Test Setup Failed
Pull Request — master (#215)
by Viruthagiri
12:15
created
geodirectory-templates/listing-listview.php 1 patch
Indentation   +288 added lines, -288 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Template for the list of places
4
- *
5
- * This is used mostly on the listing (category) pages and outputs the actual grid or list of listings.
6
- * See the link below for info on how to replace the template in your theme.
7
- *
8
- * @link http://docs.wpgeodirectory.com/customizing-geodirectory-templates/
9
- * @since 1.0.0
10
- * @package GeoDirectory
11
- * @global object $wpdb WordPress Database object.
12
- * @global object $post The current post object.
13
- * @global object $wp_query WordPress Query object.
14
- * @global string $gridview_columns The girdview style of the listings.
15
- * @global object $gd_session GeoDirectory Session object.
16
- */
3
+		 * Template for the list of places
4
+		 *
5
+		 * This is used mostly on the listing (category) pages and outputs the actual grid or list of listings.
6
+		 * See the link below for info on how to replace the template in your theme.
7
+		 *
8
+		 * @link http://docs.wpgeodirectory.com/customizing-geodirectory-templates/
9
+		 * @since 1.0.0
10
+		 * @package GeoDirectory
11
+		 * @global object $wpdb WordPress Database object.
12
+		 * @global object $post The current post object.
13
+		 * @global object $wp_query WordPress Query object.
14
+		 * @global string $gridview_columns The girdview style of the listings.
15
+		 * @global object $gd_session GeoDirectory Session object.
16
+		 */
17 17
 
18 18
 /**
19 19
  * Called before the listing template used to list listing of places.
@@ -44,57 +44,57 @@  discard block
 block discarded – undo
44 44
 
45 45
         <?php if (have_posts()) :
46 46
 
47
-            /**
48
-             * Called inside the `ul` of the listings template, but before any `li` elements.
49
-             *
50
-             * When used by the widget view template then it will only show if there are listings to be shown.
51
-             *
52
-             * @since 1.0.0
53
-             * @see 'geodir_after_listing_post_listview'
54
-             */
55
-            do_action('geodir_before_listing_post_listview');
56
-
57
-            while (have_posts()) : the_post();
58
-                global $post, $wpdb, $preview;
59
-
60
-                /**
61
-                 * Add a class to the `li` element of the listings list template.
62
-                 *
63
-                 * @since 1.0.0
64
-                 * @param string $class The extra class for the `li` element, default empty.
65
-                 */
66
-                $post_view_class = apply_filters('geodir_post_view_extra_class', '');
67
-
68
-                /**
69
-                 * Add a class to the `article` tag inside the `li` element on the listings list template.
70
-                 *
71
-                 * @since 1.0.0
72
-                 * @param string $class The extra class for the `article` element, default empty.
73
-                 */
74
-                $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', '');
75
-                ?>
47
+			/**
48
+			 * Called inside the `ul` of the listings template, but before any `li` elements.
49
+			 *
50
+			 * When used by the widget view template then it will only show if there are listings to be shown.
51
+			 *
52
+			 * @since 1.0.0
53
+			 * @see 'geodir_after_listing_post_listview'
54
+			 */
55
+			do_action('geodir_before_listing_post_listview');
56
+
57
+			while (have_posts()) : the_post();
58
+				global $post, $wpdb, $preview;
59
+
60
+				/**
61
+				 * Add a class to the `li` element of the listings list template.
62
+				 *
63
+				 * @since 1.0.0
64
+				 * @param string $class The extra class for the `li` element, default empty.
65
+				 */
66
+				$post_view_class = apply_filters('geodir_post_view_extra_class', '');
67
+
68
+				/**
69
+				 * Add a class to the `article` tag inside the `li` element on the listings list template.
70
+				 *
71
+				 * @since 1.0.0
72
+				 * @param string $class The extra class for the `article` element, default empty.
73
+				 */
74
+				$post_view_article_class = apply_filters('geodir_post_view_article_extra_class', '');
75
+				?>
76 76
 
77 77
                 <li class="clearfix <?php if ($grid_view_class) {
78
-                    echo 'geodir-gridview ' . $grid_view_class;
79
-                } else {
80
-                    echo ' geodir-listview ';
81
-                } ?> <?php if ($post_view_class) {
82
-                    echo $post_view_class;
83
-                } ?>" <?php if (isset($listing_width) && $listing_width) echo "style='width:{$listing_width}%;'"; // Width for widget listing
84
-
85
-                echo " data-post-id='$post->ID' ";
86
-                /**
87
-                 * Called inside the `<li>` tag for listing outputs.
88
-                 *
89
-                 * @since 1.5.9
90
-                 * @param object $post The post object.
91
-                 * @param string $string If called on the listing or widget template.
92
-                 */
93
-                do_action('geodir_listview_inside_li', $post, 'listing');
94
-                ?> >
78
+					echo 'geodir-gridview ' . $grid_view_class;
79
+				} else {
80
+					echo ' geodir-listview ';
81
+				} ?> <?php if ($post_view_class) {
82
+					echo $post_view_class;
83
+				} ?>" <?php if (isset($listing_width) && $listing_width) echo "style='width:{$listing_width}%;'"; // Width for widget listing
84
+
85
+				echo " data-post-id='$post->ID' ";
86
+				/**
87
+				 * Called inside the `<li>` tag for listing outputs.
88
+				 *
89
+				 * @since 1.5.9
90
+				 * @param object $post The post object.
91
+				 * @param string $string If called on the listing or widget template.
92
+				 */
93
+				do_action('geodir_listview_inside_li', $post, 'listing');
94
+				?> >
95 95
                     <article class="geodir-category-listing <?php if ($post_view_article_class) {
96
-                        echo $post_view_article_class;
97
-                    } ?>">
96
+						echo $post_view_article_class;
97
+					} ?>">
98 98
                         <div class="geodir-post-img <?php echo apply_filters('geodir_listing_listview_thumb_extra_class', '', 'listing'); ?>">
99 99
                             <?php if ($fimage = geodir_show_featured_image($post->ID, 'list-thumb', true, false, $post->featured_image)) { ?>
100 100
 
@@ -102,37 +102,37 @@  discard block
 block discarded – undo
102 102
                                     <?php echo $fimage; ?>
103 103
                                 </a>
104 104
                                 <?php
105
-                                /**
106
-                                 * Called before badges are output.
107
-                                 *
108
-                                 * Called on the listings template after the image has been output and before the badges like `new` or `featured` are output.
109
-                                 *
110
-                                 * @since 1.0.0
111
-                                 * @param object $post The post object.
112
-                                 * @see 'geodir_after_badge_on_image'
113
-                                 */
114
-                                do_action('geodir_before_badge_on_image', $post);
115
-                                if (isset($post->is_featured) && $post->is_featured) {
116
-                                    echo geodir_show_badges_on_image('featured', $post, get_permalink());
117
-                                }
118
-
119
-                                $geodir_days_new = (int)get_option('geodir_listing_new_days');
120
-
121
-                                if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
122
-                                    echo geodir_show_badges_on_image('new', $post, get_permalink());
123
-                                }
124
-
125
-                                /**
126
-                                 * Called after badges are output.
127
-                                 *
128
-                                 * Called on the listings template after the image and badges like `new` or `featured` have been output.
129
-                                 *
130
-                                 * @since 1.0.0
131
-                                 * @param object $post The post object.
132
-                                 * @see 'geodir_before_badge_on_image'
133
-                                 */
134
-                                do_action('geodir_after_badge_on_image', $post);
135
-                                ?>
105
+								/**
106
+								 * Called before badges are output.
107
+								 *
108
+								 * Called on the listings template after the image has been output and before the badges like `new` or `featured` are output.
109
+								 *
110
+								 * @since 1.0.0
111
+								 * @param object $post The post object.
112
+								 * @see 'geodir_after_badge_on_image'
113
+								 */
114
+								do_action('geodir_before_badge_on_image', $post);
115
+								if (isset($post->is_featured) && $post->is_featured) {
116
+									echo geodir_show_badges_on_image('featured', $post, get_permalink());
117
+								}
118
+
119
+								$geodir_days_new = (int)get_option('geodir_listing_new_days');
120
+
121
+								if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
122
+									echo geodir_show_badges_on_image('new', $post, get_permalink());
123
+								}
124
+
125
+								/**
126
+								 * Called after badges are output.
127
+								 *
128
+								 * Called on the listings template after the image and badges like `new` or `featured` have been output.
129
+								 *
130
+								 * @since 1.0.0
131
+								 * @param object $post The post object.
132
+								 * @see 'geodir_before_badge_on_image'
133
+								 */
134
+								do_action('geodir_after_badge_on_image', $post);
135
+								?>
136 136
 
137 137
 
138 138
                             <?php } ?>
@@ -142,15 +142,15 @@  discard block
 block discarded – undo
142 142
                         <div class="geodir-content <?php echo apply_filters('geodir_listing_listview_content_extra_class', '', 'listing'); ?>">
143 143
 
144 144
                             <?php
145
-                            /**
146
-                             * Called before the post title on the listings view template.
147
-                             *
148
-                             * @since 1.0.0
149
-                             * @param string $type The template type, default 'listview'.
150
-                             * @param object $post The post object.
151
-                             * @see 'geodir_after_listing_post_title'
152
-                             */
153
-                            do_action('geodir_before_listing_post_title', 'listview', $post); ?>
145
+							/**
146
+							 * Called before the post title on the listings view template.
147
+							 *
148
+							 * @since 1.0.0
149
+							 * @param string $type The template type, default 'listview'.
150
+							 * @param object $post The post object.
151
+							 * @see 'geodir_after_listing_post_title'
152
+							 */
153
+							do_action('geodir_before_listing_post_title', 'listview', $post); ?>
154 154
 
