Test Failed
Pull Request — master (#373)
by Viruthagiri
15:27
created
geodirectory-admin/admin_db_install.php 3 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,12 @@
 block discarded – undo
23 23
 
24 24
         $collate = '';
25 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";
26
+            if (!empty($wpdb->charset)) {
27
+            	$collate = "DEFAULT CHARACTER SET $wpdb->charset";
28
+            }
29
+            if (!empty($wpdb->collate)) {
30
+            	$collate .= " COLLATE $wpdb->collate";
31
+            }
28 32
         }
29 33
 
30 34
 		/**
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -32,35 +32,35 @@  discard block
 block discarded – undo
32 32
 		 *
33 33
 		 * @since 1.0.0
34 34
 		 */
35
-		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
35
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
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");
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 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");
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 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");
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 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");
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 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");
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 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");
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 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");
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 59
         }
60 60
 
61 61
 
62 62
         // Table for storing Countries
63
-        $GEODIR_COUNTRIES_TABLE = "CREATE TABLE " . GEODIR_COUNTRIES_TABLE . " (
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 ,
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 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 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', ''),
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 
383 383
         // Table for storing location attribute - these are user defined
384 384
 
385
-        $icon_table = "CREATE TABLE " . GEODIR_ICON_TABLE . " (
385
+        $icon_table = "CREATE TABLE ".GEODIR_ICON_TABLE." (
386 386
 						id int NOT NULL AUTO_INCREMENT,
387 387
 						post_id int( 10 ) NOT NULL,
388 388
 						post_title varchar(254) NOT NULL,
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
         // Table for storing post custom fields - these are user defined
405 405
 
406
-        $post_custom_fields = "CREATE TABLE " . GEODIR_CUSTOM_FIELDS_TABLE . " (
406
+        $post_custom_fields = "CREATE TABLE ".GEODIR_CUSTOM_FIELDS_TABLE." (
407 407
 							  id int(11) NOT NULL AUTO_INCREMENT,
408 408
 							  post_type varchar(100) NULL,
409 409
 							  data_type varchar(100) NULL DEFAULT NULL,
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
         dbDelta($post_custom_fields);
449 449
 
450 450
         // Table for storing place attribute - these are user defined
451
-        $post_detail = "CREATE TABLE " . $plugin_prefix . "gd_place_detail (
451
+        $post_detail = "CREATE TABLE ".$plugin_prefix."gd_place_detail (
452 452
 						post_id int(11) NOT NULL,
453 453
 						post_title text NULL DEFAULT NULL,
454 454
 						post_status varchar(20) NULL DEFAULT NULL,
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 
490 490
         // Table for storing place images - these are user defined
491 491
 
492
-        $attechment_table = "CREATE TABLE " . GEODIR_ATTACHMENT_TABLE . " (
492
+        $attechment_table = "CREATE TABLE ".GEODIR_ATTACHMENT_TABLE." (
493 493
 						ID int(11) NOT NULL AUTO_INCREMENT,
494 494
 						post_id int(11) NOT NULL,
495 495
 						user_id int(11) DEFAULT NULL,
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
         dbDelta($attechment_table);
517 517
 
518 518
 
519
-        $custom_sort_fields_table = "CREATE TABLE " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " (
519
+        $custom_sort_fields_table = "CREATE TABLE ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." (
520 520
 			id int(11) NOT NULL AUTO_INCREMENT,
521 521
 			post_type varchar(255) NOT NULL,
522 522
 			data_type varchar(255) NOT NULL,
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
         dbDelta($custom_sort_fields_table);
546 546
 
547 547
 
548
-            $review_table = "CREATE TABLE " . GEODIR_REVIEW_TABLE . " (
548
+            $review_table = "CREATE TABLE ".GEODIR_REVIEW_TABLE." (
549 549
 			id int(11) NOT NULL AUTO_INCREMENT,
550 550
 			post_id int(11) DEFAULT NULL,
551 551
 			post_title varchar( 255 ) NULL DEFAULT NULL,
Please login to merge, or discard this patch.
Indentation   +155 added lines, -155 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', ''),
@@ -371,21 +371,21 @@  discard block
 block discarded – undo
371 371
     (281, 'South Sudan', '--', 'SS', '-- ', '--', 'SS', '', '', '', '', 'South Sudanese pound', 'SSP', 12340000, 'South Sudan', ''),
372 372
     (282, 'Isle of Man', '--', 'IM', '-- ', '--', 'IM', '', '', '', '', 'Manx pound', 'IMP', 84497, 'Isle of Man', '')";
373 373
 
374
-            /**
375
-             * Filter the SQL query that inserts the country DB table data.
376
-             *
377
-             * @since 1.0.0
378
-             * @param string $sql The SQL insert query string.
379
-             */
380
-            $countries_insert = apply_filters('geodir_before_country_data_insert', $countries_insert);
381
-            $wpdb->query($countries_insert);
374
+			/**
375
+			 * Filter the SQL query that inserts the country DB table data.
376
+			 *
377
+			 * @since 1.0.0
378
+			 * @param string $sql The SQL insert query string.
379
+			 */
380
+			$countries_insert = apply_filters('geodir_before_country_data_insert', $countries_insert);
381
+			$wpdb->query($countries_insert);
382 382
 
383
-        }
383
+		}
384 384
 
385 385
 
386
-        // Table for storing location attribute - these are user defined
386
+		// Table for storing location attribute - these are user defined
387 387
 
388
-        $icon_table = "CREATE TABLE " . GEODIR_ICON_TABLE . " (
388
+		$icon_table = "CREATE TABLE " . GEODIR_ICON_TABLE . " (
389 389
 						id int NOT NULL AUTO_INCREMENT,
390 390
 						post_id int( 10 ) NOT NULL,
391 391
 						post_title varchar(254) NOT NULL,
@@ -394,19 +394,19 @@  discard block
 block discarded – undo
394 394
 						PRIMARY KEY  (id)
395 395
 						) $collate ";
396 396
 
397
-        /**
398
-         * Filter the SQL query that creates/updates the post_icon DB table structure.
399
-         *
400
-         * @since 1.0.0
401
-         * @param string $sql The SQL insert query string.
402
-         */
403
-        $icon_table = apply_filters('geodir_before_icon_table_create', $icon_table);
397
+		/**
398
+		 * Filter the SQL query that creates/updates the post_icon DB table structure.
399
+		 *
400
+		 * @since 1.0.0
401
+		 * @param string $sql The SQL insert query string.
402
+		 */
403
+		$icon_table = apply_filters('geodir_before_icon_table_create', $icon_table);
404 404
 
405
-        dbDelta($icon_table);
405
+		dbDelta($icon_table);
406 406
 
407
-        // Table for storing post custom fields - these are user defined
407
+		// Table for storing post custom fields - these are user defined
408 408
 
409
-        $post_custom_fields = "CREATE TABLE " . GEODIR_CUSTOM_FIELDS_TABLE . " (
409
+		$post_custom_fields = "CREATE TABLE " . GEODIR_CUSTOM_FIELDS_TABLE . " (
410 410
 							  id int(11) NOT NULL AUTO_INCREMENT,
411 411
 							  post_type varchar(100) NULL,
412 412
 							  data_type varchar(100) NULL DEFAULT NULL,
@@ -442,18 +442,18 @@  discard block
 block discarded – undo
442 442
 							  PRIMARY KEY  (id)
443 443
 							  ) $collate";
444 444
 
445
-        /**
446
-         * Filter the SQL query that creates/updates the custom_fields DB table structure.
447
-         *
448
-         * @since 1.0.0
449
-         * @param string $sql The SQL insert query string.
450
-         */
451
-        $post_custom_fields = apply_filters('geodir_before_custom_field_table_create', $post_custom_fields);
445
+		/**
446
+		 * Filter the SQL query that creates/updates the custom_fields DB table structure.
447
+		 *
448
+		 * @since 1.0.0
449
+		 * @param string $sql The SQL insert query string.
450
+		 */
451
+		$post_custom_fields = apply_filters('geodir_before_custom_field_table_create', $post_custom_fields);
452 452
 
453
-        dbDelta($post_custom_fields);
453
+		dbDelta($post_custom_fields);
454 454
 
455
-        // Table for storing place attribute - these are user defined
456
-        $post_detail = "CREATE TABLE " . $plugin_prefix . "gd_place_detail (
455
+		// Table for storing place attribute - these are user defined
456
+		$post_detail = "CREATE TABLE " . $plugin_prefix . "gd_place_detail (
457 457
 						post_id int(11) NOT NULL,
458 458
 						post_title text NULL DEFAULT NULL,
459 459
 						post_status varchar(20) NULL DEFAULT NULL,
@@ -482,22 +482,22 @@  discard block
 block discarded – undo
482 482
 						KEY is_featured (is_featured)
483 483
 						) $collate ";
484 484
 
485
-        /**
486
-         * Filter the SQL query that creates/updates the post_detail DB table structure.
487
-         *
488
-         * @since 1.0.0
489
-         * @param string $sql The SQL insert query string.
490
-         */
491
-        $post_detail = apply_filters('geodir_before_post_detail_table_create', $post_detail);
485
+		/**
486
+		 * Filter the SQL query that creates/updates the post_detail DB table structure.
487
+		 *
488
+		 * @since 1.0.0
489
+		 * @param string $sql The SQL insert query string.
490
+		 */
491
+		$post_detail = apply_filters('geodir_before_post_detail_table_create', $post_detail);
492 492
 
493
-        dbDelta($post_detail);
493
+		dbDelta($post_detail);
494 494
 
495
-        // alter post_title
496
-        //$wpdb->query("ALTER TABLE ".$wpdb->prefix."geodir_gd_place_detail MODIFY `post_title` text NULL");
495
+		// alter post_title
496
+		//$wpdb->query("ALTER TABLE ".$wpdb->prefix."geodir_gd_place_detail MODIFY `post_title` text NULL");
497 497
 
498
-        // Table for storing place images - these are user defined
498
+		// Table for storing place images - these are user defined
499 499
 
500
-        $attechment_table = "CREATE TABLE " . GEODIR_ATTACHMENT_TABLE . " (
500
+		$attechment_table = "CREATE TABLE " . GEODIR_ATTACHMENT_TABLE . " (
501 501
 						ID int(11) NOT NULL AUTO_INCREMENT,
502 502
 						post_id int(11) NOT NULL,
503 503
 						user_id int(11) DEFAULT NULL,
@@ -513,18 +513,18 @@  discard block
 block discarded – undo
513 513
 						PRIMARY KEY  (ID)
514 514
 						) $collate ";
515 515
 
516
-        /**
517
-         * Filter the SQL query that creates/updates the attachments DB table structure.
518
-         *
519
-         * @since 1.0.0
520
-         * @param string $sql The SQL insert query string.
521
-         */
522
-        $attechment_table = apply_filters('geodir_before_attachment_table_create', $attechment_table);
516
+		/**
517
+		 * Filter the SQL query that creates/updates the attachments DB table structure.
518
+		 *
519
+		 * @since 1.0.0
520
+		 * @param string $sql The SQL insert query string.
521
+		 */
522
+		$attechment_table = apply_filters('geodir_before_attachment_table_create', $attechment_table);
523 523
 
524
-        dbDelta($attechment_table);
524
+		dbDelta($attechment_table);
525 525
 
526 526
 
527
-        $custom_sort_fields_table = "CREATE TABLE " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " (
527
+		$custom_sort_fields_table = "CREATE TABLE " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " (
528 528
 			id int(11) NOT NULL AUTO_INCREMENT,
529 529
 			post_type varchar(255) NOT NULL,
530 530
 			data_type varchar(255) NOT NULL,
@@ -542,18 +542,18 @@  discard block
 block discarded – undo
542 542
 			PRIMARY KEY  (id)
543 543
 			) $collate ";
544 544
 
545
-        /**
546
-         * Filter the SQL query that creates/updates the custom_sort_fields DB table structure.
547
-         *
548
-         * @since 1.0.0
549
-         * @param string $sql The SQL insert query string.
550
-         */
551
-        $custom_sort_fields_table = apply_filters('geodir_before_sort_fields_table_create', $custom_sort_fields_table);
545
+		/**
546
+		 * Filter the SQL query that creates/updates the custom_sort_fields DB table structure.
547
+		 *
548
+		 * @since 1.0.0
549
+		 * @param string $sql The SQL insert query string.
550
+		 */
551
+		$custom_sort_fields_table = apply_filters('geodir_before_sort_fields_table_create', $custom_sort_fields_table);
552 552
 
553
-        dbDelta($custom_sort_fields_table);
553
+		dbDelta($custom_sort_fields_table);
554 554
 
555 555
 
556
-            $review_table = "CREATE TABLE " . GEODIR_REVIEW_TABLE . " (
556
+			$review_table = "CREATE TABLE " . GEODIR_REVIEW_TABLE . " (
557 557
 			id int(11) NOT NULL AUTO_INCREMENT,
558 558
 			post_id int(11) DEFAULT NULL,
559 559
 			post_title varchar( 255 ) NULL DEFAULT NULL,
@@ -577,51 +577,51 @@  discard block
 block discarded – undo
577 577
 			PRIMARY KEY  (id)
578 578
 			) $collate  ";
579 579
 
580
-            /**
581
-             * Filter the SQL query that creates the review DB table structure.
582
-             *
583
-             * @since 1.0.0
584
-             * @param string $sql The SQL insert query string.
585
-             */
586
-            $review_table = apply_filters('geodir_before_review_table_create', $review_table);
587
-            dbDelta($review_table);
580
+			/**
581
+			 * Filter the SQL query that creates the review DB table structure.
582
+			 *
583
+			 * @since 1.0.0
584
+			 * @param string $sql The SQL insert query string.
585
+			 */
586
+			$review_table = apply_filters('geodir_before_review_table_create', $review_table);
587
+			dbDelta($review_table);
588 588
 
589 589
 
590 590
 
591
-        // Alter terms table
592
-        $term_icon_column = $wpdb->get_var("SHOW COLUMNS FROM $wpdb->terms where field='term_icon'");
593
-        if (!$term_icon_column) {
594
-            $wpdb->query("ALTER TABLE $wpdb->terms ADD `term_icon` TEXT NULL DEFAULT NULL");
595
-        }
591
+		// Alter terms table
592
+		$term_icon_column = $wpdb->get_var("SHOW COLUMNS FROM $wpdb->terms where field='term_icon'");
593
+		if (!$term_icon_column) {
594
+			$wpdb->query("ALTER TABLE $wpdb->terms ADD `term_icon` TEXT NULL DEFAULT NULL");
595
+		}
596 596
 
597
-        //require_once(geodir_plugin_path() . '/upgrade.php');
597
+		//require_once(geodir_plugin_path() . '/upgrade.php');
598 598
 
599 599
 
600
-    }
600
+	}
601 601
 } // END MAIN FUNCTION geodir_tables_install
602 602
 
603 603
 if (!function_exists('geodir_create_default_fields')) {
604
-    /**
605
-     * Inserts default custom fields table data into database.
606
-     *
607
-     * @since 1.0.0
608
-     * @package GeoDirectory
609
-     */
610
-    function geodir_create_default_fields()
611
-    {
612
-
613
-        $fields = geodir_default_custom_fields('gd_place');
614
-
615
-        /**
616
-         * Filter the array of default custom fields DB table data.
617
-         *
618
-         * @since 1.0.0
619
-         * @param string $fields The default custom fields as an array.
620
-         */
621
-        $fields = apply_filters('geodir_before_default_custom_fields_saved', $fields);
622
-        foreach ($fields as $field_index => $field) {
623
-            geodir_custom_field_save($field);
624
-
625
-        }
626
-    }
604
+	/**
605
+	 * Inserts default custom fields table data into database.
606
+	 *
607
+	 * @since 1.0.0
608
+	 * @package GeoDirectory
609
+	 */
610
+	function geodir_create_default_fields()
611
+	{
612
+
613
+		$fields = geodir_default_custom_fields('gd_place');
614
+
615
+		/**
616
+		 * Filter the array of default custom fields DB table data.
617
+		 *
618
+		 * @since 1.0.0
619
+		 * @param string $fields The default custom fields as an array.
620
+		 */
621
+		$fields = apply_filters('geodir_before_default_custom_fields_saved', $fields);
622
+		foreach ($fields as $field_index => $field) {
623
+			geodir_custom_field_save($field);
624
+
625
+		}
626
+	}
627 627
 }
628 628
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/permalink_settings_array.php 1 patch
Indentation   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -16,184 +16,184 @@
 block discarded – undo
16 16
  */
