Test Failed
Pull Request — master (#308)
by Kiran
23:47
created
geodirectory-templates/listing-listview.php 3 patches
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -80,7 +80,10 @@  discard block
 block discarded – undo
80 80
                     echo ' geodir-listview ';
81 81
                 } ?> <?php if ($post_view_class) {
82 82
                     echo $post_view_class;
83
-                } ?>" <?php if (isset($listing_width) && $listing_width) echo "style='width:{$listing_width}%;'"; // Width for widget listing
83
+                } ?>" <?php if (isset($listing_width) && $listing_width) {
84
+                	echo "style='width:{$listing_width}%;'";
85
+                }
86
+                // Width for widget listing
84 87
 
85 88
                 echo " data-post-id='$post->ID' ";
86 89
                 /**
@@ -402,8 +405,10 @@  discard block
 block discarded – undo
402 405
              */
403 406
             do_action('geodir_after_listing_post_listview');
404 407
 
405
-        else:
406
-			$favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false;
408
+        else {
409
+        	:
410
+			$favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false;
411
+        }
407 412
             
408 413
 			/**
409 414
              * Called inside the `ul` of the listings template, when no listing found.
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                 ?>
76 76
 
77 77
                 <li class="clearfix <?php if ($grid_view_class) {
78
-                    echo 'geodir-gridview ' . $grid_view_class;
78
+                    echo 'geodir-gridview '.$grid_view_class;
79 79
                 } else {
80 80
                     echo ' geodir-listview ';
81 81
                 } ?> <?php if ($post_view_class) {
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                                     echo geodir_show_badges_on_image('featured', $post, get_permalink());
117 117
                                 }
118 118
 
119
-                                $geodir_days_new = (int)get_option('geodir_listing_new_days');
119
+                                $geodir_days_new = (int) get_option('geodir_listing_new_days');
120 120
 
121 121
                                 if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
122 122
                                     echo geodir_show_badges_on_image('new', $post, get_permalink());
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
                                         } else {
195 195
                                             $uom = __('meters', 'geodirectory');
196 196
                                         }
197
-                                        echo round($distance) . ' ' . $uom . '<br />';
197
+                                        echo round($distance).' '.$uom.'<br />';
198 198
                                     } else {
199 199
                                         if ($uom == 'miles') {
200 200
                                             $uom = __('miles', 'geodirectory');
201 201
                                         } else {
202 202
                                             $uom = __('km', 'geodirectory');
203 203
                                         }
204
-                                        echo round($distance, 2) . ' ' . $uom . '<br />';
204
+                                        echo round($distance, 2).' '.$uom.'<br />';
205 205
                                     }
206 206
                                     ?>
207 207
                                 </h3>
@@ -231,13 +231,13 @@  discard block
 block discarded – undo
231 231
                                  */
232 232
                                 $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post);
233 233
                                 if ($show_listing_excerpt) {
234
-                                    if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
235
-                                        $content_out = geodir_max_excerpt( $character_count );
234
+                                    if (isset($character_count) && ($character_count || $character_count == '0')) {
235
+                                        $content_out = geodir_max_excerpt($character_count);
236 236
                                     } else {
237 237
                                         $content_out = get_the_excerpt();
238 238
                                     }
239
-                                    if ( ! empty( $content_out ) ) {
240
-                                        echo "<p>" . $content_out . "</p>";
239
+                                    if (!empty($content_out)) {
240
+                                        echo "<p>".$content_out."</p>";
241 241
                                     }
242 242
                                 }
243 243
                                 ?></div>
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                          * @param object $post The post object.
262 262
                          * @param string $view The view type, default 'listing'.
263 263
                          */
264
-                        do_action( 'geodir_after_listing_content', $post, 'listing' ); ?>
264
+                        do_action('geodir_after_listing_content', $post, 'listing'); ?>
265 265
                         <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'listing'); ?>">
266 266
                             <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'listing'); ?>">
267 267
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
                                  * @param object $post The post object.
274 274
                                  * @param string $view The view type, default 'listing'.
275 275
                                  */
276
-                                do_action( 'geodir_before_review_html', $post, 'listing' );
276
+                                do_action('geodir_before_review_html', $post, 'listing');
277 277
 
278 278
                                 $review_show = geodir_is_reviews_show('listview');
279 279
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
                                  *
317 317
                                  * @since 1.0.0
318 318
                                  */
319
-                                do_action( 'geodir_after_favorite_html', $post->ID, 'listing' );
319
+                                do_action('geodir_after_favorite_html', $post->ID, 'listing');
320 320
 
321 321
 
322 322
                                 /**
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
                                  * @param int $post->ID The post id.
328 328
                                  * @param object $post The post object.
329 329
                                  */
330
-                                do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post);
330
+                                do_action('geodir_listing_after_pinpoint', $post->ID, $post);
331 331
 
332 332
                                 if ($post->post_author == get_current_user_id()) { ?>
333 333
                                     <?php
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
                                                    title="<?php _e('Edit Listing', 'geodirectory'); ?>">
357 357
                                                     <?php
358 358
                                                     $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
359
-                                                    echo '<i class="'. $geodir_listing_edit_icon .'"></i>';
359
+                                                    echo '<i class="'.$geodir_listing_edit_icon.'"></i>';
360 360
                                                     ?>
361 361
                                                     <?php _e('Edit', 'geodirectory'); ?>
362 362
                                                 </a>
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
                                                    title="<?php _e('Delete Listing', 'geodirectory'); ?>">
365 365
                                                     <?php
366 366
                                                     $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
367
-                                                    echo '<i class="'. $geodir_listing_delete_icon .'"></i>';
367
+                                                    echo '<i class="'.$geodir_listing_delete_icon.'"></i>';
368 368
                                                     ?>
369 369
                                                     <?php _e('Delete', 'geodirectory'); ?>
370 370
                                                 </a>
Please login to merge, or discard this patch.
Indentation   +276 added lines, -276 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,226 +162,226 @@  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'] != '') || $related_nearest) {
177
-
178
-                                if ($related_nearest) {
179
-                                    $startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon);
180
-                                } else {
181
-                                    $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']);
182
-                                }
183
-
184
-                                $endLat = $post->post_latitude;
185
-                                $endLon = $post->post_longitude;
186
-                                $endPoint = array('latitude' => $endLat, 'longitude' => $endLon);
187
-                                $uom = get_option('geodir_search_dist_1');
188
-                                $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); ?>
176
+							if ((isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') || $related_nearest) {
177
+
178
+								if ($related_nearest) {
179
+									$startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon);
180
+								} else {
181
+									$startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']);
182
+								}
183
+
184
+								$endLat = $post->post_latitude;
185
+								$endLon = $post->post_longitude;
186
+								$endPoint = array('latitude' => $endLat, 'longitude' => $endLon);
187
+								$uom = get_option('geodir_search_dist_1');
188
+								$distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); ?>
189 189
                                 <h3>
190 190
                                     <?php
191 191
 
192
-                                    if (round($distance, 2) == 0) {
193
-                                        $uom = get_option('geodir_search_dist_2');
194
-
195
-                                        $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom);
196
-                                        if ($uom == 'feet') {
197
-                                            $uom = __('feet', 'geodirectory');
198
-                                        } else {
199
-                                            $uom = __('meters', 'geodirectory');
200
-                                        }
201
-                                        echo round($distance) . ' ' . $uom . '<br />';
202
-                                    } else {
203
-                                        if ($uom == 'miles') {
204
-                                            $uom = __('miles', 'geodirectory');
205
-                                        } else {
206
-                                            $uom = __('km', 'geodirectory');
207
-                                        }
208
-                                        echo round($distance, 2) . ' ' . $uom . '<br />';
209
-                                    }
210
-                                    ?>
192
+									if (round($distance, 2) == 0) {
193
+										$uom = get_option('geodir_search_dist_2');
194
+
195
+										$distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom);
196
+										if ($uom == 'feet') {
197
+											$uom = __('feet', 'geodirectory');
198
+										} else {
199
+											$uom = __('meters', 'geodirectory');
200
+										}
201
+										echo round($distance) . ' ' . $uom . '<br />';
202
+									} else {
203
+										if ($uom == 'miles') {
204
+											$uom = __('miles', 'geodirectory');
205
+										} else {
206
+											$uom = __('km', 'geodirectory');
207
+										}
208
+										echo round($distance, 2) . ' ' . $uom . '<br />';
209
+									}
210
+									?>
211 211
                                 </h3>
212 212
                             <?php } ?>
213 213
 
214 214
 
215 215
                             <?php
216
-                            /**
217
-                             * Called before the post excerpt on the listings view template.
218
-                             *
219
-                             * @since 1.0.0
220
-                             * @param object $post The post object.
221
-                             * @see 'geodir_after_listing_post_excerpt'
222
-                             */
223
-                            do_action('geodir_before_listing_post_excerpt', $post); ?>
216
+							/**
217
+							 * Called before the post excerpt on the listings view template.
218
+							 *
219
+							 * @since 1.0.0
220
+							 * @param object $post The post object.
221
+							 * @see 'geodir_after_listing_post_excerpt'
222
+							 */
223
+							do_action('geodir_before_listing_post_excerpt', $post); ?>
224 224
                             <?php echo geodir_show_listing_info('listing'); ?>
225 225
                             <div class="geodir-entry-content">
226 226
 
227 227
                                 <?php
228
-                                /**
229
-                                 * Filter to hide the listing excerpt
230
-                                 *
231
-                                 * @since 1.5.3
232
-                                 * @param bool $display Display the excerpt or not. Default true.
233
-                                 * @param string $view The view type, default 'listview'.
234
-                                 * @param object $post The post object.
235
-                                 */
236
-                                $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post);
237
-                                if ($show_listing_excerpt) {
238
-                                    if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
239
-                                        $content_out = geodir_max_excerpt( $character_count );
240
-                                    } else {
241
-                                        $content_out = get_the_excerpt();
242
-                                    }
243
-                                    if ( ! empty( $content_out ) ) {
244
-                                        echo "<p>" . $content_out . "</p>";
245
-                                    }
246
-                                }
247
-                                ?></div>
228
+								/**
229
+								 * Filter to hide the listing excerpt
230
+								 *
231
+								 * @since 1.5.3
232
+								 * @param bool $display Display the excerpt or not. Default true.
233
+								 * @param string $view The view type, default 'listview'.
234
+								 * @param object $post The post object.
235
+								 */
236
+								$show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post);
237
+								if ($show_listing_excerpt) {
238
+									if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
239
+										$content_out = geodir_max_excerpt( $character_count );
240
+									} else {
241
+										$content_out = get_the_excerpt();
242
+									}
243
+									if ( ! empty( $content_out ) ) {
244
+										echo "<p>" . $content_out . "</p>";
245
+									}
246
+								}
247
+								?></div>
248 248
 
249 249
                             <?php
250
-                            /**
251
-                             * Called after the post excerpt on the listings view template.
252
-                             *
253
-                             * @since 1.0.0
254
-                             * @param object $post The post object.
255
-                             * @see 'geodir_before_listing_post_excerpt'
256
-                             */
257
-                            do_action('geodir_after_listing_post_excerpt', $post); ?>
250
+							/**
251
+							 * Called after the post excerpt on the listings view template.
252
+							 *
253
+							 * @since 1.0.0
254
+							 * @param object $post The post object.
255
+							 * @see 'geodir_before_listing_post_excerpt'
256
+							 */
257
+							do_action('geodir_after_listing_post_excerpt', $post); ?>
258 258
                         </div>
259 259
                         <!-- gd-content ends here-->
260 260
                         <?php
261
-                        /**
262
-                         * Called after printing listing content.
263
-                         *
264
-                         * @since 1.5.3
265
-                         * @param object $post The post object.
266
-                         * @param string $view The view type, default 'listing'.
267
-                         */
268
-                        do_action( 'geodir_after_listing_content', $post, 'listing' ); ?>
261
+						/**
262
+						 * Called after printing listing content.
263
+						 *
264
+						 * @since 1.5.3
265
+						 * @param object $post The post object.
266
+						 * @param string $view The view type, default 'listing'.
267
+						 */
268
+						do_action( 'geodir_after_listing_content', $post, 'listing' ); ?>
269 269
                         <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'listing'); ?>">
270 270
                             <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'listing'); ?>">
271 271
 
272 272
                                 <?php
