Test Failed
Push — master ( e3dc1d...73d69d )
by Stiofan
18:03
created
geodirectory-widgets/geodirectory_popular_widget.php 2 patches
Indentation   +217 added lines, -217 removed lines patch added patch discarded remove patch
@@ -14,83 +14,83 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class geodir_popular_post_category extends WP_Widget
16 16
 {
17
-    /**
18
-     * Register the popular post category widget.
19
-     *
20
-     * @since 1.0.0
21
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22
-     */
23
-    public function __construct() {
24
-        $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory'));
25
-        parent::__construct(
26
-            'popular_post_category', // Base ID
27
-            __('GD > Popular Post Category', 'geodirectory'), // Name
28
-            $widget_ops// Args
29
-        );
30
-    }
31
-
32
-    /**
33
-     * Front-end display content for popular post category widget.
34
-     *
35
-     * @since 1.0.0
36
-     * @since 1.5.1 Declare function public.
37
-     *
38
-     * @param array $args     Widget arguments.
39
-     * @param array $instance Saved values from database.
40
-     */
41
-    public function widget($args, $instance)
42
-    {
43
-        geodir_popular_post_category_output($args, $instance);
44
-    }
45
-
46
-    /**
47
-     * Sanitize popular post category widget form values as they are saved.
48
-     *
49
-     * @since 1.0.0
50
-     * @since 1.5.1 Declare function public.
51
-     * @since 1.5.1 Added default_post_type parameter.
52
-     * @since 1.6.9 Added parent_only parameter.
53
-     *
54
-     * @param array $new_instance Values just sent to be saved.
55
-     * @param array $old_instance Previously saved values from database.
56
-     *
57
-     * @return array Updated safe values to be saved.
58
-     */ 
59
-    public function update($new_instance, $old_instance)
60
-    {
61
-        //save the widget
62
-        $instance = $old_instance;
63
-        $instance['title'] = strip_tags($new_instance['title']);
64
-        $category_limit = (int)$new_instance['category_limit'];
65
-        $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15;
66
-        $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : '';
67
-        $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false;
68
-        return $instance;
69
-    }
70
-
71
-    /**
72
-     * Back-end popular post category widget settings form.
73
-     *
74
-     * @since 1.0.0
75
-     * @since 1.5.1 Declare function public.
76
-     * @since 1.5.1 Added option to set default post type.
77
-     * @since 1.6.9 Added option to show parent categories only.
78
-     *
79
-     * @param array $instance Previously saved values from database.
80
-     */
81
-    public function form($instance) 
82
-    {
83
-        //widgetform in backend
84
-        $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false));
85
-
86
-        $title = strip_tags($instance['title']);
87
-        $category_limit = (int)$instance['category_limit'];
88
-        $category_limit = $category_limit > 0 ? $category_limit : 15;
89
-        $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : '';
90
-        $parent_only = !empty($instance['parent_only']) ? true: false;
17
+	/**
18
+	 * Register the popular post category widget.
19
+	 *
20
+	 * @since 1.0.0
21
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22
+	 */
23
+	public function __construct() {
24
+		$widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory'));
25
+		parent::__construct(
26
+			'popular_post_category', // Base ID
27
+			__('GD > Popular Post Category', 'geodirectory'), // Name
28
+			$widget_ops// Args
29
+		);
30
+	}
31
+
32
+	/**
33
+	 * Front-end display content for popular post category widget.
34
+	 *
35
+	 * @since 1.0.0
36
+	 * @since 1.5.1 Declare function public.
37
+	 *
38
+	 * @param array $args     Widget arguments.
39
+	 * @param array $instance Saved values from database.
40
+	 */
41
+	public function widget($args, $instance)
42
+	{
43
+		geodir_popular_post_category_output($args, $instance);
44
+	}
45
+
46
+	/**
47
+	 * Sanitize popular post category widget form values as they are saved.
48
+	 *
49
+	 * @since 1.0.0
50
+	 * @since 1.5.1 Declare function public.
51
+	 * @since 1.5.1 Added default_post_type parameter.
52
+	 * @since 1.6.9 Added parent_only parameter.
53
+	 *
54
+	 * @param array $new_instance Values just sent to be saved.
55
+	 * @param array $old_instance Previously saved values from database.
56
+	 *
57
+	 * @return array Updated safe values to be saved.
58
+	 */ 
59
+	public function update($new_instance, $old_instance)
60
+	{
61
+		//save the widget
62
+		$instance = $old_instance;
63
+		$instance['title'] = strip_tags($new_instance['title']);
64
+		$category_limit = (int)$new_instance['category_limit'];
65
+		$instance['category_limit'] = $category_limit > 0 ? $category_limit : 15;
66
+		$instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : '';
67
+		$instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false;
68
+		return $instance;
69
+	}
70
+
71
+	/**
72
+	 * Back-end popular post category widget settings form.
73
+	 *
74
+	 * @since 1.0.0
75
+	 * @since 1.5.1 Declare function public.
76
+	 * @since 1.5.1 Added option to set default post type.
77
+	 * @since 1.6.9 Added option to show parent categories only.
78
+	 *
79
+	 * @param array $instance Previously saved values from database.
80
+	 */
81
+	public function form($instance) 
82
+	{
83
+		//widgetform in backend
84
+		$instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false));
85
+
86
+		$title = strip_tags($instance['title']);
87
+		$category_limit = (int)$instance['category_limit'];
88
+		$category_limit = $category_limit > 0 ? $category_limit : 15;
89
+		$default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : '';
90
+		$parent_only = !empty($instance['parent_only']) ? true: false;
91 91
         
