@@ -24,8 +24,9 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public static function instance() |
| 26 | 26 | { |
| 27 | - if(!isset(self::$instance)) |
|
| 28 | - self::$instance = new Debugger(); |
|
| 27 | + if(!isset(self::$instance)) {
|
|
| 28 | + self::$instance = new Debugger(); |
|
| 29 | + } |
|
| 29 | 30 | return self::$instance; |
| 30 | 31 | } |
| 31 | 32 | |
@@ -52,12 +53,15 @@ discard block |
||
| 52 | 53 | |
| 53 | 54 | public static function internal_error($code, $string, $file = null, $line = null, $context = null) |
| 54 | 55 | { |
| 55 | - if($file == null) |
|
| 56 | - $file = self::$UNKNOWN_ERROR_FILE; |
|
| 57 | - if($line == null) |
|
| 58 | - $line = self::$UNKNOWN_ERROR_LINE; |
|
| 59 | - if($context == null) |
|
| 60 | - $context = self::$UNKNOWN_ERROR_CONTEXT; |
|
| 56 | + if($file == null) {
|
|
| 57 | + $file = self::$UNKNOWN_ERROR_FILE; |
|
| 58 | + } |
|
| 59 | + if($line == null) {
|
|
| 60 | + $line = self::$UNKNOWN_ERROR_LINE; |
|
| 61 | + } |
|
| 62 | + if($context == null) {
|
|
| 63 | + $context = self::$UNKNOWN_ERROR_CONTEXT; |
|
| 64 | + } |
|
| 61 | 65 | |
| 62 | 66 | self::instance()->console->logError(new Exception($string), "{$string}... TYPE: {$code}"); |
| 63 | 67 | |
@@ -68,8 +72,9 @@ discard block |
||
| 68 | 72 | { |
| 69 | 73 | $error = error_get_last(); |
| 70 | 74 | |
| 71 | - if(isset($error)) |
|
| 72 | - self::internal_error($error['type'], $error['message'], $error['file'], $error['line']); |
|
| 75 | + if(isset($error)) {
|
|
| 76 | + self::internal_error($error['type'], $error['message'], $error['file'], $error['line']); |
|
| 77 | + } |
|
| 73 | 78 | |
| 74 | 79 | self::display(); |
| 75 | 80 | return true; |
@@ -57,8 +57,7 @@ |
||
| 57 | 57 | |
| 58 | 58 | Loader::load('utility', 'Content'); |
| 59 | 59 | $uri = Content::instance('URLSafe', "/{$post->category}/{$post->title_url}/")->activate(); |
| 60 | - } |
|
| 61 | - else |
|
| 60 | + } else |
|
| 62 | 61 | { |
| 63 | 62 | $post_uri = URLDecode::getPiece(1); |
| 64 | 63 | if($post_uri !== null) |
@@ -19,24 +19,33 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | private static function get_router_name() |
| 21 | 21 | { |
| 22 | - if(Request::isAJAX()) |
|
| 23 | - return 'AJAXRouter'; |
|
| 24 | - if(URLDecode::getURI() == '/robots.txt') |
|
| 25 | - return 'RobotRouter'; |
|
| 26 | - if(URLDecode::getURI() == '/sitemap.xml') |
|
| 27 | - return 'SitemapRouter'; |
|
| 28 | - if(URLDecode::getURI() == '/rss/') |
|
| 29 | - return 'RSSRouter'; |
|
| 30 | - if(URLDecode::getExtension() == 'css') |
|
| 31 | - return 'StyleRouter'; |
|
| 32 | - if(URLDecode::getExtension() == 'js') |
|
| 33 | - return 'ScriptRouter'; |
|
| 34 | - if(URLDecode::getExtension() == 'ico') |
|
| 35 | - return 'ImageRouter'; |
|
| 36 | - if(URLDecode::getExtension() == 'jpg') |
|
| 37 | - return 'ImageRouter'; |
|
| 38 | - if(URLDecode::getExtension() == 'png') |
|
| 39 | - return 'ImageRouter'; |
|
| 22 | + if(Request::isAJAX()) {
|
|
| 23 | + return 'AJAXRouter'; |
|
| 24 | + } |
|
| 25 | + if(URLDecode::getURI() == '/robots.txt') {
|
|
| 26 | + return 'RobotRouter'; |
|
| 27 | + } |
|
| 28 | + if(URLDecode::getURI() == '/sitemap.xml') {
|
|
| 29 | + return 'SitemapRouter'; |
|
| 30 | + } |
|
| 31 | + if(URLDecode::getURI() == '/rss/') {
|
|
| 32 | + return 'RSSRouter'; |
|
| 33 | + } |
|
| 34 | + if(URLDecode::getExtension() == 'css') {
|
|
| 35 | + return 'StyleRouter'; |
|
| 36 | + } |
|
| 37 | + if(URLDecode::getExtension() == 'js') {
|
|
| 38 | + return 'ScriptRouter'; |
|
| 39 | + } |
|
| 40 | + if(URLDecode::getExtension() == 'ico') {
|
|
| 41 | + return 'ImageRouter'; |
|
| 42 | + } |
|
| 43 | + if(URLDecode::getExtension() == 'jpg') {
|
|
| 44 | + return 'ImageRouter'; |
|
| 45 | + } |
|
| 46 | + if(URLDecode::getExtension() == 'png') {
|
|
| 47 | + return 'ImageRouter'; |
|
| 48 | + } |
|
| 40 | 49 | |
| 41 | 50 | switch(URLDecode::getSite()) |
| 42 | 51 | { |
@@ -93,19 +102,22 @@ discard block |
||
| 93 | 102 | |
| 94 | 103 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
| 95 | 104 | |
| 96 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
| 97 | - $redirect_uri .= '/'; |
|
| 105 | + if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') {
|
|
| 106 | + $redirect_uri .= '/'; |
|
| 107 | + } |
|
| 98 | 108 | |
| 99 | 109 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
| 100 | 110 | $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
| 101 | 111 | } |
| 102 | 112 | |
| 103 | - if($redirect_uri == URLDecode::getURI()) |
|
| 104 | - return; |
|
| 113 | + if($redirect_uri == URLDecode::getURI()) {
|
|
| 114 | + return; |
|
| 115 | + } |
|
| 105 | 116 | |
| 106 | 117 | $controller_check = $redirect_uri; |
| 107 | - if(substr($redirect_uri, 0, 4) == 'http') |
|
| 108 | - $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
|
| 118 | + if(substr($redirect_uri, 0, 4) == 'http') {
|
|
| 119 | + $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri);
|
|
| 120 | + } |
|
| 109 | 121 | |
| 110 | 122 | $controller = $this->get_controller($controller_check); |
| 111 | 123 | if($controller == '/Error404Controller') |
@@ -154,11 +166,13 @@ discard block |
||
| 154 | 166 | { |
| 155 | 167 | foreach($this->get_direct_array() as $check) |
| 156 | 168 | { |
| 157 | - if($uri == $check->match) |
|
| 158 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
| 169 | + if($uri == $check->match) {
|
|
| 170 | + return "{$this->get_primary_folder()}/{$check->controller}";
|
|
| 171 | + } |
|
| 159 | 172 | |
| 160 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
| 161 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
| 173 | + if(preg_match("@^{$check->match}$@", $uri)) {
|
|
| 174 | + return "{$this->get_primary_folder()}/{$check->controller}";
|
|
| 175 | + } |
|
| 162 | 176 | } |
| 163 | 177 | |
| 164 | 178 | return '/Error404Controller'; |
@@ -166,23 +180,30 @@ discard block |
||
| 166 | 180 | |
| 167 | 181 | final private function get_primary_folder() |
| 168 | 182 | { |
| 169 | - if(Request::isAjax()) |
|
| 170 | - return 'ajax'; |
|
| 171 | - if(URLDecode::getURI() == '/robots.txt') |
|
| 172 | - return 'robot'; |
|
| 173 | - if(URLDecode::getURI() == '/sitemap.xml') |
|
| 174 | - return 'sitemap'; |
|
| 175 | - if(URLDecode::getURI() == '/rss/') |
|
| 176 | - return 'rss'; |
|
| 177 | - if(URLDecode::getExtension() == 'css') |
|
| 178 | - return 'styles'; |
|
| 179 | - if(URLDecode::getExtension() == 'js') |
|
| 180 | - return 'scripts'; |
|
| 183 | + if(Request::isAjax()) {
|
|
| 184 | + return 'ajax'; |
|
| 185 | + } |
|
| 186 | + if(URLDecode::getURI() == '/robots.txt') {
|
|
| 187 | + return 'robot'; |
|
| 188 | + } |
|
| 189 | + if(URLDecode::getURI() == '/sitemap.xml') {
|
|
| 190 | + return 'sitemap'; |
|
| 191 | + } |
|
| 192 | + if(URLDecode::getURI() == '/rss/') {
|
|
| 193 | + return 'rss'; |
|
| 194 | + } |
|
| 195 | + if(URLDecode::getExtension() == 'css') {
|
|
| 196 | + return 'styles'; |
|
| 197 | + } |
|
| 198 | + if(URLDecode::getExtension() == 'js') {
|
|
| 199 | + return 'scripts'; |
|
| 200 | + } |
|
| 181 | 201 | if( |
| 182 | 202 | URLDecode::getExtension() == 'jpg' || |
| 183 | 203 | URLDecode::getExtension() == 'ico' || |
| 184 | - URLDecode::getExtension() == 'png') |
|
| 185 | - return 'images'; |
|
| 204 | + URLDecode::getExtension() == 'png') {
|
|
| 205 | + return 'images'; |
|
| 206 | + } |
|
| 186 | 207 | |
| 187 | 208 | return URLDecode::getSite(); |
| 188 | 209 | } |
@@ -163,10 +163,11 @@ |
||
| 163 | 163 | { |
| 164 | 164 | $path = self::escape($path); |
| 165 | 165 | |
| 166 | - if($commenter != 0) |
|
| 167 | - $trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')"; |
|
| 168 | - else |
|
| 169 | - $trusted_commenter_clause = "`commenter`.`trusted` = '1'"; |
|
| 166 | + if($commenter != 0) {
|
|
| 167 | + $trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')";
|
|
| 168 | + } else {
|
|
| 169 | + $trusted_commenter_clause = "`commenter`.`trusted` = '1'"; |
|
| 170 | + } |
|
| 170 | 171 | |
| 171 | 172 | $query = " |
| 172 | 173 | SELECT |
@@ -20,15 +20,18 @@ |
||
| 20 | 20 | parent::__construct(); |
| 21 | 21 | |
| 22 | 22 | $id = URLDecode::getPiece(2); |
| 23 | - if(!$id || !is_numeric($id)) |
|
| 24 | - $this->eject(); |
|
| 23 | + if(!$id || !is_numeric($id)) {
|
|
| 24 | + $this->eject(); |
|
| 25 | + } |
|
| 25 | 26 | |
| 26 | 27 | $post = ActivityCollector::getPost($id); |
| 27 | - if(!$post) |
|
| 28 | - $this->eject(); |
|
| 28 | + if(!$post) {
|
|
| 29 | + $this->eject(); |
|
| 30 | + } |
|
| 29 | 31 | |
| 30 | - if(URLDecode::getPiece(1) != $post->type) |
|
| 31 | - $this->eject(); |
|
| 32 | + if(URLDecode::getPiece(1) != $post->type) {
|
|
| 33 | + $this->eject(); |
|
| 34 | + } |
|
| 32 | 35 | |
| 33 | 36 | $this->post = $post; |
| 34 | 37 | } |
@@ -97,8 +97,9 @@ discard block |
||
| 97 | 97 | protected function get_page_number() |
| 98 | 98 | { |
| 99 | 99 | $page = URLDecode::getPiece(3); |
| 100 | - if(isset($page) && is_numeric($page)) |
|
| 101 | - return $page; |
|
| 100 | + if(isset($page) && is_numeric($page)) {
|
|
| 101 | + return $page; |
|
| 102 | + } |
|
| 102 | 103 | return 1; |
| 103 | 104 | } |
| 104 | 105 | |
@@ -117,25 +118,29 @@ discard block |
||
| 117 | 118 | |
| 118 | 119 | protected function get_list_next_link() |
| 119 | 120 | { |
| 120 | - if($this->page == 1) |
|
| 121 | - return; |
|
| 122 | - if($this->page == 2) |
|
| 123 | - return Loader::getRootUrl('lifestream') . $this->tag . '/'; |
|
| 121 | + if($this->page == 1) {
|
|
| 122 | + return; |
|
| 123 | + } |
|
| 124 | + if($this->page == 2) {
|
|
| 125 | + return Loader::getRootUrl('lifestream') . $this->tag . '/';
|
|
| 126 | + } |
|
| 124 | 127 | return Loader::getRootUrl('lifestream') . $this->tag . '/page/' . ($this->page - 1) . '/'; |
| 125 | 128 | } |
| 126 | 129 | |
| 127 | 130 | protected function get_list_prev_link() |
| 128 | 131 | { |
| 129 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
| 130 | - return; |
|
| 132 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) {
|
|
| 133 | + return; |
|
| 134 | + } |
|
| 131 | 135 | return Loader::getRootUrl('lifestream') . $this->tag . '/page/' . ($this->page + 1) . '/'; |
| 132 | 136 | } |
| 133 | 137 | |
| 134 | 138 | private $total_post_count; |
| 135 | 139 | protected function get_total_post_count() |
| 136 | 140 | { |
| 137 | - if(!isset($this->total_post_count)) |
|
| 138 | - $this->total_post_count = ActivityCollector::getCountForTag($this->tag); |
|
| 141 | + if(!isset($this->total_post_count)) {
|
|
| 142 | + $this->total_post_count = ActivityCollector::getCountForTag($this->tag); |
|
| 143 | + } |
|
| 139 | 144 | return $this->total_post_count; |
| 140 | 145 | } |
| 141 | 146 | |
@@ -38,8 +38,9 @@ discard block |
||
| 38 | 38 | protected function get_page_number() |
| 39 | 39 | { |
| 40 | 40 | $page = URLDecode::getPiece(2); |
| 41 | - if(isset($page) && is_numeric($page)) |
|
| 42 | - return $page; |
|
| 41 | + if(isset($page) && is_numeric($page)) {
|
|
| 42 | + return $page; |
|
| 43 | + } |
|
| 43 | 44 | return 1; |
| 44 | 45 | } |
| 45 | 46 | |
@@ -58,25 +59,29 @@ discard block |
||
| 58 | 59 | |
| 59 | 60 | protected function get_list_next_link() |
| 60 | 61 | { |
| 61 | - if($this->page == 1) |
|
| 62 | - return; |
|
| 63 | - if($this->page == 2) |
|
| 64 | - return Loader::getRootUrl('lifestream'); |
|
| 62 | + if($this->page == 1) {
|
|
| 63 | + return; |
|
| 64 | + } |
|
| 65 | + if($this->page == 2) {
|
|
| 66 | + return Loader::getRootUrl('lifestream');
|
|
| 67 | + } |
|
| 65 | 68 | return Loader::getRootUrl('lifestream') . 'page/' . ($this->page - 1) . '/'; |
| 66 | 69 | } |
| 67 | 70 | |
| 68 | 71 | protected function get_list_prev_link() |
| 69 | 72 | { |
| 70 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
| 71 | - return; |
|
| 73 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) {
|
|
| 74 | + return; |
|
| 75 | + } |
|
| 72 | 76 | return Loader::getRootUrl('lifestream') . 'page/' . ($this->page + 1) . '/'; |
| 73 | 77 | } |
| 74 | 78 | |
| 75 | 79 | private $total_post_count; |
| 76 | 80 | protected function get_total_post_count() |
| 77 | 81 | { |
| 78 | - if(!isset($this->total_post_count)) |
|
| 79 | - $this->total_post_count = ActivityCollector::getCount(); |
|
| 82 | + if(!isset($this->total_post_count)) {
|
|
| 83 | + $this->total_post_count = ActivityCollector::getCount(); |
|
| 84 | + } |
|
| 80 | 85 | return $this->total_post_count; |
| 81 | 86 | } |
| 82 | 87 | |
@@ -18,10 +18,11 @@ |
||
| 18 | 18 | |
| 19 | 19 | foreach($pieces as $piece) |
| 20 | 20 | { |
| 21 | - if($piece->category == 1) |
|
| 22 | - $this->addURL("web/{$piece->title_url}/", date('Y-01-01'), 'yearly', .7); |
|
| 23 | - else |
|
| 24 | - $this->addURL("print/{$piece->title_url}/", date('Y-01-01'), 'yearly', .7); |
|
| 21 | + if($piece->category == 1) {
|
|
| 22 | + $this->addURL("web/{$piece->title_url}/", date('Y-01-01'), 'yearly', .7);
|
|
| 23 | + } else {
|
|
| 24 | + $this->addURL("print/{$piece->title_url}/", date('Y-01-01'), 'yearly', .7);
|
|
| 25 | + } |
|
| 25 | 26 | } |
| 26 | 27 | } |
| 27 | 28 | |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | $entry = new stdclass(); |
| 29 | 29 | $entry->agent = self::$ALL_ROBOTS; |
| 30 | - if($url) |
|
| 31 | - $entry->allow = $url; |
|
| 32 | - else |
|
| 30 | + if($url) {
|
|
| 31 | + $entry->allow = $url; |
|
| 32 | + } else |
|
| 33 | 33 | { |
| 34 | 34 | $entry->disallow = ''; |
| 35 | 35 | $entry->allow = self::$ALL_URL; |
@@ -42,10 +42,11 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $entry = new stdclass(); |
| 44 | 44 | $entry->agent = self::$ALL_ROBOTS; |
| 45 | - if($url) |
|
| 46 | - $entry->disallow = $url; |
|
| 47 | - else |
|
| 48 | - $entry->disallow = self::$ALL_URL; |
|
| 45 | + if($url) {
|
|
| 46 | + $entry->disallow = $url; |
|
| 47 | + } else {
|
|
| 48 | + $entry->disallow = self::$ALL_URL; |
|
| 49 | + } |
|
| 49 | 50 | |
| 50 | 51 | $this->entries[] = $entry; |
| 51 | 52 | } |
@@ -57,12 +58,15 @@ discard block |
||
| 57 | 58 | |
| 58 | 59 | foreach($this->entries as $key => $entry) |
| 59 | 60 | { |
| 60 | - if($key == 0) |
|
| 61 | - echo "User-agent: {$entry->agent}\n"; |
|
| 62 | - if(isset($entry->disallow) && $entry->disallow != '') |
|
| 63 | - echo "Disallow: {$entry->disallow}\n"; |
|
| 64 | - if(isset($entry->allow)) |
|
| 65 | - echo "Allow: {$entry->allow}\n"; |
|
| 61 | + if($key == 0) {
|
|
| 62 | + echo "User-agent: {$entry->agent}\n";
|
|
| 63 | + } |
|
| 64 | + if(isset($entry->disallow) && $entry->disallow != '') {
|
|
| 65 | + echo "Disallow: {$entry->disallow}\n";
|
|
| 66 | + } |
|
| 67 | + if(isset($entry->allow)) {
|
|
| 68 | + echo "Allow: {$entry->allow}\n";
|
|
| 69 | + } |
|
| 66 | 70 | //echo "\n"; |
| 67 | 71 | } |
| 68 | 72 | |