Passed
Pull Request — master (#228)
by Viruthagiri
10:20
created
geodirectory-templates/listing-detail.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Template for the details (post) page
4
- *
5
- * You can make most changes via hooks or see the link below for info on how to replace the template in your theme.
6
- *
7
- * @link http://docs.wpgeodirectory.com/customizing-geodirectory-templates/
8
- * @since 1.0.0
9
- * @package GeoDirectory
10
- */
3
+		 * Template for the details (post) page
4
+		 *
5
+		 * You can make most changes via hooks or see the link below for info on how to replace the template in your theme.
6
+		 *
7
+		 * @link http://docs.wpgeodirectory.com/customizing-geodirectory-templates/
8
+		 * @since 1.0.0
9
+		 * @package GeoDirectory
10
+		 */
11 11
 
12 12
 header("X-XSS-Protection: 0"); // IE requirement
13 13
 // call header
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
 
34 34
 ###### SIDEBAR ON LEFT ######
35 35
 if (get_option('geodir_detail_sidebar_left_section')) {
36
-    /**
37
-     * Adds the details page sidebar to the details template page.
38
-     *
39
-     * @since 1.1.0
40
-     */
41
-    do_action('geodir_detail_sidebar');
36
+	/**
37
+	 * Adds the details page sidebar to the details template page.
38
+	 *
39
+	 * @since 1.1.0
40
+	 */
41
+	do_action('geodir_detail_sidebar');
42 42
 }
43 43
 
44 44
 ###### MAIN CONTENT WRAPPERS OPEN ######
@@ -63,26 +63,26 @@  discard block
 block discarded – undo
63 63
 ###### MAIN CONTENT ######
64 64
 // this call the main page content
65 65
 if (have_posts() && !$preview) {
66
-    the_post();
67
-    global $post, $post_images;
68
-    /**
69
-     * Calls the details page main content on the details template page.
70
-     *
71
-     * @since 1.1.0
72
-     * @param object $post The current post object.
73
-     */
74
-    do_action('geodir_details_main_content', $post);
66
+	the_post();
67
+	global $post, $post_images;
68
+	/**
69
+	 * Calls the details page main content on the details template page.
70
+	 *
71
+	 * @since 1.1.0
72
+	 * @param object $post The current post object.
73
+	 */
74
+	do_action('geodir_details_main_content', $post);
75 75
 } elseif ($preview) {
76
-    /**
77
-     * Called on the details page if the page is being previewed.
78
-     *
79
-     * This sets the value of `$post` to the preview values before the main content is called.
80
-     *
81
-     * @since 1.1.0
82
-     */
83
-    do_action('geodir_action_geodir_set_preview_post'); // set the $post to the preview values
84
-    /** This action is documented in geodirectory-templates/listing-detail.php */
85
-    do_action('geodir_details_main_content', $post);
76
+	/**
77
+	 * Called on the details page if the page is being previewed.
78
+	 *
79
+	 * This sets the value of `$post` to the preview values before the main content is called.
80
+	 *
81
+	 * @since 1.1.0
82
+	 */
83
+	do_action('geodir_action_geodir_set_preview_post'); // set the $post to the preview values
84
+	/** This action is documented in geodirectory-templates/listing-detail.php */
85
+	do_action('geodir_details_main_content', $post);
86 86
 }
87 87
 
88 88
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 
105 105
 ###### SIDEBAR ON RIGHT ######
106 106
 if (!get_option('geodir_detail_sidebar_left_section')) {
107
-    /** This action is documented in geodirectory-templates/listing-detail.php */
108
-    do_action('geodir_detail_sidebar');
107
+	/** This action is documented in geodirectory-templates/listing-detail.php */
108
+	do_action('geodir_detail_sidebar');
109 109
 }
110 110
 
111 111
 
Please login to merge, or discard this patch.
geodirectory_functions.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Function includes, this file calls all the separate function files
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Function includes, this file calls all the separate function files
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
  
9 9
 /**
10 10
  * Contains class & functions for geodirectory session usage.
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   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -30,30 +30,30 @@  discard block
 block discarded – undo
30 30
  * CHECK FOR OLD COMPATIBILITY PACKS AND DISABLE IF THEY ARE ACTIVE
31 31
  */
32 32
 if (is_admin()) {
33
-    /**
34
-     * Include WordPress core file so we can use core functions to check for active plugins.
35
-     */
36
-    include_once(ABSPATH . 'wp-admin/includes/plugin.php');
33
+	/**
34
+	 * Include WordPress core file so we can use core functions to check for active plugins.
35
+	 */
36
+	include_once(ABSPATH . 'wp-admin/includes/plugin.php');
37 37
 
38
-    if (is_plugin_active('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php')) {
39
-        deactivate_plugins('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php');
40
-    }
38
+	if (is_plugin_active('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php')) {
39
+		deactivate_plugins('geodirectory-genesis-compatibility-pack/geodir_genesis_compatibility.php');
40
+	}
41 41
 
42
-    if (is_plugin_active('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php')) {
43
-        deactivate_plugins('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php');
44
-    }
42
+	if (is_plugin_active('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php')) {
43
+		deactivate_plugins('geodirectory-x-theme-compatibility-pack/geodir_x_compatibility.php');
44
+	}
45 45
 
46
-    if (is_plugin_active('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php')) {
47
-        deactivate_plugins('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php');
48
-    }
46
+	if (is_plugin_active('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php')) {
47
+		deactivate_plugins('geodirectory-enfold-theme-compatibility-pack/geodir_enfold_compatibility.php');
48
+	}
49 49
 
50
-    if (is_plugin_active('geodir_avada_compatibility/geodir_avada_compatibility.php')) {
51
-        deactivate_plugins('geodir_avada_compatibility/geodir_avada_compatibility.php');
52
-    }
50
+	if (is_plugin_active('geodir_avada_compatibility/geodir_avada_compatibility.php')) {
51
+		deactivate_plugins('geodir_avada_compatibility/geodir_avada_compatibility.php');
52
+	}
53 53
 
54
-    if (is_plugin_active('geodir_compat_pack_divi/geodir_divi_compatibility.php')) {
55
-        deactivate_plugins('geodir_compat_pack_divi/geodir_divi_compatibility.php');
56
-    }
54
+	if (is_plugin_active('geodir_compat_pack_divi/geodir_divi_compatibility.php')) {
55
+		deactivate_plugins('geodir_compat_pack_divi/geodir_divi_compatibility.php');
56
+	}
57 57
 
58 58
 }
59 59
 
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 
105 105
 
106 106
 if ($_SERVER['REQUEST_URI'] == '' || $_SERVER['REQUEST_URI'] == '/') {
107
-    /**
108
-     * This tries to disable cache on homepage as it can be very dynamic.
109
-     */
110
-    define('DONOTCACHEPAGE', TRUE);
111
-    $_SERVER['DONOTCACHEPAGE']= TRUE;
107
+	/**
108
+	 * This tries to disable cache on homepage as it can be very dynamic.
109
+	 */
110
+	define('DONOTCACHEPAGE', TRUE);
111
+	$_SERVER['DONOTCACHEPAGE']= TRUE;
112 112
 }
113 113
 
114 114
 
@@ -130,19 +130,19 @@  discard block
 block discarded – undo
130 130
  * @package GeoDirectory
131 131
  */
132 132
 function geodir_error_log($log){
133
-    /*
133
+	/*
134 134
      * A filter to override the WP_DEBUG setting for function geodir_error_log().
135 135
      *
136 136
      * @since 1.5.7
137 137
      */
138
-    $should_log = apply_filters( 'geodir_log_errors', WP_DEBUG);
139
-    if ( true === $should_log ) {
140
-        if ( is_array( $log ) || is_object( $log ) ) {
141
-            error_log( print_r( $log, true ) );
142
-        } else {
143
-            error_log( $log );
144
-        }
145
-    }
138
+	$should_log = apply_filters( 'geodir_log_errors', WP_DEBUG);
139
+	if ( true === $should_log ) {
140
+		if ( is_array( $log ) || is_object( $log ) ) {
141
+			error_log( print_r( $log, true ) );
142
+		} else {
143
+			error_log( $log );
144
+		}
145
+	}
146 146
 }
147 147
 
148 148
 /**
@@ -182,62 +182,62 @@  discard block
 block discarded – undo
182 182
  */
183 183
 if (is_admin() || geodir_is_testing_mode()) {
184 184
 
185
-    /**
186
-     * Include functions used in admin area only.
187
-     *
188
-     * @since 1.0.0
189
-     */
190
-    require_once('geodirectory-admin/admin_functions.php');
191
-    /**
192
-     * Most actions/hooks used in admin area only are called from here.
193
-     *
194
-     * @since 1.0.0
195
-     */
196
-    require_once('geodirectory-admin/admin_hooks_actions.php');
197
-    /**
198
-     * Most admin JS and CSS is called from here.
199
-     *
200
-     * @since 1.0.0
201
-     */
202
-    require_once('geodirectory-admin/admin_template_tags.php');
203
-    /**
204
-     * Include any functions needed for upgrades.
205
-     *
206
-     * @since 1.0.0
207
-     */
208
-    require_once(geodir_plugin_path() . '/upgrade.php');
209
-    if (get_option('geodir_installed') != 1) {
210
-        /**
211
-         * Define language constants, here as they are not loaded yet.
212
-         *
213
-         * @since 1.0.0
214
-         */
215
-        require_once(geodir_plugin_path() . '/language.php');
216
-        /**
217
-         * Include the plugin install file that sets up the databases and any options on first run.
218
-         *
219
-         * @since 1.0.0
220
-         */
221
-        require_once('geodirectory-admin/admin_install.php');
222
-        register_activation_hook(__FILE__, 'geodir_activation');
223
-    }
224
-    register_deactivation_hook(__FILE__, 'geodir_deactivation');
225
-    register_uninstall_hook(__FILE__, 'geodir_uninstall');
185
+	/**
186
+	 * Include functions used in admin area only.
187
+	 *
188
+	 * @since 1.0.0
189
+	 */
190
+	require_once('geodirectory-admin/admin_functions.php');
191
+	/**
192
+	 * Most actions/hooks used in admin area only are called from here.
193
+	 *
194
+	 * @since 1.0.0
195
+	 */
196
+	require_once('geodirectory-admin/admin_hooks_actions.php');
197
+	/**
198
+	 * Most admin JS and CSS is called from here.
199
+	 *
200
+	 * @since 1.0.0
201
+	 */
202
+	require_once('geodirectory-admin/admin_template_tags.php');
203
+	/**
204
+	 * Include any functions needed for upgrades.
205
+	 *
206
+	 * @since 1.0.0
207
+	 */
208
+	require_once(geodir_plugin_path() . '/upgrade.php');
209
+	if (get_option('geodir_installed') != 1) {
210
+		/**
211
+		 * Define language constants, here as they are not loaded yet.
212
+		 *
213
+		 * @since 1.0.0
214
+		 */
215
+		require_once(geodir_plugin_path() . '/language.php');
216
+		/**
217
+		 * Include the plugin install file that sets up the databases and any options on first run.
218
+		 *
219
+		 * @since 1.0.0
220
+		 */
221
+		require_once('geodirectory-admin/admin_install.php');
222
+		register_activation_hook(__FILE__, 'geodir_activation');
223
+	}
224
+	register_deactivation_hook(__FILE__, 'geodir_deactivation');
225
+	register_uninstall_hook(__FILE__, 'geodir_uninstall');
226 226
 
227
-    /*
227
+	/*
228 228
      * Show a upgrade warning message if applicable.
229 229
      *
230 230
      * @since 1.5.6
231 231
      */
232
-    global $pagenow;
232
+	global $pagenow;
233 233
    if ( 'plugins.php' === $pagenow )
234
-    {
235
-        // Better update message
236
-        $file   = basename( __FILE__ );
237
-        $folder = basename( dirname( __FILE__ ) );
238
-        $hook = "in_plugin_update_message-{$folder}/{$file}";
239
-        add_action( $hook, 'geodire_admin_upgrade_notice', 20, 2 );
240
-    }
234
+	{
235
+		// Better update message
236
+		$file   = basename( __FILE__ );
237
+		$folder = basename( dirname( __FILE__ ) );
238
+		$hook = "in_plugin_update_message-{$folder}/{$file}";
239
+		add_action( $hook, 'geodire_admin_upgrade_notice', 20, 2 );
240
+	}
241 241
 
242 242
 }
243 243
 
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
  * @since 1.5.7
250 250
  */
251 251
 function geodir_is_testing_mode() {
252
-    if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
253
-        return true;
254
-    } else {
255
-        return false;
256
-    }
252
+	if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
253
+		return true;
254
+	} else {
255
+		return false;
256
+	}
257 257
 }