155 155
                             <header class="geodir-entry-header"><h3 class="geodir-entry-title">
156 156
                                     <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
@@ -162,222 +162,222 @@  discard block
 block discarded – undo
162 162
                             <!-- .entry-header -->
163 163
 
164 164
                             <?php
165
-                            /**
166
-                             * Called after the post title on the listings view template.
167
-                             *
168
-                             * @since 1.0.0
169
-                             * @param string $type The template type, default 'listview'.
170
-                             * @param object $post The post object.
171
-                             * @see 'geodir_before_listing_post_title'
172
-                             */
173
-                            do_action('geodir_after_listing_post_title', 'listview', $post); ?>
165
+							/**
166
+							 * Called after the post title on the listings view template.
167
+							 *
168
+							 * @since 1.0.0
169
+							 * @param string $type The template type, default 'listview'.
170
+							 * @param object $post The post object.
171
+							 * @see 'geodir_before_listing_post_title'
172
+							 */
173
+							do_action('geodir_after_listing_post_title', 'listview', $post); ?>
174 174
 
175 175
                             <?php /// Print Distance
176
-                            if (isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') {
176
+							if (isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') {
177 177
 
178
-                                $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']);
178
+								$startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']);
179 179
 
180
-                                $endLat = $post->post_latitude;
181
-                                $endLon = $post->post_longitude;
182
-                                $endPoint = array('latitude' => $endLat, 'longitude' => $endLon);
183
-                                $uom = get_option('geodir_search_dist_1');
184
-                                $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); ?>
180
+								$endLat = $post->post_latitude;
181
+								$endLon = $post->post_longitude;
182
+								$endPoint = array('latitude' => $endLat, 'longitude' => $endLon);
183
+								$uom = get_option('geodir_search_dist_1');
184
+								$distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); ?>
185 185
                                 <h3>
186 186
                                     <?php
187 187
 
188
-                                    if (round($distance, 2) == 0) {
189
-                                        $uom = get_option('geodir_search_dist_2');
190
-
191
-                                        $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom);
192
-                                        if ($uom == 'feet') {
193
-                                            $uom = __('feet', 'geodirectory');
194
-                                        } else {
195
-                                            $uom = __('meters', 'geodirectory');
196
-                                        }
197
-                                        echo round($distance) . ' ' . $uom . '<br />';
198
-                                    } else {
199
-                                        if ($uom == 'miles') {
200
-                                            $uom = __('miles', 'geodirectory');
201
-                                        } else {
202
-                                            $uom = __('km', 'geodirectory');
203
-                                        }
204
-                                        echo round($distance, 2) . ' ' . $uom . '<br />';
205
-                                    }
206
-                                    ?>
188
+									if (round($distance, 2) == 0) {
189
+										$uom = get_option('geodir_search_dist_2');
190
+
191
+										$distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom);
192
+										if ($uom == 'feet') {
193
+											$uom = __('feet', 'geodirectory');
194
+										} else {
195
+											$uom = __('meters', 'geodirectory');
196
+										}
197
+										echo round($distance) . ' ' . $uom . '<br />';
198
+									} else {
199
+										if ($uom == 'miles') {
200
+											$uom = __('miles', 'geodirectory');
201
+										} else {
202
+											$uom = __('km', 'geodirectory');
203
+										}
204
+										echo round($distance, 2) . ' ' . $uom . '<br />';
205
+									}
206
+									?>
207 207
                                 </h3>
208 208
                             <?php } ?>
209 209
 
210 210
 
211 211
                             <?php
212
-                            /**
213
-                             * Called before the post excerpt on the listings view template.
214
-                             *
215
-                             * @since 1.0.0
216
-                             * @param object $post The post object.
217
-                             * @see 'geodir_after_listing_post_excerpt'
218
-                             */
219
-                            do_action('geodir_before_listing_post_excerpt', $post); ?>
212
+							/**
213
+							 * Called before the post excerpt on the listings view template.
214
+							 *
215
+							 * @since 1.0.0
216
+							 * @param object $post The post object.
217
+							 * @see 'geodir_after_listing_post_excerpt'
218
+							 */
219
+							do_action('geodir_before_listing_post_excerpt', $post); ?>
220 220
                             <?php echo geodir_show_listing_info('listing'); ?>
221 221
                             <div class="geodir-entry-content">
222 222
 
223 223
                                 <?php
224
-                                /**
225
-                                 * Filter to hide the listing excerpt
226
-                                 *
227
-                                 * @since 1.5.3
228
-                                 * @param bool $display Display the excerpt or not. Default true.
229
-                                 * @param string $view The view type, default 'listview'.
230
-                                 * @param object $post The post object.
231
-                                 */
232
-                                $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post);
233
-                                if ($show_listing_excerpt) {
234
-                                    if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
235
-                                        $content_out = geodir_max_excerpt( $character_count );
236
-                                    } else {
237
-                                        $content_out = get_the_excerpt();
238
-                                    }
239
-                                    if ( ! empty( $content_out ) ) {
240
-                                        echo "<p>" . $content_out . "</p>";
241
-                                    }
242
-                                }
243
-                                ?></div>
224
+								/**
225
+								 * Filter to hide the listing excerpt
226
+								 *
227
+								 * @since 1.5.3
228
+								 * @param bool $display Display the excerpt or not. Default true.
229
+								 * @param string $view The view type, default 'listview'.
230
+								 * @param object $post The post object.
231
+								 */
232
+								$show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post);
233
+								if ($show_listing_excerpt) {
234
+									if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
235
+										$content_out = geodir_max_excerpt( $character_count );
236
+									} else {
237
+										$content_out = get_the_excerpt();
238
+									}
239
+									if ( ! empty( $content_out ) ) {
240
+										echo "<p>" . $content_out . "</p>";
241
+									}
242
+								}
243
+								?></div>
244 244
 
245 245
                             <?php
246
-                            /**
247
-                             * Called after the post excerpt on the listings view template.
248
-                             *
249
-                             * @since 1.0.0
250
-                             * @param object $post The post object.
251
-                             * @see 'geodir_before_listing_post_excerpt'
252
-                             */
253
-                            do_action('geodir_after_listing_post_excerpt', $post); ?>
246
+							/**
247
+							 * Called after the post excerpt on the listings view template.
248
+							 *
249
+							 * @since 1.0.0
250
+							 * @param object $post The post object.
251
+							 * @see 'geodir_before_listing_post_excerpt'
252
+							 */
253
+							do_action('geodir_after_listing_post_excerpt', $post); ?>
254 254
                         </div>
255 255
                         <!-- gd-content ends here-->
256 256
                         <?php
257
-                        /**
258
-                         * Called after printing listing content.
259
-                         *
260
-                         * @since 1.5.3
261
-                         * @param object $post The post object.
262
-                         * @param string $view The view type, default 'listing'.
263
-                         */
264
-                        do_action( 'geodir_after_listing_content', $post, 'listing' ); ?>
257
+						/**
258
+						 * Called after printing listing content.
259
+						 *
260
+						 * @since 1.5.3
261
+						 * @param object $post The post object.
262
+						 * @param string $view The view type, default 'listing'.
263
+						 */
264
+						do_action( 'geodir_after_listing_content', $post, 'listing' ); ?>
265 265
                         <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'listing'); ?>">
266 266
                             <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'listing'); ?>">
267 267
 
268 268
                                 <?php
269
-                                /**
270
-                                 * Called before printing review stars html.
271
-                                 *
272
-                                 * @since 1.5.3
273
-                                 * @param object $post The post object.
274
-                                 * @param string $view The view type, default 'listing'.
275
-                                 */
276
-                                do_action( 'geodir_before_review_html', $post, 'listing' );
277
-
278
-                                $review_show = geodir_is_reviews_show('listview');
279
-
280
-                                if ($review_show) {
281
-
282
-                                    if (!$preview) {
283
-                                        $post_avgratings = geodir_get_post_rating($post->ID);
284
-                                        /**
285
-                                         * Called before the rating stars are output on the listings view template.
286
-                                         *
287
-                                         * @since 1.0.0
288
-                                         * @param float $post_avgratings The average rating for the post.
289
-                                         * @param int $post->ID The post ID.
290
-                                         * @see 'geodir_after_review_rating_stars_on_listview'
291
-                                         */
292
-                                        do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID);
293
-
294
-                                        echo geodir_get_rating_stars($post_avgratings, $post->ID);
295
-
296
-                                        /**
297
-                                         * Called after the rating stars are output on the listings view template.
298
-                                         *
299
-                                         * @since 1.0.0
300
-                                         * @param float $post_avgratings The average rating for the post.
301
-                                         * @param int $post->ID The post ID.
302
-                                         * @see 'geodir_before_review_rating_stars_on_listview'
303
-                                         */
304
-                                        do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID);
305
-                                    }
306
-                                    ?>
269
+								/**
270
+								 * Called before printing review stars html.
271
+								 *
272
+								 * @since 1.5.3
273
+								 * @param object $post The post object.
274
+								 * @param string $view The view type, default 'listing'.
275
+								 */
276
+								do_action( 'geodir_before_review_html', $post, 'listing' );
277
+
278
+								$review_show = geodir_is_reviews_show('listview');
279
+
280
+								if ($review_show) {
281
+
282
+									if (!$preview) {
283
+										$post_avgratings = geodir_get_post_rating($post->ID);
284
+										/**
285
+										 * Called before the rating stars are output on the listings view template.
286
+										 *
287
+										 * @since 1.0.0
288
+										 * @param float $post_avgratings The average rating for the post.
289
+										 * @param int $post->ID The post ID.
290
+										 * @see 'geodir_after_review_rating_stars_on_listview'
291
+										 */
292
+										do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID);
293
+
294
+										echo geodir_get_rating_stars($post_avgratings, $post->ID);
295
+
296
+										/**
297
+										 * Called after the rating stars are output on the listings view template.
298
+										 *
299
+										 * @since 1.0.0
300
+										 * @param float $post_avgratings The average rating for the post.
301
+										 * @param int $post->ID The post ID.
302
+										 * @see 'geodir_before_review_rating_stars_on_listview'
303
+										 */
304
+										do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID);
305
+									}
306
+									?>
307 307
                                     <a href="<?php comments_link(); ?>" class="geodir-pcomments"><i
