Completed
Push — master ( 2684cd...5325e1 )
by Jacob
08:52
created
controller/blog/PostController.class.inc.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	{
24 24
 		parent::__construct();
25 25
 		
26
-        global $container;
27
-        $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
28
-        $this->post = $repository->findPostByPath(URLDecode::getPiece(2));
26
+		global $container;
27
+		$repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
28
+		$this->post = $repository->findPostByPath(URLDecode::getPiece(2));
29 29
 
30 30
 		if($this->post == null)
31 31
 			$this->eject();
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 			Loader::getRootUrl('blog') . $this->post['category'] . '/' . $this->post['path'] . '/',
37 37
 			$this->post['title']);
38 38
 
39
-        global $container;
40
-        $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
41
-        $this->tags = $repository->getTagsForPost($this->post['id']);
39
+		global $container;
40
+		$repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
41
+		$this->tags = $repository->getTagsForPost($this->post['id']);
42 42
 	}
43 43
 
44 44
 	protected function set_head_data()
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 		$this->set_keywords($this->get_post_keywords());
51 51
 		$this->set_author(self::$AUTHOR);
52 52
 
53
-    $photo = Content::instance('FetchFirstPhoto', $this->post['body'])->activate(true);
54
-    $photo = preg_match('/^<img src="([a-z-:\.\/]+)" [^>]+>$/', $photo, $matches);
55
-    $this->set_head('thumbnail', $matches[1]);
53
+	$photo = Content::instance('FetchFirstPhoto', $this->post['body'])->activate(true);
54
+	$photo = preg_match('/^<img src="([a-z-:\.\/]+)" [^>]+>$/', $photo, $matches);
55
+	$this->set_head('thumbnail', $matches[1]);
56 56
 
