@@ -324,7 +324,7 @@ |
||
| 324 | 324 | |
| 325 | 325 | if(!empty($show_in_arr )){
|
| 326 | 326 | $show_in_arr = implode(',',$show_in_arr);
|
| 327 | - }else{
|
|
| 327 | + } else{
|
|
| 328 | 328 | $show_in_arr = ''; |
| 329 | 329 | } |
| 330 | 330 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | global $wpdb; |
| 11 | 11 | |
| 12 | -if (get_option('geodirectory' . '_db_version') != GEODIRECTORY_VERSION) {
|
|
| 12 | +if (get_option('geodirectory'.'_db_version') != GEODIRECTORY_VERSION) {
|
|
| 13 | 13 | /** |
| 14 | 14 | * Include custom database table related functions. |
| 15 | 15 | * |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | |
| 51 | - add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
|
|
| 51 | + add_action('init', 'gd_fix_cpt_rewrite_slug', 11); // this needs to be kept for a few versions
|
|
| 52 | 52 | |
| 53 | - update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
|
|
| 53 | + update_option('geodirectory'.'_db_version', GEODIRECTORY_VERSION);
|
|
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @since 1.0.0 |
| 87 | 87 | * @package GeoDirectory |
| 88 | 88 | */ |
| 89 | -function geodir_upgrade_146(){
|
|
| 89 | +function geodir_upgrade_146() {
|
|
| 90 | 90 | gd_convert_virtual_pages(); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @since 1.5.0 |
| 97 | 97 | * @package GeoDirectory |
| 98 | 98 | */ |
| 99 | -function geodir_upgrade_150(){
|
|
| 99 | +function geodir_upgrade_150() {
|
|
| 100 | 100 | gd_fix_cpt_rewrite_slug(); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -108,12 +108,12 @@ discard block |
||
| 108 | 108 | * @since 1.4.8 |
| 109 | 109 | * @package GeoDirectory |
| 110 | 110 | */ |
| 111 | -function geodir_upgrade_148(){
|
|
| 111 | +function geodir_upgrade_148() {
|
|
| 112 | 112 | /* |
| 113 | 113 | * Blank the users google password if present as we now use oAuth 2.0 |
| 114 | 114 | */ |
| 115 | - update_option('geodir_ga_pass','');
|
|
| 116 | - update_option('geodir_ga_user','');
|
|
| 115 | + update_option('geodir_ga_pass', '');
|
|
| 116 | + update_option('geodir_ga_user', '');
|
|
| 117 | 117 | |
| 118 | 118 | } |
| 119 | 119 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @since 1.5.3 |
| 125 | 125 | * @package GeoDirectory |
| 126 | 126 | */ |
| 127 | -function geodir_upgrade_153(){
|
|
| 127 | +function geodir_upgrade_153() {
|
|
| 128 | 128 | geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
|
| 129 | 129 | geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
|
| 130 | 130 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @since 1.5.3 |
| 136 | 136 | * @package GeoDirectory |
| 137 | 137 | */ |
| 138 | -function geodir_upgrade_154(){
|
|
| 138 | +function geodir_upgrade_154() {
|
|
| 139 | 139 | geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
|
| 140 | 140 | } |
| 141 | 141 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * @since 1.5.2 |
| 146 | 146 | * @package GeoDirectory |
| 147 | 147 | */ |
| 148 | -function geodir_upgrade_152(){
|
|
| 148 | +function geodir_upgrade_152() {
|
|
| 149 | 149 | gd_fix_address_detail_table_limit(); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | function geodir_fix_review_date() |
| 182 | 182 | {
|
| 183 | 183 | global $wpdb; |
| 184 | - $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
|
|
| 184 | + $wpdb->query("UPDATE ".GEODIR_REVIEW_TABLE." gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
|
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /** |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | function geodir_fix_review_post_status() |
| 195 | 195 | {
|
| 196 | 196 | global $wpdb; |
| 197 | - $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
|
|
| 197 | + $wpdb->query("UPDATE ".GEODIR_REVIEW_TABLE." gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
|
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | function geodir_fix_review_content() |
| 209 | 209 | {
|
| 210 | 210 | global $wpdb; |
| 211 | - if ($wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
|
|
| 211 | + if ($wpdb->query("UPDATE ".GEODIR_REVIEW_TABLE." gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
|
|
| 212 | 212 | return true; |
| 213 | 213 | } else {
|
| 214 | 214 | return false; |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | foreach ($all_postypes as $key) {
|
| 234 | 234 | // update each GD CTP |
| 235 | 235 | |
| 236 | - $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN " . $wpdb->prefix . "geodir_" . $key . "_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city, gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
|
|
| 236 | + $wpdb->query("UPDATE ".GEODIR_REVIEW_TABLE." gdr JOIN ".$wpdb->prefix."geodir_".$key."_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city, gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
|
|
| 237 | 237 | |
| 238 | 238 | } |
| 239 | 239 | return true; |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | if (!empty($all_postypes)) {
|
| 258 | 258 | foreach ($all_postypes as $key) {
|
| 259 | 259 | // update each GD CTP |
| 260 | - $reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
|
|
| 260 | + $reviews = $wpdb->get_results("SELECT post_id FROM ".$wpdb->prefix."geodir_".$key."_detail d");
|
|
| 261 | 261 | |
| 262 | 262 | if (!empty($reviews)) {
|
| 263 | 263 | foreach ($reviews as $post_id) {
|
@@ -272,51 +272,51 @@ discard block |
||
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | |
| 275 | -function gd_convert_custom_field_display(){
|
|
| 275 | +function gd_convert_custom_field_display() {
|
|
| 276 | 276 | global $wpdb; |
| 277 | 277 | |
| 278 | - $field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 278 | + $field_info = $wpdb->get_results("select * from ".GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 279 | 279 | |
| 280 | 280 | $has_run = get_option('gd_convert_custom_field_display');
|
| 281 | - if($has_run){return;}
|
|
| 281 | + if ($has_run) {return; }
|
|
| 282 | 282 | |
| 283 | 283 | // set the field_type_key for standard fields |
| 284 | 284 | $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET field_type_key = field_type");
|
| 285 | 285 | |
| 286 | 286 | |
| 287 | - if(is_array( $field_info)){
|
|
| 287 | + if (is_array($field_info)) {
|
|
| 288 | 288 | |
| 289 | - foreach( $field_info as $cf){
|
|
| 289 | + foreach ($field_info as $cf) {
|
|
| 290 | 290 | |
| 291 | 291 | $id = $cf->id; |
| 292 | 292 | |
| 293 | - if(!property_exists($cf,'show_in') || !$id){return;}
|
|
| 293 | + if (!property_exists($cf, 'show_in') || !$id) {return; }
|
|
| 294 | 294 | |
| 295 | 295 | $show_in_arr = array(); |
| 296 | 296 | |
| 297 | - if($cf->is_default){
|
|
| 297 | + if ($cf->is_default) {
|
|
| 298 | 298 | $show_in_arr[] = "[detail]"; |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - if($cf->show_on_detail){
|
|
| 301 | + if ($cf->show_on_detail) {
|
|
| 302 | 302 | $show_in_arr[] = "[moreinfo]"; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - if($cf->show_on_listing){
|
|
| 305 | + if ($cf->show_on_listing) {
|
|
| 306 | 306 | $show_in_arr[] = "[listing]"; |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
|
|
| 309 | + if ($cf->show_as_tab || $cf->htmlvar_name == 'geodir_video' || $cf->htmlvar_name == 'geodir_special_offers') {
|
|
| 310 | 310 | $show_in_arr[] = "[owntab]"; |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | - if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
|
|
| 313 | + if ($cf->htmlvar_name == 'post' || $cf->htmlvar_name == 'geodir_contact' || $cf->htmlvar_name == 'geodir_timing') {
|
|
| 314 | 314 | $show_in_arr[] = "[mapbubble]"; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - if(!empty($show_in_arr )){
|
|
| 318 | - $show_in_arr = implode(',',$show_in_arr);
|
|
| 319 | - }else{
|
|
| 317 | + if (!empty($show_in_arr)) {
|
|
| 318 | + $show_in_arr = implode(',', $show_in_arr);
|
|
| 319 | + } else {
|
|
| 320 | 320 | $show_in_arr = ''; |
| 321 | 321 | } |
| 322 | 322 | |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - update_option('gd_convert_custom_field_display',1);
|
|
| 327 | + update_option('gd_convert_custom_field_display', 1);
|
|
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | |
| 702 | 702 | update_option('gd_theme_compats', $theme_compat);
|
| 703 | 703 | |
| 704 | - gd_set_theme_compat();// set the compat pack if avail |
|
| 704 | + gd_set_theme_compat(); // set the compat pack if avail |
|
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | |
@@ -712,61 +712,61 @@ discard block |
||
| 712 | 712 | * @package GeoDirectory |
| 713 | 713 | * @global object $wpdb WordPress Database object. |
| 714 | 714 | */ |
| 715 | -function gd_convert_virtual_pages(){
|
|
| 715 | +function gd_convert_virtual_pages() {
|
|
| 716 | 716 | global $wpdb; |
| 717 | 717 | |
| 718 | 718 | // Update the add listing page settings |
| 719 | 719 | $add_listing_page = $wpdb->get_var( |
| 720 | 720 | $wpdb->prepare( |
| 721 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 721 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 722 | 722 | array('add-listing')
|
| 723 | 723 | ) |
| 724 | 724 | ); |
| 725 | 725 | |
| 726 | - if($add_listing_page){
|
|
| 727 | - wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
|
|
| 728 | - update_option( 'geodir_add_listing_page', $add_listing_page); |
|
| 726 | + if ($add_listing_page) {
|
|
| 727 | + wp_update_post(array('ID' => $add_listing_page, 'post_status' => 'publish'));
|
|
| 728 | + update_option('geodir_add_listing_page', $add_listing_page);
|
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | // Update the listing preview page settings |
| 732 | 732 | $listing_preview_page = $wpdb->get_var( |
| 733 | 733 | $wpdb->prepare( |
| 734 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 734 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 735 | 735 | array('listing-preview')
|
| 736 | 736 | ) |
| 737 | 737 | ); |
| 738 | 738 | |
| 739 | - if($listing_preview_page){
|
|
| 740 | - wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
|
|
| 741 | - update_option( 'geodir_preview_page', $listing_preview_page); |
|
| 739 | + if ($listing_preview_page) {
|
|
| 740 | + wp_update_post(array('ID' => $listing_preview_page, 'post_status' => 'publish'));
|
|
| 741 | + update_option('geodir_preview_page', $listing_preview_page);
|
|
| 742 | 742 | } |
| 743 | 743 | |
| 744 | 744 | // Update the listing success page settings |
| 745 | 745 | $listing_success_page = $wpdb->get_var( |
| 746 | 746 | $wpdb->prepare( |
| 747 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 747 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 748 | 748 | array('listing-success')
|
| 749 | 749 | ) |
| 750 | 750 | ); |
| 751 | 751 | |
| 752 | - if($listing_success_page){
|
|
| 753 | - wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
|
|
| 754 | - update_option( 'geodir_success_page', $listing_success_page); |
|
| 752 | + if ($listing_success_page) {
|
|
| 753 | + wp_update_post(array('ID' => $listing_success_page, 'post_status' => 'publish'));
|
|
| 754 | + update_option('geodir_success_page', $listing_success_page);
|
|
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | // Update the listing success page settings |
| 758 | 758 | $location_page = $wpdb->get_var( |
| 759 | 759 | $wpdb->prepare( |
| 760 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 760 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 761 | 761 | array('location')
|
| 762 | 762 | ) |
| 763 | 763 | ); |
| 764 | 764 | |
| 765 | - if($location_page){
|
|
| 765 | + if ($location_page) {
|
|
| 766 | 766 | $location_slug = get_option('geodir_location_prefix');
|
| 767 | - if(!$location_slug ){$location_slug = 'location';}
|
|
| 768 | - wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
|
|
| 769 | - update_option( 'geodir_location_page', $location_page); |
|
| 767 | + if (!$location_slug) {$location_slug = 'location'; }
|
|
| 768 | + wp_update_post(array('ID' => $location_page, 'post_status' => 'publish', 'post_name' => $location_slug));
|
|
| 769 | + update_option('geodir_location_page', $location_page);
|
|
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | } |
@@ -785,13 +785,13 @@ discard block |
||
| 785 | 785 | $post_types = get_option('geodir_post_types');
|
| 786 | 786 | |
| 787 | 787 | |
| 788 | - if (is_array($post_types)){
|
|
| 788 | + if (is_array($post_types)) {
|
|
| 789 | 789 | |
| 790 | 790 | foreach ($post_types as $post_type => $args) {
|
| 791 | 791 | |
| 792 | 792 | |
| 793 | - if(isset($args['rewrite']['slug'])){
|
|
| 794 | - $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
|
|
| 793 | + if (isset($args['rewrite']['slug'])) {
|
|
| 794 | + $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%", "", $args['rewrite']['slug']);
|
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | $alt_post_types[$post_type] = $args; |
@@ -799,8 +799,8 @@ discard block |
||
| 799 | 799 | } |
| 800 | 800 | } |
| 801 | 801 | |
| 802 | - if(!empty($alt_post_types)) {
|
|
| 803 | - update_option('geodir_post_types',$alt_post_types);
|
|
| 802 | + if (!empty($alt_post_types)) {
|
|
| 803 | + update_option('geodir_post_types', $alt_post_types);
|
|
| 804 | 804 | } |
| 805 | 805 | |
| 806 | 806 | |
@@ -826,9 +826,9 @@ discard block |
||
| 826 | 826 | foreach ($all_postypes as $key) {
|
| 827 | 827 | // update each GD CTP |
| 828 | 828 | try {
|
| 829 | - $wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
|
|
| 830 | - } catch(Exception $e) {
|
|
| 831 | - error_log( 'Error: ' . $e->getMessage() ); |
|
| 829 | + $wpdb->query("ALTER TABLE ".$wpdb->prefix."geodir_".$key."_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
|
|
| 830 | + } catch (Exception $e) {
|
|
| 831 | + error_log('Error: '.$e->getMessage());
|
|
| 832 | 832 | } |
| 833 | 833 | } |
| 834 | 834 | } |
@@ -10,47 +10,47 @@ discard block |
||
| 10 | 10 | global $wpdb; |
| 11 | 11 | |
| 12 | 12 | if (get_option('geodirectory' . '_db_version') != GEODIRECTORY_VERSION) {
|
| 13 | - /** |
|
| 14 | - * Include custom database table related functions. |
|
| 15 | - * |
|
| 16 | - * @since 1.0.0 |
|
| 17 | - * @package GeoDirectory |
|
| 18 | - */ |
|
| 19 | - include_once('geodirectory-admin/admin_db_install.php');
|
|
| 20 | - add_action('plugins_loaded', 'geodirectory_upgrade_all', 10);
|
|
| 21 | - if (GEODIRECTORY_VERSION <= '1.3.6') {
|
|
| 22 | - add_action('plugins_loaded', 'geodir_upgrade_136', 11);
|
|
| 23 | - } |
|
| 13 | + /** |
|
| 14 | + * Include custom database table related functions. |
|
| 15 | + * |
|
| 16 | + * @since 1.0.0 |
|
| 17 | + * @package GeoDirectory |
|
| 18 | + */ |
|
| 19 | + include_once('geodirectory-admin/admin_db_install.php');
|
|
| 20 | + add_action('plugins_loaded', 'geodirectory_upgrade_all', 10);
|
|
| 21 | + if (GEODIRECTORY_VERSION <= '1.3.6') {
|
|
| 22 | + add_action('plugins_loaded', 'geodir_upgrade_136', 11);
|
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - if (GEODIRECTORY_VERSION <= '1.4.6') {
|
|
| 26 | - add_action('init', 'geodir_upgrade_146', 11);
|
|
| 27 | - } |
|
| 25 | + if (GEODIRECTORY_VERSION <= '1.4.6') {
|
|
| 26 | + add_action('init', 'geodir_upgrade_146', 11);
|
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - if (GEODIRECTORY_VERSION <= '1.4.8') {
|
|
| 30 | - add_action('init', 'geodir_upgrade_148', 11);
|
|
| 31 | - } |
|
| 29 | + if (GEODIRECTORY_VERSION <= '1.4.8') {
|
|
| 30 | + add_action('init', 'geodir_upgrade_148', 11);
|
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - if (GEODIRECTORY_VERSION <= '1.5.0') {
|
|
| 34 | - add_action('init', 'geodir_upgrade_150', 11);
|
|
| 35 | - } |
|
| 33 | + if (GEODIRECTORY_VERSION <= '1.5.0') {
|
|
| 34 | + add_action('init', 'geodir_upgrade_150', 11);
|
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - if (GEODIRECTORY_VERSION <= '1.5.2') {
|
|
| 38 | - add_action('init', 'geodir_upgrade_152', 11);
|
|
| 39 | - } |
|
| 37 | + if (GEODIRECTORY_VERSION <= '1.5.2') {
|
|
| 38 | + add_action('init', 'geodir_upgrade_152', 11);
|
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - if (GEODIRECTORY_VERSION <= '1.5.3') {
|
|
| 42 | - add_action('init', 'geodir_upgrade_153', 11);
|
|
| 43 | - } |
|
| 41 | + if (GEODIRECTORY_VERSION <= '1.5.3') {
|
|
| 42 | + add_action('init', 'geodir_upgrade_153', 11);
|
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - if (GEODIRECTORY_VERSION <= '1.5.4') {
|
|
| 46 | - add_action('init', 'geodir_upgrade_154', 11);
|
|
| 47 | - } |
|
| 45 | + if (GEODIRECTORY_VERSION <= '1.5.4') {
|
|
| 46 | + add_action('init', 'geodir_upgrade_154', 11);
|
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | |
| 51 | - add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
|
|
| 51 | + add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
|
|
| 52 | 52 | |
| 53 | - update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
|
|
| 53 | + update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
|
|
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | |
@@ -63,10 +63,10 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | function geodirectory_upgrade_all() |
| 65 | 65 | {
|
| 66 | - geodir_create_tables(); |
|
| 67 | - geodir_update_review_db(); |
|
| 68 | - gd_install_theme_compat(); |
|
| 69 | - gd_convert_custom_field_display(); |
|
| 66 | + geodir_create_tables(); |
|
| 67 | + geodir_update_review_db(); |
|
| 68 | + gd_install_theme_compat(); |
|
| 69 | + gd_convert_custom_field_display(); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | function geodir_upgrade_136() |
| 79 | 79 | {
|
| 80 | - geodir_fix_review_overall_rating(); |
|
| 80 | + geodir_fix_review_overall_rating(); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @package GeoDirectory |
| 88 | 88 | */ |
| 89 | 89 | function geodir_upgrade_146(){
|
| 90 | - gd_convert_virtual_pages(); |
|
| 90 | + gd_convert_virtual_pages(); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @package GeoDirectory |
| 98 | 98 | */ |
| 99 | 99 | function geodir_upgrade_150(){
|
| 100 | - gd_fix_cpt_rewrite_slug(); |
|
| 100 | + gd_fix_cpt_rewrite_slug(); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | * @package GeoDirectory |
| 110 | 110 | */ |
| 111 | 111 | function geodir_upgrade_148(){
|
| 112 | - /* |
|
| 112 | + /* |
|
| 113 | 113 | * Blank the users google password if present as we now use oAuth 2.0 |
| 114 | 114 | */ |
| 115 | - update_option('geodir_ga_pass','');
|
|
| 116 | - update_option('geodir_ga_user','');
|
|
| 115 | + update_option('geodir_ga_pass','');
|
|
| 116 | + update_option('geodir_ga_user','');
|
|
| 117 | 117 | |
| 118 | 118 | } |
| 119 | 119 | |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | * @package GeoDirectory |
| 126 | 126 | */ |
| 127 | 127 | function geodir_upgrade_153(){
|
| 128 | - geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
|
|
| 129 | - geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
|
|
| 128 | + geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
|
|
| 129 | + geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
|
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @package GeoDirectory |
| 137 | 137 | */ |
| 138 | 138 | function geodir_upgrade_154(){
|
| 139 | - geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
|
|
| 139 | + geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
|
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @package GeoDirectory |
| 147 | 147 | */ |
| 148 | 148 | function geodir_upgrade_152(){
|
| 149 | - gd_fix_address_detail_table_limit(); |
|
| 149 | + gd_fix_address_detail_table_limit(); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -162,12 +162,12 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | function geodir_update_review_db() |
| 164 | 164 | {
|
| 165 | - global $wpdb, $plugin_prefix; |
|
| 165 | + global $wpdb, $plugin_prefix; |
|
| 166 | 166 | |
| 167 | - geodir_fix_review_date(); |
|
| 168 | - geodir_fix_review_post_status(); |
|
| 169 | - geodir_fix_review_content(); |
|
| 170 | - geodir_fix_review_location(); |
|
| 167 | + geodir_fix_review_date(); |
|
| 168 | + geodir_fix_review_post_status(); |
|
| 169 | + geodir_fix_review_content(); |
|
| 170 | + geodir_fix_review_location(); |
|
| 171 | 171 | |
| 172 | 172 | } |
| 173 | 173 | |
@@ -180,8 +180,8 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | function geodir_fix_review_date() |
| 182 | 182 | {
|
| 183 | - global $wpdb; |
|
| 184 | - $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
|
|
| 183 | + global $wpdb; |
|
| 184 | + $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
|
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /** |
@@ -193,8 +193,8 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | function geodir_fix_review_post_status() |
| 195 | 195 | {
|
| 196 | - global $wpdb; |
|
| 197 | - $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
|
|
| 196 | + global $wpdb; |
|
| 197 | + $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
|
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -207,12 +207,12 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | function geodir_fix_review_content() |
| 209 | 209 | {
|
| 210 | - global $wpdb; |
|
| 211 | - if ($wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
|
|
| 212 | - return true; |
|
| 213 | - } else {
|
|
| 214 | - return false; |
|
| 215 | - } |
|
| 210 | + global $wpdb; |
|
| 211 | + if ($wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
|
|
| 212 | + return true; |
|
| 213 | + } else {
|
|
| 214 | + return false; |
|
| 215 | + } |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
@@ -225,20 +225,20 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | function geodir_fix_review_location() |
| 227 | 227 | {
|
| 228 | - global $wpdb; |
|
| 228 | + global $wpdb; |
|
| 229 | 229 | |
| 230 | - $all_postypes = geodir_get_posttypes(); |
|
| 230 | + $all_postypes = geodir_get_posttypes(); |
|
| 231 | 231 | |
| 232 | - if (!empty($all_postypes)) {
|
|
| 233 | - foreach ($all_postypes as $key) {
|
|
| 234 | - // update each GD CTP |
|
| 232 | + if (!empty($all_postypes)) {
|
|
| 233 | + foreach ($all_postypes as $key) {
|
|
| 234 | + // update each GD CTP |
|
| 235 | 235 | |
| 236 | - $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN " . $wpdb->prefix . "geodir_" . $key . "_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city, gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
|
|
| 236 | + $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN " . $wpdb->prefix . "geodir_" . $key . "_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city, gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
|
|
| 237 | 237 | |
| 238 | - } |
|
| 239 | - return true; |
|
| 240 | - } |
|
| 241 | - return false; |
|
| 238 | + } |
|
| 239 | + return true; |
|
| 240 | + } |
|
| 241 | + return false; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -250,82 +250,82 @@ discard block |
||
| 250 | 250 | */ |
| 251 | 251 | function geodir_fix_review_overall_rating() |
| 252 | 252 | {
|
| 253 | - global $wpdb; |
|
| 253 | + global $wpdb; |
|
| 254 | 254 | |
| 255 | - $all_postypes = geodir_get_posttypes(); |
|
| 255 | + $all_postypes = geodir_get_posttypes(); |
|
| 256 | 256 | |
| 257 | - if (!empty($all_postypes)) {
|
|
| 258 | - foreach ($all_postypes as $key) {
|
|
| 259 | - // update each GD CTP |
|
| 260 | - $reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
|
|
| 257 | + if (!empty($all_postypes)) {
|
|
| 258 | + foreach ($all_postypes as $key) {
|
|
| 259 | + // update each GD CTP |
|
| 260 | + $reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
|
|
| 261 | 261 | |
| 262 | - if (!empty($reviews)) {
|
|
| 263 | - foreach ($reviews as $post_id) {
|
|
| 264 | - geodir_update_postrating($post_id->post_id, $key); |
|
| 265 | - } |
|
| 262 | + if (!empty($reviews)) {
|
|
| 263 | + foreach ($reviews as $post_id) {
|
|
| 264 | + geodir_update_postrating($post_id->post_id, $key); |
|
| 265 | + } |
|
| 266 | 266 | |
| 267 | - } |
|
| 267 | + } |
|
| 268 | 268 | |
| 269 | - } |
|
| 269 | + } |
|
| 270 | 270 | |
| 271 | - } |
|
| 271 | + } |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | |
| 275 | 275 | function gd_convert_custom_field_display(){
|
| 276 | - global $wpdb; |
|
| 276 | + global $wpdb; |
|
| 277 | 277 | |
| 278 | - $field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 278 | + $field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 279 | 279 | |
| 280 | - $has_run = get_option('gd_convert_custom_field_display');
|
|
| 281 | - if($has_run){return;}
|
|
| 280 | + $has_run = get_option('gd_convert_custom_field_display');
|
|
| 281 | + if($has_run){return;}
|
|
| 282 | 282 | |
| 283 | - // set the field_type_key for standard fields |
|
| 284 | - $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET field_type_key = field_type");
|
|
| 283 | + // set the field_type_key for standard fields |
|
| 284 | + $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET field_type_key = field_type");
|
|
| 285 | 285 | |
| 286 | 286 | |
| 287 | - if(is_array( $field_info)){
|
|
| 287 | + if(is_array( $field_info)){
|
|
| 288 | 288 | |
| 289 | - foreach( $field_info as $cf){
|
|
| 289 | + foreach( $field_info as $cf){
|
|
| 290 | 290 | |
| 291 | - $id = $cf->id; |
|
| 291 | + $id = $cf->id; |
|
| 292 | 292 | |
| 293 | - if(!property_exists($cf,'show_in') || !$id){return;}
|
|
| 293 | + if(!property_exists($cf,'show_in') || !$id){return;}
|
|
| 294 | 294 | |
| 295 | - $show_in_arr = array(); |
|
| 295 | + $show_in_arr = array(); |
|
| 296 | 296 | |
| 297 | - if($cf->is_default){
|
|
| 298 | - $show_in_arr[] = "[detail]"; |
|
| 299 | - } |
|
| 297 | + if($cf->is_default){
|
|
| 298 | + $show_in_arr[] = "[detail]"; |
|
| 299 | + } |
|
| 300 | 300 | |
| 301 | - if($cf->show_on_detail){
|
|
| 302 | - $show_in_arr[] = "[moreinfo]"; |
|
| 303 | - } |
|
| 301 | + if($cf->show_on_detail){
|
|
| 302 | + $show_in_arr[] = "[moreinfo]"; |
|
| 303 | + } |
|
| 304 | 304 | |
| 305 | - if($cf->show_on_listing){
|
|
| 306 | - $show_in_arr[] = "[listing]"; |
|
| 307 | - } |
|
| 305 | + if($cf->show_on_listing){
|
|
| 306 | + $show_in_arr[] = "[listing]"; |
|
| 307 | + } |
|
| 308 | 308 | |
| 309 | - if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
|
|
| 310 | - $show_in_arr[] = "[owntab]"; |
|
| 311 | - } |
|
| 309 | + if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
|
|
| 310 | + $show_in_arr[] = "[owntab]"; |
|
| 311 | + } |
|
| 312 | 312 | |
| 313 | - if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
|
|
| 314 | - $show_in_arr[] = "[mapbubble]"; |
|
| 315 | - } |
|
| 313 | + if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
|
|
| 314 | + $show_in_arr[] = "[mapbubble]"; |
|
| 315 | + } |
|
| 316 | 316 | |
| 317 | - if(!empty($show_in_arr )){
|
|
| 318 | - $show_in_arr = implode(',',$show_in_arr);
|
|
| 319 | - }else{
|
|
| 320 | - $show_in_arr = ''; |
|
| 321 | - } |
|
| 317 | + if(!empty($show_in_arr )){
|
|
| 318 | + $show_in_arr = implode(',',$show_in_arr);
|
|
| 319 | + }else{
|
|
| 320 | + $show_in_arr = ''; |
|
| 321 | + } |
|
| 322 | 322 | |
| 323 | - $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET show_in='$show_in_arr' WHERE id=$id");
|
|
| 323 | + $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET show_in='$show_in_arr' WHERE id=$id");
|
|
| 324 | 324 | |
| 325 | - } |
|
| 325 | + } |
|
| 326 | 326 | |
| 327 | - update_option('gd_convert_custom_field_display',1);
|
|
| 328 | - } |
|
| 327 | + update_option('gd_convert_custom_field_display',1);
|
|
| 328 | + } |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | ############################################ |
@@ -341,384 +341,384 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | function gd_install_theme_compat() |
| 343 | 343 | {
|
| 344 | - global $wpdb; |
|
| 344 | + global $wpdb; |
|
| 345 | 345 | |
| 346 | - $theme_compat = array(); |
|
| 347 | - $theme_compat = get_option('gd_theme_compats');
|
|
| 346 | + $theme_compat = array(); |
|
| 347 | + $theme_compat = get_option('gd_theme_compats');
|
|
| 348 | 348 | //GDF |
| 349 | - $theme_compat['GeoDirectory_Framework'] = array( |
|
| 350 | - 'geodir_wrapper_open_id' => 'geodir_wrapper', |
|
| 351 | - 'geodir_wrapper_open_class' => '', |
|
| 352 | - 'geodir_wrapper_open_replace' => '', |
|
| 353 | - 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 354 | - 'geodir_wrapper_content_open_id' => 'geodir_content', |
|
| 355 | - 'geodir_wrapper_content_open_class' => '', |
|
| 356 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 357 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 358 | - 'geodir_article_open_id' => '', |
|
| 359 | - 'geodir_article_open_class' => '', |
|
| 360 | - 'geodir_article_open_replace' => '', |
|
| 361 | - 'geodir_article_close_replace' => '', |
|
| 362 | - 'geodir_sidebar_right_open_id' => '', |
|
| 363 | - 'geodir_sidebar_right_open_class' => '', |
|
| 364 | - 'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 365 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 366 | - 'geodir_sidebar_left_open_id' => '', |
|
| 367 | - 'geodir_sidebar_left_open_class' => '', |
|
| 368 | - 'geodir_sidebar_left_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 369 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 370 | - 'geodir_main_content_open_id' => '', |
|
| 371 | - 'geodir_main_content_open_class' => '', |
|
| 372 | - 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 373 | - 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 374 | - 'geodir_top_content_add' => '', |
|
| 375 | - 'geodir_before_main_content_add' => '<div class="clearfix geodir-common">', |
|
| 376 | - 'geodir_before_widget_filter' => '', |
|
| 377 | - 'geodir_after_widget_filter' => '', |
|
| 378 | - 'geodir_theme_compat_css' => '', |
|
| 379 | - 'geodir_theme_compat_js' => '', |
|
| 380 | - 'geodir_theme_compat_default_options' => '', |
|
| 381 | - 'geodir_theme_compat_code' => '' |
|
| 382 | - ); |
|
| 349 | + $theme_compat['GeoDirectory_Framework'] = array( |
|
| 350 | + 'geodir_wrapper_open_id' => 'geodir_wrapper', |
|
| 351 | + 'geodir_wrapper_open_class' => '', |
|
| 352 | + 'geodir_wrapper_open_replace' => '', |
|
| 353 | + 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 354 | + 'geodir_wrapper_content_open_id' => 'geodir_content', |
|
| 355 | + 'geodir_wrapper_content_open_class' => '', |
|
| 356 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 357 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 358 | + 'geodir_article_open_id' => '', |
|
| 359 | + 'geodir_article_open_class' => '', |
|
| 360 | + 'geodir_article_open_replace' => '', |
|
| 361 | + 'geodir_article_close_replace' => '', |
|
| 362 | + 'geodir_sidebar_right_open_id' => '', |
|
| 363 | + 'geodir_sidebar_right_open_class' => '', |
|
| 364 | + 'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 365 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 366 | + 'geodir_sidebar_left_open_id' => '', |
|
| 367 | + 'geodir_sidebar_left_open_class' => '', |
|
| 368 | + 'geodir_sidebar_left_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 369 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 370 | + 'geodir_main_content_open_id' => '', |
|
| 371 | + 'geodir_main_content_open_class' => '', |
|
| 372 | + 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 373 | + 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 374 | + 'geodir_top_content_add' => '', |
|
| 375 | + 'geodir_before_main_content_add' => '<div class="clearfix geodir-common">', |
|
| 376 | + 'geodir_before_widget_filter' => '', |
|
| 377 | + 'geodir_after_widget_filter' => '', |
|
| 378 | + 'geodir_theme_compat_css' => '', |
|
| 379 | + 'geodir_theme_compat_js' => '', |
|
| 380 | + 'geodir_theme_compat_default_options' => '', |
|
| 381 | + 'geodir_theme_compat_code' => '' |
|
| 382 | + ); |
|
| 383 | 383 | |
| 384 | 384 | //Directory Theme |
| 385 | - $theme_compat['Directory_Starter'] = array( |
|
| 386 | - 'geodir_wrapper_open_id' => 'geodir_wrapper', |
|
| 387 | - 'geodir_wrapper_open_class' => '', |
|
| 388 | - 'geodir_wrapper_open_replace' => '', |
|
| 389 | - 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 390 | - 'geodir_wrapper_content_open_id' => 'geodir_content', |
|
| 391 | - 'geodir_wrapper_content_open_class' => '', |
|
| 392 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 393 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 394 | - 'geodir_article_open_id' => '', |
|
| 395 | - 'geodir_article_open_class' => '', |
|
| 396 | - 'geodir_article_open_replace' => '', |
|
| 397 | - 'geodir_article_close_replace' => '', |
|
| 398 | - 'geodir_sidebar_right_open_id' => '', |
|
| 399 | - 'geodir_sidebar_right_open_class' => '', |
|
| 400 | - 'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 401 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 402 | - 'geodir_sidebar_left_open_id' => '', |
|
| 403 | - 'geodir_sidebar_left_open_class' => '', |
|
| 404 | - 'geodir_sidebar_left_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 405 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 406 | - 'geodir_main_content_open_id' => '', |
|
| 407 | - 'geodir_main_content_open_class' => '', |
|
| 408 | - 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 409 | - 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 410 | - 'geodir_top_content_add' => '', |
|
| 411 | - 'geodir_before_main_content_add' => '<div class="clearfix geodir-common">', |
|
| 412 | - 'geodir_before_widget_filter' => '', |
|
| 413 | - 'geodir_after_widget_filter' => '', |
|
| 414 | - 'geodir_theme_compat_css' => '', |
|
| 415 | - 'geodir_theme_compat_js' => '', |
|
| 416 | - 'geodir_theme_compat_default_options' => '', |
|
| 417 | - 'geodir_theme_compat_code' => '' |
|
| 418 | - ); |
|
| 385 | + $theme_compat['Directory_Starter'] = array( |
|
| 386 | + 'geodir_wrapper_open_id' => 'geodir_wrapper', |
|
| 387 | + 'geodir_wrapper_open_class' => '', |
|
| 388 | + 'geodir_wrapper_open_replace' => '', |
|
| 389 | + 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 390 | + 'geodir_wrapper_content_open_id' => 'geodir_content', |
|
| 391 | + 'geodir_wrapper_content_open_class' => '', |
|
| 392 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 393 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 394 | + 'geodir_article_open_id' => '', |
|
| 395 | + 'geodir_article_open_class' => '', |
|
| 396 | + 'geodir_article_open_replace' => '', |
|
| 397 | + 'geodir_article_close_replace' => '', |
|
| 398 | + 'geodir_sidebar_right_open_id' => '', |
|
| 399 | + 'geodir_sidebar_right_open_class' => '', |
|
| 400 | + 'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 401 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 402 | + 'geodir_sidebar_left_open_id' => '', |
|
| 403 | + 'geodir_sidebar_left_open_class' => '', |
|
| 404 | + 'geodir_sidebar_left_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 405 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 406 | + 'geodir_main_content_open_id' => '', |
|
| 407 | + 'geodir_main_content_open_class' => '', |
|
| 408 | + 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 409 | + 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 410 | + 'geodir_top_content_add' => '', |
|
| 411 | + 'geodir_before_main_content_add' => '<div class="clearfix geodir-common">', |
|
| 412 | + 'geodir_before_widget_filter' => '', |
|
| 413 | + 'geodir_after_widget_filter' => '', |
|
| 414 | + 'geodir_theme_compat_css' => '', |
|
| 415 | + 'geodir_theme_compat_js' => '', |
|
| 416 | + 'geodir_theme_compat_default_options' => '', |
|
| 417 | + 'geodir_theme_compat_code' => '' |
|
| 418 | + ); |
|
| 419 | 419 | |
| 420 | 420 | //Jobby |
| 421 | - $theme_compat['Jobby'] = $theme_compat['Directory_Starter']; |
|
| 421 | + $theme_compat['Jobby'] = $theme_compat['Directory_Starter']; |
|
| 422 | 422 | |
| 423 | 423 | //GeoProperty |
| 424 | - $theme_compat['GeoProperty'] = $theme_compat['Directory_Starter']; |
|
| 424 | + $theme_compat['GeoProperty'] = $theme_compat['Directory_Starter']; |
|
| 425 | 425 | |
| 426 | 426 | //Avada |
| 427 | - $theme_compat['Avada'] = array( |
|
| 428 | - 'geodir_wrapper_open_id' => '', |
|
| 429 | - 'geodir_wrapper_open_class' => '', |
|
| 430 | - 'geodir_wrapper_open_replace' => '<!-- removed -->', |
|
| 431 | - 'geodir_wrapper_close_replace' => '<!-- removed -->', |
|
| 432 | - 'geodir_wrapper_content_open_id' => 'content', |
|
| 433 | - 'geodir_wrapper_content_open_class' => '', |
|
| 434 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 435 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 436 | - 'geodir_article_open_id' => '', |
|
| 437 | - 'geodir_article_open_class' => '', |
|
| 438 | - 'geodir_article_open_replace' => '', |
|
| 439 | - 'geodir_article_close_replace' => '', |
|
| 440 | - 'geodir_sidebar_right_open_id' => '', |
|
| 441 | - 'geodir_sidebar_right_open_class' => '', |
|
| 442 | - 'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 443 | - 'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->', |
|
| 444 | - 'geodir_sidebar_left_open_id' => '', |
|
| 445 | - 'geodir_sidebar_left_open_class' => '', |
|
| 446 | - 'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 447 | - 'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->', |
|
| 448 | - 'geodir_main_content_open_id' => '', |
|
| 449 | - 'geodir_main_content_open_class' => '', |
|
| 450 | - 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 451 | - 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 452 | - 'geodir_top_content_add' => '', |
|
| 453 | - 'geodir_before_main_content_add' => '', |
|
| 454 | - 'geodir_before_widget_filter' => '', |
|
| 455 | - 'geodir_after_widget_filter' => '', |
|
| 456 | - 'geodir_theme_compat_css' => stripslashes('.geodir-sidebar-left{float:left}select,textarea{border-style:solid;border-width:1px}.top-menu li > div{visibility:visible}.geodir-chosen-container-single .chosen-single{height:auto}ul li#menu-item-gd-location-switcher ul{width:222px}ul li#menu-item-gd-location-switcher ul li{padding-right:0!important}#mobile-nav li#mobile-menu-item-gd-location-switcher li a{padding-left:10px;padding-right:10px}#menu-item-gd-location-switcher dd,#mobile-menu-item-gd-location-switcher{margin-left:0}#menu-item-gd-location-switcher dd a{display:block}.geodir-chosen-container .chosen-results li.highlighted{background-color:#eee;background-image:none;color:#444}#mobile-nav li.mobile-nav-item li a:before{content:\'\';margin:0}#mobile-nav li.mobile-nav-item li a{padding:10px;width:auto}.geodir-listing-search{text-align:center}.geodir-search{float:none;margin:0}.geodir-search select,.geodir-search .search_by_post,.geodir-search input[type="text"],.geodir-search button[type="button"], .geodir-search input[type="button"],.geodir-search input[type="submit"]{display:inline-block;float:none}.geodir-cat-list ul li,.map_category ul li{list-style-type:none}.wpgeo-avada .page-title ul li:after{content:\'\'}.top_banner_section{margin-bottom:0}.geodir-category-list-in{margin:0;padding:15px}.geodir_full_page .geodir-cat-list .widget-title{margin-top:0}.geodir_full_page .geodir-cat-list ul li{padding-left:0}.geodir-loc-bar{border:none;margin:0;padding:0}.geodir-loc-bar-in{padding:15px 0}.geodir_full_page section.widget{margin-bottom:20px}.sidebar .geodir-loginbox-list li{margin-bottom:10px;padding-bottom:10px}.sidebar .geodir-loginbox-list li a{display:block}.sidebar .geodir-chosen-container .chosen-results li{margin:0;padding:5px 6px}.sidebar .geodir-chosen-container .chosen-results li.highlighted{background:#eee;background-image:none;color:#000}.sidebar .geodir_category_list_view li.geodir-gridview{display:inline-block;margin-bottom:15px}.wpgeo-avada.double-sidebars #main #sidebar{margin-left:3%}.wpgeo-avada.double-sidebars #main #sidebar-2{margin-left:-100%}.wpgeo-avada.double-sidebars #content{float:left;margin-left:0}.geodir_full_page section.widget{margin-bottom: 0px;} .sidebar .widget .geodir-hide {display: none;}li.fusion-mobile-nav-item .geodir_location_tab_container a:before{content: "" !important; margin-right: auto !important;}li.fusion-mobile-nav-item .geodir_location_tab_container a{padding-left:5px !important;}'),
|
|
| 457 | - 'geodir_theme_compat_js' => '', |
|
| 458 | - 'geodir_theme_compat_default_options' => '', |
|
| 459 | - 'geodir_theme_compat_code' => 'Avada' |
|
| 460 | - ); |
|
| 427 | + $theme_compat['Avada'] = array( |
|
| 428 | + 'geodir_wrapper_open_id' => '', |
|
| 429 | + 'geodir_wrapper_open_class' => '', |
|
| 430 | + 'geodir_wrapper_open_replace' => '<!-- removed -->', |
|
| 431 | + 'geodir_wrapper_close_replace' => '<!-- removed -->', |
|
| 432 | + 'geodir_wrapper_content_open_id' => 'content', |
|
| 433 | + 'geodir_wrapper_content_open_class' => '', |
|
| 434 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 435 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 436 | + 'geodir_article_open_id' => '', |
|
| 437 | + 'geodir_article_open_class' => '', |
|
| 438 | + 'geodir_article_open_replace' => '', |
|
| 439 | + 'geodir_article_close_replace' => '', |
|
| 440 | + 'geodir_sidebar_right_open_id' => '', |
|
| 441 | + 'geodir_sidebar_right_open_class' => '', |
|
| 442 | + 'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 443 | + 'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->', |
|
| 444 | + 'geodir_sidebar_left_open_id' => '', |
|
| 445 | + 'geodir_sidebar_left_open_class' => '', |
|
| 446 | + 'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 447 | + 'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->', |
|
| 448 | + 'geodir_main_content_open_id' => '', |
|
| 449 | + 'geodir_main_content_open_class' => '', |
|
| 450 | + 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 451 | + 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 452 | + 'geodir_top_content_add' => '', |
|
| 453 | + 'geodir_before_main_content_add' => '', |
|
| 454 | + 'geodir_before_widget_filter' => '', |
|
| 455 | + 'geodir_after_widget_filter' => '', |
|
| 456 | + 'geodir_theme_compat_css' => stripslashes('.geodir-sidebar-left{float:left}select,textarea{border-style:solid;border-width:1px}.top-menu li > div{visibility:visible}.geodir-chosen-container-single .chosen-single{height:auto}ul li#menu-item-gd-location-switcher ul{width:222px}ul li#menu-item-gd-location-switcher ul li{padding-right:0!important}#mobile-nav li#mobile-menu-item-gd-location-switcher li a{padding-left:10px;padding-right:10px}#menu-item-gd-location-switcher dd,#mobile-menu-item-gd-location-switcher{margin-left:0}#menu-item-gd-location-switcher dd a{display:block}.geodir-chosen-container .chosen-results li.highlighted{background-color:#eee;background-image:none;color:#444}#mobile-nav li.mobile-nav-item li a:before{content:\'\';margin:0}#mobile-nav li.mobile-nav-item li a{padding:10px;width:auto}.geodir-listing-search{text-align:center}.geodir-search{float:none;margin:0}.geodir-search select,.geodir-search .search_by_post,.geodir-search input[type="text"],.geodir-search button[type="button"], .geodir-search input[type="button"],.geodir-search input[type="submit"]{display:inline-block;float:none}.geodir-cat-list ul li,.map_category ul li{list-style-type:none}.wpgeo-avada .page-title ul li:after{content:\'\'}.top_banner_section{margin-bottom:0}.geodir-category-list-in{margin:0;padding:15px}.geodir_full_page .geodir-cat-list .widget-title{margin-top:0}.geodir_full_page .geodir-cat-list ul li{padding-left:0}.geodir-loc-bar{border:none;margin:0;padding:0}.geodir-loc-bar-in{padding:15px 0}.geodir_full_page section.widget{margin-bottom:20px}.sidebar .geodir-loginbox-list li{margin-bottom:10px;padding-bottom:10px}.sidebar .geodir-loginbox-list li a{display:block}.sidebar .geodir-chosen-container .chosen-results li{margin:0;padding:5px 6px}.sidebar .geodir-chosen-container .chosen-results li.highlighted{background:#eee;background-image:none;color:#000}.sidebar .geodir_category_list_view li.geodir-gridview{display:inline-block;margin-bottom:15px}.wpgeo-avada.double-sidebars #main #sidebar{margin-left:3%}.wpgeo-avada.double-sidebars #main #sidebar-2{margin-left:-100%}.wpgeo-avada.double-sidebars #content{float:left;margin-left:0}.geodir_full_page section.widget{margin-bottom: 0px;} .sidebar .widget .geodir-hide {display: none;}li.fusion-mobile-nav-item .geodir_location_tab_container a:before{content: "" !important; margin-right: auto !important;}li.fusion-mobile-nav-item .geodir_location_tab_container a{padding-left:5px !important;}'),
|
|
| 457 | + 'geodir_theme_compat_js' => '', |
|
| 458 | + 'geodir_theme_compat_default_options' => '', |
|
| 459 | + 'geodir_theme_compat_code' => 'Avada' |
|
| 460 | + ); |
|
| 461 | 461 | |
| 462 | 462 | //Enfold |
| 463 | - $theme_compat['Enfold'] = array( |
|
| 464 | - 'geodir_wrapper_open_id' => '', |
|
| 465 | - 'geodir_wrapper_open_class' => '', |
|
| 466 | - 'geodir_wrapper_open_replace' => '', |
|
| 467 | - 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 468 | - 'geodir_wrapper_content_open_id' => '', |
|
| 469 | - 'geodir_wrapper_content_open_class' => '', |
|
| 470 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 471 | - 'geodir_wrapper_content_close_replace' => '</div></main>', |
|
| 472 | - 'geodir_article_open_id' => '', |
|
| 473 | - 'geodir_article_open_class' => '', |
|
| 474 | - 'geodir_article_open_replace' => '', |
|
| 475 | - 'geodir_article_close_replace' => '', |
|
| 476 | - 'geodir_sidebar_right_open_id' => '', |
|
| 477 | - 'geodir_sidebar_right_open_class' => '', |
|
| 478 | - 'geodir_sidebar_right_open_replace' => '', |
|
| 479 | - 'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->', |
|
| 480 | - 'geodir_sidebar_left_open_id' => '', |
|
| 481 | - 'geodir_sidebar_left_open_class' => '', |
|
| 482 | - 'geodir_sidebar_left_open_replace' => '', |
|
| 483 | - 'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->', |
|
| 484 | - 'geodir_main_content_open_id' => '', |
|
| 485 | - 'geodir_main_content_open_class' => '', |
|
| 486 | - 'geodir_main_content_open_replace' => '', |
|
| 487 | - 'geodir_main_content_close_replace' => '', |
|
| 488 | - 'geodir_top_content_add' => '', |
|
| 489 | - 'geodir_before_main_content_add' => '', |
|
| 490 | - 'geodir_before_widget_filter' => '', |
|
| 491 | - 'geodir_after_widget_filter' => '', |
|
| 492 | - 'geodir_theme_compat_css' => stripslashes('.geodir_full_page .top_banner_section{margin-bottom:0}.widget .geodir-cat-list ul li{clear:none}.wpgeo-enfold .av-main-nav ul{width:222px}.geodir-listing-search .geodir-loc-bar{border-top:none;padding:0}#main .geodir-listing-search,.geodir-listing-search .geodir-loc-bar{margin-bottom:0}#main .geodir-loc-bar-in,#main .geodir-category-list-in{background-color:#fcfcfc;margin:20px 0;padding:20px}#main .geodir_full_page .geodir-loc-bar-in,#main .geodir_full_page .geodir-loc-bar,#main .geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}#main .geodir-loc-bar-in{padding:20px}#main .geodir-search{margin:0;width:100%}#main .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#main .geodir-search input[type="text"]{margin:0 3% 0 0;padding:10px;width:32.4%}#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"]{font-size:inherit;line-height:2.25;margin:0;padding:7px;width:13%}.enfold-home-top section.widget{margin:0;padding:0}.enfold-home-top .top_banner_section{margin-bottom:0}.enfold-home-top .geodir-loc-bar{background:#fcfcfc;border:none;margin:0;padding:0}#main .enfold-home-top .geodir-loc-bar-in{background:none;border:none;margin:0 auto;padding:20px 0}#main .geodir-breadcrumb{border-bottom-style:solid;border-bottom-width:1px}#gd-tabs dt{clear:none}#geodir_slider ul li{list-style-type:none;margin:0;padding:0}#respond{clear:both}#comments .comments-title span{display:inline;font-size:inherit;font-weight:700}#reviewsTab .comments-area .bypostauthor cite span{display:inline}#top #comments .commentlist .comment,#top #comments .commentlist .comment > div{min-height:0}.commentlist .commenttext{padding-top:15px}#comment_imagesdropbox{margin-bottom:20px}.wpgeo-enfold .geodir_category_list_view li{margin-left:0;padding:0}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_category_list_view li .geodir-post-img{display:block}.wpgeo-enfold .geodir_event_listing_calendar tr.title{background:#ccc}@media only screen and (max-width:480px){.geodir_category_list_view li .geodir-content,.geodir_category_list_view li .geodir-post-img,.geodir_category_list_view li .geodir-addinfo{float:none;width:100%;margin:10px 0}#main .geodir-search input[type="text"],#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"],#main .geodir-search select{margin:10px 0;width:100%}}#main .geodir_full_page section:last-child .geodir-loc-bar{margin-bottom: -1px;border-bottom: none;}'),
|
|
| 493 | - 'geodir_theme_compat_js' => '', |
|
| 494 | - 'geodir_theme_compat_default_options' => '', |
|
| 495 | - 'geodir_theme_compat_code' => 'Enfold' |
|
| 496 | - ); |
|
| 463 | + $theme_compat['Enfold'] = array( |
|
| 464 | + 'geodir_wrapper_open_id' => '', |
|
| 465 | + 'geodir_wrapper_open_class' => '', |
|
| 466 | + 'geodir_wrapper_open_replace' => '', |
|
| 467 | + 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 468 | + 'geodir_wrapper_content_open_id' => '', |
|
| 469 | + 'geodir_wrapper_content_open_class' => '', |
|
| 470 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 471 | + 'geodir_wrapper_content_close_replace' => '</div></main>', |
|
| 472 | + 'geodir_article_open_id' => '', |
|
| 473 | + 'geodir_article_open_class' => '', |
|
| 474 | + 'geodir_article_open_replace' => '', |
|
| 475 | + 'geodir_article_close_replace' => '', |
|
| 476 | + 'geodir_sidebar_right_open_id' => '', |
|
| 477 | + 'geodir_sidebar_right_open_class' => '', |
|
| 478 | + 'geodir_sidebar_right_open_replace' => '', |
|
| 479 | + 'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->', |
|
| 480 | + 'geodir_sidebar_left_open_id' => '', |
|
| 481 | + 'geodir_sidebar_left_open_class' => '', |
|
| 482 | + 'geodir_sidebar_left_open_replace' => '', |
|
| 483 | + 'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->', |
|
| 484 | + 'geodir_main_content_open_id' => '', |
|
| 485 | + 'geodir_main_content_open_class' => '', |
|
| 486 | + 'geodir_main_content_open_replace' => '', |
|
| 487 | + 'geodir_main_content_close_replace' => '', |
|
| 488 | + 'geodir_top_content_add' => '', |
|
| 489 | + 'geodir_before_main_content_add' => '', |
|
| 490 | + 'geodir_before_widget_filter' => '', |
|
| 491 | + 'geodir_after_widget_filter' => '', |
|
| 492 | + 'geodir_theme_compat_css' => stripslashes('.geodir_full_page .top_banner_section{margin-bottom:0}.widget .geodir-cat-list ul li{clear:none}.wpgeo-enfold .av-main-nav ul{width:222px}.geodir-listing-search .geodir-loc-bar{border-top:none;padding:0}#main .geodir-listing-search,.geodir-listing-search .geodir-loc-bar{margin-bottom:0}#main .geodir-loc-bar-in,#main .geodir-category-list-in{background-color:#fcfcfc;margin:20px 0;padding:20px}#main .geodir_full_page .geodir-loc-bar-in,#main .geodir_full_page .geodir-loc-bar,#main .geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}#main .geodir-loc-bar-in{padding:20px}#main .geodir-search{margin:0;width:100%}#main .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#main .geodir-search input[type="text"]{margin:0 3% 0 0;padding:10px;width:32.4%}#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"]{font-size:inherit;line-height:2.25;margin:0;padding:7px;width:13%}.enfold-home-top section.widget{margin:0;padding:0}.enfold-home-top .top_banner_section{margin-bottom:0}.enfold-home-top .geodir-loc-bar{background:#fcfcfc;border:none;margin:0;padding:0}#main .enfold-home-top .geodir-loc-bar-in{background:none;border:none;margin:0 auto;padding:20px 0}#main .geodir-breadcrumb{border-bottom-style:solid;border-bottom-width:1px}#gd-tabs dt{clear:none}#geodir_slider ul li{list-style-type:none;margin:0;padding:0}#respond{clear:both}#comments .comments-title span{display:inline;font-size:inherit;font-weight:700}#reviewsTab .comments-area .bypostauthor cite span{display:inline}#top #comments .commentlist .comment,#top #comments .commentlist .comment > div{min-height:0}.commentlist .commenttext{padding-top:15px}#comment_imagesdropbox{margin-bottom:20px}.wpgeo-enfold .geodir_category_list_view li{margin-left:0;padding:0}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_category_list_view li .geodir-post-img{display:block}.wpgeo-enfold .geodir_event_listing_calendar tr.title{background:#ccc}@media only screen and (max-width:480px){.geodir_category_list_view li .geodir-content,.geodir_category_list_view li .geodir-post-img,.geodir_category_list_view li .geodir-addinfo{float:none;width:100%;margin:10px 0}#main .geodir-search input[type="text"],#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"],#main .geodir-search select{margin:10px 0;width:100%}}#main .geodir_full_page section:last-child .geodir-loc-bar{margin-bottom: -1px;border-bottom: none;}'),
|
|
| 493 | + 'geodir_theme_compat_js' => '', |
|
| 494 | + 'geodir_theme_compat_default_options' => '', |
|
| 495 | + 'geodir_theme_compat_code' => 'Enfold' |
|
| 496 | + ); |
|
| 497 | 497 | |
| 498 | 498 | // X |
| 499 | - $theme_compat['X'] = array( |
|
| 500 | - 'geodir_wrapper_open_id' => '', |
|
| 501 | - 'geodir_wrapper_open_class' => '', |
|
| 502 | - 'geodir_wrapper_open_replace' => '', |
|
| 503 | - 'geodir_wrapper_close_replace' => '', |
|
| 504 | - 'geodir_wrapper_content_open_id' => '', |
|
| 505 | - 'geodir_wrapper_content_open_class' => '', |
|
| 506 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 507 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 508 | - 'geodir_article_open_id' => '', |
|
| 509 | - 'geodir_article_open_class' => '', |
|
| 510 | - 'geodir_article_open_replace' => '', |
|
| 511 | - 'geodir_article_close_replace' => '', |
|
| 512 | - 'geodir_sidebar_right_open_id' => '', |
|
| 513 | - 'geodir_sidebar_right_open_class' => '', |
|
| 514 | - 'geodir_sidebar_right_open_replace' => '', |
|
| 515 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 516 | - 'geodir_sidebar_left_open_id' => '', |
|
| 517 | - 'geodir_sidebar_left_open_class' => '', |
|
| 518 | - 'geodir_sidebar_left_open_replace' => '', |
|
| 519 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 520 | - 'geodir_main_content_open_id' => '', |
|
| 521 | - 'geodir_main_content_open_class' => '', |
|
| 522 | - 'geodir_main_content_open_replace' => '', |
|
| 523 | - 'geodir_main_content_close_replace' => '', |
|
| 524 | - 'geodir_top_content_add' => '', |
|
| 525 | - 'geodir_before_main_content_add' => '', |
|
| 526 | - 'geodir_before_widget_filter' => '', |
|
| 527 | - 'geodir_after_widget_filter' => '', |
|
| 528 | - 'geodir_theme_compat_css' => stripslashes('.x-colophon.bottom{clear:both}#geodir-main-content,.geodir_flex-container{margin-top:16px}.geodir-x ul{list-style:none}.widget ul.geodir_category_list_view{border:none}.geodir_category_list_view li.geodir-gridview:last-child{border-bottom:1px solid #e1e1e1}.home .x-header-landmark{display:none}.geodir-x .x-main .geodir_advance_search_widget{margin:0}.geodir-x .top_banner_section{margin-bottom:0}.geodir-loc-bar{background:rgba(0,0,0,0.05);margin:0;padding:0}.geodir-loc-bar-in{background:none;border:none;padding:10px}.geodir-search{margin:0;width:100%}.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{border:1px solid #ccc;box-shadow:none;height:auto;line-height:21px;margin:0 1% 0 0;padding:5px 10px}.widget .geodir-search select,.geodir-search input[type="text"]{width:28%}.geodir-search input[type="submit"],.geodir-search input[type="button"]{line-height:19px;margin-right:0;width:11%}.geodir-search input:hover[type="submit"],.geodir-search input:hover[type="button"]{background:#333;color:#fff}.geodir-cat-list .widget-title{margin-top:0}.geodir-x .geodir-category-list-in{background:rgba(0,0,0,0.05);border:none}.widget .geodir-cat-list ul.geodir-popular-cat-list{border:none;border-radius:0;box-shadow:none}.geodir_full_page .geodir-cat-list ul li{border:none}.geodir_full_page .geodir-cat-list ul li a{border:none}.post-type-archive .geodir-loc-bar{border:none;margin-top:20px}#menu-item-gd-location-switcher dd{margin-left:0}.geodir-chosen-container-single .chosen-single{height:auto}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_full_page section.widget{clear:both}.x-ethos .entry-title{margin-bottom:20px}.x-ethos .geodir-chosen-container-single .chosen-single{padding:0 0 0 8px}.x-ethos .widget ul li a,.x-ethos .geodir_category_list_view li{color:#333}@media only screen and (max-width:767px){.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{margin:0 0 10px;width:100%}}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-loc-bar,.geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-category-list-in{border-bottom:1px solid rgba(0,0,0,0.1)}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
|
|
| 529 | - 'geodir_theme_compat_js' => '', |
|
| 530 | - 'geodir_theme_compat_default_options' => '', |
|
| 531 | - 'geodir_theme_compat_code' => 'X' |
|
| 532 | - ); |
|
| 499 | + $theme_compat['X'] = array( |
|
| 500 | + 'geodir_wrapper_open_id' => '', |
|
| 501 | + 'geodir_wrapper_open_class' => '', |
|
| 502 | + 'geodir_wrapper_open_replace' => '', |
|
| 503 | + 'geodir_wrapper_close_replace' => '', |
|
| 504 | + 'geodir_wrapper_content_open_id' => '', |
|
| 505 | + 'geodir_wrapper_content_open_class' => '', |
|
| 506 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 507 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 508 | + 'geodir_article_open_id' => '', |
|
| 509 | + 'geodir_article_open_class' => '', |
|
| 510 | + 'geodir_article_open_replace' => '', |
|
| 511 | + 'geodir_article_close_replace' => '', |
|
| 512 | + 'geodir_sidebar_right_open_id' => '', |
|
| 513 | + 'geodir_sidebar_right_open_class' => '', |
|
| 514 | + 'geodir_sidebar_right_open_replace' => '', |
|
| 515 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 516 | + 'geodir_sidebar_left_open_id' => '', |
|
| 517 | + 'geodir_sidebar_left_open_class' => '', |
|
| 518 | + 'geodir_sidebar_left_open_replace' => '', |
|
| 519 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 520 | + 'geodir_main_content_open_id' => '', |
|
| 521 | + 'geodir_main_content_open_class' => '', |
|
| 522 | + 'geodir_main_content_open_replace' => '', |
|
| 523 | + 'geodir_main_content_close_replace' => '', |
|
| 524 | + 'geodir_top_content_add' => '', |
|
| 525 | + 'geodir_before_main_content_add' => '', |
|
| 526 | + 'geodir_before_widget_filter' => '', |
|
| 527 | + 'geodir_after_widget_filter' => '', |
|
| 528 | + 'geodir_theme_compat_css' => stripslashes('.x-colophon.bottom{clear:both}#geodir-main-content,.geodir_flex-container{margin-top:16px}.geodir-x ul{list-style:none}.widget ul.geodir_category_list_view{border:none}.geodir_category_list_view li.geodir-gridview:last-child{border-bottom:1px solid #e1e1e1}.home .x-header-landmark{display:none}.geodir-x .x-main .geodir_advance_search_widget{margin:0}.geodir-x .top_banner_section{margin-bottom:0}.geodir-loc-bar{background:rgba(0,0,0,0.05);margin:0;padding:0}.geodir-loc-bar-in{background:none;border:none;padding:10px}.geodir-search{margin:0;width:100%}.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{border:1px solid #ccc;box-shadow:none;height:auto;line-height:21px;margin:0 1% 0 0;padding:5px 10px}.widget .geodir-search select,.geodir-search input[type="text"]{width:28%}.geodir-search input[type="submit"],.geodir-search input[type="button"]{line-height:19px;margin-right:0;width:11%}.geodir-search input:hover[type="submit"],.geodir-search input:hover[type="button"]{background:#333;color:#fff}.geodir-cat-list .widget-title{margin-top:0}.geodir-x .geodir-category-list-in{background:rgba(0,0,0,0.05);border:none}.widget .geodir-cat-list ul.geodir-popular-cat-list{border:none;border-radius:0;box-shadow:none}.geodir_full_page .geodir-cat-list ul li{border:none}.geodir_full_page .geodir-cat-list ul li a{border:none}.post-type-archive .geodir-loc-bar{border:none;margin-top:20px}#menu-item-gd-location-switcher dd{margin-left:0}.geodir-chosen-container-single .chosen-single{height:auto}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_full_page section.widget{clear:both}.x-ethos .entry-title{margin-bottom:20px}.x-ethos .geodir-chosen-container-single .chosen-single{padding:0 0 0 8px}.x-ethos .widget ul li a,.x-ethos .geodir_category_list_view li{color:#333}@media only screen and (max-width:767px){.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{margin:0 0 10px;width:100%}}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-loc-bar,.geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-category-list-in{border-bottom:1px solid rgba(0,0,0,0.1)}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
|
|
| 529 | + 'geodir_theme_compat_js' => '', |
|
| 530 | + 'geodir_theme_compat_default_options' => '', |
|
| 531 | + 'geodir_theme_compat_code' => 'X' |
|
| 532 | + ); |
|
| 533 | 533 | |
| 534 | 534 | // Divi |
| 535 | - $theme_compat['Divi'] = array( |
|
| 536 | - 'geodir_wrapper_open_id' => 'main-content', |
|
| 537 | - 'geodir_wrapper_open_class' => '', |
|
| 538 | - 'geodir_wrapper_open_replace' => '', |
|
| 539 | - 'geodir_wrapper_close_replace' => '', |
|
| 540 | - 'geodir_wrapper_content_open_id' => 'left-area', |
|
| 541 | - 'geodir_wrapper_content_open_class' => '', |
|
| 542 | - 'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >', |
|
| 543 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 544 | - 'geodir_article_open_id' => '', |
|
| 545 | - 'geodir_article_open_class' => '', |
|
| 546 | - 'geodir_article_open_replace' => '', |
|
| 547 | - 'geodir_article_close_replace' => '', |
|
| 548 | - 'geodir_sidebar_right_open_id' => 'sidebar', |
|
| 549 | - 'geodir_sidebar_right_open_class' => '', |
|
| 550 | - 'geodir_sidebar_right_open_replace' => '<aside id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 551 | - 'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>', |
|
| 552 | - 'geodir_sidebar_left_open_id' => 'sidebar', |
|
| 553 | - 'geodir_sidebar_left_open_class' => '', |
|
| 554 | - 'geodir_sidebar_left_open_replace' => '<aside id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 555 | - 'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>', |
|
| 556 | - 'geodir_main_content_open_id' => '', |
|
| 557 | - 'geodir_main_content_open_class' => '', |
|
| 558 | - 'geodir_main_content_open_replace' => '', |
|
| 559 | - 'geodir_main_content_close_replace' => '', |
|
| 560 | - 'geodir_top_content_add' => '', |
|
| 561 | - 'geodir_before_main_content_add' => '', |
|
| 562 | - 'geodir_before_widget_filter' => '', |
|
| 563 | - 'geodir_after_widget_filter' => '', |
|
| 564 | - 'geodir_theme_compat_css' => stripslashes('#left-area ul.geodir-direction-nav{list-style-type:none}#sidebar .geodir-company_info{margin-left:30px}#sidebar .geodir-widget{float:none;margin:0 0 30px 30px}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.archive .entry-header,.geodir-breadcrumb{border-bottom:1px solid #e2e2e2}.archive .entry-header h1,ul#breadcrumbs{padding:0 15px;width:100%}#left-area ul.geodir_category_list_view{padding:10px 0}.nav li#menu-item-gd-location-switcher ul{width:222px}#menu-item-gd-location-switcher li.gd-location-switcher-menu-item{padding-right:0}#menu-item-gd-location-switcher dd{margin-left:0}#menu-item-gd-location-switcher .geodir_location_tab_container dd a{padding:5px;width:auto}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type=button],.geodir_full_page .geodir-search input[type=submit],.geodir_full_page .geodir-search input[type=text],.geodir_full_page .geodir-search select{display:inline-block;float:none}'),
|
|
| 565 | - 'geodir_theme_compat_js' => '', |
|
| 566 | - 'geodir_theme_compat_default_options' => '', |
|
| 567 | - 'geodir_theme_compat_code' => 'Divi' |
|
| 568 | - ); |
|
| 535 | + $theme_compat['Divi'] = array( |
|
| 536 | + 'geodir_wrapper_open_id' => 'main-content', |
|
| 537 | + 'geodir_wrapper_open_class' => '', |
|
| 538 | + 'geodir_wrapper_open_replace' => '', |
|
| 539 | + 'geodir_wrapper_close_replace' => '', |
|
| 540 | + 'geodir_wrapper_content_open_id' => 'left-area', |
|
| 541 | + 'geodir_wrapper_content_open_class' => '', |
|
| 542 | + 'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >', |
|
| 543 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 544 | + 'geodir_article_open_id' => '', |
|
| 545 | + 'geodir_article_open_class' => '', |
|
| 546 | + 'geodir_article_open_replace' => '', |
|
| 547 | + 'geodir_article_close_replace' => '', |
|
| 548 | + 'geodir_sidebar_right_open_id' => 'sidebar', |
|
| 549 | + 'geodir_sidebar_right_open_class' => '', |
|
| 550 | + 'geodir_sidebar_right_open_replace' => '<aside id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 551 | + 'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>', |
|
| 552 | + 'geodir_sidebar_left_open_id' => 'sidebar', |
|
| 553 | + 'geodir_sidebar_left_open_class' => '', |
|
| 554 | + 'geodir_sidebar_left_open_replace' => '<aside id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 555 | + 'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>', |
|
| 556 | + 'geodir_main_content_open_id' => '', |
|
| 557 | + 'geodir_main_content_open_class' => '', |
|
| 558 | + 'geodir_main_content_open_replace' => '', |
|
| 559 | + 'geodir_main_content_close_replace' => '', |
|
| 560 | + 'geodir_top_content_add' => '', |
|
| 561 | + 'geodir_before_main_content_add' => '', |
|
| 562 | + 'geodir_before_widget_filter' => '', |
|
| 563 | + 'geodir_after_widget_filter' => '', |
|
| 564 | + 'geodir_theme_compat_css' => stripslashes('#left-area ul.geodir-direction-nav{list-style-type:none}#sidebar .geodir-company_info{margin-left:30px}#sidebar .geodir-widget{float:none;margin:0 0 30px 30px}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.archive .entry-header,.geodir-breadcrumb{border-bottom:1px solid #e2e2e2}.archive .entry-header h1,ul#breadcrumbs{padding:0 15px;width:100%}#left-area ul.geodir_category_list_view{padding:10px 0}.nav li#menu-item-gd-location-switcher ul{width:222px}#menu-item-gd-location-switcher li.gd-location-switcher-menu-item{padding-right:0}#menu-item-gd-location-switcher dd{margin-left:0}#menu-item-gd-location-switcher .geodir_location_tab_container dd a{padding:5px;width:auto}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type=button],.geodir_full_page .geodir-search input[type=submit],.geodir_full_page .geodir-search input[type=text],.geodir_full_page .geodir-search select{display:inline-block;float:none}'),
|
|
| 565 | + 'geodir_theme_compat_js' => '', |
|
| 566 | + 'geodir_theme_compat_default_options' => '', |
|
| 567 | + 'geodir_theme_compat_code' => 'Divi' |
|
| 568 | + ); |
|
| 569 | 569 | |
| 570 | 570 | // Genesis |
| 571 | - $theme_compat['Genesis'] = array( |
|
| 572 | - 'geodir_wrapper_open_id' => '', |
|
| 573 | - 'geodir_wrapper_open_class' => 'content-sidebar-wrap', |
|
| 574 | - 'geodir_wrapper_open_replace' => '', |
|
| 575 | - 'geodir_wrapper_close_replace' => '', |
|
| 576 | - 'geodir_wrapper_content_open_id' => '', |
|
| 577 | - 'geodir_wrapper_content_open_class' => 'content', |
|
| 578 | - 'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >', |
|
| 579 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 580 | - 'geodir_article_open_id' => '', |
|
| 581 | - 'geodir_article_open_class' => '', |
|
| 582 | - 'geodir_article_open_replace' => '', |
|
| 583 | - 'geodir_article_close_replace' => '', |
|
| 584 | - 'geodir_sidebar_right_open_id' => '', |
|
| 585 | - 'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area', |
|
| 586 | - 'geodir_sidebar_right_open_replace' => '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">', |
|
| 587 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 588 | - 'geodir_sidebar_left_open_id' => '', |
|
| 589 | - 'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area', |
|
| 590 | - 'geodir_sidebar_left_open_replace' => '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">', |
|
| 591 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 592 | - 'geodir_main_content_open_id' => '', |
|
| 593 | - 'geodir_main_content_open_class' => '', |
|
| 594 | - 'geodir_main_content_open_replace' => '<main id="[id]" class="entry [class]" role="main">', |
|
| 595 | - 'geodir_main_content_close_replace' => '', |
|
| 596 | - 'geodir_top_content_add' => '', |
|
| 597 | - 'geodir_before_main_content_add' => '', |
|
| 598 | - 'geodir_before_widget_filter' => '', |
|
| 599 | - 'geodir_after_widget_filter' => '', |
|
| 600 | - 'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher', |
|
| 601 | - 'geodir_theme_compat_css' => stripslashes('.full-width-content #geodir-wrapper-content{width:100%}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}.content{float:left}.sidebar-content .content,.sidebar-content #geodir-wrapper-content{float:right}.sidebar .geodir-company_info{background-color:#fff;border:none}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.geodir-breadcrumb-bar{margin-bottom:-35px} .search-page .entry-title,.listings-page .entry-title{font-size: 20px;}.site-inner .geodir-breadcrumb-bar{margin-bottom:0px}'),
|
|
| 602 | - 'geodir_theme_compat_js' => '', |
|
| 603 | - 'geodir_theme_compat_default_options' => '', |
|
| 604 | - 'geodir_theme_compat_code' => 'Genesis' |
|
| 605 | - ); |
|
| 571 | + $theme_compat['Genesis'] = array( |
|
| 572 | + 'geodir_wrapper_open_id' => '', |
|
| 573 | + 'geodir_wrapper_open_class' => 'content-sidebar-wrap', |
|
| 574 | + 'geodir_wrapper_open_replace' => '', |
|
| 575 | + 'geodir_wrapper_close_replace' => '', |
|
| 576 | + 'geodir_wrapper_content_open_id' => '', |
|
| 577 | + 'geodir_wrapper_content_open_class' => 'content', |
|
| 578 | + 'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >', |
|
| 579 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 580 | + 'geodir_article_open_id' => '', |
|
| 581 | + 'geodir_article_open_class' => '', |
|
| 582 | + 'geodir_article_open_replace' => '', |
|
| 583 | + 'geodir_article_close_replace' => '', |
|
| 584 | + 'geodir_sidebar_right_open_id' => '', |
|
| 585 | + 'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area', |
|
| 586 | + 'geodir_sidebar_right_open_replace' => '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">', |
|
| 587 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 588 | + 'geodir_sidebar_left_open_id' => '', |
|
| 589 | + 'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area', |
|
| 590 | + 'geodir_sidebar_left_open_replace' => '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">', |
|
| 591 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 592 | + 'geodir_main_content_open_id' => '', |
|
| 593 | + 'geodir_main_content_open_class' => '', |
|
| 594 | + 'geodir_main_content_open_replace' => '<main id="[id]" class="entry [class]" role="main">', |
|
| 595 | + 'geodir_main_content_close_replace' => '', |
|
| 596 | + 'geodir_top_content_add' => '', |
|
| 597 | + 'geodir_before_main_content_add' => '', |
|
| 598 | + 'geodir_before_widget_filter' => '', |
|
| 599 | + 'geodir_after_widget_filter' => '', |
|
| 600 | + 'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher', |
|
| 601 | + 'geodir_theme_compat_css' => stripslashes('.full-width-content #geodir-wrapper-content{width:100%}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}.content{float:left}.sidebar-content .content,.sidebar-content #geodir-wrapper-content{float:right}.sidebar .geodir-company_info{background-color:#fff;border:none}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.geodir-breadcrumb-bar{margin-bottom:-35px} .search-page .entry-title,.listings-page .entry-title{font-size: 20px;}.site-inner .geodir-breadcrumb-bar{margin-bottom:0px}'),
|
|
| 602 | + 'geodir_theme_compat_js' => '', |
|
| 603 | + 'geodir_theme_compat_default_options' => '', |
|
| 604 | + 'geodir_theme_compat_code' => 'Genesis' |
|
| 605 | + ); |
|
| 606 | 606 | |
| 607 | 607 | // Jupiter |
| 608 | - $theme_compat['Jupiter'] = array( |
|
| 609 | - 'geodir_wrapper_open_id' => '', |
|
| 610 | - 'geodir_wrapper_open_class' => '', |
|
| 611 | - 'geodir_wrapper_open_replace' => '<div id="theme-page"><div class="mk-main-wrapper-holder"><div class="theme-page-wrapper mk-main-wrapper mk-grid vc_row-fluid">', |
|
| 612 | - 'geodir_wrapper_close_replace' => '</div></div></div>', |
|
| 613 | - 'geodir_wrapper_content_open_id' => '', |
|
| 614 | - 'geodir_wrapper_content_open_class' => '', |
|
| 615 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 616 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 617 | - 'geodir_article_open_id' => '', |
|
| 618 | - 'geodir_article_open_class' => '', |
|
| 619 | - 'geodir_article_open_replace' => '', |
|
| 620 | - 'geodir_article_close_replace' => '', |
|
| 621 | - 'geodir_sidebar_right_open_id' => 'mk-sidebar', |
|
| 622 | - 'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right', |
|
| 623 | - 'geodir_sidebar_right_open_replace' => '', |
|
| 624 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 625 | - 'geodir_sidebar_left_open_id' => 'mk-sidebar', |
|
| 626 | - 'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right', |
|
| 627 | - 'geodir_sidebar_left_open_replace' => '', |
|
| 628 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 629 | - 'geodir_main_content_open_id' => '', |
|
| 630 | - 'geodir_main_content_open_class' => '', |
|
| 631 | - 'geodir_main_content_open_replace' => '', |
|
| 632 | - 'geodir_main_content_close_replace' => '', |
|
| 633 | - 'geodir_top_content_add' => '', |
|
| 634 | - 'geodir_before_main_content_add' => '', |
|
| 635 | - 'geodir_before_widget_filter' => '', |
|
| 636 | - 'geodir_after_widget_filter' => '', |
|
| 637 | - 'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">', |
|
| 638 | - 'geodir_after_title_filter' => '', |
|
| 639 | - 'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu', |
|
| 640 | - 'geodir_sub_menu_ul_class_filter' => '', |
|
| 641 | - 'geodir_sub_menu_li_class_filter' => '', |
|
| 642 | - 'geodir_menu_a_class_filter' => 'menu-item-link', |
|
| 643 | - 'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item', |
|
| 644 | - 'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-type-social menu-item-type-social gd-location-switcher menu-item-has-children no-mega-menu', |
|
| 645 | - 'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link', |
|
| 646 | - 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
| 647 | - 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
| 648 | - 'geodir_theme_compat_css' => stripslashes('.geodir-widget li,.geodir_category_list_view li{margin:0}#theme-page h3.geodir-entry-title{font-size:14px}#menu-item-gd-location-switcher dd{line-height:44px}#menu-item-gd-location-switcher .geodir_location_sugestion{line-height:20px}.geodir_loginbox{overflow:visible}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
|
|
| 649 | - 'geodir_theme_compat_js' => '', |
|
| 650 | - 'geodir_theme_compat_default_options' => '', |
|
| 651 | - 'geodir_theme_compat_code' => 'Jupiter' |
|
| 652 | - ); |
|
| 608 | + $theme_compat['Jupiter'] = array( |
|
| 609 | + 'geodir_wrapper_open_id' => '', |
|
| 610 | + 'geodir_wrapper_open_class' => '', |
|
| 611 | + 'geodir_wrapper_open_replace' => '<div id="theme-page"><div class="mk-main-wrapper-holder"><div class="theme-page-wrapper mk-main-wrapper mk-grid vc_row-fluid">', |
|
| 612 | + 'geodir_wrapper_close_replace' => '</div></div></div>', |
|
| 613 | + 'geodir_wrapper_content_open_id' => '', |
|
| 614 | + 'geodir_wrapper_content_open_class' => '', |
|
| 615 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 616 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 617 | + 'geodir_article_open_id' => '', |
|
| 618 | + 'geodir_article_open_class' => '', |
|
| 619 | + 'geodir_article_open_replace' => '', |
|
| 620 | + 'geodir_article_close_replace' => '', |
|
| 621 | + 'geodir_sidebar_right_open_id' => 'mk-sidebar', |
|
| 622 | + 'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right', |
|
| 623 | + 'geodir_sidebar_right_open_replace' => '', |
|
| 624 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 625 | + 'geodir_sidebar_left_open_id' => 'mk-sidebar', |
|
| 626 | + 'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right', |
|
| 627 | + 'geodir_sidebar_left_open_replace' => '', |
|
| 628 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 629 | + 'geodir_main_content_open_id' => '', |
|
| 630 | + 'geodir_main_content_open_class' => '', |
|
| 631 | + 'geodir_main_content_open_replace' => '', |
|
| 632 | + 'geodir_main_content_close_replace' => '', |
|
| 633 | + 'geodir_top_content_add' => '', |
|
| 634 | + 'geodir_before_main_content_add' => '', |
|
| 635 | + 'geodir_before_widget_filter' => '', |
|
| 636 | + 'geodir_after_widget_filter' => '', |
|
| 637 | + 'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">', |
|
| 638 | + 'geodir_after_title_filter' => '', |
|
| 639 | + 'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu', |
|
| 640 | + 'geodir_sub_menu_ul_class_filter' => '', |
|
| 641 | + 'geodir_sub_menu_li_class_filter' => '', |
|
| 642 | + 'geodir_menu_a_class_filter' => 'menu-item-link', |
|
| 643 | + 'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item', |
|
| 644 | + 'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-type-social menu-item-type-social gd-location-switcher menu-item-has-children no-mega-menu', |
|
| 645 | + 'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link', |
|
| 646 | + 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
| 647 | + 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
| 648 | + 'geodir_theme_compat_css' => stripslashes('.geodir-widget li,.geodir_category_list_view li{margin:0}#theme-page h3.geodir-entry-title{font-size:14px}#menu-item-gd-location-switcher dd{line-height:44px}#menu-item-gd-location-switcher .geodir_location_sugestion{line-height:20px}.geodir_loginbox{overflow:visible}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
|
|
| 649 | + 'geodir_theme_compat_js' => '', |
|
| 650 | + 'geodir_theme_compat_default_options' => '', |
|
| 651 | + 'geodir_theme_compat_code' => 'Jupiter' |
|
| 652 | + ); |
|
| 653 | 653 | |
| 654 | 654 | // Multi News |
| 655 | - $theme_compat['Multi_News'] = array( |
|
| 656 | - 'geodir_wrapper_open_id' => '', |
|
| 657 | - 'geodir_wrapper_open_class' => 'main-container clearfix', |
|
| 658 | - 'geodir_wrapper_open_replace' => '', |
|
| 659 | - 'geodir_wrapper_close_replace' => '', |
|
| 660 | - 'geodir_wrapper_content_open_id' => '', |
|
| 661 | - 'geodir_wrapper_content_open_class' => '', |
|
| 662 | - 'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content "><div class="site-content page-wrap">', |
|
| 663 | - 'geodir_wrapper_content_close_replace' => '</div></div></div>', |
|
| 664 | - 'geodir_article_open_id' => '', |
|
| 665 | - 'geodir_article_open_class' => '', |
|
| 666 | - 'geodir_article_open_replace' => '', |
|
| 667 | - 'geodir_article_close_replace' => '', |
|
| 668 | - 'geodir_sidebar_right_open_id' => '', |
|
| 669 | - 'geodir_sidebar_right_open_class' => '', |
|
| 670 | - 'geodir_sidebar_right_open_replace' => '<aside class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 671 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 672 | - 'geodir_sidebar_left_open_id' => '', |
|
| 673 | - 'geodir_sidebar_left_open_class' => '', |
|
| 674 | - 'geodir_sidebar_left_open_replace' => '<aside class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 675 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 676 | - 'geodir_main_content_open_id' => '', |
|
| 677 | - 'geodir_main_content_open_class' => '', |
|
| 678 | - 'geodir_main_content_open_replace' => '<div class="site-content page-wrap">', |
|
| 679 | - 'geodir_main_content_close_replace' => '</div>', |
|
| 680 | - 'geodir_top_content_add' => '', |
|
| 681 | - 'geodir_before_main_content_add' => '', |
|
| 682 | - 'geodir_full_page_class_filter' => 'section full-width-section', |
|
| 683 | - 'geodir_before_widget_filter' => '', |
|
| 684 | - 'geodir_after_widget_filter' => '', |
|
| 685 | - 'geodir_before_title_filter' => '<div class="widget-title"><h2>', |
|
| 686 | - 'geodir_after_title_filter' => '</h2></div>', |
|
| 687 | - 'geodir_menu_li_class_filter' => '', |
|
| 688 | - 'geodir_sub_menu_ul_class_filter' => '', |
|
| 689 | - 'geodir_sub_menu_li_class_filter' => '', |
|
| 690 | - 'geodir_menu_a_class_filter' => '', |
|
| 691 | - 'geodir_sub_menu_a_class_filter' => '', |
|
| 692 | - 'geodir_location_switcher_menu_li_class_filter' => '', |
|
| 693 | - 'geodir_location_switcher_menu_a_class_filter' => '', |
|
| 694 | - 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
| 695 | - 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
| 696 | - 'geodir_theme_compat_css' => stripslashes('.full-width-section .geodir-search{margin:0;width:100%}.geodir_full_page .geodir-search{margin:0 auto;float:none}.geodir-search input[type=button],.geodir-search input[type=submit]{width:13%}.geodir-search input[type=text]{border:1px solid #ddd;border-radius:0;padding:0 8px}.geodir-category-list-in,.geodir-loc-bar-in{background:#f2f2f2;border-color:#dbdbdb}.geodir-category-list-in{margin-top:0}.geodir-cat-list .widget-title h2{margin:-13px -13px 13px}.widget .geodir-cat-list ul li.geodir-pcat-show a:before{display:none!important}.widget .geodir-cat-list ul li.geodir-pcat-show i{margin-right:5px}.container .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#geodir_carousel,#geodir_slider{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;margin-bottom:20px!important;border:1px solid #e1e1e1;box-shadow:none}#geodir_carousel{padding:10px}.geodir-tabs-content ol.commentlist{margin:40px 0;padding:0}li#post_mapTab{min-height:400px}#reviewsTab ol.commentlist li{border-bottom:none}#reviewsTab ol.commentlist li article.comment{border-bottom:1px solid #e1e1e1;padding-bottom:10px}.comment-content .rating{display:none}.comment-respond .gd_rating{margin-bottom:20px}div.geodir-rating{width:85px!important}.comment-respond .comment-notes{margin-bottom:10px}.average-review span,.comment-form label,.dtreviewed,.geodir-details-sidebar-user-links a,.geodir-viewall,.geodir_more_info span,.reviewer,dl.geodir-tab-head dd a{font-family:"Archivo Narrow",sans-serif}section.comment-content{margin:0 0 0 12%}#reviewsTab .comments-area .comment-content{width:auto}section.comment-content .description,section.comment-content p{margin:15px 0}dl.geodir-tab-head dd a{background:#f3f3f3;margin-top:-1px;font-size:14px;padding:0 15px}dl.geodir-tab-head dd.geodir-tab-active a{padding-bottom:1px}.geodir-widget .geodir_list_heading,.geodir-widget h3.widget-title{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px;color:#2d2d2d}.geodir-widget .geodir_list_heading h3{background:0 0;border:none}.geodir-widget .geodir_list_heading{margin:-13px -14px 13px}.geodir-map-listing-page{border-width:1px 0 0;border-style:solid;border-color:#dbdbdb}.geodir-sidebar-wrap .geodir-company_info{margin:15px}.geodir-details-sidebar-social-sharing iframe{float:left}.geodir-details-sidebar-rating{overflow:hidden}.geodir-details-sidebar-rating .gd_rating_show,.geodir-details-sidebar-rating .geodir-rating{float:left;margin-right:15px}.geodir-details-sidebar-rating span.item{float:left;margin-top:5px}.geodir-details-sidebar-rating .average-review{top:-4px;position:relative}.geodir-details-sidebar-rating span.item img{margin-top:5px}.geodir_full_page{background:#fff;border:1px solid #e1e1e1;-webkit-box-shadow:0 1px 0 #e5e5e5;box-shadow:0 1px 0 #e5e5e5;padding:15px;margin-bottom:20px;clear:both}.geodir_map_container .main_list img{margin:0 5px}.geodir_category_list_view li.geodir-gridview .geodir-post-img .geodir_thumbnail{margin-bottom:10px}.geodir-addinfo .geodir-pinpoint,.geodir-addinfo a i{margin-right:5px}.geodir_category_list_view li.geodir-gridview h3{font-size:18px;margin-bottom:10px}#related_listingTab ul.geodir_category_list_view{padding:0!important}#reviewsTab #comments .gd_rating{margin-top:5px}.widget .geodir_category_list_view li .geodir-entry-content,.widget .geodir_category_list_view li a:before{display:none!important}.geodir_category_list_view li .geodir-entry-title{margin-bottom:10px}.widget ul.geodir_category_list_view{padding:15px}.sidebar .widget .geodir_category_list_view li{width:calc(100% - 25px)}.widget .geodir-loginbox-list li{overflow:visible!important}.widget ul.chosen-results{margin:0!important}.main_list_selecter{margin-right:5px}.geodir-viewall{float:right;width:auto!important}.widget-title h2{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px}.widget:first-child .geodir_list_heading .widget-title{margin-top:0}.geodir_list_heading .widget-title{float:left;width:80%;margin-top:0}.geodir_list_heading .widget-title h2{padding:0 px;background:0 0;border:none;height:auto;line-height:auto}.chosen-default:before{content:none;display:none;position:absolute;margin-left:-1000000px;float:left}#geodir-wrapper .entry-crumbs{margin-bottom:20px}.geodir-search .mom-select{float:left;width:150px;margin:5px;border:1px solid #ddd;height:40px}.iprelative .gm-style .gm-style-iw{width:100%!important}'),
|
|
| 697 | - 'geodir_theme_compat_js' => 'jQuery(document).ready(function(e){e(".geodir_full_page").length&&""===e.trim(e(".geodir_full_page").html())&&e(".geodir_full_page").css({display:"none"})});',
|
|
| 698 | - 'geodir_theme_compat_default_options' => '', |
|
| 699 | - 'geodir_theme_compat_code' => 'Multi_News' |
|
| 700 | - ); |
|
| 701 | - |
|
| 702 | - // Kelo |
|
| 703 | - $theme_compat['Kleo'] = array( |
|
| 704 | - 'geodir_theme_compat_code' => 'Kleo' |
|
| 705 | - ); |
|
| 706 | - |
|
| 707 | - |
|
| 708 | - // Twenty Seventeen |
|
| 709 | - $theme_compat['Twenty_Seventeen'] = array( |
|
| 710 | - 'geodir_wrapper_open_replace' => '<div class="wrap">', |
|
| 711 | - 'geodir_wrapper_content_open_replace' => '<div id="primary" class="content-area" >', |
|
| 712 | - 'geodir_sidebar_right_open_replace' => '<aside id="secondary" class="widget-area" itemscope itemtype="[itemtype]" >', |
|
| 713 | - 'geodir_sidebar_left_open_replace' => '<aside id="secondary" class="widget-area" itemscope itemtype="[itemtype]" >', |
|
| 714 | - 'geodir_theme_compat_css' => stripslashes('body.geodir-page #primary header.entry-header {margin-left:0;float:none !important;} .gxeodir_flex-container{float:left;} .geodir-tabs-content.entry-content{width:100% !important;} dl.geodir-tab-head, .geodir_map_container {z-index:2;} .geodir-cat-list ul.geodir-popular-cat-list li + li { margin-top: 0;} .geodir-cat-list .geodir-popular-cat-list a img, .entry-content .gm-style a img, .widget .gm-style a img { box-sizing: none; -webkit-box-shadow: none; -moz-box-shadow: none;}'),
|
|
| 715 | - 'geodir_theme_compat_code' => 'Twenty_Seventeen' |
|
| 716 | - ); |
|
| 717 | - |
|
| 718 | - |
|
| 719 | - update_option('gd_theme_compats', $theme_compat);
|
|
| 720 | - |
|
| 721 | - gd_set_theme_compat();// set the compat pack if avail |
|
| 655 | + $theme_compat['Multi_News'] = array( |
|
| 656 | + 'geodir_wrapper_open_id' => '', |
|
| 657 | + 'geodir_wrapper_open_class' => 'main-container clearfix', |
|
| 658 | + 'geodir_wrapper_open_replace' => '', |
|
| 659 | + 'geodir_wrapper_close_replace' => '', |
|
| 660 | + 'geodir_wrapper_content_open_id' => '', |
|
| 661 | + 'geodir_wrapper_content_open_class' => '', |
|
| 662 | + 'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content "><div class="site-content page-wrap">', |
|
| 663 | + 'geodir_wrapper_content_close_replace' => '</div></div></div>', |
|
| 664 | + 'geodir_article_open_id' => '', |
|
| 665 | + 'geodir_article_open_class' => '', |
|
| 666 | + 'geodir_article_open_replace' => '', |
|
| 667 | + 'geodir_article_close_replace' => '', |
|
| 668 | + 'geodir_sidebar_right_open_id' => '', |
|
| 669 | + 'geodir_sidebar_right_open_class' => '', |
|
| 670 | + 'geodir_sidebar_right_open_replace' => '<aside class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 671 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 672 | + 'geodir_sidebar_left_open_id' => '', |
|
| 673 | + 'geodir_sidebar_left_open_class' => '', |
|
| 674 | + 'geodir_sidebar_left_open_replace' => '<aside class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 675 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 676 | + 'geodir_main_content_open_id' => '', |
|
| 677 | + 'geodir_main_content_open_class' => '', |
|
| 678 | + 'geodir_main_content_open_replace' => '<div class="site-content page-wrap">', |
|
| 679 | + 'geodir_main_content_close_replace' => '</div>', |
|
| 680 | + 'geodir_top_content_add' => '', |
|
| 681 | + 'geodir_before_main_content_add' => '', |
|
| 682 | + 'geodir_full_page_class_filter' => 'section full-width-section', |
|
| 683 | + 'geodir_before_widget_filter' => '', |
|
| 684 | + 'geodir_after_widget_filter' => '', |
|
| 685 | + 'geodir_before_title_filter' => '<div class="widget-title"><h2>', |
|
| 686 | + 'geodir_after_title_filter' => '</h2></div>', |
|
| 687 | + 'geodir_menu_li_class_filter' => '', |
|
| 688 | + 'geodir_sub_menu_ul_class_filter' => '', |
|
| 689 | + 'geodir_sub_menu_li_class_filter' => '', |
|
| 690 | + 'geodir_menu_a_class_filter' => '', |
|
| 691 | + 'geodir_sub_menu_a_class_filter' => '', |
|
| 692 | + 'geodir_location_switcher_menu_li_class_filter' => '', |
|
| 693 | + 'geodir_location_switcher_menu_a_class_filter' => '', |
|
| 694 | + 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
| 695 | + 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
| 696 | + 'geodir_theme_compat_css' => stripslashes('.full-width-section .geodir-search{margin:0;width:100%}.geodir_full_page .geodir-search{margin:0 auto;float:none}.geodir-search input[type=button],.geodir-search input[type=submit]{width:13%}.geodir-search input[type=text]{border:1px solid #ddd;border-radius:0;padding:0 8px}.geodir-category-list-in,.geodir-loc-bar-in{background:#f2f2f2;border-color:#dbdbdb}.geodir-category-list-in{margin-top:0}.geodir-cat-list .widget-title h2{margin:-13px -13px 13px}.widget .geodir-cat-list ul li.geodir-pcat-show a:before{display:none!important}.widget .geodir-cat-list ul li.geodir-pcat-show i{margin-right:5px}.container .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#geodir_carousel,#geodir_slider{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;margin-bottom:20px!important;border:1px solid #e1e1e1;box-shadow:none}#geodir_carousel{padding:10px}.geodir-tabs-content ol.commentlist{margin:40px 0;padding:0}li#post_mapTab{min-height:400px}#reviewsTab ol.commentlist li{border-bottom:none}#reviewsTab ol.commentlist li article.comment{border-bottom:1px solid #e1e1e1;padding-bottom:10px}.comment-content .rating{display:none}.comment-respond .gd_rating{margin-bottom:20px}div.geodir-rating{width:85px!important}.comment-respond .comment-notes{margin-bottom:10px}.average-review span,.comment-form label,.dtreviewed,.geodir-details-sidebar-user-links a,.geodir-viewall,.geodir_more_info span,.reviewer,dl.geodir-tab-head dd a{font-family:"Archivo Narrow",sans-serif}section.comment-content{margin:0 0 0 12%}#reviewsTab .comments-area .comment-content{width:auto}section.comment-content .description,section.comment-content p{margin:15px 0}dl.geodir-tab-head dd a{background:#f3f3f3;margin-top:-1px;font-size:14px;padding:0 15px}dl.geodir-tab-head dd.geodir-tab-active a{padding-bottom:1px}.geodir-widget .geodir_list_heading,.geodir-widget h3.widget-title{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px;color:#2d2d2d}.geodir-widget .geodir_list_heading h3{background:0 0;border:none}.geodir-widget .geodir_list_heading{margin:-13px -14px 13px}.geodir-map-listing-page{border-width:1px 0 0;border-style:solid;border-color:#dbdbdb}.geodir-sidebar-wrap .geodir-company_info{margin:15px}.geodir-details-sidebar-social-sharing iframe{float:left}.geodir-details-sidebar-rating{overflow:hidden}.geodir-details-sidebar-rating .gd_rating_show,.geodir-details-sidebar-rating .geodir-rating{float:left;margin-right:15px}.geodir-details-sidebar-rating span.item{float:left;margin-top:5px}.geodir-details-sidebar-rating .average-review{top:-4px;position:relative}.geodir-details-sidebar-rating span.item img{margin-top:5px}.geodir_full_page{background:#fff;border:1px solid #e1e1e1;-webkit-box-shadow:0 1px 0 #e5e5e5;box-shadow:0 1px 0 #e5e5e5;padding:15px;margin-bottom:20px;clear:both}.geodir_map_container .main_list img{margin:0 5px}.geodir_category_list_view li.geodir-gridview .geodir-post-img .geodir_thumbnail{margin-bottom:10px}.geodir-addinfo .geodir-pinpoint,.geodir-addinfo a i{margin-right:5px}.geodir_category_list_view li.geodir-gridview h3{font-size:18px;margin-bottom:10px}#related_listingTab ul.geodir_category_list_view{padding:0!important}#reviewsTab #comments .gd_rating{margin-top:5px}.widget .geodir_category_list_view li .geodir-entry-content,.widget .geodir_category_list_view li a:before{display:none!important}.geodir_category_list_view li .geodir-entry-title{margin-bottom:10px}.widget ul.geodir_category_list_view{padding:15px}.sidebar .widget .geodir_category_list_view li{width:calc(100% - 25px)}.widget .geodir-loginbox-list li{overflow:visible!important}.widget ul.chosen-results{margin:0!important}.main_list_selecter{margin-right:5px}.geodir-viewall{float:right;width:auto!important}.widget-title h2{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px}.widget:first-child .geodir_list_heading .widget-title{margin-top:0}.geodir_list_heading .widget-title{float:left;width:80%;margin-top:0}.geodir_list_heading .widget-title h2{padding:0 px;background:0 0;border:none;height:auto;line-height:auto}.chosen-default:before{content:none;display:none;position:absolute;margin-left:-1000000px;float:left}#geodir-wrapper .entry-crumbs{margin-bottom:20px}.geodir-search .mom-select{float:left;width:150px;margin:5px;border:1px solid #ddd;height:40px}.iprelative .gm-style .gm-style-iw{width:100%!important}'),
|
|
| 697 | + 'geodir_theme_compat_js' => 'jQuery(document).ready(function(e){e(".geodir_full_page").length&&""===e.trim(e(".geodir_full_page").html())&&e(".geodir_full_page").css({display:"none"})});',
|
|
| 698 | + 'geodir_theme_compat_default_options' => '', |
|
| 699 | + 'geodir_theme_compat_code' => 'Multi_News' |
|
| 700 | + ); |
|
| 701 | + |
|
| 702 | + // Kelo |
|
| 703 | + $theme_compat['Kleo'] = array( |
|
| 704 | + 'geodir_theme_compat_code' => 'Kleo' |
|
| 705 | + ); |
|
| 706 | + |
|
| 707 | + |
|
| 708 | + // Twenty Seventeen |
|
| 709 | + $theme_compat['Twenty_Seventeen'] = array( |
|
| 710 | + 'geodir_wrapper_open_replace' => '<div class="wrap">', |
|
| 711 | + 'geodir_wrapper_content_open_replace' => '<div id="primary" class="content-area" >', |
|
| 712 | + 'geodir_sidebar_right_open_replace' => '<aside id="secondary" class="widget-area" itemscope itemtype="[itemtype]" >', |
|
| 713 | + 'geodir_sidebar_left_open_replace' => '<aside id="secondary" class="widget-area" itemscope itemtype="[itemtype]" >', |
|
| 714 | + 'geodir_theme_compat_css' => stripslashes('body.geodir-page #primary header.entry-header {margin-left:0;float:none !important;} .gxeodir_flex-container{float:left;} .geodir-tabs-content.entry-content{width:100% !important;} dl.geodir-tab-head, .geodir_map_container {z-index:2;} .geodir-cat-list ul.geodir-popular-cat-list li + li { margin-top: 0;} .geodir-cat-list .geodir-popular-cat-list a img, .entry-content .gm-style a img, .widget .gm-style a img { box-sizing: none; -webkit-box-shadow: none; -moz-box-shadow: none;}'),
|
|
| 715 | + 'geodir_theme_compat_code' => 'Twenty_Seventeen' |
|
| 716 | + ); |
|
| 717 | + |
|
| 718 | + |
|
| 719 | + update_option('gd_theme_compats', $theme_compat);
|
|
| 720 | + |
|
| 721 | + gd_set_theme_compat();// set the compat pack if avail |
|
| 722 | 722 | } |
| 723 | 723 | |
| 724 | 724 | |
@@ -730,61 +730,61 @@ discard block |
||
| 730 | 730 | * @global object $wpdb WordPress Database object. |
| 731 | 731 | */ |
| 732 | 732 | function gd_convert_virtual_pages(){
|
| 733 | - global $wpdb; |
|
| 734 | - |
|
| 735 | - // Update the add listing page settings |
|
| 736 | - $add_listing_page = $wpdb->get_var( |
|
| 737 | - $wpdb->prepare( |
|
| 738 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 739 | - array('add-listing')
|
|
| 740 | - ) |
|
| 741 | - ); |
|
| 742 | - |
|
| 743 | - if($add_listing_page){
|
|
| 744 | - wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
|
|
| 745 | - update_option( 'geodir_add_listing_page', $add_listing_page); |
|
| 746 | - } |
|
| 747 | - |
|
| 748 | - // Update the listing preview page settings |
|
| 749 | - $listing_preview_page = $wpdb->get_var( |
|
| 750 | - $wpdb->prepare( |
|
| 751 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 752 | - array('listing-preview')
|
|
| 753 | - ) |
|
| 754 | - ); |
|
| 755 | - |
|
| 756 | - if($listing_preview_page){
|
|
| 757 | - wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
|
|
| 758 | - update_option( 'geodir_preview_page', $listing_preview_page); |
|
| 759 | - } |
|
| 760 | - |
|
| 761 | - // Update the listing success page settings |
|
| 762 | - $listing_success_page = $wpdb->get_var( |
|
| 763 | - $wpdb->prepare( |
|
| 764 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 765 | - array('listing-success')
|
|
| 766 | - ) |
|
| 767 | - ); |
|
| 768 | - |
|
| 769 | - if($listing_success_page){
|
|
| 770 | - wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
|
|
| 771 | - update_option( 'geodir_success_page', $listing_success_page); |
|
| 772 | - } |
|
| 773 | - |
|
| 774 | - // Update the listing success page settings |
|
| 775 | - $location_page = $wpdb->get_var( |
|
| 776 | - $wpdb->prepare( |
|
| 777 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 778 | - array('location')
|
|
| 779 | - ) |
|
| 780 | - ); |
|
| 781 | - |
|
| 782 | - if($location_page){
|
|
| 783 | - $location_slug = get_option('geodir_location_prefix');
|
|
| 784 | - if(!$location_slug ){$location_slug = 'location';}
|
|
| 785 | - wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
|
|
| 786 | - update_option( 'geodir_location_page', $location_page); |
|
| 787 | - } |
|
| 733 | + global $wpdb; |
|
| 734 | + |
|
| 735 | + // Update the add listing page settings |
|
| 736 | + $add_listing_page = $wpdb->get_var( |
|
| 737 | + $wpdb->prepare( |
|
| 738 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 739 | + array('add-listing')
|
|
| 740 | + ) |
|
| 741 | + ); |
|
| 742 | + |
|
| 743 | + if($add_listing_page){
|
|
| 744 | + wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
|
|
| 745 | + update_option( 'geodir_add_listing_page', $add_listing_page); |
|
| 746 | + } |
|
| 747 | + |
|
| 748 | + // Update the listing preview page settings |
|
| 749 | + $listing_preview_page = $wpdb->get_var( |
|
| 750 | + $wpdb->prepare( |
|
| 751 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 752 | + array('listing-preview')
|
|
| 753 | + ) |
|
| 754 | + ); |
|
| 755 | + |
|
| 756 | + if($listing_preview_page){
|
|
| 757 | + wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
|
|
| 758 | + update_option( 'geodir_preview_page', $listing_preview_page); |
|
| 759 | + } |
|
| 760 | + |
|
| 761 | + // Update the listing success page settings |
|
| 762 | + $listing_success_page = $wpdb->get_var( |
|
| 763 | + $wpdb->prepare( |
|
| 764 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 765 | + array('listing-success')
|
|
| 766 | + ) |
|
| 767 | + ); |
|
| 768 | + |
|
| 769 | + if($listing_success_page){
|
|
| 770 | + wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
|
|
| 771 | + update_option( 'geodir_success_page', $listing_success_page); |
|
| 772 | + } |
|
| 773 | + |
|
| 774 | + // Update the listing success page settings |
|
| 775 | + $location_page = $wpdb->get_var( |
|
| 776 | + $wpdb->prepare( |
|
| 777 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 778 | + array('location')
|
|
| 779 | + ) |
|
| 780 | + ); |
|
| 781 | + |
|
| 782 | + if($location_page){
|
|
| 783 | + $location_slug = get_option('geodir_location_prefix');
|
|
| 784 | + if(!$location_slug ){$location_slug = 'location';}
|
|
| 785 | + wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
|
|
| 786 | + update_option( 'geodir_location_page', $location_page); |
|
| 787 | + } |
|
| 788 | 788 | |
| 789 | 789 | } |
| 790 | 790 | |
@@ -798,31 +798,31 @@ discard block |
||
| 798 | 798 | function gd_fix_cpt_rewrite_slug() |
| 799 | 799 | {
|
| 800 | 800 | |
| 801 | - $alt_post_types = array(); |
|
| 802 | - $post_types = get_option('geodir_post_types');
|
|
| 801 | + $alt_post_types = array(); |
|
| 802 | + $post_types = get_option('geodir_post_types');
|
|
| 803 | 803 | |
| 804 | 804 | |
| 805 | - if (is_array($post_types)){
|
|
| 805 | + if (is_array($post_types)){
|
|
| 806 | 806 | |
| 807 | - foreach ($post_types as $post_type => $args) {
|
|
| 807 | + foreach ($post_types as $post_type => $args) {
|
|
| 808 | 808 | |
| 809 | 809 | |
| 810 | - if(isset($args['rewrite']['slug'])){
|
|
| 811 | - $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
|
|
| 812 | - } |
|
| 810 | + if(isset($args['rewrite']['slug'])){
|
|
| 811 | + $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
|
|
| 812 | + } |
|
| 813 | 813 | |
| 814 | - $alt_post_types[$post_type] = $args; |
|
| 814 | + $alt_post_types[$post_type] = $args; |
|
| 815 | 815 | |
| 816 | - } |
|
| 817 | - } |
|
| 816 | + } |
|
| 817 | + } |
|
| 818 | 818 | |
| 819 | - if(!empty($alt_post_types)) {
|
|
| 820 | - update_option('geodir_post_types',$alt_post_types);
|
|
| 821 | - } |
|
| 819 | + if(!empty($alt_post_types)) {
|
|
| 820 | + update_option('geodir_post_types',$alt_post_types);
|
|
| 821 | + } |
|
| 822 | 822 | |
| 823 | 823 | |
| 824 | - // flush the rewrite rules |
|
| 825 | - flush_rewrite_rules(); |
|
| 824 | + // flush the rewrite rules |
|
| 825 | + flush_rewrite_rules(); |
|
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | |
@@ -835,18 +835,18 @@ discard block |
||
| 835 | 835 | */ |
| 836 | 836 | function gd_fix_address_detail_table_limit() |
| 837 | 837 | {
|
| 838 | - global $wpdb; |
|
| 839 | - |
|
| 840 | - $all_postypes = geodir_get_posttypes(); |
|
| 841 | - |
|
| 842 | - if (!empty($all_postypes)) {
|
|
| 843 | - foreach ($all_postypes as $key) {
|
|
| 844 | - // update each GD CTP |
|
| 845 | - try {
|
|
| 846 | - $wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
|
|
| 847 | - } catch(Exception $e) {
|
|
| 848 | - error_log( 'Error: ' . $e->getMessage() ); |
|
| 849 | - } |
|
| 850 | - } |
|
| 851 | - } |
|
| 838 | + global $wpdb; |
|
| 839 | + |
|
| 840 | + $all_postypes = geodir_get_posttypes(); |
|
| 841 | + |
|
| 842 | + if (!empty($all_postypes)) {
|
|
| 843 | + foreach ($all_postypes as $key) {
|
|
| 844 | + // update each GD CTP |
|
| 845 | + try {
|
|
| 846 | + $wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
|
|
| 847 | + } catch(Exception $e) {
|
|
| 848 | + error_log( 'Error: ' . $e->getMessage() ); |
|
| 849 | + } |
|
| 850 | + } |
|
| 851 | + } |
|
| 852 | 852 | } |
@@ -1345,6 +1345,9 @@ discard block |
||
| 1345 | 1345 | } |
| 1346 | 1346 | |
| 1347 | 1347 | |
| 1348 | +/** |
|
| 1349 | + * @return string |
|
| 1350 | + */ |
|
| 1348 | 1351 | function geodir_field_icon_proccess($cf){
|
| 1349 | 1352 | |
| 1350 | 1353 | |
@@ -1738,7 +1741,7 @@ discard block |
||
| 1738 | 1741 | * @global object $wpdb WordPress Database object. |
| 1739 | 1742 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
| 1740 | 1743 | * @param int $post_id The post ID. |
| 1741 | - * @return mixed Returns video. |
|
| 1744 | + * @return string Returns video. |
|
| 1742 | 1745 | */ |
| 1743 | 1746 | function geodir_get_video($post_id) |
| 1744 | 1747 | {
|
@@ -1764,7 +1767,7 @@ discard block |
||
| 1764 | 1767 | * @global object $wpdb WordPress Database object. |
| 1765 | 1768 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
| 1766 | 1769 | * @param int $post_id The post ID. |
| 1767 | - * @return mixed Returns special offers. |
|
| 1770 | + * @return string Returns special offers. |
|
| 1768 | 1771 | */ |
| 1769 | 1772 | function geodir_get_special_offers($post_id) |
| 1770 | 1773 | {
|
@@ -1788,7 +1791,7 @@ discard block |
||
| 1788 | 1791 | * |
| 1789 | 1792 | * @since 1.0.0 |
| 1790 | 1793 | * @package GeoDirectory |
| 1791 | - * @return mixed|void Returns max upload file size. |
|
| 1794 | + * @return string|null Returns max upload file size. |
|
| 1792 | 1795 | */ |
| 1793 | 1796 | function geodir_max_upload_size() |
| 1794 | 1797 | {
|
@@ -2157,7 +2160,6 @@ discard block |
||
| 2157 | 2160 | * @param string $field_type The form field type. |
| 2158 | 2161 | * @param object|int $result_str The custom field results object or row id. |
| 2159 | 2162 | * @param string $field_ins_upd When set to "submit" displays form. |
| 2160 | - * @param bool $default when set to true field will be for admin use only. |
|
| 2161 | 2163 | */ |
| 2162 | 2164 | function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='') |
| 2163 | 2165 | {
|
@@ -51,8 +51,9 @@ discard block |
||
| 51 | 51 | global $wpdb; |
| 52 | 52 | $result = 0;// no rows affected |
| 53 | 53 | if (!geodir_column_exist($db, $column)) {
|
| 54 | - if (!empty($db) && !empty($column)) |
|
| 55 | - $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr");
|
|
| 54 | + if (!empty($db) && !empty($column)) { |
|
| 55 | + $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr"); |
|
| 56 | + } |
|
| 56 | 57 | } |
| 57 | 58 | return $result; |
| 58 | 59 | } |
@@ -82,10 +83,11 @@ discard block |
||
| 82 | 83 | |
| 83 | 84 | $default_query = ''; |
| 84 | 85 | |
| 85 | - if ($default == 'default') |
|
| 86 | - $default_query .= " and is_admin IN ('1') ";
|
|
| 87 | - elseif ($default == 'custom') |
|
| 88 | - $default_query .= " and is_admin = '0' "; |
|
| 86 | + if ($default == 'default') { |
|
| 87 | + $default_query .= " and is_admin IN ('1') "; |
|
| 88 | + } elseif ($default == 'custom') { |
|
| 89 | + $default_query .= " and is_admin = '0' "; |
|
| 90 | + } |
|
| 89 | 91 | |
| 90 | 92 | if ($fields_location == 'none') {
|
| 91 | 93 | } else{
|
@@ -239,10 +241,12 @@ discard block |
||
| 239 | 241 | } |
| 240 | 242 | |
| 241 | 243 | return $field_id; |
| 242 | - } else |
|
| 243 | - return 0; |
|
| 244 | - } else |
|
| 245 | - return 0; |
|
| 244 | + } else { |
|
| 245 | + return 0; |
|
| 246 | + } |
|
| 247 | + } else { |
|
| 248 | + return 0; |
|
| 249 | + } |
|
| 246 | 250 | } |
| 247 | 251 | } |
| 248 | 252 | |
@@ -349,7 +353,9 @@ discard block |
||
| 349 | 353 | |
| 350 | 354 | |
| 351 | 355 | |
| 352 | - if ($post_type == '') $post_type = 'gd_place'; |
|
| 356 | + if ($post_type == '') { |
|
| 357 | + $post_type = 'gd_place'; |
|
| 358 | + } |
|
| 353 | 359 | |
| 354 | 360 | |
| 355 | 361 | $detail_table = $plugin_prefix . $post_type . '_detail'; |
@@ -389,16 +395,17 @@ discard block |
||
| 389 | 395 | } |
| 390 | 396 | |
| 391 | 397 | $option_values = ''; |
| 392 | - if (isset($request_field['option_values'])) |
|
| 393 | - $option_values = $request_field['option_values']; |
|
| 398 | + if (isset($request_field['option_values'])) { |
|
| 399 | + $option_values = $request_field['option_values']; |
|
| 400 | + } |
|
| 394 | 401 | |
| 395 | 402 | $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0'; |
| 396 | 403 | |
| 397 | 404 | $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0'; |
| 398 | 405 | |
| 399 | - if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) |
|
| 400 | - $price_pkg = implode(",", $request_field['show_on_pkg']);
|
|
| 401 | - else {
|
|
| 406 | + if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) { |
|
| 407 | + $price_pkg = implode(",", $request_field['show_on_pkg']); |
|
| 408 | + } else {
|
|
| 402 | 409 | $package_info = array(); |
| 403 | 410 | |
| 404 | 411 | $package_info = geodir_post_package_info($package_info, '', $post_type); |
@@ -406,22 +413,29 @@ discard block |
||
| 406 | 413 | } |
| 407 | 414 | |
| 408 | 415 | |
| 409 | - if (isset($request_field['extra']) && !empty($request_field['extra'])) |
|
| 410 | - $extra_fields = $request_field['extra']; |
|
| 416 | + if (isset($request_field['extra']) && !empty($request_field['extra'])) { |
|
| 417 | + $extra_fields = $request_field['extra']; |
|
| 418 | + } |
|
| 411 | 419 | |
| 412 | - if (isset($request_field['is_default']) && $request_field['is_default'] != '') |
|
| 413 | - $is_default = $request_field['is_default']; |
|
| 414 | - else |
|
| 415 | - $is_default = '0'; |
|
| 420 | + if (isset($request_field['is_default']) && $request_field['is_default'] != '') { |
|
| 421 | + $is_default = $request_field['is_default']; |
|
| 422 | + } else { |
|
| 423 | + $is_default = '0'; |
|
| 424 | + } |
|
| 416 | 425 | |
| 417 | - if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') |
|
| 418 | - $is_admin = $request_field['is_admin']; |
|
| 419 | - else |
|
| 420 | - $is_admin = '0'; |
|
| 426 | + if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') { |
|
| 427 | + $is_admin = $request_field['is_admin']; |
|
| 428 | + } else { |
|
| 429 | + $is_admin = '0'; |
|
| 430 | + } |
|
| 421 | 431 | |
| 422 | 432 | |
| 423 | - if ($is_active == '') $is_active = 1; |
|
| 424 | - if ($is_required == '') $is_required = 0; |
|
| 433 | + if ($is_active == '') { |
|
| 434 | + $is_active = 1; |
|
| 435 | + } |
|
| 436 | + if ($is_required == '') { |
|
| 437 | + $is_required = 0; |
|
| 438 | + } |
|
| 425 | 439 | |
| 426 | 440 | |
| 427 | 441 | if ($sort_order == '') {
|
@@ -690,7 +704,7 @@ discard block |
||
| 690 | 704 | } |
| 691 | 705 | if($op_max){$op_size =$op_max; }
|
| 692 | 706 | } |
| 693 | - }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 707 | + } elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 694 | 708 | if(strlen($option_values)){
|
| 695 | 709 | $op_size = strlen($option_values); |
| 696 | 710 | } |
@@ -707,11 +721,13 @@ discard block |
||
| 707 | 721 | return __('Column change failed, you may have too many columns.','geodirectory');
|
| 708 | 722 | } |
| 709 | 723 | |
| 710 | - if (isset($request_field['cat_display_type'])) |
|
| 711 | - $extra_fields = $request_field['cat_display_type']; |
|
| 724 | + if (isset($request_field['cat_display_type'])) { |
|
| 725 | + $extra_fields = $request_field['cat_display_type']; |
|
| 726 | + } |
|
| 712 | 727 | |
| 713 | - if (isset($request_field['multi_display_type'])) |
|
| 714 | - $extra_fields = $request_field['multi_display_type']; |
|
| 728 | + if (isset($request_field['multi_display_type'])) { |
|
| 729 | + $extra_fields = $request_field['multi_display_type']; |
|
| 730 | + } |
|
| 715 | 731 | |
| 716 | 732 | |
| 717 | 733 | break; |
@@ -725,8 +741,9 @@ discard block |
||
| 725 | 741 | if($alter_result===false){
|
| 726 | 742 | return __('Column change failed, you may have too many columns.','geodirectory');
|
| 727 | 743 | } |
| 728 | - if (isset($request_field['advanced_editor'])) |
|
| 729 | - $extra_fields = $request_field['advanced_editor']; |
|
| 744 | + if (isset($request_field['advanced_editor'])) { |
|
| 745 | + $extra_fields = $request_field['advanced_editor']; |
|
| 746 | + } |
|
| 730 | 747 | |
| 731 | 748 | break; |
| 732 | 749 | |
@@ -822,8 +839,9 @@ discard block |
||
| 822 | 839 | ); |
| 823 | 840 | |
| 824 | 841 | |
| 825 | - if ($cat_sort == '') |
|
| 826 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 842 | + if ($cat_sort == '') { |
|
| 843 | + $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name))); |
|
| 844 | + } |
|
| 827 | 845 | |
| 828 | 846 | |
| 829 | 847 | /** |
@@ -1193,8 +1211,10 @@ discard block |
||
| 1193 | 1211 | } |
| 1194 | 1212 | |
| 1195 | 1213 | return $post_meta_info; |
| 1196 | - else: |
|
| 1197 | - return false; |
|
| 1214 | + else { |
|
| 1215 | + : |
|
| 1216 | + return false; |
|
| 1217 | + } |
|
| 1198 | 1218 | endif; |
| 1199 | 1219 | } |
| 1200 | 1220 | |
@@ -1205,8 +1225,9 @@ discard block |
||
| 1205 | 1225 | if (is_admin()) {
|
| 1206 | 1226 | global $post,$gd_session; |
| 1207 | 1227 | |
| 1208 | - if (isset($_REQUEST['post'])) |
|
| 1209 | - $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1228 | + if (isset($_REQUEST['post'])) { |
|
| 1229 | + $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1230 | + } |
|
| 1210 | 1231 | } |
| 1211 | 1232 | |
| 1212 | 1233 | if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
|
@@ -1259,8 +1280,9 @@ discard block |
||
| 1259 | 1280 | if (is_admin()) {
|
| 1260 | 1281 | global $post; |
| 1261 | 1282 | |
| 1262 | - if (isset($_REQUEST['post'])) |
|
| 1263 | - $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1283 | + if (isset($_REQUEST['post'])) { |
|
| 1284 | + $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1285 | + } |
|
| 1264 | 1286 | } |
| 1265 | 1287 | |
| 1266 | 1288 | |
@@ -1352,7 +1374,7 @@ discard block |
||
| 1352 | 1374 | $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
| 1353 | 1375 | } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
|
| 1354 | 1376 | $field_icon = '<i class="' . $cf['field_icon'] . '"></i>'; |
| 1355 | - }else{
|
|
| 1377 | + } else{
|
|
| 1356 | 1378 | $field_icon = $cf['field_icon']; |
| 1357 | 1379 | } |
| 1358 | 1380 | |
@@ -1425,8 +1447,9 @@ discard block |
||
| 1425 | 1447 | $variables_array['post_id'] = $post->ID; |
| 1426 | 1448 | $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
| 1427 | 1449 | $variables_array['value'] = ''; |
| 1428 | - if (isset($post->{$type['htmlvar_name']}))
|
|
| 1429 | - $variables_array['value'] = $post->{$type['htmlvar_name']};
|
|
| 1450 | + if (isset($post->{$type['htmlvar_name']})) { |
|
| 1451 | + $variables_array['value'] = $post->{$type['htmlvar_name']}; |
|
| 1452 | + } |
|
| 1430 | 1453 | endif; |
| 1431 | 1454 | |
| 1432 | 1455 | |
@@ -1448,7 +1471,9 @@ discard block |
||
| 1448 | 1471 | * @param string $html Custom field unfiltered HTML. |
| 1449 | 1472 | * @param array $variables_array Custom field variables array. |
| 1450 | 1473 | */ |
| 1451 | - if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
|
|
| 1474 | + if ($html) { |
|
| 1475 | + echo apply_filters("geodir_show_{$html_var}", $html, $variables_array); |
|
| 1476 | + } |
|
| 1452 | 1477 | |
| 1453 | 1478 | /** |
| 1454 | 1479 | * Called after a custom fields is output on the frontend. |
@@ -1491,10 +1516,11 @@ discard block |
||
| 1491 | 1516 | */ |
| 1492 | 1517 | function geodir_default_date_format() |
| 1493 | 1518 | {
|
| 1494 | - if ($format = get_option('date_format'))
|
|
| 1495 | - return $format; |
|
| 1496 | - else |
|
| 1497 | - return 'dd-mm-yy'; |
|
| 1519 | + if ($format = get_option('date_format')) { |
|
| 1520 | + return $format; |
|
| 1521 | + } else { |
|
| 1522 | + return 'dd-mm-yy'; |
|
| 1523 | + } |
|
| 1498 | 1524 | } |
| 1499 | 1525 | } |
| 1500 | 1526 | |
@@ -1601,11 +1627,13 @@ discard block |
||
| 1601 | 1627 | // Set an array containing a list of acceptable formats |
| 1602 | 1628 | //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
|
| 1603 | 1629 | |
| 1604 | - if (!function_exists('wp_handle_upload'))
|
|
| 1605 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1630 | + if (!function_exists('wp_handle_upload')) { |
|
| 1631 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1632 | + } |
|
| 1606 | 1633 | |
| 1607 | - if (!is_dir($geodir_uploadpath)) |
|
| 1608 | - mkdir($geodir_uploadpath); |
|
| 1634 | + if (!is_dir($geodir_uploadpath)) { |
|
| 1635 | + mkdir($geodir_uploadpath); |
|
| 1636 | + } |
|
| 1609 | 1637 | |
| 1610 | 1638 | $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
| 1611 | 1639 | $explode_sub_dir = explode("/", $sub_dir);
|
@@ -1618,16 +1646,19 @@ discard block |
||
| 1618 | 1646 | } |
| 1619 | 1647 | |
| 1620 | 1648 | $uploaded_file = ''; |
| 1621 | - if (file_exists($img_path)) |
|
| 1622 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1649 | + if (file_exists($img_path)) { |
|
| 1650 | + $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1651 | + } |
|
| 1623 | 1652 | |
| 1624 | 1653 | if ($curr_img_dir != $geodir_uploaddir) {
|
| 1625 | - if (file_exists($img_path)) |
|
| 1626 | - unlink($img_path); |
|
| 1654 | + if (file_exists($img_path)) { |
|
| 1655 | + unlink($img_path); |
|
| 1656 | + } |
|
| 1627 | 1657 | } |
| 1628 | 1658 | |
| 1629 | - if (!empty($uploaded_file)) |
|
| 1630 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1659 | + if (!empty($uploaded_file)) { |
|
| 1660 | + $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1661 | + } |
|
| 1631 | 1662 | |
| 1632 | 1663 | } else {
|
| 1633 | 1664 | $file_urls = $post_image[$m]; |
@@ -1648,8 +1679,9 @@ discard block |
||
| 1648 | 1679 | |
| 1649 | 1680 | geodir_save_post_meta($post_id, $field_id, $file_urls); |
| 1650 | 1681 | |
| 1651 | - if (!empty($invalid_files)) |
|
| 1652 | - geodir_remove_attachments($invalid_files); |
|
| 1682 | + if (!empty($invalid_files)) { |
|
| 1683 | + geodir_remove_attachments($invalid_files); |
|
| 1684 | + } |
|
| 1653 | 1685 | |
| 1654 | 1686 | } |
| 1655 | 1687 | } |
@@ -1875,8 +1907,9 @@ discard block |
||
| 1875 | 1907 | |
| 1876 | 1908 | $all_postypes = geodir_get_posttypes(); |
| 1877 | 1909 | |
| 1878 | - if (!in_array($post_type, $all_postypes)) |
|
| 1879 | - return false; |
|
| 1910 | + if (!in_array($post_type, $all_postypes)) { |
|
| 1911 | + return false; |
|
| 1912 | + } |
|
| 1880 | 1913 | |
| 1881 | 1914 | $fields = array(); |
| 1882 | 1915 | |
@@ -1974,8 +2007,10 @@ discard block |
||
| 1974 | 2007 | } |
| 1975 | 2008 | |
| 1976 | 2009 | return $field_ids; |
| 1977 | - else: |
|
| 1978 | - return false; |
|
| 2010 | + else { |
|
| 2011 | + : |
|
| 2012 | + return false; |
|
| 2013 | + } |
|
| 1979 | 2014 | endif; |
| 1980 | 2015 | } |
| 1981 | 2016 | |
@@ -2148,8 +2183,9 @@ discard block |
||
| 2148 | 2183 | |
| 2149 | 2184 | return $field_id; |
| 2150 | 2185 | |
| 2151 | - } else |
|
| 2152 | - return 0; |
|
| 2186 | + } else { |
|
| 2187 | + return 0; |
|
| 2188 | + } |
|
| 2153 | 2189 | |
| 2154 | 2190 | } |
| 2155 | 2191 | } |
@@ -2190,8 +2226,9 @@ discard block |
||
| 2190 | 2226 | $htmlvar_name = isset($field_type_key) ? $field_type_key : ''; |
| 2191 | 2227 | |
| 2192 | 2228 | $site_title = ''; |
| 2193 | - if ($site_title == '') |
|
| 2194 | - $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 2229 | + if ($site_title == '') { |
|
| 2230 | + $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 2231 | + } |
|
| 2195 | 2232 | |
| 2196 | 2233 | if ($site_title == '') {
|
| 2197 | 2234 | $fields = geodir_get_custom_sort_options($post_type); |
@@ -2205,8 +2242,9 @@ discard block |
||
| 2205 | 2242 | } |
| 2206 | 2243 | } |
| 2207 | 2244 | |
| 2208 | - if ($htmlvar_name == '') |
|
| 2209 | - $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 2245 | + if ($htmlvar_name == '') { |
|
| 2246 | + $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 2247 | + } |
|
| 2210 | 2248 | |
| 2211 | 2249 | $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
| 2212 | 2250 | |
@@ -2219,7 +2257,7 @@ discard block |
||
| 2219 | 2257 | |
| 2220 | 2258 | if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
|
| 2221 | 2259 | $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>'; |
| 2222 | - }elseif(isset($cso['field_icon']) && $cso['field_icon']){
|
|
| 2260 | + } elseif(isset($cso['field_icon']) && $cso['field_icon']){
|
|
| 2223 | 2261 | $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
|
| 2224 | 2262 | } |
| 2225 | 2263 | |
@@ -2654,7 +2692,7 @@ discard block |
||
| 2654 | 2692 | $dt_value = ''; |
| 2655 | 2693 | if (isset($field_info->data_type)) {
|
| 2656 | 2694 | $dt_value = esc_attr($field_info->data_type); |
| 2657 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 2695 | + } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 2658 | 2696 | $dt_value = $cf['defaults']['data_type']; |
| 2659 | 2697 | } |
| 2660 | 2698 | ?> |
@@ -2686,7 +2724,7 @@ discard block |
||
| 2686 | 2724 | $value = ''; |
| 2687 | 2725 | if (isset($field_info->decimal_point)) {
|
| 2688 | 2726 | $value = esc_attr($field_info->decimal_point); |
| 2689 | - }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
|
|
| 2727 | + } elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
|
|
| 2690 | 2728 | $value = $cf['defaults']['decimal_point']; |
| 2691 | 2729 | } |
| 2692 | 2730 | ?> |
@@ -2760,11 +2798,13 @@ discard block |
||
| 2760 | 2798 | |
| 2761 | 2799 | <?php |
| 2762 | 2800 | $selected = ''; |
| 2763 | - if (isset($field_info->extra_fields)) |
|
| 2764 | - $advanced_editor = unserialize($field_info->extra_fields); |
|
| 2801 | + if (isset($field_info->extra_fields)) { |
|
| 2802 | + $advanced_editor = unserialize($field_info->extra_fields); |
|
| 2803 | + } |
|
| 2765 | 2804 | |
| 2766 | - if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
|
|
| 2767 | - $selected = 'checked="checked"'; |
|
| 2805 | + if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor)) { |
|
| 2806 | + $selected = 'checked="checked"'; |
|
| 2807 | + } |
|
| 2768 | 2808 | ?> |
| 2769 | 2809 | |
| 2770 | 2810 | <input type="checkbox" name="advanced_editor[]" id="advanced_editor" |
@@ -2786,7 +2826,7 @@ discard block |
||
| 2786 | 2826 | $value = ''; |
| 2787 | 2827 | if (isset($field_info->validation_pattern)) {
|
| 2788 | 2828 | $value = esc_attr($field_info->validation_pattern); |
| 2789 | - }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
|
|
| 2829 | + } elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
|
|
| 2790 | 2830 | $value = esc_attr($cf['defaults']['validation_pattern']); |
| 2791 | 2831 | } |
| 2792 | 2832 | ?> |
@@ -2806,7 +2846,7 @@ discard block |
||
| 2806 | 2846 | $value = ''; |
| 2807 | 2847 | if (isset($field_info->validation_msg)) {
|
| 2808 | 2848 | $value = esc_attr($field_info->validation_msg); |
| 2809 | - }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
|
|
| 2849 | + } elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
|
|
| 2810 | 2850 | $value = esc_attr($cf['defaults']['validation_msg']); |
| 2811 | 2851 | } |
| 2812 | 2852 | ?> |
@@ -2836,8 +2876,9 @@ discard block |
||
| 2836 | 2876 | |
| 2837 | 2877 | if (!isset($field_info->post_type)) {
|
| 2838 | 2878 | $post_type = sanitize_text_field($_REQUEST['listing_type']); |
| 2839 | - } else |
|
| 2840 | - $post_type = $field_info->post_type; |
|
| 2879 | + } else { |
|
| 2880 | + $post_type = $field_info->post_type; |
|
| 2881 | + } |
|
| 2841 | 2882 | ?> |
| 2842 | 2883 | <li style="display: none;"> |
| 2843 | 2884 | <label for="htmlvar_name" class="gd-cf-tooltip-wrap"> |
@@ -3111,7 +3152,7 @@ discard block |
||
| 3111 | 3152 | $value = ''; |
| 3112 | 3153 | if (isset($field_info->option_values)) {
|
| 3113 | 3154 | $value = esc_attr($field_info->option_values); |
| 3114 | - }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
|
|
| 3155 | + } elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
|
|
| 3115 | 3156 | $value = esc_attr($cf['defaults']['option_values']); |
| 3116 | 3157 | } |
| 3117 | 3158 | |
@@ -3254,7 +3295,7 @@ discard block |
||
| 3254 | 3295 | $value = ''; |
| 3255 | 3296 | if ($extra_fields && isset($extra_fields['is_price'])) {
|
| 3256 | 3297 | $value = esc_attr($extra_fields['is_price']); |
| 3257 | - }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
|
|
| 3298 | + } elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
|
|
| 3258 | 3299 | $value = esc_attr($cf['defaults']['extra_fields']['is_price']); |
| 3259 | 3300 | } |
| 3260 | 3301 | |
@@ -3289,7 +3330,7 @@ discard block |
||
| 3289 | 3330 | $value = ''; |
| 3290 | 3331 | if ($extra_fields && isset($extra_fields['thousand_separator'])) {
|
| 3291 | 3332 | $value = esc_attr($extra_fields['thousand_separator']); |
| 3292 | - }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
|
|
| 3333 | + } elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
|
|
| 3293 | 3334 | $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']); |
| 3294 | 3335 | } |
| 3295 | 3336 | ?> |
@@ -3316,7 +3357,7 @@ discard block |
||
| 3316 | 3357 | $value = ''; |
| 3317 | 3358 | if ($extra_fields && isset($extra_fields['decimal_separator'])) {
|
| 3318 | 3359 | $value = esc_attr($extra_fields['decimal_separator']); |
| 3319 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
|
|
| 3360 | + } elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
|
|
| 3320 | 3361 | $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']); |
| 3321 | 3362 | } |
| 3322 | 3363 | ?> |
@@ -3339,7 +3380,7 @@ discard block |
||
| 3339 | 3380 | $value = ''; |
| 3340 | 3381 | if ($extra_fields && isset($extra_fields['decimal_display'])) {
|
| 3341 | 3382 | $value = esc_attr($extra_fields['decimal_display']); |
| 3342 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
|
|
| 3383 | + } elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
|
|
| 3343 | 3384 | $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']); |
| 3344 | 3385 | } |
| 3345 | 3386 | ?> |
@@ -3362,7 +3403,7 @@ discard block |
||
| 3362 | 3403 | $value = ''; |
| 3363 | 3404 | if ($extra_fields && isset($extra_fields['currency_symbol'])) {
|
| 3364 | 3405 | $value = esc_attr($extra_fields['currency_symbol']); |
| 3365 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
|
|
| 3406 | + } elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
|
|
| 3366 | 3407 | $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']); |
| 3367 | 3408 | } |
| 3368 | 3409 | ?> |
@@ -3383,7 +3424,7 @@ discard block |
||
| 3383 | 3424 | $value = ''; |
| 3384 | 3425 | if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
|
| 3385 | 3426 | $value = esc_attr($extra_fields['currency_symbol_placement']); |
| 3386 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
|
|
| 3427 | + } elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
|
|
| 3387 | 3428 | $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']); |
| 3388 | 3429 | } |
| 3389 | 3430 | ?> |
@@ -3610,8 +3651,9 @@ discard block |
||
| 3610 | 3651 | $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left'; |
| 3611 | 3652 | |
| 3612 | 3653 | if($decimals>0 && $decimal_display=='if'){
|
| 3613 | - if(is_int($number) || floor( $number ) == $number) |
|
| 3614 | - $decimals = 0; |
|
| 3654 | + if(is_int($number) || floor( $number ) == $number) { |
|
| 3655 | + $decimals = 0; |
|
| 3656 | + } |
|
| 3615 | 3657 | } |
| 3616 | 3658 | |
| 3617 | 3659 | $number = number_format($number,$decimals,$decimalpoint,$separator); |
@@ -3620,7 +3662,7 @@ discard block |
||
| 3620 | 3662 | |
| 3621 | 3663 | if($currency_symbol_placement=='left'){
|
| 3622 | 3664 | $number = $symbol . $number; |
| 3623 | - }else{
|
|
| 3665 | + } else{
|
|
| 3624 | 3666 | $number = $number . $symbol; |
| 3625 | 3667 | } |
| 3626 | 3668 | |
@@ -10,52 +10,52 @@ discard block |
||
| 10 | 10 | global $wpdb, $table_prefix; |
| 11 | 11 | |
| 12 | 12 | if (!function_exists('geodir_column_exist')) {
|
| 13 | - /** |
|
| 14 | - * Check table column exist or not. |
|
| 15 | - * |
|
| 16 | - * @since 1.0.0 |
|
| 17 | - * @package GeoDirectory |
|
| 18 | - * @global object $wpdb WordPress Database object. |
|
| 19 | - * @param string $db The table name. |
|
| 20 | - * @param string $column The column name. |
|
| 21 | - * @return bool If column exists returns true. Otherwise false. |
|
| 22 | - */ |
|
| 23 | - function geodir_column_exist($db, $column) |
|
| 24 | - {
|
|
| 25 | - global $wpdb; |
|
| 26 | - $exists = false; |
|
| 27 | - $columns = $wpdb->get_col("show columns from $db");
|
|
| 28 | - foreach ($columns as $c) {
|
|
| 29 | - if ($c == $column) {
|
|
| 30 | - $exists = true; |
|
| 31 | - break; |
|
| 32 | - } |
|
| 33 | - } |
|
| 34 | - return $exists; |
|
| 35 | - } |
|
| 13 | + /** |
|
| 14 | + * Check table column exist or not. |
|
| 15 | + * |
|
| 16 | + * @since 1.0.0 |
|
| 17 | + * @package GeoDirectory |
|
| 18 | + * @global object $wpdb WordPress Database object. |
|
| 19 | + * @param string $db The table name. |
|
| 20 | + * @param string $column The column name. |
|
| 21 | + * @return bool If column exists returns true. Otherwise false. |
|
| 22 | + */ |
|
| 23 | + function geodir_column_exist($db, $column) |
|
| 24 | + {
|
|
| 25 | + global $wpdb; |
|
| 26 | + $exists = false; |
|
| 27 | + $columns = $wpdb->get_col("show columns from $db");
|
|
| 28 | + foreach ($columns as $c) {
|
|
| 29 | + if ($c == $column) {
|
|
| 30 | + $exists = true; |
|
| 31 | + break; |
|
| 32 | + } |
|
| 33 | + } |
|
| 34 | + return $exists; |
|
| 35 | + } |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | if (!function_exists('geodir_add_column_if_not_exist')) {
|
| 39 | - /** |
|
| 40 | - * Add column if table column not exist. |
|
| 41 | - * |
|
| 42 | - * @since 1.0.0 |
|
| 43 | - * @package GeoDirectory |
|
| 44 | - * @global object $wpdb WordPress Database object. |
|
| 45 | - * @param string $db The table name. |
|
| 46 | - * @param string $column The column name. |
|
| 47 | - * @param string $column_attr The column attributes. |
|
| 48 | - */ |
|
| 49 | - function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL") |
|
| 50 | - {
|
|
| 51 | - global $wpdb; |
|
| 52 | - $result = 0;// no rows affected |
|
| 53 | - if (!geodir_column_exist($db, $column)) {
|
|
| 54 | - if (!empty($db) && !empty($column)) |
|
| 55 | - $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr");
|
|
| 56 | - } |
|
| 57 | - return $result; |
|
| 58 | - } |
|
| 39 | + /** |
|
| 40 | + * Add column if table column not exist. |
|
| 41 | + * |
|
| 42 | + * @since 1.0.0 |
|
| 43 | + * @package GeoDirectory |
|
| 44 | + * @global object $wpdb WordPress Database object. |
|
| 45 | + * @param string $db The table name. |
|
| 46 | + * @param string $column The column name. |
|
| 47 | + * @param string $column_attr The column attributes. |
|
| 48 | + */ |
|
| 49 | + function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL") |
|
| 50 | + {
|
|
| 51 | + global $wpdb; |
|
| 52 | + $result = 0;// no rows affected |
|
| 53 | + if (!geodir_column_exist($db, $column)) {
|
|
| 54 | + if (!empty($db) && !empty($column)) |
|
| 55 | + $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr");
|
|
| 56 | + } |
|
| 57 | + return $result; |
|
| 58 | + } |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -72,706 +72,706 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | function geodir_post_custom_fields($package_id = '', $default = 'all', $post_type = 'gd_place', $fields_location = 'none') |
| 74 | 74 | {
|
| 75 | - global $wpdb, $geodir_post_custom_fields_cache; |
|
| 76 | - |
|
| 77 | - $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location; |
|
| 78 | - |
|
| 79 | - if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
|
|
| 80 | - return $geodir_post_custom_fields_cache[$cache_stored]; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - $default_query = ''; |
|
| 84 | - |
|
| 85 | - if ($default == 'default') |
|
| 86 | - $default_query .= " and is_admin IN ('1') ";
|
|
| 87 | - elseif ($default == 'custom') |
|
| 88 | - $default_query .= " and is_admin = '0' "; |
|
| 89 | - |
|
| 90 | - if ($fields_location == 'none') {
|
|
| 91 | - } else{
|
|
| 92 | - $fields_location = esc_sql( $fields_location ); |
|
| 93 | - $default_query .= " and show_in LIKE '%%[$fields_location]%%' "; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - $post_meta_info = $wpdb->get_results( |
|
| 97 | - $wpdb->prepare( |
|
| 98 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
|
|
| 99 | - array($post_type) |
|
| 100 | - ) |
|
| 101 | - ); |
|
| 102 | - |
|
| 103 | - |
|
| 104 | - $return_arr = array(); |
|
| 105 | - if ($post_meta_info) {
|
|
| 106 | - |
|
| 107 | - foreach ($post_meta_info as $post_meta_info_obj) {
|
|
| 108 | - |
|
| 109 | - $custom_fields = array( |
|
| 110 | - "name" => $post_meta_info_obj->htmlvar_name, |
|
| 111 | - "label" => $post_meta_info_obj->clabels, |
|
| 112 | - "default" => $post_meta_info_obj->default_value, |
|
| 113 | - "type" => $post_meta_info_obj->field_type, |
|
| 114 | - "desc" => $post_meta_info_obj->admin_desc); |
|
| 115 | - |
|
| 116 | - if ($post_meta_info_obj->field_type) {
|
|
| 117 | - $options = explode(',', $post_meta_info_obj->option_values);
|
|
| 118 | - $custom_fields["options"] = $options; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - foreach ($post_meta_info_obj as $key => $val) {
|
|
| 122 | - $custom_fields[$key] = $val; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - $pricearr = array(); |
|
| 126 | - $pricearr = explode(',', $post_meta_info_obj->packages);
|
|
| 127 | - |
|
| 128 | - if ($package_id != '' && in_array($package_id, $pricearr)) {
|
|
| 129 | - $return_arr[$post_meta_info_obj->sort_order] = $custom_fields; |
|
| 130 | - } elseif ($package_id == '') {
|
|
| 131 | - $return_arr[$post_meta_info_obj->sort_order] = $custom_fields; |
|
| 132 | - } |
|
| 133 | - } |
|
| 134 | - } |
|
| 135 | - $geodir_post_custom_fields_cache[$cache_stored] = $return_arr; |
|
| 136 | - |
|
| 137 | - if (has_filter('geodir_filter_geodir_post_custom_fields')) {
|
|
| 138 | - /** |
|
| 139 | - * Filter the post custom fields array. |
|
| 140 | - * |
|
| 141 | - * @since 1.0.0 |
|
| 142 | - * |
|
| 143 | - * @param array $return_arr Post custom fields array. |
|
| 144 | - * @param int|string $package_id The package ID. |
|
| 145 | - * @param string $post_type Optional. The wordpress post type. |
|
| 146 | - * @param string $fields_location Optional. Where exactly are you going to place this custom fields?. |
|
| 147 | - */ |
|
| 148 | - $return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
|
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - return $return_arr; |
|
| 75 | + global $wpdb, $geodir_post_custom_fields_cache; |
|
| 76 | + |
|
| 77 | + $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location; |
|
| 78 | + |
|
| 79 | + if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
|
|
| 80 | + return $geodir_post_custom_fields_cache[$cache_stored]; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + $default_query = ''; |
|
| 84 | + |
|
| 85 | + if ($default == 'default') |
|
| 86 | + $default_query .= " and is_admin IN ('1') ";
|
|
| 87 | + elseif ($default == 'custom') |
|
| 88 | + $default_query .= " and is_admin = '0' "; |
|
| 89 | + |
|
| 90 | + if ($fields_location == 'none') {
|
|
| 91 | + } else{
|
|
| 92 | + $fields_location = esc_sql( $fields_location ); |
|
| 93 | + $default_query .= " and show_in LIKE '%%[$fields_location]%%' "; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + $post_meta_info = $wpdb->get_results( |
|
| 97 | + $wpdb->prepare( |
|
| 98 | + "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
|
|
| 99 | + array($post_type) |
|
| 100 | + ) |
|
| 101 | + ); |
|
| 102 | + |
|
| 103 | + |
|
| 104 | + $return_arr = array(); |
|
| 105 | + if ($post_meta_info) {
|
|
| 106 | + |
|
| 107 | + foreach ($post_meta_info as $post_meta_info_obj) {
|
|
| 108 | + |
|
| 109 | + $custom_fields = array( |
|
| 110 | + "name" => $post_meta_info_obj->htmlvar_name, |
|
| 111 | + "label" => $post_meta_info_obj->clabels, |
|
| 112 | + "default" => $post_meta_info_obj->default_value, |
|
| 113 | + "type" => $post_meta_info_obj->field_type, |
|
| 114 | + "desc" => $post_meta_info_obj->admin_desc); |
|
| 115 | + |
|
| 116 | + if ($post_meta_info_obj->field_type) {
|
|
| 117 | + $options = explode(',', $post_meta_info_obj->option_values);
|
|
| 118 | + $custom_fields["options"] = $options; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + foreach ($post_meta_info_obj as $key => $val) {
|
|
| 122 | + $custom_fields[$key] = $val; |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + $pricearr = array(); |
|
| 126 | + $pricearr = explode(',', $post_meta_info_obj->packages);
|
|
| 127 | + |
|
| 128 | + if ($package_id != '' && in_array($package_id, $pricearr)) {
|
|
| 129 | + $return_arr[$post_meta_info_obj->sort_order] = $custom_fields; |
|
| 130 | + } elseif ($package_id == '') {
|
|
| 131 | + $return_arr[$post_meta_info_obj->sort_order] = $custom_fields; |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | + $geodir_post_custom_fields_cache[$cache_stored] = $return_arr; |
|
| 136 | + |
|
| 137 | + if (has_filter('geodir_filter_geodir_post_custom_fields')) {
|
|
| 138 | + /** |
|
| 139 | + * Filter the post custom fields array. |
|
| 140 | + * |
|
| 141 | + * @since 1.0.0 |
|
| 142 | + * |
|
| 143 | + * @param array $return_arr Post custom fields array. |
|
| 144 | + * @param int|string $package_id The package ID. |
|
| 145 | + * @param string $post_type Optional. The wordpress post type. |
|
| 146 | + * @param string $fields_location Optional. Where exactly are you going to place this custom fields?. |
|
| 147 | + */ |
|
| 148 | + $return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
|
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + return $return_arr; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * Adds admin html for custom fields. |
|
| 156 | - * |
|
| 157 | - * @since 1.0.0 |
|
| 158 | - * @package GeoDirectory |
|
| 159 | - * @global object $wpdb WordPress Database object. |
|
| 160 | - * @param string $field_type The form field type. |
|
| 161 | - * @param object|int $result_str The custom field results object or row id. |
|
| 162 | - * @param string $field_ins_upd When set to "submit" displays form. |
|
| 163 | - * @param string $field_type_key The key of the custom field. |
|
| 164 | - */ |
|
| 165 | - function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='') |
|
| 166 | - {
|
|
| 167 | - global $wpdb; |
|
| 168 | - $cf = $result_str; |
|
| 169 | - if (!is_object($cf)) {
|
|
| 170 | - |
|
| 171 | - $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
|
|
| 172 | - |
|
| 173 | - } else {
|
|
| 174 | - $field_info = $cf; |
|
| 175 | - $result_str = $cf->id; |
|
| 176 | - } |
|
| 177 | - /** |
|
| 178 | - * Contains custom field html. |
|
| 179 | - * |
|
| 180 | - * @since 1.0.0 |
|
| 181 | - */ |
|
| 182 | - include('custom_field_html.php');
|
|
| 183 | - |
|
| 184 | - } |
|
| 154 | + /** |
|
| 155 | + * Adds admin html for custom fields. |
|
| 156 | + * |
|
| 157 | + * @since 1.0.0 |
|
| 158 | + * @package GeoDirectory |
|
| 159 | + * @global object $wpdb WordPress Database object. |
|
| 160 | + * @param string $field_type The form field type. |
|
| 161 | + * @param object|int $result_str The custom field results object or row id. |
|
| 162 | + * @param string $field_ins_upd When set to "submit" displays form. |
|
| 163 | + * @param string $field_type_key The key of the custom field. |
|
| 164 | + */ |
|
| 165 | + function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='') |
|
| 166 | + {
|
|
| 167 | + global $wpdb; |
|
| 168 | + $cf = $result_str; |
|
| 169 | + if (!is_object($cf)) {
|
|
| 170 | + |
|
| 171 | + $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
|
|
| 172 | + |
|
| 173 | + } else {
|
|
| 174 | + $field_info = $cf; |
|
| 175 | + $result_str = $cf->id; |
|
| 176 | + } |
|
| 177 | + /** |
|
| 178 | + * Contains custom field html. |
|
| 179 | + * |
|
| 180 | + * @since 1.0.0 |
|
| 181 | + */ |
|
| 182 | + include('custom_field_html.php');
|
|
| 183 | + |
|
| 184 | + } |
|
| 185 | 185 | |
| 186 | 186 | |
| 187 | 187 | if (!function_exists('geodir_custom_field_delete')) {
|
| 188 | - /** |
|
| 189 | - * Delete custom field using field id. |
|
| 190 | - * |
|
| 191 | - * @since 1.0.0 |
|
| 192 | - * @since 1.5.7 Delete field from sorting fields table when custom field deleted. |
|
| 193 | - * @package GeoDirectory |
|
| 194 | - * @global object $wpdb WordPress Database object. |
|
| 195 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 196 | - * @param string $field_id The custom field ID. |
|
| 197 | - * @return int|string If field deleted successfully, returns field id. Otherwise returns 0. |
|
| 198 | - */ |
|
| 199 | - function geodir_custom_field_delete($field_id = '') {
|
|
| 200 | - global $wpdb, $plugin_prefix; |
|
| 201 | - |
|
| 202 | - if ($field_id != '') {
|
|
| 203 | - $cf = trim($field_id, '_'); |
|
| 204 | - |
|
| 205 | - if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
|
|
| 206 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 207 | - |
|
| 208 | - $post_type = $field->post_type; |
|
| 209 | - $htmlvar_name = $field->htmlvar_name; |
|
| 210 | - |
|
| 211 | - if ($post_type != '' && $htmlvar_name != '') {
|
|
| 212 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
|
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - /** |
|
| 216 | - * Called after a custom field is deleted. |
|
| 217 | - * |
|
| 218 | - * @since 1.0.0 |
|
| 219 | - * @param string $cf The fields ID. |
|
| 220 | - * @param string $field->htmlvar_name The html variable name for the field. |
|
| 221 | - * @param string $post_type The post type the field belongs to. |
|
| 222 | - */ |
|
| 223 | - do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
|
|
| 224 | - |
|
| 225 | - if ($field->field_type == 'address') {
|
|
| 226 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
|
|
| 227 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
|
|
| 228 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
|
|
| 229 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
|
|
| 230 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
|
|
| 231 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
|
|
| 232 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
|
|
| 233 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
|
|
| 234 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
|
|
| 235 | - } else {
|
|
| 236 | - if ($field->field_type != 'fieldset') {
|
|
| 237 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
|
|
| 238 | - } |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - return $field_id; |
|
| 242 | - } else |
|
| 243 | - return 0; |
|
| 244 | - } else |
|
| 245 | - return 0; |
|
| 246 | - } |
|
| 188 | + /** |
|
| 189 | + * Delete custom field using field id. |
|
| 190 | + * |
|
| 191 | + * @since 1.0.0 |
|
| 192 | + * @since 1.5.7 Delete field from sorting fields table when custom field deleted. |
|
| 193 | + * @package GeoDirectory |
|
| 194 | + * @global object $wpdb WordPress Database object. |
|
| 195 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 196 | + * @param string $field_id The custom field ID. |
|
| 197 | + * @return int|string If field deleted successfully, returns field id. Otherwise returns 0. |
|
| 198 | + */ |
|
| 199 | + function geodir_custom_field_delete($field_id = '') {
|
|
| 200 | + global $wpdb, $plugin_prefix; |
|
| 201 | + |
|
| 202 | + if ($field_id != '') {
|
|
| 203 | + $cf = trim($field_id, '_'); |
|
| 204 | + |
|
| 205 | + if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
|
|
| 206 | + $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 207 | + |
|
| 208 | + $post_type = $field->post_type; |
|
| 209 | + $htmlvar_name = $field->htmlvar_name; |
|
| 210 | + |
|
| 211 | + if ($post_type != '' && $htmlvar_name != '') {
|
|
| 212 | + $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
|
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + /** |
|
| 216 | + * Called after a custom field is deleted. |
|
| 217 | + * |
|
| 218 | + * @since 1.0.0 |
|
| 219 | + * @param string $cf The fields ID. |
|
| 220 | + * @param string $field->htmlvar_name The html variable name for the field. |
|
| 221 | + * @param string $post_type The post type the field belongs to. |
|
| 222 | + */ |
|
| 223 | + do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
|
|
| 224 | + |
|
| 225 | + if ($field->field_type == 'address') {
|
|
| 226 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
|
|
| 227 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
|
|
| 228 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
|
|
| 229 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
|
|
| 230 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
|
|
| 231 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
|
|
| 232 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
|
|
| 233 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
|
|
| 234 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
|
|
| 235 | + } else {
|
|
| 236 | + if ($field->field_type != 'fieldset') {
|
|
| 237 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
|
|
| 238 | + } |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + return $field_id; |
|
| 242 | + } else |
|
| 243 | + return 0; |
|
| 244 | + } else |
|
| 245 | + return 0; |
|
| 246 | + } |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | if (!function_exists('geodir_custom_field_save')) {
|
| 250 | - /** |
|
| 251 | - * Save or Update custom fields into the database. |
|
| 252 | - * |
|
| 253 | - * @since 1.0.0 |
|
| 254 | - * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt. |
|
| 255 | - * @package GeoDirectory |
|
| 256 | - * @global object $wpdb WordPress Database object. |
|
| 257 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 258 | - * @param array $request_field {
|
|
| 259 | - * Attributes of the request field array. |
|
| 260 | - * |
|
| 261 | - * @type string $action Ajax Action name. Default "geodir_ajax_action". |
|
| 262 | - * @type string $manage_field_type Field type Default "custom_fields". |
|
| 263 | - * @type string $create_field Create field Default "true". |
|
| 264 | - * @type string $field_ins_upd Field ins upd Default "submit". |
|
| 265 | - * @type string $_wpnonce WP nonce value. |
|
| 266 | - * @type string $listing_type Listing type Example "gd_place". |
|
| 267 | - * @type string $field_type Field type Example "radio". |
|
| 268 | - * @type string $field_id Field id Example "12". |
|
| 269 | - * @type string $data_type Data type Example "VARCHAR". |
|
| 270 | - * @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere. |
|
| 271 | - * @type array $show_on_pkg Package list to display this field. |
|
| 272 | - * @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings. |
|
| 273 | - * @type string $site_title Section title which you wish to display in frontend. |
|
| 274 | - * @type string $admin_desc Section description which will appear in frontend. |
|
| 275 | - * @type string $htmlvar_name Html variable name. This should be a unique name. |
|
| 276 | - * @type string $clabels Section Title which will appear in backend. |
|
| 277 | - * @type string $default_value The default value (for "link" this will be used as the link text). |
|
| 278 | - * @type string $sort_order The display order of this field in backend. e.g. 5. |
|
| 279 | - * @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field. |
|
| 280 | - * @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field. |
|
| 281 | - * @type string $is_required Use "1" to set field as required. |
|
| 282 | - * @type string $required_msg Enter text for error message if field required and have not full fill requirement. |
|
| 283 | - * @type string $show_on_listing Want to show this on listing page?. |
|
| 284 | - * @type string $show_in What locations to show the custom field in. |
|
| 285 | - * @type string $show_on_detail Want to show this in More Info tab on detail page?. |
|
| 286 | - * @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes. |
|
| 287 | - * @type string $option_values Option Values should be separated by comma. |
|
| 288 | - * @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class. |
|
| 289 | - * @type string $css_class Enter custom css class for field custom style. |
|
| 290 | - * @type array $extra_fields An array of extra fields to store. |
|
| 291 | - * |
|
| 292 | - * } |
|
| 293 | - * @param bool $default Not yet implemented. |
|
| 294 | - * @return int|string If field is unique returns inserted row id. Otherwise returns error string. |
|
| 295 | - */ |
|
| 296 | - function geodir_custom_field_save($request_field = array(), $default = false) |
|
| 297 | - {
|
|
| 298 | - |
|
| 299 | - global $wpdb, $plugin_prefix; |
|
| 300 | - |
|
| 301 | - $old_html_variable = ''; |
|
| 302 | - |
|
| 303 | - $data_type = trim($request_field['data_type']); |
|
| 304 | - |
|
| 305 | - $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 306 | - |
|
| 307 | - // some servers fail if a POST value is VARCHAR so we change it. |
|
| 308 | - if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
|
|
| 309 | - $request_field['data_type'] = 'VARCHAR'; |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - $cf = trim($result_str, '_'); |
|
| 313 | - |
|
| 314 | - |
|
| 315 | - /*-------- check duplicate validation --------*/ |
|
| 316 | - |
|
| 317 | - $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 318 | - $post_type = $request_field['listing_type']; |
|
| 319 | - |
|
| 320 | - if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
|
|
| 321 | - $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name; |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - $check_html_variable = $wpdb->get_var( |
|
| 325 | - $wpdb->prepare( |
|
| 326 | - "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 327 | - array($cf, $cehhtmlvar_name, $post_type) |
|
| 328 | - ) |
|
| 329 | - ); |
|
| 330 | - |
|
| 331 | - |
|
| 332 | - if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
|
|
| 333 | - |
|
| 334 | - if ($cf != '') {
|
|
| 335 | - |
|
| 336 | - $post_meta_info = $wpdb->get_row( |
|
| 337 | - $wpdb->prepare( |
|
| 338 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d", |
|
| 339 | - array($cf) |
|
| 340 | - ) |
|
| 341 | - ); |
|
| 342 | - |
|
| 343 | - } |
|
| 344 | - |
|
| 345 | - if (!empty($post_meta_info)) {
|
|
| 346 | - $post_val = $post_meta_info; |
|
| 347 | - $old_html_variable = $post_val->htmlvar_name; |
|
| 348 | - |
|
| 349 | - } |
|
| 350 | - |
|
| 351 | - |
|
| 352 | - |
|
| 353 | - if ($post_type == '') $post_type = 'gd_place'; |
|
| 354 | - |
|
| 355 | - |
|
| 356 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
| 357 | - |
|
| 358 | - $admin_title = $request_field['admin_title']; |
|
| 359 | - $site_title = $request_field['site_title']; |
|
| 360 | - $data_type = $request_field['data_type']; |
|
| 361 | - $field_type = $request_field['field_type']; |
|
| 362 | - $field_type_key = isset($request_field['field_type_key']) ? $request_field['field_type_key'] : $field_type; |
|
| 363 | - $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 364 | - $admin_desc = $request_field['admin_desc']; |
|
| 365 | - $clabels = isset($request_field['clabels']) ? $request_field['clabels'] : ''; |
|
| 366 | - $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : ''; |
|
| 367 | - $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : ''; |
|
| 368 | - $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : ''; |
|
| 369 | - $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : ''; |
|
| 370 | - $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : ''; |
|
| 371 | - $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : ''; |
|
| 372 | - $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : ''; |
|
| 373 | - $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : ''; |
|
| 374 | - $show_in = isset($request_field['show_in']) ? $request_field['show_in'] : ''; |
|
| 375 | - $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : ''; |
|
| 376 | - $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : ''; |
|
| 377 | - $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type |
|
| 378 | - $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : ''; |
|
| 379 | - $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : ''; |
|
| 380 | - $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : ''; |
|
| 381 | - $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : ''; |
|
| 250 | + /** |
|
| 251 | + * Save or Update custom fields into the database. |
|
| 252 | + * |
|
| 253 | + * @since 1.0.0 |
|
| 254 | + * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt. |
|
| 255 | + * @package GeoDirectory |
|
| 256 | + * @global object $wpdb WordPress Database object. |
|
| 257 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 258 | + * @param array $request_field {
|
|
| 259 | + * Attributes of the request field array. |
|
| 260 | + * |
|
| 261 | + * @type string $action Ajax Action name. Default "geodir_ajax_action". |
|
| 262 | + * @type string $manage_field_type Field type Default "custom_fields". |
|
| 263 | + * @type string $create_field Create field Default "true". |
|
| 264 | + * @type string $field_ins_upd Field ins upd Default "submit". |
|
| 265 | + * @type string $_wpnonce WP nonce value. |
|
| 266 | + * @type string $listing_type Listing type Example "gd_place". |
|
| 267 | + * @type string $field_type Field type Example "radio". |
|
| 268 | + * @type string $field_id Field id Example "12". |
|
| 269 | + * @type string $data_type Data type Example "VARCHAR". |
|
| 270 | + * @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere. |
|
| 271 | + * @type array $show_on_pkg Package list to display this field. |
|
| 272 | + * @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings. |
|
| 273 | + * @type string $site_title Section title which you wish to display in frontend. |
|
| 274 | + * @type string $admin_desc Section description which will appear in frontend. |
|
| 275 | + * @type string $htmlvar_name Html variable name. This should be a unique name. |
|
| 276 | + * @type string $clabels Section Title which will appear in backend. |
|
| 277 | + * @type string $default_value The default value (for "link" this will be used as the link text). |
|
| 278 | + * @type string $sort_order The display order of this field in backend. e.g. 5. |
|
| 279 | + * @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field. |
|
| 280 | + * @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field. |
|
| 281 | + * @type string $is_required Use "1" to set field as required. |
|
| 282 | + * @type string $required_msg Enter text for error message if field required and have not full fill requirement. |
|
| 283 | + * @type string $show_on_listing Want to show this on listing page?. |
|
| 284 | + * @type string $show_in What locations to show the custom field in. |
|
| 285 | + * @type string $show_on_detail Want to show this in More Info tab on detail page?. |
|
| 286 | + * @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes. |
|
| 287 | + * @type string $option_values Option Values should be separated by comma. |
|
| 288 | + * @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class. |
|
| 289 | + * @type string $css_class Enter custom css class for field custom style. |
|
| 290 | + * @type array $extra_fields An array of extra fields to store. |
|
| 291 | + * |
|
| 292 | + * } |
|
| 293 | + * @param bool $default Not yet implemented. |
|
| 294 | + * @return int|string If field is unique returns inserted row id. Otherwise returns error string. |
|
| 295 | + */ |
|
| 296 | + function geodir_custom_field_save($request_field = array(), $default = false) |
|
| 297 | + {
|
|
| 298 | + |
|
| 299 | + global $wpdb, $plugin_prefix; |
|
| 300 | + |
|
| 301 | + $old_html_variable = ''; |
|
| 302 | + |
|
| 303 | + $data_type = trim($request_field['data_type']); |
|
| 304 | + |
|
| 305 | + $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 306 | + |
|
| 307 | + // some servers fail if a POST value is VARCHAR so we change it. |
|
| 308 | + if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
|
|
| 309 | + $request_field['data_type'] = 'VARCHAR'; |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + $cf = trim($result_str, '_'); |
|
| 313 | + |
|
| 314 | + |
|
| 315 | + /*-------- check duplicate validation --------*/ |
|
| 316 | + |
|
| 317 | + $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 318 | + $post_type = $request_field['listing_type']; |
|
| 319 | + |
|
| 320 | + if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
|
|
| 321 | + $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name; |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + $check_html_variable = $wpdb->get_var( |
|
| 325 | + $wpdb->prepare( |
|
| 326 | + "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 327 | + array($cf, $cehhtmlvar_name, $post_type) |
|
| 328 | + ) |
|
| 329 | + ); |
|
| 330 | + |
|
| 331 | + |
|
| 332 | + if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
|
|
| 333 | + |
|
| 334 | + if ($cf != '') {
|
|
| 335 | + |
|
| 336 | + $post_meta_info = $wpdb->get_row( |
|
| 337 | + $wpdb->prepare( |
|
| 338 | + "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d", |
|
| 339 | + array($cf) |
|
| 340 | + ) |
|
| 341 | + ); |
|
| 342 | + |
|
| 343 | + } |
|
| 344 | + |
|
| 345 | + if (!empty($post_meta_info)) {
|
|
| 346 | + $post_val = $post_meta_info; |
|
| 347 | + $old_html_variable = $post_val->htmlvar_name; |
|
| 348 | + |
|
| 349 | + } |
|
| 350 | + |
|
| 351 | + |
|
| 352 | + |
|
| 353 | + if ($post_type == '') $post_type = 'gd_place'; |
|
| 354 | + |
|
| 355 | + |
|
| 356 | + $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
| 357 | + |
|
| 358 | + $admin_title = $request_field['admin_title']; |
|
| 359 | + $site_title = $request_field['site_title']; |
|
| 360 | + $data_type = $request_field['data_type']; |
|
| 361 | + $field_type = $request_field['field_type']; |
|
| 362 | + $field_type_key = isset($request_field['field_type_key']) ? $request_field['field_type_key'] : $field_type; |
|
| 363 | + $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 364 | + $admin_desc = $request_field['admin_desc']; |
|
| 365 | + $clabels = isset($request_field['clabels']) ? $request_field['clabels'] : ''; |
|
| 366 | + $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : ''; |
|
| 367 | + $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : ''; |
|
| 368 | + $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : ''; |
|
| 369 | + $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : ''; |
|
| 370 | + $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : ''; |
|
| 371 | + $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : ''; |
|
| 372 | + $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : ''; |
|
| 373 | + $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : ''; |
|
| 374 | + $show_in = isset($request_field['show_in']) ? $request_field['show_in'] : ''; |
|
| 375 | + $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : ''; |
|
| 376 | + $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : ''; |
|
| 377 | + $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type |
|
| 378 | + $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : ''; |
|
| 379 | + $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : ''; |
|
| 380 | + $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : ''; |
|
| 381 | + $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : ''; |
|
| 382 | 382 | |
| 383 | 383 | |
| 384 | - if(is_array($show_in)){
|
|
| 385 | - $show_in = implode(",", $request_field['show_in']);
|
|
| 386 | - } |
|
| 384 | + if(is_array($show_in)){
|
|
| 385 | + $show_in = implode(",", $request_field['show_in']);
|
|
| 386 | + } |
|
| 387 | 387 | |
| 388 | - if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
|
|
| 389 | - $htmlvar_name = 'geodir_' . $htmlvar_name; |
|
| 390 | - } |
|
| 388 | + if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
|
|
| 389 | + $htmlvar_name = 'geodir_' . $htmlvar_name; |
|
| 390 | + } |
|
| 391 | 391 | |
| 392 | - $option_values = ''; |
|
| 393 | - if (isset($request_field['option_values'])) |
|
| 394 | - $option_values = $request_field['option_values']; |
|
| 392 | + $option_values = ''; |
|
| 393 | + if (isset($request_field['option_values'])) |
|
| 394 | + $option_values = $request_field['option_values']; |
|
| 395 | 395 | |
| 396 | - $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0'; |
|
| 396 | + $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0'; |
|
| 397 | 397 | |
| 398 | - $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0'; |
|
| 398 | + $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0'; |
|
| 399 | 399 | |
| 400 | - if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) |
|
| 401 | - $price_pkg = implode(",", $request_field['show_on_pkg']);
|
|
| 402 | - else {
|
|
| 403 | - $package_info = array(); |
|
| 400 | + if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) |
|
| 401 | + $price_pkg = implode(",", $request_field['show_on_pkg']);
|
|
| 402 | + else {
|
|
| 403 | + $package_info = array(); |
|
| 404 | 404 | |
| 405 | - $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
| 406 | - $price_pkg = !empty($package_info->pid) ? $package_info->pid : ''; |
|
| 407 | - } |
|
| 405 | + $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
| 406 | + $price_pkg = !empty($package_info->pid) ? $package_info->pid : ''; |
|
| 407 | + } |
|
| 408 | 408 | |
| 409 | 409 | |
| 410 | - if (isset($request_field['extra']) && !empty($request_field['extra'])) |
|
| 411 | - $extra_fields = $request_field['extra']; |
|
| 410 | + if (isset($request_field['extra']) && !empty($request_field['extra'])) |
|
| 411 | + $extra_fields = $request_field['extra']; |
|
| 412 | 412 | |
| 413 | - if (isset($request_field['is_default']) && $request_field['is_default'] != '') |
|
| 414 | - $is_default = $request_field['is_default']; |
|
| 415 | - else |
|
| 416 | - $is_default = '0'; |
|
| 413 | + if (isset($request_field['is_default']) && $request_field['is_default'] != '') |
|
| 414 | + $is_default = $request_field['is_default']; |
|
| 415 | + else |
|
| 416 | + $is_default = '0'; |
|
| 417 | 417 | |
| 418 | - if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') |
|
| 419 | - $is_admin = $request_field['is_admin']; |
|
| 420 | - else |
|
| 421 | - $is_admin = '0'; |
|
| 418 | + if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') |
|
| 419 | + $is_admin = $request_field['is_admin']; |
|
| 420 | + else |
|
| 421 | + $is_admin = '0'; |
|
| 422 | 422 | |
| 423 | 423 | |
| 424 | - if ($is_active == '') $is_active = 1; |
|
| 425 | - if ($is_required == '') $is_required = 0; |
|
| 424 | + if ($is_active == '') $is_active = 1; |
|
| 425 | + if ($is_required == '') $is_required = 0; |
|
| 426 | 426 | |
| 427 | 427 | |
| 428 | - if ($sort_order == '') {
|
|
| 428 | + if ($sort_order == '') {
|
|
| 429 | 429 | |
| 430 | - $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 430 | + $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 431 | 431 | |
| 432 | - $sort_order = (int)$last_order + 1; |
|
| 433 | - } |
|
| 432 | + $sort_order = (int)$last_order + 1; |
|
| 433 | + } |
|
| 434 | 434 | |
| 435 | - $default_value_add = ''; |
|
| 435 | + $default_value_add = ''; |
|
| 436 | 436 | |
| 437 | 437 | |
| 438 | - if (!empty($post_meta_info)) {
|
|
| 439 | - switch ($field_type): |
|
| 438 | + if (!empty($post_meta_info)) {
|
|
| 439 | + switch ($field_type): |
|
| 440 | 440 | |
| 441 | - case 'address': |
|
| 441 | + case 'address': |
|
| 442 | 442 | |
| 443 | - if ($htmlvar_name != '') {
|
|
| 444 | - $prefix = $htmlvar_name . '_'; |
|
| 445 | - } |
|
| 446 | - $old_prefix = $old_html_variable . '_'; |
|
| 443 | + if ($htmlvar_name != '') {
|
|
| 444 | + $prefix = $htmlvar_name . '_'; |
|
| 445 | + } |
|
| 446 | + $old_prefix = $old_html_variable . '_'; |
|
| 447 | 447 | |
| 448 | 448 | |
| 449 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL"; |
|
| 449 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL"; |
|
| 450 | 450 | |
| 451 | - if ($default_value != '') {
|
|
| 452 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 453 | - } |
|
| 451 | + if ($default_value != '') {
|
|
| 452 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 453 | + } |
|
| 454 | 454 | |
| 455 | - $wpdb->query($meta_field_add); |
|
| 455 | + $wpdb->query($meta_field_add); |
|
| 456 | 456 | |
| 457 | - if ($extra_fields != '') {
|
|
| 457 | + if ($extra_fields != '') {
|
|
| 458 | 458 | |
| 459 | - if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
|
| 459 | + if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
|
| 460 | 460 | |
| 461 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
|
|
| 462 | - if ($is_column) {
|
|
| 463 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL"; |
|
| 461 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
|
|
| 462 | + if ($is_column) {
|
|
| 463 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL"; |
|
| 464 | 464 | |
| 465 | - if ($default_value != '') {
|
|
| 466 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 467 | - } |
|
| 465 | + if ($default_value != '') {
|
|
| 466 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 467 | + } |
|
| 468 | 468 | |
| 469 | - $wpdb->query($meta_field_add); |
|
| 470 | - } else {
|
|
| 469 | + $wpdb->query($meta_field_add); |
|
| 470 | + } else {
|
|
| 471 | 471 | |
| 472 | - $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 473 | - if ($default_value != '') {
|
|
| 474 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 475 | - } |
|
| 476 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 472 | + $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 473 | + if ($default_value != '') {
|
|
| 474 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 475 | + } |
|
| 476 | + geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 477 | 477 | |
| 478 | - } |
|
| 478 | + } |
|
| 479 | 479 | |
| 480 | 480 | |
| 481 | - } |
|
| 481 | + } |
|
| 482 | 482 | |
| 483 | 483 | |
| 484 | - if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
|
| 484 | + if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
|
| 485 | 485 | |
| 486 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
|
|
| 486 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
|
|
| 487 | 487 | |
| 488 | - if ($is_column) {
|
|
| 489 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL"; |
|
| 488 | + if ($is_column) {
|
|
| 489 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL"; |
|
| 490 | 490 | |
| 491 | - if ($default_value != '') {
|
|
| 492 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 493 | - } |
|
| 491 | + if ($default_value != '') {
|
|
| 492 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 493 | + } |
|
| 494 | 494 | |
| 495 | - $wpdb->query($meta_field_add); |
|
| 496 | - } else {
|
|
| 497 | - $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 498 | - if ($default_value != '') {
|
|
| 499 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 500 | - } |
|
| 495 | + $wpdb->query($meta_field_add); |
|
| 496 | + } else {
|
|
| 497 | + $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 498 | + if ($default_value != '') {
|
|
| 499 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 500 | + } |
|
| 501 | 501 | |
| 502 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 503 | - } |
|
| 502 | + geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 503 | + } |
|
| 504 | 504 | |
| 505 | - } |
|
| 506 | - if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
|
| 505 | + } |
|
| 506 | + if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
|
| 507 | 507 | |
| 508 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
|
|
| 508 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
|
|
| 509 | 509 | |
| 510 | - if ($is_column) {
|
|
| 510 | + if ($is_column) {
|
|
| 511 | 511 | |
| 512 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL"; |
|
| 512 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL"; |
|
| 513 | 513 | |
| 514 | - if ($default_value != '') {
|
|
| 515 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 516 | - } |
|
| 514 | + if ($default_value != '') {
|
|
| 515 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 516 | + } |
|
| 517 | 517 | |
| 518 | - $wpdb->query($meta_field_add); |
|
| 519 | - } else {
|
|
| 518 | + $wpdb->query($meta_field_add); |
|
| 519 | + } else {
|
|
| 520 | 520 | |
| 521 | - $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 522 | - if ($default_value != '') {
|
|
| 523 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 524 | - } |
|
| 521 | + $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 522 | + if ($default_value != '') {
|
|
| 523 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 524 | + } |
|
| 525 | 525 | |
| 526 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 526 | + geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 527 | 527 | |
| 528 | - } |
|
| 528 | + } |
|
| 529 | 529 | |
| 530 | - } |
|
| 531 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 530 | + } |
|
| 531 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 532 | 532 | |
| 533 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
|
|
| 533 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
|
|
| 534 | 534 | |
| 535 | - if ($is_column) {
|
|
| 535 | + if ($is_column) {
|
|
| 536 | 536 | |
| 537 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL"; |
|
| 537 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL"; |
|
| 538 | 538 | |
| 539 | - if ($default_value != '') {
|
|
| 540 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 541 | - } |
|
| 539 | + if ($default_value != '') {
|
|
| 540 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 541 | + } |
|
| 542 | 542 | |
| 543 | - $wpdb->query($meta_field_add); |
|
| 544 | - } else {
|
|
| 543 | + $wpdb->query($meta_field_add); |
|
| 544 | + } else {
|
|
| 545 | 545 | |
| 546 | - $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 547 | - if ($default_value != '') {
|
|
| 548 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 549 | - } |
|
| 546 | + $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 547 | + if ($default_value != '') {
|
|
| 548 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 549 | + } |
|
| 550 | 550 | |
| 551 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 551 | + geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 552 | 552 | |
| 553 | - } |
|
| 553 | + } |
|
| 554 | 554 | |
| 555 | - } |
|
| 556 | - if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
|
| 555 | + } |
|
| 556 | + if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
|
| 557 | 557 | |
| 558 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
|
|
| 559 | - if ($is_column) {
|
|
| 558 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
|
|
| 559 | + if ($is_column) {
|
|
| 560 | 560 | |
| 561 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 561 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 562 | 562 | |
| 563 | - if ($default_value != '') {
|
|
| 564 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 565 | - } |
|
| 563 | + if ($default_value != '') {
|
|
| 564 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 565 | + } |
|
| 566 | 566 | |
| 567 | - $wpdb->query($meta_field_add); |
|
| 568 | - } else {
|
|
| 567 | + $wpdb->query($meta_field_add); |
|
| 568 | + } else {
|
|
| 569 | 569 | |
| 570 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 571 | - $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 572 | - if ($default_value != '') {
|
|
| 573 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 574 | - } |
|
| 570 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 571 | + $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 572 | + if ($default_value != '') {
|
|
| 573 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 574 | + } |
|
| 575 | 575 | |
| 576 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 576 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 577 | 577 | |
| 578 | - } |
|
| 578 | + } |
|
| 579 | 579 | |
| 580 | 580 | |
| 581 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
|
|
| 581 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
|
|
| 582 | 582 | |
| 583 | - if ($is_column) {
|
|
| 584 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 583 | + if ($is_column) {
|
|
| 584 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 585 | 585 | |
| 586 | - if ($default_value != '') {
|
|
| 587 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 588 | - } |
|
| 586 | + if ($default_value != '') {
|
|
| 587 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 588 | + } |
|
| 589 | 589 | |
| 590 | - $wpdb->query($meta_field_add); |
|
| 591 | - } else {
|
|
| 590 | + $wpdb->query($meta_field_add); |
|
| 591 | + } else {
|
|
| 592 | 592 | |
| 593 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 594 | - $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 595 | - if ($default_value != '') {
|
|
| 596 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 597 | - } |
|
| 593 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 594 | + $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 595 | + if ($default_value != '') {
|
|
| 596 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 597 | + } |
|
| 598 | 598 | |
| 599 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 600 | - } |
|
| 599 | + geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 600 | + } |
|
| 601 | 601 | |
| 602 | - } |
|
| 603 | - if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
|
| 602 | + } |
|
| 603 | + if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
|
| 604 | 604 | |
| 605 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
|
|
| 605 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
|
|
| 606 | 606 | |
| 607 | - if ($is_column) {
|
|
| 608 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 607 | + if ($is_column) {
|
|
| 608 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 609 | 609 | |
| 610 | - if ($default_value != '') {
|
|
| 611 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 612 | - } |
|
| 610 | + if ($default_value != '') {
|
|
| 611 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 612 | + } |
|
| 613 | 613 | |
| 614 | - $wpdb->query($meta_field_add); |
|
| 615 | - } else {
|
|
| 614 | + $wpdb->query($meta_field_add); |
|
| 615 | + } else {
|
|
| 616 | 616 | |
| 617 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 617 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 618 | 618 | |
| 619 | - $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 620 | - if ($default_value != '') {
|
|
| 621 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 622 | - } |
|
| 619 | + $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 620 | + if ($default_value != '') {
|
|
| 621 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 622 | + } |
|
| 623 | 623 | |
| 624 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 625 | - } |
|
| 624 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 625 | + } |
|
| 626 | 626 | |
| 627 | 627 | |
| 628 | - } |
|
| 629 | - if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
|
| 628 | + } |
|
| 629 | + if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
|
| 630 | 630 | |
| 631 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
|
|
| 632 | - if ($is_column) {
|
|
| 633 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 631 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
|
|
| 632 | + if ($is_column) {
|
|
| 633 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 634 | 634 | |
| 635 | - if ($default_value != '') {
|
|
| 636 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 637 | - } |
|
| 635 | + if ($default_value != '') {
|
|
| 636 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 637 | + } |
|
| 638 | 638 | |
| 639 | - $wpdb->query($meta_field_add); |
|
| 639 | + $wpdb->query($meta_field_add); |
|
| 640 | 640 | |
| 641 | - } else {
|
|
| 641 | + } else {
|
|
| 642 | 642 | |
| 643 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 643 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 644 | 644 | |
| 645 | - $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 646 | - if ($default_value != '') {
|
|
| 647 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 648 | - } |
|
| 645 | + $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 646 | + if ($default_value != '') {
|
|
| 647 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 648 | + } |
|
| 649 | 649 | |
| 650 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 651 | - } |
|
| 650 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 651 | + } |
|
| 652 | 652 | |
| 653 | - } |
|
| 654 | - // show lat lng |
|
| 655 | - if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
|
| 656 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
|
|
| 653 | + } |
|
| 654 | + // show lat lng |
|
| 655 | + if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
|
| 656 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
|
|
| 657 | 657 | |
| 658 | - if ($is_column) {
|
|
| 659 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 660 | - $meta_field_add .= " DEFAULT '1'"; |
|
| 658 | + if ($is_column) {
|
|
| 659 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 660 | + $meta_field_add .= " DEFAULT '1'"; |
|
| 661 | 661 | |
| 662 | - $wpdb->query($meta_field_add); |
|
| 663 | - } else {
|
|
| 664 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 662 | + $wpdb->query($meta_field_add); |
|
| 663 | + } else {
|
|
| 664 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 665 | 665 | |
| 666 | - $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 667 | - $meta_field_add .= " DEFAULT '1'"; |
|
| 666 | + $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 667 | + $meta_field_add .= " DEFAULT '1'"; |
|
| 668 | 668 | |
| 669 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 670 | - } |
|
| 669 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 670 | + } |
|
| 671 | 671 | |
| 672 | - } |
|
| 673 | - }// end extra |
|
| 672 | + } |
|
| 673 | + }// end extra |
|
| 674 | 674 | |
| 675 | - break; |
|
| 675 | + break; |
|
| 676 | 676 | |
| 677 | - case 'checkbox': |
|
| 678 | - case 'multiselect': |
|
| 679 | - case 'select': |
|
| 680 | - case 'taxonomy': |
|
| 677 | + case 'checkbox': |
|
| 678 | + case 'multiselect': |
|
| 679 | + case 'select': |
|
| 680 | + case 'taxonomy': |
|
| 681 | 681 | |
| 682 | - $op_size = '500'; |
|
| 682 | + $op_size = '500'; |
|
| 683 | 683 | |
| 684 | - // only make the field as big as it needs to be. |
|
| 685 | - if(isset($option_values) && $option_values && $field_type=='select'){
|
|
| 686 | - $option_values_arr = explode(',',$option_values);
|
|
| 687 | - if(is_array($option_values_arr)){
|
|
| 688 | - $op_max = 0; |
|
| 689 | - foreach($option_values_arr as $op_val){
|
|
| 690 | - if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
|
|
| 691 | - } |
|
| 692 | - if($op_max){$op_size =$op_max; }
|
|
| 693 | - } |
|
| 694 | - }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 695 | - if(strlen($option_values)){
|
|
| 696 | - $op_size = strlen($option_values); |
|
| 697 | - } |
|
| 698 | - } |
|
| 684 | + // only make the field as big as it needs to be. |
|
| 685 | + if(isset($option_values) && $option_values && $field_type=='select'){
|
|
| 686 | + $option_values_arr = explode(',',$option_values);
|
|
| 687 | + if(is_array($option_values_arr)){
|
|
| 688 | + $op_max = 0; |
|
| 689 | + foreach($option_values_arr as $op_val){
|
|
| 690 | + if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
|
|
| 691 | + } |
|
| 692 | + if($op_max){$op_size =$op_max; }
|
|
| 693 | + } |
|
| 694 | + }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 695 | + if(strlen($option_values)){
|
|
| 696 | + $op_size = strlen($option_values); |
|
| 697 | + } |
|
| 698 | + } |
|
| 699 | 699 | |
| 700 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL"; |
|
| 700 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL"; |
|
| 701 | 701 | |
| 702 | - if ($default_value != '') {
|
|
| 703 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 704 | - } |
|
| 702 | + if ($default_value != '') {
|
|
| 703 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 704 | + } |
|
| 705 | 705 | |
| 706 | - $alter_result = $wpdb->query($meta_field_add); |
|
| 707 | - if($alter_result===false){
|
|
| 708 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 709 | - } |
|
| 706 | + $alter_result = $wpdb->query($meta_field_add); |
|
| 707 | + if($alter_result===false){
|
|
| 708 | + return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 709 | + } |
|
| 710 | 710 | |
| 711 | - if (isset($request_field['cat_display_type'])) |
|
| 712 | - $extra_fields = $request_field['cat_display_type']; |
|
| 711 | + if (isset($request_field['cat_display_type'])) |
|
| 712 | + $extra_fields = $request_field['cat_display_type']; |
|
| 713 | 713 | |
| 714 | - if (isset($request_field['multi_display_type'])) |
|
| 715 | - $extra_fields = $request_field['multi_display_type']; |
|
| 714 | + if (isset($request_field['multi_display_type'])) |
|
| 715 | + $extra_fields = $request_field['multi_display_type']; |
|
| 716 | 716 | |
| 717 | 717 | |
| 718 | - break; |
|
| 718 | + break; |
|
| 719 | 719 | |
| 720 | - case 'textarea': |
|
| 721 | - case 'html': |
|
| 722 | - case 'url': |
|
| 723 | - case 'file': |
|
| 720 | + case 'textarea': |
|
| 721 | + case 'html': |
|
| 722 | + case 'url': |
|
| 723 | + case 'file': |
|
| 724 | 724 | |
| 725 | - $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
|
|
| 726 | - if($alter_result===false){
|
|
| 727 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 728 | - } |
|
| 729 | - if (isset($request_field['advanced_editor'])) |
|
| 730 | - $extra_fields = $request_field['advanced_editor']; |
|
| 731 | - |
|
| 732 | - break; |
|
| 725 | + $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
|
|
| 726 | + if($alter_result===false){
|
|
| 727 | + return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 728 | + } |
|
| 729 | + if (isset($request_field['advanced_editor'])) |
|
| 730 | + $extra_fields = $request_field['advanced_editor']; |
|
| 731 | + |
|
| 732 | + break; |
|
| 733 | 733 | |
| 734 | - case 'fieldset': |
|
| 735 | - // Nothing happened for fieldset |
|
| 736 | - break; |
|
| 734 | + case 'fieldset': |
|
| 735 | + // Nothing happened for fieldset |
|
| 736 | + break; |
|
| 737 | 737 | |
| 738 | - default: |
|
| 739 | - if ($data_type != 'VARCHAR' && $data_type != '') {
|
|
| 740 | - if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
|
| 741 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL"; |
|
| 742 | - } else {
|
|
| 743 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL"; |
|
| 744 | - } |
|
| 745 | - |
|
| 746 | - if (is_numeric($default_value) && $default_value != '') {
|
|
| 747 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 748 | - } |
|
| 749 | - } else {
|
|
| 750 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL"; |
|
| 751 | - if ($default_value != '') {
|
|
| 752 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 753 | - } |
|
| 754 | - } |
|
| 755 | - |
|
| 756 | - $alter_result = $wpdb->query($default_value_add); |
|
| 757 | - if($alter_result===false){
|
|
| 758 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 759 | - } |
|
| 760 | - break; |
|
| 761 | - endswitch; |
|
| 762 | - |
|
| 763 | - $extra_field_query = ''; |
|
| 764 | - if (!empty($extra_fields)) {
|
|
| 765 | - $extra_field_query = serialize($extra_fields); |
|
| 766 | - } |
|
| 767 | - |
|
| 768 | - $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : ''; |
|
| 769 | - |
|
| 770 | - $wpdb->query( |
|
| 771 | - |
|
| 772 | - $wpdb->prepare( |
|
| 773 | - |
|
| 774 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 738 | + default: |
|
| 739 | + if ($data_type != 'VARCHAR' && $data_type != '') {
|
|
| 740 | + if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
|
| 741 | + $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL"; |
|
| 742 | + } else {
|
|
| 743 | + $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL"; |
|
| 744 | + } |
|
| 745 | + |
|
| 746 | + if (is_numeric($default_value) && $default_value != '') {
|
|
| 747 | + $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 748 | + } |
|
| 749 | + } else {
|
|
| 750 | + $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL"; |
|
| 751 | + if ($default_value != '') {
|
|
| 752 | + $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 753 | + } |
|
| 754 | + } |
|
| 755 | + |
|
| 756 | + $alter_result = $wpdb->query($default_value_add); |
|
| 757 | + if($alter_result===false){
|
|
| 758 | + return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 759 | + } |
|
| 760 | + break; |
|
| 761 | + endswitch; |
|
| 762 | + |
|
| 763 | + $extra_field_query = ''; |
|
| 764 | + if (!empty($extra_fields)) {
|
|
| 765 | + $extra_field_query = serialize($extra_fields); |
|
| 766 | + } |
|
| 767 | + |
|
| 768 | + $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : ''; |
|
| 769 | + |
|
| 770 | + $wpdb->query( |
|
| 771 | + |
|
| 772 | + $wpdb->prepare( |
|
| 773 | + |
|
| 774 | + "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 775 | 775 | post_type = %s, |
| 776 | 776 | admin_title = %s, |
| 777 | 777 | site_title = %s, |
@@ -805,308 +805,308 @@ discard block |
||
| 805 | 805 | for_admin_use = %s |
| 806 | 806 | where id = %d", |
| 807 | 807 | |
| 808 | - array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf) |
|
| 809 | - ) |
|
| 808 | + array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf) |
|
| 809 | + ) |
|
| 810 | 810 | |
| 811 | - ); |
|
| 811 | + ); |
|
| 812 | 812 | |
| 813 | - $lastid = trim($cf); |
|
| 813 | + $lastid = trim($cf); |
|
| 814 | 814 | |
| 815 | 815 | |
| 816 | - $wpdb->query( |
|
| 817 | - $wpdb->prepare( |
|
| 818 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 816 | + $wpdb->query( |
|
| 817 | + $wpdb->prepare( |
|
| 818 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 819 | 819 | site_title=%s |
| 820 | 820 | where post_type = %s and htmlvar_name = %s", |
| 821 | - array($site_title, $post_type, $htmlvar_name) |
|
| 822 | - ) |
|
| 823 | - ); |
|
| 824 | - |
|
| 825 | - |
|
| 826 | - if ($cat_sort == '') |
|
| 827 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 828 | - |
|
| 829 | - |
|
| 830 | - /** |
|
| 831 | - * Called after all custom fields are saved for a post. |
|
| 832 | - * |
|
| 833 | - * @since 1.0.0 |
|
| 834 | - * @param int $lastid The post ID. |
|
| 835 | - */ |
|
| 836 | - do_action('geodir_after_custom_fields_updated', $lastid);
|
|
| 837 | - |
|
| 838 | - } else {
|
|
| 839 | - |
|
| 840 | - switch ($field_type): |
|
| 841 | - |
|
| 842 | - case 'address': |
|
| 843 | - |
|
| 844 | - $data_type = ''; |
|
| 845 | - |
|
| 846 | - if ($htmlvar_name != '') {
|
|
| 847 | - $prefix = $htmlvar_name . '_'; |
|
| 848 | - } |
|
| 849 | - $old_prefix = $old_html_variable; |
|
| 850 | - |
|
| 851 | - //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL"; |
|
| 852 | - |
|
| 853 | - $meta_field_add = "VARCHAR( 254 ) NULL"; |
|
| 854 | - if ($default_value != '') {
|
|
| 855 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 856 | - } |
|
| 857 | - |
|
| 858 | - geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add); |
|
| 859 | - //$wpdb->query($meta_field_add); |
|
| 860 | - |
|
| 861 | - |
|
| 862 | - if (!empty($extra_fields)) {
|
|
| 821 | + array($site_title, $post_type, $htmlvar_name) |
|
| 822 | + ) |
|
| 823 | + ); |
|
| 824 | + |
|
| 825 | + |
|
| 826 | + if ($cat_sort == '') |
|
| 827 | + $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 828 | + |
|
| 829 | + |
|
| 830 | + /** |
|
| 831 | + * Called after all custom fields are saved for a post. |
|
| 832 | + * |
|
| 833 | + * @since 1.0.0 |
|
| 834 | + * @param int $lastid The post ID. |
|
| 835 | + */ |
|
| 836 | + do_action('geodir_after_custom_fields_updated', $lastid);
|
|
| 837 | + |
|
| 838 | + } else {
|
|
| 839 | + |
|
| 840 | + switch ($field_type): |
|
| 841 | + |
|
| 842 | + case 'address': |
|
| 843 | + |
|
| 844 | + $data_type = ''; |
|
| 845 | + |
|
| 846 | + if ($htmlvar_name != '') {
|
|
| 847 | + $prefix = $htmlvar_name . '_'; |
|
| 848 | + } |
|
| 849 | + $old_prefix = $old_html_variable; |
|
| 850 | + |
|
| 851 | + //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL"; |
|
| 852 | + |
|
| 853 | + $meta_field_add = "VARCHAR( 254 ) NULL"; |
|
| 854 | + if ($default_value != '') {
|
|
| 855 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 856 | + } |
|
| 857 | + |
|
| 858 | + geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add); |
|
| 859 | + //$wpdb->query($meta_field_add); |
|
| 860 | + |
|
| 861 | + |
|
| 862 | + if (!empty($extra_fields)) {
|
|
| 863 | 863 | |
| 864 | - if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
|
| 865 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL"; |
|
| 866 | - $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 867 | - if ($default_value != '') {
|
|
| 868 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 869 | - } |
|
| 870 | - |
|
| 871 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 872 | - //$wpdb->query($meta_field_add); |
|
| 873 | - } |
|
| 874 | - if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
|
| 875 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL"; |
|
| 876 | - $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 877 | - if ($default_value != '') {
|
|
| 878 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 879 | - } |
|
| 880 | - |
|
| 881 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 882 | - //$wpdb->query($meta_field_add); |
|
| 883 | - } |
|
| 884 | - if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
|
| 885 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL"; |
|
| 886 | - |
|
| 887 | - $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 888 | - if ($default_value != '') {
|
|
| 889 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 890 | - } |
|
| 891 | - |
|
| 892 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 893 | - //$wpdb->query($meta_field_add); |
|
| 894 | - } |
|
| 895 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 896 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL"; |
|
| 897 | - $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 898 | - if ($default_value != '') {
|
|
| 899 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 900 | - } |
|
| 901 | - |
|
| 902 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 903 | - //$wpdb->query($meta_field_add); |
|
| 904 | - } |
|
| 905 | - if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
|
| 906 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 907 | - $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 908 | - if ($default_value != '') {
|
|
| 909 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 910 | - } |
|
| 911 | - |
|
| 912 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 913 | - //$wpdb->query($meta_field_add); |
|
| 914 | - |
|
| 915 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 916 | - |
|
| 917 | - $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 918 | - if ($default_value != '') {
|
|
| 919 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 920 | - } |
|
| 921 | - |
|
| 922 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 923 | - |
|
| 924 | - //$wpdb->query($meta_field_add); |
|
| 925 | - } |
|
| 926 | - if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
|
| 927 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 928 | - |
|
| 929 | - $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 930 | - if ($default_value != '') {
|
|
| 931 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 932 | - } |
|
| 933 | - |
|
| 934 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 935 | - |
|
| 936 | - //$wpdb->query($meta_field_add); |
|
| 937 | - } |
|
| 938 | - if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
|
| 939 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 940 | - |
|
| 941 | - $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 942 | - if ($default_value != '') {
|
|
| 943 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 944 | - } |
|
| 945 | - |
|
| 946 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 947 | - |
|
| 948 | - //$wpdb->query($meta_field_add); |
|
| 949 | - } |
|
| 950 | - // show lat lng |
|
| 951 | - if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
|
| 952 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 953 | - |
|
| 954 | - $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 955 | - $meta_field_add .= " DEFAULT '1'"; |
|
| 956 | - |
|
| 957 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 958 | - //$wpdb->query($meta_field_add); |
|
| 959 | - } |
|
| 960 | - } |
|
| 961 | - |
|
| 962 | - break; |
|
| 963 | - |
|
| 964 | - case 'checkbox': |
|
| 965 | - $data_type = 'TINYINT'; |
|
| 966 | - |
|
| 967 | - $meta_field_add = $data_type . "( 1 ) NOT NULL "; |
|
| 968 | - if ((int)$default_value === 1) {
|
|
| 969 | - $meta_field_add .= " DEFAULT '1'"; |
|
| 970 | - } |
|
| 971 | - |
|
| 972 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 973 | - if ($add_result === false) {
|
|
| 974 | - return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 975 | - } |
|
| 976 | - break; |
|
| 977 | - case 'multiselect': |
|
| 978 | - case 'select': |
|
| 979 | - $data_type = 'VARCHAR'; |
|
| 980 | - $op_size = '500'; |
|
| 981 | - |
|
| 982 | - // only make the field as big as it needs to be. |
|
| 983 | - if (isset($option_values) && $option_values && $field_type == 'select') {
|
|
| 984 | - $option_values_arr = explode(',', $option_values);
|
|
| 985 | - |
|
| 986 | - if (is_array($option_values_arr)) {
|
|
| 987 | - $op_max = 0; |
|
| 988 | - |
|
| 989 | - foreach ($option_values_arr as $op_val) {
|
|
| 990 | - if (strlen($op_val) && strlen($op_val) > $op_max) {
|
|
| 991 | - $op_max = strlen($op_val); |
|
| 992 | - } |
|
| 993 | - } |
|
| 994 | - |
|
| 995 | - if ($op_max) {
|
|
| 996 | - $op_size = $op_max; |
|
| 997 | - } |
|
| 998 | - } |
|
| 999 | - } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
|
| 1000 | - if (strlen($option_values)) {
|
|
| 1001 | - $op_size = strlen($option_values); |
|
| 1002 | - } |
|
| 1003 | - |
|
| 1004 | - if (isset($request_field['multi_display_type'])) {
|
|
| 1005 | - $extra_fields = $request_field['multi_display_type']; |
|
| 1006 | - } |
|
| 1007 | - } |
|
| 1008 | - |
|
| 1009 | - $meta_field_add = $data_type . "( $op_size ) NULL "; |
|
| 1010 | - if ($default_value != '') {
|
|
| 1011 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1012 | - } |
|
| 1013 | - |
|
| 1014 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1015 | - if ($add_result === false) {
|
|
| 1016 | - return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1017 | - } |
|
| 1018 | - break; |
|
| 1019 | - case 'textarea': |
|
| 1020 | - case 'html': |
|
| 1021 | - case 'url': |
|
| 1022 | - case 'file': |
|
| 1023 | - |
|
| 1024 | - $data_type = 'TEXT'; |
|
| 1025 | - |
|
| 1026 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1027 | - |
|
| 1028 | - $meta_field_add = $data_type . " NULL "; |
|
| 1029 | - /*if($default_value != '') |
|
| 864 | + if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
|
| 865 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL"; |
|
| 866 | + $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 867 | + if ($default_value != '') {
|
|
| 868 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 869 | + } |
|
| 870 | + |
|
| 871 | + geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 872 | + //$wpdb->query($meta_field_add); |
|
| 873 | + } |
|
| 874 | + if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
|
| 875 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL"; |
|
| 876 | + $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 877 | + if ($default_value != '') {
|
|
| 878 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 879 | + } |
|
| 880 | + |
|
| 881 | + geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 882 | + //$wpdb->query($meta_field_add); |
|
| 883 | + } |
|
| 884 | + if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
|
| 885 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL"; |
|
| 886 | + |
|
| 887 | + $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 888 | + if ($default_value != '') {
|
|
| 889 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 890 | + } |
|
| 891 | + |
|
| 892 | + geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 893 | + //$wpdb->query($meta_field_add); |
|
| 894 | + } |
|
| 895 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 896 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL"; |
|
| 897 | + $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 898 | + if ($default_value != '') {
|
|
| 899 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 900 | + } |
|
| 901 | + |
|
| 902 | + geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 903 | + //$wpdb->query($meta_field_add); |
|
| 904 | + } |
|
| 905 | + if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
|
| 906 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 907 | + $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 908 | + if ($default_value != '') {
|
|
| 909 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 910 | + } |
|
| 911 | + |
|
| 912 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 913 | + //$wpdb->query($meta_field_add); |
|
| 914 | + |
|
| 915 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 916 | + |
|
| 917 | + $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 918 | + if ($default_value != '') {
|
|
| 919 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 920 | + } |
|
| 921 | + |
|
| 922 | + geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 923 | + |
|
| 924 | + //$wpdb->query($meta_field_add); |
|
| 925 | + } |
|
| 926 | + if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
|
| 927 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 928 | + |
|
| 929 | + $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 930 | + if ($default_value != '') {
|
|
| 931 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 932 | + } |
|
| 933 | + |
|
| 934 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 935 | + |
|
| 936 | + //$wpdb->query($meta_field_add); |
|
| 937 | + } |
|
| 938 | + if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
|
| 939 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 940 | + |
|
| 941 | + $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 942 | + if ($default_value != '') {
|
|
| 943 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 944 | + } |
|
| 945 | + |
|
| 946 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 947 | + |
|
| 948 | + //$wpdb->query($meta_field_add); |
|
| 949 | + } |
|
| 950 | + // show lat lng |
|
| 951 | + if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
|
| 952 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 953 | + |
|
| 954 | + $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 955 | + $meta_field_add .= " DEFAULT '1'"; |
|
| 956 | + |
|
| 957 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 958 | + //$wpdb->query($meta_field_add); |
|
| 959 | + } |
|
| 960 | + } |
|
| 961 | + |
|
| 962 | + break; |
|
| 963 | + |
|
| 964 | + case 'checkbox': |
|
| 965 | + $data_type = 'TINYINT'; |
|
| 966 | + |
|
| 967 | + $meta_field_add = $data_type . "( 1 ) NOT NULL "; |
|
| 968 | + if ((int)$default_value === 1) {
|
|
| 969 | + $meta_field_add .= " DEFAULT '1'"; |
|
| 970 | + } |
|
| 971 | + |
|
| 972 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 973 | + if ($add_result === false) {
|
|
| 974 | + return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 975 | + } |
|
| 976 | + break; |
|
| 977 | + case 'multiselect': |
|
| 978 | + case 'select': |
|
| 979 | + $data_type = 'VARCHAR'; |
|
| 980 | + $op_size = '500'; |
|
| 981 | + |
|
| 982 | + // only make the field as big as it needs to be. |
|
| 983 | + if (isset($option_values) && $option_values && $field_type == 'select') {
|
|
| 984 | + $option_values_arr = explode(',', $option_values);
|
|
| 985 | + |
|
| 986 | + if (is_array($option_values_arr)) {
|
|
| 987 | + $op_max = 0; |
|
| 988 | + |
|
| 989 | + foreach ($option_values_arr as $op_val) {
|
|
| 990 | + if (strlen($op_val) && strlen($op_val) > $op_max) {
|
|
| 991 | + $op_max = strlen($op_val); |
|
| 992 | + } |
|
| 993 | + } |
|
| 994 | + |
|
| 995 | + if ($op_max) {
|
|
| 996 | + $op_size = $op_max; |
|
| 997 | + } |
|
| 998 | + } |
|
| 999 | + } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
|
| 1000 | + if (strlen($option_values)) {
|
|
| 1001 | + $op_size = strlen($option_values); |
|
| 1002 | + } |
|
| 1003 | + |
|
| 1004 | + if (isset($request_field['multi_display_type'])) {
|
|
| 1005 | + $extra_fields = $request_field['multi_display_type']; |
|
| 1006 | + } |
|
| 1007 | + } |
|
| 1008 | + |
|
| 1009 | + $meta_field_add = $data_type . "( $op_size ) NULL "; |
|
| 1010 | + if ($default_value != '') {
|
|
| 1011 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1012 | + } |
|
| 1013 | + |
|
| 1014 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1015 | + if ($add_result === false) {
|
|
| 1016 | + return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1017 | + } |
|
| 1018 | + break; |
|
| 1019 | + case 'textarea': |
|
| 1020 | + case 'html': |
|
| 1021 | + case 'url': |
|
| 1022 | + case 'file': |
|
| 1023 | + |
|
| 1024 | + $data_type = 'TEXT'; |
|
| 1025 | + |
|
| 1026 | + $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1027 | + |
|
| 1028 | + $meta_field_add = $data_type . " NULL "; |
|
| 1029 | + /*if($default_value != '') |
|
| 1030 | 1030 | { $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
|
| 1031 | 1031 | |
| 1032 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1033 | - if ($add_result === false) {
|
|
| 1034 | - return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1035 | - } |
|
| 1032 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1033 | + if ($add_result === false) {
|
|
| 1034 | + return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1035 | + } |
|
| 1036 | 1036 | |
| 1037 | - break; |
|
| 1037 | + break; |
|
| 1038 | 1038 | |
| 1039 | - case 'datepicker': |
|
| 1039 | + case 'datepicker': |
|
| 1040 | 1040 | |
| 1041 | - $data_type = 'DATE'; |
|
| 1041 | + $data_type = 'DATE'; |
|
| 1042 | 1042 | |
| 1043 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1043 | + $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1044 | 1044 | |
| 1045 | - $meta_field_add = $data_type . " NULL "; |
|
| 1045 | + $meta_field_add = $data_type . " NULL "; |
|
| 1046 | 1046 | |
| 1047 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1048 | - if ($add_result === false) {
|
|
| 1049 | - return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
|
|
| 1050 | - } |
|
| 1047 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1048 | + if ($add_result === false) {
|
|
| 1049 | + return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
|
|
| 1050 | + } |
|
| 1051 | 1051 | |
| 1052 | - break; |
|
| 1052 | + break; |
|
| 1053 | 1053 | |
| 1054 | - case 'time': |
|
| 1054 | + case 'time': |
|
| 1055 | 1055 | |
| 1056 | - $data_type = 'TIME'; |
|
| 1056 | + $data_type = 'TIME'; |
|
| 1057 | 1057 | |
| 1058 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1058 | + $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1059 | 1059 | |
| 1060 | - $meta_field_add = $data_type . " NULL "; |
|
| 1060 | + $meta_field_add = $data_type . " NULL "; |
|
| 1061 | 1061 | |
| 1062 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1063 | - if ($add_result === false) {
|
|
| 1064 | - return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
|
|
| 1065 | - } |
|
| 1062 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1063 | + if ($add_result === false) {
|
|
| 1064 | + return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
|
|
| 1065 | + } |
|
| 1066 | 1066 | |
| 1067 | - break; |
|
| 1067 | + break; |
|
| 1068 | 1068 | |
| 1069 | - default: |
|
| 1069 | + default: |
|
| 1070 | 1070 | |
| 1071 | - if ($data_type != 'VARCHAR' && $data_type != '') {
|
|
| 1072 | - $meta_field_add = $data_type . " NULL "; |
|
| 1071 | + if ($data_type != 'VARCHAR' && $data_type != '') {
|
|
| 1072 | + $meta_field_add = $data_type . " NULL "; |
|
| 1073 | 1073 | |
| 1074 | - if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
|
| 1075 | - $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL "; |
|
| 1076 | - } |
|
| 1074 | + if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
|
| 1075 | + $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL "; |
|
| 1076 | + } |
|
| 1077 | 1077 | |
| 1078 | - if (is_numeric($default_value) && $default_value != '') {
|
|
| 1079 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1080 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1081 | - } |
|
| 1082 | - } else {
|
|
| 1083 | - $meta_field_add = " VARCHAR( 254 ) NULL "; |
|
| 1078 | + if (is_numeric($default_value) && $default_value != '') {
|
|
| 1079 | + $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1080 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1081 | + } |
|
| 1082 | + } else {
|
|
| 1083 | + $meta_field_add = " VARCHAR( 254 ) NULL "; |
|
| 1084 | 1084 | |
| 1085 | - if ($default_value != '') {
|
|
| 1086 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1087 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1088 | - } |
|
| 1089 | - } |
|
| 1085 | + if ($default_value != '') {
|
|
| 1086 | + $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1087 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1088 | + } |
|
| 1089 | + } |
|
| 1090 | 1090 | |
| 1091 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1092 | - if ($add_result === false) {
|
|
| 1093 | - return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1094 | - } |
|
| 1095 | - break; |
|
| 1096 | - endswitch; |
|
| 1091 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1092 | + if ($add_result === false) {
|
|
| 1093 | + return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1094 | + } |
|
| 1095 | + break; |
|
| 1096 | + endswitch; |
|
| 1097 | 1097 | |
| 1098 | - $extra_field_query = ''; |
|
| 1099 | - if (!empty($extra_fields)) {
|
|
| 1100 | - $extra_field_query = serialize($extra_fields); |
|
| 1101 | - } |
|
| 1098 | + $extra_field_query = ''; |
|
| 1099 | + if (!empty($extra_fields)) {
|
|
| 1100 | + $extra_field_query = serialize($extra_fields); |
|
| 1101 | + } |
|
| 1102 | 1102 | |
| 1103 | - $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : ''; |
|
| 1103 | + $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : ''; |
|
| 1104 | 1104 | |
| 1105 | - $wpdb->query( |
|
| 1105 | + $wpdb->query( |
|
| 1106 | 1106 | |
| 1107 | - $wpdb->prepare( |
|
| 1107 | + $wpdb->prepare( |
|
| 1108 | 1108 | |
| 1109 | - "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1109 | + "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1110 | 1110 | post_type = %s, |
| 1111 | 1111 | admin_title = %s, |
| 1112 | 1112 | site_title = %s, |
@@ -1139,26 +1139,26 @@ discard block |
||
| 1139 | 1139 | validation_msg = %s, |
| 1140 | 1140 | for_admin_use = %s ", |
| 1141 | 1141 | |
| 1142 | - array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use) |
|
| 1142 | + array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use) |
|
| 1143 | 1143 | |
| 1144 | - ) |
|
| 1144 | + ) |
|
| 1145 | 1145 | |
| 1146 | - ); |
|
| 1146 | + ); |
|
| 1147 | 1147 | |
| 1148 | - $lastid = $wpdb->insert_id; |
|
| 1148 | + $lastid = $wpdb->insert_id; |
|
| 1149 | 1149 | |
| 1150 | - $lastid = trim($lastid); |
|
| 1150 | + $lastid = trim($lastid); |
|
| 1151 | 1151 | |
| 1152 | - } |
|
| 1152 | + } |
|
| 1153 | 1153 | |
| 1154 | - return (int)$lastid; |
|
| 1154 | + return (int)$lastid; |
|
| 1155 | 1155 | |
| 1156 | 1156 | |
| 1157 | - } else {
|
|
| 1158 | - return 'HTML Variable Name should be a unique name'; |
|
| 1159 | - } |
|
| 1157 | + } else {
|
|
| 1158 | + return 'HTML Variable Name should be a unique name'; |
|
| 1159 | + } |
|
| 1160 | 1160 | |
| 1161 | - } |
|
| 1161 | + } |
|
| 1162 | 1162 | } |
| 1163 | 1163 | |
| 1164 | 1164 | /** |
@@ -1173,54 +1173,54 @@ discard block |
||
| 1173 | 1173 | function godir_set_field_order($field_ids = array()) |
| 1174 | 1174 | {
|
| 1175 | 1175 | |
| 1176 | - global $wpdb; |
|
| 1176 | + global $wpdb; |
|
| 1177 | 1177 | |
| 1178 | - $count = 0; |
|
| 1179 | - if (!empty($field_ids)): |
|
| 1180 | - $post_meta_info = false; |
|
| 1181 | - foreach ($field_ids as $id) {
|
|
| 1178 | + $count = 0; |
|
| 1179 | + if (!empty($field_ids)): |
|
| 1180 | + $post_meta_info = false; |
|
| 1181 | + foreach ($field_ids as $id) {
|
|
| 1182 | 1182 | |
| 1183 | - $cf = trim($id, '_'); |
|
| 1183 | + $cf = trim($id, '_'); |
|
| 1184 | 1184 | |
| 1185 | - $post_meta_info = $wpdb->query( |
|
| 1186 | - $wpdb->prepare( |
|
| 1187 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1185 | + $post_meta_info = $wpdb->query( |
|
| 1186 | + $wpdb->prepare( |
|
| 1187 | + "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1188 | 1188 | sort_order=%d |
| 1189 | 1189 | where id= %d", |
| 1190 | - array($count, $cf) |
|
| 1191 | - ) |
|
| 1192 | - ); |
|
| 1193 | - $count++; |
|
| 1194 | - } |
|
| 1195 | - |
|
| 1196 | - return $post_meta_info; |
|
| 1197 | - else: |
|
| 1198 | - return false; |
|
| 1199 | - endif; |
|
| 1190 | + array($count, $cf) |
|
| 1191 | + ) |
|
| 1192 | + ); |
|
| 1193 | + $count++; |
|
| 1194 | + } |
|
| 1195 | + |
|
| 1196 | + return $post_meta_info; |
|
| 1197 | + else: |
|
| 1198 | + return false; |
|
| 1199 | + endif; |
|
| 1200 | 1200 | } |
| 1201 | 1201 | |
| 1202 | 1202 | |
| 1203 | 1203 | function geodir_get_cf_value($cf){
|
| 1204 | - global $gd_session; |
|
| 1205 | - $value = ''; |
|
| 1206 | - if (is_admin()) {
|
|
| 1207 | - global $post,$gd_session; |
|
| 1208 | - |
|
| 1209 | - if (isset($_REQUEST['post'])) |
|
| 1210 | - $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1211 | - } |
|
| 1212 | - |
|
| 1213 | - if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 1214 | - $post = $gd_ses_listing; |
|
| 1215 | - $value = isset($post[$cf['name']]) ? $post[$cf['name']] : ''; |
|
| 1216 | - } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 1217 | - $value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true); |
|
| 1218 | - } else {
|
|
| 1219 | - if ($value == '') {
|
|
| 1220 | - $value = $cf['default']; |
|
| 1221 | - } |
|
| 1222 | - } |
|
| 1223 | - return $value; |
|
| 1204 | + global $gd_session; |
|
| 1205 | + $value = ''; |
|
| 1206 | + if (is_admin()) {
|
|
| 1207 | + global $post,$gd_session; |
|
| 1208 | + |
|
| 1209 | + if (isset($_REQUEST['post'])) |
|
| 1210 | + $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1211 | + } |
|
| 1212 | + |
|
| 1213 | + if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 1214 | + $post = $gd_ses_listing; |
|
| 1215 | + $value = isset($post[$cf['name']]) ? $post[$cf['name']] : ''; |
|
| 1216 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 1217 | + $value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true); |
|
| 1218 | + } else {
|
|
| 1219 | + if ($value == '') {
|
|
| 1220 | + $value = $cf['default']; |
|
| 1221 | + } |
|
| 1222 | + } |
|
| 1223 | + return $value; |
|
| 1224 | 1224 | } |
| 1225 | 1225 | |
| 1226 | 1226 | /** |
@@ -1239,422 +1239,422 @@ discard block |
||
| 1239 | 1239 | * @param string $post_type Optional. The wordpress post type. |
| 1240 | 1240 | */ |
| 1241 | 1241 | function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') {
|
| 1242 | - global $is_default, $mapzoom, $gd_session; |
|
| 1242 | + global $is_default, $mapzoom, $gd_session; |
|
| 1243 | 1243 | |
| 1244 | - $listing_type = $post_type; |
|
| 1244 | + $listing_type = $post_type; |
|
| 1245 | 1245 | |
| 1246 | - $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type); |
|
| 1246 | + $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type); |
|
| 1247 | 1247 | |
| 1248 | - foreach ($custom_fields as $key => $val) {
|
|
| 1249 | - if(isset($val['extra_fields'])){$extra_fields = $val['extra_fields'];}
|
|
| 1250 | - $val = stripslashes_deep($val); // strip slashes from labels |
|
| 1251 | - if(isset($val['extra_fields'])){$val['extra_fields'] = $extra_fields;}
|
|
| 1248 | + foreach ($custom_fields as $key => $val) {
|
|
| 1249 | + if(isset($val['extra_fields'])){$extra_fields = $val['extra_fields'];}
|
|
| 1250 | + $val = stripslashes_deep($val); // strip slashes from labels |
|
| 1251 | + if(isset($val['extra_fields'])){$val['extra_fields'] = $extra_fields;}
|
|
| 1252 | 1252 | |
| 1253 | - $name = $val['name']; |
|
| 1254 | - $type = $val['type']; |
|
| 1255 | - $is_default = $val['is_default']; |
|
| 1253 | + $name = $val['name']; |
|
| 1254 | + $type = $val['type']; |
|
| 1255 | + $is_default = $val['is_default']; |
|
| 1256 | 1256 | |
| 1257 | - /* field available to site admin only for edit */ |
|
| 1258 | - $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1259 | - if ($for_admin_use && !is_super_admin()) {
|
|
| 1260 | - continue; |
|
| 1261 | - } |
|
| 1257 | + /* field available to site admin only for edit */ |
|
| 1258 | + $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1259 | + if ($for_admin_use && !is_super_admin()) {
|
|
| 1260 | + continue; |
|
| 1261 | + } |
|
| 1262 | 1262 | |
| 1263 | - if (is_admin()) {
|
|
| 1264 | - global $post; |
|
| 1263 | + if (is_admin()) {
|
|
| 1264 | + global $post; |
|
| 1265 | 1265 | |
| 1266 | - if (isset($_REQUEST['post'])) |
|
| 1267 | - $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1268 | - } |
|
| 1266 | + if (isset($_REQUEST['post'])) |
|
| 1267 | + $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1268 | + } |
|
| 1269 | 1269 | |
| 1270 | 1270 | |
| 1271 | 1271 | |
| 1272 | - /** |
|
| 1273 | - * Called before the custom fields info is output for submitting a post. |
|
| 1274 | - * |
|
| 1275 | - * Used dynamic hook type geodir_before_custom_form_field_$name. |
|
| 1276 | - * |
|
| 1277 | - * @since 1.0.0 |
|
| 1278 | - * @param string $listing_type The post post type. |
|
| 1279 | - * @param int $package_id The price package ID for the post. |
|
| 1280 | - * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1281 | - * @see 'geodir_after_custom_form_field_$name' |
|
| 1282 | - */ |
|
| 1283 | - do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1284 | - |
|
| 1285 | - |
|
| 1286 | - $custom_field = $val; |
|
| 1287 | - $html =''; |
|
| 1288 | - /** |
|
| 1289 | - * Filter the output for custom fields. |
|
| 1290 | - * |
|
| 1291 | - * Here we can remove or add new functions depending on the field type. |
|
| 1292 | - * |
|
| 1293 | - * @param string $html The html to be filtered (blank). |
|
| 1294 | - * @param array $custom_field The custom field array values. |
|
| 1295 | - */ |
|
| 1296 | - echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
|
|
| 1297 | - |
|
| 1298 | - |
|
| 1299 | - |
|
| 1300 | - /** |
|
| 1301 | - * Called after the custom fields info is output for submitting a post. |
|
| 1302 | - * |
|
| 1303 | - * Used dynamic hook type geodir_after_custom_form_field_$name. |
|
| 1304 | - * |
|
| 1305 | - * @since 1.0.0 |
|
| 1306 | - * @param string $listing_type The post post type. |
|
| 1307 | - * @param int $package_id The price package ID for the post. |
|
| 1308 | - * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1309 | - * @see 'geodir_before_custom_form_field_$name' |
|
| 1310 | - */ |
|
| 1311 | - do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1312 | - |
|
| 1313 | - } |
|
| 1272 | + /** |
|
| 1273 | + * Called before the custom fields info is output for submitting a post. |
|
| 1274 | + * |
|
| 1275 | + * Used dynamic hook type geodir_before_custom_form_field_$name. |
|
| 1276 | + * |
|
| 1277 | + * @since 1.0.0 |
|
| 1278 | + * @param string $listing_type The post post type. |
|
| 1279 | + * @param int $package_id The price package ID for the post. |
|
| 1280 | + * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1281 | + * @see 'geodir_after_custom_form_field_$name' |
|
| 1282 | + */ |
|
| 1283 | + do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1284 | + |
|
| 1285 | + |
|
| 1286 | + $custom_field = $val; |
|
| 1287 | + $html =''; |
|
| 1288 | + /** |
|
| 1289 | + * Filter the output for custom fields. |
|
| 1290 | + * |
|
| 1291 | + * Here we can remove or add new functions depending on the field type. |
|
| 1292 | + * |
|
| 1293 | + * @param string $html The html to be filtered (blank). |
|
| 1294 | + * @param array $custom_field The custom field array values. |
|
| 1295 | + */ |
|
| 1296 | + echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
|
|
| 1297 | + |
|
| 1298 | + |
|
| 1299 | + |
|
| 1300 | + /** |
|
| 1301 | + * Called after the custom fields info is output for submitting a post. |
|
| 1302 | + * |
|
| 1303 | + * Used dynamic hook type geodir_after_custom_form_field_$name. |
|
| 1304 | + * |
|
| 1305 | + * @since 1.0.0 |
|
| 1306 | + * @param string $listing_type The post post type. |
|
| 1307 | + * @param int $package_id The price package ID for the post. |
|
| 1308 | + * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1309 | + * @see 'geodir_before_custom_form_field_$name' |
|
| 1310 | + */ |
|
| 1311 | + do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1312 | + |
|
| 1313 | + } |
|
| 1314 | 1314 | |
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | 1317 | |
| 1318 | 1318 | if (!function_exists('geodir_get_field_infoby')) {
|
| 1319 | - /** |
|
| 1320 | - * Get custom field using key and value. |
|
| 1321 | - * |
|
| 1322 | - * @since 1.0.0 |
|
| 1323 | - * @package GeoDirectory |
|
| 1324 | - * @global object $wpdb WordPress Database object. |
|
| 1325 | - * @param string $key The key you want to look for. |
|
| 1326 | - * @param string $value The value of the key you want to look for. |
|
| 1327 | - * @param string $geodir_post_type The post type. |
|
| 1328 | - * @return bool|mixed Returns field info when available. otherwise returns false. |
|
| 1329 | - */ |
|
| 1330 | - function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '') |
|
| 1331 | - {
|
|
| 1332 | - |
|
| 1333 | - global $wpdb; |
|
| 1334 | - |
|
| 1335 | - $filter = $wpdb->get_row( |
|
| 1336 | - $wpdb->prepare( |
|
| 1337 | - "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 1338 | - array($geodir_post_type) |
|
| 1339 | - ) |
|
| 1340 | - ); |
|
| 1341 | - |
|
| 1342 | - if ($filter) {
|
|
| 1343 | - return $filter; |
|
| 1344 | - } else {
|
|
| 1345 | - return false; |
|
| 1346 | - } |
|
| 1347 | - |
|
| 1348 | - } |
|
| 1319 | + /** |
|
| 1320 | + * Get custom field using key and value. |
|
| 1321 | + * |
|
| 1322 | + * @since 1.0.0 |
|
| 1323 | + * @package GeoDirectory |
|
| 1324 | + * @global object $wpdb WordPress Database object. |
|
| 1325 | + * @param string $key The key you want to look for. |
|
| 1326 | + * @param string $value The value of the key you want to look for. |
|
| 1327 | + * @param string $geodir_post_type The post type. |
|
| 1328 | + * @return bool|mixed Returns field info when available. otherwise returns false. |
|
| 1329 | + */ |
|
| 1330 | + function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '') |
|
| 1331 | + {
|
|
| 1332 | + |
|
| 1333 | + global $wpdb; |
|
| 1334 | + |
|
| 1335 | + $filter = $wpdb->get_row( |
|
| 1336 | + $wpdb->prepare( |
|
| 1337 | + "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 1338 | + array($geodir_post_type) |
|
| 1339 | + ) |
|
| 1340 | + ); |
|
| 1341 | + |
|
| 1342 | + if ($filter) {
|
|
| 1343 | + return $filter; |
|
| 1344 | + } else {
|
|
| 1345 | + return false; |
|
| 1346 | + } |
|
| 1347 | + |
|
| 1348 | + } |
|
| 1349 | 1349 | } |
| 1350 | 1350 | |
| 1351 | 1351 | |
| 1352 | 1352 | function geodir_field_icon_proccess($cf){
|
| 1353 | 1353 | |
| 1354 | 1354 | |
| 1355 | - if (strpos($cf['field_icon'], 'http') !== false) {
|
|
| 1356 | - $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1357 | - } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
|
|
| 1358 | - $field_icon = '<i class="' . $cf['field_icon'] . '"></i>'; |
|
| 1359 | - }else{
|
|
| 1360 | - $field_icon = $cf['field_icon']; |
|
| 1361 | - } |
|
| 1355 | + if (strpos($cf['field_icon'], 'http') !== false) {
|
|
| 1356 | + $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1357 | + } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
|
|
| 1358 | + $field_icon = '<i class="' . $cf['field_icon'] . '"></i>'; |
|
| 1359 | + }else{
|
|
| 1360 | + $field_icon = $cf['field_icon']; |
|
| 1361 | + } |
|
| 1362 | 1362 | |
| 1363 | - return $field_icon; |
|
| 1363 | + return $field_icon; |
|
| 1364 | 1364 | } |
| 1365 | 1365 | |
| 1366 | 1366 | if (!function_exists('geodir_show_listing_info')) {
|
| 1367 | - /** |
|
| 1368 | - * Show listing info depending on field location. |
|
| 1369 | - * |
|
| 1370 | - * @since 1.0.0 |
|
| 1371 | - * @since 1.5.7 Custom fields option values added to db translation. |
|
| 1372 | - * Changes to display url fields title. |
|
| 1373 | - * @package GeoDirectory |
|
| 1374 | - * @global object $wpdb WordPress Database object. |
|
| 1375 | - * @global object $post The current post object. |
|
| 1376 | - * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false. |
|
| 1377 | - * |
|
| 1378 | - * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc. |
|
| 1379 | - * @return string Returns listing info html. |
|
| 1380 | - */ |
|
| 1381 | - function geodir_show_listing_info($fields_location = '') {
|
|
| 1382 | - global $post, $preview, $wpdb, $send_to_friend; |
|
| 1383 | - |
|
| 1384 | - $package_info = array(); |
|
| 1385 | - |
|
| 1386 | - $package_info = geodir_post_package_info($package_info, $post); |
|
| 1387 | - $post_package_id = !empty($package_info->pid) ? $package_info->pid : ''; |
|
| 1388 | - $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype(); |
|
| 1389 | - $send_to_friend = false; |
|
| 1390 | - |
|
| 1391 | - ob_start(); |
|
| 1392 | - $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location); |
|
| 1393 | - |
|
| 1394 | - if (!empty($fields_info)) {
|
|
| 1395 | - $post = stripslashes_deep($post); // strip slashes |
|
| 1367 | + /** |
|
| 1368 | + * Show listing info depending on field location. |
|
| 1369 | + * |
|
| 1370 | + * @since 1.0.0 |
|
| 1371 | + * @since 1.5.7 Custom fields option values added to db translation. |
|
| 1372 | + * Changes to display url fields title. |
|
| 1373 | + * @package GeoDirectory |
|
| 1374 | + * @global object $wpdb WordPress Database object. |
|
| 1375 | + * @global object $post The current post object. |
|
| 1376 | + * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false. |
|
| 1377 | + * |
|
| 1378 | + * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc. |
|
| 1379 | + * @return string Returns listing info html. |
|
| 1380 | + */ |
|
| 1381 | + function geodir_show_listing_info($fields_location = '') {
|
|
| 1382 | + global $post, $preview, $wpdb, $send_to_friend; |
|
| 1383 | + |
|
| 1384 | + $package_info = array(); |
|
| 1385 | + |
|
| 1386 | + $package_info = geodir_post_package_info($package_info, $post); |
|
| 1387 | + $post_package_id = !empty($package_info->pid) ? $package_info->pid : ''; |
|
| 1388 | + $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype(); |
|
| 1389 | + $send_to_friend = false; |
|
| 1390 | + |
|
| 1391 | + ob_start(); |
|
| 1392 | + $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location); |
|
| 1393 | + |
|
| 1394 | + if (!empty($fields_info)) {
|
|
| 1395 | + $post = stripslashes_deep($post); // strip slashes |
|
| 1396 | 1396 | |
| 1397 | - //echo '<div class="geodir-company_info field-group">'; |
|
| 1398 | - global $field_set_start; |
|
| 1399 | - $field_set_start = 0; |
|
| 1400 | - |
|
| 1401 | - |
|
| 1402 | - |
|
| 1403 | - foreach ($fields_info as $type) {
|
|
| 1404 | - if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
|
|
| 1405 | - $type = stripslashes_deep($type); // strip slashes |
|
| 1406 | - if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
|
|
| 1407 | - $html = ''; |
|
| 1408 | - $field_icon = geodir_field_icon_proccess($type); |
|
| 1409 | - $filed_type = $type['type']; |
|
| 1410 | - $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
|
| 1411 | - if($html_var=='post'){$html_var='post_address';}
|
|
| 1412 | - |
|
| 1413 | - /** |
|
| 1414 | - * Filter the output for custom fields. |
|
| 1415 | - * |
|
| 1416 | - * Here we can remove or add new functions depending on the field type. |
|
| 1417 | - * |
|
| 1418 | - * @param string $html The html to be filtered (blank). |
|
| 1419 | - * @param string $fields_location The location the field is to be show. |
|
| 1420 | - * @param array $type The array of field values. |
|
| 1421 | - */ |
|
| 1422 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 1423 | - |
|
| 1424 | - $variables_array = array(); |
|
| 1425 | - |
|
| 1426 | - |
|
| 1427 | - if ($type['type'] != 'fieldset'): |
|
| 1428 | - $variables_array['post_id'] = $post->ID; |
|
| 1429 | - $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
| 1430 | - $variables_array['value'] = ''; |
|
| 1431 | - if (isset($post->{$type['htmlvar_name']}))
|
|
| 1432 | - $variables_array['value'] = $post->{$type['htmlvar_name']};
|
|
| 1433 | - endif; |
|
| 1434 | - |
|
| 1435 | - |
|
| 1436 | - if ($html): |
|
| 1437 | - |
|
| 1438 | - /** |
|
| 1439 | - * Called before a custom fields is output on the frontend. |
|
| 1440 | - * |
|
| 1441 | - * @since 1.0.0 |
|
| 1442 | - * @param string $html_var The HTML variable name for the field. |
|
| 1443 | - */ |
|
| 1444 | - do_action("geodir_before_show_{$html_var}");
|
|
| 1445 | - /** |
|
| 1446 | - * Filter custom field output. |
|
| 1447 | - * |
|
| 1448 | - * @since 1.0.0 |
|
| 1449 | - * |
|
| 1450 | - * @param string $html_var The HTML variable name for the field. |
|
| 1451 | - * @param string $html Custom field unfiltered HTML. |
|
| 1452 | - * @param array $variables_array Custom field variables array. |
|
| 1453 | - */ |
|
| 1454 | - if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
|
|
| 1455 | - |
|
| 1456 | - /** |
|
| 1457 | - * Called after a custom fields is output on the frontend. |
|
| 1458 | - * |
|
| 1459 | - * @since 1.0.0 |
|
| 1460 | - * @param string $html_var The HTML variable name for the field. |
|
| 1461 | - */ |
|
| 1462 | - do_action("geodir_after_show_{$html_var}");
|
|
| 1463 | - |
|
| 1464 | - endif; |
|
| 1465 | - |
|
| 1466 | - } |
|
| 1467 | - |
|
| 1468 | - //echo '</div>'; |
|
| 1469 | - |
|
| 1470 | - } |
|
| 1471 | - |
|
| 1472 | - |
|
| 1473 | - $html = ob_get_clean(); |
|
| 1474 | - |
|
| 1475 | - /** |
|
| 1476 | - * Filter the custom fields over all output. |
|
| 1477 | - * |
|
| 1478 | - * @param string $html The html of the custom fields. |
|
| 1479 | - * @param string $fields_location The location the fields are being output. |
|
| 1480 | - * @since 1.6.9 |
|
| 1481 | - */ |
|
| 1482 | - return apply_filters('geodir_show_listing_info',$html,$fields_location);
|
|
| 1483 | - |
|
| 1484 | - } |
|
| 1397 | + //echo '<div class="geodir-company_info field-group">'; |
|
| 1398 | + global $field_set_start; |
|
| 1399 | + $field_set_start = 0; |
|
| 1400 | + |
|
| 1401 | + |
|
| 1402 | + |
|
| 1403 | + foreach ($fields_info as $type) {
|
|
| 1404 | + if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
|
|
| 1405 | + $type = stripslashes_deep($type); // strip slashes |
|
| 1406 | + if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
|
|
| 1407 | + $html = ''; |
|
| 1408 | + $field_icon = geodir_field_icon_proccess($type); |
|
| 1409 | + $filed_type = $type['type']; |
|
| 1410 | + $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
|
| 1411 | + if($html_var=='post'){$html_var='post_address';}
|
|
| 1412 | + |
|
| 1413 | + /** |
|
| 1414 | + * Filter the output for custom fields. |
|
| 1415 | + * |
|
| 1416 | + * Here we can remove or add new functions depending on the field type. |
|
| 1417 | + * |
|
| 1418 | + * @param string $html The html to be filtered (blank). |
|
| 1419 | + * @param string $fields_location The location the field is to be show. |
|
| 1420 | + * @param array $type The array of field values. |
|
| 1421 | + */ |
|
| 1422 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 1423 | + |
|
| 1424 | + $variables_array = array(); |
|
| 1425 | + |
|
| 1426 | + |
|
| 1427 | + if ($type['type'] != 'fieldset'): |
|
| 1428 | + $variables_array['post_id'] = $post->ID; |
|
| 1429 | + $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
| 1430 | + $variables_array['value'] = ''; |
|
| 1431 | + if (isset($post->{$type['htmlvar_name']}))
|
|
| 1432 | + $variables_array['value'] = $post->{$type['htmlvar_name']};
|
|
| 1433 | + endif; |
|
| 1434 | + |
|
| 1435 | + |
|
| 1436 | + if ($html): |
|
| 1437 | + |
|
| 1438 | + /** |
|
| 1439 | + * Called before a custom fields is output on the frontend. |
|
| 1440 | + * |
|
| 1441 | + * @since 1.0.0 |
|
| 1442 | + * @param string $html_var The HTML variable name for the field. |
|
| 1443 | + */ |
|
| 1444 | + do_action("geodir_before_show_{$html_var}");
|
|
| 1445 | + /** |
|
| 1446 | + * Filter custom field output. |
|
| 1447 | + * |
|
| 1448 | + * @since 1.0.0 |
|
| 1449 | + * |
|
| 1450 | + * @param string $html_var The HTML variable name for the field. |
|
| 1451 | + * @param string $html Custom field unfiltered HTML. |
|
| 1452 | + * @param array $variables_array Custom field variables array. |
|
| 1453 | + */ |
|
| 1454 | + if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
|
|
| 1455 | + |
|
| 1456 | + /** |
|
| 1457 | + * Called after a custom fields is output on the frontend. |
|
| 1458 | + * |
|
| 1459 | + * @since 1.0.0 |
|
| 1460 | + * @param string $html_var The HTML variable name for the field. |
|
| 1461 | + */ |
|
| 1462 | + do_action("geodir_after_show_{$html_var}");
|
|
| 1463 | + |
|
| 1464 | + endif; |
|
| 1465 | + |
|
| 1466 | + } |
|
| 1467 | + |
|
| 1468 | + //echo '</div>'; |
|
| 1469 | + |
|
| 1470 | + } |
|
| 1471 | + |
|
| 1472 | + |
|
| 1473 | + $html = ob_get_clean(); |
|
| 1474 | + |
|
| 1475 | + /** |
|
| 1476 | + * Filter the custom fields over all output. |
|
| 1477 | + * |
|
| 1478 | + * @param string $html The html of the custom fields. |
|
| 1479 | + * @param string $fields_location The location the fields are being output. |
|
| 1480 | + * @since 1.6.9 |
|
| 1481 | + */ |
|
| 1482 | + return apply_filters('geodir_show_listing_info',$html,$fields_location);
|
|
| 1483 | + |
|
| 1484 | + } |
|
| 1485 | 1485 | } |
| 1486 | 1486 | |
| 1487 | 1487 | if (!function_exists('geodir_default_date_format')) {
|
| 1488 | - /** |
|
| 1489 | - * Returns default date format. |
|
| 1490 | - * |
|
| 1491 | - * @since 1.0.0 |
|
| 1492 | - * @package GeoDirectory |
|
| 1493 | - * @return mixed|string|void Returns default date format. |
|
| 1494 | - */ |
|
| 1495 | - function geodir_default_date_format() |
|
| 1496 | - {
|
|
| 1497 | - if ($format = get_option('date_format'))
|
|
| 1498 | - return $format; |
|
| 1499 | - else |
|
| 1500 | - return 'dd-mm-yy'; |
|
| 1501 | - } |
|
| 1488 | + /** |
|
| 1489 | + * Returns default date format. |
|
| 1490 | + * |
|
| 1491 | + * @since 1.0.0 |
|
| 1492 | + * @package GeoDirectory |
|
| 1493 | + * @return mixed|string|void Returns default date format. |
|
| 1494 | + */ |
|
| 1495 | + function geodir_default_date_format() |
|
| 1496 | + {
|
|
| 1497 | + if ($format = get_option('date_format'))
|
|
| 1498 | + return $format; |
|
| 1499 | + else |
|
| 1500 | + return 'dd-mm-yy'; |
|
| 1501 | + } |
|
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | 1504 | if (!function_exists('geodir_get_formated_date')) {
|
| 1505 | - /** |
|
| 1506 | - * Returns formatted date. |
|
| 1507 | - * |
|
| 1508 | - * @since 1.0.0 |
|
| 1509 | - * @package GeoDirectory |
|
| 1510 | - * @param string $date Date string to convert. |
|
| 1511 | - * @return bool|int|string Returns formatted date. |
|
| 1512 | - */ |
|
| 1513 | - function geodir_get_formated_date($date) |
|
| 1514 | - {
|
|
| 1515 | - return mysql2date(get_option('date_format'), $date);
|
|
| 1516 | - } |
|
| 1505 | + /** |
|
| 1506 | + * Returns formatted date. |
|
| 1507 | + * |
|
| 1508 | + * @since 1.0.0 |
|
| 1509 | + * @package GeoDirectory |
|
| 1510 | + * @param string $date Date string to convert. |
|
| 1511 | + * @return bool|int|string Returns formatted date. |
|
| 1512 | + */ |
|
| 1513 | + function geodir_get_formated_date($date) |
|
| 1514 | + {
|
|
| 1515 | + return mysql2date(get_option('date_format'), $date);
|
|
| 1516 | + } |
|
| 1517 | 1517 | } |
| 1518 | 1518 | |
| 1519 | 1519 | if (!function_exists('geodir_get_formated_time')) {
|
| 1520 | - /** |
|
| 1521 | - * Returns formatted time. |
|
| 1522 | - * |
|
| 1523 | - * @since 1.0.0 |
|
| 1524 | - * @package GeoDirectory |
|
| 1525 | - * @param string $time Time string to convert. |
|
| 1526 | - * @return bool|int|string Returns formatted time. |
|
| 1527 | - */ |
|
| 1528 | - function geodir_get_formated_time($time) |
|
| 1529 | - {
|
|
| 1530 | - return mysql2date(get_option('time_format'), $time, $translate = true);
|
|
| 1531 | - } |
|
| 1520 | + /** |
|
| 1521 | + * Returns formatted time. |
|
| 1522 | + * |
|
| 1523 | + * @since 1.0.0 |
|
| 1524 | + * @package GeoDirectory |
|
| 1525 | + * @param string $time Time string to convert. |
|
| 1526 | + * @return bool|int|string Returns formatted time. |
|
| 1527 | + */ |
|
| 1528 | + function geodir_get_formated_time($time) |
|
| 1529 | + {
|
|
| 1530 | + return mysql2date(get_option('time_format'), $time, $translate = true);
|
|
| 1531 | + } |
|
| 1532 | 1532 | } |
| 1533 | 1533 | |
| 1534 | 1534 | |
| 1535 | 1535 | if (!function_exists('geodir_save_post_file_fields')) {
|
| 1536 | - /** |
|
| 1537 | - * Save post file fields |
|
| 1538 | - * |
|
| 1539 | - * @since 1.0.0 |
|
| 1540 | - * @since 1.4.7 Added `$extra_fields` parameter. |
|
| 1541 | - * @package GeoDirectory |
|
| 1542 | - * @global object $wpdb WordPress Database object. |
|
| 1543 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1544 | - * @global object $current_user Current user object. |
|
| 1545 | - * @param int $post_id |
|
| 1546 | - * @param string $field_id |
|
| 1547 | - * @param array $post_image |
|
| 1548 | - * @param array $extra_fields Array of extra fields. |
|
| 1549 | - */ |
|
| 1550 | - function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array()) |
|
| 1551 | - {
|
|
| 1536 | + /** |
|
| 1537 | + * Save post file fields |
|
| 1538 | + * |
|
| 1539 | + * @since 1.0.0 |
|
| 1540 | + * @since 1.4.7 Added `$extra_fields` parameter. |
|
| 1541 | + * @package GeoDirectory |
|
| 1542 | + * @global object $wpdb WordPress Database object. |
|
| 1543 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1544 | + * @global object $current_user Current user object. |
|
| 1545 | + * @param int $post_id |
|
| 1546 | + * @param string $field_id |
|
| 1547 | + * @param array $post_image |
|
| 1548 | + * @param array $extra_fields Array of extra fields. |
|
| 1549 | + */ |
|
| 1550 | + function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array()) |
|
| 1551 | + {
|
|
| 1552 | 1552 | |
| 1553 | - global $wpdb, $plugin_prefix, $current_user; |
|
| 1553 | + global $wpdb, $plugin_prefix, $current_user; |
|
| 1554 | 1554 | |
| 1555 | - $post_type = get_post_type($post_id); |
|
| 1556 | - //echo $field_id; exit; |
|
| 1557 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1555 | + $post_type = get_post_type($post_id); |
|
| 1556 | + //echo $field_id; exit; |
|
| 1557 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1558 | 1558 | |
| 1559 | - $postcurr_images = array(); |
|
| 1560 | - $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
|
| 1561 | - $file_urls = ''; |
|
| 1559 | + $postcurr_images = array(); |
|
| 1560 | + $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
|
| 1561 | + $file_urls = ''; |
|
| 1562 | 1562 | |
| 1563 | - if (!empty($post_image)) {
|
|
| 1563 | + if (!empty($post_image)) {
|
|
| 1564 | 1564 | |
| 1565 | - $invalid_files = array(); |
|
| 1565 | + $invalid_files = array(); |
|
| 1566 | 1566 | |
| 1567 | - //Get and remove all old images of post from database to set by new order |
|
| 1568 | - $geodir_uploaddir = ''; |
|
| 1569 | - $uploads = wp_upload_dir(); |
|
| 1570 | - $uploads_dir = $uploads['path']; |
|
| 1567 | + //Get and remove all old images of post from database to set by new order |
|
| 1568 | + $geodir_uploaddir = ''; |
|
| 1569 | + $uploads = wp_upload_dir(); |
|
| 1570 | + $uploads_dir = $uploads['path']; |
|
| 1571 | 1571 | |
| 1572 | - $geodir_uploadpath = $uploads['path']; |
|
| 1573 | - $geodir_uploadurl = $uploads['url']; |
|
| 1574 | - $sub_dir = $uploads['subdir']; |
|
| 1572 | + $geodir_uploadpath = $uploads['path']; |
|
| 1573 | + $geodir_uploadurl = $uploads['url']; |
|
| 1574 | + $sub_dir = $uploads['subdir']; |
|
| 1575 | 1575 | |
| 1576 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
|
|
| 1576 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
|
|
| 1577 | 1577 | |
| 1578 | - for ($m = 0; $m < count($post_image); $m++) {
|
|
| 1578 | + for ($m = 0; $m < count($post_image); $m++) {
|
|
| 1579 | 1579 | |
| 1580 | - /* --------- start ------- */ |
|
| 1580 | + /* --------- start ------- */ |
|
| 1581 | 1581 | |
| 1582 | - if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
|
|
| 1582 | + if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
|
|
| 1583 | 1583 | |
| 1584 | 1584 | |
| 1585 | - $curr_img_url = $post_image[$m]; |
|
| 1586 | - $image_name_arr = explode('/', $curr_img_url);
|
|
| 1587 | - $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 1588 | - $filename = end($image_name_arr); |
|
| 1589 | - $img_name_arr = explode('.', $filename);
|
|
| 1585 | + $curr_img_url = $post_image[$m]; |
|
| 1586 | + $image_name_arr = explode('/', $curr_img_url);
|
|
| 1587 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 1588 | + $filename = end($image_name_arr); |
|
| 1589 | + $img_name_arr = explode('.', $filename);
|
|
| 1590 | 1590 | |
| 1591 | - $arr_file_type = wp_check_filetype($filename); |
|
| 1591 | + $arr_file_type = wp_check_filetype($filename); |
|
| 1592 | 1592 | |
| 1593 | - if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
|
|
| 1594 | - continue; |
|
| 1595 | - } |
|
| 1593 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
|
|
| 1594 | + continue; |
|
| 1595 | + } |
|
| 1596 | 1596 | |
| 1597 | - $uploaded_file_type = $arr_file_type['type']; |
|
| 1598 | - $uploaded_file_ext = $arr_file_type['ext']; |
|
| 1597 | + $uploaded_file_type = $arr_file_type['type']; |
|
| 1598 | + $uploaded_file_ext = $arr_file_type['ext']; |
|
| 1599 | 1599 | |
| 1600 | - if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
|
|
| 1601 | - continue; // Invalid file type. |
|
| 1602 | - } |
|
| 1600 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
|
|
| 1601 | + continue; // Invalid file type. |
|
| 1602 | + } |
|
| 1603 | 1603 | |
| 1604 | - // Set an array containing a list of acceptable formats |
|
| 1605 | - //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
|
|
| 1604 | + // Set an array containing a list of acceptable formats |
|
| 1605 | + //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
|
|
| 1606 | 1606 | |
| 1607 | - if (!function_exists('wp_handle_upload'))
|
|
| 1608 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1607 | + if (!function_exists('wp_handle_upload'))
|
|
| 1608 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1609 | 1609 | |
| 1610 | - if (!is_dir($geodir_uploadpath)) |
|
| 1611 | - mkdir($geodir_uploadpath); |
|
| 1610 | + if (!is_dir($geodir_uploadpath)) |
|
| 1611 | + mkdir($geodir_uploadpath); |
|
| 1612 | 1612 | |
| 1613 | - $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 1614 | - $explode_sub_dir = explode("/", $sub_dir);
|
|
| 1615 | - if ($curr_img_dir == end($explode_sub_dir)) {
|
|
| 1616 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1617 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1618 | - } else {
|
|
| 1619 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1620 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1621 | - } |
|
| 1613 | + $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 1614 | + $explode_sub_dir = explode("/", $sub_dir);
|
|
| 1615 | + if ($curr_img_dir == end($explode_sub_dir)) {
|
|
| 1616 | + $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1617 | + $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1618 | + } else {
|
|
| 1619 | + $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1620 | + $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1621 | + } |
|
| 1622 | 1622 | |
| 1623 | - $uploaded_file = ''; |
|
| 1624 | - if (file_exists($img_path)) |
|
| 1625 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1623 | + $uploaded_file = ''; |
|
| 1624 | + if (file_exists($img_path)) |
|
| 1625 | + $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1626 | 1626 | |
| 1627 | - if ($curr_img_dir != $geodir_uploaddir) {
|
|
| 1628 | - if (file_exists($img_path)) |
|
| 1629 | - unlink($img_path); |
|
| 1630 | - } |
|
| 1627 | + if ($curr_img_dir != $geodir_uploaddir) {
|
|
| 1628 | + if (file_exists($img_path)) |
|
| 1629 | + unlink($img_path); |
|
| 1630 | + } |
|
| 1631 | 1631 | |
| 1632 | - if (!empty($uploaded_file)) |
|
| 1633 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1632 | + if (!empty($uploaded_file)) |
|
| 1633 | + $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1634 | 1634 | |
| 1635 | - } else {
|
|
| 1636 | - $file_urls = $post_image[$m]; |
|
| 1637 | - } |
|
| 1638 | - } |
|
| 1635 | + } else {
|
|
| 1636 | + $file_urls = $post_image[$m]; |
|
| 1637 | + } |
|
| 1638 | + } |
|
| 1639 | 1639 | |
| 1640 | 1640 | |
| 1641 | - } |
|
| 1641 | + } |
|
| 1642 | 1642 | |
| 1643 | - //Remove all old attachments and temp images |
|
| 1644 | - if (!empty($postcurr_images)) {
|
|
| 1643 | + //Remove all old attachments and temp images |
|
| 1644 | + if (!empty($postcurr_images)) {
|
|
| 1645 | 1645 | |
| 1646 | - if ($file_urls != $postcurr_images) {
|
|
| 1647 | - $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 1648 | - $invalid_files = (object)$invalid_files; |
|
| 1649 | - } |
|
| 1650 | - } |
|
| 1646 | + if ($file_urls != $postcurr_images) {
|
|
| 1647 | + $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 1648 | + $invalid_files = (object)$invalid_files; |
|
| 1649 | + } |
|
| 1650 | + } |
|
| 1651 | 1651 | |
| 1652 | - geodir_save_post_meta($post_id, $field_id, $file_urls); |
|
| 1652 | + geodir_save_post_meta($post_id, $field_id, $file_urls); |
|
| 1653 | 1653 | |
| 1654 | - if (!empty($invalid_files)) |
|
| 1655 | - geodir_remove_attachments($invalid_files); |
|
| 1654 | + if (!empty($invalid_files)) |
|
| 1655 | + geodir_remove_attachments($invalid_files); |
|
| 1656 | 1656 | |
| 1657 | - } |
|
| 1657 | + } |
|
| 1658 | 1658 | } |
| 1659 | 1659 | |
| 1660 | 1660 | |
@@ -1669,76 +1669,76 @@ discard block |
||
| 1669 | 1669 | */ |
| 1670 | 1670 | function geodir_custom_upload_mimes($existing_mimes = array()) |
| 1671 | 1671 | {
|
| 1672 | - $existing_mimes['wif'] = 'text/plain'; |
|
| 1673 | - $existing_mimes['jpg|jpeg'] = 'image/jpeg'; |
|
| 1674 | - $existing_mimes['gif'] = 'image/gif'; |
|
| 1675 | - $existing_mimes['png'] = 'image/png'; |
|
| 1676 | - $existing_mimes['pdf'] = 'application/pdf'; |
|
| 1677 | - $existing_mimes['txt'] = 'text/text'; |
|
| 1678 | - $existing_mimes['csv'] = 'application/octet-stream'; |
|
| 1679 | - $existing_mimes['doc'] = 'application/msword'; |
|
| 1680 | - $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel'; |
|
| 1681 | - $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; |
|
| 1682 | - $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; |
|
| 1683 | - return $existing_mimes; |
|
| 1672 | + $existing_mimes['wif'] = 'text/plain'; |
|
| 1673 | + $existing_mimes['jpg|jpeg'] = 'image/jpeg'; |
|
| 1674 | + $existing_mimes['gif'] = 'image/gif'; |
|
| 1675 | + $existing_mimes['png'] = 'image/png'; |
|
| 1676 | + $existing_mimes['pdf'] = 'application/pdf'; |
|
| 1677 | + $existing_mimes['txt'] = 'text/text'; |
|
| 1678 | + $existing_mimes['csv'] = 'application/octet-stream'; |
|
| 1679 | + $existing_mimes['doc'] = 'application/msword'; |
|
| 1680 | + $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel'; |
|
| 1681 | + $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; |
|
| 1682 | + $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; |
|
| 1683 | + return $existing_mimes; |
|
| 1684 | 1684 | } |
| 1685 | 1685 | |
| 1686 | 1686 | if (!function_exists('geodir_plupload_action')) {
|
| 1687 | 1687 | |
| 1688 | - /** |
|
| 1689 | - * Get upload directory path details |
|
| 1690 | - * |
|
| 1691 | - * @since 1.0.0 |
|
| 1692 | - * @package GeoDirectory |
|
| 1693 | - * @global object $current_user Current user object. |
|
| 1694 | - * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'. |
|
| 1695 | - * @return mixed Returns upload directory details as an array. |
|
| 1696 | - */ |
|
| 1697 | - function geodir_upload_dir($upload) |
|
| 1698 | - {
|
|
| 1699 | - global $current_user; |
|
| 1700 | - $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 1701 | - $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 1702 | - $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 1703 | - return $upload; |
|
| 1704 | - } |
|
| 1705 | - |
|
| 1706 | - /** |
|
| 1707 | - * Handles place file and image upload. |
|
| 1708 | - * |
|
| 1709 | - * @since 1.0.0 |
|
| 1710 | - * @package GeoDirectory |
|
| 1711 | - */ |
|
| 1712 | - function geodir_plupload_action() |
|
| 1713 | - {
|
|
| 1714 | - // check ajax nonce |
|
| 1715 | - $imgid = $_POST["imgid"]; |
|
| 1716 | - |
|
| 1717 | - check_ajax_referer($imgid . 'pluploadan'); |
|
| 1718 | - |
|
| 1719 | - // handle custom file uploaddir |
|
| 1720 | - add_filter('upload_dir', 'geodir_upload_dir');
|
|
| 1721 | - |
|
| 1722 | - // change file orientation if needed |
|
| 1723 | - $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 1724 | - |
|
| 1725 | - // handle file upload |
|
| 1726 | - $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
|
| 1727 | - // remove handle custom file uploaddir |
|
| 1728 | - remove_filter('upload_dir', 'geodir_upload_dir');
|
|
| 1729 | - |
|
| 1730 | - if(!isset($status['url']) && isset($status['error'])){
|
|
| 1731 | - print_r($status); |
|
| 1732 | - } |
|
| 1733 | - |
|
| 1734 | - // send the uploaded file url in response |
|
| 1735 | - if (isset($status['url'])) {
|
|
| 1736 | - echo $status['url']; |
|
| 1737 | - } else {
|
|
| 1738 | - echo 'x'; |
|
| 1739 | - } |
|
| 1740 | - exit; |
|
| 1741 | - } |
|
| 1688 | + /** |
|
| 1689 | + * Get upload directory path details |
|
| 1690 | + * |
|
| 1691 | + * @since 1.0.0 |
|
| 1692 | + * @package GeoDirectory |
|
| 1693 | + * @global object $current_user Current user object. |
|
| 1694 | + * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'. |
|
| 1695 | + * @return mixed Returns upload directory details as an array. |
|
| 1696 | + */ |
|
| 1697 | + function geodir_upload_dir($upload) |
|
| 1698 | + {
|
|
| 1699 | + global $current_user; |
|
| 1700 | + $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 1701 | + $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 1702 | + $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 1703 | + return $upload; |
|
| 1704 | + } |
|
| 1705 | + |
|
| 1706 | + /** |
|
| 1707 | + * Handles place file and image upload. |
|
| 1708 | + * |
|
| 1709 | + * @since 1.0.0 |
|
| 1710 | + * @package GeoDirectory |
|
| 1711 | + */ |
|
| 1712 | + function geodir_plupload_action() |
|
| 1713 | + {
|
|
| 1714 | + // check ajax nonce |
|
| 1715 | + $imgid = $_POST["imgid"]; |
|
| 1716 | + |
|
| 1717 | + check_ajax_referer($imgid . 'pluploadan'); |
|
| 1718 | + |
|
| 1719 | + // handle custom file uploaddir |
|
| 1720 | + add_filter('upload_dir', 'geodir_upload_dir');
|
|
| 1721 | + |
|
| 1722 | + // change file orientation if needed |
|
| 1723 | + $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 1724 | + |
|
| 1725 | + // handle file upload |
|
| 1726 | + $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
|
| 1727 | + // remove handle custom file uploaddir |
|
| 1728 | + remove_filter('upload_dir', 'geodir_upload_dir');
|
|
| 1729 | + |
|
| 1730 | + if(!isset($status['url']) && isset($status['error'])){
|
|
| 1731 | + print_r($status); |
|
| 1732 | + } |
|
| 1733 | + |
|
| 1734 | + // send the uploaded file url in response |
|
| 1735 | + if (isset($status['url'])) {
|
|
| 1736 | + echo $status['url']; |
|
| 1737 | + } else {
|
|
| 1738 | + echo 'x'; |
|
| 1739 | + } |
|
| 1740 | + exit; |
|
| 1741 | + } |
|
| 1742 | 1742 | } |
| 1743 | 1743 | |
| 1744 | 1744 | /** |
@@ -1753,17 +1753,17 @@ discard block |
||
| 1753 | 1753 | */ |
| 1754 | 1754 | function geodir_get_video($post_id) |
| 1755 | 1755 | {
|
| 1756 | - global $wpdb, $plugin_prefix; |
|
| 1756 | + global $wpdb, $plugin_prefix; |
|
| 1757 | 1757 | |
| 1758 | - $post_type = get_post_type($post_id); |
|
| 1758 | + $post_type = get_post_type($post_id); |
|
| 1759 | 1759 | |
| 1760 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1760 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1761 | 1761 | |
| 1762 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1762 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1763 | 1763 | |
| 1764 | - if ($results) {
|
|
| 1765 | - return $results[0]->geodir_video; |
|
| 1766 | - } |
|
| 1764 | + if ($results) {
|
|
| 1765 | + return $results[0]->geodir_video; |
|
| 1766 | + } |
|
| 1767 | 1767 | |
| 1768 | 1768 | } |
| 1769 | 1769 | |
@@ -1779,40 +1779,40 @@ discard block |
||
| 1779 | 1779 | */ |
| 1780 | 1780 | function geodir_get_special_offers($post_id) |
| 1781 | 1781 | {
|
| 1782 | - global $wpdb, $plugin_prefix; |
|
| 1782 | + global $wpdb, $plugin_prefix; |
|
| 1783 | 1783 | |
| 1784 | - $post_type = get_post_type($post_id); |
|
| 1784 | + $post_type = get_post_type($post_id); |
|
| 1785 | 1785 | |
| 1786 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1786 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1787 | 1787 | |
| 1788 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1788 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1789 | 1789 | |
| 1790 | - if ($results) {
|
|
| 1791 | - return $results[0]->geodir_special_offers; |
|
| 1792 | - } |
|
| 1790 | + if ($results) {
|
|
| 1791 | + return $results[0]->geodir_special_offers; |
|
| 1792 | + } |
|
| 1793 | 1793 | |
| 1794 | 1794 | } |
| 1795 | 1795 | |
| 1796 | 1796 | if (!function_exists('geodir_max_upload_size')) {
|
| 1797 | - /** |
|
| 1798 | - * Get max upload file size |
|
| 1799 | - * |
|
| 1800 | - * @since 1.0.0 |
|
| 1801 | - * @package GeoDirectory |
|
| 1802 | - * @return mixed|void Returns max upload file size. |
|
| 1803 | - */ |
|
| 1804 | - function geodir_max_upload_size() |
|
| 1805 | - {
|
|
| 1806 | - $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 1807 | - |
|
| 1808 | - if ($max_filesize > 0 && $max_filesize < 1) {
|
|
| 1809 | - $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 1810 | - } else {
|
|
| 1811 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 1812 | - } |
|
| 1813 | - /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 1814 | - return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
|
| 1815 | - } |
|
| 1797 | + /** |
|
| 1798 | + * Get max upload file size |
|
| 1799 | + * |
|
| 1800 | + * @since 1.0.0 |
|
| 1801 | + * @package GeoDirectory |
|
| 1802 | + * @return mixed|void Returns max upload file size. |
|
| 1803 | + */ |
|
| 1804 | + function geodir_max_upload_size() |
|
| 1805 | + {
|
|
| 1806 | + $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 1807 | + |
|
| 1808 | + if ($max_filesize > 0 && $max_filesize < 1) {
|
|
| 1809 | + $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 1810 | + } else {
|
|
| 1811 | + $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 1812 | + } |
|
| 1813 | + /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 1814 | + return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
|
| 1815 | + } |
|
| 1816 | 1816 | } |
| 1817 | 1817 | |
| 1818 | 1818 | |
@@ -1830,33 +1830,33 @@ discard block |
||
| 1830 | 1830 | */ |
| 1831 | 1831 | function geodir_add_custom_sort_options($fields, $post_type) |
| 1832 | 1832 | {
|
| 1833 | - global $wpdb; |
|
| 1833 | + global $wpdb; |
|
| 1834 | 1834 | |
| 1835 | - if ($post_type != '') {
|
|
| 1835 | + if ($post_type != '') {
|
|
| 1836 | 1836 | |
| 1837 | - $all_postypes = geodir_get_posttypes(); |
|
| 1837 | + $all_postypes = geodir_get_posttypes(); |
|
| 1838 | 1838 | |
| 1839 | - if (in_array($post_type, $all_postypes)) {
|
|
| 1839 | + if (in_array($post_type, $all_postypes)) {
|
|
| 1840 | 1840 | |
| 1841 | - $custom_fields = $wpdb->get_results( |
|
| 1842 | - $wpdb->prepare( |
|
| 1843 | - "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc", |
|
| 1844 | - array($post_type) |
|
| 1845 | - ), 'ARRAY_A' |
|
| 1846 | - ); |
|
| 1841 | + $custom_fields = $wpdb->get_results( |
|
| 1842 | + $wpdb->prepare( |
|
| 1843 | + "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc", |
|
| 1844 | + array($post_type) |
|
| 1845 | + ), 'ARRAY_A' |
|
| 1846 | + ); |
|
| 1847 | 1847 | |
| 1848 | - if (!empty($custom_fields)) {
|
|
| 1848 | + if (!empty($custom_fields)) {
|
|
| 1849 | 1849 | |
| 1850 | - foreach ($custom_fields as $val) {
|
|
| 1851 | - $fields[] = $val; |
|
| 1852 | - } |
|
| 1853 | - } |
|
| 1850 | + foreach ($custom_fields as $val) {
|
|
| 1851 | + $fields[] = $val; |
|
| 1852 | + } |
|
| 1853 | + } |
|
| 1854 | 1854 | |
| 1855 | - } |
|
| 1855 | + } |
|
| 1856 | 1856 | |
| 1857 | - } |
|
| 1857 | + } |
|
| 1858 | 1858 | |
| 1859 | - return $fields; |
|
| 1859 | + return $fields; |
|
| 1860 | 1860 | } |
| 1861 | 1861 | |
| 1862 | 1862 | |
@@ -1872,76 +1872,76 @@ discard block |
||
| 1872 | 1872 | function geodir_get_custom_sort_options($post_type = '') |
| 1873 | 1873 | {
|
| 1874 | 1874 | |
| 1875 | - global $wpdb; |
|
| 1876 | - |
|
| 1877 | - if ($post_type != '') {
|
|
| 1878 | - |
|
| 1879 | - $all_postypes = geodir_get_posttypes(); |
|
| 1880 | - |
|
| 1881 | - if (!in_array($post_type, $all_postypes)) |
|
| 1882 | - return false; |
|
| 1883 | - |
|
| 1884 | - $fields = array(); |
|
| 1885 | - |
|
| 1886 | - $fields[] = array( |
|
| 1887 | - 'post_type' => $post_type, |
|
| 1888 | - 'data_type' => '', |
|
| 1889 | - 'field_type' => 'random', |
|
| 1890 | - 'site_title' => 'Random', |
|
| 1891 | - 'htmlvar_name' => 'post_title', |
|
| 1892 | - 'field_icon' => 'fa fa-random', |
|
| 1893 | - 'description' => __('Random sort (not recommended for large sites)', 'geodirectory')
|
|
| 1894 | - ); |
|
| 1895 | - |
|
| 1896 | - $fields[] = array( |
|
| 1897 | - 'post_type' => $post_type, |
|
| 1898 | - 'data_type' => '', |
|
| 1899 | - 'field_type' => 'datetime', |
|
| 1900 | - 'site_title' => __('Add date', 'geodirectory'),
|
|
| 1901 | - 'htmlvar_name' => 'post_date', |
|
| 1902 | - 'field_icon' => 'fa fa-calendar', |
|
| 1903 | - 'description' => __('Sort by date added', 'geodirectory')
|
|
| 1904 | - ); |
|
| 1905 | - $fields[] = array( |
|
| 1906 | - 'post_type' => $post_type, |
|
| 1907 | - 'data_type' => '', |
|
| 1908 | - 'field_type' => 'bigint', |
|
| 1909 | - 'site_title' => __('Review', 'geodirectory'),
|
|
| 1910 | - 'htmlvar_name' => 'comment_count', |
|
| 1911 | - 'field_icon' => 'fa fa-commenting-o', |
|
| 1912 | - 'description' => __('Sort by the number of reviews', 'geodirectory')
|
|
| 1913 | - ); |
|
| 1914 | - $fields[] = array( |
|
| 1915 | - 'post_type' => $post_type, |
|
| 1916 | - 'data_type' => '', |
|
| 1917 | - 'field_type' => 'float', |
|
| 1918 | - 'site_title' => __('Rating', 'geodirectory'),
|
|
| 1919 | - 'htmlvar_name' => 'overall_rating', |
|
| 1920 | - 'field_icon' => 'fa fa-star-o', |
|
| 1921 | - 'description' => __('Sort by the overall rating value', 'geodirectory')
|
|
| 1922 | - ); |
|
| 1923 | - $fields[] = array( |
|
| 1924 | - 'post_type' => $post_type, |
|
| 1925 | - 'data_type' => '', |
|
| 1926 | - 'field_type' => 'text', |
|
| 1927 | - 'site_title' => __('Title', 'geodirectory'),
|
|
| 1928 | - 'htmlvar_name' => 'post_title', |
|
| 1929 | - 'field_icon' => 'fa fa-sort-alpha-desc', |
|
| 1930 | - 'description' => __('Sort alphabetically by title', 'geodirectory')
|
|
| 1931 | - ); |
|
| 1932 | - |
|
| 1933 | - /** |
|
| 1934 | - * Hook to add custom sort options. |
|
| 1935 | - * |
|
| 1936 | - * @since 1.0.0 |
|
| 1937 | - * @param array $fields Unmodified sort options array. |
|
| 1938 | - * @param string $post_type Post type. |
|
| 1939 | - */ |
|
| 1940 | - return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
|
|
| 1941 | - |
|
| 1942 | - } |
|
| 1943 | - |
|
| 1944 | - return false; |
|
| 1875 | + global $wpdb; |
|
| 1876 | + |
|
| 1877 | + if ($post_type != '') {
|
|
| 1878 | + |
|
| 1879 | + $all_postypes = geodir_get_posttypes(); |
|
| 1880 | + |
|
| 1881 | + if (!in_array($post_type, $all_postypes)) |
|
| 1882 | + return false; |
|
| 1883 | + |
|
| 1884 | + $fields = array(); |
|
| 1885 | + |
|
| 1886 | + $fields[] = array( |
|
| 1887 | + 'post_type' => $post_type, |
|
| 1888 | + 'data_type' => '', |
|
| 1889 | + 'field_type' => 'random', |
|
| 1890 | + 'site_title' => 'Random', |
|
| 1891 | + 'htmlvar_name' => 'post_title', |
|
| 1892 | + 'field_icon' => 'fa fa-random', |
|
| 1893 | + 'description' => __('Random sort (not recommended for large sites)', 'geodirectory')
|
|
| 1894 | + ); |
|
| 1895 | + |
|
| 1896 | + $fields[] = array( |
|
| 1897 | + 'post_type' => $post_type, |
|
| 1898 | + 'data_type' => '', |
|
| 1899 | + 'field_type' => 'datetime', |
|
| 1900 | + 'site_title' => __('Add date', 'geodirectory'),
|
|
| 1901 | + 'htmlvar_name' => 'post_date', |
|
| 1902 | + 'field_icon' => 'fa fa-calendar', |
|
| 1903 | + 'description' => __('Sort by date added', 'geodirectory')
|
|
| 1904 | + ); |
|
| 1905 | + $fields[] = array( |
|
| 1906 | + 'post_type' => $post_type, |
|
| 1907 | + 'data_type' => '', |
|
| 1908 | + 'field_type' => 'bigint', |
|
| 1909 | + 'site_title' => __('Review', 'geodirectory'),
|
|
| 1910 | + 'htmlvar_name' => 'comment_count', |
|
| 1911 | + 'field_icon' => 'fa fa-commenting-o', |
|
| 1912 | + 'description' => __('Sort by the number of reviews', 'geodirectory')
|
|
| 1913 | + ); |
|
| 1914 | + $fields[] = array( |
|
| 1915 | + 'post_type' => $post_type, |
|
| 1916 | + 'data_type' => '', |
|
| 1917 | + 'field_type' => 'float', |
|
| 1918 | + 'site_title' => __('Rating', 'geodirectory'),
|
|
| 1919 | + 'htmlvar_name' => 'overall_rating', |
|
| 1920 | + 'field_icon' => 'fa fa-star-o', |
|
| 1921 | + 'description' => __('Sort by the overall rating value', 'geodirectory')
|
|
| 1922 | + ); |
|
| 1923 | + $fields[] = array( |
|
| 1924 | + 'post_type' => $post_type, |
|
| 1925 | + 'data_type' => '', |
|
| 1926 | + 'field_type' => 'text', |
|
| 1927 | + 'site_title' => __('Title', 'geodirectory'),
|
|
| 1928 | + 'htmlvar_name' => 'post_title', |
|
| 1929 | + 'field_icon' => 'fa fa-sort-alpha-desc', |
|
| 1930 | + 'description' => __('Sort alphabetically by title', 'geodirectory')
|
|
| 1931 | + ); |
|
| 1932 | + |
|
| 1933 | + /** |
|
| 1934 | + * Hook to add custom sort options. |
|
| 1935 | + * |
|
| 1936 | + * @since 1.0.0 |
|
| 1937 | + * @param array $fields Unmodified sort options array. |
|
| 1938 | + * @param string $post_type Post type. |
|
| 1939 | + */ |
|
| 1940 | + return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
|
|
| 1941 | + |
|
| 1942 | + } |
|
| 1943 | + |
|
| 1944 | + return false; |
|
| 1945 | 1945 | } |
| 1946 | 1946 | |
| 1947 | 1947 | |
@@ -1957,117 +1957,117 @@ discard block |
||
| 1957 | 1957 | function godir_set_sort_field_order($field_ids = array()) |
| 1958 | 1958 | {
|
| 1959 | 1959 | |
| 1960 | - global $wpdb; |
|
| 1960 | + global $wpdb; |
|
| 1961 | 1961 | |
| 1962 | - $count = 0; |
|
| 1963 | - if (!empty($field_ids)): |
|
| 1964 | - foreach ($field_ids as $id) {
|
|
| 1962 | + $count = 0; |
|
| 1963 | + if (!empty($field_ids)): |
|
| 1964 | + foreach ($field_ids as $id) {
|
|
| 1965 | 1965 | |
| 1966 | - $cf = trim($id, '_'); |
|
| 1966 | + $cf = trim($id, '_'); |
|
| 1967 | 1967 | |
| 1968 | - $post_meta_info = $wpdb->query( |
|
| 1969 | - $wpdb->prepare( |
|
| 1970 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1968 | + $post_meta_info = $wpdb->query( |
|
| 1969 | + $wpdb->prepare( |
|
| 1970 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1971 | 1971 | sort_order=%d |
| 1972 | 1972 | where id= %d", |
| 1973 | - array($count, $cf) |
|
| 1974 | - ) |
|
| 1975 | - ); |
|
| 1976 | - $count++; |
|
| 1977 | - } |
|
| 1978 | - |
|
| 1979 | - return $field_ids; |
|
| 1980 | - else: |
|
| 1981 | - return false; |
|
| 1982 | - endif; |
|
| 1973 | + array($count, $cf) |
|
| 1974 | + ) |
|
| 1975 | + ); |
|
| 1976 | + $count++; |
|
| 1977 | + } |
|
| 1978 | + |
|
| 1979 | + return $field_ids; |
|
| 1980 | + else: |
|
| 1981 | + return false; |
|
| 1982 | + endif; |
|
| 1983 | 1983 | } |
| 1984 | 1984 | |
| 1985 | 1985 | |
| 1986 | 1986 | if (!function_exists('geodir_custom_sort_field_save')) {
|
| 1987 | - /** |
|
| 1988 | - * Save or Update custom sort fields into the database. |
|
| 1989 | - * |
|
| 1990 | - * @since 1.0.0 |
|
| 1991 | - * @package GeoDirectory |
|
| 1992 | - * @global object $wpdb WordPress Database object. |
|
| 1993 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1994 | - * @param array $request_field {
|
|
| 1995 | - * Attributes of the Request field. |
|
| 1996 | - * |
|
| 1997 | - * @type string $action Ajax action name. |
|
| 1998 | - * @type string $manage_field_type Manage field type Default "sorting_options". |
|
| 1999 | - * @type string $create_field Do you want to create this field?. |
|
| 2000 | - * @type string $field_ins_upd Field created or updated?. |
|
| 2001 | - * @type string $_wpnonce Nonce value. |
|
| 2002 | - * @type string $listing_type The Post type. |
|
| 2003 | - * @type string $field_type Field Type. |
|
| 2004 | - * @type string $field_id Field ID. |
|
| 2005 | - * @type string $data_type Data Type. |
|
| 2006 | - * @type string $htmlvar_name HTML variable name. |
|
| 2007 | - * @type string $site_title Section title which you wish to display in frontend. |
|
| 2008 | - * @type string $is_default Is this default sorting?. |
|
| 2009 | - * @type string $is_active If not active then the field will not be displayed anywhere. |
|
| 2010 | - * @type string $sort_order Sort Order. |
|
| 2011 | - * |
|
| 2012 | - * } |
|
| 2013 | - * @param bool $default Not yet implemented. |
|
| 2014 | - * @return int Returns the last affected db table row id. |
|
| 2015 | - */ |
|
| 2016 | - function geodir_custom_sort_field_save($request_field = array(), $default = false) |
|
| 2017 | - {
|
|
| 2018 | - |
|
| 2019 | - global $wpdb, $plugin_prefix; |
|
| 2020 | - |
|
| 2021 | - $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 2022 | - |
|
| 2023 | - $cf = trim($result_str, '_'); |
|
| 2024 | - |
|
| 2025 | - /*-------- check duplicate validation --------*/ |
|
| 2026 | - |
|
| 2027 | - $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 2028 | - $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 2029 | - |
|
| 2030 | - $post_type = $request_field['listing_type']; |
|
| 2031 | - $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : ''; |
|
| 2032 | - $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 2033 | - $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : ''; |
|
| 2034 | - $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 2035 | - $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0; |
|
| 2036 | - $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0; |
|
| 2037 | - $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : ''; |
|
| 2038 | - $asc = isset($request_field['asc']) ? $request_field['asc'] : 0; |
|
| 2039 | - $desc = isset($request_field['desc']) ? $request_field['desc'] : 0; |
|
| 2040 | - $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : ''; |
|
| 2041 | - $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : ''; |
|
| 2042 | - |
|
| 2043 | - $default_order = ''; |
|
| 2044 | - if ($is_default != '') {
|
|
| 2045 | - $default_order = $is_default; |
|
| 2046 | - $is_default = '1'; |
|
| 2047 | - } |
|
| 2048 | - |
|
| 2049 | - |
|
| 2050 | - $check_html_variable = $wpdb->get_var( |
|
| 2051 | - $wpdb->prepare( |
|
| 2052 | - "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2053 | - array($cehhtmlvar_name, $post_type, $field_type) |
|
| 2054 | - ) |
|
| 2055 | - ); |
|
| 2056 | - |
|
| 2057 | - if ($is_default == 1) {
|
|
| 2058 | - |
|
| 2059 | - $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2060 | - |
|
| 2061 | - } |
|
| 2062 | - |
|
| 2063 | - |
|
| 2064 | - if (!$check_html_variable) {
|
|
| 2065 | - |
|
| 2066 | - $wpdb->query( |
|
| 2067 | - |
|
| 2068 | - $wpdb->prepare( |
|
| 2069 | - |
|
| 2070 | - "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1987 | + /** |
|
| 1988 | + * Save or Update custom sort fields into the database. |
|
| 1989 | + * |
|
| 1990 | + * @since 1.0.0 |
|
| 1991 | + * @package GeoDirectory |
|
| 1992 | + * @global object $wpdb WordPress Database object. |
|
| 1993 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1994 | + * @param array $request_field {
|
|
| 1995 | + * Attributes of the Request field. |
|
| 1996 | + * |
|
| 1997 | + * @type string $action Ajax action name. |
|
| 1998 | + * @type string $manage_field_type Manage field type Default "sorting_options". |
|
| 1999 | + * @type string $create_field Do you want to create this field?. |
|
| 2000 | + * @type string $field_ins_upd Field created or updated?. |
|
| 2001 | + * @type string $_wpnonce Nonce value. |
|
| 2002 | + * @type string $listing_type The Post type. |
|
| 2003 | + * @type string $field_type Field Type. |
|
| 2004 | + * @type string $field_id Field ID. |
|
| 2005 | + * @type string $data_type Data Type. |
|
| 2006 | + * @type string $htmlvar_name HTML variable name. |
|
| 2007 | + * @type string $site_title Section title which you wish to display in frontend. |
|
| 2008 | + * @type string $is_default Is this default sorting?. |
|
| 2009 | + * @type string $is_active If not active then the field will not be displayed anywhere. |
|
| 2010 | + * @type string $sort_order Sort Order. |
|
| 2011 | + * |
|
| 2012 | + * } |
|
| 2013 | + * @param bool $default Not yet implemented. |
|
| 2014 | + * @return int Returns the last affected db table row id. |
|
| 2015 | + */ |
|
| 2016 | + function geodir_custom_sort_field_save($request_field = array(), $default = false) |
|
| 2017 | + {
|
|
| 2018 | + |
|
| 2019 | + global $wpdb, $plugin_prefix; |
|
| 2020 | + |
|
| 2021 | + $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 2022 | + |
|
| 2023 | + $cf = trim($result_str, '_'); |
|
| 2024 | + |
|
| 2025 | + /*-------- check duplicate validation --------*/ |
|
| 2026 | + |
|
| 2027 | + $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 2028 | + $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 2029 | + |
|
| 2030 | + $post_type = $request_field['listing_type']; |
|
| 2031 | + $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : ''; |
|
| 2032 | + $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 2033 | + $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : ''; |
|
| 2034 | + $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 2035 | + $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0; |
|
| 2036 | + $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0; |
|
| 2037 | + $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : ''; |
|
| 2038 | + $asc = isset($request_field['asc']) ? $request_field['asc'] : 0; |
|
| 2039 | + $desc = isset($request_field['desc']) ? $request_field['desc'] : 0; |
|
| 2040 | + $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : ''; |
|
| 2041 | + $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : ''; |
|
| 2042 | + |
|
| 2043 | + $default_order = ''; |
|
| 2044 | + if ($is_default != '') {
|
|
| 2045 | + $default_order = $is_default; |
|
| 2046 | + $is_default = '1'; |
|
| 2047 | + } |
|
| 2048 | + |
|
| 2049 | + |
|
| 2050 | + $check_html_variable = $wpdb->get_var( |
|
| 2051 | + $wpdb->prepare( |
|
| 2052 | + "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2053 | + array($cehhtmlvar_name, $post_type, $field_type) |
|
| 2054 | + ) |
|
| 2055 | + ); |
|
| 2056 | + |
|
| 2057 | + if ($is_default == 1) {
|
|
| 2058 | + |
|
| 2059 | + $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2060 | + |
|
| 2061 | + } |
|
| 2062 | + |
|
| 2063 | + |
|
| 2064 | + if (!$check_html_variable) {
|
|
| 2065 | + |
|
| 2066 | + $wpdb->query( |
|
| 2067 | + |
|
| 2068 | + $wpdb->prepare( |
|
| 2069 | + |
|
| 2070 | + "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2071 | 2071 | post_type = %s, |
| 2072 | 2072 | data_type = %s, |
| 2073 | 2073 | field_type = %s, |
@@ -2082,23 +2082,23 @@ discard block |
||
| 2082 | 2082 | asc_title = %s, |
| 2083 | 2083 | desc_title = %s", |
| 2084 | 2084 | |
| 2085 | - array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title) |
|
| 2086 | - ) |
|
| 2085 | + array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title) |
|
| 2086 | + ) |
|
| 2087 | 2087 | |
| 2088 | - ); |
|
| 2088 | + ); |
|
| 2089 | 2089 | |
| 2090 | 2090 | |
| 2091 | - $lastid = $wpdb->insert_id; |
|
| 2091 | + $lastid = $wpdb->insert_id; |
|
| 2092 | 2092 | |
| 2093 | - $lastid = trim($lastid); |
|
| 2093 | + $lastid = trim($lastid); |
|
| 2094 | 2094 | |
| 2095 | - } else {
|
|
| 2095 | + } else {
|
|
| 2096 | 2096 | |
| 2097 | - $wpdb->query( |
|
| 2097 | + $wpdb->query( |
|
| 2098 | 2098 | |
| 2099 | - $wpdb->prepare( |
|
| 2099 | + $wpdb->prepare( |
|
| 2100 | 2100 | |
| 2101 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2101 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2102 | 2102 | post_type = %s, |
| 2103 | 2103 | data_type = %s, |
| 2104 | 2104 | field_type = %s, |
@@ -2114,123 +2114,123 @@ discard block |
||
| 2114 | 2114 | desc_title = %s |
| 2115 | 2115 | where id = %d", |
| 2116 | 2116 | |
| 2117 | - array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf) |
|
| 2118 | - ) |
|
| 2117 | + array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf) |
|
| 2118 | + ) |
|
| 2119 | 2119 | |
| 2120 | - ); |
|
| 2120 | + ); |
|
| 2121 | 2121 | |
| 2122 | - $lastid = trim($cf); |
|
| 2122 | + $lastid = trim($cf); |
|
| 2123 | 2123 | |
| 2124 | - } |
|
| 2124 | + } |
|
| 2125 | 2125 | |
| 2126 | 2126 | |
| 2127 | - return (int)$lastid; |
|
| 2127 | + return (int)$lastid; |
|
| 2128 | 2128 | |
| 2129 | - } |
|
| 2129 | + } |
|
| 2130 | 2130 | } |
| 2131 | 2131 | |
| 2132 | 2132 | |
| 2133 | 2133 | if (!function_exists('geodir_custom_sort_field_delete')) {
|
| 2134 | - /** |
|
| 2135 | - * Delete a custom sort field using field id. |
|
| 2136 | - * @since 1.0.0 |
|
| 2137 | - * @package GeoDirectory |
|
| 2138 | - * @global object $wpdb WordPress Database object. |
|
| 2139 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 2140 | - * @param string $field_id The field ID. |
|
| 2141 | - * @return int|string Returns field id when successful deletion, else returns 0. |
|
| 2142 | - */ |
|
| 2143 | - function geodir_custom_sort_field_delete($field_id = '') |
|
| 2144 | - {
|
|
| 2145 | - |
|
| 2146 | - global $wpdb, $plugin_prefix; |
|
| 2147 | - if ($field_id != '') {
|
|
| 2148 | - $cf = trim($field_id, '_'); |
|
| 2149 | - |
|
| 2150 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 2151 | - |
|
| 2152 | - return $field_id; |
|
| 2153 | - |
|
| 2154 | - } else |
|
| 2155 | - return 0; |
|
| 2156 | - |
|
| 2157 | - } |
|
| 2134 | + /** |
|
| 2135 | + * Delete a custom sort field using field id. |
|
| 2136 | + * @since 1.0.0 |
|
| 2137 | + * @package GeoDirectory |
|
| 2138 | + * @global object $wpdb WordPress Database object. |
|
| 2139 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 2140 | + * @param string $field_id The field ID. |
|
| 2141 | + * @return int|string Returns field id when successful deletion, else returns 0. |
|
| 2142 | + */ |
|
| 2143 | + function geodir_custom_sort_field_delete($field_id = '') |
|
| 2144 | + {
|
|
| 2145 | + |
|
| 2146 | + global $wpdb, $plugin_prefix; |
|
| 2147 | + if ($field_id != '') {
|
|
| 2148 | + $cf = trim($field_id, '_'); |
|
| 2149 | + |
|
| 2150 | + $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 2151 | + |
|
| 2152 | + return $field_id; |
|
| 2153 | + |
|
| 2154 | + } else |
|
| 2155 | + return 0; |
|
| 2156 | + |
|
| 2157 | + } |
|
| 2158 | 2158 | } |
| 2159 | 2159 | |
| 2160 | 2160 | |
| 2161 | 2161 | if (!function_exists('geodir_custom_sort_field_adminhtml')) {
|
| 2162 | - /** |
|
| 2163 | - * Custom sort field admin html. |
|
| 2164 | - * |
|
| 2165 | - * @since 1.0.0 |
|
| 2166 | - * @package GeoDirectory |
|
| 2167 | - * @global object $wpdb WordPress Database object. |
|
| 2168 | - * @param string $field_type The form field type. |
|
| 2169 | - * @param object|int $result_str The custom field results object or row id. |
|
| 2170 | - * @param string $field_ins_upd When set to "submit" displays form. |
|
| 2171 | - * @param bool $default when set to true field will be for admin use only. |
|
| 2172 | - */ |
|
| 2173 | - function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='') |
|
| 2174 | - {
|
|
| 2175 | - global $wpdb; |
|
| 2176 | - $cf = $result_str; |
|
| 2177 | - if (!is_object($cf)) {
|
|
| 2178 | - $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 2179 | - } else {
|
|
| 2180 | - $field_info = $cf; |
|
| 2181 | - $result_str = $cf->id; |
|
| 2182 | - } |
|
| 2183 | - |
|
| 2184 | - $field_info = stripslashes_deep($field_info); // strip slashes |
|
| 2185 | - |
|
| 2186 | - if (!isset($field_info->post_type)) {
|
|
| 2187 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2188 | - } else {
|
|
| 2189 | - $post_type = $field_info->post_type; |
|
| 2190 | - } |
|
| 2191 | - |
|
| 2192 | - |
|
| 2193 | - $htmlvar_name = isset($field_type_key) ? $field_type_key : ''; |
|
| 2194 | - |
|
| 2195 | - $site_title = ''; |
|
| 2196 | - if ($site_title == '') |
|
| 2197 | - $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 2198 | - |
|
| 2199 | - if ($site_title == '') {
|
|
| 2200 | - $fields = geodir_get_custom_sort_options($post_type); |
|
| 2201 | - |
|
| 2202 | - foreach ($fields as $val) {
|
|
| 2203 | - $val = stripslashes_deep($val); // strip slashes |
|
| 2204 | - |
|
| 2205 | - if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
|
|
| 2206 | - $site_title = isset($val['site_title']) ? $val['site_title'] : ''; |
|
| 2207 | - } |
|
| 2208 | - } |
|
| 2209 | - } |
|
| 2210 | - |
|
| 2211 | - if ($htmlvar_name == '') |
|
| 2212 | - $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 2213 | - |
|
| 2214 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2215 | - |
|
| 2216 | - $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 2217 | - $cso_arr = geodir_get_custom_sort_options($post_type); |
|
| 2218 | - |
|
| 2219 | - $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']); |
|
| 2220 | - foreach($cso_arr as $cso){
|
|
| 2221 | - if($cur_field_type==$cso['field_type']){
|
|
| 2222 | - |
|
| 2223 | - if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
|
|
| 2224 | - $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>'; |
|
| 2225 | - }elseif(isset($cso['field_icon']) && $cso['field_icon']){
|
|
| 2226 | - $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
|
|
| 2227 | - } |
|
| 2228 | - |
|
| 2229 | - } |
|
| 2230 | - } |
|
| 2231 | - |
|
| 2232 | - $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500); |
|
| 2233 | - ?> |
|
| 2162 | + /** |
|
| 2163 | + * Custom sort field admin html. |
|
| 2164 | + * |
|
| 2165 | + * @since 1.0.0 |
|
| 2166 | + * @package GeoDirectory |
|
| 2167 | + * @global object $wpdb WordPress Database object. |
|
| 2168 | + * @param string $field_type The form field type. |
|
| 2169 | + * @param object|int $result_str The custom field results object or row id. |
|
| 2170 | + * @param string $field_ins_upd When set to "submit" displays form. |
|
| 2171 | + * @param bool $default when set to true field will be for admin use only. |
|
| 2172 | + */ |
|
| 2173 | + function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='') |
|
| 2174 | + {
|
|
| 2175 | + global $wpdb; |
|
| 2176 | + $cf = $result_str; |
|
| 2177 | + if (!is_object($cf)) {
|
|
| 2178 | + $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 2179 | + } else {
|
|
| 2180 | + $field_info = $cf; |
|
| 2181 | + $result_str = $cf->id; |
|
| 2182 | + } |
|
| 2183 | + |
|
| 2184 | + $field_info = stripslashes_deep($field_info); // strip slashes |
|
| 2185 | + |
|
| 2186 | + if (!isset($field_info->post_type)) {
|
|
| 2187 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2188 | + } else {
|
|
| 2189 | + $post_type = $field_info->post_type; |
|
| 2190 | + } |
|
| 2191 | + |
|
| 2192 | + |
|
| 2193 | + $htmlvar_name = isset($field_type_key) ? $field_type_key : ''; |
|
| 2194 | + |
|
| 2195 | + $site_title = ''; |
|
| 2196 | + if ($site_title == '') |
|
| 2197 | + $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 2198 | + |
|
| 2199 | + if ($site_title == '') {
|
|
| 2200 | + $fields = geodir_get_custom_sort_options($post_type); |
|
| 2201 | + |
|
| 2202 | + foreach ($fields as $val) {
|
|
| 2203 | + $val = stripslashes_deep($val); // strip slashes |
|
| 2204 | + |
|
| 2205 | + if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
|
|
| 2206 | + $site_title = isset($val['site_title']) ? $val['site_title'] : ''; |
|
| 2207 | + } |
|
| 2208 | + } |
|
| 2209 | + } |
|
| 2210 | + |
|
| 2211 | + if ($htmlvar_name == '') |
|
| 2212 | + $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 2213 | + |
|
| 2214 | + $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2215 | + |
|
| 2216 | + $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 2217 | + $cso_arr = geodir_get_custom_sort_options($post_type); |
|
| 2218 | + |
|
| 2219 | + $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']); |
|
| 2220 | + foreach($cso_arr as $cso){
|
|
| 2221 | + if($cur_field_type==$cso['field_type']){
|
|
| 2222 | + |
|
| 2223 | + if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
|
|
| 2224 | + $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>'; |
|
| 2225 | + }elseif(isset($cso['field_icon']) && $cso['field_icon']){
|
|
| 2226 | + $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
|
|
| 2227 | + } |
|
| 2228 | + |
|
| 2229 | + } |
|
| 2230 | + } |
|
| 2231 | + |
|
| 2232 | + $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500); |
|
| 2233 | + ?> |
|
| 2234 | 2234 | |
| 2235 | 2235 | <li class="text" id="licontainer_<?php echo $result_str;?>"> |
| 2236 | 2236 | <form><!-- we need to wrap in a form so we can use radio buttons with same name --> |
@@ -2239,7 +2239,7 @@ discard block |
||
| 2239 | 2239 | ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
|
| 2240 | 2240 | <?php |
| 2241 | 2241 | |
| 2242 | - ?> |
|
| 2242 | + ?> |
|
| 2243 | 2243 | |
| 2244 | 2244 | <div title="<?php _e('Click to remove field', 'geodirectory');?>"
|
| 2245 | 2245 | onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
@@ -2254,17 +2254,17 @@ discard block |
||
| 2254 | 2254 | |
| 2255 | 2255 | <div id="field_frm<?php echo $result_str;?>" class="field_frm" |
| 2256 | 2256 | style="display:<?php if ($field_ins_upd == 'submit') {
|
| 2257 | - echo 'block;'; |
|
| 2258 | - } else {
|
|
| 2259 | - echo 'none;'; |
|
| 2260 | - } ?>"> |
|
| 2257 | + echo 'block;'; |
|
| 2258 | + } else {
|
|
| 2259 | + echo 'none;'; |
|
| 2260 | + } ?>"> |
|
| 2261 | 2261 | <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/> |
| 2262 | 2262 | <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/> |
| 2263 | 2263 | <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/> |
| 2264 | 2264 | <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/> |
| 2265 | 2265 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
|
| 2266 | - echo $field_info->data_type; |
|
| 2267 | - }?>"/> |
|
| 2266 | + echo $field_info->data_type; |
|
| 2267 | + }?>"/> |
|
| 2268 | 2268 | <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/> |
| 2269 | 2269 | |
| 2270 | 2270 | |
@@ -2287,14 +2287,14 @@ discard block |
||
| 2287 | 2287 | |
| 2288 | 2288 | <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled" value="1" |
| 2289 | 2289 | <?php if ($value == '1') {
|
| 2290 | - echo 'checked'; |
|
| 2291 | - } ?>/> |
|
| 2290 | + echo 'checked'; |
|
| 2291 | + } ?>/> |
|
| 2292 | 2292 | <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 2293 | 2293 | |
| 2294 | 2294 | <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0" |
| 2295 | 2295 | <?php if ($value == '0' || !$value) {
|
| 2296 | - echo 'checked'; |
|
| 2297 | - } ?>/> |
|
| 2296 | + echo 'checked'; |
|
| 2297 | + } ?>/> |
|
| 2298 | 2298 | <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 2299 | 2299 | |
| 2300 | 2300 | </div> |
@@ -2331,8 +2331,8 @@ discard block |
||
| 2331 | 2331 | |
| 2332 | 2332 | <input type="radio" name="is_default" |
| 2333 | 2333 | value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
|
| 2334 | - echo 'checked="checked"'; |
|
| 2335 | - } ?>/> |
|
| 2334 | + echo 'checked="checked"'; |
|
| 2335 | + } ?>/> |
|
| 2336 | 2336 | </div> |
| 2337 | 2337 | |
| 2338 | 2338 | </li> |
@@ -2352,14 +2352,14 @@ discard block |
||
| 2352 | 2352 | |
| 2353 | 2353 | <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled" value="1" |
| 2354 | 2354 | <?php if ($value == '1') {
|
| 2355 | - echo 'checked'; |
|
| 2356 | - } ?>/> |
|
| 2355 | + echo 'checked'; |
|
| 2356 | + } ?>/> |
|
| 2357 | 2357 | <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 2358 | 2358 | |
| 2359 | 2359 | <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0" |
| 2360 | 2360 | <?php if ($value == '0' || !$value) {
|
| 2361 | - echo 'checked'; |
|
| 2362 | - } ?>/> |
|
| 2361 | + echo 'checked'; |
|
| 2362 | + } ?>/> |
|
| 2363 | 2363 | <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 2364 | 2364 | |
| 2365 | 2365 | </div> |
@@ -2395,8 +2395,8 @@ discard block |
||
| 2395 | 2395 | |
| 2396 | 2396 | <input type="radio" name="is_default" |
| 2397 | 2397 | value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
|
| 2398 | - echo 'checked="checked"'; |
|
| 2399 | - } ?>/> |
|
| 2398 | + echo 'checked="checked"'; |
|
| 2399 | + } ?>/> |
|
| 2400 | 2400 | </div> |
| 2401 | 2401 | |
| 2402 | 2402 | </li> |
@@ -2438,8 +2438,8 @@ discard block |
||
| 2438 | 2438 | |
| 2439 | 2439 | <input type="checkbox" name="is_default" |
| 2440 | 2440 | value="<?php echo $field_type; ?>" <?php if (isset($value) && $value == '1') {
|
| 2441 | - echo 'checked="checked"'; |
|
| 2442 | - } ?>/> |
|
| 2441 | + echo 'checked="checked"'; |
|
| 2442 | + } ?>/> |
|
| 2443 | 2443 | </div> |
| 2444 | 2444 | |
| 2445 | 2445 | |
@@ -2462,14 +2462,14 @@ discard block |
||
| 2462 | 2462 | |
| 2463 | 2463 | <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
| 2464 | 2464 | <?php if ($value == '1') {
|
| 2465 | - echo 'checked'; |
|
| 2466 | - } ?>/> |
|
| 2465 | + echo 'checked'; |
|
| 2466 | + } ?>/> |
|
| 2467 | 2467 | <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 2468 | 2468 | |
| 2469 | 2469 | <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
| 2470 | 2470 | <?php if ($value == '0' || !$value) {
|
| 2471 | - echo 'checked'; |
|
| 2472 | - } ?>/> |
|
| 2471 | + echo 'checked'; |
|
| 2472 | + } ?>/> |
|
| 2473 | 2473 | <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 2474 | 2474 | |
| 2475 | 2475 | </div> |
@@ -2479,8 +2479,8 @@ discard block |
||
| 2479 | 2479 | |
| 2480 | 2480 | <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" |
| 2481 | 2481 | value="<?php if (isset($field_info->sort_order)) {
|
| 2482 | - echo esc_attr($field_info->sort_order); |
|
| 2483 | - }?>" size="50"/> |
|
| 2482 | + echo esc_attr($field_info->sort_order); |
|
| 2483 | + }?>" size="50"/> |
|
| 2484 | 2484 | |
| 2485 | 2485 | |
| 2486 | 2486 | |
@@ -2504,38 +2504,38 @@ discard block |
||
| 2504 | 2504 | </form> |
| 2505 | 2505 | </li> <?php |
| 2506 | 2506 | |
| 2507 | - } |
|
| 2507 | + } |
|
| 2508 | 2508 | } |
| 2509 | 2509 | |
| 2510 | 2510 | if (!function_exists('check_field_visibility')) {
|
| 2511 | - /** |
|
| 2512 | - * Check field visibility as per price package. |
|
| 2513 | - * |
|
| 2514 | - * @since 1.0.0 |
|
| 2515 | - * @package GeoDirectory |
|
| 2516 | - * @global object $wpdb WordPress Database object. |
|
| 2517 | - * @global array $geodir_addon_list List of active GeoDirectory extensions. |
|
| 2518 | - * @param int|string $package_id The package ID. |
|
| 2519 | - * @param string $field_name The field name. |
|
| 2520 | - * @param string $post_type Optional. The wordpress post type. |
|
| 2521 | - * @return bool Returns true when field visible, otherwise false. |
|
| 2522 | - */ |
|
| 2523 | - function check_field_visibility($package_id, $field_name, $post_type) |
|
| 2524 | - {
|
|
| 2525 | - global $wpdb, $geodir_addon_list; |
|
| 2526 | - if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
|
|
| 2527 | - return true; |
|
| 2528 | - } |
|
| 2529 | - if (!$package_id || !$field_name || !$post_type) {
|
|
| 2530 | - return true; |
|
| 2531 | - } |
|
| 2532 | - $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
|
|
| 2533 | - |
|
| 2534 | - if ($wpdb->get_var($sql)) {
|
|
| 2535 | - return true; |
|
| 2536 | - } |
|
| 2537 | - return false; |
|
| 2538 | - } |
|
| 2511 | + /** |
|
| 2512 | + * Check field visibility as per price package. |
|
| 2513 | + * |
|
| 2514 | + * @since 1.0.0 |
|
| 2515 | + * @package GeoDirectory |
|
| 2516 | + * @global object $wpdb WordPress Database object. |
|
| 2517 | + * @global array $geodir_addon_list List of active GeoDirectory extensions. |
|
| 2518 | + * @param int|string $package_id The package ID. |
|
| 2519 | + * @param string $field_name The field name. |
|
| 2520 | + * @param string $post_type Optional. The wordpress post type. |
|
| 2521 | + * @return bool Returns true when field visible, otherwise false. |
|
| 2522 | + */ |
|
| 2523 | + function check_field_visibility($package_id, $field_name, $post_type) |
|
| 2524 | + {
|
|
| 2525 | + global $wpdb, $geodir_addon_list; |
|
| 2526 | + if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
|
|
| 2527 | + return true; |
|
| 2528 | + } |
|
| 2529 | + if (!$package_id || !$field_name || !$post_type) {
|
|
| 2530 | + return true; |
|
| 2531 | + } |
|
| 2532 | + $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
|
|
| 2533 | + |
|
| 2534 | + if ($wpdb->get_var($sql)) {
|
|
| 2535 | + return true; |
|
| 2536 | + } |
|
| 2537 | + return false; |
|
| 2538 | + } |
|
| 2539 | 2539 | } |
| 2540 | 2540 | |
| 2541 | 2541 | /** |
@@ -2551,43 +2551,43 @@ discard block |
||
| 2551 | 2551 | */ |
| 2552 | 2552 | function geodir_string_to_options($input = '', $translated = false) |
| 2553 | 2553 | {
|
| 2554 | - $return = array(); |
|
| 2555 | - if ($input != '') {
|
|
| 2556 | - $input = trim($input); |
|
| 2557 | - $input = rtrim($input, ","); |
|
| 2558 | - $input = ltrim($input, ","); |
|
| 2559 | - $input = trim($input); |
|
| 2560 | - } |
|
| 2561 | - |
|
| 2562 | - $input_arr = explode(',', $input);
|
|
| 2563 | - |
|
| 2564 | - if (!empty($input_arr)) {
|
|
| 2565 | - foreach ($input_arr as $input_str) {
|
|
| 2566 | - $input_str = trim($input_str); |
|
| 2567 | - |
|
| 2568 | - if (strpos($input_str, "/") !== false) {
|
|
| 2569 | - $input_str = explode("/", $input_str, 2);
|
|
| 2570 | - $label = trim($input_str[0]); |
|
| 2571 | - if ($translated && $label != '') {
|
|
| 2572 | - $label = __($label, 'geodirectory'); |
|
| 2573 | - } |
|
| 2574 | - $label = ucfirst($label); |
|
| 2575 | - $value = trim($input_str[1]); |
|
| 2576 | - } else {
|
|
| 2577 | - $value = $input_str; |
|
| 2578 | - if ($translated && $input_str != '') {
|
|
| 2579 | - $input_str = __($input_str, 'geodirectory'); |
|
| 2580 | - } |
|
| 2581 | - $label = ucfirst($input_str); |
|
| 2582 | - } |
|
| 2583 | - |
|
| 2584 | - if ($label != '') {
|
|
| 2585 | - $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
|
|
| 2586 | - } |
|
| 2587 | - } |
|
| 2588 | - } |
|
| 2589 | - |
|
| 2590 | - return $return; |
|
| 2554 | + $return = array(); |
|
| 2555 | + if ($input != '') {
|
|
| 2556 | + $input = trim($input); |
|
| 2557 | + $input = rtrim($input, ","); |
|
| 2558 | + $input = ltrim($input, ","); |
|
| 2559 | + $input = trim($input); |
|
| 2560 | + } |
|
| 2561 | + |
|
| 2562 | + $input_arr = explode(',', $input);
|
|
| 2563 | + |
|
| 2564 | + if (!empty($input_arr)) {
|
|
| 2565 | + foreach ($input_arr as $input_str) {
|
|
| 2566 | + $input_str = trim($input_str); |
|
| 2567 | + |
|
| 2568 | + if (strpos($input_str, "/") !== false) {
|
|
| 2569 | + $input_str = explode("/", $input_str, 2);
|
|
| 2570 | + $label = trim($input_str[0]); |
|
| 2571 | + if ($translated && $label != '') {
|
|
| 2572 | + $label = __($label, 'geodirectory'); |
|
| 2573 | + } |
|
| 2574 | + $label = ucfirst($label); |
|
| 2575 | + $value = trim($input_str[1]); |
|
| 2576 | + } else {
|
|
| 2577 | + $value = $input_str; |
|
| 2578 | + if ($translated && $input_str != '') {
|
|
| 2579 | + $input_str = __($input_str, 'geodirectory'); |
|
| 2580 | + } |
|
| 2581 | + $label = ucfirst($input_str); |
|
| 2582 | + } |
|
| 2583 | + |
|
| 2584 | + if ($label != '') {
|
|
| 2585 | + $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
|
|
| 2586 | + } |
|
| 2587 | + } |
|
| 2588 | + } |
|
| 2589 | + |
|
| 2590 | + return $return; |
|
| 2591 | 2591 | } |
| 2592 | 2592 | |
| 2593 | 2593 | /** |
@@ -2602,66 +2602,66 @@ discard block |
||
| 2602 | 2602 | */ |
| 2603 | 2603 | function geodir_string_values_to_options($option_values = '', $translated = false) |
| 2604 | 2604 | {
|
| 2605 | - $options = array(); |
|
| 2606 | - if ($option_values == '') {
|
|
| 2607 | - return NULL; |
|
| 2608 | - } |
|
| 2609 | - |
|
| 2610 | - if (strpos($option_values, "{/optgroup}") !== false) {
|
|
| 2611 | - $option_values_arr = explode("{/optgroup}", $option_values);
|
|
| 2612 | - |
|
| 2613 | - foreach ($option_values_arr as $optgroup) {
|
|
| 2614 | - if (strpos($optgroup, "{optgroup}") !== false) {
|
|
| 2615 | - $optgroup_arr = explode("{optgroup}", $optgroup);
|
|
| 2616 | - |
|
| 2617 | - $count = 0; |
|
| 2618 | - foreach ($optgroup_arr as $optgroup_str) {
|
|
| 2619 | - $count++; |
|
| 2620 | - $optgroup_str = trim($optgroup_str); |
|
| 2621 | - |
|
| 2622 | - $optgroup_label = ''; |
|
| 2623 | - if (strpos($optgroup_str, "|") !== false) {
|
|
| 2624 | - $optgroup_str_arr = explode("|", $optgroup_str, 2);
|
|
| 2625 | - $optgroup_label = trim($optgroup_str_arr[0]); |
|
| 2626 | - if ($translated && $optgroup_label != '') {
|
|
| 2627 | - $optgroup_label = __($optgroup_label, 'geodirectory'); |
|
| 2628 | - } |
|
| 2629 | - $optgroup_label = ucfirst($optgroup_label); |
|
| 2630 | - $optgroup_str = $optgroup_str_arr[1]; |
|
| 2631 | - } |
|
| 2632 | - |
|
| 2633 | - $optgroup3 = geodir_string_to_options($optgroup_str, $translated); |
|
| 2634 | - |
|
| 2635 | - if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
|
|
| 2636 | - $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
|
|
| 2637 | - $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
|
|
| 2638 | - $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end); |
|
| 2639 | - } |
|
| 2640 | - $options = array_merge($options, $optgroup3); |
|
| 2641 | - } |
|
| 2642 | - } else {
|
|
| 2643 | - $optgroup1 = geodir_string_to_options($optgroup, $translated); |
|
| 2644 | - $options = array_merge($options, $optgroup1); |
|
| 2645 | - } |
|
| 2646 | - } |
|
| 2647 | - } else {
|
|
| 2648 | - $options = geodir_string_to_options($option_values, $translated); |
|
| 2649 | - } |
|
| 2650 | - |
|
| 2651 | - return $options; |
|
| 2605 | + $options = array(); |
|
| 2606 | + if ($option_values == '') {
|
|
| 2607 | + return NULL; |
|
| 2608 | + } |
|
| 2609 | + |
|
| 2610 | + if (strpos($option_values, "{/optgroup}") !== false) {
|
|
| 2611 | + $option_values_arr = explode("{/optgroup}", $option_values);
|
|
| 2612 | + |
|
| 2613 | + foreach ($option_values_arr as $optgroup) {
|
|
| 2614 | + if (strpos($optgroup, "{optgroup}") !== false) {
|
|
| 2615 | + $optgroup_arr = explode("{optgroup}", $optgroup);
|
|
| 2616 | + |
|
| 2617 | + $count = 0; |
|
| 2618 | + foreach ($optgroup_arr as $optgroup_str) {
|
|
| 2619 | + $count++; |
|
| 2620 | + $optgroup_str = trim($optgroup_str); |
|
| 2621 | + |
|
| 2622 | + $optgroup_label = ''; |
|
| 2623 | + if (strpos($optgroup_str, "|") !== false) {
|
|
| 2624 | + $optgroup_str_arr = explode("|", $optgroup_str, 2);
|
|
| 2625 | + $optgroup_label = trim($optgroup_str_arr[0]); |
|
| 2626 | + if ($translated && $optgroup_label != '') {
|
|
| 2627 | + $optgroup_label = __($optgroup_label, 'geodirectory'); |
|
| 2628 | + } |
|
| 2629 | + $optgroup_label = ucfirst($optgroup_label); |
|
| 2630 | + $optgroup_str = $optgroup_str_arr[1]; |
|
| 2631 | + } |
|
| 2632 | + |
|
| 2633 | + $optgroup3 = geodir_string_to_options($optgroup_str, $translated); |
|
| 2634 | + |
|
| 2635 | + if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
|
|
| 2636 | + $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
|
|
| 2637 | + $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
|
|
| 2638 | + $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end); |
|
| 2639 | + } |
|
| 2640 | + $options = array_merge($options, $optgroup3); |
|
| 2641 | + } |
|
| 2642 | + } else {
|
|
| 2643 | + $optgroup1 = geodir_string_to_options($optgroup, $translated); |
|
| 2644 | + $options = array_merge($options, $optgroup1); |
|
| 2645 | + } |
|
| 2646 | + } |
|
| 2647 | + } else {
|
|
| 2648 | + $options = geodir_string_to_options($option_values, $translated); |
|
| 2649 | + } |
|
| 2650 | + |
|
| 2651 | + return $options; |
|
| 2652 | 2652 | } |
| 2653 | 2653 | |
| 2654 | 2654 | |
| 2655 | 2655 | function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
|
| 2656 | - ob_start(); |
|
| 2657 | - |
|
| 2658 | - $dt_value = ''; |
|
| 2659 | - if (isset($field_info->data_type)) {
|
|
| 2660 | - $dt_value = esc_attr($field_info->data_type); |
|
| 2661 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 2662 | - $dt_value = $cf['defaults']['data_type']; |
|
| 2663 | - } |
|
| 2664 | - ?> |
|
| 2656 | + ob_start(); |
|
| 2657 | + |
|
| 2658 | + $dt_value = ''; |
|
| 2659 | + if (isset($field_info->data_type)) {
|
|
| 2660 | + $dt_value = esc_attr($field_info->data_type); |
|
| 2661 | + }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 2662 | + $dt_value = $cf['defaults']['data_type']; |
|
| 2663 | + } |
|
| 2664 | + ?> |
|
| 2665 | 2665 | <li> |
| 2666 | 2666 | <label for="data_type"><?php _e('Field Data Type ? :', 'geodirectory'); ?></label>
|
| 2667 | 2667 | <div class="gd-cf-input-wrap"> |
@@ -2670,16 +2670,16 @@ discard block |
||
| 2670 | 2670 | onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');"> |
| 2671 | 2671 | <option |
| 2672 | 2672 | value="XVARCHAR" <?php if ($dt_value == 'VARCHAR') {
|
| 2673 | - echo 'selected="selected"'; |
|
| 2674 | - } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
|
|
| 2673 | + echo 'selected="selected"'; |
|
| 2674 | + } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
|
|
| 2675 | 2675 | <option |
| 2676 | 2676 | value="INT" <?php if ($dt_value == 'INT') {
|
| 2677 | - echo 'selected="selected"'; |
|
| 2678 | - } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
|
|
| 2677 | + echo 'selected="selected"'; |
|
| 2678 | + } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
|
|
| 2679 | 2679 | <option |
| 2680 | 2680 | value="FLOAT" <?php if ($dt_value == 'FLOAT') {
|
| 2681 | - echo 'selected="selected"'; |
|
| 2682 | - } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
|
|
| 2681 | + echo 'selected="selected"'; |
|
| 2682 | + } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
|
|
| 2683 | 2683 | </select> |
| 2684 | 2684 | <br/> <span><?php _e('Select Custom Field type', 'geodirectory'); ?></span>
|
| 2685 | 2685 | |
@@ -2687,13 +2687,13 @@ discard block |
||
| 2687 | 2687 | </li> |
| 2688 | 2688 | |
| 2689 | 2689 | <?php |
| 2690 | - $value = ''; |
|
| 2691 | - if (isset($field_info->decimal_point)) {
|
|
| 2692 | - $value = esc_attr($field_info->decimal_point); |
|
| 2693 | - }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
|
|
| 2694 | - $value = $cf['defaults']['decimal_point']; |
|
| 2695 | - } |
|
| 2696 | - ?> |
|
| 2690 | + $value = ''; |
|
| 2691 | + if (isset($field_info->decimal_point)) {
|
|
| 2692 | + $value = esc_attr($field_info->decimal_point); |
|
| 2693 | + }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
|
|
| 2694 | + $value = $cf['defaults']['decimal_point']; |
|
| 2695 | + } |
|
| 2696 | + ?> |
|
| 2697 | 2697 | |
| 2698 | 2698 | <li class="decimal-point-wrapper" |
| 2699 | 2699 | style="<?php echo ($dt_value == 'FLOAT') ? '' : 'display:none' ?>"> |
@@ -2702,7 +2702,7 @@ discard block |
||
| 2702 | 2702 | <select name="decimal_point" id="decimal_point"> |
| 2703 | 2703 | <option value=""><?php echo _e('Select', 'geodirectory'); ?></option>
|
| 2704 | 2704 | <?php for ($i = 1; $i <= 10; $i++) {
|
| 2705 | - $selected = $i == $value ? 'selected="selected"' : ''; ?> |
|
| 2705 | + $selected = $i == $value ? 'selected="selected"' : ''; ?> |
|
| 2706 | 2706 | <option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option> |
| 2707 | 2707 | <?php } ?> |
| 2708 | 2708 | </select> |
@@ -2711,8 +2711,8 @@ discard block |
||
| 2711 | 2711 | </li> |
| 2712 | 2712 | <?php |
| 2713 | 2713 | |
| 2714 | - $output = ob_get_clean(); |
|
| 2715 | - return $output; |
|
| 2714 | + $output = ob_get_clean(); |
|
| 2715 | + return $output; |
|
| 2716 | 2716 | } |
| 2717 | 2717 | add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
|
| 2718 | 2718 | |
@@ -2748,9 +2748,9 @@ discard block |
||
| 2748 | 2748 | |
| 2749 | 2749 | |
| 2750 | 2750 | function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
|
| 2751 | - if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
|
|
| 2752 | - ob_start(); |
|
| 2753 | - ?> |
|
| 2751 | + if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
|
|
| 2752 | + ob_start(); |
|
| 2753 | + ?> |
|
| 2754 | 2754 | <li> |
| 2755 | 2755 | <label for="advanced_editor" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show advanced editor :', 'geodirectory'); ?>
|
| 2756 | 2756 | <div class="gdcf-tooltip"> |
@@ -2761,13 +2761,13 @@ discard block |
||
| 2761 | 2761 | <div class="gd-cf-input-wrap"> |
| 2762 | 2762 | |
| 2763 | 2763 | <?php |
| 2764 | - $selected = ''; |
|
| 2765 | - if (isset($field_info->extra_fields)) |
|
| 2766 | - $advanced_editor = unserialize($field_info->extra_fields); |
|
| 2764 | + $selected = ''; |
|
| 2765 | + if (isset($field_info->extra_fields)) |
|
| 2766 | + $advanced_editor = unserialize($field_info->extra_fields); |
|
| 2767 | 2767 | |
| 2768 | - if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
|
|
| 2769 | - $selected = 'checked="checked"'; |
|
| 2770 | - ?> |
|
| 2768 | + if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
|
|
| 2769 | + $selected = 'checked="checked"'; |
|
| 2770 | + ?> |
|
| 2771 | 2771 | |
| 2772 | 2772 | <input type="checkbox" name="advanced_editor[]" id="advanced_editor" |
| 2773 | 2773 | value="1" <?php echo $selected; ?>/> |
@@ -2776,22 +2776,22 @@ discard block |
||
| 2776 | 2776 | </li> |
| 2777 | 2777 | <?php |
| 2778 | 2778 | |
| 2779 | - $output = ob_get_clean(); |
|
| 2780 | - return $output; |
|
| 2779 | + $output = ob_get_clean(); |
|
| 2780 | + return $output; |
|
| 2781 | 2781 | } |
| 2782 | 2782 | add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
|
| 2783 | 2783 | |
| 2784 | 2784 | |
| 2785 | 2785 | function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
|
| 2786 | - ob_start(); |
|
| 2787 | - |
|
| 2788 | - $value = ''; |
|
| 2789 | - if (isset($field_info->validation_pattern)) {
|
|
| 2790 | - $value = esc_attr($field_info->validation_pattern); |
|
| 2791 | - }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
|
|
| 2792 | - $value = esc_attr($cf['defaults']['validation_pattern']); |
|
| 2793 | - } |
|
| 2794 | - ?> |
|
| 2786 | + ob_start(); |
|
| 2787 | + |
|
| 2788 | + $value = ''; |
|
| 2789 | + if (isset($field_info->validation_pattern)) {
|
|
| 2790 | + $value = esc_attr($field_info->validation_pattern); |
|
| 2791 | + }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
|
|
| 2792 | + $value = esc_attr($cf['defaults']['validation_pattern']); |
|
| 2793 | + } |
|
| 2794 | + ?> |
|
| 2795 | 2795 | <li> |
| 2796 | 2796 | <label for="validation_pattern" class="gd-cf-tooltip-wrap"> |
| 2797 | 2797 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Pattern:', 'geodirectory'); ?>
|
@@ -2805,13 +2805,13 @@ discard block |
||
| 2805 | 2805 | </div> |
| 2806 | 2806 | </li> |
| 2807 | 2807 | <?php |
| 2808 | - $value = ''; |
|
| 2809 | - if (isset($field_info->validation_msg)) {
|
|
| 2810 | - $value = esc_attr($field_info->validation_msg); |
|
| 2811 | - }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
|
|
| 2812 | - $value = esc_attr($cf['defaults']['validation_msg']); |
|
| 2813 | - } |
|
| 2814 | - ?> |
|
| 2808 | + $value = ''; |
|
| 2809 | + if (isset($field_info->validation_msg)) {
|
|
| 2810 | + $value = esc_attr($field_info->validation_msg); |
|
| 2811 | + }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
|
|
| 2812 | + $value = esc_attr($cf['defaults']['validation_msg']); |
|
| 2813 | + } |
|
| 2814 | + ?> |
|
| 2815 | 2815 | <li> |
| 2816 | 2816 | <label for="validation_msg" class="gd-cf-tooltip-wrap"> |
| 2817 | 2817 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Message:', 'geodirectory'); ?>
|
@@ -2826,21 +2826,21 @@ discard block |
||
| 2826 | 2826 | </li> |
| 2827 | 2827 | <?php |
| 2828 | 2828 | |
| 2829 | - $output = ob_get_clean(); |
|
| 2830 | - return $output; |
|
| 2829 | + $output = ob_get_clean(); |
|
| 2830 | + return $output; |
|
| 2831 | 2831 | } |
| 2832 | 2832 | add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
|
| 2833 | 2833 | |
| 2834 | 2834 | |
| 2835 | 2835 | function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
|
| 2836 | - ob_start(); |
|
| 2837 | - global $post_type; |
|
| 2838 | - |
|
| 2839 | - if (!isset($field_info->post_type)) {
|
|
| 2840 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2841 | - } else |
|
| 2842 | - $post_type = $field_info->post_type; |
|
| 2843 | - ?> |
|
| 2836 | + ob_start(); |
|
| 2837 | + global $post_type; |
|
| 2838 | + |
|
| 2839 | + if (!isset($field_info->post_type)) {
|
|
| 2840 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2841 | + } else |
|
| 2842 | + $post_type = $field_info->post_type; |
|
| 2843 | + ?> |
|
| 2844 | 2844 | <li style="display: none;"> |
| 2845 | 2845 | <label for="htmlvar_name" class="gd-cf-tooltip-wrap"> |
| 2846 | 2846 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Select taxonomy:', 'geodirectory'); ?>
|
@@ -2851,15 +2851,15 @@ discard block |
||
| 2851 | 2851 | <div class="gd-cf-input-wrap"> |
| 2852 | 2852 | <select name="htmlvar_name" id="htmlvar_name"> |
| 2853 | 2853 | <?php |
| 2854 | - $gd_taxonomy = geodir_get_taxonomies($post_type); |
|
| 2854 | + $gd_taxonomy = geodir_get_taxonomies($post_type); |
|
| 2855 | 2855 | |
| 2856 | - foreach ($gd_taxonomy as $gd_tax) {
|
|
| 2857 | - ?> |
|
| 2856 | + foreach ($gd_taxonomy as $gd_tax) {
|
|
| 2857 | + ?> |
|
| 2858 | 2858 | <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
|
| 2859 | - echo 'selected="selected"'; |
|
| 2860 | - }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php |
|
| 2861 | - } |
|
| 2862 | - ?> |
|
| 2859 | + echo 'selected="selected"'; |
|
| 2860 | + }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php |
|
| 2861 | + } |
|
| 2862 | + ?> |
|
| 2863 | 2863 | </select> |
| 2864 | 2864 | </div> |
| 2865 | 2865 | </li> |
@@ -2875,49 +2875,49 @@ discard block |
||
| 2875 | 2875 | |
| 2876 | 2876 | <select name="cat_display_type" id="cat_display_type"> |
| 2877 | 2877 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
|
| 2878 | - echo 'selected="selected"'; |
|
| 2879 | - }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
|
|
| 2878 | + echo 'selected="selected"'; |
|
| 2879 | + }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
|
|
| 2880 | 2880 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 2881 | - echo 'selected="selected"'; |
|
| 2882 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2881 | + echo 'selected="selected"'; |
|
| 2882 | + }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2883 | 2883 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
|
| 2884 | - echo 'selected="selected"'; |
|
| 2885 | - }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
|
|
| 2884 | + echo 'selected="selected"'; |
|
| 2885 | + }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
|
|
| 2886 | 2886 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 2887 | - echo 'selected="selected"'; |
|
| 2888 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2887 | + echo 'selected="selected"'; |
|
| 2888 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2889 | 2889 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 2890 | - echo 'selected="selected"'; |
|
| 2891 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2890 | + echo 'selected="selected"'; |
|
| 2891 | + }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2892 | 2892 | </select> |
| 2893 | 2893 | </div> |
| 2894 | 2894 | </li> |
| 2895 | 2895 | <?php |
| 2896 | 2896 | |
| 2897 | - $output = ob_get_clean(); |
|
| 2898 | - return $output; |
|
| 2897 | + $output = ob_get_clean(); |
|
| 2898 | + return $output; |
|
| 2899 | 2899 | } |
| 2900 | 2900 | add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
|
| 2901 | 2901 | |
| 2902 | 2902 | |
| 2903 | 2903 | function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
|
| 2904 | 2904 | |
| 2905 | - ob_start(); |
|
| 2906 | - if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
|
| 2907 | - $address = stripslashes_deep(unserialize($field_info->extra_fields)); |
|
| 2908 | - } |
|
| 2905 | + ob_start(); |
|
| 2906 | + if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
|
| 2907 | + $address = stripslashes_deep(unserialize($field_info->extra_fields)); |
|
| 2908 | + } |
|
| 2909 | 2909 | |
| 2910 | - $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500); |
|
| 2911 | - ?> |
|
| 2910 | + $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500); |
|
| 2911 | + ?> |
|
| 2912 | 2912 | <?php |
| 2913 | - /** |
|
| 2914 | - * Called on the add custom fields settings page before the address field is output. |
|
| 2915 | - * |
|
| 2916 | - * @since 1.0.0 |
|
| 2917 | - * @param array $address The address settings array. |
|
| 2918 | - * @param object $field_info Extra fields info. |
|
| 2919 | - */ |
|
| 2920 | - do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
|
|
| 2913 | + /** |
|
| 2914 | + * Called on the add custom fields settings page before the address field is output. |
|
| 2915 | + * |
|
| 2916 | + * @since 1.0.0 |
|
| 2917 | + * @param array $address The address settings array. |
|
| 2918 | + * @param object $field_info Extra fields info. |
|
| 2919 | + */ |
|
| 2920 | + do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
|
|
| 2921 | 2921 | |
| 2922 | 2922 | <li> |
| 2923 | 2923 | <label for="show_zip" class="gd-cf-tooltip-wrap"> |
@@ -2930,14 +2930,14 @@ discard block |
||
| 2930 | 2930 | |
| 2931 | 2931 | <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled" value="1" |
| 2932 | 2932 | <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
|
| 2933 | - echo 'checked'; |
|
| 2934 | - } ?>/> |
|
| 2933 | + echo 'checked'; |
|
| 2934 | + } ?>/> |
|
| 2935 | 2935 | <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 2936 | 2936 | |
| 2937 | 2937 | <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0" |
| 2938 | 2938 | <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
|
| 2939 | - echo 'checked'; |
|
| 2940 | - } ?>/> |
|
| 2939 | + echo 'checked'; |
|
| 2940 | + } ?>/> |
|
| 2941 | 2941 | <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 2942 | 2942 | |
| 2943 | 2943 | |
@@ -2954,8 +2954,8 @@ discard block |
||
| 2954 | 2954 | <div class="gd-cf-input-wrap"> |
| 2955 | 2955 | <input type="text" name="extra[zip_lable]" id="zip_lable" |
| 2956 | 2956 | value="<?php if (isset($address['zip_lable'])) {
|
| 2957 | - echo esc_attr($address['zip_lable']); |
|
| 2958 | - }?>"/> |
|
| 2957 | + echo esc_attr($address['zip_lable']); |
|
| 2958 | + }?>"/> |
|
| 2959 | 2959 | </div> |
| 2960 | 2960 | </li> |
| 2961 | 2961 | |
@@ -2972,8 +2972,8 @@ discard block |
||
| 2972 | 2972 | <div class="gd-cf-input-wrap"> |
| 2973 | 2973 | <input type="text" name="extra[map_lable]" id="map_lable" |
| 2974 | 2974 | value="<?php if (isset($address['map_lable'])) {
|
| 2975 | - echo esc_attr($address['map_lable']); |
|
| 2976 | - }?>"/> |
|
| 2975 | + echo esc_attr($address['map_lable']); |
|
| 2976 | + }?>"/> |
|
| 2977 | 2977 | </div> |
| 2978 | 2978 | </li> |
| 2979 | 2979 | |
@@ -2988,14 +2988,14 @@ discard block |
||
| 2988 | 2988 | |
| 2989 | 2989 | <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled" value="1" |
| 2990 | 2990 | <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
|
| 2991 | - echo 'checked'; |
|
| 2992 | - } ?>/> |
|
| 2991 | + echo 'checked'; |
|
| 2992 | + } ?>/> |
|
| 2993 | 2993 | <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 2994 | 2994 | |
| 2995 | 2995 | <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0" |
| 2996 | 2996 | <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
|
| 2997 | - echo 'checked'; |
|
| 2998 | - } ?>/> |
|
| 2997 | + echo 'checked'; |
|
| 2998 | + } ?>/> |
|
| 2999 | 2999 | <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 3000 | 3000 | |
| 3001 | 3001 | </div> |
@@ -3012,14 +3012,14 @@ discard block |
||
| 3012 | 3012 | |
| 3013 | 3013 | <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled" value="1" |
| 3014 | 3014 | <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
|
| 3015 | - echo 'checked'; |
|
| 3016 | - } ?>/> |
|
| 3015 | + echo 'checked'; |
|
| 3016 | + } ?>/> |
|
| 3017 | 3017 | <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 3018 | 3018 | |
| 3019 | 3019 | <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0" |
| 3020 | 3020 | <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
|
| 3021 | - echo 'checked'; |
|
| 3022 | - } ?>/> |
|
| 3021 | + echo 'checked'; |
|
| 3022 | + } ?>/> |
|
| 3023 | 3023 | <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 3024 | 3024 | |
| 3025 | 3025 | </div> |
@@ -3036,8 +3036,8 @@ discard block |
||
| 3036 | 3036 | <div class="gd-cf-input-wrap"> |
| 3037 | 3037 | <input type="text" name="extra[mapview_lable]" id="mapview_lable" |
| 3038 | 3038 | value="<?php if (isset($address['mapview_lable'])) {
|
| 3039 | - echo esc_attr($address['mapview_lable']); |
|
| 3040 | - }?>"/> |
|
| 3039 | + echo esc_attr($address['mapview_lable']); |
|
| 3040 | + }?>"/> |
|
| 3041 | 3041 | </div> |
| 3042 | 3042 | </li> |
| 3043 | 3043 | <li> |
@@ -3051,29 +3051,29 @@ discard block |
||
| 3051 | 3051 | |
| 3052 | 3052 | <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled" value="1" |
| 3053 | 3053 | <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
|
| 3054 | - echo 'checked'; |
|
| 3055 | - } ?>/> |
|
| 3054 | + echo 'checked'; |
|
| 3055 | + } ?>/> |
|
| 3056 | 3056 | <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 3057 | 3057 | |
| 3058 | 3058 | <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0" |
| 3059 | 3059 | <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
|
| 3060 | - echo 'checked'; |
|
| 3061 | - } ?>/> |
|
| 3060 | + echo 'checked'; |
|
| 3061 | + } ?>/> |
|
| 3062 | 3062 | <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 3063 | 3063 | |
| 3064 | 3064 | </div> |
| 3065 | 3065 | </li> |
| 3066 | 3066 | <?php |
| 3067 | 3067 | |
| 3068 | - $html = ob_get_clean(); |
|
| 3069 | - return $output.$html; |
|
| 3068 | + $html = ob_get_clean(); |
|
| 3069 | + return $output.$html; |
|
| 3070 | 3070 | } |
| 3071 | 3071 | add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
|
| 3072 | 3072 | |
| 3073 | 3073 | |
| 3074 | 3074 | function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
|
| 3075 | - ob_start(); |
|
| 3076 | - ?> |
|
| 3075 | + ob_start(); |
|
| 3076 | + ?> |
|
| 3077 | 3077 | <li> |
| 3078 | 3078 | <label for="multi_display_type" class="gd-cf-tooltip-wrap"> |
| 3079 | 3079 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
|
@@ -3085,14 +3085,14 @@ discard block |
||
| 3085 | 3085 | |
| 3086 | 3086 | <select name="multi_display_type" id="multi_display_type"> |
| 3087 | 3087 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 3088 | - echo 'selected="selected"'; |
|
| 3089 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 3088 | + echo 'selected="selected"'; |
|
| 3089 | + }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 3090 | 3090 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 3091 | - echo 'selected="selected"'; |
|
| 3092 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 3091 | + echo 'selected="selected"'; |
|
| 3092 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 3093 | 3093 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 3094 | - echo 'selected="selected"'; |
|
| 3095 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 3094 | + echo 'selected="selected"'; |
|
| 3095 | + }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 3096 | 3096 | </select> |
| 3097 | 3097 | |
| 3098 | 3098 | <br/> |
@@ -3100,25 +3100,25 @@ discard block |
||
| 3100 | 3100 | </li> |
| 3101 | 3101 | <?php |
| 3102 | 3102 | |
| 3103 | - $html = ob_get_clean(); |
|
| 3104 | - return $output.$html; |
|
| 3103 | + $html = ob_get_clean(); |
|
| 3104 | + return $output.$html; |
|
| 3105 | 3105 | } |
| 3106 | 3106 | add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
|
| 3107 | 3107 | |
| 3108 | 3108 | |
| 3109 | 3109 | function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
|
| 3110 | 3110 | |
| 3111 | - ob_start(); |
|
| 3111 | + ob_start(); |
|
| 3112 | 3112 | |
| 3113 | - $value = ''; |
|
| 3114 | - if (isset($field_info->option_values)) {
|
|
| 3115 | - $value = esc_attr($field_info->option_values); |
|
| 3116 | - }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
|
|
| 3117 | - $value = esc_attr($cf['defaults']['option_values']); |
|
| 3118 | - } |
|
| 3113 | + $value = ''; |
|
| 3114 | + if (isset($field_info->option_values)) {
|
|
| 3115 | + $value = esc_attr($field_info->option_values); |
|
| 3116 | + }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
|
|
| 3117 | + $value = esc_attr($cf['defaults']['option_values']); |
|
| 3118 | + } |
|
| 3119 | 3119 | |
| 3120 | - $field_type = isset($field_info->field_type) ? $field_info->field_type : ''; |
|
| 3121 | - ?> |
|
| 3120 | + $field_type = isset($field_info->field_type) ? $field_info->field_type : ''; |
|
| 3121 | + ?> |
|
| 3122 | 3122 | <li> |
| 3123 | 3123 | <label for="option_values" class="gd-cf-tooltip-wrap"> |
| 3124 | 3124 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
|
@@ -3145,8 +3145,8 @@ discard block |
||
| 3145 | 3145 | </li> |
| 3146 | 3146 | <?php |
| 3147 | 3147 | |
| 3148 | - $html = ob_get_clean(); |
|
| 3149 | - return $output.$html; |
|
| 3148 | + $html = ob_get_clean(); |
|
| 3149 | + return $output.$html; |
|
| 3150 | 3150 | } |
| 3151 | 3151 | add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
|
| 3152 | 3152 | add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
|
@@ -3154,12 +3154,12 @@ discard block |
||
| 3154 | 3154 | |
| 3155 | 3155 | |
| 3156 | 3156 | function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
|
| 3157 | - ob_start(); |
|
| 3158 | - $extra = array(); |
|
| 3159 | - if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
|
| 3160 | - $extra = unserialize($field_info->extra_fields); |
|
| 3161 | - } |
|
| 3162 | - ?> |
|
| 3157 | + ob_start(); |
|
| 3158 | + $extra = array(); |
|
| 3159 | + if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
|
| 3160 | + $extra = unserialize($field_info->extra_fields); |
|
| 3161 | + } |
|
| 3162 | + ?> |
|
| 3163 | 3163 | <li> |
| 3164 | 3164 | <label for="date_format" class="gd-cf-tooltip-wrap"> |
| 3165 | 3165 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
|
@@ -3169,52 +3169,52 @@ discard block |
||
| 3169 | 3169 | </label> |
| 3170 | 3170 | <div class="gd-cf-input-wrap" style="overflow:inherit;"> |
| 3171 | 3171 | <?php |
| 3172 | - $date_formats = array( |
|
| 3173 | - 'm/d/Y', |
|
| 3174 | - 'd/m/Y', |
|
| 3175 | - 'Y/m/d', |
|
| 3176 | - 'm-d-Y', |
|
| 3177 | - 'd-m-Y', |
|
| 3178 | - 'Y-m-d', |
|
| 3179 | - 'F j, Y', |
|
| 3180 | - ); |
|
| 3181 | - /** |
|
| 3182 | - * Filter the custom field date format options. |
|
| 3183 | - * |
|
| 3184 | - * @since 1.6.5 |
|
| 3185 | - * @param array $date_formats The PHP date format array. |
|
| 3186 | - */ |
|
| 3187 | - $date_formats = apply_filters('geodir_date_formats',$date_formats);
|
|
| 3188 | - ?> |
|
| 3172 | + $date_formats = array( |
|
| 3173 | + 'm/d/Y', |
|
| 3174 | + 'd/m/Y', |
|
| 3175 | + 'Y/m/d', |
|
| 3176 | + 'm-d-Y', |
|
| 3177 | + 'd-m-Y', |
|
| 3178 | + 'Y-m-d', |
|
| 3179 | + 'F j, Y', |
|
| 3180 | + ); |
|
| 3181 | + /** |
|
| 3182 | + * Filter the custom field date format options. |
|
| 3183 | + * |
|
| 3184 | + * @since 1.6.5 |
|
| 3185 | + * @param array $date_formats The PHP date format array. |
|
| 3186 | + */ |
|
| 3187 | + $date_formats = apply_filters('geodir_date_formats',$date_formats);
|
|
| 3188 | + ?> |
|
| 3189 | 3189 | <select name="extra[date_format]" id="date_format"> |
| 3190 | 3190 | <?php |
| 3191 | - foreach($date_formats as $format){
|
|
| 3192 | - $selected = ''; |
|
| 3193 | - if(!empty($extra) && esc_attr($extra['date_format'])==$format){
|
|
| 3194 | - $selected = "selected='selected'"; |
|
| 3195 | - } |
|
| 3196 | - echo "<option $selected value='$format'>$format (".date_i18n( $format, time()).")</option>";
|
|
| 3197 | - } |
|
| 3198 | - ?> |
|
| 3191 | + foreach($date_formats as $format){
|
|
| 3192 | + $selected = ''; |
|
| 3193 | + if(!empty($extra) && esc_attr($extra['date_format'])==$format){
|
|
| 3194 | + $selected = "selected='selected'"; |
|
| 3195 | + } |
|
| 3196 | + echo "<option $selected value='$format'>$format (".date_i18n( $format, time()).")</option>";
|
|
| 3197 | + } |
|
| 3198 | + ?> |
|
| 3199 | 3199 | </select> |
| 3200 | 3200 | |
| 3201 | 3201 | </div> |
| 3202 | 3202 | </li> |
| 3203 | 3203 | <?php |
| 3204 | 3204 | |
| 3205 | - $html = ob_get_clean(); |
|
| 3206 | - return $output.$html; |
|
| 3205 | + $html = ob_get_clean(); |
|
| 3206 | + return $output.$html; |
|
| 3207 | 3207 | } |
| 3208 | 3208 | add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
|
| 3209 | 3209 | |
| 3210 | 3210 | |
| 3211 | 3211 | function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
|
| 3212 | - ob_start(); |
|
| 3213 | - $allowed_file_types = geodir_allowed_mime_types(); |
|
| 3212 | + ob_start(); |
|
| 3213 | + $allowed_file_types = geodir_allowed_mime_types(); |
|
| 3214 | 3214 | |
| 3215 | - $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
|
| 3216 | - $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
|
|
| 3217 | - ?> |
|
| 3215 | + $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
|
| 3216 | + $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
|
|
| 3217 | + ?> |
|
| 3218 | 3218 | <li> |
| 3219 | 3219 | <label for="gd_file_types" class="gd-cf-tooltip-wrap"> |
| 3220 | 3220 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
|
@@ -3237,33 +3237,33 @@ discard block |
||
| 3237 | 3237 | </li> |
| 3238 | 3238 | <?php |
| 3239 | 3239 | |
| 3240 | - $html = ob_get_clean(); |
|
| 3241 | - return $output.$html; |
|
| 3240 | + $html = ob_get_clean(); |
|
| 3241 | + return $output.$html; |
|
| 3242 | 3242 | } |
| 3243 | 3243 | add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
|
| 3244 | 3244 | |
| 3245 | 3245 | function geodir_cfa_extra_fields_text($output,$result_str,$cf,$field_info){
|
| 3246 | - ob_start(); |
|
| 3246 | + ob_start(); |
|
| 3247 | 3247 | |
| 3248 | - $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
|
| 3248 | + $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
|
| 3249 | 3249 | // print_r($cf);echo '###'; |
| 3250 | 3250 | |
| 3251 | 3251 | |
| 3252 | 3252 | |
| 3253 | - $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500); |
|
| 3253 | + $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500); |
|
| 3254 | 3254 | |
| 3255 | 3255 | |
| 3256 | - $value = ''; |
|
| 3257 | - if ($extra_fields && isset($extra_fields['is_price'])) {
|
|
| 3258 | - $value = esc_attr($extra_fields['is_price']); |
|
| 3259 | - }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
|
|
| 3260 | - $value = esc_attr($cf['defaults']['extra_fields']['is_price']); |
|
| 3261 | - } |
|
| 3256 | + $value = ''; |
|
| 3257 | + if ($extra_fields && isset($extra_fields['is_price'])) {
|
|
| 3258 | + $value = esc_attr($extra_fields['is_price']); |
|
| 3259 | + }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
|
|
| 3260 | + $value = esc_attr($cf['defaults']['extra_fields']['is_price']); |
|
| 3261 | + } |
|
| 3262 | 3262 | |
| 3263 | - $show_price_extra = ($value==1) ? 1 : 0; |
|
| 3263 | + $show_price_extra = ($value==1) ? 1 : 0; |
|
| 3264 | 3264 | |
| 3265 | - $show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0; |
|
| 3266 | - ?> |
|
| 3265 | + $show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0; |
|
| 3266 | + ?> |
|
| 3267 | 3267 | <li class="gdcf-price-extra-set" <?php if(!$show_price){ echo "style='display:none;'";}?>>
|
| 3268 | 3268 | <label for="is_price" class="gd-cf-tooltip-wrap"> |
| 3269 | 3269 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display as price? :', 'geodirectory'); ?>
|
@@ -3275,14 +3275,14 @@ discard block |
||
| 3275 | 3275 | |
| 3276 | 3276 | <input type="radio" id="is_price_yes<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-enabled" value="1" |
| 3277 | 3277 | <?php if ($value == '1') {
|
| 3278 | - echo 'checked'; |
|
| 3279 | - } ?>/> |
|
| 3278 | + echo 'checked'; |
|
| 3279 | + } ?>/> |
|
| 3280 | 3280 | <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 3281 | 3281 | |
| 3282 | 3282 | <input type="radio" id="is_price_no<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-disabled" value="0" |
| 3283 | 3283 | <?php if ($value == '0' || !$value) {
|
| 3284 | - echo 'checked'; |
|
| 3285 | - } ?>/> |
|
| 3284 | + echo 'checked'; |
|
| 3285 | + } ?>/> |
|
| 3286 | 3286 | <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 3287 | 3287 | |
| 3288 | 3288 | </div> |
@@ -3290,13 +3290,13 @@ discard block |
||
| 3290 | 3290 | |
| 3291 | 3291 | <?php |
| 3292 | 3292 | |
| 3293 | - $value = ''; |
|
| 3294 | - if ($extra_fields && isset($extra_fields['thousand_separator'])) {
|
|
| 3295 | - $value = esc_attr($extra_fields['thousand_separator']); |
|
| 3296 | - }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
|
|
| 3297 | - $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']); |
|
| 3298 | - } |
|
| 3299 | - ?> |
|
| 3293 | + $value = ''; |
|
| 3294 | + if ($extra_fields && isset($extra_fields['thousand_separator'])) {
|
|
| 3295 | + $value = esc_attr($extra_fields['thousand_separator']); |
|
| 3296 | + }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
|
|
| 3297 | + $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']); |
|
| 3298 | + } |
|
| 3299 | + ?> |
|
| 3300 | 3300 | <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
| 3301 | 3301 | <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory');?>
|
| 3302 | 3302 | <div class="gdcf-tooltip"> |
@@ -3317,13 +3317,13 @@ discard block |
||
| 3317 | 3317 | |
| 3318 | 3318 | <?php |
| 3319 | 3319 | |
| 3320 | - $value = ''; |
|
| 3321 | - if ($extra_fields && isset($extra_fields['decimal_separator'])) {
|
|
| 3322 | - $value = esc_attr($extra_fields['decimal_separator']); |
|
| 3323 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
|
|
| 3324 | - $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']); |
|
| 3325 | - } |
|
| 3326 | - ?> |
|
| 3320 | + $value = ''; |
|
| 3321 | + if ($extra_fields && isset($extra_fields['decimal_separator'])) {
|
|
| 3322 | + $value = esc_attr($extra_fields['decimal_separator']); |
|
| 3323 | + }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
|
|
| 3324 | + $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']); |
|
| 3325 | + } |
|
| 3326 | + ?> |
|
| 3327 | 3327 | <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
| 3328 | 3328 | <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory');?>
|
| 3329 | 3329 | <div class="gdcf-tooltip"> |
@@ -3340,13 +3340,13 @@ discard block |
||
| 3340 | 3340 | |
| 3341 | 3341 | <?php |
| 3342 | 3342 | |
| 3343 | - $value = ''; |
|
| 3344 | - if ($extra_fields && isset($extra_fields['decimal_display'])) {
|
|
| 3345 | - $value = esc_attr($extra_fields['decimal_display']); |
|
| 3346 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
|
|
| 3347 | - $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']); |
|
| 3348 | - } |
|
| 3349 | - ?> |
|
| 3343 | + $value = ''; |
|
| 3344 | + if ($extra_fields && isset($extra_fields['decimal_display'])) {
|
|
| 3345 | + $value = esc_attr($extra_fields['decimal_display']); |
|
| 3346 | + }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
|
|
| 3347 | + $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']); |
|
| 3348 | + } |
|
| 3349 | + ?> |
|
| 3350 | 3350 | <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
| 3351 | 3351 | <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory');?>
|
| 3352 | 3352 | <div class="gdcf-tooltip"> |
@@ -3363,13 +3363,13 @@ discard block |
||
| 3363 | 3363 | |
| 3364 | 3364 | <?php |
| 3365 | 3365 | |
| 3366 | - $value = ''; |
|
| 3367 | - if ($extra_fields && isset($extra_fields['currency_symbol'])) {
|
|
| 3368 | - $value = esc_attr($extra_fields['currency_symbol']); |
|
| 3369 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
|
|
| 3370 | - $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']); |
|
| 3371 | - } |
|
| 3372 | - ?> |
|
| 3366 | + $value = ''; |
|
| 3367 | + if ($extra_fields && isset($extra_fields['currency_symbol'])) {
|
|
| 3368 | + $value = esc_attr($extra_fields['currency_symbol']); |
|
| 3369 | + }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
|
|
| 3370 | + $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']); |
|
| 3371 | + } |
|
| 3372 | + ?> |
|
| 3373 | 3373 | <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
| 3374 | 3374 | <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory');?>
|
| 3375 | 3375 | <div class="gdcf-tooltip"> |
@@ -3384,13 +3384,13 @@ discard block |
||
| 3384 | 3384 | |
| 3385 | 3385 | <?php |
| 3386 | 3386 | |
| 3387 | - $value = ''; |
|
| 3388 | - if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
|
|
| 3389 | - $value = esc_attr($extra_fields['currency_symbol_placement']); |
|
| 3390 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
|
|
| 3391 | - $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']); |
|
| 3392 | - } |
|
| 3393 | - ?> |
|
| 3387 | + $value = ''; |
|
| 3388 | + if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
|
|
| 3389 | + $value = esc_attr($extra_fields['currency_symbol_placement']); |
|
| 3390 | + }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
|
|
| 3391 | + $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']); |
|
| 3392 | + } |
|
| 3393 | + ?> |
|
| 3394 | 3394 | <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
| 3395 | 3395 | <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory');?>
|
| 3396 | 3396 | <div class="gdcf-tooltip"> |
@@ -3408,225 +3408,225 @@ discard block |
||
| 3408 | 3408 | |
| 3409 | 3409 | <?php |
| 3410 | 3410 | |
| 3411 | - $html = ob_get_clean(); |
|
| 3412 | - return $output.$html; |
|
| 3411 | + $html = ob_get_clean(); |
|
| 3412 | + return $output.$html; |
|
| 3413 | 3413 | } |
| 3414 | 3414 | add_filter('geodir_cfa_extra_fields_text','geodir_cfa_extra_fields_text',10,4);
|
| 3415 | 3415 | |
| 3416 | 3416 | function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
|
| 3417 | - $fields = array(); |
|
| 3418 | - $package = ($package_id=='') ? '' : array($package_id); |
|
| 3419 | - |
|
| 3420 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3421 | - 'data_type' => 'VARCHAR', |
|
| 3422 | - 'field_type' => 'taxonomy', |
|
| 3423 | - 'admin_title' => __('Category', 'geodirectory'),
|
|
| 3424 | - 'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
|
|
| 3425 | - 'site_title' => __('Category', 'geodirectory'),
|
|
| 3426 | - 'htmlvar_name' => $post_type.'category', |
|
| 3427 | - 'default_value' => '', |
|
| 3428 | - 'is_default' => '1', |
|
| 3429 | - 'is_admin' => '1', |
|
| 3430 | - 'is_required' => '1', |
|
| 3431 | - 'show_in' => '[detail]', |
|
| 3432 | - 'show_on_pkg' => $package, |
|
| 3433 | - 'clabels' => __('Category', 'geodirectory'));
|
|
| 3434 | - |
|
| 3435 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3436 | - 'data_type' => 'VARCHAR', |
|
| 3437 | - 'field_type' => 'address', |
|
| 3438 | - 'admin_title' => __('Address', 'geodirectory'),
|
|
| 3439 | - 'admin_desc' => ADDRESS_MSG, |
|
| 3440 | - 'site_title' => __('Address', 'geodirectory'),
|
|
| 3441 | - 'htmlvar_name' => 'post', |
|
| 3442 | - 'default_value' => '', |
|
| 3443 | - 'option_values' => '', |
|
| 3444 | - 'is_default' => '1', |
|
| 3445 | - 'is_admin' => '1', |
|
| 3446 | - 'is_required' => '1', |
|
| 3447 | - 'show_in' => '[detail],[mapbubble]', |
|
| 3448 | - 'show_on_pkg' => $package, |
|
| 3449 | - 'required_msg' => __('Address fields are required', 'geodirectory'),
|
|
| 3450 | - 'clabels' => __('Address', 'geodirectory'),
|
|
| 3451 | - 'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
|
|
| 3452 | - 'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
|
|
| 3453 | - 'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
|
|
| 3454 | - 'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
|
|
| 3455 | - 'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
|
|
| 3456 | - 'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
|
|
| 3457 | - 'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden', |
|
| 3458 | - 'show_latlng' => 1)); |
|
| 3459 | - |
|
| 3460 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3461 | - 'data_type' => 'VARCHAR', |
|
| 3462 | - 'field_type' => 'text', |
|
| 3463 | - 'admin_title' => __('Time', 'geodirectory'),
|
|
| 3464 | - 'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
|
|
| 3465 | - 'site_title' => __('Time', 'geodirectory'),
|
|
| 3466 | - 'htmlvar_name' => 'timing', |
|
| 3467 | - 'default_value' => '', |
|
| 3468 | - 'option_values' => '', |
|
| 3469 | - 'is_default' => '1', |
|
| 3470 | - 'is_admin' => '1', |
|
| 3471 | - 'show_in' => '[detail],[mapbubble]', |
|
| 3472 | - 'show_on_pkg' => $package, |
|
| 3473 | - 'clabels' => __('Time', 'geodirectory'));
|
|
| 3474 | - |
|
| 3475 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3476 | - 'data_type' => 'VARCHAR', |
|
| 3477 | - 'field_type' => 'phone', |
|
| 3478 | - 'admin_title' => __('Phone', 'geodirectory'),
|
|
| 3479 | - 'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
|
|
| 3480 | - 'site_title' => __('Phone', 'geodirectory'),
|
|
| 3481 | - 'htmlvar_name' => 'contact', |
|
| 3482 | - 'default_value' => '', |
|
| 3483 | - 'option_values' => '', |
|
| 3484 | - 'is_default' => '1', |
|
| 3485 | - 'is_admin' => '1', |
|
| 3486 | - 'show_in' => '[detail],[mapbubble]', |
|
| 3487 | - 'show_on_pkg' => $package, |
|
| 3488 | - 'clabels' => __('Phone', 'geodirectory'));
|
|
| 3489 | - |
|
| 3490 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3491 | - 'data_type' => 'VARCHAR', |
|
| 3492 | - 'field_type' => 'email', |
|
| 3493 | - 'admin_title' => __('Email', 'geodirectory'),
|
|
| 3494 | - 'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
|
|
| 3495 | - 'site_title' => __('Email', 'geodirectory'),
|
|
| 3496 | - 'htmlvar_name' => 'email', |
|
| 3497 | - 'default_value' => '', |
|
| 3498 | - 'option_values' => '', |
|
| 3499 | - 'is_default' => '1', |
|
| 3500 | - 'is_admin' => '1', |
|
| 3501 | - 'show_in' => '[detail]', |
|
| 3502 | - 'show_on_pkg' => $package, |
|
| 3503 | - 'clabels' => __('Email', 'geodirectory'));
|
|
| 3504 | - |
|
| 3505 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3506 | - 'data_type' => 'VARCHAR', |
|
| 3507 | - 'field_type' => 'url', |
|
| 3508 | - 'admin_title' => __('Website', 'geodirectory'),
|
|
| 3509 | - 'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
|
|
| 3510 | - 'site_title' => __('Website', 'geodirectory'),
|
|
| 3511 | - 'htmlvar_name' => 'website', |
|
| 3512 | - 'default_value' => '', |
|
| 3513 | - 'option_values' => '', |
|
| 3514 | - 'is_default' => '1', |
|
| 3515 | - 'is_admin' => '1', |
|
| 3516 | - 'show_in' => '[detail]', |
|
| 3517 | - 'show_on_pkg' => $package, |
|
| 3518 | - 'clabels' => __('Website', 'geodirectory'));
|
|
| 3519 | - |
|
| 3520 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3521 | - 'data_type' => 'VARCHAR', |
|
| 3522 | - 'field_type' => 'url', |
|
| 3523 | - 'admin_title' => __('Twitter', 'geodirectory'),
|
|
| 3524 | - 'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
|
|
| 3525 | - 'site_title' => __('Twitter', 'geodirectory'),
|
|
| 3526 | - 'htmlvar_name' => 'twitter', |
|
| 3527 | - 'default_value' => '', |
|
| 3528 | - 'option_values' => '', |
|
| 3529 | - 'is_default' => '1', |
|
| 3530 | - 'is_admin' => '1', |
|
| 3531 | - 'show_in' => '[detail]', |
|
| 3532 | - 'show_on_pkg' => $package, |
|
| 3533 | - 'clabels' => __('Twitter', 'geodirectory'));
|
|
| 3534 | - |
|
| 3535 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3536 | - 'data_type' => 'VARCHAR', |
|
| 3537 | - 'field_type' => 'url', |
|
| 3538 | - 'admin_title' => __('Facebook', 'geodirectory'),
|
|
| 3539 | - 'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
|
|
| 3540 | - 'site_title' => __('Facebook', 'geodirectory'),
|
|
| 3541 | - 'htmlvar_name' => 'facebook', |
|
| 3542 | - 'default_value' => '', |
|
| 3543 | - 'option_values' => '', |
|
| 3544 | - 'is_default' => '1', |
|
| 3545 | - 'is_admin' => '1', |
|
| 3546 | - 'show_in' => '[detail]', |
|
| 3547 | - 'show_on_pkg' => $package, |
|
| 3548 | - 'clabels' => __('Facebook', 'geodirectory'));
|
|
| 3549 | - |
|
| 3550 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3551 | - 'data_type' => 'TEXT', |
|
| 3552 | - 'field_type' => 'textarea', |
|
| 3553 | - 'admin_title' => __('Video', 'geodirectory'),
|
|
| 3554 | - 'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
|
|
| 3555 | - 'site_title' => __('Video', 'geodirectory'),
|
|
| 3556 | - 'htmlvar_name' => 'video', |
|
| 3557 | - 'default_value' => '', |
|
| 3558 | - 'option_values' => '', |
|
| 3559 | - 'is_default' => '0', |
|
| 3560 | - 'is_admin' => '1', |
|
| 3561 | - 'show_in' => '[owntab]', |
|
| 3562 | - 'show_on_pkg' => $package, |
|
| 3563 | - 'clabels' => __('Video', 'geodirectory'));
|
|
| 3564 | - |
|
| 3565 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3566 | - 'data_type' => 'TEXT', |
|
| 3567 | - 'field_type' => 'textarea', |
|
| 3568 | - 'admin_title' => __('Special Offers', 'geodirectory'),
|
|
| 3569 | - 'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
|
|
| 3570 | - 'site_title' => __('Special Offers', 'geodirectory'),
|
|
| 3571 | - 'htmlvar_name' => 'special_offers', |
|
| 3572 | - 'default_value' => '', |
|
| 3573 | - 'option_values' => '', |
|
| 3574 | - 'is_default' => '0', |
|
| 3575 | - 'is_admin' => '1', |
|
| 3576 | - 'show_in' => '[owntab]', |
|
| 3577 | - 'show_on_pkg' => $package, |
|
| 3578 | - 'clabels' => __('Special Offers', 'geodirectory'));
|
|
| 3579 | - |
|
| 3580 | - /** |
|
| 3581 | - * Filter the array of default custom fields DB table data. |
|
| 3582 | - * |
|
| 3583 | - * @since 1.6.6 |
|
| 3584 | - * @param string $fields The default custom fields as an array. |
|
| 3585 | - */ |
|
| 3586 | - $fields = apply_filters('geodir_default_custom_fields', $fields);
|
|
| 3587 | - |
|
| 3588 | - return $fields; |
|
| 3417 | + $fields = array(); |
|
| 3418 | + $package = ($package_id=='') ? '' : array($package_id); |
|
| 3419 | + |
|
| 3420 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3421 | + 'data_type' => 'VARCHAR', |
|
| 3422 | + 'field_type' => 'taxonomy', |
|
| 3423 | + 'admin_title' => __('Category', 'geodirectory'),
|
|
| 3424 | + 'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
|
|
| 3425 | + 'site_title' => __('Category', 'geodirectory'),
|
|
| 3426 | + 'htmlvar_name' => $post_type.'category', |
|
| 3427 | + 'default_value' => '', |
|
| 3428 | + 'is_default' => '1', |
|
| 3429 | + 'is_admin' => '1', |
|
| 3430 | + 'is_required' => '1', |
|
| 3431 | + 'show_in' => '[detail]', |
|
| 3432 | + 'show_on_pkg' => $package, |
|
| 3433 | + 'clabels' => __('Category', 'geodirectory'));
|
|
| 3434 | + |
|
| 3435 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3436 | + 'data_type' => 'VARCHAR', |
|
| 3437 | + 'field_type' => 'address', |
|
| 3438 | + 'admin_title' => __('Address', 'geodirectory'),
|
|
| 3439 | + 'admin_desc' => ADDRESS_MSG, |
|
| 3440 | + 'site_title' => __('Address', 'geodirectory'),
|
|
| 3441 | + 'htmlvar_name' => 'post', |
|
| 3442 | + 'default_value' => '', |
|
| 3443 | + 'option_values' => '', |
|
| 3444 | + 'is_default' => '1', |
|
| 3445 | + 'is_admin' => '1', |
|
| 3446 | + 'is_required' => '1', |
|
| 3447 | + 'show_in' => '[detail],[mapbubble]', |
|
| 3448 | + 'show_on_pkg' => $package, |
|
| 3449 | + 'required_msg' => __('Address fields are required', 'geodirectory'),
|
|
| 3450 | + 'clabels' => __('Address', 'geodirectory'),
|
|
| 3451 | + 'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
|
|
| 3452 | + 'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
|
|
| 3453 | + 'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
|
|
| 3454 | + 'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
|
|
| 3455 | + 'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
|
|
| 3456 | + 'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
|
|
| 3457 | + 'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden', |
|
| 3458 | + 'show_latlng' => 1)); |
|
| 3459 | + |
|
| 3460 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3461 | + 'data_type' => 'VARCHAR', |
|
| 3462 | + 'field_type' => 'text', |
|
| 3463 | + 'admin_title' => __('Time', 'geodirectory'),
|
|
| 3464 | + 'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
|
|
| 3465 | + 'site_title' => __('Time', 'geodirectory'),
|
|
| 3466 | + 'htmlvar_name' => 'timing', |
|
| 3467 | + 'default_value' => '', |
|
| 3468 | + 'option_values' => '', |
|
| 3469 | + 'is_default' => '1', |
|
| 3470 | + 'is_admin' => '1', |
|
| 3471 | + 'show_in' => '[detail],[mapbubble]', |
|
| 3472 | + 'show_on_pkg' => $package, |
|
| 3473 | + 'clabels' => __('Time', 'geodirectory'));
|
|
| 3474 | + |
|
| 3475 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3476 | + 'data_type' => 'VARCHAR', |
|
| 3477 | + 'field_type' => 'phone', |
|
| 3478 | + 'admin_title' => __('Phone', 'geodirectory'),
|
|
| 3479 | + 'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
|
|
| 3480 | + 'site_title' => __('Phone', 'geodirectory'),
|
|
| 3481 | + 'htmlvar_name' => 'contact', |
|
| 3482 | + 'default_value' => '', |
|
| 3483 | + 'option_values' => '', |
|
| 3484 | + 'is_default' => '1', |
|
| 3485 | + 'is_admin' => '1', |
|
| 3486 | + 'show_in' => '[detail],[mapbubble]', |
|
| 3487 | + 'show_on_pkg' => $package, |
|
| 3488 | + 'clabels' => __('Phone', 'geodirectory'));
|
|
| 3489 | + |
|
| 3490 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3491 | + 'data_type' => 'VARCHAR', |
|
| 3492 | + 'field_type' => 'email', |
|
| 3493 | + 'admin_title' => __('Email', 'geodirectory'),
|
|
| 3494 | + 'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
|
|
| 3495 | + 'site_title' => __('Email', 'geodirectory'),
|
|
| 3496 | + 'htmlvar_name' => 'email', |
|
| 3497 | + 'default_value' => '', |
|
| 3498 | + 'option_values' => '', |
|
| 3499 | + 'is_default' => '1', |
|
| 3500 | + 'is_admin' => '1', |
|
| 3501 | + 'show_in' => '[detail]', |
|
| 3502 | + 'show_on_pkg' => $package, |
|
| 3503 | + 'clabels' => __('Email', 'geodirectory'));
|
|
| 3504 | + |
|
| 3505 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3506 | + 'data_type' => 'VARCHAR', |
|
| 3507 | + 'field_type' => 'url', |
|
| 3508 | + 'admin_title' => __('Website', 'geodirectory'),
|
|
| 3509 | + 'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
|
|
| 3510 | + 'site_title' => __('Website', 'geodirectory'),
|
|
| 3511 | + 'htmlvar_name' => 'website', |
|
| 3512 | + 'default_value' => '', |
|
| 3513 | + 'option_values' => '', |
|
| 3514 | + 'is_default' => '1', |
|
| 3515 | + 'is_admin' => '1', |
|
| 3516 | + 'show_in' => '[detail]', |
|
| 3517 | + 'show_on_pkg' => $package, |
|
| 3518 | + 'clabels' => __('Website', 'geodirectory'));
|
|
| 3519 | + |
|
| 3520 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3521 | + 'data_type' => 'VARCHAR', |
|
| 3522 | + 'field_type' => 'url', |
|
| 3523 | + 'admin_title' => __('Twitter', 'geodirectory'),
|
|
| 3524 | + 'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
|
|
| 3525 | + 'site_title' => __('Twitter', 'geodirectory'),
|
|
| 3526 | + 'htmlvar_name' => 'twitter', |
|
| 3527 | + 'default_value' => '', |
|
| 3528 | + 'option_values' => '', |
|
| 3529 | + 'is_default' => '1', |
|
| 3530 | + 'is_admin' => '1', |
|
| 3531 | + 'show_in' => '[detail]', |
|
| 3532 | + 'show_on_pkg' => $package, |
|
| 3533 | + 'clabels' => __('Twitter', 'geodirectory'));
|
|
| 3534 | + |
|
| 3535 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3536 | + 'data_type' => 'VARCHAR', |
|
| 3537 | + 'field_type' => 'url', |
|
| 3538 | + 'admin_title' => __('Facebook', 'geodirectory'),
|
|
| 3539 | + 'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
|
|
| 3540 | + 'site_title' => __('Facebook', 'geodirectory'),
|
|
| 3541 | + 'htmlvar_name' => 'facebook', |
|
| 3542 | + 'default_value' => '', |
|
| 3543 | + 'option_values' => '', |
|
| 3544 | + 'is_default' => '1', |
|
| 3545 | + 'is_admin' => '1', |
|
| 3546 | + 'show_in' => '[detail]', |
|
| 3547 | + 'show_on_pkg' => $package, |
|
| 3548 | + 'clabels' => __('Facebook', 'geodirectory'));
|
|
| 3549 | + |
|
| 3550 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3551 | + 'data_type' => 'TEXT', |
|
| 3552 | + 'field_type' => 'textarea', |
|
| 3553 | + 'admin_title' => __('Video', 'geodirectory'),
|
|
| 3554 | + 'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
|
|
| 3555 | + 'site_title' => __('Video', 'geodirectory'),
|
|
| 3556 | + 'htmlvar_name' => 'video', |
|
| 3557 | + 'default_value' => '', |
|
| 3558 | + 'option_values' => '', |
|
| 3559 | + 'is_default' => '0', |
|
| 3560 | + 'is_admin' => '1', |
|
| 3561 | + 'show_in' => '[owntab]', |
|
| 3562 | + 'show_on_pkg' => $package, |
|
| 3563 | + 'clabels' => __('Video', 'geodirectory'));
|
|
| 3564 | + |
|
| 3565 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3566 | + 'data_type' => 'TEXT', |
|
| 3567 | + 'field_type' => 'textarea', |
|
| 3568 | + 'admin_title' => __('Special Offers', 'geodirectory'),
|
|
| 3569 | + 'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
|
|
| 3570 | + 'site_title' => __('Special Offers', 'geodirectory'),
|
|
| 3571 | + 'htmlvar_name' => 'special_offers', |
|
| 3572 | + 'default_value' => '', |
|
| 3573 | + 'option_values' => '', |
|
| 3574 | + 'is_default' => '0', |
|
| 3575 | + 'is_admin' => '1', |
|
| 3576 | + 'show_in' => '[owntab]', |
|
| 3577 | + 'show_on_pkg' => $package, |
|
| 3578 | + 'clabels' => __('Special Offers', 'geodirectory'));
|
|
| 3579 | + |
|
| 3580 | + /** |
|
| 3581 | + * Filter the array of default custom fields DB table data. |
|
| 3582 | + * |
|
| 3583 | + * @since 1.6.6 |
|
| 3584 | + * @param string $fields The default custom fields as an array. |
|
| 3585 | + */ |
|
| 3586 | + $fields = apply_filters('geodir_default_custom_fields', $fields);
|
|
| 3587 | + |
|
| 3588 | + return $fields; |
|
| 3589 | 3589 | } |
| 3590 | 3590 | |
| 3591 | 3591 | function geodir_currency_format_number($number='',$cf=''){
|
| 3592 | 3592 | |
| 3593 | - $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : ''; |
|
| 3593 | + $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : ''; |
|
| 3594 | 3594 | |
| 3595 | - $symbol = isset($cs['currency_symbol']) ? $cs['currency_symbol'] : '$'; |
|
| 3596 | - $decimals = isset($cf['decimal_point']) && $cf['decimal_point'] ? $cf['decimal_point'] : 2; |
|
| 3597 | - $decimal_display = !empty($cf['decimal_display']) ? $cf['decimal_display'] : (!empty($cs['decimal_display']) ? $cs['decimal_display'] : 'if'); |
|
| 3598 | - $decimalpoint = '.'; |
|
| 3595 | + $symbol = isset($cs['currency_symbol']) ? $cs['currency_symbol'] : '$'; |
|
| 3596 | + $decimals = isset($cf['decimal_point']) && $cf['decimal_point'] ? $cf['decimal_point'] : 2; |
|
| 3597 | + $decimal_display = !empty($cf['decimal_display']) ? $cf['decimal_display'] : (!empty($cs['decimal_display']) ? $cs['decimal_display'] : 'if'); |
|
| 3598 | + $decimalpoint = '.'; |
|
| 3599 | 3599 | |
| 3600 | - if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
|
|
| 3601 | - $decimalpoint = ','; |
|
| 3602 | - } |
|
| 3600 | + if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
|
|
| 3601 | + $decimalpoint = ','; |
|
| 3602 | + } |
|
| 3603 | 3603 | |
| 3604 | - $separator = ','; |
|
| 3604 | + $separator = ','; |
|
| 3605 | 3605 | |
| 3606 | - if(isset($cs['thousand_separator'])){
|
|
| 3607 | - if($cs['thousand_separator']=='comma'){$separator = ',';}
|
|
| 3608 | - if($cs['thousand_separator']=='slash'){$separator = '\\';}
|
|
| 3609 | - if($cs['thousand_separator']=='period'){$separator = '.';}
|
|
| 3610 | - if($cs['thousand_separator']=='space'){$separator = ' ';}
|
|
| 3611 | - if($cs['thousand_separator']=='none'){$separator = '';}
|
|
| 3612 | - } |
|
| 3606 | + if(isset($cs['thousand_separator'])){
|
|
| 3607 | + if($cs['thousand_separator']=='comma'){$separator = ',';}
|
|
| 3608 | + if($cs['thousand_separator']=='slash'){$separator = '\\';}
|
|
| 3609 | + if($cs['thousand_separator']=='period'){$separator = '.';}
|
|
| 3610 | + if($cs['thousand_separator']=='space'){$separator = ' ';}
|
|
| 3611 | + if($cs['thousand_separator']=='none'){$separator = '';}
|
|
| 3612 | + } |
|
| 3613 | 3613 | |
| 3614 | - $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left'; |
|
| 3614 | + $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left'; |
|
| 3615 | 3615 | |
| 3616 | - if($decimals>0 && $decimal_display=='if'){
|
|
| 3617 | - if(is_int($number) || floor( $number ) == $number) |
|
| 3618 | - $decimals = 0; |
|
| 3619 | - } |
|
| 3616 | + if($decimals>0 && $decimal_display=='if'){
|
|
| 3617 | + if(is_int($number) || floor( $number ) == $number) |
|
| 3618 | + $decimals = 0; |
|
| 3619 | + } |
|
| 3620 | 3620 | |
| 3621 | - $number = number_format($number,$decimals,$decimalpoint,$separator); |
|
| 3621 | + $number = number_format($number,$decimals,$decimalpoint,$separator); |
|
| 3622 | 3622 | |
| 3623 | 3623 | |
| 3624 | 3624 | |
| 3625 | - if($currency_symbol_placement=='left'){
|
|
| 3626 | - $number = $symbol . $number; |
|
| 3627 | - }else{
|
|
| 3628 | - $number = $number . $symbol; |
|
| 3629 | - } |
|
| 3625 | + if($currency_symbol_placement=='left'){
|
|
| 3626 | + $number = $symbol . $number; |
|
| 3627 | + }else{
|
|
| 3628 | + $number = $number . $symbol; |
|
| 3629 | + } |
|
| 3630 | 3630 | |
| 3631 | 3631 | |
| 3632 | 3632 | return $number; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL") |
| 50 | 50 | {
|
| 51 | 51 | global $wpdb; |
| 52 | - $result = 0;// no rows affected |
|
| 52 | + $result = 0; // no rows affected |
|
| 53 | 53 | if (!geodir_column_exist($db, $column)) {
|
| 54 | 54 | if (!empty($db) && !empty($column)) |
| 55 | 55 | $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr");
|
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | {
|
| 75 | 75 | global $wpdb, $geodir_post_custom_fields_cache; |
| 76 | 76 | |
| 77 | - $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location; |
|
| 77 | + $cache_stored = $post_type.'_'.$package_id.'_'.$default.'_'.$fields_location; |
|
| 78 | 78 | |
| 79 | 79 | if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
|
| 80 | 80 | return $geodir_post_custom_fields_cache[$cache_stored]; |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | $default_query .= " and is_admin = '0' "; |
| 89 | 89 | |
| 90 | 90 | if ($fields_location == 'none') {
|
| 91 | - } else{
|
|
| 92 | - $fields_location = esc_sql( $fields_location ); |
|
| 91 | + } else {
|
|
| 92 | + $fields_location = esc_sql($fields_location); |
|
| 93 | 93 | $default_query .= " and show_in LIKE '%%[$fields_location]%%' "; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $post_meta_info = $wpdb->get_results( |
| 97 | 97 | $wpdb->prepare( |
| 98 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
|
|
| 98 | + "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
|
|
| 99 | 99 | array($post_type) |
| 100 | 100 | ) |
| 101 | 101 | ); |
@@ -162,13 +162,13 @@ discard block |
||
| 162 | 162 | * @param string $field_ins_upd When set to "submit" displays form. |
| 163 | 163 | * @param string $field_type_key The key of the custom field. |
| 164 | 164 | */ |
| 165 | - function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='') |
|
| 165 | + function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '') |
|
| 166 | 166 | {
|
| 167 | 167 | global $wpdb; |
| 168 | 168 | $cf = $result_str; |
| 169 | 169 | if (!is_object($cf)) {
|
| 170 | 170 | |
| 171 | - $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
|
|
| 171 | + $field_info = $wpdb->get_row($wpdb->prepare("select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)));
|
|
| 172 | 172 | |
| 173 | 173 | } else {
|
| 174 | 174 | $field_info = $cf; |
@@ -202,14 +202,14 @@ discard block |
||
| 202 | 202 | if ($field_id != '') {
|
| 203 | 203 | $cf = trim($field_id, '_'); |
| 204 | 204 | |
| 205 | - if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
|
|
| 206 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 205 | + if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)))) {
|
|
| 206 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d ", array($cf)));
|
|
| 207 | 207 | |
| 208 | 208 | $post_type = $field->post_type; |
| 209 | 209 | $htmlvar_name = $field->htmlvar_name; |
| 210 | 210 | |
| 211 | 211 | if ($post_type != '' && $htmlvar_name != '') {
|
| 212 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
|
|
| 212 | + $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
|
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -223,18 +223,18 @@ discard block |
||
| 223 | 223 | do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
|
| 224 | 224 | |
| 225 | 225 | if ($field->field_type == 'address') {
|
| 226 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
|
|
| 227 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
|
|
| 228 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
|
|
| 229 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
|
|
| 230 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
|
|
| 231 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
|
|
| 232 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
|
|
| 233 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
|
|
| 234 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
|
|
| 226 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_address`");
|
|
| 227 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_city`");
|
|
| 228 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_region`");
|
|
| 229 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_country`");
|
|
| 230 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_zip`");
|
|
| 231 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_latitude`");
|
|
| 232 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_longitude`");
|
|
| 233 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapview`");
|
|
| 234 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapzoom`");
|
|
| 235 | 235 | } else {
|
| 236 | 236 | if ($field->field_type != 'fieldset') {
|
| 237 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
|
|
| 237 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."`");
|
|
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
| 306 | 306 | |
| 307 | 307 | // some servers fail if a POST value is VARCHAR so we change it. |
| 308 | - if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
|
|
| 308 | + if (isset($request_field['data_type']) && $request_field['data_type'] == 'XVARCHAR') {
|
|
| 309 | 309 | $request_field['data_type'] = 'VARCHAR'; |
| 310 | 310 | } |
| 311 | 311 | |
@@ -318,12 +318,12 @@ discard block |
||
| 318 | 318 | $post_type = $request_field['listing_type']; |
| 319 | 319 | |
| 320 | 320 | if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
|
| 321 | - $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name; |
|
| 321 | + $cehhtmlvar_name = 'geodir_'.$cehhtmlvar_name; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | $check_html_variable = $wpdb->get_var( |
| 325 | 325 | $wpdb->prepare( |
| 326 | - "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 326 | + "select htmlvar_name from ".GEODIR_CUSTOM_FIELDS_TABLE." where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 327 | 327 | array($cf, $cehhtmlvar_name, $post_type) |
| 328 | 328 | ) |
| 329 | 329 | ); |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | $post_meta_info = $wpdb->get_row( |
| 337 | 337 | $wpdb->prepare( |
| 338 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d", |
|
| 338 | + "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id = %d", |
|
| 339 | 339 | array($cf) |
| 340 | 340 | ) |
| 341 | 341 | ); |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | if ($post_type == '') $post_type = 'gd_place'; |
| 354 | 354 | |
| 355 | 355 | |
| 356 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
| 356 | + $detail_table = $plugin_prefix.$post_type.'_detail'; |
|
| 357 | 357 | |
| 358 | 358 | $admin_title = $request_field['admin_title']; |
| 359 | 359 | $site_title = $request_field['site_title']; |
@@ -381,12 +381,12 @@ discard block |
||
| 381 | 381 | $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : ''; |
| 382 | 382 | |
| 383 | 383 | |
| 384 | - if(is_array($show_in)){
|
|
| 384 | + if (is_array($show_in)) {
|
|
| 385 | 385 | $show_in = implode(",", $request_field['show_in']);
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
|
| 389 | - $htmlvar_name = 'geodir_' . $htmlvar_name; |
|
| 389 | + $htmlvar_name = 'geodir_'.$htmlvar_name; |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | $option_values = ''; |
@@ -427,9 +427,9 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | if ($sort_order == '') {
|
| 429 | 429 | |
| 430 | - $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 430 | + $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM ".GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 431 | 431 | |
| 432 | - $sort_order = (int)$last_order + 1; |
|
| 432 | + $sort_order = (int) $last_order + 1; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | $default_value_add = ''; |
@@ -441,15 +441,15 @@ discard block |
||
| 441 | 441 | case 'address': |
| 442 | 442 | |
| 443 | 443 | if ($htmlvar_name != '') {
|
| 444 | - $prefix = $htmlvar_name . '_'; |
|
| 444 | + $prefix = $htmlvar_name.'_'; |
|
| 445 | 445 | } |
| 446 | - $old_prefix = $old_html_variable . '_'; |
|
| 446 | + $old_prefix = $old_html_variable.'_'; |
|
| 447 | 447 | |
| 448 | 448 | |
| 449 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL"; |
|
| 449 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."address` `".$prefix."address` VARCHAR( 254 ) NULL"; |
|
| 450 | 450 | |
| 451 | 451 | if ($default_value != '') {
|
| 452 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 452 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | $wpdb->query($meta_field_add); |
@@ -458,12 +458,12 @@ discard block |
||
| 458 | 458 | |
| 459 | 459 | if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
| 460 | 460 | |
| 461 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
|
|
| 461 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."city'");
|
|
| 462 | 462 | if ($is_column) {
|
| 463 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL"; |
|
| 463 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."city` `".$prefix."city` VARCHAR( 50 ) NULL"; |
|
| 464 | 464 | |
| 465 | 465 | if ($default_value != '') {
|
| 466 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 466 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | $wpdb->query($meta_field_add); |
@@ -471,9 +471,9 @@ discard block |
||
| 471 | 471 | |
| 472 | 472 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 473 | 473 | if ($default_value != '') {
|
| 474 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 474 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 475 | 475 | } |
| 476 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 476 | + geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add); |
|
| 477 | 477 | |
| 478 | 478 | } |
| 479 | 479 | |
@@ -483,36 +483,36 @@ discard block |
||
| 483 | 483 | |
| 484 | 484 | if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
| 485 | 485 | |
| 486 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
|
|
| 486 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."region'");
|
|
| 487 | 487 | |
| 488 | 488 | if ($is_column) {
|
| 489 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL"; |
|
| 489 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."region` `".$prefix."region` VARCHAR( 50 ) NULL"; |
|
| 490 | 490 | |
| 491 | 491 | if ($default_value != '') {
|
| 492 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 492 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | $wpdb->query($meta_field_add); |
| 496 | 496 | } else {
|
| 497 | 497 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 498 | 498 | if ($default_value != '') {
|
| 499 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 499 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 502 | + geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | } |
| 506 | 506 | if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
| 507 | 507 | |
| 508 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
|
|
| 508 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."country'");
|
|
| 509 | 509 | |
| 510 | 510 | if ($is_column) {
|
| 511 | 511 | |
| 512 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL"; |
|
| 512 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."country` `".$prefix."country` VARCHAR( 50 ) NULL"; |
|
| 513 | 513 | |
| 514 | 514 | if ($default_value != '') {
|
| 515 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 515 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | $wpdb->query($meta_field_add); |
@@ -520,24 +520,24 @@ discard block |
||
| 520 | 520 | |
| 521 | 521 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 522 | 522 | if ($default_value != '') {
|
| 523 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 523 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 526 | + geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add); |
|
| 527 | 527 | |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | } |
| 531 | 531 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
| 532 | 532 | |
| 533 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
|
|
| 533 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."zip'");
|
|
| 534 | 534 | |
| 535 | 535 | if ($is_column) {
|
| 536 | 536 | |
| 537 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL"; |
|
| 537 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."zip` `".$prefix."zip` VARCHAR( 50 ) NULL"; |
|
| 538 | 538 | |
| 539 | 539 | if ($default_value != '') {
|
| 540 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 540 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | $wpdb->query($meta_field_add); |
@@ -545,128 +545,128 @@ discard block |
||
| 545 | 545 | |
| 546 | 546 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 547 | 547 | if ($default_value != '') {
|
| 548 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 548 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 551 | + geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add); |
|
| 552 | 552 | |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | } |
| 556 | 556 | if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
| 557 | 557 | |
| 558 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
|
|
| 558 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latitude'");
|
|
| 559 | 559 | if ($is_column) {
|
| 560 | 560 | |
| 561 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 561 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latitude` `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 562 | 562 | |
| 563 | 563 | if ($default_value != '') {
|
| 564 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 564 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | $wpdb->query($meta_field_add); |
| 568 | 568 | } else {
|
| 569 | 569 | |
| 570 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 570 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 571 | 571 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 572 | 572 | if ($default_value != '') {
|
| 573 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 573 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 574 | 574 | } |
| 575 | 575 | |
| 576 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 576 | + geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add); |
|
| 577 | 577 | |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | |
| 581 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
|
|
| 581 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."longitude'");
|
|
| 582 | 582 | |
| 583 | 583 | if ($is_column) {
|
| 584 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 584 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."longitude` `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 585 | 585 | |
| 586 | 586 | if ($default_value != '') {
|
| 587 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 587 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | $wpdb->query($meta_field_add); |
| 591 | 591 | } else {
|
| 592 | 592 | |
| 593 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 593 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 594 | 594 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 595 | 595 | if ($default_value != '') {
|
| 596 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 596 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 599 | + geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add); |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | } |
| 603 | 603 | if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
| 604 | 604 | |
| 605 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
|
|
| 605 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapview'");
|
|
| 606 | 606 | |
| 607 | 607 | if ($is_column) {
|
| 608 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 608 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapview` `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 609 | 609 | |
| 610 | 610 | if ($default_value != '') {
|
| 611 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 611 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | $wpdb->query($meta_field_add); |
| 615 | 615 | } else {
|
| 616 | 616 | |
| 617 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 617 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 618 | 618 | |
| 619 | 619 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 620 | 620 | if ($default_value != '') {
|
| 621 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 621 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 624 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add); |
|
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | |
| 628 | 628 | } |
| 629 | 629 | if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
| 630 | 630 | |
| 631 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
|
|
| 631 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapzoom'");
|
|
| 632 | 632 | if ($is_column) {
|
| 633 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 633 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapzoom` `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 634 | 634 | |
| 635 | 635 | if ($default_value != '') {
|
| 636 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 636 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | $wpdb->query($meta_field_add); |
| 640 | 640 | |
| 641 | 641 | } else {
|
| 642 | 642 | |
| 643 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 643 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 644 | 644 | |
| 645 | 645 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 646 | 646 | if ($default_value != '') {
|
| 647 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 647 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 650 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add); |
|
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | } |
| 654 | 654 | // show lat lng |
| 655 | 655 | if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
| 656 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
|
|
| 656 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latlng'");
|
|
| 657 | 657 | |
| 658 | 658 | if ($is_column) {
|
| 659 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 659 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latlng` `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 660 | 660 | $meta_field_add .= " DEFAULT '1'"; |
| 661 | 661 | |
| 662 | 662 | $wpdb->query($meta_field_add); |
| 663 | 663 | } else {
|
| 664 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 664 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 665 | 665 | |
| 666 | 666 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 667 | 667 | $meta_field_add .= " DEFAULT '1'"; |
| 668 | 668 | |
| 669 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 669 | + geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add); |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | } |
@@ -682,30 +682,30 @@ discard block |
||
| 682 | 682 | $op_size = '500'; |
| 683 | 683 | |
| 684 | 684 | // only make the field as big as it needs to be. |
| 685 | - if(isset($option_values) && $option_values && $field_type=='select'){
|
|
| 686 | - $option_values_arr = explode(',',$option_values);
|
|
| 687 | - if(is_array($option_values_arr)){
|
|
| 685 | + if (isset($option_values) && $option_values && $field_type == 'select') {
|
|
| 686 | + $option_values_arr = explode(',', $option_values);
|
|
| 687 | + if (is_array($option_values_arr)) {
|
|
| 688 | 688 | $op_max = 0; |
| 689 | - foreach($option_values_arr as $op_val){
|
|
| 690 | - if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
|
|
| 689 | + foreach ($option_values_arr as $op_val) {
|
|
| 690 | + if (strlen($op_val) && strlen($op_val) > $op_max) {$op_max = strlen($op_val); }
|
|
| 691 | 691 | } |
| 692 | - if($op_max){$op_size =$op_max; }
|
|
| 692 | + if ($op_max) {$op_size = $op_max; }
|
|
| 693 | 693 | } |
| 694 | - }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 695 | - if(strlen($option_values)){
|
|
| 696 | - $op_size = strlen($option_values); |
|
| 694 | + }elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
|
| 695 | + if (strlen($option_values)) {
|
|
| 696 | + $op_size = strlen($option_values); |
|
| 697 | 697 | } |
| 698 | 698 | } |
| 699 | 699 | |
| 700 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL"; |
|
| 700 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."`VARCHAR( $op_size ) NULL"; |
|
| 701 | 701 | |
| 702 | 702 | if ($default_value != '') {
|
| 703 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 703 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 704 | 704 | } |
| 705 | 705 | |
| 706 | 706 | $alter_result = $wpdb->query($meta_field_add); |
| 707 | - if($alter_result===false){
|
|
| 708 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 707 | + if ($alter_result === false) {
|
|
| 708 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | if (isset($request_field['cat_display_type'])) |
@@ -722,9 +722,9 @@ discard block |
||
| 722 | 722 | case 'url': |
| 723 | 723 | case 'file': |
| 724 | 724 | |
| 725 | - $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
|
|
| 726 | - if($alter_result===false){
|
|
| 727 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 725 | + $alter_result = $wpdb->query("ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` TEXT NULL");
|
|
| 726 | + if ($alter_result === false) {
|
|
| 727 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 728 | 728 | } |
| 729 | 729 | if (isset($request_field['advanced_editor'])) |
| 730 | 730 | $extra_fields = $request_field['advanced_editor']; |
@@ -738,24 +738,24 @@ discard block |
||
| 738 | 738 | default: |
| 739 | 739 | if ($data_type != 'VARCHAR' && $data_type != '') {
|
| 740 | 740 | if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
| 741 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL"; |
|
| 741 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` DECIMAL(11, ".(int) $decimal_point.") NULL"; |
|
| 742 | 742 | } else {
|
| 743 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL"; |
|
| 743 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` ".$data_type." NULL"; |
|
| 744 | 744 | } |
| 745 | 745 | |
| 746 | 746 | if (is_numeric($default_value) && $default_value != '') {
|
| 747 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 747 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 748 | 748 | } |
| 749 | 749 | } else {
|
| 750 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL"; |
|
| 750 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` VARCHAR( 254 ) NULL"; |
|
| 751 | 751 | if ($default_value != '') {
|
| 752 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 752 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 753 | 753 | } |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | $alter_result = $wpdb->query($default_value_add); |
| 757 | - if($alter_result===false){
|
|
| 758 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 757 | + if ($alter_result === false) {
|
|
| 758 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 759 | 759 | } |
| 760 | 760 | break; |
| 761 | 761 | endswitch; |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | |
| 772 | 772 | $wpdb->prepare( |
| 773 | 773 | |
| 774 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 774 | + "update ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 775 | 775 | post_type = %s, |
| 776 | 776 | admin_title = %s, |
| 777 | 777 | site_title = %s, |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | for_admin_use = %s |
| 806 | 806 | where id = %d", |
| 807 | 807 | |
| 808 | - array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf) |
|
| 808 | + array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use, $cf) |
|
| 809 | 809 | ) |
| 810 | 810 | |
| 811 | 811 | ); |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | |
| 816 | 816 | $wpdb->query( |
| 817 | 817 | $wpdb->prepare( |
| 818 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 818 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 819 | 819 | site_title=%s |
| 820 | 820 | where post_type = %s and htmlvar_name = %s", |
| 821 | 821 | array($site_title, $post_type, $htmlvar_name) |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | |
| 825 | 825 | |
| 826 | 826 | if ($cat_sort == '') |
| 827 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 827 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 828 | 828 | |
| 829 | 829 | |
| 830 | 830 | /** |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | $data_type = ''; |
| 845 | 845 | |
| 846 | 846 | if ($htmlvar_name != '') {
|
| 847 | - $prefix = $htmlvar_name . '_'; |
|
| 847 | + $prefix = $htmlvar_name.'_'; |
|
| 848 | 848 | } |
| 849 | 849 | $old_prefix = $old_html_variable; |
| 850 | 850 | |
@@ -852,109 +852,109 @@ discard block |
||
| 852 | 852 | |
| 853 | 853 | $meta_field_add = "VARCHAR( 254 ) NULL"; |
| 854 | 854 | if ($default_value != '') {
|
| 855 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 855 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 856 | 856 | } |
| 857 | 857 | |
| 858 | - geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add); |
|
| 858 | + geodir_add_column_if_not_exist($detail_table, $prefix."address", $meta_field_add); |
|
| 859 | 859 | //$wpdb->query($meta_field_add); |
| 860 | 860 | |
| 861 | 861 | |
| 862 | 862 | if (!empty($extra_fields)) {
|
| 863 | 863 | |
| 864 | 864 | if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
| 865 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL"; |
|
| 865 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."city` VARCHAR( 30 ) NULL"; |
|
| 866 | 866 | $meta_field_add = "VARCHAR( 30 ) NULL"; |
| 867 | 867 | if ($default_value != '') {
|
| 868 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 868 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 871 | + geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add); |
|
| 872 | 872 | //$wpdb->query($meta_field_add); |
| 873 | 873 | } |
| 874 | 874 | if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
| 875 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL"; |
|
| 875 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."region` VARCHAR( 30 ) NULL"; |
|
| 876 | 876 | $meta_field_add = "VARCHAR( 30 ) NULL"; |
| 877 | 877 | if ($default_value != '') {
|
| 878 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 878 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 879 | 879 | } |
| 880 | 880 | |
| 881 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 881 | + geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add); |
|
| 882 | 882 | //$wpdb->query($meta_field_add); |
| 883 | 883 | } |
| 884 | 884 | if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
| 885 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL"; |
|
| 885 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."country` VARCHAR( 30 ) NULL"; |
|
| 886 | 886 | |
| 887 | 887 | $meta_field_add = "VARCHAR( 30 ) NULL"; |
| 888 | 888 | if ($default_value != '') {
|
| 889 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 889 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 890 | 890 | } |
| 891 | 891 | |
| 892 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 892 | + geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add); |
|
| 893 | 893 | //$wpdb->query($meta_field_add); |
| 894 | 894 | } |
| 895 | 895 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
| 896 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL"; |
|
| 896 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."zip` VARCHAR( 15 ) NULL"; |
|
| 897 | 897 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 898 | 898 | if ($default_value != '') {
|
| 899 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 899 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 902 | + geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add); |
|
| 903 | 903 | //$wpdb->query($meta_field_add); |
| 904 | 904 | } |
| 905 | 905 | if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
| 906 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 906 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 907 | 907 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 908 | 908 | if ($default_value != '') {
|
| 909 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 909 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 910 | 910 | } |
| 911 | 911 | |
| 912 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 912 | + geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add); |
|
| 913 | 913 | //$wpdb->query($meta_field_add); |
| 914 | 914 | |
| 915 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 915 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 916 | 916 | |
| 917 | 917 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 918 | 918 | if ($default_value != '') {
|
| 919 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 919 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 920 | 920 | } |
| 921 | 921 | |
| 922 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 922 | + geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add); |
|
| 923 | 923 | |
| 924 | 924 | //$wpdb->query($meta_field_add); |
| 925 | 925 | } |
| 926 | 926 | if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
| 927 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 927 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 928 | 928 | |
| 929 | 929 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 930 | 930 | if ($default_value != '') {
|
| 931 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 931 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 932 | 932 | } |
| 933 | 933 | |
| 934 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 934 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add); |
|
| 935 | 935 | |
| 936 | 936 | //$wpdb->query($meta_field_add); |
| 937 | 937 | } |
| 938 | 938 | if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
| 939 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 939 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 940 | 940 | |
| 941 | 941 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 942 | 942 | if ($default_value != '') {
|
| 943 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 943 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 944 | 944 | } |
| 945 | 945 | |
| 946 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 946 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add); |
|
| 947 | 947 | |
| 948 | 948 | //$wpdb->query($meta_field_add); |
| 949 | 949 | } |
| 950 | 950 | // show lat lng |
| 951 | 951 | if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
| 952 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 952 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 953 | 953 | |
| 954 | 954 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 955 | 955 | $meta_field_add .= " DEFAULT '1'"; |
| 956 | 956 | |
| 957 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 957 | + geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add); |
|
| 958 | 958 | //$wpdb->query($meta_field_add); |
| 959 | 959 | } |
| 960 | 960 | } |
@@ -964,8 +964,8 @@ discard block |
||
| 964 | 964 | case 'checkbox': |
| 965 | 965 | $data_type = 'TINYINT'; |
| 966 | 966 | |
| 967 | - $meta_field_add = $data_type . "( 1 ) NOT NULL "; |
|
| 968 | - if ((int)$default_value === 1) {
|
|
| 967 | + $meta_field_add = $data_type."( 1 ) NOT NULL "; |
|
| 968 | + if ((int) $default_value === 1) {
|
|
| 969 | 969 | $meta_field_add .= " DEFAULT '1'"; |
| 970 | 970 | } |
| 971 | 971 | |
@@ -998,7 +998,7 @@ discard block |
||
| 998 | 998 | } |
| 999 | 999 | } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
| 1000 | 1000 | if (strlen($option_values)) {
|
| 1001 | - $op_size = strlen($option_values); |
|
| 1001 | + $op_size = strlen($option_values); |
|
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | if (isset($request_field['multi_display_type'])) {
|
@@ -1006,9 +1006,9 @@ discard block |
||
| 1006 | 1006 | } |
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | - $meta_field_add = $data_type . "( $op_size ) NULL "; |
|
| 1009 | + $meta_field_add = $data_type."( $op_size ) NULL "; |
|
| 1010 | 1010 | if ($default_value != '') {
|
| 1011 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1011 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
@@ -1023,9 +1023,9 @@ discard block |
||
| 1023 | 1023 | |
| 1024 | 1024 | $data_type = 'TEXT'; |
| 1025 | 1025 | |
| 1026 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1026 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1027 | 1027 | |
| 1028 | - $meta_field_add = $data_type . " NULL "; |
|
| 1028 | + $meta_field_add = $data_type." NULL "; |
|
| 1029 | 1029 | /*if($default_value != '') |
| 1030 | 1030 | { $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
|
| 1031 | 1031 | |
@@ -1040,9 +1040,9 @@ discard block |
||
| 1040 | 1040 | |
| 1041 | 1041 | $data_type = 'DATE'; |
| 1042 | 1042 | |
| 1043 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1043 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1044 | 1044 | |
| 1045 | - $meta_field_add = $data_type . " NULL "; |
|
| 1045 | + $meta_field_add = $data_type." NULL "; |
|
| 1046 | 1046 | |
| 1047 | 1047 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
| 1048 | 1048 | if ($add_result === false) {
|
@@ -1055,9 +1055,9 @@ discard block |
||
| 1055 | 1055 | |
| 1056 | 1056 | $data_type = 'TIME'; |
| 1057 | 1057 | |
| 1058 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1058 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1059 | 1059 | |
| 1060 | - $meta_field_add = $data_type . " NULL "; |
|
| 1060 | + $meta_field_add = $data_type." NULL "; |
|
| 1061 | 1061 | |
| 1062 | 1062 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
| 1063 | 1063 | if ($add_result === false) {
|
@@ -1069,22 +1069,22 @@ discard block |
||
| 1069 | 1069 | default: |
| 1070 | 1070 | |
| 1071 | 1071 | if ($data_type != 'VARCHAR' && $data_type != '') {
|
| 1072 | - $meta_field_add = $data_type . " NULL "; |
|
| 1072 | + $meta_field_add = $data_type." NULL "; |
|
| 1073 | 1073 | |
| 1074 | 1074 | if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
| 1075 | - $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL "; |
|
| 1075 | + $meta_field_add = "DECIMAL(11, ".(int) $decimal_point.") NULL "; |
|
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | 1078 | if (is_numeric($default_value) && $default_value != '') {
|
| 1079 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1080 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1079 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 1080 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1081 | 1081 | } |
| 1082 | 1082 | } else {
|
| 1083 | 1083 | $meta_field_add = " VARCHAR( 254 ) NULL "; |
| 1084 | 1084 | |
| 1085 | 1085 | if ($default_value != '') {
|
| 1086 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1087 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1086 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 1087 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1088 | 1088 | } |
| 1089 | 1089 | } |
| 1090 | 1090 | |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | |
| 1107 | 1107 | $wpdb->prepare( |
| 1108 | 1108 | |
| 1109 | - "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1109 | + "insert into ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 1110 | 1110 | post_type = %s, |
| 1111 | 1111 | admin_title = %s, |
| 1112 | 1112 | site_title = %s, |
@@ -1139,7 +1139,7 @@ discard block |
||
| 1139 | 1139 | validation_msg = %s, |
| 1140 | 1140 | for_admin_use = %s ", |
| 1141 | 1141 | |
| 1142 | - array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use) |
|
| 1142 | + array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use) |
|
| 1143 | 1143 | |
| 1144 | 1144 | ) |
| 1145 | 1145 | |
@@ -1151,7 +1151,7 @@ discard block |
||
| 1151 | 1151 | |
| 1152 | 1152 | } |
| 1153 | 1153 | |
| 1154 | - return (int)$lastid; |
|
| 1154 | + return (int) $lastid; |
|
| 1155 | 1155 | |
| 1156 | 1156 | |
| 1157 | 1157 | } else {
|
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | |
| 1185 | 1185 | $post_meta_info = $wpdb->query( |
| 1186 | 1186 | $wpdb->prepare( |
| 1187 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1187 | + "update ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 1188 | 1188 | sort_order=%d |
| 1189 | 1189 | where id= %d", |
| 1190 | 1190 | array($count, $cf) |
@@ -1200,11 +1200,11 @@ discard block |
||
| 1200 | 1200 | } |
| 1201 | 1201 | |
| 1202 | 1202 | |
| 1203 | -function geodir_get_cf_value($cf){
|
|
| 1203 | +function geodir_get_cf_value($cf) {
|
|
| 1204 | 1204 | global $gd_session; |
| 1205 | 1205 | $value = ''; |
| 1206 | 1206 | if (is_admin()) {
|
| 1207 | - global $post,$gd_session; |
|
| 1207 | + global $post, $gd_session; |
|
| 1208 | 1208 | |
| 1209 | 1209 | if (isset($_REQUEST['post'])) |
| 1210 | 1210 | $_REQUEST['pid'] = $_REQUEST['post']; |
@@ -1246,16 +1246,16 @@ discard block |
||
| 1246 | 1246 | $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type); |
| 1247 | 1247 | |
| 1248 | 1248 | foreach ($custom_fields as $key => $val) {
|
| 1249 | - if(isset($val['extra_fields'])){$extra_fields = $val['extra_fields'];}
|
|
| 1249 | + if (isset($val['extra_fields'])) {$extra_fields = $val['extra_fields']; }
|
|
| 1250 | 1250 | $val = stripslashes_deep($val); // strip slashes from labels |
| 1251 | - if(isset($val['extra_fields'])){$val['extra_fields'] = $extra_fields;}
|
|
| 1251 | + if (isset($val['extra_fields'])) {$val['extra_fields'] = $extra_fields; }
|
|
| 1252 | 1252 | |
| 1253 | 1253 | $name = $val['name']; |
| 1254 | 1254 | $type = $val['type']; |
| 1255 | 1255 | $is_default = $val['is_default']; |
| 1256 | 1256 | |
| 1257 | 1257 | /* field available to site admin only for edit */ |
| 1258 | - $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1258 | + $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false; |
|
| 1259 | 1259 | if ($for_admin_use && !is_super_admin()) {
|
| 1260 | 1260 | continue; |
| 1261 | 1261 | } |
@@ -1280,11 +1280,11 @@ discard block |
||
| 1280 | 1280 | * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
| 1281 | 1281 | * @see 'geodir_after_custom_form_field_$name' |
| 1282 | 1282 | */ |
| 1283 | - do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1283 | + do_action('geodir_before_custom_form_field_'.$name, $listing_type, $package_id, $val);
|
|
| 1284 | 1284 | |
| 1285 | 1285 | |
| 1286 | 1286 | $custom_field = $val; |
| 1287 | - $html =''; |
|
| 1287 | + $html = ''; |
|
| 1288 | 1288 | /** |
| 1289 | 1289 | * Filter the output for custom fields. |
| 1290 | 1290 | * |
@@ -1293,7 +1293,7 @@ discard block |
||
| 1293 | 1293 | * @param string $html The html to be filtered (blank). |
| 1294 | 1294 | * @param array $custom_field The custom field array values. |
| 1295 | 1295 | */ |
| 1296 | - echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
|
|
| 1296 | + echo apply_filters("geodir_custom_field_input_{$type}", $html, $custom_field);
|
|
| 1297 | 1297 | |
| 1298 | 1298 | |
| 1299 | 1299 | |
@@ -1308,7 +1308,7 @@ discard block |
||
| 1308 | 1308 | * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
| 1309 | 1309 | * @see 'geodir_before_custom_form_field_$name' |
| 1310 | 1310 | */ |
| 1311 | - do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1311 | + do_action('geodir_after_custom_form_field_'.$name, $listing_type, $package_id, $val);
|
|
| 1312 | 1312 | |
| 1313 | 1313 | } |
| 1314 | 1314 | |
@@ -1334,7 +1334,7 @@ discard block |
||
| 1334 | 1334 | |
| 1335 | 1335 | $filter = $wpdb->get_row( |
| 1336 | 1336 | $wpdb->prepare( |
| 1337 | - "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 1337 | + "SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND ".$key."='".$value."'", |
|
| 1338 | 1338 | array($geodir_post_type) |
| 1339 | 1339 | ) |
| 1340 | 1340 | ); |
@@ -1349,14 +1349,14 @@ discard block |
||
| 1349 | 1349 | } |
| 1350 | 1350 | |
| 1351 | 1351 | |
| 1352 | -function geodir_field_icon_proccess($cf){
|
|
| 1352 | +function geodir_field_icon_proccess($cf) {
|
|
| 1353 | 1353 | |
| 1354 | 1354 | |
| 1355 | 1355 | if (strpos($cf['field_icon'], 'http') !== false) {
|
| 1356 | - $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1356 | + $field_icon = ' background: url('.$cf['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1357 | 1357 | } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
|
| 1358 | - $field_icon = '<i class="' . $cf['field_icon'] . '"></i>'; |
|
| 1359 | - }else{
|
|
| 1358 | + $field_icon = '<i class="'.$cf['field_icon'].'"></i>'; |
|
| 1359 | + } else {
|
|
| 1360 | 1360 | $field_icon = $cf['field_icon']; |
| 1361 | 1361 | } |
| 1362 | 1362 | |
@@ -1401,14 +1401,14 @@ discard block |
||
| 1401 | 1401 | |
| 1402 | 1402 | |
| 1403 | 1403 | foreach ($fields_info as $type) {
|
| 1404 | - if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
|
|
| 1404 | + if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; }
|
|
| 1405 | 1405 | $type = stripslashes_deep($type); // strip slashes |
| 1406 | - if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
|
|
| 1406 | + if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; }
|
|
| 1407 | 1407 | $html = ''; |
| 1408 | 1408 | $field_icon = geodir_field_icon_proccess($type); |
| 1409 | 1409 | $filed_type = $type['type']; |
| 1410 | 1410 | $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
| 1411 | - if($html_var=='post'){$html_var='post_address';}
|
|
| 1411 | + if ($html_var == 'post') {$html_var = 'post_address'; }
|
|
| 1412 | 1412 | |
| 1413 | 1413 | /** |
| 1414 | 1414 | * Filter the output for custom fields. |
@@ -1419,7 +1419,7 @@ discard block |
||
| 1419 | 1419 | * @param string $fields_location The location the field is to be show. |
| 1420 | 1420 | * @param array $type The array of field values. |
| 1421 | 1421 | */ |
| 1422 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 1422 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
|
|
| 1423 | 1423 | |
| 1424 | 1424 | $variables_array = array(); |
| 1425 | 1425 | |
@@ -1479,7 +1479,7 @@ discard block |
||
| 1479 | 1479 | * @param string $fields_location The location the fields are being output. |
| 1480 | 1480 | * @since 1.6.9 |
| 1481 | 1481 | */ |
| 1482 | - return apply_filters('geodir_show_listing_info',$html,$fields_location);
|
|
| 1482 | + return apply_filters('geodir_show_listing_info', $html, $fields_location);
|
|
| 1483 | 1483 | |
| 1484 | 1484 | } |
| 1485 | 1485 | } |
@@ -1554,7 +1554,7 @@ discard block |
||
| 1554 | 1554 | |
| 1555 | 1555 | $post_type = get_post_type($post_id); |
| 1556 | 1556 | //echo $field_id; exit; |
| 1557 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1557 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1558 | 1558 | |
| 1559 | 1559 | $postcurr_images = array(); |
| 1560 | 1560 | $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
@@ -1573,13 +1573,13 @@ discard block |
||
| 1573 | 1573 | $geodir_uploadurl = $uploads['url']; |
| 1574 | 1574 | $sub_dir = $uploads['subdir']; |
| 1575 | 1575 | |
| 1576 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
|
|
| 1576 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
|
|
| 1577 | 1577 | |
| 1578 | 1578 | for ($m = 0; $m < count($post_image); $m++) {
|
| 1579 | 1579 | |
| 1580 | 1580 | /* --------- start ------- */ |
| 1581 | 1581 | |
| 1582 | - if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
|
|
| 1582 | + if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM ".$table." WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
|
|
| 1583 | 1583 | |
| 1584 | 1584 | |
| 1585 | 1585 | $curr_img_url = $post_image[$m]; |
@@ -1605,24 +1605,24 @@ discard block |
||
| 1605 | 1605 | //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
|
| 1606 | 1606 | |
| 1607 | 1607 | if (!function_exists('wp_handle_upload'))
|
| 1608 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1608 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
| 1609 | 1609 | |
| 1610 | 1610 | if (!is_dir($geodir_uploadpath)) |
| 1611 | 1611 | mkdir($geodir_uploadpath); |
| 1612 | 1612 | |
| 1613 | - $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 1613 | + $new_name = $post_id.'_'.$field_id.'_'.$img_name_arr[0].'.'.$img_name_arr[1]; |
|
| 1614 | 1614 | $explode_sub_dir = explode("/", $sub_dir);
|
| 1615 | 1615 | if ($curr_img_dir == end($explode_sub_dir)) {
|
| 1616 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1617 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1616 | + $img_path = $geodir_uploadpath.'/'.$filename; |
|
| 1617 | + $img_url = $geodir_uploadurl.'/'.$filename; |
|
| 1618 | 1618 | } else {
|
| 1619 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1620 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1619 | + $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1620 | + $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1621 | 1621 | } |
| 1622 | 1622 | |
| 1623 | 1623 | $uploaded_file = ''; |
| 1624 | 1624 | if (file_exists($img_path)) |
| 1625 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1625 | + $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name); |
|
| 1626 | 1626 | |
| 1627 | 1627 | if ($curr_img_dir != $geodir_uploaddir) {
|
| 1628 | 1628 | if (file_exists($img_path)) |
@@ -1630,7 +1630,7 @@ discard block |
||
| 1630 | 1630 | } |
| 1631 | 1631 | |
| 1632 | 1632 | if (!empty($uploaded_file)) |
| 1633 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1633 | + $file_urls = $geodir_uploadurl.'/'.$new_name; |
|
| 1634 | 1634 | |
| 1635 | 1635 | } else {
|
| 1636 | 1636 | $file_urls = $post_image[$m]; |
@@ -1644,8 +1644,8 @@ discard block |
||
| 1644 | 1644 | if (!empty($postcurr_images)) {
|
| 1645 | 1645 | |
| 1646 | 1646 | if ($file_urls != $postcurr_images) {
|
| 1647 | - $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 1648 | - $invalid_files = (object)$invalid_files; |
|
| 1647 | + $invalid_files[] = (object) array('src' => $postcurr_images);
|
|
| 1648 | + $invalid_files = (object) $invalid_files; |
|
| 1649 | 1649 | } |
| 1650 | 1650 | } |
| 1651 | 1651 | |
@@ -1697,9 +1697,9 @@ discard block |
||
| 1697 | 1697 | function geodir_upload_dir($upload) |
| 1698 | 1698 | {
|
| 1699 | 1699 | global $current_user; |
| 1700 | - $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 1701 | - $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 1702 | - $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 1700 | + $upload['subdir'] = $upload['subdir'].'/temp_'.$current_user->data->ID; |
|
| 1701 | + $upload['path'] = $upload['basedir'].$upload['subdir']; |
|
| 1702 | + $upload['url'] = $upload['baseurl'].$upload['subdir']; |
|
| 1703 | 1703 | return $upload; |
| 1704 | 1704 | } |
| 1705 | 1705 | |
@@ -1714,20 +1714,20 @@ discard block |
||
| 1714 | 1714 | // check ajax nonce |
| 1715 | 1715 | $imgid = $_POST["imgid"]; |
| 1716 | 1716 | |
| 1717 | - check_ajax_referer($imgid . 'pluploadan'); |
|
| 1717 | + check_ajax_referer($imgid.'pluploadan'); |
|
| 1718 | 1718 | |
| 1719 | 1719 | // handle custom file uploaddir |
| 1720 | 1720 | add_filter('upload_dir', 'geodir_upload_dir');
|
| 1721 | 1721 | |
| 1722 | 1722 | // change file orientation if needed |
| 1723 | - $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 1723 | + $fixed_file = geodir_exif($_FILES[$imgid.'async-upload']); |
|
| 1724 | 1724 | |
| 1725 | 1725 | // handle file upload |
| 1726 | 1726 | $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
| 1727 | 1727 | // remove handle custom file uploaddir |
| 1728 | 1728 | remove_filter('upload_dir', 'geodir_upload_dir');
|
| 1729 | 1729 | |
| 1730 | - if(!isset($status['url']) && isset($status['error'])){
|
|
| 1730 | + if (!isset($status['url']) && isset($status['error'])) {
|
|
| 1731 | 1731 | print_r($status); |
| 1732 | 1732 | } |
| 1733 | 1733 | |
@@ -1757,9 +1757,9 @@ discard block |
||
| 1757 | 1757 | |
| 1758 | 1758 | $post_type = get_post_type($post_id); |
| 1759 | 1759 | |
| 1760 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1760 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1761 | 1761 | |
| 1762 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1762 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM ".$table." WHERE post_id=%d", array($post_id)));
|
|
| 1763 | 1763 | |
| 1764 | 1764 | if ($results) {
|
| 1765 | 1765 | return $results[0]->geodir_video; |
@@ -1783,9 +1783,9 @@ discard block |
||
| 1783 | 1783 | |
| 1784 | 1784 | $post_type = get_post_type($post_id); |
| 1785 | 1785 | |
| 1786 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1786 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1787 | 1787 | |
| 1788 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1788 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM ".$table." WHERE post_id=%d", array($post_id)));
|
|
| 1789 | 1789 | |
| 1790 | 1790 | if ($results) {
|
| 1791 | 1791 | return $results[0]->geodir_special_offers; |
@@ -1803,12 +1803,12 @@ discard block |
||
| 1803 | 1803 | */ |
| 1804 | 1804 | function geodir_max_upload_size() |
| 1805 | 1805 | {
|
| 1806 | - $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 1806 | + $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
|
|
| 1807 | 1807 | |
| 1808 | 1808 | if ($max_filesize > 0 && $max_filesize < 1) {
|
| 1809 | - $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 1809 | + $max_filesize = (int) ($max_filesize * 1024).'kb'; |
|
| 1810 | 1810 | } else {
|
| 1811 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 1811 | + $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb'; |
|
| 1812 | 1812 | } |
| 1813 | 1813 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
| 1814 | 1814 | return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
@@ -1840,7 +1840,7 @@ discard block |
||
| 1840 | 1840 | |
| 1841 | 1841 | $custom_fields = $wpdb->get_results( |
| 1842 | 1842 | $wpdb->prepare( |
| 1843 | - "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc", |
|
| 1843 | + "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from ".GEODIR_CUSTOM_FIELDS_TABLE." where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc", |
|
| 1844 | 1844 | array($post_type) |
| 1845 | 1845 | ), 'ARRAY_A' |
| 1846 | 1846 | ); |
@@ -1967,7 +1967,7 @@ discard block |
||
| 1967 | 1967 | |
| 1968 | 1968 | $post_meta_info = $wpdb->query( |
| 1969 | 1969 | $wpdb->prepare( |
| 1970 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1970 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 1971 | 1971 | sort_order=%d |
| 1972 | 1972 | where id= %d", |
| 1973 | 1973 | array($count, $cf) |
@@ -2049,14 +2049,14 @@ discard block |
||
| 2049 | 2049 | |
| 2050 | 2050 | $check_html_variable = $wpdb->get_var( |
| 2051 | 2051 | $wpdb->prepare( |
| 2052 | - "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2052 | + "select htmlvar_name from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2053 | 2053 | array($cehhtmlvar_name, $post_type, $field_type) |
| 2054 | 2054 | ) |
| 2055 | 2055 | ); |
| 2056 | 2056 | |
| 2057 | 2057 | if ($is_default == 1) {
|
| 2058 | 2058 | |
| 2059 | - $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2059 | + $wpdb->query($wpdb->prepare("update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2060 | 2060 | |
| 2061 | 2061 | } |
| 2062 | 2062 | |
@@ -2067,7 +2067,7 @@ discard block |
||
| 2067 | 2067 | |
| 2068 | 2068 | $wpdb->prepare( |
| 2069 | 2069 | |
| 2070 | - "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2070 | + "insert into ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 2071 | 2071 | post_type = %s, |
| 2072 | 2072 | data_type = %s, |
| 2073 | 2073 | field_type = %s, |
@@ -2098,7 +2098,7 @@ discard block |
||
| 2098 | 2098 | |
| 2099 | 2099 | $wpdb->prepare( |
| 2100 | 2100 | |
| 2101 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2101 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 2102 | 2102 | post_type = %s, |
| 2103 | 2103 | data_type = %s, |
| 2104 | 2104 | field_type = %s, |
@@ -2124,7 +2124,7 @@ discard block |
||
| 2124 | 2124 | } |
| 2125 | 2125 | |
| 2126 | 2126 | |
| 2127 | - return (int)$lastid; |
|
| 2127 | + return (int) $lastid; |
|
| 2128 | 2128 | |
| 2129 | 2129 | } |
| 2130 | 2130 | } |
@@ -2147,7 +2147,7 @@ discard block |
||
| 2147 | 2147 | if ($field_id != '') {
|
| 2148 | 2148 | $cf = trim($field_id, '_'); |
| 2149 | 2149 | |
| 2150 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 2150 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where id= %d ", array($cf)));
|
|
| 2151 | 2151 | |
| 2152 | 2152 | return $field_id; |
| 2153 | 2153 | |
@@ -2170,12 +2170,12 @@ discard block |
||
| 2170 | 2170 | * @param string $field_ins_upd When set to "submit" displays form. |
| 2171 | 2171 | * @param bool $default when set to true field will be for admin use only. |
| 2172 | 2172 | */ |
| 2173 | - function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='') |
|
| 2173 | + function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '') |
|
| 2174 | 2174 | {
|
| 2175 | 2175 | global $wpdb; |
| 2176 | 2176 | $cf = $result_str; |
| 2177 | 2177 | if (!is_object($cf)) {
|
| 2178 | - $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 2178 | + $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE id = %d", array($cf)));
|
|
| 2179 | 2179 | } else {
|
| 2180 | 2180 | $field_info = $cf; |
| 2181 | 2181 | $result_str = $cf->id; |
@@ -2211,18 +2211,18 @@ discard block |
||
| 2211 | 2211 | if ($htmlvar_name == '') |
| 2212 | 2212 | $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
| 2213 | 2213 | |
| 2214 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2214 | + $nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 2215 | 2215 | |
| 2216 | 2216 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 2217 | 2217 | $cso_arr = geodir_get_custom_sort_options($post_type); |
| 2218 | 2218 | |
| 2219 | 2219 | $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']); |
| 2220 | - foreach($cso_arr as $cso){
|
|
| 2221 | - if($cur_field_type==$cso['field_type']){
|
|
| 2220 | + foreach ($cso_arr as $cso) {
|
|
| 2221 | + if ($cur_field_type == $cso['field_type']) {
|
|
| 2222 | 2222 | |
| 2223 | 2223 | if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
|
| 2224 | 2224 | $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>'; |
| 2225 | - }elseif(isset($cso['field_icon']) && $cso['field_icon']){
|
|
| 2225 | + }elseif (isset($cso['field_icon']) && $cso['field_icon']) {
|
|
| 2226 | 2226 | $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
|
| 2227 | 2227 | } |
| 2228 | 2228 | |
@@ -2232,40 +2232,40 @@ discard block |
||
| 2232 | 2232 | $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500); |
| 2233 | 2233 | ?> |
| 2234 | 2234 | |
| 2235 | - <li class="text" id="licontainer_<?php echo $result_str;?>"> |
|
| 2235 | + <li class="text" id="licontainer_<?php echo $result_str; ?>"> |
|
| 2236 | 2236 | <form><!-- we need to wrap in a form so we can use radio buttons with same name --> |
| 2237 | - <div class="title title<?php echo $result_str;?> gt-fieldset" |
|
| 2238 | - title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
|
|
| 2239 | - ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
|
|
| 2237 | + <div class="title title<?php echo $result_str; ?> gt-fieldset" |
|
| 2238 | + title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
|
|
| 2239 | + ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
|
|
| 2240 | 2240 | <?php |
| 2241 | 2241 | |
| 2242 | 2242 | ?> |
| 2243 | 2243 | |
| 2244 | - <div title="<?php _e('Click to remove field', 'geodirectory');?>"
|
|
| 2245 | - onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
|
| 2244 | + <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
|
|
| 2245 | + onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
|
|
| 2246 | 2246 | class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div> |
| 2247 | 2247 | |
| 2248 | 2248 | |
| 2249 | - <?php echo $field_icon;?> |
|
| 2249 | + <?php echo $field_icon; ?> |
|
| 2250 | 2250 | <b style="cursor:pointer;" |
| 2251 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
|
|
| 2251 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' ('.$site_title.')'); ?></b>
|
|
| 2252 | 2252 | |
| 2253 | 2253 | </div> |
| 2254 | 2254 | |
| 2255 | - <div id="field_frm<?php echo $result_str;?>" class="field_frm" |
|
| 2255 | + <div id="field_frm<?php echo $result_str; ?>" class="field_frm" |
|
| 2256 | 2256 | style="display:<?php if ($field_ins_upd == 'submit') {
|
| 2257 | 2257 | echo 'block;'; |
| 2258 | 2258 | } else {
|
| 2259 | 2259 | echo 'none;'; |
| 2260 | 2260 | } ?>"> |
| 2261 | 2261 | <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/> |
| 2262 | - <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/> |
|
| 2263 | - <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/> |
|
| 2264 | - <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/> |
|
| 2262 | + <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/> |
|
| 2263 | + <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/> |
|
| 2264 | + <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/> |
|
| 2265 | 2265 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
|
| 2266 | 2266 | echo $field_info->data_type; |
| 2267 | 2267 | }?>"/> |
| 2268 | - <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/> |
|
| 2268 | + <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/> |
|
| 2269 | 2269 | |
| 2270 | 2270 | |
| 2271 | 2271 | <ul class="widefat post fixed" border="0" style="width:100%;"> |
@@ -2275,7 +2275,7 @@ discard block |
||
| 2275 | 2275 | <input type="hidden" name="site_title" id="site_title" value="<?php echo esc_attr($site_title); ?>"/> |
| 2276 | 2276 | |
| 2277 | 2277 | <li> |
| 2278 | - <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0;?> |
|
| 2278 | + <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0; ?> |
|
| 2279 | 2279 | |
| 2280 | 2280 | <label for="asc" class="gd-cf-tooltip-wrap"> |
| 2281 | 2281 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Ascending Sort (low to high)', 'geodirectory'); ?>
|
@@ -2285,24 +2285,24 @@ discard block |
||
| 2285 | 2285 | </label> |
| 2286 | 2286 | <div class="gd-cf-input-wrap gd-switch"> |
| 2287 | 2287 | |
| 2288 | - <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled" value="1" |
|
| 2288 | + <input type="radio" id="asc_yes<?php echo $radio_id; ?>" name="asc" class="gdri-enabled" value="1" |
|
| 2289 | 2289 | <?php if ($value == '1') {
|
| 2290 | 2290 | echo 'checked'; |
| 2291 | 2291 | } ?>/> |
| 2292 | - <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2292 | + <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2293 | 2293 | |
| 2294 | - <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0" |
|
| 2294 | + <input type="radio" id="asc_no<?php echo $radio_id; ?>" name="asc" class="gdri-disabled" value="0" |
|
| 2295 | 2295 | <?php if ($value == '0' || !$value) {
|
| 2296 | 2296 | echo 'checked'; |
| 2297 | 2297 | } ?>/> |
| 2298 | - <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2298 | + <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2299 | 2299 | |
| 2300 | 2300 | </div> |
| 2301 | 2301 | |
| 2302 | 2302 | </li> |
| 2303 | 2303 | |
| 2304 | - <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'";}?>>
|
|
| 2305 | - <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : '';?> |
|
| 2304 | + <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'"; }?>>
|
|
| 2305 | + <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : ''; ?> |
|
| 2306 | 2306 | |
| 2307 | 2307 | <label for="asc_title" class="gd-cf-tooltip-wrap"> |
| 2308 | 2308 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Ascending title', 'geodirectory'); ?>
|
@@ -2312,14 +2312,14 @@ discard block |
||
| 2312 | 2312 | </label> |
| 2313 | 2313 | <div class="gd-cf-input-wrap"> |
| 2314 | 2314 | |
| 2315 | - <input type="text" name="asc_title" id="asc_title" value="<?php echo $value;?>" /> |
|
| 2315 | + <input type="text" name="asc_title" id="asc_title" value="<?php echo $value; ?>" /> |
|
| 2316 | 2316 | </div> |
| 2317 | 2317 | |
| 2318 | 2318 | |
| 2319 | 2319 | </li> |
| 2320 | 2320 | |
| 2321 | 2321 | |
| 2322 | - <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'";}?>>
|
|
| 2322 | + <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'"; }?>>
|
|
| 2323 | 2323 | |
| 2324 | 2324 | <label for="is_default" class="gd-cf-tooltip-wrap"> |
| 2325 | 2325 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
|
@@ -2330,7 +2330,7 @@ discard block |
||
| 2330 | 2330 | <div class="gd-cf-input-wrap"> |
| 2331 | 2331 | |
| 2332 | 2332 | <input type="radio" name="is_default" |
| 2333 | - value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
|
|
| 2333 | + value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_asc') {
|
|
| 2334 | 2334 | echo 'checked="checked"'; |
| 2335 | 2335 | } ?>/> |
| 2336 | 2336 | </div> |
@@ -2340,7 +2340,7 @@ discard block |
||
| 2340 | 2340 | |
| 2341 | 2341 | |
| 2342 | 2342 | <li> |
| 2343 | - <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0;?> |
|
| 2343 | + <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0; ?> |
|
| 2344 | 2344 | |
| 2345 | 2345 | <label for="desc" class="gd-cf-tooltip-wrap"> |
| 2346 | 2346 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Descending Sort (high to low)', 'geodirectory'); ?>
|
@@ -2350,24 +2350,24 @@ discard block |
||
| 2350 | 2350 | </label> |
| 2351 | 2351 | <div class="gd-cf-input-wrap gd-switch"> |
| 2352 | 2352 | |
| 2353 | - <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled" value="1" |
|
| 2353 | + <input type="radio" id="desc_yes<?php echo $radio_id; ?>" name="desc" class="gdri-enabled" value="1" |
|
| 2354 | 2354 | <?php if ($value == '1') {
|
| 2355 | 2355 | echo 'checked'; |
| 2356 | 2356 | } ?>/> |
| 2357 | - <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2357 | + <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2358 | 2358 | |
| 2359 | - <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0" |
|
| 2359 | + <input type="radio" id="desc_no<?php echo $radio_id; ?>" name="desc" class="gdri-disabled" value="0" |
|
| 2360 | 2360 | <?php if ($value == '0' || !$value) {
|
| 2361 | 2361 | echo 'checked'; |
| 2362 | 2362 | } ?>/> |
| 2363 | - <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2363 | + <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2364 | 2364 | |
| 2365 | 2365 | </div> |
| 2366 | 2366 | |
| 2367 | 2367 | </li> |
| 2368 | 2368 | |
| 2369 | - <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'";}?>>
|
|
| 2370 | - <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : '';?> |
|
| 2369 | + <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'"; }?>>
|
|
| 2370 | + <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : ''; ?> |
|
| 2371 | 2371 | |
| 2372 | 2372 | <label for="desc_title" class="gd-cf-tooltip-wrap"> |
| 2373 | 2373 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Descending title', 'geodirectory'); ?>
|
@@ -2377,13 +2377,13 @@ discard block |
||
| 2377 | 2377 | </label> |
| 2378 | 2378 | <div class="gd-cf-input-wrap"> |
| 2379 | 2379 | |
| 2380 | - <input type="text" name="desc_title" id="desc_title" value="<?php echo $value;?>" /> |
|
| 2380 | + <input type="text" name="desc_title" id="desc_title" value="<?php echo $value; ?>" /> |
|
| 2381 | 2381 | </div> |
| 2382 | 2382 | |
| 2383 | 2383 | |
| 2384 | 2384 | </li> |
| 2385 | 2385 | |
| 2386 | - <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'";}?>>
|
|
| 2386 | + <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'"; }?>>
|
|
| 2387 | 2387 | |
| 2388 | 2388 | <label for="is_default" class="gd-cf-tooltip-wrap"> |
| 2389 | 2389 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
|
@@ -2394,7 +2394,7 @@ discard block |
||
| 2394 | 2394 | <div class="gd-cf-input-wrap"> |
| 2395 | 2395 | |
| 2396 | 2396 | <input type="radio" name="is_default" |
| 2397 | - value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
|
|
| 2397 | + value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_desc') {
|
|
| 2398 | 2398 | echo 'checked="checked"'; |
| 2399 | 2399 | } ?>/> |
| 2400 | 2400 | </div> |
@@ -2419,14 +2419,14 @@ discard block |
||
| 2419 | 2419 | </label> |
| 2420 | 2420 | <div class="gd-cf-input-wrap"> |
| 2421 | 2421 | |
| 2422 | - <input type="text" name="site_title" id="site_title" value="<?php echo $value;?>" /> |
|
| 2422 | + <input type="text" name="site_title" id="site_title" value="<?php echo $value; ?>" /> |
|
| 2423 | 2423 | </div> |
| 2424 | 2424 | |
| 2425 | 2425 | |
| 2426 | 2426 | </li> |
| 2427 | 2427 | |
| 2428 | 2428 | <li> |
| 2429 | - <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : '';?> |
|
| 2429 | + <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : ''; ?> |
|
| 2430 | 2430 | |
| 2431 | 2431 | <label for="is_default" class="gd-cf-tooltip-wrap"> |
| 2432 | 2432 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
|
@@ -2450,7 +2450,7 @@ discard block |
||
| 2450 | 2450 | |
| 2451 | 2451 | |
| 2452 | 2452 | <li> |
| 2453 | - <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active: 0;?> |
|
| 2453 | + <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active : 0; ?> |
|
| 2454 | 2454 | |
| 2455 | 2455 | <label for="is_active" class="gd-cf-tooltip-wrap"> |
| 2456 | 2456 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active', 'geodirectory'); ?>
|
@@ -2460,17 +2460,17 @@ discard block |
||
| 2460 | 2460 | </label> |
| 2461 | 2461 | <div class="gd-cf-input-wrap gd-switch"> |
| 2462 | 2462 | |
| 2463 | - <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
|
| 2463 | + <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled" value="1" |
|
| 2464 | 2464 | <?php if ($value == '1') {
|
| 2465 | 2465 | echo 'checked'; |
| 2466 | 2466 | } ?>/> |
| 2467 | - <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2467 | + <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2468 | 2468 | |
| 2469 | - <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
|
| 2469 | + <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0" |
|
| 2470 | 2470 | <?php if ($value == '0' || !$value) {
|
| 2471 | 2471 | echo 'checked'; |
| 2472 | 2472 | } ?>/> |
| 2473 | - <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2473 | + <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2474 | 2474 | |
| 2475 | 2475 | </div> |
| 2476 | 2476 | |
@@ -2491,10 +2491,10 @@ discard block |
||
| 2491 | 2491 | <h3></h3> |
| 2492 | 2492 | </label> |
| 2493 | 2493 | <div class="gd-cf-input-wrap"> |
| 2494 | - <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
|
|
| 2494 | + <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
|
|
| 2495 | 2495 | onclick="save_sort_field('<?php echo esc_attr($result_str); ?>')"/>
|
| 2496 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
|
|
| 2497 | - onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
|
| 2496 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
|
|
| 2497 | + onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
|
|
| 2498 | 2498 | class="button"/></a> |
| 2499 | 2499 | </div> |
| 2500 | 2500 | </li> |
@@ -2529,7 +2529,7 @@ discard block |
||
| 2529 | 2529 | if (!$package_id || !$field_name || !$post_type) {
|
| 2530 | 2530 | return true; |
| 2531 | 2531 | } |
| 2532 | - $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
|
|
| 2532 | + $sql = $wpdb->prepare("SELECT id FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int) $package_id));
|
|
| 2533 | 2533 | |
| 2534 | 2534 | if ($wpdb->get_var($sql)) {
|
| 2535 | 2535 | return true; |
@@ -2652,13 +2652,13 @@ discard block |
||
| 2652 | 2652 | } |
| 2653 | 2653 | |
| 2654 | 2654 | |
| 2655 | -function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
|
|
| 2655 | +function geodir_cfa_data_type_text($output, $result_str, $cf, $field_info) {
|
|
| 2656 | 2656 | ob_start(); |
| 2657 | 2657 | |
| 2658 | 2658 | $dt_value = ''; |
| 2659 | 2659 | if (isset($field_info->data_type)) {
|
| 2660 | 2660 | $dt_value = esc_attr($field_info->data_type); |
| 2661 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 2661 | + }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
|
|
| 2662 | 2662 | $dt_value = $cf['defaults']['data_type']; |
| 2663 | 2663 | } |
| 2664 | 2664 | ?> |
@@ -2669,15 +2669,15 @@ discard block |
||
| 2669 | 2669 | <select name="data_type" id="data_type" |
| 2670 | 2670 | onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');"> |
| 2671 | 2671 | <option |
| 2672 | - value="XVARCHAR" <?php if ($dt_value == 'VARCHAR') {
|
|
| 2672 | + value="XVARCHAR" <?php if ($dt_value == 'VARCHAR') {
|
|
| 2673 | 2673 | echo 'selected="selected"'; |
| 2674 | 2674 | } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
|
| 2675 | 2675 | <option |
| 2676 | - value="INT" <?php if ($dt_value == 'INT') {
|
|
| 2676 | + value="INT" <?php if ($dt_value == 'INT') {
|
|
| 2677 | 2677 | echo 'selected="selected"'; |
| 2678 | 2678 | } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
|
| 2679 | 2679 | <option |
| 2680 | - value="FLOAT" <?php if ($dt_value == 'FLOAT') {
|
|
| 2680 | + value="FLOAT" <?php if ($dt_value == 'FLOAT') {
|
|
| 2681 | 2681 | echo 'selected="selected"'; |
| 2682 | 2682 | } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
|
| 2683 | 2683 | </select> |
@@ -2690,13 +2690,13 @@ discard block |
||
| 2690 | 2690 | $value = ''; |
| 2691 | 2691 | if (isset($field_info->decimal_point)) {
|
| 2692 | 2692 | $value = esc_attr($field_info->decimal_point); |
| 2693 | - }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
|
|
| 2693 | + }elseif (isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']) {
|
|
| 2694 | 2694 | $value = $cf['defaults']['decimal_point']; |
| 2695 | 2695 | } |
| 2696 | 2696 | ?> |
| 2697 | 2697 | |
| 2698 | 2698 | <li class="decimal-point-wrapper" |
| 2699 | - style="<?php echo ($dt_value == 'FLOAT') ? '' : 'display:none' ?>"> |
|
| 2699 | + style="<?php echo ($dt_value == 'FLOAT') ? '' : 'display:none' ?>"> |
|
| 2700 | 2700 | <label for="decimal_point"><?php _e('Select decimal point :', 'geodirectory'); ?></label>
|
| 2701 | 2701 | <div class="gd-cf-input-wrap"> |
| 2702 | 2702 | <select name="decimal_point" id="decimal_point"> |
@@ -2714,41 +2714,41 @@ discard block |
||
| 2714 | 2714 | $output = ob_get_clean(); |
| 2715 | 2715 | return $output; |
| 2716 | 2716 | } |
| 2717 | -add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
|
|
| 2717 | +add_filter('geodir_cfa_data_type_text', 'geodir_cfa_data_type_text', 10, 4);
|
|
| 2718 | 2718 | |
| 2719 | 2719 | // htmlvar not needed for fieldset and taxonomy |
| 2720 | -add_filter('geodir_cfa_htmlvar_name_fieldset','__return_empty_string',10,4);
|
|
| 2721 | -add_filter('geodir_cfa_htmlvar_name_taxonomy','__return_empty_string',10,4);
|
|
| 2720 | +add_filter('geodir_cfa_htmlvar_name_fieldset', '__return_empty_string', 10, 4);
|
|
| 2721 | +add_filter('geodir_cfa_htmlvar_name_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2722 | 2722 | |
| 2723 | 2723 | |
| 2724 | 2724 | // default_value not needed for textarea, html, file, fieldset, taxonomy, address |
| 2725 | -add_filter('geodir_cfa_default_value_file','__return_empty_string',10,4);
|
|
| 2726 | -add_filter('geodir_cfa_default_value_taxonomy','__return_empty_string',10,4);
|
|
| 2727 | -add_filter('geodir_cfa_default_value_address','__return_empty_string',10,4);
|
|
| 2728 | -add_filter('geodir_cfa_default_value_fieldset','__return_empty_string',10,4);
|
|
| 2725 | +add_filter('geodir_cfa_default_value_file', '__return_empty_string', 10, 4);
|
|
| 2726 | +add_filter('geodir_cfa_default_value_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2727 | +add_filter('geodir_cfa_default_value_address', '__return_empty_string', 10, 4);
|
|
| 2728 | +add_filter('geodir_cfa_default_value_fieldset', '__return_empty_string', 10, 4);
|
|
| 2729 | 2729 | |
| 2730 | 2730 | // is_required not needed for fieldset |
| 2731 | -add_filter('geodir_cfa_is_required_fieldset','__return_empty_string',10,4);
|
|
| 2732 | -add_filter('geodir_cfa_required_msg_fieldset','__return_empty_string',10,4);
|
|
| 2731 | +add_filter('geodir_cfa_is_required_fieldset', '__return_empty_string', 10, 4);
|
|
| 2732 | +add_filter('geodir_cfa_required_msg_fieldset', '__return_empty_string', 10, 4);
|
|
| 2733 | 2733 | |
| 2734 | 2734 | // field_icon not needed for fieldset |
| 2735 | -add_filter('geodir_cfa_field_icon_fieldset','__return_empty_string',10,4);
|
|
| 2736 | -add_filter('geodir_cfa_css_class_fieldset','__return_empty_string',10,4);
|
|
| 2735 | +add_filter('geodir_cfa_field_icon_fieldset', '__return_empty_string', 10, 4);
|
|
| 2736 | +add_filter('geodir_cfa_css_class_fieldset', '__return_empty_string', 10, 4);
|
|
| 2737 | 2737 | |
| 2738 | 2738 | // cat_sort not needed for some fields |
| 2739 | -add_filter('geodir_cfa_cat_sort_html','__return_empty_string',10,4);
|
|
| 2740 | -add_filter('geodir_cfa_cat_sort_file','__return_empty_string',10,4);
|
|
| 2741 | -add_filter('geodir_cfa_cat_sort_url','__return_empty_string',10,4);
|
|
| 2742 | -add_filter('geodir_cfa_cat_sort_fieldset','__return_empty_string',10,4);
|
|
| 2743 | -add_filter('geodir_cfa_cat_sort_multiselect','__return_empty_string',10,4);
|
|
| 2744 | -add_filter('geodir_cfa_cat_sort_textarea','__return_empty_string',10,4);
|
|
| 2745 | -add_filter('geodir_cfa_cat_sort_taxonomy','__return_empty_string',10,4);
|
|
| 2746 | -add_filter('geodir_cfa_cat_sort_address','__return_empty_string',10,4);
|
|
| 2739 | +add_filter('geodir_cfa_cat_sort_html', '__return_empty_string', 10, 4);
|
|
| 2740 | +add_filter('geodir_cfa_cat_sort_file', '__return_empty_string', 10, 4);
|
|
| 2741 | +add_filter('geodir_cfa_cat_sort_url', '__return_empty_string', 10, 4);
|
|
| 2742 | +add_filter('geodir_cfa_cat_sort_fieldset', '__return_empty_string', 10, 4);
|
|
| 2743 | +add_filter('geodir_cfa_cat_sort_multiselect', '__return_empty_string', 10, 4);
|
|
| 2744 | +add_filter('geodir_cfa_cat_sort_textarea', '__return_empty_string', 10, 4);
|
|
| 2745 | +add_filter('geodir_cfa_cat_sort_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2746 | +add_filter('geodir_cfa_cat_sort_address', '__return_empty_string', 10, 4);
|
|
| 2747 | 2747 | |
| 2748 | 2748 | |
| 2749 | 2749 | |
| 2750 | -function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
|
|
| 2751 | - if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
|
|
| 2750 | +function geodir_cfa_advanced_editor_geodir_special_offers($output, $result_str, $cf, $field_info) {
|
|
| 2751 | + if ($field_info->htmlvar_name != 'geodir_special_offers') {return ''; }
|
|
| 2752 | 2752 | ob_start(); |
| 2753 | 2753 | ?> |
| 2754 | 2754 | <li> |
@@ -2779,16 +2779,16 @@ discard block |
||
| 2779 | 2779 | $output = ob_get_clean(); |
| 2780 | 2780 | return $output; |
| 2781 | 2781 | } |
| 2782 | -add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
|
|
| 2782 | +add_filter('geodir_cfa_advanced_editor_textarea', 'geodir_cfa_advanced_editor_geodir_special_offers', 10, 4);
|
|
| 2783 | 2783 | |
| 2784 | 2784 | |
| 2785 | -function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
|
|
| 2785 | +function geodir_cfa_validation_pattern_text($output, $result_str, $cf, $field_info) {
|
|
| 2786 | 2786 | ob_start(); |
| 2787 | 2787 | |
| 2788 | 2788 | $value = ''; |
| 2789 | 2789 | if (isset($field_info->validation_pattern)) {
|
| 2790 | 2790 | $value = esc_attr($field_info->validation_pattern); |
| 2791 | - }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
|
|
| 2791 | + }elseif (isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']) {
|
|
| 2792 | 2792 | $value = esc_attr($cf['defaults']['validation_pattern']); |
| 2793 | 2793 | } |
| 2794 | 2794 | ?> |
@@ -2808,7 +2808,7 @@ discard block |
||
| 2808 | 2808 | $value = ''; |
| 2809 | 2809 | if (isset($field_info->validation_msg)) {
|
| 2810 | 2810 | $value = esc_attr($field_info->validation_msg); |
| 2811 | - }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
|
|
| 2811 | + }elseif (isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']) {
|
|
| 2812 | 2812 | $value = esc_attr($cf['defaults']['validation_msg']); |
| 2813 | 2813 | } |
| 2814 | 2814 | ?> |
@@ -2829,10 +2829,10 @@ discard block |
||
| 2829 | 2829 | $output = ob_get_clean(); |
| 2830 | 2830 | return $output; |
| 2831 | 2831 | } |
| 2832 | -add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
|
|
| 2832 | +add_filter('geodir_cfa_validation_pattern_text', 'geodir_cfa_validation_pattern_text', 10, 4);
|
|
| 2833 | 2833 | |
| 2834 | 2834 | |
| 2835 | -function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
|
|
| 2835 | +function geodir_cfa_htmlvar_name_taxonomy($output, $result_str, $cf, $field_info) {
|
|
| 2836 | 2836 | ob_start(); |
| 2837 | 2837 | global $post_type; |
| 2838 | 2838 | |
@@ -2857,7 +2857,7 @@ discard block |
||
| 2857 | 2857 | ?> |
| 2858 | 2858 | <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
|
| 2859 | 2859 | echo 'selected="selected"'; |
| 2860 | - }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php |
|
| 2860 | + }?> id="<?php echo $gd_tax; ?>"><?php echo $gd_tax; ?></option><?php |
|
| 2861 | 2861 | } |
| 2862 | 2862 | ?> |
| 2863 | 2863 | </select> |
@@ -2868,7 +2868,7 @@ discard block |
||
| 2868 | 2868 | <label for="cat_display_type" class="gd-cf-tooltip-wrap"> |
| 2869 | 2869 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Category display type :', 'geodirectory'); ?>
|
| 2870 | 2870 | <div class="gdcf-tooltip"> |
| 2871 | - <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory');?>
|
|
| 2871 | + <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory'); ?>
|
|
| 2872 | 2872 | </div> |
| 2873 | 2873 | </label> |
| 2874 | 2874 | <div class="gd-cf-input-wrap"> |
@@ -2876,19 +2876,19 @@ discard block |
||
| 2876 | 2876 | <select name="cat_display_type" id="cat_display_type"> |
| 2877 | 2877 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
|
| 2878 | 2878 | echo 'selected="selected"'; |
| 2879 | - }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
|
|
| 2879 | + }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory'); ?></option>
|
|
| 2880 | 2880 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 2881 | 2881 | echo 'selected="selected"'; |
| 2882 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2882 | + }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
|
|
| 2883 | 2883 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
|
| 2884 | 2884 | echo 'selected="selected"'; |
| 2885 | - }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
|
|
| 2885 | + }?> value="multiselect"><?php _e('Multiselect', 'geodirectory'); ?></option>
|
|
| 2886 | 2886 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 2887 | 2887 | echo 'selected="selected"'; |
| 2888 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2888 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
|
|
| 2889 | 2889 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 2890 | 2890 | echo 'selected="selected"'; |
| 2891 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2891 | + }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
|
|
| 2892 | 2892 | </select> |
| 2893 | 2893 | </div> |
| 2894 | 2894 | </li> |
@@ -2897,10 +2897,10 @@ discard block |
||
| 2897 | 2897 | $output = ob_get_clean(); |
| 2898 | 2898 | return $output; |
| 2899 | 2899 | } |
| 2900 | -add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
|
|
| 2900 | +add_filter('geodir_cfa_htmlvar_name_taxonomy', 'geodir_cfa_htmlvar_name_taxonomy', 10, 4);
|
|
| 2901 | 2901 | |
| 2902 | 2902 | |
| 2903 | -function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
|
|
| 2903 | +function geodir_cfa_extra_fields_address($output, $result_str, $cf, $field_info) {
|
|
| 2904 | 2904 | |
| 2905 | 2905 | ob_start(); |
| 2906 | 2906 | if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
@@ -2923,32 +2923,32 @@ discard block |
||
| 2923 | 2923 | <label for="show_zip" class="gd-cf-tooltip-wrap"> |
| 2924 | 2924 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display zip/post code :', 'geodirectory'); ?>
|
| 2925 | 2925 | <div class="gdcf-tooltip"> |
| 2926 | - <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?>
|
|
| 2926 | + <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory'); ?>
|
|
| 2927 | 2927 | </div> |
| 2928 | 2928 | </label> |
| 2929 | 2929 | <div class="gd-cf-input-wrap gd-switch"> |
| 2930 | 2930 | |
| 2931 | - <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled" value="1" |
|
| 2931 | + <input type="radio" id="show_zip_yes<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-enabled" value="1" |
|
| 2932 | 2932 | <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
|
| 2933 | 2933 | echo 'checked'; |
| 2934 | 2934 | } ?>/> |
| 2935 | - <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2935 | + <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2936 | 2936 | |
| 2937 | - <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0" |
|
| 2937 | + <input type="radio" id="show_zip_no<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-disabled" value="0" |
|
| 2938 | 2938 | <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
|
| 2939 | 2939 | echo 'checked'; |
| 2940 | 2940 | } ?>/> |
| 2941 | - <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2941 | + <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2942 | 2942 | |
| 2943 | 2943 | |
| 2944 | 2944 | </div> |
| 2945 | 2945 | </li> |
| 2946 | 2946 | |
| 2947 | - <li class="cf-zip-lable" <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'";}?> >
|
|
| 2947 | + <li class="cf-zip-lable" <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'"; }?> >
|
|
| 2948 | 2948 | <label for="zip_lable" class="gd-cf-tooltip-wrap"> |
| 2949 | 2949 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Zip/Post code label :', 'geodirectory'); ?>
|
| 2950 | 2950 | <div class="gdcf-tooltip"> |
| 2951 | - <?php _e('Enter zip/post code field label in address section.', 'geodirectory');?>
|
|
| 2951 | + <?php _e('Enter zip/post code field label in address section.', 'geodirectory'); ?>
|
|
| 2952 | 2952 | </div> |
| 2953 | 2953 | </label> |
| 2954 | 2954 | <div class="gd-cf-input-wrap"> |
@@ -2966,7 +2966,7 @@ discard block |
||
| 2966 | 2966 | <label for="map_lable" class="gd-cf-tooltip-wrap"> |
| 2967 | 2967 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map button label :', 'geodirectory'); ?>
|
| 2968 | 2968 | <div class="gdcf-tooltip"> |
| 2969 | - <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory');?>
|
|
| 2969 | + <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory'); ?>
|
|
| 2970 | 2970 | </div> |
| 2971 | 2971 | </label> |
| 2972 | 2972 | <div class="gd-cf-input-wrap"> |
@@ -2981,22 +2981,22 @@ discard block |
||
| 2981 | 2981 | <label for="show_mapzoom" class="gd-cf-tooltip-wrap"> |
| 2982 | 2982 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Use user zoom level:', 'geodirectory'); ?>
|
| 2983 | 2983 | <div class="gdcf-tooltip"> |
| 2984 | - <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory');?>
|
|
| 2984 | + <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory'); ?>
|
|
| 2985 | 2985 | </div> |
| 2986 | 2986 | </label> |
| 2987 | 2987 | <div class="gd-cf-input-wrap gd-switch"> |
| 2988 | 2988 | |
| 2989 | - <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled" value="1" |
|
| 2989 | + <input type="radio" id="show_mapzoom_yes<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-enabled" value="1" |
|
| 2990 | 2990 | <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
|
| 2991 | 2991 | echo 'checked'; |
| 2992 | 2992 | } ?>/> |
| 2993 | - <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2993 | + <label for="show_mapzoom_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2994 | 2994 | |
| 2995 | - <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0" |
|
| 2995 | + <input type="radio" id="show_mapzoom_no<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0" |
|
| 2996 | 2996 | <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
|
| 2997 | 2997 | echo 'checked'; |
| 2998 | 2998 | } ?>/> |
| 2999 | - <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2999 | + <label for="show_mapzoom_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3000 | 3000 | |
| 3001 | 3001 | </div> |
| 3002 | 3002 | </li> |
@@ -3005,22 +3005,22 @@ discard block |
||
| 3005 | 3005 | <label for="show_mapview" class="gd-cf-tooltip-wrap"> |
| 3006 | 3006 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display map view:', 'geodirectory'); ?>
|
| 3007 | 3007 | <div class="gdcf-tooltip"> |
| 3008 | - <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory');?>
|
|
| 3008 | + <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory'); ?>
|
|
| 3009 | 3009 | </div> |
| 3010 | 3010 | </label> |
| 3011 | 3011 | <div class="gd-cf-input-wrap gd-switch"> |
| 3012 | 3012 | |
| 3013 | - <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled" value="1" |
|
| 3013 | + <input type="radio" id="show_mapview_yes<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-enabled" value="1" |
|
| 3014 | 3014 | <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
|
| 3015 | 3015 | echo 'checked'; |
| 3016 | 3016 | } ?>/> |
| 3017 | - <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3017 | + <label for="show_mapview_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3018 | 3018 | |
| 3019 | - <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0" |
|
| 3019 | + <input type="radio" id="show_mapview_no<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-disabled" value="0" |
|
| 3020 | 3020 | <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
|
| 3021 | 3021 | echo 'checked'; |
| 3022 | 3022 | } ?>/> |
| 3023 | - <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3023 | + <label for="show_mapview_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3024 | 3024 | |
| 3025 | 3025 | </div> |
| 3026 | 3026 | </li> |
@@ -3030,7 +3030,7 @@ discard block |
||
| 3030 | 3030 | <label for="mapview_lable" class="gd-cf-tooltip-wrap"> |
| 3031 | 3031 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map view label:', 'geodirectory'); ?>
|
| 3032 | 3032 | <div class="gdcf-tooltip"> |
| 3033 | - <?php _e('Enter mapview field label in address section.', 'geodirectory');?>
|
|
| 3033 | + <?php _e('Enter mapview field label in address section.', 'geodirectory'); ?>
|
|
| 3034 | 3034 | </div> |
| 3035 | 3035 | </label> |
| 3036 | 3036 | <div class="gd-cf-input-wrap"> |
@@ -3044,22 +3044,22 @@ discard block |
||
| 3044 | 3044 | <label for="show_latlng" class="gd-cf-tooltip-wrap"> |
| 3045 | 3045 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show latitude and longitude', 'geodirectory'); ?>
|
| 3046 | 3046 | <div class="gdcf-tooltip"> |
| 3047 | - <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory');?>
|
|
| 3047 | + <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory'); ?>
|
|
| 3048 | 3048 | </div> |
| 3049 | 3049 | </label> |
| 3050 | 3050 | <div class="gd-cf-input-wrap gd-switch"> |
| 3051 | 3051 | |
| 3052 | - <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled" value="1" |
|
| 3052 | + <input type="radio" id="show_latlng_yes<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-enabled" value="1" |
|
| 3053 | 3053 | <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
|
| 3054 | 3054 | echo 'checked'; |
| 3055 | 3055 | } ?>/> |
| 3056 | - <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3056 | + <label for="show_latlng_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3057 | 3057 | |
| 3058 | - <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0" |
|
| 3058 | + <input type="radio" id="show_latlng_no<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-disabled" value="0" |
|
| 3059 | 3059 | <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
|
| 3060 | 3060 | echo 'checked'; |
| 3061 | 3061 | } ?>/> |
| 3062 | - <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3062 | + <label for="show_latlng_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3063 | 3063 | |
| 3064 | 3064 | </div> |
| 3065 | 3065 | </li> |
@@ -3068,17 +3068,17 @@ discard block |
||
| 3068 | 3068 | $html = ob_get_clean(); |
| 3069 | 3069 | return $output.$html; |
| 3070 | 3070 | } |
| 3071 | -add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
|
|
| 3071 | +add_filter('geodir_cfa_extra_fields_address', 'geodir_cfa_extra_fields_address', 10, 4);
|
|
| 3072 | 3072 | |
| 3073 | 3073 | |
| 3074 | -function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
|
|
| 3074 | +function geodir_cfa_extra_fields_multiselect($output, $result_str, $cf, $field_info) {
|
|
| 3075 | 3075 | ob_start(); |
| 3076 | 3076 | ?> |
| 3077 | 3077 | <li> |
| 3078 | 3078 | <label for="multi_display_type" class="gd-cf-tooltip-wrap"> |
| 3079 | 3079 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
|
| 3080 | 3080 | <div class="gdcf-tooltip"> |
| 3081 | - <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory');?>
|
|
| 3081 | + <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory'); ?>
|
|
| 3082 | 3082 | </div> |
| 3083 | 3083 | </label> |
| 3084 | 3084 | <div class="gd-cf-input-wrap"> |
@@ -3086,13 +3086,13 @@ discard block |
||
| 3086 | 3086 | <select name="multi_display_type" id="multi_display_type"> |
| 3087 | 3087 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 3088 | 3088 | echo 'selected="selected"'; |
| 3089 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 3089 | + }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
|
|
| 3090 | 3090 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 3091 | 3091 | echo 'selected="selected"'; |
| 3092 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 3092 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
|
|
| 3093 | 3093 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 3094 | 3094 | echo 'selected="selected"'; |
| 3095 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 3095 | + }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
|
|
| 3096 | 3096 | </select> |
| 3097 | 3097 | |
| 3098 | 3098 | <br/> |
@@ -3103,17 +3103,17 @@ discard block |
||
| 3103 | 3103 | $html = ob_get_clean(); |
| 3104 | 3104 | return $output.$html; |
| 3105 | 3105 | } |
| 3106 | -add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
|
|
| 3106 | +add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_multiselect', 10, 4);
|
|
| 3107 | 3107 | |
| 3108 | 3108 | |
| 3109 | -function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
|
|
| 3109 | +function geodir_cfa_extra_fields_smr($output, $result_str, $cf, $field_info) {
|
|
| 3110 | 3110 | |
| 3111 | 3111 | ob_start(); |
| 3112 | 3112 | |
| 3113 | 3113 | $value = ''; |
| 3114 | 3114 | if (isset($field_info->option_values)) {
|
| 3115 | 3115 | $value = esc_attr($field_info->option_values); |
| 3116 | - }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
|
|
| 3116 | + }elseif (isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']) {
|
|
| 3117 | 3117 | $value = esc_attr($cf['defaults']['option_values']); |
| 3118 | 3118 | } |
| 3119 | 3119 | |
@@ -3123,11 +3123,11 @@ discard block |
||
| 3123 | 3123 | <label for="option_values" class="gd-cf-tooltip-wrap"> |
| 3124 | 3124 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
|
| 3125 | 3125 | <div class="gdcf-tooltip"> |
| 3126 | - <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
|
|
| 3126 | + <span><?php _e('Option Values should be separated by comma.', 'geodirectory'); ?></span>
|
|
| 3127 | 3127 | <br/> |
| 3128 | - <small><span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory');?></span>
|
|
| 3128 | + <small><span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory'); ?></span>
|
|
| 3129 | 3129 | <br/> |
| 3130 | - <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory');?></span>
|
|
| 3130 | + <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory'); ?></span>
|
|
| 3131 | 3131 | <?php if ($field_type == 'multiselect' || $field_type == 'select') { ?>
|
| 3132 | 3132 | <br/> |
| 3133 | 3133 | <span><?php _e('- If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}"', 'geodirectory'); ?></span>
|
@@ -3138,7 +3138,7 @@ discard block |
||
| 3138 | 3138 | </label> |
| 3139 | 3139 | <div class="gd-cf-input-wrap"> |
| 3140 | 3140 | <input type="text" name="option_values" id="option_values" |
| 3141 | - value="<?php echo $value;?>"/> |
|
| 3141 | + value="<?php echo $value; ?>"/> |
|
| 3142 | 3142 | <br/> |
| 3143 | 3143 | |
| 3144 | 3144 | </div> |
@@ -3148,12 +3148,12 @@ discard block |
||
| 3148 | 3148 | $html = ob_get_clean(); |
| 3149 | 3149 | return $output.$html; |
| 3150 | 3150 | } |
| 3151 | -add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
|
|
| 3152 | -add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
|
|
| 3153 | -add_filter('geodir_cfa_extra_fields_radio','geodir_cfa_extra_fields_smr',10,4);
|
|
| 3151 | +add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 3152 | +add_filter('geodir_cfa_extra_fields_select', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 3153 | +add_filter('geodir_cfa_extra_fields_radio', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 3154 | 3154 | |
| 3155 | 3155 | |
| 3156 | -function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
|
|
| 3156 | +function geodir_cfa_extra_fields_datepicker($output, $result_str, $cf, $field_info) {
|
|
| 3157 | 3157 | ob_start(); |
| 3158 | 3158 | $extra = array(); |
| 3159 | 3159 | if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
@@ -3164,7 +3164,7 @@ discard block |
||
| 3164 | 3164 | <label for="date_format" class="gd-cf-tooltip-wrap"> |
| 3165 | 3165 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
|
| 3166 | 3166 | <div class="gdcf-tooltip"> |
| 3167 | - <?php _e('Select the date format.', 'geodirectory');?>
|
|
| 3167 | + <?php _e('Select the date format.', 'geodirectory'); ?>
|
|
| 3168 | 3168 | </div> |
| 3169 | 3169 | </label> |
| 3170 | 3170 | <div class="gd-cf-input-wrap" style="overflow:inherit;"> |
@@ -3184,16 +3184,16 @@ discard block |
||
| 3184 | 3184 | * @since 1.6.5 |
| 3185 | 3185 | * @param array $date_formats The PHP date format array. |
| 3186 | 3186 | */ |
| 3187 | - $date_formats = apply_filters('geodir_date_formats',$date_formats);
|
|
| 3187 | + $date_formats = apply_filters('geodir_date_formats', $date_formats);
|
|
| 3188 | 3188 | ?> |
| 3189 | 3189 | <select name="extra[date_format]" id="date_format"> |
| 3190 | 3190 | <?php |
| 3191 | - foreach($date_formats as $format){
|
|
| 3191 | + foreach ($date_formats as $format) {
|
|
| 3192 | 3192 | $selected = ''; |
| 3193 | - if(!empty($extra) && esc_attr($extra['date_format'])==$format){
|
|
| 3193 | + if (!empty($extra) && esc_attr($extra['date_format']) == $format) {
|
|
| 3194 | 3194 | $selected = "selected='selected'"; |
| 3195 | 3195 | } |
| 3196 | - echo "<option $selected value='$format'>$format (".date_i18n( $format, time()).")</option>";
|
|
| 3196 | + echo "<option $selected value='$format'>$format (".date_i18n($format, time()).")</option>";
|
|
| 3197 | 3197 | } |
| 3198 | 3198 | ?> |
| 3199 | 3199 | </select> |
@@ -3205,10 +3205,10 @@ discard block |
||
| 3205 | 3205 | $html = ob_get_clean(); |
| 3206 | 3206 | return $output.$html; |
| 3207 | 3207 | } |
| 3208 | -add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
|
|
| 3208 | +add_filter('geodir_cfa_extra_fields_datepicker', 'geodir_cfa_extra_fields_datepicker', 10, 4);
|
|
| 3209 | 3209 | |
| 3210 | 3210 | |
| 3211 | -function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
|
|
| 3211 | +function geodir_cfa_extra_fields_file($output, $result_str, $cf, $field_info) {
|
|
| 3212 | 3212 | ob_start(); |
| 3213 | 3213 | $allowed_file_types = geodir_allowed_mime_types(); |
| 3214 | 3214 | |
@@ -3219,16 +3219,16 @@ discard block |
||
| 3219 | 3219 | <label for="gd_file_types" class="gd-cf-tooltip-wrap"> |
| 3220 | 3220 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
|
| 3221 | 3221 | <div class="gdcf-tooltip"> |
| 3222 | - <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory');?>
|
|
| 3222 | + <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory'); ?>
|
|
| 3223 | 3223 | </div> |
| 3224 | 3224 | </label> |
| 3225 | 3225 | <div class="gd-cf-input-wrap"> |
| 3226 | 3226 | <select name="extra[gd_file_types][]" id="gd_file_types" multiple="multiple" style="height:100px;width:90%;"> |
| 3227 | - <option value="*" <?php selected(true, in_array('*', $gd_file_types));?>><?php _e('All types', 'geodirectory') ;?></option>
|
|
| 3228 | - <?php foreach ( $allowed_file_types as $format => $types ) { ?>
|
|
| 3229 | - <optgroup label="<?php echo esc_attr( wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory') ) ) ;?>">
|
|
| 3230 | - <?php foreach ( $types as $ext => $type ) { ?>
|
|
| 3231 | - <option value="<?php echo esc_attr($ext) ;?>" <?php selected(true, in_array($ext, $gd_file_types));?>><?php echo '.' . $ext ;?></option> |
|
| 3227 | + <option value="*" <?php selected(true, in_array('*', $gd_file_types)); ?>><?php _e('All types', 'geodirectory'); ?></option>
|
|
| 3228 | + <?php foreach ($allowed_file_types as $format => $types) { ?>
|
|
| 3229 | + <optgroup label="<?php echo esc_attr(wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory'))); ?>">
|
|
| 3230 | + <?php foreach ($types as $ext => $type) { ?>
|
|
| 3231 | + <option value="<?php echo esc_attr($ext); ?>" <?php selected(true, in_array($ext, $gd_file_types)); ?>><?php echo '.'.$ext; ?></option> |
|
| 3232 | 3232 | <?php } ?> |
| 3233 | 3233 | </optgroup> |
| 3234 | 3234 | <?php } ?> |
@@ -3240,9 +3240,9 @@ discard block |
||
| 3240 | 3240 | $html = ob_get_clean(); |
| 3241 | 3241 | return $output.$html; |
| 3242 | 3242 | } |
| 3243 | -add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
|
|
| 3243 | +add_filter('geodir_cfa_extra_fields_file', 'geodir_cfa_extra_fields_file', 10, 4);
|
|
| 3244 | 3244 | |
| 3245 | -function geodir_cfa_extra_fields_text($output,$result_str,$cf,$field_info){
|
|
| 3245 | +function geodir_cfa_extra_fields_text($output, $result_str, $cf, $field_info) {
|
|
| 3246 | 3246 | ob_start(); |
| 3247 | 3247 | |
| 3248 | 3248 | $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
@@ -3256,15 +3256,15 @@ discard block |
||
| 3256 | 3256 | $value = ''; |
| 3257 | 3257 | if ($extra_fields && isset($extra_fields['is_price'])) {
|
| 3258 | 3258 | $value = esc_attr($extra_fields['is_price']); |
| 3259 | - }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
|
|
| 3259 | + }elseif (isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']) {
|
|
| 3260 | 3260 | $value = esc_attr($cf['defaults']['extra_fields']['is_price']); |
| 3261 | 3261 | } |
| 3262 | 3262 | |
| 3263 | - $show_price_extra = ($value==1) ? 1 : 0; |
|
| 3263 | + $show_price_extra = ($value == 1) ? 1 : 0; |
|
| 3264 | 3264 | |
| 3265 | - $show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0; |
|
| 3265 | + $show_price = (isset($field_info->data_type) && ($field_info->data_type == 'INT' && $field_info->data_type == 'FLOAT')) ? 1 : 0; |
|
| 3266 | 3266 | ?> |
| 3267 | - <li class="gdcf-price-extra-set" <?php if(!$show_price){ echo "style='display:none;'";}?>>
|
|
| 3267 | + <li class="gdcf-price-extra-set" <?php if (!$show_price) { echo "style='display:none;'"; }?>>
|
|
| 3268 | 3268 | <label for="is_price" class="gd-cf-tooltip-wrap"> |
| 3269 | 3269 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display as price? :', 'geodirectory'); ?>
|
| 3270 | 3270 | <div class="gdcf-tooltip"> |
@@ -3273,17 +3273,17 @@ discard block |
||
| 3273 | 3273 | </label> |
| 3274 | 3274 | <div class="gd-cf-input-wrap gd-switch"> |
| 3275 | 3275 | |
| 3276 | - <input type="radio" id="is_price_yes<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-enabled" value="1" |
|
| 3276 | + <input type="radio" id="is_price_yes<?php echo $radio_id; ?>" name="extra[is_price]" class="gdri-enabled" value="1" |
|
| 3277 | 3277 | <?php if ($value == '1') {
|
| 3278 | 3278 | echo 'checked'; |
| 3279 | 3279 | } ?>/> |
| 3280 | - <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3280 | + <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3281 | 3281 | |
| 3282 | - <input type="radio" id="is_price_no<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-disabled" value="0" |
|
| 3282 | + <input type="radio" id="is_price_no<?php echo $radio_id; ?>" name="extra[is_price]" class="gdri-disabled" value="0" |
|
| 3283 | 3283 | <?php if ($value == '0' || !$value) {
|
| 3284 | 3284 | echo 'checked'; |
| 3285 | 3285 | } ?>/> |
| 3286 | - <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3286 | + <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3287 | 3287 | |
| 3288 | 3288 | </div> |
| 3289 | 3289 | </li> |
@@ -3293,23 +3293,23 @@ discard block |
||
| 3293 | 3293 | $value = ''; |
| 3294 | 3294 | if ($extra_fields && isset($extra_fields['thousand_separator'])) {
|
| 3295 | 3295 | $value = esc_attr($extra_fields['thousand_separator']); |
| 3296 | - }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
|
|
| 3296 | + }elseif (isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']) {
|
|
| 3297 | 3297 | $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']); |
| 3298 | 3298 | } |
| 3299 | 3299 | ?> |
| 3300 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3301 | - <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory');?>
|
|
| 3300 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3301 | + <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory'); ?>
|
|
| 3302 | 3302 | <div class="gdcf-tooltip"> |
| 3303 | 3303 | <?php _e('Select the thousand separator.', 'geodirectory'); ?>
|
| 3304 | 3304 | </div> |
| 3305 | 3305 | </label> |
| 3306 | 3306 | <div class="gd-cf-input-wrap"> |
| 3307 | 3307 | <select name="extra[thousand_separator]" id="thousand_separator"> |
| 3308 | - <option value="comma" <?php selected(true, $value == 'comma');?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3309 | - <option value="slash" <?php selected(true, $value == "slash");?>><?php _e('\ (slash)', 'geodirectory'); ?></option>
|
|
| 3310 | - <option value="period" <?php selected(true, $value == 'period');?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3311 | - <option value="space" <?php selected(true, $value == 'space');?>><?php _e(' (space)', 'geodirectory'); ?></option>
|
|
| 3312 | - <option value="none" <?php selected(true, $value == 'none');?>><?php _e('(none)', 'geodirectory'); ?></option>
|
|
| 3308 | + <option value="comma" <?php selected(true, $value == 'comma'); ?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3309 | + <option value="slash" <?php selected(true, $value == "slash"); ?>><?php _e('\ (slash)', 'geodirectory'); ?></option>
|
|
| 3310 | + <option value="period" <?php selected(true, $value == 'period'); ?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3311 | + <option value="space" <?php selected(true, $value == 'space'); ?>><?php _e(' (space)', 'geodirectory'); ?></option>
|
|
| 3312 | + <option value="none" <?php selected(true, $value == 'none'); ?>><?php _e('(none)', 'geodirectory'); ?></option>
|
|
| 3313 | 3313 | </select> |
| 3314 | 3314 | </div> |
| 3315 | 3315 | </li> |
@@ -3320,20 +3320,20 @@ discard block |
||
| 3320 | 3320 | $value = ''; |
| 3321 | 3321 | if ($extra_fields && isset($extra_fields['decimal_separator'])) {
|
| 3322 | 3322 | $value = esc_attr($extra_fields['decimal_separator']); |
| 3323 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
|
|
| 3323 | + }elseif (isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']) {
|
|
| 3324 | 3324 | $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']); |
| 3325 | 3325 | } |
| 3326 | 3326 | ?> |
| 3327 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3328 | - <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory');?>
|
|
| 3327 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3328 | + <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory'); ?>
|
|
| 3329 | 3329 | <div class="gdcf-tooltip"> |
| 3330 | 3330 | <?php _e('Select the decimal separator.', 'geodirectory'); ?>
|
| 3331 | 3331 | </div> |
| 3332 | 3332 | </label> |
| 3333 | 3333 | <div class="gd-cf-input-wrap"> |
| 3334 | 3334 | <select name="extra[decimal_separator]" id="decimal_separator"> |
| 3335 | - <option value="period" <?php selected(true, $value == 'period');?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3336 | - <option value="comma" <?php selected(true, $value == "comma");?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3335 | + <option value="period" <?php selected(true, $value == 'period'); ?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3336 | + <option value="comma" <?php selected(true, $value == "comma"); ?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3337 | 3337 | </select> |
| 3338 | 3338 | </div> |
| 3339 | 3339 | </li> |
@@ -3343,20 +3343,20 @@ discard block |
||
| 3343 | 3343 | $value = ''; |
| 3344 | 3344 | if ($extra_fields && isset($extra_fields['decimal_display'])) {
|
| 3345 | 3345 | $value = esc_attr($extra_fields['decimal_display']); |
| 3346 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
|
|
| 3346 | + }elseif (isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']) {
|
|
| 3347 | 3347 | $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']); |
| 3348 | 3348 | } |
| 3349 | 3349 | ?> |
| 3350 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3351 | - <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory');?>
|
|
| 3350 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3351 | + <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory'); ?>
|
|
| 3352 | 3352 | <div class="gdcf-tooltip"> |
| 3353 | 3353 | <?php _e('Select how the decimal is displayed', 'geodirectory'); ?>
|
| 3354 | 3354 | </div> |
| 3355 | 3355 | </label> |
| 3356 | 3356 | <div class="gd-cf-input-wrap"> |
| 3357 | 3357 | <select name="extra[decimal_display]" id="decimal_display"> |
| 3358 | - <option value="if" <?php selected(true, $value == 'if');?>><?php _e('If used (not .00)', 'geodirectory'); ?></option>
|
|
| 3359 | - <option value="allways" <?php selected(true, $value == "allways");?>><?php _e('Always (.00)', 'geodirectory'); ?></option>
|
|
| 3358 | + <option value="if" <?php selected(true, $value == 'if'); ?>><?php _e('If used (not .00)', 'geodirectory'); ?></option>
|
|
| 3359 | + <option value="allways" <?php selected(true, $value == "allways"); ?>><?php _e('Always (.00)', 'geodirectory'); ?></option>
|
|
| 3360 | 3360 | </select> |
| 3361 | 3361 | </div> |
| 3362 | 3362 | </li> |
@@ -3366,12 +3366,12 @@ discard block |
||
| 3366 | 3366 | $value = ''; |
| 3367 | 3367 | if ($extra_fields && isset($extra_fields['currency_symbol'])) {
|
| 3368 | 3368 | $value = esc_attr($extra_fields['currency_symbol']); |
| 3369 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
|
|
| 3369 | + }elseif (isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']) {
|
|
| 3370 | 3370 | $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']); |
| 3371 | 3371 | } |
| 3372 | 3372 | ?> |
| 3373 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3374 | - <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory');?>
|
|
| 3373 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3374 | + <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory'); ?>
|
|
| 3375 | 3375 | <div class="gdcf-tooltip"> |
| 3376 | 3376 | <?php _e('Select the currency symbol.', 'geodirectory'); ?>
|
| 3377 | 3377 | </div> |
@@ -3387,20 +3387,20 @@ discard block |
||
| 3387 | 3387 | $value = ''; |
| 3388 | 3388 | if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
|
| 3389 | 3389 | $value = esc_attr($extra_fields['currency_symbol_placement']); |
| 3390 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
|
|
| 3390 | + }elseif (isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']) {
|
|
| 3391 | 3391 | $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']); |
| 3392 | 3392 | } |
| 3393 | 3393 | ?> |
| 3394 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3395 | - <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory');?>
|
|
| 3394 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3395 | + <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory'); ?>
|
|
| 3396 | 3396 | <div class="gdcf-tooltip"> |
| 3397 | 3397 | <?php _e('Select the currency symbol placement.', 'geodirectory'); ?>
|
| 3398 | 3398 | </div> |
| 3399 | 3399 | </label> |
| 3400 | 3400 | <div class="gd-cf-input-wrap"> |
| 3401 | 3401 | <select name="extra[currency_symbol_placement]" id="currency_symbol_placement"> |
| 3402 | - <option value="left" <?php selected(true, $value == 'left');?>><?php _e('Left', 'geodirectory'); ?></option>
|
|
| 3403 | - <option value="right" <?php selected(true, $value == "right");?>><?php _e('Right', 'geodirectory'); ?></option>
|
|
| 3402 | + <option value="left" <?php selected(true, $value == 'left'); ?>><?php _e('Left', 'geodirectory'); ?></option>
|
|
| 3403 | + <option value="right" <?php selected(true, $value == "right"); ?>><?php _e('Right', 'geodirectory'); ?></option>
|
|
| 3404 | 3404 | </select> |
| 3405 | 3405 | </div> |
| 3406 | 3406 | </li> |
@@ -3411,11 +3411,11 @@ discard block |
||
| 3411 | 3411 | $html = ob_get_clean(); |
| 3412 | 3412 | return $output.$html; |
| 3413 | 3413 | } |
| 3414 | -add_filter('geodir_cfa_extra_fields_text','geodir_cfa_extra_fields_text',10,4);
|
|
| 3414 | +add_filter('geodir_cfa_extra_fields_text', 'geodir_cfa_extra_fields_text', 10, 4);
|
|
| 3415 | 3415 | |
| 3416 | -function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
|
|
| 3416 | +function geodir_default_custom_fields($post_type = 'gd_place', $package_id = '') {
|
|
| 3417 | 3417 | $fields = array(); |
| 3418 | - $package = ($package_id=='') ? '' : array($package_id); |
|
| 3418 | + $package = ($package_id == '') ? '' : array($package_id); |
|
| 3419 | 3419 | |
| 3420 | 3420 | $fields[] = array('listing_type' => $post_type,
|
| 3421 | 3421 | 'data_type' => 'VARCHAR', |
@@ -3588,7 +3588,7 @@ discard block |
||
| 3588 | 3588 | return $fields; |
| 3589 | 3589 | } |
| 3590 | 3590 | |
| 3591 | -function geodir_currency_format_number($number='',$cf=''){
|
|
| 3591 | +function geodir_currency_format_number($number = '', $cf = '') {
|
|
| 3592 | 3592 | |
| 3593 | 3593 | $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : ''; |
| 3594 | 3594 | |
@@ -3597,35 +3597,35 @@ discard block |
||
| 3597 | 3597 | $decimal_display = !empty($cf['decimal_display']) ? $cf['decimal_display'] : (!empty($cs['decimal_display']) ? $cs['decimal_display'] : 'if'); |
| 3598 | 3598 | $decimalpoint = '.'; |
| 3599 | 3599 | |
| 3600 | - if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
|
|
| 3600 | + if (isset($cs['decimal_separator']) && $cs['decimal_separator'] == 'comma') {
|
|
| 3601 | 3601 | $decimalpoint = ','; |
| 3602 | 3602 | } |
| 3603 | 3603 | |
| 3604 | 3604 | $separator = ','; |
| 3605 | 3605 | |
| 3606 | - if(isset($cs['thousand_separator'])){
|
|
| 3607 | - if($cs['thousand_separator']=='comma'){$separator = ',';}
|
|
| 3608 | - if($cs['thousand_separator']=='slash'){$separator = '\\';}
|
|
| 3609 | - if($cs['thousand_separator']=='period'){$separator = '.';}
|
|
| 3610 | - if($cs['thousand_separator']=='space'){$separator = ' ';}
|
|
| 3611 | - if($cs['thousand_separator']=='none'){$separator = '';}
|
|
| 3606 | + if (isset($cs['thousand_separator'])) {
|
|
| 3607 | + if ($cs['thousand_separator'] == 'comma') {$separator = ','; }
|
|
| 3608 | + if ($cs['thousand_separator'] == 'slash') {$separator = '\\'; }
|
|
| 3609 | + if ($cs['thousand_separator'] == 'period') {$separator = '.'; }
|
|
| 3610 | + if ($cs['thousand_separator'] == 'space') {$separator = ' '; }
|
|
| 3611 | + if ($cs['thousand_separator'] == 'none') {$separator = ''; }
|
|
| 3612 | 3612 | } |
| 3613 | 3613 | |
| 3614 | 3614 | $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left'; |
| 3615 | 3615 | |
| 3616 | - if($decimals>0 && $decimal_display=='if'){
|
|
| 3617 | - if(is_int($number) || floor( $number ) == $number) |
|
| 3616 | + if ($decimals > 0 && $decimal_display == 'if') {
|
|
| 3617 | + if (is_int($number) || floor($number) == $number) |
|
| 3618 | 3618 | $decimals = 0; |
| 3619 | 3619 | } |
| 3620 | 3620 | |
| 3621 | - $number = number_format($number,$decimals,$decimalpoint,$separator); |
|
| 3621 | + $number = number_format($number, $decimals, $decimalpoint, $separator); |
|
| 3622 | 3622 | |
| 3623 | 3623 | |
| 3624 | 3624 | |
| 3625 | - if($currency_symbol_placement=='left'){
|
|
| 3626 | - $number = $symbol . $number; |
|
| 3627 | - }else{
|
|
| 3628 | - $number = $number . $symbol; |
|
| 3625 | + if ($currency_symbol_placement == 'left') {
|
|
| 3626 | + $number = $symbol.$number; |
|
| 3627 | + } else {
|
|
| 3628 | + $number = $number.$symbol; |
|
| 3629 | 3629 | } |
| 3630 | 3630 | |
| 3631 | 3631 | |
@@ -15,40 +15,40 @@ discard block |
||
| 15 | 15 | class geodir_listing_slider_widget extends WP_Widget |
| 16 | 16 | {
|
| 17 | 17 | |
| 18 | - /** |
|
| 18 | + /** |
|
| 19 | 19 | * Register the listing slider widget. |
| 20 | 20 | * |
| 21 | 21 | * @since 1.0.0 |
| 22 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 22 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 23 | 23 | */ |
| 24 | - public function __construct() {
|
|
| 25 | - $widget_ops = array('classname' => 'geodir_listing_slider_view', 'description' => __('GD > Listing Slider', 'geodirectory'));
|
|
| 26 | - parent::__construct( |
|
| 27 | - 'listing_slider_view', // Base ID |
|
| 28 | - __('GD > Listing Slider', 'geodirectory'), // Name
|
|
| 29 | - $widget_ops// Args |
|
| 30 | - ); |
|
| 31 | - } |
|
| 24 | + public function __construct() {
|
|
| 25 | + $widget_ops = array('classname' => 'geodir_listing_slider_view', 'description' => __('GD > Listing Slider', 'geodirectory'));
|
|
| 26 | + parent::__construct( |
|
| 27 | + 'listing_slider_view', // Base ID |
|
| 28 | + __('GD > Listing Slider', 'geodirectory'), // Name
|
|
| 29 | + $widget_ops// Args |
|
| 30 | + ); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Front-end display content for listing slider widget. |
| 35 | 35 | * |
| 36 | 36 | * @since 1.0.0 |
| 37 | - * @since 1.5.1 Declare function public. |
|
| 37 | + * @since 1.5.1 Declare function public. |
|
| 38 | 38 | * |
| 39 | 39 | * @param array $args Widget arguments. |
| 40 | 40 | * @param array $instance Saved values from database. |
| 41 | 41 | */ |
| 42 | - public function widget($args, $instance) |
|
| 43 | - {
|
|
| 44 | - geodir_listing_slider_widget_output($args, $instance); |
|
| 45 | - } |
|
| 42 | + public function widget($args, $instance) |
|
| 43 | + {
|
|
| 44 | + geodir_listing_slider_widget_output($args, $instance); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Sanitize listing slider widget form values as they are saved. |
| 49 | 49 | * |
| 50 | 50 | * @since 1.0.0 |
| 51 | - * @since 1.5.1 Declare function public. |
|
| 51 | + * @since 1.5.1 Declare function public. |
|
| 52 | 52 | * |
| 53 | 53 | * @param array $new_instance Values just sent to be saved. |
| 54 | 54 | * @param array $old_instance Previously saved values from database. |
@@ -56,101 +56,101 @@ discard block |
||
| 56 | 56 | * @return array Updated safe values to be saved. |
| 57 | 57 | */ |
| 58 | 58 | public function update($new_instance, $old_instance) |
| 59 | - {
|
|
| 60 | - //save the widget |
|
| 61 | - $instance = $old_instance; |
|
| 62 | - $instance['title'] = strip_tags($new_instance['title']); |
|
| 63 | - $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
| 64 | - $instance['category'] = strip_tags($new_instance['category']); |
|
| 65 | - $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
| 66 | - $instance['max_show'] = strip_tags($new_instance['max_show']); |
|
| 67 | - $instance['slide_width'] = strip_tags($new_instance['slide_width']); |
|
| 68 | - $instance['show_title'] = isset($new_instance['show_title']) ? $new_instance['show_title'] : ''; |
|
| 69 | - $instance['slideshow'] = isset($new_instance['slideshow']) ? $new_instance['slideshow'] : ''; |
|
| 70 | - $instance['animationLoop'] = isset($new_instance['animationLoop']) ? $new_instance['animationLoop'] : ''; |
|
| 71 | - $instance['directionNav'] = isset($new_instance['directionNav']) ? $new_instance['directionNav'] : ''; |
|
| 72 | - $instance['slideshowSpeed'] = $new_instance['slideshowSpeed']; |
|
| 73 | - $instance['animationSpeed'] = $new_instance['animationSpeed']; |
|
| 74 | - $instance['animation'] = $new_instance['animation']; |
|
| 75 | - $instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : ''; |
|
| 76 | - $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
| 77 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
| 78 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 79 | - else |
|
| 80 | - $instance['add_location_filter'] = '0'; |
|
| 81 | - |
|
| 82 | - return $instance; |
|
| 83 | - } |
|
| 59 | + {
|
|
| 60 | + //save the widget |
|
| 61 | + $instance = $old_instance; |
|
| 62 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 63 | + $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
| 64 | + $instance['category'] = strip_tags($new_instance['category']); |
|
| 65 | + $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
| 66 | + $instance['max_show'] = strip_tags($new_instance['max_show']); |
|
| 67 | + $instance['slide_width'] = strip_tags($new_instance['slide_width']); |
|
| 68 | + $instance['show_title'] = isset($new_instance['show_title']) ? $new_instance['show_title'] : ''; |
|
| 69 | + $instance['slideshow'] = isset($new_instance['slideshow']) ? $new_instance['slideshow'] : ''; |
|
| 70 | + $instance['animationLoop'] = isset($new_instance['animationLoop']) ? $new_instance['animationLoop'] : ''; |
|
| 71 | + $instance['directionNav'] = isset($new_instance['directionNav']) ? $new_instance['directionNav'] : ''; |
|
| 72 | + $instance['slideshowSpeed'] = $new_instance['slideshowSpeed']; |
|
| 73 | + $instance['animationSpeed'] = $new_instance['animationSpeed']; |
|
| 74 | + $instance['animation'] = $new_instance['animation']; |
|
| 75 | + $instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : ''; |
|
| 76 | + $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
| 77 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
| 78 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 79 | + else |
|
| 80 | + $instance['add_location_filter'] = '0'; |
|
| 81 | + |
|
| 82 | + return $instance; |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * Back-end listing slider widget settings form. |
| 87 | 87 | * |
| 88 | 88 | * @since 1.0.0 |
| 89 | - * @since 1.5.1 Declare function public. |
|
| 89 | + * @since 1.5.1 Declare function public. |
|
| 90 | 90 | * |
| 91 | 91 | * @param array $instance Previously saved values from database. |
| 92 | 92 | */ |
| 93 | 93 | public function form($instance) |
| 94 | - {
|
|
| 94 | + {
|
|
| 95 | 95 | |
| 96 | - //widgetform in backend |
|
| 97 | - $instance = wp_parse_args((array)$instance, |
|
| 98 | - array('title' => '',
|
|
| 99 | - 'post_type' => '', |
|
| 100 | - 'category' => '', |
|
| 101 | - 'post_number' => '5', |
|
| 102 | - 'max_show' => '1', |
|
| 103 | - 'slide_width' => '', |
|
| 104 | - 'show_title' => '', |
|
| 105 | - 'slideshow' => '', |
|
| 106 | - 'animationLoop' => '', |
|
| 107 | - 'directionNav' => '', |
|
| 108 | - 'slideshowSpeed' => 5000, |
|
| 109 | - 'animationSpeed' => 600, |
|
| 110 | - 'animation' => '', |
|
| 111 | - 'list_sort' => 'latest', |
|
| 112 | - 'show_featured_only' => '', |
|
| 113 | - 'add_location_filter' => '0', |
|
| 114 | - ) |
|
| 115 | - ); |
|
| 96 | + //widgetform in backend |
|
| 97 | + $instance = wp_parse_args((array)$instance, |
|
| 98 | + array('title' => '',
|
|
| 99 | + 'post_type' => '', |
|
| 100 | + 'category' => '', |
|
| 101 | + 'post_number' => '5', |
|
| 102 | + 'max_show' => '1', |
|
| 103 | + 'slide_width' => '', |
|
| 104 | + 'show_title' => '', |
|
| 105 | + 'slideshow' => '', |
|
| 106 | + 'animationLoop' => '', |
|
| 107 | + 'directionNav' => '', |
|
| 108 | + 'slideshowSpeed' => 5000, |
|
| 109 | + 'animationSpeed' => 600, |
|
| 110 | + 'animation' => '', |
|
| 111 | + 'list_sort' => 'latest', |
|
| 112 | + 'show_featured_only' => '', |
|
| 113 | + 'add_location_filter' => '0', |
|
| 114 | + ) |
|
| 115 | + ); |
|
| 116 | 116 | |
| 117 | - $title = strip_tags($instance['title']); |
|
| 117 | + $title = strip_tags($instance['title']); |
|
| 118 | 118 | |
| 119 | - $post_type = strip_tags($instance['post_type']); |
|
| 119 | + $post_type = strip_tags($instance['post_type']); |
|
| 120 | 120 | |
| 121 | - $category = strip_tags($instance['category']); |
|
| 121 | + $category = strip_tags($instance['category']); |
|
| 122 | 122 | |
| 123 | - $post_number = strip_tags($instance['post_number']); |
|
| 123 | + $post_number = strip_tags($instance['post_number']); |
|
| 124 | 124 | |
| 125 | - $max_show = strip_tags($instance['max_show']); |
|
| 125 | + $max_show = strip_tags($instance['max_show']); |
|
| 126 | 126 | |
| 127 | - $slide_width = strip_tags($instance['slide_width']); |
|
| 127 | + $slide_width = strip_tags($instance['slide_width']); |
|
| 128 | 128 | |
| 129 | - $show_title = $instance['show_title']; |
|
| 129 | + $show_title = $instance['show_title']; |
|
| 130 | 130 | |
| 131 | - $slideshow = $instance['slideshow']; |
|
| 131 | + $slideshow = $instance['slideshow']; |
|
| 132 | 132 | |
| 133 | - $animationLoop = $instance['animationLoop']; |
|
| 133 | + $animationLoop = $instance['animationLoop']; |
|
| 134 | 134 | |
| 135 | - $directionNav = $instance['directionNav']; |
|
| 135 | + $directionNav = $instance['directionNav']; |
|
| 136 | 136 | |
| 137 | - $slideshowSpeed = $instance['slideshowSpeed']; |
|
| 137 | + $slideshowSpeed = $instance['slideshowSpeed']; |
|
| 138 | 138 | |
| 139 | - $animationSpeed = $instance['animationSpeed']; |
|
| 139 | + $animationSpeed = $instance['animationSpeed']; |
|
| 140 | 140 | |
| 141 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
| 141 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
| 142 | 142 | |
| 143 | - $animation = $instance['animation']; |
|
| 144 | - $list_sort = $instance['list_sort']; |
|
| 145 | - $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
| 143 | + $animation = $instance['animation']; |
|
| 144 | + $list_sort = $instance['list_sort']; |
|
| 145 | + $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
| 146 | 146 | |
| 147 | - $sort_fields = array(); |
|
| 148 | - $sort_fields[] = array('field' => 'latest', 'label' => __('Latest', 'geodirectory'));
|
|
| 149 | - $sort_fields[] = array('field' => 'featured', 'label' => __('Featured', 'geodirectory'));
|
|
| 150 | - $sort_fields[] = array('field' => 'high_review', 'label' => __('Review', 'geodirectory'));
|
|
| 151 | - $sort_fields[] = array('field' => 'high_rating', 'label' => __('Rating', 'geodirectory'));
|
|
| 152 | - $sort_fields[] = array('field' => 'random', 'label' => __('Random', 'geodirectory'));
|
|
| 153 | - ?> |
|
| 147 | + $sort_fields = array(); |
|
| 148 | + $sort_fields[] = array('field' => 'latest', 'label' => __('Latest', 'geodirectory'));
|
|
| 149 | + $sort_fields[] = array('field' => 'featured', 'label' => __('Featured', 'geodirectory'));
|
|
| 150 | + $sort_fields[] = array('field' => 'high_review', 'label' => __('Review', 'geodirectory'));
|
|
| 151 | + $sort_fields[] = array('field' => 'high_rating', 'label' => __('Rating', 'geodirectory'));
|
|
| 152 | + $sort_fields[] = array('field' => 'random', 'label' => __('Random', 'geodirectory'));
|
|
| 153 | + ?> |
|
| 154 | 154 | |
| 155 | 155 | <p> |
| 156 | 156 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
|
@@ -174,9 +174,9 @@ discard block |
||
| 174 | 174 | <?php foreach ($postypes as $postypes_obj) { ?>
|
| 175 | 175 | |
| 176 | 176 | <option <?php if ($post_type == $postypes_obj) {
|
| 177 | - echo 'selected="selected"'; |
|
| 178 | - } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
|
|
| 179 | - echo ucfirst($extvalue[1]); ?></option> |
|
| 177 | + echo 'selected="selected"'; |
|
| 178 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
|
|
| 179 | + echo ucfirst($extvalue[1]); ?></option> |
|
| 180 | 180 | |
| 181 | 181 | <?php } ?> |
| 182 | 182 | |
@@ -190,20 +190,20 @@ discard block |
||
| 190 | 190 | for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?>
|
| 191 | 191 | |
| 192 | 192 | <?php |
| 193 | - $category_taxonomy = geodir_get_taxonomies('gd_place');
|
|
| 194 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
|
|
| 195 | - ?> |
|
| 193 | + $category_taxonomy = geodir_get_taxonomies('gd_place');
|
|
| 194 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
|
|
| 195 | + ?> |
|
| 196 | 196 | |
| 197 | 197 | <select class="widefat" id="<?php echo $this->get_field_id('category'); ?>"
|
| 198 | 198 | name="<?php echo $this->get_field_name('category'); ?>">
|
| 199 | 199 | <option <?php if ($category == '0') {
|
| 200 | - echo 'selected="selected"'; |
|
| 201 | - } ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
|
|
| 200 | + echo 'selected="selected"'; |
|
| 201 | + } ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
|
|
| 202 | 202 | <?php foreach ($categories as $category_obj) { ?>
|
| 203 | 203 | |
| 204 | 204 | <option <?php if ($category == $category_obj->term_id) {
|
| 205 | - echo 'selected="selected"'; |
|
| 206 | - } ?> |
|
| 205 | + echo 'selected="selected"'; |
|
| 206 | + } ?> |
|
| 207 | 207 | value="<?php echo $category_obj->term_id; ?>"><?php echo ucfirst($category_obj->name); ?></option> |
| 208 | 208 | |
| 209 | 209 | <?php } ?> |
@@ -256,12 +256,12 @@ discard block |
||
| 256 | 256 | <select class="widefat" id="<?php echo $this->get_field_id('animation'); ?>"
|
| 257 | 257 | name="<?php echo $this->get_field_name('animation'); ?>">
|
| 258 | 258 | <option <?php if ($animation == 'slide') {
|
| 259 | - echo 'selected="selected"'; |
|
| 260 | - } ?> value="slide">Slide |
|
| 259 | + echo 'selected="selected"'; |
|
| 260 | + } ?> value="slide">Slide |
|
| 261 | 261 | </option> |
| 262 | 262 | <option <?php if ($animation == 'fade') {
|
| 263 | - echo 'selected="selected"'; |
|
| 264 | - } ?> value="fade">Fade |
|
| 263 | + echo 'selected="selected"'; |
|
| 264 | + } ?> value="fade">Fade |
|
| 265 | 265 | </option> |
| 266 | 266 | </select> |
| 267 | 267 | </label> |
@@ -292,8 +292,8 @@ discard block |
||
| 292 | 292 | for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory');?>
|
| 293 | 293 | |
| 294 | 294 | <input type="checkbox" <?php if ($slideshow) {
|
| 295 | - echo 'checked="checked"'; |
|
| 296 | - } ?> id="<?php echo $this->get_field_id('slideshow'); ?>" value="1"
|
|
| 295 | + echo 'checked="checked"'; |
|
| 296 | + } ?> id="<?php echo $this->get_field_id('slideshow'); ?>" value="1"
|
|
| 297 | 297 | name="<?php echo $this->get_field_name('slideshow'); ?>"/>
|
| 298 | 298 | |
| 299 | 299 | </label> |
@@ -304,8 +304,8 @@ discard block |
||
| 304 | 304 | for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory');?>
|
| 305 | 305 | |
| 306 | 306 | <input type="checkbox" <?php if ($animationLoop) {
|
| 307 | - echo 'checked="checked"'; |
|
| 308 | - } ?> id="<?php echo $this->get_field_id('animationLoop'); ?>" value="1"
|
|
| 307 | + echo 'checked="checked"'; |
|
| 308 | + } ?> id="<?php echo $this->get_field_id('animationLoop'); ?>" value="1"
|
|
| 309 | 309 | name="<?php echo $this->get_field_name('animationLoop'); ?>"/>
|
| 310 | 310 | |
| 311 | 311 | </label> |
@@ -316,8 +316,8 @@ discard block |
||
| 316 | 316 | for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory');?>
|
| 317 | 317 | |
| 318 | 318 | <input type="checkbox" <?php if ($directionNav) {
|
| 319 | - echo 'checked="checked"'; |
|
| 320 | - } ?> id="<?php echo $this->get_field_id('directionNav'); ?>" value="1"
|
|
| 319 | + echo 'checked="checked"'; |
|
| 320 | + } ?> id="<?php echo $this->get_field_id('directionNav'); ?>" value="1"
|
|
| 321 | 321 | name="<?php echo $this->get_field_name('directionNav'); ?>"/>
|
| 322 | 322 | |
| 323 | 323 | </label> |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory');?>
|
| 330 | 330 | |
| 331 | 331 | <input type="checkbox" <?php if ($show_title) {
|
| 332 | - echo 'checked="checked"'; |
|
| 333 | - } ?> id="<?php echo $this->get_field_id('show_title'); ?>" value="1"
|
|
| 332 | + echo 'checked="checked"'; |
|
| 333 | + } ?> id="<?php echo $this->get_field_id('show_title'); ?>" value="1"
|
|
| 334 | 334 | name="<?php echo $this->get_field_name('show_title'); ?>"/>
|
| 335 | 335 | |
| 336 | 336 | </label> |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | |
| 379 | 379 | |
| 380 | 380 | <?php |
| 381 | - } |
|
| 381 | + } |
|
| 382 | 382 | } // class geodir_listing_slider_widget |
| 383 | 383 | |
| 384 | 384 | register_widget('geodir_listing_slider_widget'); |
| 385 | 385 | \ No newline at end of file |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | {
|
| 95 | 95 | |
| 96 | 96 | //widgetform in backend |
| 97 | - $instance = wp_parse_args((array)$instance, |
|
| 97 | + $instance = wp_parse_args((array) $instance, |
|
| 98 | 98 | array('title' => '',
|
| 99 | 99 | 'post_type' => '', |
| 100 | 100 | 'category' => '', |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | ?> |
| 154 | 154 | |
| 155 | 155 | <p> |
| 156 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
|
|
| 156 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
|
|
| 157 | 157 | |
| 158 | 158 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
|
| 159 | 159 | name="<?php echo $this->get_field_name('title'); ?>" type="text"
|
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | <p> |
| 165 | 165 | <label |
| 166 | - for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?>
|
|
| 166 | + for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?>
|
|
| 167 | 167 | |
| 168 | 168 | <?php $postypes = geodir_get_posttypes(); ?> |
| 169 | 169 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | <p> |
| 189 | 189 | <label |
| 190 | - for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?>
|
|
| 190 | + for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?>
|
|
| 191 | 191 | |
| 192 | 192 | <?php |
| 193 | 193 | $category_taxonomy = geodir_get_taxonomies('gd_place');
|
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | </p> |
| 225 | 225 | <p> |
| 226 | 226 | <label |
| 227 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts(total):', 'geodirectory');?>
|
|
| 227 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts(total):', 'geodirectory'); ?>
|
|
| 228 | 228 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>"
|
| 229 | 229 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text"
|
| 230 | 230 | value="<?php echo esc_attr($post_number); ?>"/> |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | <p> |
| 235 | 235 | <label |
| 236 | - for="<?php echo $this->get_field_id('max_show'); ?>"><?php _e('Number of posts(shown at one time, requires a slide width to be set):', 'geodirectory');?>
|
|
| 236 | + for="<?php echo $this->get_field_id('max_show'); ?>"><?php _e('Number of posts(shown at one time, requires a slide width to be set):', 'geodirectory'); ?>
|
|
| 237 | 237 | <input class="widefat" id="<?php echo $this->get_field_id('max_show'); ?>"
|
| 238 | 238 | name="<?php echo $this->get_field_name('max_show'); ?>" type="text"
|
| 239 | 239 | value="<?php echo esc_attr($max_show); ?>"/> |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | <p> |
| 244 | 244 | <label |
| 245 | - for="<?php echo $this->get_field_id('slide_width'); ?>"><?php _e('Slide width(leave blank unless showing more than one slide at a time, ex: 210):', 'geodirectory');?>
|
|
| 245 | + for="<?php echo $this->get_field_id('slide_width'); ?>"><?php _e('Slide width(leave blank unless showing more than one slide at a time, ex: 210):', 'geodirectory'); ?>
|
|
| 246 | 246 | <input class="widefat" id="<?php echo $this->get_field_id('slide_width'); ?>"
|
| 247 | 247 | name="<?php echo $this->get_field_name('slide_width'); ?>" type="text"
|
| 248 | 248 | value="<?php echo esc_attr($slide_width); ?>"/> |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | <p> |
| 253 | 253 | <label |
| 254 | - for="<?php echo $this->get_field_id('animation'); ?>"><?php _e('Animation:', 'geodirectory');?>
|
|
| 254 | + for="<?php echo $this->get_field_id('animation'); ?>"><?php _e('Animation:', 'geodirectory'); ?>
|
|
| 255 | 255 | |
| 256 | 256 | <select class="widefat" id="<?php echo $this->get_field_id('animation'); ?>"
|
| 257 | 257 | name="<?php echo $this->get_field_name('animation'); ?>">
|
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | <p> |
| 271 | 271 | <label |
| 272 | - for="<?php echo $this->get_field_id('slideshowSpeed'); ?>"><?php _e('Slide Show Speed: (milliseconds)', 'geodirectory');?>
|
|
| 272 | + for="<?php echo $this->get_field_id('slideshowSpeed'); ?>"><?php _e('Slide Show Speed: (milliseconds)', 'geodirectory'); ?>
|
|
| 273 | 273 | |
| 274 | 274 | <input class="widefat" id="<?php echo $this->get_field_id('slideshowSpeed'); ?>"
|
| 275 | 275 | name="<?php echo $this->get_field_name('slideshowSpeed'); ?>" type="text"
|
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | <p> |
| 281 | 281 | <label |
| 282 | - for="<?php echo $this->get_field_id('animationSpeed'); ?>"><?php _e('Animation Speed: (milliseconds)', 'geodirectory');?>
|
|
| 282 | + for="<?php echo $this->get_field_id('animationSpeed'); ?>"><?php _e('Animation Speed: (milliseconds)', 'geodirectory'); ?>
|
|
| 283 | 283 | |
| 284 | 284 | <input class="widefat" id="<?php echo $this->get_field_id('animationSpeed'); ?>"
|
| 285 | 285 | name="<?php echo $this->get_field_name('animationSpeed'); ?>" type="text"
|
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | <p> |
| 291 | 291 | <label |
| 292 | - for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory');?>
|
|
| 292 | + for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory'); ?>
|
|
| 293 | 293 | |
| 294 | 294 | <input type="checkbox" <?php if ($slideshow) {
|
| 295 | 295 | echo 'checked="checked"'; |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | <p> |
| 303 | 303 | <label |
| 304 | - for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory');?>
|
|
| 304 | + for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory'); ?>
|
|
| 305 | 305 | |
| 306 | 306 | <input type="checkbox" <?php if ($animationLoop) {
|
| 307 | 307 | echo 'checked="checked"'; |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | <p> |
| 315 | 315 | <label |
| 316 | - for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory');?>
|
|
| 316 | + for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory'); ?>
|
|
| 317 | 317 | |
| 318 | 318 | <input type="checkbox" <?php if ($directionNav) {
|
| 319 | 319 | echo 'checked="checked"'; |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | |
| 327 | 327 | <p> |
| 328 | 328 | <label |
| 329 | - for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory');?>
|
|
| 329 | + for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory'); ?>
|
|
| 330 | 330 | |
| 331 | 331 | <input type="checkbox" <?php if ($show_title) {
|
| 332 | 332 | echo 'checked="checked"'; |
@@ -345,9 +345,9 @@ discard block |
||
| 345 | 345 | </p> |
| 346 | 346 | <p> |
| 347 | 347 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
|
| 348 | - <?php _e('Enable Location Filter:', 'geodirectory');?>
|
|
| 348 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?>
|
|
| 349 | 349 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
|
| 350 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
|
|
| 350 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?>
|
|
| 351 | 351 | value="1"/> |
| 352 | 352 | </label> |
| 353 | 353 | </p> |
@@ -368,10 +368,10 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - <?php if(is_active_widget( false, false, $this->id_base, true )){ ?>
|
|
| 371 | + <?php if (is_active_widget(false, false, $this->id_base, true)) { ?>
|
|
| 372 | 372 | var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val();
|
| 373 | 373 | |
| 374 | - geodir_change_category_list(post_type, '<?php echo $category;?>'); |
|
| 374 | + geodir_change_category_list(post_type, '<?php echo $category; ?>'); |
|
| 375 | 375 | <?php } ?> |
| 376 | 376 | |
| 377 | 377 | </script> |
@@ -74,10 +74,11 @@ discard block |
||
| 74 | 74 | $instance['animation'] = $new_instance['animation']; |
| 75 | 75 | $instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : ''; |
| 76 | 76 | $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
| 77 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
| 78 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 79 | - else |
|
| 80 | - $instance['add_location_filter'] = '0'; |
|
| 77 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') { |
|
| 78 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 79 | + } else { |
|
| 80 | + $instance['add_location_filter'] = '0'; |
|
| 81 | + } |
|
| 81 | 82 | |
| 82 | 83 | return $instance; |
| 83 | 84 | } |
@@ -339,7 +340,10 @@ discard block |
||
| 339 | 340 | <label |
| 340 | 341 | for="<?php echo $this->get_field_id('show_featured_only'); ?>"><?php _e('Show only featured listings:', 'geodirectory'); ?>
|
| 341 | 342 | <input type="checkbox" id="<?php echo $this->get_field_id('show_featured_only'); ?>"
|
| 342 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?>
|
|
| 343 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) { |
|
| 344 | + echo 'checked="checked"'; |
|
| 345 | +} |
|
| 346 | +?> |
|
| 343 | 347 | value="1"/> |
| 344 | 348 | </label> |
| 345 | 349 | </p> |
@@ -347,7 +351,10 @@ discard block |
||
| 347 | 351 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
|
| 348 | 352 | <?php _e('Enable Location Filter:', 'geodirectory');?>
|
| 349 | 353 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
|
| 350 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
|
|
| 354 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) { |
|
| 355 | + echo 'checked="checked"'; |
|
| 356 | +} |
|
| 357 | +?> |
|
| 351 | 358 | value="1"/> |
| 352 | 359 | </label> |
| 353 | 360 | </p> |
@@ -1844,6 +1844,7 @@ discard block |
||
| 1844 | 1844 | * @since 1.0.0 |
| 1845 | 1845 | * @package GeoDirectory |
| 1846 | 1846 | * @global object $current_user Current user object. |
| 1847 | + * @param string|null $input |
|
| 1847 | 1848 | * @return array Returns parsed data as array. |
| 1848 | 1849 | */ |
| 1849 | 1850 | function geodir_str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\") |
@@ -2373,7 +2374,6 @@ discard block |
||
| 2373 | 2374 | * |
| 2374 | 2375 | * @since 1.6.9 |
| 2375 | 2376 | * |
| 2376 | - * @param array $settings Array of GeoDirectory general settings. |
|
| 2377 | 2377 | * @return array Array of settings. |
| 2378 | 2378 | */ |
| 2379 | 2379 | function geodir_uninstall_settings($general_settings) {
|
@@ -10,33 +10,33 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | add_action('admin_init', 'geodir_admin_init');
|
| 12 | 12 | if (!function_exists('geodir_admin_init')) {
|
| 13 | - /** |
|
| 14 | - * Adds GD setting pages in admin. |
|
| 15 | - * |
|
| 16 | - * @since 1.0.0 |
|
| 17 | - * @package GeoDirectory |
|
| 18 | - * @global string $current_tab The current settings tab name. |
|
| 19 | - */ |
|
| 20 | - function geodir_admin_init() |
|
| 21 | - {
|
|
| 22 | - |
|
| 23 | - if (is_admin()): |
|
| 24 | - global $current_tab; |
|
| 25 | - geodir_redirect_to_admin_panel_on_installed(); |
|
| 26 | - $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings'; |
|
| 27 | - if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests |
|
| 28 | - geodir_handle_option_form_submit($current_tab); // located in admin function.php |
|
| 29 | - /** |
|
| 30 | - * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area. |
|
| 31 | - * |
|
| 32 | - * @since 1.0.0 |
|
| 33 | - */ |
|
| 34 | - do_action('admin_panel_init');
|
|
| 35 | - add_action('geodir_admin_option_form', 'geodir_get_admin_option_form', 1);
|
|
| 36 | - |
|
| 37 | - |
|
| 38 | - endif; |
|
| 39 | - } |
|
| 13 | + /** |
|
| 14 | + * Adds GD setting pages in admin. |
|
| 15 | + * |
|
| 16 | + * @since 1.0.0 |
|
| 17 | + * @package GeoDirectory |
|
| 18 | + * @global string $current_tab The current settings tab name. |
|
| 19 | + */ |
|
| 20 | + function geodir_admin_init() |
|
| 21 | + {
|
|
| 22 | + |
|
| 23 | + if (is_admin()): |
|
| 24 | + global $current_tab; |
|
| 25 | + geodir_redirect_to_admin_panel_on_installed(); |
|
| 26 | + $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings'; |
|
| 27 | + if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests |
|
| 28 | + geodir_handle_option_form_submit($current_tab); // located in admin function.php |
|
| 29 | + /** |
|
| 30 | + * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area. |
|
| 31 | + * |
|
| 32 | + * @since 1.0.0 |
|
| 33 | + */ |
|
| 34 | + do_action('admin_panel_init');
|
|
| 35 | + add_action('geodir_admin_option_form', 'geodir_get_admin_option_form', 1);
|
|
| 36 | + |
|
| 37 | + |
|
| 38 | + endif; |
|
| 39 | + } |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | function geodir_redirect_to_admin_panel_on_installed() |
| 49 | 49 | {
|
| 50 | - if (get_option('geodir_installation_redirect', false)) {
|
|
| 51 | - delete_option('geodir_installation_redirect');
|
|
| 52 | - wp_redirect(admin_url('admin.php?page=geodirectory&installed=yes'));
|
|
| 53 | - } |
|
| 50 | + if (get_option('geodir_installation_redirect', false)) {
|
|
| 51 | + delete_option('geodir_installation_redirect');
|
|
| 52 | + wp_redirect(admin_url('admin.php?page=geodirectory&installed=yes'));
|
|
| 53 | + } |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | function geodir_get_admin_option_form($current_tab) |
| 64 | 64 | {
|
| 65 | - geodir_admin_option_form($current_tab);// defined in admin template tags.php |
|
| 65 | + geodir_admin_option_form($current_tab);// defined in admin template tags.php |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
@@ -86,24 +86,24 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | function geodir_conditional_admin_script_load() |
| 88 | 88 | {
|
| 89 | - global $pagenow; |
|
| 89 | + global $pagenow; |
|
| 90 | 90 | |
| 91 | 91 | // Get the current post type |
| 92 | 92 | $post_type = geodir_admin_current_post_type(); |
| 93 | 93 | $geodir_post_types = geodir_get_posttypes(); |
| 94 | 94 | |
| 95 | 95 | if ((isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') || (($pagenow == 'post.php' || $pagenow == 'post-new.php' || $pagenow == 'edit.php') && $post_type && in_array($post_type, $geodir_post_types)) || ($pagenow == 'edit-tags.php' || $pagenow == 'term.php' || $pagenow == 'edit-comments.php' || $pagenow == 'comment.php')) {
|
| 96 | - add_action('admin_enqueue_scripts', 'geodir_admin_scripts');
|
|
| 97 | - add_action('admin_enqueue_scripts', 'geodir_admin_styles');
|
|
| 98 | - add_action('admin_enqueue_scripts', 'geodir_admin_dequeue_scripts', 100);
|
|
| 96 | + add_action('admin_enqueue_scripts', 'geodir_admin_scripts');
|
|
| 97 | + add_action('admin_enqueue_scripts', 'geodir_admin_styles');
|
|
| 98 | + add_action('admin_enqueue_scripts', 'geodir_admin_dequeue_scripts', 100);
|
|
| 99 | 99 | |
| 100 | - // Disable VC editor for GD post types. |
|
| 101 | - if (class_exists('Vc_Role_Access_Controller')) {
|
|
| 102 | - add_filter( 'vc_role_access_with_post_types_can', '__return_false', 100 ); |
|
| 103 | - } |
|
| 104 | - } |
|
| 100 | + // Disable VC editor for GD post types. |
|
| 101 | + if (class_exists('Vc_Role_Access_Controller')) {
|
|
| 102 | + add_filter( 'vc_role_access_with_post_types_can', '__return_false', 100 ); |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - add_action('admin_enqueue_scripts', 'geodir_admin_styles_req');
|
|
| 106 | + add_action('admin_enqueue_scripts', 'geodir_admin_styles_req');
|
|
| 107 | 107 | |
| 108 | 108 | } |
| 109 | 109 | |
@@ -138,12 +138,12 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | function create_default_admin_main_nav() |
| 140 | 140 | {
|
| 141 | - add_filter('geodir_settings_tabs_array', 'geodir_default_admin_main_tabs', 1);
|
|
| 142 | - add_filter('geodir_settings_tabs_array', 'places_custom_fields_tab', 2);
|
|
| 143 | - add_filter('geodir_settings_tabs_array', 'geodir_compatibility_setting_tab', 90);
|
|
| 144 | - add_filter('geodir_settings_tabs_array', 'geodir_tools_setting_tab', 95);
|
|
| 145 | - add_filter('geodir_settings_tabs_array', 'geodir_extend_geodirectory_setting_tab', 100);
|
|
| 146 | - //add_filter('geodir_settings_tabs_array', 'geodir_hide_set_location_default',3);
|
|
| 141 | + add_filter('geodir_settings_tabs_array', 'geodir_default_admin_main_tabs', 1);
|
|
| 142 | + add_filter('geodir_settings_tabs_array', 'places_custom_fields_tab', 2);
|
|
| 143 | + add_filter('geodir_settings_tabs_array', 'geodir_compatibility_setting_tab', 90);
|
|
| 144 | + add_filter('geodir_settings_tabs_array', 'geodir_tools_setting_tab', 95);
|
|
| 145 | + add_filter('geodir_settings_tabs_array', 'geodir_extend_geodirectory_setting_tab', 100);
|
|
| 146 | + //add_filter('geodir_settings_tabs_array', 'geodir_hide_set_location_default',3);
|
|
| 147 | 147 | |
| 148 | 148 | } |
| 149 | 149 | |
@@ -156,16 +156,16 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | function geodir_admin_list_columns() |
| 158 | 158 | {
|
| 159 | - if ($post_types = geodir_get_posttypes()) {
|
|
| 159 | + if ($post_types = geodir_get_posttypes()) {
|
|
| 160 | 160 | |
| 161 | - foreach ($post_types as $post_type): |
|
| 162 | - add_filter("manage_edit-{$post_type}_columns", 'geodir_edit_post_columns', 100);
|
|
| 163 | - //Filter-Payment-Manager to show Package |
|
| 164 | - add_action("manage_{$post_type}_posts_custom_column", 'geodir_manage_post_columns', 10, 2);
|
|
| 161 | + foreach ($post_types as $post_type): |
|
| 162 | + add_filter("manage_edit-{$post_type}_columns", 'geodir_edit_post_columns', 100);
|
|
| 163 | + //Filter-Payment-Manager to show Package |
|
| 164 | + add_action("manage_{$post_type}_posts_custom_column", 'geodir_manage_post_columns', 10, 2);
|
|
| 165 | 165 | |
| 166 | - add_filter("manage_edit-{$post_type}_sortable_columns", 'geodir_post_sortable_columns');
|
|
| 167 | - endforeach; |
|
| 168 | - } |
|
| 166 | + add_filter("manage_edit-{$post_type}_sortable_columns", 'geodir_post_sortable_columns');
|
|
| 167 | + endforeach; |
|
| 168 | + } |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -178,15 +178,15 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | function geodir_default_admin_main_tabs($tabs) |
| 180 | 180 | {
|
| 181 | - return $tabs = array( |
|
| 182 | - 'general_settings' => array('label' => __('General', 'geodirectory')),
|
|
| 183 | - 'design_settings' => array('label' => __('Design', 'geodirectory')),
|
|
| 184 | - 'permalink_settings' => array('label' => __('Permalinks', 'geodirectory')),
|
|
| 185 | - 'title_meta_settings' => array('label' => __('Titles & Metas', 'geodirectory')),
|
|
| 186 | - 'notifications_settings' => array('label' => __('Notifications', 'geodirectory')),
|
|
| 187 | - 'default_location_settings' => array('label' => __('Set Default Location', 'geodirectory')),
|
|
| 188 | - |
|
| 189 | - ); |
|
| 181 | + return $tabs = array( |
|
| 182 | + 'general_settings' => array('label' => __('General', 'geodirectory')),
|
|
| 183 | + 'design_settings' => array('label' => __('Design', 'geodirectory')),
|
|
| 184 | + 'permalink_settings' => array('label' => __('Permalinks', 'geodirectory')),
|
|
| 185 | + 'title_meta_settings' => array('label' => __('Titles & Metas', 'geodirectory')),
|
|
| 186 | + 'notifications_settings' => array('label' => __('Notifications', 'geodirectory')),
|
|
| 187 | + 'default_location_settings' => array('label' => __('Set Default Location', 'geodirectory')),
|
|
| 188 | + |
|
| 189 | + ); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | add_action('do_meta_boxes', 'geodir_remove_image_box');
|
@@ -199,16 +199,16 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | function geodir_remove_image_box() |
| 201 | 201 | {
|
| 202 | - global $post; |
|
| 202 | + global $post; |
|
| 203 | 203 | |
| 204 | - $geodir_posttypes = geodir_get_posttypes(); |
|
| 204 | + $geodir_posttypes = geodir_get_posttypes(); |
|
| 205 | 205 | |
| 206 | - if (isset($post) && in_array($post->post_type, $geodir_posttypes)): |
|
| 206 | + if (isset($post) && in_array($post->post_type, $geodir_posttypes)): |
|
| 207 | 207 | |
| 208 | - remove_meta_box('postimagediv', $post->post_type, 'side');
|
|
| 209 | - remove_meta_box('revisionsdiv', $post->post_type, 'normal');
|
|
| 208 | + remove_meta_box('postimagediv', $post->post_type, 'side');
|
|
| 209 | + remove_meta_box('revisionsdiv', $post->post_type, 'normal');
|
|
| 210 | 210 | |
| 211 | - endif; |
|
| 211 | + endif; |
|
| 212 | 212 | |
| 213 | 213 | } |
| 214 | 214 | |
@@ -223,27 +223,27 @@ discard block |
||
| 223 | 223 | */ |
| 224 | 224 | function geodir_meta_box_add() |
| 225 | 225 | {
|
| 226 | - global $post; |
|
| 226 | + global $post; |
|
| 227 | 227 | |
| 228 | - $geodir_post_types = geodir_get_posttypes('array');
|
|
| 229 | - $geodir_posttypes = array_keys($geodir_post_types); |
|
| 228 | + $geodir_post_types = geodir_get_posttypes('array');
|
|
| 229 | + $geodir_posttypes = array_keys($geodir_post_types); |
|
| 230 | 230 | |
| 231 | - if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)): |
|
| 231 | + if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)): |
|
| 232 | 232 | |
| 233 | - $geodir_posttype = $post->post_type; |
|
| 234 | - $post_typename = __($geodir_post_types[$geodir_posttype]['labels']['singular_name'], 'geodirectory'); |
|
| 235 | - $post_typename = geodir_ucwords($post_typename); |
|
| 233 | + $geodir_posttype = $post->post_type; |
|
| 234 | + $post_typename = __($geodir_post_types[$geodir_posttype]['labels']['singular_name'], 'geodirectory'); |
|
| 235 | + $post_typename = geodir_ucwords($post_typename); |
|
| 236 | 236 | |
| 237 | - // Filter-Payment-Manager |
|
| 237 | + // Filter-Payment-Manager |
|
| 238 | 238 | |
| 239 | - add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
|
|
| 239 | + add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
|
|
| 240 | 240 | |
| 241 | - add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
|
|
| 241 | + add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
|
|
| 242 | 242 | |
| 243 | - // no need of this box as all fields moved to main information box |
|
| 244 | - //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
|
|
| 243 | + // no need of this box as all fields moved to main information box |
|
| 244 | + //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
|
|
| 245 | 245 | |
| 246 | - endif; |
|
| 246 | + endif; |
|
| 247 | 247 | |
| 248 | 248 | } |
| 249 | 249 | |
@@ -267,23 +267,23 @@ discard block |
||
| 267 | 267 | function geodir_hide_post_taxonomy_meta_boxes() |
| 268 | 268 | {
|
| 269 | 269 | |
| 270 | - $geodir_post_types = get_option('geodir_post_types');
|
|
| 270 | + $geodir_post_types = get_option('geodir_post_types');
|
|
| 271 | 271 | |
| 272 | - if (!empty($geodir_post_types)) {
|
|
| 273 | - foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info) {
|
|
| 272 | + if (!empty($geodir_post_types)) {
|
|
| 273 | + foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info) {
|
|
| 274 | 274 | |
| 275 | - $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
| 275 | + $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
| 276 | 276 | |
| 277 | - if(!empty($gd_taxonomy)) {
|
|
| 278 | - foreach ($gd_taxonomy as $tax) {
|
|
| 277 | + if(!empty($gd_taxonomy)) {
|
|
| 278 | + foreach ($gd_taxonomy as $tax) {
|
|
| 279 | 279 | |
| 280 | - remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
| 280 | + remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
| 281 | 281 | |
| 282 | - } |
|
| 283 | - } |
|
| 282 | + } |
|
| 283 | + } |
|
| 284 | 284 | |
| 285 | - } |
|
| 286 | - } |
|
| 285 | + } |
|
| 286 | + } |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | add_filter('geodir_add_listing_map_restrict', 'geodir_add_listing_map_restrict');
|
@@ -297,12 +297,12 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | function geodir_add_listing_map_restrict($map_restirct) |
| 299 | 299 | {
|
| 300 | - if (is_admin()) {
|
|
| 301 | - if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'default_location_settings') {
|
|
| 302 | - $map_restirct = false; |
|
| 303 | - } |
|
| 304 | - } |
|
| 305 | - return $map_restirct; |
|
| 300 | + if (is_admin()) {
|
|
| 301 | + if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'default_location_settings') {
|
|
| 302 | + $map_restirct = false; |
|
| 303 | + } |
|
| 304 | + } |
|
| 305 | + return $map_restirct; |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | |
@@ -321,16 +321,16 @@ discard block |
||
| 321 | 321 | function geodir_enable_editor_on_notifications($notification) |
| 322 | 322 | {
|
| 323 | 323 | |
| 324 | - if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
|
|
| 324 | + if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
|
|
| 325 | 325 | |
| 326 | - foreach ($notification as $key => $value) {
|
|
| 327 | - if ($value['type'] == 'textarea') |
|
| 328 | - $notification[$key]['type'] = 'editor'; |
|
| 329 | - } |
|
| 326 | + foreach ($notification as $key => $value) {
|
|
| 327 | + if ($value['type'] == 'textarea') |
|
| 328 | + $notification[$key]['type'] = 'editor'; |
|
| 329 | + } |
|
| 330 | 330 | |
| 331 | - } |
|
| 331 | + } |
|
| 332 | 332 | |
| 333 | - return $notification; |
|
| 333 | + return $notification; |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | |
@@ -347,16 +347,16 @@ discard block |
||
| 347 | 347 | function geodir_enable_editor_on_design_settings($design_setting) |
| 348 | 348 | {
|
| 349 | 349 | |
| 350 | - if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
|
|
| 350 | + if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
|
|
| 351 | 351 | |
| 352 | - foreach ($design_setting as $key => $value) {
|
|
| 353 | - if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') |
|
| 354 | - $design_setting[$key]['type'] = 'editor'; |
|
| 355 | - } |
|
| 352 | + foreach ($design_setting as $key => $value) {
|
|
| 353 | + if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') |
|
| 354 | + $design_setting[$key]['type'] = 'editor'; |
|
| 355 | + } |
|
| 356 | 356 | |
| 357 | - } |
|
| 357 | + } |
|
| 358 | 358 | |
| 359 | - return $design_setting; |
|
| 359 | + return $design_setting; |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /* ----------- START MANAGE CUSTOM FIELDS ---------------- */ |
@@ -364,15 +364,15 @@ discard block |
||
| 364 | 364 | add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom');
|
| 365 | 365 | |
| 366 | 366 | function geodir_manage_available_fields_predefined($sub_tab){
|
| 367 | - if($sub_tab=='custom_fields'){
|
|
| 368 | - geodir_custom_available_fields('predefined');
|
|
| 369 | - } |
|
| 367 | + if($sub_tab=='custom_fields'){
|
|
| 368 | + geodir_custom_available_fields('predefined');
|
|
| 369 | + } |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | function geodir_manage_available_fields_custom($sub_tab){
|
| 373 | - if($sub_tab=='custom_fields'){
|
|
| 374 | - geodir_custom_available_fields('custom');
|
|
| 375 | - } |
|
| 373 | + if($sub_tab=='custom_fields'){
|
|
| 374 | + geodir_custom_available_fields('custom');
|
|
| 375 | + } |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | |
@@ -391,16 +391,16 @@ discard block |
||
| 391 | 391 | function geodir_manage_available_fields($sub_tab) |
| 392 | 392 | {
|
| 393 | 393 | |
| 394 | - switch ($sub_tab) {
|
|
| 395 | - case 'custom_fields': |
|
| 396 | - geodir_custom_available_fields(); |
|
| 397 | - break; |
|
| 394 | + switch ($sub_tab) {
|
|
| 395 | + case 'custom_fields': |
|
| 396 | + geodir_custom_available_fields(); |
|
| 397 | + break; |
|
| 398 | 398 | |
| 399 | - case 'sorting_options': |
|
| 400 | - geodir_sorting_options_available_fields(); |
|
| 401 | - break; |
|
| 399 | + case 'sorting_options': |
|
| 400 | + geodir_sorting_options_available_fields(); |
|
| 401 | + break; |
|
| 402 | 402 | |
| 403 | - } |
|
| 403 | + } |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | |
@@ -416,16 +416,16 @@ discard block |
||
| 416 | 416 | function geodir_manage_selected_fields($sub_tab) |
| 417 | 417 | {
|
| 418 | 418 | |
| 419 | - switch ($sub_tab) {
|
|
| 420 | - case 'custom_fields': |
|
| 421 | - geodir_custom_selected_fields(); |
|
| 422 | - break; |
|
| 419 | + switch ($sub_tab) {
|
|
| 420 | + case 'custom_fields': |
|
| 421 | + geodir_custom_selected_fields(); |
|
| 422 | + break; |
|
| 423 | 423 | |
| 424 | - case 'sorting_options': |
|
| 425 | - geodir_sorting_options_selected_fields(); |
|
| 426 | - break; |
|
| 424 | + case 'sorting_options': |
|
| 425 | + geodir_sorting_options_selected_fields(); |
|
| 426 | + break; |
|
| 427 | 427 | |
| 428 | - } |
|
| 428 | + } |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | /** |
@@ -437,52 +437,52 @@ discard block |
||
| 437 | 437 | */ |
| 438 | 438 | function geodir_sorting_options_available_fields() |
| 439 | 439 | {
|
| 440 | - global $wpdb; |
|
| 441 | - $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 442 | - ?> |
|
| 440 | + global $wpdb; |
|
| 441 | + $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 442 | + ?> |
|
| 443 | 443 | <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
| 444 | 444 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
| 445 | 445 | <ul> |
| 446 | 446 | <?php |
| 447 | - $sort_options = geodir_get_custom_sort_options($listing_type); |
|
| 447 | + $sort_options = geodir_get_custom_sort_options($listing_type); |
|
| 448 | 448 | |
| 449 | - foreach ($sort_options as $key => $val) {
|
|
| 450 | - $val = stripslashes_deep($val); // strip slashes |
|
| 451 | - |
|
| 452 | - $check_html_variable = $wpdb->get_var( |
|
| 453 | - $wpdb->prepare( |
|
| 454 | - "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
| 455 | - array($val['htmlvar_name'], $listing_type, $val['field_type']) |
|
| 456 | - ) |
|
| 457 | - ); |
|
| 449 | + foreach ($sort_options as $key => $val) {
|
|
| 450 | + $val = stripslashes_deep($val); // strip slashes |
|
| 451 | + |
|
| 452 | + $check_html_variable = $wpdb->get_var( |
|
| 453 | + $wpdb->prepare( |
|
| 454 | + "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
| 455 | + array($val['htmlvar_name'], $listing_type, $val['field_type']) |
|
| 456 | + ) |
|
| 457 | + ); |
|
| 458 | 458 | |
| 459 | - $display = $check_html_variable ? ' style="display:none;"' : ''; |
|
| 460 | - ?> |
|
| 459 | + $display = $check_html_variable ? ' style="display:none;"' : ''; |
|
| 460 | + ?> |
|
| 461 | 461 | |
| 462 | 462 | <li class="gd-cf-tooltip-wrap" <?php echo $display;?>> |
| 463 | 463 | <?php |
| 464 | - if(isset($val['description']) && $val['description']){
|
|
| 465 | - echo '<div class="gdcf-tooltip">'.$val['description'].'</div>'; |
|
| 466 | - }?> |
|
| 464 | + if(isset($val['description']) && $val['description']){
|
|
| 465 | + echo '<div class="gdcf-tooltip">'.$val['description'].'</div>'; |
|
| 466 | + }?> |
|
| 467 | 467 | |
| 468 | 468 | <a id="gd-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>" data-field-type-key="<?php echo $val['htmlvar_name'];?>" data-field-type="<?php echo $val['field_type'];?>" |
| 469 | 469 | title="<?php echo $val['site_title'];?>" |
| 470 | 470 | class="gd-draggable-form-items gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);"> |
| 471 | 471 | <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
|
| 472 | - echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>'; |
|
| 473 | - }elseif(isset($val['field_icon']) && $val['field_icon'] ){
|
|
| 474 | - echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
|
|
| 475 | - }else{
|
|
| 476 | - echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 477 | - }?> |
|
| 472 | + echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>'; |
|
| 473 | + }elseif(isset($val['field_icon']) && $val['field_icon'] ){
|
|
| 474 | + echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
|
|
| 475 | + }else{
|
|
| 476 | + echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 477 | + }?> |
|
| 478 | 478 | <?php echo $val['site_title'];?> |
| 479 | 479 | </a> |
| 480 | 480 | </li> |
| 481 | 481 | |
| 482 | 482 | |
| 483 | 483 | <?php |
| 484 | - } |
|
| 485 | - ?> |
|
| 484 | + } |
|
| 485 | + ?> |
|
| 486 | 486 | </ul> |
| 487 | 487 | <?php |
| 488 | 488 | } |
@@ -496,28 +496,28 @@ discard block |
||
| 496 | 496 | */ |
| 497 | 497 | function geodir_sorting_options_selected_fields() |
| 498 | 498 | {
|
| 499 | - $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 500 | - ?> |
|
| 499 | + $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 500 | + ?> |
|
| 501 | 501 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
| 502 | 502 | <ul class="core"> |
| 503 | 503 | <?php |
| 504 | - global $wpdb; |
|
| 504 | + global $wpdb; |
|
| 505 | 505 | |
| 506 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
|
|
| 506 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
|
|
| 507 | 507 | |
| 508 | - if (!empty($fields)) {
|
|
| 509 | - foreach ($fields as $field) {
|
|
| 510 | - //$result_str = $field->id; |
|
| 511 | - $result_str = $field; |
|
| 512 | - $field_type = $field->field_type; |
|
| 513 | - $field_ins_upd = 'display'; |
|
| 508 | + if (!empty($fields)) {
|
|
| 509 | + foreach ($fields as $field) {
|
|
| 510 | + //$result_str = $field->id; |
|
| 511 | + $result_str = $field; |
|
| 512 | + $field_type = $field->field_type; |
|
| 513 | + $field_ins_upd = 'display'; |
|
| 514 | 514 | |
| 515 | - $default = false; |
|
| 515 | + $default = false; |
|
| 516 | 516 | |
| 517 | - geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd, $default); |
|
| 518 | - } |
|
| 519 | - } |
|
| 520 | - ?> |
|
| 517 | + geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd, $default); |
|
| 518 | + } |
|
| 519 | + } |
|
| 520 | + ?> |
|
| 521 | 521 | </ul> |
| 522 | 522 | <?php |
| 523 | 523 | } |
@@ -530,12 +530,12 @@ discard block |
||
| 530 | 530 | */ |
| 531 | 531 | function geodir_custom_fields_custom($post_type=''){
|
| 532 | 532 | |
| 533 | - $custom_fields = array(); |
|
| 533 | + $custom_fields = array(); |
|
| 534 | 534 | |
| 535 | - /** |
|
| 536 | - * @see `geodir_custom_fields` |
|
| 537 | - */ |
|
| 538 | - return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
|
|
| 535 | + /** |
|
| 536 | + * @see `geodir_custom_fields` |
|
| 537 | + */ |
|
| 538 | + return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
|
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | |
@@ -548,140 +548,140 @@ discard block |
||
| 548 | 548 | */ |
| 549 | 549 | function geodir_custom_fields($post_type=''){
|
| 550 | 550 | |
| 551 | - $custom_fields = array( |
|
| 552 | - 'text' => array( |
|
| 553 | - 'field_type' => 'text', |
|
| 554 | - 'class' => 'gd-text', |
|
| 555 | - 'icon' => 'fa fa-minus', |
|
| 556 | - 'name' => __('Text', 'geodirectory'),
|
|
| 557 | - 'description' => __('Add any sort of text field, text or numbers', 'geodirectory')
|
|
| 558 | - ), |
|
| 559 | - 'datepicker' => array( |
|
| 560 | - 'field_type' => 'datepicker', |
|
| 561 | - 'class' => 'gd-datepicker', |
|
| 562 | - 'icon' => 'fa fa-calendar', |
|
| 563 | - 'name' => __('Date', 'geodirectory'),
|
|
| 564 | - 'description' => __('Adds a date picker.', 'geodirectory')
|
|
| 565 | - ), |
|
| 566 | - 'textarea' => array( |
|
| 567 | - 'field_type' => 'textarea', |
|
| 568 | - 'class' => 'gd-textarea', |
|
| 569 | - 'icon' => 'fa fa-bars', |
|
| 570 | - 'name' => __('Textarea', 'geodirectory'),
|
|
| 571 | - 'description' => __('Adds a textarea', 'geodirectory')
|
|
| 572 | - ), |
|
| 573 | - 'time' => array( |
|
| 574 | - 'field_type' => 'time', |
|
| 575 | - 'class' => 'gd-time', |
|
| 576 | - 'icon' => 'fa fa-clock-o', |
|
| 577 | - 'name' => __('Time', 'geodirectory'),
|
|
| 578 | - 'description' => __('Adds a time picker', 'geodirectory')
|
|
| 579 | - ), |
|
| 580 | - 'checkbox' => array( |
|
| 581 | - 'field_type' => 'checkbox', |
|
| 582 | - 'class' => 'gd-checkbox', |
|
| 583 | - 'icon' => 'fa fa-check-square-o', |
|
| 584 | - 'name' => __('Checkbox', 'geodirectory'),
|
|
| 585 | - 'description' => __('Adds a checkbox', 'geodirectory')
|
|
| 586 | - ), |
|
| 587 | - 'phone' => array( |
|
| 588 | - 'field_type' => 'phone', |
|
| 589 | - 'class' => 'gd-phone', |
|
| 590 | - 'icon' => 'fa fa-phone', |
|
| 591 | - 'name' => __('Phone', 'geodirectory'),
|
|
| 592 | - 'description' => __('Adds a phone input', 'geodirectory')
|
|
| 593 | - ), |
|
| 594 | - 'radio' => array( |
|
| 595 | - 'field_type' => 'radio', |
|
| 596 | - 'class' => 'gd-radio', |
|
| 597 | - 'icon' => 'fa fa-dot-circle-o', |
|
| 598 | - 'name' => __('Radio', 'geodirectory'),
|
|
| 599 | - 'description' => __('Adds a radio input', 'geodirectory')
|
|
| 600 | - ), |
|
| 601 | - 'email' => array( |
|
| 602 | - 'field_type' => 'email', |
|
| 603 | - 'class' => 'gd-email', |
|
| 604 | - 'icon' => 'fa fa-envelope-o', |
|
| 605 | - 'name' => __('Email', 'geodirectory'),
|
|
| 606 | - 'description' => __('Adds a email input', 'geodirectory')
|
|
| 607 | - ), |
|
| 608 | - 'select' => array( |
|
| 609 | - 'field_type' => 'select', |
|
| 610 | - 'class' => 'gd-select', |
|
| 611 | - 'icon' => 'fa fa-caret-square-o-down', |
|
| 612 | - 'name' => __('Select', 'geodirectory'),
|
|
| 613 | - 'description' => __('Adds a select input', 'geodirectory')
|
|
| 614 | - ), |
|
| 615 | - 'multiselect' => array( |
|
| 616 | - 'field_type' => 'multiselect', |
|
| 617 | - 'class' => 'gd-multiselect', |
|
| 618 | - 'icon' => 'fa fa-caret-square-o-down', |
|
| 619 | - 'name' => __('Multi Select', 'geodirectory'),
|
|
| 620 | - 'description' => __('Adds a multiselect input', 'geodirectory')
|
|
| 621 | - ), |
|
| 622 | - 'url' => array( |
|
| 623 | - 'field_type' => 'url', |
|
| 624 | - 'class' => 'gd-url', |
|
| 625 | - 'icon' => 'fa fa-link', |
|
| 626 | - 'name' => __('URL', 'geodirectory'),
|
|
| 627 | - 'description' => __('Adds a url input', 'geodirectory')
|
|
| 628 | - ), |
|
| 629 | - 'html' => array( |
|
| 630 | - 'field_type' => 'html', |
|
| 631 | - 'class' => 'gd-html', |
|
| 632 | - 'icon' => 'fa fa-code', |
|
| 633 | - 'name' => __('HTML', 'geodirectory'),
|
|
| 634 | - 'description' => __('Adds a html input textarea', 'geodirectory')
|
|
| 635 | - ), |
|
| 636 | - 'file' => array( |
|
| 637 | - 'field_type' => 'file', |
|
| 638 | - 'class' => 'gd-file', |
|
| 639 | - 'icon' => 'fa fa-file', |
|
| 640 | - 'name' => __('File Upload', 'geodirectory'),
|
|
| 641 | - 'description' => __('Adds a file input', 'geodirectory')
|
|
| 642 | - ) |
|
| 643 | - ); |
|
| 644 | - |
|
| 645 | - /** |
|
| 646 | - * Filter the custom fields array to be able to add or remove items. |
|
| 647 | - * |
|
| 648 | - * @since 1.6.6 |
|
| 649 | - * |
|
| 650 | - * @param array $custom_fields {
|
|
| 651 | - * The custom fields array to be filtered. |
|
| 652 | - * |
|
| 653 | - * @type string $field_type The type of field, eg: text, datepicker, textarea, time, checkbox, phone, radio, email, select, multiselect, url, html, file. |
|
| 654 | - * @type string $class The class for the field in backend. |
|
| 655 | - * @type string $icon Can be font-awesome class name or icon image url. |
|
| 656 | - * @type string $name The name of the field. |
|
| 657 | - * @type string $description A short description about the field. |
|
| 658 | - * @type array $defaults {
|
|
| 659 | - * Optional. Used to set the default value of the field. |
|
| 660 | - * |
|
| 661 | - * @type string data_type The SQL data type for the field. VARCHAR, TEXT, TIME, TINYINT, INT, FLOAT, DATE |
|
| 662 | - * @type int decimal_point limit if using FLOAT data_type |
|
| 663 | - * @type string admin_title The admin title for the field. |
|
| 664 | - * @type string site_title This will be the title for the field on the frontend. |
|
| 665 | - * @type string admin_desc This will be shown below the field on the add listing form. |
|
| 666 | - * @type string htmlvar_name This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters. |
|
| 667 | - * @type bool is_active If false the field will not be displayed anywhere. |
|
| 668 | - * @type bool for_admin_use If true then only site admin can see and edit this field. |
|
| 669 | - * @type string default_value The default value for the input on the add listing page. |
|
| 670 | - * @type string show_in The locations to show in. [detail],[moreinfo],[listing],[owntab],[mapbubble] |
|
| 671 | - * @type bool is_required If true the field will be required on the add listing page. |
|
| 672 | - * @type string option_values The option values for select and multiselect only |
|
| 673 | - * @type string validation_pattern HTML5 validation pattern (text input only by default). |
|
| 674 | - * @type string validation_msg HTML5 validation message (text input only by default). |
|
| 675 | - * @type string required_msg Required warning message. |
|
| 676 | - * @type string field_icon Icon url or font awesome class. |
|
| 677 | - * @type string css_class Field custom css class for field custom style. |
|
| 678 | - * @type bool cat_sort If true the field will appear in the category sort options, if false the field will be hidden, leave blank to show option. |
|
| 679 | - * @type bool cat_sort If true the field will appear in the advanced search sort options, if false the field will be hidden, leave blank to show option. (advanced search addon required) |
|
| 680 | - * } |
|
| 681 | - * } |
|
| 682 | - * @param string $post_type The post type requested. |
|
| 683 | - */ |
|
| 684 | - return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
|
|
| 551 | + $custom_fields = array( |
|
| 552 | + 'text' => array( |
|
| 553 | + 'field_type' => 'text', |
|
| 554 | + 'class' => 'gd-text', |
|
| 555 | + 'icon' => 'fa fa-minus', |
|
| 556 | + 'name' => __('Text', 'geodirectory'),
|
|
| 557 | + 'description' => __('Add any sort of text field, text or numbers', 'geodirectory')
|
|
| 558 | + ), |
|
| 559 | + 'datepicker' => array( |
|
| 560 | + 'field_type' => 'datepicker', |
|
| 561 | + 'class' => 'gd-datepicker', |
|
| 562 | + 'icon' => 'fa fa-calendar', |
|
| 563 | + 'name' => __('Date', 'geodirectory'),
|
|
| 564 | + 'description' => __('Adds a date picker.', 'geodirectory')
|
|
| 565 | + ), |
|
| 566 | + 'textarea' => array( |
|
| 567 | + 'field_type' => 'textarea', |
|
| 568 | + 'class' => 'gd-textarea', |
|
| 569 | + 'icon' => 'fa fa-bars', |
|
| 570 | + 'name' => __('Textarea', 'geodirectory'),
|
|
| 571 | + 'description' => __('Adds a textarea', 'geodirectory')
|
|
| 572 | + ), |
|
| 573 | + 'time' => array( |
|
| 574 | + 'field_type' => 'time', |
|
| 575 | + 'class' => 'gd-time', |
|
| 576 | + 'icon' => 'fa fa-clock-o', |
|
| 577 | + 'name' => __('Time', 'geodirectory'),
|
|
| 578 | + 'description' => __('Adds a time picker', 'geodirectory')
|
|
| 579 | + ), |
|
| 580 | + 'checkbox' => array( |
|
| 581 | + 'field_type' => 'checkbox', |
|
| 582 | + 'class' => 'gd-checkbox', |
|
| 583 | + 'icon' => 'fa fa-check-square-o', |
|
| 584 | + 'name' => __('Checkbox', 'geodirectory'),
|
|
| 585 | + 'description' => __('Adds a checkbox', 'geodirectory')
|
|
| 586 | + ), |
|
| 587 | + 'phone' => array( |
|
| 588 | + 'field_type' => 'phone', |
|
| 589 | + 'class' => 'gd-phone', |
|
| 590 | + 'icon' => 'fa fa-phone', |
|
| 591 | + 'name' => __('Phone', 'geodirectory'),
|
|
| 592 | + 'description' => __('Adds a phone input', 'geodirectory')
|
|
| 593 | + ), |
|
| 594 | + 'radio' => array( |
|
| 595 | + 'field_type' => 'radio', |
|
| 596 | + 'class' => 'gd-radio', |
|
| 597 | + 'icon' => 'fa fa-dot-circle-o', |
|
| 598 | + 'name' => __('Radio', 'geodirectory'),
|
|
| 599 | + 'description' => __('Adds a radio input', 'geodirectory')
|
|
| 600 | + ), |
|
| 601 | + 'email' => array( |
|
| 602 | + 'field_type' => 'email', |
|
| 603 | + 'class' => 'gd-email', |
|
| 604 | + 'icon' => 'fa fa-envelope-o', |
|
| 605 | + 'name' => __('Email', 'geodirectory'),
|
|
| 606 | + 'description' => __('Adds a email input', 'geodirectory')
|
|
| 607 | + ), |
|
| 608 | + 'select' => array( |
|
| 609 | + 'field_type' => 'select', |
|
| 610 | + 'class' => 'gd-select', |
|
| 611 | + 'icon' => 'fa fa-caret-square-o-down', |
|
| 612 | + 'name' => __('Select', 'geodirectory'),
|
|
| 613 | + 'description' => __('Adds a select input', 'geodirectory')
|
|
| 614 | + ), |
|
| 615 | + 'multiselect' => array( |
|
| 616 | + 'field_type' => 'multiselect', |
|
| 617 | + 'class' => 'gd-multiselect', |
|
| 618 | + 'icon' => 'fa fa-caret-square-o-down', |
|
| 619 | + 'name' => __('Multi Select', 'geodirectory'),
|
|
| 620 | + 'description' => __('Adds a multiselect input', 'geodirectory')
|
|
| 621 | + ), |
|
| 622 | + 'url' => array( |
|
| 623 | + 'field_type' => 'url', |
|
| 624 | + 'class' => 'gd-url', |
|
| 625 | + 'icon' => 'fa fa-link', |
|
| 626 | + 'name' => __('URL', 'geodirectory'),
|
|
| 627 | + 'description' => __('Adds a url input', 'geodirectory')
|
|
| 628 | + ), |
|
| 629 | + 'html' => array( |
|
| 630 | + 'field_type' => 'html', |
|
| 631 | + 'class' => 'gd-html', |
|
| 632 | + 'icon' => 'fa fa-code', |
|
| 633 | + 'name' => __('HTML', 'geodirectory'),
|
|
| 634 | + 'description' => __('Adds a html input textarea', 'geodirectory')
|
|
| 635 | + ), |
|
| 636 | + 'file' => array( |
|
| 637 | + 'field_type' => 'file', |
|
| 638 | + 'class' => 'gd-file', |
|
| 639 | + 'icon' => 'fa fa-file', |
|
| 640 | + 'name' => __('File Upload', 'geodirectory'),
|
|
| 641 | + 'description' => __('Adds a file input', 'geodirectory')
|
|
| 642 | + ) |
|
| 643 | + ); |
|
| 644 | + |
|
| 645 | + /** |
|
| 646 | + * Filter the custom fields array to be able to add or remove items. |
|
| 647 | + * |
|
| 648 | + * @since 1.6.6 |
|
| 649 | + * |
|
| 650 | + * @param array $custom_fields {
|
|
| 651 | + * The custom fields array to be filtered. |
|
| 652 | + * |
|
| 653 | + * @type string $field_type The type of field, eg: text, datepicker, textarea, time, checkbox, phone, radio, email, select, multiselect, url, html, file. |
|
| 654 | + * @type string $class The class for the field in backend. |
|
| 655 | + * @type string $icon Can be font-awesome class name or icon image url. |
|
| 656 | + * @type string $name The name of the field. |
|
| 657 | + * @type string $description A short description about the field. |
|
| 658 | + * @type array $defaults {
|
|
| 659 | + * Optional. Used to set the default value of the field. |
|
| 660 | + * |
|
| 661 | + * @type string data_type The SQL data type for the field. VARCHAR, TEXT, TIME, TINYINT, INT, FLOAT, DATE |
|
| 662 | + * @type int decimal_point limit if using FLOAT data_type |
|
| 663 | + * @type string admin_title The admin title for the field. |
|
| 664 | + * @type string site_title This will be the title for the field on the frontend. |
|
| 665 | + * @type string admin_desc This will be shown below the field on the add listing form. |
|
| 666 | + * @type string htmlvar_name This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters. |
|
| 667 | + * @type bool is_active If false the field will not be displayed anywhere. |
|
| 668 | + * @type bool for_admin_use If true then only site admin can see and edit this field. |
|
| 669 | + * @type string default_value The default value for the input on the add listing page. |
|
| 670 | + * @type string show_in The locations to show in. [detail],[moreinfo],[listing],[owntab],[mapbubble] |
|
| 671 | + * @type bool is_required If true the field will be required on the add listing page. |
|
| 672 | + * @type string option_values The option values for select and multiselect only |
|
| 673 | + * @type string validation_pattern HTML5 validation pattern (text input only by default). |
|
| 674 | + * @type string validation_msg HTML5 validation message (text input only by default). |
|
| 675 | + * @type string required_msg Required warning message. |
|
| 676 | + * @type string field_icon Icon url or font awesome class. |
|
| 677 | + * @type string css_class Field custom css class for field custom style. |
|
| 678 | + * @type bool cat_sort If true the field will appear in the category sort options, if false the field will be hidden, leave blank to show option. |
|
| 679 | + * @type bool cat_sort If true the field will appear in the advanced search sort options, if false the field will be hidden, leave blank to show option. (advanced search addon required) |
|
| 680 | + * } |
|
| 681 | + * } |
|
| 682 | + * @param string $post_type The post type requested. |
|
| 683 | + */ |
|
| 684 | + return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
|
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | /** |
@@ -694,19 +694,19 @@ discard block |
||
| 694 | 694 | */ |
| 695 | 695 | function geodir_custom_available_fields($type='') |
| 696 | 696 | {
|
| 697 | - $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 698 | - ?> |
|
| 697 | + $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 698 | + ?> |
|
| 699 | 699 | <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
| 700 | 700 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" /> |
| 701 | 701 | |
| 702 | 702 | <?php |
| 703 | - if($type=='predefined'){
|
|
| 704 | - $cfs = geodir_custom_fields_predefined($listing_type); |
|
| 705 | - }elseif($type=='custom'){
|
|
| 706 | - $cfs = geodir_custom_fields_custom($listing_type); |
|
| 707 | - }else{
|
|
| 708 | - $cfs = geodir_custom_fields($listing_type); |
|
| 709 | - ?> |
|
| 703 | + if($type=='predefined'){
|
|
| 704 | + $cfs = geodir_custom_fields_predefined($listing_type); |
|
| 705 | + }elseif($type=='custom'){
|
|
| 706 | + $cfs = geodir_custom_fields_custom($listing_type); |
|
| 707 | + }else{
|
|
| 708 | + $cfs = geodir_custom_fields($listing_type); |
|
| 709 | + ?> |
|
| 710 | 710 | <ul class="full gd-cf-tooltip-wrap"> |
| 711 | 711 | <li> |
| 712 | 712 | <div class="gdcf-tooltip"> |
@@ -727,18 +727,18 @@ discard block |
||
| 727 | 727 | </ul> |
| 728 | 728 | |
| 729 | 729 | <?php |
| 730 | - } |
|
| 730 | + } |
|
| 731 | 731 | |
| 732 | - if(!empty($cfs)) {
|
|
| 733 | - echo '<ul>'; |
|
| 734 | - foreach ( $cfs as $id => $cf ) {
|
|
| 735 | - ?> |
|
| 732 | + if(!empty($cfs)) {
|
|
| 733 | + echo '<ul>'; |
|
| 734 | + foreach ( $cfs as $id => $cf ) {
|
|
| 735 | + ?> |
|
| 736 | 736 | |
| 737 | 737 | <li class="gd-cf-tooltip-wrap"> |
| 738 | 738 | <?php |
| 739 | - if ( isset( $cf['description'] ) && $cf['description'] ) {
|
|
| 740 | - echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>'; |
|
| 741 | - } ?> |
|
| 739 | + if ( isset( $cf['description'] ) && $cf['description'] ) {
|
|
| 740 | + echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>'; |
|
| 741 | + } ?> |
|
| 742 | 742 | |
| 743 | 743 | <a id="gd-<?php echo $id; ?>" |
| 744 | 744 | data-field-custom-type="<?php echo $type; ?>" |
@@ -748,21 +748,21 @@ discard block |
||
| 748 | 748 | href="javascript:void(0);"> |
| 749 | 749 | |
| 750 | 750 | <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], 'fa fa-' ) !== false ) {
|
| 751 | - echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>'; |
|
| 752 | - } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
|
|
| 753 | - echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>';
|
|
| 754 | - } else {
|
|
| 755 | - echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 756 | - } ?> |
|
| 751 | + echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>'; |
|
| 752 | + } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
|
|
| 753 | + echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>';
|
|
| 754 | + } else {
|
|
| 755 | + echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 756 | + } ?> |
|
| 757 | 757 | <?php echo $cf['name']; ?> |
| 758 | 758 | </a> |
| 759 | 759 | </li> |
| 760 | 760 | <?php |
| 761 | - } |
|
| 762 | - }else{
|
|
| 763 | - _e('There are no custom fields here yet.', 'geodirectory');
|
|
| 764 | - } |
|
| 765 | - ?> |
|
| 761 | + } |
|
| 762 | + }else{
|
|
| 763 | + _e('There are no custom fields here yet.', 'geodirectory');
|
|
| 764 | + } |
|
| 765 | + ?> |
|
| 766 | 766 | |
| 767 | 767 | |
| 768 | 768 | </ul> |
@@ -781,26 +781,26 @@ discard block |
||
| 781 | 781 | */ |
| 782 | 782 | function geodir_custom_selected_fields() |
| 783 | 783 | {
|
| 784 | - $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 785 | - ?> |
|
| 784 | + $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 785 | + ?> |
|
| 786 | 786 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
| 787 | 787 | <ul class="core"> |
| 788 | 788 | <?php |
| 789 | - global $wpdb; |
|
| 790 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
|
|
| 791 | - |
|
| 792 | - if (!empty($fields)) {
|
|
| 793 | - foreach ($fields as $field) {
|
|
| 794 | - //$result_str = $field->id; |
|
| 795 | - $result_str = $field; |
|
| 796 | - $field_type = $field->field_type; |
|
| 797 | - $field_type_key = $field->field_type_key; |
|
| 798 | - $field_ins_upd = 'display'; |
|
| 799 | - |
|
| 800 | - geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key); |
|
| 801 | - } |
|
| 802 | - } |
|
| 803 | - ?></ul> |
|
| 789 | + global $wpdb; |
|
| 790 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
|
|
| 791 | + |
|
| 792 | + if (!empty($fields)) {
|
|
| 793 | + foreach ($fields as $field) {
|
|
| 794 | + //$result_str = $field->id; |
|
| 795 | + $result_str = $field; |
|
| 796 | + $field_type = $field->field_type; |
|
| 797 | + $field_type_key = $field->field_type_key; |
|
| 798 | + $field_ins_upd = 'display'; |
|
| 799 | + |
|
| 800 | + geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key); |
|
| 801 | + } |
|
| 802 | + } |
|
| 803 | + ?></ul> |
|
| 804 | 804 | <?php |
| 805 | 805 | |
| 806 | 806 | } |
@@ -819,16 +819,16 @@ discard block |
||
| 819 | 819 | function geodir_custom_fields_panel_head($heading, $sub_tab, $listing_type) |
| 820 | 820 | {
|
| 821 | 821 | |
| 822 | - switch ($sub_tab) {
|
|
| 823 | - case 'custom_fields': |
|
| 824 | - $heading = sprintf(__('Manage %s Custom Fields', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 825 | - break; |
|
| 822 | + switch ($sub_tab) {
|
|
| 823 | + case 'custom_fields': |
|
| 824 | + $heading = sprintf(__('Manage %s Custom Fields', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 825 | + break; |
|
| 826 | 826 | |
| 827 | - case 'sorting_options': |
|
| 828 | - $heading = sprintf(__('Manage %s Listing Sorting Options Fields', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 829 | - break; |
|
| 830 | - } |
|
| 831 | - return $heading; |
|
| 827 | + case 'sorting_options': |
|
| 828 | + $heading = sprintf(__('Manage %s Listing Sorting Options Fields', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 829 | + break; |
|
| 830 | + } |
|
| 831 | + return $heading; |
|
| 832 | 832 | } |
| 833 | 833 | |
| 834 | 834 | |
@@ -846,16 +846,16 @@ discard block |
||
| 846 | 846 | function geodir_cf_panel_available_fields_head($heading, $sub_tab, $listing_type) |
| 847 | 847 | {
|
| 848 | 848 | |
| 849 | - switch ($sub_tab) {
|
|
| 850 | - case 'custom_fields': |
|
| 851 | - $heading = sprintf(__('Add new %s form field', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 852 | - break; |
|
| 849 | + switch ($sub_tab) {
|
|
| 850 | + case 'custom_fields': |
|
| 851 | + $heading = sprintf(__('Add new %s form field', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 852 | + break; |
|
| 853 | 853 | |
| 854 | - case 'sorting_options': |
|
| 855 | - $heading = sprintf(__('Available sorting options for %s listing and search results', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 856 | - break; |
|
| 857 | - } |
|
| 858 | - return $heading; |
|
| 854 | + case 'sorting_options': |
|
| 855 | + $heading = sprintf(__('Available sorting options for %s listing and search results', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 856 | + break; |
|
| 857 | + } |
|
| 858 | + return $heading; |
|
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | |
@@ -873,16 +873,16 @@ discard block |
||
| 873 | 873 | function geodir_cf_panel_available_fields_note($note, $sub_tab, $listing_type) |
| 874 | 874 | {
|
| 875 | 875 | |
| 876 | - switch ($sub_tab) {
|
|
| 877 | - case 'custom_fields': |
|
| 878 | - $note = sprintf(__('Click on any box below to add a field of that type to the add %s listing form. You can use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 879 | - break; |
|
| 876 | + switch ($sub_tab) {
|
|
| 877 | + case 'custom_fields': |
|
| 878 | + $note = sprintf(__('Click on any box below to add a field of that type to the add %s listing form. You can use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 879 | + break; |
|
| 880 | 880 | |
| 881 | - case 'sorting_options': |
|
| 882 | - $note = sprintf(__('Click on any box below to make it appear in the sorting option dropdown on %s listing and search results.<br />To make a field available here, go to custom fields tab and expand any field from selected fields panel and tick the checkbox saying \'Include this field in sort option\'.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 883 | - break; |
|
| 884 | - } |
|
| 885 | - return $note; |
|
| 881 | + case 'sorting_options': |
|
| 882 | + $note = sprintf(__('Click on any box below to make it appear in the sorting option dropdown on %s listing and search results.<br />To make a field available here, go to custom fields tab and expand any field from selected fields panel and tick the checkbox saying \'Include this field in sort option\'.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 883 | + break; |
|
| 884 | + } |
|
| 885 | + return $note; |
|
| 886 | 886 | } |
| 887 | 887 | |
| 888 | 888 | |
@@ -900,16 +900,16 @@ discard block |
||
| 900 | 900 | function geodir_cf_panel_selected_fields_head($heading, $sub_tab, $listing_type) |
| 901 | 901 | {
|
| 902 | 902 | |
| 903 | - switch ($sub_tab) {
|
|
| 904 | - case 'custom_fields': |
|
| 905 | - $heading = sprintf(__('List of fields that will appear on add new %s listing form', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 906 | - break; |
|
| 903 | + switch ($sub_tab) {
|
|
| 904 | + case 'custom_fields': |
|
| 905 | + $heading = sprintf(__('List of fields that will appear on add new %s listing form', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 906 | + break; |
|
| 907 | 907 | |
| 908 | - case 'sorting_options': |
|
| 909 | - $heading = sprintf(__('List of fields that will appear in %s listing and search results sorting option dropdown box.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 910 | - break; |
|
| 911 | - } |
|
| 912 | - return $heading; |
|
| 908 | + case 'sorting_options': |
|
| 909 | + $heading = sprintf(__('List of fields that will appear in %s listing and search results sorting option dropdown box.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 910 | + break; |
|
| 911 | + } |
|
| 912 | + return $heading; |
|
| 913 | 913 | } |
| 914 | 914 | |
| 915 | 915 | |
@@ -927,16 +927,16 @@ discard block |
||
| 927 | 927 | function geodir_cf_panel_selected_fields_note($note, $sub_tab, $listing_type) |
| 928 | 928 | {
|
| 929 | 929 | |
| 930 | - switch ($sub_tab) {
|
|
| 931 | - case 'custom_fields': |
|
| 932 | - $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 933 | - break; |
|
| 930 | + switch ($sub_tab) {
|
|
| 931 | + case 'custom_fields': |
|
| 932 | + $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 933 | + break; |
|
| 934 | 934 | |
| 935 | - case 'sorting_options': |
|
| 936 | - $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order in sorting option dropdown box on %s listing and search results page.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 937 | - break; |
|
| 938 | - } |
|
| 939 | - return $note; |
|
| 935 | + case 'sorting_options': |
|
| 936 | + $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order in sorting option dropdown box on %s listing and search results page.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 937 | + break; |
|
| 938 | + } |
|
| 939 | + return $note; |
|
| 940 | 940 | } |
| 941 | 941 | |
| 942 | 942 | |
@@ -952,16 +952,16 @@ discard block |
||
| 952 | 952 | */ |
| 953 | 953 | function geodir_remove_unnecessary_fields() |
| 954 | 954 | {
|
| 955 | - global $wpdb, $plugin_prefix; |
|
| 955 | + global $wpdb, $plugin_prefix; |
|
| 956 | 956 | |
| 957 | - if (!get_option('geodir_remove_unnecessary_fields')) {
|
|
| 957 | + if (!get_option('geodir_remove_unnecessary_fields')) {
|
|
| 958 | 958 | |
| 959 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
|
|
| 960 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
|
|
| 959 | + if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
|
|
| 960 | + $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
|
|
| 961 | 961 | |
| 962 | - update_option('geodir_remove_unnecessary_fields', '1');
|
|
| 962 | + update_option('geodir_remove_unnecessary_fields', '1');
|
|
| 963 | 963 | |
| 964 | - } |
|
| 964 | + } |
|
| 965 | 965 | |
| 966 | 966 | } |
| 967 | 967 | |
@@ -979,28 +979,28 @@ discard block |
||
| 979 | 979 | */ |
| 980 | 980 | function geodir_admin_ajax_handler() |
| 981 | 981 | {
|
| 982 | - if (isset($_REQUEST['geodir_admin_ajax_action']) && $_REQUEST['geodir_admin_ajax_action'] != '') {
|
|
| 983 | - $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action']; |
|
| 984 | - $diagnose_this = ""; |
|
| 985 | - switch ($geodir_admin_ajax_action) {
|
|
| 986 | - case 'diagnosis' : |
|
| 987 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
|
|
| 988 | - $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 989 | - call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 990 | - |
|
| 991 | - } |
|
| 992 | - exit(); |
|
| 993 | - break; |
|
| 994 | - |
|
| 995 | - case 'diagnosis-fix' : |
|
| 996 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
| 997 | - $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 998 | - call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 999 | - exit(); |
|
| 1000 | - break; |
|
| 1001 | - } |
|
| 1002 | - } |
|
| 1003 | - exit(); |
|
| 982 | + if (isset($_REQUEST['geodir_admin_ajax_action']) && $_REQUEST['geodir_admin_ajax_action'] != '') {
|
|
| 983 | + $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action']; |
|
| 984 | + $diagnose_this = ""; |
|
| 985 | + switch ($geodir_admin_ajax_action) {
|
|
| 986 | + case 'diagnosis' : |
|
| 987 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
|
|
| 988 | + $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 989 | + call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 990 | + |
|
| 991 | + } |
|
| 992 | + exit(); |
|
| 993 | + break; |
|
| 994 | + |
|
| 995 | + case 'diagnosis-fix' : |
|
| 996 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
| 997 | + $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 998 | + call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 999 | + exit(); |
|
| 1000 | + break; |
|
| 1001 | + } |
|
| 1002 | + } |
|
| 1003 | + exit(); |
|
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | |
@@ -1018,127 +1018,127 @@ discard block |
||
| 1018 | 1018 | */ |
| 1019 | 1019 | function geodir_diagnose_multisite_table($filter_arr, $table, $tabel_name, $fix) |
| 1020 | 1020 | {
|
| 1021 | - global $wpdb; |
|
| 1022 | - //$filter_arr['output_str'] .='###'.$table.'###'; |
|
| 1023 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
|
|
| 1024 | - $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
|
|
| 1025 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 1026 | - |
|
| 1027 | - } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 1028 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1029 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 1030 | - $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
|
|
| 1031 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 1032 | - |
|
| 1033 | - if ($fix) {
|
|
| 1034 | - $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
|
|
| 1035 | - $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
|
|
| 1036 | - |
|
| 1037 | - if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
|
|
| 1038 | - //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
|
|
| 1039 | - |
|
| 1040 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
|
|
| 1041 | - |
|
| 1042 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 1043 | - $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
|
|
| 1044 | - } else {
|
|
| 1045 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1046 | - } |
|
| 1047 | - |
|
| 1048 | - } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
|
|
| 1049 | - |
|
| 1050 | - $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
|
|
| 1051 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
|
|
| 1052 | - |
|
| 1053 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1054 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1055 | - } else {
|
|
| 1056 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1057 | - } |
|
| 1058 | - |
|
| 1059 | - } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
|
|
| 1060 | - |
|
| 1061 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
|
|
| 1062 | - |
|
| 1063 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 1064 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
|
|
| 1065 | - } else {
|
|
| 1066 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1067 | - } |
|
| 1068 | - |
|
| 1069 | - } |
|
| 1070 | - |
|
| 1071 | - } |
|
| 1072 | - |
|
| 1073 | - |
|
| 1074 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 1075 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1076 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 1077 | - |
|
| 1078 | - if ($fix) {
|
|
| 1079 | - if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
|
|
| 1080 | - if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
|
|
| 1081 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1082 | - } else {
|
|
| 1083 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
|
|
| 1084 | - } |
|
| 1085 | - |
|
| 1086 | - } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original
|
|
| 1087 | - if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
|
|
| 1088 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1089 | - } else {
|
|
| 1090 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1091 | - } |
|
| 1092 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1093 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1094 | - } else {
|
|
| 1095 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1096 | - } |
|
| 1097 | - } else {// else rename the original table to _ms_bak
|
|
| 1098 | - if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1099 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
|
|
| 1100 | - } else {
|
|
| 1101 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
|
|
| 1102 | - } |
|
| 1103 | - } |
|
| 1104 | - } |
|
| 1105 | - |
|
| 1106 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1107 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1108 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 1109 | - |
|
| 1110 | - if ($fix) {
|
|
| 1111 | - // if original table exists but new does not, rename |
|
| 1112 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1113 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1114 | - } else {
|
|
| 1115 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1116 | - } |
|
| 1117 | - |
|
| 1118 | - } |
|
| 1119 | - |
|
| 1120 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1121 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1122 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 1123 | - |
|
| 1124 | - if ($fix) {
|
|
| 1125 | - // if original table does not exist try deleting db_vers of all addons so the initial db_install scripts run; |
|
| 1126 | - delete_option('geodirlocation_db_version');
|
|
| 1127 | - delete_option('geodirevents_db_version');
|
|
| 1128 | - delete_option('geodir_reviewrating_db_version');
|
|
| 1129 | - delete_option('gdevents_db_version');
|
|
| 1130 | - delete_option('geodirectory_db_version');
|
|
| 1131 | - delete_option('geodirclaim_db_version');
|
|
| 1132 | - delete_option('geodir_custom_posts_db_version');
|
|
| 1133 | - delete_option('geodir_reviewratings_db_version');
|
|
| 1134 | - delete_option('geodiradvancesearch_db_version');
|
|
| 1135 | - $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
|
|
| 1136 | - } |
|
| 1137 | - |
|
| 1138 | - } else {
|
|
| 1139 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1140 | - } |
|
| 1141 | - return $filter_arr; |
|
| 1021 | + global $wpdb; |
|
| 1022 | + //$filter_arr['output_str'] .='###'.$table.'###'; |
|
| 1023 | + if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
|
|
| 1024 | + $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
|
|
| 1025 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 1026 | + |
|
| 1027 | + } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 1028 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1029 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 1030 | + $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
|
|
| 1031 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 1032 | + |
|
| 1033 | + if ($fix) {
|
|
| 1034 | + $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
|
|
| 1035 | + $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
|
|
| 1036 | + |
|
| 1037 | + if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
|
|
| 1038 | + //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
|
|
| 1039 | + |
|
| 1040 | + $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
|
|
| 1041 | + |
|
| 1042 | + if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 1043 | + $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
|
|
| 1044 | + } else {
|
|
| 1045 | + $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1046 | + } |
|
| 1047 | + |
|
| 1048 | + } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
|
|
| 1049 | + |
|
| 1050 | + $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
|
|
| 1051 | + $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
|
|
| 1052 | + |
|
| 1053 | + if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1054 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1055 | + } else {
|
|
| 1056 | + $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1057 | + } |
|
| 1058 | + |
|
| 1059 | + } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
|
|
| 1060 | + |
|
| 1061 | + $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
|
|
| 1062 | + |
|
| 1063 | + if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 1064 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
|
|
| 1065 | + } else {
|
|
| 1066 | + $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1067 | + } |
|
| 1068 | + |
|
| 1069 | + } |
|
| 1070 | + |
|
| 1071 | + } |
|
| 1072 | + |
|
| 1073 | + |
|
| 1074 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 1075 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1076 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 1077 | + |
|
| 1078 | + if ($fix) {
|
|
| 1079 | + if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
|
|
| 1080 | + if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
|
|
| 1081 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1082 | + } else {
|
|
| 1083 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
|
|
| 1084 | + } |
|
| 1085 | + |
|
| 1086 | + } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original
|
|
| 1087 | + if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
|
|
| 1088 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1089 | + } else {
|
|
| 1090 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1091 | + } |
|
| 1092 | + if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1093 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1094 | + } else {
|
|
| 1095 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1096 | + } |
|
| 1097 | + } else {// else rename the original table to _ms_bak
|
|
| 1098 | + if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1099 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
|
|
| 1100 | + } else {
|
|
| 1101 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
|
|
| 1102 | + } |
|
| 1103 | + } |
|
| 1104 | + } |
|
| 1105 | + |
|
| 1106 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1107 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1108 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 1109 | + |
|
| 1110 | + if ($fix) {
|
|
| 1111 | + // if original table exists but new does not, rename |
|
| 1112 | + if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1113 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1114 | + } else {
|
|
| 1115 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1116 | + } |
|
| 1117 | + |
|
| 1118 | + } |
|
| 1119 | + |
|
| 1120 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1121 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1122 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 1123 | + |
|
| 1124 | + if ($fix) {
|
|
| 1125 | + // if original table does not exist try deleting db_vers of all addons so the initial db_install scripts run; |
|
| 1126 | + delete_option('geodirlocation_db_version');
|
|
| 1127 | + delete_option('geodirevents_db_version');
|
|
| 1128 | + delete_option('geodir_reviewrating_db_version');
|
|
| 1129 | + delete_option('gdevents_db_version');
|
|
| 1130 | + delete_option('geodirectory_db_version');
|
|
| 1131 | + delete_option('geodirclaim_db_version');
|
|
| 1132 | + delete_option('geodir_custom_posts_db_version');
|
|
| 1133 | + delete_option('geodir_reviewratings_db_version');
|
|
| 1134 | + delete_option('geodiradvancesearch_db_version');
|
|
| 1135 | + $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
|
|
| 1136 | + } |
|
| 1137 | + |
|
| 1138 | + } else {
|
|
| 1139 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1140 | + } |
|
| 1141 | + return $filter_arr; |
|
| 1142 | 1142 | } |
| 1143 | 1143 | |
| 1144 | 1144 | |
@@ -1152,111 +1152,111 @@ discard block |
||
| 1152 | 1152 | */ |
| 1153 | 1153 | function geodir_diagnose_tags_sync() |
| 1154 | 1154 | {
|
| 1155 | - global $wpdb, $plugin_prefix; |
|
| 1156 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1157 | - $step = isset($_POST['step']) ? strip_tags(esc_sql($_POST['step'])) : 0; |
|
| 1158 | - $step_max_items = geodir_get_diagnose_step_max_items(); |
|
| 1159 | - $offset = (int) $step * $step_max_items; |
|
| 1160 | - $ptype = isset($_POST['ptype']) ? strip_tags(esc_sql($_POST['ptype'])) : false; |
|
| 1161 | - |
|
| 1162 | - $total_listings = geodir_total_listings_count(); |
|
| 1163 | - $total_ptype_listings = 0; |
|
| 1164 | - if ($ptype) {
|
|
| 1165 | - $total_ptype_listings = geodir_total_listings_count($ptype); |
|
| 1166 | - } |
|
| 1167 | - $max_step = ceil($total_ptype_listings / $step_max_items) - 1; |
|
| 1155 | + global $wpdb, $plugin_prefix; |
|
| 1156 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1157 | + $step = isset($_POST['step']) ? strip_tags(esc_sql($_POST['step'])) : 0; |
|
| 1158 | + $step_max_items = geodir_get_diagnose_step_max_items(); |
|
| 1159 | + $offset = (int) $step * $step_max_items; |
|
| 1160 | + $ptype = isset($_POST['ptype']) ? strip_tags(esc_sql($_POST['ptype'])) : false; |
|
| 1161 | + |
|
| 1162 | + $total_listings = geodir_total_listings_count(); |
|
| 1163 | + $total_ptype_listings = 0; |
|
| 1164 | + if ($ptype) {
|
|
| 1165 | + $total_ptype_listings = geodir_total_listings_count($ptype); |
|
| 1166 | + } |
|
| 1167 | + $max_step = ceil($total_ptype_listings / $step_max_items) - 1; |
|
| 1168 | 1168 | |
| 1169 | - //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1170 | - $is_error_during_diagnose = false; |
|
| 1171 | - $output_str = ''; |
|
| 1169 | + //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1170 | + $is_error_during_diagnose = false; |
|
| 1171 | + $output_str = ''; |
|
| 1172 | 1172 | |
| 1173 | - if ($ptype && !empty($ptype) && $total_listings > $step_max_items) {
|
|
| 1174 | - $stepped_process = true; |
|
| 1175 | - } else {
|
|
| 1176 | - $stepped_process = false; |
|
| 1177 | - } |
|
| 1178 | - |
|
| 1179 | - if ($stepped_process) {
|
|
| 1180 | - $sql = $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $ptype . "_detail LIMIT %d OFFSET %d", $step_max_items, $offset ); |
|
| 1181 | - $posts = $wpdb->get_results( $sql ); |
|
| 1182 | - |
|
| 1183 | - if (!empty($posts)) {
|
|
| 1184 | - |
|
| 1185 | - foreach ($posts as $p) {
|
|
| 1186 | - $p->post_type = $ptype; |
|
| 1187 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1188 | - if (empty($raw_tags)) {
|
|
| 1189 | - $post_tags = ''; |
|
| 1190 | - } else {
|
|
| 1191 | - $post_tags = implode(",", $raw_tags);
|
|
| 1192 | - } |
|
| 1193 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1194 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1195 | - |
|
| 1196 | - } |
|
| 1197 | - if ($step >= $max_step) {
|
|
| 1198 | - $output_str = "done"; |
|
| 1199 | - } else {
|
|
| 1200 | - $output_str = $step + 1; |
|
| 1201 | - } |
|
| 1202 | - } |
|
| 1203 | - |
|
| 1204 | - } else {
|
|
| 1205 | - $all_postypes = geodir_get_posttypes(); |
|
| 1206 | - |
|
| 1207 | - if (!empty($all_postypes)) {
|
|
| 1208 | - foreach ($all_postypes as $key) {
|
|
| 1209 | - // update each GD CPT |
|
| 1210 | - $posts = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail"); |
|
| 1211 | - |
|
| 1212 | - if (!empty($posts)) {
|
|
| 1213 | - |
|
| 1214 | - foreach ($posts as $p) {
|
|
| 1215 | - $p->post_type = $key; |
|
| 1216 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1217 | - if (empty($raw_tags)) {
|
|
| 1218 | - $post_tags = ''; |
|
| 1219 | - } else {
|
|
| 1220 | - $post_tags = implode(",", $raw_tags);
|
|
| 1221 | - } |
|
| 1222 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1223 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1224 | - |
|
| 1225 | - } |
|
| 1226 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1227 | - } |
|
| 1228 | - |
|
| 1229 | - } |
|
| 1230 | - |
|
| 1231 | - } |
|
| 1232 | - } |
|
| 1233 | - |
|
| 1234 | - |
|
| 1235 | - if ($is_error_during_diagnose) {
|
|
| 1236 | - $info_div_class = "geodir_problem_info"; |
|
| 1237 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1238 | - } else {
|
|
| 1239 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1240 | - $fix_button_txt = ''; |
|
| 1241 | - } |
|
| 1242 | - |
|
| 1243 | - if ($stepped_process) {
|
|
| 1244 | - $percent = ($step/$max_step) * 100; |
|
| 1245 | - if ($output_str == 'done') {
|
|
| 1246 | - echo $output_str; |
|
| 1247 | - } else {
|
|
| 1248 | - $output = array( |
|
| 1249 | - 'step' => $output_str, |
|
| 1250 | - 'percent' => $percent |
|
| 1251 | - ); |
|
| 1252 | - echo json_encode($output); |
|
| 1253 | - } |
|
| 1254 | - } else {
|
|
| 1255 | - echo "<ul class='$info_div_class'>"; |
|
| 1256 | - echo $output_str; |
|
| 1257 | - echo $fix_button_txt; |
|
| 1258 | - echo "</ul>"; |
|
| 1259 | - } |
|
| 1173 | + if ($ptype && !empty($ptype) && $total_listings > $step_max_items) {
|
|
| 1174 | + $stepped_process = true; |
|
| 1175 | + } else {
|
|
| 1176 | + $stepped_process = false; |
|
| 1177 | + } |
|
| 1178 | + |
|
| 1179 | + if ($stepped_process) {
|
|
| 1180 | + $sql = $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $ptype . "_detail LIMIT %d OFFSET %d", $step_max_items, $offset ); |
|
| 1181 | + $posts = $wpdb->get_results( $sql ); |
|
| 1182 | + |
|
| 1183 | + if (!empty($posts)) {
|
|
| 1184 | + |
|
| 1185 | + foreach ($posts as $p) {
|
|
| 1186 | + $p->post_type = $ptype; |
|
| 1187 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1188 | + if (empty($raw_tags)) {
|
|
| 1189 | + $post_tags = ''; |
|
| 1190 | + } else {
|
|
| 1191 | + $post_tags = implode(",", $raw_tags);
|
|
| 1192 | + } |
|
| 1193 | + $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1194 | + $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1195 | + |
|
| 1196 | + } |
|
| 1197 | + if ($step >= $max_step) {
|
|
| 1198 | + $output_str = "done"; |
|
| 1199 | + } else {
|
|
| 1200 | + $output_str = $step + 1; |
|
| 1201 | + } |
|
| 1202 | + } |
|
| 1203 | + |
|
| 1204 | + } else {
|
|
| 1205 | + $all_postypes = geodir_get_posttypes(); |
|
| 1206 | + |
|
| 1207 | + if (!empty($all_postypes)) {
|
|
| 1208 | + foreach ($all_postypes as $key) {
|
|
| 1209 | + // update each GD CPT |
|
| 1210 | + $posts = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail"); |
|
| 1211 | + |
|
| 1212 | + if (!empty($posts)) {
|
|
| 1213 | + |
|
| 1214 | + foreach ($posts as $p) {
|
|
| 1215 | + $p->post_type = $key; |
|
| 1216 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1217 | + if (empty($raw_tags)) {
|
|
| 1218 | + $post_tags = ''; |
|
| 1219 | + } else {
|
|
| 1220 | + $post_tags = implode(",", $raw_tags);
|
|
| 1221 | + } |
|
| 1222 | + $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1223 | + $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1224 | + |
|
| 1225 | + } |
|
| 1226 | + $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1227 | + } |
|
| 1228 | + |
|
| 1229 | + } |
|
| 1230 | + |
|
| 1231 | + } |
|
| 1232 | + } |
|
| 1233 | + |
|
| 1234 | + |
|
| 1235 | + if ($is_error_during_diagnose) {
|
|
| 1236 | + $info_div_class = "geodir_problem_info"; |
|
| 1237 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1238 | + } else {
|
|
| 1239 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1240 | + $fix_button_txt = ''; |
|
| 1241 | + } |
|
| 1242 | + |
|
| 1243 | + if ($stepped_process) {
|
|
| 1244 | + $percent = ($step/$max_step) * 100; |
|
| 1245 | + if ($output_str == 'done') {
|
|
| 1246 | + echo $output_str; |
|
| 1247 | + } else {
|
|
| 1248 | + $output = array( |
|
| 1249 | + 'step' => $output_str, |
|
| 1250 | + 'percent' => $percent |
|
| 1251 | + ); |
|
| 1252 | + echo json_encode($output); |
|
| 1253 | + } |
|
| 1254 | + } else {
|
|
| 1255 | + echo "<ul class='$info_div_class'>"; |
|
| 1256 | + echo $output_str; |
|
| 1257 | + echo $fix_button_txt; |
|
| 1258 | + echo "</ul>"; |
|
| 1259 | + } |
|
| 1260 | 1260 | } |
| 1261 | 1261 | |
| 1262 | 1262 | /** |
@@ -1271,75 +1271,75 @@ discard block |
||
| 1271 | 1271 | */ |
| 1272 | 1272 | function geodir_diagnose_cats_sync() |
| 1273 | 1273 | {
|
| 1274 | - global $wpdb, $plugin_prefix; |
|
| 1275 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1274 | + global $wpdb, $plugin_prefix; |
|
| 1275 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1276 | 1276 | |
| 1277 | - //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1278 | - $is_error_during_diagnose = false; |
|
| 1279 | - $output_str = ''; |
|
| 1277 | + //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1278 | + $is_error_during_diagnose = false; |
|
| 1279 | + $output_str = ''; |
|
| 1280 | 1280 | |
| 1281 | 1281 | |
| 1282 | - $all_postypes = geodir_get_posttypes(); |
|
| 1282 | + $all_postypes = geodir_get_posttypes(); |
|
| 1283 | 1283 | |
| 1284 | - if (!empty($all_postypes)) {
|
|
| 1285 | - foreach ($all_postypes as $key) {
|
|
| 1286 | - // update each GD CTP |
|
| 1287 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
|
|
| 1284 | + if (!empty($all_postypes)) {
|
|
| 1285 | + foreach ($all_postypes as $key) {
|
|
| 1286 | + // update each GD CTP |
|
| 1287 | + $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
|
|
| 1288 | 1288 | |
| 1289 | - if (!empty($posts)) {
|
|
| 1289 | + if (!empty($posts)) {
|
|
| 1290 | 1290 | |
| 1291 | - foreach ($posts as $p) {
|
|
| 1292 | - $p->post_type = $key; |
|
| 1293 | - $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
|
|
| 1291 | + foreach ($posts as $p) {
|
|
| 1292 | + $p->post_type = $key; |
|
| 1293 | + $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
|
|
| 1294 | 1294 | |
| 1295 | - if (empty($raw_cats)) {
|
|
| 1296 | - $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
|
| 1295 | + if (empty($raw_cats)) {
|
|
| 1296 | + $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
|
| 1297 | 1297 | |
| 1298 | - if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
|
|
| 1299 | - $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
|
|
| 1300 | - foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
|
|
| 1301 | - if (is_numeric($cat_part)) {
|
|
| 1302 | - $raw_cats[] = (int)$cat_part; |
|
| 1303 | - } |
|
| 1304 | - } |
|
| 1298 | + if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
|
|
| 1299 | + $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
|
|
| 1300 | + foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
|
|
| 1301 | + if (is_numeric($cat_part)) {
|
|
| 1302 | + $raw_cats[] = (int)$cat_part; |
|
| 1303 | + } |
|
| 1304 | + } |
|
| 1305 | 1305 | |
| 1306 | - } |
|
| 1306 | + } |
|
| 1307 | 1307 | |
| 1308 | - if (!empty($raw_cats)) {
|
|
| 1309 | - $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
| 1308 | + if (!empty($raw_cats)) {
|
|
| 1309 | + $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
| 1310 | 1310 | |
| 1311 | - } |
|
| 1311 | + } |
|
| 1312 | 1312 | |
| 1313 | - } |
|
| 1313 | + } |
|
| 1314 | 1314 | |
| 1315 | 1315 | |
| 1316 | - if (empty($raw_cats)) {
|
|
| 1317 | - $post_cats = ''; |
|
| 1318 | - } else {
|
|
| 1319 | - $post_cats = ',' . implode(",", $raw_cats) . ',';
|
|
| 1320 | - } |
|
| 1321 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1322 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
| 1323 | - } |
|
| 1316 | + if (empty($raw_cats)) {
|
|
| 1317 | + $post_cats = ''; |
|
| 1318 | + } else {
|
|
| 1319 | + $post_cats = ',' . implode(",", $raw_cats) . ',';
|
|
| 1320 | + } |
|
| 1321 | + $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1322 | + $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
| 1323 | + } |
|
| 1324 | 1324 | |
| 1325 | - } |
|
| 1326 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1325 | + } |
|
| 1326 | + $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1327 | 1327 | |
| 1328 | - } |
|
| 1328 | + } |
|
| 1329 | 1329 | |
| 1330 | - } |
|
| 1330 | + } |
|
| 1331 | 1331 | |
| 1332 | - if ($is_error_during_diagnose) {
|
|
| 1333 | - $info_div_class = "geodir_problem_info"; |
|
| 1334 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1335 | - } else {
|
|
| 1336 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1337 | - $fix_button_txt = ''; |
|
| 1338 | - } |
|
| 1339 | - echo "<ul class='$info_div_class'>"; |
|
| 1340 | - echo $output_str; |
|
| 1341 | - echo $fix_button_txt; |
|
| 1342 | - echo "</ul>"; |
|
| 1332 | + if ($is_error_during_diagnose) {
|
|
| 1333 | + $info_div_class = "geodir_problem_info"; |
|
| 1334 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1335 | + } else {
|
|
| 1336 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1337 | + $fix_button_txt = ''; |
|
| 1338 | + } |
|
| 1339 | + echo "<ul class='$info_div_class'>"; |
|
| 1340 | + echo $output_str; |
|
| 1341 | + echo $fix_button_txt; |
|
| 1342 | + echo "</ul>"; |
|
| 1343 | 1343 | |
| 1344 | 1344 | } |
| 1345 | 1345 | |
@@ -1353,61 +1353,61 @@ discard block |
||
| 1353 | 1353 | */ |
| 1354 | 1354 | function geodir_diagnose_version_clear() |
| 1355 | 1355 | {
|
| 1356 | - global $wpdb, $plugin_prefix; |
|
| 1357 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1358 | - |
|
| 1359 | - //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1360 | - $is_error_during_diagnose = false; |
|
| 1361 | - $output_str = ''; |
|
| 1362 | - |
|
| 1363 | - |
|
| 1364 | - $gd_arr = array('GeoDirectory' => 'geodirectory_db_version',
|
|
| 1365 | - 'Payment Manager' => 'geodir_payments_db_version', |
|
| 1366 | - 'GeoDirectory Framework' => 'gdf_db_version', |
|
| 1367 | - 'Advanced Search' => 'geodiradvancesearch_db_version', |
|
| 1368 | - 'Review Rating Manager' => 'geodir_reviewratings_db_version', |
|
| 1369 | - 'Claim Manager' => 'geodirclaim_db_version', |
|
| 1370 | - 'CPT Manager' => 'geodir_custom_posts_db_version', |
|
| 1371 | - 'Location Manager' => 'geodirlocation_db_version', |
|
| 1372 | - 'Payment Manager' => 'geodir_payments_db_version', |
|
| 1373 | - 'Events Manager' => 'geodirevents_db_version', |
|
| 1374 | - ); |
|
| 1375 | - |
|
| 1376 | - /** |
|
| 1377 | - * Filter the array of plugins to clear the version numbers for in the GD >Tools : clear all version numbers. |
|
| 1378 | - * |
|
| 1379 | - * @since 1.0.0 |
|
| 1380 | - * @param array $gd_arr The array or addons to clear, array('GeoDirectory' => 'geodirectory_db_version',...
|
|
| 1381 | - */ |
|
| 1382 | - $ver_arr = apply_filters('geodir_db_version_name', $gd_arr);
|
|
| 1383 | - |
|
| 1384 | - if (!empty($ver_arr)) {
|
|
| 1385 | - foreach ($ver_arr as $key => $val) {
|
|
| 1386 | - if (delete_option($val)) {
|
|
| 1387 | - $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
|
|
| 1388 | - } else {
|
|
| 1389 | - $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
|
|
| 1390 | - } |
|
| 1391 | - |
|
| 1392 | - } |
|
| 1393 | - |
|
| 1394 | - if ($output_str) {
|
|
| 1395 | - $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
|
|
| 1396 | - } |
|
| 1397 | - |
|
| 1398 | - } |
|
| 1399 | - |
|
| 1400 | - if ($is_error_during_diagnose) {
|
|
| 1401 | - $info_div_class = "geodir_problem_info"; |
|
| 1402 | - $fix_button_txt = ""; |
|
| 1403 | - } else {
|
|
| 1404 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1405 | - $fix_button_txt = ''; |
|
| 1406 | - } |
|
| 1407 | - echo "<ul class='$info_div_class'>"; |
|
| 1408 | - echo $output_str; |
|
| 1409 | - echo $fix_button_txt; |
|
| 1410 | - echo "</ul>"; |
|
| 1356 | + global $wpdb, $plugin_prefix; |
|
| 1357 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1358 | + |
|
| 1359 | + //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1360 | + $is_error_during_diagnose = false; |
|
| 1361 | + $output_str = ''; |
|
| 1362 | + |
|
| 1363 | + |
|
| 1364 | + $gd_arr = array('GeoDirectory' => 'geodirectory_db_version',
|
|
| 1365 | + 'Payment Manager' => 'geodir_payments_db_version', |
|
| 1366 | + 'GeoDirectory Framework' => 'gdf_db_version', |
|
| 1367 | + 'Advanced Search' => 'geodiradvancesearch_db_version', |
|
| 1368 | + 'Review Rating Manager' => 'geodir_reviewratings_db_version', |
|
| 1369 | + 'Claim Manager' => 'geodirclaim_db_version', |
|
| 1370 | + 'CPT Manager' => 'geodir_custom_posts_db_version', |
|
| 1371 | + 'Location Manager' => 'geodirlocation_db_version', |
|
| 1372 | + 'Payment Manager' => 'geodir_payments_db_version', |
|
| 1373 | + 'Events Manager' => 'geodirevents_db_version', |
|
| 1374 | + ); |
|
| 1375 | + |
|
| 1376 | + /** |
|
| 1377 | + * Filter the array of plugins to clear the version numbers for in the GD >Tools : clear all version numbers. |
|
| 1378 | + * |
|
| 1379 | + * @since 1.0.0 |
|
| 1380 | + * @param array $gd_arr The array or addons to clear, array('GeoDirectory' => 'geodirectory_db_version',...
|
|
| 1381 | + */ |
|
| 1382 | + $ver_arr = apply_filters('geodir_db_version_name', $gd_arr);
|
|
| 1383 | + |
|
| 1384 | + if (!empty($ver_arr)) {
|
|
| 1385 | + foreach ($ver_arr as $key => $val) {
|
|
| 1386 | + if (delete_option($val)) {
|
|
| 1387 | + $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
|
|
| 1388 | + } else {
|
|
| 1389 | + $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
|
|
| 1390 | + } |
|
| 1391 | + |
|
| 1392 | + } |
|
| 1393 | + |
|
| 1394 | + if ($output_str) {
|
|
| 1395 | + $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
|
|
| 1396 | + } |
|
| 1397 | + |
|
| 1398 | + } |
|
| 1399 | + |
|
| 1400 | + if ($is_error_during_diagnose) {
|
|
| 1401 | + $info_div_class = "geodir_problem_info"; |
|
| 1402 | + $fix_button_txt = ""; |
|
| 1403 | + } else {
|
|
| 1404 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1405 | + $fix_button_txt = ''; |
|
| 1406 | + } |
|
| 1407 | + echo "<ul class='$info_div_class'>"; |
|
| 1408 | + echo $output_str; |
|
| 1409 | + echo $fix_button_txt; |
|
| 1410 | + echo "</ul>"; |
|
| 1411 | 1411 | |
| 1412 | 1412 | } |
| 1413 | 1413 | |
@@ -1421,59 +1421,59 @@ discard block |
||
| 1421 | 1421 | */ |
| 1422 | 1422 | function geodir_diagnose_ratings() |
| 1423 | 1423 | {
|
| 1424 | - global $wpdb; |
|
| 1425 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1426 | - |
|
| 1427 | - //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1428 | - $is_error_during_diagnose = false; |
|
| 1429 | - $output_str = ''; |
|
| 1430 | - |
|
| 1431 | - // check review locations |
|
| 1432 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
|
|
| 1433 | - $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
|
|
| 1434 | - $is_error_during_diagnose = true; |
|
| 1435 | - |
|
| 1436 | - if ($fix) {
|
|
| 1437 | - if (geodir_fix_review_location()) {
|
|
| 1438 | - $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
|
|
| 1439 | - } else {
|
|
| 1440 | - $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1441 | - } |
|
| 1442 | - } |
|
| 1443 | - |
|
| 1444 | - } else {
|
|
| 1445 | - $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
|
|
| 1446 | - } |
|
| 1447 | - |
|
| 1448 | - // check review content |
|
| 1449 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
|
|
| 1450 | - $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
|
|
| 1451 | - $is_error_during_diagnose = true; |
|
| 1452 | - |
|
| 1453 | - if ($fix) {
|
|
| 1454 | - if (geodir_fix_review_content()) {
|
|
| 1455 | - $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
|
|
| 1456 | - } else {
|
|
| 1457 | - $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1458 | - } |
|
| 1459 | - } |
|
| 1460 | - |
|
| 1461 | - } else {
|
|
| 1462 | - $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
|
|
| 1463 | - } |
|
| 1464 | - |
|
| 1465 | - |
|
| 1466 | - if ($is_error_during_diagnose) {
|
|
| 1467 | - $info_div_class = "geodir_problem_info"; |
|
| 1468 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1469 | - } else {
|
|
| 1470 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1471 | - $fix_button_txt = ''; |
|
| 1472 | - } |
|
| 1473 | - echo "<ul class='$info_div_class'>"; |
|
| 1474 | - echo $output_str; |
|
| 1475 | - echo $fix_button_txt; |
|
| 1476 | - echo "</ul>"; |
|
| 1424 | + global $wpdb; |
|
| 1425 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1426 | + |
|
| 1427 | + //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1428 | + $is_error_during_diagnose = false; |
|
| 1429 | + $output_str = ''; |
|
| 1430 | + |
|
| 1431 | + // check review locations |
|
| 1432 | + if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
|
|
| 1433 | + $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
|
|
| 1434 | + $is_error_during_diagnose = true; |
|
| 1435 | + |
|
| 1436 | + if ($fix) {
|
|
| 1437 | + if (geodir_fix_review_location()) {
|
|
| 1438 | + $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
|
|
| 1439 | + } else {
|
|
| 1440 | + $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1441 | + } |
|
| 1442 | + } |
|
| 1443 | + |
|
| 1444 | + } else {
|
|
| 1445 | + $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
|
|
| 1446 | + } |
|
| 1447 | + |
|
| 1448 | + // check review content |
|
| 1449 | + if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
|
|
| 1450 | + $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
|
|
| 1451 | + $is_error_during_diagnose = true; |
|
| 1452 | + |
|
| 1453 | + if ($fix) {
|
|
| 1454 | + if (geodir_fix_review_content()) {
|
|
| 1455 | + $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
|
|
| 1456 | + } else {
|
|
| 1457 | + $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1458 | + } |
|
| 1459 | + } |
|
| 1460 | + |
|
| 1461 | + } else {
|
|
| 1462 | + $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
|
|
| 1463 | + } |
|
| 1464 | + |
|
| 1465 | + |
|
| 1466 | + if ($is_error_during_diagnose) {
|
|
| 1467 | + $info_div_class = "geodir_problem_info"; |
|
| 1468 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1469 | + } else {
|
|
| 1470 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1471 | + $fix_button_txt = ''; |
|
| 1472 | + } |
|
| 1473 | + echo "<ul class='$info_div_class'>"; |
|
| 1474 | + echo $output_str; |
|
| 1475 | + echo $fix_button_txt; |
|
| 1476 | + echo "</ul>"; |
|
| 1477 | 1477 | |
| 1478 | 1478 | } |
| 1479 | 1479 | |
@@ -1487,57 +1487,57 @@ discard block |
||
| 1487 | 1487 | */ |
| 1488 | 1488 | function geodir_diagnose_multisite_conversion() |
| 1489 | 1489 | {
|
| 1490 | - global $wpdb; |
|
| 1491 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1492 | - //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1493 | - $is_error_during_diagnose = false; |
|
| 1494 | - $output_str = ''; |
|
| 1495 | - |
|
| 1496 | - $filter_arr = array(); |
|
| 1497 | - $filter_arr['output_str'] = $output_str; |
|
| 1498 | - $filter_arr['is_error_during_diagnose'] = $is_error_during_diagnose; |
|
| 1499 | - $table_arr = array('geodir_countries' => __('Countries', 'geodirectory'),
|
|
| 1500 | - 'geodir_custom_fields' => __('Custom fields', 'geodirectory'),
|
|
| 1501 | - 'geodir_post_icon' => __('Post icon', 'geodirectory'),
|
|
| 1502 | - 'geodir_attachments' => __('Attachments', 'geodirectory'),
|
|
| 1503 | - 'geodir_post_review' => __('Reviews', 'geodirectory'),
|
|
| 1504 | - 'geodir_custom_sort_fields' => __('Custom sort fields', 'geodirectory'),
|
|
| 1505 | - 'geodir_gd_place_detail' => __('Place detail', 'geodirectory')
|
|
| 1506 | - ); |
|
| 1507 | - |
|
| 1508 | - // allow other addons to hook in and add their checks |
|
| 1509 | - |
|
| 1510 | - /** |
|
| 1511 | - * Filter the array of tables. |
|
| 1512 | - * |
|
| 1513 | - * Filter the array of tables to check during the GD>Tools multisite DB conversion tool check, this allows addons to add their DB tables to the checks. |
|
| 1514 | - * |
|
| 1515 | - * @since 1.0.0 |
|
| 1516 | - * @param array $table_arr The array of tables to check, array('geodir_countries' => __('Countries', 'geodirectory'),...
|
|
| 1517 | - */ |
|
| 1518 | - $table_arr = apply_filters('geodir_diagnose_multisite_conversion', $table_arr);
|
|
| 1519 | - |
|
| 1520 | - foreach ($table_arr as $table => $table_name) {
|
|
| 1521 | - // Diagnose table |
|
| 1522 | - $filter_arr = geodir_diagnose_multisite_table($filter_arr, $table, $table_name, $fix); |
|
| 1523 | - } |
|
| 1524 | - |
|
| 1525 | - |
|
| 1526 | - $output_str = $filter_arr['output_str']; |
|
| 1527 | - $is_error_during_diagnose = $filter_arr['is_error_during_diagnose']; |
|
| 1528 | - |
|
| 1529 | - |
|
| 1530 | - if ($is_error_during_diagnose) {
|
|
| 1531 | - $info_div_class = "geodir_problem_info"; |
|
| 1532 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
| 1533 | - } else {
|
|
| 1534 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1535 | - $fix_button_txt = ''; |
|
| 1536 | - } |
|
| 1537 | - echo "<ul class='$info_div_class'>"; |
|
| 1538 | - echo $output_str; |
|
| 1539 | - echo $fix_button_txt; |
|
| 1540 | - echo "</ul>"; |
|
| 1490 | + global $wpdb; |
|
| 1491 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1492 | + //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1493 | + $is_error_during_diagnose = false; |
|
| 1494 | + $output_str = ''; |
|
| 1495 | + |
|
| 1496 | + $filter_arr = array(); |
|
| 1497 | + $filter_arr['output_str'] = $output_str; |
|
| 1498 | + $filter_arr['is_error_during_diagnose'] = $is_error_during_diagnose; |
|
| 1499 | + $table_arr = array('geodir_countries' => __('Countries', 'geodirectory'),
|
|
| 1500 | + 'geodir_custom_fields' => __('Custom fields', 'geodirectory'),
|
|
| 1501 | + 'geodir_post_icon' => __('Post icon', 'geodirectory'),
|
|
| 1502 | + 'geodir_attachments' => __('Attachments', 'geodirectory'),
|
|
| 1503 | + 'geodir_post_review' => __('Reviews', 'geodirectory'),
|
|
| 1504 | + 'geodir_custom_sort_fields' => __('Custom sort fields', 'geodirectory'),
|
|
| 1505 | + 'geodir_gd_place_detail' => __('Place detail', 'geodirectory')
|
|
| 1506 | + ); |
|
| 1507 | + |
|
| 1508 | + // allow other addons to hook in and add their checks |
|
| 1509 | + |
|
| 1510 | + /** |
|
| 1511 | + * Filter the array of tables. |
|
| 1512 | + * |
|
| 1513 | + * Filter the array of tables to check during the GD>Tools multisite DB conversion tool check, this allows addons to add their DB tables to the checks. |
|
| 1514 | + * |
|
| 1515 | + * @since 1.0.0 |
|
| 1516 | + * @param array $table_arr The array of tables to check, array('geodir_countries' => __('Countries', 'geodirectory'),...
|
|
| 1517 | + */ |
|
| 1518 | + $table_arr = apply_filters('geodir_diagnose_multisite_conversion', $table_arr);
|
|
| 1519 | + |
|
| 1520 | + foreach ($table_arr as $table => $table_name) {
|
|
| 1521 | + // Diagnose table |
|
| 1522 | + $filter_arr = geodir_diagnose_multisite_table($filter_arr, $table, $table_name, $fix); |
|
| 1523 | + } |
|
| 1524 | + |
|
| 1525 | + |
|
| 1526 | + $output_str = $filter_arr['output_str']; |
|
| 1527 | + $is_error_during_diagnose = $filter_arr['is_error_during_diagnose']; |
|
| 1528 | + |
|
| 1529 | + |
|
| 1530 | + if ($is_error_during_diagnose) {
|
|
| 1531 | + $info_div_class = "geodir_problem_info"; |
|
| 1532 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
| 1533 | + } else {
|
|
| 1534 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1535 | + $fix_button_txt = ''; |
|
| 1536 | + } |
|
| 1537 | + echo "<ul class='$info_div_class'>"; |
|
| 1538 | + echo $output_str; |
|
| 1539 | + echo $fix_button_txt; |
|
| 1540 | + echo "</ul>"; |
|
| 1541 | 1541 | } |
| 1542 | 1542 | |
| 1543 | 1543 | /** |
@@ -1555,39 +1555,39 @@ discard block |
||
| 1555 | 1555 | */ |
| 1556 | 1556 | function geodir_fix_virtual_page($slug, $page_title, $old_id, $option) |
| 1557 | 1557 | {
|
| 1558 | - global $wpdb, $current_user; |
|
| 1559 | - |
|
| 1560 | - if (!empty($old_id)) {
|
|
| 1561 | - wp_delete_post($old_id, true); |
|
| 1562 | - }//delete post if already there |
|
| 1563 | - else {
|
|
| 1564 | - $page_found = $wpdb->get_var( |
|
| 1565 | - $wpdb->prepare( |
|
| 1566 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 1567 | - array($slug) |
|
| 1568 | - ) |
|
| 1569 | - ); |
|
| 1570 | - wp_delete_post($page_found, true); |
|
| 1571 | - |
|
| 1572 | - } |
|
| 1573 | - |
|
| 1574 | - $page_data = array( |
|
| 1575 | - 'post_status' => 'publish', |
|
| 1576 | - 'post_type' => 'page', |
|
| 1577 | - 'post_author' => $current_user->ID, |
|
| 1578 | - 'post_name' => $slug, |
|
| 1579 | - 'post_title' => $page_title, |
|
| 1580 | - 'post_content' => '', |
|
| 1581 | - 'post_parent' => 0, |
|
| 1582 | - 'comment_status' => 'closed' |
|
| 1583 | - ); |
|
| 1584 | - $page_id = wp_insert_post($page_data); |
|
| 1585 | - update_option($option, $page_id); |
|
| 1586 | - if ($page_id) {
|
|
| 1587 | - return true; |
|
| 1588 | - } else {
|
|
| 1589 | - return false; |
|
| 1590 | - } |
|
| 1558 | + global $wpdb, $current_user; |
|
| 1559 | + |
|
| 1560 | + if (!empty($old_id)) {
|
|
| 1561 | + wp_delete_post($old_id, true); |
|
| 1562 | + }//delete post if already there |
|
| 1563 | + else {
|
|
| 1564 | + $page_found = $wpdb->get_var( |
|
| 1565 | + $wpdb->prepare( |
|
| 1566 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 1567 | + array($slug) |
|
| 1568 | + ) |
|
| 1569 | + ); |
|
| 1570 | + wp_delete_post($page_found, true); |
|
| 1571 | + |
|
| 1572 | + } |
|
| 1573 | + |
|
| 1574 | + $page_data = array( |
|
| 1575 | + 'post_status' => 'publish', |
|
| 1576 | + 'post_type' => 'page', |
|
| 1577 | + 'post_author' => $current_user->ID, |
|
| 1578 | + 'post_name' => $slug, |
|
| 1579 | + 'post_title' => $page_title, |
|
| 1580 | + 'post_content' => '', |
|
| 1581 | + 'post_parent' => 0, |
|
| 1582 | + 'comment_status' => 'closed' |
|
| 1583 | + ); |
|
| 1584 | + $page_id = wp_insert_post($page_data); |
|
| 1585 | + update_option($option, $page_id); |
|
| 1586 | + if ($page_id) {
|
|
| 1587 | + return true; |
|
| 1588 | + } else {
|
|
| 1589 | + return false; |
|
| 1590 | + } |
|
| 1591 | 1591 | } |
| 1592 | 1592 | |
| 1593 | 1593 | /** |
@@ -1599,212 +1599,212 @@ discard block |
||
| 1599 | 1599 | */ |
| 1600 | 1600 | function geodir_diagnose_default_pages() |
| 1601 | 1601 | {
|
| 1602 | - global $wpdb; |
|
| 1603 | - $is_error_during_diagnose = false; |
|
| 1604 | - $output_str = ''; |
|
| 1605 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1606 | - |
|
| 1607 | - ////////////////////////////////// |
|
| 1608 | - /* Diagnose GD Home Page Starts */ |
|
| 1609 | - ////////////////////////////////// |
|
| 1610 | - $option_value = get_option('geodir_home_page');
|
|
| 1611 | - $page = get_post($option_value); |
|
| 1612 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1613 | - |
|
| 1614 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1615 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1616 | - else {
|
|
| 1617 | - $is_error_during_diagnose = true; |
|
| 1618 | - $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1619 | - if ($fix) {
|
|
| 1620 | - if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
|
|
| 1621 | - $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1622 | - } else {
|
|
| 1623 | - $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1624 | - } |
|
| 1625 | - } |
|
| 1626 | - } |
|
| 1627 | - |
|
| 1628 | - //////////////////////////////// |
|
| 1629 | - /* Diagnose GD Home Page Ends */ |
|
| 1630 | - //////////////////////////////// |
|
| 1631 | - |
|
| 1632 | - ////////////////////////////////// |
|
| 1633 | - /* Diagnose Add Listing Page Starts */ |
|
| 1634 | - ////////////////////////////////// |
|
| 1635 | - $option_value = get_option('geodir_add_listing_page');
|
|
| 1636 | - $page = get_post($option_value); |
|
| 1637 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1638 | - |
|
| 1639 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1640 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1641 | - else {
|
|
| 1642 | - $is_error_during_diagnose = true; |
|
| 1643 | - $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1644 | - if ($fix) {
|
|
| 1645 | - if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
|
|
| 1646 | - $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1647 | - } else {
|
|
| 1648 | - $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1649 | - } |
|
| 1650 | - } |
|
| 1651 | - } |
|
| 1652 | - |
|
| 1653 | - //////////////////////////////// |
|
| 1654 | - /* Diagnose Add Listing Page Ends */ |
|
| 1655 | - //////////////////////////////// |
|
| 1656 | - |
|
| 1657 | - |
|
| 1658 | - ////////////////////////////////// |
|
| 1659 | - /* Diagnose Listing Preview Page Starts */ |
|
| 1660 | - ////////////////////////////////// |
|
| 1661 | - $option_value = get_option('geodir_preview_page');
|
|
| 1662 | - $page = get_post($option_value); |
|
| 1663 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1664 | - |
|
| 1665 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1666 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1667 | - else {
|
|
| 1668 | - $is_error_during_diagnose = true; |
|
| 1669 | - $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1670 | - if ($fix) {
|
|
| 1671 | - if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
|
|
| 1672 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1673 | - } else {
|
|
| 1674 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1675 | - } |
|
| 1676 | - } |
|
| 1677 | - } |
|
| 1678 | - |
|
| 1679 | - //////////////////////////////// |
|
| 1680 | - /* Diagnose Listing Preview Page Ends */ |
|
| 1681 | - //////////////////////////////// |
|
| 1682 | - |
|
| 1683 | - ////////////////////////////////// |
|
| 1684 | - /* Diagnose Listing Success Page Starts */ |
|
| 1685 | - ////////////////////////////////// |
|
| 1686 | - $option_value = get_option('geodir_success_page');
|
|
| 1687 | - $page = get_post($option_value); |
|
| 1688 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1689 | - |
|
| 1690 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1691 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1692 | - else {
|
|
| 1693 | - $is_error_during_diagnose = true; |
|
| 1694 | - $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1695 | - if ($fix) {
|
|
| 1696 | - if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
|
|
| 1697 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1698 | - } else {
|
|
| 1699 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1700 | - } |
|
| 1701 | - } |
|
| 1702 | - } |
|
| 1703 | - |
|
| 1704 | - //////////////////////////////// |
|
| 1705 | - /* Diagnose Listing Sucess Page Ends */ |
|
| 1706 | - //////////////////////////////// |
|
| 1707 | - |
|
| 1708 | - ////////////////////////////////// |
|
| 1709 | - /* Diagnose Info Page Starts */ |
|
| 1710 | - ////////////////////////////////// |
|
| 1711 | - $option_value = get_option('geodir_info_page');
|
|
| 1712 | - $page = get_post($option_value); |
|
| 1713 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1714 | - |
|
| 1715 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1716 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1717 | - else {
|
|
| 1718 | - $is_error_during_diagnose = true; |
|
| 1719 | - $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1720 | - if ($fix) {
|
|
| 1721 | - if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
|
|
| 1722 | - $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1723 | - } else {
|
|
| 1724 | - $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1725 | - } |
|
| 1726 | - } |
|
| 1727 | - } |
|
| 1728 | - |
|
| 1729 | - //////////////////////////////// |
|
| 1730 | - /* Diagnose Info Page Ends */ |
|
| 1731 | - //////////////////////////////// |
|
| 1732 | - |
|
| 1733 | - ////////////////////////////////// |
|
| 1734 | - /* Diagnose Login Page Starts */ |
|
| 1735 | - ////////////////////////////////// |
|
| 1736 | - $option_value = get_option('geodir_login_page');
|
|
| 1737 | - $page = get_post($option_value); |
|
| 1738 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1739 | - |
|
| 1740 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1741 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1742 | - else {
|
|
| 1743 | - $is_error_during_diagnose = true; |
|
| 1744 | - $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1745 | - if ($fix) {
|
|
| 1746 | - if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
|
|
| 1747 | - $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1748 | - } else {
|
|
| 1749 | - $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1750 | - } |
|
| 1751 | - } |
|
| 1752 | - } |
|
| 1753 | - |
|
| 1754 | - //////////////////////////////// |
|
| 1755 | - /* Diagnose Info Page Ends */ |
|
| 1756 | - //////////////////////////////// |
|
| 1757 | - |
|
| 1758 | - ////////////////////////////////// |
|
| 1759 | - /* Diagnose Location Page Starts */ |
|
| 1760 | - ////////////////////////////////// |
|
| 1761 | - $option_value = get_option('geodir_location_page');
|
|
| 1762 | - $page = get_post($option_value); |
|
| 1763 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1764 | - |
|
| 1765 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1766 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1767 | - else {
|
|
| 1768 | - $is_error_during_diagnose = true; |
|
| 1769 | - $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1770 | - if ($fix) {
|
|
| 1771 | - if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
|
|
| 1772 | - $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1773 | - } else {
|
|
| 1774 | - $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1775 | - } |
|
| 1776 | - } |
|
| 1777 | - } |
|
| 1778 | - |
|
| 1779 | - //////////////////////////////// |
|
| 1780 | - /* Diagnose Location Page Ends */ |
|
| 1781 | - //////////////////////////////// |
|
| 1782 | - |
|
| 1783 | - $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
|
|
| 1784 | - /** |
|
| 1785 | - * This action is called at the end of the GD Tools page check function. |
|
| 1786 | - * |
|
| 1787 | - * @since 1.5.2 |
|
| 1788 | - */ |
|
| 1789 | - $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
|
|
| 1790 | - |
|
| 1791 | - $output_str = $page_chk_arr['output_str']; |
|
| 1792 | - $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
|
| 1793 | - |
|
| 1794 | - if ($is_error_during_diagnose) {
|
|
| 1795 | - if ($fix) {
|
|
| 1796 | - flush_rewrite_rules(); |
|
| 1797 | - } |
|
| 1798 | - $info_div_class = "geodir_problem_info"; |
|
| 1799 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
| 1800 | - } else {
|
|
| 1801 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1802 | - $fix_button_txt = ''; |
|
| 1803 | - } |
|
| 1804 | - echo "<ul class='$info_div_class'>"; |
|
| 1805 | - echo $output_str; |
|
| 1806 | - echo $fix_button_txt; |
|
| 1807 | - echo "</ul>"; |
|
| 1602 | + global $wpdb; |
|
| 1603 | + $is_error_during_diagnose = false; |
|
| 1604 | + $output_str = ''; |
|
| 1605 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1606 | + |
|
| 1607 | + ////////////////////////////////// |
|
| 1608 | + /* Diagnose GD Home Page Starts */ |
|
| 1609 | + ////////////////////////////////// |
|
| 1610 | + $option_value = get_option('geodir_home_page');
|
|
| 1611 | + $page = get_post($option_value); |
|
| 1612 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1613 | + |
|
| 1614 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1615 | + $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1616 | + else {
|
|
| 1617 | + $is_error_during_diagnose = true; |
|
| 1618 | + $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1619 | + if ($fix) {
|
|
| 1620 | + if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
|
|
| 1621 | + $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1622 | + } else {
|
|
| 1623 | + $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1624 | + } |
|
| 1625 | + } |
|
| 1626 | + } |
|
| 1627 | + |
|
| 1628 | + //////////////////////////////// |
|
| 1629 | + /* Diagnose GD Home Page Ends */ |
|
| 1630 | + //////////////////////////////// |
|
| 1631 | + |
|
| 1632 | + ////////////////////////////////// |
|
| 1633 | + /* Diagnose Add Listing Page Starts */ |
|
| 1634 | + ////////////////////////////////// |
|
| 1635 | + $option_value = get_option('geodir_add_listing_page');
|
|
| 1636 | + $page = get_post($option_value); |
|
| 1637 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1638 | + |
|
| 1639 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1640 | + $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1641 | + else {
|
|
| 1642 | + $is_error_during_diagnose = true; |
|
| 1643 | + $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1644 | + if ($fix) {
|
|
| 1645 | + if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
|
|
| 1646 | + $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1647 | + } else {
|
|
| 1648 | + $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1649 | + } |
|
| 1650 | + } |
|
| 1651 | + } |
|
| 1652 | + |
|
| 1653 | + //////////////////////////////// |
|
| 1654 | + /* Diagnose Add Listing Page Ends */ |
|
| 1655 | + //////////////////////////////// |
|
| 1656 | + |
|
| 1657 | + |
|
| 1658 | + ////////////////////////////////// |
|
| 1659 | + /* Diagnose Listing Preview Page Starts */ |
|
| 1660 | + ////////////////////////////////// |
|
| 1661 | + $option_value = get_option('geodir_preview_page');
|
|
| 1662 | + $page = get_post($option_value); |
|
| 1663 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1664 | + |
|
| 1665 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1666 | + $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1667 | + else {
|
|
| 1668 | + $is_error_during_diagnose = true; |
|
| 1669 | + $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1670 | + if ($fix) {
|
|
| 1671 | + if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
|
|
| 1672 | + $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1673 | + } else {
|
|
| 1674 | + $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1675 | + } |
|
| 1676 | + } |
|
| 1677 | + } |
|
| 1678 | + |
|
| 1679 | + //////////////////////////////// |
|
| 1680 | + /* Diagnose Listing Preview Page Ends */ |
|
| 1681 | + //////////////////////////////// |
|
| 1682 | + |
|
| 1683 | + ////////////////////////////////// |
|
| 1684 | + /* Diagnose Listing Success Page Starts */ |
|
| 1685 | + ////////////////////////////////// |
|
| 1686 | + $option_value = get_option('geodir_success_page');
|
|
| 1687 | + $page = get_post($option_value); |
|
| 1688 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1689 | + |
|
| 1690 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1691 | + $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1692 | + else {
|
|
| 1693 | + $is_error_during_diagnose = true; |
|
| 1694 | + $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1695 | + if ($fix) {
|
|
| 1696 | + if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
|
|
| 1697 | + $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1698 | + } else {
|
|
| 1699 | + $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1700 | + } |
|
| 1701 | + } |
|
| 1702 | + } |
|
| 1703 | + |
|
| 1704 | + //////////////////////////////// |
|
| 1705 | + /* Diagnose Listing Sucess Page Ends */ |
|
| 1706 | + //////////////////////////////// |
|
| 1707 | + |
|
| 1708 | + ////////////////////////////////// |
|
| 1709 | + /* Diagnose Info Page Starts */ |
|
| 1710 | + ////////////////////////////////// |
|
| 1711 | + $option_value = get_option('geodir_info_page');
|
|
| 1712 | + $page = get_post($option_value); |
|
| 1713 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1714 | + |
|
| 1715 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1716 | + $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1717 | + else {
|
|
| 1718 | + $is_error_during_diagnose = true; |
|
| 1719 | + $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1720 | + if ($fix) {
|
|
| 1721 | + if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
|
|
| 1722 | + $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1723 | + } else {
|
|
| 1724 | + $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1725 | + } |
|
| 1726 | + } |
|
| 1727 | + } |
|
| 1728 | + |
|
| 1729 | + //////////////////////////////// |
|
| 1730 | + /* Diagnose Info Page Ends */ |
|
| 1731 | + //////////////////////////////// |
|
| 1732 | + |
|
| 1733 | + ////////////////////////////////// |
|
| 1734 | + /* Diagnose Login Page Starts */ |
|
| 1735 | + ////////////////////////////////// |
|
| 1736 | + $option_value = get_option('geodir_login_page');
|
|
| 1737 | + $page = get_post($option_value); |
|
| 1738 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1739 | + |
|
| 1740 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1741 | + $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1742 | + else {
|
|
| 1743 | + $is_error_during_diagnose = true; |
|
| 1744 | + $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1745 | + if ($fix) {
|
|
| 1746 | + if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
|
|
| 1747 | + $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1748 | + } else {
|
|
| 1749 | + $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1750 | + } |
|
| 1751 | + } |
|
| 1752 | + } |
|
| 1753 | + |
|
| 1754 | + //////////////////////////////// |
|
| 1755 | + /* Diagnose Info Page Ends */ |
|
| 1756 | + //////////////////////////////// |
|
| 1757 | + |
|
| 1758 | + ////////////////////////////////// |
|
| 1759 | + /* Diagnose Location Page Starts */ |
|
| 1760 | + ////////////////////////////////// |
|
| 1761 | + $option_value = get_option('geodir_location_page');
|
|
| 1762 | + $page = get_post($option_value); |
|
| 1763 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1764 | + |
|
| 1765 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1766 | + $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1767 | + else {
|
|
| 1768 | + $is_error_during_diagnose = true; |
|
| 1769 | + $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1770 | + if ($fix) {
|
|
| 1771 | + if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
|
|
| 1772 | + $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1773 | + } else {
|
|
| 1774 | + $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1775 | + } |
|
| 1776 | + } |
|
| 1777 | + } |
|
| 1778 | + |
|
| 1779 | + //////////////////////////////// |
|
| 1780 | + /* Diagnose Location Page Ends */ |
|
| 1781 | + //////////////////////////////// |
|
| 1782 | + |
|
| 1783 | + $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
|
|
| 1784 | + /** |
|
| 1785 | + * This action is called at the end of the GD Tools page check function. |
|
| 1786 | + * |
|
| 1787 | + * @since 1.5.2 |
|
| 1788 | + */ |
|
| 1789 | + $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
|
|
| 1790 | + |
|
| 1791 | + $output_str = $page_chk_arr['output_str']; |
|
| 1792 | + $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
|
| 1793 | + |
|
| 1794 | + if ($is_error_during_diagnose) {
|
|
| 1795 | + if ($fix) {
|
|
| 1796 | + flush_rewrite_rules(); |
|
| 1797 | + } |
|
| 1798 | + $info_div_class = "geodir_problem_info"; |
|
| 1799 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
| 1800 | + } else {
|
|
| 1801 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1802 | + $fix_button_txt = ''; |
|
| 1803 | + } |
|
| 1804 | + echo "<ul class='$info_div_class'>"; |
|
| 1805 | + echo $output_str; |
|
| 1806 | + echo $fix_button_txt; |
|
| 1807 | + echo "</ul>"; |
|
| 1808 | 1808 | |
| 1809 | 1809 | } |
| 1810 | 1810 | |
@@ -1816,26 +1816,26 @@ discard block |
||
| 1816 | 1816 | * @global object $wpdb WordPress Database object. |
| 1817 | 1817 | */ |
| 1818 | 1818 | function geodir_diagnose_load_db_language() {
|
| 1819 | - global $wpdb; |
|
| 1819 | + global $wpdb; |
|
| 1820 | 1820 | |
| 1821 | 1821 | $is_error_during_diagnose = geodirectory_load_db_language(); |
| 1822 | 1822 | |
| 1823 | - $output_str = ''; |
|
| 1824 | - $fix_button_txt = ''; |
|
| 1823 | + $output_str = ''; |
|
| 1824 | + $fix_button_txt = ''; |
|
| 1825 | 1825 | |
| 1826 | - if ($is_error_during_diagnose) {
|
|
| 1827 | - $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>";
|
|
| 1826 | + if ($is_error_during_diagnose) {
|
|
| 1827 | + $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>";
|
|
| 1828 | 1828 | $info_div_class = "geodir_problem_info"; |
| 1829 | - } else {
|
|
| 1830 | - $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
|
|
| 1829 | + } else {
|
|
| 1830 | + $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
|
|
| 1831 | 1831 | $info_div_class = "geodir_noproblem_info"; |
| 1832 | - $fix_button_txt = ''; |
|
| 1833 | - } |
|
| 1832 | + $fix_button_txt = ''; |
|
| 1833 | + } |
|
| 1834 | 1834 | |
| 1835 | 1835 | echo "<ul class='$info_div_class'>"; |
| 1836 | - echo $output_str; |
|
| 1837 | - echo $fix_button_txt; |
|
| 1838 | - echo "</ul>"; |
|
| 1836 | + echo $output_str; |
|
| 1837 | + echo $fix_button_txt; |
|
| 1838 | + echo "</ul>"; |
|
| 1839 | 1839 | |
| 1840 | 1840 | } |
| 1841 | 1841 | |
@@ -1866,23 +1866,23 @@ discard block |
||
| 1866 | 1866 | */ |
| 1867 | 1867 | function geodir_posts_clauses_request($clauses) |
| 1868 | 1868 | {
|
| 1869 | - global $wpdb, $wp_query, $plugin_prefix; |
|
| 1869 | + global $wpdb, $wp_query, $plugin_prefix; |
|
| 1870 | 1870 | |
| 1871 | - if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) {
|
|
| 1872 | - $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
| 1871 | + if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) {
|
|
| 1872 | + $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
| 1873 | 1873 | |
| 1874 | - $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
| 1875 | - $clauses['join'] = $join; |
|
| 1874 | + $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
| 1875 | + $clauses['join'] = $join; |
|
| 1876 | 1876 | |
| 1877 | - $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
| 1878 | - $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire'; |
|
| 1879 | - $clauses['fields'] = $fields; |
|
| 1877 | + $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
| 1878 | + $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire'; |
|
| 1879 | + $clauses['fields'] = $fields; |
|
| 1880 | 1880 | |
| 1881 | - $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
|
| 1882 | - $orderby = 'gd_expire ' . $order; |
|
| 1883 | - $clauses['orderby'] = $orderby; |
|
| 1884 | - } |
|
| 1885 | - return $clauses; |
|
| 1881 | + $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
|
| 1882 | + $orderby = 'gd_expire ' . $order; |
|
| 1883 | + $clauses['orderby'] = $orderby; |
|
| 1884 | + } |
|
| 1885 | + return $clauses; |
|
| 1886 | 1886 | } |
| 1887 | 1887 | |
| 1888 | 1888 | |
@@ -1903,7 +1903,7 @@ discard block |
||
| 1903 | 1903 | */ |
| 1904 | 1904 | function gd_theme_switch_compat_check() |
| 1905 | 1905 | {
|
| 1906 | - gd_set_theme_compat(); |
|
| 1906 | + gd_set_theme_compat(); |
|
| 1907 | 1907 | } |
| 1908 | 1908 | |
| 1909 | 1909 | /** |
@@ -1916,27 +1916,27 @@ discard block |
||
| 1916 | 1916 | */ |
| 1917 | 1917 | function geodir_str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\") |
| 1918 | 1918 | {
|
| 1919 | - if (function_exists('str_getcsv')) {
|
|
| 1920 | - $fgetcsv = str_getcsv($input, $delimiter, $enclosure, $escape); |
|
| 1921 | - } else {
|
|
| 1922 | - global $current_user; |
|
| 1923 | - $upload_dir = wp_upload_dir(); |
|
| 1924 | - |
|
| 1925 | - $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
| 1926 | - $handle = fopen($file, 'w'); |
|
| 1927 | - |
|
| 1928 | - fwrite($handle, $input); |
|
| 1929 | - fclose($handle); |
|
| 1930 | - |
|
| 1931 | - $handle = fopen($file, 'rt'); |
|
| 1932 | - if (PHP_VERSION >= '5.3.0') {
|
|
| 1933 | - $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure, $escape); |
|
| 1934 | - } else {
|
|
| 1935 | - $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure); |
|
| 1936 | - } |
|
| 1937 | - fclose($handle); |
|
| 1938 | - } |
|
| 1939 | - return $fgetcsv; |
|
| 1919 | + if (function_exists('str_getcsv')) {
|
|
| 1920 | + $fgetcsv = str_getcsv($input, $delimiter, $enclosure, $escape); |
|
| 1921 | + } else {
|
|
| 1922 | + global $current_user; |
|
| 1923 | + $upload_dir = wp_upload_dir(); |
|
| 1924 | + |
|
| 1925 | + $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
| 1926 | + $handle = fopen($file, 'w'); |
|
| 1927 | + |
|
| 1928 | + fwrite($handle, $input); |
|
| 1929 | + fclose($handle); |
|
| 1930 | + |
|
| 1931 | + $handle = fopen($file, 'rt'); |
|
| 1932 | + if (PHP_VERSION >= '5.3.0') {
|
|
| 1933 | + $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure, $escape); |
|
| 1934 | + } else {
|
|
| 1935 | + $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure); |
|
| 1936 | + } |
|
| 1937 | + fclose($handle); |
|
| 1938 | + } |
|
| 1939 | + return $fgetcsv; |
|
| 1940 | 1940 | } |
| 1941 | 1941 | |
| 1942 | 1942 | add_action('wp_ajax_gdImportCsv', 'geodir_ajax_import_csv');
|
@@ -1951,375 +1951,375 @@ discard block |
||
| 1951 | 1951 | */ |
| 1952 | 1952 | function geodir_ajax_import_csv() |
| 1953 | 1953 | {
|
| 1954 | - error_reporting(0); // hide error to get clean json response |
|
| 1954 | + error_reporting(0); // hide error to get clean json response |
|
| 1955 | 1955 | |
| 1956 | - global $wpdb, $plugin_prefix, $current_user; |
|
| 1957 | - $uploads = wp_upload_dir(); |
|
| 1958 | - ini_set('auto_detect_line_endings', true);
|
|
| 1956 | + global $wpdb, $plugin_prefix, $current_user; |
|
| 1957 | + $uploads = wp_upload_dir(); |
|
| 1958 | + ini_set('auto_detect_line_endings', true);
|
|
| 1959 | 1959 | |
| 1960 | 1960 | $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses. |
| 1961 | 1961 | |
| 1962 | - $task = isset($_POST['task']) ? $_POST['task'] : ''; |
|
| 1963 | - $uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL; |
|
| 1964 | - $filename = $uploadedFile; |
|
| 1965 | - |
|
| 1966 | - $uploads = wp_upload_dir(); |
|
| 1967 | - $uploads_dir = $uploads['path']; |
|
| 1968 | - $image_name_arr = explode('/', $filename);
|
|
| 1969 | - $filename = end($image_name_arr); |
|
| 1970 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1971 | - $return = array(); |
|
| 1972 | - $return['file'] = $uploadedFile; |
|
| 1973 | - $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
|
| 1974 | - |
|
| 1975 | - if (is_file($target_path) && file_exists($target_path) && $uploadedFile) {
|
|
| 1976 | - $wp_filetype = wp_check_filetype_and_ext($target_path, $filename); |
|
| 1977 | - |
|
| 1978 | - if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
|
|
| 1979 | - $return['error'] = NULL; |
|
| 1980 | - |
|
| 1981 | - $return['rows'] = 0; |
|
| 1982 | - |
|
| 1983 | - |
|
| 1984 | - |
|
| 1985 | - if (($handle = fopen($target_path, "r")) !== FALSE) {
|
|
| 1986 | - while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
|
| 1987 | - if(is_array($data) && !empty($data)) {
|
|
| 1988 | - $file[] = '"' . implode('","', $data) . '"';
|
|
| 1989 | - } |
|
| 1990 | - } |
|
| 1991 | - fclose($handle); |
|
| 1992 | - $file = $file; |
|
| 1993 | - } |
|
| 1994 | - |
|
| 1995 | - |
|
| 1996 | - |
|
| 1997 | - $return['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0; |
|
| 1998 | - |
|
| 1999 | - |
|
| 2000 | - if (!$return['rows'] > 0) {
|
|
| 2001 | - $return['error'] = __('No data found in csv file.', 'geodirectory');
|
|
| 2002 | - } |
|
| 2003 | - } |
|
| 2004 | - } |
|
| 2005 | - if ($task == 'prepare' || !empty($return['error'])) {
|
|
| 2006 | - echo json_encode($return); |
|
| 2007 | - exit; |
|
| 2008 | - } |
|
| 2009 | - |
|
| 2010 | - $totRecords = isset($_POST['gddata']['totRecords']) ? $_POST['gddata']['totRecords'] : NULL; |
|
| 2011 | - $importlimit = isset($_POST['gddata']['importlimit']) ? $_POST['gddata']['importlimit'] : 1; |
|
| 2012 | - $count = $importlimit; |
|
| 2013 | - $requested_limit = $importlimit; |
|
| 2014 | - $tmpCnt = isset($_POST['gddata']['tmpcount']) ? $_POST['gddata']['tmpcount'] : 0; |
|
| 2015 | - |
|
| 2016 | - if ($count < $totRecords) {
|
|
| 2017 | - $count = $tmpCnt + $count; |
|
| 2018 | - if ($count > $totRecords) {
|
|
| 2019 | - $count = $totRecords; |
|
| 2020 | - } |
|
| 2021 | - } else {
|
|
| 2022 | - $count = $totRecords; |
|
| 2023 | - } |
|
| 2024 | - |
|
| 2025 | - $total_records = 0; |
|
| 2026 | - $rowcount = 0; |
|
| 2027 | - $address_invalid = 0; |
|
| 2028 | - $blank_address = 0; |
|
| 2029 | - $upload_files = 0; |
|
| 2030 | - $invalid_post_type = 0; |
|
| 2031 | - $invalid_title = 0; |
|
| 2032 | - $customKeyarray = array(); |
|
| 2033 | - $gd_post_info = array(); |
|
| 2034 | - $post_location = array(); |
|
| 2035 | - $countpost = 0; |
|
| 2036 | - |
|
| 2037 | - if (!empty($file)) {
|
|
| 2038 | - $columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL; |
|
| 2039 | - $customKeyarray = $columns; |
|
| 2040 | - |
|
| 2041 | - if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 2042 | - $return['error'] = CSV_INVAILD_FILE; |
|
| 2043 | - echo json_encode($return); |
|
| 2044 | - exit; |
|
| 2045 | - } |
|
| 2046 | - |
|
| 2047 | - for ($i = 1; $i <= $importlimit; $i++) {
|
|
| 2048 | - $current_index = $tmpCnt + $i; |
|
| 2049 | - if (isset($file[$current_index])) {
|
|
| 2050 | - $total_records++; |
|
| 2051 | - |
|
| 2052 | - $buffer = geodir_str_getcsv($file[$current_index]); |
|
| 2053 | - $post_title = addslashes($buffer[0]); |
|
| 2054 | - $current_post_author = $buffer[1]; |
|
| 2055 | - $post_desc = addslashes($buffer[2]); |
|
| 2056 | - $post_cat = array(); |
|
| 2057 | - $catids_arr = array(); |
|
| 2058 | - $post_cat = trim($buffer[3]); // comma seperated category name |
|
| 2059 | - |
|
| 2060 | - if ($post_cat) {
|
|
| 2061 | - $post_cat_arr = explode(',', $post_cat);
|
|
| 2062 | - |
|
| 2063 | - for ($c = 0; $c < count($post_cat_arr); $c++) {
|
|
| 2064 | - $catid = wp_kses_normalize_entities(trim($post_cat_arr[$c])); |
|
| 2065 | - |
|
| 2066 | - if (!empty($buffer[5])) {
|
|
| 2067 | - if (in_array($buffer[5], geodir_get_posttypes())) {
|
|
| 2068 | - |
|
| 2069 | - $p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5])); |
|
| 2070 | - |
|
| 2071 | - if (get_term_by('name', $catid, $p_taxonomy[0])) {
|
|
| 2072 | - $cat = get_term_by('name', $catid, $p_taxonomy[0]);
|
|
| 2073 | - $catids_arr[] = $cat->slug; |
|
| 2074 | - } else if (get_term_by('slug', $catid, $p_taxonomy[0])) {
|
|
| 2075 | - $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
|
|
| 2076 | - $catids_arr[] = $cat->slug; |
|
| 2077 | - } else {
|
|
| 2078 | - $ret = wp_insert_term($catid, $p_taxonomy[0]); |
|
| 2079 | - if ($ret && !is_wp_error($ret)) {
|
|
| 2080 | - if (get_term_by('name', $catid, $p_taxonomy[0])) {
|
|
| 2081 | - $cat = get_term_by('name', $catid, $p_taxonomy[0]);
|
|
| 2082 | - $catids_arr[] = $cat->slug; |
|
| 2083 | - } elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
|
|
| 2084 | - $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
|
|
| 2085 | - $catids_arr[] = $cat->slug; |
|
| 2086 | - } |
|
| 2087 | - } |
|
| 2088 | - } |
|
| 2089 | - } |
|
| 2090 | - } |
|
| 2091 | - } |
|
| 2092 | - } |
|
| 2093 | - |
|
| 2094 | - if (!$catids_arr) {
|
|
| 2095 | - $catids_arr[] = 1; |
|
| 2096 | - } |
|
| 2097 | - |
|
| 2098 | - $post_tags = trim($buffer[4]); // comma seperated tags |
|
| 2099 | - |
|
| 2100 | - $tag_arr = ''; |
|
| 2101 | - if ($post_tags) {
|
|
| 2102 | - $tag_arr = explode(',', $post_tags);
|
|
| 2103 | - } |
|
| 2104 | - |
|
| 2105 | - $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
| 2106 | - |
|
| 2107 | - $error = ''; |
|
| 2108 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
|
|
| 2109 | - $invalid_post_type++; |
|
| 2110 | - continue; |
|
| 2111 | - } |
|
| 2112 | - |
|
| 2113 | - if ($post_title != '') {
|
|
| 2114 | - $menu_order = 0; |
|
| 2115 | - $image_folder_name = 'uplaod/'; |
|
| 2116 | - |
|
| 2117 | - $image_names = array(); |
|
| 2118 | - |
|
| 2119 | - for ($c = 5; $c < count($customKeyarray); $c++) {
|
|
| 2120 | - $gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]); |
|
| 2121 | - |
|
| 2122 | - if ($customKeyarray[$c] == 'IMAGE') {
|
|
| 2123 | - $buffer[$c] = trim($buffer[$c]); |
|
| 2124 | - |
|
| 2125 | - if (!empty($buffer[$c])) {
|
|
| 2126 | - $image_names[] = $buffer[$c]; |
|
| 2127 | - } |
|
| 2128 | - } |
|
| 2129 | - |
|
| 2130 | - if ($customKeyarray[$c] == 'alive_days') {
|
|
| 2131 | - if ($buffer[$c] != '0' && $buffer[$c] != '') {
|
|
| 2132 | - $submitdata = date('Y-m-d');
|
|
| 2133 | - |
|
| 2134 | - $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
|
|
| 2135 | - } else {
|
|
| 2136 | - $gd_post_info['expire_date'] = 'Never'; |
|
| 2137 | - } |
|
| 2138 | - } |
|
| 2139 | - |
|
| 2140 | - if ($customKeyarray[$c] == 'post_city') {
|
|
| 2141 | - $post_city = addslashes($buffer[$c]); |
|
| 2142 | - } |
|
| 2143 | - |
|
| 2144 | - if ($customKeyarray[$c] == 'post_region') {
|
|
| 2145 | - $post_region = addslashes($buffer[$c]); |
|
| 2146 | - } |
|
| 2147 | - |
|
| 2148 | - if ($customKeyarray[$c] == 'post_country') {
|
|
| 2149 | - $post_country = addslashes($buffer[$c]); |
|
| 2150 | - } |
|
| 2151 | - |
|
| 2152 | - if ($customKeyarray[$c] == 'post_latitude') {
|
|
| 2153 | - $post_latitude = addslashes($buffer[$c]); |
|
| 2154 | - } |
|
| 2155 | - |
|
| 2156 | - if ($customKeyarray[$c] == 'post_longitude') {
|
|
| 2157 | - $post_longitude = addslashes($buffer[$c]); |
|
| 2158 | - } |
|
| 1962 | + $task = isset($_POST['task']) ? $_POST['task'] : ''; |
|
| 1963 | + $uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL; |
|
| 1964 | + $filename = $uploadedFile; |
|
| 1965 | + |
|
| 1966 | + $uploads = wp_upload_dir(); |
|
| 1967 | + $uploads_dir = $uploads['path']; |
|
| 1968 | + $image_name_arr = explode('/', $filename);
|
|
| 1969 | + $filename = end($image_name_arr); |
|
| 1970 | + $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1971 | + $return = array(); |
|
| 1972 | + $return['file'] = $uploadedFile; |
|
| 1973 | + $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
|
| 1974 | + |
|
| 1975 | + if (is_file($target_path) && file_exists($target_path) && $uploadedFile) {
|
|
| 1976 | + $wp_filetype = wp_check_filetype_and_ext($target_path, $filename); |
|
| 1977 | + |
|
| 1978 | + if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
|
|
| 1979 | + $return['error'] = NULL; |
|
| 1980 | + |
|
| 1981 | + $return['rows'] = 0; |
|
| 1982 | + |
|
| 1983 | + |
|
| 1984 | + |
|
| 1985 | + if (($handle = fopen($target_path, "r")) !== FALSE) {
|
|
| 1986 | + while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
|
| 1987 | + if(is_array($data) && !empty($data)) {
|
|
| 1988 | + $file[] = '"' . implode('","', $data) . '"';
|
|
| 1989 | + } |
|
| 1990 | + } |
|
| 1991 | + fclose($handle); |
|
| 1992 | + $file = $file; |
|
| 1993 | + } |
|
| 1994 | + |
|
| 1995 | + |
|
| 1996 | + |
|
| 1997 | + $return['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0; |
|
| 1998 | + |
|
| 1999 | + |
|
| 2000 | + if (!$return['rows'] > 0) {
|
|
| 2001 | + $return['error'] = __('No data found in csv file.', 'geodirectory');
|
|
| 2002 | + } |
|
| 2003 | + } |
|
| 2004 | + } |
|
| 2005 | + if ($task == 'prepare' || !empty($return['error'])) {
|
|
| 2006 | + echo json_encode($return); |
|
| 2007 | + exit; |
|
| 2008 | + } |
|
| 2009 | + |
|
| 2010 | + $totRecords = isset($_POST['gddata']['totRecords']) ? $_POST['gddata']['totRecords'] : NULL; |
|
| 2011 | + $importlimit = isset($_POST['gddata']['importlimit']) ? $_POST['gddata']['importlimit'] : 1; |
|
| 2012 | + $count = $importlimit; |
|
| 2013 | + $requested_limit = $importlimit; |
|
| 2014 | + $tmpCnt = isset($_POST['gddata']['tmpcount']) ? $_POST['gddata']['tmpcount'] : 0; |
|
| 2015 | + |
|
| 2016 | + if ($count < $totRecords) {
|
|
| 2017 | + $count = $tmpCnt + $count; |
|
| 2018 | + if ($count > $totRecords) {
|
|
| 2019 | + $count = $totRecords; |
|
| 2020 | + } |
|
| 2021 | + } else {
|
|
| 2022 | + $count = $totRecords; |
|
| 2023 | + } |
|
| 2024 | + |
|
| 2025 | + $total_records = 0; |
|
| 2026 | + $rowcount = 0; |
|
| 2027 | + $address_invalid = 0; |
|
| 2028 | + $blank_address = 0; |
|
| 2029 | + $upload_files = 0; |
|
| 2030 | + $invalid_post_type = 0; |
|
| 2031 | + $invalid_title = 0; |
|
| 2032 | + $customKeyarray = array(); |
|
| 2033 | + $gd_post_info = array(); |
|
| 2034 | + $post_location = array(); |
|
| 2035 | + $countpost = 0; |
|
| 2036 | + |
|
| 2037 | + if (!empty($file)) {
|
|
| 2038 | + $columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL; |
|
| 2039 | + $customKeyarray = $columns; |
|
| 2040 | + |
|
| 2041 | + if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 2042 | + $return['error'] = CSV_INVAILD_FILE; |
|
| 2043 | + echo json_encode($return); |
|
| 2044 | + exit; |
|
| 2045 | + } |
|
| 2046 | + |
|
| 2047 | + for ($i = 1; $i <= $importlimit; $i++) {
|
|
| 2048 | + $current_index = $tmpCnt + $i; |
|
| 2049 | + if (isset($file[$current_index])) {
|
|
| 2050 | + $total_records++; |
|
| 2051 | + |
|
| 2052 | + $buffer = geodir_str_getcsv($file[$current_index]); |
|
| 2053 | + $post_title = addslashes($buffer[0]); |
|
| 2054 | + $current_post_author = $buffer[1]; |
|
| 2055 | + $post_desc = addslashes($buffer[2]); |
|
| 2056 | + $post_cat = array(); |
|
| 2057 | + $catids_arr = array(); |
|
| 2058 | + $post_cat = trim($buffer[3]); // comma seperated category name |
|
| 2059 | + |
|
| 2060 | + if ($post_cat) {
|
|
| 2061 | + $post_cat_arr = explode(',', $post_cat);
|
|
| 2062 | + |
|
| 2063 | + for ($c = 0; $c < count($post_cat_arr); $c++) {
|
|
| 2064 | + $catid = wp_kses_normalize_entities(trim($post_cat_arr[$c])); |
|
| 2065 | + |
|
| 2066 | + if (!empty($buffer[5])) {
|
|
| 2067 | + if (in_array($buffer[5], geodir_get_posttypes())) {
|
|
| 2068 | + |
|
| 2069 | + $p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5])); |
|
| 2070 | + |
|
| 2071 | + if (get_term_by('name', $catid, $p_taxonomy[0])) {
|
|
| 2072 | + $cat = get_term_by('name', $catid, $p_taxonomy[0]);
|
|
| 2073 | + $catids_arr[] = $cat->slug; |
|
| 2074 | + } else if (get_term_by('slug', $catid, $p_taxonomy[0])) {
|
|
| 2075 | + $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
|
|
| 2076 | + $catids_arr[] = $cat->slug; |
|
| 2077 | + } else {
|
|
| 2078 | + $ret = wp_insert_term($catid, $p_taxonomy[0]); |
|
| 2079 | + if ($ret && !is_wp_error($ret)) {
|
|
| 2080 | + if (get_term_by('name', $catid, $p_taxonomy[0])) {
|
|
| 2081 | + $cat = get_term_by('name', $catid, $p_taxonomy[0]);
|
|
| 2082 | + $catids_arr[] = $cat->slug; |
|
| 2083 | + } elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
|
|
| 2084 | + $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
|
|
| 2085 | + $catids_arr[] = $cat->slug; |
|
| 2086 | + } |
|
| 2087 | + } |
|
| 2088 | + } |
|
| 2089 | + } |
|
| 2090 | + } |
|
| 2091 | + } |
|
| 2092 | + } |
|
| 2093 | + |
|
| 2094 | + if (!$catids_arr) {
|
|
| 2095 | + $catids_arr[] = 1; |
|
| 2096 | + } |
|
| 2097 | + |
|
| 2098 | + $post_tags = trim($buffer[4]); // comma seperated tags |
|
| 2099 | + |
|
| 2100 | + $tag_arr = ''; |
|
| 2101 | + if ($post_tags) {
|
|
| 2102 | + $tag_arr = explode(',', $post_tags);
|
|
| 2103 | + } |
|
| 2104 | + |
|
| 2105 | + $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
| 2106 | + |
|
| 2107 | + $error = ''; |
|
| 2108 | + if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
|
|
| 2109 | + $invalid_post_type++; |
|
| 2110 | + continue; |
|
| 2111 | + } |
|
| 2112 | + |
|
| 2113 | + if ($post_title != '') {
|
|
| 2114 | + $menu_order = 0; |
|
| 2115 | + $image_folder_name = 'uplaod/'; |
|
| 2116 | + |
|
| 2117 | + $image_names = array(); |
|
| 2118 | + |
|
| 2119 | + for ($c = 5; $c < count($customKeyarray); $c++) {
|
|
| 2120 | + $gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]); |
|
| 2121 | + |
|
| 2122 | + if ($customKeyarray[$c] == 'IMAGE') {
|
|
| 2123 | + $buffer[$c] = trim($buffer[$c]); |
|
| 2124 | + |
|
| 2125 | + if (!empty($buffer[$c])) {
|
|
| 2126 | + $image_names[] = $buffer[$c]; |
|
| 2127 | + } |
|
| 2128 | + } |
|
| 2129 | + |
|
| 2130 | + if ($customKeyarray[$c] == 'alive_days') {
|
|
| 2131 | + if ($buffer[$c] != '0' && $buffer[$c] != '') {
|
|
| 2132 | + $submitdata = date('Y-m-d');
|
|
| 2133 | + |
|
| 2134 | + $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
|
|
| 2135 | + } else {
|
|
| 2136 | + $gd_post_info['expire_date'] = 'Never'; |
|
| 2137 | + } |
|
| 2138 | + } |
|
| 2139 | + |
|
| 2140 | + if ($customKeyarray[$c] == 'post_city') {
|
|
| 2141 | + $post_city = addslashes($buffer[$c]); |
|
| 2142 | + } |
|
| 2143 | + |
|
| 2144 | + if ($customKeyarray[$c] == 'post_region') {
|
|
| 2145 | + $post_region = addslashes($buffer[$c]); |
|
| 2146 | + } |
|
| 2147 | + |
|
| 2148 | + if ($customKeyarray[$c] == 'post_country') {
|
|
| 2149 | + $post_country = addslashes($buffer[$c]); |
|
| 2150 | + } |
|
| 2151 | + |
|
| 2152 | + if ($customKeyarray[$c] == 'post_latitude') {
|
|
| 2153 | + $post_latitude = addslashes($buffer[$c]); |
|
| 2154 | + } |
|
| 2155 | + |
|
| 2156 | + if ($customKeyarray[$c] == 'post_longitude') {
|
|
| 2157 | + $post_longitude = addslashes($buffer[$c]); |
|
| 2158 | + } |
|
| 2159 | 2159 | |
| 2160 | 2160 | // Post status |
| 2161 | 2161 | if ($customKeyarray[$c] == 'post_status') {
|
| 2162 | - $post_status = sanitize_key( $buffer[$c] ); |
|
| 2163 | - } |
|
| 2164 | - } |
|
| 2165 | - |
|
| 2166 | - /* ================ before array create ============== */ |
|
| 2167 | - $location_result = geodir_get_default_location(); |
|
| 2168 | - if ((!isset($gd_post_info['post_city']) || $gd_post_info['post_city'] == '') || (!isset($gd_post_info['post_region']) || $gd_post_info['post_region'] == '') || (!isset($gd_post_info['post_country']) || $gd_post_info['post_country'] == '') || (!isset($gd_post_info['post_address']) || $gd_post_info['post_address'] == '') || (!isset($gd_post_info['post_latitude']) || $gd_post_info['post_latitude'] == '') || (!isset($gd_post_info['post_longitude']) || $gd_post_info['post_longitude'] == '')) {
|
|
| 2169 | - $blank_address++; |
|
| 2170 | - continue; |
|
| 2171 | - } else if ($location_result->location_id == 0) {
|
|
| 2172 | - if ((geodir_strtolower($gd_post_info['post_city']) != geodir_strtolower($location_result->city)) || (geodir_strtolower($gd_post_info['post_region']) != geodir_strtolower($location_result->region)) || (geodir_strtolower($gd_post_info['post_country']) != geodir_strtolower($location_result->country))) {
|
|
| 2173 | - $address_invalid++; |
|
| 2174 | - continue; |
|
| 2175 | - } |
|
| 2176 | - } |
|
| 2162 | + $post_status = sanitize_key( $buffer[$c] ); |
|
| 2163 | + } |
|
| 2164 | + } |
|
| 2165 | + |
|
| 2166 | + /* ================ before array create ============== */ |
|
| 2167 | + $location_result = geodir_get_default_location(); |
|
| 2168 | + if ((!isset($gd_post_info['post_city']) || $gd_post_info['post_city'] == '') || (!isset($gd_post_info['post_region']) || $gd_post_info['post_region'] == '') || (!isset($gd_post_info['post_country']) || $gd_post_info['post_country'] == '') || (!isset($gd_post_info['post_address']) || $gd_post_info['post_address'] == '') || (!isset($gd_post_info['post_latitude']) || $gd_post_info['post_latitude'] == '') || (!isset($gd_post_info['post_longitude']) || $gd_post_info['post_longitude'] == '')) {
|
|
| 2169 | + $blank_address++; |
|
| 2170 | + continue; |
|
| 2171 | + } else if ($location_result->location_id == 0) {
|
|
| 2172 | + if ((geodir_strtolower($gd_post_info['post_city']) != geodir_strtolower($location_result->city)) || (geodir_strtolower($gd_post_info['post_region']) != geodir_strtolower($location_result->region)) || (geodir_strtolower($gd_post_info['post_country']) != geodir_strtolower($location_result->country))) {
|
|
| 2173 | + $address_invalid++; |
|
| 2174 | + continue; |
|
| 2175 | + } |
|
| 2176 | + } |
|
| 2177 | 2177 | |
| 2178 | 2178 | // Default post status |
| 2179 | 2179 | $default_status = 'publish'; |
| 2180 | 2180 | $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
| 2181 | 2181 | $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
| 2182 | 2182 | |
| 2183 | - $my_post['post_title'] = $post_title; |
|
| 2184 | - $my_post['post_content'] = $post_desc; |
|
| 2185 | - $my_post['post_type'] = addslashes($buffer[5]); |
|
| 2186 | - $my_post['post_author'] = $current_post_author; |
|
| 2187 | - $my_post['post_status'] = $post_status; |
|
| 2188 | - $my_post['post_category'] = $catids_arr; |
|
| 2189 | - $my_post['post_tags'] = $tag_arr; |
|
| 2190 | - |
|
| 2191 | - $gd_post_info['post_tags'] = $tag_arr; |
|
| 2192 | - $gd_post_info['post_title'] = $post_title; |
|
| 2193 | - $gd_post_info['post_status'] = $post_status; |
|
| 2194 | - $gd_post_info['submit_time'] = time(); |
|
| 2195 | - $gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR']; |
|
| 2196 | - |
|
| 2197 | - $last_postid = wp_insert_post($my_post); |
|
| 2198 | - $countpost++; |
|
| 2199 | - |
|
| 2200 | - // Check if we need to save post location as new location |
|
| 2201 | - if ($location_result->location_id > 0) {
|
|
| 2202 | - if (isset($post_city) && isset($post_region)) {
|
|
| 2203 | - $request_info['post_location'] = array( |
|
| 2204 | - 'city' => $post_city, |
|
| 2205 | - 'region' => $post_region, |
|
| 2206 | - 'country' => $post_country, |
|
| 2207 | - 'geo_lat' => $post_latitude, |
|
| 2208 | - 'geo_lng' => $post_longitude |
|
| 2209 | - ); |
|
| 2210 | - |
|
| 2211 | - $post_location_info = $request_info['post_location']; |
|
| 2212 | - if ($location_id = geodir_add_new_location($post_location_info)) |
|
| 2213 | - $post_location_id = $location_id; |
|
| 2214 | - } else {
|
|
| 2215 | - $post_location_id = 0; |
|
| 2216 | - } |
|
| 2217 | - } else {
|
|
| 2218 | - $post_location_id = 0; |
|
| 2219 | - } |
|
| 2220 | - |
|
| 2221 | - /* ------- get default package info ----- */ |
|
| 2222 | - $payment_info = array(); |
|
| 2223 | - $package_info = array(); |
|
| 2224 | - |
|
| 2225 | - $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
| 2226 | - $package_id = ''; |
|
| 2227 | - if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
|
|
| 2228 | - $package_id = $gd_post_info['package_id']; |
|
| 2229 | - } |
|
| 2230 | - |
|
| 2231 | - if (!empty($package_info)) {
|
|
| 2232 | - $payment_info['package_id'] = $package_info['pid']; |
|
| 2233 | - |
|
| 2234 | - if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
|
|
| 2235 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
|
|
| 2236 | - } else {
|
|
| 2237 | - $payment_info['expire_date'] = 'Never'; |
|
| 2238 | - } |
|
| 2239 | - |
|
| 2240 | - $gd_post_info = array_merge($gd_post_info, $payment_info); |
|
| 2241 | - } |
|
| 2242 | - |
|
| 2243 | - $gd_post_info['post_location_id'] = $post_location_id; |
|
| 2244 | - |
|
| 2245 | - $post_type = get_post_type($last_postid); |
|
| 2246 | - |
|
| 2247 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2248 | - |
|
| 2249 | - geodir_save_post_info($last_postid, $gd_post_info); |
|
| 2250 | - |
|
| 2251 | - if (!empty($image_names)) {
|
|
| 2252 | - $upload_files++; |
|
| 2253 | - $menu_order = 1; |
|
| 2254 | - |
|
| 2255 | - foreach ($image_names as $image_name) {
|
|
| 2256 | - $img_name_arr = explode('.', $image_name);
|
|
| 2257 | - |
|
| 2258 | - $uploads = wp_upload_dir(); |
|
| 2259 | - $sub_dir = $uploads['subdir']; |
|
| 2260 | - |
|
| 2261 | - $arr_file_type = wp_check_filetype($image_name); |
|
| 2262 | - $uploaded_file_type = $arr_file_type['type']; |
|
| 2263 | - |
|
| 2264 | - $attachment = array(); |
|
| 2265 | - $attachment['post_id'] = $last_postid; |
|
| 2266 | - $attachment['title'] = $img_name_arr[0]; |
|
| 2267 | - $attachment['content'] = ''; |
|
| 2268 | - $attachment['file'] = $sub_dir . '/' . $image_name; |
|
| 2269 | - $attachment['mime_type'] = $uploaded_file_type; |
|
| 2270 | - $attachment['menu_order'] = $menu_order; |
|
| 2271 | - $attachment['is_featured'] = 0; |
|
| 2272 | - |
|
| 2273 | - $attachment_set = ''; |
|
| 2274 | - |
|
| 2275 | - foreach ($attachment as $key => $val) {
|
|
| 2276 | - if ($val != '') |
|
| 2277 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2278 | - } |
|
| 2279 | - $attachment_set = trim($attachment_set, ", "); |
|
| 2280 | - |
|
| 2281 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 2282 | - |
|
| 2283 | - if ($menu_order == 1) {
|
|
| 2284 | - $post_type = get_post_type($last_postid); |
|
| 2285 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
|
|
| 2286 | - } |
|
| 2287 | - $menu_order++; |
|
| 2288 | - } |
|
| 2289 | - } |
|
| 2290 | - |
|
| 2291 | - $gd_post_info['package_id'] = $package_id; |
|
| 2292 | - |
|
| 2293 | - /** This action is documented in geodirectory-functions/post-functions.php */ |
|
| 2294 | - do_action('geodir_after_save_listing', $last_postid, $gd_post_info);
|
|
| 2295 | - |
|
| 2296 | - if (!empty($buffer[5])) {
|
|
| 2297 | - if (in_array($buffer[5], geodir_get_posttypes())) {
|
|
| 2298 | - $taxonomies = geodir_get_posttype_info(addslashes($buffer[5])); |
|
| 2299 | - wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]); |
|
| 2300 | - wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]); |
|
| 2301 | - |
|
| 2302 | - $post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : ''; |
|
| 2303 | - $post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : ''; |
|
| 2304 | - geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str); |
|
| 2305 | - } |
|
| 2306 | - } |
|
| 2307 | - } else {
|
|
| 2308 | - $invalid_title++; |
|
| 2309 | - } |
|
| 2310 | - } |
|
| 2311 | - } |
|
| 2312 | - } |
|
| 2313 | - $return['rowcount'] = $countpost; |
|
| 2314 | - $return['invalidcount'] = $address_invalid; |
|
| 2315 | - $return['blank_address'] = $blank_address; |
|
| 2316 | - $return['upload_files'] = $upload_files; |
|
| 2317 | - $return['invalid_post_type'] = $invalid_post_type; |
|
| 2318 | - $return['invalid_title'] = $invalid_title; |
|
| 2319 | - $return['total_records'] = $total_records; |
|
| 2320 | - |
|
| 2321 | - echo json_encode($return); |
|
| 2322 | - exit; |
|
| 2183 | + $my_post['post_title'] = $post_title; |
|
| 2184 | + $my_post['post_content'] = $post_desc; |
|
| 2185 | + $my_post['post_type'] = addslashes($buffer[5]); |
|
| 2186 | + $my_post['post_author'] = $current_post_author; |
|
| 2187 | + $my_post['post_status'] = $post_status; |
|
| 2188 | + $my_post['post_category'] = $catids_arr; |
|
| 2189 | + $my_post['post_tags'] = $tag_arr; |
|
| 2190 | + |
|
| 2191 | + $gd_post_info['post_tags'] = $tag_arr; |
|
| 2192 | + $gd_post_info['post_title'] = $post_title; |
|
| 2193 | + $gd_post_info['post_status'] = $post_status; |
|
| 2194 | + $gd_post_info['submit_time'] = time(); |
|
| 2195 | + $gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR']; |
|
| 2196 | + |
|
| 2197 | + $last_postid = wp_insert_post($my_post); |
|
| 2198 | + $countpost++; |
|
| 2199 | + |
|
| 2200 | + // Check if we need to save post location as new location |
|
| 2201 | + if ($location_result->location_id > 0) {
|
|
| 2202 | + if (isset($post_city) && isset($post_region)) {
|
|
| 2203 | + $request_info['post_location'] = array( |
|
| 2204 | + 'city' => $post_city, |
|
| 2205 | + 'region' => $post_region, |
|
| 2206 | + 'country' => $post_country, |
|
| 2207 | + 'geo_lat' => $post_latitude, |
|
| 2208 | + 'geo_lng' => $post_longitude |
|
| 2209 | + ); |
|
| 2210 | + |
|
| 2211 | + $post_location_info = $request_info['post_location']; |
|
| 2212 | + if ($location_id = geodir_add_new_location($post_location_info)) |
|
| 2213 | + $post_location_id = $location_id; |
|
| 2214 | + } else {
|
|
| 2215 | + $post_location_id = 0; |
|
| 2216 | + } |
|
| 2217 | + } else {
|
|
| 2218 | + $post_location_id = 0; |
|
| 2219 | + } |
|
| 2220 | + |
|
| 2221 | + /* ------- get default package info ----- */ |
|
| 2222 | + $payment_info = array(); |
|
| 2223 | + $package_info = array(); |
|
| 2224 | + |
|
| 2225 | + $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
| 2226 | + $package_id = ''; |
|
| 2227 | + if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
|
|
| 2228 | + $package_id = $gd_post_info['package_id']; |
|
| 2229 | + } |
|
| 2230 | + |
|
| 2231 | + if (!empty($package_info)) {
|
|
| 2232 | + $payment_info['package_id'] = $package_info['pid']; |
|
| 2233 | + |
|
| 2234 | + if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
|
|
| 2235 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
|
|
| 2236 | + } else {
|
|
| 2237 | + $payment_info['expire_date'] = 'Never'; |
|
| 2238 | + } |
|
| 2239 | + |
|
| 2240 | + $gd_post_info = array_merge($gd_post_info, $payment_info); |
|
| 2241 | + } |
|
| 2242 | + |
|
| 2243 | + $gd_post_info['post_location_id'] = $post_location_id; |
|
| 2244 | + |
|
| 2245 | + $post_type = get_post_type($last_postid); |
|
| 2246 | + |
|
| 2247 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2248 | + |
|
| 2249 | + geodir_save_post_info($last_postid, $gd_post_info); |
|
| 2250 | + |
|
| 2251 | + if (!empty($image_names)) {
|
|
| 2252 | + $upload_files++; |
|
| 2253 | + $menu_order = 1; |
|
| 2254 | + |
|
| 2255 | + foreach ($image_names as $image_name) {
|
|
| 2256 | + $img_name_arr = explode('.', $image_name);
|
|
| 2257 | + |
|
| 2258 | + $uploads = wp_upload_dir(); |
|
| 2259 | + $sub_dir = $uploads['subdir']; |
|
| 2260 | + |
|
| 2261 | + $arr_file_type = wp_check_filetype($image_name); |
|
| 2262 | + $uploaded_file_type = $arr_file_type['type']; |
|
| 2263 | + |
|
| 2264 | + $attachment = array(); |
|
| 2265 | + $attachment['post_id'] = $last_postid; |
|
| 2266 | + $attachment['title'] = $img_name_arr[0]; |
|
| 2267 | + $attachment['content'] = ''; |
|
| 2268 | + $attachment['file'] = $sub_dir . '/' . $image_name; |
|
| 2269 | + $attachment['mime_type'] = $uploaded_file_type; |
|
| 2270 | + $attachment['menu_order'] = $menu_order; |
|
| 2271 | + $attachment['is_featured'] = 0; |
|
| 2272 | + |
|
| 2273 | + $attachment_set = ''; |
|
| 2274 | + |
|
| 2275 | + foreach ($attachment as $key => $val) {
|
|
| 2276 | + if ($val != '') |
|
| 2277 | + $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2278 | + } |
|
| 2279 | + $attachment_set = trim($attachment_set, ", "); |
|
| 2280 | + |
|
| 2281 | + $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 2282 | + |
|
| 2283 | + if ($menu_order == 1) {
|
|
| 2284 | + $post_type = get_post_type($last_postid); |
|
| 2285 | + $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
|
|
| 2286 | + } |
|
| 2287 | + $menu_order++; |
|
| 2288 | + } |
|
| 2289 | + } |
|
| 2290 | + |
|
| 2291 | + $gd_post_info['package_id'] = $package_id; |
|
| 2292 | + |
|
| 2293 | + /** This action is documented in geodirectory-functions/post-functions.php */ |
|
| 2294 | + do_action('geodir_after_save_listing', $last_postid, $gd_post_info);
|
|
| 2295 | + |
|
| 2296 | + if (!empty($buffer[5])) {
|
|
| 2297 | + if (in_array($buffer[5], geodir_get_posttypes())) {
|
|
| 2298 | + $taxonomies = geodir_get_posttype_info(addslashes($buffer[5])); |
|
| 2299 | + wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]); |
|
| 2300 | + wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]); |
|
| 2301 | + |
|
| 2302 | + $post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : ''; |
|
| 2303 | + $post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : ''; |
|
| 2304 | + geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str); |
|
| 2305 | + } |
|
| 2306 | + } |
|
| 2307 | + } else {
|
|
| 2308 | + $invalid_title++; |
|
| 2309 | + } |
|
| 2310 | + } |
|
| 2311 | + } |
|
| 2312 | + } |
|
| 2313 | + $return['rowcount'] = $countpost; |
|
| 2314 | + $return['invalidcount'] = $address_invalid; |
|
| 2315 | + $return['blank_address'] = $blank_address; |
|
| 2316 | + $return['upload_files'] = $upload_files; |
|
| 2317 | + $return['invalid_post_type'] = $invalid_post_type; |
|
| 2318 | + $return['invalid_title'] = $invalid_title; |
|
| 2319 | + $return['total_records'] = $total_records; |
|
| 2320 | + |
|
| 2321 | + echo json_encode($return); |
|
| 2322 | + exit; |
|
| 2323 | 2323 | } |
| 2324 | 2324 | |
| 2325 | 2325 | // Add the tab in left sidebar menu fro import & export page. |
@@ -2339,9 +2339,9 @@ discard block |
||
| 2339 | 2339 | * @param $post object $post The post object of the post being saved. |
| 2340 | 2340 | */ |
| 2341 | 2341 | function geodir_update_location_prefix($post_id,$post){
|
| 2342 | - if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
|
|
| 2343 | - update_option('geodir_location_prefix',$post->post_name);
|
|
| 2344 | - } |
|
| 2342 | + if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
|
|
| 2343 | + update_option('geodir_location_prefix',$post->post_name);
|
|
| 2344 | + } |
|
| 2345 | 2345 | |
| 2346 | 2346 | } |
| 2347 | 2347 | |
@@ -2352,50 +2352,50 @@ discard block |
||
| 2352 | 2352 | function geodir_ga_callback(){
|
| 2353 | 2353 | |
| 2354 | 2354 | if(isset($_REQUEST['code']) && $_REQUEST['code']) {
|
| 2355 | - $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
|
| 2356 | - $code = "code=".$_REQUEST['code']; |
|
| 2357 | - $grant_type = "&grant_type=authorization_code"; |
|
| 2358 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 2359 | - $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
|
| 2360 | - $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
|
|
| 2355 | + $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
|
| 2356 | + $code = "code=".$_REQUEST['code']; |
|
| 2357 | + $grant_type = "&grant_type=authorization_code"; |
|
| 2358 | + $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 2359 | + $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
|
| 2360 | + $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
|
|
| 2361 | 2361 | |
| 2362 | - $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
| 2362 | + $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
| 2363 | 2363 | |
| 2364 | - $response = wp_remote_post($auth_url, array('timeout' => 15));
|
|
| 2364 | + $response = wp_remote_post($auth_url, array('timeout' => 15));
|
|
| 2365 | 2365 | |
| 2366 | - //print_r($response); |
|
| 2366 | + //print_r($response); |
|
| 2367 | 2367 | |
| 2368 | - $error_msg = __('Something went wrong','geodirectory');
|
|
| 2369 | - if(!empty($response['response']['code']) && $response['response']['code']==200){
|
|
| 2368 | + $error_msg = __('Something went wrong','geodirectory');
|
|
| 2369 | + if(!empty($response['response']['code']) && $response['response']['code']==200){
|
|
| 2370 | 2370 | |
| 2371 | - $parts = json_decode($response['body']); |
|
| 2372 | - //print_r($parts); |
|
| 2373 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
|
|
| 2374 | - else{
|
|
| 2371 | + $parts = json_decode($response['body']); |
|
| 2372 | + //print_r($parts); |
|
| 2373 | + if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
|
|
| 2374 | + else{
|
|
| 2375 | 2375 | |
| 2376 | - update_option('gd_ga_access_token', $parts->access_token);
|
|
| 2377 | - update_option('gd_ga_refresh_token', $parts->refresh_token);
|
|
| 2378 | - ?><script>window.close();</script><?php |
|
| 2379 | - } |
|
| 2376 | + update_option('gd_ga_access_token', $parts->access_token);
|
|
| 2377 | + update_option('gd_ga_refresh_token', $parts->refresh_token);
|
|
| 2378 | + ?><script>window.close();</script><?php |
|
| 2379 | + } |
|
| 2380 | 2380 | |
| 2381 | 2381 | |
| 2382 | - } |
|
| 2383 | - elseif(!empty($response['response']['code'])) {
|
|
| 2384 | - $parts = json_decode($response['body']); |
|
| 2382 | + } |
|
| 2383 | + elseif(!empty($response['response']['code'])) {
|
|
| 2384 | + $parts = json_decode($response['body']); |
|
| 2385 | 2385 | |
| 2386 | - if(isset($parts->error)){
|
|
| 2387 | - echo $parts->error.": ".$parts->error_description;exit; |
|
| 2388 | - }else{
|
|
| 2389 | - echo $error_msg." - #2";exit; |
|
| 2390 | - } |
|
| 2386 | + if(isset($parts->error)){
|
|
| 2387 | + echo $parts->error.": ".$parts->error_description;exit; |
|
| 2388 | + }else{
|
|
| 2389 | + echo $error_msg." - #2";exit; |
|
| 2390 | + } |
|
| 2391 | 2391 | |
| 2392 | - }else{
|
|
| 2392 | + }else{
|
|
| 2393 | 2393 | |
| 2394 | - echo $error_msg." - #3";exit; |
|
| 2394 | + echo $error_msg." - #3";exit; |
|
| 2395 | 2395 | |
| 2396 | - } |
|
| 2396 | + } |
|
| 2397 | 2397 | } |
| 2398 | - exit; |
|
| 2398 | + exit; |
|
| 2399 | 2399 | } |
| 2400 | 2400 | |
| 2401 | 2401 | if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
|
@@ -2411,45 +2411,45 @@ discard block |
||
| 2411 | 2411 | * @return array Array of settings. |
| 2412 | 2412 | */ |
| 2413 | 2413 | function geodir_uninstall_settings($general_settings) {
|
| 2414 | - $settings = array(); |
|
| 2415 | - $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
|
|
| 2416 | - $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
|
|
| 2414 | + $settings = array(); |
|
| 2415 | + $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
|
|
| 2416 | + $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
|
|
| 2417 | 2417 | |
| 2418 | - $plugins = get_plugins(); |
|
| 2419 | - $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
|
|
| 2418 | + $plugins = get_plugins(); |
|
| 2419 | + $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
|
|
| 2420 | 2420 | |
| 2421 | - if (!empty($plugins) && !empty($un_plugins)) {
|
|
| 2422 | - foreach ($plugins as $plugin => $data) {
|
|
| 2423 | - $plugin_name = plugin_basename(dirname($plugin)); |
|
| 2421 | + if (!empty($plugins) && !empty($un_plugins)) {
|
|
| 2422 | + foreach ($plugins as $plugin => $data) {
|
|
| 2423 | + $plugin_name = plugin_basename(dirname($plugin)); |
|
| 2424 | 2424 | |
| 2425 | - if (in_array($plugin_name, $un_plugins)) {
|
|
| 2426 | - $settings[] = array( |
|
| 2427 | - 'type' => 'checkbox', |
|
| 2428 | - 'id' => 'geodir_un_' . $plugin_name, |
|
| 2429 | - 'name' => $data['Name'], |
|
| 2430 | - 'desc' => __('Remove all data when deleted?', 'geodirectory'),
|
|
| 2431 | - 'std' => '0' |
|
| 2432 | - ); |
|
| 2433 | - } |
|
| 2434 | - } |
|
| 2435 | - } |
|
| 2425 | + if (in_array($plugin_name, $un_plugins)) {
|
|
| 2426 | + $settings[] = array( |
|
| 2427 | + 'type' => 'checkbox', |
|
| 2428 | + 'id' => 'geodir_un_' . $plugin_name, |
|
| 2429 | + 'name' => $data['Name'], |
|
| 2430 | + 'desc' => __('Remove all data when deleted?', 'geodirectory'),
|
|
| 2431 | + 'std' => '0' |
|
| 2432 | + ); |
|
| 2433 | + } |
|
| 2434 | + } |
|
| 2435 | + } |
|
| 2436 | 2436 | |
| 2437 | - $settings[] = array('type' => 'sectionend', 'id' => 'uninstall_settings_main');
|
|
| 2437 | + $settings[] = array('type' => 'sectionend', 'id' => 'uninstall_settings_main');
|
|
| 2438 | 2438 | |
| 2439 | - /** |
|
| 2440 | - * Filter the uninstall settings array. |
|
| 2441 | - * |
|
| 2442 | - * @since 1.6.9 |
|
| 2443 | - * |
|
| 2444 | - * @param array $settings The settings array. |
|
| 2445 | - */ |
|
| 2446 | - $settings = apply_filters('geodir_uninstall_settings', $settings);
|
|
| 2439 | + /** |
|
| 2440 | + * Filter the uninstall settings array. |
|
| 2441 | + * |
|
| 2442 | + * @since 1.6.9 |
|
| 2443 | + * |
|
| 2444 | + * @param array $settings The settings array. |
|
| 2445 | + */ |
|
| 2446 | + $settings = apply_filters('geodir_uninstall_settings', $settings);
|
|
| 2447 | 2447 | |
| 2448 | - if (!empty($settings) && count($settings) > 3) {
|
|
| 2449 | - return array_merge($general_settings, $settings); |
|
| 2450 | - } |
|
| 2448 | + if (!empty($settings) && count($settings) > 3) {
|
|
| 2449 | + return array_merge($general_settings, $settings); |
|
| 2450 | + } |
|
| 2451 | 2451 | |
| 2452 | - return $general_settings; |
|
| 2452 | + return $general_settings; |
|
| 2453 | 2453 | } |
| 2454 | 2454 | add_filter('geodir_general_settings', 'geodir_uninstall_settings', 100, 1);
|
| 2455 | 2455 | |
@@ -2459,7 +2459,7 @@ discard block |
||
| 2459 | 2459 | * @since 1.6.9 |
| 2460 | 2460 | */ |
| 2461 | 2461 | function geodir_uninstall_settings_desc() {
|
| 2462 | - echo '<p class="gd-un-settings-desc">' . __('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory') . '</p>';
|
|
| 2462 | + echo '<p class="gd-un-settings-desc">' . __('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory') . '</p>';
|
|
| 2463 | 2463 | } |
| 2464 | 2464 | add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc');
|
| 2465 | 2465 | |
@@ -2475,18 +2475,18 @@ discard block |
||
| 2475 | 2475 | * @return array The settings array. |
| 2476 | 2476 | */ |
| 2477 | 2477 | function geodir_resave_settings($settings = array()) {
|
| 2478 | - if (!empty($settings) && is_array($settings)) {
|
|
| 2479 | - $c = 0; |
|
| 2478 | + if (!empty($settings) && is_array($settings)) {
|
|
| 2479 | + $c = 0; |
|
| 2480 | 2480 | |
| 2481 | - foreach ($settings as $setting) {
|
|
| 2482 | - if (!empty($setting['id']) && false !== ($value = get_option($setting['id']))) {
|
|
| 2483 | - $settings[$c]['std'] = $value; |
|
| 2484 | - } |
|
| 2485 | - $c++; |
|
| 2486 | - } |
|
| 2487 | - } |
|
| 2488 | - |
|
| 2489 | - return $settings; |
|
| 2481 | + foreach ($settings as $setting) {
|
|
| 2482 | + if (!empty($setting['id']) && false !== ($value = get_option($setting['id']))) {
|
|
| 2483 | + $settings[$c]['std'] = $value; |
|
| 2484 | + } |
|
| 2485 | + $c++; |
|
| 2486 | + } |
|
| 2487 | + } |
|
| 2488 | + |
|
| 2489 | + return $settings; |
|
| 2490 | 2490 | } |
| 2491 | 2491 | |
| 2492 | 2492 | /** |
@@ -2498,9 +2498,9 @@ discard block |
||
| 2498 | 2498 | * @return array The modified settings. |
| 2499 | 2499 | */ |
| 2500 | 2500 | function geodir_core_uninstall_settings($settings) {
|
| 2501 | - $settings[] = plugin_basename(dirname(dirname(__FILE__))); |
|
| 2501 | + $settings[] = plugin_basename(dirname(dirname(__FILE__))); |
|
| 2502 | 2502 | |
| 2503 | - return $settings; |
|
| 2503 | + return $settings; |
|
| 2504 | 2504 | } |
| 2505 | 2505 | add_filter('geodir_plugins_uninstall_settings', 'geodir_core_uninstall_settings', 10, 1);
|
| 2506 | 2506 | |
@@ -2514,32 +2514,32 @@ discard block |
||
| 2514 | 2514 | */ |
| 2515 | 2515 | function geodir_diagnose_reload_db_countries() |
| 2516 | 2516 | {
|
| 2517 | - global $wpdb, $plugin_prefix; |
|
| 2518 | - |
|
| 2519 | - $is_error_during_diagnose = false; |
|
| 2520 | - $output_str = ''; |
|
| 2521 | - |
|
| 2522 | - $delete = $wpdb->query("TRUNCATE TABLE ".GEODIR_COUNTRIES_TABLE);
|
|
| 2523 | - |
|
| 2524 | - |
|
| 2525 | - if ($delete) {
|
|
| 2526 | - $output_str .= "<li><strong>" . __('Table dropped, refresh page to reinstall.', 'geodirectory') . "</strong></li>";
|
|
| 2527 | - ob_start(); |
|
| 2528 | - geodir_diagnose_version_clear(); |
|
| 2529 | - ob_end_clean(); |
|
| 2530 | - }else{
|
|
| 2531 | - $output_str .= "<li><strong>" . __('Seomething went wrong.', 'geodirectory') . "</strong></li>";
|
|
| 2532 | - } |
|
| 2533 | - |
|
| 2534 | - if ($is_error_during_diagnose) {
|
|
| 2535 | - $info_div_class = "geodir_problem_info"; |
|
| 2536 | - $fix_button_txt = ""; |
|
| 2537 | - } else {
|
|
| 2538 | - $info_div_class = "geodir_noproblem_info"; |
|
| 2539 | - $fix_button_txt = ''; |
|
| 2540 | - } |
|
| 2541 | - echo "<ul class='$info_div_class'>"; |
|
| 2542 | - echo $output_str; |
|
| 2543 | - echo $fix_button_txt; |
|
| 2544 | - echo "</ul>"; |
|
| 2517 | + global $wpdb, $plugin_prefix; |
|
| 2518 | + |
|
| 2519 | + $is_error_during_diagnose = false; |
|
| 2520 | + $output_str = ''; |
|
| 2521 | + |
|
| 2522 | + $delete = $wpdb->query("TRUNCATE TABLE ".GEODIR_COUNTRIES_TABLE);
|
|
| 2523 | + |
|
| 2524 | + |
|
| 2525 | + if ($delete) {
|
|
| 2526 | + $output_str .= "<li><strong>" . __('Table dropped, refresh page to reinstall.', 'geodirectory') . "</strong></li>";
|
|
| 2527 | + ob_start(); |
|
| 2528 | + geodir_diagnose_version_clear(); |
|
| 2529 | + ob_end_clean(); |
|
| 2530 | + }else{
|
|
| 2531 | + $output_str .= "<li><strong>" . __('Seomething went wrong.', 'geodirectory') . "</strong></li>";
|
|
| 2532 | + } |
|
| 2533 | + |
|
| 2534 | + if ($is_error_during_diagnose) {
|
|
| 2535 | + $info_div_class = "geodir_problem_info"; |
|
| 2536 | + $fix_button_txt = ""; |
|
| 2537 | + } else {
|
|
| 2538 | + $info_div_class = "geodir_noproblem_info"; |
|
| 2539 | + $fix_button_txt = ''; |
|
| 2540 | + } |
|
| 2541 | + echo "<ul class='$info_div_class'>"; |
|
| 2542 | + echo $output_str; |
|
| 2543 | + echo $fix_button_txt; |
|
| 2544 | + echo "</ul>"; |
|
| 2545 | 2545 | } |
| 2546 | 2546 | \ No newline at end of file |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | function geodir_get_admin_option_form($current_tab) |
| 64 | 64 | {
|
| 65 | - geodir_admin_option_form($current_tab);// defined in admin template tags.php |
|
| 65 | + geodir_admin_option_form($current_tab); // defined in admin template tags.php |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | add_action('geodir_update_options_compatibility_settings', 'geodir_update_options_compatibility_settings');
|
| 71 | 71 | add_action('geodir_update_options_default_location_settings', 'geodir_location_form_submit');
|
| 72 | 72 | add_action('geodir_before_admin_panel', 'geodir_before_admin_panel'); // this function is in admin_functions.php
|
| 73 | -add_action('geodir_before_update_options', 'geodir_before_update_options',10,2);
|
|
| 73 | +add_action('geodir_before_update_options', 'geodir_before_update_options', 10, 2);
|
|
| 74 | 74 | |
| 75 | 75 | //add_action('geodir_before_admin_panel', 'geodir_autoinstall_admin_header');
|
| 76 | 76 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | // Disable VC editor for GD post types. |
| 101 | 101 | if (class_exists('Vc_Role_Access_Controller')) {
|
| 102 | - add_filter( 'vc_role_access_with_post_types_can', '__return_false', 100 ); |
|
| 102 | + add_filter('vc_role_access_with_post_types_can', '__return_false', 100);
|
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | add_action('admin_panel_init', 'geodir_admin_list_columns', 2);
|
| 127 | 127 | |
| 128 | 128 | /* --- insert dummy post action ---*/ |
| 129 | -add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1,3);
|
|
| 130 | -add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1,3);
|
|
| 129 | +add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1, 3);
|
|
| 130 | +add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1, 3);
|
|
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -236,9 +236,9 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | // Filter-Payment-Manager |
| 238 | 238 | |
| 239 | - add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
|
|
| 239 | + add_meta_box('geodir_post_images', $post_typename.' '.__('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
|
|
| 240 | 240 | |
| 241 | - add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
|
|
| 241 | + add_meta_box('geodir_post_info', $post_typename.' '.__('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
|
|
| 242 | 242 | |
| 243 | 243 | // no need of this box as all fields moved to main information box |
| 244 | 244 | //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
|
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | -add_action('save_post', 'geodir_post_information_save',10,2);
|
|
| 250 | +add_action('save_post', 'geodir_post_information_save', 10, 2);
|
|
| 251 | 251 | |
| 252 | 252 | |
| 253 | 253 | |
@@ -274,10 +274,10 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
| 276 | 276 | |
| 277 | - if(!empty($gd_taxonomy)) {
|
|
| 277 | + if (!empty($gd_taxonomy)) {
|
|
| 278 | 278 | foreach ($gd_taxonomy as $tax) {
|
| 279 | 279 | |
| 280 | - remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
| 280 | + remove_meta_box($tax.'div', $geodir_post_type, 'normal'); |
|
| 281 | 281 | |
| 282 | 282 | } |
| 283 | 283 | } |
@@ -363,14 +363,14 @@ discard block |
||
| 363 | 363 | add_action('geodir_manage_available_fields_predefined', 'geodir_manage_available_fields_predefined');
|
| 364 | 364 | add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom');
|
| 365 | 365 | |
| 366 | -function geodir_manage_available_fields_predefined($sub_tab){
|
|
| 367 | - if($sub_tab=='custom_fields'){
|
|
| 366 | +function geodir_manage_available_fields_predefined($sub_tab) {
|
|
| 367 | + if ($sub_tab == 'custom_fields') {
|
|
| 368 | 368 | geodir_custom_available_fields('predefined');
|
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | -function geodir_manage_available_fields_custom($sub_tab){
|
|
| 373 | - if($sub_tab=='custom_fields'){
|
|
| 372 | +function geodir_manage_available_fields_custom($sub_tab) {
|
|
| 373 | + if ($sub_tab == 'custom_fields') {
|
|
| 374 | 374 | geodir_custom_available_fields('custom');
|
| 375 | 375 | } |
| 376 | 376 | } |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | global $wpdb; |
| 441 | 441 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
| 442 | 442 | ?> |
| 443 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
| 443 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
| 444 | 444 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
| 445 | 445 | <ul> |
| 446 | 446 | <?php |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | |
| 452 | 452 | $check_html_variable = $wpdb->get_var( |
| 453 | 453 | $wpdb->prepare( |
| 454 | - "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
| 454 | + "SELECT htmlvar_name FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
| 455 | 455 | array($val['htmlvar_name'], $listing_type, $val['field_type']) |
| 456 | 456 | ) |
| 457 | 457 | ); |
@@ -459,23 +459,23 @@ discard block |
||
| 459 | 459 | $display = $check_html_variable ? ' style="display:none;"' : ''; |
| 460 | 460 | ?> |
| 461 | 461 | |
| 462 | - <li class="gd-cf-tooltip-wrap" <?php echo $display;?>> |
|
| 462 | + <li class="gd-cf-tooltip-wrap" <?php echo $display; ?>> |
|
| 463 | 463 | <?php |
| 464 | - if(isset($val['description']) && $val['description']){
|
|
| 464 | + if (isset($val['description']) && $val['description']) {
|
|
| 465 | 465 | echo '<div class="gdcf-tooltip">'.$val['description'].'</div>'; |
| 466 | 466 | }?> |
| 467 | 467 | |
| 468 | - <a id="gd-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>" data-field-type-key="<?php echo $val['htmlvar_name'];?>" data-field-type="<?php echo $val['field_type'];?>" |
|
| 469 | - title="<?php echo $val['site_title'];?>" |
|
| 470 | - class="gd-draggable-form-items gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);"> |
|
| 468 | + <a id="gd-<?php echo $val['field_type']; ?>-_-<?php echo $val['htmlvar_name']; ?>" data-field-type-key="<?php echo $val['htmlvar_name']; ?>" data-field-type="<?php echo $val['field_type']; ?>" |
|
| 469 | + title="<?php echo $val['site_title']; ?>" |
|
| 470 | + class="gd-draggable-form-items gd-<?php echo $val['field_type']; ?> geodir-sort-<?php echo $val['htmlvar_name']; ?>" href="javascript:void(0);"> |
|
| 471 | 471 | <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
|
| 472 | 472 | echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>'; |
| 473 | - }elseif(isset($val['field_icon']) && $val['field_icon'] ){
|
|
| 473 | + }elseif (isset($val['field_icon']) && $val['field_icon']) {
|
|
| 474 | 474 | echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
|
| 475 | - }else{
|
|
| 475 | + } else {
|
|
| 476 | 476 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 477 | 477 | }?> |
| 478 | - <?php echo $val['site_title'];?> |
|
| 478 | + <?php echo $val['site_title']; ?> |
|
| 479 | 479 | </a> |
| 480 | 480 | </li> |
| 481 | 481 | |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | <?php |
| 504 | 504 | global $wpdb; |
| 505 | 505 | |
| 506 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
|
|
| 506 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
|
|
| 507 | 507 | |
| 508 | 508 | if (!empty($fields)) {
|
| 509 | 509 | foreach ($fields as $field) {
|
@@ -528,14 +528,14 @@ discard block |
||
| 528 | 528 | * @since 1.6.9 |
| 529 | 529 | * @package GeoDirectory |
| 530 | 530 | */ |
| 531 | -function geodir_custom_fields_custom($post_type=''){
|
|
| 531 | +function geodir_custom_fields_custom($post_type = '') {
|
|
| 532 | 532 | |
| 533 | 533 | $custom_fields = array(); |
| 534 | 534 | |
| 535 | 535 | /** |
| 536 | 536 | * @see `geodir_custom_fields` |
| 537 | 537 | */ |
| 538 | - return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
|
|
| 538 | + return apply_filters('geodir_custom_fields_custom', $custom_fields, $post_type);
|
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | * @since 1.6.6 |
| 547 | 547 | * @package GeoDirectory |
| 548 | 548 | */ |
| 549 | -function geodir_custom_fields($post_type=''){
|
|
| 549 | +function geodir_custom_fields($post_type = '') {
|
|
| 550 | 550 | |
| 551 | 551 | $custom_fields = array( |
| 552 | 552 | 'text' => array( |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | * } |
| 682 | 682 | * @param string $post_type The post type requested. |
| 683 | 683 | */ |
| 684 | - return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
|
|
| 684 | + return apply_filters('geodir_custom_fields', $custom_fields, $post_type);
|
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | /** |
@@ -692,25 +692,25 @@ discard block |
||
| 692 | 692 | * @param string $type The custom field type, predefined, custom or blank for default |
| 693 | 693 | * @package GeoDirectory |
| 694 | 694 | */ |
| 695 | -function geodir_custom_available_fields($type='') |
|
| 695 | +function geodir_custom_available_fields($type = '') |
|
| 696 | 696 | {
|
| 697 | 697 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
| 698 | 698 | ?> |
| 699 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
| 699 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
| 700 | 700 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" /> |
| 701 | 701 | |
| 702 | 702 | <?php |
| 703 | - if($type=='predefined'){
|
|
| 703 | + if ($type == 'predefined') {
|
|
| 704 | 704 | $cfs = geodir_custom_fields_predefined($listing_type); |
| 705 | - }elseif($type=='custom'){
|
|
| 705 | + }elseif ($type == 'custom') {
|
|
| 706 | 706 | $cfs = geodir_custom_fields_custom($listing_type); |
| 707 | - }else{
|
|
| 707 | + } else {
|
|
| 708 | 708 | $cfs = geodir_custom_fields($listing_type); |
| 709 | 709 | ?> |
| 710 | 710 | <ul class="full gd-cf-tooltip-wrap"> |
| 711 | 711 | <li> |
| 712 | 712 | <div class="gdcf-tooltip"> |
| 713 | - <?php _e('This adds a section separator with a title.', 'geodirectory');?>
|
|
| 713 | + <?php _e('This adds a section separator with a title.', 'geodirectory'); ?>
|
|
| 714 | 714 | </div> |
| 715 | 715 | <a id="gt-fieldset" |
| 716 | 716 | class="gd-draggable-form-items gt-fieldset" |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | |
| 722 | 722 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
| 723 | 723 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
| 724 | - <?php _e('Fieldset (section separator)', 'geodirectory');?>
|
|
| 724 | + <?php _e('Fieldset (section separator)', 'geodirectory'); ?>
|
|
| 725 | 725 | </a> |
| 726 | 726 | </li> |
| 727 | 727 | </ul> |
@@ -729,15 +729,15 @@ discard block |
||
| 729 | 729 | <?php |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | - if(!empty($cfs)) {
|
|
| 732 | + if (!empty($cfs)) {
|
|
| 733 | 733 | echo '<ul>'; |
| 734 | - foreach ( $cfs as $id => $cf ) {
|
|
| 734 | + foreach ($cfs as $id => $cf) {
|
|
| 735 | 735 | ?> |
| 736 | 736 | |
| 737 | 737 | <li class="gd-cf-tooltip-wrap"> |
| 738 | 738 | <?php |
| 739 | - if ( isset( $cf['description'] ) && $cf['description'] ) {
|
|
| 740 | - echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>'; |
|
| 739 | + if (isset($cf['description']) && $cf['description']) {
|
|
| 740 | + echo '<div class="gdcf-tooltip">'.$cf['description'].'</div>'; |
|
| 741 | 741 | } ?> |
| 742 | 742 | |
| 743 | 743 | <a id="gd-<?php echo $id; ?>" |
@@ -747,10 +747,10 @@ discard block |
||
| 747 | 747 | class="gd-draggable-form-items <?php echo $cf['class']; ?>" |
| 748 | 748 | href="javascript:void(0);"> |
| 749 | 749 | |
| 750 | - <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], 'fa fa-' ) !== false ) {
|
|
| 751 | - echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>'; |
|
| 752 | - } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
|
|
| 753 | - echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>';
|
|
| 750 | + <?php if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
|
|
| 751 | + echo '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
| 752 | + } elseif (isset($cf['icon']) && $cf['icon']) {
|
|
| 753 | + echo '<b style="background-image: url("'.$cf['icon'].'")"></b>';
|
|
| 754 | 754 | } else {
|
| 755 | 755 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 756 | 756 | } ?> |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | </li> |
| 760 | 760 | <?php |
| 761 | 761 | } |
| 762 | - }else{
|
|
| 762 | + } else {
|
|
| 763 | 763 | _e('There are no custom fields here yet.', 'geodirectory');
|
| 764 | 764 | } |
| 765 | 765 | ?> |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | <ul class="core"> |
| 788 | 788 | <?php |
| 789 | 789 | global $wpdb; |
| 790 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
|
|
| 790 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
|
|
| 791 | 791 | |
| 792 | 792 | if (!empty($fields)) {
|
| 793 | 793 | foreach ($fields as $field) {
|
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | $field_type_key = $field->field_type_key; |
| 798 | 798 | $field_ins_upd = 'display'; |
| 799 | 799 | |
| 800 | - geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key); |
|
| 800 | + geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd, $field_type_key); |
|
| 801 | 801 | } |
| 802 | 802 | } |
| 803 | 803 | ?></ul> |
@@ -956,8 +956,8 @@ discard block |
||
| 956 | 956 | |
| 957 | 957 | if (!get_option('geodir_remove_unnecessary_fields')) {
|
| 958 | 958 | |
| 959 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
|
|
| 960 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
|
|
| 959 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$plugin_prefix."gd_place_detail WHERE field = 'categories'"))
|
|
| 960 | + $wpdb->query("ALTER TABLE `".$plugin_prefix."gd_place_detail` DROP `categories`");
|
|
| 961 | 961 | |
| 962 | 962 | update_option('geodir_remove_unnecessary_fields', '1');
|
| 963 | 963 | |
@@ -986,7 +986,7 @@ discard block |
||
| 986 | 986 | case 'diagnosis' : |
| 987 | 987 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
|
| 988 | 988 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
| 989 | - call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 989 | + call_user_func('geodir_diagnose_'.$diagnose_this);
|
|
| 990 | 990 | |
| 991 | 991 | } |
| 992 | 992 | exit(); |
@@ -995,7 +995,7 @@ discard block |
||
| 995 | 995 | case 'diagnosis-fix' : |
| 996 | 996 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
| 997 | 997 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
| 998 | - call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 998 | + call_user_func('geodir_diagnose_'.$diagnose_this);
|
|
| 999 | 999 | exit(); |
| 1000 | 1000 | break; |
| 1001 | 1001 | } |
@@ -1020,50 +1020,50 @@ discard block |
||
| 1020 | 1020 | {
|
| 1021 | 1021 | global $wpdb; |
| 1022 | 1022 | //$filter_arr['output_str'] .='###'.$table.'###'; |
| 1023 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
|
|
| 1024 | - $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
|
|
| 1023 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0) {
|
|
| 1024 | + $filter_arr['output_str'] .= "<li>".__('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory')."</li>";
|
|
| 1025 | 1025 | $filter_arr['is_error_during_diagnose'] = true; |
| 1026 | 1026 | |
| 1027 | - } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 1028 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1027 | + } elseif ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
|
|
| 1028 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1029 | 1029 | $filter_arr['is_error_during_diagnose'] = true; |
| 1030 | - $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
|
|
| 1030 | + $filter_arr['output_str'] .= "<li>".__('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory')."</li>";
|
|
| 1031 | 1031 | $filter_arr['is_error_during_diagnose'] = true; |
| 1032 | 1032 | |
| 1033 | 1033 | if ($fix) {
|
| 1034 | - $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
|
|
| 1035 | - $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
|
|
| 1034 | + $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$table."_ms_bak"); // get backup table count
|
|
| 1035 | + $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table"); // get new table count
|
|
| 1036 | 1036 | |
| 1037 | 1037 | if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
|
| 1038 | 1038 | //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
|
| 1039 | 1039 | |
| 1040 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
|
|
| 1040 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename bak table to new table
|
|
| 1041 | 1041 | |
| 1042 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 1043 | - $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
|
|
| 1042 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
|
|
| 1043 | + $filter_arr['output_str'] .= "<li>".__('-->FIXED: Renamed and backed up the tables', 'geodirectory')."</li>";
|
|
| 1044 | 1044 | } else {
|
| 1045 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1045 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | 1048 | } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
|
| 1049 | 1049 | |
| 1050 | - $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
|
|
| 1051 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
|
|
| 1050 | + $wpdb->query("RENAME TABLE ".$wpdb->prefix."$table TO ".$table."_ms_bak2"); // rename new table to bak2
|
|
| 1051 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$wpdb->prefix."$table"); // rename bak table to new table
|
|
| 1052 | 1052 | |
| 1053 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1054 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1053 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1054 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table)."</li>";
|
|
| 1055 | 1055 | } else {
|
| 1056 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1056 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | 1059 | } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
|
| 1060 | 1060 | |
| 1061 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
|
|
| 1061 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename ms_bak table to ms_bak2
|
|
| 1062 | 1062 | |
| 1063 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 1064 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
|
|
| 1063 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
|
|
| 1064 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table)."</li>";
|
|
| 1065 | 1065 | } else {
|
| 1066 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1066 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | 1069 | } |
@@ -1071,54 +1071,54 @@ discard block |
||
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | |
| 1074 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 1075 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1074 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
|
|
| 1075 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1076 | 1076 | $filter_arr['is_error_during_diagnose'] = true; |
| 1077 | 1077 | |
| 1078 | 1078 | if ($fix) {
|
| 1079 | 1079 | if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
|
| 1080 | 1080 | if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
|
| 1081 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1081 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table)."</li>";
|
|
| 1082 | 1082 | } else {
|
| 1083 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
|
|
| 1083 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table)."</li>";
|
|
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | - } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original
|
|
| 1087 | - if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
|
|
| 1088 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1086 | + } elseif ($wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table") == 0) {// if main table is empty but original is not, delete main and rename original
|
|
| 1087 | + if ($wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."$table")) {
|
|
| 1088 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix.$table)."</li>";
|
|
| 1089 | 1089 | } else {
|
| 1090 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1090 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix.$table)."</li>";
|
|
| 1091 | 1091 | } |
| 1092 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1093 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1092 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1093 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1094 | 1094 | } else {
|
| 1095 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1095 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1096 | 1096 | } |
| 1097 | 1097 | } else {// else rename the original table to _ms_bak
|
| 1098 | - if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1099 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
|
|
| 1098 | + if ($wpdb->query("RENAME TABLE $table TO ".$table."_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1099 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table."_ms_bak")."</li>";
|
|
| 1100 | 1100 | } else {
|
| 1101 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
|
|
| 1101 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table."_ms_bak")."</li>";
|
|
| 1102 | 1102 | } |
| 1103 | 1103 | } |
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1107 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1106 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
|
|
| 1107 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1108 | 1108 | $filter_arr['is_error_during_diagnose'] = true; |
| 1109 | 1109 | |
| 1110 | 1110 | if ($fix) {
|
| 1111 | 1111 | // if original table exists but new does not, rename |
| 1112 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1113 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1112 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1113 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1114 | 1114 | } else {
|
| 1115 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1115 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1116 | 1116 | } |
| 1117 | 1117 | |
| 1118 | 1118 | } |
| 1119 | 1119 | |
| 1120 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1121 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1120 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
|
|
| 1121 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1122 | 1122 | $filter_arr['is_error_during_diagnose'] = true; |
| 1123 | 1123 | |
| 1124 | 1124 | if ($fix) {
|
@@ -1132,11 +1132,11 @@ discard block |
||
| 1132 | 1132 | delete_option('geodir_custom_posts_db_version');
|
| 1133 | 1133 | delete_option('geodir_reviewratings_db_version');
|
| 1134 | 1134 | delete_option('geodiradvancesearch_db_version');
|
| 1135 | - $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
|
|
| 1135 | + $filter_arr['output_str'] .= "<li>".__('-->TRY: Please refresh page to run table install functions', 'geodirectory')."</li>";
|
|
| 1136 | 1136 | } |
| 1137 | 1137 | |
| 1138 | 1138 | } else {
|
| 1139 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1139 | + $filter_arr['output_str'] .= "<li>".sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1140 | 1140 | } |
| 1141 | 1141 | return $filter_arr; |
| 1142 | 1142 | } |
@@ -1177,21 +1177,21 @@ discard block |
||
| 1177 | 1177 | } |
| 1178 | 1178 | |
| 1179 | 1179 | if ($stepped_process) {
|
| 1180 | - $sql = $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $ptype . "_detail LIMIT %d OFFSET %d", $step_max_items, $offset ); |
|
| 1181 | - $posts = $wpdb->get_results( $sql ); |
|
| 1180 | + $sql = $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."geodir_".$ptype."_detail LIMIT %d OFFSET %d", $step_max_items, $offset);
|
|
| 1181 | + $posts = $wpdb->get_results($sql); |
|
| 1182 | 1182 | |
| 1183 | 1183 | if (!empty($posts)) {
|
| 1184 | 1184 | |
| 1185 | 1185 | foreach ($posts as $p) {
|
| 1186 | 1186 | $p->post_type = $ptype; |
| 1187 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1187 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
|
|
| 1188 | 1188 | if (empty($raw_tags)) {
|
| 1189 | 1189 | $post_tags = ''; |
| 1190 | 1190 | } else {
|
| 1191 | 1191 | $post_tags = implode(",", $raw_tags);
|
| 1192 | 1192 | } |
| 1193 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1194 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1193 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
| 1194 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1195 | 1195 | |
| 1196 | 1196 | } |
| 1197 | 1197 | if ($step >= $max_step) {
|
@@ -1207,23 +1207,23 @@ discard block |
||
| 1207 | 1207 | if (!empty($all_postypes)) {
|
| 1208 | 1208 | foreach ($all_postypes as $key) {
|
| 1209 | 1209 | // update each GD CPT |
| 1210 | - $posts = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail"); |
|
| 1210 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail");
|
|
| 1211 | 1211 | |
| 1212 | 1212 | if (!empty($posts)) {
|
| 1213 | 1213 | |
| 1214 | 1214 | foreach ($posts as $p) {
|
| 1215 | 1215 | $p->post_type = $key; |
| 1216 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1216 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
|
|
| 1217 | 1217 | if (empty($raw_tags)) {
|
| 1218 | 1218 | $post_tags = ''; |
| 1219 | 1219 | } else {
|
| 1220 | 1220 | $post_tags = implode(",", $raw_tags);
|
| 1221 | 1221 | } |
| 1222 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1223 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1222 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
| 1223 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1224 | 1224 | |
| 1225 | 1225 | } |
| 1226 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1226 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
|
|
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | 1229 | } |
@@ -1234,14 +1234,14 @@ discard block |
||
| 1234 | 1234 | |
| 1235 | 1235 | if ($is_error_during_diagnose) {
|
| 1236 | 1236 | $info_div_class = "geodir_problem_info"; |
| 1237 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1237 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1238 | 1238 | } else {
|
| 1239 | 1239 | $info_div_class = "geodir_noproblem_info"; |
| 1240 | 1240 | $fix_button_txt = ''; |
| 1241 | 1241 | } |
| 1242 | 1242 | |
| 1243 | 1243 | if ($stepped_process) {
|
| 1244 | - $percent = ($step/$max_step) * 100; |
|
| 1244 | + $percent = ($step / $max_step) * 100; |
|
| 1245 | 1245 | if ($output_str == 'done') {
|
| 1246 | 1246 | echo $output_str; |
| 1247 | 1247 | } else {
|
@@ -1284,29 +1284,29 @@ discard block |
||
| 1284 | 1284 | if (!empty($all_postypes)) {
|
| 1285 | 1285 | foreach ($all_postypes as $key) {
|
| 1286 | 1286 | // update each GD CTP |
| 1287 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
|
|
| 1287 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d WHERE d.".$key."category='' ");
|
|
| 1288 | 1288 | |
| 1289 | 1289 | if (!empty($posts)) {
|
| 1290 | 1290 | |
| 1291 | 1291 | foreach ($posts as $p) {
|
| 1292 | 1292 | $p->post_type = $key; |
| 1293 | - $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
|
|
| 1293 | + $raw_cats = wp_get_object_terms($p->post_id, $p->post_type.'category', array('fields' => 'ids'));
|
|
| 1294 | 1294 | |
| 1295 | 1295 | if (empty($raw_cats)) {
|
| 1296 | 1296 | $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
| 1297 | 1297 | |
| 1298 | - if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
|
|
| 1299 | - $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
|
|
| 1300 | - foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
|
|
| 1298 | + if (!empty($post_categories) && !empty($post_categories[$p->post_type.'category'])) {
|
|
| 1299 | + $post_categories[$p->post_type.'category'] = str_replace("d:", "", $post_categories[$p->post_type.'category']);
|
|
| 1300 | + foreach (explode(",", $post_categories[$p->post_type.'category']) as $cat_part) {
|
|
| 1301 | 1301 | if (is_numeric($cat_part)) {
|
| 1302 | - $raw_cats[] = (int)$cat_part; |
|
| 1302 | + $raw_cats[] = (int) $cat_part; |
|
| 1303 | 1303 | } |
| 1304 | 1304 | } |
| 1305 | 1305 | |
| 1306 | 1306 | } |
| 1307 | 1307 | |
| 1308 | 1308 | if (!empty($raw_cats)) {
|
| 1309 | - $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
| 1309 | + $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type.'category'); |
|
| 1310 | 1310 | |
| 1311 | 1311 | } |
| 1312 | 1312 | |
@@ -1316,14 +1316,14 @@ discard block |
||
| 1316 | 1316 | if (empty($raw_cats)) {
|
| 1317 | 1317 | $post_cats = ''; |
| 1318 | 1318 | } else {
|
| 1319 | - $post_cats = ',' . implode(",", $raw_cats) . ',';
|
|
| 1319 | + $post_cats = ','.implode(",", $raw_cats).',';
|
|
| 1320 | 1320 | } |
| 1321 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1322 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
| 1321 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
| 1322 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET ".$p->post_type."category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
| 1323 | 1323 | } |
| 1324 | 1324 | |
| 1325 | 1325 | } |
| 1326 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1326 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
|
|
| 1327 | 1327 | |
| 1328 | 1328 | } |
| 1329 | 1329 | |
@@ -1331,7 +1331,7 @@ discard block |
||
| 1331 | 1331 | |
| 1332 | 1332 | if ($is_error_during_diagnose) {
|
| 1333 | 1333 | $info_div_class = "geodir_problem_info"; |
| 1334 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1334 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1335 | 1335 | } else {
|
| 1336 | 1336 | $info_div_class = "geodir_noproblem_info"; |
| 1337 | 1337 | $fix_button_txt = ''; |
@@ -1384,15 +1384,15 @@ discard block |
||
| 1384 | 1384 | if (!empty($ver_arr)) {
|
| 1385 | 1385 | foreach ($ver_arr as $key => $val) {
|
| 1386 | 1386 | if (delete_option($val)) {
|
| 1387 | - $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
|
|
| 1387 | + $output_str .= "<li>".$key.__(' Version: Deleted', 'geodirectory')."</li>";
|
|
| 1388 | 1388 | } else {
|
| 1389 | - $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
|
|
| 1389 | + $output_str .= "<li>".$key.__(' Version: Not Found', 'geodirectory')."</li>";
|
|
| 1390 | 1390 | } |
| 1391 | 1391 | |
| 1392 | 1392 | } |
| 1393 | 1393 | |
| 1394 | 1394 | if ($output_str) {
|
| 1395 | - $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
|
|
| 1395 | + $output_str .= "<li><strong>".__(' Upgrade/install scripts will run on next page reload.', 'geodirectory')."</strong></li>";
|
|
| 1396 | 1396 | } |
| 1397 | 1397 | |
| 1398 | 1398 | } |
@@ -1429,43 +1429,43 @@ discard block |
||
| 1429 | 1429 | $output_str = ''; |
| 1430 | 1430 | |
| 1431 | 1431 | // check review locations |
| 1432 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
|
|
| 1433 | - $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
|
|
| 1432 | + if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
|
|
| 1433 | + $output_str .= "<li>".__('Review locations missing or broken', 'geodirectory')."</li>";
|
|
| 1434 | 1434 | $is_error_during_diagnose = true; |
| 1435 | 1435 | |
| 1436 | 1436 | if ($fix) {
|
| 1437 | 1437 | if (geodir_fix_review_location()) {
|
| 1438 | - $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
|
|
| 1438 | + $output_str .= "<li><strong>".__('-->FIXED: Review locations fixed', 'geodirectory')."</strong></li>";
|
|
| 1439 | 1439 | } else {
|
| 1440 | - $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1440 | + $output_str .= "<li><strong>".__('-->FAILED: Review locations fix failed', 'geodirectory')."</strong></li>";
|
|
| 1441 | 1441 | } |
| 1442 | 1442 | } |
| 1443 | 1443 | |
| 1444 | 1444 | } else {
|
| 1445 | - $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
|
|
| 1445 | + $output_str .= "<li>".__('Review locations ok', 'geodirectory')."</li>";
|
|
| 1446 | 1446 | } |
| 1447 | 1447 | |
| 1448 | 1448 | // check review content |
| 1449 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
|
|
| 1450 | - $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
|
|
| 1449 | + if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_content IS NULL")) {
|
|
| 1450 | + $output_str .= "<li>".__('Review content missing or broken', 'geodirectory')."</li>";
|
|
| 1451 | 1451 | $is_error_during_diagnose = true; |
| 1452 | 1452 | |
| 1453 | 1453 | if ($fix) {
|
| 1454 | 1454 | if (geodir_fix_review_content()) {
|
| 1455 | - $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
|
|
| 1455 | + $output_str .= "<li><strong>".__('-->FIXED: Review content fixed', 'geodirectory')."</strong></li>";
|
|
| 1456 | 1456 | } else {
|
| 1457 | - $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1457 | + $output_str .= "<li><strong>".__('-->FAILED: Review content fix failed', 'geodirectory')."</strong></li>";
|
|
| 1458 | 1458 | } |
| 1459 | 1459 | } |
| 1460 | 1460 | |
| 1461 | 1461 | } else {
|
| 1462 | - $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
|
|
| 1462 | + $output_str .= "<li>".__('Review content ok', 'geodirectory')."</li>";
|
|
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | 1465 | |
| 1466 | 1466 | if ($is_error_during_diagnose) {
|
| 1467 | 1467 | $info_div_class = "geodir_problem_info"; |
| 1468 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1468 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1469 | 1469 | } else {
|
| 1470 | 1470 | $info_div_class = "geodir_noproblem_info"; |
| 1471 | 1471 | $fix_button_txt = ''; |
@@ -1529,7 +1529,7 @@ discard block |
||
| 1529 | 1529 | |
| 1530 | 1530 | if ($is_error_during_diagnose) {
|
| 1531 | 1531 | $info_div_class = "geodir_problem_info"; |
| 1532 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
| 1532 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
| 1533 | 1533 | } else {
|
| 1534 | 1534 | $info_div_class = "geodir_noproblem_info"; |
| 1535 | 1535 | $fix_button_txt = ''; |
@@ -1563,7 +1563,7 @@ discard block |
||
| 1563 | 1563 | else {
|
| 1564 | 1564 | $page_found = $wpdb->get_var( |
| 1565 | 1565 | $wpdb->prepare( |
| 1566 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 1566 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;", |
|
| 1567 | 1567 | array($slug) |
| 1568 | 1568 | ) |
| 1569 | 1569 | ); |
@@ -1609,18 +1609,18 @@ discard block |
||
| 1609 | 1609 | ////////////////////////////////// |
| 1610 | 1610 | $option_value = get_option('geodir_home_page');
|
| 1611 | 1611 | $page = get_post($option_value); |
| 1612 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1612 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1613 | 1613 | |
| 1614 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1615 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1614 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1615 | + $output_str .= "<li>".__('GD Home page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1616 | 1616 | else {
|
| 1617 | 1617 | $is_error_during_diagnose = true; |
| 1618 | - $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1618 | + $output_str .= "<li><strong>".__('GD Home page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1619 | 1619 | if ($fix) {
|
| 1620 | 1620 | if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
|
| 1621 | - $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1621 | + $output_str .= "<li><strong>".__('-->FIXED: GD Home page fixed', 'geodirectory')."</strong></li>";
|
|
| 1622 | 1622 | } else {
|
| 1623 | - $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1623 | + $output_str .= "<li><strong>".__('-->FAILED: GD Home page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1624 | 1624 | } |
| 1625 | 1625 | } |
| 1626 | 1626 | } |
@@ -1634,18 +1634,18 @@ discard block |
||
| 1634 | 1634 | ////////////////////////////////// |
| 1635 | 1635 | $option_value = get_option('geodir_add_listing_page');
|
| 1636 | 1636 | $page = get_post($option_value); |
| 1637 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1637 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1638 | 1638 | |
| 1639 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1640 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1639 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1640 | + $output_str .= "<li>".__('Add Listing page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1641 | 1641 | else {
|
| 1642 | 1642 | $is_error_during_diagnose = true; |
| 1643 | - $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1643 | + $output_str .= "<li><strong>".__('Add Listing page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1644 | 1644 | if ($fix) {
|
| 1645 | 1645 | if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
|
| 1646 | - $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1646 | + $output_str .= "<li><strong>".__('-->FIXED: Add Listing page fixed', 'geodirectory')."</strong></li>";
|
|
| 1647 | 1647 | } else {
|
| 1648 | - $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1648 | + $output_str .= "<li><strong>".__('-->FAILED: Add Listing page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1649 | 1649 | } |
| 1650 | 1650 | } |
| 1651 | 1651 | } |
@@ -1660,18 +1660,18 @@ discard block |
||
| 1660 | 1660 | ////////////////////////////////// |
| 1661 | 1661 | $option_value = get_option('geodir_preview_page');
|
| 1662 | 1662 | $page = get_post($option_value); |
| 1663 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1663 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1664 | 1664 | |
| 1665 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1666 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1665 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1666 | + $output_str .= "<li>".__('Listing Preview page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1667 | 1667 | else {
|
| 1668 | 1668 | $is_error_during_diagnose = true; |
| 1669 | - $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1669 | + $output_str .= "<li><strong>".__('Listing Preview page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1670 | 1670 | if ($fix) {
|
| 1671 | 1671 | if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
|
| 1672 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1672 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Preview page fixed', 'geodirectory')."</strong></li>";
|
|
| 1673 | 1673 | } else {
|
| 1674 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1674 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Preview page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1675 | 1675 | } |
| 1676 | 1676 | } |
| 1677 | 1677 | } |
@@ -1685,18 +1685,18 @@ discard block |
||
| 1685 | 1685 | ////////////////////////////////// |
| 1686 | 1686 | $option_value = get_option('geodir_success_page');
|
| 1687 | 1687 | $page = get_post($option_value); |
| 1688 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1688 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1689 | 1689 | |
| 1690 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1691 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1690 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1691 | + $output_str .= "<li>".__('Listing Success page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1692 | 1692 | else {
|
| 1693 | 1693 | $is_error_during_diagnose = true; |
| 1694 | - $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1694 | + $output_str .= "<li><strong>".__('Listing Success page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1695 | 1695 | if ($fix) {
|
| 1696 | 1696 | if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
|
| 1697 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1697 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Success page fixed', 'geodirectory')."</strong></li>";
|
|
| 1698 | 1698 | } else {
|
| 1699 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1699 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Success page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1700 | 1700 | } |
| 1701 | 1701 | } |
| 1702 | 1702 | } |
@@ -1710,18 +1710,18 @@ discard block |
||
| 1710 | 1710 | ////////////////////////////////// |
| 1711 | 1711 | $option_value = get_option('geodir_info_page');
|
| 1712 | 1712 | $page = get_post($option_value); |
| 1713 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1713 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1714 | 1714 | |
| 1715 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1716 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1715 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1716 | + $output_str .= "<li>".__('Info page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1717 | 1717 | else {
|
| 1718 | 1718 | $is_error_during_diagnose = true; |
| 1719 | - $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1719 | + $output_str .= "<li><strong>".__('Info page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1720 | 1720 | if ($fix) {
|
| 1721 | 1721 | if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
|
| 1722 | - $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1722 | + $output_str .= "<li><strong>".__('-->FIXED: Info page fixed', 'geodirectory')."</strong></li>";
|
|
| 1723 | 1723 | } else {
|
| 1724 | - $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1724 | + $output_str .= "<li><strong>".__('-->FAILED: Info page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1725 | 1725 | } |
| 1726 | 1726 | } |
| 1727 | 1727 | } |
@@ -1735,18 +1735,18 @@ discard block |
||
| 1735 | 1735 | ////////////////////////////////// |
| 1736 | 1736 | $option_value = get_option('geodir_login_page');
|
| 1737 | 1737 | $page = get_post($option_value); |
| 1738 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1738 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1739 | 1739 | |
| 1740 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1741 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1740 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1741 | + $output_str .= "<li>".__('Login page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1742 | 1742 | else {
|
| 1743 | 1743 | $is_error_during_diagnose = true; |
| 1744 | - $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1744 | + $output_str .= "<li><strong>".__('Login page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1745 | 1745 | if ($fix) {
|
| 1746 | 1746 | if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
|
| 1747 | - $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1747 | + $output_str .= "<li><strong>".__('-->FIXED: Login page fixed', 'geodirectory')."</strong></li>";
|
|
| 1748 | 1748 | } else {
|
| 1749 | - $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1749 | + $output_str .= "<li><strong>".__('-->FAILED: Login page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1750 | 1750 | } |
| 1751 | 1751 | } |
| 1752 | 1752 | } |
@@ -1760,18 +1760,18 @@ discard block |
||
| 1760 | 1760 | ////////////////////////////////// |
| 1761 | 1761 | $option_value = get_option('geodir_location_page');
|
| 1762 | 1762 | $page = get_post($option_value); |
| 1763 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1763 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1764 | 1764 | |
| 1765 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1766 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1765 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1766 | + $output_str .= "<li>".__('Location page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1767 | 1767 | else {
|
| 1768 | 1768 | $is_error_during_diagnose = true; |
| 1769 | - $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1769 | + $output_str .= "<li><strong>".__('Location page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1770 | 1770 | if ($fix) {
|
| 1771 | 1771 | if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
|
| 1772 | - $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1772 | + $output_str .= "<li><strong>".__('-->FIXED: Location page fixed', 'geodirectory')."</strong></li>";
|
|
| 1773 | 1773 | } else {
|
| 1774 | - $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1774 | + $output_str .= "<li><strong>".__('-->FAILED: Location page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1775 | 1775 | } |
| 1776 | 1776 | } |
| 1777 | 1777 | } |
@@ -1780,13 +1780,13 @@ discard block |
||
| 1780 | 1780 | /* Diagnose Location Page Ends */ |
| 1781 | 1781 | //////////////////////////////// |
| 1782 | 1782 | |
| 1783 | - $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
|
|
| 1783 | + $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose);
|
|
| 1784 | 1784 | /** |
| 1785 | 1785 | * This action is called at the end of the GD Tools page check function. |
| 1786 | 1786 | * |
| 1787 | 1787 | * @since 1.5.2 |
| 1788 | 1788 | */ |
| 1789 | - $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
|
|
| 1789 | + $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr);
|
|
| 1790 | 1790 | |
| 1791 | 1791 | $output_str = $page_chk_arr['output_str']; |
| 1792 | 1792 | $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
@@ -1796,7 +1796,7 @@ discard block |
||
| 1796 | 1796 | flush_rewrite_rules(); |
| 1797 | 1797 | } |
| 1798 | 1798 | $info_div_class = "geodir_problem_info"; |
| 1799 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
| 1799 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
| 1800 | 1800 | } else {
|
| 1801 | 1801 | $info_div_class = "geodir_noproblem_info"; |
| 1802 | 1802 | $fix_button_txt = ''; |
@@ -1824,10 +1824,10 @@ discard block |
||
| 1824 | 1824 | $fix_button_txt = ''; |
| 1825 | 1825 | |
| 1826 | 1826 | if ($is_error_during_diagnose) {
|
| 1827 | - $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>";
|
|
| 1827 | + $output_str .= "<li>".__('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory').' '.geodir_plugin_path().'/db-language.php'."</li>";
|
|
| 1828 | 1828 | $info_div_class = "geodir_problem_info"; |
| 1829 | 1829 | } else {
|
| 1830 | - $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
|
|
| 1830 | + $output_str .= "<li>".__('Load custom fields in to file for translation: ok', 'geodirectory')."</li>";
|
|
| 1831 | 1831 | $info_div_class = "geodir_noproblem_info"; |
| 1832 | 1832 | $fix_button_txt = ''; |
| 1833 | 1833 | } |
@@ -1869,17 +1869,17 @@ discard block |
||
| 1869 | 1869 | global $wpdb, $wp_query, $plugin_prefix; |
| 1870 | 1870 | |
| 1871 | 1871 | if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) {
|
| 1872 | - $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
| 1872 | + $table = $plugin_prefix.$wp_query->query_vars['post_type'].'_detail'; |
|
| 1873 | 1873 | |
| 1874 | - $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
| 1874 | + $join = $clauses['join'].' INNER JOIN '.$table.' AS gd_posts ON (gd_posts.post_id = '.$wpdb->posts.'.ID)'; |
|
| 1875 | 1875 | $clauses['join'] = $join; |
| 1876 | 1876 | |
| 1877 | - $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
| 1877 | + $fields = $clauses['fields'] != '' ? $clauses['fields'].', ' : ''; |
|
| 1878 | 1878 | $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire'; |
| 1879 | 1879 | $clauses['fields'] = $fields; |
| 1880 | 1880 | |
| 1881 | 1881 | $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
| 1882 | - $orderby = 'gd_expire ' . $order; |
|
| 1882 | + $orderby = 'gd_expire '.$order; |
|
| 1883 | 1883 | $clauses['orderby'] = $orderby; |
| 1884 | 1884 | } |
| 1885 | 1885 | return $clauses; |
@@ -1922,7 +1922,7 @@ discard block |
||
| 1922 | 1922 | global $current_user; |
| 1923 | 1923 | $upload_dir = wp_upload_dir(); |
| 1924 | 1924 | |
| 1925 | - $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
| 1925 | + $file = $upload_dir['path'].'/temp_'.$current_user->data->ID.'/geodir_tmp.csv'; |
|
| 1926 | 1926 | $handle = fopen($file, 'w'); |
| 1927 | 1927 | |
| 1928 | 1928 | fwrite($handle, $input); |
@@ -1967,7 +1967,7 @@ discard block |
||
| 1967 | 1967 | $uploads_dir = $uploads['path']; |
| 1968 | 1968 | $image_name_arr = explode('/', $filename);
|
| 1969 | 1969 | $filename = end($image_name_arr); |
| 1970 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1970 | + $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1971 | 1971 | $return = array(); |
| 1972 | 1972 | $return['file'] = $uploadedFile; |
| 1973 | 1973 | $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
@@ -1984,8 +1984,8 @@ discard block |
||
| 1984 | 1984 | |
| 1985 | 1985 | if (($handle = fopen($target_path, "r")) !== FALSE) {
|
| 1986 | 1986 | while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
| 1987 | - if(is_array($data) && !empty($data)) {
|
|
| 1988 | - $file[] = '"' . implode('","', $data) . '"';
|
|
| 1987 | + if (is_array($data) && !empty($data)) {
|
|
| 1988 | + $file[] = '"'.implode('","', $data).'"';
|
|
| 1989 | 1989 | } |
| 1990 | 1990 | } |
| 1991 | 1991 | fclose($handle); |
@@ -2102,10 +2102,10 @@ discard block |
||
| 2102 | 2102 | $tag_arr = explode(',', $post_tags);
|
| 2103 | 2103 | } |
| 2104 | 2104 | |
| 2105 | - $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
| 2105 | + $table = $plugin_prefix.$buffer[5].'_detail'; // check table in database |
|
| 2106 | 2106 | |
| 2107 | 2107 | $error = ''; |
| 2108 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
|
|
| 2108 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$table."'") != $table) {
|
|
| 2109 | 2109 | $invalid_post_type++; |
| 2110 | 2110 | continue; |
| 2111 | 2111 | } |
@@ -2131,7 +2131,7 @@ discard block |
||
| 2131 | 2131 | if ($buffer[$c] != '0' && $buffer[$c] != '') {
|
| 2132 | 2132 | $submitdata = date('Y-m-d');
|
| 2133 | 2133 | |
| 2134 | - $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
|
|
| 2134 | + $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata."+".addslashes($buffer[$c])." days"));
|
|
| 2135 | 2135 | } else {
|
| 2136 | 2136 | $gd_post_info['expire_date'] = 'Never'; |
| 2137 | 2137 | } |
@@ -2159,7 +2159,7 @@ discard block |
||
| 2159 | 2159 | |
| 2160 | 2160 | // Post status |
| 2161 | 2161 | if ($customKeyarray[$c] == 'post_status') {
|
| 2162 | - $post_status = sanitize_key( $buffer[$c] ); |
|
| 2162 | + $post_status = sanitize_key($buffer[$c]); |
|
| 2163 | 2163 | } |
| 2164 | 2164 | } |
| 2165 | 2165 | |
@@ -2177,8 +2177,8 @@ discard block |
||
| 2177 | 2177 | |
| 2178 | 2178 | // Default post status |
| 2179 | 2179 | $default_status = 'publish'; |
| 2180 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
| 2181 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
| 2180 | + $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status; |
|
| 2181 | + $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status; |
|
| 2182 | 2182 | |
| 2183 | 2183 | $my_post['post_title'] = $post_title; |
| 2184 | 2184 | $my_post['post_content'] = $post_desc; |
@@ -2222,7 +2222,7 @@ discard block |
||
| 2222 | 2222 | $payment_info = array(); |
| 2223 | 2223 | $package_info = array(); |
| 2224 | 2224 | |
| 2225 | - $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
| 2225 | + $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]); |
|
| 2226 | 2226 | $package_id = ''; |
| 2227 | 2227 | if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
|
| 2228 | 2228 | $package_id = $gd_post_info['package_id']; |
@@ -2232,7 +2232,7 @@ discard block |
||
| 2232 | 2232 | $payment_info['package_id'] = $package_info['pid']; |
| 2233 | 2233 | |
| 2234 | 2234 | if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
|
| 2235 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
|
|
| 2235 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['alive_days']." days"));
|
|
| 2236 | 2236 | } else {
|
| 2237 | 2237 | $payment_info['expire_date'] = 'Never'; |
| 2238 | 2238 | } |
@@ -2244,7 +2244,7 @@ discard block |
||
| 2244 | 2244 | |
| 2245 | 2245 | $post_type = get_post_type($last_postid); |
| 2246 | 2246 | |
| 2247 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2247 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2248 | 2248 | |
| 2249 | 2249 | geodir_save_post_info($last_postid, $gd_post_info); |
| 2250 | 2250 | |
@@ -2265,7 +2265,7 @@ discard block |
||
| 2265 | 2265 | $attachment['post_id'] = $last_postid; |
| 2266 | 2266 | $attachment['title'] = $img_name_arr[0]; |
| 2267 | 2267 | $attachment['content'] = ''; |
| 2268 | - $attachment['file'] = $sub_dir . '/' . $image_name; |
|
| 2268 | + $attachment['file'] = $sub_dir.'/'.$image_name; |
|
| 2269 | 2269 | $attachment['mime_type'] = $uploaded_file_type; |
| 2270 | 2270 | $attachment['menu_order'] = $menu_order; |
| 2271 | 2271 | $attachment['is_featured'] = 0; |
@@ -2274,15 +2274,15 @@ discard block |
||
| 2274 | 2274 | |
| 2275 | 2275 | foreach ($attachment as $key => $val) {
|
| 2276 | 2276 | if ($val != '') |
| 2277 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2277 | + $attachment_set .= $key." = '".$val."', "; |
|
| 2278 | 2278 | } |
| 2279 | 2279 | $attachment_set = trim($attachment_set, ", "); |
| 2280 | 2280 | |
| 2281 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 2281 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
|
|
| 2282 | 2282 | |
| 2283 | 2283 | if ($menu_order == 1) {
|
| 2284 | 2284 | $post_type = get_post_type($last_postid); |
| 2285 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
|
|
| 2285 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($sub_dir.'/'.$image_name, $last_postid)));
|
|
| 2286 | 2286 | } |
| 2287 | 2287 | $menu_order++; |
| 2288 | 2288 | } |
@@ -2323,11 +2323,11 @@ discard block |
||
| 2323 | 2323 | } |
| 2324 | 2324 | |
| 2325 | 2325 | // Add the tab in left sidebar menu fro import & export page. |
| 2326 | -add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 ); |
|
| 2326 | +add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94);
|
|
| 2327 | 2327 | |
| 2328 | 2328 | // Handle ajax request for import/export. |
| 2329 | -add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' ); |
|
| 2330 | -add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' ); |
|
| 2329 | +add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export');
|
|
| 2330 | +add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export');
|
|
| 2331 | 2331 | |
| 2332 | 2332 | |
| 2333 | 2333 | /** |
@@ -2338,40 +2338,40 @@ discard block |
||
| 2338 | 2338 | * @param $post_id int $post_id The post ID of the post being saved. |
| 2339 | 2339 | * @param $post object $post The post object of the post being saved. |
| 2340 | 2340 | */ |
| 2341 | -function geodir_update_location_prefix($post_id,$post){
|
|
| 2342 | - if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
|
|
| 2343 | - update_option('geodir_location_prefix',$post->post_name);
|
|
| 2341 | +function geodir_update_location_prefix($post_id, $post) {
|
|
| 2342 | + if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) {
|
|
| 2343 | + update_option('geodir_location_prefix', $post->post_name);
|
|
| 2344 | 2344 | } |
| 2345 | 2345 | |
| 2346 | 2346 | } |
| 2347 | 2347 | |
| 2348 | -add_action('save_post', 'geodir_update_location_prefix',10,2);
|
|
| 2348 | +add_action('save_post', 'geodir_update_location_prefix', 10, 2);
|
|
| 2349 | 2349 | |
| 2350 | -add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' ); |
|
| 2350 | +add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback');
|
|
| 2351 | 2351 | |
| 2352 | -function geodir_ga_callback(){
|
|
| 2352 | +function geodir_ga_callback() {
|
|
| 2353 | 2353 | |
| 2354 | -if(isset($_REQUEST['code']) && $_REQUEST['code']) {
|
|
| 2354 | +if (isset($_REQUEST['code']) && $_REQUEST['code']) {
|
|
| 2355 | 2355 | $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
| 2356 | 2356 | $code = "code=".$_REQUEST['code']; |
| 2357 | 2357 | $grant_type = "&grant_type=authorization_code"; |
| 2358 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 2358 | + $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
|
|
| 2359 | 2359 | $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
| 2360 | 2360 | $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
|
| 2361 | 2361 | |
| 2362 | - $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
| 2362 | + $auth_url = $oAuthURL.$code.$redirect_uri.$grant_type.$client_id.$client_secret; |
|
| 2363 | 2363 | |
| 2364 | 2364 | $response = wp_remote_post($auth_url, array('timeout' => 15));
|
| 2365 | 2365 | |
| 2366 | 2366 | //print_r($response); |
| 2367 | 2367 | |
| 2368 | - $error_msg = __('Something went wrong','geodirectory');
|
|
| 2369 | - if(!empty($response['response']['code']) && $response['response']['code']==200){
|
|
| 2368 | + $error_msg = __('Something went wrong', 'geodirectory');
|
|
| 2369 | + if (!empty($response['response']['code']) && $response['response']['code'] == 200) {
|
|
| 2370 | 2370 | |
| 2371 | 2371 | $parts = json_decode($response['body']); |
| 2372 | 2372 | //print_r($parts); |
| 2373 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
|
|
| 2374 | - else{
|
|
| 2373 | + if (!isset($parts->access_token)) {echo $error_msg." - #1"; exit; }
|
|
| 2374 | + else {
|
|
| 2375 | 2375 | |
| 2376 | 2376 | update_option('gd_ga_access_token', $parts->access_token);
|
| 2377 | 2377 | update_option('gd_ga_refresh_token', $parts->refresh_token);
|
@@ -2380,18 +2380,18 @@ discard block |
||
| 2380 | 2380 | |
| 2381 | 2381 | |
| 2382 | 2382 | } |
| 2383 | - elseif(!empty($response['response']['code'])) {
|
|
| 2383 | + elseif (!empty($response['response']['code'])) {
|
|
| 2384 | 2384 | $parts = json_decode($response['body']); |
| 2385 | 2385 | |
| 2386 | - if(isset($parts->error)){
|
|
| 2387 | - echo $parts->error.": ".$parts->error_description;exit; |
|
| 2388 | - }else{
|
|
| 2389 | - echo $error_msg." - #2";exit; |
|
| 2386 | + if (isset($parts->error)) {
|
|
| 2387 | + echo $parts->error.": ".$parts->error_description; exit; |
|
| 2388 | + } else {
|
|
| 2389 | + echo $error_msg." - #2"; exit; |
|
| 2390 | 2390 | } |
| 2391 | 2391 | |
| 2392 | - }else{
|
|
| 2392 | + } else {
|
|
| 2393 | 2393 | |
| 2394 | - echo $error_msg." - #3";exit; |
|
| 2394 | + echo $error_msg." - #3"; exit; |
|
| 2395 | 2395 | |
| 2396 | 2396 | } |
| 2397 | 2397 | } |
@@ -2413,7 +2413,7 @@ discard block |
||
| 2413 | 2413 | function geodir_uninstall_settings($general_settings) {
|
| 2414 | 2414 | $settings = array(); |
| 2415 | 2415 | $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
|
| 2416 | - $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
|
|
| 2416 | + $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory'));
|
|
| 2417 | 2417 | |
| 2418 | 2418 | $plugins = get_plugins(); |
| 2419 | 2419 | $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
|
@@ -2425,7 +2425,7 @@ discard block |
||
| 2425 | 2425 | if (in_array($plugin_name, $un_plugins)) {
|
| 2426 | 2426 | $settings[] = array( |
| 2427 | 2427 | 'type' => 'checkbox', |
| 2428 | - 'id' => 'geodir_un_' . $plugin_name, |
|
| 2428 | + 'id' => 'geodir_un_'.$plugin_name, |
|
| 2429 | 2429 | 'name' => $data['Name'], |
| 2430 | 2430 | 'desc' => __('Remove all data when deleted?', 'geodirectory'),
|
| 2431 | 2431 | 'std' => '0' |
@@ -2459,7 +2459,7 @@ discard block |
||
| 2459 | 2459 | * @since 1.6.9 |
| 2460 | 2460 | */ |
| 2461 | 2461 | function geodir_uninstall_settings_desc() {
|
| 2462 | - echo '<p class="gd-un-settings-desc">' . __('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory') . '</p>';
|
|
| 2462 | + echo '<p class="gd-un-settings-desc">'.__('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory').'</p>';
|
|
| 2463 | 2463 | } |
| 2464 | 2464 | add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc');
|
| 2465 | 2465 | |
@@ -2523,12 +2523,12 @@ discard block |
||
| 2523 | 2523 | |
| 2524 | 2524 | |
| 2525 | 2525 | if ($delete) {
|
| 2526 | - $output_str .= "<li><strong>" . __('Table dropped, refresh page to reinstall.', 'geodirectory') . "</strong></li>";
|
|
| 2526 | + $output_str .= "<li><strong>".__('Table dropped, refresh page to reinstall.', 'geodirectory')."</strong></li>";
|
|
| 2527 | 2527 | ob_start(); |
| 2528 | 2528 | geodir_diagnose_version_clear(); |
| 2529 | 2529 | ob_end_clean(); |
| 2530 | - }else{
|
|
| 2531 | - $output_str .= "<li><strong>" . __('Seomething went wrong.', 'geodirectory') . "</strong></li>";
|
|
| 2530 | + } else {
|
|
| 2531 | + $output_str .= "<li><strong>".__('Seomething went wrong.', 'geodirectory')."</strong></li>";
|
|
| 2532 | 2532 | } |
| 2533 | 2533 | |
| 2534 | 2534 | if ($is_error_during_diagnose) {
|
@@ -24,8 +24,11 @@ discard block |
||
| 24 | 24 | global $current_tab; |
| 25 | 25 | geodir_redirect_to_admin_panel_on_installed(); |
| 26 | 26 | $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings'; |
| 27 | - if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests |
|
| 28 | - geodir_handle_option_form_submit($current_tab); // located in admin function.php |
|
| 27 | + if (!(isset($_REQUEST['action']))) { |
|
| 28 | + // this will avoid Ajax requests |
|
| 29 | + geodir_handle_option_form_submit($current_tab); |
|
| 30 | + } |
|
| 31 | + // located in admin function.php |
|
| 29 | 32 | /** |
| 30 | 33 | * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area. |
| 31 | 34 | * |
@@ -324,8 +327,9 @@ discard block |
||
| 324 | 327 | if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
|
| 325 | 328 | |
| 326 | 329 | foreach ($notification as $key => $value) {
|
| 327 | - if ($value['type'] == 'textarea') |
|
| 328 | - $notification[$key]['type'] = 'editor'; |
|
| 330 | + if ($value['type'] == 'textarea') { |
|
| 331 | + $notification[$key]['type'] = 'editor'; |
|
| 332 | + } |
|
| 329 | 333 | } |
| 330 | 334 | |
| 331 | 335 | } |
@@ -350,8 +354,9 @@ discard block |
||
| 350 | 354 | if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
|
| 351 | 355 | |
| 352 | 356 | foreach ($design_setting as $key => $value) {
|
| 353 | - if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') |
|
| 354 | - $design_setting[$key]['type'] = 'editor'; |
|
| 357 | + if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') { |
|
| 358 | + $design_setting[$key]['type'] = 'editor'; |
|
| 359 | + } |
|
| 355 | 360 | } |
| 356 | 361 | |
| 357 | 362 | } |
@@ -470,9 +475,9 @@ discard block |
||
| 470 | 475 | class="gd-draggable-form-items gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);"> |
| 471 | 476 | <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
|
| 472 | 477 | echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>'; |
| 473 | - }elseif(isset($val['field_icon']) && $val['field_icon'] ){
|
|
| 478 | + } elseif(isset($val['field_icon']) && $val['field_icon'] ){
|
|
| 474 | 479 | echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
|
| 475 | - }else{
|
|
| 480 | + } else{
|
|
| 476 | 481 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 477 | 482 | }?> |
| 478 | 483 | <?php echo $val['site_title'];?> |
@@ -702,9 +707,9 @@ discard block |
||
| 702 | 707 | <?php |
| 703 | 708 | if($type=='predefined'){
|
| 704 | 709 | $cfs = geodir_custom_fields_predefined($listing_type); |
| 705 | - }elseif($type=='custom'){
|
|
| 710 | + } elseif($type=='custom'){
|
|
| 706 | 711 | $cfs = geodir_custom_fields_custom($listing_type); |
| 707 | - }else{
|
|
| 712 | + } else{
|
|
| 708 | 713 | $cfs = geodir_custom_fields($listing_type); |
| 709 | 714 | ?> |
| 710 | 715 | <ul class="full gd-cf-tooltip-wrap"> |
@@ -759,7 +764,7 @@ discard block |
||
| 759 | 764 | </li> |
| 760 | 765 | <?php |
| 761 | 766 | } |
| 762 | - }else{
|
|
| 767 | + } else{
|
|
| 763 | 768 | _e('There are no custom fields here yet.', 'geodirectory');
|
| 764 | 769 | } |
| 765 | 770 | ?> |
@@ -956,8 +961,9 @@ discard block |
||
| 956 | 961 | |
| 957 | 962 | if (!get_option('geodir_remove_unnecessary_fields')) {
|
| 958 | 963 | |
| 959 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
|
|
| 960 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
|
|
| 964 | + if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) { |
|
| 965 | + $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`"); |
|
| 966 | + } |
|
| 961 | 967 | |
| 962 | 968 | update_option('geodir_remove_unnecessary_fields', '1');
|
| 963 | 969 | |
@@ -993,8 +999,9 @@ discard block |
||
| 993 | 999 | break; |
| 994 | 1000 | |
| 995 | 1001 | case 'diagnosis-fix' : |
| 996 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
| 997 | - $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 1002 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') { |
|
| 1003 | + $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 1004 | + } |
|
| 998 | 1005 | call_user_func('geodir_diagnose_' . $diagnose_this);
|
| 999 | 1006 | exit(); |
| 1000 | 1007 | break; |
@@ -1609,11 +1616,11 @@ discard block |
||
| 1609 | 1616 | ////////////////////////////////// |
| 1610 | 1617 | $option_value = get_option('geodir_home_page');
|
| 1611 | 1618 | $page = get_post($option_value); |
| 1612 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1619 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1613 | 1620 | |
| 1614 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1615 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1616 | - else {
|
|
| 1621 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1622 | + $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1623 | + } else {
|
|
| 1617 | 1624 | $is_error_during_diagnose = true; |
| 1618 | 1625 | $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
|
| 1619 | 1626 | if ($fix) {
|
@@ -1634,11 +1641,11 @@ discard block |
||
| 1634 | 1641 | ////////////////////////////////// |
| 1635 | 1642 | $option_value = get_option('geodir_add_listing_page');
|
| 1636 | 1643 | $page = get_post($option_value); |
| 1637 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1644 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1638 | 1645 | |
| 1639 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1640 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1641 | - else {
|
|
| 1646 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1647 | + $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1648 | + } else {
|
|
| 1642 | 1649 | $is_error_during_diagnose = true; |
| 1643 | 1650 | $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
|
| 1644 | 1651 | if ($fix) {
|
@@ -1660,11 +1667,11 @@ discard block |
||
| 1660 | 1667 | ////////////////////////////////// |
| 1661 | 1668 | $option_value = get_option('geodir_preview_page');
|
| 1662 | 1669 | $page = get_post($option_value); |
| 1663 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1670 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1664 | 1671 | |
| 1665 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1666 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1667 | - else {
|
|
| 1672 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1673 | + $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1674 | + } else {
|
|
| 1668 | 1675 | $is_error_during_diagnose = true; |
| 1669 | 1676 | $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
|
| 1670 | 1677 | if ($fix) {
|
@@ -1685,11 +1692,11 @@ discard block |
||
| 1685 | 1692 | ////////////////////////////////// |
| 1686 | 1693 | $option_value = get_option('geodir_success_page');
|
| 1687 | 1694 | $page = get_post($option_value); |
| 1688 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1695 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1689 | 1696 | |
| 1690 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1691 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1692 | - else {
|
|
| 1697 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1698 | + $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1699 | + } else {
|
|
| 1693 | 1700 | $is_error_during_diagnose = true; |
| 1694 | 1701 | $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
|
| 1695 | 1702 | if ($fix) {
|
@@ -1710,11 +1717,11 @@ discard block |
||
| 1710 | 1717 | ////////////////////////////////// |
| 1711 | 1718 | $option_value = get_option('geodir_info_page');
|
| 1712 | 1719 | $page = get_post($option_value); |
| 1713 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1720 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1714 | 1721 | |
| 1715 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1716 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1717 | - else {
|
|
| 1722 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1723 | + $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1724 | + } else {
|
|
| 1718 | 1725 | $is_error_during_diagnose = true; |
| 1719 | 1726 | $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
|
| 1720 | 1727 | if ($fix) {
|
@@ -1735,11 +1742,11 @@ discard block |
||
| 1735 | 1742 | ////////////////////////////////// |
| 1736 | 1743 | $option_value = get_option('geodir_login_page');
|
| 1737 | 1744 | $page = get_post($option_value); |
| 1738 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1745 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1739 | 1746 | |
| 1740 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1741 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1742 | - else {
|
|
| 1747 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1748 | + $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1749 | + } else {
|
|
| 1743 | 1750 | $is_error_during_diagnose = true; |
| 1744 | 1751 | $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
|
| 1745 | 1752 | if ($fix) {
|
@@ -1760,11 +1767,11 @@ discard block |
||
| 1760 | 1767 | ////////////////////////////////// |
| 1761 | 1768 | $option_value = get_option('geodir_location_page');
|
| 1762 | 1769 | $page = get_post($option_value); |
| 1763 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1770 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1764 | 1771 | |
| 1765 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1766 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1767 | - else {
|
|
| 1772 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1773 | + $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1774 | + } else {
|
|
| 1768 | 1775 | $is_error_during_diagnose = true; |
| 1769 | 1776 | $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
|
| 1770 | 1777 | if ($fix) {
|
@@ -2209,8 +2216,9 @@ discard block |
||
| 2209 | 2216 | ); |
| 2210 | 2217 | |
| 2211 | 2218 | $post_location_info = $request_info['post_location']; |
| 2212 | - if ($location_id = geodir_add_new_location($post_location_info)) |
|
| 2213 | - $post_location_id = $location_id; |
|
| 2219 | + if ($location_id = geodir_add_new_location($post_location_info)) { |
|
| 2220 | + $post_location_id = $location_id; |
|
| 2221 | + } |
|
| 2214 | 2222 | } else {
|
| 2215 | 2223 | $post_location_id = 0; |
| 2216 | 2224 | } |
@@ -2273,8 +2281,9 @@ discard block |
||
| 2273 | 2281 | $attachment_set = ''; |
| 2274 | 2282 | |
| 2275 | 2283 | foreach ($attachment as $key => $val) {
|
| 2276 | - if ($val != '') |
|
| 2277 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2284 | + if ($val != '') { |
|
| 2285 | + $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2286 | + } |
|
| 2278 | 2287 | } |
| 2279 | 2288 | $attachment_set = trim($attachment_set, ", "); |
| 2280 | 2289 | |
@@ -2370,8 +2379,7 @@ discard block |
||
| 2370 | 2379 | |
| 2371 | 2380 | $parts = json_decode($response['body']); |
| 2372 | 2381 | //print_r($parts); |
| 2373 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
|
|
| 2374 | - else{
|
|
| 2382 | + if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} else{
|
|
| 2375 | 2383 | |
| 2376 | 2384 | update_option('gd_ga_access_token', $parts->access_token);
|
| 2377 | 2385 | update_option('gd_ga_refresh_token', $parts->refresh_token);
|
@@ -2379,17 +2387,16 @@ discard block |
||
| 2379 | 2387 | } |
| 2380 | 2388 | |
| 2381 | 2389 | |
| 2382 | - } |
|
| 2383 | - elseif(!empty($response['response']['code'])) {
|
|
| 2390 | + } elseif(!empty($response['response']['code'])) {
|
|
| 2384 | 2391 | $parts = json_decode($response['body']); |
| 2385 | 2392 | |
| 2386 | 2393 | if(isset($parts->error)){
|
| 2387 | 2394 | echo $parts->error.": ".$parts->error_description;exit; |
| 2388 | - }else{
|
|
| 2395 | + } else{
|
|
| 2389 | 2396 | echo $error_msg." - #2";exit; |
| 2390 | 2397 | } |
| 2391 | 2398 | |
| 2392 | - }else{
|
|
| 2399 | + } else{
|
|
| 2393 | 2400 | |
| 2394 | 2401 | echo $error_msg." - #3";exit; |
| 2395 | 2402 | |
@@ -2527,7 +2534,7 @@ discard block |
||
| 2527 | 2534 | ob_start(); |
| 2528 | 2535 | geodir_diagnose_version_clear(); |
| 2529 | 2536 | ob_end_clean(); |
| 2530 | - }else{
|
|
| 2537 | + } else{
|
|
| 2531 | 2538 | $output_str .= "<li><strong>" . __('Seomething went wrong.', 'geodirectory') . "</strong></li>";
|
| 2532 | 2539 | } |
| 2533 | 2540 | |
@@ -10,21 +10,21 @@ |
||
| 10 | 10 | |
| 11 | 11 | // Exit if accessed directly. |
| 12 | 12 | if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 13 | - exit; |
|
| 13 | + exit; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | global $wpdb; |
| 17 | 17 | |
| 18 | 18 | if (get_option('geodir_un_geodirectory')) { |
| 19 | - $wpdb->hide_errors(); |
|
| 19 | + $wpdb->hide_errors(); |
|
| 20 | 20 | |
| 21 | - /* |
|
| 21 | + /* |
|
| 22 | 22 | if (!defined('GEODIRECTORY_VERSION')) { |
| 23 | 23 | // Load plugin file. |
| 24 | 24 | include_once('geodirectory.php'); |
| 25 | 25 | } |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | - // Delete default data. |
|
| 29 | - delete_option('geodir_default_data_installed'); |
|
| 28 | + // Delete default data. |
|
| 29 | + delete_option('geodir_default_data_installed'); |
|
| 30 | 30 | } |
| 31 | 31 | \ No newline at end of file |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | // Exit if accessed directly. |
| 12 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
| 12 | +if (!defined('WP_UNINSTALL_PLUGIN')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -15,296 +15,296 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | function geodir_register_sidebar() |
| 17 | 17 | {
|
| 18 | - global $geodir_sidebars; |
|
| 19 | - |
|
| 20 | - if (function_exists('register_sidebar')) {
|
|
| 21 | - /*===========================*/ |
|
| 22 | - /* Home page sidebars start*/ |
|
| 23 | - /*===========================*/ |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * Filter the `$before_widget` widget opening HTML tag. |
|
| 27 | - * |
|
| 28 | - * @since 1.0.0 |
|
| 29 | - * @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'. |
|
| 30 | - * @see 'geodir_after_widget' |
|
| 31 | - */ |
|
| 32 | - $before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">');
|
|
| 33 | - /** |
|
| 34 | - * Filter the `$after_widget` widget closing HTML tag. |
|
| 35 | - * |
|
| 36 | - * @since 1.0.0 |
|
| 37 | - * @param string $var The HTML string to filter. Default = '</section>'. |
|
| 38 | - * @see 'geodir_before_widget' |
|
| 39 | - */ |
|
| 40 | - $after_widget = apply_filters('geodir_after_widget', '</section>');
|
|
| 41 | - /** |
|
| 42 | - * Filter the `$before_title` widget title opening HTML tag. |
|
| 43 | - * |
|
| 44 | - * @since 1.0.0 |
|
| 45 | - * @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'. |
|
| 46 | - * @see 'geodir_after_title' |
|
| 47 | - */ |
|
| 48 | - $before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">');
|
|
| 49 | - /** |
|
| 50 | - * Filter the `$after_title` widget title closing HTML tag. |
|
| 51 | - * |
|
| 52 | - * @since 1.0.0 |
|
| 53 | - * @param string $var The HTML string to filter. Default = '</h3>'. |
|
| 54 | - * @see 'geodir_before_title' |
|
| 55 | - */ |
|
| 56 | - $after_title = apply_filters('geodir_after_title', '</h3>');
|
|
| 57 | - |
|
| 58 | - if (get_option('geodir_show_home_top_section')) {
|
|
| 59 | - register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 60 | - |
|
| 61 | - $geodir_sidebars[] = 'geodir_home_top'; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - if (get_option('geodir_show_home_contant_section')) {
|
|
| 65 | - register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 18 | + global $geodir_sidebars; |
|
| 66 | 19 | |
| 67 | - $geodir_sidebars[] = 'geodir_home_content'; |
|
| 68 | - } |
|
| 20 | + if (function_exists('register_sidebar')) {
|
|
| 21 | + /*===========================*/ |
|
| 22 | + /* Home page sidebars start*/ |
|
| 23 | + /*===========================*/ |
|
| 69 | 24 | |
| 70 | - if (get_option('geodir_show_home_right_section')) {
|
|
| 71 | - register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 25 | + /** |
|
| 26 | + * Filter the `$before_widget` widget opening HTML tag. |
|
| 27 | + * |
|
| 28 | + * @since 1.0.0 |
|
| 29 | + * @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'. |
|
| 30 | + * @see 'geodir_after_widget' |
|
| 31 | + */ |
|
| 32 | + $before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">');
|
|
| 33 | + /** |
|
| 34 | + * Filter the `$after_widget` widget closing HTML tag. |
|
| 35 | + * |
|
| 36 | + * @since 1.0.0 |
|
| 37 | + * @param string $var The HTML string to filter. Default = '</section>'. |
|
| 38 | + * @see 'geodir_before_widget' |
|
| 39 | + */ |
|
| 40 | + $after_widget = apply_filters('geodir_after_widget', '</section>');
|
|
| 41 | + /** |
|
| 42 | + * Filter the `$before_title` widget title opening HTML tag. |
|
| 43 | + * |
|
| 44 | + * @since 1.0.0 |
|
| 45 | + * @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'. |
|
| 46 | + * @see 'geodir_after_title' |
|
| 47 | + */ |
|
| 48 | + $before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">');
|
|
| 49 | + /** |
|
| 50 | + * Filter the `$after_title` widget title closing HTML tag. |
|
| 51 | + * |
|
| 52 | + * @since 1.0.0 |
|
| 53 | + * @param string $var The HTML string to filter. Default = '</h3>'. |
|
| 54 | + * @see 'geodir_before_title' |
|
| 55 | + */ |
|
| 56 | + $after_title = apply_filters('geodir_after_title', '</h3>');
|
|
| 57 | + |
|
| 58 | + if (get_option('geodir_show_home_top_section')) {
|
|
| 59 | + register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 72 | 60 | |
| 73 | - $geodir_sidebars[] = 'geodir_home_right'; |
|
| 74 | - } |
|
| 61 | + $geodir_sidebars[] = 'geodir_home_top'; |
|
| 62 | + } |
|
| 75 | 63 | |
| 76 | - if (get_option('geodir_show_home_left_section')) {
|
|
| 77 | - register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 64 | + if (get_option('geodir_show_home_contant_section')) {
|
|
| 65 | + register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 78 | 66 | |
| 79 | - $geodir_sidebars[] = 'geodir_home_left'; |
|
| 80 | - } |
|
| 67 | + $geodir_sidebars[] = 'geodir_home_content'; |
|
| 68 | + } |
|
| 81 | 69 | |
| 82 | - if (get_option('geodir_show_home_bottom_section')) {
|
|
| 83 | - register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 70 | + if (get_option('geodir_show_home_right_section')) {
|
|
| 71 | + register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 84 | 72 | |
| 85 | - $geodir_sidebars[] = 'geodir_home_bottom'; |
|
| 86 | - } |
|
| 73 | + $geodir_sidebars[] = 'geodir_home_right'; |
|
| 74 | + } |
|
| 87 | 75 | |
| 88 | - /*===========================*/ |
|
| 89 | - /* Home page sidebars end*/ |
|
| 90 | - /*===========================*/ |
|
| 76 | + if (get_option('geodir_show_home_left_section')) {
|
|
| 77 | + register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 91 | 78 | |
| 92 | - /*===========================*/ |
|
| 93 | - /* Listing page sidebars start*/ |
|
| 94 | - /*===========================*/ |
|
| 79 | + $geodir_sidebars[] = 'geodir_home_left'; |
|
| 80 | + } |
|
| 95 | 81 | |
| 96 | - if (get_option('geodir_show_listing_top_section')) {
|
|
| 97 | - register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 82 | + if (get_option('geodir_show_home_bottom_section')) {
|
|
| 83 | + register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 98 | 84 | |
| 99 | - $geodir_sidebars[] = 'geodir_listing_top'; |
|
| 100 | - } |
|
| 85 | + $geodir_sidebars[] = 'geodir_home_bottom'; |
|
| 86 | + } |
|
| 101 | 87 | |
| 102 | - if (get_option('geodir_show_listing_left_section')) {
|
|
| 103 | - register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 88 | + /*===========================*/ |
|
| 89 | + /* Home page sidebars end*/ |
|
| 90 | + /*===========================*/ |
|
| 104 | 91 | |
| 105 | - $geodir_sidebars[] = 'geodir_listing_left_sidebar'; |
|
| 106 | - } |
|
| 92 | + /*===========================*/ |
|
| 93 | + /* Listing page sidebars start*/ |
|
| 94 | + /*===========================*/ |
|
| 107 | 95 | |
| 108 | - if (get_option('geodir_show_listing_right_section')) {
|
|
| 109 | - register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 96 | + if (get_option('geodir_show_listing_top_section')) {
|
|
| 97 | + register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 110 | 98 | |
| 111 | - $geodir_sidebars[] = 'geodir_listing_right_sidebar'; |
|
| 112 | - } |
|
| 99 | + $geodir_sidebars[] = 'geodir_listing_top'; |
|
| 100 | + } |
|
| 113 | 101 | |
| 114 | - if (get_option('geodir_show_listing_bottom_section')) {
|
|
| 115 | - register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 102 | + if (get_option('geodir_show_listing_left_section')) {
|
|
| 103 | + register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 116 | 104 | |
| 117 | - $geodir_sidebars[] = 'geodir_listing_bottom'; |
|
| 118 | - } |
|
| 105 | + $geodir_sidebars[] = 'geodir_listing_left_sidebar'; |
|
| 106 | + } |
|
| 119 | 107 | |
| 120 | - /*===========================*/ |
|
| 121 | - /* Listing page sidebars start*/ |
|
| 122 | - /*===========================*/ |
|
| 108 | + if (get_option('geodir_show_listing_right_section')) {
|
|
| 109 | + register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 123 | 110 | |
| 124 | - /*===========================*/ |
|
| 125 | - /* Search page sidebars start*/ |
|
| 126 | - /*===========================*/ |
|
| 111 | + $geodir_sidebars[] = 'geodir_listing_right_sidebar'; |
|
| 112 | + } |
|
| 127 | 113 | |
| 128 | - if (get_option('geodir_show_search_top_section')) {
|
|
| 129 | - register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 114 | + if (get_option('geodir_show_listing_bottom_section')) {
|
|
| 115 | + register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 130 | 116 | |
| 131 | - $geodir_sidebars[] = 'geodir_search_top'; |
|
| 132 | - } |
|
| 117 | + $geodir_sidebars[] = 'geodir_listing_bottom'; |
|
| 118 | + } |
|
| 133 | 119 | |
| 134 | - if (get_option('geodir_show_search_left_section')) {
|
|
| 135 | - register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 120 | + /*===========================*/ |
|
| 121 | + /* Listing page sidebars start*/ |
|
| 122 | + /*===========================*/ |
|
| 136 | 123 | |
| 137 | - $geodir_sidebars[] = 'geodir_search_left_sidebar'; |
|
| 138 | - } |
|
| 124 | + /*===========================*/ |
|
| 125 | + /* Search page sidebars start*/ |
|
| 126 | + /*===========================*/ |
|
| 139 | 127 | |
| 140 | - if (get_option('geodir_show_search_right_section')) {
|
|
| 141 | - register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 128 | + if (get_option('geodir_show_search_top_section')) {
|
|
| 129 | + register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 142 | 130 | |
| 143 | - $geodir_sidebars[] = 'geodir_search_right_sidebar'; |
|
| 144 | - } |
|
| 131 | + $geodir_sidebars[] = 'geodir_search_top'; |
|
| 132 | + } |
|
| 145 | 133 | |
| 146 | - if (get_option('geodir_show_search_bottom_section')) {
|
|
| 147 | - register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 134 | + if (get_option('geodir_show_search_left_section')) {
|
|
| 135 | + register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 148 | 136 | |
| 149 | - $geodir_sidebars[] = 'geodir_search_bottom'; |
|
| 150 | - } |
|
| 137 | + $geodir_sidebars[] = 'geodir_search_left_sidebar'; |
|
| 138 | + } |
|
| 151 | 139 | |
| 152 | - /*===========================*/ |
|
| 153 | - /* Search page sidebars end*/ |
|
| 154 | - /*===========================*/ |
|
| 140 | + if (get_option('geodir_show_search_right_section')) {
|
|
| 141 | + register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 155 | 142 | |
| 156 | - /*==================================*/ |
|
| 157 | - /* Detail/Single page sidebars start*/ |
|
| 158 | - /*==================================*/ |
|
| 159 | - if (get_option('geodir_show_detail_top_section')) {
|
|
| 160 | - register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 143 | + $geodir_sidebars[] = 'geodir_search_right_sidebar'; |
|
| 144 | + } |
|
| 161 | 145 | |
| 162 | - $geodir_sidebars[] = 'geodir_detail_top'; |
|
| 163 | - } |
|
| 146 | + if (get_option('geodir_show_search_bottom_section')) {
|
|
| 147 | + register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 164 | 148 | |
| 165 | - register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 149 | + $geodir_sidebars[] = 'geodir_search_bottom'; |
|
| 150 | + } |
|
| 166 | 151 | |
| 167 | - $geodir_sidebars[] = 'geodir_detail_sidebar'; |
|
| 152 | + /*===========================*/ |
|
| 153 | + /* Search page sidebars end*/ |
|
| 154 | + /*===========================*/ |
|
| 168 | 155 | |
| 169 | - if (get_option('geodir_show_detail_bottom_section')) {
|
|
| 170 | - register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 156 | + /*==================================*/ |
|
| 157 | + /* Detail/Single page sidebars start*/ |
|
| 158 | + /*==================================*/ |
|
| 159 | + if (get_option('geodir_show_detail_top_section')) {
|
|
| 160 | + register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 171 | 161 | |
| 172 | - $geodir_sidebars[] = 'geodir_detail_bottom'; |
|
| 173 | - } |
|
| 162 | + $geodir_sidebars[] = 'geodir_detail_top'; |
|
| 163 | + } |
|
| 174 | 164 | |
| 175 | - /*==================================*/ |
|
| 176 | - /* Detail/Single page sidebars end*/ |
|
| 177 | - /*==================================*/ |
|
| 165 | + register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 178 | 166 | |
| 179 | - /*==================================*/ |
|
| 180 | - /* Author page sidebars start */ |
|
| 181 | - /*==================================*/ |
|
| 167 | + $geodir_sidebars[] = 'geodir_detail_sidebar'; |
|
| 182 | 168 | |
| 183 | - if (get_option('geodir_show_author_top_section')) {
|
|
| 184 | - register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 169 | + if (get_option('geodir_show_detail_bottom_section')) {
|
|
| 170 | + register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 185 | 171 | |
| 186 | - $geodir_sidebars[] = 'geodir_author_top'; |
|
| 187 | - } |
|
| 172 | + $geodir_sidebars[] = 'geodir_detail_bottom'; |
|
| 173 | + } |
|
| 188 | 174 | |
| 189 | - if (get_option('geodir_show_author_left_section')) {
|
|
| 190 | - register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 175 | + /*==================================*/ |
|
| 176 | + /* Detail/Single page sidebars end*/ |
|
| 177 | + /*==================================*/ |
|
| 191 | 178 | |
| 192 | - $geodir_sidebars[] = 'geodir_author_left_sidebar'; |
|
| 193 | - } |
|
| 179 | + /*==================================*/ |
|
| 180 | + /* Author page sidebars start */ |
|
| 181 | + /*==================================*/ |
|
| 194 | 182 | |
| 195 | - if (get_option('geodir_show_author_right_section')) {
|
|
| 196 | - register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 183 | + if (get_option('geodir_show_author_top_section')) {
|
|
| 184 | + register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 197 | 185 | |
| 198 | - $geodir_sidebars[] = 'geodir_author_right_sidebar'; |
|
| 199 | - } |
|
| 186 | + $geodir_sidebars[] = 'geodir_author_top'; |
|
| 187 | + } |
|
| 200 | 188 | |
| 201 | - if (get_option('geodir_show_author_bottom_section')) {
|
|
| 202 | - register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 189 | + if (get_option('geodir_show_author_left_section')) {
|
|
| 190 | + register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 203 | 191 | |
| 204 | - $geodir_sidebars[] = 'geodir_author_bottom'; |
|
| 205 | - } |
|
| 192 | + $geodir_sidebars[] = 'geodir_author_left_sidebar'; |
|
| 193 | + } |
|
| 206 | 194 | |
| 207 | - /*==================================*/ |
|
| 208 | - /* Author page sidebars end */ |
|
| 209 | - /*==================================*/ |
|
| 195 | + if (get_option('geodir_show_author_right_section')) {
|
|
| 196 | + register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 210 | 197 | |
| 211 | - /*==================================*/ |
|
| 212 | - /* Add listing page sidebars start */ |
|
| 213 | - /*==================================*/ |
|
| 198 | + $geodir_sidebars[] = 'geodir_author_right_sidebar'; |
|
| 199 | + } |
|
| 214 | 200 | |
| 215 | - register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 201 | + if (get_option('geodir_show_author_bottom_section')) {
|
|
| 202 | + register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 216 | 203 | |
| 217 | - $geodir_sidebars[] = 'geodir_add_listing_sidebar'; |
|
| 204 | + $geodir_sidebars[] = 'geodir_author_bottom'; |
|
| 205 | + } |
|
| 218 | 206 | |
| 219 | - /*==================================*/ |
|
| 220 | - /* Add listing page sidebars end */ |
|
| 221 | - /*==================================*/ |
|
| 207 | + /*==================================*/ |
|
| 208 | + /* Author page sidebars end */ |
|
| 209 | + /*==================================*/ |
|
| 222 | 210 | |
| 223 | - } |
|
| 211 | + /*==================================*/ |
|
| 212 | + /* Add listing page sidebars start */ |
|
| 213 | + /*==================================*/ |
|
| 214 | + |
|
| 215 | + register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
|
|
| 216 | + |
|
| 217 | + $geodir_sidebars[] = 'geodir_add_listing_sidebar'; |
|
| 218 | + |
|
| 219 | + /*==================================*/ |
|
| 220 | + /* Add listing page sidebars end */ |
|
| 221 | + /*==================================*/ |
|
| 222 | + |
|
| 223 | + } |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | |
| 227 | 227 | if (!function_exists('register_geodir_widgets')) {
|
| 228 | - /** |
|
| 229 | - * Registers all Widgets. |
|
| 230 | - * |
|
| 231 | - * @since 1.0.0 |
|
| 232 | - * @package GeoDirectory |
|
| 233 | - */ |
|
| 234 | - function register_geodir_widgets() |
|
| 235 | - {
|
|
| 236 | - /** |
|
| 237 | - * Login Widget. |
|
| 238 | - * |
|
| 239 | - * @since 1.0.0 |
|
| 240 | - */ |
|
| 241 | - class geodir_loginwidget extends WP_Widget |
|
| 242 | - {
|
|
| 243 | - /** |
|
| 244 | - * Register the login widget with WordPress. |
|
| 245 | - * |
|
| 246 | - * @since 1.0.0 |
|
| 247 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 248 | - */ |
|
| 249 | - public function __construct() {
|
|
| 250 | - $widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory'));
|
|
| 251 | - parent::__construct( |
|
| 252 | - 'geodir_loginbox', // Base ID |
|
| 253 | - __('GD > Loginbox', 'geodirectory'), // Name
|
|
| 254 | - $widget_ops// Args |
|
| 255 | - ); |
|
| 256 | - } |
|
| 257 | - |
|
| 258 | - /** |
|
| 259 | - * Front-end display content for login widget. |
|
| 260 | - * |
|
| 261 | - * @since 1.0.0 |
|
| 262 | - * @since 1.5.1 Declare function public. |
|
| 263 | - * |
|
| 264 | - * @param array $args Widget arguments. |
|
| 265 | - * @param array $instance Saved values from database. |
|
| 266 | - */ |
|
| 267 | - public function widget($args, $instance) |
|
| 268 | - {
|
|
| 269 | - geodir_loginwidget_output($args, $instance); |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - /** |
|
| 273 | - * Sanitize login widget form values as they are saved. |
|
| 274 | - * |
|
| 275 | - * @since 1.0.0 |
|
| 276 | - * @since 1.5.1 Declare function public. |
|
| 277 | - * |
|
| 278 | - * @param array $new_instance Values just sent to be saved. |
|
| 279 | - * @param array $old_instance Previously saved values from database. |
|
| 280 | - * |
|
| 281 | - * @return array Updated safe values to be saved. |
|
| 282 | - */ |
|
| 283 | - public function update($new_instance, $old_instance) |
|
| 284 | - {
|
|
| 285 | - //save the widget |
|
| 286 | - $instance = $old_instance; |
|
| 287 | - $instance['title'] = strip_tags($new_instance['title']); |
|
| 288 | - |
|
| 289 | - return $instance; |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - /** |
|
| 293 | - * Back-end login widget settings form. |
|
| 294 | - * |
|
| 295 | - * @since 1.0.0 |
|
| 296 | - * @since 1.5.1 Declare function public. |
|
| 297 | - * |
|
| 298 | - * @param array $instance Previously saved values from database. |
|
| 299 | - * @return string|void |
|
| 300 | - */ |
|
| 301 | - public function form($instance) |
|
| 302 | - {
|
|
| 303 | - //widgetform in backend |
|
| 304 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
|
|
| 305 | - $title = strip_tags($instance['title']); |
|
| 306 | - |
|
| 307 | - ?> |
|
| 228 | + /** |
|
| 229 | + * Registers all Widgets. |
|
| 230 | + * |
|
| 231 | + * @since 1.0.0 |
|
| 232 | + * @package GeoDirectory |
|
| 233 | + */ |
|
| 234 | + function register_geodir_widgets() |
|
| 235 | + {
|
|
| 236 | + /** |
|
| 237 | + * Login Widget. |
|
| 238 | + * |
|
| 239 | + * @since 1.0.0 |
|
| 240 | + */ |
|
| 241 | + class geodir_loginwidget extends WP_Widget |
|
| 242 | + {
|
|
| 243 | + /** |
|
| 244 | + * Register the login widget with WordPress. |
|
| 245 | + * |
|
| 246 | + * @since 1.0.0 |
|
| 247 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 248 | + */ |
|
| 249 | + public function __construct() {
|
|
| 250 | + $widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory'));
|
|
| 251 | + parent::__construct( |
|
| 252 | + 'geodir_loginbox', // Base ID |
|
| 253 | + __('GD > Loginbox', 'geodirectory'), // Name
|
|
| 254 | + $widget_ops// Args |
|
| 255 | + ); |
|
| 256 | + } |
|
| 257 | + |
|
| 258 | + /** |
|
| 259 | + * Front-end display content for login widget. |
|
| 260 | + * |
|
| 261 | + * @since 1.0.0 |
|
| 262 | + * @since 1.5.1 Declare function public. |
|
| 263 | + * |
|
| 264 | + * @param array $args Widget arguments. |
|
| 265 | + * @param array $instance Saved values from database. |
|
| 266 | + */ |
|
| 267 | + public function widget($args, $instance) |
|
| 268 | + {
|
|
| 269 | + geodir_loginwidget_output($args, $instance); |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + /** |
|
| 273 | + * Sanitize login widget form values as they are saved. |
|
| 274 | + * |
|
| 275 | + * @since 1.0.0 |
|
| 276 | + * @since 1.5.1 Declare function public. |
|
| 277 | + * |
|
| 278 | + * @param array $new_instance Values just sent to be saved. |
|
| 279 | + * @param array $old_instance Previously saved values from database. |
|
| 280 | + * |
|
| 281 | + * @return array Updated safe values to be saved. |
|
| 282 | + */ |
|
| 283 | + public function update($new_instance, $old_instance) |
|
| 284 | + {
|
|
| 285 | + //save the widget |
|
| 286 | + $instance = $old_instance; |
|
| 287 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 288 | + |
|
| 289 | + return $instance; |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + /** |
|
| 293 | + * Back-end login widget settings form. |
|
| 294 | + * |
|
| 295 | + * @since 1.0.0 |
|
| 296 | + * @since 1.5.1 Declare function public. |
|
| 297 | + * |
|
| 298 | + * @param array $instance Previously saved values from database. |
|
| 299 | + * @return string|void |
|
| 300 | + */ |
|
| 301 | + public function form($instance) |
|
| 302 | + {
|
|
| 303 | + //widgetform in backend |
|
| 304 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
|
|
| 305 | + $title = strip_tags($instance['title']); |
|
| 306 | + |
|
| 307 | + ?> |
|
| 308 | 308 | <p><label |
| 309 | 309 | for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title', 'geodirectory'); ?>
|
| 310 | 310 | : <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
|
@@ -313,64 +313,64 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | |
| 315 | 315 | <?php |
| 316 | - } |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - register_widget('geodir_loginwidget');
|
|
| 320 | - |
|
| 321 | - |
|
| 322 | - /** |
|
| 323 | - * GeoDirectory Social Like Widget. |
|
| 324 | - * |
|
| 325 | - * @since 1.0.0 |
|
| 326 | - */ |
|
| 327 | - class geodir_social_like_widget extends WP_Widget |
|
| 328 | - {
|
|
| 329 | - |
|
| 330 | - /** |
|
| 331 | - * Register the social like widget with WordPress. |
|
| 332 | - * |
|
| 333 | - * @since 1.0.0 |
|
| 334 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 335 | - */ |
|
| 336 | - public function __construct() {
|
|
| 337 | - $widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory'));
|
|
| 338 | - parent::__construct( |
|
| 339 | - 'social_like_widget', // Base ID |
|
| 340 | - __('GD > Social Like', 'geodirectory'), // Name
|
|
| 341 | - $widget_ops// Args |
|
| 342 | - ); |
|
| 343 | - } |
|
| 344 | - |
|
| 345 | - /** |
|
| 346 | - * Front-end display content for social like widget. |
|
| 347 | - * |
|
| 348 | - * @since 1.0.0 |
|
| 349 | - * @since 1.5.1 Declare function public. |
|
| 350 | - * |
|
| 351 | - * @param array $args Widget arguments. |
|
| 352 | - * @param array $instance Saved values from database. |
|
| 353 | - */ |
|
| 354 | - public function widget($args, $instance) |
|
| 355 | - {
|
|
| 356 | - // prints the widget |
|
| 357 | - extract($args, EXTR_SKIP); |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * Filter the widget title text. |
|
| 361 | - * |
|
| 362 | - * @since 1.0.0 |
|
| 363 | - * @global object $current_user Current user object. |
|
| 364 | - * @param string $title The widget title text. |
|
| 365 | - */ |
|
| 366 | - $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
|
|
| 367 | - |
|
| 368 | - global $current_user, $post; |
|
| 369 | - echo $before_widget; |
|
| 370 | - ?> |
|
| 316 | + } |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + register_widget('geodir_loginwidget');
|
|
| 320 | + |
|
| 321 | + |
|
| 322 | + /** |
|
| 323 | + * GeoDirectory Social Like Widget. |
|
| 324 | + * |
|
| 325 | + * @since 1.0.0 |
|
| 326 | + */ |
|
| 327 | + class geodir_social_like_widget extends WP_Widget |
|
| 328 | + {
|
|
| 329 | + |
|
| 330 | + /** |
|
| 331 | + * Register the social like widget with WordPress. |
|
| 332 | + * |
|
| 333 | + * @since 1.0.0 |
|
| 334 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 335 | + */ |
|
| 336 | + public function __construct() {
|
|
| 337 | + $widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory'));
|
|
| 338 | + parent::__construct( |
|
| 339 | + 'social_like_widget', // Base ID |
|
| 340 | + __('GD > Social Like', 'geodirectory'), // Name
|
|
| 341 | + $widget_ops// Args |
|
| 342 | + ); |
|
| 343 | + } |
|
| 344 | + |
|
| 345 | + /** |
|
| 346 | + * Front-end display content for social like widget. |
|
| 347 | + * |
|
| 348 | + * @since 1.0.0 |
|
| 349 | + * @since 1.5.1 Declare function public. |
|
| 350 | + * |
|
| 351 | + * @param array $args Widget arguments. |
|
| 352 | + * @param array $instance Saved values from database. |
|
| 353 | + */ |
|
| 354 | + public function widget($args, $instance) |
|
| 355 | + {
|
|
| 356 | + // prints the widget |
|
| 357 | + extract($args, EXTR_SKIP); |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * Filter the widget title text. |
|
| 361 | + * |
|
| 362 | + * @since 1.0.0 |
|
| 363 | + * @global object $current_user Current user object. |
|
| 364 | + * @param string $title The widget title text. |
|
| 365 | + */ |
|
| 366 | + $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
|
|
| 367 | + |
|
| 368 | + global $current_user, $post; |
|
| 369 | + echo $before_widget; |
|
| 370 | + ?> |
|
| 371 | 371 | |
| 372 | 372 | <?php //if ( get_option('gd_tweet_button') ) {
|
| 373 | - ?> |
|
| 373 | + ?> |
|
| 374 | 374 | |
| 375 | 375 | <a href="http://twitter.com/share" |
| 376 | 376 | class="twitter-share-button"><?php _e('Tweet', 'geodirectory');?></a>
|
@@ -378,23 +378,23 @@ discard block |
||
| 378 | 378 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
| 379 | 379 | |
| 380 | 380 | <?php //} |
| 381 | - ?> |
|
| 381 | + ?> |
|
| 382 | 382 | |
| 383 | 383 | <?php // if ( get_option('gd_facebook_button') ) {
|
| 384 | - ?> |
|
| 384 | + ?> |
|
| 385 | 385 | |
| 386 | 386 | <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
|
| 387 | - echo 'allowtransparency="true"'; |
|
| 388 | - }?> class="facebook" |
|
| 387 | + echo 'allowtransparency="true"'; |
|
| 388 | + }?> class="facebook" |
|
| 389 | 389 | src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(geodir_curPageURL()); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" |
| 390 | 390 | style="border:none; overflow:hidden; width:100px; height:20px"></iframe> |
| 391 | 391 | |
| 392 | 392 | |
| 393 | 393 | <?php //} |
| 394 | - ?> |
|
| 394 | + ?> |
|
| 395 | 395 | |
| 396 | 396 | <?php //if ( get_option('gd_google_button') ) {
|
| 397 | - ?> |
|
| 397 | + ?> |
|
| 398 | 398 | <script> |
| 399 | 399 | window.___gcfg = {
|
| 400 | 400 | parsetags: 'explicit' |
@@ -408,118 +408,118 @@ discard block |
||
| 408 | 408 | "count": "true" |
| 409 | 409 | });</script> |
| 410 | 410 | <?php //} |
| 411 | - echo $after_widget; |
|
| 412 | - |
|
| 413 | - } |
|
| 414 | - |
|
| 415 | - /** |
|
| 416 | - * Sanitize social like widget form values as they are saved. |
|
| 417 | - * |
|
| 418 | - * @since 1.0.0 |
|
| 419 | - * @since 1.5.1 Declare function public. |
|
| 420 | - * |
|
| 421 | - * @param array $new_instance Values just sent to be saved. |
|
| 422 | - * @param array $old_instance Previously saved values from database. |
|
| 423 | - * |
|
| 424 | - * @return array Updated safe values to be saved. |
|
| 425 | - */ |
|
| 426 | - public function update($new_instance, $old_instance) |
|
| 427 | - {
|
|
| 428 | - //save the widget |
|
| 429 | - $instance = $old_instance; |
|
| 430 | - $instance['title'] = strip_tags($new_instance['title']); |
|
| 431 | - return $instance; |
|
| 432 | - } |
|
| 433 | - |
|
| 434 | - /** |
|
| 435 | - * Back-end social like widget settings form. |
|
| 436 | - * |
|
| 437 | - * @since 1.0.0 |
|
| 438 | - * @since 1.5.1 Declare function public. |
|
| 439 | - * |
|
| 440 | - * @param array $instance Previously saved values from database. |
|
| 441 | - * @return string|void |
|
| 442 | - */ |
|
| 443 | - public function form($instance) |
|
| 444 | - {
|
|
| 445 | - //widgetform in backend |
|
| 446 | - $instance = wp_parse_args((array)$instance, array('title' => ''));
|
|
| 447 | - $title = strip_tags($instance['title']); |
|
| 448 | - ?> |
|
| 411 | + echo $after_widget; |
|
| 412 | + |
|
| 413 | + } |
|
| 414 | + |
|
| 415 | + /** |
|
| 416 | + * Sanitize social like widget form values as they are saved. |
|
| 417 | + * |
|
| 418 | + * @since 1.0.0 |
|
| 419 | + * @since 1.5.1 Declare function public. |
|
| 420 | + * |
|
| 421 | + * @param array $new_instance Values just sent to be saved. |
|
| 422 | + * @param array $old_instance Previously saved values from database. |
|
| 423 | + * |
|
| 424 | + * @return array Updated safe values to be saved. |
|
| 425 | + */ |
|
| 426 | + public function update($new_instance, $old_instance) |
|
| 427 | + {
|
|
| 428 | + //save the widget |
|
| 429 | + $instance = $old_instance; |
|
| 430 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 431 | + return $instance; |
|
| 432 | + } |
|
| 433 | + |
|
| 434 | + /** |
|
| 435 | + * Back-end social like widget settings form. |
|
| 436 | + * |
|
| 437 | + * @since 1.0.0 |
|
| 438 | + * @since 1.5.1 Declare function public. |
|
| 439 | + * |
|
| 440 | + * @param array $instance Previously saved values from database. |
|
| 441 | + * @return string|void |
|
| 442 | + */ |
|
| 443 | + public function form($instance) |
|
| 444 | + {
|
|
| 445 | + //widgetform in backend |
|
| 446 | + $instance = wp_parse_args((array)$instance, array('title' => ''));
|
|
| 447 | + $title = strip_tags($instance['title']); |
|
| 448 | + ?> |
|
| 449 | 449 | <p>No settings for this widget</p> |
| 450 | 450 | |
| 451 | 451 | |
| 452 | 452 | <?php |
| 453 | - } |
|
| 454 | - } |
|
| 455 | - |
|
| 456 | - register_widget('geodir_social_like_widget');
|
|
| 457 | - |
|
| 458 | - |
|
| 459 | - /** |
|
| 460 | - * GeoDirectory Feedburner Subscribe widget. |
|
| 461 | - * |
|
| 462 | - * @since 1.0.0 |
|
| 463 | - */ |
|
| 464 | - class geodirsubscribeWidget extends WP_Widget |
|
| 465 | - {
|
|
| 466 | - |
|
| 467 | - /** |
|
| 468 | - * Register the feedburner subscribe widget with WordPress. |
|
| 469 | - * |
|
| 470 | - * @since 1.0.0 |
|
| 471 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 472 | - */ |
|
| 473 | - public function __construct() {
|
|
| 474 | - $widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory'));
|
|
| 475 | - parent::__construct( |
|
| 476 | - 'widget_subscribeWidget', // Base ID |
|
| 477 | - __('GD > Subscribe', 'geodirectory'), // Name
|
|
| 478 | - $widget_ops// Args |
|
| 479 | - ); |
|
| 480 | - } |
|
| 481 | - |
|
| 482 | - /** |
|
| 483 | - * Front-end display content for feedburner subscribe widget. |
|
| 484 | - * |
|
| 485 | - * @since 1.0.0 |
|
| 486 | - * @since 1.5.1 Declare function public. |
|
| 487 | - * |
|
| 488 | - * @param array $args Widget arguments. |
|
| 489 | - * @param array $instance Saved values from database. |
|
| 490 | - */ |
|
| 491 | - public function widget($args, $instance) |
|
| 492 | - {
|
|
| 493 | - // prints the widget |
|
| 494 | - extract($args, EXTR_SKIP); |
|
| 495 | - |
|
| 496 | - /** |
|
| 497 | - * Filter the widget instance id. |
|
| 498 | - * |
|
| 499 | - * @since 1.0.0 |
|
| 500 | - * @param string $id The widget instance id. |
|
| 501 | - */ |
|
| 502 | - $id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']);
|
|
| 503 | - |
|
| 504 | - /** This filter is documented in geodirectory_widgets.php */ |
|
| 505 | - $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
|
|
| 506 | - |
|
| 507 | - /** |
|
| 508 | - * Filter the widget text. |
|
| 509 | - * |
|
| 510 | - * @since 1.0.0 |
|
| 511 | - * @param string $text The widget text. |
|
| 512 | - */ |
|
| 513 | - $text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']);
|
|
| 514 | - |
|
| 515 | - echo $before_widget; |
|
| 516 | - ?> |
|
| 453 | + } |
|
| 454 | + } |
|
| 455 | + |
|
| 456 | + register_widget('geodir_social_like_widget');
|
|
| 457 | + |
|
| 458 | + |
|
| 459 | + /** |
|
| 460 | + * GeoDirectory Feedburner Subscribe widget. |
|
| 461 | + * |
|
| 462 | + * @since 1.0.0 |
|
| 463 | + */ |
|
| 464 | + class geodirsubscribeWidget extends WP_Widget |
|
| 465 | + {
|
|
| 466 | + |
|
| 467 | + /** |
|
| 468 | + * Register the feedburner subscribe widget with WordPress. |
|
| 469 | + * |
|
| 470 | + * @since 1.0.0 |
|
| 471 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 472 | + */ |
|
| 473 | + public function __construct() {
|
|
| 474 | + $widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory'));
|
|
| 475 | + parent::__construct( |
|
| 476 | + 'widget_subscribeWidget', // Base ID |
|
| 477 | + __('GD > Subscribe', 'geodirectory'), // Name
|
|
| 478 | + $widget_ops// Args |
|
| 479 | + ); |
|
| 480 | + } |
|
| 481 | + |
|
| 482 | + /** |
|
| 483 | + * Front-end display content for feedburner subscribe widget. |
|
| 484 | + * |
|
| 485 | + * @since 1.0.0 |
|
| 486 | + * @since 1.5.1 Declare function public. |
|
| 487 | + * |
|
| 488 | + * @param array $args Widget arguments. |
|
| 489 | + * @param array $instance Saved values from database. |
|
| 490 | + */ |
|
| 491 | + public function widget($args, $instance) |
|
| 492 | + {
|
|
| 493 | + // prints the widget |
|
| 494 | + extract($args, EXTR_SKIP); |
|
| 495 | + |
|
| 496 | + /** |
|
| 497 | + * Filter the widget instance id. |
|
| 498 | + * |
|
| 499 | + * @since 1.0.0 |
|
| 500 | + * @param string $id The widget instance id. |
|
| 501 | + */ |
|
| 502 | + $id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']);
|
|
| 503 | + |
|
| 504 | + /** This filter is documented in geodirectory_widgets.php */ |
|
| 505 | + $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
|
|
| 506 | + |
|
| 507 | + /** |
|
| 508 | + * Filter the widget text. |
|
| 509 | + * |
|
| 510 | + * @since 1.0.0 |
|
| 511 | + * @param string $text The widget text. |
|
| 512 | + */ |
|
| 513 | + $text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']);
|
|
| 514 | + |
|
| 515 | + echo $before_widget; |
|
| 516 | + ?> |
|
| 517 | 517 | |
| 518 | 518 | <?php echo $before_title . $title; ?> <a href="<?php if ($id) {
|
| 519 | - echo 'http://feeds2.feedburner.com/' . $id; |
|
| 520 | - } else {
|
|
| 521 | - bloginfo('rss_url');
|
|
| 522 | - } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?> |
|
| 519 | + echo 'http://feeds2.feedburner.com/' . $id; |
|
| 520 | + } else {
|
|
| 521 | + bloginfo('rss_url');
|
|
| 522 | + } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?> |
|
| 523 | 523 | |
| 524 | 524 | <?php if ($text <> "") { ?>
|
| 525 | 525 | |
@@ -544,57 +544,57 @@ discard block |
||
| 544 | 544 | </form> |
| 545 | 545 | |
| 546 | 546 | <?php |
| 547 | - echo $after_widget; |
|
| 547 | + echo $after_widget; |
|
| 548 | 548 | |
| 549 | - } |
|
| 549 | + } |
|
| 550 | 550 | |
| 551 | - /** |
|
| 552 | - * Sanitize feedburner subscribe widget form values as they are saved. |
|
| 553 | - * |
|
| 554 | - * @since 1.0.0 |
|
| 555 | - * @since 1.5.1 Declare function public. |
|
| 556 | - * |
|
| 557 | - * @param array $new_instance Values just sent to be saved. |
|
| 558 | - * @param array $old_instance Previously saved values from database. |
|
| 559 | - * |
|
| 560 | - * @return array Updated safe values to be saved. |
|
| 561 | - */ |
|
| 562 | - public function update($new_instance, $old_instance) |
|
| 563 | - {
|
|
| 551 | + /** |
|
| 552 | + * Sanitize feedburner subscribe widget form values as they are saved. |
|
| 553 | + * |
|
| 554 | + * @since 1.0.0 |
|
| 555 | + * @since 1.5.1 Declare function public. |
|
| 556 | + * |
|
| 557 | + * @param array $new_instance Values just sent to be saved. |
|
| 558 | + * @param array $old_instance Previously saved values from database. |
|
| 559 | + * |
|
| 560 | + * @return array Updated safe values to be saved. |
|
| 561 | + */ |
|
| 562 | + public function update($new_instance, $old_instance) |
|
| 563 | + {
|
|
| 564 | 564 | |
| 565 | - //save the widget |
|
| 566 | - $instance = $old_instance; |
|
| 567 | - $instance['id'] = strip_tags($new_instance['id']); |
|
| 568 | - $instance['title'] = ($new_instance['title']); |
|
| 569 | - $instance['text'] = ($new_instance['text']); |
|
| 565 | + //save the widget |
|
| 566 | + $instance = $old_instance; |
|
| 567 | + $instance['id'] = strip_tags($new_instance['id']); |
|
| 568 | + $instance['title'] = ($new_instance['title']); |
|
| 569 | + $instance['text'] = ($new_instance['text']); |
|
| 570 | 570 | |
| 571 | 571 | |
| 572 | - return $instance; |
|
| 573 | - } |
|
| 572 | + return $instance; |
|
| 573 | + } |
|
| 574 | 574 | |
| 575 | - /** |
|
| 576 | - * Back-end feedburner subscribe widget settings form. |
|
| 577 | - * |
|
| 578 | - * @since 1.0.0 |
|
| 579 | - * @since 1.5.1 Declare function public. |
|
| 580 | - * |
|
| 581 | - * @param array $instance Previously saved values from database. |
|
| 582 | - * @return string|void |
|
| 583 | - */ |
|
| 584 | - public function form($instance) |
|
| 585 | - {
|
|
| 586 | - //widgetform in backend |
|
| 587 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
|
|
| 575 | + /** |
|
| 576 | + * Back-end feedburner subscribe widget settings form. |
|
| 577 | + * |
|
| 578 | + * @since 1.0.0 |
|
| 579 | + * @since 1.5.1 Declare function public. |
|
| 580 | + * |
|
| 581 | + * @param array $instance Previously saved values from database. |
|
| 582 | + * @return string|void |
|
| 583 | + */ |
|
| 584 | + public function form($instance) |
|
| 585 | + {
|
|
| 586 | + //widgetform in backend |
|
| 587 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
|
|
| 588 | 588 | |
| 589 | - $id = strip_tags($instance['id']); |
|
| 589 | + $id = strip_tags($instance['id']); |
|
| 590 | 590 | |
| 591 | - $title = strip_tags($instance['title']); |
|
| 591 | + $title = strip_tags($instance['title']); |
|
| 592 | 592 | |
| 593 | - $text = strip_tags($instance['text']); |
|
| 593 | + $text = strip_tags($instance['text']); |
|
| 594 | 594 | |
| 595 | 595 | |
| 596 | 596 | |
| 597 | - ?> |
|
| 597 | + ?> |
|
| 598 | 598 | <p><label |
| 599 | 599 | for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory');?>:
|
| 600 | 600 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
|
@@ -613,101 +613,101 @@ discard block |
||
| 613 | 613 | name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_attr($text); ?></textarea></label>
|
| 614 | 614 | </p> |
| 615 | 615 | <?php |
| 616 | - } |
|
| 617 | - } |
|
| 618 | - |
|
| 619 | - register_widget('geodirsubscribeWidget');
|
|
| 620 | - |
|
| 621 | - /** |
|
| 622 | - * GeoDirectory advertise widget. |
|
| 623 | - * |
|
| 624 | - * @since 1.0.0 |
|
| 625 | - */ |
|
| 626 | - class geodiradvtwidget extends WP_Widget |
|
| 627 | - {
|
|
| 628 | - |
|
| 629 | - /** |
|
| 630 | - * Register the advertise widget with WordPress. |
|
| 631 | - * |
|
| 632 | - * @since 1.0.0 |
|
| 633 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 634 | - */ |
|
| 635 | - public function __construct() {
|
|
| 636 | - $widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory'));
|
|
| 637 | - parent::__construct( |
|
| 638 | - 'advtwidget', // Base ID |
|
| 639 | - __('GD > Advertise', 'geodirectory'), // Name
|
|
| 640 | - $widget_ops// Args |
|
| 641 | - ); |
|
| 642 | - } |
|
| 643 | - |
|
| 644 | - |
|
| 645 | - /** |
|
| 646 | - * Front-end display content for advertise widget. |
|
| 647 | - * |
|
| 648 | - * @since 1.0.0 |
|
| 649 | - * @since 1.5.1 Declare function public. |
|
| 650 | - * |
|
| 651 | - * @param array $args Widget arguments. |
|
| 652 | - * @param array $instance Saved values from database. |
|
| 653 | - */ |
|
| 654 | - public function widget($args, $instance) |
|
| 655 | - {
|
|
| 656 | - |
|
| 657 | - // prints the widget |
|
| 658 | - |
|
| 659 | - extract($args, EXTR_SKIP); |
|
| 660 | - |
|
| 661 | - /** |
|
| 662 | - * Filter the description text. |
|
| 663 | - * |
|
| 664 | - * @since 1.0.0 |
|
| 665 | - * @param string $desc1 The widget description text. |
|
| 666 | - */ |
|
| 667 | - $desc1 = empty($instance['desc1']) ? ' ' : apply_filters('widget_desc1', $instance['desc1']);
|
|
| 668 | - echo $before_widget; |
|
| 669 | - ?> |
|
| 616 | + } |
|
| 617 | + } |
|
| 618 | + |
|
| 619 | + register_widget('geodirsubscribeWidget');
|
|
| 620 | + |
|
| 621 | + /** |
|
| 622 | + * GeoDirectory advertise widget. |
|
| 623 | + * |
|
| 624 | + * @since 1.0.0 |
|
| 625 | + */ |
|
| 626 | + class geodiradvtwidget extends WP_Widget |
|
| 627 | + {
|
|
| 628 | + |
|
| 629 | + /** |
|
| 630 | + * Register the advertise widget with WordPress. |
|
| 631 | + * |
|
| 632 | + * @since 1.0.0 |
|
| 633 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 634 | + */ |
|
| 635 | + public function __construct() {
|
|
| 636 | + $widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory'));
|
|
| 637 | + parent::__construct( |
|
| 638 | + 'advtwidget', // Base ID |
|
| 639 | + __('GD > Advertise', 'geodirectory'), // Name
|
|
| 640 | + $widget_ops// Args |
|
| 641 | + ); |
|
| 642 | + } |
|
| 643 | + |
|
| 644 | + |
|
| 645 | + /** |
|
| 646 | + * Front-end display content for advertise widget. |
|
| 647 | + * |
|
| 648 | + * @since 1.0.0 |
|
| 649 | + * @since 1.5.1 Declare function public. |
|
| 650 | + * |
|
| 651 | + * @param array $args Widget arguments. |
|
| 652 | + * @param array $instance Saved values from database. |
|
| 653 | + */ |
|
| 654 | + public function widget($args, $instance) |
|
| 655 | + {
|
|
| 656 | + |
|
| 657 | + // prints the widget |
|
| 658 | + |
|
| 659 | + extract($args, EXTR_SKIP); |
|
| 660 | + |
|
| 661 | + /** |
|
| 662 | + * Filter the description text. |
|
| 663 | + * |
|
| 664 | + * @since 1.0.0 |
|
| 665 | + * @param string $desc1 The widget description text. |
|
| 666 | + */ |
|
| 667 | + $desc1 = empty($instance['desc1']) ? ' ' : apply_filters('widget_desc1', $instance['desc1']);
|
|
| 668 | + echo $before_widget; |
|
| 669 | + ?> |
|
| 670 | 670 | <?php if ($desc1 <> "") { ?>
|
| 671 | 671 | <?php echo $desc1; ?> |
| 672 | 672 | <?php } |
| 673 | - echo $after_widget; |
|
| 674 | - } |
|
| 675 | - |
|
| 676 | - /** |
|
| 677 | - * Sanitize advertise widget form values as they are saved. |
|
| 678 | - * |
|
| 679 | - * @since 1.0.0 |
|
| 680 | - * @since 1.5.1 Declare function public. |
|
| 681 | - * |
|
| 682 | - * @param array $new_instance Values just sent to be saved. |
|
| 683 | - * @param array $old_instance Previously saved values from database. |
|
| 684 | - * |
|
| 685 | - * @return array Updated safe values to be saved. |
|
| 686 | - */ |
|
| 687 | - public function update($new_instance, $old_instance) |
|
| 688 | - {
|
|
| 689 | - //save the widget |
|
| 690 | - $instance = $old_instance; |
|
| 691 | - $instance['desc1'] = ($new_instance['desc1']); |
|
| 692 | - return $instance; |
|
| 693 | - } |
|
| 694 | - |
|
| 695 | - /** |
|
| 696 | - * Back-end advertise widget settings form. |
|
| 697 | - * |
|
| 698 | - * @since 1.0.0 |
|
| 699 | - * @since 1.5.1 Declare function public. |
|
| 700 | - * |
|
| 701 | - * @param array $instance Previously saved values from database. |
|
| 702 | - * @return string|void |
|
| 703 | - */ |
|
| 704 | - public function form($instance) |
|
| 705 | - {
|
|
| 706 | - //widgetform in backend |
|
| 707 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
|
|
| 708 | - |
|
| 709 | - $desc1 = ($instance['desc1']); |
|
| 710 | - ?> |
|
| 673 | + echo $after_widget; |
|
| 674 | + } |
|
| 675 | + |
|
| 676 | + /** |
|
| 677 | + * Sanitize advertise widget form values as they are saved. |
|
| 678 | + * |
|
| 679 | + * @since 1.0.0 |
|
| 680 | + * @since 1.5.1 Declare function public. |
|
| 681 | + * |
|
| 682 | + * @param array $new_instance Values just sent to be saved. |
|
| 683 | + * @param array $old_instance Previously saved values from database. |
|
| 684 | + * |
|
| 685 | + * @return array Updated safe values to be saved. |
|
| 686 | + */ |
|
| 687 | + public function update($new_instance, $old_instance) |
|
| 688 | + {
|
|
| 689 | + //save the widget |
|
| 690 | + $instance = $old_instance; |
|
| 691 | + $instance['desc1'] = ($new_instance['desc1']); |
|
| 692 | + return $instance; |
|
| 693 | + } |
|
| 694 | + |
|
| 695 | + /** |
|
| 696 | + * Back-end advertise widget settings form. |
|
| 697 | + * |
|
| 698 | + * @since 1.0.0 |
|
| 699 | + * @since 1.5.1 Declare function public. |
|
| 700 | + * |
|
| 701 | + * @param array $instance Previously saved values from database. |
|
| 702 | + * @return string|void |
|
| 703 | + */ |
|
| 704 | + public function form($instance) |
|
| 705 | + {
|
|
| 706 | + //widgetform in backend |
|
| 707 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
|
|
| 708 | + |
|
| 709 | + $desc1 = ($instance['desc1']); |
|
| 710 | + ?> |
|
| 711 | 711 | <p><label |
| 712 | 712 | for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?>
|
| 713 | 713 | <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>"
|
@@ -715,65 +715,65 @@ discard block |
||
| 715 | 715 | </p> |
| 716 | 716 | |
| 717 | 717 | <?php |
| 718 | - } |
|
| 719 | - } |
|
| 720 | - |
|
| 721 | - register_widget('geodiradvtwidget');
|
|
| 722 | - |
|
| 723 | - /** |
|
| 724 | - * GeoDirectory Flickr widget. |
|
| 725 | - * |
|
| 726 | - * @since 1.0.0 |
|
| 727 | - */ |
|
| 728 | - class GeodirFlickrWidget extends WP_Widget |
|
| 729 | - {
|
|
| 730 | - |
|
| 731 | - /** |
|
| 732 | - * Register the flickr widget with WordPress. |
|
| 733 | - * |
|
| 734 | - * @since 1.0.0 |
|
| 735 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 736 | - */ |
|
| 737 | - public function __construct() {
|
|
| 738 | - $widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory'));
|
|
| 739 | - parent::__construct( |
|
| 740 | - 'widget_flickrwidget', // Base ID |
|
| 741 | - __('GD > Flickr Photos', 'geodirectory'), // Name
|
|
| 742 | - $widget_ops// Args |
|
| 743 | - ); |
|
| 744 | - } |
|
| 745 | - |
|
| 746 | - /** |
|
| 747 | - * Front-end display content for flickr widget. |
|
| 748 | - * |
|
| 749 | - * @since 1.0.0 |
|
| 750 | - * @since 1.5.1 Declare function public. |
|
| 751 | - * |
|
| 752 | - * @param array $args Widget arguments. |
|
| 753 | - * @param array $instance Saved values from database. |
|
| 754 | - */ |
|
| 755 | - public function widget($args, $instance) |
|
| 756 | - {
|
|
| 757 | - |
|
| 758 | - // prints the widget |
|
| 759 | - extract($args, EXTR_SKIP); |
|
| 760 | - |
|
| 761 | - echo $before_widget; |
|
| 762 | - |
|
| 763 | - /** This filter is documented in geodirectory_widgets.php */ |
|
| 764 | - $id = empty($instance['id']) ? ' ' : apply_filters('widget_id', $instance['id']);
|
|
| 765 | - |
|
| 766 | - /** |
|
| 767 | - * Filter the widget number. |
|
| 768 | - * |
|
| 769 | - * This is used in the flicker widget to show how many images to show. |
|
| 770 | - * |
|
| 771 | - * @since 1.0.0 |
|
| 772 | - * @param string $number The image count. |
|
| 773 | - */ |
|
| 774 | - $number = empty($instance['number']) ? ' ' : apply_filters('widget_number', $instance['number']);
|
|
| 775 | - echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title;
|
|
| 776 | - ?> |
|
| 718 | + } |
|
| 719 | + } |
|
| 720 | + |
|
| 721 | + register_widget('geodiradvtwidget');
|
|
| 722 | + |
|
| 723 | + /** |
|
| 724 | + * GeoDirectory Flickr widget. |
|
| 725 | + * |
|
| 726 | + * @since 1.0.0 |
|
| 727 | + */ |
|
| 728 | + class GeodirFlickrWidget extends WP_Widget |
|
| 729 | + {
|
|
| 730 | + |
|
| 731 | + /** |
|
| 732 | + * Register the flickr widget with WordPress. |
|
| 733 | + * |
|
| 734 | + * @since 1.0.0 |
|
| 735 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 736 | + */ |
|
| 737 | + public function __construct() {
|
|
| 738 | + $widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory'));
|
|
| 739 | + parent::__construct( |
|
| 740 | + 'widget_flickrwidget', // Base ID |
|
| 741 | + __('GD > Flickr Photos', 'geodirectory'), // Name
|
|
| 742 | + $widget_ops// Args |
|
| 743 | + ); |
|
| 744 | + } |
|
| 745 | + |
|
| 746 | + /** |
|
| 747 | + * Front-end display content for flickr widget. |
|
| 748 | + * |
|
| 749 | + * @since 1.0.0 |
|
| 750 | + * @since 1.5.1 Declare function public. |
|
| 751 | + * |
|
| 752 | + * @param array $args Widget arguments. |
|
| 753 | + * @param array $instance Saved values from database. |
|
| 754 | + */ |
|
| 755 | + public function widget($args, $instance) |
|
| 756 | + {
|
|
| 757 | + |
|
| 758 | + // prints the widget |
|
| 759 | + extract($args, EXTR_SKIP); |
|
| 760 | + |
|
| 761 | + echo $before_widget; |
|
| 762 | + |
|
| 763 | + /** This filter is documented in geodirectory_widgets.php */ |
|
| 764 | + $id = empty($instance['id']) ? ' ' : apply_filters('widget_id', $instance['id']);
|
|
| 765 | + |
|
| 766 | + /** |
|
| 767 | + * Filter the widget number. |
|
| 768 | + * |
|
| 769 | + * This is used in the flicker widget to show how many images to show. |
|
| 770 | + * |
|
| 771 | + * @since 1.0.0 |
|
| 772 | + * @param string $number The image count. |
|
| 773 | + */ |
|
| 774 | + $number = empty($instance['number']) ? ' ' : apply_filters('widget_number', $instance['number']);
|
|
| 775 | + echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title;
|
|
| 776 | + ?> |
|
| 777 | 777 | |
| 778 | 778 | <div class="geodir-flickr clearfix"> |
| 779 | 779 | |
@@ -784,45 +784,45 @@ discard block |
||
| 784 | 784 | |
| 785 | 785 | |
| 786 | 786 | <?php echo $after_widget; |
| 787 | - } |
|
| 788 | - |
|
| 789 | - /** |
|
| 790 | - * Sanitize flickr widget form values as they are saved. |
|
| 791 | - * |
|
| 792 | - * @since 1.0.0 |
|
| 793 | - * @since 1.5.1 Declare function public. |
|
| 794 | - * |
|
| 795 | - * @param array $new_instance Values just sent to be saved. |
|
| 796 | - * @param array $old_instance Previously saved values from database. |
|
| 797 | - * |
|
| 798 | - * @return array Updated safe values to be saved. |
|
| 799 | - */ |
|
| 800 | - public function update($new_instance, $old_instance) |
|
| 801 | - {
|
|
| 802 | - //save the widget |
|
| 803 | - $instance = $old_instance; |
|
| 804 | - $instance['id'] = strip_tags($new_instance['id']); |
|
| 805 | - $instance['number'] = strip_tags($new_instance['number']); |
|
| 806 | - return $instance; |
|
| 807 | - } |
|
| 808 | - |
|
| 809 | - /** |
|
| 810 | - * Back-end flickr widget settings form. |
|
| 811 | - * |
|
| 812 | - * @since 1.0.0 |
|
| 813 | - * @since 1.5.1 Declare function public. |
|
| 814 | - * |
|
| 815 | - * @param array $instance Previously saved values from database. |
|
| 816 | - * @return string|void |
|
| 817 | - */ |
|
| 818 | - public function form($instance) |
|
| 819 | - {
|
|
| 820 | - |
|
| 821 | - //widgetform in backend |
|
| 822 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => ''));
|
|
| 823 | - $id = strip_tags($instance['id']); |
|
| 824 | - $number = strip_tags($instance['number']); |
|
| 825 | - ?> |
|
| 787 | + } |
|
| 788 | + |
|
| 789 | + /** |
|
| 790 | + * Sanitize flickr widget form values as they are saved. |
|
| 791 | + * |
|
| 792 | + * @since 1.0.0 |
|
| 793 | + * @since 1.5.1 Declare function public. |
|
| 794 | + * |
|
| 795 | + * @param array $new_instance Values just sent to be saved. |
|
| 796 | + * @param array $old_instance Previously saved values from database. |
|
| 797 | + * |
|
| 798 | + * @return array Updated safe values to be saved. |
|
| 799 | + */ |
|
| 800 | + public function update($new_instance, $old_instance) |
|
| 801 | + {
|
|
| 802 | + //save the widget |
|
| 803 | + $instance = $old_instance; |
|
| 804 | + $instance['id'] = strip_tags($new_instance['id']); |
|
| 805 | + $instance['number'] = strip_tags($new_instance['number']); |
|
| 806 | + return $instance; |
|
| 807 | + } |
|
| 808 | + |
|
| 809 | + /** |
|
| 810 | + * Back-end flickr widget settings form. |
|
| 811 | + * |
|
| 812 | + * @since 1.0.0 |
|
| 813 | + * @since 1.5.1 Declare function public. |
|
| 814 | + * |
|
| 815 | + * @param array $instance Previously saved values from database. |
|
| 816 | + * @return string|void |
|
| 817 | + */ |
|
| 818 | + public function form($instance) |
|
| 819 | + {
|
|
| 820 | + |
|
| 821 | + //widgetform in backend |
|
| 822 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => ''));
|
|
| 823 | + $id = strip_tags($instance['id']); |
|
| 824 | + $number = strip_tags($instance['number']); |
|
| 825 | + ?> |
|
| 826 | 826 | |
| 827 | 827 | <p> |
| 828 | 828 | <label |
@@ -843,99 +843,99 @@ discard block |
||
| 843 | 843 | </label> |
| 844 | 844 | </p> |
| 845 | 845 | <?php |
| 846 | - } |
|
| 847 | - } |
|
| 848 | - |
|
| 849 | - register_widget('GeodirFlickrWidget');
|
|
| 850 | - |
|
| 851 | - /** |
|
| 852 | - * GeoDirectory Twitter widget. |
|
| 853 | - * |
|
| 854 | - * @since 1.0.0 |
|
| 855 | - */ |
|
| 856 | - class geodir_twitter extends WP_Widget |
|
| 857 | - {
|
|
| 858 | - /** |
|
| 859 | - * Register the Twitter widget with WordPress. |
|
| 860 | - * |
|
| 861 | - * @since 1.0.0 |
|
| 862 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 863 | - */ |
|
| 864 | - public function __construct() {
|
|
| 865 | - $widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory'));
|
|
| 866 | - parent::__construct( |
|
| 867 | - 'widget_Twidget', // Base ID |
|
| 868 | - __('GD > Twitter', 'geodirectory'), // Name
|
|
| 869 | - $widget_ops// Args |
|
| 870 | - ); |
|
| 871 | - } |
|
| 872 | - |
|
| 873 | - |
|
| 874 | - /** |
|
| 875 | - * Front-end display content for Twitter widget. |
|
| 876 | - * |
|
| 877 | - * @since 1.0.0 |
|
| 878 | - * @since 1.5.1 Declare function public. |
|
| 879 | - * |
|
| 880 | - * @param array $args Widget arguments. |
|
| 881 | - * @param array $instance Saved values from database. |
|
| 882 | - */ |
|
| 883 | - public function widget($args, $instance) |
|
| 884 | - {
|
|
| 885 | - |
|
| 886 | - // prints the widget |
|
| 887 | - |
|
| 888 | - extract($args, EXTR_SKIP); |
|
| 889 | - |
|
| 890 | - /** |
|
| 891 | - * Filter the twitter widget description text. |
|
| 892 | - * |
|
| 893 | - * @since 1.0.0 |
|
| 894 | - * @param string $desc1 The widget description text. |
|
| 895 | - */ |
|
| 896 | - $desc1 = empty($instance['gd_tw_desc1']) ? ' ' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']);
|
|
| 897 | - echo $before_widget; |
|
| 898 | - if ($desc1 <> "") {
|
|
| 899 | - echo $desc1; |
|
| 900 | - } |
|
| 901 | - echo $after_widget; |
|
| 902 | - } |
|
| 903 | - |
|
| 904 | - /** |
|
| 905 | - * Sanitize twitter widget form values as they are saved. |
|
| 906 | - * |
|
| 907 | - * @since 1.0.0 |
|
| 908 | - * @since 1.5.1 Declare function public. |
|
| 909 | - * |
|
| 910 | - * @param array $new_instance Values just sent to be saved. |
|
| 911 | - * @param array $old_instance Previously saved values from database. |
|
| 912 | - * |
|
| 913 | - * @return array Updated safe values to be saved. |
|
| 914 | - */ |
|
| 915 | - public function update($new_instance, $old_instance) |
|
| 916 | - {
|
|
| 917 | - //save the widget |
|
| 918 | - $instance = $old_instance; |
|
| 919 | - $instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']); |
|
| 920 | - return $instance; |
|
| 921 | - } |
|
| 922 | - |
|
| 923 | - /** |
|
| 924 | - * Back-end twitter widget settings form. |
|
| 925 | - * |
|
| 926 | - * @since 1.0.0 |
|
| 927 | - * @since 1.5.1 Declare function public. |
|
| 928 | - * |
|
| 929 | - * @param array $instance Previously saved values from database. |
|
| 930 | - * @return string|void |
|
| 931 | - */ |
|
| 932 | - public function form($instance) |
|
| 933 | - {
|
|
| 934 | - //widgetform in backend |
|
| 935 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
|
|
| 936 | - |
|
| 937 | - $desc1 = ($instance['gd_tw_desc1']); |
|
| 938 | - ?> |
|
| 846 | + } |
|
| 847 | + } |
|
| 848 | + |
|
| 849 | + register_widget('GeodirFlickrWidget');
|
|
| 850 | + |
|
| 851 | + /** |
|
| 852 | + * GeoDirectory Twitter widget. |
|
| 853 | + * |
|
| 854 | + * @since 1.0.0 |
|
| 855 | + */ |
|
| 856 | + class geodir_twitter extends WP_Widget |
|
| 857 | + {
|
|
| 858 | + /** |
|
| 859 | + * Register the Twitter widget with WordPress. |
|
| 860 | + * |
|
| 861 | + * @since 1.0.0 |
|
| 862 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 863 | + */ |
|
| 864 | + public function __construct() {
|
|
| 865 | + $widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory'));
|
|
| 866 | + parent::__construct( |
|
| 867 | + 'widget_Twidget', // Base ID |
|
| 868 | + __('GD > Twitter', 'geodirectory'), // Name
|
|
| 869 | + $widget_ops// Args |
|
| 870 | + ); |
|
| 871 | + } |
|
| 872 | + |
|
| 873 | + |
|
| 874 | + /** |
|
| 875 | + * Front-end display content for Twitter widget. |
|
| 876 | + * |
|
| 877 | + * @since 1.0.0 |
|
| 878 | + * @since 1.5.1 Declare function public. |
|
| 879 | + * |
|
| 880 | + * @param array $args Widget arguments. |
|
| 881 | + * @param array $instance Saved values from database. |
|
| 882 | + */ |
|
| 883 | + public function widget($args, $instance) |
|
| 884 | + {
|
|
| 885 | + |
|
| 886 | + // prints the widget |
|
| 887 | + |
|
| 888 | + extract($args, EXTR_SKIP); |
|
| 889 | + |
|
| 890 | + /** |
|
| 891 | + * Filter the twitter widget description text. |
|
| 892 | + * |
|
| 893 | + * @since 1.0.0 |
|
| 894 | + * @param string $desc1 The widget description text. |
|
| 895 | + */ |
|
| 896 | + $desc1 = empty($instance['gd_tw_desc1']) ? ' ' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']);
|
|
| 897 | + echo $before_widget; |
|
| 898 | + if ($desc1 <> "") {
|
|
| 899 | + echo $desc1; |
|
| 900 | + } |
|
| 901 | + echo $after_widget; |
|
| 902 | + } |
|
| 903 | + |
|
| 904 | + /** |
|
| 905 | + * Sanitize twitter widget form values as they are saved. |
|
| 906 | + * |
|
| 907 | + * @since 1.0.0 |
|
| 908 | + * @since 1.5.1 Declare function public. |
|
| 909 | + * |
|
| 910 | + * @param array $new_instance Values just sent to be saved. |
|
| 911 | + * @param array $old_instance Previously saved values from database. |
|
| 912 | + * |
|
| 913 | + * @return array Updated safe values to be saved. |
|
| 914 | + */ |
|
| 915 | + public function update($new_instance, $old_instance) |
|
| 916 | + {
|
|
| 917 | + //save the widget |
|
| 918 | + $instance = $old_instance; |
|
| 919 | + $instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']); |
|
| 920 | + return $instance; |
|
| 921 | + } |
|
| 922 | + |
|
| 923 | + /** |
|
| 924 | + * Back-end twitter widget settings form. |
|
| 925 | + * |
|
| 926 | + * @since 1.0.0 |
|
| 927 | + * @since 1.5.1 Declare function public. |
|
| 928 | + * |
|
| 929 | + * @param array $instance Previously saved values from database. |
|
| 930 | + * @return string|void |
|
| 931 | + */ |
|
| 932 | + public function form($instance) |
|
| 933 | + {
|
|
| 934 | + //widgetform in backend |
|
| 935 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
|
|
| 936 | + |
|
| 937 | + $desc1 = ($instance['gd_tw_desc1']); |
|
| 938 | + ?> |
|
| 939 | 939 | <p><label |
| 940 | 940 | for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?>
|
| 941 | 941 | <textarea class="widefat" rows="6" cols="20" |
@@ -944,179 +944,179 @@ discard block |
||
| 944 | 944 | </p> |
| 945 | 945 | |
| 946 | 946 | <?php |
| 947 | - } |
|
| 948 | - } |
|
| 949 | - |
|
| 950 | - register_widget('geodir_twitter');
|
|
| 951 | - |
|
| 952 | - /** |
|
| 953 | - * GeoDirectory Advanced Search widget. |
|
| 954 | - * |
|
| 955 | - * @since 1.0.0 |
|
| 956 | - */ |
|
| 957 | - class geodir_advance_search_widget extends WP_Widget |
|
| 958 | - {
|
|
| 959 | - /** |
|
| 960 | - * Register the advanced search widget with WordPress. |
|
| 961 | - * |
|
| 962 | - * @since 1.0.0 |
|
| 963 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 964 | - */ |
|
| 965 | - public function __construct() {
|
|
| 966 | - $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>'');
|
|
| 967 | - parent::__construct( |
|
| 968 | - 'geodir_advance_search', // Base ID |
|
| 969 | - __('GD > Search', 'geodirectory'), // Name
|
|
| 970 | - $widget_ops// Args |
|
| 971 | - ); |
|
| 972 | - } |
|
| 973 | - |
|
| 974 | - |
|
| 975 | - /** |
|
| 976 | - * Front-end display content for advanced search widget. |
|
| 977 | - * |
|
| 978 | - * @since 1.0.0 |
|
| 979 | - * @since 1.5.1 Declare function public. |
|
| 980 | - * |
|
| 981 | - * @param array $args Widget arguments. |
|
| 982 | - * @param array $instance Saved values from database. |
|
| 983 | - */ |
|
| 984 | - public function widget($args, $instance) |
|
| 985 | - {
|
|
| 986 | - /** |
|
| 987 | - * Filter the search widget arguments. |
|
| 988 | - * |
|
| 989 | - * @since 1.5.7 |
|
| 990 | - * @param array $args The widget arguments. |
|
| 991 | - * @param array $instance The widget instance. |
|
| 992 | - */ |
|
| 993 | - $args = apply_filters('widget_geodir_advance_search_args',$args,$instance);
|
|
| 994 | - |
|
| 995 | - // prints the widget |
|
| 996 | - extract($args, EXTR_SKIP); |
|
| 997 | - |
|
| 998 | - if(isset($post_type) && $post_type){
|
|
| 999 | - geodir_get_search_post_type($post_type);// set the post type |
|
| 1000 | - }else{
|
|
| 1001 | - geodir_get_search_post_type();// set the post type |
|
| 1002 | - } |
|
| 1003 | - |
|
| 1004 | - echo $before_widget; |
|
| 1005 | - |
|
| 1006 | - /** This filter is documented in geodirectory_widgets.php */ |
|
| 1007 | - $title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
|
|
| 1008 | - |
|
| 1009 | - geodir_get_template_part('listing', 'filter-form');
|
|
| 1010 | - |
|
| 1011 | - echo $after_widget; |
|
| 1012 | - |
|
| 1013 | - // after outputing the search reset the CPT |
|
| 1014 | - global $geodir_search_post_type; |
|
| 1015 | - $geodir_search_post_type = ''; |
|
| 1016 | - } |
|
| 1017 | - |
|
| 1018 | - /** |
|
| 1019 | - * Sanitize advanced search widget form values as they are saved. |
|
| 1020 | - * |
|
| 1021 | - * @since 1.0.0 |
|
| 1022 | - * @since 1.5.1 Declare function public. |
|
| 1023 | - * |
|
| 1024 | - * @param array $new_instance Values just sent to be saved. |
|
| 1025 | - * @param array $old_instance Previously saved values from database. |
|
| 1026 | - * |
|
| 1027 | - * @return array Updated safe values to be saved. |
|
| 1028 | - */ |
|
| 1029 | - public function update($new_instance, $old_instance) |
|
| 1030 | - {
|
|
| 1031 | - //save the widget |
|
| 1032 | - //Nothing to save |
|
| 1033 | - return isset($instance) ? $instance : array(); |
|
| 1034 | - } |
|
| 1035 | - |
|
| 1036 | - /** |
|
| 1037 | - * Back-end advanced search widget settings form. |
|
| 1038 | - * |
|
| 1039 | - * @since 1.0.0 |
|
| 1040 | - * @since 1.5.1 Declare function public. |
|
| 1041 | - * |
|
| 1042 | - * @param array $instance Previously saved values from database. |
|
| 1043 | - * @return string|void |
|
| 1044 | - */ |
|
| 1045 | - public function form($instance) |
|
| 1046 | - {
|
|
| 1047 | - //widgetform in backend |
|
| 1048 | - echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory');
|
|
| 1049 | - } |
|
| 1050 | - } |
|
| 1051 | - |
|
| 1052 | - register_widget('geodir_advance_search_widget');
|
|
| 1053 | - |
|
| 1054 | - |
|
| 1055 | - /** |
|
| 1056 | - * Contains all functions for popular widget. |
|
| 1057 | - * |
|
| 1058 | - * @since 1.0.0 |
|
| 1059 | - * @package GeoDirectory |
|
| 1060 | - */ |
|
| 1061 | - include_once('geodirectory-widgets/geodirectory_popular_widget.php');
|
|
| 1062 | - /** |
|
| 1063 | - * Contains all functions for listing slider widget. |
|
| 1064 | - * |
|
| 1065 | - * @since 1.0.0 |
|
| 1066 | - * @package GeoDirectory |
|
| 1067 | - */ |
|
| 1068 | - include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php');
|
|
| 1069 | - /** |
|
| 1070 | - * Contains all functions for home map widget. |
|
| 1071 | - * |
|
| 1072 | - * @since 1.0.0 |
|
| 1073 | - * @package GeoDirectory |
|
| 1074 | - */ |
|
| 1075 | - include_once('geodirectory-widgets/home_map_widget.php');
|
|
| 1076 | - /** |
|
| 1077 | - * Contains all functions for listing map widget. |
|
| 1078 | - * |
|
| 1079 | - * @since 1.0.0 |
|
| 1080 | - * @package GeoDirectory |
|
| 1081 | - */ |
|
| 1082 | - include_once('geodirectory-widgets/listing_map_widget.php');
|
|
| 1083 | - /** |
|
| 1084 | - * Contains all functions for reviews widget. |
|
| 1085 | - * |
|
| 1086 | - * @since 1.0.0 |
|
| 1087 | - * @package GeoDirectory |
|
| 1088 | - */ |
|
| 1089 | - include_once('geodirectory-widgets/geodirectory_reviews_widget.php');
|
|
| 1090 | - /** |
|
| 1091 | - * Contains all functions for related listing widget. |
|
| 1092 | - * |
|
| 1093 | - * @since 1.0.0 |
|
| 1094 | - * @package GeoDirectory |
|
| 1095 | - */ |
|
| 1096 | - include_once('geodirectory-widgets/geodirectory_related_listing_widget.php');
|
|
| 1097 | - /** |
|
| 1098 | - * Contains all functions for bestof widget. |
|
| 1099 | - * |
|
| 1100 | - * @since 1.0.0 |
|
| 1101 | - * @package GeoDirectory |
|
| 1102 | - */ |
|
| 1103 | - include_once('geodirectory-widgets/geodirectory_bestof_widget.php');
|
|
| 947 | + } |
|
| 948 | + } |
|
| 949 | + |
|
| 950 | + register_widget('geodir_twitter');
|
|
| 951 | + |
|
| 952 | + /** |
|
| 953 | + * GeoDirectory Advanced Search widget. |
|
| 954 | + * |
|
| 955 | + * @since 1.0.0 |
|
| 956 | + */ |
|
| 957 | + class geodir_advance_search_widget extends WP_Widget |
|
| 958 | + {
|
|
| 959 | + /** |
|
| 960 | + * Register the advanced search widget with WordPress. |
|
| 961 | + * |
|
| 962 | + * @since 1.0.0 |
|
| 963 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 964 | + */ |
|
| 965 | + public function __construct() {
|
|
| 966 | + $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>'');
|
|
| 967 | + parent::__construct( |
|
| 968 | + 'geodir_advance_search', // Base ID |
|
| 969 | + __('GD > Search', 'geodirectory'), // Name
|
|
| 970 | + $widget_ops// Args |
|
| 971 | + ); |
|
| 972 | + } |
|
| 973 | + |
|
| 974 | + |
|
| 975 | + /** |
|
| 976 | + * Front-end display content for advanced search widget. |
|
| 977 | + * |
|
| 978 | + * @since 1.0.0 |
|
| 979 | + * @since 1.5.1 Declare function public. |
|
| 980 | + * |
|
| 981 | + * @param array $args Widget arguments. |
|
| 982 | + * @param array $instance Saved values from database. |
|
| 983 | + */ |
|
| 984 | + public function widget($args, $instance) |
|
| 985 | + {
|
|
| 986 | + /** |
|
| 987 | + * Filter the search widget arguments. |
|
| 988 | + * |
|
| 989 | + * @since 1.5.7 |
|
| 990 | + * @param array $args The widget arguments. |
|
| 991 | + * @param array $instance The widget instance. |
|
| 992 | + */ |
|
| 993 | + $args = apply_filters('widget_geodir_advance_search_args',$args,$instance);
|
|
| 994 | + |
|
| 995 | + // prints the widget |
|
| 996 | + extract($args, EXTR_SKIP); |
|
| 997 | + |
|
| 998 | + if(isset($post_type) && $post_type){
|
|
| 999 | + geodir_get_search_post_type($post_type);// set the post type |
|
| 1000 | + }else{
|
|
| 1001 | + geodir_get_search_post_type();// set the post type |
|
| 1002 | + } |
|
| 1003 | + |
|
| 1004 | + echo $before_widget; |
|
| 1005 | + |
|
| 1006 | + /** This filter is documented in geodirectory_widgets.php */ |
|
| 1007 | + $title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
|
|
| 1008 | + |
|
| 1009 | + geodir_get_template_part('listing', 'filter-form');
|
|
| 1010 | + |
|
| 1011 | + echo $after_widget; |
|
| 1012 | + |
|
| 1013 | + // after outputing the search reset the CPT |
|
| 1014 | + global $geodir_search_post_type; |
|
| 1015 | + $geodir_search_post_type = ''; |
|
| 1016 | + } |
|
| 1017 | + |
|
| 1018 | + /** |
|
| 1019 | + * Sanitize advanced search widget form values as they are saved. |
|
| 1020 | + * |
|
| 1021 | + * @since 1.0.0 |
|
| 1022 | + * @since 1.5.1 Declare function public. |
|
| 1023 | + * |
|
| 1024 | + * @param array $new_instance Values just sent to be saved. |
|
| 1025 | + * @param array $old_instance Previously saved values from database. |
|
| 1026 | + * |
|
| 1027 | + * @return array Updated safe values to be saved. |
|
| 1028 | + */ |
|
| 1029 | + public function update($new_instance, $old_instance) |
|
| 1030 | + {
|
|
| 1031 | + //save the widget |
|
| 1032 | + //Nothing to save |
|
| 1033 | + return isset($instance) ? $instance : array(); |
|
| 1034 | + } |
|
| 1035 | + |
|
| 1036 | + /** |
|
| 1037 | + * Back-end advanced search widget settings form. |
|
| 1038 | + * |
|
| 1039 | + * @since 1.0.0 |
|
| 1040 | + * @since 1.5.1 Declare function public. |
|
| 1041 | + * |
|
| 1042 | + * @param array $instance Previously saved values from database. |
|
| 1043 | + * @return string|void |
|
| 1044 | + */ |
|
| 1045 | + public function form($instance) |
|
| 1046 | + {
|
|
| 1047 | + //widgetform in backend |
|
| 1048 | + echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory');
|
|
| 1049 | + } |
|
| 1050 | + } |
|
| 1051 | + |
|
| 1052 | + register_widget('geodir_advance_search_widget');
|
|
| 1053 | + |
|
| 1054 | + |
|
| 1055 | + /** |
|
| 1056 | + * Contains all functions for popular widget. |
|
| 1057 | + * |
|
| 1058 | + * @since 1.0.0 |
|
| 1059 | + * @package GeoDirectory |
|
| 1060 | + */ |
|
| 1061 | + include_once('geodirectory-widgets/geodirectory_popular_widget.php');
|
|
| 1062 | + /** |
|
| 1063 | + * Contains all functions for listing slider widget. |
|
| 1064 | + * |
|
| 1065 | + * @since 1.0.0 |
|
| 1066 | + * @package GeoDirectory |
|
| 1067 | + */ |
|
| 1068 | + include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php');
|
|
| 1069 | + /** |
|
| 1070 | + * Contains all functions for home map widget. |
|
| 1071 | + * |
|
| 1072 | + * @since 1.0.0 |
|
| 1073 | + * @package GeoDirectory |
|
| 1074 | + */ |
|
| 1075 | + include_once('geodirectory-widgets/home_map_widget.php');
|
|
| 1076 | + /** |
|
| 1077 | + * Contains all functions for listing map widget. |
|
| 1078 | + * |
|
| 1079 | + * @since 1.0.0 |
|
| 1080 | + * @package GeoDirectory |
|
| 1081 | + */ |
|
| 1082 | + include_once('geodirectory-widgets/listing_map_widget.php');
|
|
| 1083 | + /** |
|
| 1084 | + * Contains all functions for reviews widget. |
|
| 1085 | + * |
|
| 1086 | + * @since 1.0.0 |
|
| 1087 | + * @package GeoDirectory |
|
| 1088 | + */ |
|
| 1089 | + include_once('geodirectory-widgets/geodirectory_reviews_widget.php');
|
|
| 1090 | + /** |
|
| 1091 | + * Contains all functions for related listing widget. |
|
| 1092 | + * |
|
| 1093 | + * @since 1.0.0 |
|
| 1094 | + * @package GeoDirectory |
|
| 1095 | + */ |
|
| 1096 | + include_once('geodirectory-widgets/geodirectory_related_listing_widget.php');
|
|
| 1097 | + /** |
|
| 1098 | + * Contains all functions for bestof widget. |
|
| 1099 | + * |
|
| 1100 | + * @since 1.0.0 |
|
| 1101 | + * @package GeoDirectory |
|
| 1102 | + */ |
|
| 1103 | + include_once('geodirectory-widgets/geodirectory_bestof_widget.php');
|
|
| 1104 | + /** |
|
| 1105 | + * Contains all functions for cpt categories widget. |
|
| 1106 | + * |
|
| 1107 | + * @since 1.5.4 |
|
| 1108 | + * @package GeoDirectory |
|
| 1109 | + */ |
|
| 1110 | + include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php');
|
|
| 1104 | 1111 | /** |
| 1105 | - * Contains all functions for cpt categories widget. |
|
| 1106 | - * |
|
| 1107 | - * @since 1.5.4 |
|
| 1108 | - * @package GeoDirectory |
|
| 1109 | - */ |
|
| 1110 | - include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php');
|
|
| 1111 | - /** |
|
| 1112 | - * Contains all functions for features widget. |
|
| 1113 | - * |
|
| 1114 | - * @since 1.5.6 |
|
| 1115 | - * @package GeoDirectory |
|
| 1116 | - * @todo make the image field recurring |
|
| 1117 | - */ |
|
| 1118 | - include_once('geodirectory-widgets/geodirectory_features_widget.php');
|
|
| 1119 | - } |
|
| 1112 | + * Contains all functions for features widget. |
|
| 1113 | + * |
|
| 1114 | + * @since 1.5.6 |
|
| 1115 | + * @package GeoDirectory |
|
| 1116 | + * @todo make the image field recurring |
|
| 1117 | + */ |
|
| 1118 | + include_once('geodirectory-widgets/geodirectory_features_widget.php');
|
|
| 1119 | + } |
|
| 1120 | 1120 | |
| 1121 | 1121 | } |
| 1122 | 1122 | |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | public function form($instance) |
| 302 | 302 | {
|
| 303 | 303 | //widgetform in backend |
| 304 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
|
|
| 304 | + $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
|
|
| 305 | 305 | $title = strip_tags($instance['title']); |
| 306 | 306 | |
| 307 | 307 | ?> |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | ?> |
| 374 | 374 | |
| 375 | 375 | <a href="http://twitter.com/share" |
| 376 | - class="twitter-share-button"><?php _e('Tweet', 'geodirectory');?></a>
|
|
| 376 | + class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
|
|
| 377 | 377 | |
| 378 | 378 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
| 379 | 379 | |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | public function form($instance) |
| 444 | 444 | {
|
| 445 | 445 | //widgetform in backend |
| 446 | - $instance = wp_parse_args((array)$instance, array('title' => ''));
|
|
| 446 | + $instance = wp_parse_args((array) $instance, array('title' => ''));
|
|
| 447 | 447 | $title = strip_tags($instance['title']); |
| 448 | 448 | ?> |
| 449 | 449 | <p>No settings for this widget</p> |
@@ -515,11 +515,11 @@ discard block |
||
| 515 | 515 | echo $before_widget; |
| 516 | 516 | ?> |
| 517 | 517 | |
| 518 | - <?php echo $before_title . $title; ?> <a href="<?php if ($id) {
|
|
| 519 | - echo 'http://feeds2.feedburner.com/' . $id; |
|
| 518 | + <?php echo $before_title.$title; ?> <a href="<?php if ($id) {
|
|
| 519 | + echo 'http://feeds2.feedburner.com/'.$id; |
|
| 520 | 520 | } else {
|
| 521 | 521 | bloginfo('rss_url');
|
| 522 | - } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?> |
|
| 522 | + } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title; ?> |
|
| 523 | 523 | |
| 524 | 524 | <?php if ($text <> "") { ?>
|
| 525 | 525 | |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | public function form($instance) |
| 585 | 585 | {
|
| 586 | 586 | //widgetform in backend |
| 587 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
|
|
| 587 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
|
|
| 588 | 588 | |
| 589 | 589 | $id = strip_tags($instance['id']); |
| 590 | 590 | |
@@ -596,19 +596,19 @@ discard block |
||
| 596 | 596 | |
| 597 | 597 | ?> |
| 598 | 598 | <p><label |
| 599 | - for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory');?>:
|
|
| 599 | + for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory'); ?>:
|
|
| 600 | 600 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
|
| 601 | 601 | name="<?php echo $this->get_field_name('title'); ?>" type="text"
|
| 602 | 602 | value="<?php echo esc_attr($title); ?>"/></label></p> |
| 603 | 603 | |
| 604 | 604 | <p><label |
| 605 | - for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID (ex :- geotheme)', 'geodirectory');?>
|
|
| 605 | + for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID (ex :- geotheme)', 'geodirectory'); ?>
|
|
| 606 | 606 | : <input class="widefat" id="<?php echo $this->get_field_id('id'); ?>"
|
| 607 | 607 | name="<?php echo $this->get_field_name('id'); ?>" type="text"
|
| 608 | 608 | value="<?php echo esc_attr($id); ?>"/></label></p> |
| 609 | 609 | |
| 610 | 610 | <p><label |
| 611 | - for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Short Description', 'geodirectory');?>
|
|
| 611 | + for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Short Description', 'geodirectory'); ?>
|
|
| 612 | 612 | <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('text'); ?>"
|
| 613 | 613 | name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_attr($text); ?></textarea></label>
|
| 614 | 614 | </p> |
@@ -704,12 +704,12 @@ discard block |
||
| 704 | 704 | public function form($instance) |
| 705 | 705 | {
|
| 706 | 706 | //widgetform in backend |
| 707 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
|
|
| 707 | + $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
|
|
| 708 | 708 | |
| 709 | 709 | $desc1 = ($instance['desc1']); |
| 710 | 710 | ?> |
| 711 | 711 | <p><label |
| 712 | - for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?>
|
|
| 712 | + for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory'); ?>
|
|
| 713 | 713 | <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>"
|
| 714 | 714 | name="<?php echo $this->get_field_name('desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label>
|
| 715 | 715 | </p> |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | * @param string $number The image count. |
| 773 | 773 | */ |
| 774 | 774 | $number = empty($instance['number']) ? ' ' : apply_filters('widget_number', $instance['number']);
|
| 775 | - echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title;
|
|
| 775 | + echo $before_title.__('Photo Gallery', 'geodirectory').$after_title;
|
|
| 776 | 776 | ?> |
| 777 | 777 | |
| 778 | 778 | <div class="geodir-flickr clearfix"> |
@@ -819,14 +819,14 @@ discard block |
||
| 819 | 819 | {
|
| 820 | 820 | |
| 821 | 821 | //widgetform in backend |
| 822 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => ''));
|
|
| 822 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'number' => ''));
|
|
| 823 | 823 | $id = strip_tags($instance['id']); |
| 824 | 824 | $number = strip_tags($instance['number']); |
| 825 | 825 | ?> |
| 826 | 826 | |
| 827 | 827 | <p> |
| 828 | 828 | <label |
| 829 | - for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID', 'geodirectory');?>
|
|
| 829 | + for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID', 'geodirectory'); ?>
|
|
| 830 | 830 | (<a href="http://www.idgettr.com">idGettr</a>): |
| 831 | 831 | <input class="widefat" id="<?php echo $this->get_field_id('id'); ?>"
|
| 832 | 832 | name="<?php echo $this->get_field_name('id'); ?>" type="text"
|
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | |
| 837 | 837 | <p> |
| 838 | 838 | <label |
| 839 | - for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of photos:', 'geodirectory');?>
|
|
| 839 | + for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of photos:', 'geodirectory'); ?>
|
|
| 840 | 840 | <input class="widefat" id="<?php echo $this->get_field_id('number'); ?>"
|
| 841 | 841 | name="<?php echo $this->get_field_name('number'); ?>" type="text"
|
| 842 | 842 | value="<?php echo esc_attr($number); ?>"/> |
@@ -932,12 +932,12 @@ discard block |
||
| 932 | 932 | public function form($instance) |
| 933 | 933 | {
|
| 934 | 934 | //widgetform in backend |
| 935 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
|
|
| 935 | + $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
|
|
| 936 | 936 | |
| 937 | 937 | $desc1 = ($instance['gd_tw_desc1']); |
| 938 | 938 | ?> |
| 939 | 939 | <p><label |
| 940 | - for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?>
|
|
| 940 | + for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory'); ?>
|
|
| 941 | 941 | <textarea class="widefat" rows="6" cols="20" |
| 942 | 942 | id="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"
|
| 943 | 943 | name="<?php echo $this->get_field_name('gd_tw_desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label>
|
@@ -963,7 +963,7 @@ discard block |
||
| 963 | 963 | * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
| 964 | 964 | */ |
| 965 | 965 | public function __construct() {
|
| 966 | - $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'),'post_type'=>'');
|
|
| 966 | + $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'), 'post_type'=>'');
|
|
| 967 | 967 | parent::__construct( |
| 968 | 968 | 'geodir_advance_search', // Base ID |
| 969 | 969 | __('GD > Search', 'geodirectory'), // Name
|
@@ -990,15 +990,15 @@ discard block |
||
| 990 | 990 | * @param array $args The widget arguments. |
| 991 | 991 | * @param array $instance The widget instance. |
| 992 | 992 | */ |
| 993 | - $args = apply_filters('widget_geodir_advance_search_args',$args,$instance);
|
|
| 993 | + $args = apply_filters('widget_geodir_advance_search_args', $args, $instance);
|
|
| 994 | 994 | |
| 995 | 995 | // prints the widget |
| 996 | 996 | extract($args, EXTR_SKIP); |
| 997 | 997 | |
| 998 | - if(isset($post_type) && $post_type){
|
|
| 999 | - geodir_get_search_post_type($post_type);// set the post type |
|
| 1000 | - }else{
|
|
| 1001 | - geodir_get_search_post_type();// set the post type |
|
| 998 | + if (isset($post_type) && $post_type) {
|
|
| 999 | + geodir_get_search_post_type($post_type); // set the post type |
|
| 1000 | + } else {
|
|
| 1001 | + geodir_get_search_post_type(); // set the post type |
|
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | echo $before_widget; |
@@ -997,7 +997,7 @@ |
||
| 997 | 997 | |
| 998 | 998 | if(isset($post_type) && $post_type){
|
| 999 | 999 | geodir_get_search_post_type($post_type);// set the post type |
| 1000 | - }else{
|
|
| 1000 | + } else{
|
|
| 1001 | 1001 | geodir_get_search_post_type();// set the post type |
| 1002 | 1002 | } |
| 1003 | 1003 | |
@@ -17,26 +17,26 @@ discard block |
||
| 17 | 17 | function gd_compat_php_genesis() |
| 18 | 18 | { |
| 19 | 19 | // REPLACE GENESIS BREADCRUMBS WITH GD BREADCRUMBS |
| 20 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
| 21 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
| 22 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
| 23 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
| 24 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
| 25 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
| 20 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
| 21 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
| 22 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
| 23 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
| 24 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
| 25 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | - // make top section wide |
|
| 29 | - remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
| 30 | - remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
| 31 | - remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
| 32 | - remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
| 33 | - remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
| 34 | - remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
| 28 | + // make top section wide |
|
| 29 | + remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
| 30 | + remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
| 31 | + remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
| 32 | + remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
| 33 | + remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
| 34 | + remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
| 35 | 35 | |
| 36 | - // REMOVE PAGE TITLES |
|
| 37 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
| 38 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
| 39 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
| 36 | + // REMOVE PAGE TITLES |
|
| 37 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
| 38 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
| 39 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | } |
@@ -53,25 +53,25 @@ discard block |
||
| 53 | 53 | function gd_genesis_compat_left_sidebars() |
| 54 | 54 | { |
| 55 | 55 | |
| 56 | - if (is_page_geodir_home()) { |
|
| 57 | - remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
| 58 | - add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
| 59 | - } elseif (geodir_is_page('location')) { |
|
| 60 | - remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
| 61 | - add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
| 62 | - } elseif (geodir_is_page('listing')) { |
|
| 63 | - remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10); |
|
| 64 | - add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11); |
|
| 65 | - } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) { |
|
| 66 | - //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 ); |
|
| 67 | - //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 ); |
|
| 68 | - } elseif (geodir_is_page('search')) { |
|
| 69 | - remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10); |
|
| 70 | - add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11); |
|
| 71 | - } elseif (geodir_is_page('author')) { |
|
| 72 | - remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10); |
|
| 73 | - add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11); |
|
| 74 | - } |
|
| 56 | + if (is_page_geodir_home()) { |
|
| 57 | + remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
| 58 | + add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
| 59 | + } elseif (geodir_is_page('location')) { |
|
| 60 | + remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
| 61 | + add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
| 62 | + } elseif (geodir_is_page('listing')) { |
|
| 63 | + remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10); |
|
| 64 | + add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11); |
|
| 65 | + } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) { |
|
| 66 | + //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 ); |
|
| 67 | + //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 ); |
|
| 68 | + } elseif (geodir_is_page('search')) { |
|
| 69 | + remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10); |
|
| 70 | + add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11); |
|
| 71 | + } elseif (geodir_is_page('author')) { |
|
| 72 | + remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10); |
|
| 73 | + add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | } |
@@ -88,65 +88,65 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | function geodir_set_body_scs($classes) |
| 90 | 90 | { |
| 91 | - $remove_class = false; |
|
| 92 | - $new_class = ''; |
|
| 93 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
| 94 | - $remove_class = true; |
|
| 95 | - if (get_option('geodir_show_home_left_section')) { |
|
| 96 | - $new_class .= 'sidebar-'; |
|
| 97 | - } |
|
| 98 | - if (get_option('geodir_show_home_contant_section')) { |
|
| 99 | - $new_class .= 'content'; |
|
| 100 | - } |
|
| 101 | - if (get_option('geodir_show_home_right_section')) { |
|
| 102 | - $new_class .= '-sidebar'; |
|
| 103 | - } |
|
| 104 | - } elseif (geodir_is_page('listing')) { |
|
| 105 | - $remove_class = true; |
|
| 106 | - if (get_option('geodir_show_listing_left_section')) { |
|
| 107 | - $new_class .= 'sidebar-'; |
|
| 108 | - } |
|
| 109 | - $new_class .= 'content'; |
|
| 110 | - if (get_option('geodir_show_listing_right_section')) { |
|
| 111 | - $new_class .= '-sidebar'; |
|
| 112 | - } |
|
| 113 | - } elseif (geodir_is_page('detail')) { |
|
| 114 | - $remove_class = true; |
|
| 115 | - if (get_option('geodir_detail_sidebar_left_section')) { |
|
| 116 | - $new_class .= 'sidebar-content gd-details-sidebar-left'; |
|
| 117 | - } else { |
|
| 118 | - $new_class .= 'content-sidebar'; |
|
| 119 | - } |
|
| 120 | - } elseif (geodir_is_page('search')) { |
|
| 121 | - $remove_class = true; |
|
| 122 | - if (get_option('geodir_show_search_left_section')) { |
|
| 123 | - $new_class .= 'sidebar-'; |
|
| 124 | - } |
|
| 125 | - $new_class .= 'content'; |
|
| 126 | - if (get_option('geodir_show_search_right_section')) { |
|
| 127 | - $new_class .= '-sidebar'; |
|
| 128 | - } |
|
| 129 | - } elseif (geodir_is_page('author')) { |
|
| 130 | - $remove_class = true; |
|
| 131 | - if (get_option('geodir_show_author_left_section')) { |
|
| 132 | - $new_class .= 'sidebar-'; |
|
| 133 | - } |
|
| 134 | - $new_class .= 'content'; |
|
| 135 | - if (get_option('geodir_show_author_right_section')) { |
|
| 136 | - $new_class .= '-sidebar'; |
|
| 137 | - } |
|
| 138 | - } elseif (geodir_is_page('add-listing')) { |
|
| 139 | - $remove_class = true; |
|
| 140 | - $new_class .= 'content-sidebar'; |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - if ($remove_class) { |
|
| 144 | - $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
|
| 145 | - //str_replace(array('content-sidebar','sidebar-content','content-sidebar-sidebar','sidebar-sidebar-content','sidebar-content-sidebar','full-width-content'),array('','','','','',''),$classes); |
|
| 146 | - $classes[] = $new_class; |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - return $classes; |
|
| 91 | + $remove_class = false; |
|
| 92 | + $new_class = ''; |
|
| 93 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
| 94 | + $remove_class = true; |
|
| 95 | + if (get_option('geodir_show_home_left_section')) { |
|
| 96 | + $new_class .= 'sidebar-'; |
|
| 97 | + } |
|
| 98 | + if (get_option('geodir_show_home_contant_section')) { |
|
| 99 | + $new_class .= 'content'; |
|
| 100 | + } |
|
| 101 | + if (get_option('geodir_show_home_right_section')) { |
|
| 102 | + $new_class .= '-sidebar'; |
|
| 103 | + } |
|
| 104 | + } elseif (geodir_is_page('listing')) { |
|
| 105 | + $remove_class = true; |
|
| 106 | + if (get_option('geodir_show_listing_left_section')) { |
|
| 107 | + $new_class .= 'sidebar-'; |
|
| 108 | + } |
|
| 109 | + $new_class .= 'content'; |
|
| 110 | + if (get_option('geodir_show_listing_right_section')) { |
|
| 111 | + $new_class .= '-sidebar'; |
|
| 112 | + } |
|
| 113 | + } elseif (geodir_is_page('detail')) { |
|
| 114 | + $remove_class = true; |
|
| 115 | + if (get_option('geodir_detail_sidebar_left_section')) { |
|
| 116 | + $new_class .= 'sidebar-content gd-details-sidebar-left'; |
|
| 117 | + } else { |
|
| 118 | + $new_class .= 'content-sidebar'; |
|
| 119 | + } |
|
| 120 | + } elseif (geodir_is_page('search')) { |
|
| 121 | + $remove_class = true; |
|
| 122 | + if (get_option('geodir_show_search_left_section')) { |
|
| 123 | + $new_class .= 'sidebar-'; |
|
| 124 | + } |
|
| 125 | + $new_class .= 'content'; |
|
| 126 | + if (get_option('geodir_show_search_right_section')) { |
|
| 127 | + $new_class .= '-sidebar'; |
|
| 128 | + } |
|
| 129 | + } elseif (geodir_is_page('author')) { |
|
| 130 | + $remove_class = true; |
|
| 131 | + if (get_option('geodir_show_author_left_section')) { |
|
| 132 | + $new_class .= 'sidebar-'; |
|
| 133 | + } |
|
| 134 | + $new_class .= 'content'; |
|
| 135 | + if (get_option('geodir_show_author_right_section')) { |
|
| 136 | + $new_class .= '-sidebar'; |
|
| 137 | + } |
|
| 138 | + } elseif (geodir_is_page('add-listing')) { |
|
| 139 | + $remove_class = true; |
|
| 140 | + $new_class .= 'content-sidebar'; |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + if ($remove_class) { |
|
| 144 | + $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
|
| 145 | + //str_replace(array('content-sidebar','sidebar-content','content-sidebar-sidebar','sidebar-sidebar-content','sidebar-content-sidebar','full-width-content'),array('','','','','',''),$classes); |
|
| 146 | + $classes[] = $new_class; |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + return $classes; |
|
| 150 | 150 | |
| 151 | 151 | } |
| 152 | 152 | |
@@ -160,17 +160,17 @@ discard block |
||
| 160 | 160 | function gd_genesis_compat_add_top_section_back() |
| 161 | 161 | { |
| 162 | 162 | |
| 163 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
| 164 | - geodir_action_geodir_sidebar_home_top(); |
|
| 165 | - } elseif (geodir_is_page('listing')) { |
|
| 166 | - geodir_action_geodir_sidebar_listings_top(); |
|
| 167 | - } elseif (geodir_is_page('detail')) { |
|
| 168 | - geodir_action_geodir_sidebar_detail_top(); |
|
| 169 | - } elseif (geodir_is_page('search')) { |
|
| 170 | - geodir_action_geodir_sidebar_search_top(); |
|
| 171 | - } elseif (geodir_is_page('author')) { |
|
| 172 | - geodir_action_geodir_sidebar_author_top(); |
|
| 173 | - } |
|
| 163 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
| 164 | + geodir_action_geodir_sidebar_home_top(); |
|
| 165 | + } elseif (geodir_is_page('listing')) { |
|
| 166 | + geodir_action_geodir_sidebar_listings_top(); |
|
| 167 | + } elseif (geodir_is_page('detail')) { |
|
| 168 | + geodir_action_geodir_sidebar_detail_top(); |
|
| 169 | + } elseif (geodir_is_page('search')) { |
|
| 170 | + geodir_action_geodir_sidebar_search_top(); |
|
| 171 | + } elseif (geodir_is_page('author')) { |
|
| 172 | + geodir_action_geodir_sidebar_author_top(); |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | 175 | |
| 176 | 176 | } |
@@ -183,12 +183,12 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | function geodir_replace_breadcrumb() |
| 185 | 185 | { |
| 186 | - if (is_front_page() && geodir_is_page('home') && !geodir_is_page('login')) { |
|
| 187 | - } else { |
|
| 188 | - echo '<div class="geodir-breadcrumb-bar"><div class="wrap">'; |
|
| 189 | - geodir_breadcrumb(); |
|
| 190 | - echo '</div></div>'; |
|
| 191 | - } |
|
| 186 | + if (is_front_page() && geodir_is_page('home') && !geodir_is_page('login')) { |
|
| 187 | + } else { |
|
| 188 | + echo '<div class="geodir-breadcrumb-bar"><div class="wrap">'; |
|
| 189 | + geodir_breadcrumb(); |
|
| 190 | + echo '</div></div>'; |
|
| 191 | + } |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | // Force Full Width on signup page |
@@ -201,9 +201,9 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | function geodir_genesis_meta() |
| 203 | 203 | { |
| 204 | - if (geodir_is_page('login')) { |
|
| 205 | - add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); |
|
| 206 | - } |
|
| 204 | + if (geodir_is_page('login')) { |
|
| 205 | + add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); |
|
| 206 | + } |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | add_action('geodir_add_listing_page_title', 'geodir_add_listing_page_title_genesis_before', 8); |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | function geodir_add_listing_page_title_genesis_before() |
| 217 | 217 | { |
| 218 | 218 | |
| 219 | - echo "<div class='entry' >"; |
|
| 219 | + echo "<div class='entry' >"; |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | function geodir_add_listing_form_genesis_after() |
| 231 | 231 | { |
| 232 | 232 | |
| 233 | - echo "</div>"; |
|
| 233 | + echo "</div>"; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | |
@@ -249,38 +249,38 @@ discard block |
||
| 249 | 249 | { |
| 250 | 250 | |
| 251 | 251 | |
| 252 | - $title = ''; |
|
| 253 | - $subtitle = ''; |
|
| 254 | - |
|
| 255 | - if (geodir_is_page('listing')) { |
|
| 256 | - echo '<div class="wrap gd-title-wrap">'; |
|
| 257 | - geodir_action_listings_title(); |
|
| 258 | - echo '</div>'; |
|
| 259 | - } |
|
| 260 | - |
|
| 261 | - if (geodir_is_page('add-listing')) { |
|
| 262 | - echo '<div class="wrap gd-title-wrap">'; |
|
| 263 | - geodir_action_add_listing_page_title(); |
|
| 264 | - echo '</div>'; |
|
| 265 | - } |
|
| 266 | - |
|
| 267 | - if (geodir_is_page('author')) { |
|
| 268 | - echo '<div class="wrap gd-title-wrap">'; |
|
| 269 | - geodir_action_author_page_title(); |
|
| 270 | - echo '</div>'; |
|
| 271 | - } |
|
| 272 | - |
|
| 273 | - if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
| 274 | - echo '<div class="wrap gd-title-wrap">'; |
|
| 275 | - echo get_the_title(); |
|
| 276 | - echo '</div>'; |
|
| 277 | - } |
|
| 278 | - |
|
| 279 | - if (geodir_is_page('search')) { |
|
| 280 | - echo '<div class="wrap gd-title-wrap">'; |
|
| 281 | - geodir_action_search_page_title(); |
|
| 282 | - echo '</div>'; |
|
| 283 | - } |
|
| 252 | + $title = ''; |
|
| 253 | + $subtitle = ''; |
|
| 254 | + |
|
| 255 | + if (geodir_is_page('listing')) { |
|
| 256 | + echo '<div class="wrap gd-title-wrap">'; |
|
| 257 | + geodir_action_listings_title(); |
|
| 258 | + echo '</div>'; |
|
| 259 | + } |
|
| 260 | + |
|
| 261 | + if (geodir_is_page('add-listing')) { |
|
| 262 | + echo '<div class="wrap gd-title-wrap">'; |
|
| 263 | + geodir_action_add_listing_page_title(); |
|
| 264 | + echo '</div>'; |
|
| 265 | + } |
|
| 266 | + |
|
| 267 | + if (geodir_is_page('author')) { |
|
| 268 | + echo '<div class="wrap gd-title-wrap">'; |
|
| 269 | + geodir_action_author_page_title(); |
|
| 270 | + echo '</div>'; |
|
| 271 | + } |
|
| 272 | + |
|
| 273 | + if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
| 274 | + echo '<div class="wrap gd-title-wrap">'; |
|
| 275 | + echo get_the_title(); |
|
| 276 | + echo '</div>'; |
|
| 277 | + } |
|
| 278 | + |
|
| 279 | + if (geodir_is_page('search')) { |
|
| 280 | + echo '<div class="wrap gd-title-wrap">'; |
|
| 281 | + geodir_action_search_page_title(); |
|
| 282 | + echo '</div>'; |
|
| 283 | + } |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | |
@@ -293,8 +293,8 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | function gd_genesis_listing_page_title_bar() |
| 295 | 295 | { |
| 296 | - geodir_action_listings_title(); |
|
| 297 | - //geodir_action_listings_description(); |
|
| 296 | + geodir_action_listings_title(); |
|
| 297 | + //geodir_action_listings_description(); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | |
@@ -307,19 +307,19 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | function gd_compat_php_genesis_geo_1280_fix() |
| 309 | 309 | { |
| 310 | - if (function_exists('geo1280_search_bar')) { |
|
| 311 | - remove_action('genesis_after_header', 'geo1280_search_bar', 20); |
|
| 312 | - add_action('genesis_after_header', 'geo1280_search_bar_fix', 4); |
|
| 310 | + if (function_exists('geo1280_search_bar')) { |
|
| 311 | + remove_action('genesis_after_header', 'geo1280_search_bar', 20); |
|
| 312 | + add_action('genesis_after_header', 'geo1280_search_bar_fix', 4); |
|
| 313 | 313 | |
| 314 | - // |
|
| 314 | + // |
|
| 315 | 315 | |
| 316 | - remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20); |
|
| 317 | - remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20); |
|
| 318 | - add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105); |
|
| 316 | + remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20); |
|
| 317 | + remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20); |
|
| 318 | + add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105); |
|
| 319 | 319 | |
| 320 | - remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10); |
|
| 321 | - add_action('geodir_wrapper_open', 'geo1280_page_title', 101); |
|
| 322 | - } |
|
| 320 | + remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10); |
|
| 321 | + add_action('geodir_wrapper_open', 'geo1280_page_title', 101); |
|
| 322 | + } |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /** |
@@ -331,11 +331,11 @@ discard block |
||
| 331 | 331 | function geo1280_search_bar_fix() |
| 332 | 332 | { |
| 333 | 333 | |
| 334 | - echo '<div class="geo1280-placeholder"></div>'; |
|
| 335 | - if (is_active_sidebar('search-bar')) { |
|
| 336 | - genesis_widget_area('search-bar', array( |
|
| 337 | - 'before' => '<div class="search-bar widget-area"><div class="wrap">', |
|
| 338 | - 'after' => '</div></div>', |
|
| 339 | - )); |
|
| 340 | - } |
|
| 334 | + echo '<div class="geo1280-placeholder"></div>'; |
|
| 335 | + if (is_active_sidebar('search-bar')) { |
|
| 336 | + genesis_widget_area('search-bar', array( |
|
| 337 | + 'before' => '<div class="search-bar widget-area"><div class="wrap">', |
|
| 338 | + 'after' => '</div></div>', |
|
| 339 | + )); |
|
| 340 | + } |
|
| 341 | 341 | } |
@@ -12,27 +12,27 @@ |
||
| 12 | 12 | <div class="clearfix"> |
| 13 | 13 | <div id="geodir_content"> |
| 14 | 14 | <?php |
| 15 | - /** This action is documented in geodirectory-templates/geodir-home.php */ |
|
| 16 | - do_action('geodir_add_page_content', 'before', 'info-page'); |
|
| 17 | - global $information; |
|
| 18 | - echo '<h5 class="geodir_information">'; |
|
| 19 | - echo $information; |
|
| 20 | - echo '</h5>'; |
|
| 21 | - /** This action is documented in geodirectory-templates/geodir-home.php */ |
|
| 22 | - do_action('geodir_add_page_content', 'after', 'info-page'); |
|
| 23 | - ?> |
|
| 15 | + /** This action is documented in geodirectory-templates/geodir-home.php */ |
|
| 16 | + do_action('geodir_add_page_content', 'before', 'info-page'); |
|
| 17 | + global $information; |
|
| 18 | + echo '<h5 class="geodir_information">'; |
|
| 19 | + echo $information; |
|
| 20 | + echo '</h5>'; |
|
| 21 | + /** This action is documented in geodirectory-templates/geodir-home.php */ |
|
| 22 | + do_action('geodir_add_page_content', 'after', 'info-page'); |
|
| 23 | + ?> |
|
| 24 | 24 | </div> |
| 25 | 25 | <!-- geodir_content ends here--> |
| 26 | 26 | <div id="gd-sidebar-wrapper"> |
| 27 | 27 | <div class="geodir-sidebar-main"> |
| 28 | 28 | <div class="geodir-gd-sidebar"> |
| 29 | 29 | <?php |
| 30 | - /** |
|
| 31 | - * Calls the author sidebar. |
|
| 32 | - * |
|
| 33 | - * @since 1.6.11 |
|
| 34 | - */ |
|
| 35 | - dynamic_sidebar('geodir_author_right_sidebar'); ?> |
|
| 30 | + /** |
|
| 31 | + * Calls the author sidebar. |
|
| 32 | + * |
|
| 33 | + * @since 1.6.11 |
|
| 34 | + */ |
|
| 35 | + dynamic_sidebar('geodir_author_right_sidebar'); ?> |
|
| 36 | 36 | </div> |
| 37 | 37 | </div> |
| 38 | 38 | </div> |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | global $sitepress; |
| 246 | 246 | $default_lang = $sitepress->get_default_language(); |
| 247 | 247 | $term_id = icl_object_id($cat_term->term_id, $post_type.'category', true, $default_lang); |
| 248 | - }else{
|
|
| 248 | + } else{
|
|
| 249 | 249 | $term_id = $cat_term->term_id; |
| 250 | 250 | } |
| 251 | 251 | if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
|
@@ -273,8 +273,9 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | return $out; |
| 275 | 275 | } else {
|
| 276 | - if ($cat_parent == 0) |
|
| 277 | - return _e('No category', 'geodirectory');
|
|
| 276 | + if ($cat_parent == 0) { |
|
| 277 | + return _e('No category', 'geodirectory'); |
|
| 278 | + } |
|
| 278 | 279 | } |
| 279 | 280 | return; |
| 280 | 281 | } |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | function geodir_init_map_jason() |
| 17 | 17 | {
|
| 18 | - global $map_jason; |
|
| 19 | - $map_jason = array(); |
|
| 18 | + global $map_jason; |
|
| 19 | + $map_jason = array(); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | function geodir_init_map_canvas_array() |
| 30 | 30 | {
|
| 31 | - global $map_canvas_arr; |
|
| 32 | - $map_canvas_arr = array(); |
|
| 31 | + global $map_canvas_arr; |
|
| 32 | + $map_canvas_arr = array(); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | |
@@ -50,56 +50,56 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | function create_marker_jason_of_posts($post) |
| 52 | 52 | {
|
| 53 | - global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes; |
|
| 53 | + global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes; |
|
| 54 | 54 | |
| 55 | - if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
|
|
| 55 | + if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
|
|
| 56 | 56 | |
| 57 | - if(isset($map_jason[$post->ID])){return null;}
|
|
| 57 | + if(isset($map_jason[$post->ID])){return null;}
|
|
| 58 | 58 | |
| 59 | - $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 60 | - $replarr = array("′", "⁄", "–", "“", '');
|
|
| 59 | + $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 60 | + $replarr = array("′", "⁄", "–", "“", '');
|
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | - $geodir_cat_icons = geodir_get_term_icon(); |
|
| 64 | - $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$post->default_category]) ? $geodir_cat_icons[$post->default_category] : ''; |
|
| 63 | + $geodir_cat_icons = geodir_get_term_icon(); |
|
| 64 | + $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$post->default_category]) ? $geodir_cat_icons[$post->default_category] : ''; |
|
| 65 | 65 | |
| 66 | - $post_title = $post->post_title; |
|
| 67 | - $title = str_replace($srcharr, $replarr, $post_title); |
|
| 66 | + $post_title = $post->post_title; |
|
| 67 | + $title = str_replace($srcharr, $replarr, $post_title); |
|
| 68 | 68 | |
| 69 | - if (is_ssl()) {
|
|
| 70 | - $icon = str_replace("http:","https:",$icon );
|
|
| 71 | - } |
|
| 69 | + if (is_ssl()) {
|
|
| 70 | + $icon = str_replace("http:","https:",$icon );
|
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if ($icon != '') {
|
|
| 74 | - $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
| 73 | + if ($icon != '') {
|
|
| 74 | + $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
| 75 | 75 | |
| 76 | - if (isset($gd_marker_sizes[$icon])) {
|
|
| 77 | - $icon_size = $gd_marker_sizes[$icon]; |
|
| 78 | - } else {
|
|
| 79 | - $icon_size = geodir_get_marker_size($icon); |
|
| 80 | - $gd_marker_sizes[$icon] = $icon_size; |
|
| 81 | - } |
|
| 82 | - } else {
|
|
| 83 | - $icon_size = array('w' => 36, 'h' => 45);
|
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}';
|
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * Filter the json data when creating output for post json marker.. |
|
| 90 | - * |
|
| 91 | - * @since 1.5.7 |
|
| 92 | - * @param string $post_json JSON representation of the post marker info. |
|
| 93 | - * @param object $post The post object. |
|
| 94 | - */ |
|
| 95 | - $post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
|
|
| 96 | - |
|
| 97 | - // only assign it if it has a value |
|
| 98 | - if($post_map_json){
|
|
| 99 | - $map_jason[$post->ID] = $post_map_json; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - } |
|
| 76 | + if (isset($gd_marker_sizes[$icon])) {
|
|
| 77 | + $icon_size = $gd_marker_sizes[$icon]; |
|
| 78 | + } else {
|
|
| 79 | + $icon_size = geodir_get_marker_size($icon); |
|
| 80 | + $gd_marker_sizes[$icon] = $icon_size; |
|
| 81 | + } |
|
| 82 | + } else {
|
|
| 83 | + $icon_size = array('w' => 36, 'h' => 45);
|
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}';
|
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * Filter the json data when creating output for post json marker.. |
|
| 90 | + * |
|
| 91 | + * @since 1.5.7 |
|
| 92 | + * @param string $post_json JSON representation of the post marker info. |
|
| 93 | + * @param object $post The post object. |
|
| 94 | + */ |
|
| 95 | + $post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
|
|
| 96 | + |
|
| 97 | + // only assign it if it has a value |
|
| 98 | + if($post_map_json){
|
|
| 99 | + $map_jason[$post->ID] = $post_map_json; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + } |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -112,67 +112,67 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | function send_marker_jason_to_js() |
| 114 | 114 | {
|
| 115 | - global $map_jason, $map_canvas_arr; |
|
| 116 | - |
|
| 117 | - if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
|
|
| 118 | - foreach ($map_canvas_arr as $canvas => $jason) {
|
|
| 119 | - if (is_array($map_jason) && !empty($map_jason)) {
|
|
| 120 | - |
|
| 121 | - // on details page only show the main marker on the map |
|
| 122 | - if(geodir_is_page('detail')){
|
|
| 123 | - global $post; |
|
| 124 | - if(isset($map_jason[$post->ID])){
|
|
| 125 | - $map_jason = array($map_jason[$post->ID]); |
|
| 126 | - } |
|
| 127 | - } |
|
| 128 | - $canvas_jason = $canvas . "_jason"; |
|
| 129 | - $map_canvas_arr[$canvas] = array_unique($map_jason); |
|
| 130 | - unset($cat_content_info); |
|
| 131 | - $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
|
|
| 132 | - $totalcount = count(array_unique($map_jason)); |
|
| 133 | - if (!empty($cat_content_info)) {
|
|
| 134 | - $json_content = substr(implode(',', $cat_content_info), 1);
|
|
| 135 | - $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
|
|
| 136 | - $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
| 137 | - $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
|
|
| 138 | - } else {
|
|
| 139 | - $canvas_jason = '[{"totalcount":"0"}]';
|
|
| 140 | - } |
|
| 141 | - $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * Filter the send_marker_jason_to_js() function map canvas json args. |
|
| 145 | - * |
|
| 146 | - * You can use this filter to modify map canvas json args. |
|
| 147 | - * |
|
| 148 | - * @since 1.0.0 |
|
| 149 | - * @package GeoDirectory |
|
| 150 | - * @param string $canvas Map canvas array key. |
|
| 151 | - * @param array $map_canvas_jason_args Map canvas args. |
|
| 152 | - */ |
|
| 153 | - $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
|
|
| 154 | - |
|
| 155 | - wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
|
|
| 156 | - } else {
|
|
| 157 | - $canvas_jason = '[{"totalcount":"0"}]';
|
|
| 158 | - $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * Filter the send_marker_jason_to_js() function map canvas json args. |
|
| 162 | - * |
|
| 163 | - * You can use this filter to modify map canvas json args. |
|
| 164 | - * |
|
| 165 | - * @since 1.0.0 |
|
| 166 | - * @package GeoDirectory |
|
| 167 | - * @param string $canvas Map canvas array key. |
|
| 168 | - * @param array $map_canvas_jason_args Map canvas args. |
|
| 169 | - */ |
|
| 170 | - $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
|
|
| 171 | - wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
|
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - } |
|
| 115 | + global $map_jason, $map_canvas_arr; |
|
| 116 | + |
|
| 117 | + if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
|
|
| 118 | + foreach ($map_canvas_arr as $canvas => $jason) {
|
|
| 119 | + if (is_array($map_jason) && !empty($map_jason)) {
|
|
| 120 | + |
|
| 121 | + // on details page only show the main marker on the map |
|
| 122 | + if(geodir_is_page('detail')){
|
|
| 123 | + global $post; |
|
| 124 | + if(isset($map_jason[$post->ID])){
|
|
| 125 | + $map_jason = array($map_jason[$post->ID]); |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | + $canvas_jason = $canvas . "_jason"; |
|
| 129 | + $map_canvas_arr[$canvas] = array_unique($map_jason); |
|
| 130 | + unset($cat_content_info); |
|
| 131 | + $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
|
|
| 132 | + $totalcount = count(array_unique($map_jason)); |
|
| 133 | + if (!empty($cat_content_info)) {
|
|
| 134 | + $json_content = substr(implode(',', $cat_content_info), 1);
|
|
| 135 | + $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
|
|
| 136 | + $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
| 137 | + $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
|
|
| 138 | + } else {
|
|
| 139 | + $canvas_jason = '[{"totalcount":"0"}]';
|
|
| 140 | + } |
|
| 141 | + $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * Filter the send_marker_jason_to_js() function map canvas json args. |
|
| 145 | + * |
|
| 146 | + * You can use this filter to modify map canvas json args. |
|
| 147 | + * |
|
| 148 | + * @since 1.0.0 |
|
| 149 | + * @package GeoDirectory |
|
| 150 | + * @param string $canvas Map canvas array key. |
|
| 151 | + * @param array $map_canvas_jason_args Map canvas args. |
|
| 152 | + */ |
|
| 153 | + $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
|
|
| 154 | + |
|
| 155 | + wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
|
|
| 156 | + } else {
|
|
| 157 | + $canvas_jason = '[{"totalcount":"0"}]';
|
|
| 158 | + $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * Filter the send_marker_jason_to_js() function map canvas json args. |
|
| 162 | + * |
|
| 163 | + * You can use this filter to modify map canvas json args. |
|
| 164 | + * |
|
| 165 | + * @since 1.0.0 |
|
| 166 | + * @package GeoDirectory |
|
| 167 | + * @param string $canvas Map canvas array key. |
|
| 168 | + * @param array $map_canvas_jason_args Map canvas args. |
|
| 169 | + */ |
|
| 170 | + $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
|
|
| 171 | + wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
|
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + } |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -195,99 +195,99 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | function home_map_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = true, $pading = 0, $map_canvas_name = '', $child_collapse, $is_home_map = false) |
| 197 | 197 | {
|
| 198 | - global $cat_count, $geodir_cat_icons, $gd_session; |
|
| 198 | + global $cat_count, $geodir_cat_icons, $gd_session; |
|
| 199 | 199 | |
| 200 | - $exclude_categories = get_option('geodir_exclude_cat_on_map');
|
|
| 201 | - $exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
|
|
| 200 | + $exclude_categories = get_option('geodir_exclude_cat_on_map');
|
|
| 201 | + $exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
|
|
| 202 | 202 | |
| 203 | - // check if exclude categories saved before fix of categories identical names |
|
| 204 | - if ($exclude_categories_new) {
|
|
| 205 | - $gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : ''; |
|
| 206 | - $exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array(); |
|
| 207 | - } |
|
| 203 | + // check if exclude categories saved before fix of categories identical names |
|
| 204 | + if ($exclude_categories_new) {
|
|
| 205 | + $gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : ''; |
|
| 206 | + $exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array(); |
|
| 207 | + } |
|
| 208 | 208 | |
| 209 | - $exclude_cat_str = implode(',', $exclude_categories);
|
|
| 209 | + $exclude_cat_str = implode(',', $exclude_categories);
|
|
| 210 | 210 | |
| 211 | - if ($exclude_cat_str == '') {
|
|
| 212 | - $exclude_cat_str = '0'; |
|
| 213 | - } |
|
| 211 | + if ($exclude_cat_str == '') {
|
|
| 212 | + $exclude_cat_str = '0'; |
|
| 213 | + } |
|
| 214 | 214 | |
| 215 | - $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
|
|
| 215 | + $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
|
|
| 216 | 216 | |
| 217 | - if ($hide_empty) {
|
|
| 218 | - $cat_terms = geodir_filter_empty_terms($cat_terms); |
|
| 219 | - } |
|
| 217 | + if ($hide_empty) {
|
|
| 218 | + $cat_terms = geodir_filter_empty_terms($cat_terms); |
|
| 219 | + } |
|
| 220 | 220 | |
| 221 | - $main_list_class = ''; |
|
| 222 | - //If there are terms, start displaying |
|
| 223 | - if (count($cat_terms) > 0) {
|
|
| 224 | - //Displaying as a list |
|
| 225 | - $p = $pading * 15; |
|
| 226 | - $pading++; |
|
| 221 | + $main_list_class = ''; |
|
| 222 | + //If there are terms, start displaying |
|
| 223 | + if (count($cat_terms) > 0) {
|
|
| 224 | + //Displaying as a list |
|
| 225 | + $p = $pading * 15; |
|
| 226 | + $pading++; |
|
| 227 | 227 | |
| 228 | - if ($cat_parent == 0) {
|
|
| 229 | - $list_class = 'main_list'; |
|
| 230 | - $display = ''; |
|
| 231 | - } else {
|
|
| 232 | - $list_class = 'sub_list'; |
|
| 233 | - $display = !$child_collapse ? '' : 'display:none'; |
|
| 234 | - } |
|
| 228 | + if ($cat_parent == 0) {
|
|
| 229 | + $list_class = 'main_list'; |
|
| 230 | + $display = ''; |
|
| 231 | + } else {
|
|
| 232 | + $list_class = 'sub_list'; |
|
| 233 | + $display = !$child_collapse ? '' : 'display:none'; |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | - $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
| 236 | + $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
| 237 | 237 | |
| 238 | - $geodir_cat_icons = geodir_get_term_icon(); |
|
| 238 | + $geodir_cat_icons = geodir_get_term_icon(); |
|
| 239 | 239 | |
| 240 | - $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place';
|
|
| 241 | - if ($is_home_map && $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype')) {
|
|
| 242 | - $geodir_default_map_search_pt = $homemap_catlist_ptype; |
|
| 243 | - } |
|
| 244 | - $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : $geodir_default_map_search_pt); |
|
| 240 | + $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place';
|
|
| 241 | + if ($is_home_map && $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype')) {
|
|
| 242 | + $geodir_default_map_search_pt = $homemap_catlist_ptype; |
|
| 243 | + } |
|
| 244 | + $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : $geodir_default_map_search_pt); |
|
| 245 | 245 | |
| 246 | - foreach ($cat_terms as $cat_term): |
|
| 247 | - $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : ''; |
|
| 248 | - |
|
| 249 | - if (!in_array($cat_term->term_id, $exclude_categories)): |
|
| 250 | - //Secret sauce. Function calls itself to display child elements, if any |
|
| 251 | - $checked = 'checked="checked"'; |
|
| 252 | - |
|
| 253 | - // Untick the category by default on home map |
|
| 254 | - if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
|
|
| 255 | - if (function_exists('icl_object_id')) { // if WPML
|
|
| 256 | - global $sitepress; |
|
| 257 | - $default_lang = $sitepress->get_default_language(); |
|
| 258 | - $term_id = icl_object_id($cat_term->term_id, $post_type.'category', true, $default_lang); |
|
| 259 | - }else{
|
|
| 260 | - $term_id = $cat_term->term_id; |
|
| 261 | - } |
|
| 262 | - if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
|
|
| 263 | - $checked = ''; |
|
| 264 | - } |
|
| 265 | - } |
|
| 266 | - |
|
| 267 | - $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"'; |
|
| 268 | - $term_check .= ' name="' . $map_canvas_name . '_cat[]" '; |
|
| 269 | - $term_check .= ' title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">'; |
|
| 270 | - $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>'; |
|
| 271 | - $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>'; |
|
| 272 | - |
|
| 273 | - endif; |
|
| 274 | - |
|
| 275 | - |
|
| 276 | - // get sub category by recursion |
|
| 277 | - $out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map); |
|
| 278 | - |
|
| 279 | - $out .= '</li>'; |
|
| 280 | - |
|
| 281 | - endforeach; |
|
| 282 | - |
|
| 283 | - $out .= '</ul>'; |
|
| 284 | - |
|
| 285 | - return $out; |
|
| 286 | - } else {
|
|
| 287 | - if ($cat_parent == 0) |
|
| 288 | - return _e('No category', 'geodirectory');
|
|
| 289 | - } |
|
| 290 | - return; |
|
| 246 | + foreach ($cat_terms as $cat_term): |
|
| 247 | + $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : ''; |
|
| 248 | + |
|
| 249 | + if (!in_array($cat_term->term_id, $exclude_categories)): |
|
| 250 | + //Secret sauce. Function calls itself to display child elements, if any |
|
| 251 | + $checked = 'checked="checked"'; |
|
| 252 | + |
|
| 253 | + // Untick the category by default on home map |
|
| 254 | + if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
|
|
| 255 | + if (function_exists('icl_object_id')) { // if WPML
|
|
| 256 | + global $sitepress; |
|
| 257 | + $default_lang = $sitepress->get_default_language(); |
|
| 258 | + $term_id = icl_object_id($cat_term->term_id, $post_type.'category', true, $default_lang); |
|
| 259 | + }else{
|
|
| 260 | + $term_id = $cat_term->term_id; |
|
| 261 | + } |
|
| 262 | + if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
|
|
| 263 | + $checked = ''; |
|
| 264 | + } |
|
| 265 | + } |
|
| 266 | + |
|
| 267 | + $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"'; |
|
| 268 | + $term_check .= ' name="' . $map_canvas_name . '_cat[]" '; |
|
| 269 | + $term_check .= ' title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">'; |
|
| 270 | + $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>'; |
|
| 271 | + $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>'; |
|
| 272 | + |
|
| 273 | + endif; |
|
| 274 | + |
|
| 275 | + |
|
| 276 | + // get sub category by recursion |
|
| 277 | + $out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map); |
|
| 278 | + |
|
| 279 | + $out .= '</li>'; |
|
| 280 | + |
|
| 281 | + endforeach; |
|
| 282 | + |
|
| 283 | + $out .= '</ul>'; |
|
| 284 | + |
|
| 285 | + return $out; |
|
| 286 | + } else {
|
|
| 287 | + if ($cat_parent == 0) |
|
| 288 | + return _e('No category', 'geodirectory');
|
|
| 289 | + } |
|
| 290 | + return; |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -299,19 +299,19 @@ discard block |
||
| 299 | 299 | * @return string The map API provider name. |
| 300 | 300 | */ |
| 301 | 301 | function geodir_map_name() {
|
| 302 | - $geodir_map_name = get_option('geodir_load_map', 'google');
|
|
| 302 | + $geodir_map_name = get_option('geodir_load_map', 'google');
|
|
| 303 | 303 | |
| 304 | - if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
|
|
| 305 | - $geodir_map_name = 'auto'; |
|
| 306 | - } |
|
| 307 | - |
|
| 308 | - /** |
|
| 309 | - * Filter the map JS API provider name. |
|
| 310 | - * |
|
| 311 | - * @since 1.6.1 |
|
| 312 | - * @param string $geodir_map_name The map API provider name. |
|
| 313 | - */ |
|
| 314 | - return apply_filters('geodir_map_name', $geodir_map_name);
|
|
| 304 | + if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
|
|
| 305 | + $geodir_map_name = 'auto'; |
|
| 306 | + } |
|
| 307 | + |
|
| 308 | + /** |
|
| 309 | + * Filter the map JS API provider name. |
|
| 310 | + * |
|
| 311 | + * @since 1.6.1 |
|
| 312 | + * @param string $geodir_map_name The map API provider name. |
|
| 313 | + */ |
|
| 314 | + return apply_filters('geodir_map_name', $geodir_map_name);
|
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
@@ -327,48 +327,48 @@ discard block |
||
| 327 | 327 | * @return array The icon size. |
| 328 | 328 | */ |
| 329 | 329 | function geodir_get_marker_size($icon, $default_size = array('w' => 36, 'h' => 45)) {
|
| 330 | - global $gd_marker_sizes; |
|
| 330 | + global $gd_marker_sizes; |
|
| 331 | 331 | |
| 332 | - if (empty($gd_marker_sizes)) {
|
|
| 333 | - $gd_marker_sizes = array(); |
|
| 334 | - } |
|
| 332 | + if (empty($gd_marker_sizes)) {
|
|
| 333 | + $gd_marker_sizes = array(); |
|
| 334 | + } |
|
| 335 | 335 | |
| 336 | - if (!empty($gd_marker_sizes[$icon])) {
|
|
| 337 | - return $gd_marker_sizes[$icon]; |
|
| 338 | - } |
|
| 336 | + if (!empty($gd_marker_sizes[$icon])) {
|
|
| 337 | + return $gd_marker_sizes[$icon]; |
|
| 338 | + } |
|
| 339 | 339 | |
| 340 | - if (empty($icon)) {
|
|
| 341 | - $gd_marker_sizes[$icon] = $default_size; |
|
| 340 | + if (empty($icon)) {
|
|
| 341 | + $gd_marker_sizes[$icon] = $default_size; |
|
| 342 | 342 | |
| 343 | - return $default_size; |
|
| 344 | - } |
|
| 343 | + return $default_size; |
|
| 344 | + } |
|
| 345 | 345 | |
| 346 | - $icon_url = $icon; |
|
| 346 | + $icon_url = $icon; |
|
| 347 | 347 | |
| 348 | - $uploads = wp_upload_dir(); // Array of key => value pairs |
|
| 348 | + $uploads = wp_upload_dir(); // Array of key => value pairs |
|
| 349 | 349 | |
| 350 | - if (!path_is_absolute($icon)) {
|
|
| 351 | - $icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon); |
|
| 352 | - } |
|
| 350 | + if (!path_is_absolute($icon)) {
|
|
| 351 | + $icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon); |
|
| 352 | + } |
|
| 353 | 353 | |
| 354 | - if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
|
|
| 355 | - $icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon); |
|
| 356 | - } |
|
| 354 | + if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
|
|
| 355 | + $icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon); |
|
| 356 | + } |
|
| 357 | 357 | |
| 358 | - $sizes = array(); |
|
| 359 | - if (is_file($icon) && file_exists($icon)) {
|
|
| 360 | - $size = getimagesize(trim($icon)); |
|
| 358 | + $sizes = array(); |
|
| 359 | + if (is_file($icon) && file_exists($icon)) {
|
|
| 360 | + $size = getimagesize(trim($icon)); |
|
| 361 | 361 | |
| 362 | - if (!empty($size[0]) && !empty($size[1])) {
|
|
| 363 | - $sizes = array('w' => $size[0], 'h' => $size[1]);
|
|
| 364 | - } |
|
| 365 | - } |
|
| 362 | + if (!empty($size[0]) && !empty($size[1])) {
|
|
| 363 | + $sizes = array('w' => $size[0], 'h' => $size[1]);
|
|
| 364 | + } |
|
| 365 | + } |
|
| 366 | 366 | |
| 367 | - $sizes = !empty($sizes) ? $sizes : $default_size; |
|
| 367 | + $sizes = !empty($sizes) ? $sizes : $default_size; |
|
| 368 | 368 | |
| 369 | - $gd_marker_sizes[$icon_url] = $sizes; |
|
| 369 | + $gd_marker_sizes[$icon_url] = $sizes; |
|
| 370 | 370 | |
| 371 | - return $sizes; |
|
| 371 | + return $sizes; |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | add_action('wp_footer', 'geodir_map_load_script', 10);
|
@@ -380,8 +380,8 @@ discard block |
||
| 380 | 380 | * @package GeoDirectory |
| 381 | 381 | */ |
| 382 | 382 | function geodir_map_load_script() {
|
| 383 | - if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
|
|
| 384 | - $plugin_url = geodir_plugin_url(); |
|
| 383 | + if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
|
|
| 384 | + $plugin_url = geodir_plugin_url(); |
|
| 385 | 385 | ?> |
| 386 | 386 | <script type="text/javascript"> |
| 387 | 387 | if (!(window.google && typeof google.maps !== 'undefined')) {
|
@@ -395,5 +395,5 @@ discard block |
||
| 395 | 395 | } |
| 396 | 396 | </script> |
| 397 | 397 | <?php |
| 398 | - } |
|
| 398 | + } |
|
| 399 | 399 | } |
| 400 | 400 | \ No newline at end of file |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
|
| 56 | 56 | |
| 57 | - if(isset($map_jason[$post->ID])){return null;}
|
|
| 57 | + if (isset($map_jason[$post->ID])) {return null; }
|
|
| 58 | 58 | |
| 59 | 59 | $srcharr = array("'", "/", "-", '"', '\\');
|
| 60 | 60 | $replarr = array("′", "⁄", "–", "“", '');
|
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $title = str_replace($srcharr, $replarr, $post_title); |
| 68 | 68 | |
| 69 | 69 | if (is_ssl()) {
|
| 70 | - $icon = str_replace("http:","https:",$icon );
|
|
| 70 | + $icon = str_replace("http:", "https:", $icon);
|
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | if ($icon != '') {
|
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $icon_size = array('w' => 36, 'h' => 45);
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}';
|
|
| 86 | + $post_json = '{"id":"'.$post->ID.'","t": "'.$title.'","lt": "'.$post->post_latitude.'","ln": "'.$post->post_longitude.'","mk_id":"'.$post->ID.'_'.$post->default_category.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"}';
|
|
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | 89 | * Filter the json data when creating output for post json marker.. |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | * @param string $post_json JSON representation of the post marker info. |
| 93 | 93 | * @param object $post The post object. |
| 94 | 94 | */ |
| 95 | - $post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
|
|
| 95 | + $post_map_json = apply_filters('geodir_create_marker_jason_of_posts', $post_json, $post);
|
|
| 96 | 96 | |
| 97 | 97 | // only assign it if it has a value |
| 98 | - if($post_map_json){
|
|
| 98 | + if ($post_map_json) {
|
|
| 99 | 99 | $map_jason[$post->ID] = $post_map_json; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -119,13 +119,13 @@ discard block |
||
| 119 | 119 | if (is_array($map_jason) && !empty($map_jason)) {
|
| 120 | 120 | |
| 121 | 121 | // on details page only show the main marker on the map |
| 122 | - if(geodir_is_page('detail')){
|
|
| 122 | + if (geodir_is_page('detail')) {
|
|
| 123 | 123 | global $post; |
| 124 | - if(isset($map_jason[$post->ID])){
|
|
| 124 | + if (isset($map_jason[$post->ID])) {
|
|
| 125 | 125 | $map_jason = array($map_jason[$post->ID]); |
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | - $canvas_jason = $canvas . "_jason"; |
|
| 128 | + $canvas_jason = $canvas."_jason"; |
|
| 129 | 129 | $map_canvas_arr[$canvas] = array_unique($map_jason); |
| 130 | 130 | unset($cat_content_info); |
| 131 | 131 | $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
|
@@ -134,11 +134,11 @@ discard block |
||
| 134 | 134 | $json_content = substr(implode(',', $cat_content_info), 1);
|
| 135 | 135 | $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
|
| 136 | 136 | $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
| 137 | - $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
|
|
| 137 | + $canvas_jason = '[{"totalcount":"'.$totalcount.'",'.$json_content.']';
|
|
| 138 | 138 | } else {
|
| 139 | 139 | $canvas_jason = '[{"totalcount":"0"}]';
|
| 140 | 140 | } |
| 141 | - $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
| 141 | + $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason); |
|
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | 144 | * Filter the send_marker_jason_to_js() function map canvas json args. |
@@ -150,12 +150,12 @@ discard block |
||
| 150 | 150 | * @param string $canvas Map canvas array key. |
| 151 | 151 | * @param array $map_canvas_jason_args Map canvas args. |
| 152 | 152 | */ |
| 153 | - $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
|
|
| 153 | + $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
|
|
| 154 | 154 | |
| 155 | - wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
|
|
| 155 | + wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
|
|
| 156 | 156 | } else {
|
| 157 | 157 | $canvas_jason = '[{"totalcount":"0"}]';
|
| 158 | - $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
| 158 | + $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason); |
|
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | 161 | * Filter the send_marker_jason_to_js() function map canvas json args. |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | * @param string $canvas Map canvas array key. |
| 168 | 168 | * @param array $map_canvas_jason_args Map canvas args. |
| 169 | 169 | */ |
| 170 | - $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
|
|
| 171 | - wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
|
|
| 170 | + $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
|
|
| 171 | + wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
|
|
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | |
@@ -233,11 +233,11 @@ discard block |
||
| 233 | 233 | $display = !$child_collapse ? '' : 'display:none'; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
| 236 | + $out = '<ul class="treeview '.$list_class.'" style="margin-left:'.$p.'px;'.$display.';">'; |
|
| 237 | 237 | |
| 238 | 238 | $geodir_cat_icons = geodir_get_term_icon(); |
| 239 | 239 | |
| 240 | - $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place';
|
|
| 240 | + $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place';
|
|
| 241 | 241 | if ($is_home_map && $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype')) {
|
| 242 | 242 | $geodir_default_map_search_pt = $homemap_catlist_ptype; |
| 243 | 243 | } |
@@ -256,19 +256,19 @@ discard block |
||
| 256 | 256 | global $sitepress; |
| 257 | 257 | $default_lang = $sitepress->get_default_language(); |
| 258 | 258 | $term_id = icl_object_id($cat_term->term_id, $post_type.'category', true, $default_lang); |
| 259 | - }else{
|
|
| 259 | + } else {
|
|
| 260 | 260 | $term_id = $cat_term->term_id; |
| 261 | 261 | } |
| 262 | - if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
|
|
| 262 | + if (!empty($geodir_home_map_untick) && in_array($post_type.'_'.$term_id, $geodir_home_map_untick)) {
|
|
| 263 | 263 | $checked = ''; |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"'; |
|
| 268 | - $term_check .= ' name="' . $map_canvas_name . '_cat[]" '; |
|
| 269 | - $term_check .= ' title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">'; |
|
| 270 | - $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>'; |
|
| 271 | - $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>'; |
|
| 267 | + $term_check = '<input type="checkbox" '.$checked.' id="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'" class="group_selector '.$main_list_class.'"'; |
|
| 268 | + $term_check .= ' name="'.$map_canvas_name.'_cat[]" '; |
|
| 269 | + $term_check .= ' title="'.esc_attr(ucfirst($cat_term->name)).'" value="'.$cat_term->term_id.'" onclick="javascript:build_map_ajax_search_param(\''.$map_canvas_name.'\',false, this)">'; |
|
| 270 | + $term_img = '<img height="15" width="15" alt="'.$cat_term->taxonomy.'" src="'.$icon.'" title="'.ucfirst($cat_term->name).'"/>'; |
|
| 271 | + $out .= '<li>'.$term_check.'<label for="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'">'.$term_img.ucfirst($cat_term->name).'</label><i class="fa fa-long-arrow-down"></i>'; |
|
| 272 | 272 | |
| 273 | 273 | endif; |
| 274 | 274 | |
@@ -380,18 +380,18 @@ discard block |
||
| 380 | 380 | * @package GeoDirectory |
| 381 | 381 | */ |
| 382 | 382 | function geodir_map_load_script() {
|
| 383 | - if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
|
|
| 383 | + if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is('geodirectory-googlemap-script', 'done')) {
|
|
| 384 | 384 | $plugin_url = geodir_plugin_url(); |
| 385 | 385 | ?> |
| 386 | 386 | <script type="text/javascript"> |
| 387 | 387 | if (!(window.google && typeof google.maps !== 'undefined')) {
|
| 388 | - var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-style-css");css.setAttribute("href","<?php echo $plugin_url;?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION;?>");
|
|
| 388 | + var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-style-css");css.setAttribute("href","<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION; ?>");
|
|
| 389 | 389 | document.getElementsByTagName("head")[0].appendChild(css);
|
| 390 | - var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-routing-style");css.setAttribute("href","<?php echo $plugin_url;?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css?ver=<?php echo GEODIRECTORY_VERSION;?>");
|
|
| 390 | + var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-routing-style");css.setAttribute("href","<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css?ver=<?php echo GEODIRECTORY_VERSION; ?>");
|
|
| 391 | 391 | document.getElementsByTagName("head")[0].appendChild(css);
|
| 392 | - document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
|
|
| 393 | - document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/osm.geocode.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
|
|
| 394 | - document.write('<' + 'script id="geodirectory-leaflet-routing-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
|
|
| 392 | + document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
|
|
| 393 | + document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/osm.geocode.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
|
|
| 394 | + document.write('<' + 'script id="geodirectory-leaflet-routing-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
|
|
| 395 | 395 | } |
| 396 | 396 | </script> |
| 397 | 397 | <?php |