Test Failed
Pull Request — master (#239)
by Viruthagiri
14:39
created
geodirectory-templates/reg_frm.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  * @package GeoDirectory
10 10
  */
11 11
 if (isset($_GET['redirect_to']) && $_GET['redirect_to'] != '') {
12
-    $redirect_to = $_GET['redirect_to'];
12
+	$redirect_to = $_GET['redirect_to'];
13 13
 } else {
14
-    //echo $_SERVER['HTTP_HOST'] ;
15
-    $redirect_to = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
16
-    if (strpos($redirect_to, $_SERVER['HTTP_HOST']) === false) {
17
-        $redirect_to = home_url();
18
-    }
14
+	//echo $_SERVER['HTTP_HOST'] ;
15
+	$redirect_to = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
16
+	if (strpos($redirect_to, $_SERVER['HTTP_HOST']) === false) {
17
+		$redirect_to = home_url();
18
+	}
19 19
 }
20 20
 ?>
21 21
 <div id="sign_up">
@@ -26,28 +26,28 @@  discard block
 block discarded – undo
26 26
         <h4>
27 27
             <?php
28 28
 
29
-            /**
30
-             * Filter the `REGISTRATION_NOW_TEXT` title text on the register form template.
31
-             *
32
-             * @since 1.0.0
33
-             */
34
-            echo apply_filters('geodir_registration_page_title', REGISTRATION_NOW_TEXT);
29
+			/**
30
+			 * Filter the `REGISTRATION_NOW_TEXT` title text on the register form template.
31
+			 *
32
+			 * @since 1.0.0
33
+			 */
34
+			echo apply_filters('geodir_registration_page_title', REGISTRATION_NOW_TEXT);
35 35
 
36
-            ?>
36
+			?>
37 37
         </h4>
38 38
         <?php
39
-        global $geodir_signup_error;
40
-        if ($geodir_signup_error != '') {
41
-            echo '<p class="error_msg">' . $geodir_signup_error . '</p>';
42
-            unset($geodir_signup_error);
43
-        } else {
44
-            if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 1) {
45
-                echo '<p class="error_msg">' . EMAIL_USERNAME_EXIST_MSG . '</p>';
46
-            } else if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'regnewusr') {
47
-                echo '<p class="error_msg">' . REGISTRATION_DESABLED_MSG . '</p>';
48
-            }
49
-        }
50
-        ?>
39
+		global $geodir_signup_error;
40
+		if ($geodir_signup_error != '') {
41
+			echo '<p class="error_msg">' . $geodir_signup_error . '</p>';
42
+			unset($geodir_signup_error);
43
+		} else {
44
+			if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 1) {
45
+				echo '<p class="error_msg">' . EMAIL_USERNAME_EXIST_MSG . '</p>';
46
+			} else if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'regnewusr') {
47
+				echo '<p class="error_msg">' . REGISTRATION_DESABLED_MSG . '</p>';
48
+			}
49
+		}
50
+		?>
51 51
 
52 52
         <form name="cus_registerform" id="cus_registerform"
53 53
               action="<?php echo htmlspecialchars(geodir_curPageURL()); ?>" method="post">
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
             <div class="form_row clearfix">
58 58
                 <input placeholder='<?php echo EMAIL_TEXT; ?>' type="text" name="user_email" id="user_email"
59 59
                        class="textfield" value="<?php global $user_email;
60
-                if (!isset($user_email)) {
61
-                    $user_email = '';
62
-                }
63
-                echo esc_attr(stripslashes($user_email)); ?>" size="25"/>
60
+				if (!isset($user_email)) {
61
+					$user_email = '';
62
+				}
63
+				echo esc_attr(stripslashes($user_email)); ?>" size="25"/>
64 64
 
65 65
                 <?php if (!get_option('geodir_allow_cpass')) { ?>
66 66
 				<div id="reg_passmail">
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
                 <div class="form_row clearfix">
75 75
                     <input placeholder='<?php echo FIRST_NAME_TEXT; ?>' type="text" name="user_fname" id="user_fname"
76 76
                            class="textfield" value="<?php if (isset($user_fname)) {
77
-                        echo esc_attr(stripslashes($user_fname));
78
-                    } ?>" size="25"/>
77
+						echo esc_attr(stripslashes($user_fname));
78
+					} ?>" size="25"/>
79 79
                     <span id="user_fnameInfo"></span>
80 80
                 </div>
81 81
             </div>
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
             <?php } ?>
102 102
 
103 103
             <?php
104
-            /**
105
-             * Called just before the register new user button on the register form template.
106
-             *
107
-             * Also used by other plugins to add social connect buttons.
108
-             *
109
-             * @since 1.0.0
110
-             */
111
-            do_action('social_connect_form'); ?>
104
+			/**
105
+			 * Called just before the register new user button on the register form template.
106
+			 *
107
+			 * Also used by other plugins to add social connect buttons.
108
+			 *
109
+			 * @since 1.0.0
110
+			 */
111
+			do_action('social_connect_form'); ?>
112 112
             <input type="submit" name="registernow" value="<?php echo REGISTER_NOW_TEXT; ?>" class="geodir_button"/>
113 113
         </form>
114 114
     </div>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,13 +38,13 @@
 block discarded – undo
38 38
         <?php
39 39
         global $geodir_signup_error;
40 40
         if ($geodir_signup_error != '') {
41
-            echo '<p class="error_msg">' . $geodir_signup_error . '</p>';
41
+            echo '<p class="error_msg">'.$geodir_signup_error.'</p>';
42 42
             unset($geodir_signup_error);
43 43
         } else {
44 44
             if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 1) {
45
-                echo '<p class="error_msg">' . EMAIL_USERNAME_EXIST_MSG . '</p>';
45
+                echo '<p class="error_msg">'.EMAIL_USERNAME_EXIST_MSG.'</p>';
46 46
             } else if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'regnewusr') {
47
-                echo '<p class="error_msg">' . REGISTRATION_DESABLED_MSG . '</p>';
47
+                echo '<p class="error_msg">'.REGISTRATION_DESABLED_MSG.'</p>';
48 48
             }
49 49
         }
50 50
         ?>
Please login to merge, or discard this patch.
geodirectory.php 3 patches
Braces   +27 added lines, -9 removed lines patch added patch discarded remove patch
@@ -76,29 +76,45 @@  discard block
 block discarded – undo
76 76
 /**
77 77
  * Do not store any revisions (except the one autosave per post).
78 78
  */
79
-if (!defined('WP_POST_REVISIONS')) define('WP_POST_REVISIONS', 0);
79
+if (!defined('WP_POST_REVISIONS')) {
80
+	define('WP_POST_REVISIONS', 0);
81
+}
80 82
 
81 83
 /**
82 84
  * Define constants
83 85
  */
84
-if(!defined('GEODIRECTORY_PLUGIN_DIR')) define('GEODIRECTORY_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
86
+if(!defined('GEODIRECTORY_PLUGIN_DIR')) {
87
+	define('GEODIRECTORY_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
88
+}
85 89
 
86 90
 /*
87 91
  * Declare database table names. All since version 1.0.0
88 92
  */
89 93
 
90 94
 /** Define the database name for the countries table. */
91
-if (!defined('GEODIR_COUNTRIES_TABLE')) define('GEODIR_COUNTRIES_TABLE', $plugin_prefix . 'countries');
95
+if (!defined('GEODIR_COUNTRIES_TABLE')) {
96
+	define('GEODIR_COUNTRIES_TABLE', $plugin_prefix . 'countries');
97
+}
92 98
 /** Define the database name for the custom fields table. */
93
-if (!defined('GEODIR_CUSTOM_FIELDS_TABLE')) define('GEODIR_CUSTOM_FIELDS_TABLE', $plugin_prefix . 'custom_fields');
99
+if (!defined('GEODIR_CUSTOM_FIELDS_TABLE')) {
100
+	define('GEODIR_CUSTOM_FIELDS_TABLE', $plugin_prefix . 'custom_fields');
101
+}
94 102
 /** Define the database name for the icons table. */
95
-if (!defined('GEODIR_ICON_TABLE')) define('GEODIR_ICON_TABLE', $plugin_prefix . 'post_icon');
103
+if (!defined('GEODIR_ICON_TABLE')) {
104
+	define('GEODIR_ICON_TABLE', $plugin_prefix . 'post_icon');
105
+}
96 106
 /** Define the database name for the attachments table. */
97
-if (!defined('GEODIR_ATTACHMENT_TABLE')) define('GEODIR_ATTACHMENT_TABLE', $plugin_prefix . 'attachments');
107
+if (!defined('GEODIR_ATTACHMENT_TABLE')) {
108
+	define('GEODIR_ATTACHMENT_TABLE', $plugin_prefix . 'attachments');
109
+}
98 110
 /** Define the database name for the review table. */
99
-if (!defined('GEODIR_REVIEW_TABLE')) define('GEODIR_REVIEW_TABLE', $plugin_prefix . 'post_review');
111
+if (!defined('GEODIR_REVIEW_TABLE')) {
112
+	define('GEODIR_REVIEW_TABLE', $plugin_prefix . 'post_review');
113
+}
100 114
 /** Define the database name for the custom sort fields table. */
101
-if (!defined('GEODIR_CUSTOM_SORT_FIELDS_TABLE')) define('GEODIR_CUSTOM_SORT_FIELDS_TABLE', $plugin_prefix . 'custom_sort_fields');
115
+if (!defined('GEODIR_CUSTOM_SORT_FIELDS_TABLE')) {
116
+	define('GEODIR_CUSTOM_SORT_FIELDS_TABLE', $plugin_prefix . 'custom_sort_fields');
117
+}
102 118
 
103 119
 
104 120
 if ($_SERVER['REQUEST_URI'] == '' || $_SERVER['REQUEST_URI'] == '/') {
@@ -113,7 +129,9 @@  discard block
 block discarded – undo
113 129
 /*
114 130
  * Localisation items.
115 131
  */
116
-if (!defined('GEODIRECTORY_TEXTDOMAIN')) define('GEODIRECTORY_TEXTDOMAIN', 'geodirectory');
132
+if (!defined('GEODIRECTORY_TEXTDOMAIN')) {
133
+	define('GEODIRECTORY_TEXTDOMAIN', 'geodirectory');
134
+}
117 135
 
118 136
 // Load geodirectory plugin textdomain.
119 137
 add_action( 'plugins_loaded', 'geodir_load_textdomain' );
Please login to merge, or discard this patch.
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -31,30 +31,30 @@  discard block
 block discarded – undo
31 31
  * CHECK FOR OLD COMPATIBILITY PACKS AND DISABLE IF THEY ARE ACTIVE
32 32
  */
33 33
 if (is_admin()) {
34
-    /**
35
-     * Include WordPress core file so we can use core functions to check for active plugins.
36
-     */
37
-    include_once(ABSPATH . 'wp-admin/includes/plugin.php');
34
+	/**
35
+	 * Include WordPress core file so we can use core functions to check for active plugins.
36
+	 */
37
+	include_once(ABSPATH . 'wp-admin/includes/plugin.php');
38 38
 
39
-    if (is_plugin_active('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php')) {
40
-        deactivate_plugins('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php');
41
-    }
39
+	if (is_plugin_active('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php')) {
40
+		deactivate_plugins('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php');
41
+	}
42 42
 
43
-    if (is_plugin_active('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php')) {
44
-        deactivate_plugins('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php');
45
-    }
43
+	if (is_plugin_active('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php')) {
44
+		deactivate_plugins('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php');
45
+	}
46 46
 
47
-    if (is_plugin_active('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php')) {
48
-        deactivate_plugins('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php');
49
-    }
47
+	if (is_plugin_active('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php')) {
48
+		deactivate_plugins('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php');
49
+	}
50 50
 
51
-    if (is_plugin_active('geodir_avada_compatibility/geodir_avada_compatibility.php')) {
52
-        deactivate_plugins('geodir_avada_compatibility/geodir_avada_compatibility.php');
53
-    }
51
+	if (is_plugin_active('geodir_avada_compatibility/geodir_avada_compatibility.php')) {
52
+		deactivate_plugins('geodir_avada_compatibility/geodir_avada_compatibility.php');
53
+	}
54 54
 
55
-    if (is_plugin_active('geodir_compat_pack_divi/geodir_divi_compatibility.php')) {
56
-        deactivate_plugins('geodir_compat_pack_divi/geodir_divi_compatibility.php');
57
-    }
55
+	if (is_plugin_active('geodir_compat_pack_divi/geodir_divi_compatibility.php')) {
56
+		deactivate_plugins('geodir_compat_pack_divi/geodir_divi_compatibility.php');
57
+	}
58 58
 
59 59
 }
60 60
 
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
  * @package GeoDirectory
123 123
  */
124 124
 function geodir_error_log($log){
125
-    /*
125
+	/*
126 126
      * A filter to override the WP_DEBUG setting for function geodir_error_log().
127 127
      *
128 128
      * @since 1.5.7
129 129
      */
130
-    $should_log = apply_filters( 'geodir_log_errors', WP_DEBUG);
131
-    if ( true === $should_log ) {
132
-        if ( is_array( $log ) || is_object( $log ) ) {
133
-            error_log( print_r( $log, true ) );
134
-        } else {
135
-            error_log( $log );
136
-        }
137
-    }
130
+	$should_log = apply_filters( 'geodir_log_errors', WP_DEBUG);
131
+	if ( true === $should_log ) {
132
+		if ( is_array( $log ) || is_object( $log ) ) {
133
+			error_log( print_r( $log, true ) );
134
+		} else {
135
+			error_log( $log );
136
+		}
137
+	}
138 138
 }
139 139
 /**
140 140
  * Include all plugin functions.
@@ -173,61 +173,61 @@  discard block
 block discarded – undo
173 173
  */
174 174
 if (is_admin() || defined( 'GD_TESTING_MODE' )) {
175 175
 
176
-    /**
177
-     * Include functions used in admin area only.
178
-     *
179
-     * @since 1.0.0
180
-     */
181
-    require_once('geodirectory-admin/admin_functions.php');
182
-    /**
183
-     * Most actions/hooks used in admin area only are called from here.
184
-     *
185
-     * @since 1.0.0
186
-     */
187
-    require_once('geodirectory-admin/admin_hooks_actions.php');
188
-    /**
189
-     * Most admin JS and CSS is called from here.
190
-     *
191
-     * @since 1.0.0
192
-     */
193
-    require_once('geodirectory-admin/admin_template_tags.php');
194
-    /**
195
-     * Include any functions needed for upgrades.
196
-     *
197
-     * @since 1.0.0
198
-     */
199
-    require_once(geodir_plugin_path() . '/upgrade.php');
200
-    if (get_option('geodir_installed') != 1) {
201
-        /**
202
-         * Define language constants, here as they are not loaded yet.
203
-         *
204
-         * @since 1.0.0
205
-         */
206
-        require_once(geodir_plugin_path() . '/language.php');
207
-        /**
208
-         * Include the plugin install file that sets up the databases and any options on first run.
209
-         *
210
-         * @since 1.0.0
211
-         */
212
-        require_once('geodirectory-admin/admin_install.php');
213
-        register_activation_hook(__FILE__, 'geodir_activation');
214
-    }
215
-    register_deactivation_hook(__FILE__, 'geodir_deactivation');
216
-    register_uninstall_hook(__FILE__, 'geodir_uninstall');
217
-
218
-    /*
176
+	/**
177
+	 * Include functions used in admin area only.
178
+	 *
179
+	 * @since 1.0.0
180
+	 */
181
+	require_once('geodirectory-admin/admin_functions.php');
182
+	/**
183
+	 * Most actions/hooks used in admin area only are called from here.
184
+	 *
185
+	 * @since 1.0.0
186
+	 */
187
+	require_once('geodirectory-admin/admin_hooks_actions.php');
188
+	/**
189
+	 * Most admin JS and CSS is called from here.
190
+	 *
191
+	 * @since 1.0.0
192
+	 */
193
+	require_once('geodirectory-admin/admin_template_tags.php');
194
+	/**
195
+	 * Include any functions needed for upgrades.
196
+	 *
197
+	 * @since 1.0.0
198
+	 */
199
+	require_once(geodir_plugin_path() . '/upgrade.php');
200
+	if (get_option('geodir_installed') != 1) {
201
+		/**
202
+		 * Define language constants, here as they are not loaded yet.
203
+		 *
204
+		 * @since 1.0.0
205
+		 */
206
+		require_once(geodir_plugin_path() . '/language.php');
207
+		/**
208
+		 * Include the plugin install file that sets up the databases and any options on first run.
209
+		 *
210
+		 * @since 1.0.0
211
+		 */
212
+		require_once('geodirectory-admin/admin_install.php');
213
+		register_activation_hook(__FILE__, 'geodir_activation');
214
+	}
215
+	register_deactivation_hook(__FILE__, 'geodir_deactivation');
216
+	register_uninstall_hook(__FILE__, 'geodir_uninstall');
217
+
218
+	/*
219 219
      * Show a upgrade warning message if applicable.
220 220
      *
221 221
      * @since 1.5.6
222 222
      */
223
-    global $pagenow;
223
+	global $pagenow;
224 224
    if ( 'plugins.php' === $pagenow )
225
-    {
226
-        // Better update message
227
-        $file   = basename( __FILE__ );
228
-        $folder = basename( dirname( __FILE__ ) );
229
-        $hook = "in_plugin_update_message-{$folder}/{$file}";
230
-        add_action( $hook, 'geodire_admin_upgrade_notice', 20, 2 );
231
-    }
225
+	{
226
+		// Better update message
227
+		$file   = basename( __FILE__ );
228
+		$folder = basename( dirname( __FILE__ ) );
229
+		$hook = "in_plugin_update_message-{$folder}/{$file}";
230
+		add_action( $hook, 'geodire_admin_upgrade_notice', 20, 2 );
231
+	}
232 232
 
233 233
 }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     /**
35 35
      * Include WordPress core file so we can use core functions to check for active plugins.
36 36
      */
37
-    include_once(ABSPATH . 'wp-admin/includes/plugin.php');
37
+    include_once(ABSPATH.'wp-admin/includes/plugin.php');
38 38
 
39 39
     if (is_plugin_active('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php')) {
40 40
         deactivate_plugins('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php');
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
  * @global string $plugin_file_name Base file name. 'geodirectory/geodirectory.php'.
69 69
  */
70 70
 global $wpdb, $plugin_prefix, $geodir_addon_list, $plugin_file_name;
71
-$plugin_prefix = $wpdb->prefix . 'geodir_';
72
-$plugin_file_name = basename(plugin_dir_path(__FILE__)) . '/' . basename(__FILE__);
71
+$plugin_prefix = $wpdb->prefix.'geodir_';
72
+$plugin_file_name = basename(plugin_dir_path(__FILE__)).'/'.basename(__FILE__);
73 73
 
74 74
 /*
75 75
  * This will store the cached post custom fields per package for each page load so not to run for each listing.
@@ -84,24 +84,24 @@  discard block
 block discarded – undo
84 84
 /**
85 85
  * Define constants
86 86
  */
87
-if(!defined('GEODIRECTORY_PLUGIN_DIR')) define('GEODIRECTORY_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
87
+if (!defined('GEODIRECTORY_PLUGIN_DIR')) define('GEODIRECTORY_PLUGIN_DIR', plugin_dir_path(__FILE__));
88 88
 
89 89
 /*
90 90
  * Declare database table names. All since version 1.0.0
91 91
  */
92 92
 
93 93
 /** Define the database name for the countries table. */
94
-if (!defined('GEODIR_COUNTRIES_TABLE')) define('GEODIR_COUNTRIES_TABLE', $plugin_prefix . 'countries');
94
+if (!defined('GEODIR_COUNTRIES_TABLE')) define('GEODIR_COUNTRIES_TABLE', $plugin_prefix.'countries');
95 95
 /** Define the database name for the custom fields table. */
96
-if (!defined('GEODIR_CUSTOM_FIELDS_TABLE')) define('GEODIR_CUSTOM_FIELDS_TABLE', $plugin_prefix . 'custom_fields');
96
+if (!defined('GEODIR_CUSTOM_FIELDS_TABLE')) define('GEODIR_CUSTOM_FIELDS_TABLE', $plugin_prefix.'custom_fields');
97 97
 /** Define the database name for the icons table. */
98
-if (!defined('GEODIR_ICON_TABLE')) define('GEODIR_ICON_TABLE', $plugin_prefix . 'post_icon');
98
+if (!defined('GEODIR_ICON_TABLE')) define('GEODIR_ICON_TABLE', $plugin_prefix.'post_icon');
99 99
 /** Define the database name for the attachments table. */
100
-if (!defined('GEODIR_ATTACHMENT_TABLE')) define('GEODIR_ATTACHMENT_TABLE', $plugin_prefix . 'attachments');
100
+if (!defined('GEODIR_ATTACHMENT_TABLE')) define('GEODIR_ATTACHMENT_TABLE', $plugin_prefix.'attachments');
101 101
 /** Define the database name for the review table. */
102
-if (!defined('GEODIR_REVIEW_TABLE')) define('GEODIR_REVIEW_TABLE', $plugin_prefix . 'post_review');
102
+if (!defined('GEODIR_REVIEW_TABLE')) define('GEODIR_REVIEW_TABLE', $plugin_prefix.'post_review');
103 103
 /** Define the database name for the custom sort fields table. */
104
-if (!defined('GEODIR_CUSTOM_SORT_FIELDS_TABLE')) define('GEODIR_CUSTOM_SORT_FIELDS_TABLE', $plugin_prefix . 'custom_sort_fields');
104
+if (!defined('GEODIR_CUSTOM_SORT_FIELDS_TABLE')) define('GEODIR_CUSTOM_SORT_FIELDS_TABLE', $plugin_prefix.'custom_sort_fields');
105 105
 
106 106
 
107 107
 /*
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 if (!defined('GEODIRECTORY_TEXTDOMAIN')) define('GEODIRECTORY_TEXTDOMAIN', 'geodirectory');
111 111
 
112 112
 // Load geodirectory plugin textdomain.
113
-add_action( 'plugins_loaded', 'geodir_load_textdomain' );
113
+add_action('plugins_loaded', 'geodir_load_textdomain');
114 114
 
115 115
 /*
116 116
  * A function to log GD errors no matter the type given.
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
  * @param mixed $log The thing that should be logged.
122 122
  * @package GeoDirectory
123 123
  */
124
-function geodir_error_log($log){
124
+function geodir_error_log($log) {
125 125
     /*
126 126
      * A filter to override the WP_DEBUG setting for function geodir_error_log().
127 127
      *
128 128
      * @since 1.5.7
129 129
      */
130
-    $should_log = apply_filters( 'geodir_log_errors', WP_DEBUG);
131
-    if ( true === $should_log ) {
132
-        if ( is_array( $log ) || is_object( $log ) ) {
133
-            error_log( print_r( $log, true ) );
130
+    $should_log = apply_filters('geodir_log_errors', WP_DEBUG);
131
+    if (true === $should_log) {
132
+        if (is_array($log) || is_object($log)) {
133
+            error_log(print_r($log, true));
134 134
         } else {
135
-            error_log( $log );
135
+            error_log($log);
136 136
         }
137 137
     }
138 138
 }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 /*
172 172
  * Admin init + activation hooks
173 173
  */
174
-if (is_admin() || defined( 'GD_TESTING_MODE' )) {
174
+if (is_admin() || defined('GD_TESTING_MODE')) {
175 175
 
176 176
     /**
177 177
      * Include functions used in admin area only.
@@ -196,14 +196,14 @@  discard block
 block discarded – undo
196 196
      *
197 197
      * @since 1.0.0
198 198
      */
199
-    require_once(geodir_plugin_path() . '/upgrade.php');
199
+    require_once(geodir_plugin_path().'/upgrade.php');
200 200
     if (get_option('geodir_installed') != 1) {
201 201
         /**
202 202
          * Define language constants, here as they are not loaded yet.
203 203
          *
204 204
          * @since 1.0.0
205 205
          */
206
-        require_once(geodir_plugin_path() . '/language.php');
206
+        require_once(geodir_plugin_path().'/language.php');
207 207
         /**
208 208
          * Include the plugin install file that sets up the databases and any options on first run.
209 209
          *
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
      * @since 1.5.6
222 222
      */
223 223
     global $pagenow;
224
-   if ( 'plugins.php' === $pagenow )
224
+   if ('plugins.php' === $pagenow)
225 225
     {
226 226
         // Better update message
227
-        $file   = basename( __FILE__ );
228
-        $folder = basename( dirname( __FILE__ ) );
227
+        $file   = basename(__FILE__);
228
+        $folder = basename(dirname(__FILE__));
229 229
         $hook = "in_plugin_update_message-{$folder}/{$file}";
230
-        add_action( $hook, 'geodire_admin_upgrade_notice', 20, 2 );
230
+        add_action($hook, 'geodire_admin_upgrade_notice', 20, 2);
231 231
     }
232 232
 
233 233
 }
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_functions.php 3 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -235,8 +235,9 @@
 block discarded – undo
235 235
 
236 236
         return $out;
237 237
     } else {
238
-        if ($cat_parent == 0)
239
-            return _e('No category', 'geodirectory');
238
+        if ($cat_parent == 0) {
239
+                    return _e('No category', 'geodirectory');
240
+        }
240 241
     }
241 242
     return;
242 243
 }
Please login to merge, or discard this patch.
Indentation   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function  geodir_init_map_jason()
17 17
 {
18
-    global $map_jason;
19
-    $map_jason = array();
18
+	global $map_jason;
19
+	$map_jason = array();
20 20
 }
21 21
 
22 22
 /**
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
  */
29 29
 function geodir_init_map_canvas_array()
30 30
 {
31
-    global $map_canvas_arr;
32
-    $map_canvas_arr = array();
31
+	global $map_canvas_arr;
32
+	$map_canvas_arr = array();
33 33
 }
34 34
 
35 35
 
@@ -50,47 +50,47 @@  discard block
 block discarded – undo
50 50
  */
51 51
 function create_marker_jason_of_posts($post)
52 52
 {
53
-    global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes;
53
+	global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes;
54 54
 
55
-    if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
56
-        $srcharr = array("'", "/", "-", '"', '\\');
57
-        $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
55
+	if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
56
+		$srcharr = array("'", "/", "-", '"', '\\');
57
+		$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
58 58
 
59 59
 
60
-        $geodir_cat_icons = geodir_get_term_icon();
61
-        $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$post->default_category]) ? $geodir_cat_icons[$post->default_category] : '';
60
+		$geodir_cat_icons = geodir_get_term_icon();
61
+		$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$post->default_category]) ? $geodir_cat_icons[$post->default_category] : '';
62 62
 
63
-        $post_title = $post->post_title;
64
-        $title = str_replace($srcharr, $replarr, $post_title);
63
+		$post_title = $post->post_title;
64
+		$title = str_replace($srcharr, $replarr, $post_title);
65 65
 
66
-        if (is_ssl()) {
67
-            $icon = str_replace("http:","https:",$icon );
68
-        }
66
+		if (is_ssl()) {
67
+			$icon = str_replace("http:","https:",$icon );
68
+		}
69 69
         
70
-        if ($icon != '') {
71
-            $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
70
+		if ($icon != '') {
71
+			$gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
72 72
             
73
-            if (isset($gd_marker_sizes[$icon])) {
74
-                $icon_size = $gd_marker_sizes[$icon];
75
-            } else {
76
-                $icon_size = geodir_get_marker_size($icon);
77
-                $gd_marker_sizes[$icon] = $icon_size;
78
-            }               
79
-        } else {
80
-            $icon_size = array('w' => 36, 'h' => 45);
81
-        }
82
-
83
-        $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}';
84
-
85
-        /**
86
-         * Filter the json data when creating output for post json marker..
87
-         *
88
-         * @since 1.5.7
89
-         * @param string $post_json JSON representation of the post marker info.
90
-         * @param object $post The post object.
91
-         */
92
-        $map_jason[] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
93
-    }
73
+			if (isset($gd_marker_sizes[$icon])) {
74
+				$icon_size = $gd_marker_sizes[$icon];
75
+			} else {
76
+				$icon_size = geodir_get_marker_size($icon);
77
+				$gd_marker_sizes[$icon] = $icon_size;
78
+			}               
79
+		} else {
80
+			$icon_size = array('w' => 36, 'h' => 45);
81
+		}
82
+
83
+		$post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}';
84
+
85
+		/**
86
+		 * Filter the json data when creating output for post json marker..
87
+		 *
88
+		 * @since 1.5.7
89
+		 * @param string $post_json JSON representation of the post marker info.
90
+		 * @param object $post The post object.
91
+		 */
92
+		$map_jason[] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
93
+	}
94 94
 }
