From b6bac0618b8050c8c38c3dfb2308d68dde9682c0 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Wed, 8 Nov 2017 18:53:59 +1100 Subject: [PATCH] Move date range properties to abstract --- .../abstracts/abstract-sp-secondary-post.php | 19 +++++++++++++++++++ includes/class-sp-calendar.php | 18 ------------------ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/includes/abstracts/abstract-sp-secondary-post.php b/includes/abstracts/abstract-sp-secondary-post.php index 71e2d178..28d5a063 100644 --- a/includes/abstracts/abstract-sp-secondary-post.php +++ b/includes/abstracts/abstract-sp-secondary-post.php @@ -11,6 +11,25 @@ * @author ThemeBoy */ abstract class SP_Secondary_Post extends SP_Custom_Post { + + /** @var string The date filter for events. */ + public $date = 0; + + /** @var string The date to range from. */ + public $from = 'now'; + + /** @var string The date to range to. */ + public $to = 'now'; + + /** @var string The number of days to query in the past. */ + public $past = 0; + + /** @var string The number of days to query in the future. */ + public $future = 0; + + /** @var boolean Determines whether the date range is relative. */ + public $relative = false; + public function range( $where = '', $format = 'Y-m-d' ) { $from = new DateTime( $this->from, new DateTimeZone( get_option( 'timezone_string' ) ) ); $to = new DateTime( $this->to, new DateTimeZone( get_option( 'timezone_string' ) ) ); diff --git a/includes/class-sp-calendar.php b/includes/class-sp-calendar.php index c03c7fae..75ca80e7 100644 --- a/includes/class-sp-calendar.php +++ b/includes/class-sp-calendar.php @@ -19,30 +19,12 @@ class SP_Calendar extends SP_Secondary_Post { /** @var string The events status. */ public $status; - /** @var string The date filter for events. */ - public $date; - /** @var string The events order. */ public $order; /** @var string The events orderby. */ public $orderby; - /** @var string The date to range from. */ - public $from; - - /** @var string The date to range to. */ - public $to; - - /** @var string The number of days to query in the past. */ - public $past; - - /** @var string The number of days to query in the future. */ - public $future; - - /** @var boolean Determines whether the date range is relative. */ - public $relative; - /** @var string The match day. */ public $day;