308 308
                                             class="fa fa-comments"></i>
309 309
                                         <?php geodir_comments_number($post->rating_count); ?></a>
310 310
                                 <?php
311
-                                }
311
+								}
312 312
 
313 313
 
314
-                                /**
315
-                                 * Called after printing favorite html.
316
-                                 *
317
-                                 * @since 1.0.0
318
-                                 */
319
-                                do_action( 'geodir_after_favorite_html', $post->ID, 'listing' );
314
+								/**
315
+								 * Called after printing favorite html.
316
+								 *
317
+								 * @since 1.0.0
318
+								 */
319
+								do_action( 'geodir_after_favorite_html', $post->ID, 'listing' );
320 320
 
321 321
 
322
-                                /**
323
-                                 * Called after printing map pin point.
324
-                                 *
325
-                                 * @since 1.0.0
326
-                                 * @since 1.5.9 Added $post as second param.
327
-                                 * @param int $post->ID The post id.
328
-                                 * @param object $post The post object.
329
-                                 */
330
-                                do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post);
322
+								/**
323
+								 * Called after printing map pin point.
324
+								 *
325
+								 * @since 1.0.0
326
+								 * @since 1.5.9 Added $post as second param.
327
+								 * @param int $post->ID The post id.
328
+								 * @param object $post The post object.
329
+								 */
330
+								do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post);
331 331
 
332
-                                if ($post->post_author == get_current_user_id()) { ?>
332
+								if ($post->post_author == get_current_user_id()) { ?>
333 333
                                     <?php
334
-                                    $addplacelink = get_permalink(geodir_add_listing_page_id());
335
-                                    $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false);
336
-                                    $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false);
334
+									$addplacelink = get_permalink(geodir_add_listing_page_id());
335
+									$editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false);
336
+									$upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false);
337 337
 
338
-                                    $ajaxlink = geodir_get_ajax_url();
339
-                                    $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false);
338
+									$ajaxlink = geodir_get_ajax_url();
339
+									$deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false);
340 340
 
341
-                                    ?>
341
+									?>
342 342
 
343 343
                                     <span class="geodir-authorlink clearfix">
344 344
 											
345 345
 											<?php if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) {
346
-                                                /**
347
-                                                 * Called before the edit post link on the listings view template used on the author page.
348
-                                                 *
349
-                                                 * @since 1.0.0
350
-                                                 * @see 'geodir_after_edit_post_link_on_listing'
351
-                                                 */
352
-                                                do_action('geodir_before_edit_post_link_on_listing');
353
-                                                ?>
346
+												/**
347
+												 * Called before the edit post link on the listings view template used on the author page.
348
+												 *
349
+												 * @since 1.0.0
350
+												 * @see 'geodir_after_edit_post_link_on_listing'
351
+												 */
352
+												do_action('geodir_before_edit_post_link_on_listing');
353
+												?>
354 354
 
355 355
                                                 <a href="<?php echo esc_url($editlink); ?>" class="geodir-edit"
356 356
                                                    title="<?php _e('Edit Listing', 'geodirectory'); ?>">
357 357
                                                     <?php
358
-                                                    $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
359
-                                                    echo '<i class="'. $geodir_listing_edit_icon .'"></i>';
360
-                                                    ?>
358
+													$geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
359
+													echo '<i class="'. $geodir_listing_edit_icon .'"></i>';
360
+													?>
361 361
                                                     <?php _e('Edit', 'geodirectory'); ?>
362 362
                                                 </a>
363 363
                                                 <a href="<?php echo esc_url($deletelink); ?>" class="geodir-delete"
364 364
                                                    title="<?php _e('Delete Listing', 'geodirectory'); ?>">
365 365
                                                     <?php
366
-                                                    $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
367
-                                                    echo '<i class="'. $geodir_listing_delete_icon .'"></i>';
368
-                                                    ?>
366
+													$geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
367
+													echo '<i class="'. $geodir_listing_delete_icon .'"></i>';
368
+													?>
369 369
                                                     <?php _e('Delete', 'geodirectory'); ?>
370 370
                                                 </a>
371 371
                                                 <?php
372 372
 
373
-                                                /**
374
-                                                 * Called after the edit post link on the listings view template used on the author page.
375
-                                                 *
376
-                                                 * @since 1.0.0
377
-                                                 * @see 'geodir_before_edit_post_link_on_listing'
378
-                                                 */
379
-                                                do_action('geodir_after_edit_post_link_on_listing');
380
-                                            } ?>
373
+												/**
374
+												 * Called after the edit post link on the listings view template used on the author page.
375
+												 *
376
+												 * @since 1.0.0
377
+												 * @see 'geodir_before_edit_post_link_on_listing'
378
+												 */
379
+												do_action('geodir_after_edit_post_link_on_listing');
380
+											} ?>
381 381
 											</span>
382 382
 
383 383
                                 <?php } ?>
@@ -390,39 +390,39 @@  discard block
 block discarded – undo
390 390
                 </li>
391 391
 
392 392
             <?php
393
-            endwhile;
394
-
395
-            /**
396
-             * Called inside the `ul` of the listings template, but after all `li` elements.
397
-             *
398
-             * When used by the widget view template then it will only show if there are listings to be shown.
399
-             *
400
-             * @since 1.0.0
401
-             * @see 'geodir_before_listing_post_listview'
402
-             */
403
-            do_action('geodir_after_listing_post_listview');
404
-
405
-        else:
393
+			endwhile;
394
+
395
+			/**
396
+			 * Called inside the `ul` of the listings template, but after all `li` elements.
397
+			 *
398
+			 * When used by the widget view template then it will only show if there are listings to be shown.
399
+			 *
400
+			 * @since 1.0.0
401
+			 * @see 'geodir_before_listing_post_listview'
402
+			 */
403
+			do_action('geodir_after_listing_post_listview');
404
+
405
+		else:
406 406
 			$favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false;
407 407
             
408 408
 			/**
409
-             * Called inside the `ul` of the listings template, when no listing found.
410
-             *
411
-             * @since 1.5.5
409
+			 * Called inside the `ul` of the listings template, when no listing found.
410
+			 *
411
+			 * @since 1.5.5
412 412
 			 * @param string 'listing-listview' Listing listview template.
413 413
 			 * @param bool $favorite Are favorite listings results?
414
-             */
415
-            do_action('geodir_message_not_found_on_listing', 'listing-listview', $favorite);
416
-        endif;
414
+			 */
415
+			do_action('geodir_message_not_found_on_listing', 'listing-listview', $favorite);
416
+		endif;
417 417
 
418
-        ?>
418
+		?>
419 419
     </ul>  <!-- geodir_category_list_view ends here-->
420 420
 
421 421
     <div class="clear"></div>
422 422
 <?php
423 423
 /**
424
- * Called after the listings list view template, after all the wrapper at the very end.
425
- *
426
- * @since 1.0.0
427
- */
424
+		 * Called after the listings list view template, after all the wrapper at the very end.
425
+		 *
426
+		 * @since 1.0.0
427
+		 */
428 428
 do_action('geodir_after_listing_listview');
Please login to merge, or discard this patch.
geodirectory-functions/comments_functions.php 1 patch
Indentation   +417 added lines, -417 removed lines patch added patch discarded remove patch
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function geodir_comment_meta_row_action($a)
33 33
 {
34
-    global $comment;
35
-
36
-    $rating = geodir_get_commentoverall($comment->comment_ID);
37
-    if ($rating != 0) {
38
-        //echo '<div class="gd_rating_show" data-average="'.$rating.'" data-id="'.$comment->comment_ID.'"></div>';
39
-        echo geodir_get_rating_stars($rating, $comment->comment_ID);
40
-    }
41
-    return $a;
34
+	global $comment;
35
+
36
+	$rating = geodir_get_commentoverall($comment->comment_ID);
37
+	if ($rating != 0) {
38
+		//echo '<div class="gd_rating_show" data-average="'.$rating.'" data-id="'.$comment->comment_ID.'"></div>';
39
+		echo geodir_get_rating_stars($rating, $comment->comment_ID);
40
+	}
41
+	return $a;
42 42
 }
43 43
 
44 44
 add_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
  */
54 54
 function geodir_comment_add_meta_box($comment)
55 55
 {
56
-    add_meta_box('gd-comment-rating', __('Comment Rating', 'geodirectory'), 'geodir_comment_rating_meta', 'comment', 'normal', 'high');
56
+	add_meta_box('gd-comment-rating', __('Comment Rating', 'geodirectory'), 'geodir_comment_rating_meta', 'comment', 'normal', 'high');
57 57
 }
58 58
 
59 59
 /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function geodir_comment_rating_meta($comment)