92
-        $post_type_options = geodir_get_posttypes('options');
93
-        ?>
92
+		$post_type_options = geodir_get_posttypes('options');
93
+		?>
94 94
         <p>
95 95
             <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
96 96
                 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>"/>
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
             <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label>
117 117
         </p>
118 118
     <?php
119
-    }
119
+	}
120 120
 } // class geodir_popular_post_category
121 121
 
122 122
 register_widget('geodir_popular_post_category');
@@ -130,40 +130,40 @@  discard block
 block discarded – undo
130 130
 class geodir_popular_postview extends WP_Widget
131 131
 {
132 132
 
133
-    /**
133
+	/**
134 134
 	 * Register the popular posts widget.
135 135
 	 *
136 136
 	 * @since 1.0.0
137
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
137
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
138 138
 	 */
139
-    public function __construct() {
140
-        $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory'));
141
-        parent::__construct(
142
-            'popular_post_view', // Base ID
143
-            __('GD > Popular Post View', 'geodirectory'), // Name
144
-            $widget_ops// Args
145
-        );
146
-    }
139
+	public function __construct() {
140
+		$widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory'));
141
+		parent::__construct(
142
+			'popular_post_view', // Base ID
143
+			__('GD > Popular Post View', 'geodirectory'), // Name
144
+			$widget_ops// Args
145
+		);
146
+	}
147 147
 
148 148
 	/**
149 149
 	 * Front-end display content for popular posts widget.
150 150
 	 *
151 151
 	 * @since 1.0.0
152
-     * @since 1.5.1 Declare function public.
152
+	 * @since 1.5.1 Declare function public.
153 153
 	 *
154 154
 	 * @param array $args     Widget arguments.
155 155
 	 * @param array $instance Saved values from database.
156 156
 	 */
157 157
 	public function widget($args, $instance)
158
-    {
159
-        geodir_popular_postview_output($args, $instance);
160
-    }
158
+	{
159
+		geodir_popular_postview_output($args, $instance);
160
+	}
161 161
 
162 162
 	/**
163 163
 	 * Sanitize popular posts widget form values as they are saved.
164 164
 	 *
165 165
 	 * @since 1.0.0
166
-     * @since 1.5.1 Declare function public.
166
+	 * @since 1.5.1 Declare function public.
167 167
 	 *
168 168
 	 * @param array $new_instance Values just sent to be saved.
169 169
 	 * @param array $old_instance Previously saved values from database.
@@ -171,102 +171,102 @@  discard block
 block discarded – undo
171 171
 	 * @return array Updated safe values to be saved.
172 172
 	 */
173 173
 	public function update($new_instance, $old_instance)
174
-    {
175
-        //save the widget
176
-        $instance = $old_instance;
177
-
178
-        if ($new_instance['title'] == '') {
179
-            $title = geodir_ucwords(strip_tags($new_instance['category_title']));
180
-            //$instance['title'] = $title;
181
-        }
182
-        $instance['title'] = strip_tags($new_instance['title']);
183
-
184
-        $instance['post_type'] = strip_tags($new_instance['post_type']);
185
-        //$instance['category'] = strip_tags($new_instance['category']);
186
-        $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : '';
187
-        $instance['category_title'] = strip_tags($new_instance['category_title']);
188
-        $instance['post_number'] = strip_tags($new_instance['post_number']);
189
-        $instance['layout'] = strip_tags($new_instance['layout']);
190
-        $instance['listing_width'] = strip_tags($new_instance['listing_width']);
191
-        $instance['list_sort'] = strip_tags($new_instance['list_sort']);
192
-        $instance['character_count'] = $new_instance['character_count'];
193
-        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
194
-            $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
195
-        else
196
-            $instance['add_location_filter'] = '0';
197
-
198
-        $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0;
199
-        $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0;
200
-        $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0;
201
-        $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0;
202
-        $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0;
203
-        $instance['hide_if_empty'] = !empty($new_instance['hide_if_empty']) ? 1 : 0;
204
-
205
-        return $instance;
206
-    }
174
+	{
175
+		//save the widget
176
+		$instance = $old_instance;
177
+
178
+		if ($new_instance['title'] == '') {
179
+			$title = geodir_ucwords(strip_tags($new_instance['category_title']));
180
+			//$instance['title'] = $title;
181
+		}
182
+		$instance['title'] = strip_tags($new_instance['title']);
183
+
184
+		$instance['post_type'] = strip_tags($new_instance['post_type']);
185
+		//$instance['category'] = strip_tags($new_instance['category']);
186
+		$instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : '';
187
+		$instance['category_title'] = strip_tags($new_instance['category_title']);
188
+		$instance['post_number'] = strip_tags($new_instance['post_number']);
189
+		$instance['layout'] = strip_tags($new_instance['layout']);
190
+		$instance['listing_width'] = strip_tags($new_instance['listing_width']);
191
+		$instance['list_sort'] = strip_tags($new_instance['list_sort']);
192
+		$instance['character_count'] = $new_instance['character_count'];
193
+		if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
194
+			$instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
195
+		else
196
+			$instance['add_location_filter'] = '0';
197
+
198
+		$instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0;
199
+		$instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0;
200
+		$instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0;
201
+		$instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0;
202
+		$instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0;
203
+		$instance['hide_if_empty'] = !empty($new_instance['hide_if_empty']) ? 1 : 0;
204
+
205
+		return $instance;
206
+	}
207 207
 
208 208
 	/**
209 209
 	 * Back-end popular posts widget settings form.
210 210
 	 *
211 211
 	 * @since 1.0.0
212
-     * @since 1.5.1 Declare function public.
212
+	 * @since 1.5.1 Declare function public.
213 213
 	 *
214 214
 	 * @param array $instance Previously saved values from database.
215 215
 	 */
216 216
 	public function form($instance)
217
-    {
218
-        //widgetform in backend
219
-        $instance = wp_parse_args((array)$instance,
220
-            array('title' => '',
221
-                'post_type' => '',
222
-                'category' => array(),
223
-                'category_title' => '',
224
-                'list_sort' => '',
225
-                'list_order' => '',
226
-                'post_number' => '5',
227
-                'layout' => 'gridview_onehalf',
228
-                'listing_width' => '',
229
-                'add_location_filter' => '1',
230
-                'character_count' => '20',
231
-                'show_featured_only' => '',
232
-                'show_special_only' => '',
233
-                'with_pics_only' => '',
234
-                'with_videos_only' => '',
235
-                'use_viewing_post_type' => '',
236
-                'hide_if_empty' => ''
237
-            )
238
-        );
217
+	{
218
+		//widgetform in backend
219
+		$instance = wp_parse_args((array)$instance,
220
+			array('title' => '',
221
+				'post_type' => '',
222
+				'category' => array(),
223
+				'category_title' => '',
224
+				'list_sort' => '',
225
+				'list_order' => '',
226
+				'post_number' => '5',
227
+				'layout' => 'gridview_onehalf',
228
+				'listing_width' => '',
229
+				'add_location_filter' => '1',
230
+				'character_count' => '20',
231
+				'show_featured_only' => '',
232
+				'show_special_only' => '',
233
+				'with_pics_only' => '',
234
+				'with_videos_only' => '',
235
+				'use_viewing_post_type' => '',
236
+				'hide_if_empty' => ''
237
+			)
238
+		);
239 239
 
240
-        $title = strip_tags($instance['title']);
240
+		$title = strip_tags($instance['title']);
241 241
 
242
-        $post_type = strip_tags($instance['post_type']);
242
+		$post_type = strip_tags($instance['post_type']);
243 243
 
244
-        $category = $instance['category'];
244
+		$category = $instance['category'];
245 245
 
246
-        $category_title = strip_tags($instance['category_title']);
246
+		$category_title = strip_tags($instance['category_title']);
247 247
 
248
-        $list_sort = strip_tags($instance['list_sort']);
248
+		$list_sort = strip_tags($instance['list_sort']);
249 249
 
250
-        $list_order = strip_tags($instance['list_order']);
250
+		$list_order = strip_tags($instance['list_order']);
251 251
 
252
-        $post_number = strip_tags($instance['post_number']);
252
+		$post_number = strip_tags($instance['post_number']);
253 253
 
254
-        $layout = strip_tags($instance['layout']);
254
+		$layout = strip_tags($instance['layout']);
255 255
 
256
-        $listing_width = strip_tags($instance['listing_width']);
256
+		$listing_width = strip_tags($instance['listing_width']);
257 257
 
258
-        $add_location_filter = strip_tags($instance['add_location_filter']);
258
+		$add_location_filter = strip_tags($instance['add_location_filter']);
259 259
 
260
-        $character_count = $instance['character_count'];
260
+		$character_count = $instance['character_count'];
261 261
 
262
-        $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false;
263
-        $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false;
264
-        $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false;
265
-        $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false;
266
-        $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false;
267
-        $hide_if_empty = !empty($instance['hide_if_empty']) ? true : false;
262
+		$show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false;
263
+		$show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false;
264
+		$with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false;
265
+		$with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false;
266
+		$use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false;
267
+		$hide_if_empty = !empty($instance['hide_if_empty']) ? true : false;
268 268
 
269
-        ?>
269
+		?>
270 270
         <p>
271 271
             <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
272 272
                 <small>(%posttype_singular_label% ,
@@ -300,9 +300,9 @@  discard block
 block discarded – undo
300 300
                     <?php foreach ($postypes as $postypes_obj) { ?>
301 301
 
302 302
                         <option <?php if ($post_type == $postypes_obj) {
303
-                            echo 'selected="selected"';
304
-                        } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
305
-                            echo geodir_utf8_ucfirst($extvalue[1]); ?></option>
303
+							echo 'selected="selected"';
304
+						} ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
305
+							echo geodir_utf8_ucfirst($extvalue[1]); ?></option>
306 306
 
307 307
                     <?php } ?>
308 308
 
@@ -317,30 +317,30 @@  discard block
 block discarded – undo
317 317
 
318 318
                 <?php
319 319
 
320
-                $post_type = ($post_type != '') ? $post_type : 'gd_place';
320
+				$post_type = ($post_type != '') ? $post_type : 'gd_place';
321 321
 
322
-                $all_postypes = geodir_get_posttypes();
322
+				$all_postypes = geodir_get_posttypes();
323 323
 
324
-                if (!in_array($post_type, $all_postypes))
325
-                    $post_type = 'gd_place';
324
+				if (!in_array($post_type, $all_postypes))
325
+					$post_type = 'gd_place';
326 326
 
327
-                $category_taxonomy = geodir_get_taxonomies($post_type);
328
-                $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
327
+				$category_taxonomy = geodir_get_taxonomies($post_type);
328
+				$categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
329 329
 
330
-                ?>
330
+				?>
331 331
 
332 332
                 <select multiple="multiple" class="widefat" name="<?php echo $this->get_field_name('category'); ?>[]"
333 333
                         onchange="geodir_popular_widget_cat_title(this)">
334 334
 
335 335
                     <option <?php if (!is_array($category) || (is_array($category) && in_array('0', $category))) {
336
-                        echo 'selected="selected"';
337
-                    } ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
336
+						echo 'selected="selected"';
337
+					} ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
338 338
                     <?php foreach ($categories as $category_obj) {
339
-                        $selected = '';
340
-                        if (is_array($category) && in_array($category_obj->term_id, $category))
341
-                            echo $selected = 'selected="selected"';
339
+						$selected = '';
340
+						if (is_array($category) && in_array($category_obj->term_id, $category))
341
+							echo $selected = 'selected="selected"';
342 342
 
343
-                        ?>
343
+						?>
344 344
 
345 345
                         <option <?php echo $selected; ?>
346 346
                             value="<?php echo $category_obj->term_id; ?>"><?php echo geodir_utf8_ucfirst($category_obj->name); ?></option>
@@ -361,32 +361,32 @@  discard block
 block discarded – undo
361 361
             <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?>
362 362
 
363 363
                 <?php
364
-                $list_sort_arr = array(
365
-                    "az"        =>  __('A-Z', 'geodirectory'),
366
-                    "latest"        =>  __('Latest', 'geodirectory'),
367
-                    "featured"        =>  __('Featured', 'geodirectory'),
368
-                    "high_review"        =>  __('Review', 'geodirectory'),
369
-                    "high_rating"        =>  __('Rating', 'geodirectory'),
370
-                    "random"        =>  __('Random', 'geodirectory'),
371
-                );
372
-
373
-                /**
374
-                 * Filter the Popular post view widget sorting options.
375
-                 *
376
-                 * @since 1.6.22
377
-                 * @param array $list_sort_arr The array of key value pairs of settings.
378
-                 * @param array $instance The array of widget settings.
379
-                 */
380
-                $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance);
381
-                ?>
364
+				$list_sort_arr = array(
365
+					"az"        =>  __('A-Z', 'geodirectory'),
366
+					"latest"        =>  __('Latest', 'geodirectory'),
367
+					"featured"        =>  __('Featured', 'geodirectory'),
368
+					"high_review"        =>  __('Review', 'geodirectory'),
369
+					"high_rating"        =>  __('Rating', 'geodirectory'),
370
+					"random"        =>  __('Random', 'geodirectory'),
371
+				);
372
+
373
+				/**
374
+				 * Filter the Popular post view widget sorting options.
375
+				 *
376
+				 * @since 1.6.22
377
+				 * @param array $list_sort_arr The array of key value pairs of settings.
378
+				 * @param array $instance The array of widget settings.
379
+				 */
380
+				$list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance);
381
+				?>
382 382
 
383 383
                 <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>"
384 384
                         name="<?php echo $this->get_field_name('list_sort'); ?>">
385 385
                     <?php
386
-                    foreach($list_sort_arr as $sort_val => $sort_title){
387
-                        echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>";
388
-                    }
389
-                    ?>
386
+					foreach($list_sort_arr as $sort_val => $sort_title){
387
+						echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>";
388
+					}
389
+					?>
390 390
                 </select>
391 391
             </label>
392 392
         </p>
@@ -408,24 +408,24 @@  discard block
 block discarded – undo
408 408
                 <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>"
409 409
                         name="<?php echo $this->get_field_name('layout'); ?>">
410 410
                     <option <?php if ($layout == 'gridview_onehalf') {
411
-                        echo 'selected="selected"';
412
-                    } ?>
411
+						echo 'selected="selected"';
412
+					} ?>
413 413
                         value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?></option>
