Campaign.php
3 years ago
Current_Traffic.php
3 years ago
Device.php
2 years ago
Geo.php
2 years ago
Page.php
2 years ago
Page_Author_Archive.php
3 years ago
Page_Date_Archive.php
3 years ago
Page_Home.php
3 years ago
Page_Not_Found.php
3 years ago
Page_Post_Type_Archive.php
2 years ago
Page_Search.php
3 years ago
Page_Singular.php
2 years ago
Page_Term_Archive.php
3 years ago
Referrer.php
2 years ago
View_Stats.php
2 years ago
Visitor.php
2 years ago
WooCommerce_Stats.php
3 years ago
Page_Date_Archive.php
91 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP_SCOPED\IAWP\Models; |
| 4 | |
| 5 | class Page_Date_Archive extends Page |
| 6 | { |
| 7 | private $date_archive; |
| 8 | public function __construct($row) |
| 9 | { |
| 10 | $this->date_archive = $row->date_archive; |
| 11 | parent::__construct($row); |
| 12 | } |
| 13 | protected function resource_key() : string |
| 14 | { |
| 15 | return 'date_archive'; |
| 16 | } |
| 17 | protected function resource_value() : string |
| 18 | { |
| 19 | return $this->date_archive; |
| 20 | } |
| 21 | protected function calculate_is_deleted() : bool |
| 22 | { |
| 23 | return \false; |
| 24 | } |
| 25 | protected function calculate_url() |
| 26 | { |
| 27 | list($type, $year, $month, $day) = $this->date_archive_type(); |
| 28 | if ($type == 'year') { |
| 29 | return \get_year_link($year); |
| 30 | } elseif ($type == 'month') { |
| 31 | return \get_month_link($year, $month); |
| 32 | } else { |
| 33 | return \get_day_link($year, $month, $day); |
| 34 | } |
| 35 | } |
| 36 | protected function calculate_title() |
| 37 | { |
| 38 | return $this->date_archive; |
| 39 | } |
| 40 | protected function calculate_type() |
| 41 | { |
| 42 | return 'date-archive'; |
| 43 | } |
| 44 | protected function calculate_type_label() |
| 45 | { |
| 46 | list($type) = $this->date_archive_type(); |
| 47 | if ($type == 'year') { |
| 48 | return \esc_html__('Date Archive (Year)', 'independent-analytics'); |
| 49 | } elseif ($type == 'month') { |
| 50 | return \esc_html__('Date Archive (Month)', 'independent-analytics'); |
| 51 | } else { |
| 52 | return \esc_html__('Date Archive (Day)', 'independent-analytics'); |
| 53 | } |
| 54 | } |
| 55 | protected function calculate_icon() |
| 56 | { |
| 57 | return '<span class="dashicons dashicons-calendar-alt"></span>'; |
| 58 | } |
| 59 | protected function calculate_author_id() |
| 60 | { |
| 61 | return null; |
| 62 | } |
| 63 | protected function calculate_author() |
| 64 | { |
| 65 | return null; |
| 66 | } |
| 67 | protected function calculate_avatar() |
| 68 | { |
| 69 | return null; |
| 70 | } |
| 71 | protected function calculate_date() |
| 72 | { |
| 73 | return null; |
| 74 | } |
| 75 | protected function calculate_category() |
| 76 | { |
| 77 | return []; |
| 78 | } |
| 79 | private function date_archive_type() |
| 80 | { |
| 81 | list($year, $month, $day) = \array_pad(\explode('-', $this->date_archive), 3, null); |
| 82 | if (\is_null($day) && \is_null($month)) { |
| 83 | return ['year', $year, null, null]; |
| 84 | } elseif (\is_null($day)) { |
| 85 | return ['month', $year, $month, null]; |
| 86 | } else { |
| 87 | return ['day', $year, $month, $day]; |
| 88 | } |
| 89 | } |
| 90 | } |
| 91 |