17 17
 $geodir_settings['permalink_settings'] = apply_filters('geodir_permalink_settings', array(
18 18
 
19
-    /* Listing Permalink Settings start */
20
-    array('name' => __('Permalink', 'geodirectory'), 'type' => 'no_tabs', 'desc' => 'Settings to set permalink', 'id' => 'geodir_permalink_settings '),
21
-
22
-
23
-    array('name' => __('Listing Detail Permalink Settings', 'geodirectory'),
24
-        'type' => 'sectionstart',
25
-        'desc' => '',
26
-        'id' => 'geodir_permalink'),
27
-
28
-    array(
29
-        'name' => __('Add location in urls', 'geodirectory'),
30
-        'desc' => __('Add location slug in listing urls', 'geodirectory'),
31
-        'id' => 'geodir_add_location_url',
32
-        'type' => 'checkbox',
33
-        'std' => '1',
34
-        'checkboxgroup' => 'start'
35
-    ),
36
-
37
-    array(
38
-        'name' => __('Add full location in listing urls', 'geodirectory'),
39
-        'desc' => __('Add full location info with country, region and city slug in listing urls', 'geodirectory'),
40
-        'id' => 'geodir_show_location_url',
41
-        'type' => 'radio',
42
-        'value' => 'all',
43
-        'std' => 'all',
44
-        'radiogroup' => ''
45
-    ),
46
-
47
-	array(
48
-        'name' => __('Add country and city slug in listing urls', 'geodirectory'),
49
-        'desc' => __('Add country and city slug in listing urls (/country/city/)', 'geodirectory'),
50
-        'id' => 'geodir_show_location_url',
51
-        'type' => 'radio',
52
-        'std' => 'all',
53
-        'value' => 'country_city',
54
-        'radiogroup' => ''
55
-    ),
56
-	array(
57
-        'name' => __('Add region and city slug in listing urls', 'geodirectory'),
58
-        'desc' => __('Add region and city slug in listing urls (/region/city/)', 'geodirectory'),
59
-        'id' => 'geodir_show_location_url',
60
-        'type' => 'radio',
61
-        'std' => 'all',
62
-        'value' => 'region_city',
63
-        'radiogroup' => ''
64
-    ),
65
-    array(
66
-        'name' => __('Add only city in listing urls', 'geodirectory'),
67
-        'desc' => __('Add city slug in listing urls', 'geodirectory'),
68
-        'id' => 'geodir_show_location_url',
69
-        'type' => 'radio',
70
-        'std' => 'all',
71
-        'value' => 'city',
72
-        'radiogroup' => 'end'
73
-    ),
74
-
75
-
76
-
77
-    array(
78
-        'name' => __('Add category in listing urls', 'geodirectory'),
79
-        'desc' => __('Add requested category slugs in listing urls', 'geodirectory'),
80
-        'id' => 'geodir_add_categories_url',
81
-        'type' => 'checkbox',
82
-        'std' => '1',
83
-    ),
84
-
85
-    array(
86
-        'name' => __('Listing url prefix', 'geodirectory'),
87
-        'desc' => __('Listing prefix to show in url', 'geodirectory'),
88
-        'id' => 'geodir_listing_prefix',
89
-        'type' => 'text',
90
-        'css' => 'min-width:300px;',
91
-        'std' => 'places'
92
-    ),
93
-
94
-    array(
95
-        'name' => __('Location url prefix', 'geodirectory'),
96
-        'desc' => __('Depreciated, now uses the location page slug', 'geodirectory'),
97
-        'id' => 'geodir_location_prefix',
98
-        'type' => 'text',
99
-        'css' => 'min-width:300px;',
100
-        'std' => 'location' // Default value to show home top section
101
-    ),
102
-
103
-    array(
104
-        'name' => __('Location and category url separator', 'geodirectory'),
105
-        'desc' => __('Separator to show between location and category url slugs in listing urls', 'geodirectory'),
106
-        'id' => 'geodir_listingurl_separator',
107
-        'type' => 'text',
108
-        'css' => 'min-width:300px;',
109
-        'std' => 'C' // Default value to show home top section
110
-    ),
111
-
112
-    array(
113
-        'name' => __('Listing detail url separator', 'geodirectory'),
114
-        'desc' => __('Separator to show before listing slug in listing detail urls', 'geodirectory'),
115
-        'id' => 'geodir_detailurl_separator',
116
-        'type' => 'text',
117
-        'css' => 'min-width:300px;',
118
-        'std' => 'info' // Default value to show home top section
119
-    ),
120
-
121
-
122
-    array('type' => 'sectionend', 'id' => 'geodir_permalink'),
123
-
124
-    array('name' => __('GeoDirectory Pages', 'geodirectory'),
125
-        'type' => 'sectionstart',
126
-        'desc' => '',
127
-        'id' => 'geodir_pages'),
128
-
129
-    array(
130
-        'name' => __('GD Home page', 'geodirectory'),
131
-        'desc' => __('Select the page to use for the GD homepage (you must also set this page in Settings>Reading>Front page for it to work)', 'geodirectory'),
132
-        'id' => 'geodir_home_page',
133
-        'type' => 'single_select_page',
134
-        'class' => 'chosen_select'
135
-    ),
136
-
137
-    array(
138
-        'name' => __('Add listing page', 'geodirectory'),
139
-        'desc' => __('Select the page to use for adding listings', 'geodirectory'),
140
-        'id' => 'geodir_add_listing_page',
141
-        'type' => 'single_select_page',
142
-        'class' => 'chosen_select'
143
-    ),
144
-
145
-    array(
146
-        'name' => __('Listing preview page', 'geodirectory'),
147
-        'desc' => __('Select the page to use for listing preview', 'geodirectory'),
148
-        'id' => 'geodir_preview_page',
149
-        'type' => 'single_select_page',
150
-        'class' => 'chosen_select'
151
-    ),
152
-
153
-    array(
154
-        'name' => __('Listing success page', 'geodirectory'),
155
-        'desc' => __('Select the page to use for listing success', 'geodirectory'),
156
-        'id' => 'geodir_success_page',
157
-        'type' => 'single_select_page',
158
-        'class' => 'chosen_select'
159
-    ),
160
-
161
-    array(
162
-        'name' => __('Location page', 'geodirectory'),
163
-        'desc' => __('Select the page to use for locations', 'geodirectory'),
164
-        'id' => 'geodir_location_page',
165
-        'type' => 'single_select_page',
166
-        'class' => 'chosen_select'
167
-    ),
168
-
169
-    array(
170
-        'name' => __('Terms and Conditions page', 'geodirectory'),
171
-        'desc' => __('Select the page to use for Terms and Conditions (if enabled)', 'geodirectory'),
172
-        'id' => 'geodir_term_condition_page',
173
-        'type' => 'single_select_page',
174
-        'class' => 'chosen_select'
175
-    ),
176
-
177
-    array(
178
-        'name' => __('Info page', 'geodirectory'),
179
-        'desc' => __('Select the page to use for Gd general Info', 'geodirectory'),
180
-        'id' => 'geodir_info_page',
181
-        'type' => 'single_select_page',
182
-        'class' => 'chosen_select'
183
-    ),
184
-
185
-    array(
186
-        'name' => __('Login page', 'geodirectory'),
187
-        'desc' => __('Select the page to use for Login / Register', 'geodirectory'),
188
-        'id' => 'geodir_login_page',
189
-        'type' => 'single_select_page',
190
-        'class' => 'chosen_select'
191
-    ),
192
-
193
-
194
-    array('type' => 'sectionend', 'id' => 'geodir_pages'),
195
-
196
-    /* Listing Detail Permalink Settings End */
19
+	/* Listing Permalink Settings start */
20
+	array('name' => __('Permalink', 'geodirectory'), 'type' => 'no_tabs', 'desc' => 'Settings to set permalink', 'id' => 'geodir_permalink_settings '),
21
+
22
+
23
+	array('name' => __('Listing Detail Permalink Settings', 'geodirectory'),
24
+		'type' => 'sectionstart',
25
+		'desc' => '',
26
+		'id' => 'geodir_permalink'),
27
+
28
+	array(
29
+		'name' => __('Add location in urls', 'geodirectory'),
30
+		'desc' => __('Add location slug in listing urls', 'geodirectory'),
31
+		'id' => 'geodir_add_location_url',
32
+		'type' => 'checkbox',
33
+		'std' => '1',
34
+		'checkboxgroup' => 'start'
35
+	),
36
+
37
+	array(
38
+		'name' => __('Add full location in listing urls', 'geodirectory'),
39
+		'desc' => __('Add full location info with country, region and city slug in listing urls', 'geodirectory'),
40
+		'id' => 'geodir_show_location_url',
41
+		'type' => 'radio',
42
+		'value' => 'all',
43
+		'std' => 'all',
44
+		'radiogroup' => ''
45
+	),
46
+
47
+	array(
48
+		'name' => __('Add country and city slug in listing urls', 'geodirectory'),
49
+		'desc' => __('Add country and city slug in listing urls (/country/city/)', 'geodirectory'),
50
+		'id' => 'geodir_show_location_url',
51
+		'type' => 'radio',
52
+		'std' => 'all',
53
+		'value' => 'country_city',
54
+		'radiogroup' => ''
55
+	),
56
+	array(
57
+		'name' => __('Add region and city slug in listing urls', 'geodirectory'),
58
+		'desc' => __('Add region and city slug in listing urls (/region/city/)', 'geodirectory'),
59
+		'id' => 'geodir_show_location_url',
60
+		'type' => 'radio',
61
+		'std' => 'all',
62
+		'value' => 'region_city',
63
+		'radiogroup' => ''
64
+	),
65
+	array(
66
+		'name' => __('Add only city in listing urls', 'geodirectory'),
67
+		'desc' => __('Add city slug in listing urls', 'geodirectory'),
68
+		'id' => 'geodir_show_location_url',
69
+		'type' => 'radio',
70
+		'std' => 'all',
71
+		'value' => 'city',
72
+		'radiogroup' => 'end'
73
+	),
74
+
75
+
76
+
77
+	array(
78
+		'name' => __('Add category in listing urls', 'geodirectory'),
79
+		'desc' => __('Add requested category slugs in listing urls', 'geodirectory'),
80
+		'id' => 'geodir_add_categories_url',
81
+		'type' => 'checkbox',
82
+		'std' => '1',
83
+	),
84
+
85
+	array(
86
+		'name' => __('Listing url prefix', 'geodirectory'),
87
+		'desc' => __('Listing prefix to show in url', 'geodirectory'),
88
+		'id' => 'geodir_listing_prefix',
89
+		'type' => 'text',
90
+		'css' => 'min-width:300px;',
91
+		'std' => 'places'
92
+	),
93
+
94
+	array(
95
+		'name' => __('Location url prefix', 'geodirectory'),
96
+		'desc' => __('Depreciated, now uses the location page slug', 'geodirectory'),
97
+		'id' => 'geodir_location_prefix',
98
+		'type' => 'text',
99
+		'css' => 'min-width:300px;',
100
+		'std' => 'location' // Default value to show home top section
101
+	),
102
+
103
+	array(
104
+		'name' => __('Location and category url separator', 'geodirectory'),
105
+		'desc' => __('Separator to show between location and category url slugs in listing urls', 'geodirectory'),
106
+		'id' => 'geodir_listingurl_separator',
107
+		'type' => 'text',
108
+		'css' => 'min-width:300px;',
109
+		'std' => 'C' // Default value to show home top section
110
+	),
111
+
112
+	array(
113
+		'name' => __('Listing detail url separator', 'geodirectory'),
114
+		'desc' => __('Separator to show before listing slug in listing detail urls', 'geodirectory'),
115
+		'id' => 'geodir_detailurl_separator',
116
+		'type' => 'text',
117
+		'css' => 'min-width:300px;',
118
+		'std' => 'info' // Default value to show home top section
119
+	),
120
+
121
+
122
+	array('type' => 'sectionend', 'id' => 'geodir_permalink'),
123
+
124
+	array('name' => __('GeoDirectory Pages', 'geodirectory'),
125
+		'type' => 'sectionstart',
126
+		'desc' => '',
127
+		'id' => 'geodir_pages'),
128
+
129
+	array(
130
+		'name' => __('GD Home page', 'geodirectory'),
131
+		'desc' => __('Select the page to use for the GD homepage (you must also set this page in Settings>Reading>Front page for it to work)', 'geodirectory'),
132
+		'id' => 'geodir_home_page',
133
+		'type' => 'single_select_page',
134
+		'class' => 'chosen_select'
135
+	),
136
+
137
+	array(
138
+		'name' => __('Add listing page', 'geodirectory'),
139
+		'desc' => __('Select the page to use for adding listings', 'geodirectory'),
140
+		'id' => 'geodir_add_listing_page',
141
+		'type' => 'single_select_page',
142
+		'class' => 'chosen_select'
143
+	),
144
+
145
+	array(
146
+		'name' => __('Listing preview page', 'geodirectory'),
147
+		'desc' => __('Select the page to use for listing preview', 'geodirectory'),
148
+		'id' => 'geodir_preview_page',
149
+		'type' => 'single_select_page',
150
+		'class' => 'chosen_select'
151
+	),
152
+
153
+	array(
154
+		'name' => __('Listing success page', 'geodirectory'),
155
+		'desc' => __('Select the page to use for listing success', 'geodirectory'),
156
+		'id' => 'geodir_success_page',
157
+		'type' => 'single_select_page',
158
+		'class' => 'chosen_select'
159
+	),
160
+
161
+	array(
162
+		'name' => __('Location page', 'geodirectory'),
163
+		'desc' => __('Select the page to use for locations', 'geodirectory'),
164
+		'id' => 'geodir_location_page',
165
+		'type' => 'single_select_page',
166
+		'class' => 'chosen_select'
167
+	),
168
+
169
+	array(
170
+		'name' => __('Terms and Conditions page', 'geodirectory'),
171
+		'desc' => __('Select the page to use for Terms and Conditions (if enabled)', 'geodirectory'),
172
+		'id' => 'geodir_term_condition_page',
173
+		'type' => 'single_select_page',
174
+		'class' => 'chosen_select'
175
+	),
176
+
177
+	array(
178
+		'name' => __('Info page', 'geodirectory'),
179
+		'desc' => __('Select the page to use for Gd general Info', 'geodirectory'),
180
+		'id' => 'geodir_info_page',
181
+		'type' => 'single_select_page',
182
+		'class' => 'chosen_select'
183
+	),
184
+
185
+	array(
186
+		'name' => __('Login page', 'geodirectory'),
187
+		'desc' => __('Select the page to use for Login / Register', 'geodirectory'),
188
+		'id' => 'geodir_login_page',
189
+		'type' => 'single_select_page',
190
+		'class' => 'chosen_select'
191
+	),
192
+
193
+
194
+	array('type' => 'sectionend', 'id' => 'geodir_pages'),
195
+
196
+	/* Listing Detail Permalink Settings End */
197 197
 
198 198
 
199 199
 )); // End Design settings
Please login to merge, or discard this patch.
geodirectory-functions/compatibility/Divi.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
  */
19 19
 function geodir_divi_signup_body_class($classes)
20 20
 {
21
-    if (geodir_is_page('login')) {
22
-        $classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes);
23
-        $classes[] = 'divi-gd-signup';
24
-    }
25
-    return $classes;
21
+	if (geodir_is_page('login')) {
22
+		$classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes);
23
+		$classes[] = 'divi-gd-signup';
24
+	}
25
+	return $classes;
26 26
 }
27 27
 
28 28
 add_action('geodir_wrapper_close', 'geodir_divi_action_wrapper_close', 11);
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
  */
35 35
 function geodir_divi_action_wrapper_close()
36 36
 {
37
-    if (geodir_is_page('login')) {
38
-        // We need to close extra divs generated by WRAPPER BEFORE MAIN CONTENT (below) because there is no sidebar on this page
39
-        echo '</div></div>';
40
-    }
37
+	if (geodir_is_page('login')) {
38
+		// We need to close extra divs generated by WRAPPER BEFORE MAIN CONTENT (below) because there is no sidebar on this page
39
+		echo '</div></div>';
40
+	}
41 41
 }
42 42
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/compatibility/Multi_News.php 3 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,8 +126,10 @@
 block discarded – undo
126 126
     $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
127 127
     if (preg_match_all("/$regexp/siU", $crums, $matches)) {
128 128
         return $matches[0];
129
-    } else return '';
130
-}
129
+    } else {
130
+    	return '';
131
+    }
132
+    }
131 133
 
132 134
 
133 135
 /**
Please login to merge, or discard this patch.
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -16,36 +16,36 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function multi_news_action_calls()
18 18
 {
19
-    // REMOVE BREADCRUMB
20
-    remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
21
-    remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
22
-    remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
23
-    remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
24
-    remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
25
-    remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
26
-
27
-    //ADD BREADCRUMS
28
-    add_action('geodir_detail_before_main_content', 'gd_mn_replace_breadcrums', 20);
29
-    add_action('geodir_listings_before_main_content', 'gd_mn_replace_breadcrums', 20);
30
-    add_action('geodir_author_before_main_content', 'gd_mn_replace_breadcrums', 20);
31
-    add_action('geodir_search_before_main_content', 'gd_mn_replace_breadcrums', 20);
32
-    //add_action('geodir_home_before_main_content', 'gd_mn_replace_breadcrums', 20);
33
-    add_action('geodir_location_before_main_content', 'gd_mn_replace_breadcrums', 20);
34
-
35
-
36
-    // fix breadcrums
37
-    add_filter('breadcrumbs_plus_items', 'gd_breadcrumbs_plus_items', 1);
38
-
39
-    // REMOVE PAGE TITLES
40
-    remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
41
-    // remove_action( 'geodir_add_listing_page_title', 'geodir_action_add_listing_page_title',10);
42
-    remove_action('geodir_details_main_content', 'geodir_action_page_title', 20);
43
-    remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
44
-    remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
45
-
46
-
47
-    add_action('geodir_wrapper_content_open', 'gd_mn_extra_wrap', 30, 1);
48
-    add_action('geodir_wrapper_content_close', 'gd_mn_extra_wrap_end', 3, 1);
19
+	// REMOVE BREADCRUMB
20
+	remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
21
+	remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
22
+	remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
23
+	remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
24
+	remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
25
+	remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
26
+
27
+	//ADD BREADCRUMS
28
+	add_action('geodir_detail_before_main_content', 'gd_mn_replace_breadcrums', 20);
29
+	add_action('geodir_listings_before_main_content', 'gd_mn_replace_breadcrums', 20);
30
+	add_action('geodir_author_before_main_content', 'gd_mn_replace_breadcrums', 20);
31
+	add_action('geodir_search_before_main_content', 'gd_mn_replace_breadcrums', 20);
32
+	//add_action('geodir_home_before_main_content', 'gd_mn_replace_breadcrums', 20);
33
+	add_action('geodir_location_before_main_content', 'gd_mn_replace_breadcrums', 20);
34
+
35
+
36
+	// fix breadcrums
37
+	add_filter('breadcrumbs_plus_items', 'gd_breadcrumbs_plus_items', 1);
38
+
39
+	// REMOVE PAGE TITLES
40
+	remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
41
+	// remove_action( 'geodir_add_listing_page_title', 'geodir_action_add_listing_page_title',10);
42
+	remove_action('geodir_details_main_content', 'geodir_action_page_title', 20);
43
+	remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
44
+	remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
45
+
46
+
47
+	add_action('geodir_wrapper_content_open', 'gd_mn_extra_wrap', 30, 1);
48
+	add_action('geodir_wrapper_content_close', 'gd_mn_extra_wrap_end', 3, 1);
49 49
 }
50 50
 
51 51
 /**
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
  */