69 69
 {
70
-    $post_type = get_post_type($comment->comment_post_ID);
70
+	$post_type = get_post_type($comment->comment_post_ID);
71 71
 	if (in_array($post_type, (array)geodir_get_posttypes()) && (int)$comment->comment_parent == 0) {
72 72
 		$rating = geodir_get_commentoverall($comment->comment_ID);
73 73
 		
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
  */
108 108
 function geodir_comment_rating_fields()
109 109
 {
110
-    global $post;
110
+	global $post;
111 111
 
112
-    $post_types = geodir_get_posttypes();
112
+	$post_types = geodir_get_posttypes();
113 113
 
114
-    if (in_array($post->post_type, $post_types)) {
115
-        $star_texts = array();
114
+	if (in_array($post->post_type, $post_types)) {
115
+		$star_texts = array();
116 116
 		$star_texts[] = __('Terrible', 'geodirectory');
117 117
 		$star_texts[] = __('Poor', 'geodirectory');
118 118
 		$star_texts[] = __('Average', 'geodirectory');
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 		$star_texts[] = __('Excellent', 'geodirectory');
121 121
 		
122 122
 		$gd_rating_html = apply_filters('gd_rating_form_html', '<div class="gd_rating" data-average="0" data-id="5"></div>', $star_texts);
123
-        echo $gd_rating_html;
124
-        ?>
123
+		echo $gd_rating_html;
124
+		?>
125 125
         <input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="0"/><?php
126
-    }
126
+	}
127 127
 }
128 128
 
129 129
 
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
 function geodir_comment_replaylink($link)
140 140
 {
141 141
 
142
-    $link = '<div class="gd_comment_replaylink">' . $link . '</div>';
142
+	$link = '<div class="gd_comment_replaylink">' . $link . '</div>';
143 143
 
144
-    return $link;
144
+	return $link;
145 145
 }
146 146
 
147 147
 add_filter('cancel_comment_reply_link', 'geodir_cancle_replaylink');
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 function geodir_cancle_replaylink($link)
157 157
 {
158 158
 
159
-    $link = '<span class="gd-cancel-replaylink">' . $link . '</span>';
159
+	$link = '<span class="gd-cancel-replaylink">' . $link . '</span>';
160 160
 
161
-    return $link;
161
+	return $link;
162 162
 }
163 163
 
164 164
 add_action('comment_post', 'geodir_save_rating');
@@ -174,29 +174,29 @@  discard block
 block discarded – undo
174 174
  */
175 175
 function geodir_save_rating($comment = 0)
176 176
 {
177
-    global $wpdb, $user_ID, $plugin_prefix;
177
+	global $wpdb, $user_ID, $plugin_prefix;
178 178
 
179
-    $comment_info = get_comment($comment);
179
+	$comment_info = get_comment($comment);
180 180
 
181
-    $post_id = $comment_info->comment_post_ID;
182
-    $status = $comment_info->comment_approved;
183
-    $rating_ip = getenv("REMOTE_ADDR");
181
+	$post_id = $comment_info->comment_post_ID;
182
+	$status = $comment_info->comment_approved;
183
+	$rating_ip = getenv("REMOTE_ADDR");
184 184
 	
185
-    $post = geodir_get_post_info($post_id);
185
+	$post = geodir_get_post_info($post_id);
186 186
 
187
-    if ($post->post_status == 'publish') {
188
-        $post_status = '1';
189
-    } else {
190
-        $post_status = '0';
191
-    }
187
+	if ($post->post_status == 'publish') {
188
+		$post_status = '1';
189
+	} else {
190
+		$post_status = '0';
191
+	}
192 192
 	
193
-    if (isset($_REQUEST['geodir_overallrating'])) {
194
-        $overall_rating = $_REQUEST['geodir_overallrating'];
193
+	if (isset($_REQUEST['geodir_overallrating'])) {
194
+		$overall_rating = $_REQUEST['geodir_overallrating'];
195 195
         
196 196
 		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
197
-            $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
197
+			$overall_rating = $overall_rating > 0 ? $overall_rating : '0';
198 198
 
199
-            $sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
199
+			$sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
200 200
 					post_id		= %d,
201 201
 					post_type = %s,
202 202
 					post_title	= %s,
@@ -214,35 +214,35 @@  discard block
 block discarded – undo
214 214
 					post_latitude	= %s,
215 215
 					comment_content	= %s 
216 216
 					",
217
-                array($post_id, $post->post_type, $post->post_title, $user_ID, $comment, $rating_ip, $overall_rating, $status, $post_status, date_i18n('Y-m-d H:i:s', current_time('timestamp')), $post->post_city, $post->post_region, $post->post_country, $post->post_latitude, $post->post_longitude, $comment_info->comment_content)
218
-            );
219
-
220
-            $wpdb->query($sqlqry);
221
-
222
-            /**
223
-             * Called after saving the comment.
224
-             *
225
-             * @since 1.0.0
226
-             * @package GeoDirectory
227
-             * @param array $_REQUEST {
228
-             *    Attributes of the $_REQUEST variable.
229
-             *
230
-             *    @type string $geodir_overallrating Overall rating.
231
-             *    @type string $comment Comment text.
232
-             *    @type string $submit Submit button text.
233
-             *    @type string $comment_post_ID Comment post ID.
234
-             *    @type string $comment_parent Comment Parent ID.
235
-             *    @type string $_wp_unfiltered_html_comment Unfiltered html comment string.
236
-             *
237
-             * }
238
-             */
239
-            do_action('geodir_after_save_comment', $_REQUEST, 'Comment Your Post');
240
-
241
-            if ($status) {
242
-                geodir_update_postrating($post_id);
243
-            }
244
-        }
245
-    }
217
+				array($post_id, $post->post_type, $post->post_title, $user_ID, $comment, $rating_ip, $overall_rating, $status, $post_status, date_i18n('Y-m-d H:i:s', current_time('timestamp')), $post->post_city, $post->post_region, $post->post_country, $post->post_latitude, $post->post_longitude, $comment_info->comment_content)
218
+			);
219
+
220
+			$wpdb->query($sqlqry);
221
+
222
+			/**
223
+			 * Called after saving the comment.
224
+			 *
225
+			 * @since 1.0.0
226
+			 * @package GeoDirectory
227
+			 * @param array $_REQUEST {
228
+			 *    Attributes of the $_REQUEST variable.
229
+			 *
230
+			 *    @type string $geodir_overallrating Overall rating.
231
+			 *    @type string $comment Comment text.
232
+			 *    @type string $submit Submit button text.
233
+			 *    @type string $comment_post_ID Comment post ID.
234
+			 *    @type string $comment_parent Comment Parent ID.
235
+			 *    @type string $_wp_unfiltered_html_comment Unfiltered html comment string.
236
+			 *
237
+			 * }
238
+			 */
239
+			do_action('geodir_after_save_comment', $_REQUEST, 'Comment Your Post');
240
+
241
+			if ($status) {
242
+				geodir_update_postrating($post_id);
243
+			}
244
+		}
245
+	}
246 246
 }
247 247
 
248 248
 
@@ -260,51 +260,51 @@  discard block
 block discarded – undo
260 260
  */
261 261
 function geodir_update_rating_status_change($comment_id, $status)
262 262
 {
263
-    if ($status == 'delete') {
264
-        return;
265
-    }
266
-    global $wpdb, $plugin_prefix, $user_ID;
263
+	if ($status == 'delete') {
264
+		return;
265
+	}
266
+	global $wpdb, $plugin_prefix, $user_ID;
267 267
 
268
-    $comment_info = get_comment($comment_id);
268
+	$comment_info = get_comment($comment_id);
269 269
 
270
-    $post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : '';
270
+	$post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : '';
271 271
 
272
-    if (!empty($comment_info))
273
-        $status = $comment_info->comment_approved;
272
+	if (!empty($comment_info))
273
+		$status = $comment_info->comment_approved;
274 274
 
275
-    if ($status == 'approve' || $status == 1) {
276
-        $status = 1;
277
-    } else {
278
-        $status = 0;
279
-    }
275
+	if ($status == 'approve' || $status == 1) {
276
+		$status = 1;
277
+	} else {
278
+		$status = 0;
279
+	}
280 280
 
281
-    $comment_info_ID = isset($comment_info->comment_ID) ? $comment_info->comment_ID : '';
282
-    $old_rating = geodir_get_commentoverall($comment_info_ID);
281
+	$comment_info_ID = isset($comment_info->comment_ID) ? $comment_info->comment_ID : '';
282
+	$old_rating = geodir_get_commentoverall($comment_info_ID);
283 283
 
284
-    $post_type = get_post_type($post_id);
284
+	$post_type = get_post_type($post_id);
285 285
 
286
-    $detail_table = $plugin_prefix . $post_type . '_detail';
286
+	$detail_table = $plugin_prefix . $post_type . '_detail';
287 287
 
288
-    if ($comment_id) {
288
+	if ($comment_id) {
289 289
 
290
-        $overall_rating = $old_rating;
290
+		$overall_rating = $old_rating;
291 291
 
292
-        if (isset($old_rating)) {
292
+		if (isset($old_rating)) {
293 293
 
294
-            $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
294
+			$sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
295 295
 						overall_rating = %f,
296 296
 						status		= %s,
297 297
 						comment_content = %s 
298 298
 						WHERE comment_id = %d ", array($overall_rating, $status, $comment_info->comment_content, $comment_id));
299 299
 
300
-            $wpdb->query($sqlqry);
300
+			$wpdb->query($sqlqry);
301 301
 
302
-            //update rating
303
-            geodir_update_postrating($post_id, $post_type);
302
+			//update rating
303
+			geodir_update_postrating($post_id, $post_type);
304 304
 
305
-        }
305
+		}
306 306
 
307
-    }
307
+	}
308 308
 
309 309
 }
