Completed
Push — master ( b1edf3...c330e2 )
by Jacob
03:28
created
collector/blog/IntroductionCollector.class.inc.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -239,6 +239,9 @@
 block discarded – undo
239 239
 		return $text;
240 240
 	}
241 241
 
242
+	/**
243
+	 * @param string $type
244
+	 */
242 245
 	private function get_replace_text($entity_type, $entity, $type)
243 246
 	{
244 247
 		switch($entity_type)
Please login to merge, or discard this patch.
collector/data/DistanceCollector.class.inc.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -17,6 +17,9 @@
 block discarded – undo
17 17
 		return self::run_row_query($query);
18 18
 	}
19 19
 
20
+	/**
21
+	 * @param string $date
22
+	 */
20 23
 	public static function getTweetByFields($date, $text)
21 24
 	{
22 25
 		$query = "SELECT * FROM `jpemeric_stream`.`twitter` WHERE `date` = '{$date}' && `text` = '{$text}' LIMIT 1";
Please login to merge, or discard this patch.
collector/data/TwitterCollector.class.inc.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -17,6 +17,9 @@
 block discarded – undo
17 17
 		return self::run_row_query($query);
18 18
 	}
19 19
 
20
+	/**
21
+	 * @param string $date
22
+	 */
20 23
 	public static function getTweetByFields($date, $text)
21 24
 	{
22 25
 		$query = "SELECT * FROM `jpemeric_stream`.`twitter` WHERE `date` = '{$date}' && `text` = '{$text}' LIMIT 1";
Please login to merge, or discard this patch.
collector/stream/DistanceCollector.class.inc.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -17,6 +17,9 @@
 block discarded – undo
17 17
 		return self::run_row_query($query);
18 18
 	}
19 19
 
20
+	/**
21
+	 * @param string $date
22
+	 */
20 23
 	public static function getTweetByFields($date, $text)
21 24
 	{
22 25
 		$query = "SELECT * FROM `jpemeric_stream`.`twitter` WHERE `date` = '{$date}' && `text` = '{$text}' LIMIT 1";
Please login to merge, or discard this patch.
controller/sitemap/BlogSitemapController.class.inc.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -64,6 +64,9 @@
 block discarded – undo
64 64
 		}
65 65
 	}
66 66
 
67
+	/**
68
+	 * @param string $changefreq
69
+	 */
67 70
 	private function add_paginated_pages($posts, $base_url, $changefreq, $rank)