58 58
 function gd_mn_extra_wrap($page)
59 59
 {
60
-    if ($page == 'add-listing-page') {
61
-        echo '<div class="site-content page-wrap">';
62
-    } elseif ($page == 'signup-page') {
63
-        echo '</div><div class="section full-width-section" style="float: left;width:100%;">';
64
-    }
60
+	if ($page == 'add-listing-page') {
61
+		echo '<div class="site-content page-wrap">';
62
+	} elseif ($page == 'signup-page') {
63
+		echo '</div><div class="section full-width-section" style="float: left;width:100%;">';
64
+	}
65 65
 
66 66
 }
67 67
 
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
  */
76 76
 function gd_mn_extra_wrap_end($page)
77 77
 {
78
-    if ($page == 'add-listing-page') {
79
-        echo '</div>';
80
-    }
78
+	if ($page == 'add-listing-page') {
79
+		echo '</div>';
80
+	}
81 81
 
82 82
 }
83 83
 
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 function gd_mn_replace_breadcrums()
92 92
 {
93 93
 
94
-    if (mom_option('breadcrumb') != 0) { ?>
94
+	if (mom_option('breadcrumb') != 0) { ?>
95 95
         <?php if (mom_option('cats_bread')) {
96
-            $cclass = '';
97
-            if (mom_option('cat_slider') == false) {
98
-                $cclass = 'post-crumbs ';
99
-            }
100
-            ?>
96
+			$cclass = '';
97
+			if (mom_option('cat_slider') == false) {
98
+				$cclass = 'post-crumbs ';
99
+			}
100
+			?>
101 101
             <div class="<?php echo $cclass; ?>entry-crumbs" xmlns:v="http://rdf.data-vocabulary.org/#">
102 102
 
103 103
                 <?php mom_breadcrumb(); ?>
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function gd_get_breadcrum_links()
121 121
 {
122
-    ob_start();
123
-    geodir_breadcrumb();
124
-    $crums = ob_get_contents();
125
-    ob_get_clean();
126
-    $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
127
-    if (preg_match_all("/$regexp/siU", $crums, $matches)) {
128
-        return $matches[0];
129
-    } else return '';
122
+	ob_start();
123
+	geodir_breadcrumb();
124
+	$crums = ob_get_contents();
125
+	ob_get_clean();
126
+	$regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
127
+	if (preg_match_all("/$regexp/siU", $crums, $matches)) {
128
+		return $matches[0];
129
+	} else return '';
130 130
 }
131 131
 
132 132
 
@@ -140,30 +140,30 @@  discard block
 block discarded – undo
140 140
  */
141 141
 function gd_breadcrumbs_plus_items($items)
142 142
 {   //print_r($items);exit;
143
-    $bits = array();
144
-    $pieces = gd_get_breadcrum_links();
145
-    //unset($pieces[0]);
146
-    $bits = $pieces;
143
+	$bits = array();
144
+	$pieces = gd_get_breadcrum_links();
145
+	//unset($pieces[0]);
146
+	$bits = $pieces;
147 147
 
148
-    $title = $items['last'];
149
-    if (is_page_geodir_home() || geodir_is_page('location')) {
148
+	$title = $items['last'];
149
+	if (is_page_geodir_home() || geodir_is_page('location')) {
150 150
 
151
-    } elseif (geodir_is_page('listing')) {
151
+	} elseif (geodir_is_page('listing')) {
152 152
 
153
-    } elseif (geodir_is_page('detail')) {
154
-        ob_start();
155
-        geodir_action_page_title();
156
-        $title = ob_get_contents();
157
-        ob_end_clean();
158
-    } elseif (geodir_is_page('search')) {
159
-    } elseif (geodir_is_page('author')) {
160
-    }
153
+	} elseif (geodir_is_page('detail')) {
154
+		ob_start();
155
+		geodir_action_page_title();
156
+		$title = ob_get_contents();
157
+		ob_end_clean();
158
+	} elseif (geodir_is_page('search')) {
159
+	} elseif (geodir_is_page('author')) {
160
+	}
161 161
 
162
-    $title = strip_tags($title);
163
-    $items = gd_breadcrumbs_plus_items_add($items, $bits, $title);
162
+	$title = strip_tags($title);
163
+	$items = gd_breadcrumbs_plus_items_add($items, $bits, $title);
164 164
 
165 165
 
166
-    return $items;
166
+	return $items;
167 167
 }
168 168
 
169 169
 
@@ -179,28 +179,28 @@  discard block
 block discarded – undo
179 179
  */
180 180
 function gd_breadcrumbs_plus_items_add($items, $bits, $last)
181 181
 {
182
-    //$pieces = explode("</div>", $items[0]);
183
-    if (is_array($bits)) {
184
-        $items = array();
185
-        $pieces = '';
186
-        foreach ($bits as $bit) {
187
-            $pieces .= $bit;
188
-        }
189
-        $items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">' . $pieces . "</div>";
190
-        if (isset($last) && $last) {
191
-            $items['last'] = $last;
192
-        }
193
-    }
194
-
195
-    //print_r($items);
196
-    return $items;
182
+	//$pieces = explode("</div>", $items[0]);
183
+	if (is_array($bits)) {
184
+		$items = array();
185
+		$pieces = '';
186
+		foreach ($bits as $bit) {
187
+			$pieces .= $bit;
188
+		}
189
+		$items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">' . $pieces . "</div>";
190
+		if (isset($last) && $last) {
191
+			$items['last'] = $last;
192
+		}
193
+	}
194
+
195
+	//print_r($items);
196
+	return $items;
197 197
 
198 198
 }
199 199
 
200 200
 add_filter('geodir_menu_after_sub_ul','gd_multinews_mobile_menu_caret',10,1);
201 201
 add_filter('geodir_location_switcher_menu_after_sub_ul','gd_multinews_mobile_menu_caret',10,1);
202 202
 function gd_multinews_mobile_menu_caret($html){
203
-    $html .= '<i class="responsive-caret"></i>';
204
-    return $html;
203
+	$html .= '<i class="responsive-caret"></i>';
204
+	return $html;
205 205
 
206 206
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         foreach ($bits as $bit) {
187 187
             $pieces .= $bit;
188 188
         }
189
-        $items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">' . $pieces . "</div>";
189
+        $items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">'.$pieces."</div>";
190 190
         if (isset($last) && $last) {
191 191
             $items['last'] = $last;
192 192
         }
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
 
198 198
 }
199 199
 
200
-add_filter('geodir_menu_after_sub_ul','gd_multinews_mobile_menu_caret',10,1);
201
-add_filter('geodir_location_switcher_menu_after_sub_ul','gd_multinews_mobile_menu_caret',10,1);
202
-function gd_multinews_mobile_menu_caret($html){
200
+add_filter('geodir_menu_after_sub_ul', 'gd_multinews_mobile_menu_caret', 10, 1);
201
+add_filter('geodir_location_switcher_menu_after_sub_ul', 'gd_multinews_mobile_menu_caret', 10, 1);
202
+function gd_multinews_mobile_menu_caret($html) {
203 203
     $html .= '<i class="responsive-caret"></i>';
204 204
     return $html;
205 205
 
Please login to merge, or discard this patch.
geodirectory-templates/preview-success.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -15,29 +15,29 @@  discard block
 block discarded – undo
15 15
     <?php
16 16
 
17 17
 
18
-    global $wpdb;
18
+	global $wpdb;
19 19
 
20
-    $post_id = $_REQUEST['pid'];
21
-    $post_info = get_post($post_id);
20
+	$post_id = $_REQUEST['pid'];
21
+	$post_info = get_post($post_id);
22 22
 
23
-    $posted_date = $post_info->post_date;
24
-    $productlink = get_permalink($post_id);
25
-    $siteName = get_bloginfo('name');
26
-    $siteurl = home_url();
27
-    $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
23
+	$posted_date = $post_info->post_date;
24
+	$productlink = get_permalink($post_id);
25
+	$siteName = get_bloginfo('name');
26
+	$siteurl = home_url();
27
+	$siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
28 28
 
29
-    $loginurl = geodir_login_url();
30
-    $loginurl_link = '<a href="' . $loginurl . '">login</a>';
29
+	$loginurl = geodir_login_url();
30
+	$loginurl_link = '<a href="' . $loginurl . '">login</a>';
31 31
 
32
-    $post_author = $post_info->post_author;
32
+	$post_author = $post_info->post_author;
33 33
 
34
-    $user_info = get_userdata($post_author);
35
-    $username = $user_info->user_login;
36
-    $user_email = $user_info->user_email;
34
+	$user_info = get_userdata($post_author);
35
+	$username = $user_info->user_login;
36
+	$user_email = $user_info->user_email;
37 37
 
38
-    $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')),'geodirectory'));
38
+	$message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')),'geodirectory'));
39 39
 
40
-    /*
40
+	/*
41 41
      * Filter the success page message before variable replacements.
42 42
      *
43 43
      * @since 1.5.7
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
      * @param object $post_info Post object.
46 46
      * @param object $user_info User object.
47 47
      */
48
-    $message = apply_filters('geodir_success_page_msg_before_var_replace', $message,$post_info, $user_info);
48
+	$message = apply_filters('geodir_success_page_msg_before_var_replace', $message,$post_info, $user_info);
49 49
 
50
-    $search_array = array('[#submited_information_link#]', '[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#user_email#]', '[#username#]', '[#login_url#]', '[#posted_date#]');
51
-    $replace_array = array($productlink, $productlink, $siteurl_link, $post_id, $siteName, $user_email, $username, $loginurl_link, $posted_date);
52
-    $message = str_replace($search_array, $replace_array, $message);
50
+	$search_array = array('[#submited_information_link#]', '[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#user_email#]', '[#username#]', '[#login_url#]', '[#posted_date#]');
51
+	$replace_array = array($productlink, $productlink, $siteurl_link, $post_id, $siteName, $user_email, $username, $loginurl_link, $posted_date);
52
+	$message = str_replace($search_array, $replace_array, $message);
53 53
 
54
-    /*
54
+	/*
55 55
      * Filter the success page message after variable replacements.
56 56
      *
57 57
      * @since 1.5.7
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
      * @param object $post_info Post object.
60 60
      * @param object $user_info User object.
61 61
      */
62
-    $message = apply_filters('geodir_success_page_msg_after_var_replace', $message,$post_info, $user_info);
62
+	$message = apply_filters('geodir_success_page_msg_after_var_replace', $message,$post_info, $user_info);
63 63
 
64 64
 
65 65
 
66
-    ?>
66
+	?>
67 67
 
68 68
     <?php
69 69
 
70
-    /*
70
+	/*
71 71
      * Action called before the success page message wrapper.
72 72
      *
73 73
      * @since 1.5.7
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
      * @param object $post_info Post object.
76 76
      * @param object $user_info User object.
77 77
      */
78
-    do_action('geodir_before_success_page_msg_wrapper', $message,$post_info, $user_info);
79
-    echo '<h5 class="geodir_information">';
80
-    echo $message;
81
-    echo '</h5>';
82
-    /*
78
+	do_action('geodir_before_success_page_msg_wrapper', $message,$post_info, $user_info);
79
+	echo '<h5 class="geodir_information">';
80
+	echo $message;
81
+	echo '</h5>';
82
+	/*
83 83
      * Action called after the success page message wrapper.
84 84
      *
85 85
      * @since 1.5.7
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
      * @param object $post_info Post object.
88 88
      * @param object $user_info User object.
89 89
      */
90
-    do_action('geodir_after_success_page_msg_wrapper', $message,$post_info, $user_info);
90
+	do_action('geodir_after_success_page_msg_wrapper', $message,$post_info, $user_info);
91 91
 
92
-    ?>
92
+	?>
93 93
 
94 94
 </div>
95 95
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
     $productlink = get_permalink($post_id);
25 25
     $siteName = get_bloginfo('name');
26 26
     $siteurl = home_url();
27
-    $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
27
+    $siteurl_link = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
28 28
 
29 29
     $loginurl = geodir_login_url();
30
-    $loginurl_link = '<a href="' . $loginurl . '">login</a>';
30
+    $loginurl_link = '<a href="'.$loginurl.'">login</a>';
31 31
 
32 32
     $post_author = $post_info->post_author;
33 33
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     $username = $user_info->user_login;
36 36
     $user_email = $user_info->user_email;
37 37
 
38
-    $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')),'geodirectory'));
38
+    $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')), 'geodirectory'));
39 39
 
40 40
     /*
41 41
      * Filter the success page message before variable replacements.
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      * @param object $post_info Post object.
46 46
      * @param object $user_info User object.
47 47
      */
48
-    $message = apply_filters('geodir_success_page_msg_before_var_replace', $message,$post_info, $user_info);
48
+    $message = apply_filters('geodir_success_page_msg_before_var_replace', $message, $post_info, $user_info);
49 49
 
50 50
     $search_array = array('[#submited_information_link#]', '[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#user_email#]', '[#username#]', '[#login_url#]', '[#posted_date#]');
51 51
     $replace_array = array($productlink, $productlink, $siteurl_link, $post_id, $siteName, $user_email, $username, $loginurl_link, $posted_date);
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * @param object $post_info Post object.
60 60
      * @param object $user_info User object.
61 61
      */
62
-    $message = apply_filters('geodir_success_page_msg_after_var_replace', $message,$post_info, $user_info);
62
+    $message = apply_filters('geodir_success_page_msg_after_var_replace', $message, $post_info, $user_info);
63 63
 
64 64
 
65 65
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      * @param object $post_info Post object.
76 76
      * @param object $user_info User object.
77 77
      */
78
-    do_action('geodir_before_success_page_msg_wrapper', $message,$post_info, $user_info);
78
+    do_action('geodir_before_success_page_msg_wrapper', $message, $post_info, $user_info);
79 79
     echo '<h5 class="geodir_information">';
80 80
     echo $message;
81 81
     echo '</h5>';
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      * @param object $post_info Post object.
88 88
      * @param object $user_info User object.
89 89
      */
90
-    do_action('geodir_after_success_page_msg_wrapper', $message,$post_info, $user_info);
90
+    do_action('geodir_after_success_page_msg_wrapper', $message, $post_info, $user_info);
91 91
 
92 92
     ?>
93 93
 
Please login to merge, or discard this patch.
geodirectory-widgets/geodirectory_bestof_widget.php 3 patches
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -356,10 +356,11 @@  discard block
 block discarded – undo
356 356
         $instance['character_count'] = $new_instance['character_count'];
357 357
         $instance['tab_layout'] = $new_instance['tab_layout'];
358 358
         $instance['excerpt_type'] = $new_instance['excerpt_type'];
359
-        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
360
-            $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
361
-        else
362
-            $instance['add_location_filter'] = '0';
359
+        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') {
360
+                    $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
361
+        } else {
362
+                    $instance['add_location_filter'] = '0';
363
+        }
363 364
         $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0;
364 365
         return $instance;
365 366
     }
@@ -510,7 +511,10 @@  discard block
 block discarded – undo
510 511
             <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
511 512
                 <?php _e('Enable Location Filter:', 'geodirectory');?>
512 513
                 <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
513
-                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
514
+                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) {
515
+	echo 'checked="checked"';
516
+}
517
+?>
514 518
                        value="1"/>
515 519
             </label>
516 520
         </p>
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
          * @param string $instance ['tab_layout'] Best of widget tab layout name.
52 52
          */
53 53
         $tab_layout = empty($instance['tab_layout']) ? 'bestof-tabs-on-top' : apply_filters('bestof_widget_tab_layout', $instance['tab_layout']);
54
-        echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">';
54
+        echo '<div class="bestof-widget-tab-layout '.$tab_layout.'">';
55 55
         echo $before_widget;
56 56
         $loc_terms = geodir_get_current_location_terms();
57 57
         if (!empty($loc_terms)) {
58
-            $cur_location = ' : ' . geodir_ucwords(str_replace('-', ' ', end($loc_terms)));
58
+            $cur_location = ' : '.geodir_ucwords(str_replace('-', ' ', end($loc_terms)));
59 59
         } else {
60 60
             $cur_location = '';
61 61
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
          *
77 77
          * @param string $instance ['title'] The widget title.
78 78
          */
79
-        $title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name') . $cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory'));
79
+        $title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name').$cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory'));
80 80
 
81 81
         /**
82 82
          * Filter the post type.
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         }
203 203
 
204 204
 
205
-        echo $before_title . __($title,'geodirectory') . $after_title;
205
+        echo $before_title.__($title, 'geodirectory').$after_title;
206 206
 
207 207
         //term navigation - start
208 208
         echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">';
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             $is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false;
214 214
 
215 215
             if ($is_dropdown) {
216
-                $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr(__('Select Category', 'geodirectory')) . '">';
216
+                $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="'.esc_attr(__('Select Category', 'geodirectory')).'">';
217 217
             } else {
218 218
                 $nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">';
219 219
                 $nav_html .= '<dt></dt>';
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                     }
231 231
                     if ($is_dropdown) {
232 232
                         $selected = ($cat_count == 1) ? 'selected="selected"' : '';
233
-                        $nav_html .= '<option ' . $selected . ' value="' . $cat->term_id . '">' . geodir_ucwords($cat->name) . '</option>';
233
+                        $nav_html .= '<option '.$selected.' value="'.$cat->term_id.'">'.geodir_ucwords($cat->name).'</option>';
234 234
                     } else {
235 235
                         if ($cat_count == 1) {
236 236
                             $nav_html .= '<dd class="geodir-tab-active">';
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
                             $nav_html .= '<dd class="">';
239 239
                         }
240 240
                         $term_icon_url = !empty($term_icon) && isset($term_icon[$cat->term_id]) ? $term_icon[$cat->term_id] : '';
241
-                        $nav_html .= '<a data-termid="' . $cat->term_id . '" href="' . get_term_link($cat, $cat->taxonomy) . '">';
242
-                        $nav_html .= '<img alt="' . $cat->name . ' icon" class="bestof-cat-icon" src="' . $term_icon_url . '"/>';
241
+                        $nav_html .= '<a data-termid="'.$cat->term_id.'" href="'.get_term_link($cat, $cat->taxonomy).'">';
242
+                        $nav_html .= '<img alt="'.$cat->name.' icon" class="bestof-cat-icon" src="'.$term_icon_url.'"/>';
243 243
                         $nav_html .= '<span>';
244 244
                         $nav_html .= geodir_ucwords($cat->name);
245 245
                         $nav_html .= '<small>';
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
                             if ($num_reviews == 0) {
249 249
                                 $reviews = __('No Reviews', 'geodirectory');
250 250
                             } elseif ($num_reviews > 1) {
251
-                                $reviews = $num_reviews . __(' Reviews', 'geodirectory');
251
+                                $reviews = $num_reviews.__(' Reviews', 'geodirectory');
252 252
                             } else {
253 253
                                 $reviews = __('1 Review', 'geodirectory');
254 254
                             }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
                  */