273
-                                /**
274
-                                 * Called before printing review stars html.
275
-                                 *
276
-                                 * @since 1.5.3
277
-                                 * @param object $post The post object.
278
-                                 * @param string $view The view type, default 'listing'.
279
-                                 */
280
-                                do_action( 'geodir_before_review_html', $post, 'listing' );
281
-
282
-                                $review_show = geodir_is_reviews_show('listview');
283
-
284
-                                if ($review_show) {
285
-
286
-                                    if (!$preview) {
287
-                                        $post_avgratings = geodir_get_post_rating($post->ID);
288
-                                        /**
289
-                                         * Called before the rating stars are output on the listings view template.
290
-                                         *
291
-                                         * @since 1.0.0
292
-                                         * @param float $post_avgratings The average rating for the post.
293
-                                         * @param int $post->ID The post ID.
294
-                                         * @see 'geodir_after_review_rating_stars_on_listview'
295
-                                         */
296
-                                        do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID);
297
-
298
-                                        echo geodir_get_rating_stars($post_avgratings, $post->ID);
299
-
300
-                                        /**
301
-                                         * Called after the rating stars are output on the listings view template.
302
-                                         *
303
-                                         * @since 1.0.0
304
-                                         * @param float $post_avgratings The average rating for the post.
305
-                                         * @param int $post->ID The post ID.
306
-                                         * @see 'geodir_before_review_rating_stars_on_listview'
307
-                                         */
308
-                                        do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID);
309
-                                    }
310
-                                    ?>
273
+								/**
274
+								 * Called before printing review stars html.
275
+								 *
276
+								 * @since 1.5.3
277
+								 * @param object $post The post object.
278
+								 * @param string $view The view type, default 'listing'.
279
+								 */
280
+								do_action( 'geodir_before_review_html', $post, 'listing' );
281
+
282
+								$review_show = geodir_is_reviews_show('listview');
283
+
284
+								if ($review_show) {
285
+
286
+									if (!$preview) {
287
+										$post_avgratings = geodir_get_post_rating($post->ID);
288
+										/**
289
+										 * Called before the rating stars are output on the listings view template.
290
+										 *
291
+										 * @since 1.0.0
292
+										 * @param float $post_avgratings The average rating for the post.
293
+										 * @param int $post->ID The post ID.
294
+										 * @see 'geodir_after_review_rating_stars_on_listview'
295
+										 */
296
+										do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID);
297
+
298
+										echo geodir_get_rating_stars($post_avgratings, $post->ID);
299
+
300
+										/**
301
+										 * Called after the rating stars are output on the listings view template.
302
+										 *
303
+										 * @since 1.0.0
304
+										 * @param float $post_avgratings The average rating for the post.
305
+										 * @param int $post->ID The post ID.
306
+										 * @see 'geodir_before_review_rating_stars_on_listview'
307
+										 */
308
+										do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID);
309
+									}
310
+									?>
311 311
                                     <a href="<?php comments_link(); ?>" class="geodir-pcomments"><i
312 312
                                             class="fa fa-comments"></i>
313 313
                                         <?php geodir_comments_number($post->rating_count); ?></a>
314 314
                                 <?php
315
-                                }
315
+								}
316 316
 
317 317
 
318
-                                /**
319
-                                 * Called after printing favorite html.
320
-                                 *
321
-                                 * @since 1.0.0
322
-                                 */
323
-                                do_action( 'geodir_after_favorite_html', $post->ID, 'listing' );
318
+								/**
319
+								 * Called after printing favorite html.
320
+								 *
321
+								 * @since 1.0.0
322
+								 */
323
+								do_action( 'geodir_after_favorite_html', $post->ID, 'listing' );
324 324
 
325 325
 
326
-                                /**
327
-                                 * Called after printing map pin point.
328
-                                 *
329
-                                 * @since 1.0.0
330
-                                 * @since 1.5.9 Added $post as second param.
331
-                                 * @param int $post->ID The post id.
332
-                                 * @param object $post The post object.
333
-                                 */
334
-                                do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post);
326
+								/**
327
+								 * Called after printing map pin point.
328
+								 *
329
+								 * @since 1.0.0
330
+								 * @since 1.5.9 Added $post as second param.
331
+								 * @param int $post->ID The post id.
332
+								 * @param object $post The post object.
333
+								 */
334
+								do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post);
335 335
 
336
-                                if ($post->post_author == get_current_user_id()) { ?>
336
+								if ($post->post_author == get_current_user_id()) { ?>
337 337
                                     <?php
338
-                                    $addplacelink = get_permalink(geodir_add_listing_page_id());
339
-                                    $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false);
340
-                                    $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false);
338
+									$addplacelink = get_permalink(geodir_add_listing_page_id());
339
+									$editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false);
340
+									$upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false);
341 341
 
342
-                                    $ajaxlink = geodir_get_ajax_url();
343
-                                    $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false);
342
+									$ajaxlink = geodir_get_ajax_url();
343
+									$deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false);
344 344
 
345
-                                    ?>
345
+									?>
346 346
 
347 347
                                     <span class="geodir-authorlink clearfix">
348 348
 											
349 349
 											<?php if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) {
350
-                                                /**
351
-                                                 * Called before the edit post link on the listings view template used on the author page.
352
-                                                 *
353
-                                                 * @since 1.0.0
354
-                                                 * @see 'geodir_after_edit_post_link_on_listing'
355
-                                                 */
356
-                                                do_action('geodir_before_edit_post_link_on_listing');
357
-                                                ?>
350
+												/**
351
+												 * Called before the edit post link on the listings view template used on the author page.
352
+												 *
353
+												 * @since 1.0.0
354
+												 * @see 'geodir_after_edit_post_link_on_listing'
355
+												 */
356
+												do_action('geodir_before_edit_post_link_on_listing');
357
+												?>
358 358
 
359 359
                                                 <a href="<?php echo esc_url($editlink); ?>" class="geodir-edit"
360 360
                                                    title="<?php _e('Edit Listing', 'geodirectory'); ?>">
361 361
                                                     <?php
362
-                                                    $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
363
-                                                    echo '<i class="'. $geodir_listing_edit_icon .'"></i>';
364
-                                                    ?>
362
+													$geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
363
+													echo '<i class="'. $geodir_listing_edit_icon .'"></i>';
364
+													?>
365 365
                                                     <?php _e('Edit', 'geodirectory'); ?>
366 366
                                                 </a>
367 367
                                                 <a href="<?php echo esc_url($deletelink); ?>" class="geodir-delete"
368 368
                                                    title="<?php _e('Delete Listing', 'geodirectory'); ?>">
369 369
                                                     <?php
370
-                                                    $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
371
-                                                    echo '<i class="'. $geodir_listing_delete_icon .'"></i>';
372
-                                                    ?>
370
+													$geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
371
+													echo '<i class="'. $geodir_listing_delete_icon .'"></i>';
372
+													?>
373 373
                                                     <?php _e('Delete', 'geodirectory'); ?>
374 374
                                                 </a>
375 375
                                                 <?php
376 376
 
377
-                                                /**
378
-                                                 * Called after the edit post link on the listings view template used on the author page.
379
-                                                 *
380
-                                                 * @since 1.0.0
381
-                                                 * @see 'geodir_before_edit_post_link_on_listing'
382
-                                                 */
383
-                                                do_action('geodir_after_edit_post_link_on_listing');
384
-                                            } ?>
377
+												/**
378
+												 * Called after the edit post link on the listings view template used on the author page.
379
+												 *
380
+												 * @since 1.0.0
381
+												 * @see 'geodir_before_edit_post_link_on_listing'
382
+												 */
383
+												do_action('geodir_after_edit_post_link_on_listing');
384
+											} ?>
385 385
 											</span>
386 386
 
387 387
                                 <?php } ?>
@@ -394,32 +394,32 @@  discard block
 block discarded – undo
394 394
                 </li>
395 395
 
396 396
             <?php
397
-            endwhile;
398
-
399
-            /**
400
-             * Called inside the `ul` of the listings template, but after all `li` elements.
401
-             *
402
-             * When used by the widget view template then it will only show if there are listings to be shown.
403
-             *
404
-             * @since 1.0.0
405
-             * @see 'geodir_before_listing_post_listview'
406
-             */
407
-            do_action('geodir_after_listing_post_listview');
408
-
409
-        else:
397
+			endwhile;
398
+
399
+			/**
400
+			 * Called inside the `ul` of the listings template, but after all `li` elements.
401
+			 *
402
+			 * When used by the widget view template then it will only show if there are listings to be shown.
403
+			 *
404
+			 * @since 1.0.0
405
+			 * @see 'geodir_before_listing_post_listview'
406
+			 */
407
+			do_action('geodir_after_listing_post_listview');
408
+
409
+		else:
410 410
 			$favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false;
411 411
             
412 412
 			/**
413
-             * Called inside the `ul` of the listings template, when no listing found.
414
-             *
415
-             * @since 1.5.5
413
+			 * Called inside the `ul` of the listings template, when no listing found.
414
+			 *
415
+			 * @since 1.5.5
416 416
 			 * @param string 'listing-listview' Listing listview template.
417 417
 			 * @param bool $favorite Are favorite listings results?
418
-             */
419
-            do_action('geodir_message_not_found_on_listing', 'listing-listview', $favorite);
420
-        endif;
418
+			 */
419
+			do_action('geodir_message_not_found_on_listing', 'listing-listview', $favorite);
420
+		endif;
421 421
 
422
-        ?>
422
+		?>
423 423
     </ul>  <!-- geodir_category_list_view ends here-->
424 424
 
425 425
     <div class="clear"></div>
Please login to merge, or discard this patch.
geodirectory-templates/widget-listing-listview.php 2 patches
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -20,72 +20,72 @@  discard block
 block discarded – undo
20 20
 /** This action is documented in geodirectory-templates/listing-listview.php */
21 21
 $grid_view_class = apply_filters('geodir_grid_view_widget_columns', $gridview_columns_widget);
22 22
 if ($gd_session->get('gd_listing_view') && !isset($before_widget)) {
23
-    $grid_view_class = geodir_convert_listing_view_class($gd_session->get('gd_listing_view'));
23
+	$grid_view_class = geodir_convert_listing_view_class($gd_session->get('gd_listing_view'));
24 24
 }
25 25
 ?>
26 26
     <ul class="geodir_category_list_view clearfix <?php echo apply_filters('geodir_listing_listview_ul_extra_class', '', 'widget'); ?>">
27 27
         <?php
28
-        if (!empty($widget_listings)) {
29
-            /** This action is documented in geodirectory-templates/listing-listview.php */
30
-            do_action('geodir_before_listing_post_listview');
31
-            $all_postypes = geodir_get_posttypes();
32
-            $geodir_days_new = (int)get_option('geodir_listing_new_days');
33
-            foreach ($widget_listings as $widget_listing) {
34
-                global $gd_widget_listing_type;
35
-                $post = $widget_listing;
28
+		if (!empty($widget_listings)) {
29
+			/** This action is documented in geodirectory-templates/listing-listview.php */
30
+			do_action('geodir_before_listing_post_listview');
31
+			$all_postypes = geodir_get_posttypes();
32
+			$geodir_days_new = (int)get_option('geodir_listing_new_days');
33
+			foreach ($widget_listings as $widget_listing) {
34
+				global $gd_widget_listing_type;
35
+				$post = $widget_listing;
36 36
 
37
-                $GLOBALS['post'] = $post;
38
-                setup_postdata($post);
37
+				$GLOBALS['post'] = $post;
38
+				setup_postdata($post);
39 39
 
40
-                $gd_widget_listing_type = $post->post_type;
40
+				$gd_widget_listing_type = $post->post_type;
41 41
 
42
-                /** This action is documented in geodirectory-templates/listing-listview.php */
43
-                $post_view_class = apply_filters('geodir_post_view_extra_class', '', $all_postypes);
42
+				/** This action is documented in geodirectory-templates/listing-listview.php */
43
+				$post_view_class = apply_filters('geodir_post_view_extra_class', '', $all_postypes);
44 44
 
45
-                /** This action is documented in geodirectory-templates/listing-listview.php */
46
-                $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', '');
47
-                ?>
45
+				/** This action is documented in geodirectory-templates/listing-listview.php */
46
+				$post_view_article_class = apply_filters('geodir_post_view_article_extra_class', '');
47
+				?>
48 48
                 <li class="clearfix <?php if ($grid_view_class) {
49
-                    echo 'geodir-gridview ' . $grid_view_class;
50
-                } else {
51
-                    echo ' geodir-listview ';
52
-                } ?> <?php if ($post_view_class) {
53
-                    echo $post_view_class;
54
-                } ?>" <?php if (isset($listing_width) && $listing_width) {
55
-                    echo "style='width:{$listing_width}%;'";
56
-                }
49
+					echo 'geodir-gridview ' . $grid_view_class;
50
+				} else {
51
+					echo ' geodir-listview ';
52
+				} ?> <?php if ($post_view_class) {
53
+					echo $post_view_class;
54
+				} ?>" <?php if (isset($listing_width) && $listing_width) {
55
+					echo "style='width:{$listing_width}%;'";
56
+				}
57 57
 