57 57
 		if (array_key_exists($this->post['id'], self::$DEPRECATED_BLOGS)) {
58 58
 			$log_id = self::$DEPRECATED_BLOGS[$this->post['id']];
@@ -126,17 +126,17 @@  discard block
 block discarded – undo
126 126
 			
127 127
 			$post = new stdclass();
128 128
 
129
-      if (
130
-        strpos($post_row['title'], 'Rainy Supe Loop') === 0 ||
131
-        strpos($post_row['title'], 'Malapais Loop') === 0 ||
132
-        strpos($post_row['title'], 'Mazatzal Peak Loop') === 0
133
-      ) {
134
-        $title = $post_row['title'];
135
-        $title = explode(':', $title);
136
-        $title = array_pop($title);
137
-        $title = trim($title);
138
-        $post->title = $title;
139
-      } else if (strpos($post_row['title'], 'Isle Royale') === 0) {
129
+	  if (
130
+		strpos($post_row['title'], 'Rainy Supe Loop') === 0 ||
131
+		strpos($post_row['title'], 'Malapais Loop') === 0 ||
132
+		strpos($post_row['title'], 'Mazatzal Peak Loop') === 0
133
+	  ) {
134
+		$title = $post_row['title'];
135
+		$title = explode(':', $title);
136
+		$title = array_pop($title);
137
+		$title = trim($title);
138
+		$post->title = $title;
139
+	  } else if (strpos($post_row['title'], 'Isle Royale') === 0) {
140 140
 				$title = $post_row['title'];
141 141
 				$title = explode(',', $title);
142 142
 				$title = array_pop($title);
@@ -167,12 +167,12 @@  discard block
 block discarded – undo
167 167
 	private $series_posts;
168 168
 	private function fetch_series_posts()
169 169
 	{
170
-      if(!isset($this->series_posts)) {
171
-          global $container;
172
-          $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']);
173
-          $this->series_posts = $repository->getSeriesForPost($this->post['id']);
174
-      }
175
-      return $this->series_posts;
170
+	  if(!isset($this->series_posts)) {
171
+		  global $container;
172
+		  $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']);
173
+		  $this->series_posts = $repository->getSeriesForPost($this->post['id']);
174
+	  }
175
+	  return $this->series_posts;
176 176
 	}
177 177
 
178 178
 	private function get_related_posts()
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
 			$exclude_post_array[] = $series_post['post'];
191 191
 		}
192 192
 
193
-        global $container;
194
-        $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
195
-        $post_result = $repository->getActivePostsByRelatedTags($this->post['id']);
193
+		global $container;
194
+		$repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
195
+		$post_result = $repository->getActivePostsByRelatedTags($this->post['id']);
196 196
 
197
-        $post_array = array();
197
+		$post_array = array();
198 198
 		
199 199
 		foreach($post_result as $post_row)
200 200
 		{
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
28 28
         $this->post = $repository->findPostByPath(URLDecode::getPiece(2));
29 29
 
30
-		if($this->post == null)
30
+		if ($this->post == null)
31 31
 			$this->eject();
32 32
 		
33 33
 		$this->handle_comment_submit(
34 34
 			self::$BLOG_SITE_ID,
35 35
 			$this->post['path'],
36
-			Loader::getRootUrl('blog') . $this->post['category'] . '/' . $this->post['path'] . '/',
36
+			Loader::getRootUrl('blog').$this->post['category'].'/'.$this->post['path'].'/',
37 37
 			$this->post['title']);
38 38
 
39 39
         global $container;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 			$log_id = self::$DEPRECATED_BLOGS[$this->post['id']];
59 59
 			$log = LogCollector::getById($log_id);
60 60
 			if (!empty($log)) {
61
-				$log_url = Loader::getRootUrl('waterfalls') . "journal/{$log->alias}/";
61
+				$log_url = Loader::getRootUrl('waterfalls')."journal/{$log->alias}/";
62 62
 				$this->set_canonical($log_url);
63 63
 			}
64 64
 		}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		$keyword_array = array();
96 96
 		$keywords = $this->tags;
97 97
 		
98
-		foreach($keywords as $keyword)
98
+		foreach ($keywords as $keyword)
99 99
 		{
100 100
 			$keyword_array[] = $keyword['tag'];
101 101
 		}
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
 	private function get_series_posts()
110 110
 	{
111 111
 		$series_posts = $this->fetch_series_posts();
112
-		if(count($series_posts) < 1)
112
+		if (count($series_posts) < 1)
113 113
 			return array();
114 114
 		
115 115
 		$previous_post = new stdclass();
116 116
 		$next_post = new stdclass();
117 117
 		
118 118
 		$found_current_post = false;
119
-		foreach($series_posts as $post_row)
119
+		foreach ($series_posts as $post_row)
120 120
 		{
121
-			if($post_row['post'] == $this->post['id'])
121
+			if ($post_row['post'] == $this->post['id'])
122 122
 			{
123 123
 				$found_current_post = true;
124 124
 				continue;
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 				$post->title = $post_row['title'];
147 147
 			}
148 148
 
149
-			$post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/";
149
+			$post->url = Loader::getRootUrl('blog')."{$post_row['category']}/{$post_row['path']}/";
150 150
 			
151
-			if(!$found_current_post)
151
+			if (!$found_current_post)
152 152
 				$previous_post = $post;
153 153
 			else
154 154
 			{
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	private $series_posts;
168 168
 	private function fetch_series_posts()
169 169
 	{
170
-      if(!isset($this->series_posts)) {
170
+      if (!isset($this->series_posts)) {
171 171
           global $container;
172 172
           $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']);
173 173
           $this->series_posts = $repository->getSeriesForPost($this->post['id']);
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
 	private function get_related_posts()
179 179
 	{
180 180
 		$tag_array = array();
181
-		foreach($this->tags as $tag)
181
+		foreach ($this->tags as $tag)
182 182
 		{
183 183
 			$tag_array[] = $tag['id'];
184 184
 		}
185 185
 		
186 186
 		$series_posts = $this->fetch_series_posts();
187 187
 		$exclude_post_array = array();
188
-		foreach($series_posts as $series_post)
188
+		foreach ($series_posts as $series_post)
189 189
 		{
190 190
 			$exclude_post_array[] = $series_post['post'];
191 191
 		}
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 
197 197
         $post_array = array();
198 198
 		
199
-		foreach($post_result as $post_row)
199
+		foreach ($post_result as $post_row)
200 200
 		{
201 201
 			$post = new stdclass();
202 202
 			$post->title = $post_row['title'];
203
-			$post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/";
203
+			$post->url = Loader::getRootUrl('blog')."{$post_row['category']}/{$post_row['path']}/";
204 204
 			$post->category = ucwords(str_replace('-', ' ', $post_row['category']));
205 205
 			$post->thumb = Content::instance('FetchFirstPhoto', $post_row['body'])->activate();
206 206
 			$post->body = Content::instance('SmartTrim', $post_row['body'])->activate(($post->thumb !== '') ? self::$POST_LENGTH_SHORT : self::$POST_LENGTH_LONG);
Please login to merge, or discard this patch.