322 322
                 $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $first_term);
323 323
 
324
-                echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $first_term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>';
324
+                echo '<h3 class="bestof-cat-title">'.wp_sprintf(__('Best of %s', 'geodirectory'), $first_term->name).'<a href="'.esc_url($view_all_link).'">'.__("View all", 'geodirectory').'</a></h3>';
325 325
             }
326 326
             if ($excerpt_type == 'show-reviews') {
327 327
                 add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
      */
379 379
     public function form($instance)
380 380
     {
381
-        $instance = wp_parse_args((array)$instance,
381
+        $instance = wp_parse_args((array) $instance,
382 382
             array(
383 383
                 'title' => '',
384 384
                 'post_type' => '',
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
         ?>
405 405
         <p>
406
-            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
406
+            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
407 407
 
408 408
                 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
409 409
                        name="<?php echo $this->get_field_name('title'); ?>" type="text"
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 
414 414
         <p>
415 415
             <label
416
-                for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?>
416
+                for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?>
417 417
 
418 418
                 <?php $postypes = geodir_get_posttypes();
419 419
                 /**
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         <p>
446 446
 
447 447
             <label
448
-                for="<?php echo $this->get_field_id('post_limit'); ?>"><?php _e('Number of posts:', 'geodirectory');?>
448
+                for="<?php echo $this->get_field_id('post_limit'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?>
449 449
 
450 450
                 <input class="widefat" id="<?php echo $this->get_field_id('post_limit'); ?>"
451 451
                        name="<?php echo $this->get_field_name('post_limit'); ?>" type="text"
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
         <p>
457 457
 
458 458
             <label
459
-                for="<?php echo $this->get_field_id('categ_limit'); ?>"><?php _e('Number of categories:', 'geodirectory');?>
459
+                for="<?php echo $this->get_field_id('categ_limit'); ?>"><?php _e('Number of categories:', 'geodirectory'); ?>
460 460
 
461 461
                 <input class="widefat" id="<?php echo $this->get_field_id('categ_limit'); ?>"
462 462
                        name="<?php echo $this->get_field_name('categ_limit'); ?>" type="text"
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 
467 467
         <p>
468 468
             <label
469
-                for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?>
469
+                for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?>
470 470
                 <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>"
471 471
                        name="<?php echo $this->get_field_name('character_count'); ?>" type="text"
472 472
                        value="<?php echo esc_attr($character_count); ?>"/>
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
         </p>
475 475
         <p>
476 476
             <label
477
-                for="<?php echo $this->get_field_id('tab_layout'); ?>"><?php _e('Tab Layout:', 'geodirectory');?>
477
+                for="<?php echo $this->get_field_id('tab_layout'); ?>"><?php _e('Tab Layout:', 'geodirectory'); ?>
478 478
 
479 479
                 <select class="widefat" id="<?php echo $this->get_field_id('tab_layout'); ?>"
480 480
                         name="<?php echo $this->get_field_name('tab_layout'); ?>">
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 
496 496
         <p>
497 497
             <label
498
-                for="<?php echo $this->get_field_id('excerpt_type'); ?>"><?php _e('Excerpt Type:', 'geodirectory');?>
498
+                for="<?php echo $this->get_field_id('excerpt_type'); ?>"><?php _e('Excerpt Type:', 'geodirectory'); ?>
499 499
 
500 500
                 <select class="widefat" id="<?php echo $this->get_field_id('excerpt_type'); ?>"
501 501
                         name="<?php echo $this->get_field_name('excerpt_type'); ?>">
@@ -512,9 +512,9 @@  discard block
 block discarded – undo
512 512
 
513 513
         <p>
514 514
             <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
515
-                <?php _e('Enable Location Filter:', 'geodirectory');?>
515
+                <?php _e('Enable Location Filter:', 'geodirectory'); ?>
516 516
                 <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
517
-                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
517
+                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?>
518 518
                        value="1"/>
519 519
             </label>
520 520
         </p>
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
         /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */
663 663
         $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $term);
664 664
 
665
-        echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>';
665
+        echo '<h3 class="bestof-cat-title">'.wp_sprintf(__('Best of %s', 'geodirectory'), $term->name).'<a href="'.esc_url($view_all_link).'">'.__("View all", 'geodirectory').'</a></h3>';
666 666
     }
667 667
     if ($excerpt_type == 'show-reviews') {
668 668
         add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
Please login to merge, or discard this patch.
Indentation   +519 added lines, -519 removed lines patch added patch discarded remove patch
@@ -14,282 +14,282 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class geodir_bestof_widget extends WP_Widget
16 16
 {
17
-    /**
18
-     * Register the best of widget with WordPress.
19
-     *
20
-     * @since 1.3.9
21
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22
-     */
23
-    public function __construct()
24
-    {
25
-        $widget_ops = array('classname' => 'geodir_bestof_widget', 'description' => __('GD > Best of widget', 'geodirectory'));
26
-        parent::__construct(
27
-            'bestof_widget', // Base ID
28
-            __('GD > Best of widget', 'geodirectory'), // Name
29
-            $widget_ops// Args
30
-        );
31
-    }
32
-
33
-    /**
34
-     * Front-end display content for best of widget.
35
-     *
36
-     * @since 1.3.9
37
-     * @since 1.5.1 Added filter to view all link.
38
-     * @since 1.5.1 Declare function public.
39
-     *
40
-     * @param array $args Widget arguments.
41
-     * @param array $instance Saved values from database.
42
-     */
43
-    public function widget($args, $instance)
44
-    {
45
-        extract($args);
46
-        /**
47
-         * Filter the best of widget tab layout.
48
-         *
49
-         * @since 1.3.9
50
-         *
51
-         * @param string $instance ['tab_layout'] Best of widget tab layout name.
52
-         */
53
-        $tab_layout = empty($instance['tab_layout']) ? 'bestof-tabs-on-top' : apply_filters('bestof_widget_tab_layout', $instance['tab_layout']);
54
-        echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">';
55
-        echo $before_widget;
56
-        $loc_terms = geodir_get_current_location_terms();
57
-        if (!empty($loc_terms)) {
58
-            $cur_location = ' : ' . geodir_ucwords(str_replace('-', ' ', end($loc_terms)));
59
-        } else {
60
-            $cur_location = '';
61
-        }
62
-
63
-        /**
64
-         * Filter the current location name.
65
-         *
66
-         * @since 1.3.9
67
-         *
68
-         * @param string $cur_location Current location name.
69
-         */
70
-        $cur_location = apply_filters('bestof_widget_cur_location', $cur_location);
71
-
72
-        /**
73
-         * Filter the widget title.
74
-         *
75
-         * @since 1.3.9
76
-         *
77
-         * @param string $instance ['title'] The widget title.
78
-         */
79
-        $title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name') . $cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory'));
80
-
81
-        /**
82
-         * Filter the post type.
83
-         *
84
-         * @since 1.3.9
85
-         *
86
-         * @param string $instance ['post_type'] The post type.
87
-         */
88
-        $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('bestof_widget_post_type', $instance['post_type']);
89
-
90
-        /**
91
-         * Filter the excerpt type.
92
-         *
93
-         * @since 1.5.4
94
-         *
95
-         * @param string $instance ['excerpt_type'] The excerpt type.
96
-         */
97
-        $excerpt_type = empty($instance['excerpt_type']) ? 'show-desc' : apply_filters('bestof_widget_excerpt_type', $instance['excerpt_type']);
98
-
99
-
100
-        /**
101
-         * Filter the listing limit.
102
-         *
103
-         * @since 1.3.9
104
-         *
105
-         * @param int $instance ['post_limit'] No. of posts to display.
106
-         */
107
-        $post_limit = empty($instance['post_limit']) ? '5' : apply_filters('bestof_widget_post_limit', $instance['post_limit']);
108
-
109
-        /**
110
-         * Filter the category limit.
111
-         *
112
-         * @since 1.3.9
113
-         *
114
-         * @param int $instance ['categ_limit'] No. of categories to display.
115
-         */
116
-        $categ_limit = empty($instance['categ_limit']) ? '3' : apply_filters('bestof_widget_categ_limit', $instance['categ_limit']);
117
-        $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
118
-
119
-        /**
120
-         * Filter the use of location filter.
121
-         *
122
-         * @since 1.3.9
123
-         *
124
-         * @param int|bool $instance ['add_location_filter'] Filter listings using current location.
125
-         */
126
-        $add_location_filter = empty($instance['add_location_filter']) ? '1' : apply_filters('bestof_widget_location_filter', $instance['add_location_filter']);
127
-
128
-        // set post type to current viewing post type
129
-        if ($use_viewing_post_type) {
130
-            $current_post_type = geodir_get_current_posttype();
131
-            if ($current_post_type != '' && $current_post_type != $post_type) {
132
-                $post_type = $current_post_type;
133
-            }
134
-        }
135
-
136
-        if (isset($instance['character_count'])) {
137
-            /**
138
-             * Filter the widget's excerpt character count.
139
-             *
140
-             * @since 1.3.9
141
-             *
142
-             * @param int $instance ['character_count'] Excerpt character count.
143
-             */
144
-            $character_count = apply_filters('bestof_widget_list_character_count', $instance['character_count']);
145
-        } else {
146
-            $character_count = '';
147
-        }
148
-
149
-        $category_taxonomy = geodir_get_taxonomies($post_type);
150
-
151
-        $term_args = array(
152
-            'hide_empty' => true,
153
-            'parent' => 0
154
-        );
155
-
156
-        $term_args = apply_filters('bestof_widget_term_args', $term_args);
157
-
158
-        if (is_tax()) {
159
-            $taxonomy = get_query_var('taxonomy');
160
-            $cur_term = get_query_var('term');
161
-            $term_data = get_term_by('name', $cur_term, $taxonomy);
162
-            $term_args['parent'] = $term_data->term_id;
163
-        }
164
-
165
-        $terms = get_terms($category_taxonomy[0], $term_args);
166
-
167
-        $term_reviews = geodir_count_reviews_by_terms();
168
-        $a_terms = array();
169
-        foreach ($terms as $term) {
170
-
171
-
172
-            if ($term->count > 0) {
173
-                if (isset($term_reviews[$term->term_id])) {
174
-                    $term->review_count = $term_reviews[$term->term_id];
175
-                } else {
176
-                    $term->review_count = '0';
177
-                }
178
-
179
-                $a_terms[] = $term;
180
-            }
181
-
182
-        }
183
-
184
-
185
-        $terms = apply_filters('bestof_widget_sort_terms', geodir_sort_terms($a_terms, 'review_count'), $a_terms);
186
-
187
-        $query_args = array(
188
-            'posts_per_page' => $post_limit,
189
-            'is_geodir_loop' => true,
190
-            'post_type' => $post_type,
191
-            'gd_location' => $add_location_filter ? true : false,
192
-            'order_by' => 'high_review'
193
-        );
194
-        if ($character_count >= 0) {
195
-            $query_args['excerpt_length'] = $character_count;
196
-        }
197
-
198
-        $layout = array();
199
-        if ($tab_layout == 'bestof-tabs-as-dropdown') {
200
-            $layout[] = $tab_layout;
201
-        } else {
202
-            $layout[] = 'bestof-tabs-as-dropdown';
203
-            $layout[] = $tab_layout;
204
-        }
205
-
206
-
207
-        echo $before_title . __($title,'geodirectory') . $after_title;
208
-
209
-        //term navigation - start
210
-        echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">';
211
-
212
-        $final_html = '';
213
-        foreach ($layout as $tab_layout) {
214
-            $nav_html = '';
215
-            $is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false;
216
-
217
-            if ($is_dropdown) {
218
-                $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr(__('Select Category', 'geodirectory')) . '">';
219
-            } else {
220
-                $nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">';
221
-                $nav_html .= '<dt></dt>';
222
-            }
223
-
224
-
225
-            $term_icon = geodir_get_term_icon();
226
-            $cat_count = 0;
227
-            if (!empty($terms)) {
228
-                foreach ($terms as $cat) {
229
-                    $cat_count++;
230
-                    if ($cat_count > $categ_limit) {
231
-                        break;
232
-                    }
233
-                    if ($is_dropdown) {
234
-                        $selected = ($cat_count == 1) ? 'selected="selected"' : '';
235
-                        $nav_html .= '<option ' . $selected . ' value="' . $cat->term_id . '">' . geodir_ucwords($cat->name) . '</option>';
236
-                    } else {
237
-                        if ($cat_count == 1) {
238
-                            $nav_html .= '<dd class="geodir-tab-active">';
239
-                        } else {
240
-                            $nav_html .= '<dd class="">';
241
-                        }
242
-                        $term_icon_url = !empty($term_icon) && isset($term_icon[$cat->term_id]) ? $term_icon[$cat->term_id] : '';
243
-                        $nav_html .= '<a data-termid="' . $cat->term_id . '" href="' . get_term_link($cat, $cat->taxonomy) . '">';
244
-                        $nav_html .= '<img alt="' . $cat->name . ' icon" class="bestof-cat-icon" src="' . $term_icon_url . '"/>';
245
-                        $nav_html .= '<span>';
246
-                        $nav_html .= geodir_ucwords($cat->name);
247
-                        $nav_html .= '<small>';
248
-                        if (isset($cat->review_count)) {
249
-                            $num_reviews = $cat->review_count;
250
-                            if ($num_reviews == 0) {
251
-                                $reviews = __('No Reviews', 'geodirectory');
252
-                            } elseif ($num_reviews > 1) {
253
-                                $reviews = $num_reviews . __(' Reviews', 'geodirectory');
254
-                            } else {
255
-                                $reviews = __('1 Review', 'geodirectory');
256
-                            }
257
-                            $nav_html .= $reviews;
258
-                        }
259
-                        $nav_html .= '</small>';
260
-                        $nav_html .= '</span>';
261
-                        $nav_html .= '</a>';
262
-                        $nav_html .= '</dd>';
263
-                    }
264
-                }
265
-            }
266
-
267
-            if ($is_dropdown) {
268
-                $nav_html .= '</select>';
269
-            } else {
270
-                $nav_html .= '</dl>';
271
-            }
272
-            $final_html .= $nav_html;
273
-        }
274
-        if ($terms) {
275
-            echo $final_html;
276
-        }
277
-        echo '</div>';
278
-        //term navigation - end
279
-
280
-        //first term listings by default - start
281
-        $first_term = '';
282
-        if ($terms) {
283
-            $first_term = $terms[0];
284
-            $tax_query = array(
285
-                'taxonomy' => $category_taxonomy[0],
286
-                'field' => 'id',
287
-                'terms' => $first_term->term_id
288
-            );
289
-            $query_args['tax_query'] = array($tax_query);
290
-        }
291
-
292
-        ?>
17
+	/**
18
+	 * Register the best of widget with WordPress.
19
+	 *
20
+	 * @since 1.3.9
21
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22
+	 */
23
+	public function __construct()
24
+	{
25
+		$widget_ops = array('classname' => 'geodir_bestof_widget', 'description' => __('GD > Best of widget', 'geodirectory'));
26
+		parent::__construct(
27
+			'bestof_widget', // Base ID
28
+			__('GD > Best of widget', 'geodirectory'), // Name
29
+			$widget_ops// Args
30
+		);
31
+	}
32
+
33
+	/**
34
+	 * Front-end display content for best of widget.
35
+	 *
36
+	 * @since 1.3.9
37
+	 * @since 1.5.1 Added filter to view all link.
38
+	 * @since 1.5.1 Declare function public.
39
+	 *
40
+	 * @param array $args Widget arguments.
41
+	 * @param array $instance Saved values from database.
42
+	 */
43
+	public function widget($args, $instance)
44
+	{
45
+		extract($args);
46
+		/**
47
+		 * Filter the best of widget tab layout.
48
+		 *
49
+		 * @since 1.3.9
50
+		 *
51
+		 * @param string $instance ['tab_layout'] Best of widget tab layout name.
52
+		 */
53
+		$tab_layout = empty($instance['tab_layout']) ? 'bestof-tabs-on-top' : apply_filters('bestof_widget_tab_layout', $instance['tab_layout']);
54
+		echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">';
55
+		echo $before_widget;
56
+		$loc_terms = geodir_get_current_location_terms();
57
+		if (!empty($loc_terms)) {
58
+			$cur_location = ' : ' . geodir_ucwords(str_replace('-', ' ', end($loc_terms)));
59
+		} else {
60
+			$cur_location = '';
61
+		}
62
+
63
+		/**
64
+		 * Filter the current location name.
65
+		 *
66
+		 * @since 1.3.9
67
+		 *
68
+		 * @param string $cur_location Current location name.
69
+		 */
70
+		$cur_location = apply_filters('bestof_widget_cur_location', $cur_location);
71
+
72
+		/**
73
+		 * Filter the widget title.
74
+		 *
75
+		 * @since 1.3.9
76
+		 *
77
+		 * @param string $instance ['title'] The widget title.
78
+		 */
79
+		$title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name') . $cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory'));
80
+
81
+		/**
82
+		 * Filter the post type.
83
+		 *
84
+		 * @since 1.3.9
85
+		 *
86
+		 * @param string $instance ['post_type'] The post type.
87
+		 */
88
+		$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('bestof_widget_post_type', $instance['post_type']);
89
+
90
+		/**
91
+		 * Filter the excerpt type.
92
+		 *
93
+		 * @since 1.5.4
94
+		 *
95
+		 * @param string $instance ['excerpt_type'] The excerpt type.
96
+		 */
97
+		$excerpt_type = empty($instance['excerpt_type']) ? 'show-desc' : apply_filters('bestof_widget_excerpt_type', $instance['excerpt_type']);
98
+
99
+
100
+		/**
101
+		 * Filter the listing limit.
102
+		 *
103
+		 * @since 1.3.9
104
+		 *
105
+		 * @param int $instance ['post_limit'] No. of posts to display.
106
+		 */
107
+		$post_limit = empty($instance['post_limit']) ? '5' : apply_filters('bestof_widget_post_limit', $instance['post_limit']);
108
+
109
+		/**
110
+		 * Filter the category limit.
111
+		 *
112
+		 * @since 1.3.9
113
+		 *
114
+		 * @param int $instance ['categ_limit'] No. of categories to display.
115
+		 */
116
+		$categ_limit = empty($instance['categ_limit']) ? '3' : apply_filters('bestof_widget_categ_limit', $instance['categ_limit']);
117
+		$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
118
+
119
+		/**
120
+		 * Filter the use of location filter.
121
+		 *
122
+		 * @since 1.3.9
123
+		 *
124
+		 * @param int|bool $instance ['add_location_filter'] Filter listings using current location.
125
+		 */
126
+		$add_location_filter = empty($instance['add_location_filter']) ? '1' : apply_filters('bestof_widget_location_filter', $instance['add_location_filter']);
127
+
128
+		// set post type to current viewing post type
129
+		if ($use_viewing_post_type) {
130
+			$current_post_type = geodir_get_current_posttype();
131
+			if ($current_post_type != '' && $current_post_type != $post_type) {
132
+				$post_type = $current_post_type;
133
+			}
134
+		}
135
+
136
+		if (isset($instance['character_count'])) {
137
+			/**
138
+			 * Filter the widget's excerpt character count.
139
+			 *
140
+			 * @since 1.3.9
141
+			 *
142
+			 * @param int $instance ['character_count'] Excerpt character count.
143
+			 */
144
+			$character_count = apply_filters('bestof_widget_list_character_count', $instance['character_count']);
145
+		} else {
146
+			$character_count = '';
147
+		}
148
+
149
+		$category_taxonomy = geodir_get_taxonomies($post_type);
150
+
151
+		$term_args = array(
152
+			'hide_empty' => true,
153
+			'parent' => 0
154
+		);
155
+
156
+		$term_args = apply_filters('bestof_widget_term_args', $term_args);
157
+
158
+		if (is_tax()) {
159
+			$taxonomy = get_query_var('taxonomy');
160
+			$cur_term = get_query_var('term');
161
+			$term_data = get_term_by('name', $cur_term, $taxonomy);
162
+			$term_args['parent'] = $term_data->term_id;
163
+		}
164
+
165
+		$terms = get_terms($category_taxonomy[0], $term_args);
166
+
167
+		$term_reviews = geodir_count_reviews_by_terms();
168
+		$a_terms = array();
169
+		foreach ($terms as $term) {
170
+
171
+
172
+			if ($term->count > 0) {
173
+				if (isset($term_reviews[$term->term_id])) {
174
+					$term->review_count = $term_reviews[$term->term_id];
175
+				} else {
176
+					$term->review_count = '0';
177
+				}
178
+
179
+				$a_terms[] = $term;
180
+			}
181
+
182
+		}
183
+
184
+
185
+		$terms = apply_filters('bestof_widget_sort_terms', geodir_sort_terms($a_terms, 'review_count'), $a_terms);
186
+
187
+		$query_args = array(
188
+			'posts_per_page' => $post_limit,
189
+			'is_geodir_loop' => true,
190
+			'post_type' => $post_type,
191
+			'gd_location' => $add_location_filter ? true : false,
192
+			'order_by' => 'high_review'
193
+		);
194
+		if ($character_count >= 0) {
195
+			$query_args['excerpt_length'] = $character_count;
196
+		}
197
+
198
+		$layout = array();
199
+		if ($tab_layout == 'bestof-tabs-as-dropdown') {
200
+			$layout[] = $tab_layout;
201
+		} else {
202
+			$layout[] = 'bestof-tabs-as-dropdown';
203
+			$layout[] = $tab_layout;
204
+		}
205
+
206
+
207
+		echo $before_title . __($title,'geodirectory') . $after_title;
208
+
209
+		//term navigation - start
210
+		echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">';
211
+
212
+		$final_html = '';
213
+		foreach ($layout as $tab_layout) {
214
+			$nav_html = '';
215
+			$is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false;
216
+
217
+			if ($is_dropdown) {
218
+				$nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr(__('Select Category', 'geodirectory')) . '">';
219
+			} else {
220
+				$nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">';
221
+				$nav_html .= '<dt></dt>';
222
+			}
223
+
224
+
225
+			$term_icon = geodir_get_term_icon();
226
+			$cat_count = 0;
227
+			if (!empty($terms)) {
228
+				foreach ($terms as $cat) {
229
+					$cat_count++;
230
+					if ($cat_count > $categ_limit) {
231
+						break;
232
+					}
233
+					if ($is_dropdown) {
234
+						$selected = ($cat_count == 1) ? 'selected="selected"' : '';
235
+						$nav_html .= '<option ' . $selected . ' value="' . $cat->term_id . '">' . geodir_ucwords($cat->name) . '</option>';
236
+					} else {
237
+						if ($cat_count == 1) {
238
+							$nav_html .= '<dd class="geodir-tab-active">';
239
+						} else {
240
+							$nav_html .= '<dd class="">';
241
+						}
242
+						$term_icon_url = !empty($term_icon) && isset($term_icon[$cat->term_id]) ? $term_icon[$cat->term_id] : '';
243
+						$nav_html .= '<a data-termid="' . $cat->term_id . '" href="' . get_term_link($cat, $cat->taxonomy) . '">';
244
+						$nav_html .= '<img alt="' . $cat->name . ' icon" class="bestof-cat-icon" src="' . $term_icon_url . '"/>';
245
+						$nav_html .= '<span>';
246
+						$nav_html .= geodir_ucwords($cat->name);
247
+						$nav_html .= '<small>';
248
+						if (isset($cat->review_count)) {
249
+							$num_reviews = $cat->review_count;
250
+							if ($num_reviews == 0) {
251
+								$reviews = __('No Reviews', 'geodirectory');
252
+							} elseif ($num_reviews > 1) {
253
+								$reviews = $num_reviews . __(' Reviews', 'geodirectory');
254
+							} else {
255
+								$reviews = __('1 Review', 'geodirectory');
256
+							}
257
+							$nav_html .= $reviews;
258
+						}
259
+						$nav_html .= '</small>';
260
+						$nav_html .= '</span>';
261
+						$nav_html .= '</a>';
262
+						$nav_html .= '</dd>';
263
+					}
264
+				}
265
+			}
266
+
267
+			if ($is_dropdown) {
268
+				$nav_html .= '</select>';
269
+			} else {
270
+				$nav_html .= '</dl>';
271
+			}
272
+			$final_html .= $nav_html;
273
+		}
274
+		if ($terms) {
275
+			echo $final_html;
276
+		}
277
+		echo '</div>';
278
+		//term navigation - end
279
+
280
+		//first term listings by default - start
281
+		$first_term = '';
282
+		if ($terms) {
283
+			$first_term = $terms[0];
284
+			$tax_query = array(
285
+				'taxonomy' => $category_taxonomy[0],
286
+				'field' => 'id',
287
+				'terms' => $first_term->term_id
288
+			);
289
+			$query_args['tax_query'] = array($tax_query);
290
+		}
291
+
292
+		?>
293 293
         <input type="hidden" id="bestof_widget_post_type" name="bestof_widget_post_type"
294 294
                value="<?php echo $post_type; ?>">
295 295
         <input type="hidden" id="bestof_widget_excerpt_type" name="bestof_widget_excerpt_type"
@@ -300,110 +300,110 @@  discard block
 block discarded – undo
300 300
                value="<?php echo $category_taxonomy[0]; ?>">
301 301
         <input type="hidden" id="bestof_widget_location_filter" name="bestof_widget_location_filter"
302 302
                value="<?php if ($add_location_filter) {
303
-                   echo 1;
304
-               } else {
305
-                   echo 0;
306
-               } ?>">
303
+				   echo 1;
304
+			   } else {
305
+				   echo 0;
306
+			   } ?>">
307 307
         <input type="hidden" id="bestof_widget_char_count" name="bestof_widget_char_count"
308 308
                value="<?php echo $character_count; ?>">
309 309
         <div class="geo-bestof-contentwrap geodir-tabs-content" style="position: relative; z-index: 0;">
310 310
             <p id="geodir-bestof-loading" class="geodir-bestof-loading"><i class="fa fa-cog fa-spin"></i></p>
311 311
             <?php
312
-            echo '<div id="geodir-bestof-places">';
313
-            if ($terms) {
314
-                $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($first_term, $first_term->taxonomy));
315
-                /**
316
-                 * Filter the page link to view all lisitngs.
317
-                 *
318
-                 * @since 1.5.1
319
-                 *
320
-                 * @param array $view_all_link View all listings page link.
321
-                 * @param array $post_type The Post type.
322
-                 * @param array $first_term The category term object.
323
-                 */
324
-                $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $first_term);
325
-
326
-                echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $first_term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>';
327
-            }
328
-            if ($excerpt_type == 'show-reviews') {
329
-                add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
330
-            }
331
-            geodir_bestof_places_by_term($query_args);
332
-            if ($excerpt_type == 'show-reviews') {
333
-                remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
334
-            }
335
-            echo "</div>";
336
-            ?>
312
+			echo '<div id="geodir-bestof-places">';
313
+			if ($terms) {
314
+				$view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($first_term, $first_term->taxonomy));
315
+				/**
316
+				 * Filter the page link to view all lisitngs.
317
+				 *
318
+				 * @since 1.5.1
319
+				 *
320
+				 * @param array $view_all_link View all listings page link.
321
+				 * @param array $post_type The Post type.
322
+				 * @param array $first_term The category term object.
323
+				 */
324
+				$view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $first_term);
325
+
326
+				echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $first_term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>';
327
+			}
328
+			if ($excerpt_type == 'show-reviews') {
329
+				add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
330
+			}
331
+			geodir_bestof_places_by_term($query_args);
332
+			if ($excerpt_type == 'show-reviews') {
333
+				remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
334
+			}
335
+			echo "</div>";
336
+			?>
337 337
         </div>
