@@ -15,40 +15,40 @@ discard block |
||
| 15 | 15 | class geodir_listing_slider_widget extends WP_Widget |
| 16 | 16 | {
|
| 17 | 17 | |
| 18 | - /** |
|
| 18 | + /** |
|
| 19 | 19 | * Register the listing slider widget. |
| 20 | 20 | * |
| 21 | 21 | * @since 1.0.0 |
| 22 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 22 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 23 | 23 | */ |
| 24 | - public function __construct() {
|
|
| 25 | - $widget_ops = array('classname' => 'geodir_listing_slider_view', 'description' => __('GD > Listing Slider', 'geodirectory'));
|
|
| 26 | - parent::__construct( |
|
| 27 | - 'listing_slider_view', // Base ID |
|
| 28 | - __('GD > Listing Slider', 'geodirectory'), // Name
|
|
| 29 | - $widget_ops// Args |
|
| 30 | - ); |
|
| 31 | - } |
|
| 24 | + public function __construct() {
|
|
| 25 | + $widget_ops = array('classname' => 'geodir_listing_slider_view', 'description' => __('GD > Listing Slider', 'geodirectory'));
|
|
| 26 | + parent::__construct( |
|
| 27 | + 'listing_slider_view', // Base ID |
|
| 28 | + __('GD > Listing Slider', 'geodirectory'), // Name
|
|
| 29 | + $widget_ops// Args |
|
| 30 | + ); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Front-end display content for listing slider widget. |
| 35 | 35 | * |
| 36 | 36 | * @since 1.0.0 |
| 37 | - * @since 1.5.1 Declare function public. |
|
| 37 | + * @since 1.5.1 Declare function public. |
|
| 38 | 38 | * |
| 39 | 39 | * @param array $args Widget arguments. |
| 40 | 40 | * @param array $instance Saved values from database. |
| 41 | 41 | */ |
| 42 | - public function widget($args, $instance) |
|
| 43 | - {
|
|
| 44 | - geodir_listing_slider_widget_output($args, $instance); |
|
| 45 | - } |
|
| 42 | + public function widget($args, $instance) |
|
| 43 | + {
|
|
| 44 | + geodir_listing_slider_widget_output($args, $instance); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Sanitize listing slider widget form values as they are saved. |
| 49 | 49 | * |
| 50 | 50 | * @since 1.0.0 |
| 51 | - * @since 1.5.1 Declare function public. |
|
| 51 | + * @since 1.5.1 Declare function public. |
|
| 52 | 52 | * |
| 53 | 53 | * @param array $new_instance Values just sent to be saved. |
| 54 | 54 | * @param array $old_instance Previously saved values from database. |
@@ -56,101 +56,101 @@ discard block |
||
| 56 | 56 | * @return array Updated safe values to be saved. |
| 57 | 57 | */ |
| 58 | 58 | public function update($new_instance, $old_instance) |
| 59 | - {
|
|
| 60 | - //save the widget |
|
| 61 | - $instance = $old_instance; |
|
| 62 | - $instance['title'] = strip_tags($new_instance['title']); |
|
| 63 | - $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
| 64 | - $instance['category'] = strip_tags($new_instance['category']); |
|
| 65 | - $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
| 66 | - $instance['max_show'] = strip_tags($new_instance['max_show']); |
|
| 67 | - $instance['slide_width'] = strip_tags($new_instance['slide_width']); |
|
| 68 | - $instance['show_title'] = isset($new_instance['show_title']) ? $new_instance['show_title'] : ''; |
|
| 69 | - $instance['slideshow'] = isset($new_instance['slideshow']) ? $new_instance['slideshow'] : ''; |
|
| 70 | - $instance['animationLoop'] = isset($new_instance['animationLoop']) ? $new_instance['animationLoop'] : ''; |
|
| 71 | - $instance['directionNav'] = isset($new_instance['directionNav']) ? $new_instance['directionNav'] : ''; |
|
| 72 | - $instance['slideshowSpeed'] = $new_instance['slideshowSpeed']; |
|
| 73 | - $instance['animationSpeed'] = $new_instance['animationSpeed']; |
|
| 74 | - $instance['animation'] = $new_instance['animation']; |
|
| 75 | - $instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : ''; |
|
| 76 | - $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
| 77 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
| 78 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 79 | - else |
|
| 80 | - $instance['add_location_filter'] = '0'; |
|
| 81 | - |
|
| 82 | - return $instance; |
|
| 83 | - } |
|
| 59 | + {
|
|
| 60 | + //save the widget |
|
| 61 | + $instance = $old_instance; |
|
| 62 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 63 | + $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
| 64 | + $instance['category'] = strip_tags($new_instance['category']); |
|
| 65 | + $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
| 66 | + $instance['max_show'] = strip_tags($new_instance['max_show']); |
|
| 67 | + $instance['slide_width'] = strip_tags($new_instance['slide_width']); |
|
| 68 | + $instance['show_title'] = isset($new_instance['show_title']) ? $new_instance['show_title'] : ''; |
|
| 69 | + $instance['slideshow'] = isset($new_instance['slideshow']) ? $new_instance['slideshow'] : ''; |
|
| 70 | + $instance['animationLoop'] = isset($new_instance['animationLoop']) ? $new_instance['animationLoop'] : ''; |
|
| 71 | + $instance['directionNav'] = isset($new_instance['directionNav']) ? $new_instance['directionNav'] : ''; |
|
| 72 | + $instance['slideshowSpeed'] = $new_instance['slideshowSpeed']; |
|
| 73 | + $instance['animationSpeed'] = $new_instance['animationSpeed']; |
|
| 74 | + $instance['animation'] = $new_instance['animation']; |
|
| 75 | + $instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : ''; |
|
| 76 | + $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
| 77 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
| 78 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 79 | + else |
|
| 80 | + $instance['add_location_filter'] = '0'; |
|
| 81 | + |
|
| 82 | + return $instance; |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * Back-end listing slider widget settings form. |
| 87 | 87 | * |
| 88 | 88 | * @since 1.0.0 |
| 89 | - * @since 1.5.1 Declare function public. |
|
| 89 | + * @since 1.5.1 Declare function public. |
|
| 90 | 90 | * |
| 91 | 91 | * @param array $instance Previously saved values from database. |
| 92 | 92 | */ |
| 93 | 93 | public function form($instance) |
| 94 | - {
|
|
| 94 | + {
|
|
| 95 | 95 | |
| 96 | - //widgetform in backend |
|
| 97 | - $instance = wp_parse_args((array)$instance, |
|
| 98 | - array('title' => '',
|
|
| 99 | - 'post_type' => '', |
|
| 100 | - 'category' => '', |
|
| 101 | - 'post_number' => '5', |
|
| 102 | - 'max_show' => '1', |
|
| 103 | - 'slide_width' => '', |
|
| 104 | - 'show_title' => '', |
|
| 105 | - 'slideshow' => '', |
|
| 106 | - 'animationLoop' => '', |
|
| 107 | - 'directionNav' => '', |
|
| 108 | - 'slideshowSpeed' => 5000, |
|
| 109 | - 'animationSpeed' => 600, |
|
| 110 | - 'animation' => '', |
|
| 111 | - 'list_sort' => 'latest', |
|
| 112 | - 'show_featured_only' => '', |
|
| 113 | - 'add_location_filter' => '0', |
|
| 114 | - ) |
|
| 115 | - ); |
|
| 96 | + //widgetform in backend |
|
| 97 | + $instance = wp_parse_args((array)$instance, |
|
| 98 | + array('title' => '',
|
|
| 99 | + 'post_type' => '', |
|
| 100 | + 'category' => '', |
|
| 101 | + 'post_number' => '5', |
|
| 102 | + 'max_show' => '1', |
|
| 103 | + 'slide_width' => '', |
|
| 104 | + 'show_title' => '', |
|
| 105 | + 'slideshow' => '', |
|
| 106 | + 'animationLoop' => '', |
|
| 107 | + 'directionNav' => '', |
|
| 108 | + 'slideshowSpeed' => 5000, |
|
| 109 | + 'animationSpeed' => 600, |
|
| 110 | + 'animation' => '', |
|
| 111 | + 'list_sort' => 'latest', |
|
| 112 | + 'show_featured_only' => '', |
|
| 113 | + 'add_location_filter' => '0', |
|
| 114 | + ) |
|
| 115 | + ); |
|
| 116 | 116 | |
| 117 | - $title = strip_tags($instance['title']); |
|
| 117 | + $title = strip_tags($instance['title']); |
|
| 118 | 118 | |
| 119 | - $post_type = strip_tags($instance['post_type']); |
|
| 119 | + $post_type = strip_tags($instance['post_type']); |
|
| 120 | 120 | |
| 121 | - $category = strip_tags($instance['category']); |
|
| 121 | + $category = strip_tags($instance['category']); |
|
| 122 | 122 | |
| 123 | - $post_number = strip_tags($instance['post_number']); |
|
| 123 | + $post_number = strip_tags($instance['post_number']); |
|
| 124 | 124 | |
| 125 | - $max_show = strip_tags($instance['max_show']); |
|
| 125 | + $max_show = strip_tags($instance['max_show']); |
|
| 126 | 126 | |
| 127 | - $slide_width = strip_tags($instance['slide_width']); |
|
| 127 | + $slide_width = strip_tags($instance['slide_width']); |
|
| 128 | 128 | |
| 129 | - $show_title = $instance['show_title']; |
|
| 129 | + $show_title = $instance['show_title']; |
|
| 130 | 130 | |
| 131 | - $slideshow = $instance['slideshow']; |
|
| 131 | + $slideshow = $instance['slideshow']; |
|
| 132 | 132 | |
| 133 | - $animationLoop = $instance['animationLoop']; |
|
| 133 | + $animationLoop = $instance['animationLoop']; |
|
| 134 | 134 | |
| 135 | - $directionNav = $instance['directionNav']; |
|
| 135 | + $directionNav = $instance['directionNav']; |
|
| 136 | 136 | |
| 137 | - $slideshowSpeed = $instance['slideshowSpeed']; |
|
| 137 | + $slideshowSpeed = $instance['slideshowSpeed']; |
|
| 138 | 138 | |
| 139 | - $animationSpeed = $instance['animationSpeed']; |
|
| 139 | + $animationSpeed = $instance['animationSpeed']; |
|
| 140 | 140 | |
| 141 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
| 141 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
| 142 | 142 | |
| 143 | - $animation = $instance['animation']; |
|
| 144 | - $list_sort = $instance['list_sort']; |
|
| 145 | - $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
| 143 | + $animation = $instance['animation']; |
|
| 144 | + $list_sort = $instance['list_sort']; |
|
| 145 | + $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
| 146 | 146 | |
| 147 | - $sort_fields = array(); |
|
| 148 | - $sort_fields[] = array('field' => 'latest', 'label' => __('Latest', 'geodirectory'));
|
|
| 149 | - $sort_fields[] = array('field' => 'featured', 'label' => __('Featured', 'geodirectory'));
|
|
| 150 | - $sort_fields[] = array('field' => 'high_review', 'label' => __('Review', 'geodirectory'));
|
|
| 151 | - $sort_fields[] = array('field' => 'high_rating', 'label' => __('Rating', 'geodirectory'));
|
|
| 152 | - $sort_fields[] = array('field' => 'random', 'label' => __('Random', 'geodirectory'));
|
|
| 153 | - ?> |
|
| 147 | + $sort_fields = array(); |
|
| 148 | + $sort_fields[] = array('field' => 'latest', 'label' => __('Latest', 'geodirectory'));
|
|
| 149 | + $sort_fields[] = array('field' => 'featured', 'label' => __('Featured', 'geodirectory'));
|
|
| 150 | + $sort_fields[] = array('field' => 'high_review', 'label' => __('Review', 'geodirectory'));
|
|
| 151 | + $sort_fields[] = array('field' => 'high_rating', 'label' => __('Rating', 'geodirectory'));
|
|
| 152 | + $sort_fields[] = array('field' => 'random', 'label' => __('Random', 'geodirectory'));
|
|
| 153 | + ?> |
|
| 154 | 154 | |
| 155 | 155 | <p> |
| 156 | 156 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
|
@@ -174,9 +174,9 @@ discard block |
||
| 174 | 174 | <?php foreach ($postypes as $postypes_obj) { ?>
|
| 175 | 175 | |
| 176 | 176 | <option <?php if ($post_type == $postypes_obj) {
|
| 177 | - echo 'selected="selected"'; |
|
| 178 | - } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
|
|
| 179 | - echo ucfirst($extvalue[1]); ?></option> |
|
| 177 | + echo 'selected="selected"'; |
|
| 178 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
|
|
| 179 | + echo ucfirst($extvalue[1]); ?></option> |
|
| 180 | 180 | |
| 181 | 181 | <?php } ?> |
| 182 | 182 | |
@@ -190,20 +190,20 @@ discard block |
||
| 190 | 190 | for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?>
|
| 191 | 191 | |
| 192 | 192 | <?php |
| 193 | - $category_taxonomy = geodir_get_taxonomies('gd_place');
|
|
| 194 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
|
|
| 195 | - ?> |
|
| 193 | + $category_taxonomy = geodir_get_taxonomies('gd_place');
|
|
| 194 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
|
|
| 195 | + ?> |
|
| 196 | 196 | |
| 197 | 197 | <select class="widefat" id="<?php echo $this->get_field_id('category'); ?>"
|
| 198 | 198 | name="<?php echo $this->get_field_name('category'); ?>">
|
| 199 | 199 | <option <?php if ($category == '0') {
|
| 200 | - echo 'selected="selected"'; |
|
| 201 | - } ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
|
|
| 200 | + echo 'selected="selected"'; |
|
| 201 | + } ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
|
|
| 202 | 202 | <?php foreach ($categories as $category_obj) { ?>
|
| 203 | 203 | |
| 204 | 204 | <option <?php if ($category == $category_obj->term_id) {
|
| 205 | - echo 'selected="selected"'; |
|
| 206 | - } ?> |
|
| 205 | + echo 'selected="selected"'; |
|
| 206 | + } ?> |
|
| 207 | 207 | value="<?php echo $category_obj->term_id; ?>"><?php echo ucfirst($category_obj->name); ?></option> |
| 208 | 208 | |
| 209 | 209 | <?php } ?> |
@@ -256,12 +256,12 @@ discard block |
||
| 256 | 256 | <select class="widefat" id="<?php echo $this->get_field_id('animation'); ?>"
|
| 257 | 257 | name="<?php echo $this->get_field_name('animation'); ?>">
|
| 258 | 258 | <option <?php if ($animation == 'slide') {
|
| 259 | - echo 'selected="selected"'; |
|
| 260 | - } ?> value="slide">Slide |
|
| 259 | + echo 'selected="selected"'; |
|
| 260 | + } ?> value="slide">Slide |
|
| 261 | 261 | </option> |
| 262 | 262 | <option <?php if ($animation == 'fade') {
|
| 263 | - echo 'selected="selected"'; |
|
| 264 | - } ?> value="fade">Fade |
|
| 263 | + echo 'selected="selected"'; |
|
| 264 | + } ?> value="fade">Fade |
|
| 265 | 265 | </option> |
| 266 | 266 | </select> |
| 267 | 267 | </label> |
@@ -292,8 +292,8 @@ discard block |
||
| 292 | 292 | for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory');?>
|
| 293 | 293 | |
| 294 | 294 | <input type="checkbox" <?php if ($slideshow) {
|
| 295 | - echo 'checked="checked"'; |
|
| 296 | - } ?> id="<?php echo $this->get_field_id('slideshow'); ?>" value="1"
|
|
| 295 | + echo 'checked="checked"'; |
|
| 296 | + } ?> id="<?php echo $this->get_field_id('slideshow'); ?>" value="1"
|
|
| 297 | 297 | name="<?php echo $this->get_field_name('slideshow'); ?>"/>
|
| 298 | 298 | |
| 299 | 299 | </label> |
@@ -304,8 +304,8 @@ discard block |
||
| 304 | 304 | for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory');?>
|
| 305 | 305 | |
| 306 | 306 | <input type="checkbox" <?php if ($animationLoop) {
|
| 307 | - echo 'checked="checked"'; |
|
| 308 | - } ?> id="<?php echo $this->get_field_id('animationLoop'); ?>" value="1"
|
|
| 307 | + echo 'checked="checked"'; |
|
| 308 | + } ?> id="<?php echo $this->get_field_id('animationLoop'); ?>" value="1"
|
|
| 309 | 309 | name="<?php echo $this->get_field_name('animationLoop'); ?>"/>
|
| 310 | 310 | |
| 311 | 311 | </label> |
@@ -316,8 +316,8 @@ discard block |
||
| 316 | 316 | for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory');?>
|
| 317 | 317 | |
| 318 | 318 | <input type="checkbox" <?php if ($directionNav) {
|
| 319 | - echo 'checked="checked"'; |
|
| 320 | - } ?> id="<?php echo $this->get_field_id('directionNav'); ?>" value="1"
|
|
| 319 | + echo 'checked="checked"'; |
|
| 320 | + } ?> id="<?php echo $this->get_field_id('directionNav'); ?>" value="1"
|
|
| 321 | 321 | name="<?php echo $this->get_field_name('directionNav'); ?>"/>
|
| 322 | 322 | |
| 323 | 323 | </label> |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory');?>
|
| 330 | 330 | |
| 331 | 331 | <input type="checkbox" <?php if ($show_title) {
|
| 332 | - echo 'checked="checked"'; |
|
| 333 | - } ?> id="<?php echo $this->get_field_id('show_title'); ?>" value="1"
|
|
| 332 | + echo 'checked="checked"'; |
|
| 333 | + } ?> id="<?php echo $this->get_field_id('show_title'); ?>" value="1"
|
|
| 334 | 334 | name="<?php echo $this->get_field_name('show_title'); ?>"/>
|
| 335 | 335 | |
| 336 | 336 | </label> |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | |
| 379 | 379 | |
| 380 | 380 | <?php |
| 381 | - } |
|
| 381 | + } |
|
| 382 | 382 | } // class geodir_listing_slider_widget |
| 383 | 383 | |
| 384 | 384 | register_widget('geodir_listing_slider_widget'); |
| 385 | 385 | \ No newline at end of file |