@@ -83,6 +83,9 @@ |
||
| 83 | 83 | return self::run_query($query); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | + /** |
|
| 87 | + * @param integer $count |
|
| 88 | + */ |
|
| 86 | 89 | public static function getRecentBlogComments($count) |
| 87 | 90 | {
|
| 88 | 91 | $query = " |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | return self::run_query($query); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - public static function getRecentWaterfallComments($count = 5) |
|
| 118 | - { |
|
| 119 | - $query = " |
|
| 117 | + public static function getRecentWaterfallComments($count = 5) |
|
| 118 | + { |
|
| 119 | + $query = " |
|
| 120 | 120 | SELECT |
| 121 | 121 | `comment_meta`.`id`, |
| 122 | 122 | CONCAT('journal/', `log`.`alias`) AS `log_path`, |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | `comment_meta`.`date` DESC |
| 157 | 157 | LIMIT {$count}"; |
| 158 | 158 | |
| 159 | - return self::run_query($query); |
|
| 160 | - } |
|
| 159 | + return self::run_query($query); |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | 162 | public static function getCommentsForURL($site, $path, $commenter = 0) |
| 163 | 163 | { |
@@ -34,6 +34,9 @@ discard block |
||
| 34 | 34 | return self::run_query($query); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | + /** |
|
| 38 | + * @param integer $total |
|
| 39 | + */ |
|
| 37 | 40 | public static function getRecentList($total) |
| 38 | 41 | {
|
| 39 | 42 | $query = " |
@@ -178,6 +181,9 @@ discard block |
||
| 178 | 181 | return self::run_row_query($query); |
| 179 | 182 | } |
| 180 | 183 | |
| 184 | + /** |
|
| 185 | + * @param string $date |
|
| 186 | + */ |
|
| 181 | 187 | public static function getByDate($date) |
| 182 | 188 | {
|
| 183 | 189 | $date = self::escape($date); |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | return self::run_query($query); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public static function getRecentList($total) |
|
| 38 | - { |
|
| 39 | - $query = " |
|
| 37 | + public static function getRecentList($total) |
|
| 38 | + { |
|
| 39 | + $query = " |
|
| 40 | 40 | SELECT |
| 41 | 41 | `log`.`title`, |
| 42 | 42 | `log`.`alias`, |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | `log`.`date` DESC |
| 60 | 60 | LIMIT |
| 61 | 61 | {$total}"; |
| 62 | - return self::run_query($query); |
|
| 63 | - } |
|
| 62 | + return self::run_query($query); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | 65 | public static function getListCount() |
| 66 | 66 | { |
@@ -178,11 +178,11 @@ discard block |
||
| 178 | 178 | return self::run_row_query($query); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - public static function getByDate($date) |
|
| 182 | - { |
|
| 183 | - $date = self::escape($date); |
|
| 181 | + public static function getByDate($date) |
|
| 182 | + { |
|
| 183 | + $date = self::escape($date); |
|
| 184 | 184 | |
| 185 | - $query = " |
|
| 185 | + $query = " |
|
| 186 | 186 | SELECT |
| 187 | 187 | `log`.`alias` |
| 188 | 188 | FROM |
@@ -192,8 +192,8 @@ discard block |
||
| 192 | 192 | `log`.`is_public` = '1' |
| 193 | 193 | LIMIT 1"; |
| 194 | 194 | |
| 195 | - return self::run_row_query($query); |
|
| 196 | - } |
|
| 195 | + return self::run_row_query($query); |
|
| 196 | + } |
|
| 197 | 197 | |
| 198 | 198 | public static function getById($log) |
| 199 | 199 | { |
@@ -117,6 +117,9 @@ |
||
| 117 | 117 | return self::run_query($query); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | + /** |
|
| 121 | + * @param string $alias |
|
| 122 | + */ |
|
| 120 | 123 | public static function getByOldAlias($alias) |
| 121 | 124 | {
|
| 122 | 125 | $alias = self::escape($alias); |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | return self::run_query($query); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public static function getMapList() |
|
| 47 | - { |
|
| 48 | - $query = " |
|
| 46 | + public static function getMapList() |
|
| 47 | + { |
|
| 48 | + $query = " |
|
| 49 | 49 | SELECT |
| 50 | 50 | `waterfall`.`name`, |
| 51 | 51 | `waterfall`.`alias`, |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | ORDER BY |
| 72 | 72 | `waterfall`.`name`"; |
| 73 | 73 | |
| 74 | - return self::run_query($query); |
|
| 75 | - } |
|
| 74 | + return self::run_query($query); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | 77 | public static function getListCount() |
| 78 | 78 | { |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | return self::get_count($query); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - public static function getNearbyList($waterfall) |
|
| 96 | - { |
|
| 97 | - $query = " |
|
| 95 | + public static function getNearbyList($waterfall) |
|
| 96 | + { |
|
| 97 | + $query = " |
|
| 98 | 98 | SELECT |
| 99 | 99 | `waterfall`.`name`, |
| 100 | 100 | `waterfall`.`alias` AS `alias`, |
@@ -114,14 +114,14 @@ discard block |
||
| 114 | 114 | `waterfall`.`name`, |
| 115 | 115 | `watercourse`.`name`"; |
| 116 | 116 | |
| 117 | - return self::run_query($query); |
|
| 118 | - } |
|
| 117 | + return self::run_query($query); |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - public static function getByOldAlias($alias) |
|
| 121 | - { |
|
| 122 | - $alias = self::escape($alias); |
|
| 120 | + public static function getByOldAlias($alias) |
|
| 121 | + { |
|
| 122 | + $alias = self::escape($alias); |
|
| 123 | 123 | |
| 124 | - $query = " |
|
| 124 | + $query = " |
|
| 125 | 125 | SELECT |
| 126 | 126 | `waterfall`.`alias`, |
| 127 | 127 | `watercourse`.`alias` AS `watercourse_alias` |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | `waterfall`.`is_public` = '1' |
| 135 | 135 | LIMIT 1"; |
| 136 | 136 | |
| 137 | - return self::run_row_query($query); |
|
| 138 | - } |
|
| 137 | + return self::run_row_query($query); |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | 140 | public static function getByAlias($watercourse, $waterfall) |
| 141 | 141 | { |
@@ -97,6 +97,9 @@ |
||
| 97 | 97 | return $tag_array; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | + /** |
|
| 101 | + * @param boolean $trim |
|
| 102 | + */ |
|
| 100 | 103 | final private function get_body_for_post($post, $trim) |
| 101 | 104 | {
|
| 102 | 105 | $body = $post->body; |
@@ -18,14 +18,14 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | protected function set_head_data() |
| 20 | 20 | { |
| 21 | - $this->set_head('rss_link', [ |
|
| 22 | - 'title' => 'Jacob Emerick Blog Feed', |
|
| 23 | - 'url' => '/rss.xml' |
|
| 24 | - ]); |
|
| 25 | - $this->set_head('rss_comment_link', [ |
|
| 26 | - 'title' => 'Jacob Emerick Blog Comment Feed', |
|
| 27 | - 'url' => '/rss-comments.xml' |
|
| 28 | - ]); |
|
| 21 | + $this->set_head('rss_link', [ |
|
| 22 | + 'title' => 'Jacob Emerick Blog Feed', |
|
| 23 | + 'url' => '/rss.xml' |
|
| 24 | + ]); |
|
| 25 | + $this->set_head('rss_comment_link', [ |
|
| 26 | + 'title' => 'Jacob Emerick Blog Comment Feed', |
|
| 27 | + 'url' => '/rss-comments.xml' |
|
| 28 | + ]); |
|
| 29 | 29 | |
| 30 | 30 | $this->add_css('normalize'); |
| 31 | 31 | $this->add_css('blog'); |
@@ -87,11 +87,11 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | final private function get_tags_for_post($post) |
| 89 | 89 | { |
| 90 | - global $container; |
|
| 91 | - $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
|
| 92 | - $tag_result = $repository->getTagsForPost($post['id']); |
|
| 90 | + global $container; |
|
| 91 | + $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
|
| 92 | + $tag_result = $repository->getTagsForPost($post['id']); |
|
| 93 | 93 | |
| 94 | - $tag_array = array(); |
|
| 94 | + $tag_array = array(); |
|
| 95 | 95 | foreach($tag_result as $tag) |
| 96 | 96 | { |
| 97 | 97 | $tag_object = new stdclass(); |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | final private function get_tag_cloud() |
| 127 | 127 | { |
| 128 | - global $container; |
|
| 129 | - $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
|
| 130 | - $tag_result = $repository->getTagCloud(); |
|
| 128 | + global $container; |
|
| 129 | + $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
|
| 130 | + $tag_result = $repository->getTagCloud(); |
|
| 131 | 131 | |
| 132 | 132 | $maximum_tag_count = $this->get_maximum_tag_count($tag_result); |
| 133 | 133 | |
@@ -204,6 +204,9 @@ discard block |
||
| 204 | 204 | exit; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | + /** |
|
| 208 | + * @param string $method |
|
| 209 | + */ |
|
| 207 | 210 | protected function set_header_method($method) |
| 208 | 211 | {
|
| 209 | 212 | $this->headers = $method; |
@@ -214,6 +217,9 @@ discard block |
||
| 214 | 217 | $this->set_head('title', $value);
|
| 215 | 218 | } |
| 216 | 219 | |
| 220 | + /** |
|
| 221 | + * @param string $value |
|
| 222 | + */ |
|
| 217 | 223 | protected function set_author($value) |
| 218 | 224 | {
|
| 219 | 225 | $this->set_head('author', $value);
|
@@ -229,26 +235,41 @@ discard block |
||
| 229 | 235 | $this->set_head('keywords', implode(', ', $array));
|
| 230 | 236 | } |
| 231 | 237 | |
| 238 | + /** |
|
| 239 | + * @param string $url |
|
| 240 | + */ |
|
| 232 | 241 | protected function set_canonical($url) |
| 233 | 242 | {
|
| 234 | 243 | $this->set_head('canonical', $url);
|
| 235 | 244 | } |
| 236 | 245 | |
| 246 | + /** |
|
| 247 | + * @param string $set |
|
| 248 | + */ |
|
| 237 | 249 | protected function set_head($set, $value) |
| 238 | 250 | {
|
| 239 | 251 | $this->data_array['head'][$set] = $value; |
| 240 | 252 | } |
| 241 | 253 | |
| 254 | + /** |
|
| 255 | + * @param string $set |
|
| 256 | + */ |
|
| 242 | 257 | protected function set_body($set, $value) |
| 243 | 258 | {
|
| 244 | 259 | $this->data_array['body'][$set] = $value; |
| 245 | 260 | } |
| 246 | 261 | |
| 262 | + /** |
|
| 263 | + * @param string $file |
|
| 264 | + */ |
|
| 247 | 265 | protected function add_css($file) |
| 248 | 266 | {
|
| 249 | 267 | $this->css_array[] = $file; |
| 250 | 268 | } |
| 251 | 269 | |
| 270 | + /** |
|
| 271 | + * @param string $file |
|
| 272 | + */ |
|
| 252 | 273 | protected function add_js($file) |
| 253 | 274 | {
|
| 254 | 275 | $this->js_array[] = $file; |
@@ -271,6 +292,9 @@ discard block |
||
| 271 | 292 | $this->set_head('js_link_array', $js_array);
|
| 272 | 293 | } |
| 273 | 294 | |
| 295 | + /** |
|
| 296 | + * @param string $view |
|
| 297 | + */ |
|
| 274 | 298 | protected function set_body_view($view) |
| 275 | 299 | {
|
| 276 | 300 | $this->body_view_array[] = $view; |
@@ -315,6 +339,10 @@ discard block |
||
| 315 | 339 | } |
| 316 | 340 | |
| 317 | 341 | private $comment_errors; |
| 342 | + |
|
| 343 | + /** |
|
| 344 | + * @param string $redirect_url |
|
| 345 | + */ |
|
| 318 | 346 | protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
| 319 | 347 | {
|
| 320 | 348 | if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment')
|
@@ -56,37 +56,37 @@ discard block |
||
| 56 | 56 | return $domain_container; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - protected function get_recent_activity() |
|
| 60 | - { |
|
| 61 | - global $container; |
|
| 62 | - $activityRepository = new Jacobemerick\Web\Domain\Stream\Activity\MysqlActivityRepository($container['db_connection_locator']); |
|
| 63 | - $post_result = $activityRepository->getActivities(5); |
|
| 64 | - |
|
| 65 | - $post_array = array(); |
|
| 66 | - foreach($post_result as $row) { |
|
| 67 | - array_push($post_array, $this->expand_post($row)); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - return $post_array; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - protected function expand_post($raw_post, $format = 'short') |
|
| 74 | - { |
|
| 75 | - $post = [ |
|
| 76 | - 'type' => $raw_post['type'], |
|
| 77 | - 'title' => ($format == 'short') ? $raw_post['message'] : $raw_post['message_long'], |
|
| 78 | - 'date' => $this->get_parsed_date($raw_post['datetime']), |
|
| 79 | - ]; |
|
| 80 | - |
|
| 81 | - if ($format != 'short') { |
|
| 82 | - $post['url'] = Loader::getRootUrl('lifestream') . "{$raw_post['type']}/{$raw_post['id']}/"; |
|
| 83 | - |
|
| 84 | - $metadata = json_decode($raw_post['metadata'], true); |
|
| 85 | - $post = array_merge($post, $metadata); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - return (object) $post; |
|
| 89 | - } |
|
| 59 | + protected function get_recent_activity() |
|
| 60 | + { |
|
| 61 | + global $container; |
|
| 62 | + $activityRepository = new Jacobemerick\Web\Domain\Stream\Activity\MysqlActivityRepository($container['db_connection_locator']); |
|
| 63 | + $post_result = $activityRepository->getActivities(5); |
|
| 64 | + |
|
| 65 | + $post_array = array(); |
|
| 66 | + foreach($post_result as $row) { |
|
| 67 | + array_push($post_array, $this->expand_post($row)); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + return $post_array; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + protected function expand_post($raw_post, $format = 'short') |
|
| 74 | + { |
|
| 75 | + $post = [ |
|
| 76 | + 'type' => $raw_post['type'], |
|
| 77 | + 'title' => ($format == 'short') ? $raw_post['message'] : $raw_post['message_long'], |
|
| 78 | + 'date' => $this->get_parsed_date($raw_post['datetime']), |
|
| 79 | + ]; |
|
| 80 | + |
|
| 81 | + if ($format != 'short') { |
|
| 82 | + $post['url'] = Loader::getRootUrl('lifestream') . "{$raw_post['type']}/{$raw_post['id']}/"; |
|
| 83 | + |
|
| 84 | + $metadata = json_decode($raw_post['metadata'], true); |
|
| 85 | + $post = array_merge($post, $metadata); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + return (object) $post; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | 91 | public function activate() |
| 92 | 92 | { |
@@ -107,11 +107,11 @@ discard block |
||
| 107 | 107 | Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if (URLDecode::getSite() == 'waterfalls') { |
|
| 111 | - Loader::load('view', '/WaterfallFoot'); |
|
| 112 | - } else { |
|
| 113 | - Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
|
| 114 | - } |
|
| 110 | + if (URLDecode::getSite() == 'waterfalls') { |
|
| 111 | + Loader::load('view', '/WaterfallFoot'); |
|
| 112 | + } else { |
|
| 113 | + Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | 116 | if($view == '/404' || $view == '/503') |
| 117 | 117 | exit; |
@@ -169,19 +169,19 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | private function load_assets() |
| 171 | 171 | { |
| 172 | - $css_array = array_map(function ($stylesheet) { |
|
| 173 | - $path = "/css/{$stylesheet[0]}.css"; |
|
| 174 | - if ($stylesheet[1] > 1) { |
|
| 175 | - $path .= "?v={$stylesheet[1]}"; |
|
| 176 | - } |
|
| 177 | - return $path; |
|
| 178 | - }, $this->css_array); |
|
| 179 | - $js_array = array_map(function ($script) { |
|
| 180 | - if (substr($script, 0, 4) == 'http') { |
|
| 181 | - return $script; |
|
| 182 | - } |
|
| 183 | - return "/js/{$script}.min.js"; |
|
| 184 | - }, $this->js_array); |
|
| 172 | + $css_array = array_map(function ($stylesheet) { |
|
| 173 | + $path = "/css/{$stylesheet[0]}.css"; |
|
| 174 | + if ($stylesheet[1] > 1) { |
|
| 175 | + $path .= "?v={$stylesheet[1]}"; |
|
| 176 | + } |
|
| 177 | + return $path; |
|
| 178 | + }, $this->css_array); |
|
| 179 | + $js_array = array_map(function ($script) { |
|
| 180 | + if (substr($script, 0, 4) == 'http') { |
|
| 181 | + return $script; |
|
| 182 | + } |
|
| 183 | + return "/js/{$script}.min.js"; |
|
| 184 | + }, $this->js_array); |
|
| 185 | 185 | |
| 186 | 186 | $this->set_head('css_link_array', $css_array); |
| 187 | 187 | $this->set_head('js_link_array', $js_array); |
@@ -25,6 +25,9 @@ discard block |
||
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | + /** |
|
| 29 | + * @param string $content |
|
| 30 | + */ |
|
| 28 | 31 | private function wrap_in_list($content) |
| 29 | 32 | {
|
| 30 | 33 | $content_array = explode("\n", $content);
|
@@ -44,6 +47,9 @@ discard block |
||
| 44 | 47 | return $content; |
| 45 | 48 | } |
| 46 | 49 | |
| 50 | + /** |
|
| 51 | + * @param string $type |
|
| 52 | + */ |
|
| 47 | 53 | private function highlight_code($content, $type) |
| 48 | 54 | {
|
| 49 | 55 | switch($type) |
@@ -62,6 +62,9 @@ |
||
| 62 | 62 | $this->is_trimmed = true; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | + /** |
|
| 66 | + * @param string $content |
|
| 67 | + */ |
|
| 65 | 68 | private function trim_html_string($content, $length) |
| 66 | 69 | {
|
| 67 | 70 | $content = preg_replace(self::$PHOTO_PLACEHOLDER_MATCH, '', $content); |
@@ -42,8 +42,8 @@ |
||
| 42 | 42 | |
| 43 | 43 | if($length < strlen($this->content)) |
| 44 | 44 | $this->trim_string($length); |
| 45 | - else |
|
| 46 | - $etc = ''; |
|
| 45 | + else |
|
| 46 | + $etc = ''; |
|
| 47 | 47 | $this->check_exclude_tags(); |
| 48 | 48 | $this->close_tags($etc); |
| 49 | 49 | } |
@@ -14,9 +14,20 @@ discard block |
||
| 14 | 14 | $this->class_new = $class_name; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | + /** |
|
| 18 | + * @return string |
|
| 19 | + */ |
|
| 17 | 20 | abstract protected function getName(); |
| 18 | 21 | abstract protected function getDuration(); |
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * @return string|null |
|
| 25 | + */ |
|
| 19 | 26 | abstract protected function getDomain(); |
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @return string|null |
|
| 30 | + */ |
|
| 20 | 31 | abstract protected function getPath(); |
| 21 | 32 | |
| 22 | 33 | public function setValue($value) |
@@ -28,6 +39,9 @@ discard block |
||
| 28 | 39 | return $this; |
| 29 | 40 | } |
| 30 | 41 | |
| 42 | + /** |
|
| 43 | + * @return string|null |
|
| 44 | + */ |
|
| 31 | 45 | public function getValue() |
| 32 | 46 | {
|
| 33 | 47 | if(!$this->is_loaded) |
@@ -118,6 +132,9 @@ discard block |
||
| 118 | 132 | return $set_cookie; |
| 119 | 133 | } |
| 120 | 134 | |
| 135 | + /** |
|
| 136 | + * @param string $class_name |
|
| 137 | + */ |
|
| 121 | 138 | public static function instance($class_name) |
| 122 | 139 | {
|
| 123 | 140 | return Loader::loadNew('utility', "cookie/{$class_name}Cookie", (array) $class_name);
|
@@ -34,6 +34,9 @@ |
||
| 34 | 34 | return false; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | + /** |
|
| 38 | + * @param string $key |
|
| 39 | + */ |
|
| 37 | 40 | static function getGet($key = null) |
| 38 | 41 | {
|
| 39 | 42 | if($key) |