Skip to content

Commit

Permalink
Fix: Format check for when didn't always return the correct result.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjolshagen committed Dec 16, 2015
1 parent 5ee2e3c commit 7909c7a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions classes/shortcodes/class-available_on.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public function load_shortcode($attr = null, $content = null)
$sequence_obj = apply_filters('get_sequence_class_instance', null);
$sequence_obj->dbg_log("Shortcodes\\available_on::load_shortcode() - Processing attributes.");

$when = 'today';

$attributes = shortcode_atts(array(
'when' => 'today',
), $attr);
Expand All @@ -65,8 +67,9 @@ public function load_shortcode($attr = null, $content = null)
wp_die( sprintf(__('%s is not a valid type attribute for the e20r_available_on shortcode', 'e20rsequence'), $type));
}
*/
$sequence_obj->dbg_log("Shortcodes\\available_on::load_shortcode() - When attribute is specified: {$attributes['when']}");

if (false === strtotime( $attributes['when'])) {
if ( !is_numeric( $attributes['when'] ) && (false === strtotime( $attributes['when'] )) ) {

$sequence_obj->dbg_log("Shortcodes\\available_on::load_shortcode() - User didn't specify a recognizable format for the 'when' attribute");
wp_die( sprintf(__('%s is not a recognizable format for the when attribute in the e20r_available_on shortcode', 'e20rsequence'), $attributes['when']));
Expand All @@ -84,7 +87,7 @@ public function load_shortcode($attr = null, $content = null)
return do_shortcode($content);
}

$sequence_obj->dbg_log("Shortcodes\\available_on::load_shortcode() - We can't display the content within the shortcode block");
$sequence_obj->dbg_log("Shortcodes\\available_on::load_shortcode() - We can't display the content within the shortcode block: {$delay} vs {$days_since_start}");
return apply_filters('e20r-sequence-shortcode-text-unavailable', null);
}

Expand Down

0 comments on commit 7909c7a

Please sign in to comment.