@@ -72,6 +72,11 @@ |
||
| 72 | 72 | return $matches[0] == $string; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | + /** |
|
| 76 | + * @param string $type |
|
| 77 | + * @param string $key |
|
| 78 | + * @param string $validation |
|
| 79 | + */ |
|
| 75 | 80 | public static function checkRequest($type, $key, $validation, $strict = false) |
| 76 | 81 | {
|
| 77 | 82 | switch($type) |
@@ -11,39 +11,39 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | public static function isBoolean($value, $strict = false) |
| 13 | 13 | { |
| 14 | - if($strict && ($value === true || $value === false)) |
|
| 14 | + if ($strict && ($value === true || $value === false)) |
|
| 15 | 15 | return true; |
| 16 | - if(!$strict && ((bool) $value === true || (bool) $value === false)) |
|
| 16 | + if (!$strict && ((bool) $value === true || (bool) $value === false)) |
|
| 17 | 17 | return true; |
| 18 | 18 | return false; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public static function isDate($value) |
| 22 | 22 | { |
| 23 | - if(strtotime($value) !== -1) |
|
| 23 | + if (strtotime($value) !== -1) |
|
| 24 | 24 | return true; |
| 25 | - if(date('y', $value) !== false) |
|
| 25 | + if (date('y', $value) !== false) |
|
| 26 | 26 | return true; |
| 27 | 27 | return false; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public static function isInteger($value, $strict = false) |
| 31 | 31 | { |
| 32 | - if($strict) |
|
| 32 | + if ($strict) |
|
| 33 | 33 | return is_int($value); |
| 34 | 34 | return (int) $value == $value; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public static function isIP($value) |
| 38 | 38 | { |
| 39 | - if(self::isInteger(ip2long($value))) |
|
| 39 | + if (self::isInteger(ip2long($value))) |
|
| 40 | 40 | return true; |
| 41 | 41 | return false; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public static function isString($value, $strict = false) |
| 45 | 45 | { |
| 46 | - if($strict) |
|
| 46 | + if ($strict) |
|
| 47 | 47 | return is_string($value); |
| 48 | 48 | return (string) $value == $value; |
| 49 | 49 | } |
@@ -67,14 +67,14 @@ discard block |
||
| 67 | 67 | private static function check_value($pattern, $string) |
| 68 | 68 | { |
| 69 | 69 | preg_match($pattern, $string, $matches); |
| 70 | - if(empty($matches)) |
|
| 70 | + if (empty($matches)) |
|
| 71 | 71 | return false; |
| 72 | 72 | return $matches[0] == $string; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public static function checkRequest($type, $key, $validation, $strict = false) |
| 76 | 76 | { |
| 77 | - switch($type) |
|
| 77 | + switch ($type) |
|
| 78 | 78 | { |
| 79 | 79 | case 'server': |
| 80 | 80 | $value = Request::getServer($key); |
@@ -84,10 +84,10 @@ discard block |
||
| 84 | 84 | break; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - if($value == false) |
|
| 87 | + if ($value == false) |
|
| 88 | 88 | return false; |
| 89 | 89 | |
| 90 | - switch($validation) |
|
| 90 | + switch ($validation) |
|
| 91 | 91 | { |
| 92 | 92 | case 'boolean': |
| 93 | 93 | return self::isBoolean($value, $strict); |
@@ -11,40 +11,47 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | public static function isBoolean($value, $strict = false) |
| 13 | 13 | { |
| 14 | - if($strict && ($value === true || $value === false)) |
|
| 15 | - return true; |
|
| 16 | - if(!$strict && ((bool) $value === true || (bool) $value === false)) |
|
| 17 | - return true; |
|
| 14 | + if($strict && ($value === true || $value === false)) {
|
|
| 15 | + return true; |
|
| 16 | + } |
|
| 17 | + if(!$strict && ((bool) $value === true || (bool) $value === false)) {
|
|
| 18 | + return true; |
|
| 19 | + } |
|
| 18 | 20 | return false; |
| 19 | 21 | } |
| 20 | 22 | |
| 21 | 23 | public static function isDate($value) |
| 22 | 24 | { |
| 23 | - if(strtotime($value) !== -1) |
|
| 24 | - return true; |
|
| 25 | - if(date('y', $value) !== false) |
|
| 26 | - return true; |
|
| 25 | + if(strtotime($value) !== -1) {
|
|
| 26 | + return true; |
|
| 27 | + } |
|
| 28 | + if(date('y', $value) !== false) {
|
|
| 29 | + return true; |
|
| 30 | + } |
|
| 27 | 31 | return false; |
| 28 | 32 | } |
| 29 | 33 | |
| 30 | 34 | public static function isInteger($value, $strict = false) |
| 31 | 35 | { |
| 32 | - if($strict) |
|
| 33 | - return is_int($value); |
|
| 36 | + if($strict) {
|
|
| 37 | + return is_int($value); |
|
| 38 | + } |
|
| 34 | 39 | return (int) $value == $value; |
| 35 | 40 | } |
| 36 | 41 | |
| 37 | 42 | public static function isIP($value) |
| 38 | 43 | { |
| 39 | - if(self::isInteger(ip2long($value))) |
|
| 40 | - return true; |
|
| 44 | + if(self::isInteger(ip2long($value))) {
|
|
| 45 | + return true; |
|
| 46 | + } |
|
| 41 | 47 | return false; |
| 42 | 48 | } |
| 43 | 49 | |
| 44 | 50 | public static function isString($value, $strict = false) |
| 45 | 51 | { |
| 46 | - if($strict) |
|
| 47 | - return is_string($value); |
|
| 52 | + if($strict) {
|
|
| 53 | + return is_string($value); |
|
| 54 | + } |
|
| 48 | 55 | return (string) $value == $value; |
| 49 | 56 | } |
| 50 | 57 | |
@@ -67,8 +74,9 @@ discard block |
||
| 67 | 74 | private static function check_value($pattern, $string) |
| 68 | 75 | { |
| 69 | 76 | preg_match($pattern, $string, $matches); |
| 70 | - if(empty($matches)) |
|
| 71 | - return false; |
|
| 77 | + if(empty($matches)) {
|
|
| 78 | + return false; |
|
| 79 | + } |
|
| 72 | 80 | return $matches[0] == $string; |
| 73 | 81 | } |
| 74 | 82 | |
@@ -84,8 +92,9 @@ discard block |
||
| 84 | 92 | break; |
| 85 | 93 | } |
| 86 | 94 | |
| 87 | - if($value == false) |
|
| 88 | - return false; |
|
| 95 | + if($value == false) {
|
|
| 96 | + return false; |
|
| 97 | + } |
|
| 89 | 98 | |
| 90 | 99 | switch($validation) |
| 91 | 100 | { |
@@ -36,6 +36,10 @@ discard block |
||
| 36 | 36 | $this->replace_element_patterns(); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | + /** |
|
| 40 | + * @param string $pattern |
|
| 41 | + * @param string $replace |
|
| 42 | + */ |
|
| 39 | 43 | private function process_element($pattern, $replace) |
| 40 | 44 | {
|
| 41 | 45 | $match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER); |
@@ -75,6 +79,10 @@ discard block |
||
| 75 | 79 | $this->content = strip_tags($this->content); |
| 76 | 80 | } |
| 77 | 81 | |
| 82 | + /** |
|
| 83 | + * @param string $pattern |
|
| 84 | + * @param string $replace |
|
| 85 | + */ |
|
| 78 | 86 | private function link_unlinked_urls($pattern, $replace) |
| 79 | 87 | {
|
| 80 | 88 | $match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER); |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | $match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER); |
| 42 | 42 | |
| 43 | - if($match_count < 1) |
|
| 43 | + if ($match_count < 1) |
|
| 44 | 44 | return; |
| 45 | 45 | |
| 46 | - foreach($matches as $match) |
|
| 46 | + foreach ($matches as $match) |
|
| 47 | 47 | { |
| 48 | 48 | $full_match = array_shift($match); |
| 49 | 49 | $placeholder = $this->create_placeholder($full_match); |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | $match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER); |
| 81 | 81 | |
| 82 | - if($match_count < 1) |
|
| 82 | + if ($match_count < 1) |
|
| 83 | 83 | return; |
| 84 | 84 | |
| 85 | - foreach($matches as $match) |
|
| 85 | + foreach ($matches as $match) |
|
| 86 | 86 | { |
| 87 | 87 | $full_match = array_shift($match); |
| 88 | 88 | $full_match_pattern = $this->create_full_match_pattern($full_match); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | private function replace_element_patterns() |
| 101 | 101 | { |
| 102 | - foreach($this->replacement_array as $key => $replace) |
|
| 102 | + foreach ($this->replacement_array as $key => $replace) |
|
| 103 | 103 | { |
| 104 | 104 | $this->content = str_replace($key, $replace, $this->content); |
| 105 | 105 | } |
@@ -40,8 +40,9 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | $match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER); |
| 42 | 42 | |
| 43 | - if($match_count < 1) |
|
| 44 | - return; |
|
| 43 | + if($match_count < 1) {
|
|
| 44 | + return; |
|
| 45 | + } |
|
| 45 | 46 | |
| 46 | 47 | foreach($matches as $match) |
| 47 | 48 | { |
@@ -79,8 +80,9 @@ discard block |
||
| 79 | 80 | { |
| 80 | 81 | $match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER); |
| 81 | 82 | |
| 82 | - if($match_count < 1) |
|
| 83 | - return; |
|
| 83 | + if($match_count < 1) {
|
|
| 84 | + return; |
|
| 85 | + } |
|
| 84 | 86 | |
| 85 | 87 | foreach($matches as $match) |
| 86 | 88 | { |
@@ -23,6 +23,9 @@ |
||
| 23 | 23 | return; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | + /** |
|
| 27 | + * @param boolean $is_absolute |
|
| 28 | + */ |
|
| 26 | 29 | private function get_link($string, $is_absolute, $anchor = '') |
| 27 | 30 | {
|
| 28 | 31 | list($type, $uri) = explode('/', $string, 2);
|
@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | protected function execute($is_absolute = true) |
| 13 | 13 | { |
| 14 | 14 | preg_match_all(self::$LINK_PLACEHOLDER_MATCH, $this->content, $matches); |
| 15 | - foreach($matches[1] as $key => $match) |
|
| 15 | + foreach ($matches[1] as $key => $match) |
|
| 16 | 16 | { |
| 17 | - if(isset($matches[3][$key])) |
|
| 17 | + if (isset($matches[3][$key])) |
|
| 18 | 18 | $link_content = $this->get_link($match, $is_absolute, $matches[3][$key]); |
| 19 | 19 | else |
| 20 | 20 | $link_content = $this->get_link($match, $is_absolute); |
@@ -29,19 +29,19 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $link = ''; |
| 31 | 31 | |
| 32 | - switch($type) |
|
| 32 | + switch ($type) |
|
| 33 | 33 | { |
| 34 | 34 | case 'blog' : |
| 35 | 35 | Loader::load('collector', 'blog/PostCollector'); |
| 36 | 36 | $post = PostCollector::getPostByURI($uri); |
| 37 | 37 | |
| 38 | - if($post === NULL) |
|
| 38 | + if ($post === NULL) |
|
| 39 | 39 | return; |
| 40 | 40 | |
| 41 | 41 | $link .= ($is_absolute) ? Loader::getRootURL('blog') : '/'; |
| 42 | 42 | $link .= "{$post->category}/{$post->path}/"; |
| 43 | 43 | |
| 44 | - if($anchor == '') |
|
| 44 | + if ($anchor == '') |
|
| 45 | 45 | $anchor = $post->title; |
| 46 | 46 | |
| 47 | 47 | break; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $link .= ($is_absolute) ? Loader::getRootURL('blog') : '/'; |
| 50 | 50 | $link .= "tag/{$uri}/"; |
| 51 | 51 | |
| 52 | - if($anchor == '') |
|
| 52 | + if ($anchor == '') |
|
| 53 | 53 | { |
| 54 | 54 | $anchor = $uri; |
| 55 | 55 | $anchor = str_replace('-', ' ', $anchor); |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | Loader::load('collector', 'waterfall/LogCollector'); |
| 62 | 62 | $log = LogCollector::getByAlias($uri); |
| 63 | 63 | |
| 64 | - if($log === NULL) |
|
| 64 | + if ($log === NULL) |
|
| 65 | 65 | return; |
| 66 | 66 | |
| 67 | 67 | $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/'; |
| 68 | 68 | $link .= "journal/{$log->alias}/"; |
| 69 | 69 | |
| 70 | - if($anchor == '') |
|
| 70 | + if ($anchor == '') |
|
| 71 | 71 | $anchor = $log->title; |
| 72 | 72 | |
| 73 | 73 | break; |
@@ -14,10 +14,11 @@ discard block |
||
| 14 | 14 | preg_match_all(self::$LINK_PLACEHOLDER_MATCH, $this->content, $matches); |
| 15 | 15 | foreach($matches[1] as $key => $match) |
| 16 | 16 | { |
| 17 | - if(isset($matches[3][$key])) |
|
| 18 | - $link_content = $this->get_link($match, $is_absolute, $matches[3][$key]); |
|
| 19 | - else |
|
| 20 | - $link_content = $this->get_link($match, $is_absolute); |
|
| 17 | + if(isset($matches[3][$key])) {
|
|
| 18 | + $link_content = $this->get_link($match, $is_absolute, $matches[3][$key]); |
|
| 19 | + } else {
|
|
| 20 | + $link_content = $this->get_link($match, $is_absolute); |
|
| 21 | + } |
|
| 21 | 22 | $this->content = str_replace($matches[0][$key], $link_content, $this->content); |
| 22 | 23 | } |
| 23 | 24 | return; |
@@ -36,14 +37,16 @@ discard block |
||
| 36 | 37 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
| 37 | 38 | $post = $repository->findPostByPath($post_uri); |
| 38 | 39 | |
| 39 | - if($post === NULL) |
|
| 40 | - return; |
|
| 40 | + if($post === NULL) {
|
|
| 41 | + return; |
|
| 42 | + } |
|
| 41 | 43 | |
| 42 | 44 | $link .= ($is_absolute) ? Loader::getRootURL('blog') : '/'; |
| 43 | 45 | $link .= "{$post['category']}/{$post['path']}/"; |
| 44 | 46 | |
| 45 | - if($anchor == '') |
|
| 46 | - $anchor = $post['title']; |
|
| 47 | + if($anchor == '') {
|
|
| 48 | + $anchor = $post['title']; |
|
| 49 | + } |
|
| 47 | 50 | |
| 48 | 51 | break; |
| 49 | 52 | case 'blog-tag' : |
@@ -62,14 +65,16 @@ discard block |
||
| 62 | 65 | Loader::load('collector', 'waterfall/LogCollector'); |
| 63 | 66 | $log = LogCollector::getByAlias($uri); |
| 64 | 67 | |
| 65 | - if($log === NULL) |
|
| 66 | - return; |
|
| 68 | + if($log === NULL) {
|
|
| 69 | + return; |
|
| 70 | + } |
|
| 67 | 71 | |
| 68 | 72 | $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/'; |
| 69 | 73 | $link .= "journal/{$log->alias}/"; |
| 70 | 74 | |
| 71 | - if($anchor == '') |
|
| 72 | - $anchor = $log->title; |
|
| 75 | + if($anchor == '') {
|
|
| 76 | + $anchor = $log->title; |
|
| 77 | + } |
|
| 73 | 78 | |
| 74 | 79 | break; |
| 75 | 80 | case 'falls' : |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | switch($type) |
| 33 | 33 | { |
| 34 | 34 | case 'blog' : |
| 35 | - global $container; |
|
| 36 | - $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
| 37 | - $post = $repository->findPostByPath($uri); |
|
| 35 | + global $container; |
|
| 36 | + $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
| 37 | + $post = $repository->findPostByPath($uri); |
|
| 38 | 38 | |
| 39 | 39 | if($post === NULL) |
| 40 | 40 | return; |
@@ -73,38 +73,38 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | break; |
| 75 | 75 | case 'falls' : |
| 76 | - $pieces = explode('/', $uri); |
|
| 77 | - if (count($pieces) == 1) { |
|
| 78 | - Loader::load('collector', 'waterfall/WatercourseCollector'); |
|
| 79 | - list ($watercourse_alias) = $pieces; |
|
| 80 | - $watercourse = WatercourseCollector::getByAlias($watercourse_alias); |
|
| 76 | + $pieces = explode('/', $uri); |
|
| 77 | + if (count($pieces) == 1) { |
|
| 78 | + Loader::load('collector', 'waterfall/WatercourseCollector'); |
|
| 79 | + list ($watercourse_alias) = $pieces; |
|
| 80 | + $watercourse = WatercourseCollector::getByAlias($watercourse_alias); |
|
| 81 | 81 | |
| 82 | - if ($watercourse == null) { |
|
| 83 | - return; |
|
| 84 | - } |
|
| 82 | + if ($watercourse == null) { |
|
| 83 | + return; |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/'; |
|
| 87 | - $link .= "{$watercourse->alias}/"; |
|
| 86 | + $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/'; |
|
| 87 | + $link .= "{$watercourse->alias}/"; |
|
| 88 | 88 | |
| 89 | - if ($anchor == '') { |
|
| 90 | - $anchor = $watercourse->name; |
|
| 91 | - } |
|
| 92 | - } else if (count($pieces) == 2) { |
|
| 93 | - Loader::load('collector', 'waterfall/WaterfallCollector'); |
|
| 94 | - list ($watercourse_alias, $waterfall_alias) = $pieces; |
|
| 95 | - $waterfall = WaterfallCollector::getByAlias($watercourse_alias, $waterfall_alias); |
|
| 89 | + if ($anchor == '') { |
|
| 90 | + $anchor = $watercourse->name; |
|
| 91 | + } |
|
| 92 | + } else if (count($pieces) == 2) { |
|
| 93 | + Loader::load('collector', 'waterfall/WaterfallCollector'); |
|
| 94 | + list ($watercourse_alias, $waterfall_alias) = $pieces; |
|
| 95 | + $waterfall = WaterfallCollector::getByAlias($watercourse_alias, $waterfall_alias); |
|
| 96 | 96 | |
| 97 | - if ($waterfall == null) { |
|
| 98 | - return; |
|
| 99 | - } |
|
| 97 | + if ($waterfall == null) { |
|
| 98 | + return; |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/'; |
|
| 102 | - $link .= "{$waterfall->watercourse_alias}/{$waterfall->alias}/"; |
|
| 101 | + $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/'; |
|
| 102 | + $link .= "{$waterfall->watercourse_alias}/{$waterfall->alias}/"; |
|
| 103 | 103 | |
| 104 | - if ($anchor == '') { |
|
| 105 | - $anchor = $waterfall->name; |
|
| 106 | - } |
|
| 107 | - } |
|
| 104 | + if ($anchor == '') { |
|
| 105 | + $anchor = $waterfall->name; |
|
| 106 | + } |
|
| 107 | + } |
|
| 108 | 108 | break; |
| 109 | 109 | default : |
| 110 | 110 | break; |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | interface PostRepository |
| 6 | 6 | { |
| 7 | 7 | public function findPostByPath($category, $path); |
| 8 | - public function getActivePosts($limit = null, $offset= 0); |
|
| 8 | + public function getActivePosts($limit = null, $offset = 0); |
|
| 9 | 9 | public function getActivePostsCount(); |
| 10 | 10 | public function getActivePostsByTag($tag, $limit = null, $offset = 0); |
| 11 | 11 | public function getActivePostsCountByTag($tag); |
@@ -4,12 +4,12 @@ |
||
| 4 | 4 | |
| 5 | 5 | interface PostRepositoryInterface |
| 6 | 6 | { |
| 7 | - public function findPostByPath($path); |
|
| 8 | - public function getActivePosts($limit = null, $offset= 0); |
|
| 9 | - public function getActivePostsCount(); |
|
| 10 | - public function getActivePostsByTag($tag, $limit = null, $offset = 0); |
|
| 11 | - public function getActivePostsCountByTag($tag); |
|
| 12 | - public function getActivePostsByCategory($category, $limit = null, $offset = 0); |
|
| 13 | - public function getActivePostsCountByCategory($category); |
|
| 14 | - public function getActivePostsByRelatedTags($post, $limit = 4); |
|
| 7 | + public function findPostByPath($path); |
|
| 8 | + public function getActivePosts($limit = null, $offset= 0); |
|
| 9 | + public function getActivePostsCount(); |
|
| 10 | + public function getActivePostsByTag($tag, $limit = null, $offset = 0); |
|
| 11 | + public function getActivePostsCountByTag($tag); |
|
| 12 | + public function getActivePostsByCategory($category, $limit = null, $offset = 0); |
|
| 13 | + public function getActivePostsCountByCategory($category); |
|
| 14 | + public function getActivePostsByRelatedTags($post, $limit = 4); |
|
| 15 | 15 | } |
@@ -7,25 +7,25 @@ discard block |
||
| 7 | 7 | class MysqlSeriesRepository implements SeriesRepository |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - /** @var Aura\Sql\ConnectionLocator */ |
|
| 11 | - protected $connections; |
|
| 10 | + /** @var Aura\Sql\ConnectionLocator */ |
|
| 11 | + protected $connections; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * @param Aura\Sql\ConnectionLocator |
|
| 15 | - */ |
|
| 16 | - public function __construct(ConnectionLocator $connections) |
|
| 17 | - { |
|
| 18 | - $this->connections = $connections; |
|
| 19 | - } |
|
| 13 | + /** |
|
| 14 | + * @param Aura\Sql\ConnectionLocator |
|
| 15 | + */ |
|
| 16 | + public function __construct(ConnectionLocator $connections) |
|
| 17 | + { |
|
| 18 | + $this->connections = $connections; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @param integer $post |
|
| 23 | - * |
|
| 24 | - * @return array|false |
|
| 25 | - */ |
|
| 26 | - public function getSeriesForPost($post) |
|
| 27 | - { |
|
| 28 | - $query = " |
|
| 21 | + /** |
|
| 22 | + * @param integer $post |
|
| 23 | + * |
|
| 24 | + * @return array|false |
|
| 25 | + */ |
|
| 26 | + public function getSeriesForPost($post) |
|
| 27 | + { |
|
| 28 | + $query = " |
|
| 29 | 29 | SELECT `series`.`title` AS `series_title`, `series`.`description` AS `series_descriptions`, |
| 30 | 30 | `post.id` AS `post`, `post`.`title`, `post`.`category`, `post`.`path` |
| 31 | 31 | FROM `jpemeric_blog`.`series` |
@@ -38,14 +38,14 @@ discard block |
||
| 38 | 38 | WHERE `post` = :lookup_post |
| 39 | 39 | LIMIT 1) |
| 40 | 40 | ORDER BY `series_post`.`order`"; |
| 41 | - $bindings = [ |
|
| 42 | - 'is_active' => 1, |
|
| 43 | - 'lookup_post' => $post, |
|
| 44 | - ]; |
|
| 41 | + $bindings = [ |
|
| 42 | + 'is_active' => 1, |
|
| 43 | + 'lookup_post' => $post, |
|
| 44 | + ]; |
|
| 45 | 45 | |
| 46 | - return $this |
|
| 47 | - ->connections |
|
| 48 | - ->getRead() |
|
| 49 | - ->fetchAll($query, $bindings); |
|
| 50 | - } |
|
| 46 | + return $this |
|
| 47 | + ->connections |
|
| 48 | + ->getRead() |
|
| 49 | + ->fetchAll($query, $bindings); |
|
| 50 | + } |
|
| 51 | 51 | } |
@@ -4,5 +4,5 @@ |
||
| 4 | 4 | |
| 5 | 5 | interface SeriesRepository |
| 6 | 6 | { |
| 7 | - public function getSeriesForPost($post); |
|
| 7 | + public function getSeriesForPost($post); |
|
| 8 | 8 | } |
@@ -7,85 +7,85 @@ |
||
| 7 | 7 | class MysqlTagRepository implements TagRepository |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - /** @var Aura\Sql\ConnectionLocator */ |
|
| 11 | - protected $connections; |
|
| 10 | + /** @var Aura\Sql\ConnectionLocator */ |
|
| 11 | + protected $connections; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * @param Aura\Sql\ConnectionLocator |
|
| 15 | - */ |
|
| 16 | - public function __construct(ConnectionLocator $connections) |
|
| 17 | - { |
|
| 18 | - $this->connections = $connections; |
|
| 19 | - } |
|
| 13 | + /** |
|
| 14 | + * @param Aura\Sql\ConnectionLocator |
|
| 15 | + */ |
|
| 16 | + public function __construct(ConnectionLocator $connections) |
|
| 17 | + { |
|
| 18 | + $this->connections = $connections; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @param string $title |
|
| 23 | - * |
|
| 24 | - * @return array|false |
|
| 25 | - */ |
|
| 26 | - public function findTagByTitle($title) |
|
| 27 | - { |
|
| 28 | - $query = " |
|
| 21 | + /** |
|
| 22 | + * @param string $title |
|
| 23 | + * |
|
| 24 | + * @return array|false |
|
| 25 | + */ |
|
| 26 | + public function findTagByTitle($title) |
|
| 27 | + { |
|
| 28 | + $query = " |
|
| 29 | 29 | SELECT * |
| 30 | 30 | FROM `jpemeric_blog`.`tag` |
| 31 | 31 | WHERE `tag` = :title |
| 32 | 32 | LIMIT 1"; |
| 33 | - $bindings = [ |
|
| 34 | - 'title' => $title, |
|
| 35 | - ]; |
|
| 33 | + $bindings = [ |
|
| 34 | + 'title' => $title, |
|
| 35 | + ]; |
|
| 36 | 36 | |
| 37 | - return $this |
|
| 38 | - ->connections |
|
| 39 | - ->getRead() |
|
| 40 | - ->fetchOne($query, $bindings); |
|
| 41 | - } |
|
| 37 | + return $this |
|
| 38 | + ->connections |
|
| 39 | + ->getRead() |
|
| 40 | + ->fetchOne($query, $bindings); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - public function getAllTags() |
|
| 44 | - { |
|
| 45 | - $query = " |
|
| 43 | + public function getAllTags() |
|
| 44 | + { |
|
| 45 | + $query = " |
|
| 46 | 46 | SELECT * |
| 47 | 47 | FROM `jpemeric_blog`.`tag` |
| 48 | 48 | ORDER BY `tag`"; |
| 49 | 49 | |
| 50 | - return $this |
|
| 51 | - ->connections |
|
| 52 | - ->getRead() |
|
| 53 | - ->fetchAll($query); |
|
| 54 | - } |
|
| 50 | + return $this |
|
| 51 | + ->connections |
|
| 52 | + ->getRead() |
|
| 53 | + ->fetchAll($query); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - public function getTagCloud() |
|
| 57 | - { |
|
| 58 | - $query = " |
|
| 56 | + public function getTagCloud() |
|
| 57 | + { |
|
| 58 | + $query = " |
|
| 59 | 59 | SELECT COUNT(1) AS `count`, `tag` |
| 60 | 60 | FROM `jpemeric_blog`.`tag` |
| 61 | 61 | INNER JOIN `jpemeric_blog`.`ptlink` ON `ptlink`.`tag_id` = `tag`.`id` |
| 62 | 62 | INNER JOIN `jpemeric_blog`.`post` ON `post`.`id` = `ptlink`.`post_id` AND |
| 63 | 63 | `post`.`display` = :is_active |
| 64 | 64 | GROUP BY `tag`"; |
| 65 | - $bindings = [ |
|
| 66 | - 'is_active' => 1, |
|
| 67 | - ]; |
|
| 65 | + $bindings = [ |
|
| 66 | + 'is_active' => 1, |
|
| 67 | + ]; |
|
| 68 | 68 | |
| 69 | - return $this |
|
| 70 | - ->connections |
|
| 71 | - ->getRead() |
|
| 72 | - ->fetchAll($query, $bindings); |
|
| 73 | - } |
|
| 69 | + return $this |
|
| 70 | + ->connections |
|
| 71 | + ->getRead() |
|
| 72 | + ->fetchAll($query, $bindings); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - public function getTagsForPost($post) |
|
| 76 | - { |
|
| 77 | - $query = " |
|
| 75 | + public function getTagsForPost($post) |
|
| 76 | + { |
|
| 77 | + $query = " |
|
| 78 | 78 | SELECT `tag`.* |
| 79 | 79 | FROM `jpemeric_blog`.`tag` |
| 80 | 80 | INNER JOIN `jpemeric_blog`.`ptlink` ON `ptlink`.`tag_id` AND `post_id` = :post |
| 81 | 81 | ORDER BY `tag`"; |
| 82 | - $bindings = [ |
|
| 83 | - 'post' => $post, |
|
| 84 | - ]; |
|
| 82 | + $bindings = [ |
|
| 83 | + 'post' => $post, |
|
| 84 | + ]; |
|
| 85 | 85 | |
| 86 | - return $this |
|
| 87 | - ->connections |
|
| 88 | - ->getRead() |
|
| 89 | - ->fetchAll($query, $bindings); |
|
| 90 | - } |
|
| 86 | + return $this |
|
| 87 | + ->connections |
|
| 88 | + ->getRead() |
|
| 89 | + ->fetchAll($query, $bindings); |
|
| 90 | + } |
|
| 91 | 91 | } |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | interface TagRepository |
| 6 | 6 | { |
| 7 | - public function findTagByTitle($title); |
|
| 8 | - public function getAllTags(); |
|
| 9 | - public function getTagCloud(); |
|
| 10 | - public function getTagsForPost($post); |
|
| 7 | + public function findTagByTitle($title); |
|
| 8 | + public function getAllTags(); |
|
| 9 | + public function getTagCloud(); |
|
| 10 | + public function getTagsForPost($post); |
|
| 11 | 11 | } |
@@ -4,5 +4,5 @@ |
||
| 4 | 4 | |
| 5 | 5 | interface IntroductionRepository |
| 6 | 6 | { |
| 7 | - public function findByType($type, $value = ''); |
|
| 7 | + public function findByType($type, $value = ''); |
|
| 8 | 8 | } |