95 95
 
96 96
 /**
@@ -103,60 +103,60 @@  discard block
 block discarded – undo
103 103
  */
104 104
 function send_marker_jason_to_js()
105 105
 {
106
-    global $map_jason, $map_canvas_arr;
107
-
108
-    if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
109
-        foreach ($map_canvas_arr as $canvas => $jason) {
110
-            if (is_array($map_jason) && !empty($map_jason)) {
111
-
112
-                $canvas_jason = $canvas . "_jason";
113
-                $map_canvas_arr[$canvas] = array_unique($map_jason);
114
-                unset($cat_content_info);
115
-                $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
116
-                $totalcount = count(array_unique($map_jason));
117
-                if (!empty($cat_content_info)) {
118
-                    $json_content = substr(implode(',', $cat_content_info), 1);
119
-                    $json_content = htmlentities($json_content, ENT_QUOTES); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
120
-                    $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
121
-                } else {
122
-                    $canvas_jason = '[{"totalcount":"0"}]';
123
-                }
124
-
125
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
126
-
127
-                /**
128
-                 * Filter the send_marker_jason_to_js() function map canvas json args.
129
-                 *
130
-                 * You can use this filter to modify map canvas json args.
131
-                 *
132
-                 * @since 1.0.0
133
-                 * @package GeoDirectory
134
-                 * @param string $canvas Map canvas array key.
135
-                 * @param array $map_canvas_jason_args Map canvas args.
136
-                 */
137
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
138
-
139
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
140
-            } else {
141
-                $canvas_jason = '[{"totalcount":"0"}]';
142
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
143
-
144
-                /**
145
-                 * Filter the send_marker_jason_to_js() function map canvas json args.
146
-                 *
147
-                 * You can use this filter to modify map canvas json args.
148
-                 *
149
-                 * @since 1.0.0
150
-                 * @package GeoDirectory
151
-                 * @param string $canvas Map canvas array key.
152
-                 * @param array $map_canvas_jason_args Map canvas args.
153
-                 */
154
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
155
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
156
-            }
157
-        }
158
-
159
-    }
106
+	global $map_jason, $map_canvas_arr;
107
+
108
+	if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
109
+		foreach ($map_canvas_arr as $canvas => $jason) {
110
+			if (is_array($map_jason) && !empty($map_jason)) {
111
+
112
+				$canvas_jason = $canvas . "_jason";
113
+				$map_canvas_arr[$canvas] = array_unique($map_jason);
114
+				unset($cat_content_info);
115
+				$cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
116
+				$totalcount = count(array_unique($map_jason));
117
+				if (!empty($cat_content_info)) {
118
+					$json_content = substr(implode(',', $cat_content_info), 1);
119
+					$json_content = htmlentities($json_content, ENT_QUOTES); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
120
+					$canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
121
+				} else {
122
+					$canvas_jason = '[{"totalcount":"0"}]';
123
+				}
124
+
125
+				$map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
126
+
127
+				/**
128
+				 * Filter the send_marker_jason_to_js() function map canvas json args.
129
+				 *
130
+				 * You can use this filter to modify map canvas json args.
131
+				 *
132
+				 * @since 1.0.0
133
+				 * @package GeoDirectory
134
+				 * @param string $canvas Map canvas array key.
135
+				 * @param array $map_canvas_jason_args Map canvas args.
136
+				 */
137
+				$map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
138
+
139
+				wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
140
+			} else {
141
+				$canvas_jason = '[{"totalcount":"0"}]';
142
+				$map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
143
+
144
+				/**
145
+				 * Filter the send_marker_jason_to_js() function map canvas json args.
146
+				 *
147
+				 * You can use this filter to modify map canvas json args.
148
+				 *
149
+				 * @since 1.0.0
150
+				 * @package GeoDirectory
151
+				 * @param string $canvas Map canvas array key.
152
+				 * @param array $map_canvas_jason_args Map canvas args.
153
+				 */
154
+				$map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
155
+				wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
156
+			}
157
+		}
158
+
159
+	}
160 160
 }
161 161
 
162 162
 /**
@@ -175,90 +175,90 @@  discard block
 block discarded – undo
175 175
  */
176 176
 function home_map_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = true, $pading = 0, $map_canvas_name = '', $child_collapse, $is_home_map = false)
177 177
 {
178
-    global $cat_count, $geodir_cat_icons;
178
+	global $cat_count, $geodir_cat_icons;
179 179
 
180
-    $exclude_categories = get_option('geodir_exclude_cat_on_map');
181
-    $exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
180
+	$exclude_categories = get_option('geodir_exclude_cat_on_map');
181
+	$exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
182 182
 
183
-    // check if exclude categories saved before fix of categories identical names
184
-    if ($exclude_categories_new) {
185
-        $gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : '';
186
-        $exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array();
187
-    }
183
+	// check if exclude categories saved before fix of categories identical names
184
+	if ($exclude_categories_new) {
185
+		$gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : '';
186
+		$exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array();
187
+	}
188 188
 
189
-    $exclude_cat_str = implode(',', $exclude_categories);
189
+	$exclude_cat_str = implode(',', $exclude_categories);
190 190
 
191
-    if ($exclude_cat_str == '') {
192
-        $exclude_cat_str = '0';
193
-    }
191
+	if ($exclude_cat_str == '') {
192
+		$exclude_cat_str = '0';
193
+	}
194 194
 
195
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
195
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
196 196
     
197
-    if ($hide_empty) {
198
-        $cat_terms = geodir_filter_empty_terms($cat_terms);
199
-    }
197
+	if ($hide_empty) {
198
+		$cat_terms = geodir_filter_empty_terms($cat_terms);
199
+	}
200 200
 
201
-    $main_list_class = '';
202
-    //If there are terms, start displaying
203
-    if (count($cat_terms) > 0) {
204
-        //Displaying as a list
205
-        $p = $pading * 15;
206
-        $pading++;
201
+	$main_list_class = '';
202
+	//If there are terms, start displaying
203
+	if (count($cat_terms) > 0) {
204
+		//Displaying as a list
205
+		$p = $pading * 15;
206
+		$pading++;
207 207
 
208
-        if ($cat_parent == 0) {
209
-            $list_class = 'main_list';
210
-            $display = '';
211
-        } else {
212
-            $list_class = 'sub_list';
213
-            $display = !$child_collapse ? '' : 'display:none';
214
-        }
208
+		if ($cat_parent == 0) {
209
+			$list_class = 'main_list';
210
+			$display = '';
211
+		} else {
212
+			$list_class = 'sub_list';
213
+			$display = !$child_collapse ? '' : 'display:none';
214
+		}
215 215
 
216 216
 
217
-        $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
217
+		$out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
218 218
 
219
-        $geodir_cat_icons = geodir_get_term_icon();
219
+		$geodir_cat_icons = geodir_get_term_icon();
220 220
 
221
-        foreach ($cat_terms as $cat_term):
221
+		foreach ($cat_terms as $cat_term):
222 222
 
223
-            $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : 'gd_place';
223
+			$post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : 'gd_place';
224 224
 
225
-            $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : '';
225
+			$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : '';
226 226
 
227
-            if (!in_array($cat_term->term_id, $exclude_categories)):
228
-                //Secret sauce.  Function calls itself to display child elements, if any
229
-                $checked = 'checked="checked"';
227
+			if (!in_array($cat_term->term_id, $exclude_categories)):
228
+				//Secret sauce.  Function calls itself to display child elements, if any
229
+				$checked = 'checked="checked"';
230 230
 
231
-                // Untick the category by default on home map
232
-                if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
233
-                    if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $cat_term->term_id, $geodir_home_map_untick)) {
234
-                        $checked = '';
235
-                    }
236
-                }
231
+				// Untick the category by default on home map
232
+				if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
233
+					if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $cat_term->term_id, $geodir_home_map_untick)) {
234
+						$checked = '';
235
+					}
236
+				}
237 237
 
238
-                $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
239
-                $term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
240
-                $term_check .= '  title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
241
-                $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>';
242
-                $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
238
+				$term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
239
+				$term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
240
+				$term_check .= '  title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
241
+				$term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>';
242
+				$out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
243 243
 
244
-            endif;
244
+			endif;
245 245
 
246 246
 
247
-            // get sub category by recursion
248
-            $out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map);
247
+			// get sub category by recursion
248
+			$out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map);
249 249
 
250
-            $out .= '</li>';
250
+			$out .= '</li>';
251 251
 
252
-        endforeach;
252
+		endforeach;
253 253
 
254
-        $out .= '</ul>';
254
+		$out .= '</ul>';
255 255
 
256
-        return $out;
257
-    } else {
258
-        if ($cat_parent == 0)
259
-            return _e('No category', 'geodirectory');
260
-    }
261
-    return;
256
+		return $out;
257
+	} else {
258
+		if ($cat_parent == 0)
259
+			return _e('No category', 'geodirectory');
260
+	}
261
+	return;
262 262
 }
263 263
 
264 264
 /**
@@ -270,19 +270,19 @@  discard block
 block discarded – undo
270 270
  * @return string The map API provider name.
271 271
  */
272 272
 function geodir_map_name() {
273
-    $geodir_map_name = get_option('geodir_load_map', 'google');
273
+	$geodir_map_name = get_option('geodir_load_map', 'google');
274 274
     
275
-    if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
276
-        $geodir_map_name = 'auto';
277
-    }
278
-
279
-    /**
280
-     * Filter the map JS API provider name.
281
-     *
282
-     * @since 1.6.1
283
-     * @param string $geodir_map_name The map API provider name.
284
-     */
285
-    return apply_filters('geodir_map_name', $geodir_map_name);
275
+	if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
276
+		$geodir_map_name = 'auto';
277
+	}
278
+
279
+	/**
280
+	 * Filter the map JS API provider name.
281
+	 *
282
+	 * @since 1.6.1
283
+	 * @param string $geodir_map_name The map API provider name.
284
+	 */
285
+	return apply_filters('geodir_map_name', $geodir_map_name);
286 286
 }
287 287
 
288 288
 /**
@@ -298,48 +298,48 @@  discard block
 block discarded – undo
298 298
  * @return array The icon size.
299 299
  */
300 300
 function geodir_get_marker_size($icon, $default_size = array('w' => 36, 'h' => 45)) {
301
-    global $gd_marker_sizes;
301
+	global $gd_marker_sizes;
302 302
     
303
-    if (empty($gd_marker_sizes)) {
304
-        $gd_marker_sizes = array();
305
-    }
303
+	if (empty($gd_marker_sizes)) {
304
+		$gd_marker_sizes = array();
305
+	}
306 306
       
307
-    if (!empty($gd_marker_sizes[$icon])) {
308
-        return $gd_marker_sizes[$icon];
309
-    }
307
+	if (!empty($gd_marker_sizes[$icon])) {
308
+		return $gd_marker_sizes[$icon];
309
+	}
310 310
     
311
-    if (empty($icon)) {
312
-        $gd_marker_sizes[$icon] = $default_size;
311
+	if (empty($icon)) {
312
+		$gd_marker_sizes[$icon] = $default_size;
313 313
         
314
-        return $default_size;
315
-    }
314
+		return $default_size;
315
+	}
316 316
     
317
-    $icon_url = $icon;
317
+	$icon_url = $icon;
318 318
     
319
-    $uploads = wp_upload_dir(); // Array of key => value pairs
319
+	$uploads = wp_upload_dir(); // Array of key => value pairs
320 320
       
321
-    if (!path_is_absolute($icon)) {
322
-        $icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon);
323
-    }
321
+	if (!path_is_absolute($icon)) {
322
+		$icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon);
323
+	}
324 324
     
325
-    if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
326
-        $icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon);
327
-    }
325
+	if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
326
+		$icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon);
327
+	}
328 328
     
329
-    $sizes = array();
330
-    if (is_file($icon) && file_exists($icon)) {
331
-        $size = getimagesize(trim($icon));
329
+	$sizes = array();
330
+	if (is_file($icon) && file_exists($icon)) {
331
+		$size = getimagesize(trim($icon));
332 332
         
333
-        if (!empty($size[0]) && !empty($size[1])) {
334
-            $sizes = array('w' => $size[0], 'h' => $size[1]);
335
-        }
336
-    }
333
+		if (!empty($size[0]) && !empty($size[1])) {
334
+			$sizes = array('w' => $size[0], 'h' => $size[1]);
335
+		}
336
+	}
337 337
     
338
-    $sizes = !empty($sizes) ? $sizes : $default_size;
338
+	$sizes = !empty($sizes) ? $sizes : $default_size;
339 339
     
340
-    $gd_marker_sizes[$icon_url] = $sizes;
340
+	$gd_marker_sizes[$icon_url] = $sizes;
341 341
     
342
-    return $sizes;
342
+	return $sizes;
343 343
 }
344 344
 
345 345
 add_action('wp_head', 'geodir_map_load_style', 10);
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
  * @package GeoDirectory
352 352
  */
353 353
 function geodir_map_load_style() {    
354
-    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
354
+	if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
355 355
 ?>
356 356
 <script type="text/javascript">
357 357
 if (!(window.google && typeof google.maps !== 'undefined')) {
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 }
360 360
 </script>
361 361
 <?php
362
-    }
362
+	}
363 363
 }
364 364
 
365 365
 add_action('wp_footer', 'geodir_map_load_script', 10);
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
  * @package GeoDirectory
372 372
  */
373 373
 function geodir_map_load_script() {
374
-    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
374
+	if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
375 375
 ?>
376 376
 <script type="text/javascript">
377 377
 if (!(window.google && typeof google.maps !== 'undefined')) {
@@ -380,5 +380,5 @@  discard block
 block discarded – undo
380 380
 }
381 381
 </script>
382 382
 <?php
383
-    }
383
+	}
384 384
 }
385 385
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $title = str_replace($srcharr, $replarr, $post_title);
65 65
 
66 66
         if (is_ssl()) {
67
-            $icon = str_replace("http:","https:",$icon );
67
+            $icon = str_replace("http:", "https:", $icon);
68 68
         }
69 69
         
70 70
         if ($icon != '') {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             $icon_size = array('w' => 36, 'h' => 45);
81 81
         }
82 82
 
83
-        $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}';
83
+        $post_json = '{"id":"'.$post->ID.'","t": "'.$title.'","lt": "'.$post->post_latitude.'","ln": "'.$post->post_longitude.'","mk_id":"'.$post->ID.'_'.$post->default_category.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"}';
84 84
 
85 85
         /**
86 86
          * Filter the json data when creating output for post json marker..
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
          * @param string $post_json JSON representation of the post marker info.
90 90
          * @param object $post The post object.
91 91
          */
92
-        $map_jason[] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
92
+        $map_jason[] = apply_filters('geodir_create_marker_jason_of_posts', $post_json, $post);
93 93
     }
94 94
 }
95 95
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         foreach ($map_canvas_arr as $canvas => $jason) {
110 110
             if (is_array($map_jason) && !empty($map_jason)) {
111 111
 
112
-                $canvas_jason = $canvas . "_jason";
112
+                $canvas_jason = $canvas."_jason";
113 113
                 $map_canvas_arr[$canvas] = array_unique($map_jason);
114 114
                 unset($cat_content_info);
115 115
                 $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
@@ -117,12 +117,12 @@  discard block
 block discarded – undo
117 117
                 if (!empty($cat_content_info)) {
118 118
                     $json_content = substr(implode(',', $cat_content_info), 1);
119 119
                     $json_content = htmlentities($json_content, ENT_QUOTES); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
120
-                    $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
120
+                    $canvas_jason = '[{"totalcount":"'.$totalcount.'",'.$json_content.']';
121 121
                 } else {
122 122
                     $canvas_jason = '[{"totalcount":"0"}]';
123 123
                 }
124 124
 
125
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
125
+                $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason);
126 126
 
127 127
                 /**
128 128
                  * Filter the send_marker_jason_to_js() function map canvas json args.
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
                  * @param string $canvas Map canvas array key.
135 135
                  * @param array $map_canvas_jason_args Map canvas args.
136 136
                  */
137
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
137
+                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
138 138
 
139
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
139
+                wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
140 140
             } else {
141 141
                 $canvas_jason = '[{"totalcount":"0"}]';
142
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
142
+                $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason);
143 143
 
144 144
                 /**
145 145
                  * Filter the send_marker_jason_to_js() function map canvas json args.
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
                  * @param string $canvas Map canvas array key.
152 152
                  * @param array $map_canvas_jason_args Map canvas args.
153 153
                  */
154
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
155
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
154
+                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
155
+                wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
156 156
             }
157 157
         }