338 338
         <?php //first term listings by default - end
339
-        ?>
339
+		?>
340 340
         <?php echo $after_widget;
341
-        echo "</div>";
342
-    }
343
-
344
-    /**
345
-     * Sanitize best of widget form values as they are saved.
346
-     *
347
-     * @since 1.3.9
348
-     * @since 1.5.1 Declare function public.
349
-     *
350
-     * @param array $new_instance Values just sent to be saved.
351
-     * @param array $old_instance Previously saved values from database.
352
-     *
353
-     * @return array Updated safe values to be saved.
354
-     */
355
-    public function update($new_instance, $old_instance)
356
-    {
357
-        $instance = $old_instance;
358
-        $instance['title'] = strip_tags($new_instance['title']);
359
-        $instance['post_type'] = strip_tags($new_instance['post_type']);
360
-        $instance['post_limit'] = strip_tags($new_instance['post_limit']);
361
-        $instance['categ_limit'] = strip_tags($new_instance['categ_limit']);
362
-        $instance['character_count'] = $new_instance['character_count'];
363
-        $instance['tab_layout'] = $new_instance['tab_layout'];
364
-        $instance['excerpt_type'] = $new_instance['excerpt_type'];
365
-        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
366
-            $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
367
-        else
368
-            $instance['add_location_filter'] = '0';
369
-        $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0;
370
-        return $instance;
371
-    }
372
-
373
-    /**
374
-     * Back-end best of widget settings form.
375
-     *
376
-     * @since 1.3.9
377
-     * @since 1.5.1 Declare function public.
378
-     *
379
-     * @param array $instance Previously saved values from database.
380
-     */
381
-    public function form($instance)
382
-    {
383
-        $instance = wp_parse_args((array)$instance,
384
-            array(
385
-                'title' => '',
386
-                'post_type' => '',
387
-                'post_limit' => '5',
388
-                'categ_limit' => '3',
389
-                'character_count' => '20',
390
-                'add_location_filter' => '1',
391
-                'tab_layout' => 'bestof-tabs-on-top',
392
-                'excerpt_type' => 'show-desc',
393
-                'use_viewing_post_type' => ''
394
-            )
395
-        );
396
-        $title = strip_tags($instance['title']);
397
-        $post_type = strip_tags($instance['post_type']);
398
-        $post_limit = strip_tags($instance['post_limit']);
399
-        $categ_limit = strip_tags($instance['categ_limit']);
400
-        $character_count = strip_tags($instance['character_count']);
401
-        $tab_layout = strip_tags($instance['tab_layout']);
402
-        $excerpt_type = strip_tags($instance['excerpt_type']);
403
-        $add_location_filter = strip_tags($instance['add_location_filter']);
404
-        $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false;
405
-
406
-        ?>
341
+		echo "</div>";
342
+	}
343
+
344
+	/**
345
+	 * Sanitize best of widget form values as they are saved.
346
+	 *
347
+	 * @since 1.3.9
348
+	 * @since 1.5.1 Declare function public.
349
+	 *
350
+	 * @param array $new_instance Values just sent to be saved.
351
+	 * @param array $old_instance Previously saved values from database.
352
+	 *
353
+	 * @return array Updated safe values to be saved.
354
+	 */
355
+	public function update($new_instance, $old_instance)
356
+	{
357
+		$instance = $old_instance;
358
+		$instance['title'] = strip_tags($new_instance['title']);
359
+		$instance['post_type'] = strip_tags($new_instance['post_type']);
360
+		$instance['post_limit'] = strip_tags($new_instance['post_limit']);
361
+		$instance['categ_limit'] = strip_tags($new_instance['categ_limit']);
362
+		$instance['character_count'] = $new_instance['character_count'];
363
+		$instance['tab_layout'] = $new_instance['tab_layout'];
364
+		$instance['excerpt_type'] = $new_instance['excerpt_type'];
365
+		if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
366
+			$instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
367
+		else
368
+			$instance['add_location_filter'] = '0';
369
+		$instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0;
370
+		return $instance;
371
+	}
372
+
373
+	/**
374
+	 * Back-end best of widget settings form.
375
+	 *
376
+	 * @since 1.3.9
377
+	 * @since 1.5.1 Declare function public.
378
+	 *
379
+	 * @param array $instance Previously saved values from database.
380
+	 */
381
+	public function form($instance)
382
+	{
383
+		$instance = wp_parse_args((array)$instance,
384
+			array(
385
+				'title' => '',
386
+				'post_type' => '',
387
+				'post_limit' => '5',
388
+				'categ_limit' => '3',
389
+				'character_count' => '20',
390
+				'add_location_filter' => '1',
391
+				'tab_layout' => 'bestof-tabs-on-top',
392
+				'excerpt_type' => 'show-desc',
393
+				'use_viewing_post_type' => ''
394
+			)
395
+		);
396
+		$title = strip_tags($instance['title']);
397
+		$post_type = strip_tags($instance['post_type']);
398
+		$post_limit = strip_tags($instance['post_limit']);
399
+		$categ_limit = strip_tags($instance['categ_limit']);
400
+		$character_count = strip_tags($instance['character_count']);
401
+		$tab_layout = strip_tags($instance['tab_layout']);
402
+		$excerpt_type = strip_tags($instance['excerpt_type']);
403
+		$add_location_filter = strip_tags($instance['add_location_filter']);
404
+		$use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false;
405
+
406
+		?>
407 407
         <p>
408 408
             <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
409 409
 
@@ -418,14 +418,14 @@  discard block
 block discarded – undo
418 418
                 for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?>
419 419
 
420 420
                 <?php $postypes = geodir_get_posttypes();
421
-                /**
422
-                 * Filter the post types to display in widget.
423
-                 *
424
-                 * @since 1.3.9
425
-                 *
426
-                 * @param array $postypes Post types array.
427
-                 */
428
-                $postypes = apply_filters('geodir_post_type_list_in_p_widget', $postypes); ?>
421
+				/**
422
+				 * Filter the post types to display in widget.
423
+				 *
424
+				 * @since 1.3.9
425
+				 *
426
+				 * @param array $postypes Post types array.
427
+				 */
428
+				$postypes = apply_filters('geodir_post_type_list_in_p_widget', $postypes); ?>
429 429
 
430 430
                 <select class="widefat" id="<?php echo $this->get_field_id('post_type'); ?>"
431 431
                         name="<?php echo $this->get_field_name('post_type'); ?>"
@@ -434,9 +434,9 @@  discard block
 block discarded – undo
434 434
                     <?php foreach ($postypes as $postypes_obj) { ?>
435 435
 
436 436
                         <option <?php if ($post_type == $postypes_obj) {
437
-                            echo 'selected="selected"';
438
-                        } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
439
-                            echo ucfirst($extvalue[1]); ?></option>
437
+							echo 'selected="selected"';
438
+						} ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
439
+							echo ucfirst($extvalue[1]); ?></option>
440 440
 
441 441
                     <?php } ?>
442 442
 
@@ -482,14 +482,14 @@  discard block
 block discarded – undo
482 482
                         name="<?php echo $this->get_field_name('tab_layout'); ?>">
483 483
 
