Completed
Push — master ( d92e41...a5e989 )
by Jacob
05:09 queued 01:17
created
controller/RobotController.class.inc.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -38,6 +38,9 @@
 block discarded – undo
38 38
 		$this->entries[] = $entry;
39 39
 	}
40 40
 
41
+	/**
42
+	 * @param string $url
43
+	 */
41 44
 	protected function disallow_for_all_robots($url = null)
42 45
 	{
43 46
 		$entry = new stdclass();
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	{
28 28
 		$entry = new stdclass();
29 29
 		$entry->agent = self::$ALL_ROBOTS;
30
-		if($url)
30
+		if ($url)
31 31
 			$entry->allow = $url;
32 32
 		else
33 33
 		{
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	{
43 43
 		$entry = new stdclass();
44 44
 		$entry->agent = self::$ALL_ROBOTS;
45
-		if($url)
45
+		if ($url)
46 46
 			$entry->disallow = $url;
47 47
 		else
48 48
 			$entry->disallow = self::$ALL_URL;
@@ -55,18 +55,18 @@  discard block
 block discarded – undo
55 55
 		$this->set_data();
56 56
 		Header::sendRobot();
57 57
 		
58
-		foreach($this->entries as $key => $entry)
58
+		foreach ($this->entries as $key => $entry)
59 59
 		{
60
-			if($key == 0)
60
+			if ($key == 0)
61 61
 				echo "User-agent: {$entry->agent}\n";
62
-			if(isset($entry->disallow) && $entry->disallow != '')
62
+			if (isset($entry->disallow) && $entry->disallow != '')
63 63
 				echo "Disallow: {$entry->disallow}\n";
64
-			if(isset($entry->allow))
64
+			if (isset($entry->allow))
65 65
 				echo "Allow: {$entry->allow}\n";
66 66
 			//echo "\n";
67 67
 		}
68 68
 		
69
-		if($this->show_sitemap)
69
+		if ($this->show_sitemap)
70 70
 		{
71 71
 			echo "\n";
72 72
 			$sitemap = URLDecode::getBase() . 'sitemap.xml';
Please login to merge, or discard this patch.
Braces   +17 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		
Please login to merge, or discard this patch.
controller/RSSController.class.inc.php 4 patches
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -18,6 +18,9 @@  discard block
 block discarded – undo
18 18
 		Debugger::hide();
19 19
 	}
20 20
 
21
+	/**
22
+	 * @param string $title
23
+	 */
21 24
 	final protected function setTitle($title)
22 25
 	{
23 26
 		$this->xml->channel->addChild('title', $title);
@@ -30,11 +33,17 @@  discard block
 block discarded – undo
30 33
 		$this->xml->channel->addChild('link', $url);
31 34
 	}
32 35
 
36
+	/**
37
+	 * @param string $description
38
+	 */
33 39
 	final protected function setDescription($description)
34 40
 	{
35 41
 		$this->xml->channel->addChild('description', $description);
36 42
 	}
37 43
 
44
+	/**
45
+	 * @param string $url
46
+	 */
38 47
 	final protected function setAtom($url)
39 48
 	{
40 49
 		$atom = $this->xml->channel->addChild('link', '', 'http://www.w3.org/2005/Atom');
@@ -76,6 +85,9 @@  discard block
 block discarded – undo
76 85
 		$this->xml->channel->addChild('ttl', $ttl);
77 86
 	}
78 87
 
88
+	/**
89
+	 * @param string $pubDate
90
+	 */
79 91
 	final protected function addItem($title, $link, $description, $category, $pubDate)
80 92
 	{
81 93
 		$item = $this->xml->channel->addChild('item');
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,10 +57,10 @@
 block discarded – undo
57 57
 
58 58
 	final protected function setWebMaster($webmaster = '')
59 59
 	{
60
-        if ($webmaster == '') {
61
-            global $config;
62
-            $webmaster = "{$config->admin_email} (Jacob Emerick)";
63
-        }
60
+		if ($webmaster == '') {
61
+			global $config;
62
+			$webmaster = "{$config->admin_email} (Jacob Emerick)";
63
+		}
64 64
 		$this->xml->channel->addChild('webMaster', $webmaster);
65 65
 	}
66 66
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 	final protected function setLink($url = null)
27 27
 	{
28
-		if(!isset($url))
28
+		if (!isset($url))
29 29
 			$url = URLDecode::getBase();
30 30
 		$this->xml->channel->addChild('link', $url);
31 31
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 	final protected function setCopyright($copyright = null)
52 52
 	{
53
-		if(!isset($copyright))
53
+		if (!isset($copyright))
54 54
 			$copyright = 'Copyright ' . date('Y') . ' Jacob Emerick';
55 55
 		$this->xml->channel->addChild('copyright', $copyright);
56 56
 	}
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 	final protected function setPubDate($date = null)
68 68
 	{
69
-		if(!isset($date))
69
+		if (!isset($date))
70 70
 			$date = date('r');
71 71
 		$this->xml->channel->addChild('pubDate', $date);
72 72
 	}
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@  discard block
 block discarded – undo
25 25
 
26 26
 	final protected function setLink($url = null)
27 27
 	{
28
-		if(!isset($url))
29
-			$url = URLDecode::getBase();
28
+		if(!isset($url)) {
29
+					$url = URLDecode::getBase();
30
+		}
30 31
 		$this->xml->channel->addChild('link', $url);
31 32
 	}
32 33
 
@@ -50,8 +51,9 @@  discard block
 block discarded – undo
50 51
 
51 52
 	final protected function setCopyright($copyright = null)
52 53
 	{
53
-		if(!isset($copyright))
54
-			$copyright = 'Copyright ' . date('Y') . ' Jacob Emerick';
54
+		if(!isset($copyright)) {
55
+					$copyright = 'Copyright ' . date('Y') . ' Jacob Emerick';
56
+		}
55 57
 		$this->xml->channel->addChild('copyright', $copyright);
56 58
 	}
57 59
 
@@ -66,8 +68,9 @@  discard block
 block discarded – undo
66 68
 
67 69
 	final protected function setPubDate($date = null)
68 70
 	{
69
-		if(!isset($date))
70
-			$date = date('r');
71
+		if(!isset($date)) {
72
+					$date = date('r');
73
+		}
71 74
 		$this->xml->channel->addChild('pubDate', $date);
72 75
 	}
73 76
 
Please login to merge, or discard this patch.
controller/sitemap/LifestreamSitemapController.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   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
 {
8 8
 
9 9
 	private static $HOME_PAGE_RANK			= .9;
10
-	private static $TAG_PAGE_RANK			= .3;
11
-	private static $PAGINATED_PAGE_RANK		= .1;
10
+	private static $TAG_PAGE_RANK = .3;
11
+	private static $PAGINATED_PAGE_RANK = .1;
12 12
 	private static $POST_PAGE_RANK			= .5;
13
-	private static $ABOUT_PAGE_RANK			= .7;
13
+	private static $ABOUT_PAGE_RANK = .7;
14 14
 
15 15
 	private static $HOME_PAGE_CHANGEFREQ		= 'hourly';
16 16
 	private static $TAG_PAGE_CHANGEFREQ			= 'daily';
17
-	private static $PAGINATED_PAGE_CHANGEFREQ	= 'daily';
17
+	private static $PAGINATED_PAGE_CHANGEFREQ = 'daily';
18 18
 	private static $POST_PAGE_CHANGEFREQ		= 'weekly';
19
-	private static $ABOUT_PAGE_CHANGEFREQ		= 'monthly';
19
+	private static $ABOUT_PAGE_CHANGEFREQ = 'monthly';
20 20
 
21 21
 	private static $POSTS_PER_PAGE = 15;
22 22
 
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 		$posts = ActivityCollector::getAll();
43 43
 		
44 44
 		$tag_post_holder = array();
45
-		foreach($posts as $post)
45
+		foreach ($posts as $post)
46 46
 		{
47 47
 			$tag_post_holder[$post->type][] = $post;
48 48
 		}
49 49
 		
50
-		foreach($tag_post_holder as $tag => $posts)
50
+		foreach ($tag_post_holder as $tag => $posts)
51 51
 		{
52 52
 			$url = "{$tag}/";
53 53
 			$this->add_paginated_pages($posts, $url, self::$TAG_PAGE_CHANGEFREQ, self::$TAG_PAGE_RANK);
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	{
59 59
 		$posts = ActivityCollector::getAll();
60 60
 		
61
-		foreach($posts as $post)
61
+		foreach ($posts as $post)
62 62
 		{
63 63
 			$this->addURL("{$post->type}/{$post->id}/", date('Y-m-d', strtotime('last Monday')), self::$POST_PAGE_CHANGEFREQ, self::$POST_PAGE_RANK);
64 64
 		}
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 	private function add_paginated_pages($posts, $base_url, $changefreq, $rank)
68 68
 	{
69
-		switch($changefreq)
69
+		switch ($changefreq)
70 70
 		{
71 71
 			case 'hourly' :
72 72
 				$lastmod = date('Y-m-d H:00:00');
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		}
84 84
 		
85 85
 		$this->addURL($base_url, $lastmod, $changefreq, $rank);
86
-		for($i = 2; (($i - 1) * self::$POSTS_PER_PAGE) < count($posts); $i++)
86
+		for ($i = 2; (($i - 1) * self::$POSTS_PER_PAGE) < count($posts); $i++)
87 87
 		{
88 88
 			$this->addURL("{$base_url}page/{$i}/", date('Y-m-01'), self::$PAGINATED_PAGE_CHANGEFREQ, self::$PAGINATED_PAGE_RANK);
89 89
 		}
Please login to merge, or discard this patch.
controller/sitemap/WaterfallSitemapController.class.inc.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -133,6 +133,10 @@
 block discarded – undo
133 133
         $this->addURL('about/', date('Y-01-01'), self::$ABOUT_PAGE_CHANGEFREQ, self::$ABOUT_PAGE_RANK);
134 134
     }
135 135
 
136
+    /**
137
+     * @param integer $items_per_page
138
+     * @param string $type
139
+     */
136 140
     private function add_paginated_pages($count, $items_per_page, $base_url, $type)
137 141
     {
138 142
         switch($type) {
Please login to merge, or discard this patch.
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?
2 2
 
3 3
 Loader::load('collector', array(
4
-    'waterfall/CompanionCollector',
5
-    'waterfall/CountyCollector',
6
-    'waterfall/LogCollector',
7
-    'waterfall/LogTagCollector',
8
-    'waterfall/PeriodCollector',
9
-    'waterfall/WatercourseCollector',
10
-    'waterfall/WaterfallCollector',
4
+	'waterfall/CompanionCollector',
5
+	'waterfall/CountyCollector',
6
+	'waterfall/LogCollector',
7
+	'waterfall/LogTagCollector',
8
+	'waterfall/PeriodCollector',
9
+	'waterfall/WatercourseCollector',
10
+	'waterfall/WaterfallCollector',
11 11
 ));
12 12
 Loader::load('controller', '/SitemapController');
13 13
 Loader::load('utility', 'Content');
@@ -15,143 +15,143 @@  discard block
 block discarded – undo
15 15
 final class WaterfallSitemapController extends SitemapController
16 16
 {
17 17
 
18
-    private static $HOME_PAGE_RANK                      = .9;
19
-
20
-    private static $WATERFALL_LISTING_RANK              = .3;
21
-    private static $WATERFALL_COUNTY_LISTING_RANK       = .6;
22
-    private static $WATERFALL_WATERCOURSE_LISTING_RANK  = .6;
23
-    private static $WATERFALL_LISTING_SUBPAGES_RANK     = .1;
24
-    private static $WATERFALL_PAGE_RANK                 = .8;
25
-
26
-    private static $MAP_PAGE_RANK                       = .6;
27
-
28
-    private static $LOG_LISTING_RANK                    = .3;
29
-    private static $LOG_COMPANION_LISTING_RANK          = .3;
30
-    private static $LOG_PERIOD_LISTING_RANK             = .3;
31
-    private static $LOG_LISTING_SUBPAGES_RANK           = .1;
32
-    private static $LOG_PAGE_RANK                       = .7;
33
-
34
-    private static $ABOUT_PAGE_RANK                     = .6;
35
-
36
-
37
-    private static $HOME_PAGE_CHANGEFREQ                      = 'daily';
38
-
39
-    private static $WATERFALL_LISTING_CHANGEFREQ              = 'monthly';
40
-    private static $WATERFALL_COUNTY_LISTING_CHANGEFREQ       = 'monthly';
41
-    private static $WATERFALL_WATERCOURSE_LISTING_CHANGEFREQ  = 'monthly';
42
-    private static $WATERFALL_LISTING_SUBPAGES_CHANGEFREQ     = 'monthly';
43
-    private static $WATERFALL_PAGE_CHANGEFREQ                 = 'weekly';
44
-
45
-    private static $MAP_PAGE_CHANGEFREQ                       = 'monthly';
46
-
47
-    private static $LOG_LISTING_CHANGEFREQ                    = 'weekly';
48
-    private static $LOG_COMPANION_LISTING_CHANGEFREQ          = 'monthly';
49
-    private static $LOG_PERIOD_LISTING_CHANGEFREQ             = 'monthly';
50
-    private static $LOG_LISTING_SUBPAGES_CHANGEFREQ           = 'monthly';
51
-    private static $LOG_PAGE_CHANGEFREQ                       = 'weekly';
52
-
53
-    private static $ABOUT_PAGE_CHANGEFREQ                     = 'yearly';
54
-
55
-
56
-    private static $WATERFALLS_PER_LISTING              = 24;
57
-    private static $WATERFALLS_PER_COUNTY_LISTING       = 12;
58
-    private static $WATERFALLS_PER_WATERCOURSE_LISTING  = 12;
59
-
60
-    private static $LOGS_PER_LISTING                    = 10;
61
-    private static $LOGS_PER_COMPANION_LISTING          = 10;
62
-    private static $LOGS_PER_PERIOD_LISTING             = 10;
63
-
64
-    protected function set_data()
65
-    {
66
-        $this->add_home_pages();
67
-        $this->add_waterfall_pages();
68
-        $this->add_map_pages();
69
-        $this->add_log_pages();
70
-        $this->add_about_pages();
71
-    }
72
-
73
-    private function add_home_pages()
74
-    {
75
-        $this->addURL('', date('Y-m-d'), self::$HOME_PAGE_CHANGEFREQ, self::$HOME_PAGE_RANK);
76
-    }
77
-
78
-    private function add_waterfall_pages()
79
-    {
80
-        $this->addURL('falls/', date('Y-m-01'), self::$WATERFALL_LISTING_CHANGEFREQ, self::$WATERFALL_LISTING_RANK);
81
-        $count = WaterfallCollector::getListCount();
82
-        $this->add_paginated_pages($count, self::$WATERFALLS_PER_LISTING, 'falls', 'waterfall');
83
-
84
-        $county_list = CountyCollector::getCountyList();
85
-        foreach ($county_list as $county) {
86
-            $this->addURL("{$county->alias}/", date('Y-m-01'), self::$WATERFALL_COUNTY_LISTING_CHANGEFREQ, self::$WATERFALL_COUNTY_LISTING_RANK);
87
-            $this->add_paginated_pages($county->count, self::$WATERFALLS_PER_COUNTY_LISTING, $county->alias, 'waterfall');
88
-        }
89
-
90
-        $watercourse_list = WatercourseCollector::getWatercourseList();
91
-        foreach ($watercourse_list as $watercourse) {
92
-            $this->addURL("{$watercourse->alias}/", date('Y-m-01'), self::$WATERFALL_WATERCOURSE_LISTING_CHANGEFREQ, self::$WATERFALL_WATERCOURSE_LISTING_RANK);
93
-            $this->add_paginated_pages($watercourse->count, self::$WATERFALLS_PER_WATERCOURSE_LISTING, $watercourse->alias, 'waterfall');
94
-        }
95
-
96
-        $waterfall_list = WaterfallCollector::getList(500);
97
-        foreach ($waterfall_list as $waterfall) {
98
-            $this->addURL("{$waterfall->watercourse_alias}/{$waterfall->waterfall_alias}/", date('Y-m-d', strtotime('last Monday')), self::$WATERFALL_PAGE_CHANGEFREQ, self::$WATERFALL_PAGE_RANK);
99
-        }
100
-    }
101
-
102
-    private function add_map_pages()
103
-    {
104
-        $this->addURL('map/', date('Y-m-01'), self::$MAP_PAGE_CHANGEFREQ, self::$MAP_PAGE_RANK);
105
-    }
106
-
107
-    private function add_log_pages()
108
-    {
109
-        $this->addURL('journal/', date('Y-m-d', strtotime('last Monday')), self::$LOG_LISTING_CHANGEFREQ, self::$LOG_LISTING_RANK);
110
-        $count = LogCollector::getListCount();
111
-        $this->add_paginated_pages($count, self::$LOGS_PER_LISTING, 'journal', 'log');
112
-
113
-        $companion_list = CompanionCollector::getCompanionList();
114
-        foreach ($companion_list as $companion) {
115
-            $this->addURL("companion/{$companion->alias}/", date('Y-m-01'), self::$LOG_COMPANION_LISTING_CHANGEFREQ, self::$LOG_COMPANION_LISTING_RANK);
116
-            $this->add_paginated_pages($companion->count, self::$LOGS_PER_COMPANION_LISTING, "companion/{$companion->alias}", 'log');
117
-        }
118
-
119
-        $period_list = PeriodCollector::getPeriodList();
120
-        foreach ($period_list as $period) {
121
-            $this->addURL("period/{$period->alias}/", date('Y-m-01'), self::$LOG_PERIOD_LISTING_CHANGEFREQ, self::$LOG_PERIOD_LISTING_RANK);
122
-            $this->add_paginated_pages($period->count, self::$LOGS_PER_PERIOD_LISTING, "period/{$period->alias}", 'log');
123
-        }
124
-
125
-        $log_list = LogCollector::getList(500);
126
-        foreach ($log_list as $log) {
127
-            $this->addURL("journal/{$log->alias}/", date('Y-m-d', strtotime('last Monday')), self::$LOG_PAGE_CHANGEFREQ, self::$LOG_PAGE_RANK);
128
-        }
129
-    }
130
-
131
-    private function add_about_pages()
132
-    {
133
-        $this->addURL('about/', date('Y-01-01'), self::$ABOUT_PAGE_CHANGEFREQ, self::$ABOUT_PAGE_RANK);
134
-    }
135
-
136
-    private function add_paginated_pages($count, $items_per_page, $base_url, $type)
137
-    {
138
-        switch($type) {
139
-            case 'waterfall':
140
-                $lastmod = date('Y-m-01');
141
-                $changefreq = self::$WATERFALL_LISTING_SUBPAGES_CHANGEFREQ;
142
-                $rank = self::$WATERFALL_LISTING_SUBPAGES_RANK;
143
-                break;
144
-            case 'log':
145
-                $lastmod = date('Y-m-01');
146
-                $changefreq = self::$LOG_LISTING_SUBPAGES_CHANGEFREQ;
147
-                $rank = self::$LOG_LISTING_SUBPAGES_RANK;
148
-                break;
149
-        }
150
-
151
-        for($i = 2; (($i - 1) * $items_per_page) < $count; $i++) {
152
-            $this->addURL("{$base_url}/{$i}/", $lastmod, $changefreq, $rank);
153
-        }
154
-    }
18
+	private static $HOME_PAGE_RANK                      = .9;
19
+
20
+	private static $WATERFALL_LISTING_RANK              = .3;
21
+	private static $WATERFALL_COUNTY_LISTING_RANK       = .6;
22
+	private static $WATERFALL_WATERCOURSE_LISTING_RANK  = .6;
23
+	private static $WATERFALL_LISTING_SUBPAGES_RANK     = .1;
24
+	private static $WATERFALL_PAGE_RANK                 = .8;
25
+
26
+	private static $MAP_PAGE_RANK                       = .6;
27
+
28
+	private static $LOG_LISTING_RANK                    = .3;
29
+	private static $LOG_COMPANION_LISTING_RANK          = .3;
30
+	private static $LOG_PERIOD_LISTING_RANK             = .3;
31
+	private static $LOG_LISTING_SUBPAGES_RANK           = .1;
32
+	private static $LOG_PAGE_RANK                       = .7;
33
+
34
+	private static $ABOUT_PAGE_RANK                     = .6;
35
+
36
+
37
+	private static $HOME_PAGE_CHANGEFREQ                      = 'daily';
38
+
39
+	private static $WATERFALL_LISTING_CHANGEFREQ              = 'monthly';
40
+	private static $WATERFALL_COUNTY_LISTING_CHANGEFREQ       = 'monthly';
41
+	private static $WATERFALL_WATERCOURSE_LISTING_CHANGEFREQ  = 'monthly';
42
+	private static $WATERFALL_LISTING_SUBPAGES_CHANGEFREQ     = 'monthly';
43
+	private static $WATERFALL_PAGE_CHANGEFREQ                 = 'weekly';
44
+
45
+	private static $MAP_PAGE_CHANGEFREQ                       = 'monthly';
46
+
47
+	private static $LOG_LISTING_CHANGEFREQ                    = 'weekly';
48
+	private static $LOG_COMPANION_LISTING_CHANGEFREQ          = 'monthly';
49
+	private static $LOG_PERIOD_LISTING_CHANGEFREQ             = 'monthly';
50
+	private static $LOG_LISTING_SUBPAGES_CHANGEFREQ           = 'monthly';
51
+	private static $LOG_PAGE_CHANGEFREQ                       = 'weekly';
52
+
53
+	private static $ABOUT_PAGE_CHANGEFREQ                     = 'yearly';
54
+
55
+
56
+	private static $WATERFALLS_PER_LISTING              = 24;
57
+	private static $WATERFALLS_PER_COUNTY_LISTING       = 12;
58
+	private static $WATERFALLS_PER_WATERCOURSE_LISTING  = 12;
59
+
60
+	private static $LOGS_PER_LISTING                    = 10;
61
+	private static $LOGS_PER_COMPANION_LISTING          = 10;
62
+	private static $LOGS_PER_PERIOD_LISTING             = 10;
63
+
64
+	protected function set_data()
65
+	{
66
+		$this->add_home_pages();
67
+		$this->add_waterfall_pages();
68
+		$this->add_map_pages();
69
+		$this->add_log_pages();
70
+		$this->add_about_pages();
71
+	}
72
+
73
+	private function add_home_pages()
74
+	{
75
+		$this->addURL('', date('Y-m-d'), self::$HOME_PAGE_CHANGEFREQ, self::$HOME_PAGE_RANK);
76
+	}
77
+
78
+	private function add_waterfall_pages()
79
+	{
80
+		$this->addURL('falls/', date('Y-m-01'), self::$WATERFALL_LISTING_CHANGEFREQ, self::$WATERFALL_LISTING_RANK);
81
+		$count = WaterfallCollector::getListCount();
82
+		$this->add_paginated_pages($count, self::$WATERFALLS_PER_LISTING, 'falls', 'waterfall');
83
+
84
+		$county_list = CountyCollector::getCountyList();
85
+		foreach ($county_list as $county) {
86
+			$this->addURL("{$county->alias}/", date('Y-m-01'), self::$WATERFALL_COUNTY_LISTING_CHANGEFREQ, self::$WATERFALL_COUNTY_LISTING_RANK);
87
+			$this->add_paginated_pages($county->count, self::$WATERFALLS_PER_COUNTY_LISTING, $county->alias, 'waterfall');
88
+		}
89
+
90
+		$watercourse_list = WatercourseCollector::getWatercourseList();
91
+		foreach ($watercourse_list as $watercourse) {
92
+			$this->addURL("{$watercourse->alias}/", date('Y-m-01'), self::$WATERFALL_WATERCOURSE_LISTING_CHANGEFREQ, self::$WATERFALL_WATERCOURSE_LISTING_RANK);
93
+			$this->add_paginated_pages($watercourse->count, self::$WATERFALLS_PER_WATERCOURSE_LISTING, $watercourse->alias, 'waterfall');
94
+		}
95
+
96
+		$waterfall_list = WaterfallCollector::getList(500);
97
+		foreach ($waterfall_list as $waterfall) {
98
+			$this->addURL("{$waterfall->watercourse_alias}/{$waterfall->waterfall_alias}/", date('Y-m-d', strtotime('last Monday')), self::$WATERFALL_PAGE_CHANGEFREQ, self::$WATERFALL_PAGE_RANK);
99
+		}
100
+	}
101
+
102
+	private function add_map_pages()
103
+	{
104
+		$this->addURL('map/', date('Y-m-01'), self::$MAP_PAGE_CHANGEFREQ, self::$MAP_PAGE_RANK);
105
+	}
106
+
107
+	private function add_log_pages()
108
+	{
109
+		$this->addURL('journal/', date('Y-m-d', strtotime('last Monday')), self::$LOG_LISTING_CHANGEFREQ, self::$LOG_LISTING_RANK);
110
+		$count = LogCollector::getListCount();
111
+		$this->add_paginated_pages($count, self::$LOGS_PER_LISTING, 'journal', 'log');
112
+
113
+		$companion_list = CompanionCollector::getCompanionList();
114
+		foreach ($companion_list as $companion) {
115
+			$this->addURL("companion/{$companion->alias}/", date('Y-m-01'), self::$LOG_COMPANION_LISTING_CHANGEFREQ, self::$LOG_COMPANION_LISTING_RANK);
116
+			$this->add_paginated_pages($companion->count, self::$LOGS_PER_COMPANION_LISTING, "companion/{$companion->alias}", 'log');
117
+		}
118
+
119
+		$period_list = PeriodCollector::getPeriodList();
120
+		foreach ($period_list as $period) {
121
+			$this->addURL("period/{$period->alias}/", date('Y-m-01'), self::$LOG_PERIOD_LISTING_CHANGEFREQ, self::$LOG_PERIOD_LISTING_RANK);
122
+			$this->add_paginated_pages($period->count, self::$LOGS_PER_PERIOD_LISTING, "period/{$period->alias}", 'log');
123
+		}
124
+
125
+		$log_list = LogCollector::getList(500);
126
+		foreach ($log_list as $log) {
127
+			$this->addURL("journal/{$log->alias}/", date('Y-m-d', strtotime('last Monday')), self::$LOG_PAGE_CHANGEFREQ, self::$LOG_PAGE_RANK);
128
+		}
129
+	}
130
+
131
+	private function add_about_pages()
132
+	{
133
+		$this->addURL('about/', date('Y-01-01'), self::$ABOUT_PAGE_CHANGEFREQ, self::$ABOUT_PAGE_RANK);
134
+	}
135
+
136
+	private function add_paginated_pages($count, $items_per_page, $base_url, $type)
137
+	{
138
+		switch($type) {
139
+			case 'waterfall':
140
+				$lastmod = date('Y-m-01');
141
+				$changefreq = self::$WATERFALL_LISTING_SUBPAGES_CHANGEFREQ;
142
+				$rank = self::$WATERFALL_LISTING_SUBPAGES_RANK;
143
+				break;
144
+			case 'log':
145
+				$lastmod = date('Y-m-01');
146
+				$changefreq = self::$LOG_LISTING_SUBPAGES_CHANGEFREQ;
147
+				$rank = self::$LOG_LISTING_SUBPAGES_RANK;
148
+				break;
149
+		}
150
+
151
+		for($i = 2; (($i - 1) * $items_per_page) < $count; $i++) {
152
+			$this->addURL("{$base_url}/{$i}/", $lastmod, $changefreq, $rank);
153
+		}
154
+	}
155 155
 
156 156
 }
157 157
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
     private function add_paginated_pages($count, $items_per_page, $base_url, $type)
137 137
     {
138
-        switch($type) {
138
+        switch ($type) {
139 139
             case 'waterfall':
140 140
                 $lastmod = date('Y-m-01');
141 141
                 $changefreq = self::$WATERFALL_LISTING_SUBPAGES_CHANGEFREQ;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                 break;
149 149
         }
150 150
 
151
-        for($i = 2; (($i - 1) * $items_per_page) < $count; $i++) {
151
+        for ($i = 2; (($i - 1) * $items_per_page) < $count; $i++) {
152 152
             $this->addURL("{$base_url}/{$i}/", $lastmod, $changefreq, $rank);
153 153
         }
154 154
     }
Please login to merge, or discard this patch.
utility/Asset.class.inc.php 4 patches
Doc Comments   +15 added lines patch added patch discarded remove patch
@@ -79,6 +79,9 @@  discard block
 block discarded – undo
79 79
 		return $final_files;
80 80
 	}
81 81
 
82
+	/**
83
+	 * @param string $type
84
+	 */
82 85
 	private static function process_simple_pieces($type, $file)
83 86
 	{
84 87
 		$piece_path = self::get_piece_path($type, $file);
@@ -101,6 +104,9 @@  discard block
 block discarded – undo
101 104
 		return self::get_final_link($type, $file_name);
102 105
 	}
103 106
 
107
+	/**
108
+	 * @param string $type
109
+	 */
104 110
 	private static function process_complex_pieces($type, $array)
105 111
 	{
106 112
 		if(in_array(404, $array))
@@ -152,6 +158,9 @@  discard block
 block discarded – undo
152 158
 		return;
153 159
 	}
154 160
 
161
+	/**
162
+	 * @return string
163
+	 */
155 164
 	private static function get_piece_path($type, $file)
156 165
 	{
157 166
 		$path = Loader::getRoot() . "/{$type}/piece/{$file}*";
@@ -162,6 +171,9 @@  discard block
 block discarded – undo
162 171
 		return;
163 172
 	}
164 173
 
174
+	/**
175
+	 * @param string $contents
176
+	 */
165 177
 	private static function make_final_file($type, $contents, $file_name, $exists = false)
166 178
 	{
167 179
 		if($exists)
@@ -213,6 +225,9 @@  discard block
 block discarded – undo
213 225
 		return $path;
214 226
 	}
215 227
 
228
+	/**
229
+	 * @param string $type
230
+	 */
216 231
 	public static function getLastModified($type, $file)
217 232
 	{
218 233
 		$final_path = self::get_final_path($type, $file);
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			switch($piece)
53 53
 			{
54 54
 				case 'jquery-1.4.2' :
55
-                case 'jquery-1.10.2.min' :
55
+				case 'jquery-1.10.2.min' :
56 56
 				case 'jquery-ui-1.8.2' :
57 57
 				case 'ga' :
58 58
 					$simple_pieces[] = $piece;
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 			foreach($array as $file)
119 119
 			{
120 120
 				$piece_path = self::get_piece_path($type, $file);
121
-                $contents .= "/*** {$file} ***/\n\n";
121
+				$contents .= "/*** {$file} ***/\n\n";
122 122
 				$contents .= file_get_contents($piece_path);
123
-                $contents .= "\n\n\n";
123
+				$contents .= "\n\n\n";
124 124
 			}
125 125
 			return self::make_final_file($type, $contents, $site);
126 126
 		}
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 	{
20 20
 		$simple_pieces = array();
21 21
 		$complex_pieces = array();
22
-		foreach($array as $piece)
22
+		foreach ($array as $piece)
23 23
 		{
24
-			switch($piece)
24
+			switch ($piece)
25 25
 			{
26 26
 				case 'global' :
27 27
 					$simple_pieces[] = $piece;
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 			}
33 33
 		}
34 34
 		
35
-		foreach($simple_pieces as $piece)
35
+		foreach ($simple_pieces as $piece)
36 36
 		{
37 37
 			$final_files[] = self::process_simple_pieces('styles', $piece);
38 38
 		}
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 		$complex_pieces = array();
48 48
 		$external_pieces = array();
49 49
 		
50
-		foreach($array as $piece)
50
+		foreach ($array as $piece)
51 51
 		{
52
-			switch($piece)
52
+			switch ($piece)
53 53
 			{
54 54
 				case 'jquery-1.4.2' :
55 55
                 case 'jquery-1.10.2.min' :
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 			}
67 67
 		}
68 68
 		
69
-		foreach($external_pieces as $piece)
69
+		foreach ($external_pieces as $piece)
70 70
 		{
71 71
 			$final_files[] = $piece;
72 72
 		}
73
-		foreach($simple_pieces as $piece)
73
+		foreach ($simple_pieces as $piece)
74 74
 		{
75 75
 			$final_files[] = self::process_simple_pieces('scripts', $piece);
76 76
 		}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		$piece_path = self::get_piece_path($type, $file);
85 85
 		$final_path = self::get_final_path($type, $file);
86 86
 		
87
-		if(!$final_path)
87
+		if (!$final_path)
88 88
 		{
89 89
 			$contents = file_get_contents($piece_path);
90 90
 			return self::make_final_file($type, $contents, $file);
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		
93 93
 		$file_name = substr($final_path, strpos($final_path, $file), strrpos($final_path, '.') - strpos($final_path, $file));
94 94
 		
95
-		if(filemtime($final_path) < filemtime($piece_path))
95
+		if (filemtime($final_path) < filemtime($piece_path))
96 96
 		{
97 97
 			$contents = file_get_contents($piece_path);
98 98
 			return self::make_final_file($type, $contents, $file_name, true);
@@ -103,19 +103,19 @@  discard block
 block discarded – undo
103 103
 
104 104
 	private static function process_complex_pieces($type, $array)
105 105
 	{
106
-		if(in_array(404, $array))
106
+		if (in_array(404, $array))
107 107
 			$site = '404';
108
-		else if(in_array(503, $array))
108
+		else if (in_array(503, $array))
109 109
 			$site = '503';
110 110
 		else
111 111
 			$site = strtolower(URLDecode::getSite());
112 112
 		
113 113
 		$final_path = self::get_final_path($type, $site);
114 114
 		
115
-		if(!$final_path)
115
+		if (!$final_path)
116 116
 		{
117 117
 			$contents = '';
118
-			foreach($array as $file)
118
+			foreach ($array as $file)
119 119
 			{
120 120
 				$piece_path = self::get_piece_path($type, $file);
121 121
                 $contents .= "/*** {$file} ***/\n\n";
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 		
130 130
 		$create_new = false;
131 131
 		$contents = '';
132
-		foreach($array as $file)
132
+		foreach ($array as $file)
133 133
 		{
134 134
 			$piece_path = self::get_piece_path($type, $file);
135 135
 			$contents .= file_get_contents($piece_path);
136
-			if(filemtime($final_path) < filemtime($piece_path))
136
+			if (filemtime($final_path) < filemtime($piece_path))
137 137
 				$create_new = true;
138 138
 		}
139
-		if($create_new)
139
+		if ($create_new)
140 140
 			return self::make_final_file($type, $contents, $file_name, true);
141 141
 		
142 142
 		return self::get_final_link($type, $file_name);
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		$path = Loader::getRoot() . "/{$type}/final/{$file}*";
148 148
 		
149 149
 		$files = glob($path); 
150
-		if(count($files) > 0)
150
+		if (count($files) > 0)
151 151
 			return $files[0];
152 152
 		return;
153 153
 	}
@@ -157,18 +157,18 @@  discard block
 block discarded – undo
157 157
 		$path = Loader::getRoot() . "/{$type}/piece/{$file}*";
158 158
 		
159 159
 		$files = glob($path);
160
-		if(count($files) > 0)
160
+		if (count($files) > 0)
161 161
 			return $files[0];
162 162
 		return;
163 163
 	}
164 164
 
165 165
 	private static function make_final_file($type, $contents, $file_name, $exists = false)
166 166
 	{
167
-		if($exists)
167
+		if ($exists)
168 168
 		{
169 169
 			$old_file = self::get_final_path($type, $file_name);
170 170
 			$version = substr($old_file, strpos($old_file, $file_name));
171
-			if(strpos($version, '-v'))
171
+			if (strpos($version, '-v'))
172 172
 			{
173 173
 				$version = substr($version, strpos($version, '-v'));
174 174
 				$version = substr($version, 2, strpos($version, '.') - 2);
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 		
183 183
 		$path = Loader::getRoot() . "/{$type}/final/{$file_name}";
184 184
 		
185
-		switch($type)
185
+		switch ($type)
186 186
 		{
187 187
 			case 'styles' :
188 188
 				$path .= '.css';
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 		}
194 194
 		
195 195
 		file_put_contents($path, $contents);
196
-		if($exists)
196
+		if ($exists)
197 197
 			unlink($old_file);
198 198
 		Debugger::logMessage("New {$type} file created - {$file_name}.");
199 199
 		return self::get_final_link($type, $file_name);
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
 	private static function get_final_link($type, $file_name)
203 203
 	{
204
-		switch($type)
204
+		switch ($type)
205 205
 		{
206 206
 			case 'styles' :
207 207
 				$path = "/style/{$file_name}.css";
Please login to merge, or discard this patch.
Braces   +24 added lines, -18 removed lines patch added patch discarded remove patch
@@ -103,12 +103,13 @@  discard block
 block discarded – undo
103 103
 
104 104
 	private static function process_complex_pieces($type, $array)
105 105
 	{
106
-		if(in_array(404, $array))
107
-			$site = '404';
108
-		else if(in_array(503, $array))
109
-			$site = '503';
110
-		else
111
-			$site = strtolower(URLDecode::getSite());
106
+		if(in_array(404, $array)) {
107
+					$site = '404';
108
+		} else if(in_array(503, $array)) {
109
+					$site = '503';
110
+		} else {
111
+					$site = strtolower(URLDecode::getSite());
112
+		}
112 113
 		
113 114
 		$final_path = self::get_final_path($type, $site);
114 115
 		
@@ -133,11 +134,13 @@  discard block
 block discarded – undo
133 134
 		{
134 135
 			$piece_path = self::get_piece_path($type, $file);
135 136
 			$contents .= file_get_contents($piece_path);
136
-			if(filemtime($final_path) < filemtime($piece_path))
137
-				$create_new = true;
137
+			if(filemtime($final_path) < filemtime($piece_path)) {
138
+							$create_new = true;
139
+			}
140
+		}
141
+		if($create_new) {
142
+					return self::make_final_file($type, $contents, $file_name, true);
138 143
 		}
139
-		if($create_new)
140
-			return self::make_final_file($type, $contents, $file_name, true);
141 144
 		
142 145
 		return self::get_final_link($type, $file_name);
143 146
 	}
@@ -147,8 +150,9 @@  discard block
 block discarded – undo
147 150
 		$path = Loader::getRoot() . "/{$type}/final/{$file}*";
148 151
 		
149 152
 		$files = glob($path); 
150
-		if(count($files) > 0)
151
-			return $files[0];
153
+		if(count($files) > 0) {
154
+					return $files[0];
155
+		}
152 156
 		return;
153 157
 	}
154 158
 
@@ -157,8 +161,9 @@  discard block
 block discarded – undo
157 161
 		$path = Loader::getRoot() . "/{$type}/piece/{$file}*";
158 162
 		
159 163
 		$files = glob($path);
160
-		if(count($files) > 0)
161
-			return $files[0];
164
+		if(count($files) > 0) {
165
+					return $files[0];
166
+		}
162 167
 		return;
163 168
 	}
164 169
 
@@ -174,9 +179,9 @@  discard block
 block discarded – undo
174 179
 				$version = substr($version, 2, strpos($version, '.') - 2);
175 180
 				$version++;
176 181
 				$file_name = substr($file_name, 0, strpos($file_name, '-v'));
182
+			} else {
183
+							$version = 2;
177 184
 			}
178
-			else
179
-				$version = 2;
180 185
 			$file_name .= "-v{$version}";
181 186
 		}
182 187
 		
@@ -193,8 +198,9 @@  discard block
 block discarded – undo
193 198
 		}
194 199
 		
195 200
 		file_put_contents($path, $contents);
196
-		if($exists)
197
-			unlink($old_file);
201
+		if($exists) {
202
+					unlink($old_file);
203
+		}
198 204
 		Debugger::logMessage("New {$type} file created - {$file_name}.");
199 205
 		return self::get_final_link($type, $file_name);
200 206
 	}
Please login to merge, or discard this patch.
utility/content/AutolinkTwitterURLContent.class.inc.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -37,6 +37,9 @@  discard block
 block discarded – undo
37 37
 		return;
38 38
 	}
39 39
 
40
+	/**
41
+	 * @param string[] $match
42
+	 */
40 43
 	private function get_display_url($match)
41 44
 	{
42 45
 		$display_url = $this->check_for_redirect($match[0]);
@@ -67,6 +70,9 @@  discard block
 block discarded – undo
67 70
 		return $link;
68 71
 	}
69 72
 
73
+	/**
74
+	 * @return string
75
+	 */
70 76
 	private function check_for_redirect($url)
71 77
 	{
72 78
 		$headers = @get_headers($url);
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/AutolinkTwitterUserContent.class.inc.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -35,6 +35,10 @@
 block discarded – undo
35 35
 		return;
36 36
 	}
37 37
 
38
+	/**
39
+	 * @param string $handle_link
40
+	 * @param string $handle_display
41
+	 */
38 42
 	private function get_replacement_link($handle_link, $handle_display)
39 43
 	{
40 44
 		return sprintf(self::$USER_LINK, $handle_link, $handle_display);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
 
11 11
 	protected function execute()
12 12
 	{
13
-		if(stristr($this->content, '@') === false)
13
+		if (stristr($this->content, '@') === false)
14 14
 			return;
15 15
 		
16 16
 		// yeah yeah, i'm currently ignoring the link, whatevs
17 17
 		$parameters = func_get_args();
18
-		if(count($parameters) > 1 || (count($parameters) == 1 && !is_array($parameters[0])))
18
+		if (count($parameters) > 1 || (count($parameters) == 1 && !is_array($parameters[0])))
19 19
 		{
20 20
 			trigger_error('Unexpected parameters passed into AutolinkTwitterUser!');
21 21
 			return;
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 		$parameters = array_shift($parameters);
24 24
 		
25 25
 		$found_user = preg_match_all(self::$USER_PATTERN, $this->content, $matches, PREG_SET_ORDER);
26
-		if($found_user === false || $found_user === 0)
26
+		if ($found_user === false || $found_user === 0)
27 27
 			return;
28 28
 		
29
-		foreach($matches as $match)
29
+		foreach ($matches as $match)
30 30
 		{
31 31
 			$replacement = $this->get_replacement_link($match[1], $match[0]);
32 32
 			$this->content = str_replace($match[0], $replacement, $this->content);
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 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, '@') === false)
14
-			return;
13
+		if(stristr($this->content, '@') === false) {
14
+					return;
15
+		}
15 16
 		
16 17
 		// yeah yeah, i'm currently ignoring the link, whatevs
17 18
 		$parameters = func_get_args();
@@ -23,8 +24,9 @@  discard block
 block discarded – undo
23 24
 		$parameters = array_shift($parameters);
24 25
 		
25 26
 		$found_user = preg_match_all(self::$USER_PATTERN, $this->content, $matches, PREG_SET_ORDER);
26
-		if($found_user === false || $found_user === 0)
27
-			return;
27
+		if($found_user === false || $found_user === 0) {
28
+					return;
29
+		}
28 30
 		
29 31
 		foreach($matches as $match)
30 32
 		{
Please login to merge, or discard this patch.
utility/content/CleanCommentContent.class.inc.php 3 patches
Doc Comments   +14 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);
@@ -54,11 +58,17 @@  discard block
 block discarded – undo
54 58
 		}
55 59
 	}
56 60
 
61
+	/**
62
+	 * @param string|null $text
63
+	 */
57 64
 	private function create_placeholder($text)
58 65
 	{
59 66
 		return md5($text . rand());
60 67
 	}
61 68
 
69
+	/**
70
+	 * @param string|null $text
71
+	 */
62 72
 	private function create_full_match_pattern($text)
63 73
 	{
64 74
 		$pattern = '';
@@ -75,6 +85,10 @@  discard block
 block discarded – undo
75 85
 		$this->content = strip_tags($this->content);
76 86
 	}
77 87
 
88
+	/**
89
+	 * @param string $pattern
90
+	 * @param string $replace
91
+	 */
78 92
 	private function link_unlinked_urls($pattern, $replace)
79 93
 	{
80 94
 		$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/FetchFirstPhotoContent.class.inc.php 3 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -24,6 +24,11 @@
 block discarded – undo
24 24
 		return Loader::getImagePath('photo', $path);
25 25
 	}
26 26
 
27
+	/**
28
+	 * @param string $string
29
+	 * @param boolean $is_absolute
30
+	 * @param string $size
31
+	 */
27 32
 	private function get_thumb($string, $is_absolute, $size)
28 33
 	{
29 34
 		list($category, $file_name) = explode('/', $string);
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 	protected function execute($is_absolute = false, $size = 'thumb')
13 13
 	{
14
-		if(preg_match(self::$PHOTO_PLACEHOLDER_MATCH, $this->content, $match) === 1)
14
+		if (preg_match(self::$PHOTO_PLACEHOLDER_MATCH, $this->content, $match) === 1)
15 15
 			$this->content = $this->get_thumb($match[1], $is_absolute, $size);
16 16
 		else
17 17
 			$this->content = self::$DEFAULT_RETURN;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		
35 35
 		Loader::load('collector', 'image/PhotoCollector');
36 36
 		$photo_result = PhotoCollector::fetchRow($category, $photo);
37
-		if($photo_result == false)
37
+		if ($photo_result == false)
38 38
 			return '';
39 39
 		
40 40
 		$height = $file_size[1];
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		$description = $photo_result->description;
43 43
 		
44 44
 		$domain = '/';
45
-		if($is_absolute)
45
+		if ($is_absolute)
46 46
 			$domain = Loader::getRootUrl();
47 47
 		
48 48
 		return sprintf(self::$IMAGE_NODE, $domain, $category, $photo, $size, $extension, $height, $width, $description);
Please login to merge, or discard this patch.
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,10 +11,11 @@  discard block
 block discarded – undo
11 11
 
12 12
 	protected function execute($is_absolute = false, $size = 'thumb')
13 13
 	{
14
-		if(preg_match(self::$PHOTO_PLACEHOLDER_MATCH, $this->content, $match) === 1)
15
-			$this->content = $this->get_thumb($match[1], $is_absolute, $size);
16
-		else
17
-			$this->content = self::$DEFAULT_RETURN;
14
+		if(preg_match(self::$PHOTO_PLACEHOLDER_MATCH, $this->content, $match) === 1) {
15
+					$this->content = $this->get_thumb($match[1], $is_absolute, $size);
16
+		} else {
17
+					$this->content = self::$DEFAULT_RETURN;
18
+		}
18 19
 		return;
19 20
 	}
20 21
 
@@ -34,16 +35,18 @@  discard block
 block discarded – undo
34 35
 		
35 36
 		Loader::load('collector', 'image/PhotoCollector');
36 37
 		$photo_result = PhotoCollector::fetchRow($category, $photo);
37
-		if($photo_result == false)
38
-			return '';
38
+		if($photo_result == false) {
39
+					return '';
40
+		}
39 41
 		
40 42
 		$height = $file_size[1];
41 43
 		$width = $file_size[0];
42 44
 		$description = $photo_result->description;
43 45
 		
44 46
 		$domain = '/';
45
-		if($is_absolute)
46
-			$domain = Loader::getRootUrl();
47
+		if($is_absolute) {
48
+					$domain = Loader::getRootUrl();
49
+		}
47 50
 		
48 51
 		return sprintf(self::$IMAGE_NODE, $domain, $category, $photo, $size, $extension, $height, $width, $description);
49 52
 	}
Please login to merge, or discard this patch.