68 71
 	{
69 72
 		switch($changefreq)
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,19 +9,19 @@  discard block
 block discarded – undo
9 9
 final class BlogSitemapController extends SitemapController
10 10
 {
11 11
 
12
-	private static $HOME_PAGE_RANK			= .9;
13
-	private static $CATEGORY_PAGE_RANK		= .3;
14
-	private static $TAG_PAGE_RANK			= .2;
15
-	private static $PAGINATED_PAGE_RANK		= .1;
16
-	private static $POST_PAGE_RANK			= .8;
12
+	private static $HOME_PAGE_RANK = .9;
13
+	private static $CATEGORY_PAGE_RANK = .3;
14
+	private static $TAG_PAGE_RANK = .2;
15
+	private static $PAGINATED_PAGE_RANK = .1;
16
+	private static $POST_PAGE_RANK = .8;
17 17
 
18 18
 	private static $HOME_PAGE_CHANGEFREQ		= 'daily';
19
-	private static $CATEGORY_PAGE_CHANGEFREQ	= 'weekly';
19
+	private static $CATEGORY_PAGE_CHANGEFREQ = 'weekly';
20 20
 	private static $TAG_PAGE_CHANGEFREQ			= 'monthly';
21
-	private static $PAGINATED_PAGE_CHANGEFREQ	= 'monthly';
21
+	private static $PAGINATED_PAGE_CHANGEFREQ = 'monthly';
22 22
 	private static $POST_PAGE_CHANGEFREQ		= 'weekly';
23 23
 
24
-	private static $POSTS_PER_PAGE		= 10;
24
+	private static $POSTS_PER_PAGE = 10;
25 25
 
26 26
 	private static $CATEGORY_ARRAY = array(
27 27
 		'hiking',
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	{
51 51
 		$categories = self::$CATEGORY_ARRAY;
52 52
 		
53
-		foreach($categories as $category)
53
+		foreach ($categories as $category)
54 54
 		{
55 55
 			$post_count = PostCollector::getPostCountForCategory($category);
56 56
 			
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	{
64 64
 		$tags = TagCollector::getAllTags();
65 65
 		
66
-		foreach($tags as $tag)
66
+		foreach ($tags as $tag)
67 67
 		{
68 68
 			$post_count = PostCollector::getPostCountForTag($tag->id);
69 69
 			
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	{
77 77
 		$posts = PostCollector::getMainList(500);
78 78
 		
79
-		foreach($posts as $post)
79
+		foreach ($posts as $post)
80 80
 		{
81 81
 			$base_url = "{$post->category}/{$post->path}/";
82 82
 			$this->addURL($base_url, date('Y-m-d', strtotime('last Monday')), self::$POST_PAGE_CHANGEFREQ, self::$POST_PAGE_RANK);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 	private function add_paginated_pages($post_count, $base_url, $changefreq, $rank)
87 87
 	{
88
-		switch($changefreq)
88
+		switch ($changefreq)
89 89
 		{
90 90
 			case 'daily' :
91 91
 				$lastmod = date('Y-m-d');
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		}
100 100
 		
101 101
 		$this->addURL($base_url, $lastmod, $changefreq, $rank);
102
-		for($i = 2; (($i - 1) * self::$POSTS_PER_PAGE) < $post_count; $i++)
102
+		for ($i = 2; (($i - 1) * self::$POSTS_PER_PAGE) < $post_count; $i++)
103 103
 		{
104 104
 			$this->addURL("{$base_url}{$i}/", date('Y-m-01'), self::$PAGINATED_PAGE_CHANGEFREQ, self::$PAGINATED_PAGE_RANK);
105 105
 		}
Please login to merge, or discard this patch.
tests/unit/domain/blog/MysqlPostRepositoryTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     public function __construct()
14 14
     {
15 15
         $extendedPdo = $this->newExtendedPdo();
16
-        $this->connections = new ConnectionLocator(function () use ($extendedPdo) {
16
+        $this->connections = new ConnectionLocator(function() use ($extendedPdo) {
17 17
             return $extendedPdo;
18 18
         });
19 19
     }
Please login to merge, or discard this patch.
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -7,21 +7,21 @@  discard block
 block discarded – undo
7 7
 class MysqlPostRepositoryTest extends PHPUnit_Framework_TestCase
8 8
 {
9 9
 
10
-    protected $connections;
11
-
12
-    public function __construct()
13
-    {
14
-        $extendedPdo = $this->newExtendedPdo();
15
-        $this->connections = new ConnectionLocator(function () use ($extendedPdo) {
16
-            return $extendedPdo;
17
-        });
18
-    }
19
-
20
-    protected function newExtendedPdo()
21
-    {
22
-        $extendedPdo = new ExtendedPdo('sqlite::memory:');
23
-        $extendedPdo->exec('ATTACH DATABASE `jpemeric_blog.db` AS `jpemeric_blog`');
24
-        $extendedPdo->exec("
10
+	protected $connections;
11
+
12
+	public function __construct()
13
+	{
14
+		$extendedPdo = $this->newExtendedPdo();
15
+		$this->connections = new ConnectionLocator(function () use ($extendedPdo) {
16
+			return $extendedPdo;
17
+		});
18
+	}
19
+
20
+	protected function newExtendedPdo()
21
+	{
22
+		$extendedPdo = new ExtendedPdo('sqlite::memory:');
23
+		$extendedPdo->exec('ATTACH DATABASE `jpemeric_blog.db` AS `jpemeric_blog`');
24
+		$extendedPdo->exec("
25 25
             CREATE TABLE IF NOT EXISTS `jpemeric_blog`.`post` (
26 26
               `id` integer PRIMARY KEY AUTOINCREMENT,
27 27
               `title` varchar(60) NOT NULL,
@@ -31,88 +31,88 @@  discard block
 block discarded – undo
31 31
               `body` text NOT NULL,
32 32
               `display` integer NOT NULL
33 33
             )"
34
-        );
35
-        return $extendedPdo;
36
-    }
37
-
38
-    public function newMysqlPostRepository()
39
-    {
40
-        return new MysqlPostRepository($this->connections);
41
-    }
42
-
43
-    public function testConstructSetsConnections()
44
-    {
45
-        $this->assertAttributeEquals(
46
-            $this->connections,
47
-            'connections',
48
-            $this->newMysqlPostRepository()
49
-        );
50
-    }
51
-
52
-    public function testFindPostByPath()
53
-    {
54
-        $test_active_post = array(
55
-            'title'     => 'test findByPath active',
56
-            'path'      => 'test-findbypath-active',
57
-            'category'  => 'test-category',
58
-            'date'      => (new DateTime())->format('Y-m-d H:i:s'),
59
-            'body'      => 'test content',
60
-            'display'   => 1
61
-        );
62
-
63
-        $this->connections->getDefault()->perform("
34
+		);
35
+		return $extendedPdo;
36
+	}
37
+
38
+	public function newMysqlPostRepository()
39
+	{
40
+		return new MysqlPostRepository($this->connections);
41
+	}
42
+
43
+	public function testConstructSetsConnections()
44
+	{
45
+		$this->assertAttributeEquals(
46
+			$this->connections,
47
+			'connections',
48
+			$this->newMysqlPostRepository()
49
+		);
50
+	}
51
+
52
+	public function testFindPostByPath()
53
+	{
54
+		$test_active_post = array(
55
+			'title'     => 'test findByPath active',
56
+			'path'      => 'test-findbypath-active',
57
+			'category'  => 'test-category',
58
+			'date'      => (new DateTime())->format('Y-m-d H:i:s'),
59
+			'body'      => 'test content',
60
+			'display'   => 1
61
+		);
62
+
63
+		$this->connections->getDefault()->perform("
64 64
             INSERT INTO jpemeric_blog.post
65 65
                 (title, path, category, date, body, display)
66 66
             VALUES
67 67
                 (:title, :path, :category, :date, :body, :display)",
68
-            $test_active_post);
69
-
70
-        $active_post = $this->newMysqlPostRepository()->findPostByPath(
71
-            $test_active_post['category'],
72
-            $test_active_post['path']
73
-        );
74
-        $this->assertSame($test_active_post['title'], $active_post['title']);
75
-
76
-        $test_inactive_post = array(
77
-            'title'     => 'test findByPath inactive',
78
-            'path'      => 'test-findbypath-inactive',
79
-            'category'  => 'test-category',
80
-            'date'      => (new DateTime())->format('Y-m-d H:i:s'),
81
-            'body'      => 'test content',
82
-            'display'   => 0
83
-        );
84
-
85
-        $this->connections->getDefault()->perform("
68
+			$test_active_post);
69
+
70
+		$active_post = $this->newMysqlPostRepository()->findPostByPath(
71
+			$test_active_post['category'],
72
+			$test_active_post['path']
73
+		);
74
+		$this->assertSame($test_active_post['title'], $active_post['title']);
75
+
76
+		$test_inactive_post = array(
77
+			'title'     => 'test findByPath inactive',
78
+			'path'      => 'test-findbypath-inactive',
79
+			'category'  => 'test-category',
80
+			'date'      => (new DateTime())->format('Y-m-d H:i:s'),
81
+			'body'      => 'test content',
82
+			'display'   => 0
83
+		);
84
+
85
+		$this->connections->getDefault()->perform("
86 86
             INSERT INTO jpemeric_blog.post
87 87
                 (title, path, category, date, body, display)
88 88
             VALUES
89 89
                 (:title, :path, :category, :date, :body, :display)",
90
-            $test_inactive_post);
91
-
92
-        $inactive_post = $this->newMysqlPostRepository()->findPostByPath(
93
-            $test_inactive_post['category'],
94
-            $test_inactive_post['path']
95
-        );
96
-        $this->assertFalse($inactive_post);
97
-
98
-        $nonexistant_post = $this->newMysqlPostRepository()->findPostByPath(
99
-            'test-category',
100
-            'test-findbypath-nonexistant'
101
-        );
102
-        $this->assertFalse($nonexistant_post);
90
+			$test_inactive_post);
91
+
92
+		$inactive_post = $this->newMysqlPostRepository()->findPostByPath(
93
+			$test_inactive_post['category'],
94
+			$test_inactive_post['path']
95
+		);
96
+		$this->assertFalse($inactive_post);
97
+
98
+		$nonexistant_post = $this->newMysqlPostRepository()->findPostByPath(
99
+			'test-category',
100
+			'test-findbypath-nonexistant'
101
+		);
102
+		$this->assertFalse($nonexistant_post);
103 103
    }
104 104
 
105
-    public function testIsInstanceOfPostRepository()
106
-    {
107
-        $this->assertInstanceOf(
108
-            'Jacobemerick\Web\Domain\Blog\Post\PostRepositoryInterface',
109
-            $this->newMysqlPostRepository()
110
-        );
111
-    }
105
+	public function testIsInstanceOfPostRepository()
106
+	{
107
+		$this->assertInstanceOf(
108
+			'Jacobemerick\Web\Domain\Blog\Post\PostRepositoryInterface',
109
+			$this->newMysqlPostRepository()
110
+		);
111
+	}
112 112
 
113
-    public static function tearDownAfterClass()
114
-    {
113
+	public static function tearDownAfterClass()
114
+	{
115 115
 //        $this->connections->getDefault()->disconnect();
116
-        unlink('jpemeric_blog.db');
117
-    }
116
+		unlink('jpemeric_blog.db');
117
+	}
118 118
 }
Please login to merge, or discard this patch.
utility/content/AutolinkTwitterURLContent.class.inc.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -49,6 +49,9 @@
 block discarded – undo
49 49
 		Database::execute($query);
50 50
 	}
51 51
 
52
+	/**
53
+	 * @return string
54
+	 */
52 55
 	private function get_changeset_to_check()
53 56
 	{
54 57
 		$changeset = ChangelogCollector::getMostRecentChange();
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
 
11 11
 	protected function execute()
12 12
 	{
13
-		if(stristr($this->content, 'http') === false)
13
+		if (stristr($this->content, 'http') === false)
14 14
 			return;
15 15
 		
16 16
 		$parameters = func_get_args();
17
-		if(count($parameters) > 1 || (count($parameters) == 1 && !is_array($parameters[0])))
17
+		if (count($parameters) > 1 || (count($parameters) == 1 && !is_array($parameters[0])))
18 18
 		{
19 19
 			trigger_error('Unexpected parameters passed into AutolinkTwitterURL!');
20 20
 			return;
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 		$parameters = array_shift($parameters);
23 23
 		
24 24
 		$found_link = preg_match_all(self::$LINK_PATTERN, $this->content, $matches, PREG_SET_ORDER);
25
-		if($found_link === false || $found_link === 0)
25
+		if ($found_link === false || $found_link === 0)
26 26
 			return;
27 27
 		
28
-		foreach($matches as $match)
28
+		foreach ($matches as $match)
29 29
 		{
30 30
 			$parameters['href'] = $match[0];
31 31
 			$display_url = $this->get_display_url($match);
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	{
42 42
 		$display_url = $this->check_for_redirect($match[0]);
43 43
 		
44
-		if(strlen($display_url) > (self::$DISPLAY_URL_LENGTH - 2))
44
+		if (strlen($display_url) > (self::$DISPLAY_URL_LENGTH - 2))
45 45
 		{
46 46
 			$display_url = substr($display_url, 0, self::$DISPLAY_URL_LENGTH);
47 47
 			$display_url .= '...';
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	private function get_replacement_link($parameters, $display_url)
54 54
 	{
55 55
 		$link = '<a';
56
-		foreach($parameters as $attribute => $value)
56
+		foreach ($parameters as $attribute => $value)
57 57
 		{
58 58
 			$link .= ' ';
59 59
 			$link .= $attribute;
60 60
 			$link .= '=';
61
-			$link .= '"' . $value .'"';
61
+			$link .= '"' . $value . '"';
62 62
 		}
63 63
 		$link .= '>';
64 64
 		$link .= $display_url;
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 	private function check_for_redirect($url)
71 71
 	{
72 72
 		$headers = @get_headers($url);
73
-		if($headers === false)
73
+		if ($headers === false)
74 74
 			$headers = $this->get_headers($url);
75 75
 		
76
-		if(stristr($headers[0], '301') !== false || stristr($headers[0], '302') !== false)
76
+		if (stristr($headers[0], '301') !== false || stristr($headers[0], '302') !== false)
77 77
 		{
78
-			foreach($headers as $header)
78
+			foreach ($headers as $header)
79 79
 			{
80
-				if(substr($header, 0, 9) == 'Location:')
80
+				if (substr($header, 0, 9) == 'Location:')
81 81
 					break;
82 82
 			}
83 83
 			
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,8 +10,9 @@  discard block
 block discarded – undo
10 10
 
11 11
 	protected function execute()
12 12
 	{
13
-		if(stristr($this->content, 'http') === false)
14
-			return;
13
+		if(stristr($this->content, 'http') === false) {
14
+					return;
15
+		}
15 16
 		
16 17
 		$parameters = func_get_args();
17 18
 		if(count($parameters) > 1 || (count($parameters) == 1 && !is_array($parameters[0])))
@@ -22,8 +23,9 @@  discard block
 block discarded – undo
22 23
 		$parameters = array_shift($parameters);
23 24
 		
24 25
 		$found_link = preg_match_all(self::$LINK_PATTERN, $this->content, $matches, PREG_SET_ORDER);
25
-		if($found_link === false || $found_link === 0)
26
-			return;
26
+		if($found_link === false || $found_link === 0) {
27
+					return;
28
+		}
27 29
 		
28 30
 		foreach($matches as $match)
29 31
 		{
@@ -70,15 +72,17 @@  discard block
 block discarded – undo
70 72
 	private function check_for_redirect($url)
71 73
 	{
72 74
 		$headers = @get_headers($url);
73
-		if($headers === false)
74
-			$headers = $this->get_headers($url);
75
+		if($headers === false) {
76
+					$headers = $this->get_headers($url);
77
+		}
75 78
 		
76 79
 		if(stristr($headers[0], '301') !== false || stristr($headers[0], '302') !== false)
77 80
 		{
78 81
 			foreach($headers as $header)
79 82
 			{
80
-				if(substr($header, 0, 9) == 'Location:')
81
-					break;
83
+				if(substr($header, 0, 9) == 'Location:') {
84
+									break;
85
+				}
82 86
 			}
83 87
 			
84 88
 			$url = substr($header, 10);
Please login to merge, or discard this patch.
utility/content/CleanCommentContent.class.inc.php 3 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -36,6 +36,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,8 +40,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 		{
Please login to merge, or discard this patch.
utility/content/FixInternalLinkContent.class.inc.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -23,6 +23,9 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -72,38 +72,38 @@
 block discarded – undo
72 72
 				
73 73
 				break;
74 74
 			case 'falls' :
75
-                $pieces = explode('/', $uri);
76
-                if (count($pieces) == 1) {
77
-                    Loader::load('collector', 'waterfall/WatercourseCollector');
78
-                    list ($watercourse_alias) = $pieces;
79
-                    $watercourse = WatercourseCollector::getByAlias($watercourse_alias);
75
+				$pieces = explode('/', $uri);
76
+				if (count($pieces) == 1) {
77
+					Loader::load('collector', 'waterfall/WatercourseCollector');
78
+					list ($watercourse_alias) = $pieces;
79
+					$watercourse = WatercourseCollector::getByAlias($watercourse_alias);
80 80
                     
81
-                    if ($watercourse == null) {
82
-                        return;
83
-                    }
81
+					if ($watercourse == null) {
82
+						return;
83
+					}
84 84
                     
85
-                    $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/';
86
-                    $link .= "{$watercourse->alias}/";
85
+					$link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/';
86
+					$link .= "{$watercourse->alias}/";
87 87
                     
88
-                    if ($anchor == '') {
89
-                        $anchor = $watercourse->name;
90
-                    }
91
-                } else if (count($pieces) == 2) {
92
-                    Loader::load('collector', 'waterfall/WaterfallCollector');
93
-                    list ($watercourse_alias, $waterfall_alias) = $pieces;
94
-                    $waterfall = WaterfallCollector::getByAlias($watercourse_alias, $waterfall_alias);
88
+					if ($anchor == '') {
89
+						$anchor = $watercourse->name;
90
+					}
91
+				} else if (count($pieces) == 2) {
92
+					Loader::load('collector', 'waterfall/WaterfallCollector');
93
+					list ($watercourse_alias, $waterfall_alias) = $pieces;
94
+					$waterfall = WaterfallCollector::getByAlias($watercourse_alias, $waterfall_alias);
95 95
                     
96
-                    if ($waterfall == null) {
97
-                        return;
98
-                    }
96
+					if ($waterfall == null) {
97
+						return;
98
+					}
99 99
                     
100
-                    $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/';
101
-                    $link .= "{$waterfall->watercourse_alias}/{$waterfall->alias}/";
100
+					$link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/';
101
+					$link .= "{$waterfall->watercourse_alias}/{$waterfall->alias}/";
102 102
                     
103
-                    if ($anchor == '') {
104
-                        $anchor = $waterfall->name;
105
-                    }
106
-                }
103
+					if ($anchor == '') {
104
+						$anchor = $waterfall->name;
105
+					}
106
+				}
107 107
 				break;
108 108
 			default :
109 109
 				break;
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +17 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,10 +14,11 @@  discard block
 block discarded – undo
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;
@@ -35,14 +36,16 @@  discard block
 block discarded – undo
35 36
 				Loader::load('collector', 'blog/PostCollector');
36 37
 				$post = PostCollector::getPostByURI($uri);
37 38
 				
38
-				if($post === NULL)
39
-					return;
39
+				if($post === NULL) {
40
+									return;
41
+				}
40 42
 				
41 43
 				$link .= ($is_absolute) ? Loader::getRootURL('blog') : '/';
42 44
 				$link .= "{$post->category}/{$post->path}/";
43 45
 				
44
-				if($anchor == '')
45
-					$anchor = $post->title;
46
+				if($anchor == '') {
47
+									$anchor = $post->title;
48
+				}
46 49
 				
47 50
 				break;
48 51
 			case 'blog-tag' :
@@ -61,14 +64,16 @@  discard block
 block discarded – undo
61 64
 				Loader::load('collector', 'waterfall/LogCollector');
62 65
 				$log = LogCollector::getByAlias($uri);
63 66
 				
64
-				if($log === NULL)
65
-					return;
67
+				if($log === NULL) {
68
+									return;
69
+				}
66 70
 				
67 71
 				$link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/';
68 72
 				$link .= "journal/{$log->alias}/";
69 73
 				
70
-				if($anchor == '')
71
-					$anchor = $log->title;
74
+				if($anchor == '') {
75
+									$anchor = $log->title;
76
+				}
72 77
 				
73 78
 				break;
74 79
 			case 'falls' :
Please login to merge, or discard this patch.