@@ -44,9 +44,9 @@ |
||
| 44 | 44 | $width = $file_size[0]; |
| 45 | 45 | $description = $photo_result->description; |
| 46 | 46 | |
| 47 | - if ($description == '') {
|
|
| 48 | - Debugger::logMessage("No description for {$category}/{$photo}");
|
|
| 49 | - } |
|
| 47 | + if ($description == '') {
|
|
| 48 | + Debugger::logMessage("No description for {$category}/{$photo}");
|
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | $domain = '/'; |
| 52 | 52 | if($is_absolute) |
@@ -5,56 +5,56 @@ |
||
| 5 | 5 | final class ImperialUnitContent extends Content |
| 6 | 6 | {
|
| 7 | 7 | |
| 8 | - protected function execute($type = '') |
|
| 9 | - {
|
|
| 10 | - $number = floatval($this->content); |
|
| 11 | - $number *= 39.37; // convert to inches |
|
| 8 | + protected function execute($type = '') |
|
| 9 | + {
|
|
| 10 | + $number = floatval($this->content); |
|
| 11 | + $number *= 39.37; // convert to inches |
|
| 12 | 12 | |
| 13 | - if ($type == '') {
|
|
| 14 | - if ($number > (12 * 3 * 1760 * 5)) {
|
|
| 15 | - $type = 'full miles'; |
|
| 16 | - } else if ($number > (12 * 3 * 1760 * .5)) {
|
|
| 17 | - $type = 'tenth miles'; |
|
| 18 | - } else if ($number > (12 * 3 * 150)) {
|
|
| 19 | - $type = 'yards'; |
|
| 20 | - } else if ($number > (12 * 10)) {
|
|
| 21 | - $type = 'feet'; |
|
| 22 | - } else {
|
|
| 23 | - $type = 'inches'; |
|
| 24 | - } |
|
| 25 | - } |
|
| 13 | + if ($type == '') {
|
|
| 14 | + if ($number > (12 * 3 * 1760 * 5)) {
|
|
| 15 | + $type = 'full miles'; |
|
| 16 | + } else if ($number > (12 * 3 * 1760 * .5)) {
|
|
| 17 | + $type = 'tenth miles'; |
|
| 18 | + } else if ($number > (12 * 3 * 150)) {
|
|
| 19 | + $type = 'yards'; |
|
| 20 | + } else if ($number > (12 * 10)) {
|
|
| 21 | + $type = 'feet'; |
|
| 22 | + } else {
|
|
| 23 | + $type = 'inches'; |
|
| 24 | + } |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - switch ($type) {
|
|
| 28 | - case 'full miles' : |
|
| 29 | - $this->content = number_format(round($number / (12 * 3 * 1760))) . ' miles'; |
|
| 30 | - break; |
|
| 31 | - case 'tenth miles' : |
|
| 32 | - $this->content = round($number / (12 * 3 * 1760), 1) . ' miles'; |
|
| 33 | - break; |
|
| 34 | - case 'yards' : |
|
| 35 | - $this->content = number_format(round($number / (12 * 3))) . ' yards'; |
|
| 36 | - break; |
|
| 37 | - case 'feet' : |
|
| 38 | - $this->content = number_format(round($number / 12)) . "'"; |
|
| 39 | - break; |
|
| 40 | - case 'inches' : |
|
| 41 | - $feet = floor($number / 12); |
|
| 27 | + switch ($type) {
|
|
| 28 | + case 'full miles' : |
|
| 29 | + $this->content = number_format(round($number / (12 * 3 * 1760))) . ' miles'; |
|
| 30 | + break; |
|
| 31 | + case 'tenth miles' : |
|
| 32 | + $this->content = round($number / (12 * 3 * 1760), 1) . ' miles'; |
|
| 33 | + break; |
|
| 34 | + case 'yards' : |
|
| 35 | + $this->content = number_format(round($number / (12 * 3))) . ' yards'; |
|
| 36 | + break; |
|
| 37 | + case 'feet' : |
|
| 38 | + $this->content = number_format(round($number / 12)) . "'"; |
|
| 39 | + break; |
|
| 40 | + case 'inches' : |
|
| 41 | + $feet = floor($number / 12); |
|
| 42 | 42 | |
| 43 | - $inches = $number - $feet * 12; |
|
| 44 | - $inches = round($inches); |
|
| 43 | + $inches = $number - $feet * 12; |
|
| 44 | + $inches = round($inches); |
|
| 45 | 45 | |
| 46 | - if ($inches == 12) {
|
|
| 47 | - $feet++; |
|
| 48 | - $inches = 0; |
|
| 49 | - } |
|
| 46 | + if ($inches == 12) {
|
|
| 47 | + $feet++; |
|
| 48 | + $inches = 0; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - $this->content = ''; |
|
| 52 | - $this->content .= number_format($feet) . "'"; |
|
| 53 | - if (isset($inches) && $inches > 0) {
|
|
| 54 | - $this->content .= " {$inches}\"";
|
|
| 55 | - } |
|
| 56 | - break; |
|
| 57 | - } |
|
| 58 | - } |
|
| 51 | + $this->content = ''; |
|
| 52 | + $this->content .= number_format($feet) . "'"; |
|
| 53 | + if (isset($inches) && $inches > 0) {
|
|
| 54 | + $this->content .= " {$inches}\"";
|
|
| 55 | + } |
|
| 56 | + break; |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | 60 | } |
| 61 | 61 | \ No newline at end of file |
@@ -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 | } |
@@ -22,10 +22,10 @@ |
||
| 22 | 22 | |
| 23 | 23 | protected function getDomain() |
| 24 | 24 | {
|
| 25 | - $site = URLDecode::getSite(); |
|
| 26 | - if ($site == 'waterfalls' && Loader::isLive()) {
|
|
| 27 | - return 'waterfallsofthekeweenaw.com'; |
|
| 28 | - } |
|
| 25 | + $site = URLDecode::getSite(); |
|
| 26 | + if ($site == 'waterfalls' && Loader::isLive()) {
|
|
| 27 | + return 'waterfallsofthekeweenaw.com'; |
|
| 28 | + } |
|
| 29 | 29 | return self::$COOKIE_DOMAIN; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -20,21 +20,21 @@ |
||
| 20 | 20 | private static $USER_MENTION_LINK = '<a href="https://twitter.com/%1$s" rel="nofollow" target="_blank" title="%2$s (%1$s) on Twitter">@%1$s</a>'; |
| 21 | 21 | private static $MEDIA_LINK = '<a class="photo" href="%s" rel="nofollow" target="_blank" title="%s"><img src="%s:%s" alt="%s" height="%s" width="%s" /></a>'; |
| 22 | 22 | |
| 23 | - private $consumer_key; |
|
| 24 | - private $consumer_secret; |
|
| 25 | - private $access_token; |
|
| 26 | - private $access_secret; |
|
| 23 | + private $consumer_key; |
|
| 24 | + private $consumer_secret; |
|
| 25 | + private $access_token; |
|
| 26 | + private $access_secret; |
|
| 27 | 27 | |
| 28 | 28 | private $json; |
| 29 | 29 | |
| 30 | 30 | public function __construct() |
| 31 | 31 | {
|
| 32 | - global $config; |
|
| 32 | + global $config; |
|
| 33 | 33 | |
| 34 | - $this->consumer_key = $config->twitter->consumer_key; |
|
| 35 | - $this->consumer_secret = $config->twitter->consumer_secret; |
|
| 36 | - $this->access_token = $config->twitter->access_token; |
|
| 37 | - $this->access_secret = $config->twitter->access_secret; |
|
| 34 | + $this->consumer_key = $config->twitter->consumer_key; |
|
| 35 | + $this->consumer_secret = $config->twitter->consumer_secret; |
|
| 36 | + $this->access_token = $config->twitter->access_token; |
|
| 37 | + $this->access_secret = $config->twitter->access_secret; |
|
| 38 | 38 | |
| 39 | 39 | $json = $this->get_data(); |
| 40 | 40 | |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | public function __construct() |
| 14 | 14 | {
|
| 15 | - global $config; |
|
| 15 | + global $config; |
|
| 16 | 16 | $this->headers['From'] = self::$FROM; |
| 17 | 17 | $this->headers['Reply-To'] = "Jacob <{$config->admin_email}>";
|
| 18 | 18 | $this->headers['Bcc'] = "Jacob <{$config->admin_email}>";
|
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | public function __construct() |
| 14 | 14 | {
|
| 15 | - global $config; |
|
| 15 | + global $config; |
|
| 16 | 16 | $this->headers['From'] = self::$FROM; |
| 17 | 17 | $this->headers['Reply-To'] = "Jacob <{$config->admin_email}>";
|
| 18 | 18 | $this->headers['Bcc'] = "Jacob <{$config->admin_email}>";
|
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | public function __construct() |
| 14 | 14 | {
|
| 15 | - global $config; |
|
| 15 | + global $config; |
|
| 16 | 16 | $this->headers['From'] = self::$FROM; |
| 17 | 17 | $this->headers['Reply-To'] = "Jacob <{$config->admin_email}>";
|
| 18 | 18 | $this->headers['Bcc'] = "Jacob <{$config->admin_email}>";
|
@@ -7,165 +7,165 @@ discard block |
||
| 7 | 7 | class MysqlPostRepository implements PostRepository |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - /** @var Aura\Sql\ConnectionLocator */ |
|
| 11 | - protected $connections; |
|
| 12 | - |
|
| 13 | - /** |
|
| 14 | - * @param Aura\Sql\ConnectionLocator $connections |
|
| 15 | - */ |
|
| 16 | - public function __construct(ConnectionLocator $connections) |
|
| 17 | - { |
|
| 18 | - $this->connections = $connections; |
|
| 19 | - } |
|
| 20 | - |
|
| 21 | - /** |
|
| 22 | - * @param string $category |
|
| 23 | - * @param string $path |
|
| 24 | - * |
|
| 25 | - * @return array|false |
|
| 26 | - */ |
|
| 27 | - public function findPostByPath($category, $path) |
|
| 28 | - { |
|
| 29 | - $query = " |
|
| 10 | + /** @var Aura\Sql\ConnectionLocator */ |
|
| 11 | + protected $connections; |
|
| 12 | + |
|
| 13 | + /** |
|
| 14 | + * @param Aura\Sql\ConnectionLocator $connections |
|
| 15 | + */ |
|
| 16 | + public function __construct(ConnectionLocator $connections) |
|
| 17 | + { |
|
| 18 | + $this->connections = $connections; |
|
| 19 | + } |
|
| 20 | + |
|
| 21 | + /** |
|
| 22 | + * @param string $category |
|
| 23 | + * @param string $path |
|
| 24 | + * |
|
| 25 | + * @return array|false |
|
| 26 | + */ |
|
| 27 | + public function findPostByPath($category, $path) |
|
| 28 | + { |
|
| 29 | + $query = " |
|
| 30 | 30 | SELECT `id`, `title`, `path`, `date`, `body`, `category` |
| 31 | 31 | FROM `jpemeric_blog`.`post` |
| 32 | 32 | WHERE `path` = :path AND `category` = :category AND `display` = :is_active |
| 33 | 33 | LIMIT 1"; |
| 34 | - $bindings = [ |
|
| 35 | - 'path' => $path, |
|
| 36 | - 'category' => $category, |
|
| 37 | - 'is_active' => 1, |
|
| 38 | - ]; |
|
| 39 | - |
|
| 40 | - return $this |
|
| 41 | - ->connections |
|
| 42 | - ->getRead() |
|
| 43 | - ->fetchOne($query, $bindings); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - public function getActivePosts($limit = null, $offset = 0) |
|
| 47 | - { |
|
| 48 | - $query = " |
|
| 34 | + $bindings = [ |
|
| 35 | + 'path' => $path, |
|
| 36 | + 'category' => $category, |
|
| 37 | + 'is_active' => 1, |
|
| 38 | + ]; |
|
| 39 | + |
|
| 40 | + return $this |
|
| 41 | + ->connections |
|
| 42 | + ->getRead() |
|
| 43 | + ->fetchOne($query, $bindings); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + public function getActivePosts($limit = null, $offset = 0) |
|
| 47 | + { |
|
| 48 | + $query = " |
|
| 49 | 49 | SELECT `id`, `title`, `path`, `date`, `body`, `category` |
| 50 | 50 | FROM `jpemeric_blog`.`post` |
| 51 | 51 | WHERE `display` = :is_active |
| 52 | 52 | ORDER BY `date` DESC"; |
| 53 | - if ($limit != null) { |
|
| 54 | - $query .= " |
|
| 53 | + if ($limit != null) { |
|
| 54 | + $query .= " |
|
| 55 | 55 | LIMIT {$offset}, {$limit}"; |
| 56 | - } |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - $bindings = [ |
|
| 59 | - 'is_active' => 1, |
|
| 60 | - ]; |
|
| 58 | + $bindings = [ |
|
| 59 | + 'is_active' => 1, |
|
| 60 | + ]; |
|
| 61 | 61 | |
| 62 | - return $this |
|
| 63 | - ->connections |
|
| 64 | - ->getRead() |
|
| 65 | - ->fetchAll($query, $bindings); |
|
| 66 | - } |
|
| 62 | + return $this |
|
| 63 | + ->connections |
|
| 64 | + ->getRead() |
|
| 65 | + ->fetchAll($query, $bindings); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - public function getActivePostsCount() |
|
| 69 | - { |
|
| 70 | - $query = " |
|
| 68 | + public function getActivePostsCount() |
|
| 69 | + { |
|
| 70 | + $query = " |
|
| 71 | 71 | SELECT COUNT(1) AS `count` |
| 72 | 72 | FROM `jpemeric_blog`.`post` |
| 73 | 73 | WHERE `display` = :is_active"; |
| 74 | - $bindings = [ |
|
| 75 | - 'is_active' => 1, |
|
| 76 | - ]; |
|
| 77 | - |
|
| 78 | - return $this |
|
| 79 | - ->connections |
|
| 80 | - ->getRead() |
|
| 81 | - ->fetchValue($query, $bindings); |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - public function getActivePostsByTag($tag, $limit = null, $offset = 0) |
|
| 85 | - { |
|
| 86 | - $query = " |
|
| 74 | + $bindings = [ |
|
| 75 | + 'is_active' => 1, |
|
| 76 | + ]; |
|
| 77 | + |
|
| 78 | + return $this |
|
| 79 | + ->connections |
|
| 80 | + ->getRead() |
|
| 81 | + ->fetchValue($query, $bindings); |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + public function getActivePostsByTag($tag, $limit = null, $offset = 0) |
|
| 85 | + { |
|
| 86 | + $query = " |
|
| 87 | 87 | SELECT `id`, `title`, `path`, `date`, `body`, `category` |
| 88 | 88 | FROM `jpemeric_blog`.`post` |
| 89 | 89 | INNER JOIN `jpemeric_blog`.`ptlink` ON `ptlink`.`post_id` = `post`.`id` AND |
| 90 | 90 | `ptlink`.`tag_id` = :tag_id |
| 91 | 91 | WHERE `display` = :is_active"; |
| 92 | - if ($limit != null) { |
|
| 93 | - $query .= " |
|
| 92 | + if ($limit != null) { |
|
| 93 | + $query .= " |
|
| 94 | 94 | LIMIT {$offset}, {$limit}"; |
| 95 | - } |
|
| 96 | - |
|
| 97 | - $bindings = [ |
|
| 98 | - 'tag_id' => $tag, |
|
| 99 | - 'is_active' => 1, |
|
| 100 | - ]; |
|
| 101 | - |
|
| 102 | - return $this |
|
| 103 | - ->connections |
|
| 104 | - ->getRead() |
|
| 105 | - ->fetchAll($query, $bindings); |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - public function getActivePostsCountByTag($tag) |
|
| 109 | - { |
|
| 110 | - $query = " |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + $bindings = [ |
|
| 98 | + 'tag_id' => $tag, |
|
| 99 | + 'is_active' => 1, |
|
| 100 | + ]; |
|
| 101 | + |
|
| 102 | + return $this |
|
| 103 | + ->connections |
|
| 104 | + ->getRead() |
|
| 105 | + ->fetchAll($query, $bindings); |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + public function getActivePostsCountByTag($tag) |
|
| 109 | + { |
|
| 110 | + $query = " |
|
| 111 | 111 | SELECT COUNT(1) AS `count` |
| 112 | 112 | FROM `jpemeric_blog`.`post` |
| 113 | 113 | INNER JOIN `jpemeric_blog`.`ptlink` ON `ptlink`.`post_id` = `post`.`id` AND |
| 114 | 114 | `ptlink`.`tag_id` = :tag_id |
| 115 | 115 | WHERE `display` = :is_active"; |
| 116 | - $bindings = [ |
|
| 117 | - 'tag_id' => $tag, |
|
| 118 | - 'is_active' => 1, |
|
| 119 | - ]; |
|
| 120 | - |
|
| 121 | - return $this |
|
| 122 | - ->connections |
|
| 123 | - ->getRead() |
|
| 124 | - ->fetchValue($query, $bindings); |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - public function getActivePostsByCategory($category, $limit = null, $offset = 0) |
|
| 128 | - { |
|
| 129 | - $query = " |
|
| 116 | + $bindings = [ |
|
| 117 | + 'tag_id' => $tag, |
|
| 118 | + 'is_active' => 1, |
|
| 119 | + ]; |
|
| 120 | + |
|
| 121 | + return $this |
|
| 122 | + ->connections |
|
| 123 | + ->getRead() |
|
| 124 | + ->fetchValue($query, $bindings); |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + public function getActivePostsByCategory($category, $limit = null, $offset = 0) |
|
| 128 | + { |
|
| 129 | + $query = " |
|
| 130 | 130 | SELECT `id`, `title`, `path`, `date`, `body`, `category` |
| 131 | 131 | FROM `jpemeric_blog`.`post` |
| 132 | 132 | WHERE `category` = :category AND `display` = :is_active"; |
| 133 | - if ($limit != null) { |
|
| 134 | - $query .= " |
|
| 133 | + if ($limit != null) { |
|
| 134 | + $query .= " |
|
| 135 | 135 | LIMIT {$offset}, {$limit}"; |
| 136 | - } |
|
| 137 | - |
|
| 138 | - $bindings = [ |
|
| 139 | - 'category' => $category, |
|
| 140 | - 'is_active' => 1, |
|
| 141 | - ]; |
|
| 142 | - |
|
| 143 | - return $this |
|
| 144 | - ->connections |
|
| 145 | - ->getRead() |
|
| 146 | - ->fetchAll($query, $bindings); |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - public function getActivePostsCountByCategory($category) |
|
| 150 | - { |
|
| 151 | - $query = " |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + $bindings = [ |
|
| 139 | + 'category' => $category, |
|
| 140 | + 'is_active' => 1, |
|
| 141 | + ]; |
|
| 142 | + |
|
| 143 | + return $this |
|
| 144 | + ->connections |
|
| 145 | + ->getRead() |
|
| 146 | + ->fetchAll($query, $bindings); |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + public function getActivePostsCountByCategory($category) |
|
| 150 | + { |
|
| 151 | + $query = " |
|
| 152 | 152 | SELECT COUNT(1) AS `count` |
| 153 | 153 | FROM `jpemeric_blog`.`post` |
| 154 | 154 | WHERE `category` = :category AND `display` = :is_active"; |
| 155 | - $bindings = [ |
|
| 156 | - 'category' => $category, |
|
| 157 | - 'is_active' => 1, |
|
| 158 | - ]; |
|
| 159 | - |
|
| 160 | - return $this |
|
| 161 | - ->connections |
|
| 162 | - ->getRead() |
|
| 163 | - ->fetchValue($query, $bindings); |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - public function getActivePostsByRelatedTags($post, $limit = 4) |
|
| 167 | - { |
|
| 168 | - $query = " |
|
| 155 | + $bindings = [ |
|
| 156 | + 'category' => $category, |
|
| 157 | + 'is_active' => 1, |
|
| 158 | + ]; |
|
| 159 | + |
|
| 160 | + return $this |
|
| 161 | + ->connections |
|
| 162 | + ->getRead() |
|
| 163 | + ->fetchValue($query, $bindings); |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + public function getActivePostsByRelatedTags($post, $limit = 4) |
|
| 167 | + { |
|
| 168 | + $query = " |
|
| 169 | 169 | SELECT `id`, `title`, `path`, `date`, `body`, `category`, COUNT(1) AS `count` |
| 170 | 170 | FROM `jpemeric_blog`.`post` |
| 171 | 171 | INNER JOIN `jpemeric_blog`.`ptlink` ON `ptlink`.`post_id` = `post`.`id` AND |
@@ -185,14 +185,14 @@ discard block |
||
| 185 | 185 | GROUP BY `id` |
| 186 | 186 | ORDER BY `count` DESC |
| 187 | 187 | LIMIT {$limit}"; |
| 188 | - $bindings = [ |
|
| 189 | - 'post' => $post, |
|
| 190 | - 'is_active' => 1, |
|
| 191 | - ]; |
|
| 192 | - |
|
| 193 | - return $this |
|
| 194 | - ->connections |
|
| 195 | - ->getRead() |
|
| 196 | - ->fetchAll($query, $bindings); |
|
| 197 | - } |
|
| 188 | + $bindings = [ |
|
| 189 | + 'post' => $post, |
|
| 190 | + 'is_active' => 1, |
|
| 191 | + ]; |
|
| 192 | + |
|
| 193 | + return $this |
|
| 194 | + ->connections |
|
| 195 | + ->getRead() |
|
| 196 | + ->fetchAll($query, $bindings); |
|
| 197 | + } |
|
| 198 | 198 | } |