310 310
 
@@ -323,41 +323,41 @@  discard block
 block discarded – undo
323 323
 function geodir_update_rating($comment_id = 0)
324 324
 {
325 325
 
326
-    global $wpdb, $plugin_prefix, $user_ID;
326
+	global $wpdb, $plugin_prefix, $user_ID;
327 327
 
328
-    $comment_info = get_comment($comment_id);
328
+	$comment_info = get_comment($comment_id);
329 329
 
330
-    $post_id = $comment_info->comment_post_ID;
331
-    $status = $comment_info->comment_approved;
332
-    $old_rating = geodir_get_commentoverall($comment_info->comment_ID);
330
+	$post_id = $comment_info->comment_post_ID;
331
+	$status = $comment_info->comment_approved;
332
+	$old_rating = geodir_get_commentoverall($comment_info->comment_ID);
333 333
 
334
-    $post_type = get_post_type($post_id);
334
+	$post_type = get_post_type($post_id);
335 335
 
336
-    $detail_table = $plugin_prefix . $post_type . '_detail';
336
+	$detail_table = $plugin_prefix . $post_type . '_detail';
337 337
 
338
-    if (isset($_REQUEST['geodir_overallrating'])) {
338
+	if (isset($_REQUEST['geodir_overallrating'])) {
339 339
 
340
-        $overall_rating = $_REQUEST['geodir_overallrating'];
340
+		$overall_rating = $_REQUEST['geodir_overallrating'];
341 341
 
342
-        if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
343
-            $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
342
+		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
343
+			$overall_rating = $overall_rating > 0 ? $overall_rating : '0';
344 344
 
345
-            if (isset($old_rating)) {
345
+			if (isset($old_rating)) {
346 346
 
347
-                $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
347
+				$sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
348 348
 						overall_rating = %f,
349 349
 						status		= %s,
350 350
 						comment_content	= %s 
351 351
 						WHERE comment_id = %d ", array($overall_rating, $status, $comment_info->comment_content, $comment_id));
352 352
 
353
-                $wpdb->query($sqlqry);
353
+				$wpdb->query($sqlqry);
354 354
 
355
-                //update rating
356
-                geodir_update_postrating($post_id, $post_type);
355
+				//update rating
356
+				geodir_update_postrating($post_id, $post_type);
357 357
 
358
-            }
359
-        }
360
-    }
358
+			}
359
+		}
360
+	}
361 361
 
362 362
 
363 363
 }
@@ -373,19 +373,19 @@  discard block
 block discarded – undo
373 373
  */
374 374
 function geodir_comment_delete_comment($comment_id)
375 375
 {
376
-    global $wpdb;
376
+	global $wpdb;
377 377
 
378
-    $review_info = geodir_get_review($comment_id);
379
-    if ($review_info) {
380
-        geodir_update_postrating($review_info->post_id);
381
-    }
378
+	$review_info = geodir_get_review($comment_id);
379
+	if ($review_info) {
380
+		geodir_update_postrating($review_info->post_id);
381
+	}
382 382
 
383
-    $wpdb->query(
384
-        $wpdb->prepare(
385
-            "DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d",
386
-            array($comment_id)
387
-        )
388
-    );
383
+	$wpdb->query(
384
+		$wpdb->prepare(
385
+			"DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d",
386
+			array($comment_id)
387
+		)
388
+	);
389 389
 
390 390
 }
391 391
 
@@ -401,13 +401,13 @@  discard block
 block discarded – undo
401 401
  */
402 402
 function geodir_wrap_comment_text($content, $comment = '')
403 403
 {
404
-    $rating = 0;
405
-    if (!empty($comment))
406
-        $rating = geodir_get_commentoverall($comment->comment_ID);
407
-    if ($rating != 0 && !is_admin()) {
408
-        return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
409
-    } else
410
-        return $content;
404
+	$rating = 0;
405
+	if (!empty($comment))
406
+		$rating = geodir_get_commentoverall($comment->comment_ID);
407
+	if ($rating != 0 && !is_admin()) {
408
+		return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
409
+	} else
410
+		return $content;
411 411
 
412 412
 }
413 413
 
@@ -425,41 +425,41 @@  discard block
 block discarded – undo
425 425
  */
426 426
 function geodir_update_postrating($post_id = 0, $post_type = '', $delete = false)
427 427
 {
428
-    global $wpdb, $plugin_prefix, $comment;
429
-    if (!$post_type) {
430
-        $post_type = get_post_type($post_id);
431
-    }
432
-    $detail_table = $plugin_prefix . $post_type . '_detail';
433
-    $post_newrating = geodir_get_post_rating($post_id, 1);
434
-    $post_newrating_count = geodir_get_review_count_total($post_id);
428
+	global $wpdb, $plugin_prefix, $comment;
429
+	if (!$post_type) {
430
+		$post_type = get_post_type($post_id);
431
+	}
432
+	$detail_table = $plugin_prefix . $post_type . '_detail';
433
+	$post_newrating = geodir_get_post_rating($post_id, 1);
434
+	$post_newrating_count = geodir_get_review_count_total($post_id);
435 435
 
436 436
 
437
-    //$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ;
437
+	//$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ;
438 438
 
439
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
439
+	if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
440 440
 
441
-        $wpdb->query(
442
-            $wpdb->prepare(
443
-                "UPDATE " . $detail_table . " SET
441
+		$wpdb->query(
442
+			$wpdb->prepare(
443
+				"UPDATE " . $detail_table . " SET
444 444
 						overall_rating = %f,
445 445
 						rating_count = %f
446 446
 						where post_id = %d",
447
-                array($post_newrating, $post_newrating_count, $post_id)
448
-            )
449
-        );
450
-
451
-        update_post_meta($post_id, 'overall_rating', $post_newrating);
452
-        update_post_meta($post_id, 'rating_count', $post_newrating_count);
453
-    }
454
-    /**
455
-     * Called after Updating post overall rating and rating count.
456
-     *
457
-     * @since 1.0.0
458
-     * @since 1.4.3 Added `$post_id` param.
459
-     * @package GeoDirectory
460
-     * @param int $post_id The post ID.
461
-     */
462
-    do_action('geodir_update_postrating',$post_id);
447
+				array($post_newrating, $post_newrating_count, $post_id)
448
+			)
449
+		);
450
+
451
+		update_post_meta($post_id, 'overall_rating', $post_newrating);
452
+		update_post_meta($post_id, 'rating_count', $post_newrating_count);
453
+	}
454
+	/**
455
+	 * Called after Updating post overall rating and rating count.
456
+	 *
457
+	 * @since 1.0.0
458
+	 * @since 1.4.3 Added `$post_id` param.
459
+	 * @package GeoDirectory
460
+	 * @param int $post_id The post ID.
461
+	 */
462
+	do_action('geodir_update_postrating',$post_id);
463 463
 
464 464
 }
465 465
 
@@ -477,29 +477,29 @@  discard block
 block discarded – undo
477 477
  */
478 478
 function geodir_get_postoverall($post_id = 0)
479 479
 {
480
-    global $wpdb, $plugin_prefix;
480
+	global $wpdb, $plugin_prefix;
481 481
 
482
-    $post_type = get_post_type($post_id);
483
-    $detail_table = $plugin_prefix . $post_type . '_detail';
482
+	$post_type = get_post_type($post_id);
483
+	$detail_table = $plugin_prefix . $post_type . '_detail';
484 484
 
485
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
485
+	if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
486 486
 
487
-        $post_ratings = $wpdb->get_var(
488
-            $wpdb->prepare(
489
-                "SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d",
490
-                array($post_id)
491
-            )
492
-        );
487
+		$post_ratings = $wpdb->get_var(
488
+			$wpdb->prepare(
489
+				"SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d",
490
+				array($post_id)
491
+			)
492
+		);
493 493
 
494 494
 
495
-    } else {
496
-        $post_ratings = get_post_meta($post_id, 'overall_rating');
497
-    }
495
+	} else {
496
+		$post_ratings = get_post_meta($post_id, 'overall_rating');
497
+	}
498 498
 
499
-    if ($post_ratings)
500
-        return $post_ratings;
501
-    else
502
-        return false;
499
+	if ($post_ratings)
500
+		return $post_ratings;
501
+	else
502
+		return false;
503 503
 }
504 504
 
505 505
 
@@ -516,19 +516,19 @@  discard block
 block discarded – undo
516 516
  */
517 517
 function geodir_get_review($comment_id = 0)
518 518
 {
519
-    global $wpdb;
520
-
521
-    $reatings = $wpdb->get_row(
522
-        $wpdb->prepare(
523
-            "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
524
-            array($comment_id)
525
-        )
526
-    );
527
-
528
-    if (!empty($reatings))
529
-        return $reatings;
530
-    else
531
-        return false;
519
+	global $wpdb;
520
+
521
+	$reatings = $wpdb->get_row(
522
+		$wpdb->prepare(
523
+			"SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
524
+			array($comment_id)
525
+		)
526
+	);
527
+
528
+	if (!empty($reatings))
529
+		return $reatings;
530
+	else
531
+		return false;
532 532
 }
533 533
 
534 534
 /**
@@ -544,19 +544,19 @@  discard block
 block discarded – undo
544 544
  */
545 545
 function geodir_get_review_total($post_id = 0)
