Completed
Pull Request — master (#206)
by Kiran
05:47
created
geodirectory-admin/admin_db_install.php 1 patch
Indentation   +295 added lines, -295 removed lines patch added patch discarded remove patch
@@ -6,26 +6,26 @@  discard block
 block discarded – undo
6 6
  * @package GeoDirectory
7 7
  */
8 8
 if (!function_exists('geodir_create_tables')) {
9
-    /**
10
-     * Creates custom db tables for storing GeoDirectory plugin data.
11
-     *
12
-     * @since 1.0.0
13
-     * @package GeoDirectory
14
-     * @global object $wpdb WordPress Database object.
15
-     * @global string $plugin_prefix GeoDirectory plugin table prefix.
16
-     */
17
-    function geodir_create_tables()
18
-    {
19
-
20
-        global $wpdb, $plugin_prefix;
21
-
22
-        $wpdb->hide_errors();
23
-
24
-        $collate = '';
25
-        if ($wpdb->has_cap('collation')) {
26
-            if (!empty($wpdb->charset)) $collate = "DEFAULT CHARACTER SET $wpdb->charset";
27
-            if (!empty($wpdb->collate)) $collate .= " COLLATE $wpdb->collate";
28
-        }
9
+	/**
10
+	 * Creates custom db tables for storing GeoDirectory plugin data.
11
+	 *
12
+	 * @since 1.0.0
13
+	 * @package GeoDirectory
14
+	 * @global object $wpdb WordPress Database object.
15
+	 * @global string $plugin_prefix GeoDirectory plugin table prefix.
16
+	 */
17
+	function geodir_create_tables()
18
+	{
19
+
20
+		global $wpdb, $plugin_prefix;
21
+
22
+		$wpdb->hide_errors();
23
+
24
+		$collate = '';
25
+		if ($wpdb->has_cap('collation')) {
26
+			if (!empty($wpdb->charset)) $collate = "DEFAULT CHARACTER SET $wpdb->charset";
27
+			if (!empty($wpdb->collate)) $collate .= " COLLATE $wpdb->collate";
28
+		}
29 29
 
30 30
 		/**
31 31
 		 * Include any functions needed for upgrades.
@@ -36,31 +36,31 @@  discard block
 block discarded – undo
36 36
 
37 37
 
38 38
 // rename tables if we need to
39
-        if ($wpdb->query("SHOW TABLES LIKE 'geodir_countries'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_countries'") == 0) {
40
-            $wpdb->query("RENAME TABLE geodir_countries TO " . $wpdb->prefix . "geodir_countries");
41
-        }
42
-        if ($wpdb->query("SHOW TABLES LIKE 'geodir_custom_fields'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_custom_fields'") == 0) {
43
-            $wpdb->query("RENAME TABLE geodir_custom_fields TO " . $wpdb->prefix . "geodir_custom_fields");
44
-        }
45
-        if ($wpdb->query("SHOW TABLES LIKE 'geodir_post_icon'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_post_icon'") == 0) {
46
-            $wpdb->query("RENAME TABLE geodir_post_icon TO " . $wpdb->prefix . "geodir_post_icon");
47
-        }
48
-        if ($wpdb->query("SHOW TABLES LIKE 'geodir_attachments'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_attachments'") == 0) {
49
-            $wpdb->query("RENAME TABLE geodir_attachments TO " . $wpdb->prefix . "geodir_attachments");
50
-        }
51
-        if ($wpdb->query("SHOW TABLES LIKE 'geodir_post_review'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_post_review'") == 0) {
52
-            $wpdb->query("RENAME TABLE geodir_post_review TO " . $wpdb->prefix . "geodir_post_review");
53
-        }
54
-        if ($wpdb->query("SHOW TABLES LIKE 'geodir_custom_sort_fields'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_custom_sort_fields'") == 0) {
55
-            $wpdb->query("RENAME TABLE geodir_custom_sort_fields TO " . $wpdb->prefix . "geodir_custom_sort_fields");
56
-        }
57
-        if ($wpdb->query("SHOW TABLES LIKE 'geodir_gd_place_detail'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_gd_place_detail'") == 0) {
58
-            $wpdb->query("RENAME TABLE geodir_gd_place_detail TO " . $wpdb->prefix . "geodir_gd_place_detail");
59
-        }
60
-
61
-
62
-        // Table for storing Countries
63
-        $GEODIR_COUNTRIES_TABLE = "CREATE TABLE " . GEODIR_COUNTRIES_TABLE . " (
39
+		if ($wpdb->query("SHOW TABLES LIKE 'geodir_countries'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_countries'") == 0) {
40
+			$wpdb->query("RENAME TABLE geodir_countries TO " . $wpdb->prefix . "geodir_countries");
41
+		}
42
+		if ($wpdb->query("SHOW TABLES LIKE 'geodir_custom_fields'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_custom_fields'") == 0) {
43
+			$wpdb->query("RENAME TABLE geodir_custom_fields TO " . $wpdb->prefix . "geodir_custom_fields");
44
+		}
45
+		if ($wpdb->query("SHOW TABLES LIKE 'geodir_post_icon'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_post_icon'") == 0) {
46
+			$wpdb->query("RENAME TABLE geodir_post_icon TO " . $wpdb->prefix . "geodir_post_icon");
47
+		}
48
+		if ($wpdb->query("SHOW TABLES LIKE 'geodir_attachments'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_attachments'") == 0) {
49
+			$wpdb->query("RENAME TABLE geodir_attachments TO " . $wpdb->prefix . "geodir_attachments");
50
+		}
51
+		if ($wpdb->query("SHOW TABLES LIKE 'geodir_post_review'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_post_review'") == 0) {
52
+			$wpdb->query("RENAME TABLE geodir_post_review TO " . $wpdb->prefix . "geodir_post_review");
53
+		}
54
+		if ($wpdb->query("SHOW TABLES LIKE 'geodir_custom_sort_fields'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_custom_sort_fields'") == 0) {
55
+			$wpdb->query("RENAME TABLE geodir_custom_sort_fields TO " . $wpdb->prefix . "geodir_custom_sort_fields");
56
+		}
57
+		if ($wpdb->query("SHOW TABLES LIKE 'geodir_gd_place_detail'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_gd_place_detail'") == 0) {
58
+			$wpdb->query("RENAME TABLE geodir_gd_place_detail TO " . $wpdb->prefix . "geodir_gd_place_detail");
59
+		}
60
+
61
+
62
+		// Table for storing Countries
63
+		$GEODIR_COUNTRIES_TABLE = "CREATE TABLE " . GEODIR_COUNTRIES_TABLE . " (
64 64
 						CountryId smallint AUTO_INCREMENT NOT NULL ,
65 65
 						Country varchar (50) NOT NULL ,
66 66
 						FIPS104 varchar (2) NOT NULL ,
@@ -79,21 +79,21 @@  discard block
 block discarded – undo
79 79
 						Comment varchar (255) NULL ,
80 80
 						PRIMARY KEY  (CountryId)) $collate ";
81 81
 
82
-        /**
83
-         * Filter the SQL query that creates/updates the country DB table structure.
84
-         *
85
-         * @since 1.0.0
86
-         * @param string $sql The SQL insert query string.
87
-         */
88
-        $GEODIR_COUNTRIES_TABLE = apply_filters('geodir_before_country_table_create', $GEODIR_COUNTRIES_TABLE);
89
-        dbDelta($GEODIR_COUNTRIES_TABLE);
82
+		/**
83
+		 * Filter the SQL query that creates/updates the country DB table structure.
84
+		 *
85
+		 * @since 1.0.0
86
+		 * @param string $sql The SQL insert query string.
87
+		 */
88
+		$GEODIR_COUNTRIES_TABLE = apply_filters('geodir_before_country_table_create', $GEODIR_COUNTRIES_TABLE);
89
+		dbDelta($GEODIR_COUNTRIES_TABLE);
90 90
 
91 91
 
92
-        $country_table_empty = $wpdb->get_var("SELECT COUNT(CountryId) FROM " . GEODIR_COUNTRIES_TABLE . "");
92
+		$country_table_empty = $wpdb->get_var("SELECT COUNT(CountryId) FROM " . GEODIR_COUNTRIES_TABLE . "");
93 93
 
94
-        if ($country_table_empty == 0) {
94
+		if ($country_table_empty == 0) {
95 95
 
96
-            $countries_insert = "INSERT INTO " . GEODIR_COUNTRIES_TABLE . " (`CountryId`, `Country`, `FIPS104`, `ISO2`, `ISO3`, `ISON`, `Internet`, `Capital`, `MapReference`, `NationalitySingular`, `NationalityPlural`, `Currency`, `CurrencyCode`, `Population`, `Title`, `COMMENT`) VALUES
96
+			$countries_insert = "INSERT INTO " . GEODIR_COUNTRIES_TABLE . " (`CountryId`, `Country`, `FIPS104`, `ISO2`, `ISO3`, `ISON`, `Internet`, `Capital`, `MapReference`, `NationalitySingular`, `NationalityPlural`, `Currency`, `CurrencyCode`, `Population`, `Title`, `COMMENT`) VALUES
97 97
 	(1, 'Afghanistan', 'AF', 'AF', 'AFG', '4', 'AF', 'Kabul ', 'Asia ', 'Afghan', 'Afghans', 'Afghani ', 'AFA', 26813057, 'Afghanistan', ''),
98 98
 	(2, 'Albania', 'AL', 'AL', 'ALB', '8', 'AL', 'Tirana ', 'Europe ', 'Albanian', 'Albanians', 'Lek ', 'ALL', 3510484, 'Albania', ''),
99 99
 	(3, 'Algeria', 'AG', 'DZ', 'DZA', '12', 'DZ', 'Algiers ', 'Africa ', 'Algerian', 'Algerians', 'Algerian Dinar ', 'DZD', 31736053, 'Algeria', ''),
@@ -367,21 +367,21 @@  discard block
 block discarded – undo
367 367
 	(276, 'Curaçao', 'UC', 'CW', 'CUW', '531', 'CW', 'Willemstad ', 'Central America and the Caribbean', 'Curaçaoan', 'Curaçaoans', 'Netherlands Antillean guilder', 'ANG', 152760, 'Curaçao', ''),
368 368
 	(277, 'Caribbean Netherlands', '--', 'BQ', 'BES', '535', 'BQ', '--', 'Central America and the Caribbean', '--', '--', 'United States dollar', 'USD', 21133, 'Caribbean Netherlands', '')";
369 369
 
370
-            /**
371
-             * Filter the SQL query that inserts the country DB table data.
372
-             *
373
-             * @since 1.0.0
374
-             * @param string $sql The SQL insert query string.
375
-             */
376
-            $countries_insert = apply_filters('geodir_before_country_data_insert', $countries_insert);
377
-            $wpdb->query($countries_insert);
370
+			/**
371
+			 * Filter the SQL query that inserts the country DB table data.
372
+			 *
373
+			 * @since 1.0.0
374
+			 * @param string $sql The SQL insert query string.
375
+			 */
376
+			$countries_insert = apply_filters('geodir_before_country_data_insert', $countries_insert);
377
+			$wpdb->query($countries_insert);
378 378
 
379
-        }
379
+		}
380 380
 
381 381
 
382
-        // Table for storing location attribute - these are user defined
382
+		// Table for storing location attribute - these are user defined
383 383
 
384
-        $icon_table = "CREATE TABLE " . GEODIR_ICON_TABLE . " (
384
+		$icon_table = "CREATE TABLE " . GEODIR_ICON_TABLE . " (
385 385
 						id int NOT NULL AUTO_INCREMENT,
386 386
 						post_id int( 10 ) NOT NULL,
387 387
 						post_title varchar(254) NOT NULL,
@@ -390,19 +390,19 @@  discard block
 block discarded – undo
390 390
 						PRIMARY KEY  (id)
391 391
 						) $collate ";
392 392
 
393
-        /**
394
-         * Filter the SQL query that creates/updates the post_icon DB table structure.
395
-         *
396
-         * @since 1.0.0
397
-         * @param string $sql The SQL insert query string.
398
-         */
399
-        $icon_table = apply_filters('geodir_before_icon_table_create', $icon_table);
393
+		/**
394
+		 * Filter the SQL query that creates/updates the post_icon DB table structure.
395
+		 *
396
+		 * @since 1.0.0
397
+		 * @param string $sql The SQL insert query string.
398
+		 */
399
+		$icon_table = apply_filters('geodir_before_icon_table_create', $icon_table);
400 400
 
401
-        dbDelta($icon_table);
401
+		dbDelta($icon_table);
402 402
 
403
-        // Table for storing post custom fields - these are user defined
403
+		// Table for storing post custom fields - these are user defined
404 404
 
405
-        $post_custom_fields = "CREATE TABLE " . GEODIR_CUSTOM_FIELDS_TABLE . " (
405
+		$post_custom_fields = "CREATE TABLE " . GEODIR_CUSTOM_FIELDS_TABLE . " (
406 406
 							  id int(11) NOT NULL AUTO_INCREMENT,
407 407
 							  post_type varchar(100) NULL,
408 408
 							  data_type varchar(100) NULL DEFAULT NULL,
@@ -436,18 +436,18 @@  discard block
 block discarded – undo
436 436
 							  PRIMARY KEY  (id)
437 437
 							  ) $collate";
438 438
 
439
-        /**
440
-         * Filter the SQL query that creates/updates the custom_fields DB table structure.
441
-         *
442
-         * @since 1.0.0
443
-         * @param string $sql The SQL insert query string.
444
-         */
445
-        $post_custom_fields = apply_filters('geodir_before_custom_field_table_create', $post_custom_fields);
439
+		/**
440
+		 * Filter the SQL query that creates/updates the custom_fields DB table structure.
441
+		 *
442
+		 * @since 1.0.0
443
+		 * @param string $sql The SQL insert query string.
444
+		 */
445
+		$post_custom_fields = apply_filters('geodir_before_custom_field_table_create', $post_custom_fields);
446 446
 
447
-        dbDelta($post_custom_fields);
447
+		dbDelta($post_custom_fields);
448 448
 
449
-        // Table for storing place attribute - these are user defined
450
-        $post_detail = "CREATE TABLE " . $plugin_prefix . "gd_place_detail (
449
+		// Table for storing place attribute - these are user defined
450
+		$post_detail = "CREATE TABLE " . $plugin_prefix . "gd_place_detail (
451 451
 						post_id int(11) NOT NULL,
452 452
 						post_title text NULL DEFAULT NULL,
453 453
 						post_status varchar(20) NULL DEFAULT NULL,
@@ -473,22 +473,22 @@  discard block
 block discarded – undo
473 473
 						PRIMARY KEY  (post_id)
474 474
 						) $collate ";
475 475
 
476
-        /**
477
-         * Filter the SQL query that creates/updates the post_detail DB table structure.
478
-         *
479
-         * @since 1.0.0
480
-         * @param string $sql The SQL insert query string.
481
-         */
482
-        $post_detail = apply_filters('geodir_before_post_detail_table_create', $post_detail);
476
+		/**
477
+		 * Filter the SQL query that creates/updates the post_detail DB table structure.
478
+		 *
479
+		 * @since 1.0.0
480
+		 * @param string $sql The SQL insert query string.
481
+		 */
482
+		$post_detail = apply_filters('geodir_before_post_detail_table_create', $post_detail);
483 483
 
484
-        dbDelta($post_detail);
484
+		dbDelta($post_detail);
485 485
 
486
-        // alter post_title
487
-        //$wpdb->query("ALTER TABLE ".$wpdb->prefix."geodir_gd_place_detail MODIFY `post_title` text NULL");
486
+		// alter post_title
487
+		//$wpdb->query("ALTER TABLE ".$wpdb->prefix."geodir_gd_place_detail MODIFY `post_title` text NULL");
488 488
 
489
-        // Table for storing place images - these are user defined
489
+		// Table for storing place images - these are user defined
490 490
 
491
-        $attechment_table = "CREATE TABLE " . GEODIR_ATTACHMENT_TABLE . " (
491
+		$attechment_table = "CREATE TABLE " . GEODIR_ATTACHMENT_TABLE . " (
492 492
 						ID int(11) NOT NULL AUTO_INCREMENT,
493 493
 						post_id int(11) NOT NULL,
494 494
 						user_id int(11) DEFAULT NULL,
@@ -504,18 +504,18 @@  discard block
 block discarded – undo
504 504
 						PRIMARY KEY  (ID)
505 505
 						) $collate ";
506 506
 
507
-        /**
508
-         * Filter the SQL query that creates/updates the attachments DB table structure.
509
-         *
510
-         * @since 1.0.0
511
-         * @param string $sql The SQL insert query string.
512
-         */
513
-        $attechment_table = apply_filters('geodir_before_attachment_table_create', $attechment_table);
507
+		/**
508
+		 * Filter the SQL query that creates/updates the attachments DB table structure.
509
+		 *
510
+		 * @since 1.0.0
511
+		 * @param string $sql The SQL insert query string.
512
+		 */
513
+		$attechment_table = apply_filters('geodir_before_attachment_table_create', $attechment_table);
514 514
 
515
-        dbDelta($attechment_table);
515
+		dbDelta($attechment_table);
516 516
 
517 517
 
518
-        $custom_sort_fields_table = "CREATE TABLE " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " (
518
+		$custom_sort_fields_table = "CREATE TABLE " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " (
519 519
 			id int(11) NOT NULL AUTO_INCREMENT,
520 520
 			post_type varchar(255) NOT NULL,
521 521
 			data_type varchar(255) NOT NULL,
@@ -533,18 +533,18 @@  discard block
 block discarded – undo
533 533
 			PRIMARY KEY  (id)
534 534
 			) $collate ";
535 535
 
536
-        /**
537
-         * Filter the SQL query that creates/updates the custom_sort_fields DB table structure.
538
-         *
539
-         * @since 1.0.0
540
-         * @param string $sql The SQL insert query string.
541
-         */
542
-        $custom_sort_fields_table = apply_filters('geodir_before_sort_fields_table_create', $custom_sort_fields_table);
536
+		/**
537
+		 * Filter the SQL query that creates/updates the custom_sort_fields DB table structure.
538
+		 *
539
+		 * @since 1.0.0
540
+		 * @param string $sql The SQL insert query string.
541
+		 */
542
+		$custom_sort_fields_table = apply_filters('geodir_before_sort_fields_table_create', $custom_sort_fields_table);
543 543
 
544
-        dbDelta($custom_sort_fields_table);
544
+		dbDelta($custom_sort_fields_table);
545 545
 
546 546
 
547
-            $review_table = "CREATE TABLE " . GEODIR_REVIEW_TABLE . " (
547
+			$review_table = "CREATE TABLE " . GEODIR_REVIEW_TABLE . " (
548 548
 			id int(11) NOT NULL AUTO_INCREMENT,
549 549
 			post_id int(11) DEFAULT NULL,
550 550
 			post_title varchar( 255 ) NULL DEFAULT NULL,
@@ -568,191 +568,191 @@  discard block
 block discarded – undo
568 568
 			PRIMARY KEY  (id)
569 569
 			) $collate  ";
570 570
 
571
-            /**
572
-             * Filter the SQL query that creates the review DB table structure.
573
-             *
574
-             * @since 1.0.0
575
-             * @param string $sql The SQL insert query string.
576
-             */
577
-            $review_table = apply_filters('geodir_before_review_table_create', $review_table);
578
-            dbDelta($review_table);
571
+			/**
572
+			 * Filter the SQL query that creates the review DB table structure.
573
+			 *
574
+			 * @since 1.0.0
575
+			 * @param string $sql The SQL insert query string.
576
+			 */
577
+			$review_table = apply_filters('geodir_before_review_table_create', $review_table);
578
+			dbDelta($review_table);
579 579
 
580 580
 
581 581
 
582
-        // Alter terms table
583
-        $term_icon_column = $wpdb->get_var("SHOW COLUMNS FROM $wpdb->terms where field='term_icon'");
584
-        if (!$term_icon_column) {
585
-            $wpdb->query("ALTER TABLE $wpdb->terms ADD `term_icon` TEXT NULL DEFAULT NULL");
586
-        }
582
+		// Alter terms table
583
+		$term_icon_column = $wpdb->get_var("SHOW COLUMNS FROM $wpdb->terms where field='term_icon'");
584
+		if (!$term_icon_column) {
585
+			$wpdb->query("ALTER TABLE $wpdb->terms ADD `term_icon` TEXT NULL DEFAULT NULL");
586
+		}
587 587
 
588
-        //require_once(geodir_plugin_path() . '/upgrade.php');
588
+		//require_once(geodir_plugin_path() . '/upgrade.php');
589 589
 
590 590
 
591
-    }
591
+	}
592 592
 } // END MAIN FUNCTION geodir_tables_install
593 593
 
594 594
 if (!function_exists('geodir_create_default_fields')) {
595
-    /**
596
-     * Inserts default custom fields table data into database.
597
-     *
598
-     * @since 1.0.0
599
-     * @package GeoDirectory
600
-     */
601
-    function geodir_create_default_fields()
602
-    {
603
-
604
-        $fields = array();
605
-
606
-        $fields[] = array('listing_type' => 'gd_place',
607
-            'data_type' => 'VARCHAR',
608
-            'field_type' => 'taxonomy',
609
-            'admin_title' => __('Category', 'geodirectory'),
610
-            'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
611
-            'site_title' => __('Category', 'geodirectory'),
612
-            'htmlvar_name' => 'gd_placecategory',
613
-            'default_value' => '',
614
-            'is_default' => '1',
615
-            'is_admin' => '1',
616
-            'is_required' => '1',
617
-            'clabels' => __('Category', 'geodirectory'));
618
-
619
-        $fields[] = array('listing_type' => 'gd_place',
620
-            'data_type' => 'VARCHAR',
621
-            'field_type' => 'address',
622
-            'admin_title' => __('Address', 'geodirectory'),
623
-            'admin_desc' => ADDRESS_MSG,
624
-            'site_title' => __('Address', 'geodirectory'),
625
-            'htmlvar_name' => 'post',
626
-            'default_value' => '',
627
-            'option_values' => '',
628
-            'is_default' => '1',
629
-            'is_admin' => '1',
630
-            'is_required' => '1',
631
-            'required_msg' => __('Address fields are required', 'geodirectory'),
632
-            'clabels' => __('Address', 'geodirectory'),
633
-            'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
634
-                'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
635
-                'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
636
-                'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
637
-                'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
638
-                'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
639
-                'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
640
-                'show_latlng' => 1));
641
-
642
-        $fields[] = array('listing_type' => 'gd_place',
643
-            'data_type' => 'VARCHAR',
644
-            'field_type' => 'text',
645
-            'admin_title' => __('Time', 'geodirectory'),
646
-            'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
647
-            'site_title' => __('Time', 'geodirectory'),
648
-            'htmlvar_name' => 'timing',
649
-            'default_value' => '',
650
-            'option_values' => '',
651
-            'is_default' => '1',
652
-            'is_admin' => '1',
653
-            'clabels' => __('Time', 'geodirectory'));
654
-
655
-        $fields[] = array('listing_type' => 'gd_place',
656
-            'data_type' => 'VARCHAR',
657
-            'field_type' => 'phone',
658
-            'admin_title' => __('Phone', 'geodirectory'),
659
-            'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
660
-            'site_title' => __('Phone', 'geodirectory'),
661
-            'htmlvar_name' => 'contact',
662
-            'default_value' => '',
663
-            'option_values' => '',
664
-            'is_default' => '1',
665
-            'is_admin' => '1',
666
-            'clabels' => __('Phone', 'geodirectory'));
667
-
668
-        $fields[] = array('listing_type' => 'gd_place',
669
-            'data_type' => 'VARCHAR',
670
-            'field_type' => 'email',
671
-            'admin_title' => __('Email', 'geodirectory'),
672
-            'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
673
-            'site_title' => __('Email', 'geodirectory'),
674
-            'htmlvar_name' => 'email',
675
-            'default_value' => '',
676
-            'option_values' => '',
677
-            'is_default' => '1',
678
-            'is_admin' => '1',
679
-            'clabels' => __('Email', 'geodirectory'));
680
-
681
-        $fields[] = array('listing_type' => 'gd_place',
682
-            'data_type' => 'VARCHAR',
683
-            'field_type' => 'url',
684
-            'admin_title' => __('Website', 'geodirectory'),
685
-            'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
686
-            'site_title' => __('Website', 'geodirectory'),
687
-            'htmlvar_name' => 'website',
688
-            'default_value' => '',
689
-            'option_values' => '',
690
-            'is_default' => '1',
691
-            'is_admin' => '1',
692
-            'clabels' => __('Website', 'geodirectory'));
693
-
694
-        $fields[] = array('listing_type' => 'gd_place',
695
-            'data_type' => 'VARCHAR',
696
-            'field_type' => 'url',
697
-            'admin_title' => __('Twitter', 'geodirectory'),
698
-            'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
699
-            'site_title' => __('Twitter', 'geodirectory'),
700
-            'htmlvar_name' => 'twitter',
701
-            'default_value' => '',
702
-            'option_values' => '',
703
-            'is_default' => '1',
704
-            'is_admin' => '1',
705
-            'clabels' => __('Twitter', 'geodirectory'));
706
-
707
-        $fields[] = array('listing_type' => 'gd_place',
708
-            'data_type' => 'VARCHAR',
709
-            'field_type' => 'url',
710
-            'admin_title' => __('Facebook', 'geodirectory'),
711
-            'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
712
-            'site_title' => __('Facebook', 'geodirectory'),
713
-            'htmlvar_name' => 'facebook',
714
-            'default_value' => '',
715
-            'option_values' => '',
716
-            'is_default' => '1',
717
-            'is_admin' => '1',
718
-            'clabels' => __('Facebook', 'geodirectory'));
719
-
720
-        $fields[] = array('listing_type' => 'gd_place',
721
-            'data_type' => 'TEXT',
722
-            'field_type' => 'textarea',
723
-            'admin_title' => __('Video', 'geodirectory'),
724
-            'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
725
-            'site_title' => __('Video', 'geodirectory'),
726
-            'htmlvar_name' => 'video',
727
-            'default_value' => '',
728
-            'option_values' => '',
729
-            'is_default' => '0',
730
-            'is_admin' => '1',
731
-            'clabels' => __('Video', 'geodirectory'));
732
-
733
-        $fields[] = array('listing_type' => 'gd_place',
734
-            'data_type' => 'TEXT',
735
-            'field_type' => 'textarea',
736
-            'admin_title' => __('Special Offers', 'geodirectory'),
737
-            'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
738
-            'site_title' => __('Special Offers', 'geodirectory'),
739
-            'htmlvar_name' => 'special_offers',
740
-            'default_value' => '',
741
-            'option_values' => '',
742
-            'is_default' => '0',
743
-            'is_admin' => '1',
744
-            'clabels' => __('Special Offers', 'geodirectory'));
745
-
746
-        /**
747
-         * Filter the array of default custom fields DB table data.
748
-         *
749
-         * @since 1.0.0
750
-         * @param string $fields The default custom fields as an array.
751
-         */
752
-        $fields = apply_filters('geodir_before_default_custom_fields_saved', $fields);
753
-        foreach ($fields as $field_index => $field) {
754
-            geodir_custom_field_save($field);
755
-
756
-        }
757
-    }
595
+	/**
596
+	 * Inserts default custom fields table data into database.
597
+	 *
598
+	 * @since 1.0.0
599
+	 * @package GeoDirectory
600
+	 */
601
+	function geodir_create_default_fields()
602
+	{
603
+
604
+		$fields = array();
605
+
606
+		$fields[] = array('listing_type' => 'gd_place',
607
+			'data_type' => 'VARCHAR',
608
+			'field_type' => 'taxonomy',
609
+			'admin_title' => __('Category', 'geodirectory'),
610
+			'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
611
+			'site_title' => __('Category', 'geodirectory'),
612
+			'htmlvar_name' => 'gd_placecategory',
613
+			'default_value' => '',
614
+			'is_default' => '1',
615
+			'is_admin' => '1',
616
+			'is_required' => '1',
617
+			'clabels' => __('Category', 'geodirectory'));
618
+
619
+		$fields[] = array('listing_type' => 'gd_place',
620
+			'data_type' => 'VARCHAR',
621
+			'field_type' => 'address',
622
+			'admin_title' => __('Address', 'geodirectory'),
623
+			'admin_desc' => ADDRESS_MSG,
624
+			'site_title' => __('Address', 'geodirectory'),
625
+			'htmlvar_name' => 'post',
626
+			'default_value' => '',
627
+			'option_values' => '',
628
+			'is_default' => '1',
629
+			'is_admin' => '1',
630
+			'is_required' => '1',
631
+			'required_msg' => __('Address fields are required', 'geodirectory'),
632
+			'clabels' => __('Address', 'geodirectory'),
633
+			'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
634
+				'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
635
+				'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
636
+				'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
637
+				'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
638
+				'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
639
+				'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
640
+				'show_latlng' => 1));
641
+
642
+		$fields[] = array('listing_type' => 'gd_place',
643
+			'data_type' => 'VARCHAR',
644
+			'field_type' => 'text',
645
+			'admin_title' => __('Time', 'geodirectory'),
646
+			'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
647
+			'site_title' => __('Time', 'geodirectory'),
648
+			'htmlvar_name' => 'timing',
649
+			'default_value' => '',
650
+			'option_values' => '',
651
+			'is_default' => '1',
652
+			'is_admin' => '1',
653
+			'clabels' => __('Time', 'geodirectory'));
654
+
655
+		$fields[] = array('listing_type' => 'gd_place',
656
+			'data_type' => 'VARCHAR',
657
+			'field_type' => 'phone',
658
+			'admin_title' => __('Phone', 'geodirectory'),
659
+			'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
660
+			'site_title' => __('Phone', 'geodirectory'),
661
+			'htmlvar_name' => 'contact',
662
+			'default_value' => '',
663
+			'option_values' => '',
664
+			'is_default' => '1',
665
+			'is_admin' => '1',
666
+			'clabels' => __('Phone', 'geodirectory'));
667
+
668
+		$fields[] = array('listing_type' => 'gd_place',
669
+			'data_type' => 'VARCHAR',
670
+			'field_type' => 'email',
671
+			'admin_title' => __('Email', 'geodirectory'),
672
+			'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
673
+			'site_title' => __('Email', 'geodirectory'),
674
+			'htmlvar_name' => 'email',
675
+			'default_value' => '',
676
+			'option_values' => '',
677
+			'is_default' => '1',
678
+			'is_admin' => '1',
679
+			'clabels' => __('Email', 'geodirectory'));
680
+
681
+		$fields[] = array('listing_type' => 'gd_place',
682
+			'data_type' => 'VARCHAR',
683
+			'field_type' => 'url',
684
+			'admin_title' => __('Website', 'geodirectory'),
685
+			'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
686
+			'site_title' => __('Website', 'geodirectory'),
687
+			'htmlvar_name' => 'website',
688
+			'default_value' => '',
689
+			'option_values' => '',
690
+			'is_default' => '1',
691
+			'is_admin' => '1',
692
+			'clabels' => __('Website', 'geodirectory'));
693
+
694
+		$fields[] = array('listing_type' => 'gd_place',
695
+			'data_type' => 'VARCHAR',
696
+			'field_type' => 'url',
697
+			'admin_title' => __('Twitter', 'geodirectory'),
698
+			'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
699
+			'site_title' => __('Twitter', 'geodirectory'),
700
+			'htmlvar_name' => 'twitter',
701
+			'default_value' => '',
702
+			'option_values' => '',
703
+			'is_default' => '1',
704
+			'is_admin' => '1',
705
+			'clabels' => __('Twitter', 'geodirectory'));
706
+
707
+		$fields[] = array('listing_type' => 'gd_place',
708
+			'data_type' => 'VARCHAR',
709
+			'field_type' => 'url',
710
+			'admin_title' => __('Facebook', 'geodirectory'),
711
+			'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
712
+			'site_title' => __('Facebook', 'geodirectory'),
713
+			'htmlvar_name' => 'facebook',
714
+			'default_value' => '',
715
+			'option_values' => '',
716
+			'is_default' => '1',
717
+			'is_admin' => '1',
718
+			'clabels' => __('Facebook', 'geodirectory'));
719
+
720
+		$fields[] = array('listing_type' => 'gd_place',
721
+			'data_type' => 'TEXT',
722
+			'field_type' => 'textarea',
723
+			'admin_title' => __('Video', 'geodirectory'),
724
+			'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
725
+			'site_title' => __('Video', 'geodirectory'),
726
+			'htmlvar_name' => 'video',
727
+			'default_value' => '',
728
+			'option_values' => '',
729
+			'is_default' => '0',
730
+			'is_admin' => '1',
731
+			'clabels' => __('Video', 'geodirectory'));
732
+
733
+		$fields[] = array('listing_type' => 'gd_place',
734
+			'data_type' => 'TEXT',
735
+			'field_type' => 'textarea',
736
+			'admin_title' => __('Special Offers', 'geodirectory'),
737
+			'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
738
+			'site_title' => __('Special Offers', 'geodirectory'),
739
+			'htmlvar_name' => 'special_offers',
740
+			'default_value' => '',
741
+			'option_values' => '',
742
+			'is_default' => '0',
743
+			'is_admin' => '1',
744
+			'clabels' => __('Special Offers', 'geodirectory'));
745
+
746
+		/**
747
+		 * Filter the array of default custom fields DB table data.
748
+		 *
749
+		 * @since 1.0.0
750
+		 * @param string $fields The default custom fields as an array.
751
+		 */
752
+		$fields = apply_filters('geodir_before_default_custom_fields_saved', $fields);
753
+		foreach ($fields as $field_index => $field) {
754
+			geodir_custom_field_save($field);
755
+
756
+		}
757
+	}
758 758
 }
759 759
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-admin/admin_functions.php 1 patch
Indentation   +2762 added lines, -2762 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Admin functions.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Admin functions.
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
 
9 9
 /**
10 10
  * Updates option value when GeoDirectory get deactivated.
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 function geodir_deactivation()
16 16
 {
17 17
 
18
-    // Update installed variable
19
-    update_option("geodir_installed", 0);
18
+	// Update installed variable
19
+	update_option("geodir_installed", 0);
20 20
 
21
-    // Remove rewrite rules and then recreate rewrite rules.
22
-    flush_rewrite_rules();
21
+	// Remove rewrite rules and then recreate rewrite rules.
22
+	flush_rewrite_rules();
23 23
 }
24 24
 
25 25
 
@@ -32,105 +32,105 @@  discard block
 block discarded – undo
32 32
 function geodir_uninstall()
33 33
 {
34 34
 
35
-    delete_option('geodir_default_data_installed');
35
+	delete_option('geodir_default_data_installed');
36 36
 
37 37
 }
38 38
 
39 39
 if (!function_exists('geodir_admin_styles')) {
40
-    /**
41
-     * Enqueue Admin Styles.
42
-     *
43
-     * @since 1.0.0
44
-     * @package GeoDirectory
45
-     */
46
-    function geodir_admin_styles()
47
-    {
40
+	/**
41
+	 * Enqueue Admin Styles.
42
+	 *
43
+	 * @since 1.0.0
44
+	 * @package GeoDirectory
45
+	 */
46
+	function geodir_admin_styles()
47
+	{
48 48
 
49
-        wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
50
-        wp_enqueue_style('geodirectory-admin-css');
49
+		wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
50
+		wp_enqueue_style('geodirectory-admin-css');
51 51
 
52
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
53
-        wp_enqueue_style('geodirectory-frontend-style');
52
+		wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
53
+		wp_enqueue_style('geodirectory-frontend-style');
54 54
 
55
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
56
-        wp_enqueue_style('geodir-chosen-style');
55
+		wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
56
+		wp_enqueue_style('geodir-chosen-style');
57 57
 
58
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
59
-        wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
58
+		wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
59
+		wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
60 60
 
61
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
62
-        wp_enqueue_style('geodirectory-jquery-ui-css');
61
+		wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
62
+		wp_enqueue_style('geodirectory-jquery-ui-css');
63 63
 
64
-        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
65
-        wp_enqueue_style('geodirectory-custom-fields-css');
64
+		wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
65
+		wp_enqueue_style('geodirectory-custom-fields-css');
66 66
 
67
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
68
-        wp_enqueue_style('geodirectory-pluplodar-css');
67
+		wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
68
+		wp_enqueue_style('geodirectory-pluplodar-css');
69 69
 
70
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
71
-        wp_enqueue_style('geodir-rating-style');
70
+		wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
71
+		wp_enqueue_style('geodir-rating-style');
72 72
 
73
-        wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
74
-        wp_enqueue_style('geodir-rtl-style');
73
+		wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
74
+		wp_enqueue_style('geodir-rtl-style');
75 75
 
76
-    }
76
+	}
77 77
 }
78 78
 
79 79
 if (!function_exists('geodir_admin_styles_req')) {
80
-    /**
81
-     * Loads stylesheets from CDN.
82
-     *
83
-     * @since 1.0.0
84
-     * @package GeoDirectory
85
-     */
86
-    function geodir_admin_styles_req()
87
-    {
88
-
89
-        wp_register_style('geodirectory-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
90
-        wp_enqueue_style('geodirectory-font-awesome');
91
-    }
80
+	/**
81
+	 * Loads stylesheets from CDN.
82
+	 *
83
+	 * @since 1.0.0
84
+	 * @package GeoDirectory
85
+	 */
86
+	function geodir_admin_styles_req()
87
+	{
88
+
89
+		wp_register_style('geodirectory-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
90
+		wp_enqueue_style('geodirectory-font-awesome');
91
+	}
92 92
 }
93 93
 
94 94
 if (!function_exists('geodir_admin_scripts')) {
95
-    /**
96
-     * Enqueue Admin Scripts.
97
-     *
98
-     * @since 1.0.0
99
-     * @package GeoDirectory
100
-     */
101
-    function geodir_admin_scripts()
102
-    {
103
-
104
-        wp_enqueue_script('jquery');
105
-        /*wp_enqueue_script( 'jquery-ui-core' );
95
+	/**
96
+	 * Enqueue Admin Scripts.
97
+	 *
98
+	 * @since 1.0.0
99
+	 * @package GeoDirectory
100
+	 */
101
+	function geodir_admin_scripts()
102
+	{
103
+
104
+		wp_enqueue_script('jquery');
105
+		/*wp_enqueue_script( 'jquery-ui-core' );
106 106
         wp_enqueue_script( 'jquery-ui-datepicker' );
107 107
         wp_enqueue_script('jquery-ui-slider'); */
108 108
 
109 109
 
110
-        wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
110
+		wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
111 111
 
112
-        wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array(), GEODIRECTORY_VERSION);
113
-        wp_enqueue_script('chosen');
112
+		wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array(), GEODIRECTORY_VERSION);
113
+		wp_enqueue_script('chosen');
114 114
 
115
-        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
116
-        wp_enqueue_script('geodirectory-choose-ajax');
115
+		wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
116
+		wp_enqueue_script('geodirectory-choose-ajax');
117 117
 
118
-        if (isset($_REQUEST['listing_type'])) {
119
-            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
120
-        }
118
+		if (isset($_REQUEST['listing_type'])) {
119
+			wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
120
+		}
121 121
 
122
-        wp_enqueue_script('geodirectory-custom-fields-script');
123
-        $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
122
+		wp_enqueue_script('geodirectory-custom-fields-script');
123
+		$plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
124 124
 
125
-        wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
125
+		wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
126 126
 
127
-        $map_lang = "&language=" . geodir_get_map_default_language();
128
-        /** This filter is documented in geodirectory_template_tags.php */
129
-        $map_extra = apply_filters('geodir_googlemap_script_extra', '');
130
-        wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
127
+		$map_lang = "&language=" . geodir_get_map_default_language();
128
+		/** This filter is documented in geodirectory_template_tags.php */
129
+		$map_extra = apply_filters('geodir_googlemap_script_extra', '');
130
+		wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
131 131
 
132
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
133
-        wp_enqueue_script('geodirectory-goMap-script');
132
+		wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
133
+		wp_enqueue_script('geodirectory-goMap-script');
134 134
 
135 135
 		// font awesome rating script
136 136
 		if (get_option('geodir_reviewrating_enable_font_awesome')) {
@@ -141,177 +141,177 @@  discard block
 block discarded – undo
141 141
 			wp_enqueue_script('geodir-jRating-js');
142 142
 		}
143 143
 
144
-        wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
145
-        wp_enqueue_script('geodir-on-document-load');
146
-
147
-
148
-        // SCRIPT FOR UPLOAD
149
-        wp_enqueue_script('plupload-all');
150
-        wp_enqueue_script('jquery-ui-sortable');
151
-
152
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
153
-        wp_enqueue_script('geodirectory-plupload-script');
154
-
155
-        // SCRIPT FOR UPLOAD END
156
-
157
-
158
-        // place js config array for plupload
159
-        $plupload_init = array(
160
-            'runtimes' => 'html5,silverlight,flash,html4',
161
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
162
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
163
-            'drop_element' => 'dropbox', // will be adjusted per uploader
164
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
165
-            'multiple_queues' => true,
166
-            'max_file_size' => geodir_max_upload_size(),
167
-            'url' => admin_url('admin-ajax.php'),
168
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
169
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
170
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
171
-            'multipart' => true,
172
-            'urlstream_upload' => true,
173
-            'multi_selection' => false, // will be added per uploader
174
-            // additional post data to send to our ajax hook
175
-            'multipart_params' => array(
176
-                '_ajax_nonce' => "", // will be added per uploader
177
-                'action' => 'plupload_action', // the ajax action name
178
-                'imgid' => 0 // will be added per uploader
179
-            )
180
-        );
181
-        $base_plupload_config = json_encode($plupload_init);
182
-
183
-
184
-        $thumb_img_arr = array();
185
-
186
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
187
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
188
-
189
-        $totImg = '';
190
-        $image_limit = '';
191
-        if (!empty($thumb_img_arr)) {
192
-            foreach ($thumb_img_arr as $img) {
193
-                $curImages = $img->src . ",";
194
-            }
144
+		wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
145
+		wp_enqueue_script('geodir-on-document-load');
146
+
147
+
148
+		// SCRIPT FOR UPLOAD
149
+		wp_enqueue_script('plupload-all');
150
+		wp_enqueue_script('jquery-ui-sortable');
151
+
152
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
153
+		wp_enqueue_script('geodirectory-plupload-script');
154
+
155
+		// SCRIPT FOR UPLOAD END
156
+
157
+
158
+		// place js config array for plupload
159
+		$plupload_init = array(
160
+			'runtimes' => 'html5,silverlight,flash,html4',
161
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
162
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
163
+			'drop_element' => 'dropbox', // will be adjusted per uploader
164
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
165
+			'multiple_queues' => true,
166
+			'max_file_size' => geodir_max_upload_size(),
167
+			'url' => admin_url('admin-ajax.php'),
168
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
169
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
170
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
171
+			'multipart' => true,
172
+			'urlstream_upload' => true,
173
+			'multi_selection' => false, // will be added per uploader
174
+			// additional post data to send to our ajax hook
175
+			'multipart_params' => array(
176
+				'_ajax_nonce' => "", // will be added per uploader
177
+				'action' => 'plupload_action', // the ajax action name
178
+				'imgid' => 0 // will be added per uploader
179
+			)
180
+		);
181
+		$base_plupload_config = json_encode($plupload_init);
182
+
183
+
184
+		$thumb_img_arr = array();
185
+
186
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
187
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
188
+
189
+		$totImg = '';
190
+		$image_limit = '';
191
+		if (!empty($thumb_img_arr)) {
192
+			foreach ($thumb_img_arr as $img) {
193
+				$curImages = $img->src . ",";
194
+			}
195 195
 
196
-            $totImg = count($thumb_img_arr);
197
-        }
196
+			$totImg = count($thumb_img_arr);
197
+		}
198 198
 
199 199
 
200
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
201
-            'totalImg' => $totImg,
202
-            'image_limit' => $image_limit,
203
-            'upload_img_size' => geodir_max_upload_size());
200
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
201
+			'totalImg' => $totImg,
202
+			'image_limit' => $image_limit,
203
+			'upload_img_size' => geodir_max_upload_size());
204 204
 
205
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
205
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
206 206
 
207
-        $ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
208
-        wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
207
+		$ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
208
+		wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
209 209
 
210 210
 
211
-        wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
212
-        wp_enqueue_script('geodirectory-admin-script');
211
+		wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
212
+		wp_enqueue_script('geodirectory-admin-script');
213 213
 
214
-        wp_enqueue_style('farbtastic');
215
-        wp_enqueue_script('farbtastic');
214
+		wp_enqueue_style('farbtastic');
215
+		wp_enqueue_script('farbtastic');
216 216
 
217
-        $screen = get_current_screen();
218
-        if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
219
-            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
220
-        }
217
+		$screen = get_current_screen();
218
+		if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
219
+			wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
220
+		}
221 221
 
222
-        $ajax_cons_data = array('url' => __(get_option('siteurl') . '?geodir_ajax=true'));
223
-        wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
222
+		$ajax_cons_data = array('url' => __(get_option('siteurl') . '?geodir_ajax=true'));
223
+		wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
224 224
 
225
-    }
225
+	}
226 226
 }
227 227
 
228 228
 if (!function_exists('geodir_admin_menu')) {
229
-    /**
230
-     * Admin Menus
231
-     *
232
-     * Sets up the admin menus in wordpress.
233
-     *
234
-     * @since 1.0.0
235
-     * @package GeoDirectory
236
-     * @global array $menu Menu array.
237
-     * @global object $geodirectory GeoDirectory plugin object.
238
-     */
239
-    function geodir_admin_menu()
240
-    {
241
-        global $menu, $geodirectory;
229
+	/**
230
+	 * Admin Menus
231
+	 *
232
+	 * Sets up the admin menus in wordpress.
233
+	 *
234
+	 * @since 1.0.0
235
+	 * @package GeoDirectory
236
+	 * @global array $menu Menu array.
237
+	 * @global object $geodirectory GeoDirectory plugin object.
238
+	 */
239
+	function geodir_admin_menu()
240
+	{
241
+		global $menu, $geodirectory;
242 242
 
243
-        if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
243
+		if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
244 244
 
245
-        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
245
+		add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
246 246
 
247 247
 
248
-    }
248
+	}
249 249
 }
250 250
 
251 251
 if (!function_exists('geodir_admin_menu_order')) {
252
-    /**
253
-     * Order admin menus.
254
-     *
255
-     * @since 1.0.0
256
-     * @package GeoDirectory
257
-     * @param array $menu_order Menu order array.
258
-     * @return array Modified menu order array.
259
-     */
260
-    function geodir_admin_menu_order($menu_order)
261
-    {
262
-
263
-        // Initialize our custom order array
264
-        $geodir_menu_order = array();
265
-
266
-        // Get the index of our custom separator
267
-        $geodir_separator = array_search('separator-geodirectory', $menu_order);
268
-
269
-        // Get index of posttype menu
270
-        $post_types = geodir_get_posttypes();
271
-        if (!empty($post_types)) {
272
-            foreach ($post_types as $post_type) {
273
-                $geodir_posts = array_search("edit.php?post_type={$post_type}", $menu_order);
274
-            }
275
-        }
252
+	/**
253
+	 * Order admin menus.
254
+	 *
255
+	 * @since 1.0.0
256
+	 * @package GeoDirectory
257
+	 * @param array $menu_order Menu order array.
258
+	 * @return array Modified menu order array.
259
+	 */
260
+	function geodir_admin_menu_order($menu_order)
261
+	{
276 262
 
277
-        // Loop through menu order and do some rearranging
278
-        foreach ($menu_order as $index => $item) :
263
+		// Initialize our custom order array
264
+		$geodir_menu_order = array();
279 265
 
280
-            if ((('geodirectory') == $item)) :
281
-                $geodir_menu_order[] = 'separator-geodirectory';
282
-                if (!empty($post_types)) {
283
-                    foreach ($post_types as $post_type) {
284
-                        $geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
285
-                    }
286
-                }
287
-                $geodir_menu_order[] = $item;
266
+		// Get the index of our custom separator
267
+		$geodir_separator = array_search('separator-geodirectory', $menu_order);
288 268
 
289
-                unset($menu_order[$geodir_separator]);
290
-            //unset( $menu_order[$geodir_places] );
291
-            elseif (!in_array($item, array('separator-geodirectory'))) :
292
-                $geodir_menu_order[] = $item;
293
-            endif;
269
+		// Get index of posttype menu
270
+		$post_types = geodir_get_posttypes();
271
+		if (!empty($post_types)) {
272
+			foreach ($post_types as $post_type) {
273
+				$geodir_posts = array_search("edit.php?post_type={$post_type}", $menu_order);
274
+			}
275
+		}
294 276
 
295
-        endforeach;
277
+		// Loop through menu order and do some rearranging
278
+		foreach ($menu_order as $index => $item) :
296 279
 
297
-        // Return order
298
-        return $geodir_menu_order;
299
-    }
280
+			if ((('geodirectory') == $item)) :
281
+				$geodir_menu_order[] = 'separator-geodirectory';
282
+				if (!empty($post_types)) {
283
+					foreach ($post_types as $post_type) {
284
+						$geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
285
+					}
286
+				}
287
+				$geodir_menu_order[] = $item;
288
+
289
+				unset($menu_order[$geodir_separator]);
290
+			//unset( $menu_order[$geodir_places] );
291
+			elseif (!in_array($item, array('separator-geodirectory'))) :
292
+				$geodir_menu_order[] = $item;
293
+			endif;
294
+
295
+		endforeach;
296
+
297
+		// Return order
298
+		return $geodir_menu_order;
299
+	}
300 300
 }
301 301
 
302 302
 if (!function_exists('geodir_admin_custom_menu_order')) {
303
-    /**
304
-     * Enables custom menu order.
305
-     *
306
-     * @since 1.0.0
307
-     * @package GeoDirectory
308
-     * @return bool
309
-     */
310
-    function geodir_admin_custom_menu_order()
311
-    {
312
-        if (!current_user_can('manage_options')) return false;
313
-        return true;
314
-    }
303
+	/**
304
+	 * Enables custom menu order.
305
+	 *
306
+	 * @since 1.0.0
307
+	 * @package GeoDirectory
308
+	 * @return bool
309
+	 */
310
+	function geodir_admin_custom_menu_order()
311
+	{
312
+		if (!current_user_can('manage_options')) return false;
313
+		return true;
314
+	}
315 315
 }
316 316
 
317 317
 /**
@@ -322,41 +322,41 @@  discard block
 block discarded – undo
322 322
  */
323 323
 function geodir_before_admin_panel()
324 324
 {
325
-    if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
326
-        echo '<div id="message" class="updated fade">
325
+	if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
326
+		echo '<div id="message" class="updated fade">
327 327
                         <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory') . ' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">' . __('Support us by leaving a rating!', 'geodirectory') . '</a></p>
328 328
                         <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
329 329
                 </div>';
330 330
 
331
-    }
331
+	}
332 332
 
333
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
334
-        switch ($_REQUEST['msg']) {
335
-            case 'success':
336
-                echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
337
-                flush_rewrite_rules(false);
333
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
334
+		switch ($_REQUEST['msg']) {
335
+			case 'success':
336
+				echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
337
+				flush_rewrite_rules(false);
338 338
 
339
-                break;
339
+				break;
340 340
 			case 'fail':
341 341
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
342 342
 				
343 343
 				if ($gderr == 21)
344
-			    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
344
+					echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
345 345
 				else
346 346
 					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
347
-                break;
348
-        }
349
-    }
347
+				break;
348
+		}
349
+	}
350 350
 
351
-    if (!geodir_is_default_location_set()) {
352
-        echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
351
+	if (!geodir_is_default_location_set()) {
352
+		echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
353 353
 
354
-    }
354
+	}
355 355
 
356
-    if (!function_exists('curl_init')) {
357
-        echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
356
+	if (!function_exists('curl_init')) {
357
+		echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
358 358
 
359
-    }
359
+	}
360 360
 }
361 361
 
362 362
 /**
@@ -369,19 +369,19 @@  discard block
 block discarded – undo
369 369
  */
370 370
 function geodir_handle_option_form_submit($current_tab)
371 371
 {
372
-    global $geodir_settings;
373
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
374
-        /**
375
-         * Contains settings array for current tab.
376
-         *
377
-         * @since 1.0.0
378
-         * @package GeoDirectory
379
-         */
380
-        include_once('option-pages/' . $current_tab . '_array.php');
381
-    }
382
-    if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
383
-        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
384
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
372
+	global $geodir_settings;
373
+	if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
374
+		/**
375
+		 * Contains settings array for current tab.
376
+		 *
377
+		 * @since 1.0.0
378
+		 * @package GeoDirectory
379
+		 */
380
+		include_once('option-pages/' . $current_tab . '_array.php');
381
+	}
382
+	if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
383
+		if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
384
+		if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
385 385
 		
386 386
 		/**
387 387
 		 * Fires before updating geodirectory admin settings.
@@ -393,100 +393,100 @@  discard block
 block discarded – undo
393 393
 		 */
394 394
 		do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
395 395
 		
396
-        if (!empty($geodir_settings[$current_tab]))
397
-            geodir_update_options($geodir_settings[$current_tab]);
396
+		if (!empty($geodir_settings[$current_tab]))
397
+			geodir_update_options($geodir_settings[$current_tab]);
398 398
 
399
-        /**
400
-         * Called after GeoDirectory options settings are updated.
401
-         *
402
-         * @since 1.0.0
403
-         * @param array $geodir_settings The array of GeoDirectory settings.
404
-         * @see 'geodir_before_update_options'
405
-         */
406
-        do_action('geodir_update_options', $geodir_settings);
399
+		/**
400
+		 * Called after GeoDirectory options settings are updated.
401
+		 *
402
+		 * @since 1.0.0
403
+		 * @param array $geodir_settings The array of GeoDirectory settings.
404
+		 * @see 'geodir_before_update_options'
405
+		 */
406
+		do_action('geodir_update_options', $geodir_settings);
407 407
 
408
-        /**
409
-         * Called after GeoDirectory options settings are updated.
410
-         *
411
-         * Provides tab specific settings.
412
-         *
413
-         * @since 1.0.0
414
-         * @param string $current_tab The current settings tab name.
415
-         * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
416
-         */
417
-        do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
408
+		/**
409
+		 * Called after GeoDirectory options settings are updated.
410
+		 *
411
+		 * Provides tab specific settings.
412
+		 *
413
+		 * @since 1.0.0
414
+		 * @param string $current_tab The current settings tab name.
415
+		 * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
416
+		 */
417
+		do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
418 418
 
419
-        flush_rewrite_rules(false);
419
+		flush_rewrite_rules(false);
420 420
 
421
-        $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
421
+		$current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
422 422
 
423
-        $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
423
+		$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
424 424
 
425
-        wp_redirect($redirect_url);
426
-        exit();
427
-    endif;
425
+		wp_redirect($redirect_url);
426
+		exit();
427
+	endif;
428 428
 
429 429
 
430 430
 }
431 431
 
432 432
 
433 433
 if (!function_exists('geodir_autoinstall_admin_header') && get_option('geodir_installed')) {
434
-    /**
435
-     * GeoDirectory dummy data installation.
436
-     *
437
-     * @since 1.0.0
438
-     * @package GeoDirectory
439
-     * @global object $wpdb WordPress Database object.
440
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
441
-     * @param string $post_type The post type.
442
-     */
443
-    function geodir_autoinstall_admin_header($post_type = 'gd_place')
444
-    {
445
-
446
-        global $wpdb, $plugin_prefix;
447
-
448
-        if (!geodir_is_default_location_set()) {
449
-            echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
450
-        } else {
451
-
452
-            $geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=';
453
-
454
-            $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
455
-
456
-            if ($post_counts > 0) {
457
-                $nonce = wp_create_nonce('geodir_dummy_posts_delete_noncename');
458
-
459
-                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . SAMPLE_DATA_SHOW_MSG . '</b><br /><a id="geodir_dummy_delete" class="button_delete" onclick="geodir_autoinstall(this,\'geodir_dummy_delete\',\'' . $nonce . '\',\'' . $post_type . '\')" href="javascript:void(0);" redirect_to="' . $geodir_url . '"  >' . DELETE_BTN_SAMPLE_MSG . '</a></p></div>';
460
-                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_DELETE_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /></p></div>';
461
-            } else {
462
-                $options_list = '';
463
-                for ($option = 1; $option <= 30; $option++) {
464
-                    $selected = '';
465
-                    if ($option == 10)
466
-                        $selected = 'selected="selected"';
467
-
468
-                    $options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
469
-                }
434
+	/**
435
+	 * GeoDirectory dummy data installation.
436
+	 *
437
+	 * @since 1.0.0
438
+	 * @package GeoDirectory
439
+	 * @global object $wpdb WordPress Database object.
440
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
441
+	 * @param string $post_type The post type.
442
+	 */
443
+	function geodir_autoinstall_admin_header($post_type = 'gd_place')
444
+	{
470 445
 
471
-                $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
446
+		global $wpdb, $plugin_prefix;
472 447
 
473
-                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . AUTO_INSATALL_MSG . '</b><br /><select class="selected_sample_data">' . $options_list . '</select><a id="geodir_dummy_insert" class="button_insert" href="javascript:void(0);" onclick="geodir_autoinstall(this,\'geodir_dummy_insert\',\'' . $nonce . '\',\'' . $post_type . '\')"   redirect_to="' . $geodir_url . '" >' . INSERT_BTN_SAMPLE_MSG . '</a></p></div>';
474
-                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_IMPORT_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /><br><span class="dummy_post_inserted"></span></div>';
448
+		if (!geodir_is_default_location_set()) {
449
+			echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
450
+		} else {
475 451
 
476
-            }
477
-            echo $dummy_msg;
478
-            ?>
452
+			$geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=';
453
+
454
+			$post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
455
+
456
+			if ($post_counts > 0) {
457
+				$nonce = wp_create_nonce('geodir_dummy_posts_delete_noncename');
458
+
459
+				$dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . SAMPLE_DATA_SHOW_MSG . '</b><br /><a id="geodir_dummy_delete" class="button_delete" onclick="geodir_autoinstall(this,\'geodir_dummy_delete\',\'' . $nonce . '\',\'' . $post_type . '\')" href="javascript:void(0);" redirect_to="' . $geodir_url . '"  >' . DELETE_BTN_SAMPLE_MSG . '</a></p></div>';
460
+				$dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_DELETE_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /></p></div>';
461
+			} else {
462
+				$options_list = '';
463
+				for ($option = 1; $option <= 30; $option++) {
464
+					$selected = '';
465
+					if ($option == 10)
466
+						$selected = 'selected="selected"';
467
+
468
+					$options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
469
+				}
470
+
471
+				$nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
472
+
473
+				$dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . AUTO_INSATALL_MSG . '</b><br /><select class="selected_sample_data">' . $options_list . '</select><a id="geodir_dummy_insert" class="button_insert" href="javascript:void(0);" onclick="geodir_autoinstall(this,\'geodir_dummy_insert\',\'' . $nonce . '\',\'' . $post_type . '\')"   redirect_to="' . $geodir_url . '" >' . INSERT_BTN_SAMPLE_MSG . '</a></p></div>';
474
+				$dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_IMPORT_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /><br><span class="dummy_post_inserted"></span></div>';
475
+
476
+			}
477
+			echo $dummy_msg;
478
+			?>
479 479
             <script>
480 480
                 <?php
481 481
 
482
-                    $default_location = geodir_get_default_location();
483
-                  $city =  isset($default_location->city) ? $default_location->city : '';
484
-                  $region =isset($default_location->region) ? $default_location->region : '';
485
-                  $country =isset($default_location->country) ? $default_location->country : '';
486
-                  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
487
-                  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
482
+					$default_location = geodir_get_default_location();
483
+				  $city =  isset($default_location->city) ? $default_location->city : '';
484
+				  $region =isset($default_location->region) ? $default_location->region : '';
485
+				  $country =isset($default_location->country) ? $default_location->country : '';
486
+				  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
487
+				  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
488 488
 
489
-                ?>
489
+				?>
490 490
                 var geocoder = new google.maps.Geocoder();
491 491
                 var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country;?>';
492 492
                 var bound_lat_lng;
@@ -571,8 +571,8 @@  discard block
 block discarded – undo
571 571
                 }
572 572
             </script>
573 573
         <?php
574
-        }
575
-    }
574
+		}
575
+	}
576 576
 }
577 577
 
578 578
 /**
@@ -585,19 +585,19 @@  discard block
 block discarded – undo
585 585
  */
586 586
 function geodir_insert_dummy_posts()
587 587
 {
588
-    geodir_default_taxonomies();
588
+	geodir_default_taxonomies();
589 589
 
590
-    ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
590
+	ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
591 591
 
592
-    global $wpdb, $current_user;
592
+	global $wpdb, $current_user;
593 593
 
594
-    /**
595
-     * Contains dumy post content.
596
-     *
597
-     * @since 1.0.0
598
-     * @package GeoDirectory
599
-     */
600
-    include_once('place_dummy_post.php');
594
+	/**
595
+	 * Contains dumy post content.
596
+	 *
597
+	 * @since 1.0.0
598
+	 * @package GeoDirectory
599
+	 */
600
+	include_once('place_dummy_post.php');
601 601
 
602 602
 }
603 603
 
@@ -611,18 +611,18 @@  discard block
 block discarded – undo
611 611
  */
612 612
 function geodir_delete_dummy_posts()
613 613
 {
614
-    global $wpdb, $plugin_prefix;
614
+	global $wpdb, $plugin_prefix;
615 615
 
616 616
 
617
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
617
+	$post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
618 618
 
619 619
 
620
-    foreach ($post_ids as $post_ids_obj) {
621
-        wp_delete_post($post_ids_obj->post_id);
622
-    }
620
+	foreach ($post_ids as $post_ids_obj) {
621
+		wp_delete_post($post_ids_obj->post_id);
622
+	}
623 623
 
624
-    //double check posts are deleted
625
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
624
+	//double check posts are deleted
625
+	$wpdb->get_results("DELETE FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
626 626
 }
627 627
 
628 628
 /**
@@ -638,110 +638,110 @@  discard block
 block discarded – undo
638 638
 function geodir_default_taxonomies()
639 639
 {
640 640
 
641
-    global $wpdb, $dummy_image_path;
641
+	global $wpdb, $dummy_image_path;
642 642
 
643
-    $category_array = array('Attractions', 'Hotels', 'Restaurants', 'Food Nightlife', 'Festival', 'Videos', 'Feature');
643
+	$category_array = array('Attractions', 'Hotels', 'Restaurants', 'Food Nightlife', 'Festival', 'Videos', 'Feature');
644 644
 
645
-    $last_catid = isset($last_catid) ? $last_catid : '';
645
+	$last_catid = isset($last_catid) ? $last_catid : '';
646 646
 
647
-    $last_term = get_term($last_catid, 'gd_placecategory');
647
+	$last_term = get_term($last_catid, 'gd_placecategory');
648 648
 
649
-    $uploads = wp_upload_dir(); // Array of key => value pairs
650
-    //print_r($uploads) ;
651
-    for ($i = 0; $i < count($category_array); $i++) {
652
-        $parent_catid = 0;
653
-        if (is_array($category_array[$i])) {
654
-            $cat_name_arr = $category_array[$i];
655
-            for ($j = 0; $j < count($cat_name_arr); $j++) {
656
-                $catname = $cat_name_arr[$j];
649
+	$uploads = wp_upload_dir(); // Array of key => value pairs
650
+	//print_r($uploads) ;
651
+	for ($i = 0; $i < count($category_array); $i++) {
652
+		$parent_catid = 0;
653
+		if (is_array($category_array[$i])) {
654
+			$cat_name_arr = $category_array[$i];
655
+			for ($j = 0; $j < count($cat_name_arr); $j++) {
656
+				$catname = $cat_name_arr[$j];
657 657
 
658
-                if (!term_exists($catname, 'gd_placecategory')) {
659
-                    $last_catid = wp_insert_term($catname, 'gd_placecategory', $args = array('parent' => $parent_catid));
658
+				if (!term_exists($catname, 'gd_placecategory')) {
659
+					$last_catid = wp_insert_term($catname, 'gd_placecategory', $args = array('parent' => $parent_catid));
660 660
 
661
-                    if ($j == 0) {
662
-                        $parent_catid = $last_catid;
663
-                    }
661
+					if ($j == 0) {
662
+						$parent_catid = $last_catid;
663
+					}
664 664
 
665 665
 
666
-                    if (geodir_dummy_folder_exists())
667
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
668
-                    else
669
-                        $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
670
-                    $catname = str_replace(' ', '_', $catname);
671
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
666
+					if (geodir_dummy_folder_exists())
667
+						$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
668
+					else
669
+						$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
670
+					$catname = str_replace(' ', '_', $catname);
671
+					$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
672 672
 
673
-                    if (empty($uploaded['error'])) {
674
-                        $new_path = $uploaded['file'];
675
-                        $new_url = $uploaded['url'];
676
-                    }
673
+					if (empty($uploaded['error'])) {
674
+						$new_path = $uploaded['file'];
675
+						$new_url = $uploaded['url'];
676
+					}
677 677
 
678
-                    $wp_filetype = wp_check_filetype(basename($new_path), null);
679
-
680
-                    $attachment = array(
681
-                        'guid' => $uploads['baseurl'] . '/' . basename($new_path),
682
-                        'post_mime_type' => $wp_filetype['type'],
683
-                        'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
684
-                        'post_content' => '',
685
-                        'post_status' => 'inherit'
686
-                    );
687
-                    $attach_id = wp_insert_attachment($attachment, $new_path);
688
-
689
-                    // you must first include the image.php file
690
-                    // for the function wp_generate_attachment_metadata() to work
691
-                    require_once(ABSPATH . 'wp-admin/includes/image.php');
692
-                    $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
693
-                    wp_update_attachment_metadata($attach_id, $attach_data);
694
-
695
-                    if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
696
-                        update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), 'gd_place');
697
-                    }
698
-                }
699
-            }
678
+					$wp_filetype = wp_check_filetype(basename($new_path), null);
679
+
680
+					$attachment = array(
681
+						'guid' => $uploads['baseurl'] . '/' . basename($new_path),
682
+						'post_mime_type' => $wp_filetype['type'],
683
+						'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
684
+						'post_content' => '',
685
+						'post_status' => 'inherit'
686
+					);
687
+					$attach_id = wp_insert_attachment($attachment, $new_path);
688
+
689
+					// you must first include the image.php file
690
+					// for the function wp_generate_attachment_metadata() to work
691
+					require_once(ABSPATH . 'wp-admin/includes/image.php');
692
+					$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
693
+					wp_update_attachment_metadata($attach_id, $attach_data);
694
+
695
+					if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
696
+						update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), 'gd_place');
697
+					}
698
+				}
699
+			}
700 700
 
701
-        } else {
702
-            $catname = $category_array[$i];
701
+		} else {
702
+			$catname = $category_array[$i];
703 703
 
704
-            if (!term_exists($catname, 'gd_placecategory')) {
705
-                $last_catid = wp_insert_term($catname, 'gd_placecategory');
704
+			if (!term_exists($catname, 'gd_placecategory')) {
705
+				$last_catid = wp_insert_term($catname, 'gd_placecategory');
706 706
 
707
-                if (geodir_dummy_folder_exists())
708
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
709
-                else
710
-                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
711
-                $catname = str_replace(' ', '_', $catname);
712
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
707
+				if (geodir_dummy_folder_exists())
708
+					$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
709
+				else
710
+					$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
711
+				$catname = str_replace(' ', '_', $catname);
712
+				$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
713 713
 
714
-                if (empty($uploaded['error'])) {
715
-                    $new_path = $uploaded['file'];
716
-                    $new_url = $uploaded['url'];
717
-                }
714
+				if (empty($uploaded['error'])) {
715
+					$new_path = $uploaded['file'];
716
+					$new_url = $uploaded['url'];
717
+				}
718 718
 
719
-                $wp_filetype = wp_check_filetype(basename($new_path), null);
719
+				$wp_filetype = wp_check_filetype(basename($new_path), null);
720 720
 
721
-                $attachment = array(
722
-                    'guid' => $uploads['baseurl'] . '/' . basename($new_path),
723
-                    'post_mime_type' => $wp_filetype['type'],
724
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
725
-                    'post_content' => '',
726
-                    'post_status' => 'inherit'
727
-                );
721
+				$attachment = array(
722
+					'guid' => $uploads['baseurl'] . '/' . basename($new_path),
723
+					'post_mime_type' => $wp_filetype['type'],
724
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
725
+					'post_content' => '',
726
+					'post_status' => 'inherit'
727
+				);
728 728
 
729
-                $attach_id = wp_insert_attachment($attachment, $new_path);
729
+				$attach_id = wp_insert_attachment($attachment, $new_path);
730 730
 
731 731
 
732
-                // you must first include the image.php file
733
-                // for the function wp_generate_attachment_metadata() to work
734
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
735
-                $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
736
-                wp_update_attachment_metadata($attach_id, $attach_data);
732
+				// you must first include the image.php file
733
+				// for the function wp_generate_attachment_metadata() to work
734
+				require_once(ABSPATH . 'wp-admin/includes/image.php');
735
+				$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
736
+				wp_update_attachment_metadata($attach_id, $attach_data);
737 737
 
738
-                if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
739
-                    update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), 'gd_place');
740
-                }
741
-            }
742
-        }
738
+				if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
739
+					update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), 'gd_place');
740
+				}
741
+			}
742
+		}
743 743
 
744
-    }
744
+	}
745 745
 }
746 746
 
747 747
 /**
@@ -759,145 +759,145 @@  discard block
 block discarded – undo
759 759
 {
760 760
    // print_r($_POST);    print_r($options);    exit;
761 761
 
762
-    if ((!isset($_POST) || !$_POST) && !$dummy) return false;
762
+	if ((!isset($_POST) || !$_POST) && !$dummy) return false;
763 763
 
764
-    foreach ($options as $value) {
765
-        if ($dummy && isset($value['std']))
766
-            $_POST[$value['id']] = $value['std'];
764
+	foreach ($options as $value) {
765
+		if ($dummy && isset($value['std']))
766
+			$_POST[$value['id']] = $value['std'];
767 767
 
768 768
 
769
-        if (isset($value['type']) && $value['type'] == 'checkbox') :
769
+		if (isset($value['type']) && $value['type'] == 'checkbox') :
770 770
 
771
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
772
-                update_option($value['id'], $_POST[$value['id']]);
773
-            } else {
774
-                update_option($value['id'], 0);
775
-            }
771
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
772
+				update_option($value['id'], $_POST[$value['id']]);
773
+			} else {
774
+				update_option($value['id'], 0);
775
+			}
776 776
 
777
-        elseif (isset($value['type']) && $value['type'] == 'image_width') :
778
-
779
-            if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
780
-                update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
781
-                update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
782
-                if (isset($_POST[$value['id'] . '_crop'])) :
783
-                    update_option($value['id'] . '_crop', 1);
784
-                else :
785
-                    update_option($value['id'] . '_crop', 0);
786
-                endif;
787
-            } else {
788
-                update_option($value['id'] . '_width', $value['std']);
789
-                update_option($value['id'] . '_height', $value['std']);
790
-                update_option($value['id'] . '_crop', 1);
791
-            }
777
+		elseif (isset($value['type']) && $value['type'] == 'image_width') :
792 778
 
793
-        elseif (isset($value['type']) && $value['type'] == 'map') :
794
-            $post_types = array();
795
-            $categories = array();
796
-            $i = 0;
779
+			if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
780
+				update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
781
+				update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
782
+				if (isset($_POST[$value['id'] . '_crop'])) :
783
+					update_option($value['id'] . '_crop', 1);
784
+				else :
785
+					update_option($value['id'] . '_crop', 0);
786
+				endif;
787
+			} else {
788
+				update_option($value['id'] . '_width', $value['std']);
789
+				update_option($value['id'] . '_height', $value['std']);
790
+				update_option($value['id'] . '_crop', 1);
791
+			}
797 792
 
798
-            if (!empty($_POST['home_map_post_types'])) :
799
-                foreach ($_POST['home_map_post_types'] as $post_type) :
800
-                    $post_types[] = $post_type;
801
-                endforeach;
802
-            endif;
793
+		elseif (isset($value['type']) && $value['type'] == 'map') :
794
+			$post_types = array();
795
+			$categories = array();
796
+			$i = 0;
803 797
 
804
-            update_option('geodir_exclude_post_type_on_map', $post_types);
798
+			if (!empty($_POST['home_map_post_types'])) :
799
+				foreach ($_POST['home_map_post_types'] as $post_type) :
800
+					$post_types[] = $post_type;
801
+				endforeach;
802
+			endif;
805 803
 
806
-            if (!empty($_POST['post_category'])) :
807
-                foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
808
-                    $categories[$texonomy] = array();
809
-                    foreach ($cat_arr as $category) :
810
-                        $categories[$texonomy][] = $category;
811
-                    endforeach;
812
-                    $categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
813
-                endforeach;
814
-            endif;
815
-            update_option('geodir_exclude_cat_on_map', $categories);
816
-            update_option('geodir_exclude_cat_on_map_upgrade', 1);
817
-        elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
804
+			update_option('geodir_exclude_post_type_on_map', $post_types);
818 805
 
806
+			if (!empty($_POST['post_category'])) :
807
+				foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
808
+					$categories[$texonomy] = array();
809
+					foreach ($cat_arr as $category) :
810
+						$categories[$texonomy][] = $category;
811
+					endforeach;
812
+					$categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
813
+				endforeach;
814
+			endif;
815
+			update_option('geodir_exclude_cat_on_map', $categories);
816
+			update_option('geodir_exclude_cat_on_map_upgrade', 1);
817
+		elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
819 818
 
820
-            if (!empty($_POST['geodir_default_map_language'])):
821
-                update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
822
-            endif;
823 819
 
820
+			if (!empty($_POST['geodir_default_map_language'])):
821
+				update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
822
+			endif;
824 823
 
825
-            if (!empty($_POST['geodir_default_map_search_pt'])):
826
-                update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
827
-            endif;
828 824
 
825
+			if (!empty($_POST['geodir_default_map_search_pt'])):
826
+				update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
827
+			endif;
829 828
 
830
-        elseif (isset($value['type']) && $value['type'] == 'file') :
831 829
 
830
+		elseif (isset($value['type']) && $value['type'] == 'file') :
832 831
 
833
-            if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
834 832
 
835
-                if (get_option($value['id'])) {
836
-                    $image_name_arr = explode('/', get_option($value['id']));
837
-                    $noimg_name = end($image_name_arr);
838
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
839
-                    if (file_exists($img_path))
840
-                        unlink($img_path);
841
-                }
833
+			if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
842 834
 
843
-                update_option($value['id'], '');
844
-            }
835
+				if (get_option($value['id'])) {
836
+					$image_name_arr = explode('/', get_option($value['id']));
837
+					$noimg_name = end($image_name_arr);
838
+					$img_path = $uploads['path'] . '/' . $noimg_name;
839
+					if (file_exists($img_path))
840
+						unlink($img_path);
841
+				}
845 842
 
846
-            $uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
847
-            $filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
848
-
849
-            if (!empty($filename)):
850
-                $ext = pathinfo($filename, PATHINFO_EXTENSION);
851
-                $uplaods = array();
852
-
853
-                foreach ($uploadedfile as $key => $uplaod):
854
-                    if ($key == 'name'):
855
-                        $uplaods[$key] = $filename;
856
-                    else :
857
-                        $uplaods[$key] = $uplaod;
858
-                    endif;
859
-                endforeach;
860
-
861
-                $uploads = wp_upload_dir();
862
-
863
-                if (get_option($value['id'])) {
864
-                    $image_name_arr = explode('/', get_option($value['id']));
865
-                    $noimg_name = end($image_name_arr);
866
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
867
-                    if (file_exists($img_path))
868
-                        unlink($img_path);
869
-                }
843
+				update_option($value['id'], '');
844
+			}
845
+
846
+			$uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
847
+			$filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
848
+
849
+			if (!empty($filename)):
850
+				$ext = pathinfo($filename, PATHINFO_EXTENSION);
851
+				$uplaods = array();
852
+
853
+				foreach ($uploadedfile as $key => $uplaod):
854
+					if ($key == 'name'):
855
+						$uplaods[$key] = $filename;
856
+					else :
857
+						$uplaods[$key] = $uplaod;
858
+					endif;
859
+				endforeach;
860
+
861
+				$uploads = wp_upload_dir();
862
+
863
+				if (get_option($value['id'])) {
864
+					$image_name_arr = explode('/', get_option($value['id']));
865
+					$noimg_name = end($image_name_arr);
866
+					$img_path = $uploads['path'] . '/' . $noimg_name;
867
+					if (file_exists($img_path))
868
+						unlink($img_path);
869
+				}
870 870
 
871
-                $upload_overrides = array('test_form' => false);
872
-                $movefile = wp_handle_upload($uplaods, $upload_overrides);
871
+				$upload_overrides = array('test_form' => false);
872
+				$movefile = wp_handle_upload($uplaods, $upload_overrides);
873 873
 
874
-                update_option($value['id'], $movefile['url']);
874
+				update_option($value['id'], $movefile['url']);
875 875
 
876
-            endif;
876
+			endif;
877 877
 
878
-            if (!get_option($value['id']) && isset($value['value'])):
879
-                update_option($value['id'], $value['value']);
880
-            endif;
878
+			if (!get_option($value['id']) && isset($value['value'])):
879
+				update_option($value['id'], $value['value']);
880
+			endif;
881 881
 
882 882
 
883
-        else :
884
-            // same menu setting per theme.
885
-            if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
886
-                $theme = wp_get_theme();
887
-                update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
888
-            }
883
+		else :
884
+			// same menu setting per theme.
885
+			if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
886
+				$theme = wp_get_theme();
887
+				update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
888
+			}
889 889
 
890
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
891
-                update_option($value['id'], $_POST[$value['id']]);
892
-            } else {
893
-                delete_option($value['id']);
894
-            }
890
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
891
+				update_option($value['id'], $_POST[$value['id']]);
892
+			} else {
893
+				delete_option($value['id']);
894
+			}
895 895
 
896
-        endif;
897
-    }
898
-    if ($dummy)
899
-        unset($_POST);
900
-    return true;
896
+		endif;
897
+	}
898
+	if ($dummy)
899
+		unset($_POST);
900
+	return true;
901 901
 
902 902
 }
903 903
 
@@ -946,33 +946,33 @@  discard block
 block discarded – undo
946 946
 function places_custom_fields_tab($tabs)
947 947
 {
948 948
 
949
-    $geodir_post_types = get_option('geodir_post_types');
949
+	$geodir_post_types = get_option('geodir_post_types');
950 950
 
951
-    if (!empty($geodir_post_types)) {
951
+	if (!empty($geodir_post_types)) {
952 952
 
953
-        foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
953
+		foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
954 954
 
955
-            $listing_slug = $geodir_posttype_info['labels']['singular_name'];
955
+			$listing_slug = $geodir_posttype_info['labels']['singular_name'];
956 956
 
957
-            $tabs[$geodir_post_type . '_fields_settings'] = array(
958
-                'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'),
959
-                'subtabs' => array(
960
-                    array('subtab' => 'custom_fields',
961
-                        'label' => __('Custom Fields', 'geodirectory'),
962
-                        'request' => array('listing_type' => $geodir_post_type)),
963
-                    array('subtab' => 'sorting_options',
964
-                        'label' => __('Sorting Options', 'geodirectory'),
965
-                        'request' => array('listing_type' => $geodir_post_type)),
966
-                ),
967
-                'tab_index' => 9,
968
-                'request' => array('listing_type' => $geodir_post_type)
969
-            );
957
+			$tabs[$geodir_post_type . '_fields_settings'] = array(
958
+				'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'),
959
+				'subtabs' => array(
960
+					array('subtab' => 'custom_fields',
961
+						'label' => __('Custom Fields', 'geodirectory'),
962
+						'request' => array('listing_type' => $geodir_post_type)),
963
+					array('subtab' => 'sorting_options',
964
+						'label' => __('Sorting Options', 'geodirectory'),
965
+						'request' => array('listing_type' => $geodir_post_type)),
966
+				),
967
+				'tab_index' => 9,
968
+				'request' => array('listing_type' => $geodir_post_type)
969
+			);
970 970
 
971
-        endforeach;
971
+		endforeach;
972 972
 
973
-    }
973
+	}
974 974
 
975
-    return $tabs;
975
+	return $tabs;
976 976
 }
977 977
 
978 978
 
@@ -988,8 +988,8 @@  discard block
 block discarded – undo
988 988
  */
989 989
 function geodir_tools_setting_tab($tabs)
990 990
 {
991
-    $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
992
-    return $tabs;
991
+	$tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
992
+	return $tabs;
993 993
 }
994 994
 
995 995
 /**
@@ -1004,8 +1004,8 @@  discard block
 block discarded – undo
1004 1004
  */
1005 1005
 function geodir_compatibility_setting_tab($tabs)
1006 1006
 {
1007
-    $tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
1008
-    return $tabs;
1007
+	$tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
1008
+	return $tabs;
1009 1009
 }
1010 1010
 
1011 1011
 
@@ -1021,144 +1021,144 @@  discard block
 block discarded – undo
1021 1021
  */
1022 1022
 function geodir_extend_geodirectory_setting_tab($tabs)
1023 1023
 {
1024
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1025
-    return $tabs;
1024
+	$tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1025
+	return $tabs;
1026 1026
 }
1027 1027
 
1028 1028
 
1029 1029
 if (!function_exists('geodir_edit_post_columns')) {
1030
-    /**
1031
-     * Modify admin post listing page columns.
1032
-     *
1033
-     * @since 1.0.0
1034
-     * @package GeoDirectory
1035
-     * @param array $columns The column array.
1036
-     * @return array Altered column array.
1037
-     */
1038
-    function geodir_edit_post_columns($columns)
1039
-    {
1040
-
1041
-        $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1042
-            'categorys' => __('Categories', 'geodirectory'));
1043
-
1044
-        if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
1045
-        {
1046
-            $offset = 0; // should we prepend $array with $data?
1047
-            $offset = count($columns); // or should we append $array with $data? lets pick this one...
1048
-        }
1030
+	/**
1031
+	 * Modify admin post listing page columns.
1032
+	 *
1033
+	 * @since 1.0.0
1034
+	 * @package GeoDirectory
1035
+	 * @param array $columns The column array.
1036
+	 * @return array Altered column array.
1037
+	 */
1038
+	function geodir_edit_post_columns($columns)
1039
+	{
1049 1040
 
1050
-        $columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
1041
+		$new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1042
+			'categorys' => __('Categories', 'geodirectory'));
1051 1043
 
1052
-        $columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
1044
+		if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
1045
+		{
1046
+			$offset = 0; // should we prepend $array with $data?
1047
+			$offset = count($columns); // or should we append $array with $data? lets pick this one...
1048
+		}
1053 1049
 
1054
-        return $columns;
1055
-    }
1050
+		$columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
1051
+
1052
+		$columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
1053
+
1054
+		return $columns;
1055
+	}
1056 1056
 }
1057 1057
 
1058 1058
 
1059 1059
 if (!function_exists('geodir_manage_post_columns')) {
1060
-    /**
1061
-     * Adds content to our custom post listing page columns.
1062
-     *
1063
-     * @since 1.0.0
1064
-     * @package GeoDirectory
1065
-     * @global object $wpdb WordPress Database object.
1066
-     * @global object $post WordPress Post object.
1067
-     * @param string $column The column name.
1068
-     * @param int $post_id The post ID.
1069
-     */
1070
-    function geodir_manage_post_columns($column, $post_id)
1071
-    {
1072
-        global $post, $wpdb;
1073
-
1074
-        switch ($column):
1075
-            /* If displaying the 'city' column. */
1076
-            case 'location' :
1077
-                $location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
1078
-                $location = geodir_get_location($location_id);
1079
-                /* If no city is found, output a default message. */
1080
-                if (empty($location)) {
1081
-                    _e('Unknown', 'geodirectory');
1082
-                } else {
1083
-                    /* If there is a city id, append 'city name' to the text string. */
1084
-                    $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
1085
-                    echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
1086
-                }
1087
-                break;
1088
-
1089
-            /* If displaying the 'expire' column. */
1090
-            case 'expire' :
1091
-                $expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
1092
-                $d1 = $expire_date; // get expire_date
1093
-                $d2 = date('Y-m-d'); // get current date
1094
-                $state = __('days left', 'geodirectory');
1095
-                $date_diff_text = '';
1096
-                $expire_class = 'expire_left';
1097
-                if ($expire_date != 'Never') {
1098
-                    if (strtotime($d1) < strtotime($d2)) {
1099
-                        $state = __('days overdue', 'geodirectory');
1100
-                        $expire_class = 'expire_over';
1101
-                    }
1102
-                    $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the differance in days
1103
-                    $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1104
-                }
1105
-                /* If no expire_date is found, output a default message. */
1106
-                if (empty($expire_date))
1107
-                    echo __('Unknown', 'geodirectory');
1108
-                /* If there is a expire_date, append 'days left' to the text string. */
1109
-                else
1110
-                    echo $expire_date . $date_diff_text;
1111
-                break;
1112
-
1113
-            /* If displaying the 'categorys' column. */
1114
-            case 'categorys' :
1115
-
1116
-                /* Get the categorys for the post. */
1117
-
1118
-
1119
-                $terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
1120
-
1121
-                /* If terms were found. */
1122
-                if (!empty($terms)) {
1123
-                    $out = array();
1124
-                    /* Loop through each term, linking to the 'edit posts' page for the specific term. */
1125
-                    foreach ($terms as $term) {
1126
-                        if (!strstr($term->taxonomy, 'tag')) {
1127
-                            $out[] = sprintf('<a href="%s">%s</a>',
1128
-                                esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
1129
-                                esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
1130
-                            );
1131
-                        }
1132
-                    }
1133
-                    /* Join the terms, separating them with a comma. */
1134
-                    echo(join(', ', $out));
1135
-                } /* If no terms were found, output a default message. */
1136
-                else {
1137
-                    _e('No Categories', 'geodirectory');
1138
-                }
1139
-                break;
1060
+	/**
1061
+	 * Adds content to our custom post listing page columns.
1062
+	 *
1063
+	 * @since 1.0.0
1064
+	 * @package GeoDirectory
1065
+	 * @global object $wpdb WordPress Database object.
1066
+	 * @global object $post WordPress Post object.
1067
+	 * @param string $column The column name.
1068
+	 * @param int $post_id The post ID.
1069
+	 */
1070
+	function geodir_manage_post_columns($column, $post_id)
1071
+	{
1072
+		global $post, $wpdb;
1073
+
1074
+		switch ($column):
1075
+			/* If displaying the 'city' column. */
1076
+			case 'location' :
1077
+				$location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
1078
+				$location = geodir_get_location($location_id);
1079
+				/* If no city is found, output a default message. */
1080
+				if (empty($location)) {
1081
+					_e('Unknown', 'geodirectory');
1082
+				} else {
1083
+					/* If there is a city id, append 'city name' to the text string. */
1084
+					$add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
1085
+					echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
1086
+				}
1087
+				break;
1088
+
1089
+			/* If displaying the 'expire' column. */
1090
+			case 'expire' :
1091
+				$expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
1092
+				$d1 = $expire_date; // get expire_date
1093
+				$d2 = date('Y-m-d'); // get current date
1094
+				$state = __('days left', 'geodirectory');
1095
+				$date_diff_text = '';
1096
+				$expire_class = 'expire_left';
1097
+				if ($expire_date != 'Never') {
1098
+					if (strtotime($d1) < strtotime($d2)) {
1099
+						$state = __('days overdue', 'geodirectory');
1100
+						$expire_class = 'expire_over';
1101
+					}
1102
+					$date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the differance in days
1103
+					$date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1104
+				}
1105
+				/* If no expire_date is found, output a default message. */
1106
+				if (empty($expire_date))
1107
+					echo __('Unknown', 'geodirectory');
1108
+				/* If there is a expire_date, append 'days left' to the text string. */
1109
+				else
1110
+					echo $expire_date . $date_diff_text;
1111
+				break;
1140 1112
 
1141
-        endswitch;
1142
-    }
1113
+			/* If displaying the 'categorys' column. */
1114
+			case 'categorys' :
1115
+
1116
+				/* Get the categorys for the post. */
1117
+
1118
+
1119
+				$terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
1120
+
1121
+				/* If terms were found. */
1122
+				if (!empty($terms)) {
1123
+					$out = array();
1124
+					/* Loop through each term, linking to the 'edit posts' page for the specific term. */
1125
+					foreach ($terms as $term) {
1126
+						if (!strstr($term->taxonomy, 'tag')) {
1127
+							$out[] = sprintf('<a href="%s">%s</a>',
1128
+								esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
1129
+								esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
1130
+							);
1131
+						}
1132
+					}
1133
+					/* Join the terms, separating them with a comma. */
1134
+					echo(join(', ', $out));
1135
+				} /* If no terms were found, output a default message. */
1136
+				else {
1137
+					_e('No Categories', 'geodirectory');
1138
+				}
1139
+				break;
1140
+
1141
+		endswitch;
1142
+	}
1143 1143
 }
1144 1144
 
1145 1145
 
1146 1146
 if (!function_exists('geodir_post_sortable_columns')) {
1147
-    /**
1148
-     * Makes admin post listing page columns sortable.
1149
-     *
1150
-     * @since 1.0.0
1151
-     * @package GeoDirectory
1152
-     * @param array $columns The column array.
1153
-     * @return array Altered column array.
1154
-     */
1155
-    function geodir_post_sortable_columns($columns)
1156
-    {
1157
-
1158
-        $columns['expire'] = 'expire';
1159
-
1160
-        return $columns;
1161
-    }
1147
+	/**
1148
+	 * Makes admin post listing page columns sortable.
1149
+	 *
1150
+	 * @since 1.0.0
1151
+	 * @package GeoDirectory
1152
+	 * @param array $columns The column array.
1153
+	 * @return array Altered column array.
1154
+	 */
1155
+	function geodir_post_sortable_columns($columns)
1156
+	{
1157
+
1158
+		$columns['expire'] = 'expire';
1159
+
1160
+		return $columns;
1161
+	}
1162 1162
 }
1163 1163
 
1164 1164
 /**
@@ -1172,49 +1172,49 @@  discard block
 block discarded – undo
1172 1172
  * @param int $post_id The post ID.
1173 1173
  */
1174 1174
 function geodir_post_information_save($post_id, $post) {
1175
-    global $wpdb, $current_user;
1175
+	global $wpdb, $current_user;
1176 1176
 
1177
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1178
-        return;
1179
-    }
1177
+	if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1178
+		return;
1179
+	}
1180 1180
 
1181
-    $geodir_posttypes = geodir_get_posttypes();
1181
+	$geodir_posttypes = geodir_get_posttypes();
1182 1182
 
1183
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
1184
-        return;
1183
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
1184
+		return;
1185 1185
 
1186
-    if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
1187
-        if (isset($_REQUEST['_status']))
1188
-            geodir_change_post_status($post_id, $_REQUEST['_status']);
1186
+	if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
1187
+		if (isset($_REQUEST['_status']))
1188
+			geodir_change_post_status($post_id, $_REQUEST['_status']);
1189 1189
 
1190
-        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
1191
-            return;
1190
+		if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
1191
+			return;
1192 1192
 
1193
-        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
1194
-            return;
1193
+		if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
1194
+			return;
1195 1195
 
1196
-        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
1197
-            return;
1196
+		if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
1197
+			return;
1198 1198
 
1199
-        geodir_save_listing($_REQUEST);
1200
-    }
1199
+		geodir_save_listing($_REQUEST);
1200
+	}
1201 1201
 }
1202 1202
 
1203 1203
 if (!function_exists('geodir_insert_csv_post_data') && get_option('geodir_installed')) {
1204
-    /**
1205
-     * Function to insert csv post data.
1206
-     *
1207
-     * @since 1.0.0
1208
-     * @package GeoDirectory
1209
-     * @global object $wpdb WordPress Database object.
1210
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1211
-     */
1212
-    function geodir_insert_csv_post_data()
1213
-    {
1214
-        global $wpdb, $plugin_prefix;
1215
-
1216
-        $svalue = '';
1217
-        ?>
1204
+	/**
1205
+	 * Function to insert csv post data.
1206
+	 *
1207
+	 * @since 1.0.0
1208
+	 * @package GeoDirectory
1209
+	 * @global object $wpdb WordPress Database object.
1210
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1211
+	 */
1212
+	function geodir_insert_csv_post_data()
1213
+	{
1214
+		global $wpdb, $plugin_prefix;
1215
+
1216
+		$svalue = '';
1217
+		?>
1218 1218
         <script type="text/javascript">
1219 1219
             jQuery(document).ready(function () {
1220 1220
                 jQuery("#import_data").click(function () {
@@ -1254,50 +1254,50 @@  discard block
 block discarded – undo
1254 1254
         </script>
1255 1255
         <?php
1256 1256
 
1257
-        if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] == 'csv_upload_settings') {
1258
-            if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'success') {
1259
-                $rowcount = (int)$_REQUEST['rowcount'];
1260
-                $uploads = wp_upload_dir();
1261
-                ?>
1257
+		if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] == 'csv_upload_settings') {
1258
+			if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'success') {
1259
+				$rowcount = (int)$_REQUEST['rowcount'];
1260
+				$uploads = wp_upload_dir();
1261
+				?>
1262 1262
                 <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204); margin-left:0px; margin-top:0px; margin-bottom:10px;">
1263 1263
                 <?php
1264
-                    if ($_REQUEST['invalidcount'] == 0 && $_REQUEST['blank_address'] == 0 && $_REQUEST['invalid_post_type'] == 0 && $_REQUEST['invalid_title'] == 0) {
1265
-                        echo '<p>' . CSV_INSERT_DATA . '</p>';
1266
-                    }
1267
-                    echo '<p>';
1268
-                    printf(CSV_TOTAL_RECORD, $rowcount);
1269
-                    echo '</p>';
1270
-
1271
-                    if (isset($_REQUEST['invalidcount']) && $_REQUEST['invalidcount'] > 0) {
1272
-                        echo '<p>';
1273
-                        printf(CSV_INVALID_DEFUALT_ADDRESS, (int)$_REQUEST['invalidcount'], (int)$_REQUEST['total_records']);
1274
-                        echo '</p>';
1275
-                    }
1264
+					if ($_REQUEST['invalidcount'] == 0 && $_REQUEST['blank_address'] == 0 && $_REQUEST['invalid_post_type'] == 0 && $_REQUEST['invalid_title'] == 0) {
1265
+						echo '<p>' . CSV_INSERT_DATA . '</p>';
1266
+					}
1267
+					echo '<p>';
1268
+					printf(CSV_TOTAL_RECORD, $rowcount);
1269
+					echo '</p>';
1270
+
1271
+					if (isset($_REQUEST['invalidcount']) && $_REQUEST['invalidcount'] > 0) {
1272
+						echo '<p>';
1273
+						printf(CSV_INVALID_DEFUALT_ADDRESS, (int)$_REQUEST['invalidcount'], (int)$_REQUEST['total_records']);
1274
+						echo '</p>';
1275
+					}
1276 1276
 
1277
-                    if (isset($_REQUEST['blank_address']) && $_REQUEST['blank_address'] > 0) {
1278
-                        echo '<p>';
1279
-                        printf(CSV_INVALID_TOTAL_RECORD, (int)$_REQUEST['blank_address'], (int)$_REQUEST['total_records']);
1280
-                        echo '</p>';
1281
-                    }
1277
+					if (isset($_REQUEST['blank_address']) && $_REQUEST['blank_address'] > 0) {
1278
+						echo '<p>';
1279
+						printf(CSV_INVALID_TOTAL_RECORD, (int)$_REQUEST['blank_address'], (int)$_REQUEST['total_records']);
1280
+						echo '</p>';
1281
+					}
1282 1282
 
1283
-                    if (isset($_REQUEST['invalid_post_type']) && $_REQUEST['invalid_post_type'] > 0) {
1284
-                        echo '<p>';
1285
-                        printf(CSV_INVALID_POST_TYPE, (int)$_REQUEST['invalid_post_type'], (int)$_REQUEST['total_records']);
1286
-                        echo '</p>';
1287
-                    }
1283
+					if (isset($_REQUEST['invalid_post_type']) && $_REQUEST['invalid_post_type'] > 0) {
1284
+						echo '<p>';
1285
+						printf(CSV_INVALID_POST_TYPE, (int)$_REQUEST['invalid_post_type'], (int)$_REQUEST['total_records']);
1286
+						echo '</p>';
1287
+					}
1288 1288
 
1289
-                    if (isset($_REQUEST['invalid_title']) && $_REQUEST['invalid_title'] > 0) {
1290
-                        echo '<p>';
1291
-                        printf(CSV_BLANK_POST_TITLE, (int)$_REQUEST['invalid_title'], (int)$_REQUEST['total_records']);
1292
-                        echo '</p>';
1293
-                    }
1289
+					if (isset($_REQUEST['invalid_title']) && $_REQUEST['invalid_title'] > 0) {
1290
+						echo '<p>';
1291
+						printf(CSV_BLANK_POST_TITLE, (int)$_REQUEST['invalid_title'], (int)$_REQUEST['total_records']);
1292
+						echo '</p>';
1293
+					}
1294 1294
 
1295
-                    if (isset($_REQUEST['upload_files']) && $_REQUEST['upload_files'] > 0) {
1296
-                        echo '<p>';
1297
-                        printf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir']);
1298
-                        echo '</p>';
1299
-                    }
1300
-                    ?>
1295
+					if (isset($_REQUEST['upload_files']) && $_REQUEST['upload_files'] > 0) {
1296
+						echo '<p>';
1297
+						printf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir']);
1298
+						echo '</p>';
1299
+					}
1300
+					?>
1301 1301
                 </div>
1302 1302
             <?php } ?>
1303 1303
             <?php if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'wrong') { ?>
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
                     <p><?php echo CSV_UPLOAD_ONLY; ?></p>
1313 1313
                 </div>
1314 1314
             <?php }
1315
-        } ?>
1315
+		} ?>
1316 1316
         <?php /* ?>
1317 1317
     <table class="form-table">
1318 1318
         <tbody>
@@ -1350,10 +1350,10 @@  discard block
 block discarded – undo
1350 1350
     </table>
1351 1351
 	<?php */ ?>
1352 1352
         <?php
1353
-        $id = "gd_import_csv";
1354
-        $multiple = false; // allow multiple files upload
1355
-        $uploads = wp_upload_dir();
1356
-        ?>
1353
+		$id = "gd_import_csv";
1354
+		$multiple = false; // allow multiple files upload
1355
+		$uploads = wp_upload_dir();
1356
+		?>
1357 1357
         <style>
1358 1358
             .gd-csv-form-table .filelist div.file:last-child {
1359 1359
                 display: block !important;
@@ -1711,12 +1711,12 @@  discard block
 block discarded – undo
1711 1711
                                 <br/>
1712 1712
                                 <a href="<?php echo geodir_plugin_url() . '/geodirectory-assets/place_listing.csv'?>"><?php _e("Download sample csv", 'geodirectory')?></a>
1713 1713
                                 <?php
1714
-                                /**
1715
-                                 * Called just after the sample CSV download link.
1716
-                                 *
1717
-                                 * @since 1.0.0
1718
-                                 */
1719
-                                do_action('geodir_sample_csv_download_link'); ?>
1714
+								/**
1715
+								 * Called just after the sample CSV download link.
1716
+								 *
1717
+								 * @since 1.0.0
1718
+								 */
1719
+								do_action('geodir_sample_csv_download_link'); ?>
1720 1720
                                 <span class="ajaxnonceplu"
1721 1721
                                       id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span><br/>
1722 1722
                                 <br/>
@@ -1775,362 +1775,362 @@  discard block
 block discarded – undo
1775 1775
 }
1776 1776
 
1777 1777
 if (!function_exists('geodir_import_data')) {
1778
-    /**
1779
-     * Imports data from csv file.
1780
-     *
1781
-     * @since 1.0.0
1782
-     * @package GeoDirectory
1783
-     * @global object $wpdb WordPress Database object.
1784
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1785
-     * @global object $current_user Current user object.
1786
-     */
1787
-    function geodir_import_data()
1788
-    {
1778
+	/**
1779
+	 * Imports data from csv file.
1780
+	 *
1781
+	 * @since 1.0.0
1782
+	 * @package GeoDirectory
1783
+	 * @global object $wpdb WordPress Database object.
1784
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1785
+	 * @global object $current_user Current user object.
1786
+	 */
1787
+	function geodir_import_data()
1788
+	{
1789 1789
 
1790
-        global $wpdb, $plugin_prefix, $current_user;
1790
+		global $wpdb, $plugin_prefix, $current_user;
1791 1791
 
1792
-        if (isset($_REQUEST['geodir_import_data']) && !empty($_REQUEST['geodir_import_data'])) {
1793
-            $uploads = wp_upload_dir();
1794
-            $uploads_dir = $uploads['path'];
1792
+		if (isset($_REQUEST['geodir_import_data']) && !empty($_REQUEST['geodir_import_data'])) {
1793
+			$uploads = wp_upload_dir();
1794
+			$uploads_dir = $uploads['path'];
1795 1795
 
1796
-            $curr_img_url = $_REQUEST['filename'];
1796
+			$curr_img_url = $_REQUEST['filename'];
1797 1797
 
1798
-            $image_name_arr = explode('/', $curr_img_url);
1798
+			$image_name_arr = explode('/', $curr_img_url);
1799 1799
 
1800
-            $filename = end($image_name_arr);
1800
+			$filename = end($image_name_arr);
1801 1801
 
1802
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1802
+			$target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1803 1803
 
1804
-            $destination_path = $uploads_dir . '/temp_' . $current_user->data->ID;
1804
+			$destination_path = $uploads_dir . '/temp_' . $current_user->data->ID;
1805 1805
 
1806
-            $csv_target_path = $target_path;
1806
+			$csv_target_path = $target_path;
1807 1807
 
1808
-            ini_set('auto_detect_line_endings', true);
1808
+			ini_set('auto_detect_line_endings', true);
1809 1809
 
1810
-            $fd = fopen($target_path, "rt");
1810
+			$fd = fopen($target_path, "rt");
1811 1811
 
1812
-            $total_records = 0;
1813
-            $rowcount = 0;
1814
-            $address_invalid = 0;
1815
-            $blank_address = 0;
1816
-            $upload_files = 0;
1817
-            $invalid_post_type = 0;
1818
-            $invalid_title = 0;
1812
+			$total_records = 0;
1813
+			$rowcount = 0;
1814
+			$address_invalid = 0;
1815
+			$blank_address = 0;
1816
+			$upload_files = 0;
1817
+			$invalid_post_type = 0;
1818
+			$invalid_title = 0;
1819 1819
 
1820
-            $customKeyarray = array();
1820
+			$customKeyarray = array();
1821 1821
 
1822
-            $gd_post_info = array();
1822
+			$gd_post_info = array();
1823 1823
 
1824
-            $post_location = array();
1825
-            $countpost = 0;
1824
+			$post_location = array();
1825
+			$countpost = 0;
1826 1826
 
1827
-            $uploaded_file_type = pathinfo($filename, PATHINFO_EXTENSION);
1827
+			$uploaded_file_type = pathinfo($filename, PATHINFO_EXTENSION);
1828 1828
 
1829
-            $extensionarr = array('csv', 'CSV');
1829
+			$extensionarr = array('csv', 'CSV');
1830 1830
 
1831
-            if (in_array($uploaded_file_type, $extensionarr)) {
1831
+			if (in_array($uploaded_file_type, $extensionarr)) {
1832 1832
 
1833
-                while (!feof($fd)) {
1834
-                    $buffer = fgetcsv($fd, 40960);
1833
+				while (!feof($fd)) {
1834
+					$buffer = fgetcsv($fd, 40960);
1835 1835
 
1836
-                    if ($rowcount == 0) {
1837
-                        for ($k = 0; $k < count($buffer); $k++) {
1838
-                            $customKeyarray[$k] = $buffer[$k];
1839
-                        }
1836
+					if ($rowcount == 0) {
1837
+						for ($k = 0; $k < count($buffer); $k++) {
1838
+							$customKeyarray[$k] = $buffer[$k];
1839
+						}
1840 1840
 
1841
-                        if ($customKeyarray[0] == '') {
1842
-                            echo $geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=csv_upload_settings&emsg=wrong';
1843
-                            exit;
1844
-                        }
1845
-                    } elseif (!empty($buffer)) {
1846
-
1847
-                        $total_records++;
1848
-
1849
-                        $post_title = addslashes($buffer[0]);
1850
-                        $current_post_author = $buffer[1];
1851
-                        $post_desc = addslashes($buffer[2]);
1852
-                        $post_cat = array();
1853
-                        $catids_arr = array();
1854
-                        $post_cat = trim($buffer[3]); // comma seperated category name
1855
-
1856
-                        if ($post_cat) {
1857
-                            $post_cat_arr = explode(',', $post_cat);
1858
-
1859
-                            for ($c = 0; $c < count($post_cat_arr); $c++) {
1860
-                                $catid = wp_kses_normalize_entities(trim($post_cat_arr[$c]));
1861
-                                if (!empty($buffer[5])) {
1862
-                                    if (in_array($buffer[5], geodir_get_posttypes())) {
1863
-                                        $p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5]));
1864
-                                        if (get_term_by('name', $catid, $p_taxonomy[0])) {
1865
-                                            $cat = get_term_by('name', $catid, $p_taxonomy[0]);
1866
-                                            $catids_arr[] = $cat->slug;
1867
-                                        } elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
1868
-                                            $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
1869
-                                            $catids_arr[] = $cat->slug;
1870
-                                        }
1871
-                                    }
1872
-                                }
1873
-                            }
1874
-                        }
1841
+						if ($customKeyarray[0] == '') {
1842
+							echo $geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=csv_upload_settings&emsg=wrong';
1843
+							exit;
1844
+						}
1845
+					} elseif (!empty($buffer)) {
1846
+
1847
+						$total_records++;
1848
+
1849
+						$post_title = addslashes($buffer[0]);
1850
+						$current_post_author = $buffer[1];
1851
+						$post_desc = addslashes($buffer[2]);
1852
+						$post_cat = array();
1853
+						$catids_arr = array();
1854
+						$post_cat = trim($buffer[3]); // comma seperated category name
1855
+
1856
+						if ($post_cat) {
1857
+							$post_cat_arr = explode(',', $post_cat);
1858
+
1859
+							for ($c = 0; $c < count($post_cat_arr); $c++) {
1860
+								$catid = wp_kses_normalize_entities(trim($post_cat_arr[$c]));
1861
+								if (!empty($buffer[5])) {
1862
+									if (in_array($buffer[5], geodir_get_posttypes())) {
1863
+										$p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5]));
1864
+										if (get_term_by('name', $catid, $p_taxonomy[0])) {
1865
+											$cat = get_term_by('name', $catid, $p_taxonomy[0]);
1866
+											$catids_arr[] = $cat->slug;
1867
+										} elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
1868
+											$cat = get_term_by('slug', $catid, $p_taxonomy[0]);
1869
+											$catids_arr[] = $cat->slug;
1870
+										}
1871
+									}
1872
+								}
1873
+							}
1874
+						}
1875 1875
 
1876
-                        if (!$catids_arr) {
1877
-                            $catids_arr[] = 1;
1878
-                        }
1876
+						if (!$catids_arr) {
1877
+							$catids_arr[] = 1;
1878
+						}
1879 1879
 
1880
-                        $post_tags = trim($buffer[4]); // comma seperated tags
1880
+						$post_tags = trim($buffer[4]); // comma seperated tags
1881 1881
 
1882
-                        $tag_arr = '';
1883
-                        if ($post_tags) {
1882
+						$tag_arr = '';
1883
+						if ($post_tags) {
1884 1884
 
1885
-                            $tag_arr = explode(',', $post_tags);
1886
-                        }
1885
+							$tag_arr = explode(',', $post_tags);
1886
+						}
1887 1887
 
1888
-                        $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database
1888
+						$table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database
1889 1889
 
1890
-                        $error = '';
1891
-                        if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
1890
+						$error = '';
1891
+						if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
1892 1892
 
1893
-                            $invalid_post_type++;
1894
-                            continue;
1893
+							$invalid_post_type++;
1894
+							continue;
1895 1895
 
1896
-                        }
1896
+						}
1897 1897
 
1898
-                        if ($post_title != '') {
1898
+						if ($post_title != '') {
1899 1899
 
1900
-                            $menu_order = 0;
1900
+							$menu_order = 0;
1901 1901
 
1902
-                            $image_folder_name = 'uplaod/';
1902
+							$image_folder_name = 'uplaod/';
1903 1903
 
1904
-                            $image_names = array();
1904
+							$image_names = array();
1905 1905
 
1906
-                            for ($c = 5; $c < count($customKeyarray); $c++) {
1907
-                                $gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]);
1906
+							for ($c = 5; $c < count($customKeyarray); $c++) {
1907
+								$gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]);
1908 1908
 
1909
-                                if ($customKeyarray[$c] == 'IMAGE') {
1910
-                                    $buffer[$c] = trim($buffer[$c]);
1911
-                                    if (!empty($buffer[$c])) {
1912
-                                        $image_names[] = $buffer[$c];
1913
-                                    }
1909
+								if ($customKeyarray[$c] == 'IMAGE') {
1910
+									$buffer[$c] = trim($buffer[$c]);
1911
+									if (!empty($buffer[$c])) {
1912
+										$image_names[] = $buffer[$c];
1913
+									}
1914 1914
 
1915
-                                }
1915
+								}
1916 1916
 
1917
-                                if ($customKeyarray[$c] == 'alive_days') {
1918
-                                    if ($buffer[$c] != '0' && $buffer[$c] != '') {
1919
-                                        $submitdata = date('Y-m-d');
1920
-                                        $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
1921
-                                    } else {
1922
-                                        $gd_post_info['expire_date'] = 'Never';
1923
-                                    }
1924
-                                }
1917
+								if ($customKeyarray[$c] == 'alive_days') {
1918
+									if ($buffer[$c] != '0' && $buffer[$c] != '') {
1919
+										$submitdata = date('Y-m-d');
1920
+										$gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
1921
+									} else {
1922
+										$gd_post_info['expire_date'] = 'Never';
1923
+									}
1924
+								}
1925 1925
 
1926 1926
 
1927
-                                if ($customKeyarray[$c] == 'post_city') {
1928
-                                    $post_city = addslashes($buffer[$c]);
1929
-                                }
1927
+								if ($customKeyarray[$c] == 'post_city') {
1928
+									$post_city = addslashes($buffer[$c]);
1929
+								}
1930 1930
 
1931
-                                if ($customKeyarray[$c] == 'post_region') {
1932
-                                    $post_region = addslashes($buffer[$c]);
1933
-                                }
1931
+								if ($customKeyarray[$c] == 'post_region') {
1932
+									$post_region = addslashes($buffer[$c]);
1933
+								}
1934 1934
 
1935
-                                if ($customKeyarray[$c] == 'post_country') {
1936
-                                    $post_country = addslashes($buffer[$c]);
1937
-                                }
1935
+								if ($customKeyarray[$c] == 'post_country') {
1936
+									$post_country = addslashes($buffer[$c]);
1937
+								}
1938 1938
 
1939
-                                if ($customKeyarray[$c] == 'post_latitude') {
1940
-                                    $post_latitude = addslashes($buffer[$c]);
1941
-                                }
1939
+								if ($customKeyarray[$c] == 'post_latitude') {
1940
+									$post_latitude = addslashes($buffer[$c]);
1941
+								}
1942 1942
 
1943
-                                if ($customKeyarray[$c] == 'post_longitude') {
1944
-                                    $post_longitude = addslashes($buffer[$c]);
1945
-                                }
1943
+								if ($customKeyarray[$c] == 'post_longitude') {
1944
+									$post_longitude = addslashes($buffer[$c]);
1945
+								}
1946 1946
 
1947
-                            }
1947
+							}
1948 1948
 
1949
-                            /* ================ before array create ============== */
1949
+							/* ================ before array create ============== */
1950 1950
 
1951
-                            $location_result = geodir_get_default_location();
1951
+							$location_result = geodir_get_default_location();
1952 1952
 
1953
-                            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'] == '')) {
1953
+							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'] == '')) {
1954 1954
 
1955
-                                $blank_address++;
1956
-                                continue;
1955
+								$blank_address++;
1956
+								continue;
1957 1957
 
1958
-                            } elseif ($location_result->location_id == 0) {
1958
+							} elseif ($location_result->location_id == 0) {
1959 1959
 
1960
-                                if ((geodir_strtolower($gd_post_info['post_city']) != geodir_strtolower($location_result->city)) ||
1961
-                                    (geodir_strtolower($gd_post_info['post_region']) != geodir_strtolower($location_result->region)) ||
1962
-                                    (geodir_strtolower($gd_post_info['post_country']) != geodir_strtolower($location_result->country))
1963
-                                ) {
1960
+								if ((geodir_strtolower($gd_post_info['post_city']) != geodir_strtolower($location_result->city)) ||
1961
+									(geodir_strtolower($gd_post_info['post_region']) != geodir_strtolower($location_result->region)) ||
1962
+									(geodir_strtolower($gd_post_info['post_country']) != geodir_strtolower($location_result->country))
1963
+								) {
1964 1964
 
1965
-                                    $address_invalid++;
1966
-                                    continue;
1965
+									$address_invalid++;
1966
+									continue;
1967 1967
 
1968
-                                }
1968
+								}
1969 1969
 
1970
-                            }
1970
+							}
1971 1971
 
1972 1972
 
1973
-                            $my_post['post_title'] = $post_title;
1974
-                            $my_post['post_content'] = $post_desc;
1975
-                            $my_post['post_type'] = addslashes($buffer[5]);
1976
-                            $my_post['post_author'] = $current_post_author;
1977
-                            $my_post['post_status'] = 'publish';
1978
-                            $my_post['post_category'] = $catids_arr;
1979
-                            $my_post['post_tags'] = $tag_arr;
1973
+							$my_post['post_title'] = $post_title;
1974
+							$my_post['post_content'] = $post_desc;
1975
+							$my_post['post_type'] = addslashes($buffer[5]);
1976
+							$my_post['post_author'] = $current_post_author;
1977
+							$my_post['post_status'] = 'publish';
1978
+							$my_post['post_category'] = $catids_arr;
1979
+							$my_post['post_tags'] = $tag_arr;
1980 1980
 
1981 1981
 
1982
-                            $gd_post_info['post_tags'] = $tag_arr;
1983
-                            $gd_post_info['post_title'] = $post_title;
1984
-                            $gd_post_info['post_status'] = 'publish';
1985
-                            $gd_post_info['submit_time'] = time();
1986
-                            $gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR'];
1982
+							$gd_post_info['post_tags'] = $tag_arr;
1983
+							$gd_post_info['post_title'] = $post_title;
1984
+							$gd_post_info['post_status'] = 'publish';
1985
+							$gd_post_info['submit_time'] = time();
1986
+							$gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR'];
1987 1987
 
1988 1988
 
1989
-                            $last_postid = wp_insert_post($my_post);
1990
-                            $countpost++;
1989
+							$last_postid = wp_insert_post($my_post);
1990
+							$countpost++;
1991 1991
 
1992 1992
 
1993
-                            // Check if we need to save post location as new location
1993
+							// Check if we need to save post location as new location
1994 1994
 
1995
-                            if ($location_result->location_id > 0) {
1996
-                                if (isset($post_city) && isset($post_region)) {
1995
+							if ($location_result->location_id > 0) {
1996
+								if (isset($post_city) && isset($post_region)) {
1997 1997
 
1998
-                                    $request_info['post_location'] = array('city' => $post_city,
1999
-                                        'region' => $post_region,
2000
-                                        'country' => $post_country,
2001
-                                        'geo_lat' => $post_latitude,
2002
-                                        'geo_lng' => $post_longitude);
1998
+									$request_info['post_location'] = array('city' => $post_city,
1999
+										'region' => $post_region,
2000
+										'country' => $post_country,
2001
+										'geo_lat' => $post_latitude,
2002
+										'geo_lng' => $post_longitude);
2003 2003
 
2004
-                                    $post_location_info = $request_info['post_location'];
2005
-                                    if ($location_id = geodir_add_new_location($post_location_info))
2006
-                                        $post_location_id = $location_id;
2004
+									$post_location_info = $request_info['post_location'];
2005
+									if ($location_id = geodir_add_new_location($post_location_info))
2006
+										$post_location_id = $location_id;
2007 2007
 
2008
-                                } else {
2009
-                                    $post_location_id = 0;
2010
-                                }
2011
-                            } else {
2012
-                                $post_location_id = 0;
2013
-                            }
2008
+								} else {
2009
+									$post_location_id = 0;
2010
+								}
2011
+							} else {
2012
+								$post_location_id = 0;
2013
+							}
2014 2014
 
2015
-                            /* ------- get default package info ----- */
2016
-                            $payment_info = array();
2017
-                            $package_info = array();
2015
+							/* ------- get default package info ----- */
2016
+							$payment_info = array();
2017
+							$package_info = array();
2018 2018
 
2019
-                            $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
2020
-                            $package_id = '';
2021
-                            if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
2022
-                                $package_id = $gd_post_info['package_id'];
2023
-                            }
2019
+							$package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
2020
+							$package_id = '';
2021
+							if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
2022
+								$package_id = $gd_post_info['package_id'];
2023
+							}
2024 2024
 
2025
-                            if (!empty($package_info)) {
2026
-                                $payment_info['package_id'] = $package_info['pid'];
2027
-                                if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
2028
-                                    $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
2029
-                                } else {
2030
-                                    $payment_info['expire_date'] = 'Never';
2031
-                                }
2025
+							if (!empty($package_info)) {
2026
+								$payment_info['package_id'] = $package_info['pid'];
2027
+								if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
2028
+									$payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
2029
+								} else {
2030
+									$payment_info['expire_date'] = 'Never';
2031
+								}
2032 2032
 
2033
-                                $gd_post_info = array_merge($gd_post_info, $payment_info);
2034
-                            }
2033
+								$gd_post_info = array_merge($gd_post_info, $payment_info);
2034
+							}
2035 2035
 
2036 2036
 
2037
-                            $gd_post_info['post_location_id'] = $post_location_id;
2037
+							$gd_post_info['post_location_id'] = $post_location_id;
2038 2038
 
2039
-                            $post_type = get_post_type($last_postid);
2039
+							$post_type = get_post_type($last_postid);
2040 2040
 
2041
-                            $table = $plugin_prefix . $post_type . '_detail';
2041
+							$table = $plugin_prefix . $post_type . '_detail';
2042 2042
 
2043
-                            geodir_save_post_info($last_postid, $gd_post_info);
2043
+							geodir_save_post_info($last_postid, $gd_post_info);
2044 2044
 
2045
-                            if (!empty($image_names)) {
2046
-                                $upload_files++;
2047
-                                $menu_order = 1;
2048
-                                foreach ($image_names as $image_name) {
2045
+							if (!empty($image_names)) {
2046
+								$upload_files++;
2047
+								$menu_order = 1;
2048
+								foreach ($image_names as $image_name) {
2049 2049
 
2050
-                                    $img_name_arr = explode('.', $image_name);
2050
+									$img_name_arr = explode('.', $image_name);
2051 2051
 
2052
-                                    $uploads = wp_upload_dir();
2053
-                                    $sub_dir = $uploads['subdir'];
2052
+									$uploads = wp_upload_dir();
2053
+									$sub_dir = $uploads['subdir'];
2054 2054
 
2055
-                                    $arr_file_type = wp_check_filetype($image_name);
2056
-                                    $uploaded_file_type = $arr_file_type['type'];
2055
+									$arr_file_type = wp_check_filetype($image_name);
2056
+									$uploaded_file_type = $arr_file_type['type'];
2057 2057
 
2058
-                                    $attachment = array();
2059
-                                    $attachment['post_id'] = $last_postid;
2060
-                                    $attachment['title'] = $img_name_arr[0];
2061
-                                    $attachment['content'] = '';
2062
-                                    $attachment['file'] = $sub_dir . '/' . $image_name;
2063
-                                    $attachment['mime_type'] = $uploaded_file_type;
2064
-                                    $attachment['menu_order'] = $menu_order;
2065
-                                    $attachment['is_featured'] = 0;
2058
+									$attachment = array();
2059
+									$attachment['post_id'] = $last_postid;
2060
+									$attachment['title'] = $img_name_arr[0];
2061
+									$attachment['content'] = '';
2062
+									$attachment['file'] = $sub_dir . '/' . $image_name;
2063
+									$attachment['mime_type'] = $uploaded_file_type;
2064
+									$attachment['menu_order'] = $menu_order;
2065
+									$attachment['is_featured'] = 0;
2066 2066
 
2067
-                                    $attachment_set = '';
2067
+									$attachment_set = '';
2068 2068
 
2069
-                                    foreach ($attachment as $key => $val) {
2070
-                                        if ($val != '')
2071
-                                            $attachment_set .= $key . " = '" . $val . "', ";
2072
-                                    }
2069
+									foreach ($attachment as $key => $val) {
2070
+										if ($val != '')
2071
+											$attachment_set .= $key . " = '" . $val . "', ";
2072
+									}
2073 2073
 
2074
-                                    $attachment_set = trim($attachment_set, ", ");
2074
+									$attachment_set = trim($attachment_set, ", ");
2075 2075
 
2076
-                                    $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
2076
+									$wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
2077 2077
 
2078
-                                    if ($menu_order == 1) {
2078
+									if ($menu_order == 1) {
2079 2079
 
2080
-                                        $post_type = get_post_type($last_postid);
2080
+										$post_type = get_post_type($last_postid);
2081 2081
 
2082
-                                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
2082
+										$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
2083 2083
 
2084
-                                    }
2084
+									}
2085 2085
 
2086
-                                    $menu_order++;
2087
-                                }
2088
-                            }
2086
+									$menu_order++;
2087
+								}
2088
+							}
2089 2089
 
2090
-                            $gd_post_info['package_id'] = $package_id;
2090
+							$gd_post_info['package_id'] = $package_id;
2091 2091
 
2092
-                            /** This action is documented in geodirectory-functions/post-functions.php */
2093
-                            do_action('geodir_after_save_listing', $last_postid, $gd_post_info);
2092
+							/** This action is documented in geodirectory-functions/post-functions.php */
2093
+							do_action('geodir_after_save_listing', $last_postid, $gd_post_info);
2094 2094
 
2095
-                            if (!empty($buffer[5])) {
2096
-                                if (in_array($buffer[5], geodir_get_posttypes())) {
2095
+							if (!empty($buffer[5])) {
2096
+								if (in_array($buffer[5], geodir_get_posttypes())) {
2097 2097
 
2098
-                                    $taxonomies = geodir_get_posttype_info(addslashes($buffer[5]));
2099
-                                    wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]);
2100
-                                    wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]);
2098
+									$taxonomies = geodir_get_posttype_info(addslashes($buffer[5]));
2099
+									wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]);
2100
+									wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]);
2101 2101
 
2102 2102
 
2103
-                                    $post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : '';
2103
+									$post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : '';
2104 2104
 
2105
-                                    $post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : '';
2106
-                                    geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str);
2105
+									$post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : '';
2106
+									geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str);
2107 2107
 
2108
-                                }
2108
+								}
2109 2109
 
2110
-                            }
2110
+							}
2111
+
2112
+						} else {
2113
+							$invalid_title++;
2114
+						}
2115
+					}
2116
+					$rowcount++;
2117
+				}
2118
+				fclose($fd);
2119
+				//unlink($csv_target_path);
2120
+				//rmdir($destination_path);
2121
+				if (!empty($filename))
2122
+					geodir_remove_temp_images();
2111 2123
 
2112
-                        } else {
2113
-                            $invalid_title++;
2114
-                        }
2115
-                    }
2116
-                    $rowcount++;
2117
-                }
2118
-                fclose($fd);
2119
-                //unlink($csv_target_path);
2120
-                //rmdir($destination_path);
2121
-                if (!empty($filename))
2122
-                    geodir_remove_temp_images();
2123
-
2124
-
2125
-                echo $geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=csv_upload_settings&msg=success&rowcount=' . $countpost . '&invalidcount=' . $address_invalid . '&blank_address=' . $blank_address . '&upload_files=' . $upload_files . '&invalid_post_type=' . $invalid_post_type . '&invalid_title=' . $invalid_title . '&total_records=' . $total_records;
2126
-                exit;
2127
-            } else {
2128
-                echo $geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=csv_upload_settings&emsg=csvonly';
2129
-                exit;
2130
-            }
2131
-        }
2132 2124
 
2133
-    }
2125
+				echo $geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=csv_upload_settings&msg=success&rowcount=' . $countpost . '&invalidcount=' . $address_invalid . '&blank_address=' . $blank_address . '&upload_files=' . $upload_files . '&invalid_post_type=' . $invalid_post_type . '&invalid_title=' . $invalid_title . '&total_records=' . $total_records;
2126
+				exit;
2127
+			} else {
2128
+				echo $geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=csv_upload_settings&emsg=csvonly';
2129
+				exit;
2130
+			}
2131
+		}
2132
+
2133
+	}
2134 2134
 }
2135 2135
 
2136 2136
 /**
@@ -2146,105 +2146,105 @@  discard block
 block discarded – undo
2146 2146
  */
2147 2147
 function geodir_admin_fields($options)
2148 2148
 {
2149
-    global $geodirectory;
2150
-
2151
-    $first_title = true;
2152
-    $tab_id = '';
2153
-    $i = 0;
2154
-    foreach ($options as $value) :
2155
-        if (!isset($value['name'])) $value['name'] = '';
2156
-        if (!isset($value['class'])) $value['class'] = '';
2157
-        if (!isset($value['css'])) $value['css'] = '';
2158
-        if (!isset($value['std'])) $value['std'] = '';
2159
-        $desc = '';
2160
-        switch ($value['type']) :
2161
-            case 'dummy_installer':
2162
-                $post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
2163
-                geodir_autoinstall_admin_header($post_type);
2164
-                break;
2165
-            case 'csv_installer':
2166
-                geodir_insert_csv_post_data();
2167
-                break;
2168
-            case 'title':
2169
-
2170
-                if ($i == 0) {
2171
-                    echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
2172
-                    echo '<div class="inner_content_tab_main">';
2173
-                }
2149
+	global $geodirectory;
2150
+
2151
+	$first_title = true;
2152
+	$tab_id = '';
2153
+	$i = 0;
2154
+	foreach ($options as $value) :
2155
+		if (!isset($value['name'])) $value['name'] = '';
2156
+		if (!isset($value['class'])) $value['class'] = '';
2157
+		if (!isset($value['css'])) $value['css'] = '';
2158
+		if (!isset($value['std'])) $value['std'] = '';
2159
+		$desc = '';
2160
+		switch ($value['type']) :
2161
+			case 'dummy_installer':
2162
+				$post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
2163
+				geodir_autoinstall_admin_header($post_type);
2164
+				break;
2165
+			case 'csv_installer':
2166
+				geodir_insert_csv_post_data();
2167
+				break;
2168
+			case 'title':
2169
+
2170
+				if ($i == 0) {
2171
+					echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
2172
+					echo '<div class="inner_content_tab_main">';
2173
+				}
2174 2174
 
2175
-                $i++;
2175
+				$i++;
2176 2176
 
2177
-                if (isset($value['id']) && $value['id'])
2178
-                    $tab_id = $value['id'];
2177
+				if (isset($value['id']) && $value['id'])
2178
+					$tab_id = $value['id'];
2179 2179
 
2180
-                if (isset($value['desc']) && $value['desc'])
2181
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
2180
+				if (isset($value['desc']) && $value['desc'])
2181
+					$desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
2182 2182
 
2183
-                if (isset($value['name']) && $value['name']) {
2184
-                    if ($first_title === true) {
2185
-                        $first_title = false;
2186
-                    } else {
2187
-                        echo '</div>';
2188
-                    }
2189
-                    echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
2183
+				if (isset($value['name']) && $value['name']) {
2184
+					if ($first_title === true) {
2185
+						$first_title = false;
2186
+					} else {
2187
+						echo '</div>';
2188
+					}
2189
+					echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
2190 2190
 
2191
-                    echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
2192
-                }
2191
+					echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
2192
+				}
2193 2193
 
2194
-                /**
2195
-                 * Called after a GeoDirectory settings title is output in the GD settings page.
2196
-                 *
2197
-                 * The action is called dynamically geodir_settings_$value['id'].
2198
-                 *
2199
-                 * @since 1.0.0
2200
-                 */
2201
-                do_action('geodir_settings_' . sanitize_title($value['id']));
2202
-                break;
2203
-
2204
-            case 'no_tabs':
2205
-
2206
-                echo '<div class="inner_content_tab_main">';
2207
-                echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
2208
-
2209
-                break;
2210
-
2211
-            case 'sectionstart':
2212
-                if (isset($value['desc']) && $value['desc'])
2213
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
2214
-                if (isset($value['name']) && $value['name'])
2215
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
2216
-                /**
2217
-                 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
2218
-                 *
2219
-                 * The action is called dynamically geodir_settings_$value['id']_start.
2220
-                 *
2221
-                 * @since 1.0.0
2222
-                 */
2223
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
2224
-                echo '<table class="form-table">' . "\n\n";
2225
-
2226
-                break;
2227
-            case 'sectionend':
2228
-                /**
2229
-                 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
2230
-                 *
2231
-                 * The action is called dynamically geodir_settings_$value['id']_end.
2232
-                 *
2233
-                 * @since 1.0.0
2234
-                 */
2235
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
2236
-                echo '</table>';
2237
-                /**
2238
-                 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
2239
-                 *
2240
-                 * The action is called dynamically geodir_settings_$value['id']_end.
2241
-                 *
2242
-                 * @since 1.0.0
2243
-                 */
2244
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
2245
-                break;
2246
-            case 'text':
2247
-                ?>
2194
+				/**
2195
+				 * Called after a GeoDirectory settings title is output in the GD settings page.
2196
+				 *
2197
+				 * The action is called dynamically geodir_settings_$value['id'].
2198
+				 *
2199
+				 * @since 1.0.0
2200
+				 */
2201
+				do_action('geodir_settings_' . sanitize_title($value['id']));
2202
+				break;
2203
+
2204
+			case 'no_tabs':
2205
+
2206
+				echo '<div class="inner_content_tab_main">';
2207
+				echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
2208
+
2209
+				break;
2210
+
2211
+			case 'sectionstart':
2212
+				if (isset($value['desc']) && $value['desc'])
2213
+					$desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
2214
+				if (isset($value['name']) && $value['name'])
2215
+					echo '<h3>' . $value['name'] . $desc . '</h3>';
2216
+				/**
2217
+				 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
2218
+				 *
2219
+				 * The action is called dynamically geodir_settings_$value['id']_start.
2220
+				 *
2221
+				 * @since 1.0.0
2222
+				 */
2223
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
2224
+				echo '<table class="form-table">' . "\n\n";
2225
+
2226
+				break;
2227
+			case 'sectionend':
2228
+				/**
2229
+				 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
2230
+				 *
2231
+				 * The action is called dynamically geodir_settings_$value['id']_end.
2232
+				 *
2233
+				 * @since 1.0.0
2234
+				 */
2235
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
2236
+				echo '</table>';
2237
+				/**
2238
+				 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
2239
+				 *
2240
+				 * The action is called dynamically geodir_settings_$value['id']_end.
2241
+				 *
2242
+				 * @since 1.0.0
2243
+				 */
2244
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
2245
+				break;
2246
+			case 'text':
2247
+				?>
2248 2248
                 <tr valign="top">
2249 2249
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
2250 2250
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -2253,15 +2253,15 @@  discard block
 block discarded – undo
2253 2253
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2254 2254
                                            style=" <?php echo esc_attr($value['css']); ?>"
2255 2255
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
2256
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
2257
-                                           } else {
2258
-                                               echo esc_attr($value['std']);
2259
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
2256
+											   echo esc_attr(stripslashes(get_option($value['id'])));
2257
+										   } else {
2258
+											   echo esc_attr($value['std']);
2259
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
2260 2260
                 </tr><?php
2261
-                break;
2261
+				break;
2262 2262
 
2263
-            case 'password':
2264
-                ?>
2263
+			case 'password':
2264
+				?>
2265 2265
                 <tr valign="top">
2266 2266
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
2267 2267
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -2270,42 +2270,42 @@  discard block
 block discarded – undo
2270 2270
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2271 2271
                                            style="<?php echo esc_attr($value['css']); ?>"
2272 2272
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
2273
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
2274
-                                           } else {
2275
-                                               echo esc_attr($value['std']);
2276
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
2273
+											   echo esc_attr(stripslashes(get_option($value['id'])));
2274
+										   } else {
2275
+											   echo esc_attr($value['std']);
2276
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
2277 2277
                 </tr><?php
2278
-                break;
2278
+				break;
2279 2279
 
2280
-            case 'html_content':
2281
-                ?>
2280
+			case 'html_content':
2281
+				?>
2282 2282
                 <tr valign="top">
2283 2283
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
2284 2284
                 <td class="forminp"><span class="description"><?php echo $value['desc']; ?></span></td>
2285 2285
                 </tr><?php
2286
-                break;
2286
+				break;
2287 2287
 
2288
-            case 'color' :
2289
-                ?>
2288
+			case 'color' :
2289
+				?>
2290 2290
                 <tr valign="top">
2291 2291
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
2292 2292
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
2293 2293
                                            id="<?php echo esc_attr($value['id']); ?>" type="text"
2294 2294
                                            style="<?php echo esc_attr($value['css']); ?>"
2295 2295
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
2296
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
2297
-                                           } else {
2298
-                                               echo esc_attr($value['std']);
2299
-                                           } ?>" class="colorpick"/> <span
2296
+											   echo esc_attr(stripslashes(get_option($value['id'])));
2297
+										   } else {
2298
+											   echo esc_attr($value['std']);
2299
+										   } ?>" class="colorpick"/> <span
2300 2300
                         class="description"><?php echo $value['desc']; ?></span>
2301 2301
 
2302 2302
                     <div id="colorPickerDiv_<?php echo esc_attr($value['id']); ?>" class="colorpickdiv"
2303 2303
                          style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>
2304 2304
                 </td>
2305 2305
                 </tr><?php
2306
-                break;
2307
-            case 'image_width' :
2308
-                ?>
2306
+				break;
2307
+			case 'image_width' :
2308
+				?>
2309 2309
                 <tr valign="top">
2310 2310
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
2311 2311
                 <td class="forminp">
@@ -2327,9 +2327,9 @@  discard block
 block discarded – undo
2327 2327
 
2328 2328
                     <span class="description"><?php echo $value['desc'] ?></span></td>
2329 2329
                 </tr><?php
2330
-                break;
2331
-            case 'select':
2332
-                ?>
2330
+				break;
2331
+			case 'select':
2332
+				?>
2333 2333
                 <tr valign="top">
2334 2334
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
2335 2335
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -2338,30 +2338,30 @@  discard block
 block discarded – undo
2338 2338
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
2339 2339
                                             option-ajaxchosen="false">
2340 2340
                         <?php
2341
-                        foreach ($value['options'] as $key => $val) {
2342
-                            $geodir_select_value = '';
2343
-                            if (get_option($value['id']) != '') {
2344
-                                if (get_option($value['id']) != '' && get_option($value['id']) == $key)
2345
-                                    $geodir_select_value = ' selected="selected" ';
2346
-                            } else {
2347
-                                if ($value['std'] == $key)
2348
-                                    $geodir_select_value = ' selected="selected" ';
2349
-                            }
2341
+						foreach ($value['options'] as $key => $val) {
2342
+							$geodir_select_value = '';
2343
+							if (get_option($value['id']) != '') {
2344
+								if (get_option($value['id']) != '' && get_option($value['id']) == $key)
2345
+									$geodir_select_value = ' selected="selected" ';
2346
+							} else {
2347
+								if ($value['std'] == $key)
2348
+									$geodir_select_value = ' selected="selected" ';
2349
+							}
2350 2350
 
2351 2351
 
2352
-                            ?>
2352
+							?>
2353 2353
                             <option
2354 2354
                                 value="<?php echo esc_attr($key); ?>" <?php echo $geodir_select_value; ?> ><?php echo ucfirst($val) ?></option>
2355 2355
                         <?php
2356
-                        }
2357
-                        ?>
2356
+						}
2357
+						?>
2358 2358
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
2359 2359
                 </td>
2360 2360
                 </tr><?php
2361
-                break;
2361
+				break;
2362 2362
 
2363
-            case 'multiselect':
2364
-                ?>
2363
+			case 'multiselect':
2364
+				?>
2365 2365
                 <tr valign="top">
2366 2366
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
2367 2367
                 <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]"
@@ -2371,27 +2371,27 @@  discard block
 block discarded – undo
2371 2371
                                             data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
2372 2372
                                             option-ajaxchosen="false">
2373 2373
                         <?php
2374
-                        foreach ($value['options'] as $key => $val) {
2375
-                            if (strpos($key, 'optgroup_start-') === 0) {
2376
-                                ?><optgroup label="<?php echo ucfirst($val); ?>"><?php
2377
-                            } else if (strpos($key, 'optgroup_end-') === 0) {
2378
-                                ?></optgroup><?php
2379
-                            } else {
2380
-                                ?>
2374
+						foreach ($value['options'] as $key => $val) {
2375
+							if (strpos($key, 'optgroup_start-') === 0) {
2376
+								?><optgroup label="<?php echo ucfirst($val); ?>"><?php
2377
+							} else if (strpos($key, 'optgroup_end-') === 0) {
2378
+								?></optgroup><?php
2379
+							} else {
2380
+								?>
2381 2381
                                 <option
2382 2382
                                     value="<?php echo esc_attr($key); ?>" <?php if (is_array(get_option($value['id']))) {
2383
-                                    if (in_array($key, get_option($value['id']))) { ?> selected="selected" <?php }
2384
-                                } ?>><?php echo ucfirst($val) ?></option>
2383
+									if (in_array($key, get_option($value['id']))) { ?> selected="selected" <?php }
2384
+								} ?>><?php echo ucfirst($val) ?></option>
2385 2385
                             <?php
2386
-                            }
2387
-                        }
2388
-                        ?>
2386
+							}
2387
+						}
2388
+						?>
2389 2389
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
2390 2390
                 </td>
2391 2391
                 </tr><?php
2392
-                break;
2393
-            case 'file':
2394
-                ?>
2392
+				break;
2393
+			case 'file':
2394
+				?>
2395 2395
                 <tr valign="top">
2396 2396
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
2397 2397
                 <td class="forminp">
@@ -2411,87 +2411,87 @@  discard block
 block discarded – undo
2411 2411
                     <?php } ?>
2412 2412
                 </td>
2413 2413
                 </tr><?php
2414
-                break;
2415
-            case 'map_default_settings' :
2416
-                ?>
2414
+				break;
2415
+			case 'map_default_settings' :
2416
+				?>
2417 2417
 
2418 2418
                 <tr valign="top">
2419 2419
                     <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
2420 2420
                     <td width="60%">
2421 2421
                         <select name="geodir_default_map_language" style="width:60%">
2422 2422
                             <?php
2423
-                            $arr_map_langages = array(
2424
-                                'ar' => __('ARABIC', 'geodirectory'),
2425
-                                'eu' => __('BASQUE', 'geodirectory'),
2426
-                                'bg' => __('BULGARIAN', 'geodirectory'),
2427
-                                'bn' => __('BENGALI', 'geodirectory'),
2428
-                                'ca' => __('CATALAN', 'geodirectory'),
2429
-                                'cs' => __('CZECH', 'geodirectory'),
2430
-                                'da' => __('DANISH', 'geodirectory'),
2431
-                                'de' => __('GERMAN', 'geodirectory'),
2432
-                                'el' => __('GREEK', 'geodirectory'),
2433
-                                'en' => __('ENGLISH', 'geodirectory'),
2434
-                                'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
2435
-                                'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
2436
-                                'es' => __('SPANISH', 'geodirectory'),
2437
-                                'eu' => __('BASQUE', 'geodirectory'),
2438
-                                'fa' => __('FARSI', 'geodirectory'),
2439
-                                'fi' => __('FINNISH', 'geodirectory'),
2440
-                                'fil' => __('FILIPINO', 'geodirectory'),
2441
-                                'fr' => __('FRENCH', 'geodirectory'),
2442
-                                'gl' => __('GALICIAN', 'geodirectory'),
2443
-                                'gu' => __('GUJARATI', 'geodirectory'),
2444
-                                'hi' => __('HINDI', 'geodirectory'),
2445
-                                'hr' => __('CROATIAN', 'geodirectory'),
2446
-                                'hu' => __('HUNGARIAN', 'geodirectory'),
2447
-                                'id' => __('INDONESIAN', 'geodirectory'),
2448
-                                'it' => __('ITALIAN', 'geodirectory'),
2449
-                                'iw' => __('HEBREW', 'geodirectory'),
2450
-                                'ja' => __('JAPANESE', 'geodirectory'),
2451
-                                'kn' => __('KANNADA', 'geodirectory'),
2452
-                                'ko' => __('KOREAN', 'geodirectory'),
2453
-                                'lt' => __('LITHUANIAN', 'geodirectory'),
2454
-                                'lv' => __('LATVIAN', 'geodirectory'),
2455
-                                'ml' => __('MALAYALAM', 'geodirectory'),
2456
-                                'mr' => __('MARATHI', 'geodirectory'),
2457
-                                'nl' => __('DUTCH', 'geodirectory'),
2458
-                                'no' => __('NORWEGIAN', 'geodirectory'),
2459
-                                'pl' => __('POLISH', 'geodirectory'),
2460
-                                'pt' => __('PORTUGUESE', 'geodirectory'),
2461
-                                'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
2462
-                                'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
2463
-                                'ro' => __('ROMANIAN', 'geodirectory'),
2464
-                                'ru' => __('RUSSIAN', 'geodirectory'),
2465
-                                'ru' => __('RUSSIAN', 'geodirectory'),
2466
-                                'sk' => __('SLOVAK', 'geodirectory'),
2467
-                                'sl' => __('SLOVENIAN', 'geodirectory'),
2468
-                                'sr' => __('SERBIAN', 'geodirectory'),
2469
-                                'sv' => __('	SWEDISH', 'geodirectory'),
2470
-                                'tl' => __('TAGALOG', 'geodirectory'),
2471
-                                'ta' => __('TAMIL', 'geodirectory'),
2472
-                                'te' => __('TELUGU', 'geodirectory'),
2473
-                                'th' => __('THAI', 'geodirectory'),
2474
-                                'tr' => __('TURKISH', 'geodirectory'),
2475
-                                'uk' => __('UKRAINIAN', 'geodirectory'),
2476
-                                'vi' => __('VIETNAMESE', 'geodirectory'),
2477
-                                'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
2478
-                                'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
2479
-                            );
2480
-                            $geodir_default_map_language = get_option('geodir_default_map_language');
2481
-                            if (empty($geodir_default_map_language))
2482
-                                $geodir_default_map_language = 'en';
2483
-                            foreach ($arr_map_langages as $language_key => $language_txt) {
2484
-                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
2485
-                                    $geodir_default_language_selected = "selected='selected'";
2486
-                                else
2487
-                                    $geodir_default_language_selected = '';
2488
-
2489
-                                ?>
2423
+							$arr_map_langages = array(
2424
+								'ar' => __('ARABIC', 'geodirectory'),
2425
+								'eu' => __('BASQUE', 'geodirectory'),
2426
+								'bg' => __('BULGARIAN', 'geodirectory'),
2427
+								'bn' => __('BENGALI', 'geodirectory'),
2428
+								'ca' => __('CATALAN', 'geodirectory'),
2429
+								'cs' => __('CZECH', 'geodirectory'),
2430
+								'da' => __('DANISH', 'geodirectory'),
2431
+								'de' => __('GERMAN', 'geodirectory'),
2432
+								'el' => __('GREEK', 'geodirectory'),
2433
+								'en' => __('ENGLISH', 'geodirectory'),
2434
+								'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
2435
+								'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
2436
+								'es' => __('SPANISH', 'geodirectory'),
2437
+								'eu' => __('BASQUE', 'geodirectory'),
2438
+								'fa' => __('FARSI', 'geodirectory'),
2439
+								'fi' => __('FINNISH', 'geodirectory'),
2440
+								'fil' => __('FILIPINO', 'geodirectory'),
2441
+								'fr' => __('FRENCH', 'geodirectory'),
2442
+								'gl' => __('GALICIAN', 'geodirectory'),
2443
+								'gu' => __('GUJARATI', 'geodirectory'),
2444
+								'hi' => __('HINDI', 'geodirectory'),
2445
+								'hr' => __('CROATIAN', 'geodirectory'),
2446
+								'hu' => __('HUNGARIAN', 'geodirectory'),
2447
+								'id' => __('INDONESIAN', 'geodirectory'),
2448
+								'it' => __('ITALIAN', 'geodirectory'),
2449
+								'iw' => __('HEBREW', 'geodirectory'),
2450
+								'ja' => __('JAPANESE', 'geodirectory'),
2451
+								'kn' => __('KANNADA', 'geodirectory'),
2452
+								'ko' => __('KOREAN', 'geodirectory'),
2453
+								'lt' => __('LITHUANIAN', 'geodirectory'),
2454
+								'lv' => __('LATVIAN', 'geodirectory'),
2455
+								'ml' => __('MALAYALAM', 'geodirectory'),
2456
+								'mr' => __('MARATHI', 'geodirectory'),
2457
+								'nl' => __('DUTCH', 'geodirectory'),
2458
+								'no' => __('NORWEGIAN', 'geodirectory'),
2459
+								'pl' => __('POLISH', 'geodirectory'),
2460
+								'pt' => __('PORTUGUESE', 'geodirectory'),
2461
+								'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
2462
+								'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
2463
+								'ro' => __('ROMANIAN', 'geodirectory'),
2464
+								'ru' => __('RUSSIAN', 'geodirectory'),
2465
+								'ru' => __('RUSSIAN', 'geodirectory'),
2466
+								'sk' => __('SLOVAK', 'geodirectory'),
2467
+								'sl' => __('SLOVENIAN', 'geodirectory'),
2468
+								'sr' => __('SERBIAN', 'geodirectory'),
2469
+								'sv' => __('	SWEDISH', 'geodirectory'),
2470
+								'tl' => __('TAGALOG', 'geodirectory'),
2471
+								'ta' => __('TAMIL', 'geodirectory'),
2472
+								'te' => __('TELUGU', 'geodirectory'),
2473
+								'th' => __('THAI', 'geodirectory'),
2474
+								'tr' => __('TURKISH', 'geodirectory'),
2475
+								'uk' => __('UKRAINIAN', 'geodirectory'),
2476
+								'vi' => __('VIETNAMESE', 'geodirectory'),
2477
+								'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
2478
+								'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
2479
+							);
2480
+							$geodir_default_map_language = get_option('geodir_default_map_language');
2481
+							if (empty($geodir_default_map_language))
2482
+								$geodir_default_map_language = 'en';
2483
+							foreach ($arr_map_langages as $language_key => $language_txt) {
2484
+								if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
2485
+									$geodir_default_language_selected = "selected='selected'";
2486
+								else
2487
+									$geodir_default_language_selected = '';
2488
+
2489
+								?>
2490 2490
                                 <option
2491 2491
                                     value="<?php echo $language_key?>" <?php echo $geodir_default_language_selected; ?>><?php echo $language_txt; ?></option>
2492 2492
 
2493 2493
                             <?php }
2494
-                            ?>
2494
+							?>
2495 2495
                         </select>
2496 2496
                     </td>
2497 2497
                 </tr>
@@ -2502,46 +2502,46 @@  discard block
 block discarded – undo
2502 2502
                     <td width="60%">
2503 2503
                         <select name="geodir_default_map_search_pt" style="width:60%">
2504 2504
                             <?php
2505
-                            $post_types = geodir_get_posttypes('array');
2506
-                            $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
2507
-                            if (empty($geodir_default_map_search_pt))
2508
-                                $geodir_default_map_search_pt = 'gd_place';
2509
-                            if (is_array($post_types)) {
2510
-                                foreach ($post_types as $key => $post_types_obj) {
2511
-                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
2512
-                                        $geodir_search_pt_selected = "selected='selected'";
2513
-                                    else
2514
-                                        $geodir_search_pt_selected = '';
2515
-
2516
-                                    ?>
2505
+							$post_types = geodir_get_posttypes('array');
2506
+							$geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
2507
+							if (empty($geodir_default_map_search_pt))
2508
+								$geodir_default_map_search_pt = 'gd_place';
2509
+							if (is_array($post_types)) {
2510
+								foreach ($post_types as $key => $post_types_obj) {
2511
+									if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
2512
+										$geodir_search_pt_selected = "selected='selected'";
2513
+									else
2514
+										$geodir_search_pt_selected = '';
2515
+
2516
+									?>
2517 2517
                                     <option
2518 2518
                                         value="<?php echo $key?>" <?php echo $geodir_search_pt_selected; ?>><?php echo $post_types_obj['labels']['singular_name']; ?></option>
2519 2519
 
2520 2520
                                 <?php }
2521 2521
 
2522
-                            }
2522
+							}
2523 2523
 
2524
-                            ?>
2524
+							?>
2525 2525
                         </select>
2526 2526
                     </td>
2527 2527
                 </tr>
2528 2528
 
2529 2529
                 <?php
2530
-                break;
2530
+				break;
2531 2531
 
2532
-            case 'map':
2533
-                ?>
2532
+			case 'map':
2533
+				?>
2534 2534
                 <tr valign="top">
2535 2535
                     <td class="forminp">
2536 2536
                         <?php
2537
-                        global $post_cat, $cat_display;
2538
-                        $post_types = geodir_get_posttypes('object');
2539
-                        $cat_display = 'checkbox';
2540
-                        $gd_post_types = get_option('geodir_exclude_post_type_on_map');
2541
-                        $gd_cats = get_option('geodir_exclude_cat_on_map');
2542
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
2543
-                        $count = 1;
2544
-                        ?>
2537
+						global $post_cat, $cat_display;
2538
+						$post_types = geodir_get_posttypes('object');
2539
+						$cat_display = 'checkbox';
2540
+						$gd_post_types = get_option('geodir_exclude_post_type_on_map');
2541
+						$gd_cats = get_option('geodir_exclude_cat_on_map');
2542
+						$gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
2543
+						$count = 1;
2544
+						?>
2545 2545
                         <table width="70%" class="widefat">
2546 2546
                             <thead>
2547 2547
                             <tr>
@@ -2550,18 +2550,18 @@  discard block
 block discarded – undo
2550 2550
                                 <th><b><?php echo DESIGN_POST_TYPE_CAT; ?></b></th>
2551 2551
                             </tr>
2552 2552
                             <?php
2553
-                            $gd_categs = $gd_cats;
2554
-                            foreach ($post_types as $key => $post_types_obj) :
2555
-                                $checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
2556
-                                $gd_taxonomy = geodir_get_taxonomies($key);
2557
-                                if ($gd_cats_upgrade) {
2558
-                                    $gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
2559
-                                    $gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
2560
-                                    $gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
2561
-                                }
2562
-                                $post_cat = implode(',', $gd_cats);
2563
-                                $gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
2564
-                                ?>
2553
+							$gd_categs = $gd_cats;
2554
+							foreach ($post_types as $key => $post_types_obj) :
2555
+								$checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
2556
+								$gd_taxonomy = geodir_get_taxonomies($key);
2557
+								if ($gd_cats_upgrade) {
2558
+									$gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
2559
+									$gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
2560
+									$gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
2561
+								}
2562
+								$post_cat = implode(',', $gd_cats);
2563
+								$gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
2564
+								?>
2565 2565
                                 <tr>
2566 2566
                                     <td valign="top" width="5%"><?php echo $count; ?></td>
2567 2567
                                     <td valign="top" width="25%" id="td_post_types"><input type="checkbox"
@@ -2582,19 +2582,19 @@  discard block
 block discarded – undo
2582 2582
                     </td>
2583 2583
                 </tr>
2584 2584
                 <?php
2585
-                break;
2585
+				break;
2586 2586
 
2587
-            case 'checkbox' :
2587
+			case 'checkbox' :
2588 2588
 
2589
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
2590
-                    ?>
2589
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
2590
+					?>
2591 2591
                     <tr valign="top">
2592 2592
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
2593 2593
                     <td class="forminp">
2594 2594
                 <?php
2595
-                endif;
2595
+				endif;
2596 2596
 
2597
-                ?>
2597
+				?>
2598 2598
                 <fieldset>
2599 2599
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
2600 2600
                     <label for="<?php echo $value['id'] ?>">
@@ -2604,49 +2604,49 @@  discard block
 block discarded – undo
2604 2604
                 </fieldset>
2605 2605
                 <?php
2606 2606
 
2607
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
2608
-                    ?>
2607
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
2608
+					?>
2609 2609
                     </td>
2610 2610
                     </tr>
2611 2611
                 <?php
2612
-                endif;
2612
+				endif;
2613 2613
 
2614
-                break;
2614
+				break;
2615 2615
 
2616
-            case 'radio' :
2616
+			case 'radio' :
2617 2617
 
2618
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
2619
-                    ?>
2618
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
2619
+					?>
2620 2620
                     <tr valign="top">
2621 2621
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
2622 2622
                     <td class="forminp">
2623 2623
                 <?php
2624
-                endif;
2624
+				endif;
2625 2625
 
2626
-                ?>
2626
+				?>
2627 2627
                 <fieldset>
2628 2628
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
2629 2629
                     <label for="<?php echo $value['id'];?>">
2630 2630
                         <input name="<?php echo esc_attr($value['id']); ?>"
2631 2631
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
2632 2632
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
2633
-                            echo 'checked="checked"';
2634
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
2633
+							echo 'checked="checked"';
2634
+						}elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
2635 2635
                         <?php echo $value['desc']; ?></label><br>
2636 2636
                 </fieldset>
2637 2637
                 <?php
2638 2638
 
2639
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
2640
-                    ?>
2639
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
2640
+					?>
2641 2641
                     </td>
2642 2642
                     </tr>
2643 2643
                 <?php
2644
-                endif;
2644
+				endif;
2645 2645
 
2646
-                break;
2646
+				break;
2647 2647
 
2648
-            case 'textarea':
2649
-                ?>
2648
+			case 'textarea':
2649
+				?>
2650 2650
                 <tr valign="top">
2651 2651
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
2652 2652
                 <td class="forminp">
@@ -2659,32 +2659,32 @@  discard block
 block discarded – undo
2659 2659
 
2660 2660
                 </td>
2661 2661
                 </tr><?php
2662
-                break;
2662
+				break;
2663 2663
 
2664
-            case 'editor':
2665
-                ?>
2664
+			case 'editor':
2665
+				?>
2666 2666
                 <tr valign="top">
2667 2667
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
2668 2668
                 <td class="forminp"><?php
2669 2669
 
2670
-                    $content = '';
2671
-                    if (get_option($value['id']))
2672
-                        $content = stripslashes(get_option($value['id']));
2673
-                    else
2674
-                        $content = $value['std'];
2670
+					$content = '';
2671
+					if (get_option($value['id']))
2672
+						$content = stripslashes(get_option($value['id']));
2673
+					else
2674
+						$content = $value['std'];
2675 2675
 
2676
-                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2676
+					$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2677 2677
 
2678
-                    wp_editor($content, esc_attr($value['id']), $editor_settings);
2678
+					wp_editor($content, esc_attr($value['id']), $editor_settings);
2679 2679
 
2680
-                    ?> <span class="description"><?php echo $value['desc'] ?></span>
2680
+					?> <span class="description"><?php echo $value['desc'] ?></span>
2681 2681
 
2682 2682
                 </td>
2683 2683
                 </tr><?php
2684
-                break;
2684
+				break;
2685 2685
 
2686
-            case 'single_select_page' :
2687
-                // WPML
2686
+			case 'single_select_page' :
2687
+				// WPML
2688 2688
 				$switch_lang = false;
2689 2689
 				$disabled = '';
2690 2690
 				if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
@@ -2702,18 +2702,18 @@  discard block
 block discarded – undo
2702 2702
 				//
2703 2703
 				$page_setting = (int)get_option($value['id']);
2704 2704
 
2705
-                $args = array('name' => $value['id'],
2706
-                    'id' => $value['id'],
2707
-                    'sort_column' => 'menu_order',
2708
-                    'sort_order' => 'ASC',
2709
-                    'show_option_none' => ' ',
2710
-                    'class' => $value['class'],
2711
-                    'echo' => false,
2712
-                    'selected' => $page_setting);
2705
+				$args = array('name' => $value['id'],
2706
+					'id' => $value['id'],
2707
+					'sort_column' => 'menu_order',
2708
+					'sort_order' => 'ASC',
2709
+					'show_option_none' => ' ',
2710
+					'class' => $value['class'],
2711
+					'echo' => false,
2712
+					'selected' => $page_setting);
2713 2713
 
2714
-                if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
2714
+				if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
2715 2715
 
2716
-                ?>
2716
+				?>
2717 2717
                 <tr valign="top" class="single_select_page">
2718 2718
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
2719 2719
                 <td class="forminp">
@@ -2724,18 +2724,18 @@  discard block
 block discarded – undo
2724 2724
 				if ($switch_lang) {
2725 2725
 					$sitepress->switch_lang($switch_lang, true);
2726 2726
 				}
2727
-                break;
2728
-            case 'single_select_country' :
2729
-                $countries = $geodirectory->countries->countries;
2730
-                $country_setting = (string)get_option($value['id']);
2731
-                if (strstr($country_setting, ':')) :
2732
-                    $country = current(explode(':', $country_setting));
2733
-                    $state = end(explode(':', $country_setting));
2734
-                else :
2735
-                    $country = $country_setting;
2736
-                    $state = '*';
2737
-                endif;
2738
-                ?>
2727
+				break;
2728
+			case 'single_select_country' :
2729
+				$countries = $geodirectory->countries->countries;
2730
+				$country_setting = (string)get_option($value['id']);
2731
+				if (strstr($country_setting, ':')) :
2732
+					$country = current(explode(':', $country_setting));
2733
+					$state = end(explode(':', $country_setting));
2734
+				else :
2735
+					$country = $country_setting;
2736
+					$state = '*';
2737
+				endif;
2738
+				?>
2739 2739
                 <tr valign="top">
2740 2740
                 <th scope="rpw" class="titledesc"><?php echo $value['name'] ?></th>
2741 2741
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -2746,12 +2746,12 @@  discard block
 block discarded – undo
2746 2746
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
2747 2747
                 </td>
2748 2748
                 </tr><?php
2749
-                break;
2750
-            case 'multi_select_countries' :
2751
-                $countries = $geodirectory->countries->countries;
2752
-                asort($countries);
2753
-                $selections = (array)get_option($value['id']);
2754
-                ?>
2749
+				break;
2750
+			case 'multi_select_countries' :
2751
+				$countries = $geodirectory->countries->countries;
2752
+				asort($countries);
2753
+				$selections = (array)get_option($value['id']);
2754
+				?>
2755 2755
                 <tr valign="top">
2756 2756
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
2757 2757
                 <td class="forminp">
@@ -2759,22 +2759,22 @@  discard block
 block discarded – undo
2759 2759
                             data-placeholder="<?php _e('Choose countries&hellip;', 'geodirectory'); ?>"
2760 2760
                             title="Country" class="chosen_select">
2761 2761
                         <?php
2762
-                        if ($countries) foreach ($countries as $key => $val) :
2763
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
2764
-                        endforeach;
2765
-                        ?>
2762
+						if ($countries) foreach ($countries as $key => $val) :
2763
+							echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
2764
+						endforeach;
2765
+						?>
2766 2766
                     </select>
2767 2767
                 </td>
2768 2768
                 </tr>
2769 2769
 
2770 2770
                 <?php
2771 2771
 
2772
-                break;
2772
+				break;
2773 2773
 
2774
-            case 'google_analytics' :
2775
-                $selections = (array)get_option($value['id']);
2776
-                if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
2777
-                    ?>
2774
+			case 'google_analytics' :
2775
+				$selections = (array)get_option($value['id']);
2776
+				if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
2777
+					?>
2778 2778
                     <tr valign="top">
2779 2779
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
2780 2780
                         <td class="forminp">
@@ -2782,19 +2782,19 @@  discard block
 block discarded – undo
2782 2782
 
2783 2783
                             <?php
2784 2784
 
2785
-                            $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
2786
-                            $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
2787
-                            $state = "&state=123";//any string
2788
-                            $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2789
-                            $response_type = "&response_type=code";
2790
-                            $client_id = "&client_id=".get_option('geodir_ga_client_id');
2791
-                            $access_type = "&access_type=offline";
2792
-                            $approval_prompt = "&approval_prompt=force";
2785
+							$oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
2786
+							$scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
2787
+							$state = "&state=123";//any string
2788
+							$redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2789
+							$response_type = "&response_type=code";
2790
+							$client_id = "&client_id=".get_option('geodir_ga_client_id');
2791
+							$access_type = "&access_type=offline";
2792
+							$approval_prompt = "&approval_prompt=force";
2793 2793
 
2794
-                            $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
2794
+							$auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
2795 2795
 
2796 2796
 
2797
-                            ?>
2797
+							?>
2798 2798
                             <script>
2799 2799
                                 function gd_ga_popup() {
2800 2800
                                     var win = window.open("<?php echo $auth_url;?>", "Google Analytics", "");
@@ -2809,47 +2809,47 @@  discard block
 block discarded – undo
2809 2809
                             </script>
2810 2810
 
2811 2811
                             <?php
2812
-                            if (get_option('gd_ga_refresh_token')) {
2813
-                                ?>
2812
+							if (get_option('gd_ga_refresh_token')) {
2813
+								?>
2814 2814
                                 <span class="button-primary"
2815 2815
                                       onclick="gd_ga_popup();"><?php _e('Re-authorize', 'geodirectory'); ?></span>
2816 2816
                                 <span
2817 2817
                                     style="color: green; font-weight: bold;"><?php _e('Authorized', 'geodirectory'); ?></span>
2818 2818
                             <?php
2819
-                            } else {
2820
-                                ?>
2819
+							} else {
2820
+								?>
2821 2821
                                 <span class="button-primary"
2822 2822
                                       onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory');?></span>
2823 2823
                             <?php
2824
-                            }
2825
-                            ?>
2824
+							}
2825
+							?>
2826 2826
                         </td>
2827 2827
                     </tr>
2828 2828
 
2829 2829
                 <?php
2830
-                }
2830
+				}
2831 2831
 
2832
-                break;
2832
+				break;
2833 2833
 
2834
-            case 'field_seperator' :
2834
+			case 'field_seperator' :
2835 2835
 
2836
-                ?>
2836
+				?>
2837 2837
                 <tr valign="top">
2838 2838
                     <td colspan="2" class="forminp geodir_line_seperator"></td>
2839 2839
                 </tr>
2840 2840
                 <?php
2841 2841
 
2842
-                break;
2842
+				break;
2843 2843
 
2844
-        endswitch;
2844
+		endswitch;
2845 2845
 
2846
-    endforeach;
2846
+	endforeach;
2847 2847
 
2848
-    if ($first_title === false) {
2849
-        echo "</div>";
2850
-    }
2848
+	if ($first_title === false) {
2849
+		echo "</div>";
2850
+	}
2851 2851
 
2852
-    ?>
2852
+	?>
2853 2853
 
2854 2854
     <script type="text/javascript">
2855 2855
 
@@ -2909,33 +2909,33 @@  discard block
 block discarded – undo
2909 2909
  */
2910 2910
 function geodir_post_info_setting()
2911 2911
 {
2912
-    global $post, $post_id;
2913
-
2914
-    $post_type = get_post_type();
2915
-
2916
-    $package_info = array();
2917
-
2918
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
2919
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
2920
-    echo '<div id="geodir_wrapper">';
2921
-    /**
2922
-     * Called before the GD custom fields are output in the wp-admin area.
2923
-     *
2924
-     * @since 1.0.0
2925
-     * @see 'geodir_after_default_field_in_meta_box'
2926
-     */
2927
-    do_action('geodir_before_default_field_in_meta_box');
2928
-    //geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
2929
-    // to display all fields in one information box
2930
-    geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
2931
-    /**
2932
-     * Called after the GD custom fields are output in the wp-admin area.
2933
-     *
2934
-     * @since 1.0.0
2935
-     * @see 'geodir_before_default_field_in_meta_box'
2936
-     */
2937
-    do_action('geodir_after_default_field_in_meta_box');
2938
-    echo '</div>';
2912
+	global $post, $post_id;
2913
+
2914
+	$post_type = get_post_type();
2915
+
2916
+	$package_info = array();
2917
+
2918
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
2919
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
2920
+	echo '<div id="geodir_wrapper">';
2921
+	/**
2922
+	 * Called before the GD custom fields are output in the wp-admin area.
2923
+	 *
2924
+	 * @since 1.0.0
2925
+	 * @see 'geodir_after_default_field_in_meta_box'
2926
+	 */
2927
+	do_action('geodir_before_default_field_in_meta_box');
2928
+	//geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
2929
+	// to display all fields in one information box
2930
+	geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
2931
+	/**
2932
+	 * Called after the GD custom fields are output in the wp-admin area.
2933
+	 *
2934
+	 * @since 1.0.0
2935
+	 * @see 'geodir_before_default_field_in_meta_box'
2936
+	 */
2937
+	do_action('geodir_after_default_field_in_meta_box');
2938
+	echo '</div>';
2939 2939
 }
2940 2940
 
2941 2941
 /**
@@ -2948,18 +2948,18 @@  discard block
 block discarded – undo
2948 2948
  */
2949 2949
 function geodir_post_addinfo_setting()
2950 2950
 {
2951
-    global $post, $post_id;
2951
+	global $post, $post_id;
2952 2952
 
2953
-    $post_type = get_post_type();
2953
+	$post_type = get_post_type();
2954 2954
 
2955
-    $package_info = array();
2955
+	$package_info = array();
2956 2956
 
2957
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
2957
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
2958 2958
 
2959
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
2960
-    echo '<div id="geodir_wrapper">';
2961
-    geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
2962
-    echo '</div>';
2959
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
2960
+	echo '<div id="geodir_wrapper">';
2961
+	geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
2962
+	echo '</div>';
2963 2963
 
2964 2964
 }
2965 2965
 
@@ -2973,60 +2973,60 @@  discard block
 block discarded – undo
2973 2973
  */
2974 2974
 function geodir_post_attachments()
2975 2975
 {
2976
-    global $post, $post_id;
2976
+	global $post, $post_id;
2977 2977
 
2978
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
2978
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
2979 2979
 
2980
-    if (geodir_get_featured_image($post_id, 'thumbnail')) {
2981
-        echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
2982
-        geodir_show_featured_image($post_id, 'thumbnail');
2983
-    }
2980
+	if (geodir_get_featured_image($post_id, 'thumbnail')) {
2981
+		echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
2982
+		geodir_show_featured_image($post_id, 'thumbnail');
2983
+	}
2984 2984
 
2985
-    $image_limit = 0;
2985
+	$image_limit = 0;
2986 2986
 
2987
-    ?>
2987
+	?>
2988 2988
 
2989 2989
 
2990 2990
     <h5 class="form_title">
2991 2991
         <?php if ($image_limit != 0 && $image_limit == 1) {
2992
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2993
-        } ?>
2992
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2993
+		} ?>
2994 2994
         <?php if ($image_limit != 0 && $image_limit > 1) {
2995
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2996
-        } ?>
2995
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2996
+		} ?>
2997 2997
         <?php if ($image_limit == 0) {
2998
-            echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2999
-        } ?>
2998
+			echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2999
+		} ?>
3000 3000
     </h5>
3001 3001
 
3002 3002
 
3003 3003
     <?php
3004 3004
 
3005
-    $curImages = geodir_get_images($post_id);
3006
-    $place_img_array = array();
3005
+	$curImages = geodir_get_images($post_id);
3006
+	$place_img_array = array();
3007 3007
 
3008
-    if (!empty($curImages)):
3009
-        foreach ($curImages as $p_img):
3010
-            $place_img_array[] = $p_img->src;
3011
-        endforeach;
3012
-    endif;
3008
+	if (!empty($curImages)):
3009
+		foreach ($curImages as $p_img):
3010
+			$place_img_array[] = $p_img->src;
3011
+		endforeach;
3012
+	endif;
3013 3013
 
3014
-    if (!empty($place_img_array))
3015
-        $curImages = implode(',', $place_img_array);
3014
+	if (!empty($place_img_array))
3015
+		$curImages = implode(',', $place_img_array);
3016 3016
 
3017 3017
 
3018
-    // adjust values here
3019
-    $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
3018
+	// adjust values here
3019
+	$id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
3020 3020
 
3021
-    $svalue = $curImages; // this will be initial value of the above form field. Image urls.
3021
+	$svalue = $curImages; // this will be initial value of the above form field. Image urls.
3022 3022
 
3023
-    $multiple = true; // allow multiple files upload
3023
+	$multiple = true; // allow multiple files upload
3024 3024
 
3025
-    $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
3025
+	$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
3026 3026
 
3027
-    $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
3027
+	$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
3028 3028
 
3029
-    ?>
3029
+	?>
3030 3030
 
3031 3031
     <div class="gtd-form_row clearfix" id="<?php echo $id; ?>dropbox" style="border:1px solid #999999;padding:5px;text-align:center;">
3032 3032
         <input type="hidden" name="<?php echo $id; ?>" id="<?php echo $id; ?>" value="<?php echo $svalue; ?>"/>
@@ -3068,13 +3068,13 @@  discard block
 block discarded – undo
3068 3068
  */
3069 3069
 function geodir_action_post_updated($post_ID, $post_after, $post_before)
3070 3070
 {
3071
-    $post_type = get_post_type($post_ID);
3071
+	$post_type = get_post_type($post_ID);
3072 3072
 
3073
-    if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
3074
-        if ($post_type != '' && in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_ID) && !empty($post_after->post_title) && $post_after->post_title != $post_before->post_title) {
3075
-            geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
3076
-        }
3077
-    }
3073
+	if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
3074
+		if ($post_type != '' && in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_ID) && !empty($post_after->post_title) && $post_after->post_title != $post_before->post_title) {
3075
+			geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
3076
+		}
3077
+	}
3078 3078
 }
3079 3079
 
3080 3080
 /**
@@ -3089,39 +3089,39 @@  discard block
 block discarded – undo
3089 3089
  */
3090 3090
 function geodir_notification_add_bcc_option($settings)
3091 3091
 {
3092
-    if (!empty($settings)) {
3093
-        $new_settings = array();
3094
-        foreach ($settings as $setting) {
3095
-            if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
3096
-                $geodir_bcc_listing_published_yes = array(
3097
-                    'name' => __('Listing published', 'geodirectory'),
3098
-                    'desc' => __('Yes', 'geodirectory'),
3099
-                    'id' => 'geodir_bcc_listing_published',
3100
-                    'std' => 'yes',
3101
-                    'type' => 'radio',
3102
-                    'value' => '1',
3103
-                    'radiogroup' => 'start'
3104
-                );
3105
-
3106
-                $geodir_bcc_listing_published_no = array(
3107
-                    'name' => __('Listing published', 'geodirectory'),
3108
-                    'desc' => __('No', 'geodirectory'),
3109
-                    'id' => 'geodir_bcc_listing_published',
3110
-                    'std' => 'yes',
3111
-                    'type' => 'radio',
3112
-                    'value' => '0',
3113
-                    'radiogroup' => 'end'
3114
-                );
3115
-
3116
-                $new_settings[] = $geodir_bcc_listing_published_yes;
3117
-                $new_settings[] = $geodir_bcc_listing_published_no;
3118
-            }
3119
-            $new_settings[] = $setting;
3120
-        }
3121
-        $settings = $new_settings;
3122
-    }
3092
+	if (!empty($settings)) {
3093
+		$new_settings = array();
3094
+		foreach ($settings as $setting) {
3095
+			if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
3096
+				$geodir_bcc_listing_published_yes = array(
3097
+					'name' => __('Listing published', 'geodirectory'),
3098
+					'desc' => __('Yes', 'geodirectory'),
3099
+					'id' => 'geodir_bcc_listing_published',
3100
+					'std' => 'yes',
3101
+					'type' => 'radio',
3102
+					'value' => '1',
3103
+					'radiogroup' => 'start'
3104
+				);
3105
+
3106
+				$geodir_bcc_listing_published_no = array(
3107
+					'name' => __('Listing published', 'geodirectory'),
3108
+					'desc' => __('No', 'geodirectory'),
3109
+					'id' => 'geodir_bcc_listing_published',
3110
+					'std' => 'yes',
3111
+					'type' => 'radio',
3112
+					'value' => '0',
3113
+					'radiogroup' => 'end'
3114
+				);
3115
+
3116
+				$new_settings[] = $geodir_bcc_listing_published_yes;
3117
+				$new_settings[] = $geodir_bcc_listing_published_no;
3118
+			}
3119
+			$new_settings[] = $setting;
3120
+		}
3121
+		$settings = $new_settings;
3122
+	}
3123 3123
 
3124
-    return $settings;
3124
+	return $settings;
3125 3125
 }
3126 3126
 
3127 3127
 
@@ -3136,19 +3136,19 @@  discard block
 block discarded – undo
3136 3136
  */
3137 3137
 function get_gd_theme_compat_callback()
3138 3138
 {
3139
-    global $wpdb;
3140
-    $themes = get_option('gd_theme_compats');
3141
-
3142
-    if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
3143
-        if (isset($_POST['export'])) {
3144
-            echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
3145
-        } else {
3146
-            echo json_encode($themes[$_POST['theme']]);
3147
-        }
3139
+	global $wpdb;
3140
+	$themes = get_option('gd_theme_compats');
3148 3141
 
3149
-    }
3142
+	if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
3143
+		if (isset($_POST['export'])) {
3144
+			echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
3145
+		} else {
3146
+			echo json_encode($themes[$_POST['theme']]);
3147
+		}
3148
+
3149
+	}
3150 3150
 
3151
-    die();
3151
+	die();
3152 3152
 }
3153 3153
 
3154 3154
 add_action('wp_ajax_get_gd_theme_compat_import_callback', 'get_gd_theme_compat_import_callback');
@@ -3162,20 +3162,20 @@  discard block
 block discarded – undo
3162 3162
  */
3163 3163
 function get_gd_theme_compat_import_callback()
3164 3164
 {
3165
-    global $wpdb;
3166
-    $themes = get_option('gd_theme_compats');
3167
-    if (isset($_POST['theme']) && !empty($_POST['theme'])) {
3168
-        $json = json_decode(stripslashes($_POST['theme']), true);
3169
-        if (!empty($json) && is_array($json)) {
3170
-            $key = sanitize_text_field(key($json));
3171
-            $themes[$key] = $json[$key];
3172
-            update_option('gd_theme_compats', $themes);
3173
-            echo $key;
3174
-            die();
3175
-        }
3176
-    }
3177
-    echo '0';
3178
-    die();
3165
+	global $wpdb;
3166
+	$themes = get_option('gd_theme_compats');
3167
+	if (isset($_POST['theme']) && !empty($_POST['theme'])) {
3168
+		$json = json_decode(stripslashes($_POST['theme']), true);
3169
+		if (!empty($json) && is_array($json)) {
3170
+			$key = sanitize_text_field(key($json));
3171
+			$themes[$key] = $json[$key];
3172
+			update_option('gd_theme_compats', $themes);
3173
+			echo $key;
3174
+			die();
3175
+		}
3176
+	}
3177
+	echo '0';
3178
+	die();
3179 3179
 }
3180 3180
 
3181 3181
 
@@ -3188,39 +3188,39 @@  discard block
 block discarded – undo
3188 3188
  */
3189 3189
 function gd_set_theme_compat()
3190 3190
 {
3191
-    global $wpdb;
3192
-    $theme = wp_get_theme();
3191
+	global $wpdb;
3192
+	$theme = wp_get_theme();
3193 3193
 
3194
-    if ($theme->parent()) {
3195
-        $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
3196
-    } else {
3197
-        $theme_name = str_replace(" ", "_", $theme->get('Name'));
3198
-    }
3194
+	if ($theme->parent()) {
3195
+		$theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
3196
+	} else {
3197
+		$theme_name = str_replace(" ", "_", $theme->get('Name'));
3198
+	}
3199 3199
 
3200
-    $theme_compats = get_option('gd_theme_compats');
3201
-    $current_compat = get_option('gd_theme_compat');
3202
-    $current_compat = str_replace("_custom", "", $current_compat);
3200
+	$theme_compats = get_option('gd_theme_compats');
3201
+	$current_compat = get_option('gd_theme_compat');
3202
+	$current_compat = str_replace("_custom", "", $current_compat);
3203 3203
 
3204
-    if ($current_compat == $theme_name && strpos("_custom", get_option('gd_theme_compat')) !== false) {
3205
-        return;
3206
-    }// if already running corect compat then bail
3204
+	if ($current_compat == $theme_name && strpos("_custom", get_option('gd_theme_compat')) !== false) {
3205
+		return;
3206
+	}// if already running corect compat then bail
3207 3207
 
3208
-    if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
3209
-        update_option('gd_theme_compat', $theme_name);
3210
-        update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
3208
+	if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
3209
+		update_option('gd_theme_compat', $theme_name);
3210
+		update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
3211 3211
 
3212
-        // if there are default options to set then set them
3213
-        if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
3212
+		// if there are default options to set then set them
3213
+		if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
3214 3214
 
3215
-            foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
3216
-                update_option($key, $val);
3217
-            }
3218
-        }
3215
+			foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
3216
+				update_option($key, $val);
3217
+			}
3218
+		}
3219 3219
 
3220
-    } else {
3221
-        update_option('gd_theme_compat', '');
3222
-        update_option('theme_compatibility_setting', '');
3223
-    }
3220
+	} else {
3221
+		update_option('gd_theme_compat', '');
3222
+		update_option('theme_compatibility_setting', '');
3223
+	}
3224 3224
 
3225 3225
 
3226 3226
 }
@@ -3235,9 +3235,9 @@  discard block
 block discarded – undo
3235 3235
  */
3236 3236
 function gd_check_avada_compat()
3237 3237
 {
3238
-    if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
3239
-        add_action('admin_notices', 'gd_avada_compat_warning');
3240
-    }
3238
+	if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
3239
+		add_action('admin_notices', 'gd_avada_compat_warning');
3240
+	}
3241 3241
 }
3242 3242
 
3243 3243
 
@@ -3250,22 +3250,22 @@  discard block
 block discarded – undo
3250 3250
 function gd_avada_compat_warning()
3251 3251
 {
3252 3252
 
3253
-    /*
3253
+	/*
3254 3254
     $msg_type = error
3255 3255
     $msg_type = updated fade
3256 3256
     $msg_type = update-nag
3257 3257
     */
3258 3258
 
3259
-    $plugin = 'avada-nag';
3260
-    $timestamp = 'avada-nag1234';
3261
-    $message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
3262
-    echo '<div id="' . $timestamp . '"  class="error">';
3263
-    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
3264
-    echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
3265
-    echo "<p>$message</p>";
3266
-    echo "</div>";
3259
+	$plugin = 'avada-nag';
3260
+	$timestamp = 'avada-nag1234';
3261
+	$message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
3262
+	echo '<div id="' . $timestamp . '"  class="error">';
3263
+	echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
3264
+	echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
3265
+	echo "<p>$message</p>";
3266
+	echo "</div>";
3267 3267
 
3268
-    ?>
3268
+	?>
3269 3269
     <script>
3270 3270
         function gdRemoveANotification($plugin, $timestamp) {
3271 3271
 
@@ -3333,10 +3333,10 @@  discard block
 block discarded – undo
3333 3333
  */
3334 3334
 function geodir_avada_remove_notification()
3335 3335
 {
3336
-    update_option('avada_nag', TRUE);
3336
+	update_option('avada_nag', TRUE);
3337 3337
 
3338
-    // Always die in functions echoing ajax content
3339
-    die();
3338
+	// Always die in functions echoing ajax content
3339
+	die();
3340 3340
 }
3341 3341
 
3342 3342
 
@@ -3395,7 +3395,7 @@  discard block
 block discarded – undo
3395 3395
 		// Don't allow same slug url for listing and location
3396 3396
 		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
3397 3397
 			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
3398
-        	wp_redirect($redirect_url);
3398
+			wp_redirect($redirect_url);
3399 3399
 			exit;
3400 3400
 		}
3401 3401
 		
@@ -3425,10 +3425,10 @@  discard block
 block discarded – undo
3425 3425
  * @package GeoDirectory
3426 3426
  */
3427 3427
 function geodir_hide_admin_preview_button() {
3428
-    global $post_type;
3429
-    $post_types = geodir_get_posttypes();
3430
-    if(in_array($post_type, $post_types))
3431
-        echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
3428
+	global $post_type;
3429
+	$post_types = geodir_get_posttypes();
3430
+	if(in_array($post_type, $post_types))
3431
+		echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
3432 3432
 }
3433 3433
 add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
3434 3434
 add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
@@ -3443,7 +3443,7 @@  discard block
 block discarded – undo
3443 3443
  */
3444 3444
 function geodir_import_export_tab( $tabs ) {
3445 3445
 	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
3446
-    return $tabs;
3446
+	return $tabs;
3447 3447
 }
3448 3448
 
3449 3449
 /**
@@ -3458,26 +3458,26 @@  discard block
 block discarded – undo
3458 3458
 function geodir_import_export_page() {
3459 3459
 	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
3460 3460
 	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
3461
-    /**
3462
-     * Filter sample category data csv file url.
3463
-     *
3464
-     * @since 1.0.0
3465
-     * @package GeoDirectory
3466
-     *
3467
-     * @param string $gd_cats_sample_csv Sample category data csv file url.
3468
-     */
3461
+	/**
3462
+	 * Filter sample category data csv file url.
3463
+	 *
3464
+	 * @since 1.0.0
3465
+	 * @package GeoDirectory
3466
+	 *
3467
+	 * @param string $gd_cats_sample_csv Sample category data csv file url.
3468
+	 */
3469 3469
 	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
3470 3470
 	
3471 3471
 	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
3472
-    /**
3473
-     * Filter sample post data csv file url.
3474
-     *
3475
-     * @since 1.0.0
3476
-     * @package GeoDirectory
3477
-     *
3478
-     * @param string $gd_posts_sample_csv Sample post data csv file url.
3479
-     */
3480
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
3472
+	/**
3473
+	 * Filter sample post data csv file url.
3474
+	 *
3475
+	 * @since 1.0.0
3476
+	 * @package GeoDirectory
3477
+	 *
3478
+	 * @param string $gd_posts_sample_csv Sample post data csv file url.
3479
+	 */
3480
+	$gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
3481 3481
 	
3482 3482
 	$gd_posttypes = geodir_get_posttypes( 'array' );
3483 3483
 	
@@ -3500,14 +3500,14 @@  discard block
 block discarded – undo
3500 3500
 	$gd_chunksize_options[100000] = 100000;
3501 3501
 	 
3502 3502
 	 /**
3503
-     * Filter max entries per export csv file.
3504
-     *
3505
-     * @since 1.5.6
3506
-     * @package GeoDirectory
3507
-     *
3508
-     * @param string $gd_chunksize_options Entries options.
3509
-     */
3510
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
3503
+	  * Filter max entries per export csv file.
3504
+	  *
3505
+	  * @since 1.5.6
3506
+	  * @package GeoDirectory
3507
+	  *
3508
+	  * @param string $gd_chunksize_options Entries options.
3509
+	  */
3510
+	$gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
3511 3511
 	
3512 3512
 	$gd_chunksize_option = '';
3513 3513
 	foreach ($gd_chunksize_options as $value => $title) {
@@ -3523,12 +3523,12 @@  discard block
 block discarded – undo
3523 3523
   <div class="gd-content-heading">
3524 3524
 
3525 3525
   <?php
3526
-    ini_set('max_execution_time', 999999);
3527
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
3528
-    ini_restore('max_execution_time');
3526
+	ini_set('max_execution_time', 999999);
3527
+	$ini_max_execution_time_check = @ini_get( 'max_execution_time' );
3528
+	ini_restore('max_execution_time');
3529 3529
 
3530
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
3531
-        ?>
3530
+	if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
3531
+		?>
3532 3532
 	<div id="gd_ie_reqs" class="metabox-holder">
3533 3533
       <div class="meta-box-sortables ui-sortable">
3534 3534
         <div class="postbox">
@@ -3694,7 +3694,7 @@  discard block
 block discarded – undo
3694 3694
 						 * Called just after the sample CSV download link.
3695 3695
 						 *
3696 3696
 						 * @since 1.0.0
3697
-                         * @package GeoDirectory
3697
+						 * @package GeoDirectory
3698 3698
 						 */
3699 3699
 						do_action('geodir_sample_cats_csv_download_link');
3700 3700
 						?>
@@ -3778,11 +3778,11 @@  discard block
 block discarded – undo
3778 3778
 	 *
3779 3779
 	 * Called after the last setting on the GD > Import & Export page.
3780 3780
 	 * @since 1.4.6
3781
-     * @package GeoDirectory
3781
+	 * @package GeoDirectory
3782 3782
 	 *
3783 3783
 	 * @param array $gd_posttypes GD post types.
3784
-     * @param array $gd_chunksize_options File chunk size options.
3785
-     * @param string $nonce Wordpress security token for GD import & export.
3784
+	 * @param array $gd_chunksize_options File chunk size options.
3785
+	 * @param string $nonce Wordpress security token for GD import & export.
3786 3786
 	 */
3787 3787
 	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
3788 3788
 	?>
@@ -4422,44 +4422,44 @@  discard block
 block discarded – undo
4422 4422
 function geodir_init_filesystem()
4423 4423
 {
4424 4424
 
4425
-    if(!function_exists('get_filesystem_method')){
4426
-        require_once(ABSPATH."/wp-admin/includes/file.php");
4427
-    }
4428
-    $access_type = get_filesystem_method();
4429
-    if ($access_type === 'direct') {
4430
-        /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
4431
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
4432
-
4433
-        /* initialize the API */
4434
-        if (!WP_Filesystem($creds)) {
4435
-            /* any problems and we exit */
4436
-            //return '@@@3';
4437
-            return false;
4438
-        }
4425
+	if(!function_exists('get_filesystem_method')){
4426
+		require_once(ABSPATH."/wp-admin/includes/file.php");
4427
+	}
4428
+	$access_type = get_filesystem_method();
4429
+	if ($access_type === 'direct') {
4430
+		/* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
4431
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
4432
+
4433
+		/* initialize the API */
4434
+		if (!WP_Filesystem($creds)) {
4435
+			/* any problems and we exit */
4436
+			//return '@@@3';
4437
+			return false;
4438
+		}
4439 4439
 
4440
-        global $wp_filesystem;
4441
-        return $wp_filesystem;
4442
-        /* do our file manipulations below */
4443
-    } elseif (defined('FTP_USER')) {
4444
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
4445
-
4446
-        /* initialize the API */
4447
-        if (!WP_Filesystem($creds)) {
4448
-            /* any problems and we exit */
4449
-            //return '@@@33';
4450
-            return false;
4451
-        }
4440
+		global $wp_filesystem;
4441
+		return $wp_filesystem;
4442
+		/* do our file manipulations below */
4443
+	} elseif (defined('FTP_USER')) {
4444
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
4452 4445
 
4453
-        global $wp_filesystem;
4454
-        //return '@@@1';
4455
-        return $wp_filesystem;
4446
+		/* initialize the API */
4447
+		if (!WP_Filesystem($creds)) {
4448
+			/* any problems and we exit */
4449
+			//return '@@@33';
4450
+			return false;
4451
+		}
4456 4452
 
4457
-    } else {
4458
-        //return '@@@2';
4459
-        /* don't have direct write access. Prompt user with our notice */
4460
-        add_action('admin_notice', 'geodir_filesystem_notice');
4461
-        return false;
4462
-    }
4453
+		global $wp_filesystem;
4454
+		//return '@@@1';
4455
+		return $wp_filesystem;
4456
+
4457
+	} else {
4458
+		//return '@@@2';
4459
+		/* don't have direct write access. Prompt user with our notice */
4460
+		add_action('admin_notice', 'geodir_filesystem_notice');
4461
+		return false;
4462
+	}
4463 4463
 
4464 4464
 }
4465 4465
 
@@ -4477,10 +4477,10 @@  discard block
 block discarded – undo
4477 4477
  */
4478 4478
 function geodir_filesystem_notice()
4479 4479
 {   if ( defined( 'DOING_AJAX' ) ){return;}
4480
-    $access_type = get_filesystem_method();
4481
-    if ($access_type === 'direct') {
4482
-    } elseif (!defined('FTP_USER')) {
4483
-        ?>
4480
+	$access_type = get_filesystem_method();
4481
+	if ($access_type === 'direct') {
4482
+	} elseif (!defined('FTP_USER')) {
4483
+		?>
4484 4484
         <div class="error">
4485 4485
             <p><?php _e('GeoDirectory does not have access to your filesystem, thing like import/export will not work. Please define your details in wp-config.php as explained here', 'geodirectory'); ?>
4486 4486
                 <a target="_blank" href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants">http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants</a>
@@ -4506,1235 +4506,1235 @@  discard block
 block discarded – undo
4506 4506
  * @return string Json data.
4507 4507
  */
4508 4508
 function geodir_ajax_import_export() {
4509
-    global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
4509
+	global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
4510 4510
     
4511
-    error_reporting(0);
4511
+	error_reporting(0);
4512 4512
 
4513
-    // try to set higher limits for import
4514
-    $max_input_time = ini_get('max_input_time');
4515
-    $max_execution_time = ini_get('max_execution_time');
4516
-    $memory_limit= ini_get('memory_limit');
4513
+	// try to set higher limits for import
4514
+	$max_input_time = ini_get('max_input_time');
4515
+	$max_execution_time = ini_get('max_execution_time');
4516
+	$memory_limit= ini_get('memory_limit');
4517 4517
 
4518
-    if(!$max_input_time || $max_input_time<3000){
4519
-        ini_set('max_input_time', 3000);
4520
-    }
4518
+	if(!$max_input_time || $max_input_time<3000){
4519
+		ini_set('max_input_time', 3000);
4520
+	}
4521 4521
 
4522
-    if(!$max_execution_time || $max_execution_time<3000){
4523
-        ini_set('max_execution_time', 3000);
4524
-    }
4522
+	if(!$max_execution_time || $max_execution_time<3000){
4523
+		ini_set('max_execution_time', 3000);
4524
+	}
4525 4525
 
4526
-    if($memory_limit && str_replace('M','',$memory_limit)){
4527
-        if(str_replace('M','',$memory_limit)<256){
4528
-            ini_set('memory_limit', '256M');
4529
-        }
4530
-    }
4526
+	if($memory_limit && str_replace('M','',$memory_limit)){
4527
+		if(str_replace('M','',$memory_limit)<256){
4528
+			ini_set('memory_limit', '256M');
4529
+		}
4530
+	}
4531 4531
 
4532
-    $json = array();
4532
+	$json = array();
4533 4533
 
4534
-    if ( !current_user_can( 'manage_options' ) ) {
4535
-        wp_send_json( $json );
4536
-    }
4534
+	if ( !current_user_can( 'manage_options' ) ) {
4535
+		wp_send_json( $json );
4536
+	}
4537 4537
 
4538
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
4539
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
4540
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
4538
+	$task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
4539
+	$nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
4540
+	$stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
4541 4541
 
4542
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
4543
-        wp_send_json( $json );
4544
-    }
4542
+	if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
4543
+		wp_send_json( $json );
4544
+	}
4545 4545
 
4546
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
4547
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
4548
-    $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
4549
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
4546
+	$post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
4547
+	$chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
4548
+	$chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
4549
+	$chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
4550 4550
 
4551
-    $wp_filesystem = geodir_init_filesystem();
4552
-    if (!$wp_filesystem) {
4553
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
4554
-        wp_send_json( $json );
4555
-    }
4551
+	$wp_filesystem = geodir_init_filesystem();
4552
+	if (!$wp_filesystem) {
4553
+		$json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
4554
+		wp_send_json( $json );
4555
+	}
4556 4556
 
4557
-    if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
4558
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
4559
-        wp_send_json( $json );
4560
-    }
4557
+	if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
4558
+		$json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
4559
+		wp_send_json( $json );
4560
+	}
4561 4561
 
4562
-    $csv_file_dir = geodir_path_import_export( false );
4563
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
4564
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
4565
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
4566
-            wp_send_json( $json );
4567
-        }
4568
-    }
4562
+	$csv_file_dir = geodir_path_import_export( false );
4563
+	if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
4564
+		if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
4565
+			$json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
4566
+			wp_send_json( $json );
4567
+		}
4568
+	}
4569 4569
 
4570
-    switch ( $task ) {
4571
-        case 'export_posts': {
4572
-            // WPML
4573
-            $is_wpml = geodir_is_wpml();
4574
-            if ($is_wpml) {
4575
-                global $sitepress;
4576
-                $active_lang = ICL_LANGUAGE_CODE;
4570
+	switch ( $task ) {
4571
+		case 'export_posts': {
4572
+			// WPML
4573
+			$is_wpml = geodir_is_wpml();
4574
+			if ($is_wpml) {
4575
+				global $sitepress;
4576
+				$active_lang = ICL_LANGUAGE_CODE;
4577 4577
                 
4578
-                $sitepress->switch_lang('all', true);
4579
-            }
4580
-            // WPML
4581
-            if ( $post_type == 'gd_event' ) {
4582
-                //add_filter( 'geodir_imex_count_posts', 'geodir_imex_count_events', 10, 2 );
4583
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
4584
-            }
4585
-            $file_name = $post_type . '_' . date( 'dmyHi' );
4586
-            $posts_count = geodir_get_posts_count( $post_type );
4587
-            $file_url_base = geodir_path_import_export() . '/';
4588
-            $file_url = $file_url_base . $file_name . '.csv';
4589
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
4590
-            $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
4578
+				$sitepress->switch_lang('all', true);
4579
+			}
4580
+			// WPML
4581
+			if ( $post_type == 'gd_event' ) {
4582
+				//add_filter( 'geodir_imex_count_posts', 'geodir_imex_count_events', 10, 2 );
4583
+				add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
4584
+			}
4585
+			$file_name = $post_type . '_' . date( 'dmyHi' );
4586
+			$posts_count = geodir_get_posts_count( $post_type );
4587
+			$file_url_base = geodir_path_import_export() . '/';
4588
+			$file_url = $file_url_base . $file_name . '.csv';
4589
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
4590
+			$file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
4591 4591
             
4592
-            $chunk_file_paths = array();
4592
+			$chunk_file_paths = array();
4593 4593
 
4594
-            if ( isset( $_REQUEST['_st'] ) ) {
4595
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
4596
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
4597
-                $percentage = min( $percentage, 100 );
4594
+			if ( isset( $_REQUEST['_st'] ) ) {
4595
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
4596
+				$percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
4597
+				$percentage = min( $percentage, 100 );
4598 4598
                 
4599
-                $json['percentage'] = $percentage;
4600
-                // WPML
4601
-                if ($is_wpml) {
4602
-                    $sitepress->switch_lang($active_lang, true);
4603
-                }
4604
-                // WPML
4605
-                wp_send_json( $json );
4606
-                exit;
4607
-            } else {				
4608
-                if ( !$posts_count > 0 ) {
4609
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
4610
-                } else {
4611
-                    $total_posts = $posts_count;
4612
-                    if ($chunk_per_page > $total_posts) {
4613
-                        $chunk_per_page = $total_posts;
4614
-                    }
4615
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
4599
+				$json['percentage'] = $percentage;
4600
+				// WPML
4601
+				if ($is_wpml) {
4602
+					$sitepress->switch_lang($active_lang, true);
4603
+				}
4604
+				// WPML
4605
+				wp_send_json( $json );
4606
+				exit;
4607
+			} else {				
4608
+				if ( !$posts_count > 0 ) {
4609
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
4610
+				} else {
4611
+					$total_posts = $posts_count;
4612
+					if ($chunk_per_page > $total_posts) {
4613
+						$chunk_per_page = $total_posts;
4614
+					}
4615
+					$chunk_total_pages = ceil( $total_posts / $chunk_per_page );
4616 4616
                     
4617
-                    $j = $chunk_page_no;
4618
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
4617
+					$j = $chunk_page_no;
4618
+					$chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
4619 4619
                     
4620
-                    $per_page = 500;
4621
-                    if ($per_page > $chunk_per_page) {
4622
-                        $per_page = $chunk_per_page;
4623
-                    }
4624
-                    $total_pages = ceil( $chunk_per_page / $per_page );
4620
+					$per_page = 500;
4621
+					if ($per_page > $chunk_per_page) {
4622
+						$per_page = $chunk_per_page;
4623
+					}
4624
+					$total_pages = ceil( $chunk_per_page / $per_page );
4625 4625
                     
4626
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
4627
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
4626
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
4627
+						$save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
4628 4628
                         
4629
-                        $clear = $i == 0 ? true : false;
4630
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
4631
-                    }
4629
+						$clear = $i == 0 ? true : false;
4630
+						geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
4631
+					}
4632 4632
                         
4633
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
4634
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
4635
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
4636
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
4637
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
4633
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
4634
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
4635
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
4636
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
4637
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
4638 4638
                         
4639
-                        $file_url = $file_url_base . $chunk_file_name;
4640
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
4641
-                    }
4639
+						$file_url = $file_url_base . $chunk_file_name;
4640
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
4641
+					}
4642 4642
                     
4643
-                    if ( !empty($chunk_file_paths) ) {
4644
-                        $json['total'] = $posts_count;
4645
-                        $json['files'] = $chunk_file_paths;
4646
-                    } else {
4647
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
4648
-                    }
4649
-                }
4650
-                // WPML
4651
-                if ($is_wpml) {
4652
-                    $sitepress->switch_lang($active_lang, true);
4653
-                }
4654
-                // WPML
4655
-                wp_send_json( $json );
4656
-            }
4657
-        }
4658
-        break;
4659
-        case 'export_cats': {
4660
-            // WPML
4661
-            $is_wpml = geodir_is_wpml();
4662
-            if ($is_wpml) {
4663
-                global $sitepress;
4664
-                $active_lang = ICL_LANGUAGE_CODE;
4643
+					if ( !empty($chunk_file_paths) ) {
4644
+						$json['total'] = $posts_count;
4645
+						$json['files'] = $chunk_file_paths;
4646
+					} else {
4647
+						$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
4648
+					}
4649
+				}
4650
+				// WPML
4651
+				if ($is_wpml) {
4652
+					$sitepress->switch_lang($active_lang, true);
4653
+				}
4654
+				// WPML
4655
+				wp_send_json( $json );
4656
+			}
4657
+		}
4658
+		break;
4659
+		case 'export_cats': {
4660
+			// WPML
4661
+			$is_wpml = geodir_is_wpml();
4662
+			if ($is_wpml) {
4663
+				global $sitepress;
4664
+				$active_lang = ICL_LANGUAGE_CODE;
4665 4665
                 
4666
-                $sitepress->switch_lang('all', true);
4667
-            }
4668
-            // WPML
4669
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
4666
+				$sitepress->switch_lang('all', true);
4667
+			}
4668
+			// WPML
4669
+			$file_name = $post_type . 'category_' . date( 'dmyHi' );
4670 4670
             
4671
-            $terms_count = geodir_get_terms_count( $post_type );
4672
-            $file_url_base = geodir_path_import_export() . '/';
4673
-            $file_url = $file_url_base . $file_name . '.csv';
4674
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
4675
-            $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
4671
+			$terms_count = geodir_get_terms_count( $post_type );
4672
+			$file_url_base = geodir_path_import_export() . '/';
4673
+			$file_url = $file_url_base . $file_name . '.csv';
4674
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
4675
+			$file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
4676 4676
             
4677
-            $chunk_file_paths = array();
4677
+			$chunk_file_paths = array();
4678 4678
             
4679
-            if ( isset( $_REQUEST['_st'] ) ) {
4680
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
4681
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
4682
-                $percentage = min( $percentage, 100 );
4679
+			if ( isset( $_REQUEST['_st'] ) ) {
4680
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
4681
+				$percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
4682
+				$percentage = min( $percentage, 100 );
4683 4683
                 
4684
-                $json['percentage'] = $percentage;
4685
-                // WPML
4686
-                if ($is_wpml) {
4687
-                    $sitepress->switch_lang($active_lang, true);
4688
-                }
4689
-                // WPML
4690
-                wp_send_json( $json );
4691
-            } else {				
4692
-                if ( !$terms_count > 0 ) {
4693
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
4694
-                } else {
4695
-                    $total_terms = $terms_count;
4696
-                    if ($chunk_per_page > $terms_count) {
4697
-                        $chunk_per_page = $terms_count;
4698
-                    }
4699
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
4684
+				$json['percentage'] = $percentage;
4685
+				// WPML
4686
+				if ($is_wpml) {
4687
+					$sitepress->switch_lang($active_lang, true);
4688
+				}
4689
+				// WPML
4690
+				wp_send_json( $json );
4691
+			} else {				
4692
+				if ( !$terms_count > 0 ) {
4693
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
4694
+				} else {
4695
+					$total_terms = $terms_count;
4696
+					if ($chunk_per_page > $terms_count) {
4697
+						$chunk_per_page = $terms_count;
4698
+					}
4699
+					$chunk_total_pages = ceil( $total_terms / $chunk_per_page );
4700 4700
                     
4701
-                    $j = $chunk_page_no;					
4702
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
4701
+					$j = $chunk_page_no;					
4702
+					$chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
4703 4703
                     
4704
-                    $per_page = 500;
4705
-                    if ($per_page > $chunk_per_page) {
4706
-                        $per_page = $chunk_per_page;
4707
-                    }
4708
-                    $total_pages = ceil( $chunk_per_page / $per_page );
4704
+					$per_page = 500;
4705
+					if ($per_page > $chunk_per_page) {
4706
+						$per_page = $chunk_per_page;
4707
+					}
4708
+					$total_pages = ceil( $chunk_per_page / $per_page );
4709 4709
                     
4710
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
4711
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
4710
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
4711
+						$save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
4712 4712
                         
4713
-                        $clear = $i == 0 ? true : false;
4714
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
4715
-                    }
4713
+						$clear = $i == 0 ? true : false;
4714
+						geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
4715
+					}
4716 4716
                     
4717
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
4718
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
4719
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
4720
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
4721
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
4717
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
4718
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
4719
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
4720
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
4721
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
4722 4722
                         
4723
-                        $file_url = $file_url_base . $chunk_file_name;
4724
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
4725
-                    }
4723
+						$file_url = $file_url_base . $chunk_file_name;
4724
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
4725
+					}
4726 4726
                     
4727
-                    if ( !empty($chunk_file_paths) ) {
4728
-                        $json['total'] = $terms_count;
4729
-                        $json['files'] = $chunk_file_paths;
4730
-                    } else {
4731
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
4732
-                    }
4733
-                }
4734
-                // WPML
4735
-                if ($is_wpml) {
4736
-                    $sitepress->switch_lang($active_lang, true);
4737
-                }
4738
-                // WPML
4739
-                wp_send_json( $json );
4740
-            }
4741
-        }
4742
-        break;
4743
-        case 'export_locations': {
4744
-            $file_url_base = geodir_path_import_export() . '/';
4745
-            $file_name = 'gd_locations_' . date( 'dmyHi' );			
4746
-            $file_url = $file_url_base . $file_name . '.csv';
4747
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
4748
-            $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
4727
+					if ( !empty($chunk_file_paths) ) {
4728
+						$json['total'] = $terms_count;
4729
+						$json['files'] = $chunk_file_paths;
4730
+					} else {
4731
+						$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
4732
+					}
4733
+				}
4734
+				// WPML
4735
+				if ($is_wpml) {
4736
+					$sitepress->switch_lang($active_lang, true);
4737
+				}
4738
+				// WPML
4739
+				wp_send_json( $json );
4740
+			}
4741
+		}
4742
+		break;
4743
+		case 'export_locations': {
4744
+			$file_url_base = geodir_path_import_export() . '/';
4745
+			$file_name = 'gd_locations_' . date( 'dmyHi' );			
4746
+			$file_url = $file_url_base . $file_name . '.csv';
4747
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
4748
+			$file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
4749 4749
             
4750
-            $items_count = (int)geodir_location_imex_count_locations();
4750
+			$items_count = (int)geodir_location_imex_count_locations();
4751 4751
             
4752
-            if ( isset( $_REQUEST['_st'] ) ) {
4753
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
4754
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
4755
-                $percentage = min( $percentage, 100 );
4752
+			if ( isset( $_REQUEST['_st'] ) ) {
4753
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
4754
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
4755
+				$percentage = min( $percentage, 100 );
4756 4756
                 
4757
-                $json['percentage'] = $percentage;
4758
-                wp_send_json( $json );
4759
-            } else {
4760
-                $chunk_file_paths = array();
4757
+				$json['percentage'] = $percentage;
4758
+				wp_send_json( $json );
4759
+			} else {
4760
+				$chunk_file_paths = array();
4761 4761
                 
4762
-                if ( !$items_count > 0 ) {
4763
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
4764
-                } else {
4765
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
4766
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
4762
+				if ( !$items_count > 0 ) {
4763
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
4764
+				} else {
4765
+					$chunk_per_page = min( $chunk_per_page, $items_count );
4766
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
4767 4767
                     
4768
-                    $j = $chunk_page_no;					
4769
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
4768
+					$j = $chunk_page_no;					
4769
+					$chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
4770 4770
                     
4771
-                    $per_page = 500;
4772
-                    $per_page = min( $per_page, $chunk_per_page );
4773
-                    $total_pages = ceil( $chunk_per_page / $per_page );
4771
+					$per_page = 500;
4772
+					$per_page = min( $per_page, $chunk_per_page );
4773
+					$total_pages = ceil( $chunk_per_page / $per_page );
4774 4774
                     
4775
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
4776
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
4775
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
4776
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
4777 4777
                         
4778
-                        $clear = $i == 0 ? true : false;
4779
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
4780
-                    }
4778
+						$clear = $i == 0 ? true : false;
4779
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
4780
+					}
4781 4781
                     
4782
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
4783
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
4784
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
4785
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
4786
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
4782
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
4783
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
4784
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
4785
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
4786
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
4787 4787
                         
4788
-                        $file_url = $file_url_base . $chunk_file_name;
4789
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
4790
-                    }
4788
+						$file_url = $file_url_base . $chunk_file_name;
4789
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
4790
+					}
4791 4791
                     
4792
-                    if ( !empty($chunk_file_paths) ) {
4793
-                        $json['total'] = $items_count;
4794
-                        $json['files'] = $chunk_file_paths;
4795
-                    } else {
4796
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
4797
-                    }
4798
-                }
4799
-                wp_send_json( $json );
4800
-            }
4801
-        }
4802
-        break;
4803
-        case 'prepare_import':
4804
-        case 'import_cat':
4805
-        case 'import_post':
4806
-        case 'import_loc': {
4807
-            // WPML
4808
-            $is_wpml = geodir_is_wpml();
4809
-            if ($is_wpml) {
4810
-                global $sitepress;
4811
-                $active_lang = ICL_LANGUAGE_CODE;
4812
-            }
4813
-            // WPML
4792
+					if ( !empty($chunk_file_paths) ) {
4793
+						$json['total'] = $items_count;
4794
+						$json['files'] = $chunk_file_paths;
4795
+					} else {
4796
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
4797
+					}
4798
+				}
4799
+				wp_send_json( $json );
4800
+			}
4801
+		}
4802
+		break;
4803
+		case 'prepare_import':
4804
+		case 'import_cat':
4805
+		case 'import_post':
4806
+		case 'import_loc': {
4807
+			// WPML
4808
+			$is_wpml = geodir_is_wpml();
4809
+			if ($is_wpml) {
4810
+				global $sitepress;
4811
+				$active_lang = ICL_LANGUAGE_CODE;
4812
+			}
4813
+			// WPML
4814 4814
             
4815
-            ini_set( 'auto_detect_line_endings', true );
4815
+			ini_set( 'auto_detect_line_endings', true );
4816 4816
             
4817
-            $uploads = wp_upload_dir();
4818
-            $uploads_dir = $uploads['path'];
4819
-            $uploads_subdir = $uploads['subdir'];
4817
+			$uploads = wp_upload_dir();
4818
+			$uploads_dir = $uploads['path'];
4819
+			$uploads_subdir = $uploads['subdir'];
4820 4820
             
4821
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
4822
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
4821
+			$csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
4822
+			$import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
4823 4823
             
4824
-            $csv_file_arr = explode( '/', $csv_file );
4825
-            $csv_filename = end( $csv_file_arr );
4826
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
4824
+			$csv_file_arr = explode( '/', $csv_file );
4825
+			$csv_filename = end( $csv_file_arr );
4826
+			$target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
4827 4827
             
4828
-            $json['file'] = $csv_file;
4829
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
4828
+			$json['file'] = $csv_file;
4829
+			$json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
4830 4830
 
4831
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
4832
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
4831
+			if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
4832
+				$wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
4833 4833
                 
4834
-                if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
4835
-                    $json['error'] = NULL;
4836
-                    $json['rows'] = 0;
4834
+				if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
4835
+					$json['error'] = NULL;
4836
+					$json['rows'] = 0;
4837 4837
                     
4838
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
4839
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4840
-                            if ( !empty( $data ) ) {
4841
-                                $file[] = $data;
4842
-                            }
4843
-                        }
4844
-                        fclose($handle);
4845
-                    }
4838
+					if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
4839
+						while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4840
+							if ( !empty( $data ) ) {
4841
+								$file[] = $data;
4842
+							}
4843
+						}
4844
+						fclose($handle);
4845
+					}
4846 4846
 
4847
-                    $json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
4847
+					$json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
4848 4848
                     
4849
-                    if (!$json['rows'] > 0) {
4850
-                        $json['error'] = __('No data found in csv file.', 'geodirectory');
4851
-                    }
4852
-                } else {
4853
-                    wp_send_json( $json );
4854
-                }
4855
-            } else {
4856
-                wp_send_json( $json );
4857
-            }
4849
+					if (!$json['rows'] > 0) {
4850
+						$json['error'] = __('No data found in csv file.', 'geodirectory');
4851
+					}
4852
+				} else {
4853
+					wp_send_json( $json );
4854
+				}
4855
+			} else {
4856
+				wp_send_json( $json );
4857
+			}
4858 4858
             
4859
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4860
-                wp_send_json( $json );
4861
-            }
4859
+			if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4860
+				wp_send_json( $json );
4861
+			}
4862 4862
             
4863
-            $total = $json['rows'];
4864
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4865
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4863
+			$total = $json['rows'];
4864
+			$limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4865
+			$processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4866 4866
             
4867
-            $count = $limit;
4868
-            $requested_limit = $limit;
4867
+			$count = $limit;
4868
+			$requested_limit = $limit;
4869 4869
             
4870
-            if ($count < $total) {
4871
-                $count = $processed + $count;
4872
-                if ($count > $total) {
4873
-                    $count = $total;
4874
-                }
4875
-            } else {
4876
-                $count = $total;
4877
-            }
4870
+			if ($count < $total) {
4871
+				$count = $processed + $count;
4872
+				if ($count > $total) {
4873
+					$count = $total;
4874
+				}
4875
+			} else {
4876
+				$count = $total;
4877
+			}
4878 4878
             
4879
-            $created = 0;
4880
-            $updated = 0;
4881
-            $skipped = 0;
4882
-            $invalid = 0;
4883
-            $invalid_addr = 0;
4884
-            $images = 0;
4879
+			$created = 0;
4880
+			$updated = 0;
4881
+			$skipped = 0;
4882
+			$invalid = 0;
4883
+			$invalid_addr = 0;
4884
+			$images = 0;
4885 4885
             
4886
-            $invalid_title = 0;
4887
-            $customKeyarray = array();
4888
-            $gd_post_info = array();
4889
-            $post_location = array();
4890
-            $countpost = 0;
4886
+			$invalid_title = 0;
4887
+			$customKeyarray = array();
4888
+			$gd_post_info = array();
4889
+			$post_location = array();
4890
+			$countpost = 0;
4891 4891
             
4892
-            $post_types = geodir_get_posttypes();
4892
+			$post_types = geodir_get_posttypes();
4893 4893
 
4894
-            if ( $task == 'import_cat' ) {				
4895
-                if (!empty($file)) {
4896
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4894
+			if ( $task == 'import_cat' ) {				
4895
+				if (!empty($file)) {
4896
+					$columns = isset($file[0]) ? $file[0] : NULL;
4897 4897
                     
4898
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4899
-                        $json['error'] = CSV_INVAILD_FILE;
4900
-                        wp_send_json( $json );
4901
-                        exit;
4902
-                    }
4898
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4899
+						$json['error'] = CSV_INVAILD_FILE;
4900
+						wp_send_json( $json );
4901
+						exit;
4902
+					}
4903 4903
                     
4904
-                    for ($i = 1; $i <= $limit; $i++) {
4905
-                        $index = $processed + $i;
4904
+					for ($i = 1; $i <= $limit; $i++) {
4905
+						$index = $processed + $i;
4906 4906
                         
4907
-                        if (isset($file[$index])) {
4908
-                            $row = $file[$index];
4909
-                            $row = array_map( 'trim', $row );
4910
-                            //$row = array_map( 'utf8_encode', $row );
4907
+						if (isset($file[$index])) {
4908
+							$row = $file[$index];
4909
+							$row = array_map( 'trim', $row );
4910
+							//$row = array_map( 'utf8_encode', $row );
4911 4911
                             
4912
-                            $cat_id = '';
4913
-                            $cat_name = '';
4914
-                            $cat_slug = '';
4915
-                            $cat_posttype = '';
4916
-                            $cat_parent = '';
4917
-                            $cat_description = '';
4918
-                            $cat_schema = '';
4919
-                            $cat_top_description = '';
4920
-                            $cat_image = '';
4921
-                            $cat_icon = '';
4922
-                            $cat_language = '';
4912
+							$cat_id = '';
4913
+							$cat_name = '';
4914
+							$cat_slug = '';
4915
+							$cat_posttype = '';
4916
+							$cat_parent = '';
4917
+							$cat_description = '';
4918
+							$cat_schema = '';
4919
+							$cat_top_description = '';
4920
+							$cat_image = '';
4921
+							$cat_icon = '';
4922
+							$cat_language = '';
4923 4923
                             
4924
-                            $c = 0;
4925
-                            foreach ($columns as $column ) {
4926
-                                if ( $column == 'cat_id' ) {
4927
-                                    $cat_id = (int)$row[$c];
4928
-                                } else if ( $column == 'cat_name' ) {
4929
-                                    $cat_name = $row[$c];
4930
-                                } else if ( $column == 'cat_slug' ) {
4931
-                                    $cat_slug = $row[$c];
4932
-                                } else if ( $column == 'cat_posttype' ) {
4933
-                                    $cat_posttype = $row[$c];
4934
-                                } else if ( $column == 'cat_parent' ) {
4935
-                                    $cat_parent = trim($row[$c]);
4936
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4937
-                                    $cat_schema = $row[$c];
4938
-                                } else if ( $column == 'cat_description' ) {
4939
-                                    $cat_description = $row[$c];
4940
-                                } else if ( $column == 'cat_top_description' ) {
4941
-                                    $cat_top_description = $row[$c];
4942
-                                } else if ( $column == 'cat_image' ) {
4943
-                                    $cat_image = $row[$c];
4944
-                                } else if ( $column == 'cat_icon' ) {
4945
-                                    $cat_icon = $row[$c];
4946
-                                }
4947
-                                // WPML
4948
-                                if ($is_wpml && $column == 'cat_language') {
4949
-                                    $cat_language = geodir_strtolower(trim($row[$c]));
4950
-                                }
4951
-                                // WPML
4952
-                                $c++;
4953
-                            }
4924
+							$c = 0;
4925
+							foreach ($columns as $column ) {
4926
+								if ( $column == 'cat_id' ) {
4927
+									$cat_id = (int)$row[$c];
4928
+								} else if ( $column == 'cat_name' ) {
4929
+									$cat_name = $row[$c];
4930
+								} else if ( $column == 'cat_slug' ) {
4931
+									$cat_slug = $row[$c];
4932
+								} else if ( $column == 'cat_posttype' ) {
4933
+									$cat_posttype = $row[$c];
4934
+								} else if ( $column == 'cat_parent' ) {
4935
+									$cat_parent = trim($row[$c]);
4936
+								} else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4937
+									$cat_schema = $row[$c];
4938
+								} else if ( $column == 'cat_description' ) {
4939
+									$cat_description = $row[$c];
4940
+								} else if ( $column == 'cat_top_description' ) {
4941
+									$cat_top_description = $row[$c];
4942
+								} else if ( $column == 'cat_image' ) {
4943
+									$cat_image = $row[$c];
4944
+								} else if ( $column == 'cat_icon' ) {
4945
+									$cat_icon = $row[$c];
4946
+								}
4947
+								// WPML
4948
+								if ($is_wpml && $column == 'cat_language') {
4949
+									$cat_language = geodir_strtolower(trim($row[$c]));
4950
+								}
4951
+								// WPML
4952
+								$c++;
4953
+							}
4954 4954
                             
4955
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4956
-                                $invalid++;
4957
-                                continue;
4958
-                            }
4955
+							if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4956
+								$invalid++;
4957
+								continue;
4958
+							}
4959 4959
                             
4960
-                            // WPML
4961
-                            if ($is_wpml && $cat_language != '') {
4962
-                                $sitepress->switch_lang($cat_language, true);
4963
-                            }
4964
-                            // WPML
4960
+							// WPML
4961
+							if ($is_wpml && $cat_language != '') {
4962
+								$sitepress->switch_lang($cat_language, true);
4963
+							}
4964
+							// WPML
4965 4965
                                                         
4966
-                            $term_data = array();
4967
-                            $term_data['name'] = $cat_name;
4968
-                            $term_data['slug'] = $cat_slug;
4969
-                            $term_data['description'] = $cat_description;
4970
-                            $term_data['cat_schema'] = $cat_schema;
4971
-                            $term_data['top_description'] = $cat_top_description;
4972
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4973
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4966
+							$term_data = array();
4967
+							$term_data['name'] = $cat_name;
4968
+							$term_data['slug'] = $cat_slug;
4969
+							$term_data['description'] = $cat_description;
4970
+							$term_data['cat_schema'] = $cat_schema;
4971
+							$term_data['top_description'] = $cat_top_description;
4972
+							$term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4973
+							$term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4974 4974
                             
4975
-                            //$term_data = array_map( 'utf8_encode', $term_data );
4975
+							//$term_data = array_map( 'utf8_encode', $term_data );
4976 4976
                             
4977
-                            $taxonomy = $cat_posttype . 'category';
4977
+							$taxonomy = $cat_posttype . 'category';
4978 4978
                             
4979
-                            $term_data['taxonomy'] = $taxonomy;
4979
+							$term_data['taxonomy'] = $taxonomy;
4980 4980
 
4981
-                            $term_parent_id = 0;
4982
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
4983
-                                $term_parent = '';
4981
+							$term_parent_id = 0;
4982
+							if ($cat_parent != "" || (int)$cat_parent > 0) {
4983
+								$term_parent = '';
4984 4984
                                 
4985
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4986
-                                    $term_parent = $term_parent;
4987
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4988
-                                    $term_parent = $term_parent;
4989
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4990
-                                    $term_parent = $term_parent;
4991
-                                } else {
4992
-                                    $term_parent_data = array();
4993
-                                    $term_parent_data['name'] = $cat_parent;											
4994
-                                    //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );										
4995
-                                    $term_parent_data['taxonomy'] = $taxonomy;
4985
+								if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4986
+									$term_parent = $term_parent;
4987
+								} else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4988
+									$term_parent = $term_parent;
4989
+								} else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4990
+									$term_parent = $term_parent;
4991
+								} else {
4992
+									$term_parent_data = array();
4993
+									$term_parent_data['name'] = $cat_parent;											
4994
+									//$term_parent_data = array_map( 'utf8_encode', $term_parent_data );										
4995
+									$term_parent_data['taxonomy'] = $taxonomy;
4996 4996
                                     
4997
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4998
-                                }
4997
+									$term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4998
+								}
4999 4999
                                 
5000
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
5001
-                                    $term_parent_id = (int)$term_parent->term_id;
5002
-                                }
5003
-                            }
5004
-                            $term_data['parent'] = (int)$term_parent_id;
5000
+								if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
5001
+									$term_parent_id = (int)$term_parent->term_id;
5002
+								}
5003
+							}
5004
+							$term_data['parent'] = (int)$term_parent_id;
5005 5005
 
5006
-                            $term_id = NULL;
5007
-                            if ( $import_choice == 'update' ) {
5008
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
5009
-                                    $term_data['term_id'] = $term['term_id'];
5006
+							$term_id = NULL;
5007
+							if ( $import_choice == 'update' ) {
5008
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
5009
+									$term_data['term_id'] = $term['term_id'];
5010 5010
                                     
5011
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
5012
-                                        $updated++;
5013
-                                    } else {
5014
-                                        $invalid++;
5015
-                                    }
5016
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5017
-                                    $term_data['term_id'] = $term['term_id'];
5011
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
5012
+										$updated++;
5013
+									} else {
5014
+										$invalid++;
5015
+									}
5016
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5017
+									$term_data['term_id'] = $term['term_id'];
5018 5018
                                     
5019
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
5020
-                                        $updated++;
5021
-                                    } else {
5022
-                                        $invalid++;
5023
-                                    }
5024
-                                } else {
5025
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
5026
-                                        $created++;
5027
-                                    } else {
5028
-                                        $invalid++;
5029
-                                    }
5030
-                                }
5031
-                            } else if ( $import_choice == 'skip' ) {
5032
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
5033
-                                    $skipped++;
5034
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5035
-                                    $skipped++;
5036
-                                } else {
5037
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {										
5038
-                                        $created++;
5039
-                                    } else {
5040
-                                        $invalid++;
5041
-                                    }
5042
-                                }
5043
-                            } else {
5044
-                                $invalid++;
5045
-                            }
5019
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
5020
+										$updated++;
5021
+									} else {
5022
+										$invalid++;
5023
+									}
5024
+								} else {
5025
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
5026
+										$created++;
5027
+									} else {
5028
+										$invalid++;
5029
+									}
5030
+								}
5031
+							} else if ( $import_choice == 'skip' ) {
5032
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
5033
+									$skipped++;
5034
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5035
+									$skipped++;
5036
+								} else {
5037
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {										
5038
+										$created++;
5039
+									} else {
5040
+										$invalid++;
5041
+									}
5042
+								}
5043
+							} else {
5044
+								$invalid++;
5045
+							}
5046 5046
                             
5047
-                            if ( $term_id ) {
5048
-                                if ( isset( $term_data['top_description'] ) ) {
5049
-                                    update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
5050
-                                }
5047
+							if ( $term_id ) {
5048
+								if ( isset( $term_data['top_description'] ) ) {
5049
+									update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
5050
+								}
5051 5051
                                 
5052
-                                if ( isset( $term_data['cat_schema'] ) ) {
5053
-                                    update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
5054
-                                }
5052
+								if ( isset( $term_data['cat_schema'] ) ) {
5053
+									update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
5054
+								}
5055 5055
             
5056
-                                $attachment = false;
5057
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
5058
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
5059
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
5056
+								$attachment = false;
5057
+								if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
5058
+									$cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
5059
+									$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
5060 5060
                                     
5061
-                                    if ( basename($cat_image) != $term_data['image'] ) {
5062
-                                        $attachment = true;
5063
-                                        update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
5064
-                                    }
5065
-                                }
5061
+									if ( basename($cat_image) != $term_data['image'] ) {
5062
+										$attachment = true;
5063
+										update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
5064
+									}
5065
+								}
5066 5066
                                 
5067
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
5068
-                                    $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
5069
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
5067
+								if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
5068
+									$cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
5069
+									$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
5070 5070
                                         
5071
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
5072
-                                        $attachment = true;
5073
-                                        update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
5074
-                                    }
5075
-                                }
5071
+									if ( basename($cat_icon) != $term_data['icon'] ) {
5072
+										$attachment = true;
5073
+										update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
5074
+									}
5075
+								}
5076 5076
                                 
5077
-                                if ( $attachment ) {
5078
-                                    $images++;
5079
-                                }
5080
-                            }
5077
+								if ( $attachment ) {
5078
+									$images++;
5079
+								}
5080
+							}
5081 5081
                             
5082
-                            // WPML
5083
-                            if ($is_wpml && $cat_language != '') {
5084
-                                $sitepress->switch_lang($active_lang, true);
5085
-                            }
5086
-                            // WPML
5087
-                        }
5088
-                    }
5089
-                }
5082
+							// WPML
5083
+							if ($is_wpml && $cat_language != '') {
5084
+								$sitepress->switch_lang($active_lang, true);
5085
+							}
5086
+							// WPML
5087
+						}
5088
+					}
5089
+				}
5090 5090
                 
5091
-                $json = array();
5092
-                $json['processed'] = $limit;
5093
-                $json['created'] = $created;
5094
-                $json['updated'] = $updated;
5095
-                $json['skipped'] = $skipped;
5096
-                $json['invalid'] = $invalid;
5097
-                $json['images'] = $images;
5091
+				$json = array();
5092
+				$json['processed'] = $limit;
5093
+				$json['created'] = $created;
5094
+				$json['updated'] = $updated;
5095
+				$json['skipped'] = $skipped;
5096
+				$json['invalid'] = $invalid;
5097
+				$json['images'] = $images;
5098 5098
                 
5099
-                wp_send_json( $json );
5100
-                exit;
5101
-            } else if ( $task == 'import_post' ) {
5099
+				wp_send_json( $json );
5100
+				exit;
5101
+			} else if ( $task == 'import_post' ) {
5102 5102
 
5103
-                //run some stuff to make the import quicker
5104
-                wp_defer_term_counting( true );
5105
-                wp_defer_comment_counting( true );
5106
-                $wpdb->query( 'SET autocommit = 0;' );
5103
+				//run some stuff to make the import quicker
5104
+				wp_defer_term_counting( true );
5105
+				wp_defer_comment_counting( true );
5106
+				$wpdb->query( 'SET autocommit = 0;' );
5107 5107
 
5108
-                //remove_all_actions('publish_post');
5109
-                //remove_all_actions('transition_post_status');
5110
-                //remove_all_actions('publish_future_post');
5108
+				//remove_all_actions('publish_post');
5109
+				//remove_all_actions('transition_post_status');
5110
+				//remove_all_actions('publish_future_post');
5111 5111
 
5112 5112
 
5113
-                if (!empty($file)) {
5114
-                    $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
5115
-                    $default_status = 'publish';
5116
-                    $current_date = date_i18n( 'Y-m-d', time() );
5113
+				if (!empty($file)) {
5114
+					$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
5115
+					$default_status = 'publish';
5116
+					$current_date = date_i18n( 'Y-m-d', time() );
5117 5117
                     
5118
-                    $columns = isset($file[0]) ? $file[0] : NULL;
5118
+					$columns = isset($file[0]) ? $file[0] : NULL;
5119 5119
                     
5120
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
5121
-                        $json['error'] = CSV_INVAILD_FILE;
5122
-                        wp_send_json( $json );
5123
-                        exit;
5124
-                    }
5120
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
5121
+						$json['error'] = CSV_INVAILD_FILE;
5122
+						wp_send_json( $json );
5123
+						exit;
5124
+					}
5125 5125
 
5126
-                    $processed_actual=0;
5127
-                    for ($i = 1; $i <= $limit; $i++) {
5128
-                        $index = $processed + $i;
5129
-                        $gd_post = array();
5126
+					$processed_actual=0;
5127
+					for ($i = 1; $i <= $limit; $i++) {
5128
+						$index = $processed + $i;
5129
+						$gd_post = array();
5130 5130
                         
5131
-                        if (isset($file[$index])) {$processed_actual++;
5132
-                            $row = $file[$index];
5133
-                            $row = array_map( 'trim', $row );
5134
-                            //$row = array_map( 'utf8_encode', $row );
5135
-                            $row = array_map( 'addslashes_gpc', $row );
5131
+						if (isset($file[$index])) {$processed_actual++;
5132
+							$row = $file[$index];
5133
+							$row = array_map( 'trim', $row );
5134
+							//$row = array_map( 'utf8_encode', $row );
5135
+							$row = array_map( 'addslashes_gpc', $row );
5136 5136
                             
5137
-                            $post_id = '';
5138
-                            $post_title = '';
5139
-                            $post_author = '';
5140
-                            $post_content = '';
5141
-                            $post_category_arr = array();
5142
-                            $default_category = '';
5143
-                            $post_tags = array();
5144
-                            $post_type = '';
5145
-                            $post_status = '';
5146
-                            $geodir_video = '';
5147
-                            $post_address = '';
5148
-                            $post_city = '';
5149
-                            $post_region = '';
5150
-                            $post_country = '';
5151
-                            $post_zip = '';
5152
-                            $post_latitude = '';
5153
-                            $post_longitude = '';
5154
-                            $geodir_timing = '';
5155
-                            $geodir_contact = '';
5156
-                            $geodir_email = '';
5157
-                            $geodir_website = '';
5158
-                            $geodir_twitter = '';
5159
-                            $geodir_facebook = '';
5160
-                            $geodir_twitter = '';
5161
-                            $post_images = array();
5137
+							$post_id = '';
5138
+							$post_title = '';
5139
+							$post_author = '';
5140
+							$post_content = '';
5141
+							$post_category_arr = array();
5142
+							$default_category = '';
5143
+							$post_tags = array();
5144
+							$post_type = '';
5145
+							$post_status = '';
5146
+							$geodir_video = '';
5147
+							$post_address = '';
5148
+							$post_city = '';
5149
+							$post_region = '';
5150
+							$post_country = '';
5151
+							$post_zip = '';
5152
+							$post_latitude = '';
5153
+							$post_longitude = '';
5154
+							$geodir_timing = '';
5155
+							$geodir_contact = '';
5156
+							$geodir_email = '';
5157
+							$geodir_website = '';
5158
+							$geodir_twitter = '';
5159
+							$geodir_facebook = '';
5160
+							$geodir_twitter = '';
5161
+							$post_images = array();
5162 5162
                             
5163
-                            $expire_date = 'Never';
5163
+							$expire_date = 'Never';
5164 5164
                             
5165
-                            $language = '';
5166
-                            $original_post_id = '';
5165
+							$language = '';
5166
+							$original_post_id = '';
5167 5167
                                                         
5168
-                            $c = 0;
5169
-                            foreach ($columns as $column ) {
5170
-                                $gd_post[$column] = $row[$c];
5168
+							$c = 0;
5169
+							foreach ($columns as $column ) {
5170
+								$gd_post[$column] = $row[$c];
5171 5171
                                 
5172
-                                if ( $column == 'post_id' ) {
5173
-                                    $post_id = $row[$c];
5174
-                                } else if ( $column == 'post_title' ) {
5175
-                                    $post_title = $row[$c];
5176
-                                } else if ( $column == 'post_author' ) {
5177
-                                    $post_author = $row[$c];
5178
-                                } else if ( $column == 'post_content' ) {
5179
-                                    $post_content = $row[$c];
5180
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
5181
-                                    $post_category_arr = explode( ',', $row[$c] );
5182
-                                } else if ( $column == 'default_category' ) {
5183
-                                    $default_category = wp_kses_normalize_entities($row[$c]);
5184
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
5185
-                                    $post_tags = explode( ',', $row[$c] );
5186
-                                } else if ( $column == 'post_type' ) {
5187
-                                    $post_type = $row[$c];
5188
-                                } else if ( $column == 'post_status' ) {
5189
-                                    $post_status = sanitize_key( $row[$c] );
5190
-                                } else if ( $column == 'is_featured' ) {
5191
-                                    $is_featured = (int)$row[$c];
5192
-                                } else if ( $column == 'geodir_video' ) {
5193
-                                    $geodir_video = $row[$c];
5194
-                                } else if ( $column == 'post_address' ) {
5195
-                                    $post_address = $row[$c];
5196
-                                } else if ( $column == 'post_city' ) {
5197
-                                    $post_city = $row[$c];
5198
-                                } else if ( $column == 'post_region' ) {
5199
-                                    $post_region = $row[$c];
5200
-                                } else if ( $column == 'post_country' ) {
5201
-                                    $post_country = $row[$c];
5202
-                                } else if ( $column == 'post_zip' ) {
5203
-                                    $post_zip = $row[$c];
5204
-                                } else if ( $column == 'post_latitude' ) {
5205
-                                    $post_latitude = $row[$c];
5206
-                                } else if ( $column == 'post_longitude' ) {
5207
-                                    $post_longitude = $row[$c];
5208
-                                } else if ( $column == 'geodir_timing' ) {
5209
-                                    $geodir_timing = $row[$c];
5210
-                                } else if ( $column == 'geodir_contact' ) {
5211
-                                    $geodir_contact = $row[$c];
5212
-                                } else if ( $column == 'geodir_email' ) {
5213
-                                    $geodir_email = $row[$c];
5214
-                                } else if ( $column == 'geodir_website' ) {
5215
-                                    $geodir_website = $row[$c];
5216
-                                } else if ( $column == 'geodir_twitter' ) {
5217
-                                    $geodir_twitter = $row[$c];
5218
-                                } else if ( $column == 'geodir_facebook' ) {
5219
-                                    $geodir_facebook = $row[$c];
5220
-                                } else if ( $column == 'geodir_twitter' ) {
5221
-                                    $geodir_twitter = $row[$c];
5222
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
5223
-                                    $post_images[] = $row[$c];
5224
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
5225
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
5226
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
5227
-                                    $row[$c] = str_replace('/', '-', $row[$c]);
5228
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
5229
-                                }
5230
-                                // WPML
5231
-                                if ($is_wpml) {
5232
-                                    if ($column == 'language') {
5233
-                                        $language = geodir_strtolower(trim($row[$c]));
5234
-                                    } else if ($column == 'original_post_id') {
5235
-                                        $original_post_id = (int)$row[$c];
5236
-                                    }
5237
-                                }
5238
-                                // WPML
5239
-                                $c++;
5240
-                            }
5172
+								if ( $column == 'post_id' ) {
5173
+									$post_id = $row[$c];
5174
+								} else if ( $column == 'post_title' ) {
5175
+									$post_title = $row[$c];
5176
+								} else if ( $column == 'post_author' ) {
5177
+									$post_author = $row[$c];
5178
+								} else if ( $column == 'post_content' ) {
5179
+									$post_content = $row[$c];
5180
+								} else if ( $column == 'post_category' && $row[$c] != '' ) {
5181
+									$post_category_arr = explode( ',', $row[$c] );
5182
+								} else if ( $column == 'default_category' ) {
5183
+									$default_category = wp_kses_normalize_entities($row[$c]);
5184
+								} else if ( $column == 'post_tags' && $row[$c] != '' ) {
5185
+									$post_tags = explode( ',', $row[$c] );
5186
+								} else if ( $column == 'post_type' ) {
5187
+									$post_type = $row[$c];
5188
+								} else if ( $column == 'post_status' ) {
5189
+									$post_status = sanitize_key( $row[$c] );
5190
+								} else if ( $column == 'is_featured' ) {
5191
+									$is_featured = (int)$row[$c];
5192
+								} else if ( $column == 'geodir_video' ) {
5193
+									$geodir_video = $row[$c];
5194
+								} else if ( $column == 'post_address' ) {
5195
+									$post_address = $row[$c];
5196
+								} else if ( $column == 'post_city' ) {
5197
+									$post_city = $row[$c];
5198
+								} else if ( $column == 'post_region' ) {
5199
+									$post_region = $row[$c];
5200
+								} else if ( $column == 'post_country' ) {
5201
+									$post_country = $row[$c];
5202
+								} else if ( $column == 'post_zip' ) {
5203
+									$post_zip = $row[$c];
5204
+								} else if ( $column == 'post_latitude' ) {
5205
+									$post_latitude = $row[$c];
5206
+								} else if ( $column == 'post_longitude' ) {
5207
+									$post_longitude = $row[$c];
5208
+								} else if ( $column == 'geodir_timing' ) {
5209
+									$geodir_timing = $row[$c];
5210
+								} else if ( $column == 'geodir_contact' ) {
5211
+									$geodir_contact = $row[$c];
5212
+								} else if ( $column == 'geodir_email' ) {
5213
+									$geodir_email = $row[$c];
5214
+								} else if ( $column == 'geodir_website' ) {
5215
+									$geodir_website = $row[$c];
5216
+								} else if ( $column == 'geodir_twitter' ) {
5217
+									$geodir_twitter = $row[$c];
5218
+								} else if ( $column == 'geodir_facebook' ) {
5219
+									$geodir_facebook = $row[$c];
5220
+								} else if ( $column == 'geodir_twitter' ) {
5221
+									$geodir_twitter = $row[$c];
5222
+								} else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
5223
+									$post_images[] = $row[$c];
5224
+								} else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
5225
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
5226
+								} else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
5227
+									$row[$c] = str_replace('/', '-', $row[$c]);
5228
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
5229
+								}
5230
+								// WPML
5231
+								if ($is_wpml) {
5232
+									if ($column == 'language') {
5233
+										$language = geodir_strtolower(trim($row[$c]));
5234
+									} else if ($column == 'original_post_id') {
5235
+										$original_post_id = (int)$row[$c];
5236
+									}
5237
+								}
5238
+								// WPML
5239
+								$c++;
5240
+							}
5241 5241
                             
5242
-                            // WPML
5243
-                            if ($is_wpml && $language != '') {
5244
-                                $sitepress->switch_lang($language, true);
5245
-                            }
5246
-                            // WPML
5242
+							// WPML
5243
+							if ($is_wpml && $language != '') {
5244
+								$sitepress->switch_lang($language, true);
5245
+							}
5246
+							// WPML
5247 5247
 
5248
-                            $gd_post['IMAGE'] = $post_images;
5248
+							$gd_post['IMAGE'] = $post_images;
5249 5249
                             
5250
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
5251
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
5250
+							$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
5251
+							$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
5252 5252
                                                                                                                 
5253
-                            $valid = true;
5253
+							$valid = true;
5254 5254
                             
5255
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
5256
-                                $invalid++;
5257
-                                $valid = false;
5258
-                            }
5255
+							if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
5256
+								$invalid++;
5257
+								$valid = false;
5258
+							}
5259 5259
                             
5260
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5261
-                            if ( $location_allowed ) {
5262
-                                $location_result = geodir_get_default_location();
5263
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
5264
-                                    $invalid_addr++;
5265
-                                    $valid = false;
5266
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
5267
-                                    if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
5268
-                                        $invalid_addr++;
5269
-                                        $valid = false;
5270
-                                    } else {
5271
-                                        if (!function_exists('geodir_location_plugin_activated')) {
5272
-                                            $gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated.
5273
-                                        }
5274
-                                    }
5275
-                                }
5276
-                            }
5260
+							$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5261
+							if ( $location_allowed ) {
5262
+								$location_result = geodir_get_default_location();
5263
+								if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
5264
+									$invalid_addr++;
5265
+									$valid = false;
5266
+								} else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
5267
+									if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
5268
+										$invalid_addr++;
5269
+										$valid = false;
5270
+									} else {
5271
+										if (!function_exists('geodir_location_plugin_activated')) {
5272
+											$gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated.
5273
+										}
5274
+									}
5275
+								}
5276
+							}
5277 5277
                             
5278
-                            if ( !$valid ) {
5279
-                                continue;
5280
-                            }
5278
+							if ( !$valid ) {
5279
+								continue;
5280
+							}
5281 5281
 
5282
-                            $cat_taxonomy = $post_type . 'category';
5283
-                            $tags_taxonomy = $post_type . '_tags';
5282
+							$cat_taxonomy = $post_type . 'category';
5283
+							$tags_taxonomy = $post_type . '_tags';
5284 5284
                             
5285
-                            if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
5286
-                                $post_category_arr = array_merge(array($default_category), $post_category_arr);
5287
-                            }
5285
+							if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
5286
+								$post_category_arr = array_merge(array($default_category), $post_category_arr);
5287
+							}
5288 5288
 
5289
-                            $post_category = array();
5290
-                            $default_category_id = NULL;
5291
-                            if ( !empty( $post_category_arr ) ) {
5292
-                                foreach ( $post_category_arr as $value ) {
5293
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
5289
+							$post_category = array();
5290
+							$default_category_id = NULL;
5291
+							if ( !empty( $post_category_arr ) ) {
5292
+								foreach ( $post_category_arr as $value ) {
5293
+									$category_name = wp_kses_normalize_entities( trim( $value ) );
5294 5294
                                     
5295
-                                    if ( $category_name != '' ) {
5296
-                                        $term_category = array();
5295
+									if ( $category_name != '' ) {
5296
+										$term_category = array();
5297 5297
                                         
5298
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
5299
-                                            $term_category = $term;
5300
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
5301
-                                            $term_category = $term;
5302
-                                        } else {
5303
-                                            $term_data = array();
5304
-                                            $term_data['name'] = $category_name;											
5305
-                                            //$term_data = array_map( 'utf8_encode', $term_data );										
5306
-                                            $term_data['taxonomy'] = $cat_taxonomy;
5298
+										if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
5299
+											$term_category = $term;
5300
+										} else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
5301
+											$term_category = $term;
5302
+										} else {
5303
+											$term_data = array();
5304
+											$term_data['name'] = $category_name;											
5305
+											//$term_data = array_map( 'utf8_encode', $term_data );										
5306
+											$term_data['taxonomy'] = $cat_taxonomy;
5307 5307
                                             
5308
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
5309
-                                            if ( $term_id ) {
5310
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
5311
-                                            }
5312
-                                        }
5308
+											$term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
5309
+											if ( $term_id ) {
5310
+												$term_category = get_term( $term_id, $cat_taxonomy );
5311
+											}
5312
+										}
5313 5313
                                         
5314
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
5315
-                                            //$post_category[] = $term_category->slug;
5316
-                                            $post_category[] = intval($term_category->term_id);
5314
+										if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
5315
+											//$post_category[] = $term_category->slug;
5316
+											$post_category[] = intval($term_category->term_id);
5317 5317
                                             
5318
-                                            if ($category_name == $default_category) {
5319
-                                                $default_category_id = intval($term_category->term_id);
5320
-                                            }
5321
-                                        }
5322
-                                    }
5323
-                                }
5324
-                            }
5318
+											if ($category_name == $default_category) {
5319
+												$default_category_id = intval($term_category->term_id);
5320
+											}
5321
+										}
5322
+									}
5323
+								}
5324
+							}
5325 5325
 
5326
-                            $save_post = array();
5327
-                            $save_post['post_title'] = $post_title;
5328
-                            $save_post['post_content'] = $post_content;
5329
-                            $save_post['post_type'] = $post_type;
5330
-                            $save_post['post_author'] = $post_author;
5331
-                            $save_post['post_status'] = $post_status;
5332
-                            $save_post['post_category'] = $post_category;
5333
-                            $save_post['post_tags'] = $post_tags;
5334
-
5335
-                            $saved_post_id = NULL;
5336
-                            if ( $import_choice == 'update' ) {
5337
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
5338
-                                    $save_post['ID'] = $post_id;
5326
+							$save_post = array();
5327
+							$save_post['post_title'] = $post_title;
5328
+							$save_post['post_content'] = $post_content;
5329
+							$save_post['post_type'] = $post_type;
5330
+							$save_post['post_author'] = $post_author;
5331
+							$save_post['post_status'] = $post_status;
5332
+							$save_post['post_category'] = $post_category;
5333
+							$save_post['post_tags'] = $post_tags;
5334
+
5335
+							$saved_post_id = NULL;
5336
+							if ( $import_choice == 'update' ) {
5337
+								if ( $post_id > 0 && get_post( $post_id ) ) {
5338
+									$save_post['ID'] = $post_id;
5339 5339
                                     
5340
-                                    if ( wp_update_post( $save_post ) ) {
5341
-                                        $saved_post_id = $post_id;
5342
-                                        $updated++;
5343
-                                    }
5344
-                                } else {
5345
-                                    if ( $saved_post_id = wp_insert_post( $save_post ) ) {
5346
-                                        $created++;
5347
-                                    }
5348
-                                }
5340
+									if ( wp_update_post( $save_post ) ) {
5341
+										$saved_post_id = $post_id;
5342
+										$updated++;
5343
+									}
5344
+								} else {
5345
+									if ( $saved_post_id = wp_insert_post( $save_post ) ) {
5346
+										$created++;
5347
+									}
5348
+								}
5349 5349
                                 
5350
-                                if ( !$saved_post_id > 0 ) {
5351
-                                    $invalid++;
5352
-                                }
5353
-                            } else if ( $import_choice == 'skip' ) {
5354
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
5355
-                                    $skipped++;	
5356
-                                } else {
5357
-                                    if ( $saved_post_id = wp_insert_post( $save_post ) ) {
5358
-                                        $created++;	
5359
-                                    } else {
5360
-                                        $invalid++;
5361
-                                    }
5362
-                                }
5363
-                            } else {
5364
-                                $invalid++;
5365
-                            }
5350
+								if ( !$saved_post_id > 0 ) {
5351
+									$invalid++;
5352
+								}
5353
+							} else if ( $import_choice == 'skip' ) {
5354
+								if ( $post_id > 0 && get_post( $post_id ) ) {
5355
+									$skipped++;	
5356
+								} else {
5357
+									if ( $saved_post_id = wp_insert_post( $save_post ) ) {
5358
+										$created++;	
5359
+									} else {
5360
+										$invalid++;
5361
+									}
5362
+								}
5363
+							} else {
5364
+								$invalid++;
5365
+							}
5366 5366
 
5367
-                            if ( (int)$saved_post_id > 0 ) {
5368
-                                // WPML
5369
-                                if ($is_wpml && $original_post_id > 0 && $language != '') {
5370
-                                    $wpml_post_type = 'post_' . $post_type;
5371
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
5372
-                                    $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
5367
+							if ( (int)$saved_post_id > 0 ) {
5368
+								// WPML
5369
+								if ($is_wpml && $original_post_id > 0 && $language != '') {
5370
+									$wpml_post_type = 'post_' . $post_type;
5371
+									$source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
5372
+									$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
5373 5373
 
5374
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
5374
+									$trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
5375 5375
                                     
5376
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
5377
-                                }
5378
-                                // WPML
5379
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
5376
+									$sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
5377
+								}
5378
+								// WPML
5379
+								$gd_post_info = geodir_get_post_info( $saved_post_id );
5380 5380
                                 
5381
-                                $gd_post['post_id'] = $saved_post_id;
5382
-                                $gd_post['ID'] = $saved_post_id;
5383
-                                $gd_post['post_tags'] = $post_tags;
5384
-                                $gd_post['post_title'] = $post_title;
5385
-                                $gd_post['post_status'] = $post_status;
5386
-                                $gd_post['submit_time'] = time();
5387
-                                $gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
5381
+								$gd_post['post_id'] = $saved_post_id;
5382
+								$gd_post['ID'] = $saved_post_id;
5383
+								$gd_post['post_tags'] = $post_tags;
5384
+								$gd_post['post_title'] = $post_title;
5385
+								$gd_post['post_status'] = $post_status;
5386
+								$gd_post['submit_time'] = time();
5387
+								$gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
5388 5388
                                                     
5389
-                                // post location
5390
-                                $post_location_id = 0;
5391
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
5392
-                                    $post_location_info = array(
5393
-                                                                'city' => $post_city,
5394
-                                                                'region' => $post_region,
5395
-                                                                'country' => $post_country,
5396
-                                                                'geo_lat' => $post_latitude,
5397
-                                                                'geo_lng' => $post_longitude
5398
-                                                            );
5399
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
5400
-                                        $post_location_id = $location_id;
5401
-                                    }
5402
-                                }
5403
-                                $gd_post['post_location_id'] = $post_location_id;
5389
+								// post location
5390
+								$post_location_id = 0;
5391
+								if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
5392
+									$post_location_info = array(
5393
+																'city' => $post_city,
5394
+																'region' => $post_region,
5395
+																'country' => $post_country,
5396
+																'geo_lat' => $post_latitude,
5397
+																'geo_lng' => $post_longitude
5398
+															);
5399
+									if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
5400
+										$post_location_id = $location_id;
5401
+									}
5402
+								}
5403
+								$gd_post['post_location_id'] = $post_location_id;
5404 5404
                                 
5405
-                                // post package info
5406
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
5407
-                                if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
5408
-                                    $package_id = $gd_post_info->package_id;
5409
-                                }
5405
+								// post package info
5406
+								$package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
5407
+								if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
5408
+									$package_id = $gd_post_info->package_id;
5409
+								}
5410 5410
                                 
5411
-                                $package_info = array();
5412
-                                if ($package_id && function_exists('geodir_get_package_info_by_id')) {
5413
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
5411
+								$package_info = array();
5412
+								if ($package_id && function_exists('geodir_get_package_info_by_id')) {
5413
+									$package_info = (array)geodir_get_package_info_by_id($package_id);
5414 5414
                                     
5415
-                                    if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
5416
-                                        $package_info = array();
5417
-                                    }
5418
-                                }
5415
+									if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
5416
+										$package_info = array();
5417
+									}
5418
+								}
5419 5419
                                 
5420
-                                if (empty($package_info)) {
5421
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
5422
-                                }
5420
+								if (empty($package_info)) {
5421
+									$package_info = (array)geodir_post_package_info( array(), '', $post_type );
5422
+								}
5423 5423
                                  
5424
-                                if (!empty($package_info))	 {
5425
-                                    $package_id = $package_info['pid'];
5424
+								if (!empty($package_info))	 {
5425
+									$package_id = $package_info['pid'];
5426 5426
                                     
5427
-                                    if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
5428
-                                        $gd_post['expire_date'] = $expire_date;
5429
-                                    } else {
5430
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
5431
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
5432
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
5433
-                                        } else {
5434
-                                            $gd_post['expire_date'] = 'Never';
5435
-                                        }
5436
-                                    }
5427
+									if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
5428
+										$gd_post['expire_date'] = $expire_date;
5429
+									} else {
5430
+										if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
5431
+											$gd_post['alive_days'] = (int)$package_info['days'];
5432
+											$gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
5433
+										} else {
5434
+											$gd_post['expire_date'] = 'Never';
5435
+										}
5436
+									}
5437 5437
                                     
5438
-                                    $gd_post['package_id'] = $package_id;
5439
-                                }
5438
+									$gd_post['package_id'] = $package_id;
5439
+								}
5440 5440
 
5441
-                                $table = $plugin_prefix . $post_type . '_detail';
5441
+								$table = $plugin_prefix . $post_type . '_detail';
5442 5442
                                 
5443
-                                if ($post_type == 'gd_event') {
5444
-                                    $gd_post = geodir_imex_process_event_data($gd_post);
5445
-                                }
5443
+								if ($post_type == 'gd_event') {
5444
+									$gd_post = geodir_imex_process_event_data($gd_post);
5445
+								}
5446 5446
                                 
5447
-                                if (isset($gd_post['post_id'])) {
5448
-                                    unset($gd_post['post_id']);
5449
-                                }
5447
+								if (isset($gd_post['post_id'])) {
5448
+									unset($gd_post['post_id']);
5449
+								}
5450 5450
 
5451
-                                // Export franchise fields
5452
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5453
-                                if ($is_franchise_active) {
5454
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
5455
-                                        $gd_franchise_lock = array();
5451
+								// Export franchise fields
5452
+								$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5453
+								if ($is_franchise_active) {
5454
+									if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
5455
+										$gd_franchise_lock = array();
5456 5456
                                         
5457
-                                        if ( isset( $gd_post['gd_franchise_lock'] ) ) {
5458
-                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
5459
-                                            $gd_franchise_lock = trim( $gd_franchise_lock );
5460
-                                            $gd_franchise_lock = explode( ",", $gd_franchise_lock );
5461
-                                        }
5457
+										if ( isset( $gd_post['gd_franchise_lock'] ) ) {
5458
+											$gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
5459
+											$gd_franchise_lock = trim( $gd_franchise_lock );
5460
+											$gd_franchise_lock = explode( ",", $gd_franchise_lock );
5461
+										}
5462 5462
                                         
5463
-                                        update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
5464
-                                        update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
5465
-                                    } else {
5466
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
5467
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
5468
-                                        }
5469
-                                    }
5470
-                                }
5463
+										update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
5464
+										update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
5465
+									} else {
5466
+										if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
5467
+											geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
5468
+										}
5469
+									}
5470
+								}
5471 5471
                                 
5472
-                                if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
5473
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
5474
-                                    if ($default_category_id) {
5475
-                                        $save_post['post_default_category'] = $default_category_id;
5476
-                                        $gd_post['default_category'] = $default_category_id;
5477
-                                    }
5478
-                                    $gd_post[$cat_taxonomy] = $save_post['post_category'];
5479
-                                }
5472
+								if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
5473
+									$save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
5474
+									if ($default_category_id) {
5475
+										$save_post['post_default_category'] = $default_category_id;
5476
+										$gd_post['default_category'] = $default_category_id;
5477
+									}
5478
+									$gd_post[$cat_taxonomy] = $save_post['post_category'];
5479
+								}
5480 5480
                                 
5481
-                                // Save post info
5482
-                                geodir_save_post_info( $saved_post_id, $gd_post );
5483
-                                // post taxonomies
5484
-                                if ( !empty( $save_post['post_category'] ) ) {
5485
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
5481
+								// Save post info
5482
+								geodir_save_post_info( $saved_post_id, $gd_post );
5483
+								// post taxonomies
5484
+								if ( !empty( $save_post['post_category'] ) ) {
5485
+									wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
5486 5486
                                     
5487
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
5488
-                                    if ($default_category_id) {
5489
-                                        $post_default_category = $default_category_id;
5490
-                                    }
5491
-                                    $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
5492
-                                    $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
5493
-                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
5487
+									$post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
5488
+									if ($default_category_id) {
5489
+										$post_default_category = $default_category_id;
5490
+									}
5491
+									$post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
5492
+									$save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
5493
+									$post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
5494 5494
                                     
5495
-                                    if ($post_category_str != '' && $post_default_category) {
5496
-                                        $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
5497
-                                    }
5495
+									if ($post_category_str != '' && $post_default_category) {
5496
+										$post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
5497
+									}
5498 5498
                                     
5499
-                                    $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
5499
+									$post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
5500 5500
                                     
5501
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
5502
-                                }
5501
+									geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
5502
+								}
5503 5503
 
5504
-                                if ( !empty( $save_post['post_tags'] ) ) {
5505
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
5506
-                                }
5504
+								if ( !empty( $save_post['post_tags'] ) ) {
5505
+									wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
5506
+								}
5507 5507
 
5508
-                                // Post images
5509
-                                if ( !empty( $post_images ) ) {
5510
-                                    $post_images = array_unique($post_images);
5508
+								// Post images
5509
+								if ( !empty( $post_images ) ) {
5510
+									$post_images = array_unique($post_images);
5511 5511
                                     
5512
-                                    $old_post_images_arr = array();
5513
-                                    $saved_post_images_arr = array();
5512
+									$old_post_images_arr = array();
5513
+									$saved_post_images_arr = array();
5514 5514
                                     
5515
-                                    $order = 1;
5515
+									$order = 1;
5516 5516
                                     
5517
-                                    $old_post_images = geodir_get_images( $saved_post_id );
5518
-                                    if (!empty($old_post_images)) {
5519
-                                        foreach( $old_post_images as $old_post_image ) {
5520
-                                            if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
5521
-                                                $old_post_images_arr[] = $old_post_image->file;
5522
-                                            }
5523
-                                        }
5524
-                                    }
5517
+									$old_post_images = geodir_get_images( $saved_post_id );
5518
+									if (!empty($old_post_images)) {
5519
+										foreach( $old_post_images as $old_post_image ) {
5520
+											if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
5521
+												$old_post_images_arr[] = $old_post_image->file;
5522
+											}
5523
+										}
5524
+									}
5525 5525
                                     
5526
-                                    foreach ( $post_images as $post_image ) {
5527
-                                        $image_name = basename( $post_image );
5528
-                                        $saved_post_images_arr[] = $image_name;
5526
+									foreach ( $post_images as $post_image ) {
5527
+										$image_name = basename( $post_image );
5528
+										$saved_post_images_arr[] = $image_name;
5529 5529
                                         
5530
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
5531
-                                            continue; // Skip if image already exists.
5532
-                                        }
5530
+										if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
5531
+											continue; // Skip if image already exists.
5532
+										}
5533 5533
                                         
5534
-                                        $image_name_parts = explode( '.', $image_name );
5535
-                                        array_pop( $image_name_parts );
5536
-                                        $proper_image_name = implode( '.', $image_name_parts );
5534
+										$image_name_parts = explode( '.', $image_name );
5535
+										array_pop( $image_name_parts );
5536
+										$proper_image_name = implode( '.', $image_name_parts );
5537 5537
                                         
5538
-                                        $arr_file_type = wp_check_filetype( $image_name );
5538
+										$arr_file_type = wp_check_filetype( $image_name );
5539 5539
                                         
5540
-                                        if ( !empty( $arr_file_type ) ) {
5541
-                                            $uploaded_file_type = $arr_file_type['type'];
5540
+										if ( !empty( $arr_file_type ) ) {
5541
+											$uploaded_file_type = $arr_file_type['type'];
5542 5542
                                             
5543
-                                            $attachment = array();
5544
-                                            $attachment['post_id'] = $saved_post_id;
5545
-                                            $attachment['title'] = $proper_image_name;
5546
-                                            $attachment['content'] = '';
5547
-                                            $attachment['file'] = $uploads_subdir . '/' . $image_name;
5548
-                                            $attachment['mime_type'] = $uploaded_file_type;
5549
-                                            $attachment['menu_order'] = $order;
5550
-                                            $attachment['is_featured'] = 0;
5551
-
5552
-                                            $attachment_set = '';
5553
-                                            foreach ( $attachment as $key => $val ) {
5554
-                                                if ( $val != '' ) {
5555
-                                                    $attachment_set .= $key . " = '" . $val . "', ";
5556
-                                                }
5557
-                                            }
5558
-                                            $attachment_set = trim( $attachment_set, ", " );
5543
+											$attachment = array();
5544
+											$attachment['post_id'] = $saved_post_id;
5545
+											$attachment['title'] = $proper_image_name;
5546
+											$attachment['content'] = '';
5547
+											$attachment['file'] = $uploads_subdir . '/' . $image_name;
5548
+											$attachment['mime_type'] = $uploaded_file_type;
5549
+											$attachment['menu_order'] = $order;
5550
+											$attachment['is_featured'] = 0;
5551
+
5552
+											$attachment_set = '';
5553
+											foreach ( $attachment as $key => $val ) {
5554
+												if ( $val != '' ) {
5555
+													$attachment_set .= $key . " = '" . $val . "', ";
5556
+												}
5557
+											}
5558
+											$attachment_set = trim( $attachment_set, ", " );
5559 5559
                                                                                         
5560
-                                            // Add new attachment
5561
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
5560
+											// Add new attachment
5561
+											$wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
5562 5562
                                                                                         
5563
-                                            $order++;
5564
-                                        }
5565
-                                    }
5563
+											$order++;
5564
+										}
5565
+									}
5566 5566
 
5567
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
5568
-                                    // Remove previous attachment
5569
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
5567
+									$saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
5568
+									// Remove previous attachment
5569
+									$wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
5570 5570
                                     
5571
-                                    if ( !empty( $saved_post_images_arr ) ) {
5572
-                                        $menu_order = 1;
5571
+									if ( !empty( $saved_post_images_arr ) ) {
5572
+										$menu_order = 1;
5573 5573
                                         
5574
-                                        foreach ( $saved_post_images_arr as $img_name ) {
5575
-                                            $wpdb->query( $wpdb->prepare( "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array( $menu_order, $saved_post_id, '%/' . $img_name ) ) );
5574
+										foreach ( $saved_post_images_arr as $img_name ) {
5575
+											$wpdb->query( $wpdb->prepare( "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array( $menu_order, $saved_post_id, '%/' . $img_name ) ) );
5576 5576
                                             
5577
-                                            if( $menu_order == 1 ) {
5578
-                                                if ( $featured_image = $wpdb->get_var( $wpdb->prepare( "SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array( $saved_post_id, '%/' . $img_name ) ) ) ) {
5579
-                                                    $wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) );
5580
-                                                }
5581
-                                            }
5582
-                                            $menu_order++;
5583
-                                        }
5584
-                                    }
5577
+											if( $menu_order == 1 ) {
5578
+												if ( $featured_image = $wpdb->get_var( $wpdb->prepare( "SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array( $saved_post_id, '%/' . $img_name ) ) ) ) {
5579
+													$wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) );
5580
+												}
5581
+											}
5582
+											$menu_order++;
5583
+										}
5584
+									}
5585 5585
                                     
5586
-                                    if ( $order > 1 ) {
5587
-                                        $images++;
5588
-                                    }
5589
-                                }
5586
+									if ( $order > 1 ) {
5587
+										$images++;
5588
+									}
5589
+								}
5590 5590
 
5591
-                                /** This action is documented in geodirectory-functions/post-functions.php */
5592
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
5591
+								/** This action is documented in geodirectory-functions/post-functions.php */
5592
+								do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
5593 5593
                                 
5594
-                                if (isset($is_featured)) {
5595
-                                    geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
5596
-                                }
5597
-                                if (isset($gd_post['expire_date'])) {
5598
-                                    geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
5599
-                                }
5600
-                            }
5594
+								if (isset($is_featured)) {
5595
+									geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
5596
+								}
5597
+								if (isset($gd_post['expire_date'])) {
5598
+									geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
5599
+								}
5600
+							}
5601 5601
                             
5602
-                            // WPML
5603
-                            if ($is_wpml && $language != '') {
5604
-                                $sitepress->switch_lang($active_lang, true);
5605
-                            }
5606
-                            // WPML
5607
-                        }
5608
-                    }
5609
-                }
5602
+							// WPML
5603
+							if ($is_wpml && $language != '') {
5604
+								$sitepress->switch_lang($active_lang, true);
5605
+							}
5606
+							// WPML
5607
+						}
5608
+					}
5609
+				}
5610 5610
 
5611
-                //undo some stuff to make the import quicker
5612
-                wp_defer_term_counting( false );
5613
-                wp_defer_comment_counting( false );
5614
-                $wpdb->query( 'COMMIT;' );
5615
-                $wpdb->query( 'SET autocommit = 1;' );
5616
-
5617
-                $json = array();
5618
-                $json['processed'] = $processed_actual;
5619
-                $json['created'] = $created;
5620
-                $json['updated'] = $updated;
5621
-                $json['skipped'] = $skipped;
5622
-                $json['invalid'] = $invalid;
5623
-                $json['invalid_addr'] = $invalid_addr;
5624
-                $json['images'] = $images;
5611
+				//undo some stuff to make the import quicker
5612
+				wp_defer_term_counting( false );
5613
+				wp_defer_comment_counting( false );
5614
+				$wpdb->query( 'COMMIT;' );
5615
+				$wpdb->query( 'SET autocommit = 1;' );
5616
+
5617
+				$json = array();
5618
+				$json['processed'] = $processed_actual;
5619
+				$json['created'] = $created;
5620
+				$json['updated'] = $updated;
5621
+				$json['skipped'] = $skipped;
5622
+				$json['invalid'] = $invalid;
5623
+				$json['invalid_addr'] = $invalid_addr;
5624
+				$json['images'] = $images;
5625 5625
                 
5626
-                wp_send_json( $json );
5627
-                exit;
5628
-            } else if ( $task == 'import_loc' ) {
5629
-                global $gd_post_types;
5630
-                $gd_post_types = $post_types;
5626
+				wp_send_json( $json );
5627
+				exit;
5628
+			} else if ( $task == 'import_loc' ) {
5629
+				global $gd_post_types;
5630
+				$gd_post_types = $post_types;
5631 5631
                 
5632
-                if (!empty($file)) {
5633
-                    $columns = isset($file[0]) ? $file[0] : NULL;
5632
+				if (!empty($file)) {
5633
+					$columns = isset($file[0]) ? $file[0] : NULL;
5634 5634
                     
5635
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
5636
-                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
5637
-                        wp_send_json( $json );
5638
-                    }
5635
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
5636
+						$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
5637
+						wp_send_json( $json );
5638
+					}
5639 5639
                     
5640
-                    for ($i = 1; $i <= $limit; $i++) {
5641
-                        $index = $processed + $i;
5640
+					for ($i = 1; $i <= $limit; $i++) {
5641
+						$index = $processed + $i;
5642 5642
                         
5643
-                        if (isset($file[$index])) {
5644
-                            $row = $file[$index];
5645
-                            $row = array_map( 'trim', $row );
5646
-                            $data = array();
5643
+						if (isset($file[$index])) {
5644
+							$row = $file[$index];
5645
+							$row = array_map( 'trim', $row );
5646
+							$data = array();
5647 5647
                             
5648
-                            foreach ($columns as $c => $column ) {
5649
-                                if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta', 'city_desc', 'region_meta', 'region_desc', 'country_meta', 'country_desc'))) {
5650
-                                    $data[$column] = $row[$c];
5651
-                                }
5652
-                            }
5648
+							foreach ($columns as $c => $column ) {
5649
+								if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta', 'city_desc', 'region_meta', 'region_desc', 'country_meta', 'country_desc'))) {
5650
+									$data[$column] = $row[$c];
5651
+								}
5652
+							}
5653 5653
 
5654
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
5655
-                                $invalid++;
5656
-                                continue;
5657
-                            }
5654
+							if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
5655
+								$invalid++;
5656
+								continue;
5657
+							}
5658 5658
                             
5659
-                            $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
5659
+							$data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
5660 5660
                             
5661
-                            if ( $import_choice == 'update' ) {
5662
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
5663
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
5664
-                                        $updated++;
5665
-                                    } else {
5666
-                                        $invalid++;
5667
-                                    }
5668
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
5669
-                                    $data['location_id'] = (int)$location->location_id;
5661
+							if ( $import_choice == 'update' ) {
5662
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
5663
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
5664
+										$updated++;
5665
+									} else {
5666
+										$invalid++;
5667
+									}
5668
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
5669
+									$data['location_id'] = (int)$location->location_id;
5670 5670
                                     
5671
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
5672
-                                        $data['location_id'] = (int)$location->location_id;
5673
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
5674
-                                        $data['location_id'] = (int)$location->location_id;
5675
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
5676
-                                        $data['location_id'] = (int)$location->location_id;
5677
-                                    }
5671
+									if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
5672
+										$data['location_id'] = (int)$location->location_id;
5673
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
5674
+										$data['location_id'] = (int)$location->location_id;
5675
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
5676
+										$data['location_id'] = (int)$location->location_id;
5677
+									}
5678 5678
                                     
5679
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
5680
-                                        $updated++;
5681
-                                    } else {
5682
-                                        $invalid++;
5683
-                                    }
5684
-                                } else {
5685
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
5686
-                                        $created++;
5687
-                                    } else {
5688
-                                        $invalid++;
5689
-                                    }
5690
-                                }
5691
-                            } elseif ( $import_choice == 'skip' ) {
5692
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
5693
-                                    $skipped++;
5694
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
5695
-                                    $skipped++;
5696
-                                } else {
5697
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {										
5698
-                                        $created++;
5699
-                                    } else {
5700
-                                        $invalid++;
5701
-                                    }
5702
-                                }
5703
-                            } else {
5704
-                                $invalid++;
5705
-                            }
5706
-                        }
5707
-                    }
5708
-                }
5679
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
5680
+										$updated++;
5681
+									} else {
5682
+										$invalid++;
5683
+									}
5684
+								} else {
5685
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
5686
+										$created++;
5687
+									} else {
5688
+										$invalid++;
5689
+									}
5690
+								}
5691
+							} elseif ( $import_choice == 'skip' ) {
5692
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
5693
+									$skipped++;
5694
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
5695
+									$skipped++;
5696
+								} else {
5697
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {										
5698
+										$created++;
5699
+									} else {
5700
+										$invalid++;
5701
+									}
5702
+								}
5703
+							} else {
5704
+								$invalid++;
5705
+							}
5706
+						}
5707
+					}
5708
+				}
5709 5709
                 
5710
-                $json = array();
5711
-                $json['processed'] = $limit;
5712
-                $json['created'] = $created;
5713
-                $json['updated'] = $updated;
5714
-                $json['skipped'] = $skipped;
5715
-                $json['invalid'] = $invalid;
5716
-                $json['images'] = $images;
5710
+				$json = array();
5711
+				$json['processed'] = $limit;
5712
+				$json['created'] = $created;
5713
+				$json['updated'] = $updated;
5714
+				$json['skipped'] = $skipped;
5715
+				$json['invalid'] = $invalid;
5716
+				$json['images'] = $images;
5717 5717
                 
5718
-                wp_send_json( $json );
5719
-            }
5720
-        }
5721
-        break;
5722
-        case 'import_finish':{
5723
-            /**
5724
-             * Run an action when an import finishes.
5725
-             *
5726
-             * This action can be used to fire functions after an import ends.
5727
-             *
5728
-             * @since 1.5.3
5729
-             * @package GeoDirectory
5730
-             */
5731
-            do_action('geodir_import_finished');
5732
-        }
5733
-        break;
5718
+				wp_send_json( $json );
5719
+			}
5720
+		}
5721
+		break;
5722
+		case 'import_finish':{
5723
+			/**
5724
+			 * Run an action when an import finishes.
5725
+			 *
5726
+			 * This action can be used to fire functions after an import ends.
5727
+			 *
5728
+			 * @since 1.5.3
5729
+			 * @package GeoDirectory
5730
+			 */
5731
+			do_action('geodir_import_finished');
5732
+		}
5733
+		break;
5734 5734
 
5735
-    }
5736
-    echo '0';
5737
-    wp_die();
5735
+	}
5736
+	echo '0';
5737
+	wp_die();
5738 5738
 }
5739 5739
 
5740 5740
 /**
@@ -5778,12 +5778,12 @@  discard block
 block discarded – undo
5778 5778
 		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5779 5779
 	}
5780 5780
 	
5781
-    if( !empty( $term ) ) {
5781
+	if( !empty( $term ) ) {
5782 5782
 		$result = wp_insert_term( $term, $taxonomy, $args );
5783
-        if( !is_wp_error( $result ) ) {
5784
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5785
-        }
5786
-    }
5783
+		if( !is_wp_error( $result ) ) {
5784
+			return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5785
+		}
5786
+	}
5787 5787
 	
5788 5788
 	return false;
5789 5789
 }
@@ -5830,16 +5830,16 @@  discard block
 block discarded – undo
5830 5830
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5831 5831
 		
5832 5832
 		if( !is_wp_error( $result ) ) {
5833
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5834
-        }
5833
+			return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5834
+		}
5835 5835
 	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5836 5836
 		$term_data['term_id'] = $term_info['term_id'];
5837 5837
 		
5838 5838
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5839 5839
 		
5840 5840
 		if( !is_wp_error( $result ) ) {
5841
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5842
-        }
5841
+			return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5842
+		}
5843 5843
 	} else {
5844 5844
 		return geodir_imex_insert_term( $taxonomy, $term_data );
5845 5845
 	}
@@ -5864,7 +5864,7 @@  discard block
 block discarded – undo
5864 5864
 	 * Modify returned post counts for the current post type.
5865 5865
 	 *
5866 5866
 	 * @since 1.4.6
5867
-     * @package GeoDirectory
5867
+	 * @package GeoDirectory
5868 5868
 	 *
5869 5869
 	 * @param int $posts_count Post counts.
5870 5870
 	 * @param string $post_type Post type.
@@ -6004,7 +6004,7 @@  discard block
 block discarded – undo
6004 6004
 		$csv_rows[] = $csv_row;
6005 6005
 
6006 6006
 		$images_count = 5;
6007
-        $xx=0;
6007
+		$xx=0;
6008 6008
 		foreach ( $posts as $post ) {$xx++;
6009 6009
 			$post_id = $post['ID'];
6010 6010
 			
@@ -6244,7 +6244,7 @@  discard block
 block discarded – undo
6244 6244
 	 * Modify returned posts SQL query for the current post type.
6245 6245
 	 *
6246 6246
 	 * @since 1.4.6
6247
-     * @package GeoDirectory
6247
+	 * @package GeoDirectory
6248 6248
 	 *
6249 6249
 	 * @param int $query The SQL query.
6250 6250
 	 * @param string $post_type Post type.
@@ -6257,7 +6257,7 @@  discard block
 block discarded – undo
6257 6257
 	 * Modify returned post results for the current post type.
6258 6258
 	 *
6259 6259
 	 * @since 1.4.6
6260
-     * @package GeoDirectory
6260
+	 * @package GeoDirectory
6261 6261
 	 *
6262 6262
 	 * @param object $results An object containing all post ids.
6263 6263
 	 * @param string $post_type Post type.
@@ -6983,44 +6983,44 @@  discard block
 block discarded – undo
6983 6983
  */
6984 6984
 function geodir_create_page($slug, $option, $page_title = '', $page_content = '', $post_parent = 0, $status = 'publish')
6985 6985
 {
6986
-    global $wpdb, $current_user;
6987
-
6988
-    $option_value = get_option($option);
6989
-
6990
-    if ($option_value > 0) :
6991
-        if (get_post($option_value)) :
6992
-            // Page exists
6993
-            return;
6994
-        endif;
6995
-    endif;
6996
-
6997
-
6998
-    $page_found = $wpdb->get_var(
6999
-        $wpdb->prepare(
7000
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
7001
-            array($slug)
7002
-        )
7003
-    );
7004
-
7005
-    if ($page_found) :
7006
-        // Page exists
7007
-        if (!$option_value) update_option($option, $page_found);
7008
-        return;
7009
-    endif;
7010
-
7011
-    $page_data = array(
7012
-        'post_status' => $status,
7013
-        'post_type' => 'page',
7014
-        'post_author' => $current_user->ID,
7015
-        'post_name' => $slug,
7016
-        'post_title' => $page_title,
7017
-        'post_content' => $page_content,
7018
-        'post_parent' => $post_parent,
7019
-        'comment_status' => 'closed'
7020
-    );
7021
-    $page_id = wp_insert_post($page_data);
7022
-
7023
-    add_option($option, $page_id);
6986
+	global $wpdb, $current_user;
6987
+
6988
+	$option_value = get_option($option);
6989
+
6990
+	if ($option_value > 0) :
6991
+		if (get_post($option_value)) :
6992
+			// Page exists
6993
+			return;
6994
+		endif;
6995
+	endif;
6996
+
6997
+
6998
+	$page_found = $wpdb->get_var(
6999
+		$wpdb->prepare(
7000
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
7001
+			array($slug)
7002
+		)
7003
+	);
7004
+
7005
+	if ($page_found) :
7006
+		// Page exists
7007
+		if (!$option_value) update_option($option, $page_found);
7008
+		return;
7009
+	endif;
7010
+
7011
+	$page_data = array(
7012
+		'post_status' => $status,
7013
+		'post_type' => 'page',
7014
+		'post_author' => $current_user->ID,
7015
+		'post_name' => $slug,
7016
+		'post_title' => $page_title,
7017
+		'post_content' => $page_content,
7018
+		'post_parent' => $post_parent,
7019
+		'comment_status' => 'closed'
7020
+	);
7021
+	$page_id = wp_insert_post($page_data);
7022
+
7023
+	add_option($option, $page_id);
7024 7024
 
7025 7025
 }
7026 7026
 
@@ -7051,9 +7051,9 @@  discard block
 block discarded – undo
7051 7051
  * @package GeoDirectory
7052 7052
  */
7053 7053
 function geodir_admin_upgrade_notice() {
7054
-    $class = "error";
7055
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
7056
-    echo"<div class=\"$class\"> <p>$message</p></div>";
7054
+	$class = "error";
7055
+	$message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
7056
+	echo"<div class=\"$class\"> <p>$message</p></div>";
7057 7057
 }
7058 7058
 
7059 7059
 
@@ -7069,18 +7069,18 @@  discard block
 block discarded – undo
7069 7069
  */
7070 7070
 function geodire_admin_upgrade_notice( $plugin_data, $r )
7071 7071
 {
7072
-    // readme contents
7073
-    $args = array(
7074
-        'timeout'     => 15,
7075
-        'redirection' => 5
7076
-    );
7077
-    $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
7078
-    $data       = wp_remote_get( $url, $args );
7072
+	// readme contents
7073
+	$args = array(
7074
+		'timeout'     => 15,
7075
+		'redirection' => 5
7076
+	);
7077
+	$url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
7078
+	$data       = wp_remote_get( $url, $args );
7079 7079
 
7080
-    if (!is_wp_error($data) && $data['response']['code'] == 200) {
7080
+	if (!is_wp_error($data) && $data['response']['code'] == 200) {
7081 7081
 
7082
-        geodir_in_plugin_update_message($data['body']);
7083
-    }
7082
+		geodir_in_plugin_update_message($data['body']);
7083
+	}
7084 7084
 }
7085 7085
 
7086 7086
 
@@ -7088,28 +7088,28 @@  discard block
 block discarded – undo
7088 7088
 * @param string $body http response body
7089 7089
 */
7090 7090
 function geodir_in_plugin_update_message($content) {
7091
-    // Output Upgrade Notice
7092
-    $matches        = null;
7093
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
7094
-    $upgrade_notice = '';
7095
-    if ( preg_match( $regexp, $content, $matches ) ) {
7096
-        if(empty($matches)){return;}
7097
-        //print_r($matches );
7098
-        $version = trim( $matches[1] );
7099
-        if($version && $version>GEODIRECTORY_VERSION){
7100
-
7101
-
7102
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
7103
-        if ( version_compare( WC_VERSION, $version, '<' ) ) {
7104
-            $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
7105
-            foreach ( $notices as $index => $line ) {
7106
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
7107
-            }
7108
-            $upgrade_notice .= '</div> ';
7109
-        }
7110
-        }
7111
-    }
7112
-    echo $upgrade_notice;
7091
+	// Output Upgrade Notice
7092
+	$matches        = null;
7093
+	$regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
7094
+	$upgrade_notice = '';
7095
+	if ( preg_match( $regexp, $content, $matches ) ) {
7096
+		if(empty($matches)){return;}
7097
+		//print_r($matches );
7098
+		$version = trim( $matches[1] );
7099
+		if($version && $version>GEODIRECTORY_VERSION){
7100
+
7101
+
7102
+		$notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
7103
+		if ( version_compare( WC_VERSION, $version, '<' ) ) {
7104
+			$upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
7105
+			foreach ( $notices as $index => $line ) {
7106
+				$upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
7107
+			}
7108
+			$upgrade_notice .= '</div> ';
7109
+		}
7110
+		}
7111
+	}
7112
+	echo $upgrade_notice;
7113 7113
 }
7114 7114
 
7115 7115
 /**
Please login to merge, or discard this patch.
geodirectory-admin/admin_hooks_actions.php 1 patch
Indentation   +1305 added lines, -1305 removed lines patch added patch discarded remove patch
@@ -1,42 +1,42 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * GeoDirectory Admin.
4
- *
5
- * Main admin file which loads all settings panels and sets up admin menus.
6
- *
7
- * @since 1.0.0
8
- * @package GeoDirectory
9
- */
3
+	 * GeoDirectory Admin.
4
+	 *
5
+	 * Main admin file which loads all settings panels and sets up admin menus.
6
+	 *
7
+	 * @since 1.0.0
8
+	 * @package GeoDirectory
9
+	 */
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 avoide 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 avoide 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
 block discarded – undo
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
 block discarded – undo
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
 
@@ -83,18 +83,18 @@  discard block
 block discarded – undo
83 83
  */
84 84
 function geodir_conditional_admin_script_load()
85 85
 {
86
-    global $pagenow;
86
+	global $pagenow;
87 87
 	
88 88
 	// Get the current post type
89 89
 	$post_type = geodir_admin_current_post_type();
90 90
 	$geodir_post_types = geodir_get_posttypes();
91 91
     
92 92
 	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 == 'edit-comments.php' || $pagenow == 'comment.php')) {
93
-        add_action('admin_enqueue_scripts', 'geodir_admin_scripts');
94
-        add_action('admin_enqueue_scripts', 'geodir_admin_styles');
95
-    }
93
+		add_action('admin_enqueue_scripts', 'geodir_admin_scripts');
94
+		add_action('admin_enqueue_scripts', 'geodir_admin_styles');
95
+	}
96 96
 
97
-    add_action('admin_enqueue_scripts', 'geodir_admin_styles_req');
97
+	add_action('admin_enqueue_scripts', 'geodir_admin_styles_req');
98 98
 
99 99
 }
100 100
 
@@ -128,12 +128,12 @@  discard block
 block discarded – undo
128 128
  */
129 129
 function create_default_admin_main_nav()
130 130
 {
131
-    add_filter('geodir_settings_tabs_array', 'geodir_default_admin_main_tabs', 1);
132
-    add_filter('geodir_settings_tabs_array', 'places_custom_fields_tab', 2);
133
-    add_filter('geodir_settings_tabs_array', 'geodir_compatibility_setting_tab', 90);
134
-    add_filter('geodir_settings_tabs_array', 'geodir_tools_setting_tab', 95);
135
-    add_filter('geodir_settings_tabs_array', 'geodir_extend_geodirectory_setting_tab', 100);
136
-    //add_filter('geodir_settings_tabs_array', 'geodir_hide_set_location_default',3);
131
+	add_filter('geodir_settings_tabs_array', 'geodir_default_admin_main_tabs', 1);
132
+	add_filter('geodir_settings_tabs_array', 'places_custom_fields_tab', 2);
133
+	add_filter('geodir_settings_tabs_array', 'geodir_compatibility_setting_tab', 90);
134
+	add_filter('geodir_settings_tabs_array', 'geodir_tools_setting_tab', 95);
135
+	add_filter('geodir_settings_tabs_array', 'geodir_extend_geodirectory_setting_tab', 100);
136
+	//add_filter('geodir_settings_tabs_array', 'geodir_hide_set_location_default',3);
137 137
 
138 138
 }
139 139
 
@@ -146,16 +146,16 @@  discard block
 block discarded – undo
146 146
  */
147 147
 function geodir_admin_list_columns()
148 148
 {
149
-    if ($post_types = geodir_get_posttypes()) {
149
+	if ($post_types = geodir_get_posttypes()) {
150 150
 
151
-        foreach ($post_types as $post_type):
152
-            add_filter("manage_edit-{$post_type}_columns", 'geodir_edit_post_columns', 100);
153
-            //Filter-Payment-Manager to show Package
154
-            add_action("manage_{$post_type}_posts_custom_column", 'geodir_manage_post_columns', 10, 2);
151
+		foreach ($post_types as $post_type):
152
+			add_filter("manage_edit-{$post_type}_columns", 'geodir_edit_post_columns', 100);
153
+			//Filter-Payment-Manager to show Package
154
+			add_action("manage_{$post_type}_posts_custom_column", 'geodir_manage_post_columns', 10, 2);
155 155
 
156
-            add_filter("manage_edit-{$post_type}_sortable_columns", 'geodir_post_sortable_columns');
157
-        endforeach;
158
-    }
156
+			add_filter("manage_edit-{$post_type}_sortable_columns", 'geodir_post_sortable_columns');
157
+		endforeach;
158
+	}
159 159
 }
160 160
 
161 161
 /**
@@ -168,15 +168,15 @@  discard block
 block discarded – undo
168 168
  */
169 169
 function geodir_default_admin_main_tabs($tabs)
170 170
 {
171
-    return $tabs = array(
172
-        'general_settings' => array('label' => __('General', 'geodirectory')),
173
-        'design_settings' => array('label' => __('Design', 'geodirectory')),
174
-        'permalink_settings' => array('label' => __('Permalinks', 'geodirectory')),
175
-        'title_meta_settings' => array('label' => __('Titles & Metas', 'geodirectory')),
176
-        'notifications_settings' => array('label' => __('Notifications', 'geodirectory')),
177
-        'default_location_settings' => array('label' => __('Set Default Location', 'geodirectory')),
178
-
179
-    );
171
+	return $tabs = array(
172
+		'general_settings' => array('label' => __('General', 'geodirectory')),
173
+		'design_settings' => array('label' => __('Design', 'geodirectory')),
174
+		'permalink_settings' => array('label' => __('Permalinks', 'geodirectory')),
175
+		'title_meta_settings' => array('label' => __('Titles & Metas', 'geodirectory')),
176
+		'notifications_settings' => array('label' => __('Notifications', 'geodirectory')),
177
+		'default_location_settings' => array('label' => __('Set Default Location', 'geodirectory')),
178
+
179
+	);
180 180
 }
181 181
 
182 182
 add_action('do_meta_boxes', 'geodir_remove_image_box');
@@ -189,16 +189,16 @@  discard block
 block discarded – undo
189 189
  */
190 190
 function geodir_remove_image_box()
191 191
 {
192
-    global $post;
192
+	global $post;
193 193
 
194
-    $geodir_posttypes = geodir_get_posttypes();
194
+	$geodir_posttypes = geodir_get_posttypes();
195 195
 
196
-    if (isset($post) && in_array($post->post_type, $geodir_posttypes)):
196
+	if (isset($post) && in_array($post->post_type, $geodir_posttypes)):
197 197
 
198
-        remove_meta_box('postimagediv', $post->post_type, 'side');
199
-        remove_meta_box('revisionsdiv', $post->post_type, 'normal');
198
+		remove_meta_box('postimagediv', $post->post_type, 'side');
199
+		remove_meta_box('revisionsdiv', $post->post_type, 'normal');
200 200
 
201
-    endif;
201
+	endif;
202 202
 
203 203
 }
204 204
 
@@ -213,26 +213,26 @@  discard block
 block discarded – undo
213 213
  */
214 214
 function geodir_meta_box_add()
215 215
 {
216
-    global $post;
216
+	global $post;
217 217
 
218
-    $geodir_post_types = geodir_get_posttypes('array');
219
-    $geodir_posttypes = array_keys($geodir_post_types);
218
+	$geodir_post_types = geodir_get_posttypes('array');
219
+	$geodir_posttypes = array_keys($geodir_post_types);
220 220
 
221
-    if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)):
221
+	if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)):
222 222
 
223
-        $geodir_posttype = $post->post_type;
224
-        $post_typename = geodir_ucwords($geodir_post_types[$geodir_posttype]['labels']['singular_name']);
223
+		$geodir_posttype = $post->post_type;
224
+		$post_typename = geodir_ucwords($geodir_post_types[$geodir_posttype]['labels']['singular_name']);
225 225
 
226
-        // Filter-Payment-Manager
226
+		// Filter-Payment-Manager
227 227
 
228
-        add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
228
+		add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
229 229
 
230
-        add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
230
+		add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
231 231
 
232
-        // no need of this box as all fields moved to main informain box
233
-        //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
232
+		// no need of this box as all fields moved to main informain box
233
+		//add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
234 234
 
235
-    endif;
235
+	endif;
236 236
 
237 237
 }
238 238
 
@@ -256,23 +256,23 @@  discard block
 block discarded – undo
256 256
 function geodir_hide_post_taxonomy_meta_boxes()
257 257
 {
258 258
 
259
-    $geodir_post_types = get_option('geodir_post_types');
259
+	$geodir_post_types = get_option('geodir_post_types');
260 260
 
261
-    if (!empty($geodir_post_types)) {
262
-        foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info) {
261
+	if (!empty($geodir_post_types)) {
262
+		foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info) {
263 263
 
264
-            $gd_taxonomy = geodir_get_taxonomies($geodir_post_type);
264
+			$gd_taxonomy = geodir_get_taxonomies($geodir_post_type);
265 265
 
266
-            if(!empty($gd_taxonomy)) {
267
-                foreach ($gd_taxonomy as $tax) {
266
+			if(!empty($gd_taxonomy)) {
267
+				foreach ($gd_taxonomy as $tax) {
268 268
 
269
-                    remove_meta_box($tax . 'div', $geodir_post_type, 'normal');
269
+					remove_meta_box($tax . 'div', $geodir_post_type, 'normal');
270 270
 
271
-                }
272
-            }
271
+				}
272
+			}
273 273
 
274
-        }
275
-    }
274
+		}
275
+	}
276 276
 }
277 277
 
278 278
 add_filter('geodir_add_listing_map_restrict', 'geodir_add_listing_map_restrict');
@@ -286,12 +286,12 @@  discard block
 block discarded – undo
286 286
  */
287 287
 function geodir_add_listing_map_restrict($map_restirct)
288 288
 {
289
-    if (is_admin()) {
290
-        if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'default_location_settings') {
291
-            $map_restirct = false;
292
-        }
293
-    }
294
-    return $map_restirct;
289
+	if (is_admin()) {
290
+		if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'default_location_settings') {
291
+			$map_restirct = false;
292
+		}
293
+	}
294
+	return $map_restirct;
295 295
 }
296 296
 
297 297
 
@@ -310,16 +310,16 @@  discard block
 block discarded – undo
310 310
 function geodir_enable_editor_on_notifications($notification)
311 311
 {
312 312
 
313
-    if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
313
+	if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
314 314
 
315
-        foreach ($notification as $key => $value) {
316
-            if ($value['type'] == 'textarea')
317
-                $notification[$key]['type'] = 'editor';
318
-        }
315
+		foreach ($notification as $key => $value) {
316
+			if ($value['type'] == 'textarea')
317
+				$notification[$key]['type'] = 'editor';
318
+		}
319 319
 
320
-    }
320
+	}
321 321
 
322
-    return $notification;
322
+	return $notification;
323 323
 }
324 324
 
325 325
 
@@ -336,16 +336,16 @@  discard block
 block discarded – undo
336 336
 function geodir_enable_editor_on_design_settings($design_setting)
337 337
 {
338 338
 
339
-    if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
339
+	if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
340 340
 
341
-        foreach ($design_setting as $key => $value) {
342
-            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content')
343
-                $design_setting[$key]['type'] = 'editor';
344
-        }
341
+		foreach ($design_setting as $key => $value) {
342
+			if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content')
343
+				$design_setting[$key]['type'] = 'editor';
344
+		}
345 345
 
346
-    }
346
+	}
347 347
 
348
-    return $design_setting;
348
+	return $design_setting;
349 349
 }
350 350
 
351 351
 /* ----------- START MANAGE CUSTOM FIELDS ---------------- */
@@ -366,16 +366,16 @@  discard block
 block discarded – undo
366 366
 function geodir_manage_available_fields($sub_tab)
367 367
 {
368 368
 
369
-    switch ($sub_tab) {
370
-        case 'custom_fields':
371
-            geodir_custom_available_fields();
372
-            break;
369
+	switch ($sub_tab) {
370
+		case 'custom_fields':
371
+			geodir_custom_available_fields();
372
+			break;
373 373
 
374
-        case 'sorting_options':
375
-            geodir_sorting_options_available_fields();
376
-            break;
374
+		case 'sorting_options':
375
+			geodir_sorting_options_available_fields();
376
+			break;
377 377
 
378
-    }
378
+	}
379 379
 }
380 380
 
381 381
 
@@ -391,16 +391,16 @@  discard block
 block discarded – undo
391 391
 function geodir_manage_selected_fields($sub_tab)
392 392
 {
393 393
 
394
-    switch ($sub_tab) {
395
-        case 'custom_fields':
396
-            geodir_custom_selected_fields();
397
-            break;
394
+	switch ($sub_tab) {
395
+		case 'custom_fields':
396
+			geodir_custom_selected_fields();
397
+			break;
398 398
 
399
-        case 'sorting_options':
400
-            geodir_sorting_options_selected_fields();
401
-            break;
399
+		case 'sorting_options':
400
+			geodir_sorting_options_selected_fields();
401
+			break;
402 402
 
403
-    }
403
+	}
404 404
 }
405 405
 
406 406
 /**
@@ -412,27 +412,27 @@  discard block
 block discarded – undo
412 412
  */
413 413
 function geodir_sorting_options_available_fields()
414 414
 {
415
-    global $wpdb;
416
-    $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
417
-    ?>
415
+	global $wpdb;
416
+	$listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
417
+	?>
418 418
     <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
419 419
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
420 420
     <ul>
421 421
     <?php
422
-        $sort_options = geodir_get_custom_sort_options($listing_type);
422
+		$sort_options = geodir_get_custom_sort_options($listing_type);
423 423
         
424
-        foreach ($sort_options as $key => $val) {
425
-            $val = stripslashes_deep($val); // strip slashes
426
-
427
-            $check_html_variable = $wpdb->get_var(
428
-                $wpdb->prepare(
429
-                    "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s",
430
-                    array($val['htmlvar_name'], $listing_type, $val['field_type'])
431
-                )
432
-            );
424
+		foreach ($sort_options as $key => $val) {
425
+			$val = stripslashes_deep($val); // strip slashes
426
+
427
+			$check_html_variable = $wpdb->get_var(
428
+				$wpdb->prepare(
429
+					"SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s",
430
+					array($val['htmlvar_name'], $listing_type, $val['field_type'])
431
+				)
432
+			);
433 433
             
434
-            $display = $check_html_variable ? ' style="display:none;"' : '';
435
-            ?>
434
+			$display = $check_html_variable ? ' style="display:none;"' : '';
435
+			?>
436 436
             <li <?php echo $display;?>>
437 437
             <a id="gt-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>"
438 438
                title="<?php echo $val['site_title'];?>"
@@ -440,8 +440,8 @@  discard block
 block discarded – undo
440 440
                href="javascript:void(0);"><b></b><?php _e($val['site_title'], 'geodirectory');?></a>
441 441
             </li>
442 442
             <?php
443
-        }
444
-    ?>
443
+		}
444
+	?>
445 445
     </ul>
446 446
     <?php
447 447
 }
@@ -455,28 +455,28 @@  discard block
 block discarded – undo
455 455
  */
456 456
 function geodir_sorting_options_selected_fields()
457 457
 {
458
-    $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
459
-    ?>
458
+	$listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
459
+	?>
460 460
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
461 461
     <ul class="core">
462 462
     <?php 
463
-        global $wpdb;
463
+		global $wpdb;
464 464
         
465
-        $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)));
465
+		$fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
466 466
 
467
-        if (!empty($fields)) {
468
-            foreach ($fields as $field) {
469
-                //$result_str = $field->id;
470
-                $result_str = $field;
471
-                $field_type = $field->field_type;
472
-                $field_ins_upd = 'display';
467
+		if (!empty($fields)) {
468
+			foreach ($fields as $field) {
469
+				//$result_str = $field->id;
470
+				$result_str = $field;
471
+				$field_type = $field->field_type;
472
+				$field_ins_upd = 'display';
473 473
 
474
-                $default = false;
474
+				$default = false;
475 475
 
476
-                geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd, $default);
477
-            }
478
-        }
479
-    ?>
476
+				geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd, $default);
477
+			}
478
+		}
479
+	?>
480 480
     </ul>
481 481
     <?php
482 482
 }
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
  */
490 490
 function geodir_custom_available_fields()
491 491
 {
492
-    $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
493
-    ?>
492
+	$listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
493
+	?>
494 494
     <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
495 495
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
496 496
     <ul class="full">
@@ -541,25 +541,25 @@  discard block
 block discarded – undo
541 541
  */
542 542
 function geodir_custom_selected_fields()
543 543
 {
544
-    $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
545
-    ?>
544
+	$listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
545
+	?>
546 546
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
547 547
     <ul class="core">
548 548
     <?php 
549
-        global $wpdb;
550
-        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
551
-
552
-        if (!empty($fields)) {
553
-            foreach ($fields as $field) {
554
-                //$result_str = $field->id;
555
-                $result_str = $field;
556
-                $field_type = $field->field_type;
557
-                $field_ins_upd = 'display';
558
-
559
-                geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd);
560
-            }
561
-        }
562
-        ?></ul>
549
+		global $wpdb;
550
+		$fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
551
+
552
+		if (!empty($fields)) {
553
+			foreach ($fields as $field) {
554
+				//$result_str = $field->id;
555
+				$result_str = $field;
556
+				$field_type = $field->field_type;
557
+				$field_ins_upd = 'display';
558
+
559
+				geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd);
560
+			}
561
+		}
562
+		?></ul>
563 563
 <?php
564 564
 
565 565
 }
@@ -578,16 +578,16 @@  discard block
 block discarded – undo
578 578
 function geodir_custom_fields_panel_head($heading, $sub_tab, $listing_type)
579 579
 {
580 580
 
581
-    switch ($sub_tab) {
582
-        case 'custom_fields':
583
-            $heading = sprintf(__('Manage %s Custom Fields', 'geodirectory'), get_post_type_singular_label($listing_type));
584
-            break;
581
+	switch ($sub_tab) {
582
+		case 'custom_fields':
583
+			$heading = sprintf(__('Manage %s Custom Fields', 'geodirectory'), get_post_type_singular_label($listing_type));
584
+			break;
585 585
 
586
-        case 'sorting_options':
587
-            $heading = sprintf(__('Manage %s Listing Sorting Options Fields', 'geodirectory'), get_post_type_singular_label($listing_type));
588
-            break;
589
-    }
590
-    return $heading;
586
+		case 'sorting_options':
587
+			$heading = sprintf(__('Manage %s Listing Sorting Options Fields', 'geodirectory'), get_post_type_singular_label($listing_type));
588
+			break;
589
+	}
590
+	return $heading;
591 591
 }
592 592
 
593 593
 
@@ -605,16 +605,16 @@  discard block
 block discarded – undo
605 605
 function geodir_cf_panel_available_fields_head($heading, $sub_tab, $listing_type)
606 606
 {
607 607
 
608
-    switch ($sub_tab) {
609
-        case 'custom_fields':
610
-            $heading = sprintf(__('Add new %s form field', 'geodirectory'), get_post_type_singular_label($listing_type));
611
-            break;
608
+	switch ($sub_tab) {
609
+		case 'custom_fields':
610
+			$heading = sprintf(__('Add new %s form field', 'geodirectory'), get_post_type_singular_label($listing_type));
611
+			break;
612 612
 
613
-        case 'sorting_options':
614
-            $heading = sprintf(__('Available sorting options for %s listing and search results', 'geodirectory'), get_post_type_singular_label($listing_type));
615
-            break;
616
-    }
617
-    return $heading;
613
+		case 'sorting_options':
614
+			$heading = sprintf(__('Available sorting options for %s listing and search results', 'geodirectory'), get_post_type_singular_label($listing_type));
615
+			break;
616
+	}
617
+	return $heading;
618 618
 }
619 619
 
620 620
 
@@ -632,16 +632,16 @@  discard block
 block discarded – undo
632 632
 function geodir_cf_panel_available_fields_note($note, $sub_tab, $listing_type)
633 633
 {
634 634
 
635
-    switch ($sub_tab) {
636
-        case 'custom_fields':
637
-            $note = sprintf(__('Click on any box below to add a field of that type on add %s listing form. You must be use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));;
638
-            break;
635
+	switch ($sub_tab) {
636
+		case 'custom_fields':
637
+			$note = sprintf(__('Click on any box below to add a field of that type on add %s listing form. You must be use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));;
638
+			break;
639 639
 
640
-        case 'sorting_options':
641
-            $note = sprintf(__('Click on any box below to make it appear in 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));
642
-            break;
643
-    }
644
-    return $note;
640
+		case 'sorting_options':
641
+			$note = sprintf(__('Click on any box below to make it appear in 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));
642
+			break;
643
+	}
644
+	return $note;
645 645
 }
646 646
 
647 647
 
@@ -659,16 +659,16 @@  discard block
 block discarded – undo
659 659
 function geodir_cf_panel_selected_fields_head($heading, $sub_tab, $listing_type)
660 660
 {
661 661
 
662
-    switch ($sub_tab) {
663
-        case 'custom_fields':
664
-            $heading = sprintf(__('List of fields those will appear on add new %s listing form', 'geodirectory'), get_post_type_singular_label($listing_type));
665
-            break;
662
+	switch ($sub_tab) {
663
+		case 'custom_fields':
664
+			$heading = sprintf(__('List of fields those will appear on add new %s listing form', 'geodirectory'), get_post_type_singular_label($listing_type));
665
+			break;
666 666
 
667
-        case 'sorting_options':
668
-            $heading = sprintf(__('List of fields those will appear in %s listing and search resutls sorting option dropdown box.', 'geodirectory'), get_post_type_singular_label($listing_type));
669
-            break;
670
-    }
671
-    return $heading;
667
+		case 'sorting_options':
668
+			$heading = sprintf(__('List of fields those will appear in %s listing and search resutls sorting option dropdown box.', 'geodirectory'), get_post_type_singular_label($listing_type));
669
+			break;
670
+	}
671
+	return $heading;
672 672
 }
673 673
 
674 674
 
@@ -686,16 +686,16 @@  discard block
 block discarded – undo
686 686
 function geodir_cf_panel_selected_fields_note($note, $sub_tab, $listing_type)
687 687
 {
688 688
 
689
-    switch ($sub_tab) {
690
-        case 'custom_fields':
691
-            $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));;
692
-            break;
689
+	switch ($sub_tab) {
690
+		case 'custom_fields':
691
+			$note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));;
692
+			break;
693 693
 
694
-        case 'sorting_options':
695
-            $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));
696
-            break;
697
-    }
698
-    return $note;
694
+		case 'sorting_options':
695
+			$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));
696
+			break;
697
+	}
698
+	return $note;
699 699
 }
700 700
 
701 701
 
@@ -711,16 +711,16 @@  discard block
 block discarded – undo
711 711
  */
712 712
 function geodir_remove_unnecessary_fields()
713 713
 {
714
-    global $wpdb, $plugin_prefix;
714
+	global $wpdb, $plugin_prefix;
715 715
 
716
-    if (!get_option('geodir_remove_unnecessary_fields')) {
716
+	if (!get_option('geodir_remove_unnecessary_fields')) {
717 717
 
718
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
719
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
718
+		if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
719
+			$wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
720 720
 
721
-        update_option('geodir_remove_unnecessary_fields', '1');
721
+		update_option('geodir_remove_unnecessary_fields', '1');
722 722
 
723
-    }
723
+	}
724 724
 
725 725
 }
726 726
 
@@ -738,25 +738,25 @@  discard block
 block discarded – undo
738 738
  */
739 739
 function geodir_admin_ajax_handler()
740 740
 {
741
-    if (isset($_REQUEST['geodir_admin_ajax_action']) && $_REQUEST['geodir_admin_ajax_action'] != '') {
742
-        $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action'];
743
-        switch ($geodir_admin_ajax_action) {
744
-            case 'diagnosis' :
745
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
746
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
747
-                call_user_func('geodir_diagnose_' . $diagnose_this);
748
-                exit();
749
-                break;
750
-
751
-            case 'diagnosis-fix' :
752
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
753
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
754
-                call_user_func('geodir_diagnose_' . $diagnose_this);
755
-                exit();
756
-                break;
757
-        }
758
-    }
759
-    exit();
741
+	if (isset($_REQUEST['geodir_admin_ajax_action']) && $_REQUEST['geodir_admin_ajax_action'] != '') {
742
+		$geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action'];
743
+		switch ($geodir_admin_ajax_action) {
744
+			case 'diagnosis' :
745
+				if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
746
+					$diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
747
+				call_user_func('geodir_diagnose_' . $diagnose_this);
748
+				exit();
749
+				break;
750
+
751
+			case 'diagnosis-fix' :
752
+				if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
753
+					$diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
754
+				call_user_func('geodir_diagnose_' . $diagnose_this);
755
+				exit();
756
+				break;
757
+		}
758
+	}
759
+	exit();
760 760
 }
761 761
 
762 762
 
@@ -774,127 +774,127 @@  discard block
 block discarded – undo
774 774
  */
775 775
 function geodir_diagnose_multisite_table($filter_arr, $table, $tabel_name, $fix)
776 776
 {
777
-    global $wpdb;
778
-    //$filter_arr['output_str'] .='###'.$table.'###';
779
-    if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
780
-        $filter_arr['output_str'] .= "<li>" . __('ERROR: You didnt follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
781
-        $filter_arr['is_error_during_diagnose'] = true;
782
-
783
-    } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
784
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
785
-        $filter_arr['is_error_during_diagnose'] = true;
786
-        $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
787
-        $filter_arr['is_error_during_diagnose'] = true;
788
-
789
-        if ($fix) {
790
-            $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
791
-            $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
792
-
793
-            if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
794
-                //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
795
-
796
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
797
-
798
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
799
-                    $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
800
-                } else {
801
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
802
-                }
803
-
804
-            } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
805
-
806
-                $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
807
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
808
-
809
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
810
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
811
-                } else {
812
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
813
-                }
814
-
815
-            } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
816
-
817
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
818
-
819
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
820
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
821
-                } else {
822
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
823
-                }
824
-
825
-            }
826
-
827
-        }
828
-
829
-
830
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
831
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
832
-        $filter_arr['is_error_during_diagnose'] = true;
833
-
834
-        if ($fix) {
835
-            if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
836
-                if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
837
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
838
-                } else {
839
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
840
-                }
841
-
842
-            } 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
843
-                if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
844
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
845
-                } else {
846
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
847
-                }
848
-                if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
849
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
850
-                } else {
851
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
852
-                }
853
-            } else {// else rename the original table to _ms_bak
854
-                if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
855
-                    $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>";
856
-                } else {
857
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
858
-                }
859
-            }
860
-        }
861
-
862
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
863
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
864
-        $filter_arr['is_error_during_diagnose'] = true;
865
-
866
-        if ($fix) {
867
-            // if orignal table exists but new does not, rename
868
-            if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
869
-                $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
870
-            } else {
871
-                $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
872
-            }
873
-
874
-        }
875
-
876
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
877
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
878
-        $filter_arr['is_error_during_diagnose'] = true;
879
-
880
-        if ($fix) {
881
-            // if orignal table does not exist try deleting db_vers of all addons so the initial db_install scripts run;
882
-            delete_option('geodirlocation_db_version');
883
-            delete_option('geodirevents_db_version');
884
-            delete_option('geodir_reviewrating_db_version');
885
-            delete_option('gdevents_db_version');
886
-            delete_option('geodirectory_db_version');
887
-            delete_option('geodirclaim_db_version');
888
-            delete_option('geodir_custom_posts_db_version');
889
-            delete_option('geodir_reviewratings_db_version');
890
-            delete_option('geodiradvancesearch_db_version');
891
-            $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
892
-        }
893
-
894
-    } else {
895
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
896
-    }
897
-    return $filter_arr;
777
+	global $wpdb;
778
+	//$filter_arr['output_str'] .='###'.$table.'###';
779
+	if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
780
+		$filter_arr['output_str'] .= "<li>" . __('ERROR: You didnt follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
781
+		$filter_arr['is_error_during_diagnose'] = true;
782
+
783
+	} elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
784
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
785
+		$filter_arr['is_error_during_diagnose'] = true;
786
+		$filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
787
+		$filter_arr['is_error_during_diagnose'] = true;
788
+
789
+		if ($fix) {
790
+			$ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
791
+			$new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
792
+
793
+			if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
794
+				//$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
795
+
796
+				$wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
797
+
798
+				if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
799
+					$filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
800
+				} else {
801
+					$filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
802
+				}
803
+
804
+			} elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
805
+
806
+				$wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
807
+				$wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
808
+
809
+				if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
810
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
811
+				} else {
812
+					$filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
813
+				}
814
+
815
+			} elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
816
+
817
+				$wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
818
+
819
+				if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
820
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
821
+				} else {
822
+					$filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
823
+				}
824
+
825
+			}
826
+
827
+		}
828
+
829
+
830
+	} elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
831
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
832
+		$filter_arr['is_error_during_diagnose'] = true;
833
+
834
+		if ($fix) {
835
+			if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
836
+				if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
837
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
838
+				} else {
839
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
840
+				}
841
+
842
+			} 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
843
+				if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
844
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
845
+				} else {
846
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
847
+				}
848
+				if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
849
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
850
+				} else {
851
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
852
+				}
853
+			} else {// else rename the original table to _ms_bak
854
+				if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
855
+					$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>";
856
+				} else {
857
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
858
+				}
859
+			}
860
+		}
861
+
862
+	} elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
863
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
864
+		$filter_arr['is_error_during_diagnose'] = true;
865
+
866
+		if ($fix) {
867
+			// if orignal table exists but new does not, rename
868
+			if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
869
+				$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
870
+			} else {
871
+				$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
872
+			}
873
+
874
+		}
875
+
876
+	} elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
877
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
878
+		$filter_arr['is_error_during_diagnose'] = true;
879
+
880
+		if ($fix) {
881
+			// if orignal table does not exist try deleting db_vers of all addons so the initial db_install scripts run;
882
+			delete_option('geodirlocation_db_version');
883
+			delete_option('geodirevents_db_version');
884
+			delete_option('geodir_reviewrating_db_version');
885
+			delete_option('gdevents_db_version');
886
+			delete_option('geodirectory_db_version');
887
+			delete_option('geodirclaim_db_version');
888
+			delete_option('geodir_custom_posts_db_version');
889
+			delete_option('geodir_reviewratings_db_version');
890
+			delete_option('geodiradvancesearch_db_version');
891
+			$filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
892
+		}
893
+
894
+	} else {
895
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
896
+	}
897
+	return $filter_arr;
898 898
 }
899 899
 
900 900
 
@@ -908,53 +908,53 @@  discard block
 block discarded – undo
908 908
  */
909 909
 function geodir_diagnose_tags_sync()
910 910
 {
911
-    global $wpdb, $plugin_prefix;
912
-    $fix = isset($_POST['fix']) ? true : false;
913
-
914
-    //if($fix){echo 'true';}else{echo 'false';}
915
-    $is_error_during_diagnose = false;
916
-    $output_str = '';
917
-
918
-
919
-    $all_postypes = geodir_get_posttypes();
920
-
921
-    if (!empty($all_postypes)) {
922
-        foreach ($all_postypes as $key) {
923
-            // update each GD CTP
924
-            $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
925
-
926
-            if (!empty($posts)) {
927
-
928
-                foreach ($posts as $p) {
929
-                    $p->post_type = $key;
930
-                    $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
931
-                    if (empty($raw_tags)) {
932
-                        $post_tags = '';
933
-                    } else {
934
-                        $post_tags = implode(",", $raw_tags);
935
-                    }
936
-                    $tablename = $plugin_prefix . $p->post_type . '_detail';
937
-                    $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
938
-
939
-                }
940
-                $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
941
-            }
942
-
943
-        }
944
-
945
-    }
946
-
947
-    if ($is_error_during_diagnose) {
948
-        $info_div_class = "geodir_problem_info";
949
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
950
-    } else {
951
-        $info_div_class = "geodir_noproblem_info";
952
-        $fix_button_txt = '';
953
-    }
954
-    echo "<ul class='$info_div_class'>";
955
-    echo $output_str;
956
-    echo $fix_button_txt;
957
-    echo "</ul>";
911
+	global $wpdb, $plugin_prefix;
912
+	$fix = isset($_POST['fix']) ? true : false;
913
+
914
+	//if($fix){echo 'true';}else{echo 'false';}
915
+	$is_error_during_diagnose = false;
916
+	$output_str = '';
917
+
918
+
919
+	$all_postypes = geodir_get_posttypes();
920
+
921
+	if (!empty($all_postypes)) {
922
+		foreach ($all_postypes as $key) {
923
+			// update each GD CTP
924
+			$posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
925
+
926
+			if (!empty($posts)) {
927
+
928
+				foreach ($posts as $p) {
929
+					$p->post_type = $key;
930
+					$raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
931
+					if (empty($raw_tags)) {
932
+						$post_tags = '';
933
+					} else {
934
+						$post_tags = implode(",", $raw_tags);
935
+					}
936
+					$tablename = $plugin_prefix . $p->post_type . '_detail';
937
+					$wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
938
+
939
+				}
940
+				$output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
941
+			}
942
+
943
+		}
944
+
945
+	}
946
+
947
+	if ($is_error_during_diagnose) {
948
+		$info_div_class = "geodir_problem_info";
949
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
950
+	} else {
951
+		$info_div_class = "geodir_noproblem_info";
952
+		$fix_button_txt = '';
953
+	}
954
+	echo "<ul class='$info_div_class'>";
955
+	echo $output_str;
956
+	echo $fix_button_txt;
957
+	echo "</ul>";
958 958
 
959 959
 }
960 960
 
@@ -970,75 +970,75 @@  discard block
 block discarded – undo
970 970
  */
971 971
 function geodir_diagnose_cats_sync()
972 972
 {
973
-    global $wpdb, $plugin_prefix;
974
-    $fix = isset($_POST['fix']) ? true : false;
973
+	global $wpdb, $plugin_prefix;
974
+	$fix = isset($_POST['fix']) ? true : false;
975 975
 
976
-    //if($fix){echo 'true';}else{echo 'false';}
977
-    $is_error_during_diagnose = false;
978
-    $output_str = '';
976
+	//if($fix){echo 'true';}else{echo 'false';}
977
+	$is_error_during_diagnose = false;
978
+	$output_str = '';
979 979
 
980 980
 
981
-    $all_postypes = geodir_get_posttypes();
981
+	$all_postypes = geodir_get_posttypes();
982 982
 
983
-    if (!empty($all_postypes)) {
984
-        foreach ($all_postypes as $key) {
985
-            // update each GD CTP
986
-            $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
983
+	if (!empty($all_postypes)) {
984
+		foreach ($all_postypes as $key) {
985
+			// update each GD CTP
986
+			$posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
987 987
 
988
-            if (!empty($posts)) {
988
+			if (!empty($posts)) {
989 989
 
990
-                foreach ($posts as $p) {
991
-                    $p->post_type = $key;
992
-                    $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
990
+				foreach ($posts as $p) {
991
+					$p->post_type = $key;
992
+					$raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
993 993
 
994
-                    if (empty($raw_cats)) {
995
-                        $post_categories = get_post_meta($p->post_id, 'post_categories', true);
994
+					if (empty($raw_cats)) {
995
+						$post_categories = get_post_meta($p->post_id, 'post_categories', true);
996 996
 
997
-                        if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
998
-                            $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
999
-                            foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
1000
-                                if (is_numeric($cat_part)) {
1001
-                                    $raw_cats[] = (int)$cat_part;
1002
-                                }
1003
-                            }
997
+						if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
998
+							$post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
999
+							foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
1000
+								if (is_numeric($cat_part)) {
1001
+									$raw_cats[] = (int)$cat_part;
1002
+								}
1003
+							}
1004 1004
 
1005
-                        }
1005
+						}
1006 1006
 
1007
-                        if (!empty($raw_cats)) {
1008
-                            $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category');
1007
+						if (!empty($raw_cats)) {
1008
+							$term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category');
1009 1009
 
1010
-                        }
1010
+						}
1011 1011
 
1012
-                    }
1012
+					}
1013 1013
 
1014 1014
 
1015
-                    if (empty($raw_cats)) {
1016
-                        $post_cats = '';
1017
-                    } else {
1018
-                        $post_cats = ',' . implode(",", $raw_cats) . ',';
1019
-                    }
1020
-                    $tablename = $plugin_prefix . $p->post_type . '_detail';
1021
-                    $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
1022
-                }
1015
+					if (empty($raw_cats)) {
1016
+						$post_cats = '';
1017
+					} else {
1018
+						$post_cats = ',' . implode(",", $raw_cats) . ',';
1019
+					}
1020
+					$tablename = $plugin_prefix . $p->post_type . '_detail';
1021
+					$wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
1022
+				}
1023 1023
 
1024
-            }
1025
-            $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1024
+			}
1025
+			$output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1026 1026
 
1027
-        }
1027
+		}
1028 1028
 
1029
-    }
1029
+	}
1030 1030
 
1031
-    if ($is_error_during_diagnose) {
1032
-        $info_div_class = "geodir_problem_info";
1033
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1034
-    } else {
1035
-        $info_div_class = "geodir_noproblem_info";
1036
-        $fix_button_txt = '';
1037
-    }
1038
-    echo "<ul class='$info_div_class'>";
1039
-    echo $output_str;
1040
-    echo $fix_button_txt;
1041
-    echo "</ul>";
1031
+	if ($is_error_during_diagnose) {
1032
+		$info_div_class = "geodir_problem_info";
1033
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1034
+	} else {
1035
+		$info_div_class = "geodir_noproblem_info";
1036
+		$fix_button_txt = '';
1037
+	}
1038
+	echo "<ul class='$info_div_class'>";
1039
+	echo $output_str;
1040
+	echo $fix_button_txt;
1041
+	echo "</ul>";
1042 1042
 
1043 1043
 }
1044 1044
 
@@ -1052,61 +1052,61 @@  discard block
 block discarded – undo
1052 1052
  */
1053 1053
 function geodir_diagnose_version_clear()
1054 1054
 {
1055
-    global $wpdb, $plugin_prefix;
1056
-    $fix = isset($_POST['fix']) ? true : false;
1057
-
1058
-    //if($fix){echo 'true';}else{echo 'false';}
1059
-    $is_error_during_diagnose = false;
1060
-    $output_str = '';
1061
-
1062
-
1063
-    $gd_arr = array('GeoDirectory' => 'geodirectory_db_version',
1064
-        'Payment Manager' => 'geodir_payments_db_version',
1065
-        'GeoDirectory Framework' => 'gdf_db_version',
1066
-        'Advanced Search' => 'geodiradvancesearch_db_version',
1067
-        'Review Rating Manager' => 'geodir_reviewratings_db_version',
1068
-        'Claim Manager' => 'geodirclaim_db_version',
1069
-        'CPT Manager' => 'geodir_custom_posts_db_version',
1070
-        'Location Manager' => 'geodirlocation_db_version',
1071
-        'Payment Manager' => 'geodir_payments_db_version',
1072
-        'Events Manager' => 'geodirevents_db_version',
1073
-    );
1074
-
1075
-    /**
1076
-     * Filter the array of plugins to clear the version numbers for in the GD >Tools : clear all version numbers.
1077
-     *
1078
-     * @since 1.0.0
1079
-     * @param array $gd_arr The array or addons to clear, array('GeoDirectory' => 'geodirectory_db_version',...
1080
-     */
1081
-    $ver_arr = apply_filters('geodir_db_version_name', $gd_arr);
1082
-
1083
-    if (!empty($ver_arr)) {
1084
-        foreach ($ver_arr as $key => $val) {
1085
-            if (delete_option($val)) {
1086
-                $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
1087
-            } else {
1088
-                $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
1089
-            }
1090
-
1091
-        }
1092
-
1093
-        if ($output_str) {
1094
-            $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
1095
-        }
1096
-
1097
-    }
1098
-
1099
-    if ($is_error_during_diagnose) {
1100
-        $info_div_class = "geodir_problem_info";
1101
-        $fix_button_txt = "";
1102
-    } else {
1103
-        $info_div_class = "geodir_noproblem_info";
1104
-        $fix_button_txt = '';
1105
-    }
1106
-    echo "<ul class='$info_div_class'>";
1107
-    echo $output_str;
1108
-    echo $fix_button_txt;
1109
-    echo "</ul>";
1055
+	global $wpdb, $plugin_prefix;
1056
+	$fix = isset($_POST['fix']) ? true : false;
1057
+
1058
+	//if($fix){echo 'true';}else{echo 'false';}
1059
+	$is_error_during_diagnose = false;
1060
+	$output_str = '';
1061
+
1062
+
1063
+	$gd_arr = array('GeoDirectory' => 'geodirectory_db_version',
1064
+		'Payment Manager' => 'geodir_payments_db_version',
1065
+		'GeoDirectory Framework' => 'gdf_db_version',
1066
+		'Advanced Search' => 'geodiradvancesearch_db_version',
1067
+		'Review Rating Manager' => 'geodir_reviewratings_db_version',
1068
+		'Claim Manager' => 'geodirclaim_db_version',
1069
+		'CPT Manager' => 'geodir_custom_posts_db_version',
1070
+		'Location Manager' => 'geodirlocation_db_version',
1071
+		'Payment Manager' => 'geodir_payments_db_version',
1072
+		'Events Manager' => 'geodirevents_db_version',
1073
+	);
1074
+
1075
+	/**
1076
+	 * Filter the array of plugins to clear the version numbers for in the GD >Tools : clear all version numbers.
1077
+	 *
1078
+	 * @since 1.0.0
1079
+	 * @param array $gd_arr The array or addons to clear, array('GeoDirectory' => 'geodirectory_db_version',...
1080
+	 */
1081
+	$ver_arr = apply_filters('geodir_db_version_name', $gd_arr);
1082
+
1083
+	if (!empty($ver_arr)) {
1084
+		foreach ($ver_arr as $key => $val) {
1085
+			if (delete_option($val)) {
1086
+				$output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
1087
+			} else {
1088
+				$output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
1089
+			}
1090
+
1091
+		}
1092
+
1093
+		if ($output_str) {
1094
+			$output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
1095
+		}
1096
+
1097
+	}
1098
+
1099
+	if ($is_error_during_diagnose) {
1100
+		$info_div_class = "geodir_problem_info";
1101
+		$fix_button_txt = "";
1102
+	} else {
1103
+		$info_div_class = "geodir_noproblem_info";
1104
+		$fix_button_txt = '';
1105
+	}
1106
+	echo "<ul class='$info_div_class'>";
1107
+	echo $output_str;
1108
+	echo $fix_button_txt;
1109
+	echo "</ul>";
1110 1110
 
1111 1111
 }
1112 1112
 
@@ -1120,59 +1120,59 @@  discard block
 block discarded – undo
1120 1120
  */
1121 1121
 function geodir_diagnose_ratings()
1122 1122
 {
1123
-    global $wpdb;
1124
-    $fix = isset($_POST['fix']) ? true : false;
1125
-
1126
-    //if($fix){echo 'true';}else{echo 'false';}
1127
-    $is_error_during_diagnose = false;
1128
-    $output_str = '';
1129
-
1130
-    // check review locations
1131
-    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")) {
1132
-        $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
1133
-        $is_error_during_diagnose = true;
1134
-
1135
-        if ($fix) {
1136
-            if (geodir_fix_review_location()) {
1137
-                $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
1138
-            } else {
1139
-                $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
1140
-            }
1141
-        }
1142
-
1143
-    } else {
1144
-        $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
1145
-    }
1146
-
1147
-    // check review content
1148
-    if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
1149
-        $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
1150
-        $is_error_during_diagnose = true;
1151
-
1152
-        if ($fix) {
1153
-            if (geodir_fix_review_content()) {
1154
-                $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
1155
-            } else {
1156
-                $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
1157
-            }
1158
-        }
1159
-
1160
-    } else {
1161
-        $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
1162
-    }
1163
-
1164
-
1165
-    if ($is_error_during_diagnose) {
1166
-        $info_div_class = "geodir_problem_info";
1167
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1168
-    } else {
1169
-        $info_div_class = "geodir_noproblem_info";
1170
-        $fix_button_txt = '';
1171
-    }
1172
-    echo "<ul class='$info_div_class'>";
1173
-    echo $output_str;
1174
-    echo $fix_button_txt;
1175
-    echo "</ul>";
1123
+	global $wpdb;
1124
+	$fix = isset($_POST['fix']) ? true : false;
1125
+
1126
+	//if($fix){echo 'true';}else{echo 'false';}
1127
+	$is_error_during_diagnose = false;
1128
+	$output_str = '';
1129
+
1130
+	// check review locations
1131
+	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")) {
1132
+		$output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
1133
+		$is_error_during_diagnose = true;
1134
+
1135
+		if ($fix) {
1136
+			if (geodir_fix_review_location()) {
1137
+				$output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
1138
+			} else {
1139
+				$output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
1140
+			}
1141
+		}
1142
+
1143
+	} else {
1144
+		$output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
1145
+	}
1146
+
1147
+	// check review content
1148
+	if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
1149
+		$output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
1150
+		$is_error_during_diagnose = true;
1151
+
1152
+		if ($fix) {
1153
+			if (geodir_fix_review_content()) {
1154
+				$output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
1155
+			} else {
1156
+				$output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
1157
+			}
1158
+		}
1159
+
1160
+	} else {
1161
+		$output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
1162
+	}
1163
+
1164
+
1165
+	if ($is_error_during_diagnose) {
1166
+		$info_div_class = "geodir_problem_info";
1167
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1168
+	} else {
1169
+		$info_div_class = "geodir_noproblem_info";
1170
+		$fix_button_txt = '';
1171
+	}
1172
+	echo "<ul class='$info_div_class'>";
1173
+	echo $output_str;
1174
+	echo $fix_button_txt;
1175
+	echo "</ul>";
1176 1176
 
1177 1177
 }
1178 1178
 
@@ -1186,57 +1186,57 @@  discard block
 block discarded – undo
1186 1186
  */
1187 1187
 function geodir_diagnose_multisite_conversion()
1188 1188
 {
1189
-    global $wpdb;
1190
-    $fix = isset($_POST['fix']) ? true : false;
1191
-    //if($fix){echo 'true';}else{echo 'false';}
1192
-    $is_error_during_diagnose = false;
1193
-    $output_str = '';
1194
-
1195
-    $filter_arr = array();
1196
-    $filter_arr['output_str'] = $output_str;
1197
-    $filter_arr['is_error_during_diagnose'] = $is_error_during_diagnose;
1198
-    $table_arr = array('geodir_countries' => __('Countries', 'geodirectory'),
1199
-        'geodir_custom_fields' => __('Custom fields', 'geodirectory'),
1200
-        'geodir_post_icon' => __('Post icon', 'geodirectory'),
1201
-        'geodir_attachments' => __('Attachments', 'geodirectory'),
1202
-        'geodir_post_review' => __('Reviews', 'geodirectory'),
1203
-        'geodir_custom_sort_fields' => __('Custom sort fields', 'geodirectory'),
1204
-        'geodir_gd_place_detail' => __('Place detail', 'geodirectory')
1205
-    );
1206
-
1207
-    // allow other addons to hook in and add their checks
1208
-
1209
-    /**
1210
-     * Filter the array of tables.
1211
-     *
1212
-     * Filter the array of tables to check during the GD>Tools multisite DB conversion tool check, this allows adons to add their DB tables to the checks.
1213
-     *
1214
-     * @since 1.0.0
1215
-     * @param array $table_arr The array of tables to check, array('geodir_countries' => __('Countries', 'geodirectory'),...
1216
-     */
1217
-    $table_arr = apply_filters('geodir_diagnose_multisite_conversion', $table_arr);
1218
-
1219
-    foreach ($table_arr as $table => $table_name) {
1220
-        // Diagnose table
1221
-        $filter_arr = geodir_diagnose_multisite_table($filter_arr, $table, $table_name, $fix);
1222
-    }
1223
-
1224
-
1225
-    $output_str = $filter_arr['output_str'];
1226
-    $is_error_during_diagnose = $filter_arr['is_error_during_diagnose'];
1227
-
1228
-
1229
-    if ($is_error_during_diagnose) {
1230
-        $info_div_class = "geodir_problem_info";
1231
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1232
-    } else {
1233
-        $info_div_class = "geodir_noproblem_info";
1234
-        $fix_button_txt = '';
1235
-    }
1236
-    echo "<ul class='$info_div_class'>";
1237
-    echo $output_str;
1238
-    echo $fix_button_txt;
1239
-    echo "</ul>";
1189
+	global $wpdb;
1190
+	$fix = isset($_POST['fix']) ? true : false;
1191
+	//if($fix){echo 'true';}else{echo 'false';}
1192
+	$is_error_during_diagnose = false;
1193
+	$output_str = '';
1194
+
1195
+	$filter_arr = array();
1196
+	$filter_arr['output_str'] = $output_str;
1197
+	$filter_arr['is_error_during_diagnose'] = $is_error_during_diagnose;
1198
+	$table_arr = array('geodir_countries' => __('Countries', 'geodirectory'),
1199
+		'geodir_custom_fields' => __('Custom fields', 'geodirectory'),
1200
+		'geodir_post_icon' => __('Post icon', 'geodirectory'),
1201
+		'geodir_attachments' => __('Attachments', 'geodirectory'),
1202
+		'geodir_post_review' => __('Reviews', 'geodirectory'),
1203
+		'geodir_custom_sort_fields' => __('Custom sort fields', 'geodirectory'),
1204
+		'geodir_gd_place_detail' => __('Place detail', 'geodirectory')
1205
+	);
1206
+
1207
+	// allow other addons to hook in and add their checks
1208
+
1209
+	/**
1210
+	 * Filter the array of tables.
1211
+	 *
1212
+	 * Filter the array of tables to check during the GD>Tools multisite DB conversion tool check, this allows adons to add their DB tables to the checks.
1213
+	 *
1214
+	 * @since 1.0.0
1215
+	 * @param array $table_arr The array of tables to check, array('geodir_countries' => __('Countries', 'geodirectory'),...
1216
+	 */
1217
+	$table_arr = apply_filters('geodir_diagnose_multisite_conversion', $table_arr);
1218
+
1219
+	foreach ($table_arr as $table => $table_name) {
1220
+		// Diagnose table
1221
+		$filter_arr = geodir_diagnose_multisite_table($filter_arr, $table, $table_name, $fix);
1222
+	}
1223
+
1224
+
1225
+	$output_str = $filter_arr['output_str'];
1226
+	$is_error_during_diagnose = $filter_arr['is_error_during_diagnose'];
1227
+
1228
+
1229
+	if ($is_error_during_diagnose) {
1230
+		$info_div_class = "geodir_problem_info";
1231
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1232
+	} else {
1233
+		$info_div_class = "geodir_noproblem_info";
1234
+		$fix_button_txt = '';
1235
+	}
1236
+	echo "<ul class='$info_div_class'>";
1237
+	echo $output_str;
1238
+	echo $fix_button_txt;
1239
+	echo "</ul>";
1240 1240
 }
1241 1241
 
1242 1242
 /**
@@ -1254,39 +1254,39 @@  discard block
 block discarded – undo
1254 1254
  */
1255 1255
 function geodir_fix_virtual_page($slug, $page_title, $old_id, $option)
1256 1256
 {
1257
-    global $wpdb, $current_user;
1258
-
1259
-    if (!empty($old_id)) {
1260
-        wp_delete_post($old_id, true);
1261
-    }//delete post if already there
1262
-    else {
1263
-        $page_found = $wpdb->get_var(
1264
-            $wpdb->prepare(
1265
-                "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
1266
-                array($slug)
1267
-            )
1268
-        );
1269
-        wp_delete_post($page_found, true);
1270
-
1271
-    }
1272
-
1273
-    $page_data = array(
1274
-        'post_status' => 'publish',
1275
-        'post_type' => 'page',
1276
-        'post_author' => $current_user->ID,
1277
-        'post_name' => $slug,
1278
-        'post_title' => $page_title,
1279
-        'post_content' => '',
1280
-        'post_parent' => 0,
1281
-        'comment_status' => 'closed'
1282
-    );
1283
-    $page_id = wp_insert_post($page_data);
1284
-    update_option($option, $page_id);
1285
-    if ($page_id) {
1286
-        return true;
1287
-    } else {
1288
-        return false;
1289
-    }
1257
+	global $wpdb, $current_user;
1258
+
1259
+	if (!empty($old_id)) {
1260
+		wp_delete_post($old_id, true);
1261
+	}//delete post if already there
1262
+	else {
1263
+		$page_found = $wpdb->get_var(
1264
+			$wpdb->prepare(
1265
+				"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
1266
+				array($slug)
1267
+			)
1268
+		);
1269
+		wp_delete_post($page_found, true);
1270
+
1271
+	}
1272
+
1273
+	$page_data = array(
1274
+		'post_status' => 'publish',
1275
+		'post_type' => 'page',
1276
+		'post_author' => $current_user->ID,
1277
+		'post_name' => $slug,
1278
+		'post_title' => $page_title,
1279
+		'post_content' => '',
1280
+		'post_parent' => 0,
1281
+		'comment_status' => 'closed'
1282
+	);
1283
+	$page_id = wp_insert_post($page_data);
1284
+	update_option($option, $page_id);
1285
+	if ($page_id) {
1286
+		return true;
1287
+	} else {
1288
+		return false;
1289
+	}
1290 1290
 }
1291 1291
 
1292 1292
 /**
@@ -1298,212 +1298,212 @@  discard block
 block discarded – undo
1298 1298
  */
1299 1299
 function geodir_diagnose_default_pages()
1300 1300
 {
1301
-    global $wpdb;
1302
-    $is_error_during_diagnose = false;
1303
-    $output_str = '';
1304
-    $fix = isset($_POST['fix']) ? true : false;
1305
-
1306
-    //////////////////////////////////
1307
-    /* Diagnose GD Home Page Starts */
1308
-    //////////////////////////////////
1309
-    $option_value = get_option('geodir_home_page');
1310
-    $page = get_post($option_value);
1311
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1312
-
1313
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1314
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1315
-    else {
1316
-        $is_error_during_diagnose = true;
1317
-        $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1318
-        if ($fix) {
1319
-            if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
1320
-                $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
1321
-            } else {
1322
-                $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
1323
-            }
1324
-        }
1325
-    }
1326
-
1327
-    ////////////////////////////////
1328
-    /* Diagnose GD Home Page Ends */
1329
-    ////////////////////////////////
1330
-
1331
-    //////////////////////////////////
1332
-    /* Diagnose Add Listing Page Starts */
1333
-    //////////////////////////////////
1334
-    $option_value = get_option('geodir_add_listing_page');
1335
-    $page = get_post($option_value);
1336
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1337
-
1338
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1339
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1340
-    else {
1341
-        $is_error_during_diagnose = true;
1342
-        $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1343
-        if ($fix) {
1344
-            if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
1345
-                $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
1346
-            } else {
1347
-                $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
1348
-            }
1349
-        }
1350
-    }
1351
-
1352
-    ////////////////////////////////
1353
-    /* Diagnose Add Listing Page Ends */
1354
-    ////////////////////////////////
1355
-
1356
-
1357
-    //////////////////////////////////
1358
-    /* Diagnose Listing Preview Page Starts */
1359
-    //////////////////////////////////
1360
-    $option_value = get_option('geodir_preview_page');
1361
-    $page = get_post($option_value);
1362
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1363
-
1364
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1365
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1366
-    else {
1367
-        $is_error_during_diagnose = true;
1368
-        $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1369
-        if ($fix) {
1370
-            if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
1371
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
1372
-            } else {
1373
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
1374
-            }
1375
-        }
1376
-    }
1377
-
1378
-    ////////////////////////////////
1379
-    /* Diagnose Listing Preview Page Ends */
1380
-    ////////////////////////////////
1381
-
1382
-    //////////////////////////////////
1383
-    /* Diagnose Listing Success Page Starts */
1384
-    //////////////////////////////////
1385
-    $option_value = get_option('geodir_success_page');
1386
-    $page = get_post($option_value);
1387
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1388
-
1389
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1390
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1391
-    else {
1392
-        $is_error_during_diagnose = true;
1393
-        $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1394
-        if ($fix) {
1395
-            if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
1396
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
1397
-            } else {
1398
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
1399
-            }
1400
-        }
1401
-    }
1402
-
1403
-    ////////////////////////////////
1404
-    /* Diagnose Listing Sucess Page Ends */
1405
-    ////////////////////////////////
1406
-
1407
-    //////////////////////////////////
1408
-    /* Diagnose Info Page Starts */
1409
-    //////////////////////////////////
1410
-    $option_value = get_option('geodir_info_page');
1411
-    $page = get_post($option_value);
1412
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1413
-
1414
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1415
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1416
-    else {
1417
-        $is_error_during_diagnose = true;
1418
-        $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1419
-        if ($fix) {
1420
-            if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
1421
-                $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
1422
-            } else {
1423
-                $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
1424
-            }
1425
-        }
1426
-    }
1427
-
1428
-    ////////////////////////////////
1429
-    /* Diagnose Info Page Ends */
1430
-    ////////////////////////////////
1431
-
1432
-    //////////////////////////////////
1433
-    /* Diagnose Login Page Starts */
1434
-    //////////////////////////////////
1435
-    $option_value = get_option('geodir_login_page');
1436
-    $page = get_post($option_value);
1437
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1438
-
1439
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1440
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1441
-    else {
1442
-        $is_error_during_diagnose = true;
1443
-        $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1444
-        if ($fix) {
1445
-            if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
1446
-                $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
1447
-            } else {
1448
-                $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
1449
-            }
1450
-        }
1451
-    }
1452
-
1453
-    ////////////////////////////////
1454
-    /* Diagnose Info Page Ends */
1455
-    ////////////////////////////////
1456
-
1457
-    //////////////////////////////////
1458
-    /* Diagnose Location Page Starts */
1459
-    //////////////////////////////////
1460
-    $option_value = get_option('geodir_location_page');
1461
-    $page = get_post($option_value);
1462
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1463
-
1464
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1465
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1466
-    else {
1467
-        $is_error_during_diagnose = true;
1468
-        $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1469
-        if ($fix) {
1470
-            if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
1471
-                $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
1472
-            } else {
1473
-                $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
1474
-            }
1475
-        }
1476
-    }
1477
-
1478
-    ////////////////////////////////
1479
-    /* Diagnose Location Page Ends */
1480
-    ////////////////////////////////
1481
-
1482
-    $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
1483
-    /**
1484
-     * This action is called at the end of the GD Tools page check function.
1485
-     *
1486
-     * @since 1.5.2
1487
-     */
1488
-    $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
1489
-
1490
-    $output_str = $page_chk_arr['output_str'];
1491
-    $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];
1492
-
1493
-    if ($is_error_during_diagnose) {
1494
-        if ($fix) {
1495
-            flush_rewrite_rules();
1496
-        }
1497
-        $info_div_class = "geodir_problem_info";
1498
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1499
-    } else {
1500
-        $info_div_class = "geodir_noproblem_info";
1501
-        $fix_button_txt = '';
1502
-    }
1503
-    echo "<ul class='$info_div_class'>";
1504
-    echo $output_str;
1505
-    echo $fix_button_txt;
1506
-    echo "</ul>";
1301
+	global $wpdb;
1302
+	$is_error_during_diagnose = false;
1303
+	$output_str = '';
1304
+	$fix = isset($_POST['fix']) ? true : false;
1305
+
1306
+	//////////////////////////////////
1307
+	/* Diagnose GD Home Page Starts */
1308
+	//////////////////////////////////
1309
+	$option_value = get_option('geodir_home_page');
1310
+	$page = get_post($option_value);
1311
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1312
+
1313
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1314
+		$output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1315
+	else {
1316
+		$is_error_during_diagnose = true;
1317
+		$output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1318
+		if ($fix) {
1319
+			if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
1320
+				$output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
1321
+			} else {
1322
+				$output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
1323
+			}
1324
+		}
1325
+	}
1326
+
1327
+	////////////////////////////////
1328
+	/* Diagnose GD Home Page Ends */
1329
+	////////////////////////////////
1330
+
1331
+	//////////////////////////////////
1332
+	/* Diagnose Add Listing Page Starts */
1333
+	//////////////////////////////////
1334
+	$option_value = get_option('geodir_add_listing_page');
1335
+	$page = get_post($option_value);
1336
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1337
+
1338
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1339
+		$output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1340
+	else {
1341
+		$is_error_during_diagnose = true;
1342
+		$output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1343
+		if ($fix) {
1344
+			if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
1345
+				$output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
1346
+			} else {
1347
+				$output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
1348
+			}
1349
+		}
1350
+	}
1351
+
1352
+	////////////////////////////////
1353
+	/* Diagnose Add Listing Page Ends */
1354
+	////////////////////////////////
1355
+
1356
+
1357
+	//////////////////////////////////
1358
+	/* Diagnose Listing Preview Page Starts */
1359
+	//////////////////////////////////
1360
+	$option_value = get_option('geodir_preview_page');
1361
+	$page = get_post($option_value);
1362
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1363
+
1364
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1365
+		$output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1366
+	else {
1367
+		$is_error_during_diagnose = true;
1368
+		$output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1369
+		if ($fix) {
1370
+			if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
1371
+				$output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
1372
+			} else {
1373
+				$output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
1374
+			}
1375
+		}
1376
+	}
1377
+
1378
+	////////////////////////////////
1379
+	/* Diagnose Listing Preview Page Ends */
1380
+	////////////////////////////////
1381
+
1382
+	//////////////////////////////////
1383
+	/* Diagnose Listing Success Page Starts */
1384
+	//////////////////////////////////
1385
+	$option_value = get_option('geodir_success_page');
1386
+	$page = get_post($option_value);
1387
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1388
+
1389
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1390
+		$output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1391
+	else {
1392
+		$is_error_during_diagnose = true;
1393
+		$output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1394
+		if ($fix) {
1395
+			if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
1396
+				$output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
1397
+			} else {
1398
+				$output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
1399
+			}
1400
+		}
1401
+	}
1402
+
1403
+	////////////////////////////////
1404
+	/* Diagnose Listing Sucess Page Ends */
1405
+	////////////////////////////////
1406
+
1407
+	//////////////////////////////////
1408
+	/* Diagnose Info Page Starts */
1409
+	//////////////////////////////////
1410
+	$option_value = get_option('geodir_info_page');
1411
+	$page = get_post($option_value);
1412
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1413
+
1414
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1415
+		$output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1416
+	else {
1417
+		$is_error_during_diagnose = true;
1418
+		$output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1419
+		if ($fix) {
1420
+			if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
1421
+				$output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
1422
+			} else {
1423
+				$output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
1424
+			}
1425
+		}
1426
+	}
1427
+
1428
+	////////////////////////////////
1429
+	/* Diagnose Info Page Ends */
1430
+	////////////////////////////////
1431
+
1432
+	//////////////////////////////////
1433
+	/* Diagnose Login Page Starts */
1434
+	//////////////////////////////////
1435
+	$option_value = get_option('geodir_login_page');
1436
+	$page = get_post($option_value);
1437
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1438
+
1439
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1440
+		$output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1441
+	else {
1442
+		$is_error_during_diagnose = true;
1443
+		$output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1444
+		if ($fix) {
1445
+			if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
1446
+				$output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
1447
+			} else {
1448
+				$output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
1449
+			}
1450
+		}
1451
+	}
1452
+
1453
+	////////////////////////////////
1454
+	/* Diagnose Info Page Ends */
1455
+	////////////////////////////////
1456
+
1457
+	//////////////////////////////////
1458
+	/* Diagnose Location Page Starts */
1459
+	//////////////////////////////////
1460
+	$option_value = get_option('geodir_location_page');
1461
+	$page = get_post($option_value);
1462
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1463
+
1464
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1465
+		$output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1466
+	else {
1467
+		$is_error_during_diagnose = true;
1468
+		$output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1469
+		if ($fix) {
1470
+			if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
1471
+				$output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
1472
+			} else {
1473
+				$output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
1474
+			}
1475
+		}
1476
+	}
1477
+
1478
+	////////////////////////////////
1479
+	/* Diagnose Location Page Ends */
1480
+	////////////////////////////////
1481
+
1482
+	$page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
1483
+	/**
1484
+	 * This action is called at the end of the GD Tools page check function.
1485
+	 *
1486
+	 * @since 1.5.2
1487
+	 */
1488
+	$page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
1489
+
1490
+	$output_str = $page_chk_arr['output_str'];
1491
+	$is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];
1492
+
1493
+	if ($is_error_during_diagnose) {
1494
+		if ($fix) {
1495
+			flush_rewrite_rules();
1496
+		}
1497
+		$info_div_class = "geodir_problem_info";
1498
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1499
+	} else {
1500
+		$info_div_class = "geodir_noproblem_info";
1501
+		$fix_button_txt = '';
1502
+	}
1503
+	echo "<ul class='$info_div_class'>";
1504
+	echo $output_str;
1505
+	echo $fix_button_txt;
1506
+	echo "</ul>";
1507 1507
 
1508 1508
 }
1509 1509
 
@@ -1515,25 +1515,25 @@  discard block
 block discarded – undo
1515 1515
  * @global object $wpdb WordPress Database object.
1516 1516
  */
1517 1517
 function geodir_diagnose_load_db_language() {
1518
-    global $wpdb;
1518
+	global $wpdb;
1519 1519
 	
1520 1520
 	$is_error_during_diagnose = geodirectory_load_db_language();
1521 1521
 
1522
-    $output_str = '';
1522
+	$output_str = '';
1523 1523
 
1524
-    if ($is_error_during_diagnose) {
1525
-        $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>";
1524
+	if ($is_error_during_diagnose) {
1525
+		$output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>";
1526 1526
 		$info_div_class = "geodir_problem_info";
1527
-    } else {
1528
-        $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
1527
+	} else {
1528
+		$output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
1529 1529
 		$info_div_class = "geodir_noproblem_info";
1530
-        $fix_button_txt = '';
1531
-    }
1530
+		$fix_button_txt = '';
1531
+	}
1532 1532
     
1533 1533
 	echo "<ul class='$info_div_class'>";
1534
-    echo $output_str;
1535
-    echo $fix_button_txt;
1536
-    echo "</ul>";
1534
+	echo $output_str;
1535
+	echo $fix_button_txt;
1536
+	echo "</ul>";
1537 1537
 
1538 1538
 }
1539 1539
 
@@ -1564,23 +1564,23 @@  discard block
 block discarded – undo
1564 1564
  */
1565 1565
 function geodir_posts_clauses_request($clauses)
1566 1566
 {
1567
-    global $wpdb, $wp_query, $plugin_prefix;
1567
+	global $wpdb, $wp_query, $plugin_prefix;
1568 1568
 
1569
-    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'])) {
1570
-        $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail';
1569
+	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'])) {
1570
+		$table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail';
1571 1571
 
1572
-        $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)';
1573
-        $clauses['join'] = $join;
1572
+		$join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)';
1573
+		$clauses['join'] = $join;
1574 1574
 
1575
-        $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : '';
1576
-        $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';
1577
-        $clauses['fields'] = $fields;
1575
+		$fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : '';
1576
+		$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';
1577
+		$clauses['fields'] = $fields;
1578 1578
 
1579
-        $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC';
1580
-        $orderby = 'gd_expire ' . $order;
1581
-        $clauses['orderby'] = $orderby;
1582
-    }
1583
-    return $clauses;
1579
+		$order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC';
1580
+		$orderby = 'gd_expire ' . $order;
1581
+		$clauses['orderby'] = $orderby;
1582
+	}
1583
+	return $clauses;
1584 1584
 }
1585 1585
 
1586 1586
 
@@ -1601,7 +1601,7 @@  discard block
 block discarded – undo
1601 1601
  */
1602 1602
 function gd_theme_switch_compat_check()
1603 1603
 {
1604
-    gd_set_theme_compat();
1604
+	gd_set_theme_compat();
1605 1605
 }
1606 1606
 
1607 1607
 /**
@@ -1614,27 +1614,27 @@  discard block
 block discarded – undo
1614 1614
  */
1615 1615
 function geodir_str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\")
1616 1616
 {
1617
-    if (function_exists('str_getcsv')) {
1618
-        $fgetcsv = str_getcsv($input, $delimiter, $enclosure, $escape);
1619
-    } else {
1620
-        global $current_user;
1621
-        $upload_dir = wp_upload_dir();
1622
-
1623
-        $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv';
1624
-        $handle = fopen($file, 'w');
1625
-
1626
-        fwrite($handle, $input);
1627
-        fclose($handle);
1628
-
1629
-        $handle = fopen($file, 'rt');
1630
-        if (PHP_VERSION >= '5.3.0') {
1631
-            $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure, $escape);
1632
-        } else {
1633
-            $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure);
1634
-        }
1635
-        fclose($handle);
1636
-    }
1637
-    return $fgetcsv;
1617
+	if (function_exists('str_getcsv')) {
1618
+		$fgetcsv = str_getcsv($input, $delimiter, $enclosure, $escape);
1619
+	} else {
1620
+		global $current_user;
1621
+		$upload_dir = wp_upload_dir();
1622
+
1623
+		$file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv';
1624
+		$handle = fopen($file, 'w');
1625
+
1626
+		fwrite($handle, $input);
1627
+		fclose($handle);
1628
+
1629
+		$handle = fopen($file, 'rt');
1630
+		if (PHP_VERSION >= '5.3.0') {
1631
+			$fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure, $escape);
1632
+		} else {
1633
+			$fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure);
1634
+		}
1635
+		fclose($handle);
1636
+	}
1637
+	return $fgetcsv;
1638 1638
 }
1639 1639
 
1640 1640
 add_action('wp_ajax_gdImportCsv', 'geodir_ajax_import_csv');
@@ -1649,375 +1649,375 @@  discard block
 block discarded – undo
1649 1649
  */
1650 1650
 function geodir_ajax_import_csv()
1651 1651
 {
1652
-    error_reporting(0); // hide error to get clean json response
1652
+	error_reporting(0); // hide error to get clean json response
1653 1653
 
1654
-    global $wpdb, $plugin_prefix, $current_user;
1655
-    $uploads = wp_upload_dir();
1656
-    ini_set('auto_detect_line_endings', true);
1654
+	global $wpdb, $plugin_prefix, $current_user;
1655
+	$uploads = wp_upload_dir();
1656
+	ini_set('auto_detect_line_endings', true);
1657 1657
 	
1658 1658
 	$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
1659 1659
 
1660
-    $task = isset($_POST['task']) ? $_POST['task'] : '';
1661
-    $uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL;
1662
-    $filename = $uploadedFile;
1663
-
1664
-    $uploads = wp_upload_dir();
1665
-    $uploads_dir = $uploads['path'];
1666
-    $image_name_arr = explode('/', $filename);
1667
-    $filename = end($image_name_arr);
1668
-    $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1669
-    $return = array();
1670
-    $return['file'] = $uploadedFile;
1671
-    $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
1672
-
1673
-    if (is_file($target_path) && file_exists($target_path) && $uploadedFile) {
1674
-        $wp_filetype = wp_check_filetype_and_ext($target_path, $filename);
1675
-
1676
-        if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
1677
-            $return['error'] = NULL;
1678
-
1679
-            $return['rows'] = 0;
1680
-
1681
-
1682
-
1683
-                if (($handle = fopen($target_path, "r")) !== FALSE) {
1684
-                    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
1685
-                        if(is_array($data) && !empty($data)) {
1686
-                            $file[] = '"' . implode('","', $data) . '"';
1687
-                        }
1688
-                    }
1689
-                    fclose($handle);
1690
-                    $file = $file;
1691
-                }
1692
-
1693
-
1694
-
1695
-                $return['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
1696
-
1697
-
1698
-            if (!$return['rows'] > 0) {
1699
-                $return['error'] = __('No data found in csv file.', 'geodirectory');
1700
-            }
1701
-        }
1702
-    }
1703
-    if ($task == 'prepare' || !empty($return['error'])) {
1704
-        echo json_encode($return);
1705
-        exit;
1706
-    }
1707
-
1708
-    $totRecords = isset($_POST['gddata']['totRecords']) ? $_POST['gddata']['totRecords'] : NULL;
1709
-    $importlimit = isset($_POST['gddata']['importlimit']) ? $_POST['gddata']['importlimit'] : 1;
1710
-    $count = $importlimit;
1711
-    $requested_limit = $importlimit;
1712
-    $tmpCnt = isset($_POST['gddata']['tmpcount']) ? $_POST['gddata']['tmpcount'] : 0;
1713
-
1714
-    if ($count < $totRecords) {
1715
-        $count = $tmpCnt + $count;
1716
-        if ($count > $totRecords) {
1717
-            $count = $totRecords;
1718
-        }
1719
-    } else {
1720
-        $count = $totRecords;
1721
-    }
1722
-
1723
-    $total_records = 0;
1724
-    $rowcount = 0;
1725
-    $address_invalid = 0;
1726
-    $blank_address = 0;
1727
-    $upload_files = 0;
1728
-    $invalid_post_type = 0;
1729
-    $invalid_title = 0;
1730
-    $customKeyarray = array();
1731
-    $gd_post_info = array();
1732
-    $post_location = array();
1733
-    $countpost = 0;
1734
-
1735
-    if (!empty($file)) {
1736
-        $columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL;
1737
-        $customKeyarray = $columns;
1738
-
1739
-        if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
1740
-            $return['error'] = CSV_INVAILD_FILE;
1741
-            echo json_encode($return);
1742
-            exit;
1743
-        }
1744
-
1745
-        for ($i = 1; $i <= $importlimit; $i++) {
1746
-            $current_index = $tmpCnt + $i;
1747
-            if (isset($file[$current_index])) {
1748
-                $total_records++;
1749
-
1750
-                $buffer = geodir_str_getcsv($file[$current_index]);
1751
-                $post_title = addslashes($buffer[0]);
1752
-                $current_post_author = $buffer[1];
1753
-                $post_desc = addslashes($buffer[2]);
1754
-                $post_cat = array();
1755
-                $catids_arr = array();
1756
-                $post_cat = trim($buffer[3]); // comma seperated category name
1757
-
1758
-                if ($post_cat) {
1759
-                    $post_cat_arr = explode(',', $post_cat);
1760
-
1761
-                    for ($c = 0; $c < count($post_cat_arr); $c++) {
1762
-                        $catid = wp_kses_normalize_entities(trim($post_cat_arr[$c]));
1763
-
1764
-                        if (!empty($buffer[5])) {
1765
-                            if (in_array($buffer[5], geodir_get_posttypes())) {
1766
-
1767
-                                $p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5]));
1768
-
1769
-                                if (get_term_by('name', $catid, $p_taxonomy[0])) {
1770
-                                    $cat = get_term_by('name', $catid, $p_taxonomy[0]);
1771
-                                    $catids_arr[] = $cat->slug;
1772
-                                } else if (get_term_by('slug', $catid, $p_taxonomy[0])) {
1773
-                                    $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
1774
-                                    $catids_arr[] = $cat->slug;
1775
-                                } else {
1776
-                                    $ret = wp_insert_term($catid, $p_taxonomy[0]);
1777
-                                    if ($ret && !is_wp_error($ret)) {
1778
-                                        if (get_term_by('name', $catid, $p_taxonomy[0])) {
1779
-                                            $cat = get_term_by('name', $catid, $p_taxonomy[0]);
1780
-                                            $catids_arr[] = $cat->slug;
1781
-                                        } elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
1782
-                                            $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
1783
-                                            $catids_arr[] = $cat->slug;
1784
-                                        }
1785
-                                    }
1786
-                                }
1787
-                            }
1788
-                        }
1789
-                    }
1790
-                }
1791
-
1792
-                if (!$catids_arr) {
1793
-                    $catids_arr[] = 1;
1794
-                }
1795
-
1796
-                $post_tags = trim($buffer[4]); // comma seperated tags
1797
-
1798
-                $tag_arr = '';
1799
-                if ($post_tags) {
1800
-                    $tag_arr = explode(',', $post_tags);
1801
-                }
1802
-
1803
-                $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database
1804
-
1805
-                $error = '';
1806
-                if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
1807
-                    $invalid_post_type++;
1808
-                    continue;
1809
-                }
1810
-
1811
-                if ($post_title != '') {
1812
-                    $menu_order = 0;
1813
-                    $image_folder_name = 'uplaod/';
1814
-
1815
-                    $image_names = array();
1816
-
1817
-                    for ($c = 5; $c < count($customKeyarray); $c++) {
1818
-                        $gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]);
1819
-
1820
-                        if ($customKeyarray[$c] == 'IMAGE') {
1821
-                            $buffer[$c] = trim($buffer[$c]);
1822
-
1823
-                            if (!empty($buffer[$c])) {
1824
-                                $image_names[] = $buffer[$c];
1825
-                            }
1826
-                        }
1827
-
1828
-                        if ($customKeyarray[$c] == 'alive_days') {
1829
-                            if ($buffer[$c] != '0' && $buffer[$c] != '') {
1830
-                                $submitdata = date('Y-m-d');
1831
-
1832
-                                $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
1833
-                            } else {
1834
-                                $gd_post_info['expire_date'] = 'Never';
1835
-                            }
1836
-                        }
1837
-
1838
-                        if ($customKeyarray[$c] == 'post_city') {
1839
-                            $post_city = addslashes($buffer[$c]);
1840
-                        }
1841
-
1842
-                        if ($customKeyarray[$c] == 'post_region') {
1843
-                            $post_region = addslashes($buffer[$c]);
1844
-                        }
1845
-
1846
-                        if ($customKeyarray[$c] == 'post_country') {
1847
-                            $post_country = addslashes($buffer[$c]);
1848
-                        }
1849
-
1850
-                        if ($customKeyarray[$c] == 'post_latitude') {
1851
-                            $post_latitude = addslashes($buffer[$c]);
1852
-                        }
1853
-
1854
-                        if ($customKeyarray[$c] == 'post_longitude') {
1855
-                            $post_longitude = addslashes($buffer[$c]);
1856
-                        }
1660
+	$task = isset($_POST['task']) ? $_POST['task'] : '';
1661
+	$uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL;
1662
+	$filename = $uploadedFile;
1663
+
1664
+	$uploads = wp_upload_dir();
1665
+	$uploads_dir = $uploads['path'];
1666
+	$image_name_arr = explode('/', $filename);
1667
+	$filename = end($image_name_arr);
1668
+	$target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1669
+	$return = array();
1670
+	$return['file'] = $uploadedFile;
1671
+	$return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
1672
+
1673
+	if (is_file($target_path) && file_exists($target_path) && $uploadedFile) {
1674
+		$wp_filetype = wp_check_filetype_and_ext($target_path, $filename);
1675
+
1676
+		if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
1677
+			$return['error'] = NULL;
1678
+
1679
+			$return['rows'] = 0;
1680
+
1681
+
1682
+
1683
+				if (($handle = fopen($target_path, "r")) !== FALSE) {
1684
+					while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
1685
+						if(is_array($data) && !empty($data)) {
1686
+							$file[] = '"' . implode('","', $data) . '"';
1687
+						}
1688
+					}
1689
+					fclose($handle);
1690
+					$file = $file;
1691
+				}
1692
+
1693
+
1694
+
1695
+				$return['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
1696
+
1697
+
1698
+			if (!$return['rows'] > 0) {
1699
+				$return['error'] = __('No data found in csv file.', 'geodirectory');
1700
+			}
1701
+		}
1702
+	}
1703
+	if ($task == 'prepare' || !empty($return['error'])) {
1704
+		echo json_encode($return);
1705
+		exit;
1706
+	}
1707
+
1708
+	$totRecords = isset($_POST['gddata']['totRecords']) ? $_POST['gddata']['totRecords'] : NULL;
1709
+	$importlimit = isset($_POST['gddata']['importlimit']) ? $_POST['gddata']['importlimit'] : 1;
1710
+	$count = $importlimit;
1711
+	$requested_limit = $importlimit;
1712
+	$tmpCnt = isset($_POST['gddata']['tmpcount']) ? $_POST['gddata']['tmpcount'] : 0;
1713
+
1714
+	if ($count < $totRecords) {
1715
+		$count = $tmpCnt + $count;
1716
+		if ($count > $totRecords) {
1717
+			$count = $totRecords;
1718
+		}
1719
+	} else {
1720
+		$count = $totRecords;
1721
+	}
1722
+
1723
+	$total_records = 0;
1724
+	$rowcount = 0;
1725
+	$address_invalid = 0;
1726
+	$blank_address = 0;
1727
+	$upload_files = 0;
1728
+	$invalid_post_type = 0;
1729
+	$invalid_title = 0;
1730
+	$customKeyarray = array();
1731
+	$gd_post_info = array();
1732
+	$post_location = array();
1733
+	$countpost = 0;
1734
+
1735
+	if (!empty($file)) {
1736
+		$columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL;
1737
+		$customKeyarray = $columns;
1738
+
1739
+		if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
1740
+			$return['error'] = CSV_INVAILD_FILE;
1741
+			echo json_encode($return);
1742
+			exit;
1743
+		}
1744
+
1745
+		for ($i = 1; $i <= $importlimit; $i++) {
1746
+			$current_index = $tmpCnt + $i;
1747
+			if (isset($file[$current_index])) {
1748
+				$total_records++;
1749
+
1750
+				$buffer = geodir_str_getcsv($file[$current_index]);
1751
+				$post_title = addslashes($buffer[0]);
1752
+				$current_post_author = $buffer[1];
1753
+				$post_desc = addslashes($buffer[2]);
1754
+				$post_cat = array();
1755
+				$catids_arr = array();
1756
+				$post_cat = trim($buffer[3]); // comma seperated category name
1757
+
1758
+				if ($post_cat) {
1759
+					$post_cat_arr = explode(',', $post_cat);
1760
+
1761
+					for ($c = 0; $c < count($post_cat_arr); $c++) {
1762
+						$catid = wp_kses_normalize_entities(trim($post_cat_arr[$c]));
1763
+
1764
+						if (!empty($buffer[5])) {
1765
+							if (in_array($buffer[5], geodir_get_posttypes())) {
1766
+
1767
+								$p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5]));
1768
+
1769
+								if (get_term_by('name', $catid, $p_taxonomy[0])) {
1770
+									$cat = get_term_by('name', $catid, $p_taxonomy[0]);
1771
+									$catids_arr[] = $cat->slug;
1772
+								} else if (get_term_by('slug', $catid, $p_taxonomy[0])) {
1773
+									$cat = get_term_by('slug', $catid, $p_taxonomy[0]);
1774
+									$catids_arr[] = $cat->slug;
1775
+								} else {
1776
+									$ret = wp_insert_term($catid, $p_taxonomy[0]);
1777
+									if ($ret && !is_wp_error($ret)) {
1778
+										if (get_term_by('name', $catid, $p_taxonomy[0])) {
1779
+											$cat = get_term_by('name', $catid, $p_taxonomy[0]);
1780
+											$catids_arr[] = $cat->slug;
1781
+										} elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
1782
+											$cat = get_term_by('slug', $catid, $p_taxonomy[0]);
1783
+											$catids_arr[] = $cat->slug;
1784
+										}
1785
+									}
1786
+								}
1787
+							}
1788
+						}
1789
+					}
1790
+				}
1791
+
1792
+				if (!$catids_arr) {
1793
+					$catids_arr[] = 1;
1794
+				}
1795
+
1796
+				$post_tags = trim($buffer[4]); // comma seperated tags
1797
+
1798
+				$tag_arr = '';
1799
+				if ($post_tags) {
1800
+					$tag_arr = explode(',', $post_tags);
1801
+				}
1802
+
1803
+				$table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database
1804
+
1805
+				$error = '';
1806
+				if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
1807
+					$invalid_post_type++;
1808
+					continue;
1809
+				}
1810
+
1811
+				if ($post_title != '') {
1812
+					$menu_order = 0;
1813
+					$image_folder_name = 'uplaod/';
1814
+
1815
+					$image_names = array();
1816
+
1817
+					for ($c = 5; $c < count($customKeyarray); $c++) {
1818
+						$gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]);
1819
+
1820
+						if ($customKeyarray[$c] == 'IMAGE') {
1821
+							$buffer[$c] = trim($buffer[$c]);
1822
+
1823
+							if (!empty($buffer[$c])) {
1824
+								$image_names[] = $buffer[$c];
1825
+							}
1826
+						}
1827
+
1828
+						if ($customKeyarray[$c] == 'alive_days') {
1829
+							if ($buffer[$c] != '0' && $buffer[$c] != '') {
1830
+								$submitdata = date('Y-m-d');
1831
+
1832
+								$gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
1833
+							} else {
1834
+								$gd_post_info['expire_date'] = 'Never';
1835
+							}
1836
+						}
1837
+
1838
+						if ($customKeyarray[$c] == 'post_city') {
1839
+							$post_city = addslashes($buffer[$c]);
1840
+						}
1841
+
1842
+						if ($customKeyarray[$c] == 'post_region') {
1843
+							$post_region = addslashes($buffer[$c]);
1844
+						}
1845
+
1846
+						if ($customKeyarray[$c] == 'post_country') {
1847
+							$post_country = addslashes($buffer[$c]);
1848
+						}
1849
+
1850
+						if ($customKeyarray[$c] == 'post_latitude') {
1851
+							$post_latitude = addslashes($buffer[$c]);
1852
+						}
1853
+
1854
+						if ($customKeyarray[$c] == 'post_longitude') {
1855
+							$post_longitude = addslashes($buffer[$c]);
1856
+						}
1857 1857
 						
1858 1858
 						// Post status
1859 1859
 						if ($customKeyarray[$c] == 'post_status') {
1860
-                            $post_status = sanitize_key( $buffer[$c] );
1861
-                        }
1862
-                    }
1863
-
1864
-                    /* ================ before array create ============== */
1865
-                    $location_result = geodir_get_default_location();
1866
-                    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'] == '')) {
1867
-                        $blank_address++;
1868
-                        continue;
1869
-                    } else if ($location_result->location_id == 0) {
1870
-                        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))) {
1871
-                            $address_invalid++;
1872
-                            continue;
1873
-                        }
1874
-                    }
1860
+							$post_status = sanitize_key( $buffer[$c] );
1861
+						}
1862
+					}
1863
+
1864
+					/* ================ before array create ============== */
1865
+					$location_result = geodir_get_default_location();
1866
+					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'] == '')) {
1867
+						$blank_address++;
1868
+						continue;
1869
+					} else if ($location_result->location_id == 0) {
1870
+						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))) {
1871
+							$address_invalid++;
1872
+							continue;
1873
+						}
1874
+					}
1875 1875
 					
1876 1876
 					// Default post status
1877 1877
 					$default_status = 'publish';
1878 1878
 					$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
1879 1879
 					$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
1880 1880
 
1881
-                    $my_post['post_title'] = $post_title;
1882
-                    $my_post['post_content'] = $post_desc;
1883
-                    $my_post['post_type'] = addslashes($buffer[5]);
1884
-                    $my_post['post_author'] = $current_post_author;
1885
-                    $my_post['post_status'] = $post_status;
1886
-                    $my_post['post_category'] = $catids_arr;
1887
-                    $my_post['post_tags'] = $tag_arr;
1888
-
1889
-                    $gd_post_info['post_tags'] = $tag_arr;
1890
-                    $gd_post_info['post_title'] = $post_title;
1891
-                    $gd_post_info['post_status'] = $post_status;
1892
-                    $gd_post_info['submit_time'] = time();
1893
-                    $gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR'];
1894
-
1895
-                    $last_postid = wp_insert_post($my_post);
1896
-                    $countpost++;
1897
-
1898
-                    // Check if we need to save post location as new location
1899
-                    if ($location_result->location_id > 0) {
1900
-                        if (isset($post_city) && isset($post_region)) {
1901
-                            $request_info['post_location'] = array(
1902
-                                'city' => $post_city,
1903
-                                'region' => $post_region,
1904
-                                'country' => $post_country,
1905
-                                'geo_lat' => $post_latitude,
1906
-                                'geo_lng' => $post_longitude
1907
-                            );
1908
-
1909
-                            $post_location_info = $request_info['post_location'];
1910
-                            if ($location_id = geodir_add_new_location($post_location_info))
1911
-                                $post_location_id = $location_id;
1912
-                        } else {
1913
-                            $post_location_id = 0;
1914
-                        }
1915
-                    } else {
1916
-                        $post_location_id = 0;
1917
-                    }
1918
-
1919
-                    /* ------- get default package info ----- */
1920
-                    $payment_info = array();
1921
-                    $package_info = array();
1922
-
1923
-                    $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
1924
-                    $package_id = '';
1925
-                    if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
1926
-                        $package_id = $gd_post_info['package_id'];
1927
-                    }
1928
-
1929
-                    if (!empty($package_info)) {
1930
-                        $payment_info['package_id'] = $package_info['pid'];
1931
-
1932
-                        if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
1933
-                            $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
1934
-                        } else {
1935
-                            $payment_info['expire_date'] = 'Never';
1936
-                        }
1937
-
1938
-                        $gd_post_info = array_merge($gd_post_info, $payment_info);
1939
-                    }
1940
-
1941
-                    $gd_post_info['post_location_id'] = $post_location_id;
1942
-
1943
-                    $post_type = get_post_type($last_postid);
1944
-
1945
-                    $table = $plugin_prefix . $post_type . '_detail';
1946
-
1947
-                    geodir_save_post_info($last_postid, $gd_post_info);
1948
-
1949
-                    if (!empty($image_names)) {
1950
-                        $upload_files++;
1951
-                        $menu_order = 1;
1952
-
1953
-                        foreach ($image_names as $image_name) {
1954
-                            $img_name_arr = explode('.', $image_name);
1955
-
1956
-                            $uploads = wp_upload_dir();
1957
-                            $sub_dir = $uploads['subdir'];
1958
-
1959
-                            $arr_file_type = wp_check_filetype($image_name);
1960
-                            $uploaded_file_type = $arr_file_type['type'];
1961
-
1962
-                            $attachment = array();
1963
-                            $attachment['post_id'] = $last_postid;
1964
-                            $attachment['title'] = $img_name_arr[0];
1965
-                            $attachment['content'] = '';
1966
-                            $attachment['file'] = $sub_dir . '/' . $image_name;
1967
-                            $attachment['mime_type'] = $uploaded_file_type;
1968
-                            $attachment['menu_order'] = $menu_order;
1969
-                            $attachment['is_featured'] = 0;
1970
-
1971
-                            $attachment_set = '';
1972
-
1973
-                            foreach ($attachment as $key => $val) {
1974
-                                if ($val != '')
1975
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1976
-                            }
1977
-                            $attachment_set = trim($attachment_set, ", ");
1978
-
1979
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
1980
-
1981
-                            if ($menu_order == 1) {
1982
-                                $post_type = get_post_type($last_postid);
1983
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
1984
-                            }
1985
-                            $menu_order++;
1986
-                        }
1987
-                    }
1988
-
1989
-                    $gd_post_info['package_id'] = $package_id;
1990
-
1991
-                    /** This action is documented in geodirectory-functions/post-functions.php */
1992
-                    do_action('geodir_after_save_listing', $last_postid, $gd_post_info);
1993
-
1994
-                    if (!empty($buffer[5])) {
1995
-                        if (in_array($buffer[5], geodir_get_posttypes())) {
1996
-                            $taxonomies = geodir_get_posttype_info(addslashes($buffer[5]));
1997
-                            wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]);
1998
-                            wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]);
1999
-
2000
-                            $post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : '';
2001
-                            $post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : '';
2002
-                            geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str);
2003
-                        }
2004
-                    }
2005
-                } else {
2006
-                    $invalid_title++;
2007
-                }
2008
-            }
2009
-        }
2010
-    }
2011
-    $return['rowcount'] = $countpost;
2012
-    $return['invalidcount'] = $address_invalid;
2013
-    $return['blank_address'] = $blank_address;
2014
-    $return['upload_files'] = $upload_files;
2015
-    $return['invalid_post_type'] = $invalid_post_type;
2016
-    $return['invalid_title'] = $invalid_title;
2017
-    $return['total_records'] = $total_records;
2018
-
2019
-    echo json_encode($return);
2020
-    exit;
1881
+					$my_post['post_title'] = $post_title;
1882
+					$my_post['post_content'] = $post_desc;
1883
+					$my_post['post_type'] = addslashes($buffer[5]);
1884
+					$my_post['post_author'] = $current_post_author;
1885
+					$my_post['post_status'] = $post_status;
1886
+					$my_post['post_category'] = $catids_arr;
1887
+					$my_post['post_tags'] = $tag_arr;
1888
+
1889
+					$gd_post_info['post_tags'] = $tag_arr;
1890
+					$gd_post_info['post_title'] = $post_title;
1891
+					$gd_post_info['post_status'] = $post_status;
1892
+					$gd_post_info['submit_time'] = time();
1893
+					$gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR'];
1894
+
1895
+					$last_postid = wp_insert_post($my_post);
1896
+					$countpost++;
1897
+
1898
+					// Check if we need to save post location as new location
1899
+					if ($location_result->location_id > 0) {
1900
+						if (isset($post_city) && isset($post_region)) {
1901
+							$request_info['post_location'] = array(
1902
+								'city' => $post_city,
1903
+								'region' => $post_region,
1904
+								'country' => $post_country,
1905
+								'geo_lat' => $post_latitude,
1906
+								'geo_lng' => $post_longitude
1907
+							);
1908
+
1909
+							$post_location_info = $request_info['post_location'];
1910
+							if ($location_id = geodir_add_new_location($post_location_info))
1911
+								$post_location_id = $location_id;
1912
+						} else {
1913
+							$post_location_id = 0;
1914
+						}
1915
+					} else {
1916
+						$post_location_id = 0;
1917
+					}
1918
+
1919
+					/* ------- get default package info ----- */
1920
+					$payment_info = array();
1921
+					$package_info = array();
1922
+
1923
+					$package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
1924
+					$package_id = '';
1925
+					if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
1926
+						$package_id = $gd_post_info['package_id'];
1927
+					}
1928
+
1929
+					if (!empty($package_info)) {
1930
+						$payment_info['package_id'] = $package_info['pid'];
1931
+
1932
+						if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
1933
+							$payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
1934
+						} else {
1935
+							$payment_info['expire_date'] = 'Never';
1936
+						}
1937
+
1938
+						$gd_post_info = array_merge($gd_post_info, $payment_info);
1939
+					}
1940
+
1941
+					$gd_post_info['post_location_id'] = $post_location_id;
1942
+
1943
+					$post_type = get_post_type($last_postid);
1944
+
1945
+					$table = $plugin_prefix . $post_type . '_detail';
1946
+
1947
+					geodir_save_post_info($last_postid, $gd_post_info);
1948
+
1949
+					if (!empty($image_names)) {
1950
+						$upload_files++;
1951
+						$menu_order = 1;
1952
+
1953
+						foreach ($image_names as $image_name) {
1954
+							$img_name_arr = explode('.', $image_name);
1955
+
1956
+							$uploads = wp_upload_dir();
1957
+							$sub_dir = $uploads['subdir'];
1958
+
1959
+							$arr_file_type = wp_check_filetype($image_name);
1960
+							$uploaded_file_type = $arr_file_type['type'];
1961
+
1962
+							$attachment = array();
1963
+							$attachment['post_id'] = $last_postid;
1964
+							$attachment['title'] = $img_name_arr[0];
1965
+							$attachment['content'] = '';
1966
+							$attachment['file'] = $sub_dir . '/' . $image_name;
1967
+							$attachment['mime_type'] = $uploaded_file_type;
1968
+							$attachment['menu_order'] = $menu_order;
1969
+							$attachment['is_featured'] = 0;
1970
+
1971
+							$attachment_set = '';
1972
+
1973
+							foreach ($attachment as $key => $val) {
1974
+								if ($val != '')
1975
+									$attachment_set .= $key . " = '" . $val . "', ";
1976
+							}
1977
+							$attachment_set = trim($attachment_set, ", ");
1978
+
1979
+							$wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
1980
+
1981
+							if ($menu_order == 1) {
1982
+								$post_type = get_post_type($last_postid);
1983
+								$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
1984
+							}
1985
+							$menu_order++;
1986
+						}
1987
+					}
1988
+
1989
+					$gd_post_info['package_id'] = $package_id;
1990
+
1991
+					/** This action is documented in geodirectory-functions/post-functions.php */
1992
+					do_action('geodir_after_save_listing', $last_postid, $gd_post_info);
1993
+
1994
+					if (!empty($buffer[5])) {
1995
+						if (in_array($buffer[5], geodir_get_posttypes())) {
1996
+							$taxonomies = geodir_get_posttype_info(addslashes($buffer[5]));
1997
+							wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]);
1998
+							wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]);
1999
+
2000
+							$post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : '';
2001
+							$post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : '';
2002
+							geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str);
2003
+						}
2004
+					}
2005
+				} else {
2006
+					$invalid_title++;
2007
+				}
2008
+			}
2009
+		}
2010
+	}
2011
+	$return['rowcount'] = $countpost;
2012
+	$return['invalidcount'] = $address_invalid;
2013
+	$return['blank_address'] = $blank_address;
2014
+	$return['upload_files'] = $upload_files;
2015
+	$return['invalid_post_type'] = $invalid_post_type;
2016
+	$return['invalid_title'] = $invalid_title;
2017
+	$return['total_records'] = $total_records;
2018
+
2019
+	echo json_encode($return);
2020
+	exit;
2021 2021
 }
2022 2022
 
2023 2023
 // Add the tab in left sidebar menu fro import & export page.
@@ -2037,9 +2037,9 @@  discard block
 block discarded – undo
2037 2037
  * @param $post object $post The post object of the post being saved.
2038 2038
  */
2039 2039
 function geodir_update_location_prefix($post_id,$post){
2040
-    if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
2041
-        update_option('geodir_location_prefix',$post->post_name);
2042
-    }
2040
+	if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
2041
+		update_option('geodir_location_prefix',$post->post_name);
2042
+	}
2043 2043
 
2044 2044
 }
2045 2045
 
@@ -2050,50 +2050,50 @@  discard block
 block discarded – undo
2050 2050
 function geodir_ga_callback(){
2051 2051
 
2052 2052
 if(isset($_REQUEST['code']) && $_REQUEST['code']) {
2053
-    $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?";
2054
-    $code = "code=".$_REQUEST['code'];
2055
-    $grant_type = "&grant_type=authorization_code";
2056
-    $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2057
-    $client_id = "&client_id=".get_option('geodir_ga_client_id');
2058
-    $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
2053
+	$oAuthURL = "https://www.googleapis.com/oauth2/v3/token?";
2054
+	$code = "code=".$_REQUEST['code'];
2055
+	$grant_type = "&grant_type=authorization_code";
2056
+	$redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2057
+	$client_id = "&client_id=".get_option('geodir_ga_client_id');
2058
+	$client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
2059 2059
 
2060
-    $auth_url = $oAuthURL . $code . $redirect_uri .  $grant_type . $client_id .$client_secret;
2060
+	$auth_url = $oAuthURL . $code . $redirect_uri .  $grant_type . $client_id .$client_secret;
2061 2061
 
2062
-    $response = wp_remote_post($auth_url, array('timeout' => 15));
2062
+	$response = wp_remote_post($auth_url, array('timeout' => 15));
2063 2063
 
2064
-    //print_r($response);
2064
+	//print_r($response);
2065 2065
 
2066
-    $error_msg =  __('Something went wrong','geodirectory');
2067
-    if(!empty($response['response']['code']) && $response['response']['code']==200){
2066
+	$error_msg =  __('Something went wrong','geodirectory');
2067
+	if(!empty($response['response']['code']) && $response['response']['code']==200){
2068 2068
 
2069
-        $parts = json_decode($response['body']);
2070
-        //print_r($parts);
2071
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2072
-        else{
2069
+		$parts = json_decode($response['body']);
2070
+		//print_r($parts);
2071
+		if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2072
+		else{
2073 2073
 
2074
-            update_option('gd_ga_access_token', $parts->access_token);
2075
-            update_option('gd_ga_refresh_token', $parts->refresh_token);
2076
-            ?><script>window.close();</script><?php
2077
-        }
2074
+			update_option('gd_ga_access_token', $parts->access_token);
2075
+			update_option('gd_ga_refresh_token', $parts->refresh_token);
2076
+			?><script>window.close();</script><?php
2077
+		}
2078 2078
 
2079 2079
 
2080
-    }
2081
-    elseif(!empty($response['response']['code'])) {
2082
-        $parts = json_decode($response['body']);
2080
+	}
2081
+	elseif(!empty($response['response']['code'])) {
2082
+		$parts = json_decode($response['body']);
2083 2083
 
2084
-        if(isset($parts->error)){
2085
-            echo $parts->error.": ".$parts->error_description;exit;
2086
-        }else{
2087
-            echo $error_msg." - #2";exit;
2088
-        }
2084
+		if(isset($parts->error)){
2085
+			echo $parts->error.": ".$parts->error_description;exit;
2086
+		}else{
2087
+			echo $error_msg." - #2";exit;
2088
+		}
2089 2089
 
2090
-    }else{
2090
+	}else{
2091 2091
 
2092
-        echo $error_msg." - #3";exit;
2092
+		echo $error_msg." - #3";exit;
2093 2093
 
2094
-    }
2094
+	}
2095 2095
 }
2096
-    exit;
2096
+	exit;
2097 2097
 }
2098 2098
 
2099 2099
 add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
Please login to merge, or discard this patch.
geodirectory-admin/admin_install.php 1 patch
Indentation   +167 added lines, -167 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * GeoDirectory Installation related functions.
4
- *
5
- * Plugin install script which adds default pages, taxonomies, and database tables.
6
- *
7
- * @since 1.0.0
8
- * @package GeoDirectory
9
- */
3
+	 * GeoDirectory Installation related functions.
4
+	 *
5
+	 * Plugin install script which adds default pages, taxonomies, and database tables.
6
+	 *
7
+	 * @since 1.0.0
8
+	 * @package GeoDirectory
9
+	 */
10 10
 
11 11
 /**
12 12
  * Include custom database table related functions.
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 function geodir_activation()
25 25
 {
26 26
 
27
-    geodir_install();
28
-    add_action('wp_loaded', 'geodir_flush_activation');
27
+	geodir_install();
28
+	add_action('wp_loaded', 'geodir_flush_activation');
29 29
 }
30 30
 
31 31
 /**
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
  */
37 37
 function geodir_flush_activation()
38 38
 {
39
-    // Remove rewrite rules and then recreate rewrite rules.
40
-    // flush late so everything is loaded
41
-    flush_rewrite_rules();
39
+	// Remove rewrite rules and then recreate rewrite rules.
40
+	// flush late so everything is loaded
41
+	flush_rewrite_rules();
42 42
 }
43 43
 
44 44
 /**
@@ -50,44 +50,44 @@  discard block
 block discarded – undo
50 50
  */
51 51
 function geodir_install()
52 52
 {
53
-    global $geodir_settings;
54
-
55
-    /**
56
-     * Called before the GD installation scripts have run.
57
-     *
58
-     * @since 1.0.0
59
-     * @see 'geodir_installation_end'
60
-     */
61
-    do_action('geodir_installation_start');
62
-
63
-    // Do install
64
-    if (!get_option('geodir_default_data_installed')) {
65
-        geodir_create_tables(); // in admin db install.php
66
-        geodir_register_defaults(); // geodir_functions/ taxonomy_functions.php
67
-        geodir_create_default_fields();
68
-        //geodir_default_taxonomies();
69
-        geodir_set_default_options();
70
-        geodir_create_pages();
71
-        geodir_set_default_widgets();
72
-        gd_install_theme_compat();
73
-
74
-        update_option('geodir_default_data_installed', 1);
75
-
76
-    }
77
-
78
-    if (!get_option('geodir_default_data_installed_1.2.8')) {
79
-        //geodir_create_tables(); // in admin db install.php
80
-        update_option('geodir_default_data_installed_1.2.8', 1);
81
-    }
82
-
83
-    geodir_installation_end();
84
-    /**
85
-     * Called after the GD installation scripts have run.
86
-     *
87
-     * @since 1.0.0
88
-     * @see 'geodir_installation_start'
89
-     */
90
-    do_action('geodir_installation_end');
53
+	global $geodir_settings;
54
+
55
+	/**
56
+	 * Called before the GD installation scripts have run.
57
+	 *
58
+	 * @since 1.0.0
59
+	 * @see 'geodir_installation_end'
60
+	 */
61
+	do_action('geodir_installation_start');
62
+
63
+	// Do install
64
+	if (!get_option('geodir_default_data_installed')) {
65
+		geodir_create_tables(); // in admin db install.php
66
+		geodir_register_defaults(); // geodir_functions/ taxonomy_functions.php
67
+		geodir_create_default_fields();
68
+		//geodir_default_taxonomies();
69
+		geodir_set_default_options();
70
+		geodir_create_pages();
71
+		geodir_set_default_widgets();
72
+		gd_install_theme_compat();
73
+
74
+		update_option('geodir_default_data_installed', 1);
75
+
76
+	}
77
+
78
+	if (!get_option('geodir_default_data_installed_1.2.8')) {
79
+		//geodir_create_tables(); // in admin db install.php
80
+		update_option('geodir_default_data_installed_1.2.8', 1);
81
+	}
82
+
83
+	geodir_installation_end();
84
+	/**
85
+	 * Called after the GD installation scripts have run.
86
+	 *
87
+	 * @since 1.0.0
88
+	 * @see 'geodir_installation_start'
89
+	 */
90
+	do_action('geodir_installation_end');
91 91
 
92 92
 
93 93
 }
@@ -104,16 +104,16 @@  discard block
 block discarded – undo
104 104
 function geodir_create_pages()
105 105
 {
106 106
 
107
-    //geodir_create_page( esc_sql( _x('home-map', 'page_slug', 'geodirectory') ), 'geodir_home_map_page', __('Home Map', 'geodirectory'), '',0,'publish' );
108
-    geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
109
-    geodir_create_page(esc_sql(_x('add-listing', 'page_slug', 'geodirectory')), 'geodir_add_listing_page', __('Add Listing', 'geodirectory'), '');
110
-    geodir_create_page(esc_sql(_x('listing-preview', 'page_slug', 'geodirectory')), 'geodir_preview_page', __('Listing Preview', 'geodirectory'), '');
111
-    geodir_create_page(esc_sql(_x('listing-success', 'page_slug', 'geodirectory')), 'geodir_success_page', __('Listing Success', 'geodirectory'), '');
112
-    geodir_create_page(esc_sql(_x('location', 'page_slug', 'geodirectory')), 'geodir_location_page', __('Location', 'geodirectory'), '');
107
+	//geodir_create_page( esc_sql( _x('home-map', 'page_slug', 'geodirectory') ), 'geodir_home_map_page', __('Home Map', 'geodirectory'), '',0,'publish' );
108
+	geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
109
+	geodir_create_page(esc_sql(_x('add-listing', 'page_slug', 'geodirectory')), 'geodir_add_listing_page', __('Add Listing', 'geodirectory'), '');
110
+	geodir_create_page(esc_sql(_x('listing-preview', 'page_slug', 'geodirectory')), 'geodir_preview_page', __('Listing Preview', 'geodirectory'), '');
111
+	geodir_create_page(esc_sql(_x('listing-success', 'page_slug', 'geodirectory')), 'geodir_success_page', __('Listing Success', 'geodirectory'), '');
112
+	geodir_create_page(esc_sql(_x('location', 'page_slug', 'geodirectory')), 'geodir_location_page', __('Location', 'geodirectory'), '');
113 113
 
114
-    //New since 1.5.3
115
-    geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
116
-    geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
114
+	//New since 1.5.3
115
+	geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
116
+	geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
117 117
 
118 118
 
119 119
 }
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
  */
130 130
 function geodir_installation_end()
131 131
 {
132
-    //update_option( "geodir_db_version", GEODIRECTORY_VERSION );
132
+	//update_option( "geodir_db_version", GEODIRECTORY_VERSION );
133 133
 
134
-    update_option("geodir_installed", 1);
135
-    update_option("geodir_installation_redirect", 1);
136
-    update_option('skip_install_geodir_pages', 0);
134
+	update_option("geodir_installed", 1);
135
+	update_option("geodir_installation_redirect", 1);
136
+	update_option('skip_install_geodir_pages', 0);
137 137
 }
138 138
 
139 139
 /**
@@ -147,45 +147,45 @@  discard block
 block discarded – undo
147 147
  */
148 148
 function geodir_set_default_options()
149 149
 {
150
-    global $geodir_settings;
151
-    /**
152
-     * Contains settings array for general tab.
153
-     *
154
-     * @since 1.0.0
155
-     * @package GeoDirectory
156
-     */
157
-    include_once("option-pages/general_settings_array.php");
158
-    /**
159
-     * Contains settings array for design tab.
160
-     *
161
-     * @since 1.0.0
162
-     * @package GeoDirectory
163
-     */
164
-    include_once("option-pages/design_settings_array.php");
165
-    /**
166
-     * Contains settings array for notifications tab.
167
-     *
168
-     * @since 1.0.0
169
-     * @package GeoDirectory
170
-     */
171
-    include_once("option-pages/notifications_settings_array.php");
172
-    /**
173
-     * Contains settings array for permalink tab.
174
-     *
175
-     * @since 1.0.0
176
-     * @package GeoDirectory
177
-     */
178
-    include_once("option-pages/permalink_settings_array.php");
179
-    /**
180
-     * Contains settings array for title / meta tab.
181
-     *
182
-     * @since 1.5.4
183
-     * @package GeoDirectory
184
-     */
185
-    include_once("option-pages/title_meta_settings_array.php");
186
-    foreach ($geodir_settings as $value) {
187
-        geodir_update_options($value, true);
188
-    }
150
+	global $geodir_settings;
151
+	/**
152
+	 * Contains settings array for general tab.
153
+	 *
154
+	 * @since 1.0.0
155
+	 * @package GeoDirectory
156
+	 */
157
+	include_once("option-pages/general_settings_array.php");
158
+	/**
159
+	 * Contains settings array for design tab.
160
+	 *
161
+	 * @since 1.0.0
162
+	 * @package GeoDirectory
163
+	 */
164
+	include_once("option-pages/design_settings_array.php");
165
+	/**
166
+	 * Contains settings array for notifications tab.
167
+	 *
168
+	 * @since 1.0.0
169
+	 * @package GeoDirectory
170
+	 */
171
+	include_once("option-pages/notifications_settings_array.php");
172
+	/**
173
+	 * Contains settings array for permalink tab.
174
+	 *
175
+	 * @since 1.0.0
176
+	 * @package GeoDirectory
177
+	 */
178
+	include_once("option-pages/permalink_settings_array.php");
179
+	/**
180
+	 * Contains settings array for title / meta tab.
181
+	 *
182
+	 * @since 1.5.4
183
+	 * @package GeoDirectory
184
+	 */
185
+	include_once("option-pages/title_meta_settings_array.php");
186
+	foreach ($geodir_settings as $value) {
187
+		geodir_update_options($value, true);
188
+	}
189 189
 
190 190
 }
191 191
 
@@ -199,103 +199,103 @@  discard block
 block discarded – undo
199 199
 function geodir_set_default_widgets()
200 200
 {
201 201
 
202
-    $widget_option_list = array();
203
-    $widgetinfo = array();
204
-    $sidebarvalue_array = array();
205
-    $sidebars_widgets = array();
202
+	$widget_option_list = array();
203
+	$widgetinfo = array();
204
+	$sidebarvalue_array = array();
205
+	$sidebars_widgets = array();
206 206
 
207
-    /*===========================*/
208
-    /*  Widgets ON HOME PAGE     */
209
-    /*===========================*/
207
+	/*===========================*/
208
+	/*  Widgets ON HOME PAGE     */
209
+	/*===========================*/
210 210
 
211
-    $widget_option_list['geodir_home_top'] =
212
-        array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
213
-            'geodir_map_v3_home_map' => array("autozoom" => 1, "width" => '100%', "heigh" => '425'),
214
-            'geodir_advance_search' => array());
211
+	$widget_option_list['geodir_home_top'] =
212
+		array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
213
+			'geodir_map_v3_home_map' => array("autozoom" => 1, "width" => '100%', "heigh" => '425'),
214
+			'geodir_advance_search' => array());
215 215
 
216
-    $widget_option_list['geodir_home_content'] =
217
-        array('popular_post_view' => array("title" => __('Popular Places', 'geodirectory'), "layout" => 'list', "add_location_filter" => '1'));
216
+	$widget_option_list['geodir_home_content'] =
217
+		array('popular_post_view' => array("title" => __('Popular Places', 'geodirectory'), "layout" => 'list', "add_location_filter" => '1'));
218 218
 
219
-    $widget_option_list['geodir_home_right'] =
220
-        array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
221
-            'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
219
+	$widget_option_list['geodir_home_right'] =
220
+		array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
221
+			'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
222 222
 
223
-    /*===========================*/
224
-    /*  Widgets ON LISTING PAGE     */
225
-    /*===========================*/
223
+	/*===========================*/
224
+	/*  Widgets ON LISTING PAGE     */
225
+	/*===========================*/
226 226
 
227
-    $widget_option_list['geodir_listing_top'] =
228
-        array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
229
-            'geodir_advance_search' => array());
227
+	$widget_option_list['geodir_listing_top'] =
228
+		array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
229
+			'geodir_advance_search' => array());
230 230
 
231
-    $widget_option_list['geodir_listing_right_sidebar'] =
232
-        array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
233
-            'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
234
-            'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
231
+	$widget_option_list['geodir_listing_right_sidebar'] =
232
+		array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
233
+			'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
234
+			'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
235 235
 
236 236
 
237
-    /*===========================*/
238
-    /*  Widgets ON SEARCH PAGE     */
239
-    /*===========================*/
237
+	/*===========================*/
238
+	/*  Widgets ON SEARCH PAGE     */
239
+	/*===========================*/
240 240
 
241
-    $widget_option_list['geodir_search_top'] =
242
-        array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
243
-            'geodir_advance_search' => array());
241
+	$widget_option_list['geodir_search_top'] =
242
+		array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
243
+			'geodir_advance_search' => array());
244 244
 
245
-    $widget_option_list['geodir_search_right_sidebar'] =
246
-        array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
247
-            'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
248
-            'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
245
+	$widget_option_list['geodir_search_right_sidebar'] =
246
+		array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
247
+			'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
248
+			'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
249 249
 
250
-    /*===========================*/
251
-    /*  Widgets ON DETAIL/SINGLE PAGE     */
252
-    /*===========================*/
250
+	/*===========================*/
251
+	/*  Widgets ON DETAIL/SINGLE PAGE     */
252
+	/*===========================*/
253 253
 
254
-    $widget_option_list['geodir_detail_sidebar'] =
255
-        array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
256
-            'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
257
-            'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
254
+	$widget_option_list['geodir_detail_sidebar'] =
255
+		array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
256
+			'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
257
+			'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
258 258
 
259 259
 
260
-    /*===========================*/
261
-    /*  Widgets ON AUTHOR PAGE     */
262
-    /*===========================*/
260
+	/*===========================*/
261
+	/*  Widgets ON AUTHOR PAGE     */
262
+	/*===========================*/
263 263
 
264 264
 
265
-    $widget_option_list['geodir_author_right_sidebar'] =
266
-        array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')));
265
+	$widget_option_list['geodir_author_right_sidebar'] =
266
+		array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')));
267 267
 
268 268
 
269
-    $sidebars_widgets = get_option('sidebars_widgets');
269
+	$sidebars_widgets = get_option('sidebars_widgets');
270 270
 
271
-    foreach ($widget_option_list as $key => $widget_options) {
271
+	foreach ($widget_option_list as $key => $widget_options) {
272 272
 
273
-        foreach ($widget_options as $key2 => $widget_options_obj) {
274
-            $widgetid = 'widget_' . $key2;
273
+		foreach ($widget_options as $key2 => $widget_options_obj) {
274
+			$widgetid = 'widget_' . $key2;
275 275
 
276
-            $widgetinfo[$widgetid][] = $widget_options_obj;
276
+			$widgetinfo[$widgetid][] = $widget_options_obj;
277 277
 
278
-            $sidebarvalue_array[$key][] = $key2 . "-" . (count($widgetinfo[$widgetid]));
278
+			$sidebarvalue_array[$key][] = $key2 . "-" . (count($widgetinfo[$widgetid]));
279 279
 
280
-            $widget_update[$widgetid][count($widgetinfo[$widgetid])] = $widget_options_obj;
280
+			$widget_update[$widgetid][count($widgetinfo[$widgetid])] = $widget_options_obj;
281 281
 
282
-        }
282
+		}
283 283
 
284
-        if (!empty($sidebarvalue_array[$key])) {
284
+		if (!empty($sidebarvalue_array[$key])) {
285 285
 
286
-            $sidebars_widgets = get_option('sidebars_widgets');
287
-            $sidebars_widgets[$key] = $sidebarvalue_array[$key];
288
-            update_option('sidebars_widgets', $sidebars_widgets);
286
+			$sidebars_widgets = get_option('sidebars_widgets');
287
+			$sidebars_widgets[$key] = $sidebarvalue_array[$key];
288
+			update_option('sidebars_widgets', $sidebars_widgets);
289 289
 
290
-            foreach ($widget_update as $key => $value) {
290
+			foreach ($widget_update as $key => $value) {
291 291
 
292
-                update_option($key, $value);
292
+				update_option($key, $value);
293 293
 
294
-            }
294
+			}
295 295
 
296
-        }
296
+		}
297 297
 
298
-    }
298
+	}
299 299
 
300 300
 
301 301
 }
Please login to merge, or discard this patch.
geodirectory-admin/admin_template_tags.php 1 patch
Indentation   +515 added lines, -515 removed lines patch added patch discarded remove patch
@@ -7,33 +7,33 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 if (!function_exists('geodir_admin_panel')) {
10
-    /**
11
-     * GeoDirectory Backend Admin Panel.
12
-     *
13
-     * Handles the display of the main GeoDirectory admin panel.
14
-     *
15
-     * @since 1.0.0
16
-     * @package GeoDirectory
17
-     * @global string $current_tab Current tab in geodirectory settings.
18
-     * @global object $geodirectory GeoDirectory plugin object.
19
-     */
20
-    function geodir_admin_panel()
21
-    {
22
-        global $geodirectory;
23
-        global $current_tab;
24
-
25
-
26
-        ?>
10
+	/**
11
+	 * GeoDirectory Backend Admin Panel.
12
+	 *
13
+	 * Handles the display of the main GeoDirectory admin panel.
14
+	 *
15
+	 * @since 1.0.0
16
+	 * @package GeoDirectory
17
+	 * @global string $current_tab Current tab in geodirectory settings.
18
+	 * @global object $geodirectory GeoDirectory plugin object.
19
+	 */
20
+	function geodir_admin_panel()
21
+	{
22
+		global $geodirectory;
23
+		global $current_tab;
24
+
25
+
26
+		?>
27 27
 
28 28
         <div id="gd-wrapper-main" class="wrap geodirectory">
29 29
             <?php
30
-            /**
31
-             * Called just after the opening wrapper div for the GD settings page in the admin area.
32
-             *
33
-             * @since 1.0.0
34
-             */
35
-            do_action('geodir_before_admin_panel');
36
-            ?>
30
+			/**
31
+			 * Called just after the opening wrapper div for the GD settings page in the admin area.
32
+			 *
33
+			 * @since 1.0.0
34
+			 */
35
+			do_action('geodir_before_admin_panel');
36
+			?>
37 37
 
38 38
             <div class="gd-wrapper gd-wrapper-vr clearfix">
39 39
 
@@ -44,75 +44,75 @@  discard block
 block discarded – undo
44 44
                          alt="geo-logo" class="geo-logoalter"/>
45 45
                     <ul>
46 46
                         <?php
47
-                        $tabs = array();
48
-                        /**
49
-                         * Filter the GD admin settings tabs on the left of the admin menu.
50
-                         *
51
-                         * @since 1.0.0
52
-                         * @param array $tabs The array of tabs to display.
53
-                         */
54
-                        $tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
-                        update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
56
-
57
-                        foreach ($tabs as $name => $args) :
58
-                            $label = $args['label'];
59
-
60
-
61
-                            $query_string = '';
62
-                            if (isset($args['subtabs']) && !empty($args['subtabs'])):
63
-
64
-                                $subtabs = $args['subtabs'];
65
-
66
-                                $query_string = '&subtab=' . $subtabs[0]['subtab'];
67
-
68
-                            endif;
69
-
70
-
71
-                            $tab_link = admin_url('admin.php?page=geodirectory&tab=' . $name . $query_string);
72
-
73
-                            if (isset($args['url']) && $args['url'] != '') {
74
-                                $tab_link = $args['url'];
75
-                            }
76
-
77
-                            if (!empty($args['request']))
78
-                                $tab_link = geodir_getlink($tab_link, $args['request']);
79
-
80
-                            if (isset($args['target']) && $args['target'] != '') {
81
-                                $tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
-                            } else
83
-                                $tab_target = '';
84
-
85
-                            $tab_active = '';
86
-                            if ($current_tab == $name)
87
-                                $tab_active = ' class="tab-active" ';
88
-                            /**
89
-                             * Called before the individual settings tabs are output.
90
-                             *
91
-                             * @since 1.0.0
92
-                             * @param string $name The name of the settings tab.
93
-                             * @see 'geodir_after_settings_tabs'
94
-                             */
95
-                            do_action('geodir_before_settings_tabs', $name);
96
-                            echo '<li ' . $tab_active . ' ><a href="' . esc_url($tab_link) . '"  ' . $tab_target . ' >' . sanitize_text_field($label) . '</a></li>';
97
-                            /**
98
-                             * Called after the individual settings tabs are output.
99
-                             *
100
-                             * @since 1.0.0
101
-                             * @param string $name The name of the settings tab.
102
-                             * @see 'geodir_before_settings_tabs'
103
-                             */
104
-                            do_action('geodir_after_settings_tabs', $name);
105
-                        endforeach;
106
-
107
-                        /**
108
-                         * Called after the GD settings tabs have been output.
109
-                         *
110
-                         * Called before the closing `ul` so can be used to add new settings tab links.
111
-                         *
112
-                         * @since 1.0.0
113
-                         */
114
-                        do_action('geodir_settings_tabs');
115
-                        ?>
47
+						$tabs = array();
48
+						/**
49
+						 * Filter the GD admin settings tabs on the left of the admin menu.
50
+						 *
51
+						 * @since 1.0.0
52
+						 * @param array $tabs The array of tabs to display.
53
+						 */
54
+						$tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
+						update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
56
+
57
+						foreach ($tabs as $name => $args) :
58
+							$label = $args['label'];
59
+
60
+
61
+							$query_string = '';
62
+							if (isset($args['subtabs']) && !empty($args['subtabs'])):
63
+
64
+								$subtabs = $args['subtabs'];
65
+
66
+								$query_string = '&subtab=' . $subtabs[0]['subtab'];
67
+
68
+							endif;
69
+
70
+
71
+							$tab_link = admin_url('admin.php?page=geodirectory&tab=' . $name . $query_string);
72
+
73
+							if (isset($args['url']) && $args['url'] != '') {
74
+								$tab_link = $args['url'];
75
+							}
76
+
77
+							if (!empty($args['request']))
78
+								$tab_link = geodir_getlink($tab_link, $args['request']);
79
+
80
+							if (isset($args['target']) && $args['target'] != '') {
81
+								$tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
+							} else
83
+								$tab_target = '';
84
+
85
+							$tab_active = '';
86
+							if ($current_tab == $name)
87
+								$tab_active = ' class="tab-active" ';
88
+							/**
89
+							 * Called before the individual settings tabs are output.
90
+							 *
91
+							 * @since 1.0.0
92
+							 * @param string $name The name of the settings tab.
93
+							 * @see 'geodir_after_settings_tabs'
94
+							 */
95
+							do_action('geodir_before_settings_tabs', $name);
96
+							echo '<li ' . $tab_active . ' ><a href="' . esc_url($tab_link) . '"  ' . $tab_target . ' >' . sanitize_text_field($label) . '</a></li>';
97
+							/**
98
+							 * Called after the individual settings tabs are output.
99
+							 *
100
+							 * @since 1.0.0
101
+							 * @param string $name The name of the settings tab.
102
+							 * @see 'geodir_before_settings_tabs'
103
+							 */
104
+							do_action('geodir_after_settings_tabs', $name);
105
+						endforeach;
106
+
107
+						/**
108
+						 * Called after the GD settings tabs have been output.
109
+						 *
110
+						 * Called before the closing `ul` so can be used to add new settings tab links.
111
+						 *
112
+						 * @since 1.0.0
113
+						 */
114
+						do_action('geodir_settings_tabs');
115
+						?>
116 116
                     </ul>
117 117
                 </div>
118 118
                 <!--gd-left-nav ends here-->
@@ -121,52 +121,52 @@  discard block
 block discarded – undo
121 121
                     <div class="gd-tabs-main">
122 122
 
123 123
                         <?php
124
-                        unset($subtabs);
125
-                        if (isset($tabs[$current_tab]['subtabs']))
126
-                            $subtabs = $tabs[$current_tab]['subtabs'];
127
-                        $form_action = '';
124
+						unset($subtabs);
125
+						if (isset($tabs[$current_tab]['subtabs']))
126
+							$subtabs = $tabs[$current_tab]['subtabs'];
127
+						$form_action = '';
128 128
 
129
-                        if (!empty($subtabs)):
130
-                        ?>
129
+						if (!empty($subtabs)):
130
+						?>
131 131
                             <dl class="gd-tab-head">
132 132
                                 <?php
133
-                                foreach ($subtabs as $sub) {
134
-                                    $subtab_active = '';
135
-                                    if (isset($_REQUEST['subtab']) && $sub['subtab'] == $_REQUEST['subtab']) {
136
-                                        $subtab_active = 'class="gd-tab-active"';
137
-                                        $form_action = isset($sub['form_action']) ? $sub['form_action'] : '';
138
-                                    }
139
-
140
-                                    $sub_tabs_link = admin_url() . 'admin.php?page=geodirectory&tab=' . $current_tab . '&subtab=' . $sub['subtab'];
141
-                                    if (isset($sub['request']) && is_array($sub['request']) && !empty($sub['request'])) {
142
-                                        $sub_tabs_link = geodir_getlink($sub_tabs_link, $sub['request']);
143
-                                    }
144
-                                    echo '<dd ' . $subtab_active . ' id="claim_listing"><a href="' . esc_url($sub_tabs_link) . '" >' . sanitize_text_field($sub['label']) . '</a></dd>';
145
-                                }
146
-                                ?>
133
+								foreach ($subtabs as $sub) {
134
+									$subtab_active = '';
135
+									if (isset($_REQUEST['subtab']) && $sub['subtab'] == $_REQUEST['subtab']) {
136
+										$subtab_active = 'class="gd-tab-active"';
137
+										$form_action = isset($sub['form_action']) ? $sub['form_action'] : '';
138
+									}
139
+
140
+									$sub_tabs_link = admin_url() . 'admin.php?page=geodirectory&tab=' . $current_tab . '&subtab=' . $sub['subtab'];
141
+									if (isset($sub['request']) && is_array($sub['request']) && !empty($sub['request'])) {
142
+										$sub_tabs_link = geodir_getlink($sub_tabs_link, $sub['request']);
143
+									}
144
+									echo '<dd ' . $subtab_active . ' id="claim_listing"><a href="' . esc_url($sub_tabs_link) . '" >' . sanitize_text_field($sub['label']) . '</a></dd>';
145
+								}
146
+								?>
147 147
                             </dl>
148 148
 
149 149
                         <?php endif; ?>
150 150
                         <div class="gd-tab-content <?php if (empty($subtabs)) {
151
-                            echo "inner_contet_tabs";
152
-                        } ?>">
151
+							echo "inner_contet_tabs";
152
+						} ?>">
153 153
                             <form method="post" id="mainform"
154 154
                                   class="geodir_optionform <?php echo $current_tab . ' '; ?><?php if (isset($sub['subtab'])) {
155
-                                      echo sanitize_text_field($sub['subtab']);
156
-                                  } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data">
155
+									  echo sanitize_text_field($sub['subtab']);
156
+								  } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data">
157 157
                                 <input type="hidden" class="active_tab" name="active_tab"
158 158
                                        value="<?php if (isset($_REQUEST['active_tab'])) {
159
-                                           echo sanitize_text_field($_REQUEST['active_tab']);
160
-                                       } ?>"/>
159
+										   echo sanitize_text_field($_REQUEST['active_tab']);
160
+									   } ?>"/>
161 161
                                 <?php wp_nonce_field('geodir-settings', '_wpnonce', true, true); ?>
162 162
                                 <?php wp_nonce_field('geodir-settings-' . $current_tab, '_wpnonce-' . $current_tab, true, true); ?>
163 163
                                 <?php
164
-                                /**
165
-                                 * Used to call the content of each GD settings tab page.
166
-                                 *
167
-                                 * @since 1.0.0
168
-                                 */
169
-                                do_action('geodir_admin_option_form', $current_tab); ?>
164
+								/**
165
+								 * Used to call the content of each GD settings tab page.
166
+								 *
167
+								 * @since 1.0.0
168
+								 */
169
+								do_action('geodir_admin_option_form', $current_tab); ?>
170 170
                             </form>
171 171
                         </div>
172 172
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         </script>
268 268
     <?php
269 269
 
270
-    }
270
+	}
271 271
 }
272 272
 
273 273
 
@@ -283,48 +283,48 @@  discard block
 block discarded – undo
283 283
 function geodir_admin_option_form($tab_name)
284 284
 {
285 285
 
286
-    //echo $tab_name.'_array.php' ;
287
-    global $geodir_settings, $is_default, $mapzoom;
288
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $tab_name . '_array.php')) {
289
-        /**
290
-         * Contains settings array for given tab.
291
-         *
292
-         * @since 1.0.0
293
-         * @package GeoDirectory
294
-         */
295
-        include_once('option-pages/' . $tab_name . '_array.php');
296
-    }
297
-
298
-    $listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : '';
299
-
300
-    switch ($tab_name) {
301
-
302
-        case 'general_settings':
303
-
304
-            geodir_admin_fields($geodir_settings['general_settings']);
305
-            /**
306
-             *
307
-             * Update Taxonomy Options *
308
-             *
309
-             **/
310
-            /*add_action('updated_option_place_prefix','update_listing_prefix');
286
+	//echo $tab_name.'_array.php' ;
287
+	global $geodir_settings, $is_default, $mapzoom;
288
+	if (file_exists(dirname(__FILE__) . '/option-pages/' . $tab_name . '_array.php')) {
289
+		/**
290
+		 * Contains settings array for given tab.
291
+		 *
292
+		 * @since 1.0.0
293
+		 * @package GeoDirectory
294
+		 */
295
+		include_once('option-pages/' . $tab_name . '_array.php');
296
+	}
297
+
298
+	$listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : '';
299
+
300
+	switch ($tab_name) {
301
+
302
+		case 'general_settings':
303
+
304
+			geodir_admin_fields($geodir_settings['general_settings']);
305
+			/**
306
+			 *
307
+			 * Update Taxonomy Options *
308
+			 *
309
+			 **/
310
+			/*add_action('updated_option_place_prefix','update_listing_prefix');
311 311
             function update_listing_prefix(){
312 312
                 geodir_register_defaults();
313 313
             }*/
314 314
 
315
-            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
-                $hide_save_button = "style='display:none;'";
317
-            else
318
-                $hide_save_button = '';
315
+			if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
+				$hide_save_button = "style='display:none;'";
317
+			else
318
+				$hide_save_button = '';
319 319
 
320
-            /**
321
-             * Filter weather the default save button in the GD admin settings pages should be shown.
322
-             *
323
-             * @since 1.0.0
324
-             * @param string $hide_save_button The style element, either blank or: style='display:none;'.
325
-             */
326
-            $hide_save_button = apply_filters('geodir_hide_save_button', $hide_save_button);
327
-            ?>
320
+			/**
321
+			 * Filter weather the default save button in the GD admin settings pages should be shown.
322
+			 *
323
+			 * @since 1.0.0
324
+			 * @param string $hide_save_button The style element, either blank or: style='display:none;'.
325
+			 */
326
+			$hide_save_button = apply_filters('geodir_hide_save_button', $hide_save_button);
327
+			?>
328 328
 
329 329
             <p class="submit">
330 330
             <input <?php echo $hide_save_button;?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
@@ -334,36 +334,36 @@  discard block
 block discarded – undo
334 334
             </div>
335 335
             
336 336
 		<?php break;
337
-        case 'design_settings' :
338
-            geodir_admin_fields($geodir_settings['design_settings']);
337
+		case 'design_settings' :
338
+			geodir_admin_fields($geodir_settings['design_settings']);
339 339
 
340 340
 
341 341
 
342
-            ?>
342
+			?>
343 343
 			<p class="submit">
344 344
 			<input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
345 345
 			<input type="hidden" name="subtab" id="last_tab" />
346 346
 			</p>
347 347
 			</div>
348 348
         <?php break;
349
-        case 'permalink_settings' :
350
-            geodir_admin_fields($geodir_settings['permalink_settings']); ?>
349
+		case 'permalink_settings' :
350
+			geodir_admin_fields($geodir_settings['permalink_settings']); ?>
351 351
             <p class="submit">
352 352
             <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
353 353
             <input type="hidden" name="subtab" id="last_tab" />
354 354
             </p>
355 355
             </div>	
356 356
 		<?php break;
357
-        case 'title_meta_settings' :
358
-            geodir_admin_fields($geodir_settings['title_meta_settings']); ?>
357
+		case 'title_meta_settings' :
358
+			geodir_admin_fields($geodir_settings['title_meta_settings']); ?>
359 359
             <p class="submit">
360 360
             <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
361 361
             <input type="hidden" name="subtab" id="last_tab" />
362 362
             </p>
363 363
             </div>
364 364
 		<?php break;
365
-        case 'notifications_settings' :
366
-            geodir_admin_fields($geodir_settings['notifications_settings']); ?>
365
+		case 'notifications_settings' :
366
+			geodir_admin_fields($geodir_settings['notifications_settings']); ?>
367 367
 			
368 368
 			<p class="submit">
369 369
 				
@@ -373,36 +373,36 @@  discard block
 block discarded – undo
373 373
 			</div>
374 374
 			
375 375
 		<?php break;
376
-        case 'default_location_settings' :
377
-            ?>
376
+		case 'default_location_settings' :
377
+			?>
378 378
             <div class="inner_content_tab_main">
379 379
                 <div class="gd-content-heading">
380 380
                     <?php global $wpdb;
381 381
 
382 382
 
383
-                    $location_result = geodir_get_default_location();
383
+					$location_result = geodir_get_default_location();
384 384
 
385
-                    $prefix = '';
385
+					$prefix = '';
386 386
 
387 387
 
388
-                    $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '';
389
-                    $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '';
390
-                    $city = isset($location_result->city) ? $location_result->city : '';
391
-                    $region = isset($location_result->region) ? $location_result->region : '';
392
-                    $country = isset($location_result->country) ? $location_result->country : '';
388
+					$lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '';
389
+					$lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '';
390
+					$city = isset($location_result->city) ? $location_result->city : '';
391
+					$region = isset($location_result->region) ? $location_result->region : '';
392
+					$country = isset($location_result->country) ? $location_result->country : '';
393 393
 
394 394
 
395
-                    $map_title = __("Set Address On Map", 'geodirectory');
395
+					$map_title = __("Set Address On Map", 'geodirectory');
396 396
 
397
-                    ?>
397
+					?>
398 398
 
399 399
                     <h3><?php _e('Set Default Location', 'geodirectory');?></h3>
400 400
 
401 401
                     <input type="hidden" name="add_location" value="location">
402 402
 
403 403
                     <input type="hidden" name="update_city" value="<?php if (isset($location_result->location_id)) {
404
-                        echo $location_result->location_id;
405
-                    } ?>">
404
+						echo $location_result->location_id;
405
+					} ?>">
406 406
 
407 407
                     <input type="hidden" name="address" id="<?php echo $prefix;?>address" value="">
408 408
 
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
                                     <input class="require" type="text" size="80" style="width:440px"
416 416
                                            id="<?php echo $prefix;?>city" name="city"
417 417
                                            value="<?php if (isset($location_result->city)) {
418
-                                               echo $location_result->city;
419
-                                           } ?>"/>
418
+											   echo $location_result->city;
419
+										   } ?>"/>
420 420
 
421 421
                                     <div
422 422
                                         class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
                                     <input class="require" type="text" size="80" style="width:440px"
432 432
                                            id="<?php echo $prefix;?>region" name="region"
433 433
                                            value="<?php if (isset($location_result->region)) {
434
-                                               echo $location_result->region;
435
-                                           } ?>"/>
434
+											   echo $location_result->region;
435
+										   } ?>"/>
436 436
 
437 437
                                     <div
438 438
                                         class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
447 447
                                     <?php
448 448
 
449
-                                    $country_result = isset($location_result->country) ? $location_result->country : '';
450
-                                    ?>
449
+									$country_result = isset($location_result->country) ? $location_result->country : '';
450
+									?>
451 451
                                     <select id="<?php echo $prefix ?>country" class="chosen_select"
452 452
                                             data-location_type="country" name="<?php echo $prefix ?>country"
453 453
                                             data-placeholder="<?php _e('Choose a country.', 'geodirectory');?>"
@@ -470,12 +470,12 @@  discard block
 block discarded – undo
470 470
                                 scope="row"><?php _e('Set Location on Map', 'geodirectory');?></th>
471 471
                             <td class="forminp">
472 472
                                 <?php
473
-                                /**
474
-                                 * Contains add listing page map functions.
475
-                                 *
476
-                                 * @since 1.0.0
477
-                                 */
478
-                                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
473
+								/**
474
+								 * Contains add listing page map functions.
475
+								 *
476
+								 * @since 1.0.0
477
+								 */
478
+								include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
479 479
                             </td>
480 480
                         </tr>
481 481
                         <tr valign="top" class="single_select_page">
@@ -485,8 +485,8 @@  discard block
 block discarded – undo
485 485
                                     <input type="text" class="require" size="80" style="width:440px"
486 486
                                            id="<?php echo $prefix;?>latitude" name="latitude"
487 487
                                            value="<?php if (isset($location_result->city_latitude)) {
488
-                                               echo $location_result->city_latitude;
489
-                                           } ?>"/>
488
+											   echo $location_result->city_latitude;
489
+										   } ?>"/>
490 490
 
491 491
                                     <div
492 492
                                         class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
                                     <input type="text" class="require" size="80" style="width:440px"
503 503
                                            id="<?php echo $prefix;?>longitude" name="longitude"
504 504
                                            value="<?php if (isset($location_result->city_longitude)) {
505
-                                               echo $location_result->city_longitude;
506
-                                           } ?>"/>
505
+											   echo $location_result->city_longitude;
506
+										   } ?>"/>
507 507
 
508 508
                                     <div
509 509
                                         class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -535,22 +535,22 @@  discard block
 block discarded – undo
535 535
                 </div>
536 536
             </div>
537 537
             <?php break;
538
-        case $listing_type . '_fields_settings' :
538
+		case $listing_type . '_fields_settings' :
539 539
 
540
-            geodir_custom_post_type_form();
540
+			geodir_custom_post_type_form();
541 541
 
542
-            break;
543
-        case 'tools_settings' :
544
-            geodir_diagnostic_tools_setting_page();
545
-            break;
546
-        case 'compatibility_settings' :
547
-            geodir_theme_compatibility_setting_page();
548
-            break;		
542
+			break;
543
+		case 'tools_settings' :
544
+			geodir_diagnostic_tools_setting_page();
545
+			break;
546
+		case 'compatibility_settings' :
547
+			geodir_theme_compatibility_setting_page();
548
+			break;		
549 549
 		case 'import_export' :
550
-            geodir_import_export_page();
551
-            break;
550
+			geodir_import_export_page();
551
+			break;
552 552
 
553
-    }// end of switch
553
+	}// end of switch
554 554
 }
555 555
 
556 556
 
@@ -590,170 +590,170 @@  discard block
 block discarded – undo
590 590
 function geodir_update_options_compatibility_settings()
591 591
 {
592 592
 
593
-    global $wpdb;
593
+	global $wpdb;
594 594
 
595 595
 
596
-    $theme_settings = array();
596
+	$theme_settings = array();
597 597
 
598
-    $theme_settings['geodir_wrapper_open_id'] = $_POST['geodir_wrapper_open_id'];
599
-    $theme_settings['geodir_wrapper_open_class'] = $_POST['geodir_wrapper_open_class'];
600
-    $theme_settings['geodir_wrapper_open_replace'] = stripslashes($_POST['geodir_wrapper_open_replace']);
598
+	$theme_settings['geodir_wrapper_open_id'] = $_POST['geodir_wrapper_open_id'];
599
+	$theme_settings['geodir_wrapper_open_class'] = $_POST['geodir_wrapper_open_class'];
600
+	$theme_settings['geodir_wrapper_open_replace'] = stripslashes($_POST['geodir_wrapper_open_replace']);
601 601
 
602
-    $theme_settings['geodir_wrapper_close_replace'] = stripslashes($_POST['geodir_wrapper_close_replace']);
602
+	$theme_settings['geodir_wrapper_close_replace'] = stripslashes($_POST['geodir_wrapper_close_replace']);
603 603
 
604
-    $theme_settings['geodir_wrapper_content_open_id'] = $_POST['geodir_wrapper_content_open_id'];
605
-    $theme_settings['geodir_wrapper_content_open_class'] = $_POST['geodir_wrapper_content_open_class'];
606
-    $theme_settings['geodir_wrapper_content_open_replace'] = stripslashes($_POST['geodir_wrapper_content_open_replace']);
604
+	$theme_settings['geodir_wrapper_content_open_id'] = $_POST['geodir_wrapper_content_open_id'];
605
+	$theme_settings['geodir_wrapper_content_open_class'] = $_POST['geodir_wrapper_content_open_class'];
606
+	$theme_settings['geodir_wrapper_content_open_replace'] = stripslashes($_POST['geodir_wrapper_content_open_replace']);
607 607
 
608
-    $theme_settings['geodir_wrapper_content_close_replace'] = stripslashes($_POST['geodir_wrapper_content_close_replace']);
608
+	$theme_settings['geodir_wrapper_content_close_replace'] = stripslashes($_POST['geodir_wrapper_content_close_replace']);
609 609
 
610
-    $theme_settings['geodir_article_open_id'] = $_POST['geodir_article_open_id'];
611
-    $theme_settings['geodir_article_open_class'] = $_POST['geodir_article_open_class'];
612
-    $theme_settings['geodir_article_open_replace'] = stripslashes($_POST['geodir_article_open_replace']);
610
+	$theme_settings['geodir_article_open_id'] = $_POST['geodir_article_open_id'];
611
+	$theme_settings['geodir_article_open_class'] = $_POST['geodir_article_open_class'];
612
+	$theme_settings['geodir_article_open_replace'] = stripslashes($_POST['geodir_article_open_replace']);
613 613
 
614
-    $theme_settings['geodir_article_close_replace'] = stripslashes($_POST['geodir_article_close_replace']);
614
+	$theme_settings['geodir_article_close_replace'] = stripslashes($_POST['geodir_article_close_replace']);
615 615
 
616
-    $theme_settings['geodir_sidebar_right_open_id'] = $_POST['geodir_sidebar_right_open_id'];
617
-    $theme_settings['geodir_sidebar_right_open_class'] = $_POST['geodir_sidebar_right_open_class'];
618
-    $theme_settings['geodir_sidebar_right_open_replace'] = stripslashes($_POST['geodir_sidebar_right_open_replace']);
616
+	$theme_settings['geodir_sidebar_right_open_id'] = $_POST['geodir_sidebar_right_open_id'];
617
+	$theme_settings['geodir_sidebar_right_open_class'] = $_POST['geodir_sidebar_right_open_class'];
618
+	$theme_settings['geodir_sidebar_right_open_replace'] = stripslashes($_POST['geodir_sidebar_right_open_replace']);
619 619
 
620
-    $theme_settings['geodir_sidebar_right_close_replace'] = stripslashes($_POST['geodir_sidebar_right_close_replace']);
620
+	$theme_settings['geodir_sidebar_right_close_replace'] = stripslashes($_POST['geodir_sidebar_right_close_replace']);
621 621
 
622
-    $theme_settings['geodir_sidebar_left_open_id'] = $_POST['geodir_sidebar_left_open_id'];
623
-    $theme_settings['geodir_sidebar_left_open_class'] = $_POST['geodir_sidebar_left_open_class'];
624
-    $theme_settings['geodir_sidebar_left_open_replace'] = stripslashes($_POST['geodir_sidebar_left_open_replace']);
622
+	$theme_settings['geodir_sidebar_left_open_id'] = $_POST['geodir_sidebar_left_open_id'];
623
+	$theme_settings['geodir_sidebar_left_open_class'] = $_POST['geodir_sidebar_left_open_class'];
624
+	$theme_settings['geodir_sidebar_left_open_replace'] = stripslashes($_POST['geodir_sidebar_left_open_replace']);
625 625
 
626
-    $theme_settings['geodir_sidebar_left_close_replace'] = stripslashes($_POST['geodir_sidebar_left_close_replace']);
626
+	$theme_settings['geodir_sidebar_left_close_replace'] = stripslashes($_POST['geodir_sidebar_left_close_replace']);
627 627
 
628
-    $theme_settings['geodir_main_content_open_id'] = $_POST['geodir_main_content_open_id'];
629
-    $theme_settings['geodir_main_content_open_class'] = $_POST['geodir_main_content_open_class'];
630
-    $theme_settings['geodir_main_content_open_replace'] = stripslashes($_POST['geodir_main_content_open_replace']);
628
+	$theme_settings['geodir_main_content_open_id'] = $_POST['geodir_main_content_open_id'];
629
+	$theme_settings['geodir_main_content_open_class'] = $_POST['geodir_main_content_open_class'];
630
+	$theme_settings['geodir_main_content_open_replace'] = stripslashes($_POST['geodir_main_content_open_replace']);
631 631
 
632
-    $theme_settings['geodir_main_content_close_replace'] = stripslashes($_POST['geodir_main_content_close_replace']);
632
+	$theme_settings['geodir_main_content_close_replace'] = stripslashes($_POST['geodir_main_content_close_replace']);
633 633
 
634 634
 // Other Actions
635
-    $theme_settings['geodir_top_content_add'] = stripslashes($_POST['geodir_top_content_add']);
636
-    $theme_settings['geodir_before_main_content_add'] = stripslashes($_POST['geodir_before_main_content_add']);
635
+	$theme_settings['geodir_top_content_add'] = stripslashes($_POST['geodir_top_content_add']);
636
+	$theme_settings['geodir_before_main_content_add'] = stripslashes($_POST['geodir_before_main_content_add']);
637 637
 
638 638
 // Filters
639
-    $theme_settings['geodir_full_page_class_filter'] = stripslashes($_POST['geodir_full_page_class_filter']);
640
-    $theme_settings['geodir_before_widget_filter'] = stripslashes($_POST['geodir_before_widget_filter']);
641
-    $theme_settings['geodir_after_widget_filter'] = stripslashes($_POST['geodir_after_widget_filter']);
642
-    $theme_settings['geodir_before_title_filter'] = stripslashes($_POST['geodir_before_title_filter']);
643
-    $theme_settings['geodir_after_title_filter'] = stripslashes($_POST['geodir_after_title_filter']);
644
-    $theme_settings['geodir_menu_li_class_filter'] = stripslashes($_POST['geodir_menu_li_class_filter']);
645
-    $theme_settings['geodir_sub_menu_ul_class_filter'] = stripslashes($_POST['geodir_sub_menu_ul_class_filter']);
646
-    $theme_settings['geodir_sub_menu_li_class_filter'] = stripslashes($_POST['geodir_sub_menu_li_class_filter']);
647
-    $theme_settings['geodir_menu_a_class_filter'] = stripslashes($_POST['geodir_menu_a_class_filter']);
648
-    $theme_settings['geodir_sub_menu_a_class_filter'] = stripslashes($_POST['geodir_sub_menu_a_class_filter']);
639
+	$theme_settings['geodir_full_page_class_filter'] = stripslashes($_POST['geodir_full_page_class_filter']);
640
+	$theme_settings['geodir_before_widget_filter'] = stripslashes($_POST['geodir_before_widget_filter']);
641
+	$theme_settings['geodir_after_widget_filter'] = stripslashes($_POST['geodir_after_widget_filter']);
642
+	$theme_settings['geodir_before_title_filter'] = stripslashes($_POST['geodir_before_title_filter']);
643
+	$theme_settings['geodir_after_title_filter'] = stripslashes($_POST['geodir_after_title_filter']);
644
+	$theme_settings['geodir_menu_li_class_filter'] = stripslashes($_POST['geodir_menu_li_class_filter']);
645
+	$theme_settings['geodir_sub_menu_ul_class_filter'] = stripslashes($_POST['geodir_sub_menu_ul_class_filter']);
646
+	$theme_settings['geodir_sub_menu_li_class_filter'] = stripslashes($_POST['geodir_sub_menu_li_class_filter']);
647
+	$theme_settings['geodir_menu_a_class_filter'] = stripslashes($_POST['geodir_menu_a_class_filter']);
648
+	$theme_settings['geodir_sub_menu_a_class_filter'] = stripslashes($_POST['geodir_sub_menu_a_class_filter']);
649 649
 //location manager filters
650
-    $theme_settings['geodir_location_switcher_menu_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_li_class_filter']);
651
-    $theme_settings['geodir_location_switcher_menu_a_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_a_class_filter']);
652
-    $theme_settings['geodir_location_switcher_menu_sub_ul_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_ul_class_filter']);
653
-    $theme_settings['geodir_location_switcher_menu_sub_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_li_class_filter']);
650
+	$theme_settings['geodir_location_switcher_menu_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_li_class_filter']);
651
+	$theme_settings['geodir_location_switcher_menu_a_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_a_class_filter']);
652
+	$theme_settings['geodir_location_switcher_menu_sub_ul_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_ul_class_filter']);
653
+	$theme_settings['geodir_location_switcher_menu_sub_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_li_class_filter']);
654 654
 
655 655
 
656 656
 // theme required css
657
-    $theme_settings['geodir_theme_compat_css'] = stripslashes($_POST['geodir_theme_compat_css']);
657
+	$theme_settings['geodir_theme_compat_css'] = stripslashes($_POST['geodir_theme_compat_css']);
658 658
 
659 659
 // theme required js
660
-    $theme_settings['geodir_theme_compat_js'] = stripslashes($_POST['geodir_theme_compat_js']);
660
+	$theme_settings['geodir_theme_compat_js'] = stripslashes($_POST['geodir_theme_compat_js']);
661 661
 
662 662
 // theme compat name
663
-    $theme_settings['gd_theme_compat'] = $_POST['gd_theme_compat'];
664
-    if ($theme_settings['gd_theme_compat'] == '') {
665
-        update_option('gd_theme_compat', '');
666
-        update_option('theme_compatibility_setting', '');
667
-        return;
668
-    }
663
+	$theme_settings['gd_theme_compat'] = $_POST['gd_theme_compat'];
664
+	if ($theme_settings['gd_theme_compat'] == '') {
665
+		update_option('gd_theme_compat', '');
666
+		update_option('theme_compatibility_setting', '');
667
+		return;
668
+	}
669 669
 
670 670
 // theme default options
671
-    $theme_settings['geodir_theme_compat_default_options'] = '';
671
+	$theme_settings['geodir_theme_compat_default_options'] = '';
672 672
 
673 673
 
674 674
 //suported theme code
675
-    $theme_settings['geodir_theme_compat_code'] = false;
676
-
677
-    $theme = wp_get_theme();
678
-
679
-    if ($theme->parent()) {
680
-        $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
681
-    } else {
682
-        $theme_name = str_replace(" ", "_", $theme->get('Name'));
683
-    }
684
-
685
-    if (in_array($theme_name, array('Avada', 'Enfold', 'X', 'Divi', 'Genesis', 'Jupiter', 'Multi_News'))) {// list of themes that have php files
686
-        $theme_settings['geodir_theme_compat_code'] = $theme_name;
687
-    }
688
-
689
-
690
-    $theme_name = $theme_name . "_custom";
691
-    $theme_arr = get_option('gd_theme_compats');
692
-    update_option('gd_theme_compat', $theme_name);
693
-    /**
694
-     * Called before the theme compatibility settings are saved to the DB.
695
-     *
696
-     * @since 1.4.0
697
-     * @param array $theme_settings {
698
-     *    Attributes of the theme compatibility settings array.
699
-     *
700
-     *    @type string $geodir_wrapper_open_id Geodir wrapper open html id.
701
-     *    @type string $geodir_wrapper_open_class Geodir wrapper open html class.
702
-     *    @type string $geodir_wrapper_open_replace Geodir wrapper open content replace.
703
-     *    @type string $geodir_wrapper_close_replace Geodir wrapper close content replace.
704
-     *    @type string $geodir_wrapper_content_open_id Geodir wrapper content open html id.
705
-     *    @type string $geodir_wrapper_content_open_class Geodir wrapper content open html class.
706
-     *    @type string $geodir_wrapper_content_open_replace Geodir wrapper content open content replace.
707
-     *    @type string $geodir_wrapper_content_close_replace Geodir wrapper content close content replace.
708
-     *    @type string $geodir_article_open_id Geodir article open html id.
709
-     *    @type string $geodir_article_open_class Geodir article open html class.
710
-     *    @type string $geodir_article_open_replace Geodir article open content replace.
711
-     *    @type string $geodir_article_close_replace Geodir article close content replace.
712
-     *    @type string $geodir_sidebar_right_open_id Geodir sidebar right open html id.
713
-     *    @type string $geodir_sidebar_right_open_class Geodir sidebar right open html class.
714
-     *    @type string $geodir_sidebar_right_open_replace Geodir sidebar right open content replace.
715
-     *    @type string $geodir_sidebar_right_close_replace Geodir sidebar right close content replace.
716
-     *    @type string $geodir_sidebar_left_open_id Geodir sidebar left open html id.
717
-     *    @type string $geodir_sidebar_left_open_class Geodir sidebar left open html class.
718
-     *    @type string $geodir_sidebar_left_open_replace Geodir sidebar left open content replace.
719
-     *    @type string $geodir_sidebar_left_close_replace Geodir sidebar left close content replace.
720
-     *    @type string $geodir_main_content_open_id Geodir main content open html id.
721
-     *    @type string $geodir_main_content_open_class Geodir main content open html class.
722
-     *    @type string $geodir_main_content_open_replace Geodir main content open content replace.
723
-     *    @type string $geodir_main_content_close_replace Geodir main content close content replace.
724
-     *    @type string $geodir_top_content_add Geodir top content add.
725
-     *    @type string $geodir_before_main_content_add Geodir before main content add.
726
-     *    @type string $geodir_full_page_class_filter Geodir full page class filter.
727
-     *    @type string $geodir_before_widget_filter Geodir before widget filter.
728
-     *    @type string $geodir_after_widget_filter Geodir after widget filter.
729
-     *    @type string $geodir_before_title_filter Geodir before title filter.
730
-     *    @type string $geodir_after_title_filter Geodir after title filter.
731
-     *    @type string $geodir_menu_li_class_filter Geodir menu li class filter.
732
-     *    @type string $geodir_sub_menu_ul_class_filter Geodir sub menu ul class filter.
733
-     *    @type string $geodir_sub_menu_li_class_filter Geodir sub menu li class filter.
734
-     *    @type string $geodir_menu_a_class_filter Geodir menu a class filter.
735
-     *    @type string $geodir_sub_menu_a_class_filter Geodir sub menu a class filter.
736
-     *    @type string $geodir_location_switcher_menu_li_class_filter Geodir location switcher menu li class filter.
737
-     *    @type string $geodir_location_switcher_menu_a_class_filter Geodir location switcher menu a class filter.
738
-     *    @type string $geodir_location_switcher_menu_sub_ul_class_filter Geodir location switcher menu sub ul class filter.
739
-     *    @type string $geodir_location_switcher_menu_sub_li_class_filter Geodir location switcher menu sub li class filter.
740
-     *    @type string $geodir_theme_compat_css Geodir theme compatibility css.
741
-     *    @type string $geodir_theme_compat_js Geodir theme compatibility js.
742
-     *    @type string $gd_theme_compat Gd theme compatibility.
743
-     *    @type string $geodir_theme_compat_default_options Geodir theme compatibility default options.
744
-     *    @type bool $geodir_theme_compat_code Geodir theme compatibility code Ex: 'Avada.
745
-     *
746
-     * }
747
-     */
748
-    do_action('gd_compat_save_settings', $theme_settings);
675
+	$theme_settings['geodir_theme_compat_code'] = false;
676
+
677
+	$theme = wp_get_theme();
678
+
679
+	if ($theme->parent()) {
680
+		$theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
681
+	} else {
682
+		$theme_name = str_replace(" ", "_", $theme->get('Name'));
683
+	}
684
+
685
+	if (in_array($theme_name, array('Avada', 'Enfold', 'X', 'Divi', 'Genesis', 'Jupiter', 'Multi_News'))) {// list of themes that have php files
686
+		$theme_settings['geodir_theme_compat_code'] = $theme_name;
687
+	}
688
+
689
+
690
+	$theme_name = $theme_name . "_custom";
691
+	$theme_arr = get_option('gd_theme_compats');
692
+	update_option('gd_theme_compat', $theme_name);
693
+	/**
694
+	 * Called before the theme compatibility settings are saved to the DB.
695
+	 *
696
+	 * @since 1.4.0
697
+	 * @param array $theme_settings {
698
+	 *    Attributes of the theme compatibility settings array.
699
+	 *
700
+	 *    @type string $geodir_wrapper_open_id Geodir wrapper open html id.
701
+	 *    @type string $geodir_wrapper_open_class Geodir wrapper open html class.
702
+	 *    @type string $geodir_wrapper_open_replace Geodir wrapper open content replace.
703
+	 *    @type string $geodir_wrapper_close_replace Geodir wrapper close content replace.
704
+	 *    @type string $geodir_wrapper_content_open_id Geodir wrapper content open html id.
705
+	 *    @type string $geodir_wrapper_content_open_class Geodir wrapper content open html class.
706
+	 *    @type string $geodir_wrapper_content_open_replace Geodir wrapper content open content replace.
707
+	 *    @type string $geodir_wrapper_content_close_replace Geodir wrapper content close content replace.
708
+	 *    @type string $geodir_article_open_id Geodir article open html id.
709
+	 *    @type string $geodir_article_open_class Geodir article open html class.
710
+	 *    @type string $geodir_article_open_replace Geodir article open content replace.
711
+	 *    @type string $geodir_article_close_replace Geodir article close content replace.
712
+	 *    @type string $geodir_sidebar_right_open_id Geodir sidebar right open html id.
713
+	 *    @type string $geodir_sidebar_right_open_class Geodir sidebar right open html class.
714
+	 *    @type string $geodir_sidebar_right_open_replace Geodir sidebar right open content replace.
715
+	 *    @type string $geodir_sidebar_right_close_replace Geodir sidebar right close content replace.
716
+	 *    @type string $geodir_sidebar_left_open_id Geodir sidebar left open html id.
717
+	 *    @type string $geodir_sidebar_left_open_class Geodir sidebar left open html class.
718
+	 *    @type string $geodir_sidebar_left_open_replace Geodir sidebar left open content replace.
719
+	 *    @type string $geodir_sidebar_left_close_replace Geodir sidebar left close content replace.
720
+	 *    @type string $geodir_main_content_open_id Geodir main content open html id.
721
+	 *    @type string $geodir_main_content_open_class Geodir main content open html class.
722
+	 *    @type string $geodir_main_content_open_replace Geodir main content open content replace.
723
+	 *    @type string $geodir_main_content_close_replace Geodir main content close content replace.
724
+	 *    @type string $geodir_top_content_add Geodir top content add.
725
+	 *    @type string $geodir_before_main_content_add Geodir before main content add.
726
+	 *    @type string $geodir_full_page_class_filter Geodir full page class filter.
727
+	 *    @type string $geodir_before_widget_filter Geodir before widget filter.
728
+	 *    @type string $geodir_after_widget_filter Geodir after widget filter.
729
+	 *    @type string $geodir_before_title_filter Geodir before title filter.
730
+	 *    @type string $geodir_after_title_filter Geodir after title filter.
731
+	 *    @type string $geodir_menu_li_class_filter Geodir menu li class filter.
732
+	 *    @type string $geodir_sub_menu_ul_class_filter Geodir sub menu ul class filter.
733
+	 *    @type string $geodir_sub_menu_li_class_filter Geodir sub menu li class filter.
734
+	 *    @type string $geodir_menu_a_class_filter Geodir menu a class filter.
735
+	 *    @type string $geodir_sub_menu_a_class_filter Geodir sub menu a class filter.
736
+	 *    @type string $geodir_location_switcher_menu_li_class_filter Geodir location switcher menu li class filter.
737
+	 *    @type string $geodir_location_switcher_menu_a_class_filter Geodir location switcher menu a class filter.
738
+	 *    @type string $geodir_location_switcher_menu_sub_ul_class_filter Geodir location switcher menu sub ul class filter.
739
+	 *    @type string $geodir_location_switcher_menu_sub_li_class_filter Geodir location switcher menu sub li class filter.
740
+	 *    @type string $geodir_theme_compat_css Geodir theme compatibility css.
741
+	 *    @type string $geodir_theme_compat_js Geodir theme compatibility js.
742
+	 *    @type string $gd_theme_compat Gd theme compatibility.
743
+	 *    @type string $geodir_theme_compat_default_options Geodir theme compatibility default options.
744
+	 *    @type bool $geodir_theme_compat_code Geodir theme compatibility code Ex: 'Avada.
745
+	 *
746
+	 * }
747
+	 */
748
+	do_action('gd_compat_save_settings', $theme_settings);
749 749
 
750 750
 //if($_POST['gd_theme_compat'])==
751
-    $theme_arr[$theme_name] = $theme_settings;
752
-    update_option('gd_theme_compats', $theme_arr);
751
+	$theme_arr[$theme_name] = $theme_settings;
752
+	update_option('gd_theme_compats', $theme_arr);
753 753
 
754 754
 
755 755
 //print_r($theme_settings);exit;
756
-    update_option('theme_compatibility_setting', $theme_settings);
756
+	update_option('theme_compatibility_setting', $theme_settings);
757 757
 
758 758
 }
759 759
 
@@ -766,12 +766,12 @@  discard block
 block discarded – undo
766 766
  */
767 767
 function geodir_theme_compatibility_setting_page()
768 768
 {
769
-    global $wpdb;
770
-    $tc = get_option('theme_compatibility_setting');
771
-    //print_r($tc);
772
-    //print_r(wp_get_theme());
769
+	global $wpdb;
770
+	$tc = get_option('theme_compatibility_setting');
771
+	//print_r($tc);
772
+	//print_r(wp_get_theme());
773 773
 
774
-    ?>
774
+	?>
775 775
     <div class="inner_content_tab_main">
776 776
         <div class="gd-content-heading">
777 777
 
@@ -813,21 +813,21 @@  discard block
 block discarded – undo
813 813
                 <option value=""><?php _e('Select Theme', 'geodirectory');?></option>
814 814
                 <option value="custom"><?php _e('Custom', 'geodirectory');?></option>
815 815
                 <?php
816
-                $theme_arr = get_option('gd_theme_compats');
817
-                $theme_active = get_option('gd_theme_compat');
818
-                if (is_array($theme_arr)) {
819
-                    foreach ($theme_arr as $key => $theme) {
820
-                        $sel = '';
821
-                        if ($theme_active == $key) {
822
-                            $sel = "selected";
823
-                        }
824
-                        echo "<option $sel>$key</option>";
825
-                    }
816
+				$theme_arr = get_option('gd_theme_compats');
817
+				$theme_active = get_option('gd_theme_compat');
818
+				if (is_array($theme_arr)) {
819
+					foreach ($theme_arr as $key => $theme) {
820
+						$sel = '';
821
+						if ($theme_active == $key) {
822
+							$sel = "selected";
823
+						}
824
+						echo "<option $sel>$key</option>";
825
+					}
826 826
 
827 827
 
828
-                }
828
+				}
829 829
 
830
-                ?>
830
+				?>
831 831
             </select>
832 832
             <button onclick="gd_comp_export();" type="button"
833 833
                     class="button-primary"><?php _e('Export', 'geodirectory');?></button>
@@ -936,11 +936,11 @@  discard block
 block discarded – undo
936 936
                         <small>geodir_wrapper_open</small>
937 937
                     </td>
938 938
                     <td><input value="<?php if (isset($tc['geodir_wrapper_open_id'])) {
939
-                            echo $tc['geodir_wrapper_open_id'];
940
-                        }?>" type="text" name="geodir_wrapper_open_id" placeholder="geodir-wrapper"/></td>
939
+							echo $tc['geodir_wrapper_open_id'];
940
+						}?>" type="text" name="geodir_wrapper_open_id" placeholder="geodir-wrapper"/></td>
941 941
                     <td><input value="<?php if (isset($tc['geodir_wrapper_open_class'])) {
942
-                            echo $tc['geodir_wrapper_open_class'];
943
-                        }?>" type="text" name="geodir_wrapper_open_class" placeholder=""/></td>
942
+							echo $tc['geodir_wrapper_open_class'];
943
+						}?>" type="text" name="geodir_wrapper_open_class" placeholder=""/></td>
944 944
                 </tr>
945 945
 
946 946
                 <tr class="gd-theme-comp-out">
@@ -948,8 +948,8 @@  discard block
 block discarded – undo
948 948
                         <span><?php _e('Output:', 'geodirectory');?></span>
949 949
                         <textarea name="geodir_wrapper_open_replace"
950 950
                                   placeholder='<div id="[id]" class="[class]">'><?php if (isset($tc['geodir_wrapper_open_replace'])) {
951
-                                echo $tc['geodir_wrapper_open_replace'];
952
-                            }?></textarea>
951
+								echo $tc['geodir_wrapper_open_replace'];
952
+							}?></textarea>
953 953
                     </td>
954 954
                 </tr>
955 955
 
@@ -969,8 +969,8 @@  discard block
 block discarded – undo
969 969
                         <span><?php _e('Output:', 'geodirectory');?></span>
970 970
                         <textarea name="geodir_wrapper_close_replace"
971 971
                                   placeholder='</div><!-- wrapper ends here-->'><?php if (isset($tc['geodir_wrapper_close_replace'])) {
972
-                                echo $tc['geodir_wrapper_close_replace'];
973
-                            }?></textarea>
972
+								echo $tc['geodir_wrapper_close_replace'];
973
+							}?></textarea>
974 974
                     </td>
975 975
                 </tr>
976 976
 
@@ -980,12 +980,12 @@  discard block
 block discarded – undo
980 980
                         <small>geodir_wrapper_content_open</small>
981 981
                     </td>
982 982
                     <td><input value="<?php if (isset($tc['geodir_wrapper_content_open_id'])) {
983
-                            echo $tc['geodir_wrapper_content_open_id'];
984
-                        }?>" type="text" name="geodir_wrapper_content_open_id" placeholder="geodir-wrapper-content"/>
983
+							echo $tc['geodir_wrapper_content_open_id'];
984
+						}?>" type="text" name="geodir_wrapper_content_open_id" placeholder="geodir-wrapper-content"/>
985 985
                     </td>
986 986
                     <td><input value="<?php if (isset($tc['geodir_wrapper_content_open_class'])) {
987
-                            echo $tc['geodir_wrapper_content_open_class'];
988
-                        }?>" type="text" name="geodir_wrapper_content_open_class" placeholder=""/></td>
987
+							echo $tc['geodir_wrapper_content_open_class'];
988
+						}?>" type="text" name="geodir_wrapper_content_open_class" placeholder=""/></td>
989 989
                 </tr>
990 990
 
991 991
                 <tr class="gd-theme-comp-out">
@@ -993,8 +993,8 @@  discard block
 block discarded – undo
993 993
                         <span><?php _e('Output:', 'geodirectory');?></span>
994 994
                         <textarea name="geodir_wrapper_content_open_replace"
995 995
                                   placeholder='<div id="[id]" class="[class]" role="main" [width_css]>'><?php if (isset($tc['geodir_wrapper_content_open_replace'])) {
996
-                                echo $tc['geodir_wrapper_content_open_replace'];
997
-                            }?></textarea>
996
+								echo $tc['geodir_wrapper_content_open_replace'];
997
+							}?></textarea>
998 998
                     </td>
999 999
                 </tr>
1000 1000
 
@@ -1014,8 +1014,8 @@  discard block
 block discarded – undo
1014 1014
                         <span><?php _e('Output:', 'geodirectory');?></span>
1015 1015
                         <textarea name="geodir_wrapper_content_close_replace"
1016 1016
                                   placeholder='</div><!-- content ends here-->'><?php if (isset($tc['geodir_wrapper_content_close_replace'])) {
1017
-                                echo $tc['geodir_wrapper_content_close_replace'];
1018
-                            }?></textarea>
1017
+								echo $tc['geodir_wrapper_content_close_replace'];
1018
+							}?></textarea>
1019 1019
                     </td>
1020 1020
                 </tr>
1021 1021
 
@@ -1024,11 +1024,11 @@  discard block
 block discarded – undo
1024 1024
                         <small>geodir_article_open</small>
1025 1025
                     </td>
1026 1026
                     <td><input value="<?php if (isset($tc['geodir_article_open_id'])) {
1027
-                            echo $tc['geodir_article_open_id'];
1028
-                        }?>" type="text" name="geodir_article_open_id" placeholder="geodir-wrapper-content"/></td>
1027
+							echo $tc['geodir_article_open_id'];
1028
+						}?>" type="text" name="geodir_article_open_id" placeholder="geodir-wrapper-content"/></td>
1029 1029
                     <td><input value="<?php if (isset($tc['geodir_article_open_class'])) {
1030
-                            echo $tc['geodir_article_open_class'];
1031
-                        }?>" type="text" name="geodir_article_open_class" placeholder=""/></td>
1030
+							echo $tc['geodir_article_open_class'];
1031
+						}?>" type="text" name="geodir_article_open_class" placeholder=""/></td>
1032 1032
                 </tr>
1033 1033
 
1034 1034
                 <tr class="gd-theme-comp-out">
@@ -1036,8 +1036,8 @@  discard block
 block discarded – undo
1036 1036
                         <span><?php _e('Output:', 'geodirectory');?></span>
1037 1037
                         <textarea name="geodir_article_open_replace"
1038 1038
                                   placeholder='<article  id="[id]" class="[class]" itemscope itemtype="[itemtype]">'><?php if (isset($tc['geodir_article_open_replace'])) {
1039
-                                echo $tc['geodir_article_open_replace'];
1040
-                            }?></textarea>
1039
+								echo $tc['geodir_article_open_replace'];
1040
+							}?></textarea>
1041 1041
                     </td>
1042 1042
                 </tr>
1043 1043
 
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
                         <span><?php _e('Output:', 'geodirectory');?></span>
1057 1057
                         <textarea name="geodir_article_close_replace"
1058 1058
                                   placeholder='</article><!-- article ends here-->'><?php if (isset($tc['geodir_article_close_replace'])) {
1059
-                                echo $tc['geodir_article_close_replace'];
1060
-                            }?></textarea>
1059
+								echo $tc['geodir_article_close_replace'];
1060
+							}?></textarea>
1061 1061
                     </td>
1062 1062
                 </tr>
1063 1063
 
@@ -1066,11 +1066,11 @@  discard block
 block discarded – undo
1066 1066
                         <small>geodir_sidebar_right_open</small>
1067 1067
                     </td>
1068 1068
                     <td><input value="<?php if (isset($tc['geodir_sidebar_right_open_id'])) {
1069
-                            echo $tc['geodir_sidebar_right_open_id'];
1070
-                        }?>" type="text" name="geodir_sidebar_right_open_id" placeholder="geodir-sidebar-right"/></td>
1069
+							echo $tc['geodir_sidebar_right_open_id'];
1070
+						}?>" type="text" name="geodir_sidebar_right_open_id" placeholder="geodir-sidebar-right"/></td>
1071 1071
                     <td><input value="<?php if (isset($tc['geodir_sidebar_right_open_class'])) {
1072
-                            echo $tc['geodir_sidebar_right_open_class'];
1073
-                        }?>" type="text" name="geodir_sidebar_right_open_class"
1072
+							echo $tc['geodir_sidebar_right_open_class'];
1073
+						}?>" type="text" name="geodir_sidebar_right_open_class"
1074 1074
                                placeholder="geodir-sidebar-right geodir-listings-sidebar-right"/></td>
1075 1075
                 </tr>
1076 1076
 
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
                         <span><?php _e('Output:', 'geodirectory');?></span>
1080 1080
                         <textarea name="geodir_sidebar_right_open_replace"
1081 1081
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_right_open_replace'])) {
1082
-                                echo $tc['geodir_sidebar_right_open_replace'];
1083
-                            }?></textarea>
1082
+								echo $tc['geodir_sidebar_right_open_replace'];
1083
+							}?></textarea>
1084 1084
                     </td>
1085 1085
                 </tr>
1086 1086
 
@@ -1099,8 +1099,8 @@  discard block
 block discarded – undo
1099 1099
                         <span><?php _e('Output:', 'geodirectory');?></span>
1100 1100
                         <textarea name="geodir_sidebar_right_close_replace"
1101 1101
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_right_close_replace'])) {
1102
-                                echo $tc['geodir_sidebar_right_close_replace'];
1103
-                            }?></textarea>
1102
+								echo $tc['geodir_sidebar_right_close_replace'];
1103
+							}?></textarea>
1104 1104
                     </td>
1105 1105
                 </tr>
1106 1106
 
@@ -1110,11 +1110,11 @@  discard block
 block discarded – undo
1110 1110
                         <small>geodir_sidebar_left_open</small>
1111 1111
                     </td>
1112 1112
                     <td><input value="<?php if (isset($tc['geodir_sidebar_left_open_id'])) {
1113
-                            echo $tc['geodir_sidebar_left_open_id'];
1114
-                        }?>" type="text" name="geodir_sidebar_left_open_id" placeholder="geodir-sidebar-left"/></td>
1113
+							echo $tc['geodir_sidebar_left_open_id'];
1114
+						}?>" type="text" name="geodir_sidebar_left_open_id" placeholder="geodir-sidebar-left"/></td>
1115 1115
                     <td><input value="<?php if (isset($tc['geodir_sidebar_left_open_class'])) {
1116
-                            echo $tc['geodir_sidebar_left_open_class'];
1117
-                        }?>" type="text" name="geodir_sidebar_left_open_class"
1116
+							echo $tc['geodir_sidebar_left_open_class'];
1117
+						}?>" type="text" name="geodir_sidebar_left_open_class"
1118 1118
                                placeholder="geodir-sidebar-left geodir-listings-sidebar-left"/></td>
1119 1119
                 </tr>
1120 1120
 
@@ -1123,8 +1123,8 @@  discard block
 block discarded – undo
1123 1123
                         <span><?php _e('Output:', 'geodirectory');?></span>
1124 1124
                         <textarea name="geodir_sidebar_left_open_replace"
1125 1125
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_left_open_replace'])) {
1126
-                                echo $tc['geodir_sidebar_left_open_replace'];
1127
-                            }?></textarea>
1126
+								echo $tc['geodir_sidebar_left_open_replace'];
1127
+							}?></textarea>
1128 1128
                     </td>
1129 1129
                 </tr>
1130 1130
 
@@ -1143,8 +1143,8 @@  discard block
 block discarded – undo
1143 1143
                         <span><?php _e('Output:', 'geodirectory');?></span>
1144 1144
                         <textarea name="geodir_sidebar_left_close_replace"
1145 1145
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_left_close_replace'])) {
1146
-                                echo $tc['geodir_sidebar_left_close_replace'];
1147
-                            }?></textarea>
1146
+								echo $tc['geodir_sidebar_left_close_replace'];
1147
+							}?></textarea>
1148 1148
                     </td>
1149 1149
                 </tr>
1150 1150
 
@@ -1153,11 +1153,11 @@  discard block
 block discarded – undo
1153 1153
                         <small>geodir_main_content_open</small>
1154 1154
                     </td>
1155 1155
                     <td><input value="<?php if (isset($tc['geodir_main_content_open_id'])) {
1156
-                            echo $tc['geodir_main_content_open_id'];
1157
-                        }?>" type="text" name="geodir_main_content_open_id" placeholder="geodir-main-content"/></td>
1156
+							echo $tc['geodir_main_content_open_id'];
1157
+						}?>" type="text" name="geodir_main_content_open_id" placeholder="geodir-main-content"/></td>
1158 1158
                     <td><input value="<?php if (isset($tc['geodir_main_content_open_class'])) {
1159
-                            echo $tc['geodir_main_content_open_class'];
1160
-                        }?>" type="text" name="geodir_main_content_open_class" placeholder="CURRENT-PAGE-page"/></td>
1159
+							echo $tc['geodir_main_content_open_class'];
1160
+						}?>" type="text" name="geodir_main_content_open_class" placeholder="CURRENT-PAGE-page"/></td>
1161 1161
                 </tr>
1162 1162
 
1163 1163
                 <tr class="gd-theme-comp-out">
@@ -1165,8 +1165,8 @@  discard block
 block discarded – undo
1165 1165
                         <span><?php _e('Output:', 'geodirectory');?></span>
1166 1166
                         <textarea name="geodir_main_content_open_replace"
1167 1167
                                   placeholder='<main  id="[id]" class="[class]"  role="main">'><?php if (isset($tc['geodir_main_content_open_replace'])) {
1168
-                                echo $tc['geodir_main_content_open_replace'];
1169
-                            }?></textarea>
1168
+								echo $tc['geodir_main_content_open_replace'];
1169
+							}?></textarea>
1170 1170
                     </td>
1171 1171
                 </tr>
1172 1172
 
@@ -1185,8 +1185,8 @@  discard block
 block discarded – undo
1185 1185
                         <span><?php _e('Output:', 'geodirectory');?></span>
1186 1186
                         <textarea name="geodir_main_content_close_replace"
1187 1187
                                   placeholder='</main><!-- main ends here-->'><?php if (isset($tc['geodir_main_content_close_replace'])) {
1188
-                                echo $tc['geodir_main_content_close_replace'];
1189
-                            }?></textarea>
1188
+								echo $tc['geodir_main_content_close_replace'];
1189
+							}?></textarea>
1190 1190
                     </td>
1191 1191
                 </tr>
1192 1192
 
@@ -1210,8 +1210,8 @@  discard block
 block discarded – undo
1210 1210
                     </td>
1211 1211
                     <td><textarea name="geodir_top_content_add"
1212 1212
                                   placeholder=''><?php if (isset($tc['geodir_top_content_add'])) {
1213
-                                echo $tc['geodir_top_content_add'];
1214
-                            }?></textarea></td>
1213
+								echo $tc['geodir_top_content_add'];
1214
+							}?></textarea></td>
1215 1215
                 </tr>
1216 1216
 
1217 1217
                 <tr>
@@ -1220,8 +1220,8 @@  discard block
 block discarded – undo
1220 1220
                     </td>
1221 1221
                     <td><textarea name="geodir_before_main_content_add"
1222 1222
                                   placeholder=''><?php if (isset($tc['geodir_before_main_content_add'])) {
1223
-                                echo $tc['geodir_before_main_content_add'];
1224
-                            }?></textarea></td>
1223
+								echo $tc['geodir_before_main_content_add'];
1224
+							}?></textarea></td>
1225 1225
                 </tr>
1226 1226
 
1227 1227
 
@@ -1244,8 +1244,8 @@  discard block
 block discarded – undo
1244 1244
                     </td>
1245 1245
                     <td><textarea name="geodir_full_page_class_filter"
1246 1246
                                   placeholder='geodir_full_page clearfix'><?php if (isset($tc['geodir_full_page_class_filter'])) {
1247
-                                echo $tc['geodir_full_page_class_filter'];
1248
-                            }?></textarea></td>
1247
+								echo $tc['geodir_full_page_class_filter'];
1248
+							}?></textarea></td>
1249 1249
                 </tr>
1250 1250
 
1251 1251
                 <tr>
@@ -1254,8 +1254,8 @@  discard block
 block discarded – undo
1254 1254
                     </td>
1255 1255
                     <td><textarea name="geodir_before_widget_filter"
1256 1256
                                   placeholder='<section id="%1$s" class="widget geodir-widget %2$s">'><?php if (isset($tc['geodir_before_widget_filter'])) {
1257
-                                echo $tc['geodir_before_widget_filter'];
1258
-                            }?></textarea></td>
1257
+								echo $tc['geodir_before_widget_filter'];
1258
+							}?></textarea></td>
1259 1259
                 </tr>
1260 1260
 
1261 1261
                 <tr>
@@ -1264,8 +1264,8 @@  discard block
 block discarded – undo
1264 1264
                     </td>
1265 1265
                     <td><textarea name="geodir_after_widget_filter"
1266 1266
                                   placeholder='</section>'><?php if (isset($tc['geodir_after_widget_filter'])) {
1267
-                                echo $tc['geodir_after_widget_filter'];
1268
-                            }?></textarea></td>
1267
+								echo $tc['geodir_after_widget_filter'];
1268
+							}?></textarea></td>
1269 1269
                 </tr>
1270 1270
 
1271 1271
                 <tr>
@@ -1274,8 +1274,8 @@  discard block
 block discarded – undo
1274 1274
                     </td>
1275 1275
                     <td><textarea name="geodir_before_title_filter"
1276 1276
                                   placeholder='<h3 class="widget-title">'><?php if (isset($tc['geodir_before_title_filter'])) {
1277
-                                echo $tc['geodir_before_title_filter'];
1278
-                            }?></textarea></td>
1277
+								echo $tc['geodir_before_title_filter'];
1278
+							}?></textarea></td>
1279 1279
                 </tr>
1280 1280
 
1281 1281
                 <tr>
@@ -1284,8 +1284,8 @@  discard block
 block discarded – undo
1284 1284
                     </td>
1285 1285
                     <td><textarea name="geodir_after_title_filter"
1286 1286
                                   placeholder='</h3>'><?php if (isset($tc['geodir_after_title_filter'])) {
1287
-                                echo $tc['geodir_after_title_filter'];
1288
-                            }?></textarea></td>
1287
+								echo $tc['geodir_after_title_filter'];
1288
+							}?></textarea></td>
1289 1289
                 </tr>
1290 1290
 
1291 1291
                 <tr>
@@ -1294,8 +1294,8 @@  discard block
 block discarded – undo
1294 1294
                     </td>
1295 1295
                     <td><textarea name="geodir_menu_li_class_filter"
1296 1296
                                   placeholder='menu-item'><?php if (isset($tc['geodir_menu_li_class_filter'])) {
1297
-                                echo $tc['geodir_menu_li_class_filter'];
1298
-                            }?></textarea></td>
1297
+								echo $tc['geodir_menu_li_class_filter'];
1298
+							}?></textarea></td>
1299 1299
                 </tr>
1300 1300
 
1301 1301
                 <tr>
@@ -1304,8 +1304,8 @@  discard block
 block discarded – undo
1304 1304
                     </td>
1305 1305
                     <td><textarea name="geodir_sub_menu_ul_class_filter"
1306 1306
                                   placeholder='sub-menu'><?php if (isset($tc['geodir_sub_menu_ul_class_filter'])) {
1307
-                                echo $tc['geodir_sub_menu_ul_class_filter'];
1308
-                            }?></textarea></td>
1307
+								echo $tc['geodir_sub_menu_ul_class_filter'];
1308
+							}?></textarea></td>
1309 1309
                 </tr>
1310 1310
 
1311 1311
                 <tr>
@@ -1314,8 +1314,8 @@  discard block
 block discarded – undo
1314 1314
                     </td>
1315 1315
                     <td><textarea name="geodir_sub_menu_li_class_filter"
1316 1316
                                   placeholder='menu-item'><?php if (isset($tc['geodir_sub_menu_li_class_filter'])) {
1317
-                                echo $tc['geodir_sub_menu_li_class_filter'];
1318
-                            }?></textarea></td>
1317
+								echo $tc['geodir_sub_menu_li_class_filter'];
1318
+							}?></textarea></td>
1319 1319
                 </tr>
1320 1320
 
1321 1321
                 <tr>
@@ -1324,8 +1324,8 @@  discard block
 block discarded – undo
1324 1324
                     </td>
1325 1325
                     <td><textarea name="geodir_menu_a_class_filter"
1326 1326
                                   placeholder=''><?php if (isset($tc['geodir_menu_a_class_filter'])) {
1327
-                                echo $tc['geodir_menu_a_class_filter'];
1328
-                            }?></textarea></td>
1327
+								echo $tc['geodir_menu_a_class_filter'];
1328
+							}?></textarea></td>
1329 1329
                 </tr>
1330 1330
 
1331 1331
                 <tr>
@@ -1334,8 +1334,8 @@  discard block
 block discarded – undo
1334 1334
                     </td>
1335 1335
                     <td><textarea name="geodir_sub_menu_a_class_filter"
1336 1336
                                   placeholder=''><?php if (isset($tc['geodir_sub_menu_a_class_filter'])) {
1337
-                                echo $tc['geodir_sub_menu_a_class_filter'];
1338
-                            }?></textarea></td>
1337
+								echo $tc['geodir_sub_menu_a_class_filter'];
1338
+							}?></textarea></td>
1339 1339
                 </tr>
1340 1340
 
1341 1341
 
@@ -1345,8 +1345,8 @@  discard block
 block discarded – undo
1345 1345
                     </td>
1346 1346
                     <td><textarea name="geodir_location_switcher_menu_li_class_filter"
1347 1347
                                   placeholder='menu-item menu-item-type-social menu-item-type-social gd-location-switcher'><?php if (isset($tc['geodir_location_switcher_menu_li_class_filter'])) {
1348
-                                echo $tc['geodir_location_switcher_menu_li_class_filter'];
1349
-                            }?></textarea></td>
1348
+								echo $tc['geodir_location_switcher_menu_li_class_filter'];
1349
+							}?></textarea></td>
1350 1350
                 </tr>
1351 1351
 
1352 1352
                 <tr>
@@ -1355,8 +1355,8 @@  discard block
 block discarded – undo
1355 1355
                     </td>
1356 1356
                     <td><textarea name="geodir_location_switcher_menu_a_class_filter"
1357 1357
                                   placeholder=''><?php if (isset($tc['geodir_location_switcher_menu_a_class_filter'])) {
1358
-                                echo $tc['geodir_location_switcher_menu_a_class_filter'];
1359
-                            }?></textarea></td>
1358
+								echo $tc['geodir_location_switcher_menu_a_class_filter'];
1359
+							}?></textarea></td>
1360 1360
                 </tr>
1361 1361
 
1362 1362
                 <tr>
@@ -1365,8 +1365,8 @@  discard block
 block discarded – undo
1365 1365
                     </td>
1366 1366
                     <td><textarea name="geodir_location_switcher_menu_sub_ul_class_filter"
1367 1367
                                   placeholder='sub-menu'><?php if (isset($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
1368
-                                echo $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
1369
-                            }?></textarea></td>
1368
+								echo $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
1369
+							}?></textarea></td>
1370 1370
                 </tr>
1371 1371
 
1372 1372
                 <tr>
@@ -1375,21 +1375,21 @@  discard block
 block discarded – undo
1375 1375
                     </td>
1376 1376
                     <td><textarea name="geodir_location_switcher_menu_sub_li_class_filter"
1377 1377
                                   placeholder='menu-item gd-location-switcher-menu-item'><?php if (isset($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
1378
-                                echo $tc['geodir_location_switcher_menu_sub_li_class_filter'];
1379
-                            }?></textarea></td>
1378
+								echo $tc['geodir_location_switcher_menu_sub_li_class_filter'];
1379
+							}?></textarea></td>
1380 1380
                 </tr>
1381 1381
 
1382 1382
 
1383 1383
 
1384 1384
                 <?php
1385
-                /**
1386
-                 * Allows more filter setting to be added to theme compatibility settings page.
1387
-                 *
1388
-                 * Called after the last setting in "Other filters" section of theme compatibility settings.
1389
-                 *
1390
-                 * @since 1.4.0
1391
-                 */
1392
-                do_action('gd_compat_other_filters');?>
1385
+				/**
1386
+				 * Allows more filter setting to be added to theme compatibility settings page.
1387
+				 *
1388
+				 * Called after the last setting in "Other filters" section of theme compatibility settings.
1389
+				 *
1390
+				 * @since 1.4.0
1391
+				 */
1392
+				do_action('gd_compat_other_filters');?>
1393 1393
 
1394 1394
                 </tbody>
1395 1395
             </table>
@@ -1402,8 +1402,8 @@  discard block
 block discarded – undo
1402 1402
                 <tr>
1403 1403
                     <td><textarea name="geodir_theme_compat_css"
1404 1404
                                   placeholder=''><?php if (isset($tc['geodir_theme_compat_css'])) {
1405
-                                echo $tc['geodir_theme_compat_css'];
1406
-                            }?></textarea></td>
1405
+								echo $tc['geodir_theme_compat_css'];
1406
+							}?></textarea></td>
1407 1407
                 </tr>
1408 1408
 
1409 1409
 
@@ -1417,8 +1417,8 @@  discard block
 block discarded – undo
1417 1417
                 <tr>
1418 1418
                     <td><textarea name="geodir_theme_compat_js"
1419 1419
                                   placeholder=''><?php if (isset($tc['geodir_theme_compat_js'])) {
1420
-                                echo $tc['geodir_theme_compat_js'];
1421
-                            }?></textarea></td>
1420
+								echo $tc['geodir_theme_compat_js'];
1421
+							}?></textarea></td>
1422 1422
                 </tr>
1423 1423
 
1424 1424
 
@@ -1445,23 +1445,23 @@  discard block
 block discarded – undo
1445 1445
  */
1446 1446
 function geodir_custom_post_type_form()
1447 1447
 {
1448
-    $listing_type = ($_REQUEST['listing_type'] != '') ? $_REQUEST['listing_type'] : 'gd_place';
1448
+	$listing_type = ($_REQUEST['listing_type'] != '') ? $_REQUEST['listing_type'] : 'gd_place';
1449 1449
 
1450
-    $sub_tab = ($_REQUEST['subtab'] != '') ? $_REQUEST['subtab'] : '';
1450
+	$sub_tab = ($_REQUEST['subtab'] != '') ? $_REQUEST['subtab'] : '';
1451 1451
 
1452 1452
 
1453
-    ?>
1453
+	?>
1454 1454
 
1455 1455
     <div class="gd-content-heading">
1456 1456
         <?php
1457
-        /**
1458
-         * Filter custom fields panel heading.
1459
-         *
1460
-         * @since 1.0.0
1461
-         * @param string $sub_tab Sub tab name.
1462
-         * @param string $listing_type Post type.
1463
-         */
1464
-        ?>
1457
+		/**
1458
+		 * Filter custom fields panel heading.
1459
+		 *
1460
+		 * @since 1.0.0
1461
+		 * @param string $sub_tab Sub tab name.
1462
+		 * @param string $listing_type Post type.
1463
+		 */
1464
+		?>
1465 1465
         <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type);?></h3>
1466 1466
     </div>
1467 1467
     <div id="container_general" class="clearfix">
@@ -1469,25 +1469,25 @@  discard block
 block discarded – undo
1469 1469
 
1470 1470
             <div class="side-sortables" id="geodir-available-fields">
1471 1471
                 <?php
1472
-                /**
1473
-                 * Filter custom field available fields heading.
1474
-                 *
1475
-                 * @since 1.0.0
1476
-                 * @param string $sub_tab Sub tab name.
1477
-                 * @param string $listing_type Post type.
1478
-                 */
1479
-                ?>
1472
+				/**
1473
+				 * Filter custom field available fields heading.
1474
+				 *
1475
+				 * @since 1.0.0
1476
+				 * @param string $sub_tab Sub tab name.
1477
+				 * @param string $listing_type Post type.
1478
+				 */
1479
+				?>
1480 1480
                 <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type);?>
1481 1481
 							</span></h3>
1482 1482
                 <?php
1483
-                /**
1484
-                 * Filter custom field available fields note text.
1485
-                 *
1486
-                 * @since 1.0.0
1487
-                 * @param string $sub_tab Sub tab name.
1488
-                 * @param string $listing_type Post type.
1489
-                 */
1490
-                ?>
1483
+				/**
1484
+				 * Filter custom field available fields note text.
1485
+				 *
1486
+				 * @since 1.0.0
1487
+				 * @param string $sub_tab Sub tab name.
1488
+				 * @param string $listing_type Post type.
1489
+				 */
1490
+				?>
1491 1491
                 <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type);?></p>
1492 1492
 
1493 1493
                 <div class="inside">
@@ -1495,13 +1495,13 @@  discard block
 block discarded – undo
1495 1495
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1496 1496
 
1497 1497
                         <?php
1498
-                        /**
1499
-                         * Adds the available fields to the custom fields settings page per post type.
1500
-                         *
1501
-                         * @since 1.0.0
1502
-                         * @param string $sub_tab The current settings tab name.
1503
-                         */
1504
-                        do_action('geodir_manage_available_fields', $sub_tab); ?>
1498
+						/**
1499
+						 * Adds the available fields to the custom fields settings page per post type.
1500
+						 *
1501
+						 * @since 1.0.0
1502
+						 * @param string $sub_tab The current settings tab name.
1503
+						 */
1504
+						do_action('geodir_manage_available_fields', $sub_tab); ?>
1505 1505
 
1506 1506
                         <div style="clear:both"></div>
1507 1507
                     </div>
@@ -1514,25 +1514,25 @@  discard block
 block discarded – undo
1514 1514
             <div class="side-sortables" id="geodir-selected-fields">
1515 1515
                 <h3 class="hndle">
1516 1516
                     <?php
1517
-                    /**
1518
-                     * Filter custom field selected fields heading.
1519
-                     *
1520
-                     * @since 1.0.0
1521
-                     * @param string $sub_tab Sub tab name.
1522
-                     * @param string $listing_type Post type.
1523
-                     */
1524
-                    ?>
1517
+					/**
1518
+					 * Filter custom field selected fields heading.
1519
+					 *
1520
+					 * @since 1.0.0
1521
+					 * @param string $sub_tab Sub tab name.
1522
+					 * @param string $listing_type Post type.
1523
+					 */
1524
+					?>
1525 1525
                     <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type);?></span>
1526 1526
                 </h3>
1527 1527
                 <?php
1528
-                /**
1529
-                 * Filter custom field selected fields note text.
1530
-                 *
1531
-                 * @since 1.0.0
1532
-                 * @param string $sub_tab Sub tab name.
1533
-                 * @param string $listing_type Post type.
1534
-                 */
1535
-                ?>
1528
+				/**
1529
+				 * Filter custom field selected fields note text.
1530
+				 *
1531
+				 * @since 1.0.0
1532
+				 * @param string $sub_tab Sub tab name.
1533
+				 * @param string $listing_type Post type.
1534
+				 */
1535
+				?>
1536 1536
                 <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type);?></p>
1537 1537
 
1538 1538
                 <div class="inside">
@@ -1540,13 +1540,13 @@  discard block
 block discarded – undo
1540 1540
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1541 1541
                         <div class="field_row_main">
1542 1542
                             <?php
1543
-                            /**
1544
-                             * Adds the selected fields and setting to the custom fields settings page per post type.
1545
-                             *
1546
-                             * @since 1.0.0
1547
-                             * @param string $sub_tab The current settings tab name.
1548
-                             */
1549
-                            do_action('geodir_manage_selected_fields', $sub_tab); ?>
1543
+							/**
1544
+							 * Adds the selected fields and setting to the custom fields settings page per post type.
1545
+							 *
1546
+							 * @since 1.0.0
1547
+							 * @param string $sub_tab The current settings tab name.
1548
+							 */
1549
+							do_action('geodir_manage_selected_fields', $sub_tab); ?>
1550 1550
                         </div>
1551 1551
                         <div style="clear:both"></div>
1552 1552
                     </div>
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
  */
1570 1570
 function geodir_diagnostic_tools_setting_page()
1571 1571
 {
1572
-    ?>
1572
+	?>
1573 1573
     <div class="inner_content_tab_main">
1574 1574
         <div class="gd-content-heading">
1575 1575
 
@@ -1671,13 +1671,13 @@  discard block
 block discarded – undo
1671 1671
 					</td>
1672 1672
 				</tr>
1673 1673
                 <?php
1674
-                /**
1675
-                 * Allows you to add more setting to the GD>Tools settings page.
1676
-                 *
1677
-                 * Called after the last setting on the GD>Tools page.
1678
-                 * @since 1.0.0
1679
-                 */
1680
-                do_action('geodir_diagnostic_tool');?>
1674
+				/**
1675
+				 * Allows you to add more setting to the GD>Tools settings page.
1676
+				 *
1677
+				 * Called after the last setting on the GD>Tools page.
1678
+				 * @since 1.0.0
1679
+				 */
1680
+				do_action('geodir_diagnostic_tool');?>
1681 1681
 
1682 1682
                 </tbody>
1683 1683
             </table>
Please login to merge, or discard this patch.
geodirectory-admin/geodir_admin_ajax.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@
 block discarded – undo
13 13
 	 * @since 1.0.0
14 14
 	 */
15 15
 	include_once(geodir_plugin_path() . '/geodirectory-admin/option-pages/create_field.php');
16
-    die;
16
+	die;
17 17
 }
18 18
 
19 19
 
20 20
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] != '') {
21
-    switch ($_REQUEST['ajax_action']):
22
-        case 'get_cat_dl':
23
-            geodir_get_categories_dl($_REQUEST['post_type'], $_REQUEST['selected'], false, true);
24
-            break;
25
-    endswitch;
21
+	switch ($_REQUEST['ajax_action']):
22
+		case 'get_cat_dl':
23
+			geodir_get_categories_dl($_REQUEST['post_type'], $_REQUEST['selected'], false, true);
24
+			break;
25
+	endswitch;
26 26
 }
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/create_field.php 1 patch
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Creates custom fields
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Creates custom fields
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
 
9 9
 $data_type = isset($_REQUEST['data_type']) ? sanitize_text_field($_REQUEST['data_type']) : '';
10 10
 $field_type = isset($_REQUEST['field_type']) ? sanitize_text_field($_REQUEST['field_type']) : '';
@@ -15,95 +15,95 @@  discard block
 block discarded – undo
15 15
 
16 16
 $field_ids = array();
17 17
 if (!empty($_REQUEST['licontainer']) && is_array($_REQUEST['licontainer'])) {
18
-    foreach ($_REQUEST['licontainer'] as $lic_id) {
19
-        $field_ids[] = sanitize_text_field($lic_id);
20
-    }
18
+	foreach ($_REQUEST['licontainer'] as $lic_id) {
19
+		$field_ids[] = sanitize_text_field($lic_id);
20
+	}
21 21
 }
22 22
 
23 23
 /* ------- check nonce field ------- */
24 24
 if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
25
-    echo godir_set_field_order($field_ids);
25
+	echo godir_set_field_order($field_ids);
26 26
 }
27 27
 
28 28
 if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
29
-    echo godir_set_sort_field_order($field_ids);
29
+	echo godir_set_sort_field_order($field_ids);
30 30
 }
31 31
 
32 32
 /* ---- Show field form in admin ---- */
33 33
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
34
-    geodir_custom_field_adminhtml($field_type, $field_id, $field_action);
34
+	geodir_custom_field_adminhtml($field_type, $field_id, $field_action);
35 35
 }
36 36
 
37 37
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
38
-    geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action);
38
+	geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action);
39 39
 }
40 40
 
41 41
 /* ---- Delete field ---- */
42 42
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
43
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
44
-        return;
43
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
44
+		return;
45 45
     
46
-    echo geodir_custom_field_delete($field_id);
46
+	echo geodir_custom_field_delete($field_id);
47 47
 }
48 48
 
49 49
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
50
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
51
-        return;
50
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
51
+		return;
52 52
     
53
-    echo geodir_custom_sort_field_delete($field_id);
53
+	echo geodir_custom_sort_field_delete($field_id);
54 54
 }
55 55
 
56 56
 /* ---- Save field  ---- */
57 57
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
58
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
59
-        return;
60
-
61
-    foreach ($_REQUEST as $pkey => $pval) {
62
-        if (is_array($_REQUEST[$pkey])) {
63
-            $tags = 'skip_field';
64
-        } else {
65
-            $tags = '';
66
-        }
67
-
68
-        if ($tags != 'skip_field') {
69
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
70
-        }
71
-    }
72
-
73
-    $return = geodir_custom_field_save($_REQUEST);
74
-
75
-    if (is_int($return)) {
76
-        $lastid = $return;
77
-        geodir_custom_field_adminhtml($field_type, $lastid, 'submit');
78
-    } else {
79
-        echo $return;
80
-    }
58
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
59
+		return;
60
+
61
+	foreach ($_REQUEST as $pkey => $pval) {
62
+		if (is_array($_REQUEST[$pkey])) {
63
+			$tags = 'skip_field';
64
+		} else {
65
+			$tags = '';
66
+		}
67
+
68
+		if ($tags != 'skip_field') {
69
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
70
+		}
71
+	}
72
+
73
+	$return = geodir_custom_field_save($_REQUEST);
74
+
75
+	if (is_int($return)) {
76
+		$lastid = $return;
77
+		geodir_custom_field_adminhtml($field_type, $lastid, 'submit');
78
+	} else {
79
+		echo $return;
80
+	}
81 81
 }
82 82
 
83 83
 /* ---- Save sort field  ---- */
84 84
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
85
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
86
-        return;
87
-
88
-    foreach ($_REQUEST as $pkey => $pval) {
89
-        if (is_array($_REQUEST[$pkey])) {
90
-            $tags = 'skip_field';
91
-        } else {
92
-            $tags = '';
93
-        }
94
-
95
-        if ($tags != 'skip_field') {
96
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
97
-        }
98
-    }
99
-
100
-    $return = geodir_custom_sort_field_save($_REQUEST);
101
-
102
-    if (is_int($return)) {
103
-        $lastid = $return;
104
-        $default = false;
105
-        geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default);
106
-    } else {
107
-        echo $return;
108
-    }
85
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
86
+		return;
87
+
88
+	foreach ($_REQUEST as $pkey => $pval) {
89
+		if (is_array($_REQUEST[$pkey])) {
90
+			$tags = 'skip_field';
91
+		} else {
92
+			$tags = '';
93
+		}
94
+
95
+		if ($tags != 'skip_field') {
96
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
97
+		}
98
+	}
99
+
100
+	$return = geodir_custom_sort_field_save($_REQUEST);
101
+
102
+	if (is_int($return)) {
103
+		$lastid = $return;
104
+		$default = false;
105
+		geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default);
106
+	} else {
107
+		echo $return;
108
+	}
109 109
 }
110 110
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/design_settings_array.php 1 patch
Indentation   +902 added lines, -902 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Design tab settings.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- * @global array $geodir_settings Geodirectory settings array.
8
- */
3
+	 * Design tab settings.
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 * @global array $geodir_settings Geodirectory settings array.
8
+	 */
9 9
 global $geodir_settings;
10 10
 
11 11
 
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function geodir_post_type_setting_fun()
19 19
 {
20
-    $post_type_arr = array();
20
+	$post_type_arr = array();
21 21
 
22
-    $post_types = geodir_get_posttypes('object');
22
+	$post_types = geodir_get_posttypes('object');
23 23
 
24
-    foreach ($post_types as $key => $post_types_obj) {
25
-        $post_type_arr[$key] = $post_types_obj->labels->singular_name;
26
-    }
27
-    return $post_type_arr;
24
+	foreach ($post_types as $key => $post_types_obj) {
25
+		$post_type_arr[$key] = $post_types_obj->labels->singular_name;
26
+	}
27
+	return $post_type_arr;
28 28
 }
29 29
 
30 30
 /**
@@ -35,548 +35,548 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function geodir_theme_location_setting_fun()
37 37
 {
38
-    $post_type_arr = array();
39
-    $geodir_all_nav_locations = get_registered_nav_menus();
40
-    $geodir_active_nav_locations = get_nav_menu_locations();
41
-    if (!empty($geodir_active_nav_locations) && is_array($geodir_active_nav_locations)) {
42
-        foreach ($geodir_active_nav_locations as $key => $theme_location) {
43
-            if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations))
44
-                $post_type_arr[$key] = $geodir_all_nav_locations[$key];
45
-        }
46
-    }
47
-
48
-    return $post_type_arr;
38
+	$post_type_arr = array();
39
+	$geodir_all_nav_locations = get_registered_nav_menus();
40
+	$geodir_active_nav_locations = get_nav_menu_locations();
41
+	if (!empty($geodir_active_nav_locations) && is_array($geodir_active_nav_locations)) {
42
+		foreach ($geodir_active_nav_locations as $key => $theme_location) {
43
+			if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations))
44
+				$post_type_arr[$key] = $geodir_all_nav_locations[$key];
45
+		}
46
+	}
47
+
48
+	return $post_type_arr;
49 49
 }
50 50
 /**
51
- * Filter GD design settings array.
52
- *
53
- * @since 1.0.0
54
- * @package GeoDirectory
55
- */
51
+	 * Filter GD design settings array.
52
+	 *
53
+	 * @since 1.0.0
54
+	 * @package GeoDirectory
55
+	 */
56 56
 $geodir_settings['design_settings'] = apply_filters('geodir_design_settings', array(
57 57
 
58
-    /* Home Layout Settings start */
59
-    array('name' => __('Home', 'geodirectory'), 'type' => 'title', 'desc' => 'Setting to set home page layout', 'id' => 'home_page_settings '),
58
+	/* Home Layout Settings start */
59
+	array('name' => __('Home', 'geodirectory'), 'type' => 'title', 'desc' => 'Setting to set home page layout', 'id' => 'home_page_settings '),
60 60
 
61 61
 
62
-    array('name' => __('Home Top Section Settings', 'geodirectory'),
63
-        'type' => 'sectionstart',
64
-        'desc' => '',
65
-        'id' => 'geodir_home_top_section'),
62
+	array('name' => __('Home Top Section Settings', 'geodirectory'),
63
+		'type' => 'sectionstart',
64
+		'desc' => '',
65
+		'id' => 'geodir_home_top_section'),
66 66
 
67
-    array(
68
-        'name' => __('Geodirectory home page', 'geodirectory'),
69
-        'desc' => __('Set geodirectory home page as your home. <b style="color:red;">This setting has been depreciated and will be removed in the next version, instead please set the GD home page in GD>Permalinks and then set this page to the front page under Settings>Reading>Front Page</b>', 'geodirectory'),
70
-        'id' => 'geodir_set_as_home',
71
-        'type' => 'checkbox',
72
-        'std' => '0' // Default value to show home top section
73
-    ),
67
+	array(
68
+		'name' => __('Geodirectory home page', 'geodirectory'),
69
+		'desc' => __('Set geodirectory home page as your home. <b style="color:red;">This setting has been depreciated and will be removed in the next version, instead please set the GD home page in GD>Permalinks and then set this page to the front page under Settings>Reading>Front Page</b>', 'geodirectory'),
70
+		'id' => 'geodir_set_as_home',
71
+		'type' => 'checkbox',
72
+		'std' => '0' // Default value to show home top section
73
+	),
74 74
 
75
-    array(
76
-        'name' => __('Home top section', 'geodirectory'),
77
-        'desc' => __('Show the top section of home page', 'geodirectory'),
78
-        'id' => 'geodir_show_home_top_section',
79
-        'type' => 'checkbox',
80
-        'std' => '1' // Default value to show home top section
81
-    ),
75
+	array(
76
+		'name' => __('Home top section', 'geodirectory'),
77
+		'desc' => __('Show the top section of home page', 'geodirectory'),
78
+		'id' => 'geodir_show_home_top_section',
79
+		'type' => 'checkbox',
80
+		'std' => '1' // Default value to show home top section
81
+	),
82 82
 
83 83
 
84
-    array('type' => 'sectionend', 'id' => 'geodir_home_top_section'),
84
+	array('type' => 'sectionend', 'id' => 'geodir_home_top_section'),
85 85
 
86 86
 
87
-    array('name' => __('Home Page Layout Settings', 'geodirectory'),
88
-        'type' => 'sectionstart',
89
-        'desc' => '',
90
-        'id' => 'geodir_home_layout'),
87
+	array('name' => __('Home Page Layout Settings', 'geodirectory'),
88
+		'type' => 'sectionstart',
89
+		'desc' => '',
90
+		'id' => 'geodir_home_layout'),
91 91
 
92
-    array(
93
-        'name' => __('Home right section', 'geodirectory'),
94
-        'desc' => __('Show the right section of home page', 'geodirectory'),
95
-        'id' => 'geodir_show_home_right_section',
96
-        'type' => 'checkbox',
97
-        'std' => '1' // Default value to show home top section
98
-    ),
92
+	array(
93
+		'name' => __('Home right section', 'geodirectory'),
94
+		'desc' => __('Show the right section of home page', 'geodirectory'),
95
+		'id' => 'geodir_show_home_right_section',
96
+		'type' => 'checkbox',
97
+		'std' => '1' // Default value to show home top section
98
+	),
99 99
 
100
-    array(
101
-        'name' => __('Width of home right section', 'geodirectory'),
102
-        'desc' => __('Enter the width of right section of home page in %', 'geodirectory'),
103
-        'id' => 'geodir_width_home_right_section',
104
-        'type' => 'text',
105
-        'css' => 'min-width:300px;',
106
-        'std' => '30' // Default value to show home top section
107
-    ),
100
+	array(
101
+		'name' => __('Width of home right section', 'geodirectory'),
102
+		'desc' => __('Enter the width of right section of home page in %', 'geodirectory'),
103
+		'id' => 'geodir_width_home_right_section',
104
+		'type' => 'text',
105
+		'css' => 'min-width:300px;',
106
+		'std' => '30' // Default value to show home top section
107
+	),
108 108
 
109
-    array(
110
-        'name' => __('Home content section', 'geodirectory'),
111
-        'desc' => __('Show the content section of home page', 'geodirectory'),
112
-        'id' => 'geodir_show_home_contant_section',
113
-        'type' => 'checkbox',
114
-        'std' => '1' // Default value to show home top section
115
-    ),
109
+	array(
110
+		'name' => __('Home content section', 'geodirectory'),
111
+		'desc' => __('Show the content section of home page', 'geodirectory'),
112
+		'id' => 'geodir_show_home_contant_section',
113
+		'type' => 'checkbox',
114
+		'std' => '1' // Default value to show home top section
115
+	),
116 116
 
117
-    array(
118
-        'name' => __('Width of home content section', 'geodirectory'),
119
-        'desc' => __('Enter the width of content section of home page in %', 'geodirectory'),
120
-        'id' => 'geodir_width_home_contant_section',
121
-        'type' => 'text',
122
-        'css' => 'min-width:300px;',
123
-        'std' => '63' // Default value to show home top section
124
-    ),
117
+	array(
118
+		'name' => __('Width of home content section', 'geodirectory'),
119
+		'desc' => __('Enter the width of content section of home page in %', 'geodirectory'),
120
+		'id' => 'geodir_width_home_contant_section',
121
+		'type' => 'text',
122
+		'css' => 'min-width:300px;',
123
+		'std' => '63' // Default value to show home top section
124
+	),
125 125
 
126
-    array(
127
-        'name' => __('Home left section', 'geodirectory'),
128
-        'desc' => __('Show the left section of home page', 'geodirectory'),
129
-        'id' => 'geodir_show_home_left_section',
130
-        'type' => 'checkbox',
131
-        'std' => '0' // Default value to show home top section
132
-    ),
126
+	array(
127
+		'name' => __('Home left section', 'geodirectory'),
128
+		'desc' => __('Show the left section of home page', 'geodirectory'),
129
+		'id' => 'geodir_show_home_left_section',
130
+		'type' => 'checkbox',
131
+		'std' => '0' // Default value to show home top section
132
+	),
133 133
 
134
-    array(
135
-        'name' => __('Width of home left section', 'geodirectory'),
136
-        'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
137
-        'id' => 'geodir_width_home_left_section',
138
-        'type' => 'text',
139
-        'css' => 'min-width:300px;',
140
-        'std' => '30' // Default value to show home top section
141
-    ),
134
+	array(
135
+		'name' => __('Width of home left section', 'geodirectory'),
136
+		'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
137
+		'id' => 'geodir_width_home_left_section',
138
+		'type' => 'text',
139
+		'css' => 'min-width:300px;',
140
+		'std' => '30' // Default value to show home top section
141
+	),
142 142
 
143
-    array(
144
-        'name' => __('Home bottom section', 'geodirectory'),
145
-        'desc' => __('Show the bottom section of home page', 'geodirectory'),
146
-        'id' => 'geodir_show_home_bottom_section',
147
-        'type' => 'checkbox',
148
-        'std' => '0' // Default value to show home top section
149
-    ),
150
-    array(
151
-        'name' => __('Resize image large size', 'geodirectory'),
152
-        'desc' => sprintf(__('Use default wordpress media image large size ( %s ) for featured image upload. If unchecked then default geodirectory image large size ( 800x800 ) will be used.', 'geodirectory'), get_option('large_size_w') . 'x' . get_option('large_size_h')),
153
-        'id' => 'geodir_use_wp_media_large_size',
154
-        'type' => 'checkbox',
155
-        'std' => '0'
156
-    ),
143
+	array(
144
+		'name' => __('Home bottom section', 'geodirectory'),
145
+		'desc' => __('Show the bottom section of home page', 'geodirectory'),
146
+		'id' => 'geodir_show_home_bottom_section',
147
+		'type' => 'checkbox',
148
+		'std' => '0' // Default value to show home top section
149
+	),
150
+	array(
151
+		'name' => __('Resize image large size', 'geodirectory'),
152
+		'desc' => sprintf(__('Use default wordpress media image large size ( %s ) for featured image upload. If unchecked then default geodirectory image large size ( 800x800 ) will be used.', 'geodirectory'), get_option('large_size_w') . 'x' . get_option('large_size_h')),
153
+		'id' => 'geodir_use_wp_media_large_size',
154
+		'type' => 'checkbox',
155
+		'std' => '0'
156
+	),
157 157
 
158
-    array('type' => 'sectionend', 'id' => 'geodir_home_layout'),
158
+	array('type' => 'sectionend', 'id' => 'geodir_home_layout'),
159 159
 
160 160
 
161
-    /* Home Layout Settings end */
161
+	/* Home Layout Settings end */
162 162
 
163 163
 
164
-    /* Listing Layout Settings end */
164
+	/* Listing Layout Settings end */
165 165
 
166
-    array('name' => __('Listings', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_listing_settings '),
166
+	array('name' => __('Listings', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_listing_settings '),
167 167
 
168 168
 
169
-    array('name' => __('Listing Page Layout Settings', 'geodirectory'),
170
-        'type' => 'sectionstart',
171
-        'desc' => '',
172
-        'id' => 'geodir_listing_layout'),
169
+	array('name' => __('Listing Page Layout Settings', 'geodirectory'),
170
+		'type' => 'sectionstart',
171
+		'desc' => '',
172
+		'id' => 'geodir_listing_layout'),
173 173
 
174
-    array(
175
-        'name' => __('Listing top section', 'geodirectory'),
176
-        'desc' => __('Show the top section of listing page', 'geodirectory'),
177
-        'id' => 'geodir_show_listing_top_section',
178
-        'type' => 'checkbox',
179
-        'std' => '1' // Default value to show home top section
180
-    ),
174
+	array(
175
+		'name' => __('Listing top section', 'geodirectory'),
176
+		'desc' => __('Show the top section of listing page', 'geodirectory'),
177
+		'id' => 'geodir_show_listing_top_section',
178
+		'type' => 'checkbox',
179
+		'std' => '1' // Default value to show home top section
180
+	),
181 181
 
182
-    array(
183
-        'name' => __('Listing right section', 'geodirectory'),
184
-        'desc' => __('Show the right section of listing page', 'geodirectory'),
185
-        'id' => 'geodir_show_listing_right_section',
186
-        'type' => 'checkbox',
187
-        'std' => '1' // Default value to show home top section
188
-    ),
182
+	array(
183
+		'name' => __('Listing right section', 'geodirectory'),
184
+		'desc' => __('Show the right section of listing page', 'geodirectory'),
185
+		'id' => 'geodir_show_listing_right_section',
186
+		'type' => 'checkbox',
187
+		'std' => '1' // Default value to show home top section
188
+	),
189 189
 
190
-    array(
191
-        'name' => __('Width of listing right section', 'geodirectory'),
192
-        'desc' => __('Enter the width of right section of listing page in %', 'geodirectory'),
193
-        'id' => 'geodir_width_listing_right_section',
194
-        'type' => 'text',
195
-        'css' => 'min-width:300px;',
196
-        'std' => '30' // Default value to show home top section
197
-    ),
190
+	array(
191
+		'name' => __('Width of listing right section', 'geodirectory'),
192
+		'desc' => __('Enter the width of right section of listing page in %', 'geodirectory'),
193
+		'id' => 'geodir_width_listing_right_section',
194
+		'type' => 'text',
195
+		'css' => 'min-width:300px;',
196
+		'std' => '30' // Default value to show home top section
197
+	),
198 198
 
199 199
 
200
-    array(
201
-        'name' => __('Listing content section view', 'geodirectory'),
202
-        'desc' => __('Set the listing view of listing page', 'geodirectory'),
203
-        'id' => 'geodir_listing_view',
204
-        'css' => 'min-width:300px;',
205
-        'std' => 'gridview_onehalf',
206
-        'type' => 'select',
207
-        'class' => 'chosen_select',
208
-        'options' => array_unique(array(
209
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
210
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
211
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
212
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
213
-            'listview' => __('List view', 'geodirectory'),
214
-        ))
215
-    ),
200
+	array(
201
+		'name' => __('Listing content section view', 'geodirectory'),
202
+		'desc' => __('Set the listing view of listing page', 'geodirectory'),
203
+		'id' => 'geodir_listing_view',
204
+		'css' => 'min-width:300px;',
205
+		'std' => 'gridview_onehalf',
206
+		'type' => 'select',
207
+		'class' => 'chosen_select',
208
+		'options' => array_unique(array(
209
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
210
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
211
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
212
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
213
+			'listview' => __('List view', 'geodirectory'),
214
+		))
215
+	),
216 216
 
217
-    array(
218
-        'name' => __('Width of listing content section', 'geodirectory'),
219
-        'desc' => __('Enter the width of content section of listing page in %', 'geodirectory'),
220
-        'id' => 'geodir_width_listing_contant_section',
221
-        'type' => 'text',
222
-        'css' => 'min-width:300px;',
223
-        'std' => '63' // Default value to show home top section
224
-    ),
217
+	array(
218
+		'name' => __('Width of listing content section', 'geodirectory'),
219
+		'desc' => __('Enter the width of content section of listing page in %', 'geodirectory'),
220
+		'id' => 'geodir_width_listing_contant_section',
221
+		'type' => 'text',
222
+		'css' => 'min-width:300px;',
223
+		'std' => '63' // Default value to show home top section
224
+	),
225 225
 
226
-    array(
227
-        'name' => __('Listing left section', 'geodirectory'),
228
-        'desc' => __('Show the left section of listing page', 'geodirectory'),
229
-        'id' => 'geodir_show_listing_left_section',
230
-        'type' => 'checkbox',
231
-        'std' => '0' // Default value to show home top section
232
-    ),
226
+	array(
227
+		'name' => __('Listing left section', 'geodirectory'),
228
+		'desc' => __('Show the left section of listing page', 'geodirectory'),
229
+		'id' => 'geodir_show_listing_left_section',
230
+		'type' => 'checkbox',
231
+		'std' => '0' // Default value to show home top section
232
+	),
233 233
 
234
-    array(
235
-        'name' => __('Width of listing left section', 'geodirectory'),
236
-        'desc' => __('Enter the width of left section of listing in %', 'geodirectory'),
237
-        'id' => 'geodir_width_listing_left_section',
238
-        'type' => 'text',
239
-        'css' => 'min-width:300px;',
240
-        'std' => '30' // Default value to show home top section
241
-    ),
234
+	array(
235
+		'name' => __('Width of listing left section', 'geodirectory'),
236
+		'desc' => __('Enter the width of left section of listing in %', 'geodirectory'),
237
+		'id' => 'geodir_width_listing_left_section',
238
+		'type' => 'text',
239
+		'css' => 'min-width:300px;',
240
+		'std' => '30' // Default value to show home top section
241
+	),
242 242
 
243
-    array(
244
-        'name' => __('Listing bottom section', 'geodirectory'),
245
-        'desc' => __('Show the bottom section of listing page', 'geodirectory'),
246
-        'id' => 'geodir_show_listing_bottom_section',
247
-        'type' => 'checkbox',
248
-        'std' => '0' // Default value to show home top section
249
-    ),
243
+	array(
244
+		'name' => __('Listing bottom section', 'geodirectory'),
245
+		'desc' => __('Show the bottom section of listing page', 'geodirectory'),
246
+		'id' => 'geodir_show_listing_bottom_section',
247
+		'type' => 'checkbox',
248
+		'std' => '0' // Default value to show home top section
249
+	),
250 250
 
251
-    array(
252
-        'name' => __('Upload listing no image', 'geodirectory'),
253
-        'desc' => '',
254
-        'id' => 'geodir_listing_no_img',
255
-        'type' => 'file',
256
-        'std' => '0' // Default value to show home top section
257
-    ),
251
+	array(
252
+		'name' => __('Upload listing no image', 'geodirectory'),
253
+		'desc' => '',
254
+		'id' => 'geodir_listing_no_img',
255
+		'type' => 'file',
256
+		'std' => '0' // Default value to show home top section
257
+	),
258 258
 
259
-    array(
260
-        'name' => __('Description word limit', 'geodirectory'),
261
-        'desc' => '',
262
-        'id' => 'geodir_desc_word_limit',
263
-        'type' => 'text',
264
-        'css' => 'min-width:300px;',
265
-        'std' => '50' // Default value to show home top section
266
-    ),
259
+	array(
260
+		'name' => __('Description word limit', 'geodirectory'),
261
+		'desc' => '',
262
+		'id' => 'geodir_desc_word_limit',
263
+		'type' => 'text',
264
+		'css' => 'min-width:300px;',
265
+		'std' => '50' // Default value to show home top section
266
+	),
267 267
 
268
-    array('type' => 'sectionend', 'id' => 'geodir_listing_layout'),
268
+	array('type' => 'sectionend', 'id' => 'geodir_listing_layout'),
269 269
 
270 270
 
271
-    array('name' => __('Listing General Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_listing_gen_settings '),
271
+	array('name' => __('Listing General Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_listing_gen_settings '),
272 272
 
273
-    array(
274
-        'name' => __('New listing default status', 'geodirectory'),
275
-        'desc' => __('Select new listing default status.', 'geodirectory'),
276
-        'tip' => '',
277
-        'id' => 'geodir_new_post_default_status',
278
-        'css' => 'min-width:300px;',
279
-        'std' => 'publish',
280
-        'type' => 'select',
281
-        'class' => 'chosen_select',
282
-        'options' => array_unique(array(
283
-            'publish' => __('publish', 'geodirectory'),
284
-            'draft' => __('draft', 'geodirectory'),
285
-        ))
286
-    ),
273
+	array(
274
+		'name' => __('New listing default status', 'geodirectory'),
275
+		'desc' => __('Select new listing default status.', 'geodirectory'),
276
+		'tip' => '',
277
+		'id' => 'geodir_new_post_default_status',
278
+		'css' => 'min-width:300px;',
279
+		'std' => 'publish',
280
+		'type' => 'select',
281
+		'class' => 'chosen_select',
282
+		'options' => array_unique(array(
283
+			'publish' => __('publish', 'geodirectory'),
284
+			'draft' => __('draft', 'geodirectory'),
285
+		))
286
+	),
287 287
 
288
-    array(
289
-        'name' => __('New listings settings', 'geodirectory'),
290
-        'desc' => __('Enter number of days a listing will appear new.(enter 0 to disable feature)', 'geodirectory'),
291
-        'id' => 'geodir_listing_new_days',
292
-        'type' => 'text',
293
-        'css' => 'min-width:300px;',
294
-        'std' => '30' // Default value for the page title - changed in settings
295
-    ),
288
+	array(
289
+		'name' => __('New listings settings', 'geodirectory'),
290
+		'desc' => __('Enter number of days a listing will appear new.(enter 0 to disable feature)', 'geodirectory'),
291
+		'id' => 'geodir_listing_new_days',
292
+		'type' => 'text',
293
+		'css' => 'min-width:300px;',
294
+		'std' => '30' // Default value for the page title - changed in settings
295
+	),
296 296
 
297
-    array('type' => 'sectionend', 'id' => 'geodir_listing_gen_settings'),
297
+	array('type' => 'sectionend', 'id' => 'geodir_listing_gen_settings'),
298 298
 
299 299
 
300
-    array('name' => __('Add Listing Form Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_add_listing_gen_settings'),
300
+	array('name' => __('Add Listing Form Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_add_listing_gen_settings'),
301 301
 
302
-    array(
303
-        'name' => __('Enable "Accept Terms and Conditions"', 'geodirectory'),
304
-        'desc' => __('Show the "Accept Terms and Conditions" field on add listing.', 'geodirectory'),
305
-        'id' => 'geodir_accept_term_condition',
306
-        'type' => 'checkbox',
307
-        'std' => '1' // Default value to show home top section
308
-    ),
302
+	array(
303
+		'name' => __('Enable "Accept Terms and Conditions"', 'geodirectory'),
304
+		'desc' => __('Show the "Accept Terms and Conditions" field on add listing.', 'geodirectory'),
305
+		'id' => 'geodir_accept_term_condition',
306
+		'type' => 'checkbox',
307
+		'std' => '1' // Default value to show home top section
308
+	),
309 309
 
310 310
 
311
-    array(
312
-        'name' => __('Show description field as editor', 'geodirectory'),
313
-        'desc' => __('Select post types to show advanced editor on add listing page.', 'geodirectory'),
314
-        'tip' => '',
315
-        'id' => 'geodir_tiny_editor_on_add_listing',
316
-        'css' => 'min-width:300px;',
317
-        'std' => array(),
318
-        'type' => 'multiselect',
319
-        'placeholder_text' => __('Select post types', 'geodirectory'),
320
-        'class' => 'chosen_select',
321
-        'options' => array_unique(geodir_post_type_setting_fun())
322
-    ),
311
+	array(
312
+		'name' => __('Show description field as editor', 'geodirectory'),
313
+		'desc' => __('Select post types to show advanced editor on add listing page.', 'geodirectory'),
314
+		'tip' => '',
315
+		'id' => 'geodir_tiny_editor_on_add_listing',
316
+		'css' => 'min-width:300px;',
317
+		'std' => array(),
318
+		'type' => 'multiselect',
319
+		'placeholder_text' => __('Select post types', 'geodirectory'),
320
+		'class' => 'chosen_select',
321
+		'options' => array_unique(geodir_post_type_setting_fun())
322
+	),
323 323
 
324
-    array('type' => 'sectionend', 'id' => 'geodir_add_listing_gen_settings'),
325
-    /* Listing Layout Settings end */
324
+	array('type' => 'sectionend', 'id' => 'geodir_add_listing_gen_settings'),
325
+	/* Listing Layout Settings end */
326 326
 
327 327
 
328
-    /* Search Layout Settings end */
328
+	/* Search Layout Settings end */
329 329
 
330
-    array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_search_settings '),
330
+	array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_search_settings '),
331 331
 
332 332
 
333
-    array('name' => __('Search Page Layout Settings', 'geodirectory'),
334
-        'type' => 'sectionstart',
335
-        'desc' => '',
336
-        'id' => 'geodir_search_layout'),
333
+	array('name' => __('Search Page Layout Settings', 'geodirectory'),
334
+		'type' => 'sectionstart',
335
+		'desc' => '',
336
+		'id' => 'geodir_search_layout'),
337 337
 
338
-    array(
339
-        'name' => __('Search top section', 'geodirectory'),
340
-        'desc' => __('Show the top section of search page', 'geodirectory'),
341
-        'id' => 'geodir_show_search_top_section',
342
-        'type' => 'checkbox',
343
-        'std' => '1' // Default value to show home top section
344
-    ),
338
+	array(
339
+		'name' => __('Search top section', 'geodirectory'),
340
+		'desc' => __('Show the top section of search page', 'geodirectory'),
341
+		'id' => 'geodir_show_search_top_section',
342
+		'type' => 'checkbox',
343
+		'std' => '1' // Default value to show home top section
344
+	),
345 345
 
346
-    array(
347
-        'name' => __('Search right section', 'geodirectory'),
348
-        'desc' => __('Show the right section of search page', 'geodirectory'),
349
-        'id' => 'geodir_show_search_right_section',
350
-        'type' => 'checkbox',
351
-        'std' => '1' // Default value to show home top section
352
-    ),
346
+	array(
347
+		'name' => __('Search right section', 'geodirectory'),
348
+		'desc' => __('Show the right section of search page', 'geodirectory'),
349
+		'id' => 'geodir_show_search_right_section',
350
+		'type' => 'checkbox',
351
+		'std' => '1' // Default value to show home top section
352
+	),
353 353
 
354
-    array(
355
-        'name' => __('Width of search right section', 'geodirectory'),
356
-        'desc' => __('Enter the width of right section of search page in %', 'geodirectory'),
357
-        'id' => 'geodir_width_search_right_section',
358
-        'type' => 'text',
359
-        'css' => 'min-width:300px;',
360
-        'std' => '30' // Default value to show home top section
361
-    ),
354
+	array(
355
+		'name' => __('Width of search right section', 'geodirectory'),
356
+		'desc' => __('Enter the width of right section of search page in %', 'geodirectory'),
357
+		'id' => 'geodir_width_search_right_section',
358
+		'type' => 'text',
359
+		'css' => 'min-width:300px;',
360
+		'std' => '30' // Default value to show home top section
361
+	),
362 362
 
363 363
 
364
-    array(
365
-        'name' => __('Search content section view', 'geodirectory'),
366
-        'desc' => __('Set the listing view of search page', 'geodirectory'),
367
-        'id' => 'geodir_search_view',
368
-        'css' => 'min-width:300px;',
369
-        'std' => 'gridview_onehalf',
370
-        'type' => 'select',
371
-        'class' => 'chosen_select',
372
-        'options' => array_unique(array(
373
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
374
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
375
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
376
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
377
-            'listview' => __('List view', 'geodirectory'),
378
-        ))
379
-    ),
364
+	array(
365
+		'name' => __('Search content section view', 'geodirectory'),
366
+		'desc' => __('Set the listing view of search page', 'geodirectory'),
367
+		'id' => 'geodir_search_view',
368
+		'css' => 'min-width:300px;',
369
+		'std' => 'gridview_onehalf',
370
+		'type' => 'select',
371
+		'class' => 'chosen_select',
372
+		'options' => array_unique(array(
373
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
374
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
375
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
376
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
377
+			'listview' => __('List view', 'geodirectory'),
378
+		))
379
+	),
380 380
 
381
-    array(
382
-        'name' => __('Width of search content section', 'geodirectory'),
383
-        'desc' => __('Enter the width of content section of search page in %', 'geodirectory'),
384
-        'id' => 'geodir_width_search_contant_section',
385
-        'type' => 'text',
386
-        'css' => 'min-width:300px;',
387
-        'std' => '63' // Default value to show home top section
388
-    ),
381
+	array(
382
+		'name' => __('Width of search content section', 'geodirectory'),
383
+		'desc' => __('Enter the width of content section of search page in %', 'geodirectory'),
384
+		'id' => 'geodir_width_search_contant_section',
385
+		'type' => 'text',
386
+		'css' => 'min-width:300px;',
387
+		'std' => '63' // Default value to show home top section
388
+	),
389 389
 
390
-    array(
391
-        'name' => __('Search left section', 'geodirectory'),
392
-        'desc' => __('Show the left section of search page', 'geodirectory'),
393
-        'id' => 'geodir_show_search_left_section',
394
-        'type' => 'checkbox',
395
-        'std' => '0' // Default value to show home top section
396
-    ),
390
+	array(
391
+		'name' => __('Search left section', 'geodirectory'),
392
+		'desc' => __('Show the left section of search page', 'geodirectory'),
393
+		'id' => 'geodir_show_search_left_section',
394
+		'type' => 'checkbox',
395
+		'std' => '0' // Default value to show home top section
396
+	),
397 397
 
398
-    array(
399
-        'name' => __('Width of search left section', 'geodirectory'),
400
-        'desc' => __('Enter the width of left section of search in %', 'geodirectory'),
401
-        'id' => 'geodir_width_search_left_section',
402
-        'type' => 'text',
403
-        'css' => 'min-width:300px;',
404
-        'std' => '30' // Default value to show home top section
405
-    ),
398
+	array(
399
+		'name' => __('Width of search left section', 'geodirectory'),
400
+		'desc' => __('Enter the width of left section of search in %', 'geodirectory'),
401
+		'id' => 'geodir_width_search_left_section',
402
+		'type' => 'text',
403
+		'css' => 'min-width:300px;',
404
+		'std' => '30' // Default value to show home top section
405
+	),
406 406
 
407
-    array(
408
-        'name' => __('Search bottom section', 'geodirectory'),
409
-        'desc' => __('Show the bottom section of search page', 'geodirectory'),
410
-        'id' => 'geodir_show_search_bottom_section',
411
-        'type' => 'checkbox',
412
-        'std' => '0' // Default value to show home top section
413
-    ),
407
+	array(
408
+		'name' => __('Search bottom section', 'geodirectory'),
409
+		'desc' => __('Show the bottom section of search page', 'geodirectory'),
410
+		'id' => 'geodir_show_search_bottom_section',
411
+		'type' => 'checkbox',
412
+		'std' => '0' // Default value to show home top section
413
+	),
414 414
 	
415 415
 	array(
416
-        'name' => __('Show advanced pagination details', 'geodirectory'),
417
-        'desc' => __('This will add extra pagination info like "Showing listings x-y of z" aftre/before pagination.', 'geodirectory'),
418
-        'id' => 'geodir_pagination_advance_info',
419
-        'css' => 'min-width:300px;',
420
-        'std' => '',
421
-        'type' => 'select',
422
-        'class' => 'chosen_select',
423
-        'options' => array(
416
+		'name' => __('Show advanced pagination details', 'geodirectory'),
417
+		'desc' => __('This will add extra pagination info like "Showing listings x-y of z" aftre/before pagination.', 'geodirectory'),
418
+		'id' => 'geodir_pagination_advance_info',
419
+		'css' => 'min-width:300px;',
420
+		'std' => '',
421
+		'type' => 'select',
422
+		'class' => 'chosen_select',
423
+		'options' => array(
424 424
 						'' => __('Never Display', 'geodirectory'),
425 425
 						'after' => __('After Pagination', 'geodirectory'),
426 426
 						'before' => __('Before Pagination', 'geodirectory')
427 427
 					)
428
-    ),
428
+	),
429 429
 
430
-    array('type' => 'sectionend', 'id' => 'geodir_search_layout'),
430
+	array('type' => 'sectionend', 'id' => 'geodir_search_layout'),
431 431
 
432 432
 
433
-    array('name' => __('Search form default text settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_search_form_default_text_settings'),
433
+	array('name' => __('Search form default text settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_search_form_default_text_settings'),
434 434
 
435
-    array(
436
-        'name' => __('Search field default value', 'geodirectory'),
437
-        'desc' => __('Show the search text box \'placeholder\' value on search form.', 'geodirectory'),
438
-        'id' => 'geodir_search_field_default_text',
439
-        'type' => 'text',
440
-        'css' => 'min-width:300px;',
441
-        'std' => 'Search for' // show on the listing page.
442
-    ),
435
+	array(
436
+		'name' => __('Search field default value', 'geodirectory'),
437
+		'desc' => __('Show the search text box \'placeholder\' value on search form.', 'geodirectory'),
438
+		'id' => 'geodir_search_field_default_text',
439
+		'type' => 'text',
440
+		'css' => 'min-width:300px;',
441
+		'std' => 'Search for' // show on the listing page.
442
+	),
443 443
 
444
-    array(
445
-        'name' => __('Near field default value', 'geodirectory'),
446
-        'desc' => __('Show the near text box \'placeholder\' value on search form.', 'geodirectory'),
447
-        'id' => 'geodir_near_field_default_text',
448
-        'type' => 'text',
449
-        'css' => 'min-width:300px;',
450
-        'std' => 'Near' // show on the listing page.
451
-    ),
444
+	array(
445
+		'name' => __('Near field default value', 'geodirectory'),
446
+		'desc' => __('Show the near text box \'placeholder\' value on search form.', 'geodirectory'),
447
+		'id' => 'geodir_near_field_default_text',
448
+		'type' => 'text',
449
+		'css' => 'min-width:300px;',
450
+		'std' => 'Near' // show on the listing page.
451
+	),
452 452
 
453
-    array(
454
-        'name' => __('Search button label', 'geodirectory'),
455
-        'desc' => __('Show the search button label on search form.', 'geodirectory'),
456
-        'id' => 'geodir_search_button_label',
457
-        'type' => 'text',
458
-        'css' => 'min-width:300px;',
459
-        'std' => 'Search' // show on the listing page.
460
-    ),
453
+	array(
454
+		'name' => __('Search button label', 'geodirectory'),
455
+		'desc' => __('Show the search button label on search form.', 'geodirectory'),
456
+		'id' => 'geodir_search_button_label',
457
+		'type' => 'text',
458
+		'css' => 'min-width:300px;',
459
+		'std' => 'Search' // show on the listing page.
460
+	),
461 461
 
462
-    array('type' => 'sectionend', 'id' => 'geodir_search_form_default_text_settings'),
462
+	array('type' => 'sectionend', 'id' => 'geodir_search_form_default_text_settings'),
463 463
 
464
-    /* Listing Layout Settings end */
464
+	/* Listing Layout Settings end */
465 465
 
466 466
 
467
-    /* Detail Layout Settings end */
467
+	/* Detail Layout Settings end */
468 468
 
469
-    array('name' => __('Detail', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_detail_settings '),
469
+	array('name' => __('Detail', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_detail_settings '),
470 470
 
471
-    array('name' => __('Detail/Single Page Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_settings '),
471
+	array('name' => __('Detail/Single Page Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_settings '),
472 472
 
473
-    array(
474
-        'name' => __('Detail top section', 'geodirectory'),
475
-        'desc' => __('Show the top section of listing page', 'geodirectory'),
476
-        'id' => 'geodir_show_detail_top_section',
477
-        'type' => 'checkbox',
478
-        'std' => '1' // Default value to show home top section
479
-    ),
473
+	array(
474
+		'name' => __('Detail top section', 'geodirectory'),
475
+		'desc' => __('Show the top section of listing page', 'geodirectory'),
476
+		'id' => 'geodir_show_detail_top_section',
477
+		'type' => 'checkbox',
478
+		'std' => '1' // Default value to show home top section
479
+	),
480 480
 
481
-    array(
482
-        'name' => __('Detail bottom section', 'geodirectory'),
483
-        'desc' => __('Show the bottom section of listing page', 'geodirectory'),
484
-        'id' => 'geodir_show_detail_bottom_section',
485
-        'type' => 'checkbox',
486
-        'std' => '1' // Default value to show home top section
487
-    ),
488
-    array(
489
-        'name' => __('Detail sidebar section on left side', 'geodirectory'),
490
-        'desc' => __('Display detail sidebar section on left side of the detail page', 'geodirectory'),
491
-        'id' => 'geodir_detail_sidebar_left_section',
492
-        'type' => 'checkbox',
493
-        'std' => '0'
494
-    ),
495
-    array(
496
-        'name' => __('Disable GD modal', 'geodirectory'),
497
-        'desc' => __('Disable GD modal that displays slideshow images in popup', 'geodirectory'),
498
-        'id' => 'geodir_disable_gb_modal',
499
-        'type' => 'checkbox',
500
-        'std' => '0'
501
-    ),
502
-    array(
503
-        'name' => __('Disable Tweet, Fb Like, Google+ buttons section', 'geodirectory'),
504
-        'desc' => __('Disable Tweet, Fb Like, Google+ buttons section that displays on Detail page sidebar', 'geodirectory'),
505
-        'id' => 'geodir_disable_tfg_buttons_section',
506
-        'type' => 'checkbox',
507
-        'std' => '0'
508
-    ),
509
-    array(
510
-        'name' => __('Disable share this button section', 'geodirectory'),
511
-        'desc' => __('Disable share this button section that displays on Detail page sidebar', 'geodirectory'),
512
-        'id' => 'geodir_disable_sharethis_button_section',
513
-        'type' => 'checkbox',
514
-        'std' => '0'
515
-    ),
516
-    array(
517
-        'name' => __('Disable Google Analytics section', 'geodirectory'),
518
-        'desc' => __('Disable Google Analytics section that displays on Detail page sidebar', 'geodirectory'),
519
-        'id' => 'geodir_disable_google_analytics_section',
520
-        'type' => 'checkbox',
521
-        'std' => '0'
522
-    ),
523
-    array(
524
-        'name' => __('Disable User Links section', 'geodirectory'),
525
-        'desc' => __('Disable User Links section (Edit post, Favorite etc..) that displays on Detail page sidebar', 'geodirectory'),
526
-        'id' => 'geodir_disable_user_links_section',
527
-        'type' => 'checkbox',
528
-        'std' => '0'
529
-    ),
530
-    array(
531
-        'name' => __('Disable Rating Info section', 'geodirectory'),
532
-        'desc' => __('Disable Rating Info section that displays on Detail page sidebar', 'geodirectory'),
533
-        'id' => 'geodir_disable_rating_info_section',
534
-        'type' => 'checkbox',
535
-        'std' => '0'
536
-    ),
537
-    array(
538
-        'name' => __('Disable Listing Info section', 'geodirectory'),
539
-        'desc' => __('Disable Listing Info section that displays on Detail page sidebar', 'geodirectory'),
540
-        'id' => 'geodir_disable_listing_info_section',
541
-        'type' => 'checkbox',
542
-        'std' => '0'
543
-    ),
481
+	array(
482
+		'name' => __('Detail bottom section', 'geodirectory'),
483
+		'desc' => __('Show the bottom section of listing page', 'geodirectory'),
484
+		'id' => 'geodir_show_detail_bottom_section',
485
+		'type' => 'checkbox',
486
+		'std' => '1' // Default value to show home top section
487
+	),
488
+	array(
489
+		'name' => __('Detail sidebar section on left side', 'geodirectory'),
490
+		'desc' => __('Display detail sidebar section on left side of the detail page', 'geodirectory'),
491
+		'id' => 'geodir_detail_sidebar_left_section',
492
+		'type' => 'checkbox',
493
+		'std' => '0'
494
+	),
495
+	array(
496
+		'name' => __('Disable GD modal', 'geodirectory'),
497
+		'desc' => __('Disable GD modal that displays slideshow images in popup', 'geodirectory'),
498
+		'id' => 'geodir_disable_gb_modal',
499
+		'type' => 'checkbox',
500
+		'std' => '0'
501
+	),
502
+	array(
503
+		'name' => __('Disable Tweet, Fb Like, Google+ buttons section', 'geodirectory'),
504
+		'desc' => __('Disable Tweet, Fb Like, Google+ buttons section that displays on Detail page sidebar', 'geodirectory'),
505
+		'id' => 'geodir_disable_tfg_buttons_section',
506
+		'type' => 'checkbox',
507
+		'std' => '0'
508
+	),
509
+	array(
510
+		'name' => __('Disable share this button section', 'geodirectory'),
511
+		'desc' => __('Disable share this button section that displays on Detail page sidebar', 'geodirectory'),
512
+		'id' => 'geodir_disable_sharethis_button_section',
513
+		'type' => 'checkbox',
514
+		'std' => '0'
515
+	),
516
+	array(
517
+		'name' => __('Disable Google Analytics section', 'geodirectory'),
518
+		'desc' => __('Disable Google Analytics section that displays on Detail page sidebar', 'geodirectory'),
519
+		'id' => 'geodir_disable_google_analytics_section',
520
+		'type' => 'checkbox',
521
+		'std' => '0'
522
+	),
523
+	array(
524
+		'name' => __('Disable User Links section', 'geodirectory'),
525
+		'desc' => __('Disable User Links section (Edit post, Favorite etc..) that displays on Detail page sidebar', 'geodirectory'),
526
+		'id' => 'geodir_disable_user_links_section',
527
+		'type' => 'checkbox',
528
+		'std' => '0'
529
+	),
530
+	array(
531
+		'name' => __('Disable Rating Info section', 'geodirectory'),
532
+		'desc' => __('Disable Rating Info section that displays on Detail page sidebar', 'geodirectory'),
533
+		'id' => 'geodir_disable_rating_info_section',
534
+		'type' => 'checkbox',
535
+		'std' => '0'
536
+	),
537
+	array(
538
+		'name' => __('Disable Listing Info section', 'geodirectory'),
539
+		'desc' => __('Disable Listing Info section that displays on Detail page sidebar', 'geodirectory'),
540
+		'id' => 'geodir_disable_listing_info_section',
541
+		'type' => 'checkbox',
542
+		'std' => '0'
543
+	),
544 544
 
545
-    array('type' => 'sectionend', 'id' => 'detail_page_settings'),
545
+	array('type' => 'sectionend', 'id' => 'detail_page_settings'),
546 546
 
547 547
 
548
-    /* ---------- DETAIL PAGE TAB SETTING START*/
548
+	/* ---------- DETAIL PAGE TAB SETTING START*/
549 549
 
550
-    array('name' => __('Detail Page Tab Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_detail_page_tab_settings '),
550
+	array('name' => __('Detail Page Tab Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_detail_page_tab_settings '),
551 551
 
552
-    array(
553
-        'name' => __('Exclude selected tabs from detail page', 'geodirectory'),
554
-        'desc' => __('Select tabs to exclude from the list of all appearing tabs on detail page.', 'geodirectory'),
555
-        'tip' => '',
556
-        'id' => 'geodir_detail_page_tabs_excluded',
557
-        'css' => 'min-width:300px;',
558
-        'std' => geodir_get_posttypes(),
559
-        'type' => 'multiselect',
560
-        'placeholder_text' => __('Select tabs', 'geodirectory'),
561
-        'class' => 'chosen_select',
562
-        'options' => array_unique(geodir_detail_page_tabs_key_value_array())
563
-    ),
552
+	array(
553
+		'name' => __('Exclude selected tabs from detail page', 'geodirectory'),
554
+		'desc' => __('Select tabs to exclude from the list of all appearing tabs on detail page.', 'geodirectory'),
555
+		'tip' => '',
556
+		'id' => 'geodir_detail_page_tabs_excluded',
557
+		'css' => 'min-width:300px;',
558
+		'std' => geodir_get_posttypes(),
559
+		'type' => 'multiselect',
560
+		'placeholder_text' => __('Select tabs', 'geodirectory'),
561
+		'class' => 'chosen_select',
562
+		'options' => array_unique(geodir_detail_page_tabs_key_value_array())
563
+	),
564 564
 
565 565
 
566
-    array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
567
-    /* ---------- DETAIL PAGE TAB SETTING END*/
566
+	array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
567
+	/* ---------- DETAIL PAGE TAB SETTING END*/
568 568
 
569
-    /* START DEFAULT STAR IMAGE*/
570
-    array('name' => __('Default Rating Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_rating_settings '),
569
+	/* START DEFAULT STAR IMAGE*/
570
+	array('name' => __('Default Rating Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_rating_settings '),
571 571
 
572
-    array(
573
-        'name' => __('Upload default rating star icon', 'geodirectory'),
574
-        'desc' => '',
575
-        'id' => 'geodir_default_rating_star_icon',
576
-        'type' => 'file',
577
-        'std' => '0',
578
-        'value' => geodir_plugin_url() . '/geodirectory-assets/images/stars.png'// Default value to show home top section
579
-    ),
572
+	array(
573
+		'name' => __('Upload default rating star icon', 'geodirectory'),
574
+		'desc' => '',
575
+		'id' => 'geodir_default_rating_star_icon',
576
+		'type' => 'file',
577
+		'std' => '0',
578
+		'value' => geodir_plugin_url() . '/geodirectory-assets/images/stars.png'// Default value to show home top section
579
+	),
580 580
 	array(
581 581
 		'name' => __('Enable Font Awesome', 'geodirectory'),
582 582
 		'desc' => __('When enabled all rating images will be using font awesome rating icons as images.', 'geodirectory' ),
@@ -592,368 +592,368 @@  discard block
 block discarded – undo
592 592
 		'std' => '#757575'
593 593
 	),
594 594
 
595
-    array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
595
+	array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
596 596
 
597
-    /* END DEFAULT STAR IMAGE*/
597
+	/* END DEFAULT STAR IMAGE*/
598 598
 
599
-    /* Detail related post settings start */
599
+	/* Detail related post settings start */
600 600
 
601
-    array('name' => __('Related Post Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_related_post_settings '),
601
+	array('name' => __('Related Post Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_related_post_settings '),
602 602
 
603
-    array(
604
-        'name' => __('Show related post listing on', 'geodirectory'),
605
-        'desc' => __('Select the post types to display related listing on detail page.', 'geodirectory'),
606
-        'tip' => '',
607
-        'id' => 'geodir_add_related_listing_posttypes',
608
-        'css' => 'min-width:300px;',
609
-        'std' => geodir_get_posttypes(),
610
-        'type' => 'multiselect',
611
-        'placeholder_text' => __('Select post types', 'geodirectory'),
612
-        'class' => 'chosen_select',
613
-        'options' => array_unique(geodir_post_type_setting_fun())
614
-    ),
603
+	array(
604
+		'name' => __('Show related post listing on', 'geodirectory'),
605
+		'desc' => __('Select the post types to display related listing on detail page.', 'geodirectory'),
606
+		'tip' => '',
607
+		'id' => 'geodir_add_related_listing_posttypes',
608
+		'css' => 'min-width:300px;',
609
+		'std' => geodir_get_posttypes(),
610
+		'type' => 'multiselect',
611
+		'placeholder_text' => __('Select post types', 'geodirectory'),
612
+		'class' => 'chosen_select',
613
+		'options' => array_unique(geodir_post_type_setting_fun())
614
+	),
615 615
 
616
-    array(
617
-        'name' => __('Relate to', 'geodirectory'),
618
-        'desc' => __('Set the relation between current post to related posts.', 'geodirectory'),
619
-        'id' => 'geodir_related_post_relate_to',
620
-        'css' => 'min-width:300px;',
621
-        'std' => 'category',
622
-        'type' => 'select',
623
-        'class' => 'chosen_select',
624
-        'options' => array_unique(array(
625
-            'category' => __('Categories', 'geodirectory'),
626
-            'tags' => __('Tags', 'geodirectory'),
627
-        ))
628
-    ),
616
+	array(
617
+		'name' => __('Relate to', 'geodirectory'),
618
+		'desc' => __('Set the relation between current post to related posts.', 'geodirectory'),
619
+		'id' => 'geodir_related_post_relate_to',
620
+		'css' => 'min-width:300px;',
621
+		'std' => 'category',
622
+		'type' => 'select',
623
+		'class' => 'chosen_select',
624
+		'options' => array_unique(array(
625
+			'category' => __('Categories', 'geodirectory'),
626
+			'tags' => __('Tags', 'geodirectory'),
627
+		))
628
+	),
629 629
 
630
-    array(
631
-        'name' => __('Layout', 'geodirectory'),
632
-        'desc' => __('Set the listing view of relate post on detail page', 'geodirectory'),
633
-        'id' => 'geodir_related_post_listing_view',
634
-        'css' => 'min-width:300px;',
635
-        'std' => 'gridview_onehalf',
636
-        'type' => 'select',
637
-        'class' => 'chosen_select',
638
-        'options' => array_unique(array(
639
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
640
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
641
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
642
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
643
-            'listview' => __('List view', 'geodirectory'),
644
-        ))
645
-    ),
630
+	array(
631
+		'name' => __('Layout', 'geodirectory'),
632
+		'desc' => __('Set the listing view of relate post on detail page', 'geodirectory'),
633
+		'id' => 'geodir_related_post_listing_view',
634
+		'css' => 'min-width:300px;',
635
+		'std' => 'gridview_onehalf',
636
+		'type' => 'select',
637
+		'class' => 'chosen_select',
638
+		'options' => array_unique(array(
639
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
640
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
641
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
642
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
643
+			'listview' => __('List view', 'geodirectory'),
644
+		))
645
+	),
646 646
 
647
-    array(
648
-        'name' => __('Sort by', 'geodirectory'),
649
-        'desc' => __('Set the related post listing sort by view', 'geodirectory'),
650
-        'id' => 'geodir_related_post_sortby',
651
-        'css' => 'min-width:300px;',
652
-        'std' => 'latest',
653
-        'type' => 'select',
654
-        'class' => 'chosen_select',
655
-        'options' => array_unique(array(
656
-            'latest' => __('Latest', 'geodirectory'),
657
-            'featured' => __('Featured', 'geodirectory'),
658
-            'high_review' => __('Review', 'geodirectory'),
659
-            'high_rating' => __('Rating', 'geodirectory'),
660
-            'random' => __('Random', 'geodirectory'),
661
-        ))
662
-    ),
647
+	array(
648
+		'name' => __('Sort by', 'geodirectory'),
649
+		'desc' => __('Set the related post listing sort by view', 'geodirectory'),
650
+		'id' => 'geodir_related_post_sortby',
651
+		'css' => 'min-width:300px;',
652
+		'std' => 'latest',
653
+		'type' => 'select',
654
+		'class' => 'chosen_select',
655
+		'options' => array_unique(array(
656
+			'latest' => __('Latest', 'geodirectory'),
657
+			'featured' => __('Featured', 'geodirectory'),
658
+			'high_review' => __('Review', 'geodirectory'),
659
+			'high_rating' => __('Rating', 'geodirectory'),
660
+			'random' => __('Random', 'geodirectory'),
661
+		))
662
+	),
663 663
 
664
-    array(
665
-        'name' => __('Number of posts:', 'geodirectory'),
666
-        'desc' => __('Enter number of posts to display on related posts listing', 'geodirectory'),
667
-        'id' => 'geodir_related_post_count',
668
-        'type' => 'text',
669
-        'css' => 'min-width:300px;',
670
-        'std' => '5' // Default value to show home top section
671
-    ),
664
+	array(
665
+		'name' => __('Number of posts:', 'geodirectory'),
666
+		'desc' => __('Enter number of posts to display on related posts listing', 'geodirectory'),
667
+		'id' => 'geodir_related_post_count',
668
+		'type' => 'text',
669
+		'css' => 'min-width:300px;',
670
+		'std' => '5' // Default value to show home top section
671
+	),
672 672
 
673
-    array(
674
-        'name' => __('Post excerpt', 'geodirectory'),
675
-        'desc' => __('Post content excerpt character count', 'geodirectory'),
676
-        'id' => 'geodir_related_post_excerpt',
677
-        'type' => 'text',
678
-        'css' => 'min-width:300px;',
679
-        'std' => '20' // Default value to show home top section
680
-    ),
673
+	array(
674
+		'name' => __('Post excerpt', 'geodirectory'),
675
+		'desc' => __('Post content excerpt character count', 'geodirectory'),
676
+		'id' => 'geodir_related_post_excerpt',
677
+		'type' => 'text',
678
+		'css' => 'min-width:300px;',
679
+		'std' => '20' // Default value to show home top section
680
+	),
681 681
 
682 682
 
683
-    array('type' => 'sectionend', 'id' => 'detail_page_related_post_settings'),
684
-    /* Detail Layout Settings end */
683
+	array('type' => 'sectionend', 'id' => 'detail_page_related_post_settings'),
684
+	/* Detail Layout Settings end */
685 685
 
686
-    /* Author Layout Settings Start */
686
+	/* Author Layout Settings Start */
687 687
 
688
-    array('name' => __('Author', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_author_settings '),
688
+	array('name' => __('Author', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_author_settings '),
689 689
 
690 690
 
691
-    array('name' => __('Author Page Layout Settings', 'geodirectory'),
692
-        'type' => 'sectionstart',
693
-        'desc' => '',
694
-        'id' => 'geodir_author_layout'),
691
+	array('name' => __('Author Page Layout Settings', 'geodirectory'),
692
+		'type' => 'sectionstart',
693
+		'desc' => '',
694
+		'id' => 'geodir_author_layout'),
695 695
 
696
-    array(
697
-        'name' => __('Author top section', 'geodirectory'),
698
-        'desc' => __('Show the top section of author page', 'geodirectory'),
699
-        'id' => 'geodir_show_author_top_section',
700
-        'type' => 'checkbox',
701
-        'std' => '1' // Default value to show home top section
702
-    ),
696
+	array(
697
+		'name' => __('Author top section', 'geodirectory'),
698
+		'desc' => __('Show the top section of author page', 'geodirectory'),
699
+		'id' => 'geodir_show_author_top_section',
700
+		'type' => 'checkbox',
701
+		'std' => '1' // Default value to show home top section
702
+	),
703 703
 
704
-    array(
705
-        'name' => __('Author right section', 'geodirectory'),
706
-        'desc' => __('Show the right section of author page', 'geodirectory'),
707
-        'id' => 'geodir_show_author_right_section',
708
-        'type' => 'checkbox',
709
-        'std' => '1' // Default value to show home top section
710
-    ),
704
+	array(
705
+		'name' => __('Author right section', 'geodirectory'),
706
+		'desc' => __('Show the right section of author page', 'geodirectory'),
707
+		'id' => 'geodir_show_author_right_section',
708
+		'type' => 'checkbox',
709
+		'std' => '1' // Default value to show home top section
710
+	),
711 711
 
712
-    array(
713
-        'name' => __('Width of author right section', 'geodirectory'),
714
-        'desc' => __('Enter the width of right section of author page in %', 'geodirectory'),
715
-        'id' => 'geodir_width_author_right_section',
716
-        'type' => 'text',
717
-        'css' => 'min-width:300px;',
718
-        'std' => '30' // Default value to show home top section
719
-    ),
712
+	array(
713
+		'name' => __('Width of author right section', 'geodirectory'),
714
+		'desc' => __('Enter the width of right section of author page in %', 'geodirectory'),
715
+		'id' => 'geodir_width_author_right_section',
716
+		'type' => 'text',
717
+		'css' => 'min-width:300px;',
718
+		'std' => '30' // Default value to show home top section
719
+	),
720 720
 
721
-    array(
722
-        'name' => __('Author content section view', 'geodirectory'),
723
-        'desc' => __('Set the listing view of author page', 'geodirectory'),
724
-        'id' => 'geodir_author_view',
725
-        'css' => 'min-width:300px;',
726
-        'std' => 'gridview_onehalf',
727
-        'type' => 'select',
728
-        'class' => 'chosen_select',
729
-        'options' => array_unique(array(
730
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
731
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
732
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
733
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
734
-            'listview' => __('List view', 'geodirectory'),
735
-        ))
736
-    ),
721
+	array(
722
+		'name' => __('Author content section view', 'geodirectory'),
723
+		'desc' => __('Set the listing view of author page', 'geodirectory'),
724
+		'id' => 'geodir_author_view',
725
+		'css' => 'min-width:300px;',
726
+		'std' => 'gridview_onehalf',
727
+		'type' => 'select',
728
+		'class' => 'chosen_select',
729
+		'options' => array_unique(array(
730
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
731
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
732
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
733
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
734
+			'listview' => __('List view', 'geodirectory'),
735
+		))
736
+	),
737 737
 
738
-    array(
739
-        'name' => __('Width of author content section', 'geodirectory'),
740
-        'desc' => __('Enter the width of content section of author page in %', 'geodirectory'),
741
-        'id' => 'geodir_width_author_contant_section',
742
-        'type' => 'text',
743
-        'css' => 'min-width:300px;',
744
-        'std' => '63' // Default value to show home top section
745
-    ),
738
+	array(
739
+		'name' => __('Width of author content section', 'geodirectory'),
740
+		'desc' => __('Enter the width of content section of author page in %', 'geodirectory'),
741
+		'id' => 'geodir_width_author_contant_section',
742
+		'type' => 'text',
743
+		'css' => 'min-width:300px;',
744
+		'std' => '63' // Default value to show home top section
745
+	),
746 746
 
747
-    array(
748
-        'name' => __('Author left section', 'geodirectory'),
749
-        'desc' => __('Show the left section of author page', 'geodirectory'),
750
-        'id' => 'geodir_show_author_left_section',
751
-        'type' => 'checkbox',
752
-        'std' => '0' // Default value to show home top section
753
-    ),
747
+	array(
748
+		'name' => __('Author left section', 'geodirectory'),
749
+		'desc' => __('Show the left section of author page', 'geodirectory'),
750
+		'id' => 'geodir_show_author_left_section',
751
+		'type' => 'checkbox',
752
+		'std' => '0' // Default value to show home top section
753
+	),
754 754
 
755
-    array(
756
-        'name' => __('Width of author left section', 'geodirectory'),
757
-        'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
758
-        'id' => 'geodir_width_author_left_section',
759
-        'type' => 'text',
760
-        'css' => 'min-width:300px;',
761
-        'std' => '30' // Default value to show home top section
762
-    ),
755
+	array(
756
+		'name' => __('Width of author left section', 'geodirectory'),
757
+		'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
758
+		'id' => 'geodir_width_author_left_section',
759
+		'type' => 'text',
760
+		'css' => 'min-width:300px;',
761
+		'std' => '30' // Default value to show home top section
762
+	),
763 763
 
764
-    array(
765
-        'name' => __('Author bottom section', 'geodirectory'),
766
-        'desc' => __('Show the bottom section of author page', 'geodirectory'),
767
-        'id' => 'geodir_show_author_bottom_section',
768
-        'type' => 'checkbox',
769
-        'std' => '0' // Default value to show home top section
770
-    ),
764
+	array(
765
+		'name' => __('Author bottom section', 'geodirectory'),
766
+		'desc' => __('Show the bottom section of author page', 'geodirectory'),
767
+		'id' => 'geodir_show_author_bottom_section',
768
+		'type' => 'checkbox',
769
+		'std' => '0' // Default value to show home top section
770
+	),
771 771
 
772 772
 
773
-    array(
774
-        'name' => __('Description word limit', 'geodirectory'),
775
-        'desc' => '',
776
-        'id' => 'geodir_author_desc_word_limit',
777
-        'type' => 'text',
778
-        'css' => 'min-width:300px;',
779
-        'std' => '50' // Default value to show home top section
780
-    ),
773
+	array(
774
+		'name' => __('Description word limit', 'geodirectory'),
775
+		'desc' => '',
776
+		'id' => 'geodir_author_desc_word_limit',
777
+		'type' => 'text',
778
+		'css' => 'min-width:300px;',
779
+		'std' => '50' // Default value to show home top section
780
+	),
781 781
 
782
-    array('type' => 'sectionend', 'id' => 'geodir_author_layout'),
783
-    /* Author Layout Settings end */
782
+	array('type' => 'sectionend', 'id' => 'geodir_author_layout'),
783
+	/* Author Layout Settings end */
784 784
 
785 785
 
786
-    /* Post Type Navigation Settings Start */
787
-    array('name' => __('Navigation', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_navigation_settings'),
786
+	/* Post Type Navigation Settings Start */
787
+	array('name' => __('Navigation', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_navigation_settings'),
788 788
 
789 789
 
790
-    /* Post Type Navigation Settings Start */
790
+	/* Post Type Navigation Settings Start */
791 791
 
792
-    array('name' => __('Navigation Locations', 'geodirectory'),
793
-        'type' => 'sectionstart',
794
-        'desc' => '',
795
-        'id' => 'geodir_navigation_locations'),
792
+	array('name' => __('Navigation Locations', 'geodirectory'),
793
+		'type' => 'sectionstart',
794
+		'desc' => '',
795
+		'id' => 'geodir_navigation_locations'),
796 796
 
797
-    array(
798
-        'name' => __('Show geodirectory navigation in selected menu locations', 'geodirectory'),
799
-        'desc' => '',
800
-        'tip' => '',
801
-        'id' => 'geodir_theme_location_nav',
802
-        'css' => 'min-width:300px;',
803
-        'std' => array(),
804
-        'type' => 'multiselect',
805
-        'placeholder_text' => __('Select menu locations', 'geodirectory'),
806
-        'class' => 'chosen_select',
807
-        'options' => array_unique(geodir_theme_location_setting_fun())
808
-    ),
809
-    array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
810
-
811
-
812
-    array('name' => __('Navigation Settings', 'geodirectory'),
813
-        'type' => 'sectionstart',
814
-        'desc' => '',
815
-        'id' => 'geodir_navigation_options'),
797
+	array(
798
+		'name' => __('Show geodirectory navigation in selected menu locations', 'geodirectory'),
799
+		'desc' => '',
800
+		'tip' => '',
801
+		'id' => 'geodir_theme_location_nav',
802
+		'css' => 'min-width:300px;',
803
+		'std' => array(),
804
+		'type' => 'multiselect',
805
+		'placeholder_text' => __('Select menu locations', 'geodirectory'),
806
+		'class' => 'chosen_select',
807
+		'options' => array_unique(geodir_theme_location_setting_fun())
808
+	),
809
+	array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
816 810
 
817 811
 
818
-    array(
819
-        'name' => __('Show add listing navigation in menu', 'geodirectory'),
820
-        'desc' => sprintf(__('Show add listing navigation in main menu? (untick to disable) If you disable this option, none of the add listing link will appear in main navigation.', 'geodirectory')),
821
-        'id' => 'geodir_show_addlisting_nav',
822
-        'std' => '1',
823
-        'type' => 'checkbox'
824
-    ),
812
+	array('name' => __('Navigation Settings', 'geodirectory'),
813
+		'type' => 'sectionstart',
814
+		'desc' => '',
815
+		'id' => 'geodir_navigation_options'),
825 816
 
826
-    array(
827
-        'name' => __('Show listings navigation in menu', 'geodirectory'),
828
-        'desc' => sprintf(__('Show listing navigation in main menu? (untick to disable) If you disable this option, none of the listing link will appear in main navigation.', 'geodirectory')),
829
-        'id' => 'geodir_show_listing_nav',
830
-        'std' => '1',
831
-        'type' => 'checkbox'
832
-    ),
833 817
 
834
-    array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
818
+	array(
819
+		'name' => __('Show add listing navigation in menu', 'geodirectory'),
820
+		'desc' => sprintf(__('Show add listing navigation in main menu? (untick to disable) If you disable this option, none of the add listing link will appear in main navigation.', 'geodirectory')),
821
+		'id' => 'geodir_show_addlisting_nav',
822
+		'std' => '1',
823
+		'type' => 'checkbox'
824
+	),
835 825
 
826
+	array(
827
+		'name' => __('Show listings navigation in menu', 'geodirectory'),
828
+		'desc' => sprintf(__('Show listing navigation in main menu? (untick to disable) If you disable this option, none of the listing link will appear in main navigation.', 'geodirectory')),
829
+		'id' => 'geodir_show_listing_nav',
830
+		'std' => '1',
831
+		'type' => 'checkbox'
832
+	),
836 833
 
837
-    array('name' => __('Post Type Navigation Settings', 'geodirectory'),
838
-        'type' => 'sectionstart',
839
-        'desc' => '',
840
-        'id' => 'geodir_post_type_navigation_layout'),
841
-    array(
842
-        'name' => __('Show listing link in main navigation', 'geodirectory'),
843
-        'desc' => '',
844
-        'tip' => '',
845
-        'id' => 'geodir_add_posttype_in_main_nav',
846
-        'css' => 'min-width:300px;',
847
-        'std' => array(),
848
-        'type' => 'multiselect',
849
-        'placeholder_text' => __('Select post types', 'geodirectory'),
850
-        'class' => 'chosen_select',
851
-        'options' => array_unique(geodir_post_type_setting_fun())
852
-    ),
834
+	array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
853 835
 
854
-    array(
855
-        'name' => __('Show listing link in listing navigation', 'geodirectory'),
856
-        'desc' => '',
857
-        'tip' => '',
858
-        'id' => 'geodir_add_posttype_in_listing_nav',
859
-        'css' => 'min-width:300px;',
860
-        'std' => geodir_get_posttypes(),
861
-        'type' => 'multiselect',
862
-        'placeholder_text' => __('Select post types', 'geodirectory'),
863
-        'class' => 'chosen_select',
864
-        'options' => array_unique(geodir_post_type_setting_fun())
865
-    ),
866 836
 
867
-    array(
868
-        'name' => __('Allow post type to add from frontend', 'geodirectory'),
869
-        'desc' => '',
870
-        'tip' => '',
871
-        'id' => 'geodir_allow_posttype_frontend',
872
-        'css' => 'min-width:300px;',
873
-        'std' => geodir_get_posttypes(),
874
-        'type' => 'multiselect',
875
-        'placeholder_text' => __('Select post types', 'geodirectory'),
876
-        'class' => 'chosen_select',
877
-        'options' => array_unique(geodir_post_type_setting_fun())
878
-    ),
837
+	array('name' => __('Post Type Navigation Settings', 'geodirectory'),
838
+		'type' => 'sectionstart',
839
+		'desc' => '',
840
+		'id' => 'geodir_post_type_navigation_layout'),
841
+	array(
842
+		'name' => __('Show listing link in main navigation', 'geodirectory'),
843
+		'desc' => '',
844
+		'tip' => '',
845
+		'id' => 'geodir_add_posttype_in_main_nav',
846
+		'css' => 'min-width:300px;',
847
+		'std' => array(),
848
+		'type' => 'multiselect',
849
+		'placeholder_text' => __('Select post types', 'geodirectory'),
850
+		'class' => 'chosen_select',
851
+		'options' => array_unique(geodir_post_type_setting_fun())
852
+	),
879 853
 
880
-    array(
881
-        'name' => __('Show add listing link in main navigation', 'geodirectory'),
882
-        'desc' => '',
883
-        'tip' => '',
884
-        'id' => 'geodir_add_listing_link_main_nav',
885
-        'css' => 'min-width:300px;',
886
-        'std' => array(),
887
-        'type' => 'multiselect',
888
-        'placeholder_text' => __('Select post types', 'geodirectory'),
889
-        'class' => 'chosen_select',
890
-        'options' => array_unique(geodir_post_type_setting_fun())
891
-    ),
854
+	array(
855
+		'name' => __('Show listing link in listing navigation', 'geodirectory'),
856
+		'desc' => '',
857
+		'tip' => '',
858
+		'id' => 'geodir_add_posttype_in_listing_nav',
859
+		'css' => 'min-width:300px;',
860
+		'std' => geodir_get_posttypes(),
861
+		'type' => 'multiselect',
862
+		'placeholder_text' => __('Select post types', 'geodirectory'),
863
+		'class' => 'chosen_select',
864
+		'options' => array_unique(geodir_post_type_setting_fun())
865
+	),
892 866
 
893
-    array(
894
-        'name' => __('Show add listing link in add listing navigation', 'geodirectory'),
895
-        'desc' => '',
896
-        'tip' => '',
897
-        'id' => 'geodir_add_listing_link_add_listing_nav',
898
-        'css' => 'min-width:300px;',
899
-        'std' => geodir_get_posttypes(),
900
-        'type' => 'multiselect',
901
-        'class' => 'chosen_select',
902
-        'options' => array_unique(geodir_post_type_setting_fun())
903
-    ),
867
+	array(
868
+		'name' => __('Allow post type to add from frontend', 'geodirectory'),
869
+		'desc' => '',
870
+		'tip' => '',
871
+		'id' => 'geodir_allow_posttype_frontend',
872
+		'css' => 'min-width:300px;',
873
+		'std' => geodir_get_posttypes(),
874
+		'type' => 'multiselect',
875
+		'placeholder_text' => __('Select post types', 'geodirectory'),
876
+		'class' => 'chosen_select',
877
+		'options' => array_unique(geodir_post_type_setting_fun())
878
+	),
904 879
 
905
-    array('type' => 'sectionend', 'id' => 'geodir_post_type_navigation_layout'),
880
+	array(
881
+		'name' => __('Show add listing link in main navigation', 'geodirectory'),
882
+		'desc' => '',
883
+		'tip' => '',
884
+		'id' => 'geodir_add_listing_link_main_nav',
885
+		'css' => 'min-width:300px;',
886
+		'std' => array(),
887
+		'type' => 'multiselect',
888
+		'placeholder_text' => __('Select post types', 'geodirectory'),
889
+		'class' => 'chosen_select',
890
+		'options' => array_unique(geodir_post_type_setting_fun())
891
+	),
906 892
 
893
+	array(
894
+		'name' => __('Show add listing link in add listing navigation', 'geodirectory'),
895
+		'desc' => '',
896
+		'tip' => '',
897
+		'id' => 'geodir_add_listing_link_add_listing_nav',
898
+		'css' => 'min-width:300px;',
899
+		'std' => geodir_get_posttypes(),
900
+		'type' => 'multiselect',
901
+		'class' => 'chosen_select',
902
+		'options' => array_unique(geodir_post_type_setting_fun())
903
+	),
907 904
 
908
-    array('name' => __('User Dashboard Post Type Navigation Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_user_dashboard_post_type '),
905
+	array('type' => 'sectionend', 'id' => 'geodir_post_type_navigation_layout'),
909 906
 
910 907
 
911
-    array(
912
-        'name' => __('Show add listing link in user dashboard', 'geodirectory'),
913
-        'desc' => '',
914
-        'tip' => '',
915
-        'id' => 'geodir_add_listing_link_user_dashboard',
916
-        'css' => 'min-width:300px;',
917
-        'std' => geodir_get_posttypes(),
918
-        'type' => 'multiselect',
919
-        'placeholder_text' => __('Select post types', 'geodirectory'),
920
-        'class' => 'chosen_select',
921
-        'options' => array_unique(geodir_post_type_setting_fun())
922
-    ),
908
+	array('name' => __('User Dashboard Post Type Navigation Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_user_dashboard_post_type '),
923 909
 
924
-    array(
925
-        'name' => __('Show favorite link in user dashboard', 'geodirectory'),
926
-        'desc' => __('Option will not appear if user does not have a favorite of that post type', 'geodirectory'),
927
-        'tip' => '',
928
-        'id' => 'geodir_favorite_link_user_dashboard',
929
-        'css' => 'min-width:300px;',
930
-        'std' => geodir_get_posttypes(),
931
-        'type' => 'multiselect',
932
-        'placeholder_text' => __('Select post types', 'geodirectory'),
933
-        'class' => 'chosen_select',
934
-        'options' => array_unique(geodir_post_type_setting_fun())
935
-    ),
936 910
 
937
-    array(
938
-        'name' => __('Show listing link in user dashboard', 'geodirectory'),
939
-        'desc' => __('Option will not appear if user does not have his/her own listing of that post type', 'geodirectory'),
940
-        'tip' => '',
941
-        'id' => 'geodir_listing_link_user_dashboard',
942
-        'css' => 'min-width:300px;',
943
-        'std' => geodir_get_posttypes(),
944
-        'type' => 'multiselect',
945
-        'placeholder_text' => __('Select post types', 'geodirectory'),
946
-        'class' => 'chosen_select',
947
-        'options' => array_unique(geodir_post_type_setting_fun())
948
-    ),
949
-
950
-    array('type' => 'sectionend', 'id' => 'geodir_user_dashboard_post_type'),
951
-    /* Post Type Navigation Settings End */
952
-
953
-    /* Script Settings Start */
954
-    array('name' => __('Scripts', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_script_settings '),
955
-
956
-    /*
911
+	array(
912
+		'name' => __('Show add listing link in user dashboard', 'geodirectory'),
913
+		'desc' => '',
914
+		'tip' => '',
915
+		'id' => 'geodir_add_listing_link_user_dashboard',
916
+		'css' => 'min-width:300px;',
917
+		'std' => geodir_get_posttypes(),
918
+		'type' => 'multiselect',
919
+		'placeholder_text' => __('Select post types', 'geodirectory'),
920
+		'class' => 'chosen_select',
921
+		'options' => array_unique(geodir_post_type_setting_fun())
922
+	),
923
+
924
+	array(
925
+		'name' => __('Show favorite link in user dashboard', 'geodirectory'),
926
+		'desc' => __('Option will not appear if user does not have a favorite of that post type', 'geodirectory'),
927
+		'tip' => '',
928
+		'id' => 'geodir_favorite_link_user_dashboard',
929
+		'css' => 'min-width:300px;',
930
+		'std' => geodir_get_posttypes(),
931
+		'type' => 'multiselect',
932
+		'placeholder_text' => __('Select post types', 'geodirectory'),
933
+		'class' => 'chosen_select',
934
+		'options' => array_unique(geodir_post_type_setting_fun())
935
+	),
936
+
937
+	array(
938
+		'name' => __('Show listing link in user dashboard', 'geodirectory'),
939
+		'desc' => __('Option will not appear if user does not have his/her own listing of that post type', 'geodirectory'),
940
+		'tip' => '',
941
+		'id' => 'geodir_listing_link_user_dashboard',
942
+		'css' => 'min-width:300px;',
943
+		'std' => geodir_get_posttypes(),
944
+		'type' => 'multiselect',
945
+		'placeholder_text' => __('Select post types', 'geodirectory'),
946
+		'class' => 'chosen_select',
947
+		'options' => array_unique(geodir_post_type_setting_fun())
948
+	),
949
+
950
+	array('type' => 'sectionend', 'id' => 'geodir_user_dashboard_post_type'),
951
+	/* Post Type Navigation Settings End */
952
+
953
+	/* Script Settings Start */
954
+	array('name' => __('Scripts', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_script_settings '),
955
+
956
+	/*
957 957
     array( 	'name' => __( 'Add/Remove Scripts', 'geodirectory' ),
958 958
                 'type' => 'sectionstart',
959 959
                 'desc' => '',
@@ -979,150 +979,150 @@  discard block
 block discarded – undo
979 979
 
980 980
     */
981 981
 
982
-    array('name' => __('SCSS Settings (CSS combine and minify)', 'geodirectory'),
983
-        'type' => 'sectionstart',
984
-        'desc' => '',
985
-        'id' => 'geodir_scss_settings'),
982
+	array('name' => __('SCSS Settings (CSS combine and minify)', 'geodirectory'),
983
+		'type' => 'sectionstart',
984
+		'desc' => '',
985
+		'id' => 'geodir_scss_settings'),
986 986
 
987
-    array(
988
-        'name' => __('Disable Core SCSS', 'geodirectory'),
989
-        'desc' => __('Stops the CSS files being minified and output as one.', 'geodirectory'),
990
-        'id' => 'geodir_scss_core',
991
-        'type' => 'checkbox',
992
-        'std' => '0' // Default value to show home top section
993
-    ),
987
+	array(
988
+		'name' => __('Disable Core SCSS', 'geodirectory'),
989
+		'desc' => __('Stops the CSS files being minified and output as one.', 'geodirectory'),
990
+		'id' => 'geodir_scss_core',
991
+		'type' => 'checkbox',
992
+		'std' => '0' // Default value to show home top section
993
+	),
994 994
 
995
-    array('type' => 'sectionend', 'id' => 'geodir_scss_settings'),
995
+	array('type' => 'sectionend', 'id' => 'geodir_scss_settings'),
996 996
 
997
-    array('name' => __('Script Settings', 'geodirectory'),
998
-        'type' => 'sectionstart',
999
-        'desc' => '',
1000
-        'id' => 'geodir_script_settings'),
997
+	array('name' => __('Script Settings', 'geodirectory'),
998
+		'type' => 'sectionstart',
999
+		'desc' => '',
1000
+		'id' => 'geodir_script_settings'),
1001 1001
 
1002
-    array(
1003
-        'name' => __('Custom style css code', 'geodirectory'),
1004
-        'desc' => '',
1005
-        'id' => 'geodir_coustem_css',
1006
-        'type' => 'textarea',
1007
-        'css' => 'min-width:300px;',
1008
-        'std' => '' // Default value for the page title - changed in settings
1009
-    ),
1002
+	array(
1003
+		'name' => __('Custom style css code', 'geodirectory'),
1004
+		'desc' => '',
1005
+		'id' => 'geodir_coustem_css',
1006
+		'type' => 'textarea',
1007
+		'css' => 'min-width:300px;',
1008
+		'std' => '' // Default value for the page title - changed in settings
1009
+	),
1010 1010
 
1011
-    array(
1012
-        'name' => __('Header script code', 'geodirectory'),
1013
-        'desc' => '',
1014
-        'id' => 'geodir_header_scripts',
1015
-        'type' => 'textarea',
1016
-        'css' => 'min-width:300px;',
1017
-        'std' => '' // Default value for the page title - changed in settings
1018
-    ),
1011
+	array(
1012
+		'name' => __('Header script code', 'geodirectory'),
1013
+		'desc' => '',
1014
+		'id' => 'geodir_header_scripts',
1015
+		'type' => 'textarea',
1016
+		'css' => 'min-width:300px;',
1017
+		'std' => '' // Default value for the page title - changed in settings
1018
+	),
1019 1019
 
1020
-    array(
1021
-        'name' => __('Footer script code', 'geodirectory'),
1022
-        'desc' => '',
1023
-        'id' => 'geodir_footer_scripts',
1024
-        'type' => 'textarea',
1025
-        'css' => 'min-width:300px;',
1026
-        'std' => '' // Default value for the page title - changed in settings
1027
-    ),
1020
+	array(
1021
+		'name' => __('Footer script code', 'geodirectory'),
1022
+		'desc' => '',
1023
+		'id' => 'geodir_footer_scripts',
1024
+		'type' => 'textarea',
1025
+		'css' => 'min-width:300px;',
1026
+		'std' => '' // Default value for the page title - changed in settings
1027
+	),
1028 1028
 
1029
-    array('type' => 'sectionend', 'id' => 'geodir_script_settings'),
1030
-    /* Script Settings End */
1029
+	array('type' => 'sectionend', 'id' => 'geodir_script_settings'),
1030
+	/* Script Settings End */
1031 1031
 
1032
-    /* Map Settings Start */
1033
-    array('name' => __('Map', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_map_settings '),
1032
+	/* Map Settings Start */
1033
+	array('name' => __('Map', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_map_settings '),
1034 1034
 
1035
-    /* Untick the category by default on home map */
1036
-    array(
1037
-        'name' => __('Home Map Settings', 'geodirectory'),
1038
-        'type' => 'sectionstart',
1039
-        'desc' => '',
1040
-        'id' => 'geodir_home_map_section'
1041
-    ),
1042
-    array(
1043
-        'name' => __('Select category to untick by default on map', 'geodirectory'),
1044
-        'desc' => __('Select category to untick by default on the home map.', 'geodirectory'),
1045
-        'tip' => '',
1046
-        'id' => 'geodir_home_map_untick',
1047
-        'css' => 'min-width:300px;',
1048
-        'std' => '',
1049
-        'type' => 'multiselect',
1050
-        'placeholder_text' => __('Select category', 'geodirectory'),
1051
-        'class' => 'chosen_select',
1052
-        'options' => geodir_home_map_cats_key_value_array()
1053
-    ),
1054
-    array(
1055
-        'type' => 'sectionend',
1056
-        'id' => 'geodir_home_map_section'
1057
-    ),
1035
+	/* Untick the category by default on home map */
1036
+	array(
1037
+		'name' => __('Home Map Settings', 'geodirectory'),
1038
+		'type' => 'sectionstart',
1039
+		'desc' => '',
1040
+		'id' => 'geodir_home_map_section'
1041
+	),
1042
+	array(
1043
+		'name' => __('Select category to untick by default on map', 'geodirectory'),
1044
+		'desc' => __('Select category to untick by default on the home map.', 'geodirectory'),
1045
+		'tip' => '',
1046
+		'id' => 'geodir_home_map_untick',
1047
+		'css' => 'min-width:300px;',
1048
+		'std' => '',
1049
+		'type' => 'multiselect',
1050
+		'placeholder_text' => __('Select category', 'geodirectory'),
1051
+		'class' => 'chosen_select',
1052
+		'options' => geodir_home_map_cats_key_value_array()
1053
+	),
1054
+	array(
1055
+		'type' => 'sectionend',
1056
+		'id' => 'geodir_home_map_section'
1057
+	),
1058 1058
 
1059
-    array(
1060
-        'name' => __('Add Listing Map Settings', 'geodirectory'),
1061
-        'type' => 'sectionstart',
1062
-        'desc' => '',
1063
-        'id' => 'geodir_add_listing_map_section'
1064
-    ),
1065
-    array(
1066
-        'name' => __('Disable mouse scroll', 'geodirectory'),
1067
-        'desc' => __('Stops the mouse scroll zooming the map', 'geodirectory'),
1068
-        'id' => 'geodir_add_listing_mouse_scroll',
1069
-        'type' => 'checkbox',
1070
-        'std' => '0' // Default value to show home top section
1071
-    ),
1072
-    array(
1073
-        'type' => 'sectionend',
1074
-        'id' => 'geodir_add_listing_map_section'
1075
-    ),
1059
+	array(
1060
+		'name' => __('Add Listing Map Settings', 'geodirectory'),
1061
+		'type' => 'sectionstart',
1062
+		'desc' => '',
1063
+		'id' => 'geodir_add_listing_map_section'
1064
+	),
1065
+	array(
1066
+		'name' => __('Disable mouse scroll', 'geodirectory'),
1067
+		'desc' => __('Stops the mouse scroll zooming the map', 'geodirectory'),
1068
+		'id' => 'geodir_add_listing_mouse_scroll',
1069
+		'type' => 'checkbox',
1070
+		'std' => '0' // Default value to show home top section
1071
+	),
1072
+	array(
1073
+		'type' => 'sectionend',
1074
+		'id' => 'geodir_add_listing_map_section'
1075
+	),
1076 1076
 
1077 1077
 
1078
-    array('name' => __('Default map settings', 'geodirectory'),
1079
-        'type' => 'sectionstart',
1080
-        'desc' => '',
1081
-        'id' => 'geodir_map_default_settings'),
1078
+	array('name' => __('Default map settings', 'geodirectory'),
1079
+		'type' => 'sectionstart',
1080
+		'desc' => '',
1081
+		'id' => 'geodir_map_default_settings'),
1082 1082
 
1083
-    array(
1084
-        'name' => '',
1085
-        'desc' => '',
1086
-        'id' => 'map_default_settings',
1087
-        'type' => 'map_default_settings',
1088
-        'css' => 'min-width:300px;',
1089
-        'std' => '' // Default value for the page title - changed in settings
1090
-    ),
1083
+	array(
1084
+		'name' => '',
1085
+		'desc' => '',
1086
+		'id' => 'map_default_settings',
1087
+		'type' => 'map_default_settings',
1088
+		'css' => 'min-width:300px;',
1089
+		'std' => '' // Default value for the page title - changed in settings
1090
+	),
1091 1091
 
1092
-    array(
1093
-        'name' => __('Upload map default marker icon', 'geodirectory'),
1094
-        'desc' => '',
1095
-        'id' => 'geodir_default_marker_icon',
1096
-        'type' => 'file',
1097
-        'std' => '0',
1098
-        'value' => geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'// Default value to show home top section
1099
-    ),
1100
-    // add option that allows enable/disable map dragging to phone devices
1101
-    array(
1102
-        'name' => __('Show button control on map to enable/disable dragging', 'geodirectory'),
1103
-        'desc' => __('If checked, it displays button control to enable/disable dragging on google maps for phone devices', 'geodirectory'),
1104
-        'id' => 'geodir_map_onoff_dragging',
1105
-        'type' => 'checkbox',
1106
-        'std' => '0' // Default value to show home top section
1107
-    ),
1092
+	array(
1093
+		'name' => __('Upload map default marker icon', 'geodirectory'),
1094
+		'desc' => '',
1095
+		'id' => 'geodir_default_marker_icon',
1096
+		'type' => 'file',
1097
+		'std' => '0',
1098
+		'value' => geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'// Default value to show home top section
1099
+	),
1100
+	// add option that allows enable/disable map dragging to phone devices
1101
+	array(
1102
+		'name' => __('Show button control on map to enable/disable dragging', 'geodirectory'),
1103
+		'desc' => __('If checked, it displays button control to enable/disable dragging on google maps for phone devices', 'geodirectory'),
1104
+		'id' => 'geodir_map_onoff_dragging',
1105
+		'type' => 'checkbox',
1106
+		'std' => '0' // Default value to show home top section
1107
+	),
1108 1108
 
1109
-    array('type' => 'sectionend', 'id' => 'geodir_map_default_settings'),
1109
+	array('type' => 'sectionend', 'id' => 'geodir_map_default_settings'),
1110 1110
 
1111
-    array('name' => __('Show / hide post type and category on map', 'geodirectory'),
1112
-        'type' => 'sectionstart',
1113
-        'desc' => '',
1114
-        'id' => 'geodir_map_settings'),
1111
+	array('name' => __('Show / hide post type and category on map', 'geodirectory'),
1112
+		'type' => 'sectionstart',
1113
+		'desc' => '',
1114
+		'id' => 'geodir_map_settings'),
1115 1115
 
1116
-    array(
1117
-        'name' => __('Select Map Category', 'geodirectory'),
1118
-        'desc' => '',
1119
-        'id' => 'geodir_map_settings',
1120
-        'type' => 'map',
1121
-        'css' => 'min-width:300px;',
1122
-        'std' => '' // Default value for the page title - changed in settings
1123
-    ),
1124
-
1125
-    array('type' => 'sectionend', 'id' => 'geodir_map_settings'),
1126
-    /* Map Settings End */
1116
+	array(
1117
+		'name' => __('Select Map Category', 'geodirectory'),
1118
+		'desc' => '',
1119
+		'id' => 'geodir_map_settings',
1120
+		'type' => 'map',
1121
+		'css' => 'min-width:300px;',
1122
+		'std' => '' // Default value for the page title - changed in settings
1123
+	),
1124
+
1125
+	array('type' => 'sectionend', 'id' => 'geodir_map_settings'),
1126
+	/* Map Settings End */
1127 1127
 
1128 1128
 )); // End Design settings
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/general_settings_array.php 1 patch
Indentation   +252 added lines, -252 removed lines patch added patch discarded remove patch
@@ -16,30 +16,30 @@  discard block
 block discarded – undo
16 16
  */
17 17
 $general_options = apply_filters('geodir_general_options', array(
18 18
 
19
-    array('name' => __('General', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'),
20
-
21
-    array('name' => __('General Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'general_options'),
22
-
23
-    array(
24
-        'name' => __('Sender name', 'geodirectory'),
25
-        'desc' => __('(Name that will be shown as email sender when users receive emails from this site)', 'geodirectory'),
26
-        'id' => 'site_email_name',
27
-        'type' => 'text',
28
-        'css' => 'min-width:300px;',
29
-        'std' => get_bloginfo('name') // Default value for the page title - changed in settings
30
-    ),
31
-
32
-    array(
33
-        'name' => __('Email address', 'geodirectory'),
34
-        'desc' => __('(Emails to users will be sent via this mail ID)', 'geodirectory'),
35
-        'id' => 'site_email',
36
-        'type' => 'text',
37
-        'css' => 'min-width:300px;',
38
-        'std' => get_bloginfo('admin_email') // Default value for the page title - changed in settings
39
-    ),
40
-
41
-
42
-    /*array(
19
+	array('name' => __('General', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'),
20
+
21
+	array('name' => __('General Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'general_options'),
22
+
23
+	array(
24
+		'name' => __('Sender name', 'geodirectory'),
25
+		'desc' => __('(Name that will be shown as email sender when users receive emails from this site)', 'geodirectory'),
26
+		'id' => 'site_email_name',
27
+		'type' => 'text',
28
+		'css' => 'min-width:300px;',
29
+		'std' => get_bloginfo('name') // Default value for the page title - changed in settings
30
+	),
31
+
32
+	array(
33
+		'name' => __('Email address', 'geodirectory'),
34
+		'desc' => __('(Emails to users will be sent via this mail ID)', 'geodirectory'),
35
+		'id' => 'site_email',
36
+		'type' => 'text',
37
+		'css' => 'min-width:300px;',
38
+		'std' => get_bloginfo('admin_email') // Default value for the page title - changed in settings
39
+	),
40
+
41
+
42
+	/*array(
43 43
         'name' => __( 'Display Category', 'geodirectory' ),
44 44
         'desc' 		=> __( 'Allow users to select category at add listing page', 'geodirectory' ),
45 45
         'tip' 		=> '',
@@ -58,69 +58,69 @@  discard block
 block discarded – undo
58 58
 
59 59
 
60 60
     */
61
-    array(
62
-        'name' => __('Allow user to see wp-admin area', 'geodirectory'),
63
-        'desc' => __('Yes', 'geodirectory'),
64
-        'id' => 'geodir_allow_wpadmin',
65
-        'std' => '1',
66
-        'type' => 'radio',
67
-        'value' => '1',
68
-        'radiogroup' => 'start'
69
-    ),
70
-    array(
71
-        'name' => __('Allow user to see wp-admin area', 'geodirectory'),
72
-        'desc' => __('No', 'geodirectory'),
73
-        'id' => 'geodir_allow_wpadmin',
74
-        'std' => '0',
75
-        'type' => 'radio',
76
-        'value' => '0',
77
-        'radiogroup' => 'end'
78
-    ),
79
-
80
-    array(
81
-        'name' => __('Allow user to choose own password', 'geodirectory'),
82
-        'desc' => __('Yes', 'geodirectory'),
83
-        'id' => 'geodir_allow_cpass',
84
-        'std' => '1',
85
-        'type' => 'radio',
86
-        'value' => '1',
87
-        'radiogroup' => 'start'
88
-    ),
89
-    array(
90
-        'name' => __('Allow user to choose own password', 'geodirectory'),
91
-        'desc' => __('No', 'geodirectory'),
92
-        'id' => 'geodir_allow_cpass',
93
-        'std' => '0',
94
-        'type' => 'radio',
95
-        'value' => '0',
96
-        'radiogroup' => 'end'
97
-    ),
98
-    array(
99
-        'name' => __('Disable rating on comments', 'geodirectory'),
100
-        'desc' => __('Disable rating without disabling comments on listings', 'geodirectory'),
101
-        'id' => 'geodir_disable_rating',
102
-        'type' => 'checkbox',
103
-        'std' => '0'
104
-    ),
105
-    array(
106
-        'name' => __('User deleted posts go to trash', 'geodirectory'),
107
-        'desc' => __('If checked a user deleted post will go to trash, otherwise it will be permanently deleted', 'geodirectory'),
108
-        'id' => 'geodir_disable_perm_delete',
109
-        'type' => 'checkbox',
110
-        'std' => '1'
111
-    ),
112
-    array(
113
-        'name' => __('Maxi upload file size(in mb)', 'geodirectory'),
114
-        'desc' => __('(Maximum upload file size in MB, 1 MB = 1024 KB. Must be greater then 0(ZERO), for ex: 2 )', 'geodirectory'),
115
-        'id' => 'geodir_upload_max_filesize',
116
-        'type' => 'text',
117
-        'css' => 'min-width:300px;',
118
-        'std' => '2'
119
-    ),
120
-
121
-
122
-
123
-    array('type' => 'sectionend', 'id' => 'general_options'),
61
+	array(
62
+		'name' => __('Allow user to see wp-admin area', 'geodirectory'),
63
+		'desc' => __('Yes', 'geodirectory'),
64
+		'id' => 'geodir_allow_wpadmin',
65
+		'std' => '1',
66
+		'type' => 'radio',
67
+		'value' => '1',
68
+		'radiogroup' => 'start'
69
+	),
70
+	array(
71
+		'name' => __('Allow user to see wp-admin area', 'geodirectory'),
72
+		'desc' => __('No', 'geodirectory'),
73
+		'id' => 'geodir_allow_wpadmin',
74
+		'std' => '0',
75
+		'type' => 'radio',
76
+		'value' => '0',
77
+		'radiogroup' => 'end'
78
+	),
79
+
80
+	array(
81
+		'name' => __('Allow user to choose own password', 'geodirectory'),
82
+		'desc' => __('Yes', 'geodirectory'),
83
+		'id' => 'geodir_allow_cpass',
84
+		'std' => '1',
85
+		'type' => 'radio',
86
+		'value' => '1',
87
+		'radiogroup' => 'start'
88
+	),
89
+	array(
90
+		'name' => __('Allow user to choose own password', 'geodirectory'),
91
+		'desc' => __('No', 'geodirectory'),
92
+		'id' => 'geodir_allow_cpass',
93
+		'std' => '0',
94
+		'type' => 'radio',
95
+		'value' => '0',
96
+		'radiogroup' => 'end'
97
+	),
98
+	array(
99
+		'name' => __('Disable rating on comments', 'geodirectory'),
100
+		'desc' => __('Disable rating without disabling comments on listings', 'geodirectory'),
101
+		'id' => 'geodir_disable_rating',
102
+		'type' => 'checkbox',
103
+		'std' => '0'
104
+	),
105
+	array(
106
+		'name' => __('User deleted posts go to trash', 'geodirectory'),
107
+		'desc' => __('If checked a user deleted post will go to trash, otherwise it will be permanently deleted', 'geodirectory'),
108
+		'id' => 'geodir_disable_perm_delete',
109
+		'type' => 'checkbox',
110
+		'std' => '1'
111
+	),
112
+	array(
113
+		'name' => __('Maxi upload file size(in mb)', 'geodirectory'),
114
+		'desc' => __('(Maximum upload file size in MB, 1 MB = 1024 KB. Must be greater then 0(ZERO), for ex: 2 )', 'geodirectory'),
115
+		'id' => 'geodir_upload_max_filesize',
116
+		'type' => 'text',
117
+		'css' => 'min-width:300px;',
118
+		'std' => '2'
119
+	),
120
+
121
+
122
+
123
+	array('type' => 'sectionend', 'id' => 'general_options'),
124 124
 
125 125
 ));/* General Options End*/
126 126
 
@@ -132,82 +132,82 @@  discard block
 block discarded – undo
132 132
  */
133 133
 $google_analytic_settings = apply_filters('geodir_google_analytic_settings', array(
134 134
 
135
-    array('name' => __('Google Analytics', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'google_analytic_settings'),
136
-
137
-    array('name' => __('Google Analytic Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'google_analytic_settings'),
138
-
139
-
140
-
141
-    array(
142
-        'name' => __('Show business owner google analytics stats?', 'geodirectory'),
143
-        'desc' => __('Yes', 'geodirectory'),
144
-        'id' => 'geodir_ga_stats',
145
-        'std' => '0',
146
-        'type' => 'radio',
147
-        'value' => '1',
148
-        'radiogroup' => 'start'
149
-    ),
150
-    array(
151
-        'name' => __('Show business owner Google Analytics stats?', 'geodirectory'),
152
-        'desc' => __('No', 'geodirectory'),
153
-        'id' => 'geodir_ga_stats',
154
-        'std' => '1',
155
-        'type' => 'radio',
156
-        'value' => '0',
157
-        'radiogroup' => 'end'
158
-    ),
159
-
160
-    array(
161
-        'name' => __('Google analytics "Profile ID(ie: ga:12345678)?', 'geodirectory') . ' ' .
162
-            '<a target="_blank" href="https://docs.wpgeodirectory.com/gd-core-plugin-google-analytics/">' . __('help', 'geodirectory') . '</a>',
163
-        'desc' => '',
164
-        'id' => 'geodir_ga_id',
165
-        'type' => 'text',
166
-        'css' => 'min-width:300px;',
167
-        'std' => '' // Default value for the page title - changed in settings
168
-    ),
169
-
170
-    array(
171
-        'name' => __('Client ID', 'geodirectory') . ' ' .
172
-            '<a target="_blank" href="https://docs.wpgeodirectory.com/gd-core-plugin-google-analytics/">' . __('help', 'geodirectory') . '</a>',
173
-        'desc' => '',
174
-        'id' => 'geodir_ga_client_id',
175
-        'type' => 'text',
176
-        'css' => 'min-width:300px;',
177
-        'std' => '' // Default value for the page title - changed in settings
178
-    ),
179
-
180
-    array(
181
-        'name' => __('Client secret', 'geodirectory') . ' ' .
182
-            '<a target="_blank" href="https://docs.wpgeodirectory.com/gd-core-plugin-google-analytics/">' . __('help', 'geodirectory') . '</a>',
183
-        'desc' => '',
184
-        'id' => 'geodir_ga_client_secret',
185
-        'type' => 'password',
186
-        'css' => 'min-width:300px;',
187
-        'std' => '' // Default value for the page title - changed in settings
188
-    ),
189
-
190
-    array(
191
-        'name' => __('Google analytics access', 'geodirectory'),
192
-        'desc' => '',
193
-        'id' => 'geodir_ga_token',
194
-        'type' => 'google_analytics',
195
-        'css' => 'min-width:300px;',
196
-        'std' => '' // Default value for the page title - changed in settings
197
-    ),
198
-
199
-
200
-    array(
201
-        'name' => __('Google analytics tracking code', 'geodirectory'),
202
-        'desc' => '',
203
-        'id' => 'geodir_ga_tracking_code',
204
-        'type' => 'textarea',
205
-        'css' => 'min-width:300px;',
206
-        'std' => '' // Default value for the page title - changed in settings
207
-    ),
208
-
209
-
210
-    array('type' => 'sectionend', 'id' => 'google_analytic_settings'),
135
+	array('name' => __('Google Analytics', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'google_analytic_settings'),
136
+
137
+	array('name' => __('Google Analytic Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'google_analytic_settings'),
138
+
139
+
140
+
141
+	array(
142
+		'name' => __('Show business owner google analytics stats?', 'geodirectory'),
143
+		'desc' => __('Yes', 'geodirectory'),
144
+		'id' => 'geodir_ga_stats',
145
+		'std' => '0',
146
+		'type' => 'radio',
147
+		'value' => '1',
148
+		'radiogroup' => 'start'
149
+	),
150
+	array(
151
+		'name' => __('Show business owner Google Analytics stats?', 'geodirectory'),
152
+		'desc' => __('No', 'geodirectory'),
153
+		'id' => 'geodir_ga_stats',
154
+		'std' => '1',
155
+		'type' => 'radio',
156
+		'value' => '0',
157
+		'radiogroup' => 'end'
158
+	),
159
+
160
+	array(
161
+		'name' => __('Google analytics "Profile ID(ie: ga:12345678)?', 'geodirectory') . ' ' .
162
+			'<a target="_blank" href="https://docs.wpgeodirectory.com/gd-core-plugin-google-analytics/">' . __('help', 'geodirectory') . '</a>',
163
+		'desc' => '',
164
+		'id' => 'geodir_ga_id',
165
+		'type' => 'text',
166
+		'css' => 'min-width:300px;',
167
+		'std' => '' // Default value for the page title - changed in settings
168
+	),
169
+
170
+	array(
171
+		'name' => __('Client ID', 'geodirectory') . ' ' .
172
+			'<a target="_blank" href="https://docs.wpgeodirectory.com/gd-core-plugin-google-analytics/">' . __('help', 'geodirectory') . '</a>',
173
+		'desc' => '',
174
+		'id' => 'geodir_ga_client_id',
175
+		'type' => 'text',
176
+		'css' => 'min-width:300px;',
177
+		'std' => '' // Default value for the page title - changed in settings
178
+	),
179
+
180
+	array(
181
+		'name' => __('Client secret', 'geodirectory') . ' ' .
182
+			'<a target="_blank" href="https://docs.wpgeodirectory.com/gd-core-plugin-google-analytics/">' . __('help', 'geodirectory') . '</a>',
183
+		'desc' => '',
184
+		'id' => 'geodir_ga_client_secret',
185
+		'type' => 'password',
186
+		'css' => 'min-width:300px;',
187
+		'std' => '' // Default value for the page title - changed in settings
188
+	),
189
+
190
+	array(
191
+		'name' => __('Google analytics access', 'geodirectory'),
192
+		'desc' => '',
193
+		'id' => 'geodir_ga_token',
194
+		'type' => 'google_analytics',
195
+		'css' => 'min-width:300px;',
196
+		'std' => '' // Default value for the page title - changed in settings
197
+	),
198
+
199
+
200
+	array(
201
+		'name' => __('Google analytics tracking code', 'geodirectory'),
202
+		'desc' => '',
203
+		'id' => 'geodir_ga_tracking_code',
204
+		'type' => 'textarea',
205
+		'css' => 'min-width:300px;',
206
+		'std' => '' // Default value for the page title - changed in settings
207
+	),
208
+
209
+
210
+	array('type' => 'sectionend', 'id' => 'google_analytic_settings'),
211 211
 
212 212
 )); // google_analytic_settings End
213 213
 
@@ -219,84 +219,84 @@  discard block
 block discarded – undo
219 219
  */
220 220
 $search_settings = apply_filters('geodir_search_settings', array(
221 221
 
222
-    array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'search_settings'),
223
-
224
-    array('name' => __('Search Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'search_settings'),
225
-
226
-    array(
227
-        'name' => __('Limit squared distance area to X miles (helps improve search speed)', 'geodirectory'),
228
-        'desc' => __('Enter whole number only ex. 40 (Tokyo is largest city in the world @40 sq miles) LEAVE BLANK FOR NO DISTANCE LIMIT', 'geodirectory'),
229
-        'id' => 'geodir_search_dist',
230
-        'type' => 'text',
231
-        'css' => 'min-width:300px;',
232
-        'std' => '40' // Default value for the page title - changed in settings
233
-    ),
234
-
235
-    array(
236
-        'name' => __('Show search distances in miles or km', 'geodirectory'),
237
-        'desc' => __('Miles', 'geodirectory'),
238
-        'id' => 'geodir_search_dist_1',
239
-        'std' => 'miles',
240
-        'type' => 'radio',
241
-        'value' => 'miles',
242
-        'radiogroup' => 'start'
243
-    ),
244
-    array(
245
-        'name' => __('Show search distances in miles or km', 'geodirectory'),
246
-        'desc' => __('Kilometers', 'geodirectory'),
247
-        'id' => 'geodir_search_dist_1',
248
-        'std' => 'miles',
249
-        'type' => 'radio',
250
-        'value' => 'km',
251
-        'radiogroup' => 'end'
252
-    ),
253
-
254
-    array(
255
-        'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
256
-        'desc' => __('Meters', 'geodirectory'),
257
-        'id' => 'geodir_search_dist_2',
258
-        'std' => 'meters',
259
-        'type' => 'radio',
260
-        'value' => 'meters',
261
-        'radiogroup' => 'start'
262
-    ),
263
-
264
-    array(
265
-        'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
266
-        'desc' => __('Feet', 'geodirectory'),
267
-        'id' => 'geodir_search_dist_2',
268
-        'std' => 'meters',
269
-        'type' => 'radio',
270
-        'value' => 'feet',
271
-        'radiogroup' => 'end'
272
-    ),
273
-
274
-    array(
275
-        'name' => __('Add location specific text to (Near) search for Google', 'geodirectory'),
276
-        'desc' => __('This is usefull if your directory is limted to one location such as: New York or Australia (this setting should be blank if using default country, regions etc with multilocation addon as it will automatically add them)', 'geodirectory'),
277
-        'id' => 'geodir_search_near_addition',
278
-        'type' => 'text',
279
-        'css' => 'min-width:300px;',
280
-        'std' => ''
281
-    ),
282
-    array(
283
-        'name' => __('Individual word search limit', 'geodirectory'),
284
-        'desc' => __('With this option you can limit individual words being searched for, for example searching for `Jo Brown` would return results with words like `Jones`, you can exclude these types of small character words if you wish.', 'geodirectory'),
285
-        'id' => 'geodir_search_word_limit',
286
-        'css' => 'min-width:300px;',
287
-        'std' => 'gridview_onehalf',
288
-        'type' => 'select',
289
-        'class' => 'chosen_select',
290
-        'options' => array_unique(array(
291
-            '0' => __('Disabled', 'geodirectory'),
292
-            '1' => __('1 Character words excluded', 'geodirectory'),
293
-            '2' => __('2 Character words and less excluded', 'geodirectory'),
294
-            '3' => __('3 Character words and less excluded', 'geodirectory'),
295
-        ))
296
-    ),
297
-
298
-
299
-    array('type' => 'sectionend', 'id' => 'search_settings'),
222
+	array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'search_settings'),
223
+
224
+	array('name' => __('Search Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'search_settings'),
225
+
226
+	array(
227
+		'name' => __('Limit squared distance area to X miles (helps improve search speed)', 'geodirectory'),
228
+		'desc' => __('Enter whole number only ex. 40 (Tokyo is largest city in the world @40 sq miles) LEAVE BLANK FOR NO DISTANCE LIMIT', 'geodirectory'),
229
+		'id' => 'geodir_search_dist',
230
+		'type' => 'text',
231
+		'css' => 'min-width:300px;',
232
+		'std' => '40' // Default value for the page title - changed in settings
233
+	),
234
+
235
+	array(
236
+		'name' => __('Show search distances in miles or km', 'geodirectory'),
237
+		'desc' => __('Miles', 'geodirectory'),
238
+		'id' => 'geodir_search_dist_1',
239
+		'std' => 'miles',
240
+		'type' => 'radio',
241
+		'value' => 'miles',
242
+		'radiogroup' => 'start'
243
+	),
244
+	array(
245
+		'name' => __('Show search distances in miles or km', 'geodirectory'),
246
+		'desc' => __('Kilometers', 'geodirectory'),
247
+		'id' => 'geodir_search_dist_1',
248
+		'std' => 'miles',
249
+		'type' => 'radio',
250
+		'value' => 'km',
251
+		'radiogroup' => 'end'
252
+	),
253
+
254
+	array(
255
+		'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
256
+		'desc' => __('Meters', 'geodirectory'),
257
+		'id' => 'geodir_search_dist_2',
258
+		'std' => 'meters',
259
+		'type' => 'radio',
260
+		'value' => 'meters',
261
+		'radiogroup' => 'start'
262
+	),
263
+
264
+	array(
265
+		'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
266
+		'desc' => __('Feet', 'geodirectory'),
267
+		'id' => 'geodir_search_dist_2',
268
+		'std' => 'meters',
269
+		'type' => 'radio',
270
+		'value' => 'feet',
271
+		'radiogroup' => 'end'
272
+	),
273
+
274
+	array(
275
+		'name' => __('Add location specific text to (Near) search for Google', 'geodirectory'),
276
+		'desc' => __('This is usefull if your directory is limted to one location such as: New York or Australia (this setting should be blank if using default country, regions etc with multilocation addon as it will automatically add them)', 'geodirectory'),
277
+		'id' => 'geodir_search_near_addition',
278
+		'type' => 'text',
279
+		'css' => 'min-width:300px;',
280
+		'std' => ''
281
+	),
282
+	array(
283
+		'name' => __('Individual word search limit', 'geodirectory'),
284
+		'desc' => __('With this option you can limit individual words being searched for, for example searching for `Jo Brown` would return results with words like `Jones`, you can exclude these types of small character words if you wish.', 'geodirectory'),
285
+		'id' => 'geodir_search_word_limit',
286
+		'css' => 'min-width:300px;',
287
+		'std' => 'gridview_onehalf',
288
+		'type' => 'select',
289
+		'class' => 'chosen_select',
290
+		'options' => array_unique(array(
291
+			'0' => __('Disabled', 'geodirectory'),
292
+			'1' => __('1 Character words excluded', 'geodirectory'),
293
+			'2' => __('2 Character words and less excluded', 'geodirectory'),
294
+			'3' => __('3 Character words and less excluded', 'geodirectory'),
295
+		))
296
+	),
297
+
298
+
299
+	array('type' => 'sectionend', 'id' => 'search_settings'),
300 300
 
301 301
 )); //search_settings End
302 302
 
@@ -308,17 +308,17 @@  discard block
 block discarded – undo
308 308
  */
309 309
 $dummy_data_settings = apply_filters('geodir_dummy_data_settings', array(
310 310
 
311
-    array('name' => __('Dummy Data', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'dummy_data_settings'),
312
-
313
-    array(
314
-        'name' => '',
315
-        'desc' => '',
316
-        'id' => 'geodir_dummy_data_installer',
317
-        'type' => 'dummy_installer',
318
-        'css' => 'min-width:300px;',
319
-        'std' => '40' // Default value for the page title - changed in settings
320
-    ),
321
-    array('type' => 'sectionend', 'id' => 'geodir_dummy_data_settings'),
311
+	array('name' => __('Dummy Data', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'dummy_data_settings'),
312
+
313
+	array(
314
+		'name' => '',
315
+		'desc' => '',
316
+		'id' => 'geodir_dummy_data_installer',
317
+		'type' => 'dummy_installer',
318
+		'css' => 'min-width:300px;',
319
+		'std' => '40' // Default value for the page title - changed in settings
320
+	),
321
+	array('type' => 'sectionend', 'id' => 'geodir_dummy_data_settings'),
322 322
 
323 323
 )); //dummy_data_settings End
324 324
 
Please login to merge, or discard this patch.