equal
deleted
inserted
replaced
107 $instance['orderby'] = 'name'; |
107 $instance['orderby'] = 'name'; |
108 if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ), true ) ) { |
108 if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ), true ) ) { |
109 $instance['orderby'] = $new_instance['orderby']; |
109 $instance['orderby'] = $new_instance['orderby']; |
110 } |
110 } |
111 |
111 |
112 $instance['category'] = intval( $new_instance['category'] ); |
112 $instance['category'] = (int) $new_instance['category']; |
113 $instance['limit'] = ! empty( $new_instance['limit'] ) ? intval( $new_instance['limit'] ) : -1; |
113 $instance['limit'] = ! empty( $new_instance['limit'] ) ? (int) $new_instance['limit'] : -1; |
114 |
114 |
115 return $instance; |
115 return $instance; |
116 } |
116 } |
117 |
117 |
118 /** |
118 /** |
136 'orderby' => 'name', |
136 'orderby' => 'name', |
137 'limit' => -1, |
137 'limit' => -1, |
138 ) |
138 ) |
139 ); |
139 ); |
140 $link_cats = get_terms( array( 'taxonomy' => 'link_category' ) ); |
140 $link_cats = get_terms( array( 'taxonomy' => 'link_category' ) ); |
141 $limit = intval( $instance['limit'] ); |
141 $limit = (int) $instance['limit']; |
142 if ( ! $limit ) { |
142 if ( ! $limit ) { |
143 $limit = -1; |
143 $limit = -1; |
144 } |
144 } |
145 ?> |
145 ?> |
146 <p> |
146 <p> |
147 <label for="<?php echo $this->get_field_id( 'category' ); ?>"><?php _e( 'Select Link Category:' ); ?></label> |
147 <label for="<?php echo $this->get_field_id( 'category' ); ?>"><?php _e( 'Select Link Category:' ); ?></label> |
148 <select class="widefat" id="<?php echo $this->get_field_id( 'category' ); ?>" name="<?php echo $this->get_field_name( 'category' ); ?>"> |
148 <select class="widefat" id="<?php echo $this->get_field_id( 'category' ); ?>" name="<?php echo $this->get_field_name( 'category' ); ?>"> |
149 <option value=""><?php _ex( 'All Links', 'links widget' ); ?></option> |
149 <option value=""><?php _ex( 'All Links', 'links widget' ); ?></option> |
150 <?php foreach ( $link_cats as $link_cat ) : ?> |
150 <?php foreach ( $link_cats as $link_cat ) : ?> |
151 <option value="<?php echo intval( $link_cat->term_id ); ?>" <?php selected( $instance['category'], $link_cat->term_id ); ?>> |
151 <option value="<?php echo (int) $link_cat->term_id; ?>" <?php selected( $instance['category'], $link_cat->term_id ); ?>> |
152 <?php echo esc_html( $link_cat->name ); ?> |
152 <?php echo esc_html( $link_cat->name ); ?> |
153 </option> |
153 </option> |
154 <?php endforeach; ?> |
154 <?php endforeach; ?> |
155 </select> |
155 </select> |
156 <label for="<?php echo $this->get_field_id( 'orderby' ); ?>"><?php _e( 'Sort by:' ); ?></label> |
156 <label for="<?php echo $this->get_field_id( 'orderby' ); ?>"><?php _e( 'Sort by:' ); ?></label> |
179 <label for="<?php echo $this->get_field_id( 'rating' ); ?>"><?php _e( 'Show Link Rating' ); ?></label> |
179 <label for="<?php echo $this->get_field_id( 'rating' ); ?>"><?php _e( 'Show Link Rating' ); ?></label> |
180 </p> |
180 </p> |
181 |
181 |
182 <p> |
182 <p> |
183 <label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of links to show:' ); ?></label> |
183 <label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of links to show:' ); ?></label> |
184 <input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo ( -1 !== $limit ) ? intval( $limit ) : ''; ?>" size="3" /> |
184 <input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo ( -1 !== $limit ) ? (int) $limit : ''; ?>" size="3" /> |
185 </p> |
185 </p> |
186 <?php |
186 <?php |
187 } |
187 } |
188 } |
188 } |