58
-                echo " data-post-id='$post->ID' ";
59
-                /** This action is documented in geodirectory-templates/listing-listview.php */
60
-                do_action('geodir_listview_inside_li', $post, 'widget');
61
-                ?>>
58
+				echo " data-post-id='$post->ID' ";
59
+				/** This action is documented in geodirectory-templates/listing-listview.php */
60
+				do_action('geodir_listview_inside_li', $post, 'widget');
61
+				?>>
62 62
                     <article class="geodir-category-listing <?php if ($post_view_article_class) {
63
-                        echo $post_view_article_class;
64
-                    } ?>">
63
+						echo $post_view_article_class;
64
+					} ?>">
65 65
                         <div class="geodir-post-img <?php echo apply_filters('geodir_listing_listview_thumb_extra_class', '', 'widget'); ?>">
66 66
                             <?php if ($fimage = geodir_show_featured_image($post->ID, 'list-thumb', true, false, $post->featured_image)) { ?>
67 67
                                 <a href="<?php the_permalink(); ?>"><?php echo $fimage; ?></a>
68 68
                                 <?php
69
-                                /** This action is documented in geodirectory-templates/listing-listview.php */
70
-                                do_action('geodir_before_badge_on_image', $post);
71
-                                if ($post->is_featured) {
72
-                                    echo geodir_show_badges_on_image('featured', $post, get_permalink());
73
-                                }
69
+								/** This action is documented in geodirectory-templates/listing-listview.php */
70
+								do_action('geodir_before_badge_on_image', $post);
71
+								if ($post->is_featured) {
72
+									echo geodir_show_badges_on_image('featured', $post, get_permalink());
73
+								}
74 74
 
75 75
 
76
-                                if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
77
-                                    echo geodir_show_badges_on_image('new', $post, get_permalink());
78
-                                }
76
+								if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
77
+									echo geodir_show_badges_on_image('new', $post, get_permalink());
78
+								}
79 79
 
80
-                                /** This action is documented in geodirectory-templates/listing-listview.php */
81
-                                do_action('geodir_after_badge_on_image', $post);
82
-                            }
83
-                            ?>
80
+								/** This action is documented in geodirectory-templates/listing-listview.php */
81
+								do_action('geodir_after_badge_on_image', $post);
82
+							}
83
+							?>
84 84
                         </div>
85 85
                         <div class="geodir-content <?php echo apply_filters('geodir_listing_listview_content_extra_class', '', 'widget'); ?>">
86 86
                             <?php
87
-                            /** This action is documented in geodirectory-templates/listing-listview.php */
88
-                            do_action('geodir_before_listing_post_title', 'listview', $post); ?>
87
+							/** This action is documented in geodirectory-templates/listing-listview.php */
88
+							do_action('geodir_before_listing_post_title', 'listview', $post); ?>
89 89
                             <header class="geodir-entry-header">
90 90
                                 <h3 class="geodir-entry-title">
91 91
                                     <a href="<?php the_permalink(); ?>"
@@ -94,158 +94,158 @@  discard block
 block discarded – undo
94 94
                             </header>
95 95
                             <!-- .entry-header -->
96 96
                             <?php
97
-                            /** This action is documented in geodirectory-templates/listing-listview.php */
98
-                            do_action('geodir_after_listing_post_title', 'listview', $post); ?>
97
+							/** This action is documented in geodirectory-templates/listing-listview.php */
98
+							do_action('geodir_after_listing_post_title', 'listview', $post); ?>
99 99
                             <?php /// Print Distance
100
-                            if (isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') {
101
-                                $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']);
100
+							if (isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') {
101
+								$startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']);
102 102
 
103
-                                $endLat = $post->post_latitude;
104
-                                $endLon = $post->post_longitude;
105
-                                $endPoint = array('latitude' => $endLat, 'longitude' => $endLon);
106
-                                $uom = get_option('geodir_search_dist_1');
107
-                                $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom);
108
-                                ?>
103
+								$endLat = $post->post_latitude;
104
+								$endLon = $post->post_longitude;
105
+								$endPoint = array('latitude' => $endLat, 'longitude' => $endLon);
106
+								$uom = get_option('geodir_search_dist_1');
107
+								$distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom);
108
+								?>
109 109
                                 <h3>
110 110
                                     <?php
111
-                                    if (round($distance, 2) == 0) {
112
-                                        $uom = get_option('geodir_search_dist_2');
113
-                                        $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom);
114
-                                        if ($uom == 'feet') {
115
-                                            $uom = __('feet', 'geodirectory');
116
-                                        } else {
117
-                                            $uom = __('meters', 'geodirectory');
118
-                                        }
119
-                                        echo round($distance) . ' ' . __($uom, 'geodirectory') . '
111
+									if (round($distance, 2) == 0) {
112
+										$uom = get_option('geodir_search_dist_2');
113
+										$distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom);
114
+										if ($uom == 'feet') {
115
+											$uom = __('feet', 'geodirectory');
116
+										} else {
117
+											$uom = __('meters', 'geodirectory');
118
+										}
119
+										echo round($distance) . ' ' . __($uom, 'geodirectory') . '
120 120
 			<br />
121 121
 			';
122
-                                    } else {
123
-                                        if ($uom == 'miles') {
124
-                                            $uom = __('miles', 'geodirectory');
125
-                                        } else {
126
-                                            $uom = __('km', 'geodirectory');
127
-                                        }
128
-                                        echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . '
122
+									} else {
123
+										if ($uom == 'miles') {
124
+											$uom = __('miles', 'geodirectory');
125
+										} else {
126
+											$uom = __('km', 'geodirectory');
127
+										}
128
+										echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . '
129 129
 			<br />
130 130
 			';
131
-                                    }
132
-                                    ?>
131
+									}
132
+									?>
133 133
                                 </h3>
134 134
                             <?php } ?>
135 135
                             <?php
136
-                            /** This action is documented in geodirectory-templates/listing-listview.php */
137
-                            do_action('geodir_before_listing_post_excerpt', $post); ?>
136
+							/** This action is documented in geodirectory-templates/listing-listview.php */
137
+							do_action('geodir_before_listing_post_excerpt', $post); ?>
138 138
                             <?php echo geodir_show_listing_info('listing'); ?>
139 139
                             <?php if (isset($character_count) && $character_count == '0') {
140
-                            } else { ?>
140
+							} else { ?>
141 141
                                 <div class="geodir-entry-content">
142 142
                                     <?php
143
-                                    /**
144
-                                     * Filter to hide the listing excerpt
145
-                                     *
146
-                                     * @since 1.5.3
147
-                                     * @param bool $display Display the excerpt or not. Default true.
148
-                                     * @param object $post The post object.
149
-                                     */
150
-                                    $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post);
151
-                                    if ($show_listing_excerpt) {
152
-                                        if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
153
-                                            $content_out = geodir_max_excerpt( $character_count );
154
-                                        } else {
155
-                                            $content_out = get_the_excerpt();
156
-                                        }
157
-                                        if ( ! empty( $content_out ) ) {
158
-                                            echo "<p>" . $content_out . "</p>";
159
-                                        }
160
-                                    }
161
-                                    ?>
143
+									/**
144
+									 * Filter to hide the listing excerpt
145
+									 *
146
+									 * @since 1.5.3
147
+									 * @param bool $display Display the excerpt or not. Default true.
148
+									 * @param object $post The post object.
149
+									 */
150
+									$show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post);
151
+									if ($show_listing_excerpt) {
152
+										if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
153
+											$content_out = geodir_max_excerpt( $character_count );
154
+										} else {
155
+											$content_out = get_the_excerpt();
156
+										}
157
+										if ( ! empty( $content_out ) ) {
158
+											echo "<p>" . $content_out . "</p>";
159
+										}
160
+									}
161
+									?>
162 162
                                 </div>
163 163
                             <?php } ?>
164 164
                             <?php
165
-                            /** This action is documented in geodirectory-templates/listing-listview.php */
166
-                            do_action('geodir_after_listing_post_excerpt', $post); ?>
165
+							/** This action is documented in geodirectory-templates/listing-listview.php */
166
+							do_action('geodir_after_listing_post_excerpt', $post); ?>
167 167
                         </div>
168 168
                         <!-- gd-content ends here-->
169 169
                         <?php
170
-                        /**
171
-                         * Called after printing listing content.
172
-                         *
173
-                         * @since 1.5.3
174
-                         * @param object $post The post object.
175
-                         * @param string $view The view type, default 'widget'.
176
-                         */
177
-                        do_action( 'geodir_after_listing_content', $post, 'widget' ); ?>
170
+						/**
171
+						 * Called after printing listing content.
172
+						 *
173
+						 * @since 1.5.3
174
+						 * @param object $post The post object.
175
+						 * @param string $view The view type, default 'widget'.
176
+						 */
177
+						do_action( 'geodir_after_listing_content', $post, 'widget' ); ?>
178 178
                         <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'widget'); ?>">
179 179
                             <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'widget'); ?>">
180 180
                                 <?php
181
-                                /**
182
-                                 * Called before printing review stars html.
183
-                                 *
184
-                                 * @since 1.5.3
185
-                                 * @param object $post The post object.
186
-                                 * @param string $view The view type, default 'widget'.
187
-                                 */
188
-                                do_action( 'geodir_before_review_html', $post, 'widget' );
189
-                                $review_show = geodir_is_reviews_show('listview');
190
-                                if ($review_show) {
181
+								/**
182
+								 * Called before printing review stars html.
183
+								 *
184
+								 * @since 1.5.3
185
+								 * @param object $post The post object.
186
+								 * @param string $view The view type, default 'widget'.
187
+								 */
188
+								do_action( 'geodir_before_review_html', $post, 'widget' );
189
+								$review_show = geodir_is_reviews_show('listview');
190
+								if ($review_show) {
191 191
 
192
-                                    $post_avgratings = geodir_get_post_rating($post->ID);
192
+									$post_avgratings = geodir_get_post_rating($post->ID);
193 193
 
194
-                                    /** This action is documented in geodirectory-templates/listing-listview.php */
195
-                                    do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID);
194
+									/** This action is documented in geodirectory-templates/listing-listview.php */
195
+									do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID);
196 196
 
197
-                                    echo geodir_get_rating_stars($post_avgratings, $post->ID);
197
+									echo geodir_get_rating_stars($post_avgratings, $post->ID);
198 198
 
199
-                                    /** This action is documented in geodirectory-templates/listing-listview.php */
200
-                                    do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID);
201
-                                    ?><a href="<?php comments_link(); ?>" class="geodir-pcomments"><i
199
+									/** This action is documented in geodirectory-templates/listing-listview.php */
200
+									do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID);
201
+									?><a href="<?php comments_link(); ?>" class="geodir-pcomments"><i
202 202
                                         class="fa fa-comments"></i> <?php geodir_comments_number($post->rating_count); ?>
203 203
                                     </a>
204 204
                                 <?php
205
-                                }
205
+								}
206 206
 
207 207
 
208
-                                /**
209
-                                 * Called after printing favorite html.
210
-                                 *
211
-                                 * @since 1.0.0
212
-                                 */
213
-                                do_action( 'geodir_after_favorite_html', $post->ID, 'widget' );
208
+								/**
209
+								 * Called after printing favorite html.
210
+								 *
211
+								 * @since 1.0.0
212
+								 */
213
+								do_action( 'geodir_after_favorite_html', $post->ID, 'widget' );
214 214
 
215
-                                if ($post->post_author == get_current_user_id()) {
216
-                                    $addplacelink = get_permalink(geodir_add_listing_page_id());
217
-                                    $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false);
218
-                                    $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false);
215
+								if ($post->post_author == get_current_user_id()) {
216
+									$addplacelink = get_permalink(geodir_add_listing_page_id());
217
+									$editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false);
218
+									$upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false);
219 219
 
220
-                                    $ajaxlink = geodir_get_ajax_url();
221
-                                    $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false);
222
-                                    ?>
220
+									$ajaxlink = geodir_get_ajax_url();
221
+									$deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false);
222
+									?>
223 223
                                     <span class="geodir-authorlink clearfix">
224 224
                                 <?php