158 158
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         }
215 215
 
216 216
 
217
-        $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
217
+        $out = '<ul class="treeview '.$list_class.'" style="margin-left:'.$p.'px;'.$display.';">';
218 218
 
219 219
         $geodir_cat_icons = geodir_get_term_icon();
220 220
 
@@ -230,16 +230,16 @@  discard block
 block discarded – undo
230 230
 
231 231
                 // Untick the category by default on home map
232 232
                 if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
233
-                    if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $cat_term->term_id, $geodir_home_map_untick)) {
233
+                    if (!empty($geodir_home_map_untick) && in_array($post_type.'_'.$cat_term->term_id, $geodir_home_map_untick)) {
234 234
                         $checked = '';
235 235
                     }
236 236
                 }
237 237
 
238
-                $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
239
-                $term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
240
-                $term_check .= '  title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
241
-                $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>';
242
-                $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
238
+                $term_check = '<input type="checkbox" '.$checked.' id="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'" class="group_selector '.$main_list_class.'"';
239
+                $term_check .= ' name="'.$map_canvas_name.'_cat[]" ';
240
+                $term_check .= '  title="'.esc_attr(ucfirst($cat_term->name)).'" value="'.$cat_term->term_id.'" onclick="javascript:build_map_ajax_search_param(\''.$map_canvas_name.'\',false, this)">';
241
+                $term_img = '<img height="15" width="15" alt="'.$cat_term->taxonomy.'" src="'.$icon.'" title="'.ucfirst($cat_term->name).'"/>';
242
+                $out .= '<li>'.$term_check.'<label for="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'">'.$term_img.ucfirst($cat_term->name).'</label><i class="fa fa-long-arrow-down"></i>';
243 243
 
244 244
             endif;
245 245
 
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
  * @package GeoDirectory
352 352
  */
353 353
 function geodir_map_load_style() {    
354
-    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
354
+    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is('geodirectory-googlemap-script', 'done')) {
355 355
 ?>
356 356
 <script type="text/javascript">
357 357
 if (!(window.google && typeof google.maps !== 'undefined')) {
358
-    document.write('<' + 'link id="geodirectory-leaflet-style-css" media="all" type="text/css" href="<?php echo geodir_plugin_url();?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION;?>" rel="stylesheet"' + '>');
358
+    document.write('<' + 'link id="geodirectory-leaflet-style-css" media="all" type="text/css" href="<?php echo geodir_plugin_url(); ?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION; ?>" rel="stylesheet"' + '>');
359 359
 }
360 360
 </script>
361 361
 <?php
@@ -371,12 +371,12 @@  discard block
 block discarded – undo
371 371
  * @package GeoDirectory
372 372
  */
373 373
 function geodir_map_load_script() {
374
-    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
374
+    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is('geodirectory-googlemap-script', 'done')) {
375 375
 ?>
376 376
 <script type="text/javascript">
377 377
 if (!(window.google && typeof google.maps !== 'undefined')) {
378
-    document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo geodir_plugin_url();?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
379
-    document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo geodir_plugin_url();?>/geodirectory-assets/leaflet/osm.geocode.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
378
+    document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo geodir_plugin_url(); ?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
379
+    document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo geodir_plugin_url(); ?>/geodirectory-assets/leaflet/osm.geocode.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
380 380
 }
381 381
 </script>
382 382
 <?php
Please login to merge, or discard this patch.
geodirectory-widgets/listing_map_widget.php 3 patches
Indentation   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
  */
19 19
 function init_listing_map_script()
20 20
 {
21
-    global $list_map_json;
21
+	global $list_map_json;
22 22
 
23
-    $list_map_json = array();
23
+	$list_map_json = array();
24 24
 
25 25
 }
26 26
 
@@ -35,18 +35,18 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function create_list_jsondata($post)
37 37
 {
38
-    global $wpdb, $list_map_json, $add_post_in_marker_array;
39
-
40
-    if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') {
41
-        /**
42
-         * Filter the json data for search listing map.
43
-         *
44
-         * @since 1.5.7
45
-         * @param string $post->marker_json JSON representation of the post marker info.
46
-         * @param object $post The post object.
47
-         */
48
-        $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
49
-    }
38
+	global $wpdb, $list_map_json, $add_post_in_marker_array;
39
+
40
+	if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') {
41
+		/**
42
+		 * Filter the json data for search listing map.
43
+		 *
44
+		 * @since 1.5.7
45
+		 * @param string $post->marker_json JSON representation of the post marker info.
46
+		 * @param object $post The post object.
47
+		 */
48
+		$list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
49
+	}
50 50
 
51 51
 }
52 52
 
@@ -59,28 +59,28 @@  discard block
 block discarded – undo
59 59
  */
60 60
 function show_listing_widget_map()
61 61
 {
62
-    global $list_map_json;
62
+	global $list_map_json;
63 63
 
64
-    if (!empty($list_map_json)) {
65
-        $list_map_json = array_unique($list_map_json);
66
-        $cat_content_info[] = implode(',', $list_map_json);
67
-    }
64
+	if (!empty($list_map_json)) {
65
+		$list_map_json = array_unique($list_map_json);
66
+		$cat_content_info[] = implode(',', $list_map_json);
67
+	}
68 68
 
69
-    $totalcount = count(array_unique($list_map_json));
69
+	$totalcount = count(array_unique($list_map_json));
70 70
 
71 71
 
72
-    if (!empty($cat_content_info)) {
73
-        $json_content = substr(implode(',', $cat_content_info), 1);
74
-        $json_content = htmlentities($json_content, ENT_QUOTES); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
75
-        $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
76
-    } else {
77
-        $list_json = '[{"totalcount":"0"}]';
78
-    }
72
+	if (!empty($cat_content_info)) {
73
+		$json_content = substr(implode(',', $cat_content_info), 1);
74
+		$json_content = htmlentities($json_content, ENT_QUOTES); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
75
+		$list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
76
+	} else {
77
+		$list_json = '[{"totalcount":"0"}]';
78
+	}
79 79
 
80
-    $listing_map_args = array('list_json' => $list_json);
80
+	$listing_map_args = array('list_json' => $list_json);
81 81
 
82
-    // Pass the json data in listing map script
83
-    wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args);
82
+	// Pass the json data in listing map script
83
+	wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args);
84 84
 
85 85
 }
86 86
 
@@ -92,184 +92,184 @@  discard block
 block discarded – undo
92 92
 class geodir_map_listingpage extends WP_Widget
93 93
 {
94 94
 
95
-    /**
95
+	/**
96 96
 	 * Register the listing page map widget.
97 97
 	 *
98 98
 	 * @since 1.0.0
99
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
99
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
100 100
 	 */
101
-    public function __construct() {
102
-        $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory'));
103
-        parent::__construct(
104
-            'geodir_map_v3_listing_map', // Base ID
105
-            __('GD > GMap - Listing page', 'geodirectory'), // Name
106
-            $widget_ops// Args
107
-        );
101
+	public function __construct() {
102
+		$widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory'));
103
+		parent::__construct(
104
+			'geodir_map_v3_listing_map', // Base ID
105
+			__('GD > GMap - Listing page', 'geodirectory'), // Name
106
+			$widget_ops// Args
107
+		);
108 108
 
109
-        add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
109
+		add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
110 110
 
111
-        add_action('the_post', 'create_list_jsondata'); // Add marker in json array
111
+		add_action('the_post', 'create_list_jsondata'); // Add marker in json array
112 112
 
113
-        add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
114
-    }
113
+		add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
114
+	}
115 115
 
116 116
 	/**
117 117
 	 * Front-end display content for listing page map widget.
118 118
 	 *
119 119
 	 * @since 1.0.0
120
-     * @since 1.5.1 Declare function public.
120
+	 * @since 1.5.1 Declare function public.
121
+	 *
122
+	 * @global object $post The current post object.
121 123
 	 *
122
-     * @global object $post The current post object.
123
-     *
124 124
 	 * @param array $args     Widget arguments.
125 125
 	 * @param array $instance Saved values from database.
126 126
 	 */
127
-    public function widget($args, $instance)
128
-    {
129
-
130
-        if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search')
131
-            || geodir_is_page('detail')
132
-        ) :
133
-
134
-            extract($args, EXTR_SKIP);
135
-            /** This action is documented in geodirectory_shortcodes.php */
136
-            $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']);
137
-            /** This action is documented in geodirectory_shortcodes.php */
138
-            $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']);
139
-            /** This action is documented in geodirectory_shortcodes.php */
140
-            $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']);
141
-            /** This action is documented in geodirectory_shortcodes.php */
142
-            $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']);
143
-            /** This action is documented in geodirectory_shortcodes.php */
144
-            $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']);
145
-            /**
146
-             * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page).
147
-             *
148
-             * @since 1.0.0
149
-             * @param bool $sticky True if should be sticky, false if not
150
-             */
151
-            $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']);
152
-            /** This action is documented in geodirectory_shortcodes.php */
153
-            $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']);
154
-            $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']);
127
+	public function widget($args, $instance)
128
+	{
129
+
130
+		if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search')
131
+			|| geodir_is_page('detail')
132
+		) :
133
+
134
+			extract($args, EXTR_SKIP);
135
+			/** This action is documented in geodirectory_shortcodes.php */
136
+			$width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']);
137
+			/** This action is documented in geodirectory_shortcodes.php */
138
+			$height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']);
139
+			/** This action is documented in geodirectory_shortcodes.php */
140
+			$maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']);
141
+			/** This action is documented in geodirectory_shortcodes.php */
142
+			$zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']);
143
+			/** This action is documented in geodirectory_shortcodes.php */
144
+			$autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']);
145
+			/**
146
+			 * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page).
147
+			 *
148
+			 * @since 1.0.0
149
+			 * @param bool $sticky True if should be sticky, false if not
150
+			 */
151
+			$sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']);
152
+			/** This action is documented in geodirectory_shortcodes.php */
153
+			$scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']);
154
+			$showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']);
155 155
 			
156 156
 			/**
157
-             * Filter the listing map should to be displayed or not.
158
-             *
159
-             * @since 1.4.6
157
+			 * Filter the listing map should to be displayed or not.
160 158
 			 *
161
-             * @param bool $display true if map should be displayed, false if not.
162
-             */
159
+			 * @since 1.4.6
160
+			 *
161
+			 * @param bool $display true if map should be displayed, false if not.
162
+			 */
163 163
 			$show_map = apply_filters( 'geodir_show_map_listing', $display = true );
164 164
 			if ( !$show_map ) {
165 165
 				return;
166 166
 			}
167 167
 
168
-            $map_args = array();
169
-            $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']);
170
-            $map_args['width'] = $width;
171
-            $map_args['height'] = $height;
172
-
173
-            $map_args['scrollwheel'] = $scrollwheel;
174
-            $map_args['showall'] = $showall;
175
-            $map_args['child_collapse'] = '0';
176
-            $map_args['sticky'] = $sticky;
177
-            $map_args['enable_cat_filters'] = false;
178
-            $map_args['enable_text_search'] = false;
179
-            $map_args['enable_post_type_filters'] = false;
180
-            $map_args['enable_location_filters'] = false;
181
-            $map_args['enable_jason_on_load'] = true;
168
+			$map_args = array();
169
+			$map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']);
170
+			$map_args['width'] = $width;
171
+			$map_args['height'] = $height;
172
+
173
+			$map_args['scrollwheel'] = $scrollwheel;
174
+			$map_args['showall'] = $showall;
175
+			$map_args['child_collapse'] = '0';
176
+			$map_args['sticky'] = $sticky;
177
+			$map_args['enable_cat_filters'] = false;
178
+			$map_args['enable_text_search'] = false;
179
+			$map_args['enable_post_type_filters'] = false;
180
+			$map_args['enable_location_filters'] = false;
181
+			$map_args['enable_jason_on_load'] = true;
182 182
 			
183
-            if (is_single()) {
184
-
185
-                global $post;
186
-                $map_default_lat = $address_latitude = $post->post_latitude;
187
-                $map_default_lng = $address_longitude = $post->post_longitude;
188
-                $mapview = $post->post_mapview;
189
-                $mapzoom = $post->post_mapzoom;
190
-                $map_args['map_class_name'] = 'geodir-map-listing-page-single';
191
-
192
-            } else {
193
-                $default_location = geodir_get_default_location();
194
-
195
-                $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
196
-                $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
197
-                $map_args['map_class_name'] = 'geodir-map-listing-page';
198
-                $mapview = $maptype;
199
-            }
200
-
201
-            if (empty($mapzoom)) $mapzoom = $zoom;
202
-
203
-            // Set default map options
204
-            $map_args['ajax_url'] = geodir_get_ajax_url();
205
-            $map_args['latitude'] = $map_default_lat;
206
-            $map_args['longitude'] = $map_default_lng;
207
-            $map_args['zoom'] = $zoom;
208
-            //$map_args['scrollwheel'] = true;
209
-            $map_args['scrollwheel'] = $scrollwheel;
210
-            $map_args['showall'] = $showall;
211
-            $map_args['streetViewControl'] = true;
212
-            $map_args['maptype'] = $maptype;
213
-            $map_args['showPreview'] = '0';
214
-            $map_args['maxZoom'] = 21;
215
-            $map_args['autozoom'] = $autozoom;
216
-            $map_args['bubble_size'] = 'small';
217
-
218
-            echo $before_widget;
219
-            geodir_draw_map($map_args);
220
-            echo $after_widget;
221
-
222
-        endif;
223
-    }
183
+			if (is_single()) {
184
+
185
+				global $post;
186
+				$map_default_lat = $address_latitude = $post->post_latitude;
187
+				$map_default_lng = $address_longitude = $post->post_longitude;
188
+				$mapview = $post->post_mapview;
189
+				$mapzoom = $post->post_mapzoom;
190
+				$map_args['map_class_name'] = 'geodir-map-listing-page-single';
191
+
192
+			} else {
193
+				$default_location = geodir_get_default_location();
194
+
195
+				$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
196
+				$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
197
+				$map_args['map_class_name'] = 'geodir-map-listing-page';
198
+				$mapview = $maptype;
199
+			}
200
+
201
+			if (empty($mapzoom)) $mapzoom = $zoom;
202
+
203
+			// Set default map options
204
+			$map_args['ajax_url'] = geodir_get_ajax_url();
205
+			$map_args['latitude'] = $map_default_lat;
206
+			$map_args['longitude'] = $map_default_lng;
207
+			$map_args['zoom'] = $zoom;
208
+			//$map_args['scrollwheel'] = true;
209
+			$map_args['scrollwheel'] = $scrollwheel;
210
+			$map_args['showall'] = $showall;
211
+			$map_args['streetViewControl'] = true;
212
+			$map_args['maptype'] = $maptype;
213
+			$map_args['showPreview'] = '0';
214
+			$map_args['maxZoom'] = 21;
215
+			$map_args['autozoom'] = $autozoom;
216
+			$map_args['bubble_size'] = 'small';
217
+
218
+			echo $before_widget;
219
+			geodir_draw_map($map_args);
220
+			echo $after_widget;
221
+
222
+		endif;
223
+	}
224 224
 
225 225
 	/**
226 226
 	 * Sanitize listing page map widget form values as they are saved.
227 227
 	 *
228 228
 	 * @since 1.0.0
229
-     * @since 1.5.1 Declare function public.
229
+	 * @since 1.5.1 Declare function public.
230 230
 	 *
231 231
 	 * @param array $new_instance Values just sent to be saved.
232 232
 	 * @param array $old_instance Previously saved values from database.
233 233
 	 *
234 234
 	 * @return array Updated safe values to be saved.
235 235
 	 */
236
-    public function update($new_instance, $old_instance)
237
-    {
238
-        //save the widget
239
-        $instance = $old_instance;
240
-        $instance['width'] = strip_tags($new_instance['width']);
241
-        $instance['heigh'] = ($new_instance['heigh']);
242
-        $instance['maptype'] = ($new_instance['maptype']);
243
-        $instance['zoom'] = ($new_instance['zoom']);
244
-        $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : '';
245
-        $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : '';
246
-        $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : '';
247
-        $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : '';
248
-
249
-        return $instance;
250
-    }
236
+	public function update($new_instance, $old_instance)
237
+	{
238
+		//save the widget
239
+		$instance = $old_instance;
240
+		$instance['width'] = strip_tags($new_instance['width']);
241
+		$instance['heigh'] = ($new_instance['heigh']);
242
+		$instance['maptype'] = ($new_instance['maptype']);
243
+		$instance['zoom'] = ($new_instance['zoom']);
244
+		$instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : '';
245
+		$instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : '';
246
+		$instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : '';
247
+		$instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : '';
248
+
249
+		return $instance;
250
+	}
251 251
 
252 252
 	/**
253 253
 	 * Back-end listing page map widget settings form.
254 254
 	 *
255 255
 	 * @since 1.0.0
256
-     * @since 1.5.1 Declare function public.
256
+	 * @since 1.5.1 Declare function public.
257 257
 	 *
258 258
 	 * @param array $instance Previously saved values from database.
259 259
 	 */
260
-    public function form($instance)
261
-    {
262
-        //widgetform in backend
263
-        $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0'));
264
-        $width = strip_tags($instance['width']);
265
-        $heigh = strip_tags($instance['heigh']);
266
-        $maptype = strip_tags($instance['maptype']);
267
-        $zoom = strip_tags($instance['zoom']);
268
-        $autozoom = strip_tags($instance['autozoom']);
269
-        $sticky = strip_tags($instance['sticky']);
270
-        $scrollwheel = strip_tags($instance['scrollwheel']);
271
-        $showall = strip_tags($instance['showall']);
272
-        ?>
260
+	public function form($instance)
261
+	{
262
+		//widgetform in backend
263
+		$instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0'));
264
+		$width = strip_tags($instance['width']);
265
+		$heigh = strip_tags($instance['heigh']);
266
+		$maptype = strip_tags($instance['maptype']);
267
+		$zoom = strip_tags($instance['zoom']);
268
+		$autozoom = strip_tags($instance['autozoom']);
269
+		$sticky = strip_tags($instance['sticky']);
270
+		$scrollwheel = strip_tags($instance['scrollwheel']);
271
+		$showall = strip_tags($instance['showall']);
272
+		?>
273 273
         <p>
274 274
             <label
275 275
                 for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Map Width <small>(Default is : 294) you can use px or % here</small>', 'geodirectory'); ?>
@@ -298,14 +298,14 @@  discard block
 block discarded – undo
298 298
                         name="<?php echo $this->get_field_name('maptype'); ?>">
299 299
 
300 300
                     <option <?php if (isset($maptype) && $maptype == 'ROADMAP') {
301
-                        echo 'selected="selected"';
302
-                    } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option>
301
+						echo 'selected="selected"';
302
+					} ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option>
303 303
                     <option <?php if (isset($maptype) && $maptype == 'SATELLITE') {
304
-                        echo 'selected="selected"';
305
-                    } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option>
304
+						echo 'selected="selected"';
305
+					} ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option>
306 306
                     <option <?php if (isset($maptype) && $maptype == 'HYBRID') {
307
-                        echo 'selected="selected"';
308
-                    } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
307
+						echo 'selected="selected"';
308
+					} ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
309 309
 					<option <?php selected($maptype, 'TERRAIN');?> 
310 310
 							value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option>
311 311
                 </select>
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
         </p>
314 314
 
315 315
         <?php
316
-        $map_zoom_level = geodir_map_zoom_level();
317
-        ?>
316
+		$map_zoom_level = geodir_map_zoom_level();
317
+		?>
318 318
 
319 319
         <p>
320 320
             <label
@@ -324,14 +324,14 @@  discard block
 block discarded – undo
324 324
                 <select class="widefat" id="<?php echo $this->get_field_id('zoom'); ?>"
325 325
                         name="<?php echo $this->get_field_name('zoom'); ?>"> <?php
326 326
 
327
-                    foreach ($map_zoom_level as $level) {
328
-                        $selected = '';
329
-                        if ($level == $zoom)
330
-                            $selected = 'selected="selected"';
327
+					foreach ($map_zoom_level as $level) {
328
+						$selected = '';
329
+						if ($level == $zoom)
330
+							$selected = 'selected="selected"';
331 331
 
332
-                        echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
332
+						echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
333 333
 
334
-                    } ?>
334
+					} ?>
335 335
 
336 336
                 </select>
337 337
 
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
                 :
345 345
                 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('autozoom'); ?>"
346 346
                        name="<?php echo $this->get_field_name('autozoom'); ?>"<?php if ($autozoom) {
347
-                    echo 'checked="checked"';
348
-                } ?> /></label>
347
+					echo 'checked="checked"';
348
+				} ?> /></label>
349 349
         </p>
350 350
 
351 351
         <p>
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
                 :
355 355
                 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('sticky'); ?>"
356 356
                        name="<?php echo $this->get_field_name('sticky'); ?>"<?php if ($sticky) {
357
-                    echo 'checked="checked"';
358
-                } ?> /> </label>
357
+					echo 'checked="checked"';
358
+				} ?> /> </label>
359 359
         </p>
360 360
 
361 361
         <p>
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
     </p> -->
376 376
 
377 377
     <?php
378
-    }
378
+	}
379 379
 } // class geodir_map_listingpage
380 380
 
381 381
 register_widget('geodir_map_listingpage');
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -198,7 +198,9 @@  discard block
 block discarded – undo
198 198
                 $mapview = $maptype;
199 199
             }
200 200
 
201
-            if (empty($mapzoom)) $mapzoom = $zoom;
201
+            if (empty($mapzoom)) {
202
+            	$mapzoom = $zoom;
203
+            }
202 204
 
203 205
             // Set default map options
204 206
             $map_args['ajax_url'] = geodir_get_ajax_url();
@@ -326,8 +328,9 @@  discard block
 block discarded – undo
326 328
 
327 329
                     foreach ($map_zoom_level as $level) {
328 330
                         $selected = '';
329
-                        if ($level == $zoom)
330
-                            $selected = 'selected="selected"';
331
+                        if ($level == $zoom) {
332
+                                                    $selected = 'selected="selected"';
333
+                        }
331 334
 
332 335
                         echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
333 336
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
          * @param string $post->marker_json JSON representation of the post marker info.
46 46
          * @param object $post The post object.
47 47
          */
48
-        $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
48
+        $list_map_json[] = apply_filters('geodir_create_list_jsondata', $post->marker_json, $post);
49 49
     }
50 50
 