414 414
                     <option <?php if ($layout == 'gridview_onethird') {
415
-                        echo 'selected="selected"';
416
-                    } ?>
415
+						echo 'selected="selected"';
416
+					} ?>
417 417
                         value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?></option>
418 418
                     <option <?php if ($layout == 'gridview_onefourth') {
419
-                        echo 'selected="selected"';
420
-                    } ?>
419
+						echo 'selected="selected"';
420
+					} ?>
421 421
                         value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?></option>
422 422
                     <option <?php if ($layout == 'gridview_onefifth') {
423
-                        echo 'selected="selected"';
424
-                    } ?>
423
+						echo 'selected="selected"';
424
+					} ?>
425 425
                         value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?></option>
426 426
                     <option <?php if ($layout == 'list') {
427
-                        echo 'selected="selected"';
428
-                    } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option>
427
+						echo 'selected="selected"';
428
+					} ?> value="list"><?php _e('List view', 'geodirectory'); ?></option>
429 429
 
430 430
                 </select>
431 431
             </label>
@@ -495,8 +495,8 @@  discard block
 block discarded – undo
495 495
                 for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?>
496 496
                 <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"
497 497
                        name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) {
498
-                    echo 'checked="checked"';
499
-                } ?>  value="1"/>
498
+					echo 'checked="checked"';
499
+				} ?>  value="1"/>
500 500
             </label>