484 484
                     <option <?php if ($tab_layout == 'bestof-tabs-on-top') {
485
-                        echo 'selected="selected"';
486
-                    } ?> value="bestof-tabs-on-top"><?php _e('Tabs on Top', 'geodirectory'); ?></option>
485
+						echo 'selected="selected"';
486
+					} ?> value="bestof-tabs-on-top"><?php _e('Tabs on Top', 'geodirectory'); ?></option>
487 487
                     <option <?php if ($tab_layout == 'bestof-tabs-on-left') {
488
-                        echo 'selected="selected"';
489
-                    } ?> value="bestof-tabs-on-left"><?php _e('Tabs on Left', 'geodirectory'); ?></option>
488
+						echo 'selected="selected"';
489
+					} ?> value="bestof-tabs-on-left"><?php _e('Tabs on Left', 'geodirectory'); ?></option>
490 490
                     <option <?php if ($tab_layout == 'bestof-tabs-as-dropdown') {
491
-                        echo 'selected="selected"';
492
-                    } ?>
491
+						echo 'selected="selected"';
492
+					} ?>
493 493
                         value="bestof-tabs-as-dropdown"><?php _e('Tabs as Dropdown', 'geodirectory'); ?></option>
494 494
                 </select>
495 495
             </label>
@@ -503,11 +503,11 @@  discard block
 block discarded – undo
503 503
                         name="<?php echo $this->get_field_name('excerpt_type'); ?>">
504 504
 
505 505
                     <option <?php if ($excerpt_type == 'show-desc') {
506
-                        echo 'selected="selected"';
507
-                    } ?> value="show-desc"><?php _e('Show Description', 'geodirectory'); ?></option>
506
+						echo 'selected="selected"';
507
+					} ?> value="show-desc"><?php _e('Show Description', 'geodirectory'); ?></option>
508 508
                     <option <?php if ($excerpt_type == 'show-reviews') {
509
-                        echo 'selected="selected"';
510
-                    } ?> value="show-reviews"><?php _e('Show Reviews if Available', 'geodirectory'); ?></option>
509
+						echo 'selected="selected"';
510
+					} ?> value="show-reviews"><?php _e('Show Reviews if Available', 'geodirectory'); ?></option>
511 511
                 </select>
512 512
             </label>
513 513
         </p>
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
                 for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?>
527 527
                 <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"
528 528
                        name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) {
529
-                    echo 'checked="checked"';
530
-                } ?>  value="1"/>
529
+					echo 'checked="checked"';
530
+				} ?>  value="1"/>
531 531
             </label>
532 532
         </p>
533 533
     <?php
534
-    }
534
+	}
535 535
 } // class geodir_bestof_widget
536 536
 
537 537
 register_widget('geodir_bestof_widget');
@@ -551,68 +551,68 @@  discard block
 block discarded – undo
551 551
  */
552 552
 function geodir_bestof_places_by_term($query_args)
553 553
 {
554
-    global $gd_session;
555
-
556
-    /**
557
-     * This action called before querying widget listings.
558
-     *
559
-     * @since 1.0.0
560
-     */
561
-    do_action('geodir_bestof_get_widget_listings_before');
562
-
563
-    $widget_listings = geodir_get_widget_listings($query_args);
564
-
565
-    /**
566
-     * This action called after querying widget listings.
567
-     *
568
-     * @since 1.0.0
569
-     */
570
-    do_action('geodir_bestof_get_widget_listings_after');
571
-
572
-    $character_count = isset($query_args['excerpt_length']) ? $query_args['excerpt_length'] : '';
573
-
574
-    if (!isset($character_count)) {
575
-        /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */
576
-        $character_count = $character_count == '' ? 50 : apply_filters('bestof_widget_character_count', $character_count);
577
-    }
578
-
579
-    /** This filter is documented in geodirectory-functions/general_functions.php */
580
-    $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
581
-
582
-    global $post, $map_jason, $map_canvas_arr, $gridview_columns_widget, $geodir_is_widget_listing;
583
-    $current_post = $post;
584
-    $current_map_jason = $map_jason;
585
-    $current_map_canvas_arr = $map_canvas_arr;
586
-    $current_grid_view = $gridview_columns_widget;
587
-    $gridview_columns_widget = null;
588
-
589
-    $gd_listing_view_set = $gd_session->get('gd_listing_view') ? true : false;
590
-    $gd_listing_view_old = $gd_listing_view_set ? $gd_session->get('gd_listing_view') : '';
591
-
592
-    $gd_session->set('gd_listing_view', '1');
593
-    $geodir_is_widget_listing = true;
594
-
595
-    /**
596
-     * Includes the template for the listing listview.
597
-     *
598
-     * @since 1.3.9
599
-     */
600
-    include($template);
601
-
602
-    $geodir_is_widget_listing = false;
603
-
604
-    $GLOBALS['post'] = $current_post;
605
-    if (!empty($current_post)) {
606
-        setup_postdata($current_post);
607
-    }
608
-    if ($gd_listing_view_set) { // Set back previous value
609
-        $gd_session->set('gd_listing_view', $gd_listing_view_old);
610
-    } else {
611
-        $gd_session->un_set('gd_listing_view');
612
-    }
613
-    $map_jason = $current_map_jason;
614
-    $map_canvas_arr = $current_map_canvas_arr;
615
-    $gridview_columns_widget = $current_grid_view;
554
+	global $gd_session;
555
+
556
+	/**
557
+	 * This action called before querying widget listings.
558
+	 *
559
+	 * @since 1.0.0
560
+	 */
561
+	do_action('geodir_bestof_get_widget_listings_before');
562
+
563
+	$widget_listings = geodir_get_widget_listings($query_args);
564
+
565
+	/**
566
+	 * This action called after querying widget listings.
567
+	 *
568
+	 * @since 1.0.0
569
+	 */
570
+	do_action('geodir_bestof_get_widget_listings_after');
571
+
572
+	$character_count = isset($query_args['excerpt_length']) ? $query_args['excerpt_length'] : '';
573
+
574
+	if (!isset($character_count)) {
575
+		/** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */
576
+		$character_count = $character_count == '' ? 50 : apply_filters('bestof_widget_character_count', $character_count);
577
+	}
578
+
579
+	/** This filter is documented in geodirectory-functions/general_functions.php */
580
+	$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
581
+
582
+	global $post, $map_jason, $map_canvas_arr, $gridview_columns_widget, $geodir_is_widget_listing;
583
+	$current_post = $post;
584
+	$current_map_jason = $map_jason;
585
+	$current_map_canvas_arr = $map_canvas_arr;
586
+	$current_grid_view = $gridview_columns_widget;
587
+	$gridview_columns_widget = null;
588
+
589
+	$gd_listing_view_set = $gd_session->get('gd_listing_view') ? true : false;
590
+	$gd_listing_view_old = $gd_listing_view_set ? $gd_session->get('gd_listing_view') : '';
591
+
592
+	$gd_session->set('gd_listing_view', '1');
593
+	$geodir_is_widget_listing = true;
594
+
595
+	/**
596
+	 * Includes the template for the listing listview.
597
+	 *
598
+	 * @since 1.3.9
599
+	 */
600
+	include($template);
601
+
602
+	$geodir_is_widget_listing = false;
603
+
604
+	$GLOBALS['post'] = $current_post;
605
+	if (!empty($current_post)) {
606
+		setup_postdata($current_post);
607
+	}
608
+	if ($gd_listing_view_set) { // Set back previous value
609
+		$gd_session->set('gd_listing_view', $gd_listing_view_old);
610
+	} else {
611
+		$gd_session->un_set('gd_listing_view');
612
+	}
613
+	$map_jason = $current_map_jason;
614
+	$map_canvas_arr = $current_map_canvas_arr;
615
+	$gridview_columns_widget = $current_grid_view;
616 616
 }
617 617
 
618 618
 //Ajax functions
@@ -629,51 +629,51 @@  discard block
 block discarded – undo
629 629
  */
630 630
 function geodir_bestof_callback()
631 631
 {
632
-    check_ajax_referer('geodir-bestof-nonce', 'geodir_bestof_nonce');
633
-    //set variables
634
-    $post_type = strip_tags(esc_sql($_POST['post_type']));
635
-    $post_limit = strip_tags(esc_sql($_POST['post_limit']));
636
-    $character_count = strip_tags(esc_sql($_POST['char_count']));
637
-    $taxonomy = strip_tags(esc_sql($_POST['taxonomy']));
638
-    $add_location_filter = strip_tags(esc_sql($_POST['add_location_filter']));
639
-    $term_id = strip_tags(esc_sql($_POST['term_id']));
640
-    $excerpt_type = strip_tags(esc_sql($_POST['excerpt_type']));
641
-
642
-    $query_args = array(
643
-        'posts_per_page' => $post_limit,
644
-        'is_geodir_loop' => true,
645
-        'post_type' => $post_type,
646
-        'gd_location' => $add_location_filter ? true : false,
647
-        'order_by' => 'high_review'
648
-    );
649
-
650
-    if ($character_count >= 0) {
651
-        $query_args['excerpt_length'] = $character_count;
652
-    }
653
-
654
-    $tax_query = array(
655
-        'taxonomy' => $taxonomy,
656
-        'field' => 'id',
657
-        'terms' => $term_id
658
-    );
659
-
660
-    $query_args['tax_query'] = array($tax_query);
661
-    if ($term_id && $taxonomy) {
662
-        $term = get_term_by('id', $term_id, $taxonomy);
663
-        $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($term));
664
-        /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */
665
-        $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $term);
666
-
667
-        echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>';
668
-    }
669
-    if ($excerpt_type == 'show-reviews') {
670
-        add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
671
-    }
672
-    geodir_bestof_places_by_term($query_args);
673
-    if ($excerpt_type == 'show-reviews') {
674
-        remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
675
-    }
676
-    gd_die();
632
+	check_ajax_referer('geodir-bestof-nonce', 'geodir_bestof_nonce');
633
+	//set variables
634
+	$post_type = strip_tags(esc_sql($_POST['post_type']));
635
+	$post_limit = strip_tags(esc_sql($_POST['post_limit']));
636
+	$character_count = strip_tags(esc_sql($_POST['char_count']));
637
+	$taxonomy = strip_tags(esc_sql($_POST['taxonomy']));
638
+	$add_location_filter = strip_tags(esc_sql($_POST['add_location_filter']));
639
+	$term_id = strip_tags(esc_sql($_POST['term_id']));
640
+	$excerpt_type = strip_tags(esc_sql($_POST['excerpt_type']));
641
+
642
+	$query_args = array(
643
+		'posts_per_page' => $post_limit,
644
+		'is_geodir_loop' => true,
645
+		'post_type' => $post_type,
646
+		'gd_location' => $add_location_filter ? true : false,
647
+		'order_by' => 'high_review'
648
+	);
649
+
650
+	if ($character_count >= 0) {
651
+		$query_args['excerpt_length'] = $character_count;
652
+	}
653
+
654
+	$tax_query = array(
655
+		'taxonomy' => $taxonomy,
656
+		'field' => 'id',
657
+		'terms' => $term_id
658
+	);
659
+
660
+	$query_args['tax_query'] = array($tax_query);
661
+	if ($term_id && $taxonomy) {
662
+		$term = get_term_by('id', $term_id, $taxonomy);
663
+		$view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($term));
664
+		/** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */
665
+		$view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $term);
666
+
667
+		echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>';
668
+	}
669
+	if ($excerpt_type == 'show-reviews') {
670
+		add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
671
+	}
672
+	geodir_bestof_places_by_term($query_args);
673
+	if ($excerpt_type == 'show-reviews') {
674
+		remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
675
+	}
676
+	gd_die();
677 677
 }
678 678
 
679 679
 //Javascript
@@ -686,8 +686,8 @@  discard block
 block discarded – undo
686 686
  */
687 687
 function geodir_bestof_js()
688 688
 {
689
-    $ajax_nonce = wp_create_nonce("geodir-bestof-nonce");
690
-    ?>
689
+	$ajax_nonce = wp_create_nonce("geodir-bestof-nonce");
690
+	?>
691 691
     <script type="text/javascript">
692 692
         jQuery(document).ready(function () {
693 693
             jQuery('.geodir-bestof-cat-list a, #geodir_bestof_tab_dd').on("click change", function (e) {
@@ -766,18 +766,18 @@  discard block
 block discarded – undo
766 766
 
767 767
 function best_of_show_review_in_excerpt($excerpt)
768 768
 {
769
-    global $wpdb, $post;
770
-    $review_table = GEODIR_REVIEW_TABLE;
771
-    $request = "SELECT comment_ID FROM $review_table WHERE post_id = $post->ID ORDER BY post_date DESC, id DESC LIMIT 1";
772
-    $comments = $wpdb->get_results($request);
773
-
774
-    if ($comments) {
775
-        foreach ($comments as $comment) {
776
-            // Set the extra comment info needed.
777
-            $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
778
-            $comment_content = $comment_extra->comment_content;
779
-            $excerpt = strip_tags($comment_content);
780
-        }
781
-    }
782
-    return $excerpt;
769
+	global $wpdb, $post;
770
+	$review_table = GEODIR_REVIEW_TABLE;
771
+	$request = "SELECT comment_ID FROM $review_table WHERE post_id = $post->ID ORDER BY post_date DESC, id DESC LIMIT 1";
772
+	$comments = $wpdb->get_results($request);
773
+
774
+	if ($comments) {
775
+		foreach ($comments as $comment) {
776
+			// Set the extra comment info needed.
777
+			$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
778
+			$comment_content = $comment_extra->comment_content;
779
+			$excerpt = strip_tags($comment_content);
780
+		}
781
+	}
782
+	return $excerpt;
783 783
 }
784 784
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-widgets/geodirectory_popular_widget.php 3 patches
Braces   +37 added lines, -14 removed lines patch added patch discarded remove patch
@@ -190,10 +190,11 @@  discard block
 block discarded – undo
190 190
         $instance['listing_width'] = strip_tags($new_instance['listing_width']);
191 191
         $instance['list_sort'] = strip_tags($new_instance['list_sort']);
192 192
         $instance['character_count'] = $new_instance['character_count'];
193
-        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
194
-            $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
195
-        else
196
-            $instance['add_location_filter'] = '0';
193
+        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') {
194
+                    $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
195
+        } else {
196
+                    $instance['add_location_filter'] = '0';
197
+        }
197 198
 
198 199
         $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0;
199 200
         $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0;
@@ -319,8 +320,9 @@  discard block
 block discarded – undo
319 320
 
320 321
                 $all_postypes = geodir_get_posttypes();
321 322
 
322
-                if (!in_array($post_type, $all_postypes))
323
-                    $post_type = 'gd_place';
323
+                if (!in_array($post_type, $all_postypes)) {
324
+                                    $post_type = 'gd_place';
325
+                }
324 326
 
325 327
                 $category_taxonomy = geodir_get_taxonomies($post_type);
326 328
                 $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
@@ -335,8 +337,9 @@  discard block
 block discarded – undo
335 337
                     } ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
336 338
                     <?php foreach ($categories as $category_obj) {
337 339
                         $selected = '';
338
-                        if (is_array($category) && in_array($category_obj->term_id, $category))
339
-                            echo $selected = 'selected="selected"';
340
+                        if (is_array($category) && in_array($category_obj->term_id, $category)) {
341
+                                                    echo $selected = 'selected="selected"';
342
+                        }
340 343
 
341 344
                         ?>
342 345
 
@@ -350,7 +353,12 @@  discard block
 block discarded – undo
350 353
 
351 354
                 <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>"
352 355
                        id="<?php echo $this->get_field_id('category_title'); ?>"
353
-                       value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/>
356
+                       value="<?php if ($category_title != '') {
357
+	echo $category_title;
358
+} else {
359
+	echo __('All', 'geodirectory');
360
+}
361
+?>"/>
354 362
 
355 363
             </label>
356 364
         </p>
@@ -453,7 +461,10 @@  discard block
 block discarded – undo
453 461
             <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
454 462
                 <?php _e('Enable Location Filter:', 'geodirectory');?>
455 463
                 <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
456
-                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
464
+                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) {
465
+	echo 'checked="checked"';
466
+}
467
+?>
457 468
                        value="1"/>
458 469
             </label>
459 470
         </p>
@@ -461,7 +472,10 @@  discard block
 block discarded – undo
461 472
             <label for="<?php echo $this->get_field_id('show_featured_only'); ?>">
462 473
                 <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox"
463 474
                                                                                             id="<?php echo $this->get_field_id('show_featured_only'); ?>"
464
-                                                                                            name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?>
475
+                                                                                            name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) {
476
+	echo 'checked="checked"';
477
+}
478
+?>
465 479
                                                                                             value="1"/>
466 480
             </label>
467 481
         </p>
@@ -469,7 +483,10 @@  discard block
 block discarded – undo
469 483
             <label for="<?php echo $this->get_field_id('show_special_only'); ?>">
470 484
                 <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox"
471 485
                                                                                                        id="<?php echo $this->get_field_id('show_special_only'); ?>"
472
-                                                                                                       name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?>
486
+                                                                                                       name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) {
487
+	echo 'checked="checked"';
488
+}
489
+?>
473 490
                                                                                                        value="1"/>
474 491
             </label>
475 492
         </p>
@@ -477,7 +494,10 @@  discard block
 block discarded – undo
477 494
             <label for="<?php echo $this->get_field_id('with_pics_only'); ?>">
478 495
                 <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox"
479 496
                                                                                              id="<?php echo $this->get_field_id('with_pics_only'); ?>"
480
-                                                                                             name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?>
497
+                                                                                             name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) {
498
+	echo 'checked="checked"';
499
+}
500
+?>
481 501
                                                                                              value="1"/>
482 502
             </label>
483 503
         </p>
@@ -485,7 +505,10 @@  discard block
 block discarded – undo
485 505
             <label for="<?php echo $this->get_field_id('with_videos_only'); ?>">
486 506
                 <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox"
487 507
                                                                                                id="<?php echo $this->get_field_id('with_videos_only'); ?>"
488
-                                                                                               name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?>
508
+                                                                                               name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) {
509
+	echo 'checked="checked"';
510
+}
511
+?>
489 512
                                                                                                value="1"/>
490 513
             </label>
491 514
         </p>