51 51
 }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     if (!empty($cat_content_info)) {
73 73
         $json_content = substr(implode(',', $cat_content_info), 1);
74 74
         $json_content = htmlentities($json_content, ENT_QUOTES); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
75
-        $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
75
+        $list_json = '[{"totalcount":"'.$totalcount.'",'.$json_content.']';
76 76
     } else {
77 77
         $list_json = '[{"totalcount":"0"}]';
78 78
     }
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 			 *
161 161
              * @param bool $display true if map should be displayed, false if not.
162 162
              */
163
-			$show_map = apply_filters( 'geodir_show_map_listing', $display = true );
164
-			if ( !$show_map ) {
163
+			$show_map = apply_filters('geodir_show_map_listing', $display = true);
164
+			if (!$show_map) {
165 165
 				return;
166 166
 			}
167 167
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     public function form($instance)
261 261
     {
262 262
         //widgetform in backend
263
-        $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0'));
263
+        $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0'));
264 264
         $width = strip_tags($instance['width']);
265 265
         $heigh = strip_tags($instance['heigh']);
266 266
         $maptype = strip_tags($instance['maptype']);
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
                     <option <?php if (isset($maptype) && $maptype == 'HYBRID') {
307 307
                         echo 'selected="selected"';
308 308
                     } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
309
-					<option <?php selected($maptype, 'TERRAIN');?> 
309
+					<option <?php selected($maptype, 'TERRAIN'); ?> 
310 310
 							value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option>
311 311
                 </select>
312 312
             </label>
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
                         if ($level == $zoom)
330 330
                             $selected = 'selected="selected"';
331 331
 
332
-                        echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
332
+                        echo '<option '.$selected.' value="'.$level.'">'.$level.'</option>';
333 333
 
334 334
                     } ?>
335 335
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
                 :
365 365
                 <input id="<?php echo $this->get_field_id('scrollwheel'); ?>"
366 366
                        name="<?php echo $this->get_field_name('scrollwheel'); ?>" type="checkbox" value="1"
367
-                       <?php if ($scrollwheel){ ?>checked="checked" <?php } ?> />
367
+                       <?php if ($scrollwheel) { ?>checked="checked" <?php } ?> />
368 368
             </label>
369 369
         </p>
370 370
 
Please login to merge, or discard this patch.
geodirectory-templates/listing-listview.php 3 patches
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -80,7 +80,10 @@  discard block
 block discarded – undo
80 80
                     echo ' geodir-listview ';
81 81
                 } ?> <?php if ($post_view_class) {
82 82
                     echo $post_view_class;
83
-                } ?>" <?php if (isset($listing_width) && $listing_width) echo "style='width:{$listing_width}%;'"; // Width for widget listing
83
+                } ?>" <?php if (isset($listing_width) && $listing_width) {
84
+                	echo "style='width:{$listing_width}%;'";
85
+                }
86
+                // Width for widget listing
84 87
 
85 88
                 echo " data-post-id='$post->ID' ";
86 89
                 /**
@@ -402,8 +405,10 @@  discard block
 block discarded – undo
402 405
              */
403 406
             do_action('geodir_after_listing_post_listview');
404 407
 
405
-        else:
406
-			$favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false;
408
+        else {
409
+        	:
410
+			$favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false;
411
+        }
407 412
             
408 413
 			/**
409 414
              * Called inside the `ul` of the listings template, when no listing found.
Please login to merge, or discard this patch.
Indentation   +270 added lines, -270 removed lines patch added patch discarded remove patch
@@ -44,57 +44,57 @@  discard block
 block discarded – undo
44 44
 
45 45
         <?php if (have_posts()) :
46 46
 
47
-            /**
48
-             * Called inside the `ul` of the listings template, but before any `li` elements.
49
-             *
50
-             * When used by the widget view template then it will only show if there are listings to be shown.
51
-             *
52
-             * @since 1.0.0
53
-             * @see 'geodir_after_listing_post_listview'
54
-             */
55
-            do_action('geodir_before_listing_post_listview');
56
-
57
-            while (have_posts()) : the_post();
58
-                global $post, $wpdb, $preview;
59
-
60
-                /**
61
-                 * Add a class to the `li` element of the listings list template.
62
-                 *
63
-                 * @since 1.0.0
64
-                 * @param string $class The extra class for the `li` element, default empty.
65
-                 */
66
-                $post_view_class = apply_filters('geodir_post_view_extra_class', '');
67
-
68
-                /**
69
-                 * Add a class to the `article` tag inside the `li` element on the listings list template.
70
-                 *
71
-                 * @since 1.0.0
72
-                 * @param string $class The extra class for the `article` element, default empty.
73
-                 */
74
-                $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', '');
75
-                ?>
47
+			/**
48
+			 * Called inside the `ul` of the listings template, but before any `li` elements.
49
+			 *
50
+			 * When used by the widget view template then it will only show if there are listings to be shown.
51
+			 *
52
+			 * @since 1.0.0
53
+			 * @see 'geodir_after_listing_post_listview'
54
+			 */
55
+			do_action('geodir_before_listing_post_listview');
56
+
57
+			while (have_posts()) : the_post();
58
+				global $post, $wpdb, $preview;
59
+
60
+				/**
61
+				 * Add a class to the `li` element of the listings list template.
62
+				 *
63
+				 * @since 1.0.0
64
+				 * @param string $class The extra class for the `li` element, default empty.
65
+				 */
66
+				$post_view_class = apply_filters('geodir_post_view_extra_class', '');
67
+
68
+				/**
69
+				 * Add a class to the `article` tag inside the `li` element on the listings list template.
70
+				 *
71
+				 * @since 1.0.0
72
+				 * @param string $class The extra class for the `article` element, default empty.
73
+				 */
74
+				$post_view_article_class = apply_filters('geodir_post_view_article_extra_class', '');
75
+				?>
76 76
 
77 77
                 <li class="clearfix <?php if ($grid_view_class) {
78
-                    echo 'geodir-gridview ' . $grid_view_class;
79
-                } else {
80
-                    echo ' geodir-listview ';
81
-                } ?> <?php if ($post_view_class) {
82
-                    echo $post_view_class;
83
-                } ?>" <?php if (isset($listing_width) && $listing_width) echo "style='width:{$listing_width}%;'"; // Width for widget listing
84
-
85
-                echo " data-post-id='$post->ID' ";
86
-                /**
87
-                 * Called inside the `<li>` tag for listing outputs.
88
-                 *
89
-                 * @since 1.5.9
90
-                 * @param object $post The post object.
91
-                 * @param string $string If called on the listing or widget template.
92
-                 */
93
-                do_action('geodir_listview_inside_li', $post, 'listing');
94
-                ?> >
78
+					echo 'geodir-gridview ' . $grid_view_class;
79
+				} else {
80
+					echo ' geodir-listview ';
81
+				} ?> <?php if ($post_view_class) {
82
+					echo $post_view_class;
83
+				} ?>" <?php if (isset($listing_width) && $listing_width) echo "style='width:{$listing_width}%;'"; // Width for widget listing
84
+
85
+				echo " data-post-id='$post->ID' ";
86
+				/**
87
+				 * Called inside the `<li>` tag for listing outputs.
88
+				 *
89
+				 * @since 1.5.9
90
+				 * @param object $post The post object.
91
+				 * @param string $string If called on the listing or widget template.
92
+				 */
93
+				do_action('geodir_listview_inside_li', $post, 'listing');
94
+				?> >
95 95
                     <article class="geodir-category-listing <?php if ($post_view_article_class) {
96
-                        echo $post_view_article_class;
97
-                    } ?>">
96
+						echo $post_view_article_class;
97
+					} ?>">
98 98
                         <div class="geodir-post-img <?php echo apply_filters('geodir_listing_listview_thumb_extra_class', '', 'listing'); ?>">
99 99
                             <?php if ($fimage = geodir_show_featured_image($post->ID, 'list-thumb', true, false, $post->featured_image)) { ?>
100 100
 
@@ -102,37 +102,37 @@  discard block
 block discarded – undo
102 102
                                     <?php echo $fimage; ?>
103 103
                                 </a>
104 104
                                 <?php
105
-                                /**
106
-                                 * Called before badges are output.
107
-                                 *
108
-                                 * Called on the listings template after the image has been output and before the badges like `new` or `featured` are output.
109
-                                 *
110
-                                 * @since 1.0.0
111
-                                 * @param object $post The post object.
112
-                                 * @see 'geodir_after_badge_on_image'
113
-                                 */
114
-                                do_action('geodir_before_badge_on_image', $post);
115
-                                if (isset($post->is_featured) && $post->is_featured) {
116
-                                    echo geodir_show_badges_on_image('featured', $post, get_permalink());
117
-                                }
118
-
119
-                                $geodir_days_new = (int)get_option('geodir_listing_new_days');
120
-
121
-                                if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
122
-                                    echo geodir_show_badges_on_image('new', $post, get_permalink());
123
-                                }
124
-
125
-                                /**
126
-                                 * Called after badges are output.
127
-                                 *
128
-                                 * Called on the listings template after the image and badges like `new` or `featured` have been output.
129
-                                 *
130
-                                 * @since 1.0.0
131
-                                 * @param object $post The post object.
132
-                                 * @see 'geodir_before_badge_on_image'
133
-                                 */
134
-                                do_action('geodir_after_badge_on_image', $post);
135
-                                ?>
105
+								/**
106
+								 * Called before badges are output.
107
+								 *
108
+								 * Called on the listings template after the image has been output and before the badges like `new` or `featured` are output.
109
+								 *
110
+								 * @since 1.0.0
111
+								 * @param object $post The post object.
112
+								 * @see 'geodir_after_badge_on_image'
113
+								 */
114
+								do_action('geodir_before_badge_on_image', $post);
115
+								if (isset($post->is_featured) && $post->is_featured) {
116
+									echo geodir_show_badges_on_image('featured', $post, get_permalink());
117
+								}
118
+
119
+								$geodir_days_new = (int)get_option('geodir_listing_new_days');
120
+
121
+								if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
122
+									echo geodir_show_badges_on_image('new', $post, get_permalink());
123
+								}
124
+
125
+								/**
126
+								 * Called after badges are output.
127
+								 *
128
+								 * Called on the listings template after the image and badges like `new` or `featured` have been output.
129
+								 *
130
+								 * @since 1.0.0
131
+								 * @param object $post The post object.
132
+								 * @see 'geodir_before_badge_on_image'
133
+								 */
134
+								do_action('geodir_after_badge_on_image', $post);
135
+								?>
136 136
 
137 137
 
138 138
                             <?php } ?>
@@ -142,15 +142,15 @@  discard block
 block discarded – undo
142 142
                         <div class="geodir-content <?php echo apply_filters('geodir_listing_listview_content_extra_class', '', 'listing'); ?>">
143 143
 
144 144
                             <?php
145
-                            /**
146
-                             * Called before the post title on the listings view template.
147
-                             *
148
-                             * @since 1.0.0
149
-                             * @param string $type The template type, default 'listview'.
150
-                             * @param object $post The post object.
151
-                             * @see 'geodir_after_listing_post_title'
152
-                             */
153
-                            do_action('geodir_before_listing_post_title', 'listview', $post); ?>
145
+							/**
146
+							 * Called before the post title on the listings view template.
147
+							 *
148
+							 * @since 1.0.0
149
+							 * @param string $type The template type, default 'listview'.
150
+							 * @param object $post The post object.
151
+							 * @see 'geodir_after_listing_post_title'
152
+							 */
153
+							do_action('geodir_before_listing_post_title', 'listview', $post); ?>
154 154
 
155 155
                             <header class="geodir-entry-header"><h3 class="geodir-entry-title">
156 156
                                     <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
@@ -162,222 +162,222 @@  discard block
 block discarded – undo
162 162
                             <!-- .entry-header -->
163 163
 
164 164
                             <?php
165
-                            /**
166
-                             * Called after the post title on the listings view template.
167
-                             *
168
-                             * @since 1.0.0
169
-                             * @param string $type The template type, default 'listview'.
170
-                             * @param object $post The post object.
171
-                             * @see 'geodir_before_listing_post_title'
172
-                             */
173
-                            do_action('geodir_after_listing_post_title', 'listview', $post); ?>
165
+							/**
166
+							 * Called after the post title on the listings view template.
167
+							 *
168
+							 * @since 1.0.0
169
+							 * @param string $type The template type, default 'listview'.
170
+							 * @param object $post The post object.
171
+							 * @see 'geodir_before_listing_post_title'
172
+							 */
173
+							do_action('geodir_after_listing_post_title', 'listview', $post); ?>
174 174
 
175 175
                             <?php /// Print Distance
176
-                            if (isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') {
176
+							if (isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') {
177 177
 
178
-                                $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']);
178
+								$startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']);
179 179
 
180
-                                $endLat = $post->post_latitude;
181
-                                $endLon = $post->post_longitude;
182
-                                $endPoint = array('latitude' => $endLat, 'longitude' => $endLon);
183
-                                $uom = get_option('geodir_search_dist_1');
184
-                                $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); ?>
180
+								$endLat = $post->post_latitude;
181
+								$endLon = $post->post_longitude;
182
+								$endPoint = array('latitude' => $endLat, 'longitude' => $endLon);
183
+								$uom = get_option('geodir_search_dist_1');
184
+								$distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); ?>
185 185
                                 <h3>
186 186
                                     <?php
187 187
 
188
-                                    if (round($distance, 2) == 0) {
189
-                                        $uom = get_option('geodir_search_dist_2');
190
-
191
-                                        $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom);
192
-                                        if ($uom == 'feet') {
193
-                                            $uom = __('feet', 'geodirectory');
194
-                                        } else {
195
-                                            $uom = __('meters', 'geodirectory');
196
-                                        }
197
-                                        echo round($distance) . ' ' . $uom . '<br />';
198
-                                    } else {
199
-                                        if ($uom == 'miles') {
200
-                                            $uom = __('miles', 'geodirectory');
201
-                                        } else {
202
-                                            $uom = __('km', 'geodirectory');
203
-                                        }
204
-                                        echo round($distance, 2) . ' ' . $uom . '<br />';
205
-                                    }
206
-                                    ?>
188
+									if (round($distance, 2) == 0) {
189
+										$uom = get_option('geodir_search_dist_2');
190
+
191
+										$distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom);
192
+										if ($uom == 'feet') {
193
+											$uom = __('feet', 'geodirectory');
194
+										} else {
195
+											$uom = __('meters', 'geodirectory');
196
+										}
197
+										echo round($distance) . ' ' . $uom . '<br />';
198
+									} else {
199
+										if ($uom == 'miles') {
200
+											$uom = __('miles', 'geodirectory');
201
+										} else {
202
+											$uom = __('km', 'geodirectory');
203
+										}
204
+										echo round($distance, 2) . ' ' . $uom . '<br />';
205
+									}
206
+									?>
207 207
                                 </h3>
208 208
                             <?php } ?>
209 209
 
210 210
 
211 211
                             <?php
212
-                            /**
213
-                             * Called before the post excerpt on the listings view template.
214
-                             *
215
-                             * @since 1.0.0
216
-                             * @param object $post The post object.
217
-                             * @see 'geodir_after_listing_post_excerpt'
218
-                             */
219
-                            do_action('geodir_before_listing_post_excerpt', $post); ?>
212
+							/**
213
+							 * Called before the post excerpt on the listings view template.
214
+							 *
215
+							 * @since 1.0.0
216
+							 * @param object $post The post object.
217
+							 * @see 'geodir_after_listing_post_excerpt'
218
+							 */
219
+							do_action('geodir_before_listing_post_excerpt', $post); ?>
220 220
                             <?php echo geodir_show_listing_info('listing'); ?>
221 221
                             <div class="geodir-entry-content">
222 222
 
223 223
                                 <?php
224
-                                /**
225
-                                 * Filter to hide the listing excerpt
226
-                                 *
227
-                                 * @since 1.5.3
228
-                                 * @param bool $display Display the excerpt or not. Default true.
229
-                                 * @param string $view The view type, default 'listview'.
230
-                                 * @param object $post The post object.
231
-                                 */
232
-                                $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post);
233
-                                if ($show_listing_excerpt) {
234
-                                    if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
235
-                                        $content_out = geodir_max_excerpt( $character_count );
236
-                                    } else {
237
-                                        $content_out = get_the_excerpt();
238
-                                    }
239
-                                    if ( ! empty( $content_out ) ) {
240
-                                        echo "<p>" . $content_out . "</p>";
241
-                                    }
242
-                                }
243
-                                ?></div>
224
+								/**
225
+								 * Filter to hide the listing excerpt
226
+								 *
227
+								 * @since 1.5.3
228
+								 * @param bool $display Display the excerpt or not. Default true.
229
+								 * @param string $view The view type, default 'listview'.
230
+								 * @param object $post The post object.
231
+								 */
232
+								$show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post);
233
+								if ($show_listing_excerpt) {
234
+									if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
235
+										$content_out = geodir_max_excerpt( $character_count );
236
+									} else {
237
+										$content_out = get_the_excerpt();
238
+									}
239
+									if ( ! empty( $content_out ) ) {
240
+										echo "<p>" . $content_out . "</p>";
241
+									}
242
+								}
243
+								?></div>
244 244
 
245 245
                             <?php
246
-                            /**
247
-                             * Called after the post excerpt on the listings view template.
248
-                             *
249
-                             * @since 1.0.0
250
-                             * @param object $post The post object.
251
-                             * @see 'geodir_before_listing_post_excerpt'
252
-                             */
253
-                            do_action('geodir_after_listing_post_excerpt', $post); ?>
246
+							/**
247
+							 * Called after the post excerpt on the listings view template.
248
+							 *
249
+							 * @since 1.0.0
250
+							 * @param object $post The post object.
251
+							 * @see 'geodir_before_listing_post_excerpt'
252
+							 */
253
+							do_action('geodir_after_listing_post_excerpt', $post); ?>
254 254
                         </div>
255 255
                         <!-- gd-content ends here-->
256 256
                         <?php
257
-                        /**
258
-                         * Called after printing listing content.
259
-                         *
260
-                         * @since 1.5.3
261
-                         * @param object $post The post object.
262
-                         * @param string $view The view type, default 'listing'.
263
-                         */
264
-                        do_action( 'geodir_after_listing_content', $post, 'listing' ); ?>
257
+						/**
258
+						 * Called after printing listing content.
259
+						 *
260
+						 * @since 1.5.3
261
+						 * @param object $post The post object.
262
+						 * @param string $view The view type, default 'listing'.
263
+						 */
264
+						do_action( 'geodir_after_listing_content', $post, 'listing' ); ?>
265 265
                         <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'listing'); ?>">
266 266
                             <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'listing'); ?>">
267 267
 
268 268
                                 <?php
269
-                                /**
270
-                                 * Called before printing review stars html.
271
-                                 *
272
-                                 * @since 1.5.3
273
-                                 * @param object $post The post object.
274
-                                 * @param string $view The view type, default 'listing'.
275
-                                 */
276
-                                do_action( 'geodir_before_review_html', $post, 'listing' );
277
-
278
-                                $review_show = geodir_is_reviews_show('listview');
279
-
280
-                                if ($review_show) {
281
-
282
-                                    if (!$preview) {
283
-                                        $post_avgratings = geodir_get_post_rating($post->ID);
284
-                                        /**
285
-                                         * Called before the rating stars are output on the listings view template.
286
-                                         *
287
-                                         * @since 1.0.0
288
-                                         * @param float $post_avgratings The average rating for the post.
289
-                                         * @param int $post->ID The post ID.
290
-                                         * @see 'geodir_after_review_rating_stars_on_listview'
291
-                                         */
292
-                                        do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID);
293
-
294
-                                        echo geodir_get_rating_stars($post_avgratings, $post->ID);
295
-
296
-                                        /**
297
-                                         * Called after the rating stars are output on the listings view template.
298
-                                         *
299
-                                         * @since 1.0.0
300
-                                         * @param float $post_avgratings The average rating for the post.
301
-                                         * @param int $post->ID The post ID.
302
-                                         * @see 'geodir_before_review_rating_stars_on_listview'
303
-                                         */
304
-                                        do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID);
305
-                                    }
306
-                                    ?>
269
+								/**
270
+								 * Called before printing review stars html.
271
+								 *
272
+								 * @since 1.5.3
273
+								 * @param object $post The post object.
274
+								 * @param string $view The view type, default 'listing'.
275
+								 */
276
+								do_action( 'geodir_before_review_html', $post, 'listing' );
277
+
278
+								$review_show = geodir_is_reviews_show('listview');
279
+
280
+								if ($review_show) {
281
+
282
+									if (!$preview) {
283
+										$post_avgratings = geodir_get_post_rating($post->ID);
284
+										/**
285
+										 * Called before the rating stars are output on the listings view template.
286
+										 *
287
+										 * @since 1.0.0
288
+										 * @param float $post_avgratings The average rating for the post.
289
+										 * @param int $post->ID The post ID.
290
+										 * @see 'geodir_after_review_rating_stars_on_listview'
291
+										 */
292
+										do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID);
293
+
294
+										echo geodir_get_rating_stars($post_avgratings, $post->ID);
295
+
296
+										/**
297
+										 * Called after the rating stars are output on the listings view template.
298
+										 *
299
+										 * @since 1.0.0
300
+										 * @param float $post_avgratings The average rating for the post.
301
+										 * @param int $post->ID The post ID.
302
+										 * @see 'geodir_before_review_rating_stars_on_listview'
303
+										 */
304
+										do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID);
305
+									}
306
+									?>
307 307
                                     <a href="<?php comments_link(); ?>" class="geodir-pcomments"><i
308 308
                                             class="fa fa-comments"></i>
309 309
                                         <?php geodir_comments_number($post->rating_count); ?></a>
310 310
                                 <?php
311
-                                }
311
+								}
312 312
 
313 313
 
314
-                                /**
315
-                                 * Called after printing favorite html.
316
-                                 *
317
-                                 * @since 1.0.0
318
-                                 */
319
-                                do_action( 'geodir_after_favorite_html', $post->ID, 'listing' );
314
+								/**
315
+								 * Called after printing favorite html.
316
+								 *
317
+								 * @since 1.0.0
318
+								 */
319
+								do_action( 'geodir_after_favorite_html', $post->ID, 'listing' );
320 320
 
321 321
 
322
-                                /**
323
-                                 * Called after printing map pin point.
324
-                                 *
325
-                                 * @since 1.0.0
326
-                                 * @since 1.5.9 Added $post as second param.
327
-                                 * @param int $post->ID The post id.
328
-                                 * @param object $post The post object.
329
-                                 */
330
-                                do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post);
322
+								/**
323
+								 * Called after printing map pin point.
324
+								 *
325
+								 * @since 1.0.0
326
+								 * @since 1.5.9 Added $post as second param.
327
+								 * @param int $post->ID The post id.
328
+								 * @param object $post The post object.
329
+								 */
330
+								do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post);
331 331
 
