@@ -2,16 +2,16 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | Loader::load('controller', 'waterfalls/DefaultListController'); |
| 4 | 4 | |
| 5 | -final class SearchListController extends DefaultListController |
|
| 6 | -{ |
|
| 5 | +final class SearchListController extends DefaultListController |
|
| 6 | +{
|
|
| 7 | 7 | |
| 8 | 8 | private static $TITLE = 'Search Listing'; |
| 9 | 9 | private static $DESCRIPTION = ''; |
| 10 | 10 | |
| 11 | 11 | private static $KEYWORD_ARRAY = array(); |
| 12 | 12 | |
| 13 | - protected function set_head_data() |
|
| 14 | - { |
|
| 13 | + protected function set_head_data() |
|
| 14 | + {
|
|
| 15 | 15 | parent::set_head_data(); |
| 16 | 16 | |
| 17 | 17 | $this->set_title(self::$TITLE); |
@@ -19,47 +19,48 @@ discard block |
||
| 19 | 19 | $this->set_keywords(self::$KEYWORD_ARRAY); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - protected function get_introduction() |
|
| 23 | - { |
|
| 22 | + protected function get_introduction() |
|
| 23 | + {
|
|
| 24 | 24 | return; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - protected function get_page_number() |
|
| 28 | - { |
|
| 27 | + protected function get_page_number() |
|
| 28 | + {
|
|
| 29 | 29 | $page = URLDecode::getPiece(2); |
| 30 | - if(isset($page) && is_numeric($page)) |
|
| 31 | - return $page; |
|
| 30 | + if(isset($page) && is_numeric($page)) {
|
|
| 31 | + return $page; |
|
| 32 | + } |
|
| 32 | 33 | return 1; |
| 33 | 34 | } |
| 34 | 35 | |
| 35 | - protected function get_items() |
|
| 36 | - { |
|
| 36 | + protected function get_items() |
|
| 37 | + {
|
|
| 37 | 38 | return array(); |
| 38 | 39 | } |
| 39 | 40 | |
| 40 | - protected function get_list_description() |
|
| 41 | - { |
|
| 41 | + protected function get_list_description() |
|
| 42 | + {
|
|
| 42 | 43 | return 'yay cloud'; |
| 43 | 44 | } |
| 44 | 45 | |
| 45 | - protected function get_list_next_link() |
|
| 46 | - { |
|
| 46 | + protected function get_list_next_link() |
|
| 47 | + {
|
|
| 47 | 48 | return '/'; |
| 48 | 49 | } |
| 49 | 50 | |
| 50 | - protected function get_list_prev_link() |
|
| 51 | - { |
|
| 51 | + protected function get_list_prev_link() |
|
| 52 | + {
|
|
| 52 | 53 | return '/'; |
| 53 | 54 | } |
| 54 | 55 | |
| 55 | 56 | private $total_post_count; |
| 56 | - protected function get_item_count() |
|
| 57 | - { |
|
| 57 | + protected function get_item_count() |
|
| 58 | + {
|
|
| 58 | 59 | return 20; |
| 59 | 60 | } |
| 60 | 61 | |
| 61 | - protected function get_item_count_per_page() |
|
| 62 | - { |
|
| 62 | + protected function get_item_count_per_page() |
|
| 63 | + {
|
|
| 63 | 64 | return 20; |
| 64 | 65 | } |
| 65 | 66 | |
@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | Loader::load('collector', 'waterfall/LogTagCollector'); |
| 4 | 4 | Loader::load('controller', 'waterfalls/DefaultLogListController'); |
| 5 | 5 | |
| 6 | -final class LogTagListController extends DefaultLogListController |
|
| 7 | -{ |
|
| 6 | +final class LogTagListController extends DefaultLogListController |
|
| 7 | +{
|
|
| 8 | 8 | |
| 9 | 9 | private static $DEFAULT_TITLE = 'Hiking with %s, Page %d of %d'; |
| 10 | 10 | private static $DEFAULT_DESCRIPTION = 'Page %d of %d of legendary hiking stories with %s written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
@@ -22,19 +22,20 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | private $tag; |
| 24 | 24 | |
| 25 | - public function __construct() |
|
| 26 | - { |
|
| 25 | + public function __construct() |
|
| 26 | + {
|
|
| 27 | 27 | $alias = URLDecode::getPiece(3); |
| 28 | 28 | $this->tag = LogTagCollector::getTag($alias); |
| 29 | 29 | |
| 30 | - if(!$this->tag) |
|
| 31 | - $this->eject(); |
|
| 30 | + if(!$this->tag) {
|
|
| 31 | + $this->eject(); |
|
| 32 | + } |
|
| 32 | 33 | |
| 33 | 34 | parent::__construct(); |
| 34 | 35 | } |
| 35 | 36 | |
| 36 | - protected function get_initial_meta() |
|
| 37 | - { |
|
| 37 | + protected function get_initial_meta() |
|
| 38 | + {
|
|
| 38 | 39 | $meta_array = array(); |
| 39 | 40 | |
| 40 | 41 | $meta_array['title'] = "{$this->tag->name} | " . self::$WEBSITE_TITLE; |
@@ -44,8 +45,8 @@ discard block |
||
| 44 | 45 | return $meta_array; |
| 45 | 46 | } |
| 46 | 47 | |
| 47 | - protected function get_subsequent_meta() |
|
| 48 | - { |
|
| 48 | + protected function get_subsequent_meta() |
|
| 49 | + {
|
|
| 49 | 50 | $meta_array = array(); |
| 50 | 51 | |
| 51 | 52 | $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->companion->name, $this->page, $this->page_count); |
@@ -55,46 +56,46 @@ discard block |
||
| 55 | 56 | return $meta_array; |
| 56 | 57 | } |
| 57 | 58 | |
| 58 | - private function get_keyword_array() |
|
| 59 | - { |
|
| 59 | + private function get_keyword_array() |
|
| 60 | + {
|
|
| 60 | 61 | $keyword_array = self::$KEYWORD_ARRAY; |
| 61 | 62 | array_unshift($keyword_array, strtolower($this->tag->name)); |
| 62 | 63 | return $keyword_array; |
| 63 | 64 | } |
| 64 | 65 | |
| 65 | - protected function get_initial_introduction() |
|
| 66 | - { |
|
| 66 | + protected function get_initial_introduction() |
|
| 67 | + {
|
|
| 67 | 68 | return array( |
| 68 | 69 | 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->tag->name)); |
| 69 | 70 | } |
| 70 | 71 | |
| 71 | - protected function get_subsequent_introduction() |
|
| 72 | - { |
|
| 72 | + protected function get_subsequent_introduction() |
|
| 73 | + {
|
|
| 73 | 74 | return $this->get_initial_introduction(); |
| 74 | 75 | } |
| 75 | 76 | |
| 76 | - protected function get_page_number_piece() |
|
| 77 | - { |
|
| 77 | + protected function get_page_number_piece() |
|
| 78 | + {
|
|
| 78 | 79 | return URLDecode::getPiece(3); |
| 79 | 80 | } |
| 80 | 81 | |
| 81 | - protected function get_item_result($total, $offset) |
|
| 82 | - { |
|
| 82 | + protected function get_item_result($total, $offset) |
|
| 83 | + {
|
|
| 83 | 84 | return LogTagCollector::getLogListForTag($this->tag->id, $total, $offset); |
| 84 | 85 | } |
| 85 | 86 | |
| 86 | - protected function get_item_count_result() |
|
| 87 | - { |
|
| 87 | + protected function get_item_count_result() |
|
| 88 | + {
|
|
| 88 | 89 | return LogTagCollector::getLogCountForTag($this->tag->id); |
| 89 | 90 | } |
| 90 | 91 | |
| 91 | - protected function get_list_description_pattern() |
|
| 92 | - { |
|
| 92 | + protected function get_list_description_pattern() |
|
| 93 | + {
|
|
| 93 | 94 | return str_replace('%TAG%', $this->tag->name, self::$NAVIGATION_DESCRIPTION); |
| 94 | 95 | } |
| 95 | 96 | |
| 96 | - protected function get_list_link_root() |
|
| 97 | - { |
|
| 97 | + protected function get_list_link_root() |
|
| 98 | + {
|
|
| 98 | 99 | return sprintf(self::$LINK_ROOT, $this->tag->alias); |
| 99 | 100 | } |
| 100 | 101 | |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | Loader::load('controller', 'waterfalls/DefaultPageController'); |
| 4 | 4 | |
| 5 | -abstract class DefaultListController extends DefaultPageController |
|
| 6 | -{ |
|
| 5 | +abstract class DefaultListController extends DefaultPageController |
|
| 6 | +{
|
|
| 7 | 7 | |
| 8 | 8 | private static $IMAGE_ELEMENT_PATTERN = '<img src="/photo/%s/%s-size-%s.jpg" alt="%s" height="%s" width="%s" />'; |
| 9 | 9 | |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | protected $page_count; |
| 12 | 12 | protected $offset; |
| 13 | 13 | |
| 14 | - public function __construct() |
|
| 15 | - { |
|
| 14 | + public function __construct() |
|
| 15 | + {
|
|
| 16 | 16 | parent::__construct(); |
| 17 | 17 | |
| 18 | 18 | $this->page = $this->get_page_number(); |
@@ -20,15 +20,17 @@ discard block |
||
| 20 | 20 | $this->offset = ($this->page - 1) * $this->get_item_count_per_page(); |
| 21 | 21 | |
| 22 | 22 | $items = $this->get_items(); |
| 23 | - if(count($items) < 1) |
|
| 24 | - $this->eject(); |
|
| 23 | + if(count($items) < 1) {
|
|
| 24 | + $this->eject(); |
|
| 25 | + } |
|
| 25 | 26 | } |
| 26 | 27 | |
| 27 | - final protected function get_page_number() |
|
| 28 | - { |
|
| 28 | + final protected function get_page_number() |
|
| 29 | + {
|
|
| 29 | 30 | $page = $this->get_page_number_piece(); |
| 30 | - if(isset($page) && is_numeric($page)) |
|
| 31 | - return $page; |
|
| 31 | + if(isset($page) && is_numeric($page)) {
|
|
| 32 | + return $page; |
|
| 33 | + } |
|
| 32 | 34 | return 1; |
| 33 | 35 | } |
| 34 | 36 | |
@@ -39,10 +41,11 @@ discard block |
||
| 39 | 41 | abstract protected function get_sidebar(); |
| 40 | 42 | abstract protected function get_list_view(); |
| 41 | 43 | |
| 42 | - final private function get_introduction() |
|
| 43 | - { |
|
| 44 | - if($this->page == 1) |
|
| 45 | - return $this->get_initial_introduction(); |
|
| 44 | + final private function get_introduction() |
|
| 45 | + {
|
|
| 46 | + if($this->page == 1) {
|
|
| 47 | + return $this->get_initial_introduction(); |
|
| 48 | + } |
|
| 46 | 49 | |
| 47 | 50 | return $this->get_subsequent_introduction(); |
| 48 | 51 | } |
@@ -51,8 +54,8 @@ discard block |
||
| 51 | 54 | abstract protected function get_subsequent_introduction(); |
| 52 | 55 | |
| 53 | 56 | private $items; |
| 54 | - protected function get_items() |
|
| 55 | - { |
|
| 57 | + protected function get_items() |
|
| 58 | + {
|
|
| 56 | 59 | if(!isset($this->items)) |
| 57 | 60 | { |
| 58 | 61 | $total = $this->get_item_count_per_page(); |
@@ -66,26 +69,28 @@ discard block |
||
| 66 | 69 | abstract protected function get_item_result($total, $offset); |
| 67 | 70 | |
| 68 | 71 | private $item_count; |
| 69 | - final private function get_item_count() |
|
| 70 | - { |
|
| 71 | - if(!isset($this->item_count)) |
|
| 72 | - $this->item_count = $this->get_item_count_result(); |
|
| 72 | + final private function get_item_count() |
|
| 73 | + {
|
|
| 74 | + if(!isset($this->item_count)) {
|
|
| 75 | + $this->item_count = $this->get_item_count_result(); |
|
| 76 | + } |
|
| 73 | 77 | return $this->item_count; |
| 74 | 78 | } |
| 75 | 79 | |
| 76 | 80 | abstract protected function get_item_count_result(); |
| 77 | 81 | |
| 78 | - final protected function set_head_data() |
|
| 79 | - { |
|
| 82 | + final protected function set_head_data() |
|
| 83 | + {
|
|
| 80 | 84 | parent::set_head_data(); |
| 81 | 85 | |
| 82 | 86 | $this->set_head('next_link', $this->get_list_next_link()); |
| 83 | 87 | $this->set_head('previous_link', $this->get_list_prev_link()); |
| 84 | 88 | |
| 85 | - if($this->page == 1) |
|
| 86 | - $meta_array = $this->get_initial_meta(); |
|
| 87 | - else |
|
| 88 | - $meta_array = $this->get_subsequent_meta(); |
|
| 89 | + if($this->page == 1) {
|
|
| 90 | + $meta_array = $this->get_initial_meta(); |
|
| 91 | + } else {
|
|
| 92 | + $meta_array = $this->get_subsequent_meta(); |
|
| 93 | + } |
|
| 89 | 94 | |
| 90 | 95 | $this->set_title($meta_array['title']); |
| 91 | 96 | $this->set_description($meta_array['description']); |
@@ -95,16 +100,16 @@ discard block |
||
| 95 | 100 | abstract protected function get_initial_meta(); |
| 96 | 101 | abstract protected function get_subsequent_meta(); |
| 97 | 102 | |
| 98 | - final protected function set_body_data($page_type = 'normal') |
|
| 99 | - { |
|
| 103 | + final protected function set_body_data($page_type = 'normal') |
|
| 104 | + {
|
|
| 100 | 105 | parent::set_body_data($page_type); |
| 101 | 106 | |
| 102 | 107 | $this->set_body('view', $this->get_list_view()); |
| 103 | 108 | $this->set_body('data', $this->get_list_body_data()); |
| 104 | 109 | } |
| 105 | 110 | |
| 106 | - final private function get_list_body_data() |
|
| 107 | - { |
|
| 111 | + final private function get_list_body_data() |
|
| 112 | + {
|
|
| 108 | 113 | $body_data_array = array(); |
| 109 | 114 | |
| 110 | 115 | $body_data_array['introduction'] = $this->get_introduction(); |
@@ -117,37 +122,42 @@ discard block |
||
| 117 | 122 | return $body_data_array; |
| 118 | 123 | } |
| 119 | 124 | |
| 120 | - final private function get_list_prev_link() |
|
| 121 | - { |
|
| 122 | - if($this->page == 1) |
|
| 123 | - return; |
|
| 124 | - if($this->page == 2) |
|
| 125 | - return $this->get_list_link_root(); |
|
| 125 | + final private function get_list_prev_link() |
|
| 126 | + {
|
|
| 127 | + if($this->page == 1) {
|
|
| 128 | + return; |
|
| 129 | + } |
|
| 130 | + if($this->page == 2) {
|
|
| 131 | + return $this->get_list_link_root(); |
|
| 132 | + } |
|
| 126 | 133 | return $this->get_list_link_root() . ($this->page - 1) . '/'; |
| 127 | 134 | } |
| 128 | 135 | |
| 129 | - final private function get_list_next_link() |
|
| 130 | - { |
|
| 131 | - if(($this->page * $this->get_item_count_per_page()) >= $this->get_item_count()) |
|
| 132 | - return; |
|
| 136 | + final private function get_list_next_link() |
|
| 137 | + {
|
|
| 138 | + if(($this->page * $this->get_item_count_per_page()) >= $this->get_item_count()) {
|
|
| 139 | + return; |
|
| 140 | + } |
|
| 133 | 141 | return $this->get_list_link_root() . ($this->page + 1) . '/'; |
| 134 | 142 | } |
| 135 | 143 | |
| 136 | 144 | abstract protected function get_list_link_root(); |
| 137 | 145 | |
| 138 | - final private function get_list_link_array() |
|
| 139 | - { |
|
| 146 | + final private function get_list_link_array() |
|
| 147 | + {
|
|
| 140 | 148 | $link_array = array(); |
| 141 | 149 | |
| 142 | - if($this->get_item_count_per_page() >= $this->get_item_count()) |
|
| 143 | - return $link_array; |
|
| 150 | + if($this->get_item_count_per_page() >= $this->get_item_count()) {
|
|
| 151 | + return $link_array; |
|
| 152 | + } |
|
| 144 | 153 | |
| 145 | 154 | $link = new stdclass(); |
| 146 | 155 | $link->anchor = '« previous'; |
| 147 | - if($this->get_list_prev_link() !== null) |
|
| 148 | - $link->uri = $this->get_list_prev_link(); |
|
| 149 | - else |
|
| 150 | - $link->class = 'inactive'; |
|
| 156 | + if($this->get_list_prev_link() !== null) {
|
|
| 157 | + $link->uri = $this->get_list_prev_link(); |
|
| 158 | + } else {
|
|
| 159 | + $link->class = 'inactive'; |
|
| 160 | + } |
|
| 151 | 161 | $link_array[] = $link; |
| 152 | 162 | |
| 153 | 163 | for($i = 1; $i <= ceil($this->get_item_count() / $this->get_item_count_per_page()); $i++) |
@@ -155,14 +165,15 @@ discard block |
||
| 155 | 165 | $link = new stdclass(); |
| 156 | 166 | $link->anchor = $i; |
| 157 | 167 | |
| 158 | - if($i == $this->page) |
|
| 159 | - $link->class = 'current'; |
|
| 160 | - else |
|
| 168 | + if($i == $this->page) {
|
|
| 169 | + $link->class = 'current'; |
|
| 170 | + } else |
|
| 161 | 171 | { |
| 162 | - if($i == 1) |
|
| 163 | - $link->uri = $this->get_list_link_root(); |
|
| 164 | - else |
|
| 165 | - $link->uri = $this->get_list_link_root() . $i . '/'; |
|
| 172 | + if($i == 1) {
|
|
| 173 | + $link->uri = $this->get_list_link_root(); |
|
| 174 | + } else {
|
|
| 175 | + $link->uri = $this->get_list_link_root() . $i . '/'; |
|
| 176 | + } |
|
| 166 | 177 | } |
| 167 | 178 | |
| 168 | 179 | $link_array[] = $link; |
@@ -170,17 +181,18 @@ discard block |
||
| 170 | 181 | |
| 171 | 182 | $link = new stdclass(); |
| 172 | 183 | $link->anchor = 'next »'; |
| 173 | - if($this->get_list_next_link() !== null) |
|
| 174 | - $link->uri = $this->get_list_next_link(); |
|
| 175 | - else |
|
| 176 | - $link->class = 'inactive'; |
|
| 184 | + if($this->get_list_next_link() !== null) {
|
|
| 185 | + $link->uri = $this->get_list_next_link(); |
|
| 186 | + } else {
|
|
| 187 | + $link->class = 'inactive'; |
|
| 188 | + } |
|
| 177 | 189 | $link_array[] = $link; |
| 178 | 190 | |
| 179 | 191 | return $link_array; |
| 180 | 192 | } |
| 181 | 193 | |
| 182 | - final private function get_list_description() |
|
| 183 | - { |
|
| 194 | + final private function get_list_description() |
|
| 195 | + {
|
|
| 184 | 196 | $start = ($this->page - 1) * $this->get_item_count_per_page() + 1; |
| 185 | 197 | $end = min($this->page * $this->get_item_count_per_page(), $this->get_item_count()); |
| 186 | 198 | $total = $this->get_item_count(); |
@@ -190,8 +202,8 @@ discard block |
||
| 190 | 202 | |
| 191 | 203 | abstract protected function get_list_description_pattern(); |
| 192 | 204 | |
| 193 | - final protected function get_image_element($category, $path, $description, $size = 'small') |
|
| 194 | - { |
|
| 205 | + final protected function get_image_element($category, $path, $description, $size = 'small') |
|
| 206 | + {
|
|
| 195 | 207 | switch($size) |
| 196 | 208 | { |
| 197 | 209 | case 'medium' : |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | Loader::load('controller', 'waterfalls/DefaultPageController'); |
| 4 | 4 | |
| 5 | -final class ContactController extends DefaultPageController |
|
| 6 | -{ |
|
| 5 | +final class ContactController extends DefaultPageController |
|
| 6 | +{
|
|
| 7 | 7 | |
| 8 | 8 | private static $TITLE = 'Contact Jacob Emerick | Waterfalls of the Keweenaw'; |
| 9 | 9 | private static $DESCRIPTION = 'Contact page to reach Jacob Emerick by email or social networks'; |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | 'waterfalls', |
| 15 | 15 | 'Jacob Emerick'); |
| 16 | 16 | |
| 17 | - protected function set_head_data() |
|
| 18 | - { |
|
| 17 | + protected function set_head_data() |
|
| 18 | + {
|
|
| 19 | 19 | $this->set_title(self::$TITLE); |
| 20 | 20 | $this->set_description(self::$DESCRIPTION); |
| 21 | 21 | $this->set_keywords(self::$KEYWORD_ARRAY); |
@@ -23,27 +23,31 @@ discard block |
||
| 23 | 23 | parent::set_head_data(); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - protected function set_body_data() |
|
| 27 | - { |
|
| 26 | + protected function set_body_data() |
|
| 27 | + {
|
|
| 28 | 28 | $this->set_body('form_container', $this->process_form()); |
| 29 | 29 | $this->set_body('view', 'Contact'); |
| 30 | 30 | |
| 31 | 31 | parent::set_body_data(); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - private function process_form() |
|
| 35 | - { |
|
| 36 | - if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') |
|
| 37 | - return (object) array('display' => 'normal'); |
|
| 34 | + private function process_form() |
|
| 35 | + {
|
|
| 36 | + if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') {
|
|
| 37 | + return (object) array('display' => 'normal');
|
|
| 38 | + } |
|
| 38 | 39 | |
| 39 | 40 | Loader::load('utility', 'Validate'); |
| 40 | 41 | $error_result = array(); |
| 41 | - if(!Validate::checkRequest('post', 'name', 'string')) |
|
| 42 | - $error_result['name'] = 'please enter your name'; |
|
| 43 | - if(!Validate::checkRequest('post', 'email', 'string')) |
|
| 44 | - $error_result['email'] = 'please enter a valid email'; |
|
| 45 | - if(!Validate::checkRequest('post', 'message', 'string')) |
|
| 46 | - $error_result['message'] = 'please write a message'; |
|
| 42 | + if(!Validate::checkRequest('post', 'name', 'string')) {
|
|
| 43 | + $error_result['name'] = 'please enter your name'; |
|
| 44 | + } |
|
| 45 | + if(!Validate::checkRequest('post', 'email', 'string')) {
|
|
| 46 | + $error_result['email'] = 'please enter a valid email'; |
|
| 47 | + } |
|
| 48 | + if(!Validate::checkRequest('post', 'message', 'string')) {
|
|
| 49 | + $error_result['message'] = 'please write a message'; |
|
| 50 | + } |
|
| 47 | 51 | |
| 48 | 52 | $values = (object) array( |
| 49 | 53 | 'name' => Request::getPost('name'), |
@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | Loader::load('collector', 'waterfall/CountyCollector'); |
| 4 | 4 | Loader::load('controller', 'waterfalls/DefaultWaterfallListController'); |
| 5 | 5 | |
| 6 | -final class CountyListController extends DefaultWaterfallListController |
|
| 7 | -{ |
|
| 6 | +final class CountyListController extends DefaultWaterfallListController |
|
| 7 | +{
|
|
| 8 | 8 | |
| 9 | 9 | private static $DEFAULT_TITLE = '%s Waterfalls, Page %d of %d'; |
| 10 | 10 | private static $DEFAULT_DESCRIPTION = 'Page %d of %d of awesome waterfalls in %s, located in the northwestern wilds of Micigan\'s Upper Peninsula.'; |
@@ -23,19 +23,20 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | private $county; |
| 25 | 25 | |
| 26 | - public function __construct() |
|
| 27 | - { |
|
| 26 | + public function __construct() |
|
| 27 | + {
|
|
| 28 | 28 | $path = URLDecode::getPiece(1); |
| 29 | 29 | $this->county = CountyCollector::getByAlias($path); |
| 30 | 30 | |
| 31 | - if(!$this->county) |
|
| 32 | - $this->eject(); |
|
| 31 | + if(!$this->county) {
|
|
| 32 | + $this->eject(); |
|
| 33 | + } |
|
| 33 | 34 | |
| 34 | 35 | parent::__construct(); |
| 35 | 36 | } |
| 36 | 37 | |
| 37 | - protected function get_initial_meta() |
|
| 38 | - { |
|
| 38 | + protected function get_initial_meta() |
|
| 39 | + {
|
|
| 39 | 40 | $meta_array = array(); |
| 40 | 41 | |
| 41 | 42 | $meta_array['title'] = "{$this->county->name} Waterfalls | " . self::$WEBSITE_TITLE; |
@@ -45,8 +46,8 @@ discard block |
||
| 45 | 46 | return $meta_array; |
| 46 | 47 | } |
| 47 | 48 | |
| 48 | - protected function get_subsequent_meta() |
|
| 49 | - { |
|
| 49 | + protected function get_subsequent_meta() |
|
| 50 | + {
|
|
| 50 | 51 | $meta_array = array(); |
| 51 | 52 | |
| 52 | 53 | $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->county->name, $this->page, $this->page_count); |
@@ -56,15 +57,15 @@ discard block |
||
| 56 | 57 | return $meta_array; |
| 57 | 58 | } |
| 58 | 59 | |
| 59 | - private function get_keyword_array() |
|
| 60 | - { |
|
| 60 | + private function get_keyword_array() |
|
| 61 | + {
|
|
| 61 | 62 | $keyword_array = self::$KEYWORD_ARRAY; |
| 62 | 63 | array_unshift($keyword_array, strtolower($this->county->name)); |
| 63 | 64 | return $keyword_array; |
| 64 | 65 | } |
| 65 | 66 | |
| 66 | - protected function get_initial_introduction() |
|
| 67 | - { |
|
| 67 | + protected function get_initial_introduction() |
|
| 68 | + {
|
|
| 68 | 69 | $introduction = array(); |
| 69 | 70 | |
| 70 | 71 | $introduction['title'] = $this->county->title; |
@@ -74,39 +75,39 @@ discard block |
||
| 74 | 75 | return $introduction; |
| 75 | 76 | } |
| 76 | 77 | |
| 77 | - protected function get_subsequent_introduction() |
|
| 78 | - { |
|
| 78 | + protected function get_subsequent_introduction() |
|
| 79 | + {
|
|
| 79 | 80 | return array( |
| 80 | 81 | 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->county->name)); |
| 81 | 82 | } |
| 82 | 83 | |
| 83 | - protected function get_item_count_per_page() |
|
| 84 | - { |
|
| 84 | + protected function get_item_count_per_page() |
|
| 85 | + {
|
|
| 85 | 86 | return self::$ITEM_COUNT_PER_PAGE; |
| 86 | 87 | } |
| 87 | 88 | |
| 88 | - protected function get_page_number_piece() |
|
| 89 | - { |
|
| 89 | + protected function get_page_number_piece() |
|
| 90 | + {
|
|
| 90 | 91 | return URLDecode::getPiece(2); |
| 91 | 92 | } |
| 92 | 93 | |
| 93 | - protected function get_item_result($total, $offset) |
|
| 94 | - { |
|
| 94 | + protected function get_item_result($total, $offset) |
|
| 95 | + {
|
|
| 95 | 96 | return CountyCollector::getLogListForCounty($this->county->id, $total, $offset); |
| 96 | 97 | } |
| 97 | 98 | |
| 98 | - protected function get_item_count_result() |
|
| 99 | - { |
|
| 99 | + protected function get_item_count_result() |
|
| 100 | + {
|
|
| 100 | 101 | return CountyCollector::getLogCountForCounty($this->county->id); |
| 101 | 102 | } |
| 102 | 103 | |
| 103 | - protected function get_list_description_pattern() |
|
| 104 | - { |
|
| 104 | + protected function get_list_description_pattern() |
|
| 105 | + {
|
|
| 105 | 106 | return str_replace('%COUNTY%', $this->county->name, self::$NAVIGATION_DESCRIPTION); |
| 106 | 107 | } |
| 107 | 108 | |
| 108 | - protected function get_list_link_root() |
|
| 109 | - { |
|
| 109 | + protected function get_list_link_root() |
|
| 110 | + {
|
|
| 110 | 111 | return sprintf(self::$LINK_ROOT, $this->county->alias); |
| 111 | 112 | } |
| 112 | 113 | |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | Loader::load('controller', 'waterfalls/DefaultPageController'); |
| 4 | 4 | |
| 5 | -final class AboutController extends DefaultPageController |
|
| 6 | -{ |
|
| 5 | +final class AboutController extends DefaultPageController |
|
| 6 | +{
|
|
| 7 | 7 | |
| 8 | 8 | private static $TITLE = 'About the Website | Waterfalls of the Keweenaw'; |
| 9 | 9 | private static $DESCRIPTION = 'A little bit about the website, the area, and the reason why someone would hunt down a hundred and fifty waterfalls in the Upper Peninsula.'; |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | 'Jacob Emerick', |
| 15 | 15 | ); |
| 16 | 16 | |
| 17 | - protected function set_head_data() |
|
| 18 | - { |
|
| 17 | + protected function set_head_data() |
|
| 18 | + {
|
|
| 19 | 19 | parent::set_head_data(); |
| 20 | 20 | |
| 21 | 21 | $this->set_title(self::$TITLE); |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | $this->set_keywords(self::$KEYWORD_ARRAY); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - protected function set_body_data($page_type = 'normal') |
|
| 27 | - { |
|
| 26 | + protected function set_body_data($page_type = 'normal') |
|
| 27 | + {
|
|
| 28 | 28 | parent::set_body_data($page_type); |
| 29 | 29 | |
| 30 | 30 | $this->set_body('view', 'About'); |
@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | Loader::load('collector', 'waterfall/PeriodCollector'); |
| 4 | 4 | Loader::load('controller', 'waterfalls/DefaultLogListController'); |
| 5 | 5 | |
| 6 | -final class PeriodListController extends DefaultLogListController |
|
| 7 | -{ |
|
| 6 | +final class PeriodListController extends DefaultLogListController |
|
| 7 | +{
|
|
| 8 | 8 | |
| 9 | 9 | private static $DEFAULT_TITLE = '%s Hiking Stories, Page %d of %d'; |
| 10 | 10 | private static $DEFAULT_DESCRIPTION = 'Page %d of %d of epic %s hiking stories written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
@@ -21,19 +21,20 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | private $period; |
| 23 | 23 | |
| 24 | - public function __construct() |
|
| 25 | - { |
|
| 24 | + public function __construct() |
|
| 25 | + {
|
|
| 26 | 26 | $alias = URLDecode::getPiece(2); |
| 27 | 27 | $this->period = PeriodCollector::getByAlias($alias); |
| 28 | 28 | |
| 29 | - if(!$this->period) |
|
| 30 | - $this->eject(); |
|
| 29 | + if(!$this->period) {
|
|
| 30 | + $this->eject(); |
|
| 31 | + } |
|
| 31 | 32 | |
| 32 | 33 | parent::__construct(); |
| 33 | 34 | } |
| 34 | 35 | |
| 35 | - protected function get_initial_meta() |
|
| 36 | - { |
|
| 36 | + protected function get_initial_meta() |
|
| 37 | + {
|
|
| 37 | 38 | $meta_array = array(); |
| 38 | 39 | |
| 39 | 40 | $meta_array['title'] = "Hiking Stories - {$this->period->name} | " . self::$WEBSITE_TITLE; |
@@ -43,8 +44,8 @@ discard block |
||
| 43 | 44 | return $meta_array; |
| 44 | 45 | } |
| 45 | 46 | |
| 46 | - protected function get_subsequent_meta() |
|
| 47 | - { |
|
| 47 | + protected function get_subsequent_meta() |
|
| 48 | + {
|
|
| 48 | 49 | $meta_array = array(); |
| 49 | 50 | |
| 50 | 51 | $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->period->name, $this->page, $this->page_count); |
@@ -54,15 +55,15 @@ discard block |
||
| 54 | 55 | return $meta_array; |
| 55 | 56 | } |
| 56 | 57 | |
| 57 | - private function get_keyword_array() |
|
| 58 | - { |
|
| 58 | + private function get_keyword_array() |
|
| 59 | + {
|
|
| 59 | 60 | $keyword_array = self::$KEYWORD_ARRAY; |
| 60 | 61 | array_unshift($keyword_array, strtolower($this->period->name)); |
| 61 | 62 | return $keyword_array; |
| 62 | 63 | } |
| 63 | 64 | |
| 64 | - protected function get_initial_introduction() |
|
| 65 | - { |
|
| 65 | + protected function get_initial_introduction() |
|
| 66 | + {
|
|
| 66 | 67 | $introduction = array(); |
| 67 | 68 | |
| 68 | 69 | $introduction['title'] = $this->period->title; |
@@ -72,37 +73,37 @@ discard block |
||
| 72 | 73 | return $introduction; |
| 73 | 74 | } |
| 74 | 75 | |
| 75 | - protected function get_subsequent_introduction() |
|
| 76 | - { |
|
| 76 | + protected function get_subsequent_introduction() |
|
| 77 | + {
|
|
| 77 | 78 | return array( |
| 78 | 79 | 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->period->name)); |
| 79 | 80 | } |
| 80 | 81 | |
| 81 | - protected function get_page_number_piece() |
|
| 82 | - { |
|
| 82 | + protected function get_page_number_piece() |
|
| 83 | + {
|
|
| 83 | 84 | return URLDecode::getPiece(3); |
| 84 | 85 | } |
| 85 | 86 | |
| 86 | - protected function get_item_result($total, $offset) |
|
| 87 | - { |
|
| 87 | + protected function get_item_result($total, $offset) |
|
| 88 | + {
|
|
| 88 | 89 | return PeriodCollector::getLogListForPeriod($this->period->id, $total, $offset); |
| 89 | 90 | } |
| 90 | 91 | |
| 91 | - protected function get_item_count_result() |
|
| 92 | - { |
|
| 92 | + protected function get_item_count_result() |
|
| 93 | + {
|
|
| 93 | 94 | return PeriodCollector::getLogCountForPeriod($this->period->id); |
| 94 | 95 | } |
| 95 | 96 | |
| 96 | - protected function get_list_description_pattern() |
|
| 97 | - { |
|
| 97 | + protected function get_list_description_pattern() |
|
| 98 | + {
|
|
| 98 | 99 | $period = $this->period->name; |
| 99 | 100 | $period = strtolower($period); |
| 100 | 101 | $navigation_description = str_replace('%PERIOD%', $period, self::$NAVIGATION_DESCRIPTION); |
| 101 | 102 | return $navigation_description; |
| 102 | 103 | } |
| 103 | 104 | |
| 104 | - protected function get_list_link_root() |
|
| 105 | - { |
|
| 105 | + protected function get_list_link_root() |
|
| 106 | + {
|
|
| 106 | 107 | return sprintf(self::$LINK_ROOT, $this->period->alias); |
| 107 | 108 | } |
| 108 | 109 | |
@@ -2,11 +2,11 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | Loader::load('controller', '/PageController'); |
| 4 | 4 | |
| 5 | -class Error404Controller extends PageController |
|
| 6 | -{ |
|
| 5 | +class Error404Controller extends PageController |
|
| 6 | +{
|
|
| 7 | 7 | |
| 8 | - protected function set_head_data() |
|
| 9 | - { |
|
| 8 | + protected function set_head_data() |
|
| 9 | + {
|
|
| 10 | 10 | $this->set_header_method('send404'); |
| 11 | 11 | $this->add_css('normalize'); |
| 12 | 12 | $this->add_css('404'); |
@@ -16,15 +16,15 @@ discard block |
||
| 16 | 16 | $this->set_head('keywords', ''); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - protected function set_body_data() |
|
| 20 | - { |
|
| 19 | + protected function set_body_data() |
|
| 20 | + {
|
|
| 21 | 21 | $this->set_body('site_list', $this->get_sites()); |
| 22 | 22 | |
| 23 | 23 | $this->set_body_view('/404'); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - private function get_sites() |
|
| 27 | - { |
|
| 26 | + private function get_sites() |
|
| 27 | + {
|
|
| 28 | 28 | return [ |
| 29 | 29 | [ |
| 30 | 30 | 'url' => 'https://home.jacobemerick.com/', |
@@ -2,72 +2,73 @@ |
||
| 2 | 2 | |
| 3 | 3 | Loader::load('utility', 'Content'); |
| 4 | 4 | |
| 5 | -final class ElapsedTimeContent extends Content |
|
| 6 | -{ |
|
| 5 | +final class ElapsedTimeContent extends Content |
|
| 6 | +{
|
|
| 7 | 7 | |
| 8 | - protected function execute() |
|
| 9 | - { |
|
| 8 | + protected function execute() |
|
| 9 | + {
|
|
| 10 | 10 | $previous_time = strtotime($this->content); |
| 11 | 11 | $current_time = time(); |
| 12 | 12 | |
| 13 | - if($current_time <= $previous_time) |
|
| 14 | - $this->content = 'few seconds ago'; |
|
| 15 | - else if(($current_time - $previous_time) < 30) |
|
| 16 | - $this->content = 'few seconds ago'; |
|
| 17 | - else if(($current_time - $previous_time) < 1.5 * 60) |
|
| 18 | - $this->content = 'a minute ago'; |
|
| 19 | - else if(($current_time - $previous_time) < 4 * 60) |
|
| 20 | - $this->content = 'few minutes ago'; |
|
| 21 | - else if(($current_time - $previous_time) < 7 * 60) |
|
| 22 | - $this->content = 'five minutes ago'; |
|
| 23 | - else if(($current_time - $previous_time) < 12 * 60) |
|
| 24 | - $this->content = 'ten minutes ago'; |
|
| 25 | - else if(($current_time - $previous_time) < 17 * 60) |
|
| 26 | - $this->content = 'fifteen minutes ago'; |
|
| 27 | - else if(($current_time - $previous_time) < 22 * 60) |
|
| 28 | - $this->content = 'twenty minutes ago'; |
|
| 29 | - else if(($current_time - $previous_time) < 37 * 60) |
|
| 30 | - $this->content = 'half hour ago'; |
|
| 31 | - else if(($current_time - $previous_time) < 52 * 60) |
|
| 32 | - $this->content = 'forty-five minutes ago'; |
|
| 33 | - else if(($current_time - $previous_time) < 1.5 * 60 * 60) |
|
| 34 | - $this->content = 'an hour ago'; |
|
| 35 | - else if(($current_time - $previous_time) < 2.5 * 60 * 60) |
|
| 36 | - $this->content = 'two hours ago'; |
|
| 37 | - else if(($current_time - $previous_time) < 3.5 * 60 * 60) |
|
| 38 | - $this->content = 'three hours ago'; |
|
| 39 | - else if(($current_time - $previous_time) < 4.5 * 60 * 60) |
|
| 40 | - $this->content = 'few hours ago'; |
|
| 41 | - else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'pm') |
|
| 42 | - $this->content = 'this afternoon'; |
|
| 43 | - else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'am') |
|
| 44 | - $this->content = 'this morning'; |
|
| 45 | - else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm' && date('G', $previous_time) >= 17) |
|
| 46 | - $this->content = 'yesterday evening'; |
|
| 47 | - else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm') |
|
| 48 | - $this->content = 'yesterday afternoon'; |
|
| 49 | - else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'am') |
|
| 50 | - $this->content = 'yesterday morning'; |
|
| 51 | - else if(($current_time - $previous_time) < 3 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 2) |
|
| 52 | - $this->content = 'two days ago'; |
|
| 53 | - else if(($current_time - $previous_time) < 4 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 3) |
|
| 54 | - $this->content = 'three days ago'; |
|
| 55 | - else if(($current_time - $previous_time) < 1 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time)) |
|
| 56 | - $this->content = 'earlier this week'; |
|
| 57 | - else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1 && date('w', $previous_time) >= 3) |
|
| 58 | - $this->content = 'late last week'; |
|
| 59 | - else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1) |
|
| 60 | - $this->content = 'early last week'; |
|
| 61 | - else if(($current_time - $previous_time) < 3 * 7 * 24 * 60 * 60) |
|
| 62 | - $this->content = 'few weeks ago'; |
|
| 63 | - else if(($current_time - $previous_time) < 1.25* 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time)) |
|
| 64 | - $this->content = 'earlier this month'; |
|
| 65 | - else if(($current_time - $previous_time) < 2 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time) + 1) |
|
| 66 | - $this->content = 'last month'; |
|
| 67 | - else if(($current_time - $previous_time) < 4 * 4 * 7 * 24 * 60 * 60) |
|
| 68 | - $this->content = 'several months ago'; |
|
| 69 | - else |
|
| 70 | - $this->content = 'long ago'; |
|
| 13 | + if($current_time <= $previous_time) {
|
|
| 14 | + $this->content = 'few seconds ago'; |
|
| 15 | + } else if(($current_time - $previous_time) < 30) {
|
|
| 16 | + $this->content = 'few seconds ago'; |
|
| 17 | + } else if(($current_time - $previous_time) < 1.5 * 60) {
|
|
| 18 | + $this->content = 'a minute ago'; |
|
| 19 | + } else if(($current_time - $previous_time) < 4 * 60) {
|
|
| 20 | + $this->content = 'few minutes ago'; |
|
| 21 | + } else if(($current_time - $previous_time) < 7 * 60) {
|
|
| 22 | + $this->content = 'five minutes ago'; |
|
| 23 | + } else if(($current_time - $previous_time) < 12 * 60) {
|
|
| 24 | + $this->content = 'ten minutes ago'; |
|
| 25 | + } else if(($current_time - $previous_time) < 17 * 60) {
|
|
| 26 | + $this->content = 'fifteen minutes ago'; |
|
| 27 | + } else if(($current_time - $previous_time) < 22 * 60) {
|
|
| 28 | + $this->content = 'twenty minutes ago'; |
|
| 29 | + } else if(($current_time - $previous_time) < 37 * 60) {
|
|
| 30 | + $this->content = 'half hour ago'; |
|
| 31 | + } else if(($current_time - $previous_time) < 52 * 60) {
|
|
| 32 | + $this->content = 'forty-five minutes ago'; |
|
| 33 | + } else if(($current_time - $previous_time) < 1.5 * 60 * 60) {
|
|
| 34 | + $this->content = 'an hour ago'; |
|
| 35 | + } else if(($current_time - $previous_time) < 2.5 * 60 * 60) {
|
|
| 36 | + $this->content = 'two hours ago'; |
|
| 37 | + } else if(($current_time - $previous_time) < 3.5 * 60 * 60) {
|
|
| 38 | + $this->content = 'three hours ago'; |
|
| 39 | + } else if(($current_time - $previous_time) < 4.5 * 60 * 60) {
|
|
| 40 | + $this->content = 'few hours ago'; |
|
| 41 | + } else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'pm') {
|
|
| 42 | + $this->content = 'this afternoon'; |
|
| 43 | + } else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'am') {
|
|
| 44 | + $this->content = 'this morning'; |
|
| 45 | + } else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm' && date('G', $previous_time) >= 17) {
|
|
| 46 | + $this->content = 'yesterday evening'; |
|
| 47 | + } else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm') {
|
|
| 48 | + $this->content = 'yesterday afternoon'; |
|
| 49 | + } else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'am') {
|
|
| 50 | + $this->content = 'yesterday morning'; |
|
| 51 | + } else if(($current_time - $previous_time) < 3 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 2) {
|
|
| 52 | + $this->content = 'two days ago'; |
|
| 53 | + } else if(($current_time - $previous_time) < 4 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 3) {
|
|
| 54 | + $this->content = 'three days ago'; |
|
| 55 | + } else if(($current_time - $previous_time) < 1 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time)) {
|
|
| 56 | + $this->content = 'earlier this week'; |
|
| 57 | + } else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1 && date('w', $previous_time) >= 3) {
|
|
| 58 | + $this->content = 'late last week'; |
|
| 59 | + } else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1) {
|
|
| 60 | + $this->content = 'early last week'; |
|
| 61 | + } else if(($current_time - $previous_time) < 3 * 7 * 24 * 60 * 60) {
|
|
| 62 | + $this->content = 'few weeks ago'; |
|
| 63 | + } else if(($current_time - $previous_time) < 1.25* 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time)) {
|
|
| 64 | + $this->content = 'earlier this month'; |
|
| 65 | + } else if(($current_time - $previous_time) < 2 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time) + 1) {
|
|
| 66 | + $this->content = 'last month'; |
|
| 67 | + } else if(($current_time - $previous_time) < 4 * 4 * 7 * 24 * 60 * 60) {
|
|
| 68 | + $this->content = 'several months ago'; |
|
| 69 | + } else {
|
|
| 70 | + $this->content = 'long ago'; |
|
| 71 | + } |
|
| 71 | 72 | } |
| 72 | 73 | |
| 73 | 74 | } |
| 74 | 75 | \ No newline at end of file |