501 501
         </p>
502 502
         <p>
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
         </script>
545 545
 
546 546
     <?php
547
-    }
547
+	}
548 548
 } // class geodir_popular_postview
549 549
 
550 550
 register_widget('geodir_popular_postview');
551 551
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         //save the widget
62 62
         $instance = $old_instance;
63 63
         $instance['title'] = strip_tags($new_instance['title']);
64
-        $category_limit = (int)$new_instance['category_limit'];
64
+        $category_limit = (int) $new_instance['category_limit'];
65 65
         $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15;
66 66
         $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : '';
67 67
         $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false;
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
     public function form($instance) 
82 82
     {
83 83
         //widgetform in backend
84
-        $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false));
84
+        $instance = wp_parse_args((array) $instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false));
85 85
 
86 86
         $title = strip_tags($instance['title']);
87
-        $category_limit = (int)$instance['category_limit'];
87
+        $category_limit = (int) $instance['category_limit'];
88 88
         $category_limit = $category_limit > 0 ? $category_limit : 15;
89 89
         $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : '';
90
-        $parent_only = !empty($instance['parent_only']) ? true: false;
90
+        $parent_only = !empty($instance['parent_only']) ? true : false;
91 91
         
92 92
         $post_type_options = geodir_get_posttypes('options');