332
-                                if ($post->post_author == get_current_user_id()) { ?>
332
+								if ($post->post_author == get_current_user_id()) { ?>
333 333
                                     <?php
334
-                                    $addplacelink = get_permalink(geodir_add_listing_page_id());
335
-                                    $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false);
336
-                                    $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false);
334
+									$addplacelink = get_permalink(geodir_add_listing_page_id());
335
+									$editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false);
336
+									$upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false);
337 337
 
338
-                                    $ajaxlink = geodir_get_ajax_url();
339
-                                    $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false);
338
+									$ajaxlink = geodir_get_ajax_url();
339
+									$deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false);
340 340
 
341
-                                    ?>
341
+									?>
342 342
 
343 343
                                     <span class="geodir-authorlink clearfix">
344 344
 											
345 345
 											<?php if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) {
346
-                                                /**
347
-                                                 * Called before the edit post link on the listings view template used on the author page.
348
-                                                 *
349
-                                                 * @since 1.0.0
350
-                                                 * @see 'geodir_after_edit_post_link_on_listing'
351
-                                                 */
352
-                                                do_action('geodir_before_edit_post_link_on_listing');
353
-                                                ?>
346
+												/**
347
+												 * Called before the edit post link on the listings view template used on the author page.
348
+												 *
349
+												 * @since 1.0.0
350
+												 * @see 'geodir_after_edit_post_link_on_listing'
351
+												 */
352
+												do_action('geodir_before_edit_post_link_on_listing');
353
+												?>
354 354
 
355 355
                                                 <a href="<?php echo esc_url($editlink); ?>" class="geodir-edit"
356 356
                                                    title="<?php _e('Edit Listing', 'geodirectory'); ?>">
357 357
                                                     <?php
358
-                                                    $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
359
-                                                    echo '<i class="'. $geodir_listing_edit_icon .'"></i>';
360
-                                                    ?>
358
+													$geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
359
+													echo '<i class="'. $geodir_listing_edit_icon .'"></i>';
360
+													?>
361 361
                                                     <?php _e('Edit', 'geodirectory'); ?>
362 362
                                                 </a>
363 363
                                                 <a href="<?php echo esc_url($deletelink); ?>" class="geodir-delete"
364 364
                                                    title="<?php _e('Delete Listing', 'geodirectory'); ?>">
365 365
                                                     <?php
366
-                                                    $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
367
-                                                    echo '<i class="'. $geodir_listing_delete_icon .'"></i>';
368
-                                                    ?>
366
+													$geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
367
+													echo '<i class="'. $geodir_listing_delete_icon .'"></i>';
368
+													?>
369 369
                                                     <?php _e('Delete', 'geodirectory'); ?>
370 370
                                                 </a>
371 371
                                                 <?php
372 372
 
373
-                                                /**
374
-                                                 * Called after the edit post link on the listings view template used on the author page.
375
-                                                 *
376
-                                                 * @since 1.0.0
377
-                                                 * @see 'geodir_before_edit_post_link_on_listing'
378
-                                                 */
379
-                                                do_action('geodir_after_edit_post_link_on_listing');
380
-                                            } ?>
373
+												/**
374
+												 * Called after the edit post link on the listings view template used on the author page.
375
+												 *
376
+												 * @since 1.0.0
377
+												 * @see 'geodir_before_edit_post_link_on_listing'
378
+												 */
379
+												do_action('geodir_after_edit_post_link_on_listing');
380
+											} ?>
381 381
 											</span>
382 382
 
383 383
                                 <?php } ?>
@@ -390,32 +390,32 @@  discard block
 block discarded – undo
390 390
                 </li>
391 391
 
392 392
             <?php
393
-            endwhile;
394
-
395
-            /**
396
-             * Called inside the `ul` of the listings template, but after all `li` elements.
397
-             *
398
-             * When used by the widget view template then it will only show if there are listings to be shown.
399
-             *
400
-             * @since 1.0.0
401
-             * @see 'geodir_before_listing_post_listview'
402
-             */
403
-            do_action('geodir_after_listing_post_listview');
404
-
405
-        else:
393
+			endwhile;
394
+
395
+			/**
396
+			 * Called inside the `ul` of the listings template, but after all `li` elements.
397
+			 *
398
+			 * When used by the widget view template then it will only show if there are listings to be shown.
399
+			 *
400
+			 * @since 1.0.0
401
+			 * @see 'geodir_before_listing_post_listview'
402
+			 */
403
+			do_action('geodir_after_listing_post_listview');
404
+
405
+		else:
406 406
 			$favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false;
407 407
             
408 408
 			/**
409
-             * Called inside the `ul` of the listings template, when no listing found.
410
-             *
411
-             * @since 1.5.5
409
+			 * Called inside the `ul` of the listings template, when no listing found.
410
+			 *
411
+			 * @since 1.5.5
412 412
 			 * @param string 'listing-listview' Listing listview template.
413 413
 			 * @param bool $favorite Are favorite listings results?
414
-             */
415
-            do_action('geodir_message_not_found_on_listing', 'listing-listview', $favorite);
416
-        endif;
414
+			 */
415
+			do_action('geodir_message_not_found_on_listing', 'listing-listview', $favorite);
416
+		endif;
417 417
 
418
-        ?>
418
+		?>
419 419
     </ul>  <!-- geodir_category_list_view ends here-->
420 420
 
421 421
     <div class="clear"></div>
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                 ?>
76 76
 
77 77
                 <li class="clearfix <?php if ($grid_view_class) {
78
-                    echo 'geodir-gridview ' . $grid_view_class;
78
+                    echo 'geodir-gridview '.$grid_view_class;
79 79
                 } else {
80 80
                     echo ' geodir-listview ';
81 81
                 } ?> <?php if ($post_view_class) {
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                                     echo geodir_show_badges_on_image('featured', $post, get_permalink());
117 117
                                 }
118 118
 
119
-                                $geodir_days_new = (int)get_option('geodir_listing_new_days');
119
+                                $geodir_days_new = (int) get_option('geodir_listing_new_days');
120 120
 
121 121
                                 if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
122 122
                                     echo geodir_show_badges_on_image('new', $post, get_permalink());
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
                                         } else {
195 195
                                             $uom = __('meters', 'geodirectory');
196 196
                                         }
197
-                                        echo round($distance) . ' ' . $uom . '<br />';
197
+                                        echo round($distance).' '.$uom.'<br />';
198 198
                                     } else {
199 199
                                         if ($uom == 'miles') {
200 200
                                             $uom = __('miles', 'geodirectory');
201 201
                                         } else {
202 202
                                             $uom = __('km', 'geodirectory');
203 203
                                         }
204
-                                        echo round($distance, 2) . ' ' . $uom . '<br />';
204
+                                        echo round($distance, 2).' '.$uom.'<br />';
205 205
                                     }
206 206
                                     ?>
207 207
                                 </h3>
@@ -231,13 +231,13 @@  discard block
 block discarded – undo
231 231
                                  */
232 232
                                 $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post);
233 233
                                 if ($show_listing_excerpt) {
234
-                                    if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
235
-                                        $content_out = geodir_max_excerpt( $character_count );
234
+                                    if (isset($character_count) && ($character_count || $character_count == '0')) {
235
+                                        $content_out = geodir_max_excerpt($character_count);
236 236
                                     } else {
237 237
                                         $content_out = get_the_excerpt();
238 238
                                     }
239
-                                    if ( ! empty( $content_out ) ) {
240
-                                        echo "<p>" . $content_out . "</p>";
239
+                                    if (!empty($content_out)) {
240
+                                        echo "<p>".$content_out."</p>";
241 241
                                     }
242 242
                                 }
243 243
                                 ?></div>
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                          * @param object $post The post object.
262 262
                          * @param string $view The view type, default 'listing'.
263 263
                          */
264
-                        do_action( 'geodir_after_listing_content', $post, 'listing' ); ?>
264
+                        do_action('geodir_after_listing_content', $post, 'listing'); ?>
265 265
                         <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'listing'); ?>">
266 266
                             <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'listing'); ?>">
267 267
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
                                  * @param object $post The post object.
274 274
                                  * @param string $view The view type, default 'listing'.
275 275
                                  */
276
-                                do_action( 'geodir_before_review_html', $post, 'listing' );
276
+                                do_action('geodir_before_review_html', $post, 'listing');
277 277
 
278 278
                                 $review_show = geodir_is_reviews_show('listview');
279 279
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
                                  *
317 317
                                  * @since 1.0.0
318 318
                                  */
319
-                                do_action( 'geodir_after_favorite_html', $post->ID, 'listing' );
319
+                                do_action('geodir_after_favorite_html', $post->ID, 'listing');
320 320
 
321 321
 
322 322
                                 /**
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
                                  * @param int $post->ID The post id.
328 328
                                  * @param object $post The post object.
329 329
                                  */
330
-                                do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post);
330
+                                do_action('geodir_listing_after_pinpoint', $post->ID, $post);
331 331
 
332 332
                                 if ($post->post_author == get_current_user_id()) { ?>
333 333
                                     <?php
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
                                                    title="<?php _e('Edit Listing', 'geodirectory'); ?>">
357 357
                                                     <?php
358 358
                                                     $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
359
-                                                    echo '<i class="'. $geodir_listing_edit_icon .'"></i>';
359
+                                                    echo '<i class="'.$geodir_listing_edit_icon.'"></i>';
360 360
                                                     ?>
361 361
                                                     <?php _e('Edit', 'geodirectory'); ?>
362 362
                                                 </a>
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
                                                    title="<?php _e('Delete Listing', 'geodirectory'); ?>">
365 365
                                                     <?php
366 366
                                                     $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
367
-                                                    echo '<i class="'. $geodir_listing_delete_icon .'"></i>';
367
+                                                    echo '<i class="'.$geodir_listing_delete_icon.'"></i>';
368 368
                                                     ?>
369 369
                                                     <?php _e('Delete', 'geodirectory'); ?>
370 370
                                                 </a>
Please login to merge, or discard this patch.
geodirectory-templates/widget-listing-listview.php 2 patches
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -20,72 +20,72 @@  discard block
 block discarded – undo
20 20
 /** This action is documented in geodirectory-templates/listing-listview.php */
21 21
 $grid_view_class = apply_filters('geodir_grid_view_widget_columns', $gridview_columns_widget);
22 22
 if ($gd_session->get('gd_listing_view') && !isset($before_widget)) {
23
-    $grid_view_class = geodir_convert_listing_view_class($gd_session->get('gd_listing_view'));
23
+	$grid_view_class = geodir_convert_listing_view_class($gd_session->get('gd_listing_view'));
24 24
 }
25 25
 ?>
26 26
     <ul class="geodir_category_list_view clearfix <?php echo apply_filters('geodir_listing_listview_ul_extra_class', '', 'widget'); ?>">
27 27
         <?php
28
-        if (!empty($widget_listings)) {
29
-            /** This action is documented in geodirectory-templates/listing-listview.php */
30
-            do_action('geodir_before_listing_post_listview');
31
-            $all_postypes = geodir_get_posttypes();
32
-            $geodir_days_new = (int)get_option('geodir_listing_new_days');
33
-            foreach ($widget_listings as $widget_listing) {
34
-                global $gd_widget_listing_type;
35
-                $post = $widget_listing;
28
+		if (!empty($widget_listings)) {
29
+			/** This action is documented in geodirectory-templates/listing-listview.php */
30
+			do_action('geodir_before_listing_post_listview');
31
+			$all_postypes = geodir_get_posttypes();
32
+			$geodir_days_new = (int)get_option('geodir_listing_new_days');
33
+			foreach ($widget_listings as $widget_listing) {
34
+				global $gd_widget_listing_type;
35
+				$post = $widget_listing;
36 36
 
37
-                $GLOBALS['post'] = $post;
38
-                setup_postdata($post);
37
+				$GLOBALS['post'] = $post;
38
+				setup_postdata($post);
39 39
 
40
-                $gd_widget_listing_type = $post->post_type;
40
+				$gd_widget_listing_type = $post->post_type;
41 41
 
42
-                /** This action is documented in geodirectory-templates/listing-listview.php */
43
-                $post_view_class = apply_filters('geodir_post_view_extra_class', '', $all_postypes);
42
+				/** This action is documented in geodirectory-templates/listing-listview.php */
43
+				$post_view_class = apply_filters('geodir_post_view_extra_class', '', $all_postypes);
44 44
 
45
-                /** This action is documented in geodirectory-templates/listing-listview.php */
46
-                $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', '');
47
-                ?>
45
+				/** This action is documented in geodirectory-templates/listing-listview.php */
46
+				$post_view_article_class = apply_filters('geodir_post_view_article_extra_class', '');
47
+				?>
48 48
                 <li class="clearfix <?php if ($grid_view_class) {
49
-                    echo 'geodir-gridview ' . $grid_view_class;
50
-                } else {
51
-                    echo ' geodir-listview ';
52
-                } ?> <?php if ($post_view_class) {
53
-                    echo $post_view_class;
54
-                } ?>" <?php if (isset($listing_width) && $listing_width) {
55
-                    echo "style='width:{$listing_width}%;'";
56
-                }
49
+					echo 'geodir-gridview ' . $grid_view_class;
50
+				} else {
51
+					echo ' geodir-listview ';
52
+				} ?> <?php if ($post_view_class) {
53
+					echo $post_view_class;
54
+				} ?>" <?php if (isset($listing_width) && $listing_width) {
55
+					echo "style='width:{$listing_width}%;'";
56
+				}
57 57
 
58
-                echo " data-post-id='$post->ID' ";
59
-                /** This action is documented in geodirectory-templates/listing-listview.php */
60
-                do_action('geodir_listview_inside_li', $post, 'widget');
61
-                ?>>
58
+				echo " data-post-id='$post->ID' ";
59
+				/** This action is documented in geodirectory-templates/listing-listview.php */
60
+				do_action('geodir_listview_inside_li', $post, 'widget');
61
+				?>>
62 62
                     <article class="geodir-category-listing <?php if ($post_view_article_class) {
63
-                        echo $post_view_article_class;
64
-                    } ?>">
63
+						echo $post_view_article_class;
64
+					} ?>">
65 65
                         <div class="geodir-post-img <?php echo apply_filters('geodir_listing_listview_thumb_extra_class', '', 'widget'); ?>">
66 66
                             <?php if ($fimage = geodir_show_featured_image($post->ID, 'list-thumb', true, false, $post->featured_image)) { ?>
67 67
                                 <a href="<?php the_permalink(); ?>"><?php echo $fimage; ?></a>
68 68
                                 <?php
69
-                                /** This action is documented in geodirectory-templates/listing-listview.php */
70
-                                do_action('geodir_before_badge_on_image', $post);
71
-                                if ($post->is_featured) {
72
-                                    echo geodir_show_badges_on_image('featured', $post, get_permalink());
73
-                                }
69
+								/** This action is documented in geodirectory-templates/listing-listview.php */
70
+								do_action('geodir_before_badge_on_image', $post);
71
+								if ($post->is_featured) {
72
+									echo geodir_show_badges_on_image('featured', $post, get_permalink());
73
+								}
74 74
 
75 75
 
76
-                                if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
77
-                                    echo geodir_show_badges_on_image('new', $post, get_permalink());
78
-                                }
76
+								if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
77
+									echo geodir_show_badges_on_image('new', $post, get_permalink());
78
+								}
79 79
 
80
-                                /** This action is documented in geodirectory-templates/listing-listview.php */
81
-                                do_action('geodir_after_badge_on_image', $post);
82
-                            }
83
-                            ?>
80
+								/** This action is documented in geodirectory-templates/listing-listview.php */
81
+								do_action('geodir_after_badge_on_image', $post);
82
+							}
83
+							?>
84 84
                         </div>
85 85
                         <div class="geodir-content <?php echo apply_filters('geodir_listing_listview_content_extra_class', '', 'widget'); ?>">
86 86
                             <?php
87
-                            /** This action is documented in geodirectory-templates/listing-listview.php */
88
-                            do_action('geodir_before_listing_post_title', 'listview', $post); ?>
87
+							/** This action is documented in geodirectory-templates/listing-listview.php */
88
+							do_action('geodir_before_listing_post_title', 'listview', $post); ?>
89 89
                             <header class="geodir-entry-header">
90 90
                                 <h3 class="geodir-entry-title">
91 91
                                     <a href="<?php the_permalink(); ?>"
@@ -94,158 +94,158 @@  discard block
 block discarded – undo
94 94
                             </header>
95 95
                             <!-- .entry-header -->
96 96
                             <?php
97
-                            /** This action is documented in geodirectory-templates/listing-listview.php */
98
-                            do_action('geodir_after_listing_post_title', 'listview', $post); ?>
97
+							/** This action is documented in geodirectory-templates/listing-listview.php */
98
+							do_action('geodir_after_listing_post_title', 'listview', $post); ?>
99 99
                             <?php /// Print Distance
100
-                            if (isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') {
101
-                                $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']);
100
+							if (isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') {
101
+								$startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']);
102 102
 
103
-                                $endLat = $post->post_latitude;
104
-                                $endLon = $post->post_longitude;
105
-                                $endPoint = array('latitude' => $endLat, 'longitude' => $endLon);
106
-                                $uom = get_option('geodir_search_dist_1');
107
-                                $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom);
108
-                                ?>
103
+								$endLat = $post->post_latitude;
104
+								$endLon = $post->post_longitude;
105
+								$endPoint = array('latitude' => $endLat, 'longitude' => $endLon);
106
+								$uom = get_option('geodir_search_dist_1');
107
+								$distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom);
108
+								?>
109 109
                                 <h3>
110 110
                                     <?php
111
-                                    if (round($distance, 2) == 0) {
112
-                                        $uom = get_option('geodir_search_dist_2');
113
-                                        $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom);
114
-                                        if ($uom == 'feet') {
115
-                                            $uom = __('feet', 'geodirectory');
116
-                                        } else {
117
-                                            $uom = __('meters', 'geodirectory');
118
-                                        }
119
-                                        echo round($distance) . ' ' . __($uom, 'geodirectory') . '
111
+									if (round($distance, 2) == 0) {
112
+										$uom = get_option('geodir_search_dist_2');
113
+										$distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom);
114
+										if ($uom == 'feet') {
115
+											$uom = __('feet', 'geodirectory');
116
+										} else {
117
+											$uom = __('meters', 'geodirectory');
118
+										}
119
+										echo round($distance) . ' ' . __($uom, 'geodirectory') . '
120 120
 			<br />
121 121
 			';
122
-                                    } else {
123
-                                        if ($uom == 'miles') {
124
-                                            $uom = __('miles', 'geodirectory');
125
-                                        } else {
126
-                                            $uom = __('km', 'geodirectory');
127
-                                        }
128
-                                        echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . '
122
+									} else {
123
+										if ($uom == 'miles') {
124
+											$uom = __('miles', 'geodirectory');
125
+										} else {
126
+											$uom = __('km', 'geodirectory');
127
+										}
128
+										echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . '
129 129
 			<br />
130 130
 			';
131
-                                    }
132
-                                    ?>
131
+									}
132
+									?>
133 133
                                 </h3>
134 134
                             <?php } ?>
135 135
                             <?php
136
-                            /** This action is documented in geodirectory-templates/listing-listview.php */
137
-                            do_action('geodir_before_listing_post_excerpt', $post); ?>
136
+							/** This action is documented in geodirectory-templates/listing-listview.php */
137
+							do_action('geodir_before_listing_post_excerpt', $post); ?>
138 138
                             <?php echo geodir_show_listing_info('listing'); ?>
139 139
                             <?php if (isset($character_count) && $character_count == '0') {
140
-                            } else { ?>
140
+							} else { ?>
141 141
                                 <div class="geodir-entry-content">
142 142
                                     <?php
143
-                                    /**
144
-                                     * Filter to hide the listing excerpt
145
-                                     *
146
-                                     * @since 1.5.3
147
-                                     * @param bool $display Display the excerpt or not. Default true.
148
-                                     * @param object $post The post object.
149
-                                     */
150
-                                    $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post);
151
-                                    if ($show_listing_excerpt) {
152
-                                        if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
153
-                                            $content_out = geodir_max_excerpt( $character_count );
154
-                                        } else {
155
-                                            $content_out = get_the_excerpt();
156
-                                        }
157
-                                        if ( ! empty( $content_out ) ) {
158
-                                            echo "<p>" . $content_out . "</p>";
159
-                                        }
160
-                                    }
161
-                                    ?>
143
+									/**
144
+									 * Filter to hide the listing excerpt
145
+									 *
146
+									 * @since 1.5.3
147
+									 * @param bool $display Display the excerpt or not. Default true.
148
+									 * @param object $post The post object.
149
+									 */
150
+									$show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post);
151
+									if ($show_listing_excerpt) {
152
+										if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
153
+											$content_out = geodir_max_excerpt( $character_count );
154
+										} else {
155
+											$content_out = get_the_excerpt();
156
+										}
157
+										if ( ! empty( $content_out ) ) {
158
+											echo "<p>" . $content_out . "</p>";
159
+										}
160
+									}
161
+									?>
162 162
                                 </div>
163 163
                             <?php } ?>
164 164
                             <?php
165
-                            /** This action is documented in geodirectory-templates/listing-listview.php */
166
-                            do_action('geodir_after_listing_post_excerpt', $post); ?>
165
+							/** This action is documented in geodirectory-templates/listing-listview.php */
166
+							do_action('geodir_after_listing_post_excerpt', $post); ?>
167 167
                         </div>
168 168
                         <!-- gd-content ends here-->
169 169
                         <?php
170
-                        /**
171
-                         * Called after printing listing content.
172
-                         *
173
-                         * @since 1.5.3
174
-                         * @param object $post The post object.
175
-                         * @param string $view The view type, default 'widget'.
176
-                         */
177
-                        do_action( 'geodir_after_listing_content', $post, 'widget' ); ?>
170
+						/**
171
+						 * Called after printing listing content.
172
+						 *
173
+						 * @since 1.5.3
174
+						 * @param object $post The post object.
175
+						 * @param string $view The view type, default 'widget'.
176
+						 */
177
+						do_action( 'geodir_after_listing_content', $post, 'widget' ); ?>
178 178
                         <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'widget'); ?>">
179 179
                             <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'widget'); ?>">
180 180
                                 <?php