546 546
 {
547
-    global $wpdb;
548
-
549
-    $results = $wpdb->get_var(
550
-        $wpdb->prepare(
551
-            "SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
552
-            array($post_id)
553
-        )
554
-    );
555
-
556
-    if (!empty($results))
557
-        return $results;
558
-    else
559
-        return false;
547
+	global $wpdb;
548
+
549
+	$results = $wpdb->get_var(
550
+		$wpdb->prepare(
551
+			"SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
552
+			array($post_id)
553
+		)
554
+	);
555
+
556
+	if (!empty($results))
557
+		return $results;
558
+	else
559
+		return false;
560 560
 }
561 561
 
562 562
 /**
@@ -572,18 +572,18 @@  discard block
 block discarded – undo
572 572
  */
573 573
 function geodir_get_review_count_by_user_id($user_id = 0)
574 574
 {
575
-    global $wpdb;
576
-    $results = $wpdb->get_var(
577
-        $wpdb->prepare(
578
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0",
579
-            array($user_id)
580
-        )
581
-    );
582
-
583
-    if (!empty($results))
584
-        return $results;
585
-    else
586
-        return false;
575
+	global $wpdb;
576
+	$results = $wpdb->get_var(
577
+		$wpdb->prepare(
578
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0",
579
+			array($user_id)
580
+		)
581
+	);
582
+
583
+	if (!empty($results))
584
+		return $results;
585
+	else
586
+		return false;
587 587
 }
588 588
 
589 589
 /**
@@ -601,27 +601,27 @@  discard block
 block discarded – undo
601 601
  */
602 602
 function geodir_get_post_rating($post_id = 0, $force_query = 0)
603 603
 {
604
-    global $wpdb, $post;
605
-
606
-    if (isset($post->ID) && $post->ID == $post_id && !$force_query) {
607
-        if (isset($post->rating_count) && $post->rating_count > 0 && isset($post->overall_rating) && $post->overall_rating > 0) {
608
-            return $post->overall_rating;
609
-        } else {
610
-            return 0;
611
-        }
612
-    }
613
-
614
-    $results = $wpdb->get_var(
615
-        $wpdb->prepare(
616
-            "SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
617
-            array($post_id)
618
-        )
619
-    );
620
-
621
-    if (!empty($results))
622
-        return $results;
623
-    else
624
-        return false;
604
+	global $wpdb, $post;
605
+
606
+	if (isset($post->ID) && $post->ID == $post_id && !$force_query) {
607
+		if (isset($post->rating_count) && $post->rating_count > 0 && isset($post->overall_rating) && $post->overall_rating > 0) {
608
+			return $post->overall_rating;
609
+		} else {
610
+			return 0;
611
+		}
612
+	}
613
+
614
+	$results = $wpdb->get_var(
615
+		$wpdb->prepare(
616
+			"SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
617
+			array($post_id)
618
+		)
619
+	);
620
+
621
+	if (!empty($results))
622
+		return $results;
623
+	else
624
+		return false;
625 625
 }
626 626
 
627 627
 /**
@@ -637,19 +637,19 @@  discard block
 block discarded – undo
637 637
  */
638 638
 function geodir_get_review_count_total($post_id = 0)
639 639
 {
640
-    global $wpdb;
641
-
642
-    $results = $wpdb->get_var(
643
-        $wpdb->prepare(
644
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
645
-            array($post_id)
646
-        )
647
-    );
648
-
649
-    if (!empty($results))
650
-        return $results;
651
-    else
652
-        return false;
640
+	global $wpdb;
641
+
642
+	$results = $wpdb->get_var(
643
+		$wpdb->prepare(
644
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
645
+			array($post_id)
646
+		)
647
+	);
648
+
649
+	if (!empty($results))
650
+		return $results;
651
+	else
652
+		return false;
653 653
 }
654 654
 
655 655
 /**
@@ -666,20 +666,20 @@  discard block
 block discarded – undo
666 666
  */
667 667
 function geodir_get_comments_number($post_id = 0)
668 668
 {
669
-    global $wpdb;
669
+	global $wpdb;
670 670
 
671
-    $results = $wpdb->get_var(
672
-        $wpdb->prepare(
673
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
674
-            array($post_id)
675
-        )
676
-    );
671
+	$results = $wpdb->get_var(
672
+		$wpdb->prepare(
673
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
674
+			array($post_id)
675
+		)
676
+	);
677 677
 
678 678
 
679
-    if (!empty($results))
680
-        return $results;
681
-    else
682
-        return false;
679
+	if (!empty($results))
680
+		return $results;
681
+	else
682
+		return false;
683 683
 }
684 684
 
685 685
 /**
@@ -695,19 +695,19 @@  discard block
 block discarded – undo
695 695
  */
696 696
 function geodir_get_commentoverall($comment_id = 0)
697 697
 {
698
-    global $wpdb;
699
-
700
-    $reatings = $wpdb->get_var(
701
-        $wpdb->prepare(
702
-            "SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
703
-            array($comment_id)
704
-        )
705
-    );
706
-
707
-    if ($reatings)
708
-        return $reatings;
709
-    else
710
-        return false;
698
+	global $wpdb;
699
+
700
+	$reatings = $wpdb->get_var(
701
+		$wpdb->prepare(
702
+			"SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
703
+			array($comment_id)
704
+		)
705
+	);
706
+
707
+	if ($reatings)
708
+		return $reatings;
709
+	else
710
+		return false;
711 711
 }
712 712
 
713 713
 /**
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
  */
722 722
 function geodir_get_commentoverall_number($post_id = 0)
723 723
 {
724
-    return geodir_get_post_rating($post_id);
724
+	return geodir_get_post_rating($post_id);
725 725
 }
726 726
 
727 727
 
@@ -739,98 +739,98 @@  discard block
 block discarded – undo
739 739
  */
740 740
 function geodir_comment_template($comment_template)
741 741
 {
742
-    global $post;
743
-
744
-    $post_types = geodir_get_posttypes();
745
-
746
-    if (!(is_singular() && (have_comments() || (isset($post->comment_status) && 'open' == $post->comment_status)))) {
747
-        return;
748
-    }
749
-    if (in_array($post->post_type, $post_types)) { // assuming there is a post type called business
750
-        $template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available
751
-        if (!$template) {
752
-            $template = dirname(__FILE__) . '/reviews.php';
753
-        }
754
-        return $template;
755
-    }
742
+	global $post;
743
+
744
+	$post_types = geodir_get_posttypes();
745
+
746
+	if (!(is_singular() && (have_comments() || (isset($post->comment_status) && 'open' == $post->comment_status)))) {
747
+		return;
748
+	}
749
+	if (in_array($post->post_type, $post_types)) { // assuming there is a post type called business
750
+		$template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available
751
+		if (!$template) {
752
+			$template = dirname(__FILE__) . '/reviews.php';
753
+		}
754
+		return $template;
755
+	}
756 756
 }
757 757
 
758 758
 add_filter("comments_template", "geodir_comment_template");
759 759
 
760 760
 