258 258
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 /**
84 84
  * Define constants
85 85
  */
86
-if(!defined('GEODIRECTORY_PLUGIN_DIR')) define('GEODIRECTORY_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
86
+if (!defined('GEODIRECTORY_PLUGIN_DIR')) define('GEODIRECTORY_PLUGIN_DIR', plugin_dir_path(__FILE__));
87 87
 
88 88
 /*
89 89
  * Declare database table names. All since version 1.0.0
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * This tries to disable cache on homepage as it can be very dynamic.
109 109
      */
110 110
     define('DONOTCACHEPAGE', TRUE);
111
-    $_SERVER['DONOTCACHEPAGE']= TRUE;
111
+    $_SERVER['DONOTCACHEPAGE'] = TRUE;
112 112
 }
113 113
 
114 114
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 if (!defined('GEODIRECTORY_TEXTDOMAIN')) define('GEODIRECTORY_TEXTDOMAIN', 'geodirectory');
119 119
 
120 120
 // Load geodirectory plugin textdomain.
121
-add_action( 'plugins_loaded', 'geodir_load_textdomain' );
121
+add_action('plugins_loaded', 'geodir_load_textdomain');
122 122
 
123 123
 /*
124 124
  * A function to log GD errors no matter the type given.
@@ -129,18 +129,18 @@  discard block
 block discarded – undo
129 129
  * @param mixed $log The thing that should be logged.
130 130
  * @package GeoDirectory
131 131
  */