181
-                                /**
182
-                                 * Called before printing review stars html.
183
-                                 *
184
-                                 * @since 1.5.3
185
-                                 * @param object $post The post object.
186
-                                 * @param string $view The view type, default 'widget'.
187
-                                 */
188
-                                do_action( 'geodir_before_review_html', $post, 'widget' );
189
-                                $review_show = geodir_is_reviews_show('listview');
190
-                                if ($review_show) {
181
+								/**
182
+								 * Called before printing review stars html.
183
+								 *
184
+								 * @since 1.5.3
185
+								 * @param object $post The post object.
186
+								 * @param string $view The view type, default 'widget'.
187
+								 */
188
+								do_action( 'geodir_before_review_html', $post, 'widget' );
189
+								$review_show = geodir_is_reviews_show('listview');
190
+								if ($review_show) {
191 191
 
192
-                                    $post_avgratings = geodir_get_post_rating($post->ID);
192
+									$post_avgratings = geodir_get_post_rating($post->ID);
193 193
 
194
-                                    /** This action is documented in geodirectory-templates/listing-listview.php */
195
-                                    do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID);
194
+									/** This action is documented in geodirectory-templates/listing-listview.php */
195
+									do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID);
196 196
 
197
-                                    echo geodir_get_rating_stars($post_avgratings, $post->ID);
197
+									echo geodir_get_rating_stars($post_avgratings, $post->ID);
198 198
 
199
-                                    /** This action is documented in geodirectory-templates/listing-listview.php */
200
-                                    do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID);
201
-                                    ?><a href="<?php comments_link(); ?>" class="geodir-pcomments"><i
199
+									/** This action is documented in geodirectory-templates/listing-listview.php */
200
+									do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID);
201
+									?><a href="<?php comments_link(); ?>" class="geodir-pcomments"><i
202 202
                                         class="fa fa-comments"></i> <?php geodir_comments_number($post->rating_count); ?>
203 203
                                     </a>
204 204
                                 <?php
205
-                                }
205
+								}
206 206
 
207 207
 
208
-                                /**
209
-                                 * Called after printing favorite html.
210
-                                 *
211
-                                 * @since 1.0.0
212
-                                 */
213
-                                do_action( 'geodir_after_favorite_html', $post->ID, 'widget' );
208
+								/**
209
+								 * Called after printing favorite html.
210
+								 *
211
+								 * @since 1.0.0
212
+								 */
213
+								do_action( 'geodir_after_favorite_html', $post->ID, 'widget' );
214 214
 
215
-                                if ($post->post_author == get_current_user_id()) {
216
-                                    $addplacelink = get_permalink(geodir_add_listing_page_id());
217
-                                    $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false);
218
-                                    $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false);
215
+								if ($post->post_author == get_current_user_id()) {
216
+									$addplacelink = get_permalink(geodir_add_listing_page_id());
217
+									$editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false);
218
+									$upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false);
219 219
 
220
-                                    $ajaxlink = geodir_get_ajax_url();
221
-                                    $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false);
222
-                                    ?>
220
+									$ajaxlink = geodir_get_ajax_url();
221
+									$deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false);
222
+									?>
223 223
                                     <span class="geodir-authorlink clearfix">
224 224
                                 <?php
225
-                if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) {
226
-                    /** This action is documented in geodirectory-templates/listing-listview.php */
227
-                    do_action('geodir_before_edit_post_link_on_listing');
228
-                    ?>
225
+				if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) {
226
+					/** This action is documented in geodirectory-templates/listing-listview.php */
227
+					do_action('geodir_before_edit_post_link_on_listing');
228
+					?>
229 229
                     <a href="<?php echo esc_url($editlink); ?>" class="geodir-edit"
230 230
                        title="<?php _e('Edit Listing', 'geodirectory'); ?>">
231 231
                         <?php
232
-                        $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
233
-                        echo '<i class="'. $geodir_listing_edit_icon .'"></i>';
234
-                        ?>
232
+						$geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
233
+						echo '<i class="'. $geodir_listing_edit_icon .'"></i>';
234
+						?>
235 235
                         <?php _e('Edit', 'geodirectory'); ?>
236 236
                     </a>
237 237
                     <a href="<?php echo esc_url($deletelink); ?>" class="geodir-delete"
238 238
                        title="<?php _e('Delete Listing', 'geodirectory'); ?>">
239 239
                         <?php
240
-                        $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
241
-                        echo '<i class="'. $geodir_listing_delete_icon .'"></i>';
242
-                        ?>
240
+						$geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
241
+						echo '<i class="'. $geodir_listing_delete_icon .'"></i>';
242
+						?>
243 243
                         <?php _e('Delete', 'geodirectory'); ?>
244 244
                     </a>
245 245
                     <?php
246
-                    /** This action is documented in geodirectory-templates/listing-listview.php */
247
-                    do_action('geodir_after_edit_post_link_on_listing');
248
-                } ?>
246
+					/** This action is documented in geodirectory-templates/listing-listview.php */
247
+					do_action('geodir_after_edit_post_link_on_listing');
248
+				} ?>
249 249
 					</span>
250 250
                                 <?php } ?>
251 251
                             </div>
@@ -255,17 +255,17 @@  discard block
 block discarded – undo
255 255
                     </article>
256 256
                 </li>
257 257
                 <?php
258
-                unset($gd_widget_listing_type);
259
-            }
260
-            /** This action is documented in geodirectory-templates/listing-listview.php */
261
-            do_action('geodir_after_listing_post_listview');
262
-        } else {
258
+				unset($gd_widget_listing_type);
259
+			}
260
+			/** This action is documented in geodirectory-templates/listing-listview.php */
261
+			do_action('geodir_after_listing_post_listview');
262
+		} else {
263 263
 			$favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false;
264 264
             
265 265
 			/** This action is documented in geodirectory-templates/listing-listview.php */
266
-            do_action('geodir_message_not_found_on_listing', 'widget-listing-listview', $favorite);
267
-        }
268
-        ?>
266
+			do_action('geodir_message_not_found_on_listing', 'widget-listing-listview', $favorite);
267
+		}
268
+		?>
269 269
     </ul>  <!-- geodir_category_list_view ends here-->
270 270
     <div class="clear"></div>
271 271
 <?php
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             /** This action is documented in geodirectory-templates/listing-listview.php */
30 30
             do_action('geodir_before_listing_post_listview');
31 31
             $all_postypes = geodir_get_posttypes();
32
-            $geodir_days_new = (int)get_option('geodir_listing_new_days');
32
+            $geodir_days_new = (int) get_option('geodir_listing_new_days');
33 33
             foreach ($widget_listings as $widget_listing) {
34 34
                 global $gd_widget_listing_type;
35 35
                 $post = $widget_listing;
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
                 $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', '');
47 47
                 ?>
48 48
                 <li class="clearfix <?php if ($grid_view_class) {
49
-                    echo 'geodir-gridview ' . $grid_view_class;
49
+                    echo 'geodir-gridview '.$grid_view_class;
50 50
                 } else {
51 51
                     echo ' geodir-listview ';
52 52
                 } ?> <?php if ($post_view_class) {
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                                         } else {
117 117
                                             $uom = __('meters', 'geodirectory');
118 118
                                         }
119
-                                        echo round($distance) . ' ' . __($uom, 'geodirectory') . '
119
+                                        echo round($distance).' '.__($uom, 'geodirectory').'
120 120
 			<br />
121 121
 			';
122 122
                                     } else {
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                                         } else {
126 126
                                             $uom = __('km', 'geodirectory');
127 127
                                         }
128
-                                        echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . '
128
+                                        echo round($distance, 2).' '.__($uom, 'geodirectory').'
129 129
 			<br />
130 130
 			';
131 131
                                     }
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
                                      */
150 150
                                     $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post);
151 151
                                     if ($show_listing_excerpt) {
152
-                                        if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
153
-                                            $content_out = geodir_max_excerpt( $character_count );
152
+                                        if (isset($character_count) && ($character_count || $character_count == '0')) {
153
+                                            $content_out = geodir_max_excerpt($character_count);
154 154
                                         } else {
155 155
                                             $content_out = get_the_excerpt();
156 156
                                         }
157
-                                        if ( ! empty( $content_out ) ) {
158
-                                            echo "<p>" . $content_out . "</p>";
157
+                                        if (!empty($content_out)) {
158
+                                            echo "<p>".$content_out."</p>";
159 159
                                         }
160 160
                                     }
161 161
                                     ?>
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                          * @param object $post The post object.
175 175
                          * @param string $view The view type, default 'widget'.
176 176
                          */
177
-                        do_action( 'geodir_after_listing_content', $post, 'widget' ); ?>
177
+                        do_action('geodir_after_listing_content', $post, 'widget'); ?>
178 178
                         <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'widget'); ?>">
179 179
                             <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'widget'); ?>">
180 180
                                 <?php
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                                  * @param object $post The post object.
186 186
                                  * @param string $view The view type, default 'widget'.
187 187
                                  */
188
-                                do_action( 'geodir_before_review_html', $post, 'widget' );
188
+                                do_action('geodir_before_review_html', $post, 'widget');
189 189
                                 $review_show = geodir_is_reviews_show('listview');