225
-                if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) {
226
-                    /** This action is documented in geodirectory-templates/listing-listview.php */
227
-                    do_action('geodir_before_edit_post_link_on_listing');
228
-                    ?>
225
+				if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) {
226
+					/** This action is documented in geodirectory-templates/listing-listview.php */
227
+					do_action('geodir_before_edit_post_link_on_listing');
228
+					?>
229 229
                     <a href="<?php echo esc_url($editlink); ?>" class="geodir-edit"
230 230
                        title="<?php _e('Edit Listing', 'geodirectory'); ?>">
231 231
                         <?php
232
-                        $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
233
-                        echo '<i class="'. $geodir_listing_edit_icon .'"></i>';
234
-                        ?>
232
+						$geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
233
+						echo '<i class="'. $geodir_listing_edit_icon .'"></i>';
234
+						?>
235 235
                         <?php _e('Edit', 'geodirectory'); ?>
236 236
                     </a>
237 237
                     <a href="<?php echo esc_url($deletelink); ?>" class="geodir-delete"
238 238
                        title="<?php _e('Delete Listing', 'geodirectory'); ?>">
239 239
                         <?php
240
-                        $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
241
-                        echo '<i class="'. $geodir_listing_delete_icon .'"></i>';
242
-                        ?>
240
+						$geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
241
+						echo '<i class="'. $geodir_listing_delete_icon .'"></i>';
242
+						?>
243 243
                         <?php _e('Delete', 'geodirectory'); ?>
244 244
                     </a>
245 245
                     <?php
246
-                    /** This action is documented in geodirectory-templates/listing-listview.php */
247
-                    do_action('geodir_after_edit_post_link_on_listing');
248
-                } ?>
246
+					/** This action is documented in geodirectory-templates/listing-listview.php */
247
+					do_action('geodir_after_edit_post_link_on_listing');
248
+				} ?>
249 249
 					</span>
250 250
                                 <?php } ?>
251 251
                             </div>
@@ -255,17 +255,17 @@  discard block
 block discarded – undo
255 255
                     </article>
256 256
                 </li>
257 257
                 <?php
258
-                unset($gd_widget_listing_type);
259
-            }
260
-            /** This action is documented in geodirectory-templates/listing-listview.php */
261
-            do_action('geodir_after_listing_post_listview');
262
-        } else {
258
+				unset($gd_widget_listing_type);
259
+			}
260
+			/** This action is documented in geodirectory-templates/listing-listview.php */
261
+			do_action('geodir_after_listing_post_listview');
262
+		} else {
263 263
 			$favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false;
264 264
             
265 265
 			/** This action is documented in geodirectory-templates/listing-listview.php */
266
-            do_action('geodir_message_not_found_on_listing', 'widget-listing-listview', $favorite);
267
-        }
268
-        ?>
266
+			do_action('geodir_message_not_found_on_listing', 'widget-listing-listview', $favorite);
267
+		}
268
+		?>
269 269
     </ul>  <!-- geodir_category_list_view ends here-->
270 270
     <div class="clear"></div>
271 271
 <?php
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             /** This action is documented in geodirectory-templates/listing-listview.php */
30 30
             do_action('geodir_before_listing_post_listview');
31 31
             $all_postypes = geodir_get_posttypes();
32
-            $geodir_days_new = (int)get_option('geodir_listing_new_days');
32
+            $geodir_days_new = (int) get_option('geodir_listing_new_days');
33 33
             foreach ($widget_listings as $widget_listing) {
34 34
                 global $gd_widget_listing_type;
35 35
                 $post = $widget_listing;
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
                 $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', '');
47 47
                 ?>
48 48
                 <li class="clearfix <?php if ($grid_view_class) {
49
-                    echo 'geodir-gridview ' . $grid_view_class;
49
+                    echo 'geodir-gridview '.$grid_view_class;
50 50
                 } else {
51 51
                     echo ' geodir-listview ';
52 52
                 } ?> <?php if ($post_view_class) {
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                                         } else {
117 117
                                             $uom = __('meters', 'geodirectory');
118 118
                                         }
119
-                                        echo round($distance) . ' ' . __($uom, 'geodirectory') . '
119
+                                        echo round($distance).' '.__($uom, 'geodirectory').'
120 120
 			<br />
121 121
 			';
122 122
                                     } else {
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                                         } else {
126 126
                                             $uom = __('km', 'geodirectory');
127 127
                                         }
128
-                                        echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . '
128
+                                        echo round($distance, 2).' '.__($uom, 'geodirectory').'
129 129
 			<br />
130 130
 			';
131 131
                                     }
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
                                      */
150 150
                                     $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post);
151 151
                                     if ($show_listing_excerpt) {
152
-                                        if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
153
-                                            $content_out = geodir_max_excerpt( $character_count );
152
+                                        if (isset($character_count) && ($character_count || $character_count == '0')) {
153
+                                            $content_out = geodir_max_excerpt($character_count);
154 154
                                         } else {
155 155
                                             $content_out = get_the_excerpt();
156 156
                                         }
157
-                                        if ( ! empty( $content_out ) ) {
158
-                                            echo "<p>" . $content_out . "</p>";
157
+                                        if (!empty($content_out)) {
158
+                                            echo "<p>".$content_out."</p>";
159 159
                                         }
160 160
                                     }
161 161
                                     ?>
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                          * @param object $post The post object.
175 175
                          * @param string $view The view type, default 'widget'.
176 176
                          */
177
-                        do_action( 'geodir_after_listing_content', $post, 'widget' ); ?>
177
+                        do_action('geodir_after_listing_content', $post, 'widget'); ?>
178 178
                         <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'widget'); ?>">
179 179
                             <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'widget'); ?>">
180 180
                                 <?php
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                                  * @param object $post The post object.
186 186
                                  * @param string $view The view type, default 'widget'.
187 187
                                  */
188
-                                do_action( 'geodir_before_review_html', $post, 'widget' );
188
+                                do_action('geodir_before_review_html', $post, 'widget');
189 189
                                 $review_show = geodir_is_reviews_show('listview');
190 190
                                 if ($review_show) {
191 191
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
                                  *
211 211
                                  * @since 1.0.0
212 212
                                  */
213
-                                do_action( 'geodir_after_favorite_html', $post->ID, 'widget' );
213
+                                do_action('geodir_after_favorite_html', $post->ID, 'widget');
214 214
 
215 215
                                 if ($post->post_author == get_current_user_id()) {
216 216
                                     $addplacelink = get_permalink(geodir_add_listing_page_id());
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                        title="<?php _e('Edit Listing', 'geodirectory'); ?>">
231 231
                         <?php
232 232
                         $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
233
-                        echo '<i class="'. $geodir_listing_edit_icon .'"></i>';
233
+                        echo '<i class="'.$geodir_listing_edit_icon.'"></i>';
234 234
                         ?>
235 235
                         <?php _e('Edit', 'geodirectory'); ?>
236 236
                     </a>
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
                        title="<?php _e('Delete Listing', 'geodirectory'); ?>">
239 239
                         <?php
240 240
                         $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
241
-                        echo '<i class="'. $geodir_listing_delete_icon .'"></i>';
241
+                        echo '<i class="'.$geodir_listing_delete_icon.'"></i>';
242 242
                         ?>
243 243
                         <?php _e('Delete', 'geodirectory'); ?>
244 244
                     </a>
Please login to merge, or discard this patch.
tests/test-Check_Maps.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -1,69 +1,69 @@
 block discarded – undo
1 1
 <?php
2 2
 class CheckMaps extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+	}
8 8
 
9
-    public function testCheckHomeMap()
10
-    {
11
-        $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]');
12
-        $this->assertContains( 'geodir-map-home-page', $output );
13
-    }
9
+	public function testCheckHomeMap()
10
+	{
11
+		$output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]');
12
+		$this->assertContains( 'geodir-map-home-page', $output );
13
+	}
14 14
 
15
-    public function testListingsPageMap()
16
-    {
17
-        $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]');
18
-        $this->assertContains( 'geodir-map-listing-page', $output );
19
-    }
15
+	public function testListingsPageMap()
16
+	{
17
+		$output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]');
18
+		$this->assertContains( 'geodir-map-listing-page', $output );
19
+	}
20 20
 
21
-    public function testDetailPageMap()
22
-    {
21
+	public function testDetailPageMap()
22
+	{
23 23
 
24
-        $query_args = array(
25
-            'post_status' => 'publish',
26
-            'post_type' => 'gd_place',
27
-            'posts_per_page' => 1,
28
-        );
24
+		$query_args = array(
25
+			'post_status' => 'publish',
26
+			'post_type' => 'gd_place',
27
+			'posts_per_page' => 1,
28
+		);
29 29
 
30
-        $all_posts = new WP_Query( $query_args );
31
-        $post_id = null;
32
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
33
-            $post_id = get_the_ID();
34
-            global $post;
35
-            $post =  geodir_get_post_info($post_id);
36
-            setup_postdata($post);
30
+		$all_posts = new WP_Query( $query_args );
31
+		$post_id = null;
32
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
33
+			$post_id = get_the_ID();
34
+			global $post;
35
+			$post =  geodir_get_post_info($post_id);
36
+			setup_postdata($post);
37 37
 
38
-            $map_args = array();
39
-            $map_args['map_canvas_name'] = 'detail_page_map_canvas';
40
-            $map_args['width'] = '600';
41
-            $map_args['height'] = '300';
42
-            if ($post->post_mapzoom) {
43
-                $map_args['zoom'] = '' . $post->post_mapzoom . '';
44
-            }
45
-            $map_args['autozoom'] = false;
46
-            $map_args['child_collapse'] = '0';
47
-            $map_args['enable_cat_filters'] = false;
48
-            $map_args['enable_text_search'] = false;
49
-            $map_args['enable_post_type_filters'] = false;
50
-            $map_args['enable_location_filters'] = false;
51
-            $map_args['enable_jason_on_load'] = true;
52
-            $map_args['enable_map_direction'] = true;
53
-            $map_args['map_class_name'] = 'geodir-map-detail-page';
54
-            $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
55
-            ob_start();
56
-            geodir_draw_map($map_args);
57
-            $output = ob_get_clean();
58
-            $this->assertContains( 'geodir-map-detail-page', $output );
59
-        endwhile;
38
+			$map_args = array();
39
+			$map_args['map_canvas_name'] = 'detail_page_map_canvas';
40
+			$map_args['width'] = '600';
41
+			$map_args['height'] = '300';
42
+			if ($post->post_mapzoom) {
43
+				$map_args['zoom'] = '' . $post->post_mapzoom . '';
44
+			}
45
+			$map_args['autozoom'] = false;
46
+			$map_args['child_collapse'] = '0';
47
+			$map_args['enable_cat_filters'] = false;
48
+			$map_args['enable_text_search'] = false;
49
+			$map_args['enable_post_type_filters'] = false;
50
+			$map_args['enable_location_filters'] = false;
51
+			$map_args['enable_jason_on_load'] = true;
52
+			$map_args['enable_map_direction'] = true;
53
+			$map_args['map_class_name'] = 'geodir-map-detail-page';
54
+			$map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
55
+			ob_start();
56
+			geodir_draw_map($map_args);
57
+			$output = ob_get_clean();
58
+			$this->assertContains( 'geodir-map-detail-page', $output );
59
+		endwhile;
60 60
 
61 61
 
62
-    }
62
+	}
63 63
 
64
-    public function tearDown()
65
-    {
66
-        parent::tearDown();
67
-    }
64
+	public function tearDown()
65
+	{
66
+		parent::tearDown();
67
+	}
68 68
 }
69 69
 ?>
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
     public function testCheckHomeMap()
10 10
     {
11 11
         $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]');
12
-        $this->assertContains( 'geodir-map-home-page', $output );
12
+        $this->assertContains('geodir-map-home-page', $output);
13 13
     }
14 14
 
15 15
     public function testListingsPageMap()
16 16
     {
17 17
         $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]');
18
-        $this->assertContains( 'geodir-map-listing-page', $output );
18
+        $this->assertContains('geodir-map-listing-page', $output);
19 19
     }
20 20
 
21 21
     public function testDetailPageMap()
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
             'posts_per_page' => 1,
28 28
         );
29 29
 
30
-        $all_posts = new WP_Query( $query_args );
30
+        $all_posts = new WP_Query($query_args);
31 31
         $post_id = null;
32
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
32
+        while ($all_posts->have_posts()) : $all_posts->the_post();
33 33
             $post_id = get_the_ID();
34 34
             global $post;