761 761
 if (!function_exists('geodir_comment')) {
762
-    /**
763
-     * Comment HTML markup.
764
-     *
765
-     * @since 1.0.0
766
-     * @package GeoDirectory
767
-     * @global object $post The current post object.
768
-     * @param object $comment The comment object.
769
-     * @param string|array $args {
770
-     *     Optional. Formatting options.
771
-     *
772
-     *     @type object $walker            Instance of a Walker class to list comments. Default null.
773
-     *     @type int    $max_depth         The maximum comments depth. Default empty.
774
-     *     @type string $style             The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
775
-     *     @type string $callback          Callback function to use. Default null.
776
-     *     @type string $end-callback      Callback function to use at the end. Default null.
777
-     *     @type string $type              Type of comments to list.
778
-     *                                     Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
779
-     *     @type int    $page              Page ID to list comments for. Default empty.
780
-     *     @type int    $per_page          Number of comments to list per page. Default empty.
781
-     *     @type int    $avatar_size       Height and width dimensions of the avatar size. Default 32.
782
-     *     @type string $reverse_top_level Ordering of the listed comments. Default null. Accepts 'desc', 'asc'.
783
-     *     @type bool   $reverse_children  Whether to reverse child comments in the list. Default null.
784
-     *     @type string $format            How to format the comments list.
785
-     *                                     Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
786
-     *     @type bool   $short_ping        Whether to output short pings. Default false.
787
-     *     @type bool   $echo              Whether to echo the output or return it. Default true.
788
-     * }
789
-     * @param int $depth Depth of comment.
790
-     */
791
-    function geodir_comment($comment, $args, $depth)
792
-    {
793
-        $GLOBALS['comment'] = $comment;
794
-        switch ($comment->comment_type) :
795
-            case 'pingback' :
796
-            case 'trackback' :
797
-                // Display trackbacks differently than normal comments.
798
-                ?>
762
+	/**
763
+	 * Comment HTML markup.
764
+	 *
765
+	 * @since 1.0.0
766
+	 * @package GeoDirectory
767
+	 * @global object $post The current post object.
768
+	 * @param object $comment The comment object.
769
+	 * @param string|array $args {
770
+	 *     Optional. Formatting options.
771
+	 *
772
+	 *     @type object $walker            Instance of a Walker class to list comments. Default null.
773
+	 *     @type int    $max_depth         The maximum comments depth. Default empty.
774
+	 *     @type string $style             The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
775
+	 *     @type string $callback          Callback function to use. Default null.
776
+	 *     @type string $end-callback      Callback function to use at the end. Default null.
777
+	 *     @type string $type              Type of comments to list.
778
+	 *                                     Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
779
+	 *     @type int    $page              Page ID to list comments for. Default empty.
780
+	 *     @type int    $per_page          Number of comments to list per page. Default empty.
781
+	 *     @type int    $avatar_size       Height and width dimensions of the avatar size. Default 32.
782
+	 *     @type string $reverse_top_level Ordering of the listed comments. Default null. Accepts 'desc', 'asc'.
783
+	 *     @type bool   $reverse_children  Whether to reverse child comments in the list. Default null.
784
+	 *     @type string $format            How to format the comments list.
785
+	 *                                     Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
786
+	 *     @type bool   $short_ping        Whether to output short pings. Default false.
787
+	 *     @type bool   $echo              Whether to echo the output or return it. Default true.
788
+	 * }
789
+	 * @param int $depth Depth of comment.
790
+	 */
791
+	function geodir_comment($comment, $args, $depth)
792
+	{
793
+		$GLOBALS['comment'] = $comment;
794
+		switch ($comment->comment_type) :
795
+			case 'pingback' :
796
+			case 'trackback' :
797
+				// Display trackbacks differently than normal comments.
798
+				?>
799 799
                 <li <?php comment_class('geodir-comment'); ?> id="comment-<?php comment_ID(); ?>">
800 800
                 <p><?php _e('Pingback:', 'geodirectory'); ?> <?php comment_author_link(); ?> <?php edit_comment_link(__('(Edit)', 'geodirectory'), '<span class="edit-link">', '</span>'); ?></p>
801 801
                 <?php
802
-                break;
803
-            default :
804
-                // Proceed with normal comments.
805
-                global $post;
806
-                ?>
802
+				break;
803
+			default :
804
+				// Proceed with normal comments.
805
+				global $post;
806
+				?>
807 807
             <li <?php comment_class('geodir-comment'); ?> id="li-comment-<?php comment_ID(); ?>">
808 808
                 <article id="comment-<?php comment_ID(); ?>" class="comment hreview">
809 809
                     <header class="comment-meta comment-author vcard">
810 810
                         <?php
811
-                        /**
812
-                         * Filter to modify comment avatar size
813
-                         *
814
-                         * You can use this filter to change comment avatar size.
815
-                         *
816
-                         * @since 1.0.0
817
-                         * @package GeoDirectory
818
-                         */
819
-                        $avatar_size = apply_filters('geodir_comment_avatar_size', 44);
820
-                        echo get_avatar($comment, $avatar_size);
821
-                        printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>',
822
-                            get_comment_author_link(),
823
-                            // If current post author is also comment author, make it known visually.
824
-                            ($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : ''
825
-                        );
826
-                        echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>";
827
-                        printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>',
828
-                            esc_url(get_comment_link($comment->comment_ID)),
829
-                            get_comment_time('c'),
830
-                            /* translators: 1: date, 2: time */
831
-                            sprintf(__('%1$s at %2$s', 'geodirectory'), get_comment_date(), get_comment_time())
832
-                        );
833
-                        ?>
811
+						/**
812
+						 * Filter to modify comment avatar size
813
+						 *
814
+						 * You can use this filter to change comment avatar size.
815
+						 *
816
+						 * @since 1.0.0
817
+						 * @package GeoDirectory
818
+						 */
819
+						$avatar_size = apply_filters('geodir_comment_avatar_size', 44);
820
+						echo get_avatar($comment, $avatar_size);
821
+						printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>',
822
+							get_comment_author_link(),
823
+							// If current post author is also comment author, make it known visually.
824
+							($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : ''
825
+						);
826
+						echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>";
827
+						printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>',
828
+							esc_url(get_comment_link($comment->comment_ID)),
829
+							get_comment_time('c'),
830
+							/* translators: 1: date, 2: time */
831
+							sprintf(__('%1$s at %2$s', 'geodirectory'), get_comment_date(), get_comment_time())
832
+						);
833
+						?>
834 834
                     </header>
835 835
                     <!-- .comment-meta -->
836 836
 
@@ -854,47 +854,47 @@  discard block
 block discarded – undo
854 854
                 </article>
855 855
                 <!-- #comment-## -->
856 856
                 <?php
857
-                break;
858
-        endswitch; // end comment_type check
859
-    }
857
+				break;
858
+		endswitch; // end comment_type check
859
+	}
860 860
 }
861 861
 
862 862
 
863 863
 add_filter('get_comments_number', 'geodir_fix_comment_count', 10, 2);
864 864
 if (!function_exists('geodir_fix_comment_count')) {
865
-    /**
866
-     * Fix comment count by not listing replies as reviews
867
-     *
868
-     * @since 1.0.0
869
-     * @package GeoDirectory
870
-     * @global object $post The current post object.
871
-     * @param int $count The comment count.
872
-     * @param int $post_id The post ID.
873
-     * @todo $post is unreachable since the function return the count before that variable.
874
-     * @return bool|null|string The comment count.
875
-     */
876
-    function geodir_fix_comment_count($count, $post_id)
877
-    {
878
-        if (!is_admin() || strpos($_SERVER['REQUEST_URI'], 'admin-ajax.php')) {
879
-            global $post;
880
-            $post_types = geodir_get_posttypes();
881
-
882
-            if (in_array(get_post_type($post_id), $post_types)) {
883
-                $review_count = geodir_get_review_count_total($post_id);
884
-                return $review_count;
885
-
886
-                if ($post && isset($post->rating_count)) {
887
-                    return $post->rating_count;
888
-                } else {
889
-                    return geodir_get_comments_number($post_id);
890
-                }
891
-            } else {
892
-                return $count;
893
-            }
894
-        } else {
895
-            return $count;
896
-        }
897
-    }
865
+	/**
866
+	 * Fix comment count by not listing replies as reviews
867
+	 *
868
+	 * @since 1.0.0
869
+	 * @package GeoDirectory
870
+	 * @global object $post The current post object.
871
+	 * @param int $count The comment count.
872
+	 * @param int $post_id The post ID.
873
+	 * @todo $post is unreachable since the function return the count before that variable.
874
+	 * @return bool|null|string The comment count.
875
+	 */
876
+	function geodir_fix_comment_count($count, $post_id)
877
+	{
878
+		if (!is_admin() || strpos($_SERVER['REQUEST_URI'], 'admin-ajax.php')) {
879
+			global $post;
880
+			$post_types = geodir_get_posttypes();
881
+
882
+			if (in_array(get_post_type($post_id), $post_types)) {
883
+				$review_count = geodir_get_review_count_total($post_id);
884
+				return $review_count;
885
+
886
+				if ($post && isset($post->rating_count)) {
887
+					return $post->rating_count;
888
+				} else {
889
+					return geodir_get_comments_number($post_id);
890
+				}
891
+			} else {
892
+				return $count;
893
+			}
894
+		} else {
895
+			return $count;
896
+		}
897
+	}
898 898
 }
899 899
 
900 900
 /**
@@ -911,11 +911,11 @@  discard block
 block discarded – undo
911 911
  */
912 912
 function geodir_get_rating_stars($rating, $post_id, $small = false)
913 913
 {
914
-    $a_rating = $rating / 5 * 100;
914
+	$a_rating = $rating / 5 * 100;
915 915
 
916
-    if ($small) {
917
-        $r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
918
-    } else {
916
+	if ($small) {
917
+		$r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
918
+	} else {
919 919
 		if (function_exists('geodir_reviewrating_draw_overall_rating')) {
920 920
 			// Show rating stars from review rating manager
921 921
 			$r_html = geodir_reviewrating_draw_overall_rating($rating);
@@ -933,8 +933,8 @@  discard block
 block discarded – undo
933 933
 			}
934 934
 			$r_html = '<div class="geodir-rating" style="' . $attach_style . '"><div class="gd_rating_show" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingAverage" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star">' . $rating_img . $rating_img . $rating_img . $rating_img . $rating_img . '</div></div></div>';
935 935
 		}
936
-    }
937
-    return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5);
936
+	}
937
+	return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5);
938 938
 }
939 939
 
940 940
 /**
@@ -948,23 +948,23 @@  discard block
 block discarded – undo
948 948
 function geodir_is_reviews_show($pageview = '')
949 949
 {
950 950
 
951
-    $active_tabs = get_option('geodir_detail_page_tabs_excluded');
952
-
953
-    $is_display = true;
954
-    if (!empty($active_tabs) && in_array('reviews', $active_tabs))
955
-        $is_display = false;
956
-
957
-    /**
958
-     * Filter to change display value.
959
-     *
960
-     * You can use this filter to change the is_display value.
961
-     *
962
-     * @since 1.0.0
963
-     * @package GeoDirectory
964
-     * @param bool $is_display Display ratings when set to true.
965
-     * @param string $pageview The view template. Ex: listview, gridview etc.
966
-     */
967
-    return apply_filters('geodir_is_reviews_show', $is_display, $pageview);
951
+	$active_tabs = get_option('geodir_detail_page_tabs_excluded');
952
+
953
+	$is_display = true;
954
+	if (!empty($active_tabs) && in_array('reviews', $active_tabs))
955
+		$is_display = false;
956
+
957
+	/**
958
+	 * Filter to change display value.
959
+	 *
960
+	 * You can use this filter to change the is_display value.
961
+	 *
962
+	 * @since 1.0.0
963
+	 * @package GeoDirectory
964
+	 * @param bool $is_display Display ratings when set to true.
965
+	 * @param string $pageview The view template. Ex: listview, gridview etc.
966
+	 */
967
+	return apply_filters('geodir_is_reviews_show', $is_display, $pageview);
968 968
 }