190 190
                                 if ($review_show) {
191 191
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
                                  *
211 211
                                  * @since 1.0.0
212 212
                                  */
213
-                                do_action( 'geodir_after_favorite_html', $post->ID, 'widget' );
213
+                                do_action('geodir_after_favorite_html', $post->ID, 'widget');
214 214
 
215 215
                                 if ($post->post_author == get_current_user_id()) {
216 216
                                     $addplacelink = get_permalink(geodir_add_listing_page_id());
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                        title="<?php _e('Edit Listing', 'geodirectory'); ?>">
231 231
                         <?php
232 232
                         $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
233
-                        echo '<i class="'. $geodir_listing_edit_icon .'"></i>';
233
+                        echo '<i class="'.$geodir_listing_edit_icon.'"></i>';
234 234
                         ?>
235 235
                         <?php _e('Edit', 'geodirectory'); ?>
236 236
                     </a>
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
                        title="<?php _e('Delete Listing', 'geodirectory'); ?>">
239 239
                         <?php
240 240
                         $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
241
-                        echo '<i class="'. $geodir_listing_delete_icon .'"></i>';
241
+                        echo '<i class="'.$geodir_listing_delete_icon.'"></i>';
242 242
                         ?>
243 243
                         <?php _e('Delete', 'geodirectory'); ?>
244 244
                     </a>
Please login to merge, or discard this patch.
tests/lib/wordpress-tests-lib/includes/factory.php 3 patches
Doc Comments   +25 added lines patch added patch discarded remove patch
@@ -64,6 +64,9 @@  discard block
 block discarded – undo
64 64
 
65 65
 class WP_UnitTest_Factory_For_Post extends WP_UnitTest_Factory_For_Thing {
66 66
 
67
+	/**
68
+	 * @param WP_UnitTest_Factory $factory
69
+	 */
67 70
 	function __construct( $factory = null ) {
68 71
 		parent::__construct( $factory );
69 72
 		$this->default_generation_definitions = array(
@@ -127,6 +130,9 @@  discard block
 block discarded – undo
127 130
 
128 131
 class WP_UnitTest_Factory_For_User extends WP_UnitTest_Factory_For_Thing {
129 132
 
133
+	/**
134
+	 * @param WP_UnitTest_Factory $factory
135
+	 */
130 136
 	function __construct( $factory = null ) {
131 137
 		parent::__construct( $factory );
132 138
 		$this->default_generation_definitions = array(
@@ -152,6 +158,9 @@  discard block
 block discarded – undo
152 158
 
153 159
 class WP_UnitTest_Factory_For_Comment extends WP_UnitTest_Factory_For_Thing {
154 160
 
161
+	/**
162
+	 * @param WP_UnitTest_Factory $factory
163
+	 */
155 164
 	function __construct( $factory = null ) {
156 165
 		parent::__construct( $factory );
157 166
 		$this->default_generation_definitions = array(
@@ -183,6 +192,9 @@  discard block
 block discarded – undo
183 192
 
184 193
 class WP_UnitTest_Factory_For_Blog extends WP_UnitTest_Factory_For_Thing {
185 194
 
195
+	/**
196
+	 * @param WP_UnitTest_Factory $factory
197
+	 */
186 198
 	function __construct( $factory = null ) {
187 199
 		global $current_site, $base;
188 200
 		parent::__construct( $factory );
@@ -219,6 +231,9 @@  discard block
 block discarded – undo
219 231
 
220 232
 class WP_UnitTest_Factory_For_Network extends WP_UnitTest_Factory_For_Thing {
221 233
 
234
+	/**
235
+	 * @param WP_UnitTest_Factory $factory
236
+	 */
222 237
 	function __construct( $factory = null ) {
223 238
 		parent::__construct( $factory );
224 239
 		$this->default_generation_definitions = array(
@@ -255,6 +270,10 @@  discard block
 block discarded – undo
255 270
 	private $taxonomy;
256 271
 	const DEFAULT_TAXONOMY = 'post_tag';
257 272
 
273
+	/**
274
+	 * @param WP_UnitTest_Factory $factory
275
+	 * @param string $taxonomy
276
+	 */
258 277
 	function __construct( $factory = null, $taxonomy = null ) {
259 278
 		parent::__construct( $factory );
260 279
 		$this->taxonomy = $taxonomy ? $taxonomy : self::DEFAULT_TAXONOMY;
@@ -342,6 +361,9 @@  discard block
 block discarded – undo
342 361
 
343 362
 	abstract function get_object_by_id( $object_id );
344 363
 
364
+	/**
365
+	 * @param integer $count
366
+	 */
345 367
 	function create_many( $count, $args = array(), $generation_definitions = null ) {
346 368
 		$results = array();
347 369
 		for ( $i = 0; $i < $count; $i++ ) {
@@ -405,6 +427,9 @@  discard block
 block discarded – undo
405 427
 	public $next;
406 428
 	public $template_string;
407 429
 
430
+	/**
431
+	 * @param integer $start
432
+	 */
408 433
 	function __construct( $template_string = '%s', $start = null ) {
409 434
 		if ( $start ) {
410 435
 			$this->next = $start;
Please login to merge, or discard this patch.
Braces   +29 added lines, -21 removed lines patch added patch discarded remove patch
@@ -104,8 +104,9 @@  discard block
 block discarded – undo
104 104
 			$type = $upload['type'];
105 105
 		} else {
106 106
 			$mime = wp_check_filetype( $upload['file'] );
107
-			if ($mime)
108
-				$type = $mime['type'];
107
+			if ($mime) {
108
+							$type = $mime['type'];
109
+			}
109 110
 		}
110 111
 
111 112
 		$attachment = array(
@@ -268,15 +269,17 @@  discard block
 block discarded – undo
268 269
 	function create_object( $args ) {
269 270
 		$args = array_merge( array( 'taxonomy' => $this->taxonomy ), $args );
270 271
 		$term_id_pair = wp_insert_term( $args['name'], $args['taxonomy'], $args );
271
-		if ( is_wp_error( $term_id_pair ) )
272
-			return $term_id_pair;
272
+		if ( is_wp_error( $term_id_pair ) ) {
273
+					return $term_id_pair;
274
+		}
273 275
 		return $term_id_pair['term_id'];
274 276
 	}
275 277
 
276 278
 	function update_object( $term, $fields ) {
277 279
 		$fields = array_merge( array( 'taxonomy' => $this->taxonomy ), $fields );
278
-		if ( is_object( $term ) )
279
-			$taxonomy = $term->taxonomy;
280
+		if ( is_object( $term ) ) {
281
+					$taxonomy = $term->taxonomy;
282
+		}
280 283
 		$term_id_pair = wp_update_term( $term, $taxonomy, $fields );
281 284
 		return $term_id_pair['term_id'];
282 285
 	}
@@ -318,19 +321,22 @@  discard block
 block discarded – undo
318 321
 	abstract function update_object( $object, $fields );
319 322
 
320 323
 	function create( $args = array(), $generation_definitions = null ) {
321
-		if ( is_null( $generation_definitions ) )
322
-			$generation_definitions = $this->default_generation_definitions;
324
+		if ( is_null( $generation_definitions ) ) {
325
+					$generation_definitions = $this->default_generation_definitions;
326
+		}
323 327
 
324 328
 		$generated_args = $this->generate_args( $args, $generation_definitions, $callbacks );
325 329
 		$created = $this->create_object( $generated_args );
326
-		if ( !$created || is_wp_error( $created ) )
327
-			return $created;
330
+		if ( !$created || is_wp_error( $created ) ) {
331
+					return $created;
332
+		}
328 333
 
329 334
 		if ( $callbacks ) {
330 335
 			$updated_fields = $this->apply_callbacks( $callbacks, $created );
331 336
 			$save_result = $this->update_object( $created, $updated_fields );
332
-			if ( !$save_result || is_wp_error( $save_result ) )
333
-				return $save_result;
337
+			if ( !$save_result || is_wp_error( $save_result ) ) {
338
+							return $save_result;
339
+			}
334 340
 		}
335 341
 		return $created;
336 342
 	}
@@ -352,20 +358,22 @@  discard block
 block discarded – undo
352 358
 
353 359
 	function generate_args( $args = array(), $generation_definitions = null, &$callbacks = null ) {
354 360
 		$callbacks = array();
355
-		if ( is_null( $generation_definitions ) )
356
-			$generation_definitions = $this->default_generation_definitions;
361
+		if ( is_null( $generation_definitions ) ) {
362
+					$generation_definitions = $this->default_generation_definitions;
363
+		}
357 364
 
358 365
 		foreach( array_keys( $generation_definitions ) as $field_name ) {
359 366
 			if ( !isset( $args[$field_name] ) ) {
360 367
 				$generator = $generation_definitions[$field_name];
361
-				if ( is_scalar( $generator ) )
362
-					$args[$field_name] = $generator;
363
-				elseif ( is_object( $generator ) && method_exists( $generator, 'call' ) ) {
368
+				if ( is_scalar( $generator ) ) {
369
+									$args[$field_name] = $generator;
370
+				} elseif ( is_object( $generator ) && method_exists( $generator, 'call' ) ) {
364 371
 					$callbacks[$field_name] = $generator;
365
-				} elseif ( is_object( $generator ) )
366
-					$args[$field_name] = $generator->next();
367
-				else
368
-					return new WP_Error( 'invalid_argument', 'Factory default value should be either a scalar or an generator object.' );
372
+				} elseif ( is_object( $generator ) ) {
373
+									$args[$field_name] = $generator->next();
374
+				} else {
375
+									return new WP_Error( 'invalid_argument', 'Factory default value should be either a scalar or an generator object.' );
376
+				}
369 377
 			}
370 378
 		}
371 379
 		return $args;
Please login to merge, or discard this patch.
Spacing   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -48,78 +48,78 @@  discard block
 block discarded – undo
48 48
 	public $network;
49 49
 
50 50
 	function __construct() {
51
-		$this->post = new WP_UnitTest_Factory_For_Post( $this );
52
-		$this->attachment = new WP_UnitTest_Factory_For_Attachment( $this );
53
-		$this->comment = new WP_UnitTest_Factory_For_Comment( $this );
54
-		$this->user = new WP_UnitTest_Factory_For_User( $this );
55
-		$this->term = new WP_UnitTest_Factory_For_Term( $this );
56
-		$this->category = new WP_UnitTest_Factory_For_Term( $this, 'category' );
57
-		$this->tag = new WP_UnitTest_Factory_For_Term( $this, 'post_tag' );
58
-		if ( is_multisite() ) {
59
-			$this->blog = new WP_UnitTest_Factory_For_Blog( $this );
60
-			$this->network = new WP_UnitTest_Factory_For_Network( $this );
51
+		$this->post = new WP_UnitTest_Factory_For_Post($this);
52
+		$this->attachment = new WP_UnitTest_Factory_For_Attachment($this);
53
+		$this->comment = new WP_UnitTest_Factory_For_Comment($this);
54
+		$this->user = new WP_UnitTest_Factory_For_User($this);
55
+		$this->term = new WP_UnitTest_Factory_For_Term($this);
56
+		$this->category = new WP_UnitTest_Factory_For_Term($this, 'category');
57
+		$this->tag = new WP_UnitTest_Factory_For_Term($this, 'post_tag');
58
+		if (is_multisite()) {
59
+			$this->blog = new WP_UnitTest_Factory_For_Blog($this);
60
+			$this->network = new WP_UnitTest_Factory_For_Network($this);
61 61
 		}
62 62
 	}
63 63
 }
64 64
 
65 65
 class WP_UnitTest_Factory_For_Post extends WP_UnitTest_Factory_For_Thing {
66 66
 
67
-	function __construct( $factory = null ) {
68
-		parent::__construct( $factory );
67
+	function __construct($factory = null) {
68
+		parent::__construct($factory);
69 69
 		$this->default_generation_definitions = array(
70 70
 			'post_status' => 'publish',
71
-			'post_title' => new WP_UnitTest_Generator_Sequence( 'Post title %s' ),
72
-			'post_content' => new WP_UnitTest_Generator_Sequence( 'Post content %s' ),
73
-			'post_excerpt' => new WP_UnitTest_Generator_Sequence( 'Post excerpt %s' ),
71
+			'post_title' => new WP_UnitTest_Generator_Sequence('Post title %s'),
72
+			'post_content' => new WP_UnitTest_Generator_Sequence('Post content %s'),
73
+			'post_excerpt' => new WP_UnitTest_Generator_Sequence('Post excerpt %s'),
74 74
 			'post_type' => 'post'
75 75
 		);
76 76
 	}
77 77
 
78
-	function create_object( $args ) {
79
-		return wp_insert_post( $args );
78
+	function create_object($args) {
79
+		return wp_insert_post($args);
80 80
 	}
81 81
 
82
-	function update_object( $post_id, $fields ) {
82
+	function update_object($post_id, $fields) {
83 83
 		$fields['ID'] = $post_id;
84
-		return wp_update_post( $fields );
84
+		return wp_update_post($fields);
85 85
 	}
86 86
 
87
-	function get_object_by_id( $post_id ) {
88
-		return get_post( $post_id );
87
+	function get_object_by_id($post_id) {
88
+		return get_post($post_id);
89 89
 	}
90 90
 }
91 91
 
92 92
 class WP_UnitTest_Factory_For_Attachment extends WP_UnitTest_Factory_For_Post {
93 93
 
94
-	function create_object( $file, $parent = 0, $args = array() ) {
95
-		return wp_insert_attachment( $args, $file, $parent );
94
+	function create_object($file, $parent = 0, $args = array()) {
95
+		return wp_insert_attachment($args, $file, $parent);
96 96
 	}
97 97
 
98
-	function create_upload_object( $file, $parent = 0 ) {
98
+	function create_upload_object($file, $parent = 0) {
99 99
 		$contents = file_get_contents($file);
100 100
 		$upload = wp_upload_bits(basename($file), null, $contents);
101 101
 
102 102
 		$type = '';
103
-		if ( ! empty($upload['type']) ) {
103
+		if (!empty($upload['type'])) {
104 104
 			$type = $upload['type'];
105 105
 		} else {
106
-			$mime = wp_check_filetype( $upload['file'] );
106
+			$mime = wp_check_filetype($upload['file']);
107 107
 			if ($mime)
108 108
 				$type = $mime['type'];
109 109
 		}
110 110
 
111 111
 		$attachment = array(
112
-			'post_title' => basename( $upload['file'] ),
112
+			'post_title' => basename($upload['file']),
113 113
 			'post_content' => '',
114 114
 			'post_type' => 'attachment',
115 115
 			'post_parent' => $parent,
116 116
 			'post_mime_type' => $type,
117
-			'guid' => $upload[ 'url' ],
117
+			'guid' => $upload['url'],
118 118
 		);
119 119
 
120 120
 		// Save the data
121
-		$id = wp_insert_attachment( $attachment, $upload[ 'file' ], $parent );
122
-		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
121
+		$id = wp_insert_attachment($attachment, $upload['file'], $parent);
122
+		wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $upload['file']));
123 123
 
124 124
 		return $id;
125 125
 	}
@@ -127,126 +127,126 @@  discard block
 block discarded – undo
127 127
 
128 128
 class WP_UnitTest_Factory_For_User extends WP_UnitTest_Factory_For_Thing {
129 129
 
130
-	function __construct( $factory = null ) {
131
-		parent::__construct( $factory );
130
+	function __construct($factory = null) {
131
+		parent::__construct($factory);
132 132
 		$this->default_generation_definitions = array(
133
-			'user_login' => new WP_UnitTest_Generator_Sequence( 'User %s' ),
133
+			'user_login' => new WP_UnitTest_Generator_Sequence('User %s'),
134 134
 			'user_pass' => 'password',
135
-			'user_email' => new WP_UnitTest_Generator_Sequence( 'user_%[email protected]' ),
135
+			'user_email' => new WP_UnitTest_Generator_Sequence('user_%[email protected]'),
136 136
 		);
137 137
 	}
138 138
 
139
-	function create_object( $args ) {
140
-		return wp_insert_user( $args );
139
+	function create_object($args) {
140
+		return wp_insert_user($args);
141 141
 	}
142 142
 
143
-	function update_object( $user_id, $fields ) {
143
+	function update_object($user_id, $fields) {
144 144
 		$fields['ID'] = $user_id;
145
-		return wp_update_user( $fields );
145
+		return wp_update_user($fields);
146 146
 	}
147 147
 
148
-	function get_object_by_id( $user_id ) {
149
-		return new WP_User( $user_id );
148
+	function get_object_by_id($user_id) {
149
+		return new WP_User($user_id);
150 150
 	}
151 151
 }
152 152
 
153 153
 class WP_UnitTest_Factory_For_Comment extends WP_UnitTest_Factory_For_Thing {
154 154
 
155
-	function __construct( $factory = null ) {
156
-		parent::__construct( $factory );
155
+	function __construct($factory = null) {
156
+		parent::__construct($factory);
157 157
 		$this->default_generation_definitions = array(
158
-			'comment_author' => new WP_UnitTest_Generator_Sequence( 'Commenter %s' ),
159
-			'comment_author_url' => new WP_UnitTest_Generator_Sequence( 'http://example.com/%s/' ),
158
+			'comment_author' => new WP_UnitTest_Generator_Sequence('Commenter %s'),
159
+			'comment_author_url' => new WP_UnitTest_Generator_Sequence('http://example.com/%s/'),
160 160
 			'comment_approved' => 1,
161 161
 			'comment_content' => 'This is a comment'
162 162
 		);
163 163
 	}
164 164
 
165
-	function create_object( $args ) {
166
-		return wp_insert_comment( $this->addslashes_deep( $args ) );
165
+	function create_object($args) {
166
+		return wp_insert_comment($this->addslashes_deep($args));
167 167
 	}
168 168
 
169
-	function update_object( $comment_id, $fields ) {
169
+	function update_object($comment_id, $fields) {
170 170
 		$fields['comment_ID'] = $comment_id;
171
-		return wp_update_comment( $this->addslashes_deep( $fields ) );
171
+		return wp_update_comment($this->addslashes_deep($fields));
172 172
 	}
173 173
 
174
-	function create_post_comments( $post_id, $count = 1, $args = array(), $generation_definitions = null ) {
174
+	function create_post_comments($post_id, $count = 1, $args = array(), $generation_definitions = null) {
175 175
 		$args['comment_post_ID'] = $post_id;
176
-		return $this->create_many( $count, $args, $generation_definitions );
176
+		return $this->create_many($count, $args, $generation_definitions);
177 177
 	}
178 178
 
179
-	function get_object_by_id( $comment_id ) {
180
-		return get_comment( $comment_id );
179
+	function get_object_by_id($comment_id) {
180
+		return get_comment($comment_id);
181 181
 	}
182 182
 }
183 183
 
184 184
 class WP_UnitTest_Factory_For_Blog extends WP_UnitTest_Factory_For_Thing {
185 185
 
186
-	function __construct( $factory = null ) {
186
+	function __construct($factory = null) {
187 187
 		global $current_site, $base;
188
-		parent::__construct( $factory );
188
+		parent::__construct($factory);
189 189
 		$this->default_generation_definitions = array(
190 190
 			'domain' => $current_site->domain,
191
-			'path' => new WP_UnitTest_Generator_Sequence( $base . 'testpath%s' ),
192
-			'title' => new WP_UnitTest_Generator_Sequence( 'Site %s' ),
191
+			'path' => new WP_UnitTest_Generator_Sequence($base.'testpath%s'),
192
+			'title' => new WP_UnitTest_Generator_Sequence('Site %s'),
193 193
 			'site_id' => $current_site->id,
194 194
 		);
195 195
 	}
196 196
 
197
-	function create_object( $args ) {
197
+	function create_object($args) {
198 198
 		global $wpdb;
199
-		$meta = isset( $args['meta'] ) ? $args['meta'] : array();
200
-		$user_id = isset( $args['user_id'] ) ? $args['user_id'] : get_current_user_id();
199
+		$meta = isset($args['meta']) ? $args['meta'] : array();
200
+		$user_id = isset($args['user_id']) ? $args['user_id'] : get_current_user_id();
201 201
 		// temp tables will trigger db errors when we attempt to reference them as new temp tables
202 202
 		$suppress = $wpdb->suppress_errors();
203
-		$blog = wpmu_create_blog( $args['domain'], $args['path'], $args['title'], $user_id, $meta, $args['site_id'] );
204
-		$wpdb->suppress_errors( $suppress );
203
+		$blog = wpmu_create_blog($args['domain'], $args['path'], $args['title'], $user_id, $meta, $args['site_id']);
204
+		$wpdb->suppress_errors($suppress);
205 205
 
206 206
 		// Tell WP we're done installing.
207
-		wp_installing( false );
207
+		wp_installing(false);
208 208
 
209 209
 		return $blog;
210 210
 	}
211 211
 
212
-	function update_object( $blog_id, $fields ) {}
212
+	function update_object($blog_id, $fields) {}
213 213
 
214
-	function get_object_by_id( $blog_id ) {
215
-		return get_blog_details( $blog_id, false );
214
+	function get_object_by_id($blog_id) {
215
+		return get_blog_details($blog_id, false);
216 216
 	}
217 217
 }
218 218
 
219 219
 
220 220
 class WP_UnitTest_Factory_For_Network extends WP_UnitTest_Factory_For_Thing {
221 221
 
222
-	function __construct( $factory = null ) {
223
-		parent::__construct( $factory );
222
+	function __construct($factory = null) {
223
+		parent::__construct($factory);
224 224
 		$this->default_generation_definitions = array(
225 225
 			'domain' => WP_TESTS_DOMAIN,
226
-			'title' => new WP_UnitTest_Generator_Sequence( 'Network %s' ),
227
-			'path' => new WP_UnitTest_Generator_Sequence( '/testpath%s/' ),
228
-			'network_id' => new WP_UnitTest_Generator_Sequence( '%s', 2 ),
226
+			'title' => new WP_UnitTest_Generator_Sequence('Network %s'),
227
+			'path' => new WP_UnitTest_Generator_Sequence('/testpath%s/'),
228
+			'network_id' => new WP_UnitTest_Generator_Sequence('%s', 2),
229 229
 			'subdomain_install' => false,
230 230
 		);
231 231
 	}
232 232
 
233
-	function create_object( $args ) {
234
-		require_once ABSPATH . 'wp-admin/includes/upgrade.php';
233
+	function create_object($args) {
234
+		require_once ABSPATH.'wp-admin/includes/upgrade.php';
235 235
 
236
-		if ( ! isset( $args['user'] ) ) {
236
+		if (!isset($args['user'])) {
237 237
 			$email = WP_TESTS_EMAIL;
238 238
 		} else {
239
-			$email = get_userdata( $args['user'] )->user_email;
239
+			$email = get_userdata($args['user'])->user_email;
240 240
 		}
241 241
 
242
-		populate_network( $args['network_id'], $args['domain'], $email, $args['title'], $args['path'], $args['subdomain_install'] );
242
+		populate_network($args['network_id'], $args['domain'], $email, $args['title'], $args['path'], $args['subdomain_install']);
243 243
 		return $args['network_id'];
244 244
 	}
245 245
 
246
-	function update_object( $network_id, $fields ) {}
246
+	function update_object($network_id, $fields) {}
247 247
 
248
-	function get_object_by_id( $network_id ) {
249
-		return wp_get_network( $network_id );
248
+	function get_object_by_id($network_id) {
249
+		return wp_get_network($network_id);
250 250
 	}
251 251
 }
252 252
 
@@ -255,44 +255,44 @@  discard block
 block discarded – undo
255 255
 	private $taxonomy;
256 256
 	const DEFAULT_TAXONOMY = 'post_tag';
257 257
 
258
-	function __construct( $factory = null, $taxonomy = null ) {
259
-		parent::__construct( $factory );
258
+	function __construct($factory = null, $taxonomy = null) {
259
+		parent::__construct($factory);
260 260
 		$this->taxonomy = $taxonomy ? $taxonomy : self::DEFAULT_TAXONOMY;
261 261
 		$this->default_generation_definitions = array(
262
-			'name' => new WP_UnitTest_Generator_Sequence( 'Term %s' ),
262
+			'name' => new WP_UnitTest_Generator_Sequence('Term %s'),
263 263
 			'taxonomy' => $this->taxonomy,
264
-			'description' => new WP_UnitTest_Generator_Sequence( 'Term description %s' ),
264
+			'description' => new WP_UnitTest_Generator_Sequence('Term description %s'),
265 265
 		);
266 266
 	}
267 267
 
268
-	function create_object( $args ) {
269
-		$args = array_merge( array( 'taxonomy' => $this->taxonomy ), $args );
270
-		$term_id_pair = wp_insert_term( $args['name'], $args['taxonomy'], $args );
271
-		if ( is_wp_error( $term_id_pair ) )
268
+	function create_object($args) {
269
+		$args = array_merge(array('taxonomy' => $this->taxonomy), $args);
270
+		$term_id_pair = wp_insert_term($args['name'], $args['taxonomy'], $args);
271
+		if (is_wp_error($term_id_pair))
272 272
 			return $term_id_pair;
273 273
 		return $term_id_pair['term_id'];
274 274
 	}
275 275
 
276
-	function update_object( $term, $fields ) {
277
-		$fields = array_merge( array( 'taxonomy' => $this->taxonomy ), $fields );
278
-		if ( is_object( $term ) )
276
+	function update_object($term, $fields) {
277
+		$fields = array_merge(array('taxonomy' => $this->taxonomy), $fields);
278
+		if (is_object($term))
279 279
 			$taxonomy = $term->taxonomy;
280
-		$term_id_pair = wp_update_term( $term, $taxonomy, $fields );
280
+		$term_id_pair = wp_update_term($term, $taxonomy, $fields);
281 281
 		return $term_id_pair['term_id'];
282 282
 	}
283 283
 
284
-	function add_post_terms( $post_id, $terms, $taxonomy, $append = true ) {
285
-		return wp_set_post_terms( $post_id, $terms, $taxonomy, $append );
284
+	function add_post_terms($post_id, $terms, $taxonomy, $append = true) {
285
+		return wp_set_post_terms($post_id, $terms, $taxonomy, $append);
286 286
 	}
287 287
 
288
-	function create_and_get( $args = array(), $generation_definitions = null ) {
289
-		$term_id = $this->create( $args, $generation_definitions );
290
-		$taxonomy = isset( $args['taxonomy'] ) ? $args['taxonomy'] : $this->taxonomy;
291
-		return get_term( $term_id, $taxonomy );
288
+	function create_and_get($args = array(), $generation_definitions = null) {
289
+		$term_id = $this->create($args, $generation_definitions);
290
+		$taxonomy = isset($args['taxonomy']) ? $args['taxonomy'] : $this->taxonomy;
291
+		return get_term($term_id, $taxonomy);
292 292
 	}
293 293
 
294
-	function get_object_by_id( $term_id ) {
295
-		return get_term( $term_id, $this->taxonomy );
294
+	function get_object_by_id($term_id) {
295
+		return get_term($term_id, $this->taxonomy);
296 296
 	}
297 297
 }
298 298
 
@@ -309,90 +309,90 @@  discard block
 block discarded – undo
309 309
 	 * can be generators -- an object with next() method. There are some default generators: {@link WP_UnitTest_Generator_Sequence},
310 310
 	 * {@link WP_UnitTest_Generator_Locale_Name}, {@link WP_UnitTest_Factory_Callback_After_Create}.
311 311
 	 */
312
-	function __construct( $factory, $default_generation_definitions = array() ) {
312
+	function __construct($factory, $default_generation_definitions = array()) {
313 313
 		$this->factory = $factory;
314 314
 		$this->default_generation_definitions = $default_generation_definitions;
315 315
 	}
316 316
 
317
-	abstract function create_object( $args );
318
-	abstract function update_object( $object, $fields );
317
+	abstract function create_object($args);
318
+	abstract function update_object($object, $fields);
319 319
 
320
-	function create( $args = array(), $generation_definitions = null ) {
321
-		if ( is_null( $generation_definitions ) )
320
+	function create($args = array(), $generation_definitions = null) {
321
+		if (is_null($generation_definitions))
322 322
 			$generation_definitions = $this->default_generation_definitions;
323 323
 
324
-		$generated_args = $this->generate_args( $args, $generation_definitions, $callbacks );
325
-		$created = $this->create_object( $generated_args );
326
-		if ( !$created || is_wp_error( $created ) )
324
+		$generated_args = $this->generate_args($args, $generation_definitions, $callbacks);
325
+		$created = $this->create_object($generated_args);
326
+		if (!$created || is_wp_error($created))
327 327
 			return $created;
328 328
 
329
-		if ( $callbacks ) {
330
-			$updated_fields = $this->apply_callbacks( $callbacks, $created );
331
-			$save_result = $this->update_object( $created, $updated_fields );
332
-			if ( !$save_result || is_wp_error( $save_result ) )
329
+		if ($callbacks) {
330
+			$updated_fields = $this->apply_callbacks($callbacks, $created);
331
+			$save_result = $this->update_object($created, $updated_fields);
332
+			if (!$save_result || is_wp_error($save_result))
333 333
 				return $save_result;
334 334
 		}
335 335
 		return $created;
336 336
 	}
337 337
 
338
-	function create_and_get( $args = array(), $generation_definitions = null ) {
339
-		$object_id = $this->create( $args, $generation_definitions );
340
-		return $this->get_object_by_id( $object_id );
338
+	function create_and_get($args = array(), $generation_definitions = null) {
339
+		$object_id = $this->create($args, $generation_definitions);
340
+		return $this->get_object_by_id($object_id);
341 341
 	}
342 342
 
343
-	abstract function get_object_by_id( $object_id );
343
+	abstract function get_object_by_id($object_id);
344 344
 
345
-	function create_many( $count, $args = array(), $generation_definitions = null ) {
345
+	function create_many($count, $args = array(), $generation_definitions = null) {
346 346
 		$results = array();
347
-		for ( $i = 0; $i < $count; $i++ ) {
348
-			$results[] = $this->create( $args, $generation_definitions );
347
+		for ($i = 0; $i < $count; $i++) {
348
+			$results[] = $this->create($args, $generation_definitions);
349 349
 		}
350 350
 		return $results;
351 351
 	}
352 352
 
353
-	function generate_args( $args = array(), $generation_definitions = null, &$callbacks = null ) {
353
+	function generate_args($args = array(), $generation_definitions = null, &$callbacks = null) {
354 354
 		$callbacks = array();
355
-		if ( is_null( $generation_definitions ) )
355
+		if (is_null($generation_definitions))
356 356
 			$generation_definitions = $this->default_generation_definitions;
357 357
 
358
-		foreach( array_keys( $generation_definitions ) as $field_name ) {
359
-			if ( !isset( $args[$field_name] ) ) {
358
+		foreach (array_keys($generation_definitions) as $field_name) {
359
+			if (!isset($args[$field_name])) {
360 360
 				$generator = $generation_definitions[$field_name];
361
-				if ( is_scalar( $generator ) )
361
+				if (is_scalar($generator))
362 362
 					$args[$field_name] = $generator;
363
-				elseif ( is_object( $generator ) && method_exists( $generator, 'call' ) ) {
363
+				elseif (is_object($generator) && method_exists($generator, 'call')) {
364 364
 					$callbacks[$field_name] = $generator;
365
-				} elseif ( is_object( $generator ) )
365
+				} elseif (is_object($generator))
366 366
 					$args[$field_name] = $generator->next();
367 367
 				else
368
-					return new WP_Error( 'invalid_argument', 'Factory default value should be either a scalar or an generator object.' );
368
+					return new WP_Error('invalid_argument', 'Factory default value should be either a scalar or an generator object.');
369 369
 			}
370 370
 		}
371 371
 		return $args;
372 372
 	}
373 373
 
374
-	function apply_callbacks( $callbacks, $created ) {
374
+	function apply_callbacks($callbacks, $created) {
375 375
 		$updated_fields = array();
376
-		foreach( $callbacks as $field_name => $generator ) {
377
-			$updated_fields[$field_name] = $generator->call( $created );
376
+		foreach ($callbacks as $field_name => $generator) {
377
+			$updated_fields[$field_name] = $generator->call($created);
378 378
 		}
379 379
 		return $updated_fields;
380 380
 	}
381 381
 
382
-	function callback( $function ) {
383
-		return new WP_UnitTest_Factory_Callback_After_Create( $function );
382
+	function callback($function) {
383
+		return new WP_UnitTest_Factory_Callback_After_Create($function);
384 384
 	}
385 385
 
386 386
 	function addslashes_deep($value) {
387
-		if ( is_array( $value ) ) {
388
-			$value = array_map( array( $this, 'addslashes_deep' ), $value );
389
-		} elseif ( is_object( $value ) ) {
390
-			$vars = get_object_vars( $value );
387
+		if (is_array($value)) {
388
+			$value = array_map(array($this, 'addslashes_deep'), $value);
389
+		} elseif (is_object($value)) {
390
+			$vars = get_object_vars($value);
391 391
 			foreach ($vars as $key=>$data) {
392
-				$value->{$key} = $this->addslashes_deep( $data );
392
+				$value->{$key} = $this->addslashes_deep($data);
393 393
 			}
394
-		} elseif ( is_string( $value ) ) {
395
-			$value = addslashes( $value );
394
+		} elseif (is_string($value)) {
395
+			$value = addslashes($value);
396 396
 		}
397 397
 
398 398
 		return $value;
@@ -405,8 +405,8 @@  discard block
 block discarded – undo
405 405
 	public $next;
406 406
 	public $template_string;
407 407
 
408
-	function __construct( $template_string = '%s', $start = null ) {
409
-		if ( $start ) {
408
+	function __construct($template_string = '%s', $start = null) {
409
+		if ($start) {
410 410
 			$this->next = $start;
411 411
 		} else {
412 412
 			self::$incr++;
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	}
417 417
 
418 418
 	function next() {
419
-		$generated = sprintf( $this->template_string , $this->next );
419
+		$generated = sprintf($this->template_string, $this->next);
420 420
 		$this->next++;
421 421
 		return $generated;
422 422
 	}
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
 class WP_UnitTest_Factory_Callback_After_Create {
426 426
 	var $callback;
427 427
 
428
-	function __construct( $callback ) {
428
+	function __construct($callback) {
429 429
 		$this->callback = $callback;
430 430
 	}
431 431
 
432
-	function call( $object ) {
433
-		return call_user_func( $this->callback, $object );
432
+	function call($object) {
433
+		return call_user_func($this->callback, $object);
434 434
 	}
435 435
 }
Please login to merge, or discard this patch.
tests/lib/wordpress-tests-lib/includes/functions.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -10,6 +10,9 @@  discard block
 block discarded – undo
10 10
 	return true;
11 11
 }
12 12
 
13
+/**
14
+ * @param integer $priority
15
+ */
13 16
 function _test_filter_build_unique_id($tag, $function, $priority) {
14 17
 	global $wp_filter;
15 18
 	static $filter_id_count = 0;
@@ -92,6 +95,9 @@  discard block
 block discarded – undo
92 95
 	return '_wp_die_handler';
93 96
 }
94 97
 
98
+/**
99
+ * @param string $title
100
+ */
95 101
 function _wp_die_handler_txt( $message, $title, $args ) {
96 102
 	echo "\nwp_die called\n";
97 103
 	echo "Message : $message\n";
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
 	global $wp_filter;
15 15
 	static $filter_id_count = 0;
16 16
 
17
-	if ( is_string($function) )
18
-		return $function;
17
+	if ( is_string($function) ) {
18
+			return $function;
19
+	}
19 20
 
20 21
 	if ( is_object($function) ) {
21 22
 		// Closures are currently implemented as objects
@@ -37,8 +38,9 @@  discard block
 block discarded – undo
37 38
 
38 39
 	$all_posts = $wpdb->get_col("SELECT ID from {$wpdb->posts}");
39 40
 	if ($all_posts) {
40
-		foreach ($all_posts as $id)
41
-			wp_delete_post( $id, true );
41
+		foreach ($all_posts as $id) {
42
+					wp_delete_post( $id, true );
43
+		}
42 44
 	}
43 45
 }
44 46
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 
7 7
 	$idx = _test_filter_build_unique_id($tag, $function_to_add, $priority);
8 8
 	$wp_filter[$tag][$priority][$idx] = array('function' => $function_to_add, 'accepted_args' => $accepted_args);
9
-	unset( $merged_filters[ $tag ] );
9
+	unset($merged_filters[$tag]);
10 10
 	return true;
11 11
 }
12 12
 
@@ -14,19 +14,19 @@  discard block
 block discarded – undo
14 14
 	global $wp_filter;
15 15
 	static $filter_id_count = 0;
16 16
 
17
-	if ( is_string($function) )
17
+	if (is_string($function))
18 18
 		return $function;
19 19
 
20
-	if ( is_object($function) ) {
20
+	if (is_object($function)) {
21 21
 		// Closures are currently implemented as objects
22
-		$function = array( $function, '' );
22
+		$function = array($function, '');
23 23
 	} else {
24 24
 		$function = (array) $function;
25 25
 	}
26 26
 
27
-	if (is_object($function[0]) ) {
28
-		return spl_object_hash($function[0]) . $function[1];
29
-	} else if ( is_string($function[0]) ) {
27
+	if (is_object($function[0])) {
28
+		return spl_object_hash($function[0]).$function[1];
29
+	} else if (is_string($function[0])) {
30 30
 		// Static Calling
31 31
 		return $function[0].$function[1];
32 32
 	}
@@ -38,31 +38,31 @@  discard block
 block discarded – undo
38 38
 	$all_posts = $wpdb->get_col("SELECT ID from {$wpdb->posts}");
39 39
 	if ($all_posts) {
40 40
 		foreach ($all_posts as $id)
41
-			wp_delete_post( $id, true );
41
+			wp_delete_post($id, true);
42 42
 	}
43 43
 }
44 44
 
45 45
 class Basic_Object {
46 46
 	private $foo = 'bar';
47 47
 
48
-	public function __get( $name ) {
48
+	public function __get($name) {
49 49
 		return $this->{$name};
50 50
 	}
51 51
 
52
-	public function __set( $name, $value ) {
52
+	public function __set($name, $value) {
53 53
 		return $this->{$name} = $value;
54 54
 	}
55 55
 
56
-	public function __isset( $name ) {
57
-		return isset( $this->{$name} );
56
+	public function __isset($name) {
57
+		return isset($this->{$name} );
58 58
 	}
59 59
 
60
-	public function __unset( $name ) {
61
-		unset( $this->{$name} );
60
+	public function __unset($name) {
61
+		unset($this->{$name} );
62 62
 	}
63 63
 
64
-	public function __call( $name, $arguments ) {
65
-		return call_user_func_array( array( $this, $name ), $arguments );
64
+	public function __call($name, $arguments) {
65
+		return call_user_func_array(array($this, $name), $arguments);
66 66
 	}
67 67
 
68 68
 	private function callMe() {
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 
73 73
 class Basic_Subclass extends Basic_Object {}
74 74
 
75
-function _wp_die_handler( $message, $title = '', $args = array() ) {
76
-	if ( !$GLOBALS['_wp_die_disabled'] ) {
77
-		_wp_die_handler_txt( $message, $title, $args);
75
+function _wp_die_handler($message, $title = '', $args = array()) {
76
+	if (!$GLOBALS['_wp_die_disabled']) {
77
+		_wp_die_handler_txt($message, $title, $args);
78 78
 	} else {
79 79
 		//Ignore at our peril
80 80
 	}
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
 	return '_wp_die_handler';
93 93
 }
94 94
 
95
-function _wp_die_handler_txt( $message, $title, $args ) {
95
+function _wp_die_handler_txt($message, $title, $args) {
96 96
 	echo "\nwp_die called\n";
97 97
 	echo "Message : $message\n";
98 98
 	echo "Title : $title\n";
99
-	if ( ! empty( $args ) ) {
99
+	if (!empty($args)) {
100 100
 		echo "Args: \n";
101
-		foreach( $args as $k => $v ){
101
+		foreach ($args as $k => $v) {
102 102
 			echo "\t $k : $v\n";
103 103
 		}
104 104
 	}
@@ -113,5 +113,5 @@  discard block
 block discarded – undo
113 113
  * @since 4.2.0
114 114
  */
115 115
 function _set_default_permalink_structure_for_tests() {
116
-	update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
116
+	update_option('permalink_structure', '/%year%/%monthnum%/%day%/%postname%/');
117 117
 }
Please login to merge, or discard this patch.
tests/lib/wordpress-tests-lib/includes/mock-fs.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -49,6 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 	/**
51 51
 	 * "Bulk Loads" a filesystem into the internal virtual filesystem
52
+	 * @param string $paths
52 53
 	 */
53 54
 	function setfs( $paths ) {
54 55
 		if ( ! is_array($paths) )
@@ -144,6 +145,9 @@  discard block
 block discarded – undo
144 145
 		return isset( $this->fs_map[ $file ] ) && $this->fs_map[ $file ]->is_file();
145 146
 	}
146 147
 
148
+	/**
149
+	 * @param string $path
150
+	 */
147 151
 	function is_dir( $path ) {
148 152
 		$path = trailingslashit( $path );
149 153
 
Please login to merge, or discard this patch.
Braces   +49 added lines, -33 removed lines patch added patch discarded remove patch
@@ -21,13 +21,15 @@  discard block
 block discarded – undo
21 21
 
22 22
 	// Copy of core's function, but accepts a path.
23 23
 	function abspath( $path = false ) {
24
-		if ( ! $path )
25
-			$path = ABSPATH;
24
+		if ( ! $path ) {
25
+					$path = ABSPATH;
26
+		}
26 27
 		$folder = $this->find_folder( $path );
27 28
 
28 29
 		// Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare.
29
-		if ( ! $folder && $this->is_dir('/wp-includes') )
30
-			$folder = '/';
30
+		if ( ! $folder && $this->is_dir('/wp-includes') ) {
31
+					$folder = '/';
32
+		}
31 33
 		return $folder;
32 34
 	}
33 35
 
@@ -51,21 +53,25 @@  discard block
 block discarded – undo
51 53
 	 * "Bulk Loads" a filesystem into the internal virtual filesystem
52 54
 	 */
53 55
 	function setfs( $paths ) {
54
-		if ( ! is_array($paths) )
55
-			$paths = explode( "\n", $paths );
56
+		if ( ! is_array($paths) ) {
57
+					$paths = explode( "\n", $paths );
58
+		}
56 59
 
57 60
 		$paths = array_filter( array_map( 'trim', $paths ) );
58 61
 
59 62
 		foreach ( $paths as $path ) {
60 63
 			// Allow for comments
61
-			if ( '#' == $path[0] )
62
-				continue;
64
+			if ( '#' == $path[0] ) {
65
+							continue;
66
+			}
63 67
 
64 68
 			// Directories
65
-			if ( '/' == $path[ strlen($path) -1 ] )
66
-				$this->mkdir( $path );
67
-			else // Files (with dummy content for now)
69
+			if ( '/' == $path[ strlen($path) -1 ] ) {
70
+							$this->mkdir( $path );
71
+			} else {
72
+				// Files (with dummy content for now)
68 73
 				$this->put_contents( $path, 'This is a test file' );
74
+			}
69 75
 		}
70 76
 
71 77
 	}
@@ -95,8 +101,9 @@  discard block
 block discarded – undo
95 101
 			$dirname = str_replace( '\\', '/', dirname( $path ) );
96 102
 			$this->mkdir( $dirname );
97 103
 			$parent_node = $this->locate_parent_node( $path );
98
-			if ( ! $parent_node )
99
-				return false;
104
+			if ( ! $parent_node ) {
105
+							return false;
106
+			}
100 107
 		}
101 108
 
102 109
 		$node = new MockFS_Directory_Node( $path );
@@ -108,8 +115,9 @@  discard block
 block discarded – undo
108 115
 	}
109 116
 
110 117
 	function put_contents( $path, $contents = '', $mode = null ) {
111
-		if ( ! $this->is_dir( dirname( $path ) ) )
112
-			$this->mkdir( dirname( $path ) );
118
+		if ( ! $this->is_dir( dirname( $path ) ) ) {
119
+					$this->mkdir( dirname( $path ) );
120
+		}
113 121
 
114 122
 		$parent = $this->locate_parent_node( $path );
115 123
 		$new_file = new MockFS_File_Node( $path, $contents );
@@ -119,8 +127,9 @@  discard block
 block discarded – undo
119 127
 	}
120 128
 
121 129
 	function get_contents( $file ) {
122
-		if ( ! $this->is_file( $file ) )
123
-			return false;
130
+		if ( ! $this->is_file( $file ) ) {
131
+					return false;
132
+		}
124 133
 		return $this->fs_map[ $file ]->contents;
125 134
 	}
126 135
 
@@ -129,8 +138,9 @@  discard block
 block discarded – undo
129 138
 	}
130 139
 
131 140
 	function chdir( $path ) {
132
-		if ( ! isset( $this->fs_map[ $path ] ) )
133
-			return false;
141
+		if ( ! isset( $this->fs_map[ $path ] ) ) {
142
+					return false;
143
+		}
134 144
 
135 145
 		$this->cwd = $this->fs_map[ $path ];
136 146
 		return true;
@@ -152,11 +162,13 @@  discard block
 block discarded – undo
152 162
 
153 163
 	function dirlist( $path = '.', $include_hidden = true, $recursive = false ) {
154 164
 
155
-		if ( empty( $path ) || '.' == $path )
156
-			$path = $this->cwd();
165
+		if ( empty( $path ) || '.' == $path ) {
166
+					$path = $this->cwd();
167
+		}
157 168
 
158
-		if ( ! $this->exists( $path ) )
159
-			return false;
169
+		if ( ! $this->exists( $path ) ) {
170
+					return false;
171
+		}
160 172
 
161 173
 		$limit_file = false;
162 174
 		if ( $this->is_file( $path ) ) {
@@ -166,24 +178,28 @@  discard block
 block discarded – undo
166 178
 
167 179
 		$ret = array();
168 180
 		foreach ( $this->fs_map[ $path ]->children as $entry ) {
169
-			if ( '.' == $entry->name || '..' == $entry->name )
170
-				continue;
181
+			if ( '.' == $entry->name || '..' == $entry->name ) {
182
+							continue;
183
+			}
171 184
 
172
-			if ( ! $include_hidden && '.' == $entry->name )
173
-				continue;
185
+			if ( ! $include_hidden && '.' == $entry->name ) {
186
+							continue;
187
+			}
174 188
 
175
-			if ( $limit_file && $entry->name != $limit_file )
176
-				continue;
189
+			if ( $limit_file && $entry->name != $limit_file ) {
190
+							continue;
191
+			}
177 192
 
178 193
 			$struc = array();
179 194
 			$struc['name'] = $entry->name;
180 195
 			$struc['type'] = $entry->type;
181 196
 
182 197
 			if ( 'd' == $struc['type'] ) {
183
-				if ( $recursive )
184
-					$struc['files'] = $this->dirlist( trailingslashit( $path ) . trailingslashit( $struc['name'] ), $include_hidden, $recursive );
185
-				else
186
-					$struc['files'] = array();
198
+				if ( $recursive ) {
199
+									$struc['files'] = $this->dirlist( trailingslashit( $path ) . trailingslashit( $struc['name'] ), $include_hidden, $recursive );
200
+				} else {
201
+									$struc['files'] = array();
202
+				}
187 203
 			}
188 204
 
189 205
 			$ret[ $entry->name ] = $struc;
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	}
21 21
 
22 22
 	// Copy of core's function, but accepts a path.
23
-	function abspath( $path = false ) {
24
-		if ( ! $path )
23
+	function abspath($path = false) {
24
+		if (!$path)
25 25
 			$path = ABSPATH;
26
-		$folder = $this->find_folder( $path );
26
+		$folder = $this->find_folder($path);
27 27
 
28 28
 		// Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare.
29
-		if ( ! $folder && $this->is_dir('/wp-includes') )
29
+		if (!$folder && $this->is_dir('/wp-includes'))
30 30
 			$folder = '/';
31 31
 		return $folder;
32 32
 	}
@@ -37,35 +37,35 @@  discard block
 block discarded – undo
37 37
 	 * Sets initial filesystem environment and/or clears the current environment.
38 38
 	 * Can also be passed the initial filesystem to be setup which is passed to self::setfs()
39 39
 	 */
40
-	function init( $paths = '', $home_dir = '/' ) {
41
-		$this->fs = new MockFS_Directory_Node( '/' );
40
+	function init($paths = '', $home_dir = '/') {
41
+		$this->fs = new MockFS_Directory_Node('/');
42 42
 		$this->fs_map = array(
43 43
 			'/' => $this->fs,
44 44
 		);
45 45
 		$this->cache = array(); // Used by find_folder() and friends
46
-		$this->cwd = isset( $this->fs_map[ $home_dir ] ) ? $this->fs_map[ $home_dir ] : '/';
47
-		$this->setfs( $paths );
46
+		$this->cwd = isset($this->fs_map[$home_dir]) ? $this->fs_map[$home_dir] : '/';
47
+		$this->setfs($paths);
48 48
 	}
49 49
 
50 50
 	/**
51 51
 	 * "Bulk Loads" a filesystem into the internal virtual filesystem
52 52
 	 */
53
-	function setfs( $paths ) {
54
-		if ( ! is_array($paths) )
55
-			$paths = explode( "\n", $paths );
53
+	function setfs($paths) {
54
+		if (!is_array($paths))
55
+			$paths = explode("\n", $paths);
56 56
 
57
-		$paths = array_filter( array_map( 'trim', $paths ) );
57
+		$paths = array_filter(array_map('trim', $paths));
58 58
 
59
-		foreach ( $paths as $path ) {
59
+		foreach ($paths as $path) {
60 60
 			// Allow for comments
61
-			if ( '#' == $path[0] )
61
+			if ('#' == $path[0])
62 62
 				continue;
63 63
 
64 64
 			// Directories
65
-			if ( '/' == $path[ strlen($path) -1 ] )
66
-				$this->mkdir( $path );
65
+			if ('/' == $path[strlen($path) - 1])
66
+				$this->mkdir($path);
67 67
 			else // Files (with dummy content for now)
68
-				$this->put_contents( $path, 'This is a test file' );
68
+				$this->put_contents($path, 'This is a test file');
69 69
 		}
70 70
 
71 71
 	}
@@ -73,120 +73,120 @@  discard block
 block discarded – undo
73 73
 	/**
74 74
 	 * Locates a filesystem "node"
75 75
 	 */
76
-	private function locate_node( $path ) {
77
-		return isset( $this->fs_map[ $path ] ) ? $this->fs_map[ $path ] : false;
76
+	private function locate_node($path) {
77
+		return isset($this->fs_map[$path]) ? $this->fs_map[$path] : false;
78 78
 	}
79 79
 
80 80
 	/**
81 81
 	 * Locates a filesystem node for the parent of the given item
82 82
 	 */
83
-	private function locate_parent_node( $path ) {
84
-		$dirname = str_replace( '\\', '/', dirname( $path ) );
85
-		return $this->locate_node( trailingslashit( $dirname ) );
83
+	private function locate_parent_node($path) {
84
+		$dirname = str_replace('\\', '/', dirname($path));
85
+		return $this->locate_node(trailingslashit($dirname));
86 86
 	}
87 87
 
88 88
 	// Here starteth the WP_Filesystem functions.
89 89
 
90
-	function mkdir( $path, /* Optional args are ignored */ $chmod = false, $chown = false, $chgrp = false ) {
91
-		$path = trailingslashit( $path );
90
+	function mkdir($path, /* Optional args are ignored */ $chmod = false, $chown = false, $chgrp = false) {
91
+		$path = trailingslashit($path);
92 92
 
93
-		$parent_node = $this->locate_parent_node( $path );
94
-		if ( ! $parent_node ) {
95
-			$dirname = str_replace( '\\', '/', dirname( $path ) );
96
-			$this->mkdir( $dirname );
97
-			$parent_node = $this->locate_parent_node( $path );
98
-			if ( ! $parent_node )
93
+		$parent_node = $this->locate_parent_node($path);
94
+		if (!$parent_node) {
95
+			$dirname = str_replace('\\', '/', dirname($path));
96
+			$this->mkdir($dirname);
97
+			$parent_node = $this->locate_parent_node($path);
98
+			if (!$parent_node)
99 99
 				return false;
100 100
 		}
101 101
 
102
-		$node = new MockFS_Directory_Node( $path );
102
+		$node = new MockFS_Directory_Node($path);
103 103
 
104
-		$parent_node->children[ $node->name ] = $node;
105
-		$this->fs_map[ $path ] = $node;
104
+		$parent_node->children[$node->name] = $node;
105
+		$this->fs_map[$path] = $node;
106 106
 
107 107
 		return true;
108 108
 	}
109 109
 
110
-	function put_contents( $path, $contents = '', $mode = null ) {
111
-		if ( ! $this->is_dir( dirname( $path ) ) )
112
-			$this->mkdir( dirname( $path ) );
110
+	function put_contents($path, $contents = '', $mode = null) {
111
+		if (!$this->is_dir(dirname($path)))
112
+			$this->mkdir(dirname($path));
113 113
 
114
-		$parent = $this->locate_parent_node( $path );
115
-		$new_file = new MockFS_File_Node( $path, $contents );
114
+		$parent = $this->locate_parent_node($path);
115
+		$new_file = new MockFS_File_Node($path, $contents);
116 116
 
117
-		$parent->children[ $new_file->name ] = $new_file;
118
-		$this->fs_map[ $path ] = $new_file;
117
+		$parent->children[$new_file->name] = $new_file;
118
+		$this->fs_map[$path] = $new_file;
119 119
 	}
120 120
 
121
-	function get_contents( $file ) {
122
-		if ( ! $this->is_file( $file ) )
121
+	function get_contents($file) {
122
+		if (!$this->is_file($file))
123 123
 			return false;
124
-		return $this->fs_map[ $file ]->contents;
124
+		return $this->fs_map[$file]->contents;
125 125
 	}
126 126
 
127 127
 	function cwd() {
128 128
 		return $this->cwd->path;
129 129
 	}
130 130
 
131
-	function chdir( $path ) {
132
-		if ( ! isset( $this->fs_map[ $path ] ) )
131
+	function chdir($path) {
132
+		if (!isset($this->fs_map[$path]))
133 133
 			return false;
134 134
 
135
-		$this->cwd = $this->fs_map[ $path ];
135
+		$this->cwd = $this->fs_map[$path];
136 136
 		return true;
137 137
 	}
138 138
 
139
-	function exists( $path ) {
140
-		return isset( $this->fs_map[ $path ] ) || isset( $this->fs_map[ trailingslashit( $path ) ] );
139
+	function exists($path) {
140
+		return isset($this->fs_map[$path]) || isset($this->fs_map[trailingslashit($path)]);
141 141
 	}
142 142
 
143
-	function is_file( $file ) {
144
-		return isset( $this->fs_map[ $file ] ) && $this->fs_map[ $file ]->is_file();
143
+	function is_file($file) {
144
+		return isset($this->fs_map[$file]) && $this->fs_map[$file]->is_file();
145 145
 	}
146 146
 
147
-	function is_dir( $path ) {
148
-		$path = trailingslashit( $path );
147
+	function is_dir($path) {
148
+		$path = trailingslashit($path);
149 149
 
150
-		return isset( $this->fs_map[ $path ] ) && $this->fs_map[ $path ]->is_dir();
150
+		return isset($this->fs_map[$path]) && $this->fs_map[$path]->is_dir();
151 151
 	}
152 152
 
153
-	function dirlist( $path = '.', $include_hidden = true, $recursive = false ) {
153
+	function dirlist($path = '.', $include_hidden = true, $recursive = false) {
154 154
 
155
-		if ( empty( $path ) || '.' == $path )
155
+		if (empty($path) || '.' == $path)
156 156
 			$path = $this->cwd();
157 157
 
158
-		if ( ! $this->exists( $path ) )
158
+		if (!$this->exists($path))
159 159
 			return false;
160 160
 
161 161
 		$limit_file = false;
162
-		if ( $this->is_file( $path ) ) {
163
-			$limit_file = $this->locate_node( $path )->name;
164
-			$path = dirname( $path ) . '/';
162
+		if ($this->is_file($path)) {
163
+			$limit_file = $this->locate_node($path)->name;
164
+			$path = dirname($path).'/';
165 165
 		}
166 166
 
167 167
 		$ret = array();
168
-		foreach ( $this->fs_map[ $path ]->children as $entry ) {
169
-			if ( '.' == $entry->name || '..' == $entry->name )
168
+		foreach ($this->fs_map[$path]->children as $entry) {
169
+			if ('.' == $entry->name || '..' == $entry->name)
170 170
 				continue;
171 171
 
172
-			if ( ! $include_hidden && '.' == $entry->name )
172
+			if (!$include_hidden && '.' == $entry->name)
173 173
 				continue;
174 174
 
175
-			if ( $limit_file && $entry->name != $limit_file )
175
+			if ($limit_file && $entry->name != $limit_file)
176 176
 				continue;
177 177
 
178 178
 			$struc = array();
179 179
 			$struc['name'] = $entry->name;
180 180
 			$struc['type'] = $entry->type;
181 181
 
182
-			if ( 'd' == $struc['type'] ) {
183
-				if ( $recursive )
184
-					$struc['files'] = $this->dirlist( trailingslashit( $path ) . trailingslashit( $struc['name'] ), $include_hidden, $recursive );
182
+			if ('d' == $struc['type']) {
183
+				if ($recursive)
184
+					$struc['files'] = $this->dirlist(trailingslashit($path).trailingslashit($struc['name']), $include_hidden, $recursive);
185 185
 				else
186 186
 					$struc['files'] = array();
187 187
 			}
188 188
 
189
-			$ret[ $entry->name ] = $struc;
189
+			$ret[$entry->name] = $struc;
190 190
 		}
191 191
 		return $ret;
192 192
 	}
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
 	public $type; // The type of the entry 'f' for file, 'd' for Directory
199 199
 	public $path; // The full path to the entry.
200 200
 
201
-	function __construct( $path ) {
201
+	function __construct($path) {
202 202
 		$this->path = $path;
203
-		$this->name = basename( $path );
203
+		$this->name = basename($path);
204 204
 	}
205 205
 
206 206
 	function is_file() {
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	public $type = 'f';
222 222
 	public $contents = ''; // The contents of the file
223 223
 
224
-	function __construct( $path, $contents = '' ) {
225
-		parent::__construct( $path );
224
+	function __construct($path, $contents = '') {
225
+		parent::__construct($path);
226 226
 		$this->contents = $contents;
227 227
 	}
228 228
 }
229 229
\ No newline at end of file
Please login to merge, or discard this patch.