35
-            $post =  geodir_get_post_info($post_id);
35
+            $post = geodir_get_post_info($post_id);
36 36
             setup_postdata($post);
37 37
 
38 38
             $map_args = array();
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
             $map_args['width'] = '600';
41 41
             $map_args['height'] = '300';
42 42
             if ($post->post_mapzoom) {
43
-                $map_args['zoom'] = '' . $post->post_mapzoom . '';
43
+                $map_args['zoom'] = ''.$post->post_mapzoom.'';
44 44
             }
45 45
             $map_args['autozoom'] = false;
46 46
             $map_args['child_collapse'] = '0';
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             ob_start();
56 56
             geodir_draw_map($map_args);
57 57
             $output = ob_get_clean();
58
-            $this->assertContains( 'geodir-map-detail-page', $output );
58
+            $this->assertContains('geodir-map-detail-page', $output);
59 59
         endwhile;
60 60
 
61 61
 
Please login to merge, or discard this patch.
tests/test-Favourites.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
             'posts_per_page' => 1,
18 18
         );
19 19
 
20
-        $all_posts = new WP_Query( $query_args );
20
+        $all_posts = new WP_Query($query_args);
21 21
         $post_id = null;
22
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
22
+        while ($all_posts->have_posts()) : $all_posts->the_post();
23 23
             $post_id = get_the_ID();
24 24
         endwhile;
25 25
 
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
         ob_start();
29 29
         geodir_add_to_favorite($post_id);
30 30
         $output = ob_get_clean();
31
-        $this->assertContains( 'Remove from Favorites', $output );
31
+        $this->assertContains('Remove from Favorites', $output);
32 32
 
33 33
         $user_id = $current_user->ID;
34 34
 
35 35
         $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
36 36
 
37
-        $this->assertContains( $post_id, $user_fav_posts );
37
+        $this->assertContains($post_id, $user_fav_posts);
38 38
 
39 39
 
40 40
     }
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
             'posts_per_page' => 1,
50 50
         );
51 51
 
52
-        $all_posts = new WP_Query( $query_args );
52
+        $all_posts = new WP_Query($query_args);
53 53
         $post_id = null;
54
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
54
+        while ($all_posts->have_posts()) : $all_posts->the_post();
55 55
             $post_id = get_the_ID();
56 56
         endwhile;
57 57
 
@@ -60,22 +60,22 @@  discard block
 block discarded – undo
60 60
         ob_start();
61 61
         geodir_add_to_favorite($post_id);
62 62
         $output = ob_get_clean();
63
-        $this->assertContains( 'Remove from Favorites', $output );
63
+        $this->assertContains('Remove from Favorites', $output);
64 64
 
65 65
         $user_id = $current_user->ID;
66 66
 
67 67
         $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
68 68
 
69
-        $this->assertContains( $post_id, $user_fav_posts );
69
+        $this->assertContains($post_id, $user_fav_posts);
70 70
 
71 71
         ob_start();
72 72
         geodir_remove_from_favorite($post_id);
73 73
         $output = ob_get_clean();
74
-        $this->assertContains( 'Add to Favorites', $output );
74
+        $this->assertContains('Add to Favorites', $output);
75 75
 
76 76
         $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
77 77
 
78
-        $this->assertNotContains( $post_id, $user_fav_posts );
78
+        $this->assertNotContains($post_id, $user_fav_posts);
79 79
     }
80 80
 
81 81
 
Please login to merge, or discard this patch.
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -1,89 +1,89 @@
 block discarded – undo
1 1
 <?php
2 2
 class Favourites extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-        wp_set_current_user(1);
8
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+		wp_set_current_user(1);
8
+	}
9 9
 
10
-    public function testAddFavourite()
11
-    {
12
-        global $current_user;
10
+	public function testAddFavourite()
11
+	{
12
+		global $current_user;
13 13
 
14
-        $user_id = $current_user->ID;
14
+		$user_id = $current_user->ID;
15 15
 
16
-        $query_args = array(
17
-            'post_status' => 'publish',
18
-            'post_type' => 'gd_place',
19
-            'posts_per_page' => 1,
20
-        );
16
+		$query_args = array(
17
+			'post_status' => 'publish',
18
+			'post_type' => 'gd_place',
19
+			'posts_per_page' => 1,
20
+		);
21 21
 
22
-        $all_posts = new WP_Query( $query_args );
23
-        $post_id = null;
24
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
25
-            $post_id = get_the_ID();
26
-        endwhile;
22
+		$all_posts = new WP_Query( $query_args );
23
+		$post_id = null;
24
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
25
+			$post_id = get_the_ID();
26
+		endwhile;
27 27
 
28
-        $this->assertTrue(is_int($post_id));
28
+		$this->assertTrue(is_int($post_id));
29 29
 
30
-        ob_start();
31
-        geodir_add_to_favorite($post_id);
32
-        $output = ob_get_clean();
33
-        $this->assertContains( 'Remove from Favorites', $output );
30
+		ob_start();
31
+		geodir_add_to_favorite($post_id);
32
+		$output = ob_get_clean();
33
+		$this->assertContains( 'Remove from Favorites', $output );
34 34
 
35 35
 
36
-        $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
36
+		$user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
37 37
 
38
-        $this->assertContains( $post_id, $user_fav_posts );
38
+		$this->assertContains( $post_id, $user_fav_posts );
39 39
 
40 40
 
41
-    }
41
+	}
42 42
 
43
-    public function testRemoveFavourite()
44
-    {
45
-        global $current_user;
43
+	public function testRemoveFavourite()
44
+	{
45
+		global $current_user;
46 46
 
47
-        $user_id = $current_user->ID;
47
+		$user_id = $current_user->ID;
48 48
 
49
-        $query_args = array(
50
-            'post_status' => 'publish',
51
-            'post_type' => 'gd_place',
52
-            'posts_per_page' => 1,
53
-        );
49
+		$query_args = array(
50
+			'post_status' => 'publish',
51
+			'post_type' => 'gd_place',
52
+			'posts_per_page' => 1,
53
+		);
54 54
 
55
-        $all_posts = new WP_Query( $query_args );
56
-        $post_id = null;
57
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
58
-            $post_id = get_the_ID();
59
-        endwhile;
55
+		$all_posts = new WP_Query( $query_args );
56
+		$post_id = null;
57
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
58
+			$post_id = get_the_ID();
59
+		endwhile;
60 60
 
61
-        $this->assertTrue(is_int($post_id));
61
+		$this->assertTrue(is_int($post_id));
62 62
 
63
-        ob_start();
64
-        geodir_add_to_favorite($post_id);
65
-        $output = ob_get_clean();
66
-        $this->assertContains( 'Remove from Favorites', $output );
63
+		ob_start();
64
+		geodir_add_to_favorite($post_id);
65
+		$output = ob_get_clean();
66
+		$this->assertContains( 'Remove from Favorites', $output );
67 67
 
68 68
 
69
-        $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
69
+		$user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
70 70
 
71
-        $this->assertContains( $post_id, $user_fav_posts );
71
+		$this->assertContains( $post_id, $user_fav_posts );
72 72
 
73
-        ob_start();
74
-        geodir_remove_from_favorite($post_id);
75
-        $output = ob_get_clean();
76
-        $this->assertContains( 'Add to Favorites', $output );
73
+		ob_start();
74
+		geodir_remove_from_favorite($post_id);
75
+		$output = ob_get_clean();
76
+		$this->assertContains( 'Add to Favorites', $output );
77 77
 
78
-        $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
78
+		$user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
79 79
 
80
-        $this->assertNotContains( $post_id, $user_fav_posts );
81
-    }
80
+		$this->assertNotContains( $post_id, $user_fav_posts );
81
+	}
82 82
 
83 83
 
84
-    public function tearDown()
85
-    {
86
-        parent::tearDown();
87
-    }
84
+	public function tearDown()
85
+	{
86
+		parent::tearDown();
87
+	}
88 88
 }
89 89
 ?>
90 90
\ No newline at end of file
Please login to merge, or discard this patch.
tests/test-Check_PinPoint.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@
 block discarded – undo
1 1
 <?php
2 2
 class CheckPinpoint extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+	}
8 8
 
9
-    public function testCheckPinpoint()
10
-    {
9
+	public function testCheckPinpoint()
10
+	{
11 11
 
12
-    }
12
+	}
13 13
 
14
-    public function tearDown()
15
-    {
16
-        parent::tearDown();
17
-    }
14
+	public function tearDown()
15
+	{
16
+		parent::tearDown();
17
+	}
18 18
 }
19 19
 ?>
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
tests/test-Add_A_Review.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,63 +1,63 @@
 block discarded – undo
1 1
 <?php
2 2
 class AddReview extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-        wp_set_current_user(1);
8
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+		wp_set_current_user(1);
8
+	}
9 9
 
10
-    public function testAddReview()
11
-    {
12
-        $time = current_time('mysql');
10
+	public function testAddReview()
11
+	{
12
+		$time = current_time('mysql');
13 13
 
14
-        $args = array(
15
-            'listing_type' => 'gd_place',
16
-            'post_title' => 'Test Listing Title',
17
-            'post_desc' => 'Test Desc',
18
-            'post_tags' => 'test1,test2',
19
-            'post_address' => 'New York City Hall',
20
-            'post_zip' => '10007',
21
-            'post_latitude' => '40.7127837',
22
-            'post_longitude' => '-74.00594130000002',
23
-            'post_mapview' => 'ROADMAP',
24
-            'post_mapzoom' => '10',
25
-            'geodir_timing' => '10.00 am to 6 pm every day',
26
-            'geodir_contact' => '1234567890',
27
-            'geodir_email' => '[email protected]',
28
-            'geodir_website' => 'http://test.com',
29
-            'geodir_twitter' => 'http://twitter.com/test',
30
-            'geodir_facebook' => 'http://facebook.com/test',
31
-            'geodir_special_offers' => 'Test offer'
32
-        );
33
-        $post_id = geodir_save_listing($args, true);
14
+		$args = array(
15
+			'listing_type' => 'gd_place',
16
+			'post_title' => 'Test Listing Title',
17
+			'post_desc' => 'Test Desc',
18
+			'post_tags' => 'test1,test2',
19
+			'post_address' => 'New York City Hall',
20
+			'post_zip' => '10007',
21
+			'post_latitude' => '40.7127837',
22
+			'post_longitude' => '-74.00594130000002',
23
+			'post_mapview' => 'ROADMAP',
24
+			'post_mapzoom' => '10',
25
+			'geodir_timing' => '10.00 am to 6 pm every day',
26
+			'geodir_contact' => '1234567890',
27
+			'geodir_email' => '[email protected]',
28
+			'geodir_website' => 'http://test.com',
29
+			'geodir_twitter' => 'http://twitter.com/test',
30
+			'geodir_facebook' => 'http://facebook.com/test',
31
+			'geodir_special_offers' => 'Test offer'
32
+		);
33
+		$post_id = geodir_save_listing($args, true);
34 34
 
35
-        $data = array(
36
-            'comment_post_ID' => $post_id,
37
-            'comment_author' => 'admin',
38
-            'comment_author_email' => '[email protected]',
39
-            'comment_author_url' => 'http://wpgeodirectory.com',
40
-            'comment_content' => 'content here',
41
-            'comment_type' => '',
42
-            'comment_parent' => 0,
43
-            'user_id' => 1,
44
-            'comment_author_IP' => '127.0.0.1',
45
-            'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
46
-            'comment_date' => $time,
47
-            'comment_approved' => 1,
48
-        );
35
+		$data = array(
36
+			'comment_post_ID' => $post_id,
37
+			'comment_author' => 'admin',
38
+			'comment_author_email' => '[email protected]',
39
+			'comment_author_url' => 'http://wpgeodirectory.com',
40
+			'comment_content' => 'content here',
41
+			'comment_type' => '',
42
+			'comment_parent' => 0,
43
+			'user_id' => 1,
44
+			'comment_author_IP' => '127.0.0.1',
45
+			'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
46
+			'comment_date' => $time,
47
+			'comment_approved' => 1,
48
+		);
49 49
 
50
-        $comment_id = wp_insert_comment($data);
50
+		$comment_id = wp_insert_comment($data);
51 51
 
52
-        $_REQUEST['geodir_overallrating'] = 5.0;
53
-        geodir_save_rating($comment_id);
52
+		$_REQUEST['geodir_overallrating'] = 5.0;
53
+		geodir_save_rating($comment_id);
54 54
 
55
-        $this->assertTrue(is_int($comment_id));
56
-    }
55
+		$this->assertTrue(is_int($comment_id));
56
+	}
57 57
 