Please login to merge, or discard this patch.
Indentation   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -14,83 +14,83 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class geodir_popular_post_category extends WP_Widget
16 16
 {
17
-    /**
18
-     * Register the popular post category widget.
19
-     *
20
-     * @since 1.0.0
21
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22
-     */
23
-    public function __construct() {
24
-        $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory'));
25
-        parent::__construct(
26
-            'popular_post_category', // Base ID
27
-            __('GD > Popular Post Category', 'geodirectory'), // Name
28
-            $widget_ops// Args
29
-        );
30
-    }
31
-
32
-    /**
33
-     * Front-end display content for popular post category widget.
34
-     *
35
-     * @since 1.0.0
36
-     * @since 1.5.1 Declare function public.
37
-     *
38
-     * @param array $args     Widget arguments.
39
-     * @param array $instance Saved values from database.
40
-     */
41
-    public function widget($args, $instance)
42
-    {
43
-        geodir_popular_post_category_output($args, $instance);
44
-    }
45
-
46
-    /**
47
-     * Sanitize popular post category widget form values as they are saved.
48
-     *
49
-     * @since 1.0.0
50
-     * @since 1.5.1 Declare function public.
51
-     * @since 1.5.1 Added default_post_type parameter.
52
-     * @since 1.6.9 Added parent_only parameter.
53
-     *
54
-     * @param array $new_instance Values just sent to be saved.
55
-     * @param array $old_instance Previously saved values from database.
56
-     *
57
-     * @return array Updated safe values to be saved.
58
-     */ 
59
-    public function update($new_instance, $old_instance)
60
-    {
61
-        //save the widget
62
-        $instance = $old_instance;
63
-        $instance['title'] = strip_tags($new_instance['title']);
64
-        $category_limit = (int)$new_instance['category_limit'];
65
-        $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15;
66
-        $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : '';
67
-        $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false;
68
-        return $instance;
69
-    }
70
-
71
-    /**
72
-     * Back-end popular post category widget settings form.
73
-     *
74
-     * @since 1.0.0
75
-     * @since 1.5.1 Declare function public.
76
-     * @since 1.5.1 Added option to set default post type.
77
-     * @since 1.6.9 Added option to show parent categories only.
78
-     *
79
-     * @param array $instance Previously saved values from database.
80
-     */
81
-    public function form($instance) 
82
-    {
83
-        //widgetform in backend
84
-        $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false));
85
-
86
-        $title = strip_tags($instance['title']);
87
-        $category_limit = (int)$instance['category_limit'];
88
-        $category_limit = $category_limit > 0 ? $category_limit : 15;
89
-        $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : '';
90
-        $parent_only = !empty($instance['parent_only']) ? true: false;
17
+	/**
18
+	 * Register the popular post category widget.
19
+	 *
20
+	 * @since 1.0.0
21
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22
+	 */
23
+	public function __construct() {
24
+		$widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory'));
25
+		parent::__construct(
26
+			'popular_post_category', // Base ID
27
+			__('GD > Popular Post Category', 'geodirectory'), // Name
28
+			$widget_ops// Args
29
+		);
30
+	}
31
+
32
+	/**
33
+	 * Front-end display content for popular post category widget.
34
+	 *
35
+	 * @since 1.0.0
36
+	 * @since 1.5.1 Declare function public.
37
+	 *
38
+	 * @param array $args     Widget arguments.
39
+	 * @param array $instance Saved values from database.
40
+	 */
41
+	public function widget($args, $instance)
42
+	{
43
+		geodir_popular_post_category_output($args, $instance);
44
+	}
45
+
46
+	/**
47
+	 * Sanitize popular post category widget form values as they are saved.
48
+	 *
49
+	 * @since 1.0.0
50
+	 * @since 1.5.1 Declare function public.
51
+	 * @since 1.5.1 Added default_post_type parameter.
52
+	 * @since 1.6.9 Added parent_only parameter.
53
+	 *
54
+	 * @param array $new_instance Values just sent to be saved.
55
+	 * @param array $old_instance Previously saved values from database.
56
+	 *
57
+	 * @return array Updated safe values to be saved.
58
+	 */ 
59
+	public function update($new_instance, $old_instance)
60
+	{
61
+		//save the widget
62
+		$instance = $old_instance;
63
+		$instance['title'] = strip_tags($new_instance['title']);
64
+		$category_limit = (int)$new_instance['category_limit'];
65
+		$instance['category_limit'] = $category_limit > 0 ? $category_limit : 15;
66
+		$instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : '';
67
+		$instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false;
68
+		return $instance;
69
+	}
70
+
71
+	/**
72
+	 * Back-end popular post category widget settings form.
73
+	 *
74
+	 * @since 1.0.0
75
+	 * @since 1.5.1 Declare function public.
76
+	 * @since 1.5.1 Added option to set default post type.
77
+	 * @since 1.6.9 Added option to show parent categories only.
78
+	 *
79
+	 * @param array $instance Previously saved values from database.
80
+	 */
81
+	public function form($instance) 
82
+	{
83
+		//widgetform in backend
84
+		$instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false));
85
+
86
+		$title = strip_tags($instance['title']);
87
+		$category_limit = (int)$instance['category_limit'];
88
+		$category_limit = $category_limit > 0 ? $category_limit : 15;
89
+		$default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : '';
90
+		$parent_only = !empty($instance['parent_only']) ? true: false;
91 91
         
92
-        $post_type_options = geodir_get_posttypes('options');
93
-        ?>
92
+		$post_type_options = geodir_get_posttypes('options');
93
+		?>
94 94
         <p>
95 95
             <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
96 96
                 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>"/>
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
             <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label>
117 117
         </p>
118 118
     <?php
119
-    }
119
+	}
120 120
 } // class geodir_popular_post_category
121 121
 
122 122
 register_widget('geodir_popular_post_category');
@@ -130,40 +130,40 @@  discard block
 block discarded – undo
130 130
 class geodir_popular_postview extends WP_Widget
131 131
 {
132 132
 
133
-    /**
133
+	/**
134 134
 	 * Register the popular posts widget.
135 135
 	 *
136 136
 	 * @since 1.0.0
137
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
137
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
138 138
 	 */
139
-    public function __construct() {
140
-        $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory'));
141
-        parent::__construct(
142
-            'popular_post_view', // Base ID
143
-            __('GD > Popular Post View', 'geodirectory'), // Name
144
-            $widget_ops// Args
145
-        );
146
-    }
139
+	public function __construct() {
140
+		$widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory'));
141
+		parent::__construct(
142
+			'popular_post_view', // Base ID
143
+			__('GD > Popular Post View', 'geodirectory'), // Name
144
+			$widget_ops// Args
145
+		);
146
+	}
147 147
 
148 148
 	/**
149 149
 	 * Front-end display content for popular posts widget.
150 150
 	 *
151 151
 	 * @since 1.0.0
152
-     * @since 1.5.1 Declare function public.
152
+	 * @since 1.5.1 Declare function public.
153 153
 	 *
154 154
 	 * @param array $args     Widget arguments.
155 155
 	 * @param array $instance Saved values from database.
156 156
 	 */
157 157
 	public function widget($args, $instance)
158
-    {
159
-        geodir_popular_postview_output($args, $instance);
160
-    }
158
+	{
159
+		geodir_popular_postview_output($args, $instance);
160
+	}
161 161
 
162 162
 	/**
163 163
 	 * Sanitize popular posts widget form values as they are saved.
164 164
 	 *
165 165
 	 * @since 1.0.0
166
-     * @since 1.5.1 Declare function public.
166
+	 * @since 1.5.1 Declare function public.
167 167
 	 *
168 168
 	 * @param array $new_instance Values just sent to be saved.
169 169
 	 * @param array $old_instance Previously saved values from database.
@@ -171,99 +171,99 @@  discard block
 block discarded – undo
171 171
 	 * @return array Updated safe values to be saved.
172 172
 	 */
173 173
 	public function update($new_instance, $old_instance)
174
-    {
175
-        //save the widget
176
-        $instance = $old_instance;
177
-
178
-        if ($new_instance['title'] == '') {
179
-            $title = geodir_ucwords(strip_tags($new_instance['category_title']));
180
-            //$instance['title'] = $title;
181
-        }
182
-        $instance['title'] = strip_tags($new_instance['title']);
183
-
184
-        $instance['post_type'] = strip_tags($new_instance['post_type']);
185
-        //$instance['category'] = strip_tags($new_instance['category']);
186
-        $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : '';
187
-        $instance['category_title'] = strip_tags($new_instance['category_title']);
188
-        $instance['post_number'] = strip_tags($new_instance['post_number']);
189
-        $instance['layout'] = strip_tags($new_instance['layout']);
190
-        $instance['listing_width'] = strip_tags($new_instance['listing_width']);
191
-        $instance['list_sort'] = strip_tags($new_instance['list_sort']);
192
-        $instance['character_count'] = $new_instance['character_count'];
193
-        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
194
-            $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
195
-        else
196
-            $instance['add_location_filter'] = '0';
197
-
198
-        $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0;
199
-        $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0;
200
-        $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0;
201
-        $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0;
202
-        $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0;
203
-
204
-        return $instance;
205
-    }
174
+	{
175
+		//save the widget
176
+		$instance = $old_instance;
177
+
178
+		if ($new_instance['title'] == '') {
179
+			$title = geodir_ucwords(strip_tags($new_instance['category_title']));
180
+			//$instance['title'] = $title;
181
+		}
182
+		$instance['title'] = strip_tags($new_instance['title']);
183
+
184
+		$instance['post_type'] = strip_tags($new_instance['post_type']);
185
+		//$instance['category'] = strip_tags($new_instance['category']);
186
+		$instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : '';
187
+		$instance['category_title'] = strip_tags($new_instance['category_title']);
188
+		$instance['post_number'] = strip_tags($new_instance['post_number']);
189
+		$instance['layout'] = strip_tags($new_instance['layout']);
190
+		$instance['listing_width'] = strip_tags($new_instance['listing_width']);
191
+		$instance['list_sort'] = strip_tags($new_instance['list_sort']);
192
+		$instance['character_count'] = $new_instance['character_count'];
193
+		if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
194
+			$instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
195
+		else
196
+			$instance['add_location_filter'] = '0';
197
+
198
+		$instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0;
199
+		$instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0;
200
+		$instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0;
201
+		$instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0;
202
+		$instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0;
203
+
204
+		return $instance;
205
+	}
206 206
 
207 207
 	/**
208 208
 	 * Back-end popular posts widget settings form.
209 209
 	 *
210 210
 	 * @since 1.0.0
211
-     * @since 1.5.1 Declare function public.
211
+	 * @since 1.5.1 Declare function public.
212 212
 	 *
213 213
 	 * @param array $instance Previously saved values from database.
214 214
 	 */
215 215
 	public function form($instance)
216
-    {
217
-        //widgetform in backend
218
-        $instance = wp_parse_args((array)$instance,
219
-            array('title' => '',
220
-                'post_type' => '',
221
-                'category' => array(),
222
-                'category_title' => '',
223
-                'list_sort' => '',
224
-                'list_order' => '',
225
-                'post_number' => '5',
226
-                'layout' => 'gridview_onehalf',
227
-                'listing_width' => '',
228
-                'add_location_filter' => '1',
229
-                'character_count' => '20',
230
-                'show_featured_only' => '',
231
-                'show_special_only' => '',
232
-                'with_pics_only' => '',
233
-                'with_videos_only' => '',
234
-                'use_viewing_post_type' => ''
235
-            )
236
-        );
216
+	{
217
+		//widgetform in backend
218
+		$instance = wp_parse_args((array)$instance,
219
+			array('title' => '',
220
+				'post_type' => '',
221
+				'category' => array(),
222
+				'category_title' => '',
223
+				'list_sort' => '',
224
+				'list_order' => '',
225
+				'post_number' => '5',
226
+				'layout' => 'gridview_onehalf',
227
+				'listing_width' => '',
228
+				'add_location_filter' => '1',
229
+				'character_count' => '20',
230
+				'show_featured_only' => '',
231
+				'show_special_only' => '',
232
+				'with_pics_only' => '',
233
+				'with_videos_only' => '',
234
+				'use_viewing_post_type' => ''
235
+			)
236
+		);
237 237
 
238
-        $title = strip_tags($instance['title']);
238
+		$title = strip_tags($instance['title']);
239 239
 
240
-        $post_type = strip_tags($instance['post_type']);
240
+		$post_type = strip_tags($instance['post_type']);
241 241
 
242
-        $category = $instance['category'];
242
+		$category = $instance['category'];
243 243
 
244
-        $category_title = strip_tags($instance['category_title']);
244
+		$category_title = strip_tags($instance['category_title']);
245 245
 
246
-        $list_sort = strip_tags($instance['list_sort']);
246
+		$list_sort = strip_tags($instance['list_sort']);
247 247
 
248
-        $list_order = strip_tags($instance['list_order']);
248
+		$list_order = strip_tags($instance['list_order']);
249 249
 
250
-        $post_number = strip_tags($instance['post_number']);
250
+		$post_number = strip_tags($instance['post_number']);
251 251
 
252
-        $layout = strip_tags($instance['layout']);
252
+		$layout = strip_tags($instance['layout']);
253 253
 
254
-        $listing_width = strip_tags($instance['listing_width']);
254
+		$listing_width = strip_tags($instance['listing_width']);
255 255
 
256
-        $add_location_filter = strip_tags($instance['add_location_filter']);
256
+		$add_location_filter = strip_tags($instance['add_location_filter']);
257 257
 
258
-        $character_count = $instance['character_count'];
258
+		$character_count = $instance['character_count'];
259 259
 
260
-        $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false;
261
-        $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false;
262
-        $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false;
263
-        $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false;
264
-        $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false;
260
+		$show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false;
261
+		$show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false;
262
+		$with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false;
263
+		$with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false;
264
+		$use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false;
265 265
 
266
-        ?>
266
+		?>
267 267
 
268 268
         <p>
269 269
             <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
                     <?php foreach ($postypes as $postypes_obj) { ?>
299 299
 
300 300
                         <option <?php if ($post_type == $postypes_obj) {
301
-                            echo 'selected="selected"';
302
-                        } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
303
-                            echo ucfirst($extvalue[1]); ?></option>
301
+							echo 'selected="selected"';
302
+						} ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
303
+							echo ucfirst($extvalue[1]); ?></option>
304 304
 
305 305
                     <?php } ?>
306 306
 
@@ -315,30 +315,30 @@  discard block
 block discarded – undo
315 315
 
316 316
                 <?php
317 317
 
318
-                $post_type = ($post_type != '') ? $post_type : 'gd_place';
318
+				$post_type = ($post_type != '') ? $post_type : 'gd_place';
319 319
 
320
-                $all_postypes = geodir_get_posttypes();
320
+				$all_postypes = geodir_get_posttypes();
321 321
 
322
-                if (!in_array($post_type, $all_postypes))
323
-                    $post_type = 'gd_place';
322
+				if (!in_array($post_type, $all_postypes))
323
+					$post_type = 'gd_place';
324 324
 
325
-                $category_taxonomy = geodir_get_taxonomies($post_type);
326
-                $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
325
+				$category_taxonomy = geodir_get_taxonomies($post_type);
326
+				$categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
327 327
 
328
-                ?>
328
+				?>
329 329
 
330 330
                 <select multiple="multiple" class="widefat" name="<?php echo $this->get_field_name('category'); ?>[]"
331 331
                         onchange="geodir_popular_widget_cat_title(this)">
332 332
 
333 333
                     <option <?php if (!is_array($category) || (is_array($category) && in_array('0', $category))) {
334
-                        echo 'selected="selected"';
335
-                    } ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
334
+						echo 'selected="selected"';
335
+					} ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
336 336
                     <?php foreach ($categories as $category_obj) {
337
-                        $selected = '';
338
-                        if (is_array($category) && in_array($category_obj->term_id, $category))
339
-                            echo $selected = 'selected="selected"';
337
+						$selected = '';
338
+						if (is_array($category) && in_array($category_obj->term_id, $category))
339
+							echo $selected = 'selected="selected"';
340 340
 
341
-                        ?>
341
+						?>
342 342
 
343 343
                         <option <?php echo $selected; ?>
344 344
                             value="<?php echo $category_obj->term_id; ?>"><?php echo ucfirst($category_obj->name); ?></option>
@@ -363,28 +363,28 @@  discard block
 block discarded – undo
363 363
                         name="<?php echo $this->get_field_name('list_sort'); ?>">
364 364
 
365 365
                     <option <?php if ($list_sort == 'az') {
366
-                        echo 'selected="selected"';
367
-                    } ?> value="az"><?php _e('A-Z', 'geodirectory'); ?></option>
366
+						echo 'selected="selected"';
367
+					} ?> value="az"><?php _e('A-Z', 'geodirectory'); ?></option>
368 368
 
369 369
                     <option <?php if ($list_sort == 'latest') {
370
-                        echo 'selected="selected"';
371
-                    } ?> value="latest"><?php _e('Latest', 'geodirectory'); ?></option>
370
+						echo 'selected="selected"';
371
+					} ?> value="latest"><?php _e('Latest', 'geodirectory'); ?></option>
372 372
 
373 373
                     <option <?php if ($list_sort == 'featured') {
374
-                        echo 'selected="selected"';
375
-                    } ?> value="featured"><?php _e('Featured', 'geodirectory'); ?></option>
374
+						echo 'selected="selected"';
375
+					} ?> value="featured"><?php _e('Featured', 'geodirectory'); ?></option>
376 376
 
377 377
                     <option <?php if ($list_sort == 'high_review') {
378
-                        echo 'selected="selected"';
379
-                    } ?> value="high_review"><?php _e('Review', 'geodirectory'); ?></option>
378
+						echo 'selected="selected"';
379
+					} ?> value="high_review"><?php _e('Review', 'geodirectory'); ?></option>
380 380
 
381 381
                     <option <?php if ($list_sort == 'high_rating') {
382
-                        echo 'selected="selected"';
383
-                    } ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?></option>
382
+						echo 'selected="selected"';
383
+					} ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?></option>
384 384
 