132
-function geodir_error_log($log){
132
+function geodir_error_log($log) {
133 133
     /*
134 134
      * A filter to override the WP_DEBUG setting for function geodir_error_log().
135 135
      *
136 136
      * @since 1.5.7
137 137
      */
138
-    $should_log = apply_filters( 'geodir_log_errors', WP_DEBUG);
139
-    if ( true === $should_log ) {
140
-        if ( is_array( $log ) || is_object( $log ) ) {
141
-            error_log( print_r( $log, true ) );
138
+    $should_log = apply_filters('geodir_log_errors', WP_DEBUG);
139
+    if (true === $should_log) {
140
+        if (is_array($log) || is_object($log)) {
141
+            error_log(print_r($log, true));
142 142
         } else {
143
-            error_log( $log );
143
+            error_log($log);
144 144
         }
145 145
     }
146 146
 }
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
      * @since 1.5.6
231 231
      */
232 232
     global $pagenow;
233
-   if ( 'plugins.php' === $pagenow )
233
+   if ('plugins.php' === $pagenow)
234 234
     {
235 235
         // Better update message
236
-        $file   = basename( __FILE__ );
237
-        $folder = basename( dirname( __FILE__ ) );
236
+        $file   = basename(__FILE__);
237
+        $folder = basename(dirname(__FILE__));
238 238
         $hook = "in_plugin_update_message-{$folder}/{$file}";
239
-        add_action( $hook, 'geodire_admin_upgrade_notice', 20, 2 );
239
+        add_action($hook, 'geodire_admin_upgrade_notice', 20, 2);
240 240
     }
241 241
 
242 242
 }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
  * @since 1.5.7
250 250
  */
251 251
 function geodir_is_testing_mode() {
252
-    if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
252
+    if (defined('GD_TESTING_MODE') && GD_TESTING_MODE) {
253 253
         return true;
254 254
     } else {
255 255
         return false;
Please login to merge, or discard this patch.
geodirectory-templates/geodir-listing.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Template for the listings (category) page
4
- *
5
- * You can make most changes via hooks or see the link below for info on how to replace the template in your theme.
6
- *
7
- * @link http://docs.wpgeodirectory.com/customizing-geodirectory-templates/
8
- * @since 1.0.0
9
- * @package GeoDirectory
10
- */
3
+			 * Template for the listings (category) page
4
+			 *
5
+			 * You can make most changes via hooks or see the link below for info on how to replace the template in your theme.
6
+			 *
7
+			 * @link http://docs.wpgeodirectory.com/customizing-geodirectory-templates/
8
+			 * @since 1.0.0
9
+			 * @package GeoDirectory
10
+			 */
11 11
 
12 12
 // call header
13 13
 get_header();
Please login to merge, or discard this patch.
language.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Language constants used in the plugin
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Language constants used in the plugin
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
 
9 9
 /*
10 10
  * NOTE: when editing text in this file, a single apostrophe ( ' ) can cause the site to break
Please login to merge, or discard this patch.
geodirectory-widgets/geodirectory_features_widget.php 2 patches
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -3,117 +3,117 @@  discard block
 block discarded – undo
3 3
 class Geodir_Features_Widget extends WP_Widget
4 4
 {
5 5
 
6
-    /**
7
-     * Class constructor.
8
-     */
9
-    public function __construct()
10
-    {
11
-        $widget_ops = array(
12
-            'description' => __('Displays "GD Features" widget', 'geodirectory'),
13
-            'classname' => 'widget_gd_features',
14
-        );
15
-        parent::__construct(false, $name = _x('GD > Features', 'widget name', 'geodirectory'), $widget_ops);
16
-
17
-    }
18
-
19
-    /**
20
-     * Display the widget.
21
-     *
22
-     * @param array $args Widget arguments.
23
-     * @param array $instance The widget settings, as saved by the user.
24
-     */
25
-    public function widget($args, $instance)
26
-    {
27
-        extract($args);
28
-
29
-        $title = empty($instance['title']) ? '' : apply_filters('gd_features_widget_title', __($instance['title'], 'geodirectory'));
30
-        $icon_color = $instance['icon_color'];
31
-
32
-        echo $before_widget;
33
-        ?>
6
+	/**
7
+	 * Class constructor.
8
+	 */
9
+	public function __construct()
10
+	{
11
+		$widget_ops = array(
12
+			'description' => __('Displays "GD Features" widget', 'geodirectory'),
13
+			'classname' => 'widget_gd_features',
14
+		);
15
+		parent::__construct(false, $name = _x('GD > Features', 'widget name', 'geodirectory'), $widget_ops);
16
+
17
+	}
18
+
19
+	/**
20
+	 * Display the widget.
21
+	 *
22
+	 * @param array $args Widget arguments.
23
+	 * @param array $instance The widget settings, as saved by the user.
24
+	 */
25
+	public function widget($args, $instance)
26
+	{
27
+		extract($args);
28
+
29
+		$title = empty($instance['title']) ? '' : apply_filters('gd_features_widget_title', __($instance['title'], 'geodirectory'));
30
+		$icon_color = $instance['icon_color'];
31
+
32
+		echo $before_widget;
33
+		?>
34 34
         <?php if ($title) {
35
-        echo '<div class="geodir_list_heading clearfix">';
36
-        echo $before_title . $title . $after_title;
37
-        echo '</div>';
38
-    } ?>
35
+		echo '<div class="geodir_list_heading clearfix">';
36
+		echo $before_title . $title . $after_title;
37
+		echo '</div>';
38
+	} ?>
39 39
         <?php
40
-        echo "<ul class='gd-features'>";
41
-
42
-        $i = 1;
43
-        while ($i < 100) {
44
-
45
-            if (isset($instance['title' . $i]) || isset($instance['image' . $i]) || isset($instance['desc' . $i])) {
46
-                echo "<li>";
47
-                if ($instance['title' . $i]) {
48
-                    echo "<h3 class='gd-fe-title'>" . $instance['title' . $i] . "</h3>";
49
-                }
50
-                if ($instance['image' . $i]) {
51
-                    echo "<div class='gd-fe-image'>" . gd_features_parse_image($instance['image' . $i], $icon_color) . "</div>";
52
-                }
53
-                if ($instance['desc' . $i]) {
54
-                    echo "<div class='gd-fe-desc'>" . gd_features_parse_desc($instance['desc' . $i]) . "</div>";
55
-                }
56
-                echo "</li>";
57
-            } else {
58
-                break;
59
-            }
60
-
61
-            $i++;
62
-        }
63
-
64
-        echo "</ul>";
65
-        ?>
40
+		echo "<ul class='gd-features'>";
41
+
42
+		$i = 1;
43
+		while ($i < 100) {
44
+
45
+			if (isset($instance['title' . $i]) || isset($instance['image' . $i]) || isset($instance['desc' . $i])) {
46
+				echo "<li>";
47
+				if ($instance['title' . $i]) {
48
+					echo "<h3 class='gd-fe-title'>" . $instance['title' . $i] . "</h3>";
49
+				}
50
+				if ($instance['image' . $i]) {
51
+					echo "<div class='gd-fe-image'>" . gd_features_parse_image($instance['image' . $i], $icon_color) . "</div>";
52
+				}
53
+				if ($instance['desc' . $i]) {
54
+					echo "<div class='gd-fe-desc'>" . gd_features_parse_desc($instance['desc' . $i]) . "</div>";
55
+				}
56
+				echo "</li>";
57
+			} else {
58
+				break;
59
+			}
60
+
61
+			$i++;
62
+		}
63
+
64
+		echo "</ul>";
65
+		?>
66 66
         <?php echo $after_widget; ?>
67 67
     <?php
68
-    }
69
-
70
-    public function update($new_instance, $old_instance)
71
-    {
72
-        //save the widget
73
-        $instance = $old_instance;
74
-
75
-        $instance['title'] = strip_tags($new_instance['title']);
76
-        $instance['icon_color'] = strip_tags($new_instance['icon_color']);
77
-
78
-        $i = 1;
79
-        while ($i < 100) {
80
-
81
-            if (isset($new_instance['title' . $i]) || isset($new_instance['image' . $i]) || isset($new_instance['desc' . $i])) {
82
-                if ($new_instance['title' . $i]) {
83
-                    $instance['title' . $i] = $new_instance['title' . $i];
84
-                }
85
-                if ($new_instance['image' . $i]) {
86
-                    $instance['image' . $i] = $new_instance['image' . $i];
87
-                }
88
-                if ($new_instance['desc' . $i]) {
89
-                    $instance['desc' . $i] = $new_instance['desc' . $i];
90
-                }
91
-            } else {
92
-                break;
93
-            }
94
-
95
-            $i++;
96
-        }
97
-
98
-        return $instance;
99
-    }
100
-
101
-    public function form($instance)
102
-    {
103
-        //widgetform in backend
104
-        $instance = wp_parse_args((array)$instance, array(
105
-            'title' => '',
106
-            'icon_color' => '#757575',
107
-            'title1' => '',
108
-            'image1' => '',
109
-            'desc1' => '',
110
-        ));
111
-
112
-
113
-        $title = strip_tags($instance['title']);
114
-        $icon_color = strip_tags($instance['icon_color']);
115
-
116
-        ?>
68
+	}
69
+
70
+	public function update($new_instance, $old_instance)
71
+	{
72
+		//save the widget
73
+		$instance = $old_instance;
74
+
75
+		$instance['title'] = strip_tags($new_instance['title']);
76
+		$instance['icon_color'] = strip_tags($new_instance['icon_color']);
77
+
78
+		$i = 1;
79
+		while ($i < 100) {
80
+
81
+			if (isset($new_instance['title' . $i]) || isset($new_instance['image' . $i]) || isset($new_instance['desc' . $i])) {
82
+				if ($new_instance['title' . $i]) {
83
+					$instance['title' . $i] = $new_instance['title' . $i];
84
+				}
85
+				if ($new_instance['image' . $i]) {
86
+					$instance['image' . $i] = $new_instance['image' . $i];
87
+				}
88
+				if ($new_instance['desc' . $i]) {
89
+					$instance['desc' . $i] = $new_instance['desc' . $i];
90
+				}
91
+			} else {
92
+				break;
93
+			}
94
+
95
+			$i++;
96
+		}
97
+
98
+		return $instance;
99
+	}
100
+
101
+	public function form($instance)
102
+	{
103
+		//widgetform in backend
104
+		$instance = wp_parse_args((array)$instance, array(
105
+			'title' => '',
106
+			'icon_color' => '#757575',
107
+			'title1' => '',
108
+			'image1' => '',
109
+			'desc1' => '',
110
+		));
111
+
112
+
113
+		$title = strip_tags($instance['title']);
114
+		$icon_color = strip_tags($instance['icon_color']);
115
+
116
+		?>
117 117
         <p>
118 118
             <b>Heads Up!</b> If you don't have enough content, You can keep some boxes blank.
119 119
         </p>
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
         <div class="gd-fet-rep-<?php echo $this->get_field_id('xxx');?>">
142 142
             <?php
143 143
 
144
-            $i = 1;
145
-            while ($i < 100) {
144
+			$i = 1;
145
+			while ($i < 100) {
146 146
 
147
-                if ( $i==1 || (isset($instance['title' . $i]) || isset($instance['image' . $i]) || isset($instance['desc' . $i])) && ($instance['title' . $i] || $instance['image' . $i] || $instance['desc' . $i])) {
148
-                    ?>
147
+				if ( $i==1 || (isset($instance['title' . $i]) || isset($instance['image' . $i]) || isset($instance['desc' . $i])) && ($instance['title' . $i] || $instance['image' . $i] || $instance['desc' . $i])) {
148
+					?>
149 149
                     <div class="gdrep<?php echo $i;?>">
150 150
                         <p class="features-title">
151 151
                             <label
@@ -170,14 +170,14 @@  discard block
 block discarded – undo
170 170
                         </p>
171 171
                     </div>
172 172
                 <?php
173
-                } else {
174
-                    break;
175
-                }
173
+				} else {
174
+					break;
175
+				}
176 176
 
177
-                $i++;
178
-            }
177
+				$i++;
178
+			}
179 179
 
180
-            ?>
180
+			?>
181 181
             <input class="button button-primary left"
182 182
                    onclick="gd_featured_widget_repeat('gd-fet-rep-<?php echo $this->get_field_id('xxx');?>','<?php echo $this->get_field_name('xxx');?>')"
183 183
                    type="button" value="<?php _e('Add item', 'geodirectory');?>"/>
@@ -185,25 +185,25 @@  discard block
 block discarded – undo
185 185
 
186 186
 
187 187
     <?php
188
-    }
188
+	}
189 189
 
190 190
 }
191 191
 
192 192
 register_widget("Geodir_Features_Widget");
193 193
 function gd_features_parse_image($image, $icon_color)
194 194
 {
195
-    if (substr($image, 0, 4) === "http") {
196
-        $image = '<img src="' . $image . '" />';
197
-    } elseif (substr($image, 0, 3) === "fa-") {
198
-        if (empty($icon_color)) {
199
-            $icon_color = '#757575';
200
-        }
201
-        $image = '<i style="color:' . $icon_color . '" class="fa ' . $image . '"></i>';
202
-    }
203
-    return $image;
195
+	if (substr($image, 0, 4) === "http") {
196
+		$image = '<img src="' . $image . '" />';
197
+	} elseif (substr($image, 0, 3) === "fa-") {
198
+		if (empty($icon_color)) {
199
+			$icon_color = '#757575';
200
+		}
201
+		$image = '<i style="color:' . $icon_color . '" class="fa ' . $image . '"></i>';
202
+	}
203
+	return $image;
204 204
 }
205 205
 
206 206
 function gd_features_parse_desc($desc)
207 207
 {
208
-    return $desc;
208
+	return $desc;
209 209
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     public function form($instance)
102 102
     {
103 103
         //widgetform in backend
104
-        $instance = wp_parse_args((array)$instance, array(
104
+        $instance = wp_parse_args((array) $instance, array(
105 105
             'title' => '',
106 106
             'icon_color' => '#757575',
107 107
             'title1' => '',
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
         </p>
139 139
 
140 140
 
141
-        <div class="gd-fet-rep-<?php echo $this->get_field_id('xxx');?>">
141
+        <div class="gd-fet-rep-<?php echo $this->get_field_id('xxx'); ?>">
142 142
             <?php
143 143
 
144 144
             $i = 1;
145 145
             while ($i < 100) {
146 146
 
147
-                if ( $i==1 || (isset($instance['title' . $i]) || isset($instance['image' . $i]) || isset($instance['desc' . $i])) && ($instance['title' . $i] || $instance['image' . $i] || $instance['desc' . $i])) {
147
+                if ($i == 1 || (isset($instance['title' . $i]) || isset($instance['image' . $i]) || isset($instance['desc' . $i])) && ($instance['title' . $i] || $instance['image' . $i] || $instance['desc' . $i])) {
148 148
                     ?>
149
-                    <div class="gdrep<?php echo $i;?>">
149
+                    <div class="gdrep<?php echo $i; ?>">
150 150
                         <p class="features-title">
151 151
                             <label
152 152
                                 data-gdrep-title-num="1"><?php printf(__('Title %d:', 'geodirectory'), $i); ?></label>
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 
180 180
             ?>
181 181
             <input class="button button-primary left"
182
-                   onclick="gd_featured_widget_repeat('gd-fet-rep-<?php echo $this->get_field_id('xxx');?>','<?php echo $this->get_field_name('xxx');?>')"
183
-                   type="button" value="<?php _e('Add item', 'geodirectory');?>"/>
182
+                   onclick="gd_featured_widget_repeat('gd-fet-rep-<?php echo $this->get_field_id('xxx'); ?>','<?php echo $this->get_field_name('xxx'); ?>')"
183
+                   type="button" value="<?php _e('Add item', 'geodirectory'); ?>"/>
184 184
         </div>
185 185
 
186 186
 
Please login to merge, or discard this patch.
geodirectory-templates/listing-listview.php 3 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -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());
@@ -231,12 +231,12 @@  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 ) ) {
239
+                                    if (!empty($content_out)) {
240 240
                                         echo "<p>" . $content_out . "</p>";
241 241
                                     }
242 242
                                 }
@@ -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.
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   +274 added lines, -274 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,39 +390,39 @@  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>
422 422
 <?php
423 423
 /**
424
- * Called after the listings list view template, after all the wrapper at the very end.
425
- *
426
- * @since 1.0.0
427
- */
424
+		 * Called after the listings list view template, after all the wrapper at the very end.
425
+		 *
426
+		 * @since 1.0.0
427
+		 */
428 428
 do_action('geodir_after_listing_listview');
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.
Spacing   +142 added lines, -142 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 ) {
233
+	function create_object($args) {
234 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.
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.
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,21 +14,21 @@  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]) ) {
27
+	if (is_object($function[0])) {
28 28
 		return spl_object_hash($function[0]) . $function[1];
29
-	} else if ( is_string($function[0]) ) {
29
+	} else if (is_string($function[0])) {
30 30
 		// Static Calling
31
-		return $function[0].$function[1];
31
+		return $function[0] . $function[1];
32 32
 	}
33 33
 }
34 34
 
@@ -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.