58
-    public function tearDown()
59
-    {
60
-        parent::tearDown();
61
-    }
58
+	public function tearDown()
59
+	{
60
+		parent::tearDown();
61
+	}
62 62
 }
63 63
 ?>
64 64
\ No newline at end of file
Please login to merge, or discard this patch.
tests/test-Send_Enquiry.php 2 patches
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -1,116 +1,116 @@
 block discarded – undo
1 1
 <?php
2 2
 class SendEnquiry extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-    }
8
-
9
-    public function testSendEnquiry()
10
-    {
11
-        $query_args = array(
12
-            'post_status' => 'publish',
13
-            'post_type' => 'gd_place',
14
-            'posts_per_page' => 1,
15
-        );
16
-
17
-        $all_posts = new WP_Query( $query_args );
18
-        $post_id = null;
19
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
20
-            $post_id = get_the_ID();
21
-        endwhile;
22
-
23
-        $this->assertTrue(is_int($post_id));
24
-
25
-        $data = array(
26
-            'sendact' => 'send_inqury',
27
-            'pid' => (string) $post_id,
28
-            'inq_name' => 'Test User',
29
-            'inq_email' => '[email protected]',
30
-            'inq_phone' => 'Test',
31
-            'inq_msg' => 'Hi there, I would like to enquire about this place. I would like to ask more info about...',
32
-            'Send' => 'Send'
33
-        );
34
-
35
-        add_filter('wp_redirect', '__return_false');
36
-        geodir_send_inquiry($data);
37
-        remove_filter('wp_redirect', '__return_false');
38
-    }
39
-
40
-    public function testSendToFriend()
41
-    {
42
-        $query_args = array(
43
-            'post_status' => 'publish',
44
-            'post_type' => 'gd_place',
45
-            'posts_per_page' => 1,
46
-        );
47
-
48
-        $all_posts = new WP_Query( $query_args );
49
-        $post_id = null;
50
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
51
-            $post_id = get_the_ID();
52
-        endwhile;
53
-
54
-        $this->assertTrue(is_int($post_id));
55
-
56
-        $data = array(
57
-            'sendact' => 'email_frnd',
58
-            'pid' => (string) $post_id,
59
-            'yourname' => 'Test User',
60
-            'youremail' => '[email protected]',
61
-            'frnd_subject' => 'Test',
62
-            'frnd_comments' => 'Hi there, This is a comment',
63
-            'to_email' => '[email protected]',
64
-            'to_name' => 'Test User 2',
65
-            'Send' => 'Send'
66
-        );
67
-
68
-        add_filter('wp_redirect', '__return_false');
69
-        geodir_send_friend($data);
70
-        remove_filter('wp_redirect', '__return_false');
71
-    }
72
-
73
-    public function texstSendToFriendFailure()
74
-    {
75
-        $query_args = array(
76
-            'post_status' => 'publish',
77
-            'post_type' => 'gd_place',
78
-            'posts_per_page' => 1,
79
-        );
80
-
81
-        $all_posts = new WP_Query( $query_args );
82
-        $post_id = null;
83
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
84
-            $post_id = get_the_ID();
85
-        endwhile;
86
-
87
-        $this->assertTrue(is_int($post_id));
88
-
89
-        $data = array(
90
-            'sendact' => 'email_frnd',
91
-            'pid' => (string) $post_id,
92
-            'yourname' => 'Test User',
93
-            'youremail' => '[email protected]',
94
-            'frnd_subject' => 'Test',
95
-            'frnd_comments' => 'Hi there, This is a comment',
96
-            'to_email' => 'Test User 2', //incorrect email
97
-            'to_name' => '[email protected]',
98
-            'Send' => 'Send'
99
-        );
100
-
101
-        add_filter('wp_redirect', '__return_false');
102
-        add_filter('wp_mail', 'print_mail');
103
-        ob_start();
104
-        geodir_send_friend($data);
105
-        $output = ob_get_clean();
106
-        $this->assertContains( 'Email from GeoDirectory failed to send', $output );
107
-        remove_filter('wp_mail', 'print_mail');
108
-        remove_filter('wp_redirect', '__return_false');
109
-    }
110
-
111
-    public function tearDown()
112
-    {
113
-        parent::tearDown();
114
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+	}
8
+
9
+	public function testSendEnquiry()
10
+	{
11
+		$query_args = array(
12
+			'post_status' => 'publish',
13
+			'post_type' => 'gd_place',
14
+			'posts_per_page' => 1,
15
+		);
16
+
17
+		$all_posts = new WP_Query( $query_args );
18
+		$post_id = null;
19
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
20
+			$post_id = get_the_ID();
21
+		endwhile;
22
+
23
+		$this->assertTrue(is_int($post_id));
24
+
25
+		$data = array(
26
+			'sendact' => 'send_inqury',
27
+			'pid' => (string) $post_id,
28
+			'inq_name' => 'Test User',
29
+			'inq_email' => '[email protected]',
30
+			'inq_phone' => 'Test',
31
+			'inq_msg' => 'Hi there, I would like to enquire about this place. I would like to ask more info about...',
32
+			'Send' => 'Send'
33
+		);
34
+
35
+		add_filter('wp_redirect', '__return_false');
36
+		geodir_send_inquiry($data);
37
+		remove_filter('wp_redirect', '__return_false');
38
+	}
39
+
40
+	public function testSendToFriend()
41
+	{
42
+		$query_args = array(
43
+			'post_status' => 'publish',
44
+			'post_type' => 'gd_place',
45
+			'posts_per_page' => 1,
46
+		);
47
+
48
+		$all_posts = new WP_Query( $query_args );
49
+		$post_id = null;
50
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
51
+			$post_id = get_the_ID();
52
+		endwhile;
53
+
54
+		$this->assertTrue(is_int($post_id));
55
+
56
+		$data = array(
57
+			'sendact' => 'email_frnd',
58
+			'pid' => (string) $post_id,
59
+			'yourname' => 'Test User',
60
+			'youremail' => '[email protected]',
61
+			'frnd_subject' => 'Test',
62
+			'frnd_comments' => 'Hi there, This is a comment',
63
+			'to_email' => '[email protected]',
64
+			'to_name' => 'Test User 2',
65
+			'Send' => 'Send'
66
+		);
67
+
68
+		add_filter('wp_redirect', '__return_false');
69
+		geodir_send_friend($data);
70
+		remove_filter('wp_redirect', '__return_false');
71
+	}
72
+
73
+	public function texstSendToFriendFailure()
74
+	{
75
+		$query_args = array(
76
+			'post_status' => 'publish',
77
+			'post_type' => 'gd_place',
78
+			'posts_per_page' => 1,
79
+		);
80
+
81
+		$all_posts = new WP_Query( $query_args );
82
+		$post_id = null;
83
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
84
+			$post_id = get_the_ID();
85
+		endwhile;
86
+
87
+		$this->assertTrue(is_int($post_id));
88
+
89
+		$data = array(
90
+			'sendact' => 'email_frnd',
91
+			'pid' => (string) $post_id,
92
+			'yourname' => 'Test User',
93
+			'youremail' => '[email protected]',
94
+			'frnd_subject' => 'Test',
95
+			'frnd_comments' => 'Hi there, This is a comment',
96
+			'to_email' => 'Test User 2', //incorrect email
97
+			'to_name' => '[email protected]',
98
+			'Send' => 'Send'
99
+		);
100
+
101
+		add_filter('wp_redirect', '__return_false');
102
+		add_filter('wp_mail', 'print_mail');
103
+		ob_start();
104
+		geodir_send_friend($data);
105
+		$output = ob_get_clean();
106
+		$this->assertContains( 'Email from GeoDirectory failed to send', $output );
107
+		remove_filter('wp_mail', 'print_mail');
108
+		remove_filter('wp_redirect', '__return_false');
109
+	}
110
+
111
+	public function tearDown()
112
+	{
113
+		parent::tearDown();
114
+	}
115 115
 }
116 116
 ?>
117 117
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
             'posts_per_page' => 1,
15 15
         );
16 16
 
17
-        $all_posts = new WP_Query( $query_args );
17
+        $all_posts = new WP_Query($query_args);
18 18
         $post_id = null;
19
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
19
+        while ($all_posts->have_posts()) : $all_posts->the_post();
20 20
             $post_id = get_the_ID();
21 21
         endwhile;
22 22
 
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
             'posts_per_page' => 1,
46 46
         );
47 47
 
48
-        $all_posts = new WP_Query( $query_args );
48
+        $all_posts = new WP_Query($query_args);
49 49
         $post_id = null;
50
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
50
+        while ($all_posts->have_posts()) : $all_posts->the_post();
51 51
             $post_id = get_the_ID();
52 52
         endwhile;
53 53
 
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
             'posts_per_page' => 1,
79 79
         );
80 80
 
81
-        $all_posts = new WP_Query( $query_args );
81
+        $all_posts = new WP_Query($query_args);
82 82
         $post_id = null;
83
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
83
+        while ($all_posts->have_posts()) : $all_posts->the_post();
84 84
             $post_id = get_the_ID();
85 85
         endwhile;
86 86
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         ob_start();
104 104
         geodir_send_friend($data);
105 105
         $output = ob_get_clean();
106
-        $this->assertContains( 'Email from GeoDirectory failed to send', $output );
106
+        $this->assertContains('Email from GeoDirectory failed to send', $output);
107 107
         remove_filter('wp_mail', 'print_mail');
108 108
         remove_filter('wp_redirect', '__return_false');
109 109
     }
Please login to merge, or discard this patch.
tests/lib/wordpress-tests-lib/includes/wp-profiler.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		// reset the wpdb queries log, storing it on the profile stack if necessary
41 41
 		global $wpdb;
42 42
 		if ($this->stack) {
43
-			$this->stack[count($this->stack)-1]['queries'] = $wpdb->queries;
43
+			$this->stack[count($this->stack) - 1]['queries'] = $wpdb->queries;
44 44
 		}
45 45
 		$wpdb->queries = array();
46 46
 
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 
75 75
 		if (isset($this->profile[$name])) {
76 76
 			$this->profile[$name]['time'] += $time;
77
-			$this->profile[$name]['calls'] ++;
77
+			$this->profile[$name]['calls']++;
78 78
 			$this->profile[$name]['cache_cold_hits'] += ($wp_object_cache->cold_cache_hits - $item['cache_cold_hits']);
79 79
 			$this->profile[$name]['cache_warm_hits'] += ($wp_object_cache->warm_cache_hits - $item['cache_warm_hits']);
80 80
 			$this->profile[$name]['cache_misses'] += ($wp_object_cache->cache_misses - $item['cache_misses']);
81
-			$this->profile[$name]['cache_dirty_objects'] = array_add( $this->profile[$name]['cache_dirty_objects'], $cache_dirty_delta) ;
82
-			$this->profile[$name]['actions'] = array_add( $this->profile[$name]['actions'], $item['actions'] );
83
-			$this->profile[$name]['filters'] = array_add( $this->profile[$name]['filters'], $item['filters'] );
84
-			$this->profile[$name]['queries'] = array_add( $this->profile[$name]['queries'], $item['queries'] );
81
+			$this->profile[$name]['cache_dirty_objects'] = array_add($this->profile[$name]['cache_dirty_objects'], $cache_dirty_delta);
82
+			$this->profile[$name]['actions'] = array_add($this->profile[$name]['actions'], $item['actions']);
83
+			$this->profile[$name]['filters'] = array_add($this->profile[$name]['filters'], $item['filters']);
84
+			$this->profile[$name]['queries'] = array_add($this->profile[$name]['queries'], $item['queries']);
85 85
 			#$this->_query_summary($item['queries'], $this->profile[$name]['queries']);
86 86
 
87 87
 		}
@@ -109,28 +109,28 @@  discard block
 block discarded – undo
109 109
 
110 110
 	function microtime($since = 0.0) {
111 111
 		list($usec, $sec) = explode(' ', microtime());
112
-		return (float)$sec + (float)$usec - $since;
112
+		return (float) $sec + (float) $usec - $since;
113 113
 	}
114 114
 
115 115
 	function log_filter($tag) {
116 116
 		if ($this->stack) {
117 117
 			global $wp_actions;
118 118
 			if ($tag == end($wp_actions))
119
-				@$this->stack[count($this->stack)-1]['actions'][$tag] ++;
119
+				@$this->stack[count($this->stack) - 1]['actions'][$tag]++;
120 120
 			else
121
-				@$this->stack[count($this->stack)-1]['filters'][$tag] ++;
121
+				@$this->stack[count($this->stack) - 1]['filters'][$tag]++;
122 122
 		}
123 123
 		return $arg;
124 124
 	}