969 969
 
970 970
 
@@ -972,9 +972,9 @@  discard block
 block discarded – undo
972 972
  * If Disqus plugin is active, do some fixes to show on blogs but no on GD post types
973 973
  */
974 974
 if(function_exists('dsq_can_replace')) {
975
-    remove_filter('comments_template', 'dsq_comments_template');
976
-    add_filter('comments_template', 'dsq_comments_template', 100);
977
-    add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
975
+	remove_filter('comments_template', 'dsq_comments_template');
976
+	add_filter('comments_template', 'dsq_comments_template', 100);
977
+	add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
978 978
 }
979 979
 
980 980
 
@@ -988,13 +988,13 @@  discard block
 block discarded – undo
988 988
  * @return string `1` if active `0` if disabled.
989 989
  */
990 990
 function geodir_option_disqus_active($disqus_active){
991
-    global $post;
992
-    $all_postypes = geodir_get_posttypes();
991
+	global $post;
992
+	$all_postypes = geodir_get_posttypes();
993 993
 
994
-    if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
995
-        $disqus_active = '0';
996
-    }
994
+	if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
995
+		$disqus_active = '0';
996
+	}
997 997
 
998
-    return $disqus_active;
998
+	return $disqus_active;
999 999
 }
1000 1000
 
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   +6 added lines, -6 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();
@@ -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
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -1,87 +1,87 @@
 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
-        $query_args = array(
15
-            'post_status' => 'publish',
16
-            'post_type' => 'gd_place',
17
-            'posts_per_page' => 1,
18
-        );
14
+		$query_args = array(
15
+			'post_status' => 'publish',
16
+			'post_type' => 'gd_place',
17
+			'posts_per_page' => 1,
18
+		);
19 19
 
20
-        $all_posts = new WP_Query( $query_args );
21
-        $post_id = null;
22
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
23
-            $post_id = get_the_ID();
24
-        endwhile;
20
+		$all_posts = new WP_Query( $query_args );
21
+		$post_id = null;
22
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
23
+			$post_id = get_the_ID();
24
+		endwhile;
25 25
 
26
-        $this->assertTrue(is_int($post_id));
26
+		$this->assertTrue(is_int($post_id));
27 27
 
28
-        ob_start();
29
-        geodir_add_to_favorite($post_id);
30
-        $output = ob_get_clean();
31
-        $this->assertContains( 'Remove from Favorites', $output );
28
+		ob_start();
29
+		geodir_add_to_favorite($post_id);
30
+		$output = ob_get_clean();
31
+		$this->assertContains( 'Remove from Favorites', $output );
32 32
 
33
-        $user_id = $current_user->ID;
33
+		$user_id = $current_user->ID;
34 34
 
35
-        $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
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
+	}
41 41
 
42
-    public function testRemoveFavourite()
43
-    {
44
-        global $current_user;
42
+	public function testRemoveFavourite()
43
+	{
44
+		global $current_user;
45 45
 
46
-        $query_args = array(
47
-            'post_status' => 'publish',
48
-            'post_type' => 'gd_place',
49
-            'posts_per_page' => 1,
50
-        );
46
+		$query_args = array(
47
+			'post_status' => 'publish',
48
+			'post_type' => 'gd_place',
49
+			'posts_per_page' => 1,
50
+		);
51 51
 
52
-        $all_posts = new WP_Query( $query_args );
53
-        $post_id = null;
54
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
55
-            $post_id = get_the_ID();
56
-        endwhile;
52
+		$all_posts = new WP_Query( $query_args );
53
+		$post_id = null;
54
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
55
+			$post_id = get_the_ID();
56
+		endwhile;
57 57
 
58
-        $this->assertTrue(is_int($post_id));
58
+		$this->assertTrue(is_int($post_id));
59 59
 
60
-        ob_start();
61
-        geodir_add_to_favorite($post_id);
62
-        $output = ob_get_clean();
63
-        $this->assertContains( 'Remove from Favorites', $output );
60
+		ob_start();
61
+		geodir_add_to_favorite($post_id);
62
+		$output = ob_get_clean();
63
+		$this->assertContains( 'Remove from Favorites', $output );
64 64
 
65
-        $user_id = $current_user->ID;
65
+		$user_id = $current_user->ID;
66 66
 
67
-        $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
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
-        ob_start();
72
-        geodir_remove_from_favorite($post_id);
73
-        $output = ob_get_clean();
74
-        $this->assertContains( 'Add to Favorites', $output );
71
+		ob_start();
72
+		geodir_remove_from_favorite($post_id);
73
+		$output = ob_get_clean();
74
+		$this->assertContains( 'Add to Favorites', $output );
75 75
 
76
-        $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
76
+		$user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
77 77
 
78
-        $this->assertNotContains( $post_id, $user_fav_posts );
79
-    }
78
+		$this->assertNotContains( $post_id, $user_fav_posts );
79
+	}
80 80
 
81 81
 
82
-    public function tearDown()
83
-    {
84
-        parent::tearDown();
85
-    }
82
+	public function tearDown()
83
+	{
84
+		parent::tearDown();
85
+	}
86 86
 }
87 87
 ?>
88 88
\ No newline at end of file
Please login to merge, or discard this patch.
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.
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/bootstrap.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,41 +3,41 @@  discard block
 block discarded – undo
3 3
 $_SERVER['SERVER_NAME'] = '';
4 4
 $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
5 5
 
6
-define( 'GD_USE_PHP_SESSIONS', false );
7
-define( 'GD_TESTING_MODE', true );
6
+define('GD_USE_PHP_SESSIONS', false);
7
+define('GD_TESTING_MODE', true);
8 8
 
9
-$_tests_dir = getenv( 'WP_TESTS_DIR' );
9
+$_tests_dir = getenv('WP_TESTS_DIR');
10 10
 
11
-if ( ! $_tests_dir ) {
12
-	$_tests_dir = dirname( __FILE__ )  . '/lib/wordpress-tests-lib';
11
+if (!$_tests_dir) {
12
+	$_tests_dir = dirname(__FILE__) . '/lib/wordpress-tests-lib';
13 13
 }
14 14
 
15 15
 require_once $_tests_dir . '/includes/functions.php';
16 16
 
17 17
 function _manually_load_plugin() {
18
-	require dirname( __FILE__ ) . '/../geodirectory.php';
18
+	require dirname(__FILE__) . '/../geodirectory.php';
19 19
 }
20
-tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
20
+tests_add_filter('muplugins_loaded', '_manually_load_plugin');
21 21
 
22 22
 function place_dummy_image_url($url) {
23
-	$gd_dummy_base_url = getenv( 'GD_DUMMY_BASE_URL' );
23
+	$gd_dummy_base_url = getenv('GD_DUMMY_BASE_URL');
24 24
 	if ($gd_dummy_base_url) {
25 25
 		return $gd_dummy_base_url;
26 26
 	} else {
27 27
 		return $url;
28 28
 	}
29 29
 }
30
-tests_add_filter( 'place_dummy_image_url', 'place_dummy_image_url' );
30
+tests_add_filter('place_dummy_image_url', 'place_dummy_image_url');
31 31
 
32 32
 function place_dummy_cat_image_url($url) {
33
-	$gd_dummy_base_url = getenv( 'GD_DUMMY_BASE_URL' );
33
+	$gd_dummy_base_url = getenv('GD_DUMMY_BASE_URL');
34 34
 	if ($gd_dummy_base_url) {
35
-		return $gd_dummy_base_url."/cat_icon";
35
+		return $gd_dummy_base_url . "/cat_icon";
36 36
 	} else {
37 37
 		return $url;
38 38
 	}
39 39
 }
40
-tests_add_filter( 'place_dummy_cat_image_url', 'place_dummy_cat_image_url' );
40
+tests_add_filter('place_dummy_cat_image_url', 'place_dummy_cat_image_url');
41 41
 
42 42
 
43 43
 require $_tests_dir . '/includes/bootstrap.php';
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
 global $current_user;
46 46
 $current_user = new WP_User(1);
47 47
 $current_user->set_role('administrator');
48
-wp_update_user( array( 'ID' => 1, 'first_name' => 'Admin', 'last_name' => 'User' ) );
48
+wp_update_user(array('ID' => 1, 'first_name' => 'Admin', 'last_name' => 'User'));
49 49
 //Add subscriber
50
-wp_create_user( 'testuser', '12345', '[email protected]' );
50
+wp_create_user('testuser', '12345', '[email protected]');
51 51
 
52 52
 echo "Activating GeoDirectory...\n";
53
-activate_plugin( 'geodirectory/geodirectory.php' );
53
+activate_plugin('geodirectory/geodirectory.php');
54 54
 
55 55
 echo "Installing GeoDirectory...\n";
56 56
 geodir_install();
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 //	unset($_REQUEST['_wpnonce']);
122 122
 
123 123
 	$i = 2;
124
-	while($i <= $max) {
124
+	while ($i <= $max) {
125 125
 		global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
126 126
 
127 127
 		$dummy_post_index = $i;
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		$city_bound_lat2 = 40.91525559999999;
131 131
 		$city_bound_lng2 = -73.7002721;
132 132
 
133
-		include dirname( __FILE__ ) . '/../geodirectory-admin/place_dummy_post.php';
133
+		include dirname(__FILE__) . '/../geodirectory-admin/place_dummy_post.php';
134 134
 		$i++;
135 135
 	}
136 136
 }
Please login to merge, or discard this patch.
tests/test-Author_Page.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 AuthorPage 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 testAuthorPage()
10
-    {
9
+	public function testAuthorPage()
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.