Skip to content

Commit 5b9f24b

Browse files
authored
Merge pull request #2 from jmau111/master
fix notices
2 parents b73dd6c + 222794b commit 5b9f24b

File tree

1 file changed

+78
-78
lines changed

1 file changed

+78
-78
lines changed

classes/monthly.php

Lines changed: 78 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ function load_values( $params ) {
1919

2020
// Orderby
2121
$orderby = 'f.facet_display_value DESC';
22-
if ( 'asc' === $facet['orderby'] ) {
22+
if ( ! empty( $facet['orderby'] ) && 'asc' === $facet['orderby'] ) {
2323
$orderby = 'f.facet_display_value ASC';
2424
}
2525

2626
// Limit
2727
$limit = 10;
28-
if ( absint( $facet['count'] ) > 0 ) {
28+
if ( ! empty( $facet['count'] ) && absint( $facet['count'] ) > 0 ) {
2929
$limit = absint( $facet['count'] );
3030
}
3131

@@ -95,7 +95,7 @@ function filter_posts( $params ) {
9595
$dates = explode( '-', reset( $selected_values ) );
9696

9797
if ( count( $dates ) < 2 ) {
98-
$dates = array( date( 'Y' ), date( 'm' ) );
98+
$dates = array( date( 'Y' ), date( 'm' ) );
9999
}
100100

101101
$sql = $wpdb->prepare( "SELECT DISTINCT post_id
@@ -118,95 +118,95 @@ function filter_posts( $params ) {
118118
* Output admin settings HTML
119119
*/
120120
function settings_html() { ?>
121-
<tr class="facetwp-conditional type-monthly">
122-
<td>
121+
<tr class="facetwp-conditional type-monthly">
122+
<td>
123123
<?php _e( 'Default label', 'fwp' ); ?>:
124-
<div class="facetwp-tooltip">
125-
<span class="icon-question">?</span>
126-
<div class="facetwp-tooltip-content">
127-
Customize the first option label (default: "Any")
128-
</div>
129-
</div>
130-
</td>
131-
<td>
132-
<input type="text" class="facet-label-any" value="<?php _e( 'Any', 'fwp' ); ?>"/>
133-
</td>
134-
</tr>
135-
<tr class="facetwp-conditional type-monthly">
136-
<td>
124+
<div class="facetwp-tooltip">
125+
<span class="icon-question">?</span>
126+
<div class="facetwp-tooltip-content">
127+
Customize the first option label (default: "Any")
128+
</div>
129+
</div>
130+
</td>
131+
<td>
132+
<input type="text" class="facet-label-any" value="<?php _e( 'Any', 'fwp' ); ?>"/>
133+
</td>
134+
</tr>
135+
<tr class="facetwp-conditional type-monthly">
136+
<td>
137137
<?php _e( 'Archive order', 'fwp' ); ?>:
138-
<div class="facetwp-tooltip">
139-
<span class="icon-question">?</span>
140-
<div class="facetwp-tooltip-content">
141-
Customize the archives order (default: "Newest to Oldest")
142-
</div>
143-
</div>
144-
</td>
145-
<td>
146-
<select class="facet-orderby">
147-
<option value="desc" selected><?php _e( 'Newest to Oldest', 'fwp' ); ?></option>
148-
<option value="asc"><?php _e( 'Oldest to newest', 'fwp' ); ?></option>
149-
</select>
150-
</td>
151-
</tr>
152-
<tr class="facetwp-conditional type-monthly">
153-
<td>
138+
<div class="facetwp-tooltip">
139+
<span class="icon-question">?</span>
140+
<div class="facetwp-tooltip-content">
141+
Customize the archives order (default: "Newest to Oldest")
142+
</div>
143+
</div>
144+
</td>
145+
<td>
146+
<select class="facet-orderby">
147+
<option value="desc" selected><?php _e( 'Newest to Oldest', 'fwp' ); ?></option>
148+
<option value="asc"><?php _e( 'Oldest to newest', 'fwp' ); ?></option>
149+
</select>
150+
</td>
151+
</tr>
152+
<tr class="facetwp-conditional type-monthly">
153+
<td>
154154
<?php _e( 'Count', 'fwp' ); ?>:
155-
<div class="facetwp-tooltip">
156-
<span class="icon-question">?</span>
157-
<div class="facetwp-tooltip-content"><?php _e( 'The maximum number of facet choices to show',
155+
<div class="facetwp-tooltip">
156+
<span class="icon-question">?</span>
157+
<div class="facetwp-tooltip-content"><?php _e( 'The maximum number of facet choices to show',
158158
'fwp' ); ?></div>
159-
</div>
160-
</td>
161-
<td><input type="text" class="facet-count" value="10"/></td>
162-
</tr>
159+
</div>
160+
</td>
161+
<td><input type="text" class="facet-count" value="10"/></td>
162+
</tr>
163163
<?php }
164164

165165
/**
166166
* Output any admin scripts
167167
*/
168168
function admin_scripts() { ?>
169-
<script>
170-
(function ($) {
171-
wp.hooks.addAction('facetwp/load/monthly', function ($this, obj) {
172-
$this.find('.facet-source').val(obj['source']);
173-
$this.find('.type-monthly .facet-label-any').val(obj['label_any']);
174-
$this.find('.type-monthly .facet-orderby').val(obj['orderby']);
175-
$this.find('.type-monthly .facet-count').val(obj['count']);
176-
});
177-
178-
wp.hooks.addFilter('facetwp/save/monthly', function ($this, obj) {
179-
obj['source'] = $this.find('.facet-source').val();
180-
obj['label_any'] = $this.find('.type-monthly .facet-label-any').val();
181-
obj['orderby'] = $this.find('.type-monthly .facet-orderby').val();
182-
obj['count'] = $this.find('.type-monthly .facet-count').val();
183-
return obj;
184-
});
185-
})(jQuery);
186-
</script>
169+
<script>
170+
(function ($) {
171+
wp.hooks.addAction('facetwp/load/monthly', function ($this, obj) {
172+
$this.find('.facet-source').val(obj['source']);
173+
$this.find('.type-monthly .facet-label-any').val(obj['label_any']);
174+
$this.find('.type-monthly .facet-orderby').val(obj['orderby']);
175+
$this.find('.type-monthly .facet-count').val(obj['count']);
176+
});
177+
178+
wp.hooks.addFilter('facetwp/save/monthly', function ($this, obj) {
179+
obj['source'] = $this.find('.facet-source').val();
180+
obj['label_any'] = $this.find('.type-monthly .facet-label-any').val();
181+
obj['orderby'] = $this.find('.type-monthly .facet-orderby').val();
182+
obj['count'] = $this.find('.type-monthly .facet-count').val();
183+
return obj;
184+
});
185+
})(jQuery);
186+
</script>
187187
<?php }
188188

189189
/**
190190
* Output any front-end scripts
191191
*/
192192
function front_scripts() { ?>
193-
<script>
194-
(function ($) {
195-
wp.hooks.addAction('facetwp/refresh/monthly', function ($this, facet_name) {
196-
var val = $this.find('.facetwp-monthly').val();
197-
FWP.facets[facet_name] = val ? [val] : [];
198-
});
199-
200-
wp.hooks.addAction('facetwp/ready', function () {
201-
$(document).on('change', '.facetwp-facet .facetwp-monthly', function () {
202-
var $facet = $(this).closest('.facetwp-facet');
203-
if ('' != $facet.find(':selected').val()) {
204-
FWP.static_facet = $facet.attr('data-name');
205-
}
206-
FWP.autoload();
207-
});
208-
});
209-
})(jQuery);
210-
</script>
193+
<script>
194+
(function ($) {
195+
wp.hooks.addAction('facetwp/refresh/monthly', function ($this, facet_name) {
196+
var val = $this.find('.facetwp-monthly').val();
197+
FWP.facets[facet_name] = val ? [val] : [];
198+
});
199+
200+
wp.hooks.addAction('facetwp/ready', function () {
201+
$(document).on('change', '.facetwp-facet .facetwp-monthly', function () {
202+
var $facet = $(this).closest('.facetwp-facet');
203+
if ('' != $facet.find(':selected').val()) {
204+
FWP.static_facet = $facet.attr('data-name');
205+
}
206+
FWP.autoload();
207+
});
208+
});
209+
})(jQuery);
210+
</script>
211211
<?php }
212-
}
212+
}

0 commit comments

Comments
 (0)