125 125
 
126 126
 	function log_action($tag) {
127 127
 		if ($this->stack)
128
-			@$this->stack[count($this->stack)-1]['actions'][$tag] ++;
128
+			@$this->stack[count($this->stack) - 1]['actions'][$tag]++;
129 129
 	}
130 130
 
131 131
 	function _current_action() {
132 132
 		global $wp_actions;
133
-		return $wp_actions[count($wp_actions)-1];
133
+		return $wp_actions[count($wp_actions) - 1];
134 134
 	}
135 135
 
136 136
 	function results() {
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 			$sql = preg_replace('/(WHERE \w+ =) \d+/', '$1 x', $sql);
144 144
 			$sql = preg_replace('/(WHERE \w+ =) \'\[-\w]+\'/', '$1 \'xxx\'', $sql);
145 145
 
146
-			@$out[$sql] ++;
146
+			@$out[$sql]++;
147 147
 		}
148 148
 		asort($out);
149 149
 		return;
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
 		$out = array();
155 155
 		foreach ($queries as $q) {
156 156
 			if (empty($q[2]))
157
-				@$out['unknown'] ++;
157
+				@$out['unknown']++;
158 158
 			else
159
-				@$out[$q[2]] ++;
159
+				@$out[$q[2]]++;
160 160
 		}
161 161
 		return $out;
162 162
 	}
Please login to merge, or discard this patch.
Braces   +26 added lines, -20 removed lines patch added patch discarded remove patch
@@ -84,8 +84,7 @@  discard block
 block discarded – undo
84 84
 			$this->profile[$name]['queries'] = array_add( $this->profile[$name]['queries'], $item['queries'] );
85 85
 			#$this->_query_summary($item['queries'], $this->profile[$name]['queries']);
86 86
 