93 93
         ?>
@@ -97,23 +97,23 @@  discard block
 block discarded – undo
97 97
             </label>
98 98
         </p>
99 99
         <p>
100
-            <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory');?>
100
+            <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory'); ?>
101 101
                 <select class="widefat" id="<?php echo $this->get_field_id('default_post_type'); ?>" name="<?php echo $this->get_field_name('default_post_type'); ?>">
102 102
                 <?php foreach ($post_type_options as $name => $title) { ?>
103
-                    <option value="<?php echo $name;?>" <?php selected($name, $default_post_type);?>><?php echo $title; ?></option>
103
+                    <option value="<?php echo $name; ?>" <?php selected($name, $default_post_type); ?>><?php echo $title; ?></option>
104 104
                 <?php } ?>
105 105
                 </select>
106 106
             </label>
107 107
         </p>
108 108
         <p>
109 109
             <label for="<?php echo $this->get_field_id('category_limit'); ?>"><?php _e('Customize categories count to appear by default:', 'geodirectory'); ?>
110
-                <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int)esc_attr($category_limit); ?>"/>
110
+                <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int) esc_attr($category_limit); ?>"/>
111 111
                 <p class="description" style="padding:0"><?php _e('After categories count reaches this limit option More Categories / Less Categoris will be displayed to show/hide categories. Default: 15', 'geodirectory'); ?></p>