385 385
                     <option <?php if ($list_sort == 'random') {
386
-                        echo 'selected="selected"';
387
-                    } ?> value="random"><?php _e('Random', 'geodirectory'); ?></option>
386
+						echo 'selected="selected"';
387
+					} ?> value="random"><?php _e('Random', 'geodirectory'); ?></option>
388 388
 
389 389
                 </select>
390 390
             </label>
@@ -407,24 +407,24 @@  discard block
 block discarded – undo
407 407
                 <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>"
408 408
                         name="<?php echo $this->get_field_name('layout'); ?>">
409 409
                     <option <?php if ($layout == 'gridview_onehalf') {
410
-                        echo 'selected="selected"';
411
-                    } ?>
410
+						echo 'selected="selected"';
411
+					} ?>
412 412
                         value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?></option>
413 413
                     <option <?php if ($layout == 'gridview_onethird') {
414
-                        echo 'selected="selected"';
415
-                    } ?>
414
+						echo 'selected="selected"';
415
+					} ?>
416 416
                         value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?></option>
417 417
                     <option <?php if ($layout == 'gridview_onefourth') {
418
-                        echo 'selected="selected"';
419
-                    } ?>
418
+						echo 'selected="selected"';
419
+					} ?>
420 420
                         value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?></option>
421 421
                     <option <?php if ($layout == 'gridview_onefifth') {
422
-                        echo 'selected="selected"';
423
-                    } ?>
422
+						echo 'selected="selected"';
423
+					} ?>
424 424
                         value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?></option>
425 425
                     <option <?php if ($layout == 'list') {
426
-                        echo 'selected="selected"';
427
-                    } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option>
426
+						echo 'selected="selected"';
427
+					} ?> value="list"><?php _e('List view', 'geodirectory'); ?></option>
428 428
 
429 429
                 </select>
430 430
             </label>
@@ -494,8 +494,8 @@  discard block
 block discarded – undo
494 494
                 for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?>
495 495
                 <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"
496 496
                        name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) {
497
-                    echo 'checked="checked"';
498
-                } ?>  value="1"/>
497
+					echo 'checked="checked"';
498
+				} ?>  value="1"/>
499 499
             </label>
500 500
         </p>
501 501
 
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
         </script>
540 540
 
541 541
     <?php
542
-    }
542
+	}
543 543
 } // class geodir_popular_postview
544 544
 
545 545
 register_widget('geodir_popular_postview');
546 546
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         //save the widget
62 62
         $instance = $old_instance;
63 63
         $instance['title'] = strip_tags($new_instance['title']);
64
-        $category_limit = (int)$new_instance['category_limit'];
64
+        $category_limit = (int) $new_instance['category_limit'];
65 65
         $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15;
66 66
         $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : '';
67 67
         $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false;
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
     public function form($instance) 
82 82
     {
83 83
         //widgetform in backend
84
-        $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false));
84
+        $instance = wp_parse_args((array) $instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false));
85 85
 
86 86
         $title = strip_tags($instance['title']);
87
-        $category_limit = (int)$instance['category_limit'];
87
+        $category_limit = (int) $instance['category_limit'];
88 88
         $category_limit = $category_limit > 0 ? $category_limit : 15;
89 89
         $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : '';
90
-        $parent_only = !empty($instance['parent_only']) ? true: false;
90
+        $parent_only = !empty($instance['parent_only']) ? true : false;
91 91
         
92 92
         $post_type_options = geodir_get_posttypes('options');
93 93
         ?>
@@ -97,23 +97,23 @@  discard block
 block discarded – undo
97 97
             </label>
98 98
         </p>
99 99
         <p>
100
-            <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory');?>
100
+            <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory'); ?>
101 101
                 <select class="widefat" id="<?php echo $this->get_field_id('default_post_type'); ?>" name="<?php echo $this->get_field_name('default_post_type'); ?>">
102 102
                 <?php foreach ($post_type_options as $name => $title) { ?>
103
-                    <option value="<?php echo $name;?>" <?php selected($name, $default_post_type);?>><?php echo $title; ?></option>
103
+                    <option value="<?php echo $name; ?>" <?php selected($name, $default_post_type); ?>><?php echo $title; ?></option>
104 104
                 <?php } ?>
105 105
                 </select>
106 106
             </label>
107 107
         </p>
108 108
         <p>
109 109
             <label for="<?php echo $this->get_field_id('category_limit'); ?>"><?php _e('Customize categories count to appear by default:', 'geodirectory'); ?>
110
-                <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int)esc_attr($category_limit); ?>"/>
110
+                <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int) esc_attr($category_limit); ?>"/>
111 111
                 <p class="description" style="padding:0"><?php _e('After categories count reaches this limit option More Categories / Less Categoris will be displayed to show/hide categories. Default: 15', 'geodirectory'); ?></p>
112 112
             </label>
113 113
         </p>
114 114
         <p>
115
-            <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked( $parent_only ); ?> value="1" />
116
-            <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label>
115
+            <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked($parent_only); ?> value="1" />
116
+            <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e('Show parent categories only', 'geodirectory'); ?></label>
117 117
         </p>
118 118
     <?php
119 119
     }
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	public function form($instance)
216 216
     {
217 217
         //widgetform in backend
218
-        $instance = wp_parse_args((array)$instance,
218
+        $instance = wp_parse_args((array) $instance,
219 219
             array('title' => '',
220 220
                 'post_type' => '',
221 221
                 'category' => array(),
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
         ?>
267 267
 
268 268
         <p>
269
-            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
269
+            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
270 270
                 <small>(%posttype_singular_label% ,
271
-                    %posttype_plural_label% <?php _e('can be used', 'geodirectory');?>)
271
+                    %posttype_plural_label% <?php _e('can be used', 'geodirectory'); ?>)
272 272
                 </small>
273 273
 
274 274
                 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
         <p>
281 281
             <label
282
-                for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?>
282
+                for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?>
283 283
 
284 284
                 <?php $postypes = geodir_get_posttypes();
285 285
 				/**
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 
312 312
         <p id="post_type_cats">
313 313
             <label
314
-                for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?>
314
+                for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?>
315 315
 
316 316
                 <?php
317 317
 
@@ -350,14 +350,14 @@  discard block
 block discarded – undo
350 350
 
351 351
                 <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>"
352 352
                        id="<?php echo $this->get_field_id('category_title'); ?>"
353
-                       value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/>
353
+                       value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory'); ?>"/>
354 354
 
355 355
             </label>
356 356
         </p>
357 357
 
358 358
         <p>
359 359
             <label
360
-                for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?>
360
+                for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?>
361 361
 
362 362
                 <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>"
363 363
                         name="<?php echo $this->get_field_name('list_sort'); ?>">
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
         <p>
394 394
 
395 395
             <label
396
-                for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?>
396
+                for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?>
397 397
 
398 398
                 <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>"
399 399
                        name="<?php echo $this->get_field_name('post_number'); ?>" type="text"
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
         <p>
405 405
             <label for="<?php echo $this->get_field_id('layout'); ?>">
406
-                <?php _e('Layout:', 'geodirectory');?>
406
+                <?php _e('Layout:', 'geodirectory'); ?>
407 407
                 <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>"
408 408
                         name="<?php echo $this->get_field_name('layout'); ?>">
409 409
                     <option <?php if ($layout == 'gridview_onehalf') {
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
         <p>
434 434
             <label
435
-                for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?>
435
+                for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?>
436 436
 
437 437
                 <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>"
438 438
                        name="<?php echo $this->get_field_name('listing_width'); ?>" type="text"
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 
443 443
         <p>
444 444
             <label
445
-                for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?>
445
+                for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?>
446 446
                 <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>"
447 447
                        name="<?php echo $this->get_field_name('character_count'); ?>" type="text"
448 448
                        value="<?php echo esc_attr($character_count); ?>"/>
@@ -451,41 +451,41 @@  discard block
 block discarded – undo
451 451
 
452 452
         <p>
453 453
             <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
454
-                <?php _e('Enable Location Filter:', 'geodirectory');?>
454
+                <?php _e('Enable Location Filter:', 'geodirectory'); ?>
455 455
                 <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
456
-                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
456
+                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?>
457 457
                        value="1"/>
458 458
             </label>
459 459
         </p>
460 460
         <p>
461 461
             <label for="<?php echo $this->get_field_id('show_featured_only'); ?>">
462
-                <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox"
462
+                <?php _e('Show only featured listings:', 'geodirectory'); ?> <input type="checkbox"
463 463
                                                                                             id="<?php echo $this->get_field_id('show_featured_only'); ?>"
464
-                                                                                            name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?>
464
+                                                                                            name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?>
465 465
                                                                                             value="1"/>
466 466
             </label>
467 467
         </p>
468 468
         <p>
469 469
             <label for="<?php echo $this->get_field_id('show_special_only'); ?>">
470
-                <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox"
470
+                <?php _e('Show only listings with special offers:', 'geodirectory'); ?> <input type="checkbox"
471 471
                                                                                                        id="<?php echo $this->get_field_id('show_special_only'); ?>"
472
-                                                                                                       name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?>
472
+                                                                                                       name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"'; ?>
473 473
                                                                                                        value="1"/>
474 474
             </label>
475 475
         </p>
476 476
         <p>
477 477
             <label for="<?php echo $this->get_field_id('with_pics_only'); ?>">
478
-                <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox"
478
+                <?php _e('Show only listings with pics:', 'geodirectory'); ?> <input type="checkbox"
479 479
                                                                                              id="<?php echo $this->get_field_id('with_pics_only'); ?>"
480
-                                                                                             name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?>
480
+                                                                                             name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"'; ?>
481 481
                                                                                              value="1"/>
482 482
             </label>
483 483
         </p>
484 484
         <p>
485 485
             <label for="<?php echo $this->get_field_id('with_videos_only'); ?>">
486
-                <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox"
486
+                <?php _e('Show only listings with videos:', 'geodirectory'); ?> <input type="checkbox"
487 487
                                                                                                id="<?php echo $this->get_field_id('with_videos_only'); ?>"
488
-                                                                                               name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?>
488
+                                                                                               name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"'; ?>
489 489
                                                                                                value="1"/>
490 490
             </label>
491 491
         </p>
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 
532 532
             }
533 533
 
534
-            <?php if(is_active_widget( false, false, $this->id_base, true )){ ?>
534
+            <?php if (is_active_widget(false, false, $this->id_base, true)) { ?>
535 535
             var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val();
536 536
 
537 537
             <?php } ?>
Please login to merge, or discard this patch.
geodirectory-widgets/geodirectory_reviews_widget.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -14,37 +14,37 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class geodir_recent_reviews_widget extends WP_Widget
16 16
 {
17
-    /**
17
+	/**
18 18
 	 * Register the recent reviews widget.
19 19
 	 *
20 20
 	 * @since 1.0.0
21
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
21
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22 22
 	 */
23
-    public function __construct() {
24
-        $widget_ops = array('classname' => 'geodir_recent_reviews', 'description' => __('GD > Recent Reviews', 'geodirectory'));
25
-        parent::__construct(
26
-            'geodir_recent_reviews', // Base ID
27
-            __('GD > Recent Reviews', 'geodirectory'), // Name
28
-            $widget_ops// Args
29
-        );
30
-    }
23
+	public function __construct() {
24
+		$widget_ops = array('classname' => 'geodir_recent_reviews', 'description' => __('GD > Recent Reviews', 'geodirectory'));
25
+		parent::__construct(
26
+			'geodir_recent_reviews', // Base ID
27
+			__('GD > Recent Reviews', 'geodirectory'), // Name
28
+			$widget_ops// Args
29
+		);
30
+	}
31 31
 
32 32
 	/**
33 33
 	 * Front-end display content for recent reviews widget.
34 34
 	 *
35 35
 	 * @since 1.0.0
36
-     * @since 1.5.1 Declare function public.
36
+	 * @since 1.5.1 Declare function public.
37 37
 	 *
38 38
 	 * @param array $args     Widget arguments.
39 39
 	 * @param array $instance Saved values from database.
40 40
 	 */
41 41
 	public function widget($args, $instance)
42
-    {
43
-        // prints the widget
44
-        extract($args, EXTR_SKIP);
42
+	{
43
+		// prints the widget
44
+		extract($args, EXTR_SKIP);
45 45
 
46
-        /** This filter is documented in geodirectory_widgets.php */
47
-        $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
46
+		/** This filter is documented in geodirectory_widgets.php */
47
+		$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
48 48
 		
49 49
 		/**
50 50
 		 * Filter the number of reviews to display.
@@ -63,35 +63,35 @@  discard block
 block discarded – undo
63 63
 		 * @param int $g_size Height and width of the avatar image in pixels. Default 30.
64 64
 		 */
65 65
 		$g_size = apply_filters('geodir_recent_reviews_g_size', 30);
66
-        /**
67
-         * Filter the excerpt length
68
-         *
69
-         * @since 1.0.0
70
-         *
71
-         * @param int $excerpt_length Excerpt length. Default 100.
72
-         */
73
-        $excerpt_length = apply_filters('geodir_recent_reviews_excerpt_length', 100);
74
-        $comments_li = geodir_get_recent_reviews($g_size, $count, $excerpt_length, false);
66
+		/**
67
+		 * Filter the excerpt length
68
+		 *
69
+		 * @since 1.0.0
70
+		 *
71
+		 * @param int $excerpt_length Excerpt length. Default 100.
72
+		 */
73
+		$excerpt_length = apply_filters('geodir_recent_reviews_excerpt_length', 100);
74
+		$comments_li = geodir_get_recent_reviews($g_size, $count, $excerpt_length, false);
75 75
 
76
-        if ($comments_li) {
77
-            echo $before_widget;
78
-            ?>
76
+		if ($comments_li) {
77
+			echo $before_widget;
78
+			?>
79 79
             <div class="widget geodir_recent_reviews_section">
80 80
                 <?php if ($title) {
81
-                    echo $before_title . $title . $after_title;
82
-                } ?>
81
+					echo $before_title . $title . $after_title;
82
+				} ?>
83 83
                 <ul class="geodir_recent_reviews"><?php echo $comments_li; ?></ul>
84 84
             </div>
85 85
             <?php
86
-            echo $after_widget;
87
-        }
88
-    }
86
+			echo $after_widget;
87
+		}
88
+	}
89 89
 
90 90
 	/**
91 91
 	 * Sanitize recent reviews widget form values as they are saved.
92 92
 	 *
93 93
 	 * @since 1.0.0
94
-     * @since 1.5.1 Declare function public.
94
+	 * @since 1.5.1 Declare function public.
95 95
 	 *
96 96
 	 * @param array $new_instance Values just sent to be saved.
97 97
 	 * @param array $old_instance Previously saved values from database.
@@ -99,29 +99,29 @@  discard block
 block discarded – undo
99 99
 	 * @return array Updated safe values to be saved.
100 100
 	 */
101 101
 	public function update($new_instance, $old_instance)
102
-    {
103
-        //save the widget
104
-        $instance = $old_instance;
105
-        $instance['title'] = strip_tags($new_instance['title']);
106
-        $instance['count'] = strip_tags($new_instance['count']);
107
-        return $instance;
108
-    }
102
+	{
103
+		//save the widget
104
+		$instance = $old_instance;
105
+		$instance['title'] = strip_tags($new_instance['title']);
106
+		$instance['count'] = strip_tags($new_instance['count']);
107
+		return $instance;
108
+	}
109 109
     
110 110
 	/**
111 111
 	 * Back-end recent reviews widget settings form.
112 112
 	 *
113 113
 	 * @since 1.0.0
114
-     * @since 1.5.1 Declare function public.
114
+	 * @since 1.5.1 Declare function public.
115 115
 	 *
116 116
 	 * @param array $instance Previously saved values from database.
117 117
 	 */
118 118
 	public function form($instance)
119
-    {
120
-        //widgetform in backend
121
-        $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => ''));
122
-        $title = strip_tags($instance['title']);
123
-        $count = strip_tags($instance['count']);
124
-        ?>
119
+	{
120
+		//widgetform in backend
121
+		$instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => ''));
122
+		$title = strip_tags($instance['title']);
123
+		$count = strip_tags($instance['count']);
124
+		?>
125 125
         <p><label for="<?php echo $this->get_field_id('title'); ?>">Widget Title: <input class="widefat"
126 126
                                                                                          id="<?php echo $this->get_field_id('title'); ?>"
127 127
                                                                                          name="<?php echo $this->get_field_name('title'); ?>"
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
                                                                                              value="<?php echo esc_attr($count); ?>"/></label>
136 136
         </p>
137 137
     <?php
138
-    }
138
+	}
139 139
 } // class geodir_recent_reviews_widget
140 140
 
141 141
 register_widget('geodir_recent_reviews_widget');
142 142
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             ?>
79 79
             <div class="widget geodir_recent_reviews_section">
80 80
                 <?php if ($title) {
81
-                    echo $before_title . $title . $after_title;
81
+                    echo $before_title.$title.$after_title;
82 82
                 } ?>
83 83
                 <ul class="geodir_recent_reviews"><?php echo $comments_li; ?></ul>
84 84
             </div>
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	public function form($instance)
119 119
     {
120 120
         //widgetform in backend
121
-        $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => ''));
121
+        $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => ''));
122 122
         $title = strip_tags($instance['title']);
123 123
         $count = strip_tags($instance['count']);
124 124
         ?>
Please login to merge, or discard this patch.
geodirectory-admin/admin_install.php 2 patches
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -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.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -271,11 +271,11 @@
 block discarded – undo
271 271
     foreach ($widget_option_list as $key => $widget_options) {
272 272
 
273 273
         foreach ($widget_options as $key2 => $widget_options_obj) {
274
-            $widgetid = 'widget_' . $key2;
274
+            $widgetid = 'widget_'.$key2;
275 275
 
276 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 280
             $widget_update[$widgetid][count($widgetinfo[$widgetid])] = $widget_options_obj;
281 281
 
Please login to merge, or discard this patch.