87
-		}
88
-		else {
87
+		} else {
89 88
 			$queries = array();
90 89
 			$this->_query_summary($item['queries'], $queries);
91 90
 			$this->profile[$name] = array(
@@ -115,17 +114,19 @@  discard block
 block discarded – undo
115 114
 	function log_filter($tag) {
116 115
 		if ($this->stack) {
117 116
 			global $wp_actions;
118
-			if ($tag == end($wp_actions))
119
-				@$this->stack[count($this->stack)-1]['actions'][$tag] ++;
120
-			else
121
-				@$this->stack[count($this->stack)-1]['filters'][$tag] ++;
117
+			if ($tag == end($wp_actions)) {
118
+							@$this->stack[count($this->stack)-1]['actions'][$tag] ++;
119
+			} else {
120
+							@$this->stack[count($this->stack)-1]['filters'][$tag] ++;
121
+			}
122 122
 		}
123 123
 		return $arg;
124 124
 	}
125 125
 
126 126
 	function log_action($tag) {
127
-		if ($this->stack)
128
-			@$this->stack[count($this->stack)-1]['actions'][$tag] ++;
127
+		if ($this->stack) {
128
+					@$this->stack[count($this->stack)-1]['actions'][$tag] ++;
129
+		}
129 130
 	}
130 131
 
131 132
 	function _current_action() {
@@ -153,36 +154,41 @@  discard block
 block discarded – undo
153 154
 		// this requires the savequeries patch at https://core.trac.wordpress.org/ticket/5218
154 155
 		$out = array();
155 156
 		foreach ($queries as $q) {
156
-			if (empty($q[2]))
157
-				@$out['unknown'] ++;
158
-			else
159
-				@$out[$q[2]] ++;
157
+			if (empty($q[2])) {
158
+							@$out['unknown'] ++;
159
+			} else {
160
+							@$out[$q[2]] ++;
161
+			}
160 162
 		}
161 163
 		return $out;
162 164
 	}
163 165
 
164 166
 	function _dirty_objects_count($dirty_objects) {
165 167
 		$out = array();
166
-		foreach (array_keys($dirty_objects) as $group)
167
-			$out[$group] = count($dirty_objects[$group]);
168
+		foreach (array_keys($dirty_objects) as $group) {
169
+					$out[$group] = count($dirty_objects[$group]);
170
+		}
168 171
 		return $out;
169 172
 	}
170 173
 
171 174
 	function array_add($a, $b) {
172 175
 		$out = $a;
173
-		foreach (array_keys($b) as $key)
174
-			if (array_key_exists($key, $out))
176
+		foreach (array_keys($b) as $key) {
177
+					if (array_key_exists($key, $out))
175 178
 				$out[$key] += $b[$key];
176
-			else
177
-				$out[$key] = $b[$key];
179
+		}
180
+			else {
181
+							$out[$key] = $b[$key];
182
+			}
178 183
 		return $out;
179 184
 	}
180 185
 
181 186
 	function array_sub($a, $b) {
182 187
 		$out = $a;
183
-		foreach (array_keys($b) as $key)
184
-			if (array_key_exists($key, $b))
188
+		foreach (array_keys($b) as $key) {
189
+					if (array_key_exists($key, $b))
185 190
 				$out[$key] -= $b[$key];
191
+		}
186 192
 		return $out;
187 193
 	}
188 194
 
Please login to merge, or discard this patch.
tests/lib/wordpress-tests-lib/includes/speed-trap-listener.php 2 patches
Indentation   +317 added lines, -317 removed lines patch added patch discarded remove patch
@@ -6,321 +6,321 @@
 block discarded – undo
6 6
  */
7 7
 class SpeedTrapListener implements PHPUnit_Framework_TestListener
8 8
 {
9
-    /**
10
-     * Internal tracking for test suites.
11
-     *
12
-     * Increments as more suites are run, then decremented as they finish. All
13
-     * suites have been run when returns to 0.
14
-     *
15
-     * @var integer
16
-     */
17
-    protected $suites = 0;
18
-
19
-    /**
20
-     * Time in milliseconds at which a test will be considered "slow" and be
21
-     * reported by this listener.
22
-     *
23
-     * @var int
24
-     */
25
-    protected $slowThreshold;
26
-
27
-    /**
28
-     * Number of tests to report on for slowness.
29
-     *
30
-     * @var int
31
-     */
32
-    protected $reportLength;
33
-
34
-    /**
35
-     * Collection of slow tests.
36
-     *
37
-     * @var array
38
-     */
39
-    protected $slow = array();
40
-
41
-    /**
42
-     * Construct a new instance.
43
-     *
44
-     * @param array $options
45
-     */
46
-    public function __construct(array $options = array())
47
-    {
48
-        $this->loadOptions($options);
49
-    }
50
-
51
-    /**
52
-     * An error occurred.
53
-     *
54
-     * @param PHPUnit_Framework_Test $test
55
-     * @param Exception              $e
56
-     * @param float                   $time
57
-     */
58
-    public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
59
-    {
60
-    }
61
-
62
-    /**
63
-     * A warning occurred.
64
-     *
65
-     * @param PHPUnit_Framework_Test    $test
66
-     * @param PHPUnit_Framework_Warning $e
67
-     * @param float                     $time
68
-     * @since Method available since Release 5.1.0
69
-     */
70
-    public function addWarning(PHPUnit_Framework_Test $test, PHPUnit_Framework_Warning $e, $time)
71
-    {
72
-    }
73
-
74
-    /**
75
-     * A failure occurred.
76
-     *
77
-     * @param PHPUnit_Framework_Test                 $test
78
-     * @param PHPUnit_Framework_AssertionFailedError $e
79
-     * @param float                                   $time
80
-     */
81
-    public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
82
-    {
83
-    }
84
-
85
-    /**
86
-     * Incomplete test.
87
-     *
88
-     * @param PHPUnit_Framework_Test $test
89
-     * @param Exception              $e
90
-     * @param float                   $time
91
-     */
92
-    public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
93
-    {
94
-    }
95
-
96
-    /**
97
-     * Risky test.
98
-     *
99
-     * @param PHPUnit_Framework_Test $test
100
-     * @param Exception              $e
101
-     * @param float                   $time
102
-     * @since  Method available since Release 4.0.0
103
-     */
104
-    public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time)
105
-    {
106
-    }
107
-
108
-    /**
109
-     * Skipped test.
110
-     *
111
-     * @param PHPUnit_Framework_Test $test
112
-     * @param Exception              $e
113
-     * @param float                   $time
114
-     */
115
-    public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
116
-    {
117
-    }
118
-
119
-    /**
120
-     * A test started.
121
-     *
122
-     * @param PHPUnit_Framework_Test $test
123
-     */
124
-    public function startTest(PHPUnit_Framework_Test $test)
125
-    {
126
-    }
127
-
128
-    /**
129
-     * A test ended.
130
-     *
131
-     * @param PHPUnit_Framework_Test $test
132
-     * @param float                   $time
133
-     */
134
-    public function endTest(PHPUnit_Framework_Test $test, $time)
135
-    {
136
-        if (!$test instanceof PHPUnit_Framework_TestCase) return;
137
-
138
-        $time = $this->toMilliseconds($time);
139
-        $threshold = $this->getSlowThreshold($test);
140
-
141
-        if ($this->isSlow($time, $threshold)) {
142
-            $this->addSlowTest($test, $time);
143
-        }
144
-    }
145
-
146
-    /**
147
-     * A test suite started.
148
-     *
149
-     * @param PHPUnit_Framework_TestSuite $suite
150
-     */
151
-    public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
152
-    {
153
-        $this->suites++;
154
-    }
155
-
156
-    /**
157
-     * A test suite ended.
158
-     *
159
-     * @param PHPUnit_Framework_TestSuite $suite
160
-     */
161
-    public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
162
-    {
163
-        $this->suites--;
164
-
165
-        if (0 === $this->suites && $this->hasSlowTests()) {
166
-            arsort($this->slow); // Sort longest running tests to the top
167
-
168
-            $this->renderHeader();
169
-            $this->renderBody();
170
-            $this->renderFooter();
171
-        }
172
-    }
173
-
174
-    /**
175
-     * Whether the given test execution time is considered slow.
176
-     *
177
-     * @param int $time          Test execution time in milliseconds
178
-     * @param int $slowThreshold Test execution time at which a test should be considered slow (milliseconds)
179
-     * @return bool
180
-     */
181
-    protected function isSlow($time, $slowThreshold)
182
-    {
183
-        return $time >= $slowThreshold;
184
-    }
185
-
186
-    /**
187
-     * Stores a test as slow.
188
-     *
189
-     * @param PHPUnit_Framework_TestCase $test
190
-     * @param int                         $time Test execution time in milliseconds
191
-     */
192
-    protected function addSlowTest(PHPUnit_Framework_TestCase $test, $time)
193
-    {
194
-        $label = $this->makeLabel($test);
195
-
196
-        $this->slow[$label] = $time;
197
-    }
198
-
199
-    /**
200
-     * Whether at least one test has been considered slow.
201
-     *
202
-     * @return bool
203
-     */
204
-    protected function hasSlowTests()
205
-    {
206
-        return !empty($this->slow);
207
-    }
208
-
209
-    /**
210
-     * Convert PHPUnit's reported test time (microseconds) to milliseconds.
211
-     *
212
-     * @param float $time
213
-     * @return int
214
-     */
215
-    protected function toMilliseconds($time)
216
-    {
217
-        return (int) round($time * 1000);
218
-    }
219
-
220
-    /**
221
-     * Label for describing a test.
222
-     *
223
-     * @param PHPUnit_Framework_TestCase $test
224
-     * @return string
225
-     */
226
-    protected function makeLabel(PHPUnit_Framework_TestCase $test)
227
-    {
228
-        return sprintf('%s:%s', get_class($test), $test->getName());
229
-    }
230
-
231
-    /**
232
-     * Calculate number of slow tests to report about.
233
-     *
234
-     * @return int
235
-     */
236
-    protected function getReportLength()
237
-    {
238
-        return min(count($this->slow), $this->reportLength);
239
-    }
240
-
241
-    /**
242
-     * Find how many slow tests occurred that won't be shown due to list length.
243
-     *
244
-     * @return int Number of hidden slow tests
245
-     */
246
-    protected function getHiddenCount()
247
-    {
248
-        $total = count($this->slow);
249
-        $showing = $this->getReportLength($this->slow);
250
-
251
-        $hidden = 0;
252
-        if ($total > $showing) {
253
-            $hidden = $total - $showing;
254
-        }
255
-
256
-        return $hidden;
257
-    }
258
-
259
-    /**
260
-     * Renders slow test report header.
261
-     */
262
-    protected function renderHeader()
263
-    {
264
-        echo sprintf("\n\nYou should really fix these slow tests (>%sms)...\n", $this->slowThreshold);
265
-    }
266
-
267
-    /**
268
-     * Renders slow test report body.
269
-     */
270
-    protected function renderBody()
271
-    {
272
-        $slowTests = $this->slow;
273
-
274
-        $length = $this->getReportLength($slowTests);
275
-        for ($i = 1; $i <= $length; ++$i) {
276
-            $label = key($slowTests);
277
-            $time = array_shift($slowTests);
278
-
279
-            echo sprintf(" %s. %sms to run %s\n", $i, $time, $label);
280
-        }
281
-    }
282
-
283
-    /**
284
-     * Renders slow test report footer.
285
-     */
286
-    protected function renderFooter()
287
-    {
288
-        if ($hidden = $this->getHiddenCount($this->slow)) {
289
-            echo sprintf("...and there %s %s more above your threshold hidden from view", $hidden == 1 ? 'is' : 'are', $hidden);
290
-        }
291
-    }
292
-
293
-    /**
294
-     * Populate options into class internals.
295
-     *
296
-     * @param array $options
297
-     */
298
-    protected function loadOptions(array $options)
299
-    {
300
-        $this->slowThreshold = isset($options['slowThreshold']) ? $options['slowThreshold'] : 500;
301
-        $this->reportLength = isset($options['reportLength']) ? $options['reportLength'] : 10;
302
-    }
303
-
304
-    /**
305
-     * Get slow test threshold for given test. A TestCase can override the
306
-     * suite-wide slow threshold by using the annotation @slowThreshold with
307
-     * the threshold value in milliseconds.
308
-     *
309
-     * The following test will only be considered slow when its execution time
310
-     * reaches 5000ms (5 seconds):
311
-     *
312
-     * <code>
313
-     * @slowThreshold 5000
314
-     * public function testLongRunningProcess() {}
315
-     * </code>
316
-     *
317
-     * @param PHPUnit_Framework_TestCase $test
318
-     * @return int
319
-     */
320
-    protected function getSlowThreshold(PHPUnit_Framework_TestCase $test)
321
-    {
322
-        $ann = $test->getAnnotations();
323
-
324
-        return isset($ann['method']['slowThreshold'][0]) ? $ann['method']['slowThreshold'][0] : $this->slowThreshold;
325
-    }
9
+	/**
10
+	 * Internal tracking for test suites.
11
+	 *
12
+	 * Increments as more suites are run, then decremented as they finish. All
13
+	 * suites have been run when returns to 0.
14
+	 *
15
+	 * @var integer
16
+	 */
17
+	protected $suites = 0;
18
+
19
+	/**
20
+	 * Time in milliseconds at which a test will be considered "slow" and be
21
+	 * reported by this listener.
22
+	 *
23
+	 * @var int
24
+	 */
25
+	protected $slowThreshold;
26
+
27
+	/**
28
+	 * Number of tests to report on for slowness.
29
+	 *
30
+	 * @var int
31
+	 */
32
+	protected $reportLength;
33
+
34
+	/**
35
+	 * Collection of slow tests.
36
+	 *
37
+	 * @var array
38
+	 */
39
+	protected $slow = array();
40
+
41
+	/**
42
+	 * Construct a new instance.
43
+	 *
44
+	 * @param array $options
45
+	 */
46
+	public function __construct(array $options = array())
47
+	{
48
+		$this->loadOptions($options);
49
+	}
50
+
51
+	/**
52
+	 * An error occurred.
53
+	 *
54
+	 * @param PHPUnit_Framework_Test $test
55
+	 * @param Exception              $e
56
+	 * @param float                   $time
57
+	 */
58
+	public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
59
+	{
60
+	}
61
+
62
+	/**
63
+	 * A warning occurred.
64
+	 *
65
+	 * @param PHPUnit_Framework_Test    $test
66
+	 * @param PHPUnit_Framework_Warning $e
67
+	 * @param float                     $time
68
+	 * @since Method available since Release 5.1.0
69
+	 */
70
+	public function addWarning(PHPUnit_Framework_Test $test, PHPUnit_Framework_Warning $e, $time)
71
+	{
72
+	}
73
+
74
+	/**
75
+	 * A failure occurred.
76
+	 *
77
+	 * @param PHPUnit_Framework_Test                 $test
78
+	 * @param PHPUnit_Framework_AssertionFailedError $e
79
+	 * @param float                                   $time
80
+	 */
81
+	public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
82
+	{
83
+	}
84
+
85
+	/**
86
+	 * Incomplete test.
87
+	 *
88
+	 * @param PHPUnit_Framework_Test $test
89
+	 * @param Exception              $e
90
+	 * @param float                   $time
91
+	 */
92
+	public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
93
+	{
94
+	}
95
+
96
+	/**
97
+	 * Risky test.
98
+	 *
99
+	 * @param PHPUnit_Framework_Test $test
100
+	 * @param Exception              $e
101
+	 * @param float                   $time
102
+	 * @since  Method available since Release 4.0.0
103
+	 */
104
+	public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time)
105
+	{
106
+	}
107
+
108
+	/**
109
+	 * Skipped test.
110
+	 *
111
+	 * @param PHPUnit_Framework_Test $test
112
+	 * @param Exception              $e
113
+	 * @param float                   $time
114
+	 */
115
+	public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
116
+	{
117
+	}
118
+
119
+	/**
120
+	 * A test started.
121
+	 *
122
+	 * @param PHPUnit_Framework_Test $test
123
+	 */
124
+	public function startTest(PHPUnit_Framework_Test $test)
125
+	{
126
+	}
127
+
128
+	/**
129
+	 * A test ended.
130
+	 *
131
+	 * @param PHPUnit_Framework_Test $test
132
+	 * @param float                   $time
133
+	 */
134
+	public function endTest(PHPUnit_Framework_Test $test, $time)
135
+	{
136
+		if (!$test instanceof PHPUnit_Framework_TestCase) return;
137
+
138
+		$time = $this->toMilliseconds($time);
139
+		$threshold = $this->getSlowThreshold($test);
140
+
141
+		if ($this->isSlow($time, $threshold)) {
142
+			$this->addSlowTest($test, $time);
143
+		}
144
+	}
145
+
146
+	/**
147
+	 * A test suite started.
148
+	 *
149
+	 * @param PHPUnit_Framework_TestSuite $suite
150
+	 */
151
+	public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
152
+	{
153
+		$this->suites++;
154
+	}
155
+
156
+	/**
157
+	 * A test suite ended.
158
+	 *
159
+	 * @param PHPUnit_Framework_TestSuite $suite
160
+	 */
161
+	public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
162
+	{
163
+		$this->suites--;
164
+
165
+		if (0 === $this->suites && $this->hasSlowTests()) {
166
+			arsort($this->slow); // Sort longest running tests to the top
167
+
168
+			$this->renderHeader();
169
+			$this->renderBody();
170
+			$this->renderFooter();
171
+		}
172
+	}
173
+
174
+	/**
175
+	 * Whether the given test execution time is considered slow.
176
+	 *
177
+	 * @param int $time          Test execution time in milliseconds
178
+	 * @param int $slowThreshold Test execution time at which a test should be considered slow (milliseconds)
179
+	 * @return bool
180
+	 */
181
+	protected function isSlow($time, $slowThreshold)
182
+	{
183
+		return $time >= $slowThreshold;
184
+	}
185
+
186
+	/**
187
+	 * Stores a test as slow.
188
+	 *
189
+	 * @param PHPUnit_Framework_TestCase $test
190
+	 * @param int                         $time Test execution time in milliseconds
191
+	 */
192
+	protected function addSlowTest(PHPUnit_Framework_TestCase $test, $time)
193
+	{
194
+		$label = $this->makeLabel($test);
195
+
196
+		$this->slow[$label] = $time;
197
+	}
198
+
199
+	/**
200
+	 * Whether at least one test has been considered slow.
201
+	 *
202
+	 * @return bool
203
+	 */
204
+	protected function hasSlowTests()
205
+	{
206
+		return !empty($this->slow);
207
+	}
208
+
209
+	/**
210
+	 * Convert PHPUnit's reported test time (microseconds) to milliseconds.
211
+	 *
212
+	 * @param float $time
213
+	 * @return int
214
+	 */
215
+	protected function toMilliseconds($time)
216
+	{
217
+		return (int) round($time * 1000);
218
+	}
219
+
220
+	/**
221
+	 * Label for describing a test.
222
+	 *
223
+	 * @param PHPUnit_Framework_TestCase $test
224
+	 * @return string
225
+	 */
226
+	protected function makeLabel(PHPUnit_Framework_TestCase $test)
227
+	{
228
+		return sprintf('%s:%s', get_class($test), $test->getName());
229
+	}
230
+
231
+	/**
232
+	 * Calculate number of slow tests to report about.
233
+	 *
234
+	 * @return int
235
+	 */
236
+	protected function getReportLength()
237
+	{
238
+		return min(count($this->slow), $this->reportLength);
239
+	}
240
+
241
+	/**
242
+	 * Find how many slow tests occurred that won't be shown due to list length.
243
+	 *
244
+	 * @return int Number of hidden slow tests
245
+	 */
246
+	protected function getHiddenCount()
247
+	{
248
+		$total = count($this->slow);
249
+		$showing = $this->getReportLength($this->slow);
250
+
251
+		$hidden = 0;
252
+		if ($total > $showing) {
253
+			$hidden = $total - $showing;
254
+		}
255
+
256
+		return $hidden;
257
+	}
258
+
259
+	/**
260
+	 * Renders slow test report header.
261
+	 */
262
+	protected function renderHeader()
263
+	{
264
+		echo sprintf("\n\nYou should really fix these slow tests (>%sms)...\n", $this->slowThreshold);
265
+	}
266
+
267
+	/**
268
+	 * Renders slow test report body.
269
+	 */
270
+	protected function renderBody()
271
+	{
272
+		$slowTests = $this->slow;
273
+
274
+		$length = $this->getReportLength($slowTests);
275
+		for ($i = 1; $i <= $length; ++$i) {
276
+			$label = key($slowTests);
277
+			$time = array_shift($slowTests);
278
+
279
+			echo sprintf(" %s. %sms to run %s\n", $i, $time, $label);
280
+		}
281
+	}
282
+
283
+	/**
284
+	 * Renders slow test report footer.
285
+	 */
286
+	protected function renderFooter()
287
+	{
288
+		if ($hidden = $this->getHiddenCount($this->slow)) {
289
+			echo sprintf("...and there %s %s more above your threshold hidden from view", $hidden == 1 ? 'is' : 'are', $hidden);
290
+		}
291
+	}
292
+
293
+	/**
294
+	 * Populate options into class internals.
295
+	 *
296
+	 * @param array $options
297
+	 */
298
+	protected function loadOptions(array $options)
299
+	{
300
+		$this->slowThreshold = isset($options['slowThreshold']) ? $options['slowThreshold'] : 500;
301
+		$this->reportLength = isset($options['reportLength']) ? $options['reportLength'] : 10;
302
+	}
303
+
304
+	/**
305
+	 * Get slow test threshold for given test. A TestCase can override the
306
+	 * suite-wide slow threshold by using the annotation @slowThreshold with
307
+	 * the threshold value in milliseconds.
308
+	 *
309
+	 * The following test will only be considered slow when its execution time
310
+	 * reaches 5000ms (5 seconds):
311
+	 *
312
+	 * <code>
313
+	 * @slowThreshold 5000
314
+	 * public function testLongRunningProcess() {}
315
+	 * </code>
316
+	 *
317
+	 * @param PHPUnit_Framework_TestCase $test
318
+	 * @return int
319
+	 */
320
+	protected function getSlowThreshold(PHPUnit_Framework_TestCase $test)
321
+	{
322
+		$ann = $test->getAnnotations();
323
+
324
+		return isset($ann['method']['slowThreshold'][0]) ? $ann['method']['slowThreshold'][0] : $this->slowThreshold;
325
+	}
326 326
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,9 @@
 block discarded – undo
133 133
      */
134 134
     public function endTest(PHPUnit_Framework_Test $test, $time)
135 135
     {
136
-        if (!$test instanceof PHPUnit_Framework_TestCase) return;
136
+        if (!$test instanceof PHPUnit_Framework_TestCase) {
137
+        	return;
138
+        }
137 139
 
138 140
         $time = $this->toMilliseconds($time);
139 141
         $threshold = $this->getSlowThreshold($test);
Please login to merge, or discard this patch.