112 112
             </label>
113 113
         </p>
114 114
         <p>
115
-            <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked( $parent_only ); ?> value="1" />
116
-            <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label>
115
+            <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked($parent_only); ?> value="1" />
116
+            <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e('Show parent categories only', 'geodirectory'); ?></label>
117 117
         </p>
118 118
     <?php
119 119
     }
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	public function form($instance)
217 217
     {
218 218
         //widgetform in backend
219
-        $instance = wp_parse_args((array)$instance,
219
+        $instance = wp_parse_args((array) $instance,
220 220
             array('title' => '',
221 221
                 'post_type' => '',
222 222
                 'category' => array(),
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
 
269 269
         ?>
270 270
         <p>
271
-            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
271
+            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
272 272
                 <small>(%posttype_singular_label% ,
273
-                    %posttype_plural_label% <?php _e('can be used', 'geodirectory');?>)
273
+                    %posttype_plural_label% <?php _e('can be used', 'geodirectory'); ?>)
274 274
                 </small>
275 275
 
276 276
                 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
         <p>
283 283
             <label
284
-                for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?>
284
+                for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?>
285 285
 
286 286
                 <?php $postypes = geodir_get_posttypes();
287 287
 				/**
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
         <p id="post_type_cats">
315 315
             <label
316
-                for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?>
316
+                for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?>
317 317
 
318 318
                 <?php
319 319
 
@@ -352,13 +352,13 @@  discard block
 block discarded – undo
352 352
 
353 353
                 <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>"
354 354
                        id="<?php echo $this->get_field_id('category_title'); ?>"
355
-                       value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/>
355
+                       value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory'); ?>"/>
356 356
 
357 357
             </label>
358 358
         </p>
359 359
 
360 360
         <p>
361
-            <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?>
361
+            <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?>
362 362
 
363 363
                 <?php
364 364
                 $list_sort_arr = array(
@@ -377,14 +377,14 @@  discard block
 block discarded – undo
377 377
                  * @param array $list_sort_arr The array of key value pairs of settings.
378 378
                  * @param array $instance The array of widget settings.
379 379
                  */
380
-                $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance);
380
+                $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort', $list_sort_arr, $instance);
381 381
                 ?>
382 382
 
383 383
                 <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>"
384 384
                         name="<?php echo $this->get_field_name('list_sort'); ?>">
385 385
                     <?php
386
-                    foreach($list_sort_arr as $sort_val => $sort_title){
387
-                        echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>";
386
+                    foreach ($list_sort_arr as $sort_val => $sort_title) {
387
+                        echo "<option value='$sort_val' ".selected($list_sort, $sort_val)." >$sort_title</option>";
388 388
                     }
389 389
                     ?>
390 390
                 </select>
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
         <p>
395 395
 
396 396
             <label
397
-                for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?>
397
+                for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?>
398 398
 
399 399
                 <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>"
400 400
                        name="<?php echo $this->get_field_name('post_number'); ?>" type="text"
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 
405 405
         <p>
406 406
             <label for="<?php echo $this->get_field_id('layout'); ?>">
407
-                <?php _e('Layout:', 'geodirectory');?>
407
+                <?php _e('Layout:', 'geodirectory'); ?>
408 408
                 <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>"
409 409
                         name="<?php echo $this->get_field_name('layout'); ?>">
410 410
                     <option <?php if ($layout == 'gridview_onehalf') {
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 
434 434
         <p>
435 435
             <label
436
-                for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?>
436
+                for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?>
437 437
 
438 438
                 <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>"
439 439
                        name="<?php echo $this->get_field_name('listing_width'); ?>" type="text"
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 
444 444
         <p>
445 445
             <label
446
-                for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?>
446
+                for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?>
447 447
                 <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>"
448 448
                        name="<?php echo $this->get_field_name('character_count'); ?>" type="text"
449 449
                        value="<?php echo esc_attr($character_count); ?>"/>
@@ -452,41 +452,41 @@  discard block
 block discarded – undo
452 452
 
453 453
         <p>
454 454
             <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
455
-                <?php _e('Enable Location Filter:', 'geodirectory');?>
455
+                <?php _e('Enable Location Filter:', 'geodirectory'); ?>
456 456
                 <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
457
-                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
457
+                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?>
458 458
                        value="1"/>
459 459
             </label>
460 460
         </p>
461 461
         <p>
462 462
             <label for="<?php echo $this->get_field_id('show_featured_only'); ?>">
463
-                <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox"
463
+                <?php _e('Show only featured listings:', 'geodirectory'); ?> <input type="checkbox"
464 464
                                                                                             id="<?php echo $this->get_field_id('show_featured_only'); ?>"
465
-                                                                                            name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?>
465
+                                                                                            name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?>
466 466
                                                                                             value="1"/>
467 467
             </label>
468 468
         </p>
469 469
         <p>
470 470
             <label for="<?php echo $this->get_field_id('show_special_only'); ?>">
471
-                <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox"
471
+                <?php _e('Show only listings with special offers:', 'geodirectory'); ?> <input type="checkbox"
472 472
                                                                                                        id="<?php echo $this->get_field_id('show_special_only'); ?>"
473
-                                                                                                       name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?>
473
+                                                                                                       name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"'; ?>
474 474
                                                                                                        value="1"/>
475 475
             </label>
476 476
         </p>
477 477
         <p>
478 478
             <label for="<?php echo $this->get_field_id('with_pics_only'); ?>">
479
-                <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox"
479
+                <?php _e('Show only listings with pics:', 'geodirectory'); ?> <input type="checkbox"
480 480
                                                                                              id="<?php echo $this->get_field_id('with_pics_only'); ?>"
481
-                                                                                             name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?>
481
+                                                                                             name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"'; ?>
482 482
                                                                                              value="1"/>
483 483
             </label>
484 484
         </p>
485 485
         <p>
486 486
             <label for="<?php echo $this->get_field_id('with_videos_only'); ?>">
487
-                <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox"
487
+                <?php _e('Show only listings with videos:', 'geodirectory'); ?> <input type="checkbox"
488 488
                                                                                                id="<?php echo $this->get_field_id('with_videos_only'); ?>"
489
-                                                                                               name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?>
489
+                                                                                               name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"'; ?>
490 490
                                                                                                value="1"/>
491 491
             </label>
492 492
         </p>
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 
537 537
             }
538 538
 
539
-            <?php if(is_active_widget( false, false, $this->id_base, true )){ ?>
539
+            <?php if (is_active_widget(false, false, $this->id_base, true)) { ?>
540 540
             var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val();
541 541
 
542 542
             <?php } ?>
Please login to merge, or discard this patch.