Completed
Push — master ( 37f1fc...bff11b )
by Jacob
08:53
created
controller/AJAXController.class.inc.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 
29 29
 	protected function set_response($message, $type = 'internal')
30 30
 	{
31
-		switch($type)
31
+		switch ($type)
32 32
 		{
33 33
 			case 'internal' :
34 34
 				$this->response['internal'] = $message;
Please login to merge, or discard this patch.
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -1,60 +1,60 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 Loader::load('utility', array(
4
-	'Header',
5
-	'Request'));
4
+    'Header',
5
+    'Request'));
6 6
 
7 7
 abstract class AJAXController
8 8
 {
9 9
 
10
-	private static $RESPONSE_HEADER = 'sendJSON';
10
+    private static $RESPONSE_HEADER = 'sendJSON';
11 11
 
12
-	private $response = array();
12
+    private $response = array();
13 13
 
14
-	abstract protected function set_data();
14
+    abstract protected function set_data();
15 15
 
16
-	function __construct() {}
16
+    function __construct() {}
17 17
 
18
-	public function activate()
19
-	{
20
-		call_user_func(array('Header', self::$RESPONSE_HEADER));
18
+    public function activate()
19
+    {
20
+        call_user_func(array('Header', self::$RESPONSE_HEADER));
21 21
 		
22
-		$this->set_data();
23
-		echo $this->response_as_json();
24
-	}
25
-
26
-	protected function set_response($message, $type = 'internal')
27
-	{
28
-		switch($type)
29
-		{
30
-			case 'internal' :
31
-				$this->response['internal'] = $message;
32
-			break;
33
-			case 'error' :
34
-				$this->response['error'] = $message;
35
-			default :
36
-				$this->response[$type] = $message;
37
-			break;
38
-		}
39
-	}
40
-
41
-	protected function fail_response($message)
42
-	{
43
-		$this->set_response($message, 'error');
44
-		return false;
45
-	}
46
-
47
-	protected function eject($message)
48
-	{
49
-		$this->fail_response($message);
50
-		echo $this->response_as_json();
51
-		exit();
52
-	}
53
-
54
-	private function response_as_json()
55
-	{
56
-		return json_encode($this->response);
57
-	}
22
+        $this->set_data();
23
+        echo $this->response_as_json();
24
+    }
25
+
26
+    protected function set_response($message, $type = 'internal')
27
+    {
28
+        switch($type)
29
+        {
30
+            case 'internal' :
31
+                $this->response['internal'] = $message;
32
+            break;
33
+            case 'error' :
34
+                $this->response['error'] = $message;
35
+            default :
36
+                $this->response[$type] = $message;
37
+            break;
38
+        }
39
+    }
40
+
41
+    protected function fail_response($message)
42
+    {
43
+        $this->set_response($message, 'error');
44
+        return false;
45
+    }
46
+
47
+    protected function eject($message)
48
+    {
49
+        $this->fail_response($message);
50
+        echo $this->response_as_json();
51
+        exit();
52
+    }
53
+
54
+    private function response_as_json()
55
+    {
56
+        return json_encode($this->response);
57
+    }
58 58
 
59 59
 }
60 60
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -13 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 	'Header',
5 5
 	'Request'));
6 6
 
7
-abstract class AJAXController
8
-{
7
+abstract class AJAXController
8
+{
9 9
 
10 10
 	private static $RESPONSE_HEADER = 'sendJSON';
11 11
 
@@ -13,18 +13,20 @@  discard block
 block discarded – undo
13 13
 
14 14
 	abstract protected function set_data();
15 15
 
16
-	function __construct() {}
16
+	function __construct()
17
+	{
18
+}
17 19
 
18
-	public function activate()
19
-	{
20
+	public function activate()
21
+	{
20 22
 		call_user_func(array('Header', self::$RESPONSE_HEADER));
21 23
 		
22 24
 		$this->set_data();
23 25
 		echo $this->response_as_json();
24 26
 	}
25 27
 
26
-	protected function set_response($message, $type = 'internal')
27
-	{
28
+	protected function set_response($message, $type = 'internal')
29
+	{
28 30
 		switch($type)
29 31
 		{
30 32
 			case 'internal' :
@@ -38,21 +40,21 @@  discard block
 block discarded – undo
38 40
 		}
39 41
 	}
40 42
 
41
-	protected function fail_response($message)
42
-	{
43
+	protected function fail_response($message)
44
+	{
43 45
 		$this->set_response($message, 'error');
44 46
 		return false;
45 47
 	}
46 48
 
47
-	protected function eject($message)
48
-	{
49
+	protected function eject($message)
50
+	{
49 51
 		$this->fail_response($message);
50 52
 		echo $this->response_as_json();
51 53
 		exit();
52 54
 	}
53 55
 
54
-	private function response_as_json()
55
-	{
56
+	private function response_as_json()
57
+	{
56 58
 		return json_encode($this->response);
57 59
 	}
58 60
 
Please login to merge, or discard this patch.
controller/lifestream/DefaultListController.class.inc.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,11 +55,11 @@
 block discarded – undo
55 55
 	final private function get_list_posts()
56 56
 	{
57 57
 		$post_array = array();
58
-		foreach($this->get_list_results() as $post)
58
+		foreach ($this->get_list_results() as $post)
59 59
 		{
60 60
 			$post_array[] = $this->expand_post($post, 'full');
61 61
 		}
62
-		if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search')
62
+		if (count($post_array) < 1 && URLDecode::getPiece(1) !== 'search')
63 63
 			$this->eject();
64 64
 		return $post_array;
65 65
 	}
Please login to merge, or discard this patch.
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -5,63 +5,63 @@
 block discarded – undo
5 5
 abstract class DefaultListController extends DefaultPageController
6 6
 {
7 7
 
8
-	protected static $POSTS_PER_PAGE = 15;
8
+    protected static $POSTS_PER_PAGE = 15;
9 9
 
10
-	protected $page;
11
-	protected $offset;
10
+    protected $page;
11
+    protected $offset;
12 12
 
13
-	public function __construct()
14
-	{
15
-		parent::__construct();
13
+    public function __construct()
14
+    {
15
+        parent::__construct();
16 16
 
17
-		$this->page = $this->get_page_number();
18
-		$this->offset = ($this->page - 1) * self::$POSTS_PER_PAGE;
19
-	}
17
+        $this->page = $this->get_page_number();
18
+        $this->offset = ($this->page - 1) * self::$POSTS_PER_PAGE;
19
+    }
20 20
 
21
-	abstract protected function get_page_number();
22
-	abstract protected function get_list_results();
23
-	abstract protected function get_list_description();
24
-	abstract protected function get_list_next_link();
25
-	abstract protected function get_list_prev_link();
26
-	abstract protected function get_total_post_count();
21
+    abstract protected function get_page_number();
22
+    abstract protected function get_list_results();
23
+    abstract protected function get_list_description();
24
+    abstract protected function get_list_next_link();
25
+    abstract protected function get_list_prev_link();
26
+    abstract protected function get_total_post_count();
27 27
 
28
-	protected function set_head_data()
29
-	{
30
-		parent::set_head_data();
28
+    protected function set_head_data()
29
+    {
30
+        parent::set_head_data();
31 31
 		
32
-		$this->set_head('next_link', $this->get_list_next_link());
33
-		$this->set_head('previous_link', $this->get_list_prev_link());
34
-	}
32
+        $this->set_head('next_link', $this->get_list_next_link());
33
+        $this->set_head('previous_link', $this->get_list_prev_link());
34
+    }
35 35
 
36
-	protected function set_body_data()
37
-	{
38
-		parent::set_body_data();
36
+    protected function set_body_data()
37
+    {
38
+        parent::set_body_data();
39 39
 		
40
-		$this->set_body('view', 'Listing');
41
-		$this->set_body('data', $this->get_list_body_data());
42
-	}
40
+        $this->set_body('view', 'Listing');
41
+        $this->set_body('data', $this->get_list_body_data());
42
+    }
43 43
 
44
-	final private function get_list_body_data()
45
-	{
46
-		return array(
47
-			'posts' => $this->get_list_posts(),
48
-			'type' => 'list',
49
-			'pagination' => array(
50
-				'description' => $this->get_list_description(),
51
-				'next' => $this->get_list_next_link(),
52
-				'prev' => $this->get_list_prev_link()));
53
-	}
44
+    final private function get_list_body_data()
45
+    {
46
+        return array(
47
+            'posts' => $this->get_list_posts(),
48
+            'type' => 'list',
49
+            'pagination' => array(
50
+                'description' => $this->get_list_description(),
51
+                'next' => $this->get_list_next_link(),
52
+                'prev' => $this->get_list_prev_link()));
53
+    }
54 54
 
55
-	final private function get_list_posts()
56
-	{
57
-		$post_array = array();
58
-		foreach($this->get_list_results() as $post)
59
-		{
60
-			$post_array[] = $this->expand_post($post, 'full');
61
-		}
62
-		if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search')
63
-			$this->eject();
64
-		return $post_array;
65
-	}
55
+    final private function get_list_posts()
56
+    {
57
+        $post_array = array();
58
+        foreach($this->get_list_results() as $post)
59
+        {
60
+            $post_array[] = $this->expand_post($post, 'full');
61
+        }
62
+        if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search')
63
+            $this->eject();
64
+        return $post_array;
65
+    }
66 66
 
67 67
 }
Please login to merge, or discard this patch.
Braces   +15 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,16 +2,16 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('controller', 'lifestream/DefaultPageController');
4 4
 
5
-abstract class DefaultListController extends DefaultPageController
6
-{
5
+abstract class DefaultListController extends DefaultPageController
6
+{
7 7
 
8 8
 	protected static $POSTS_PER_PAGE = 15;
9 9
 
10 10
 	protected $page;
11 11
 	protected $offset;
12 12
 
13
-	public function __construct()
14
-	{
13
+	public function __construct()
14
+	{
15 15
 		parent::__construct();
16 16
 
17 17
 		$this->page = $this->get_page_number();
@@ -25,24 +25,24 @@  discard block
 block discarded – undo
25 25
 	abstract protected function get_list_prev_link();
26 26
 	abstract protected function get_total_post_count();
27 27
 
28
-	protected function set_head_data()
29
-	{
28
+	protected function set_head_data()
29
+	{
30 30
 		parent::set_head_data();
31 31
 		
32 32
 		$this->set_head('next_link', $this->get_list_next_link());
33 33
 		$this->set_head('previous_link', $this->get_list_prev_link());
34 34
 	}
35 35
 
36
-	protected function set_body_data()
37
-	{
36
+	protected function set_body_data()
37
+	{
38 38
 		parent::set_body_data();
39 39
 		
40 40
 		$this->set_body('view', 'Listing');
41 41
 		$this->set_body('data', $this->get_list_body_data());
42 42
 	}
43 43
 
44
-	final private function get_list_body_data()
45
-	{
44
+	final private function get_list_body_data()
45
+	{
46 46
 		return array(
47 47
 			'posts' => $this->get_list_posts(),
48 48
 			'type' => 'list',
@@ -52,15 +52,16 @@  discard block
 block discarded – undo
52 52
 				'prev' => $this->get_list_prev_link()));
53 53
 	}
54 54
 
55
-	final private function get_list_posts()
56
-	{
55
+	final private function get_list_posts()
56
+	{
57 57
 		$post_array = array();
58 58
 		foreach($this->get_list_results() as $post)
59 59
 		{
60 60
 			$post_array[] = $this->expand_post($post, 'full');
61 61
 		}
62
-		if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search')
63
-			$this->eject();
62
+		if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') {
63
+					$this->eject();
64
+		}
64 65
 		return $post_array;
65 66
 	}
66 67
 
Please login to merge, or discard this patch.
controller/waterfalls/DefaultLogListController.class.inc.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		$companion_result = CompanionCollector::getCompanionList();
43 43
 		$companion_list = array();
44 44
 		
45
-		foreach($companion_result as $companion_row)
45
+		foreach ($companion_result as $companion_row)
46 46
 		{
47 47
 			$companion = new stdclass();
48 48
 			$companion->name = $companion_row->name;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		$period_result = PeriodCollector::getPeriodList();
56 56
 		$period_list = array();
57 57
 		
58
-		foreach($period_result as $period_row)
58
+		foreach ($period_result as $period_row)
59 59
 		{
60 60
 			$period = new stdclass();
61 61
 			$period->name = $period_row->name;
Please login to merge, or discard this patch.
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,23 +7,23 @@  discard block
 block discarded – undo
7 7
 	'waterfall/PeriodCollector'));
8 8
 Loader::load('controller', 'waterfalls/DefaultListController');
9 9
 
10
-abstract class DefaultLogListController extends DefaultListController
11
-{
10
+abstract class DefaultLogListController extends DefaultListController
11
+{
12 12
 
13 13
 	private static $ITEM_COUNT_PER_PAGE = 10;
14 14
 
15
-	final protected function get_list_view()
16
-	{
15
+	final protected function get_list_view()
16
+	{
17 17
 		return 'LogListing';
18 18
 	}
19 19
 
20
-	final protected function get_item_count_per_page()
21
-	{
20
+	final protected function get_item_count_per_page()
21
+	{
22 22
 		return self::$ITEM_COUNT_PER_PAGE;
23 23
 	}
24 24
 
25
-	final protected function format_item($item)
26
-	{
25
+	final protected function format_item($item)
26
+	{
27 27
 		$item_array = array();
28 28
 		
29 29
 		$item_array['title'] = $item->title;
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 		return $item_array;
38 38
 	}
39 39
 
40
-	final protected function get_sidebar()
41
-	{
40
+	final protected function get_sidebar()
41
+	{
42 42
 		$companion_result = CompanionCollector::getCompanionList();
43 43
 		$companion_list = array();
44 44
 		
Please login to merge, or discard this patch.
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -1,72 +1,72 @@
 block discarded – undo
1 1
 <?
2 2
 
3 3
 Loader::load('collector', array(
4
-	'waterfall/CompanionCollector',
5
-	'waterfall/LogCollector',
6
-	'waterfall/PeriodCollector'));
4
+    'waterfall/CompanionCollector',
5
+    'waterfall/LogCollector',
6
+    'waterfall/PeriodCollector'));
7 7
 Loader::load('controller', 'waterfalls/DefaultListController');
8 8
 
9 9
 abstract class DefaultLogListController extends DefaultListController
10 10
 {
11 11
 
12
-	private static $ITEM_COUNT_PER_PAGE = 10;
12
+    private static $ITEM_COUNT_PER_PAGE = 10;
13 13
 
14
-	final protected function get_list_view()
15
-	{
16
-		return 'LogListing';
17
-	}
14
+    final protected function get_list_view()
15
+    {
16
+        return 'LogListing';
17
+    }
18 18
 
19
-	final protected function get_item_count_per_page()
20
-	{
21
-		return self::$ITEM_COUNT_PER_PAGE;
22
-	}
19
+    final protected function get_item_count_per_page()
20
+    {
21
+        return self::$ITEM_COUNT_PER_PAGE;
22
+    }
23 23
 
24
-	final protected function format_item($item)
25
-	{
26
-		$item_array = array();
24
+    final protected function format_item($item)
25
+    {
26
+        $item_array = array();
27 27
 		
28
-		$item_array['title'] = $item->title;
29
-		$item_array['image'] = $this->get_image_element($item->photo_category, $item->photo, $item->photo_description);
30
-		$item_array['waterfall_list'] = LogCollector::getWaterfallListForLog($item->id);
31
-		$item_array['introduction'] = $item->introduction;
32
-		$item_array['path'] = "/journal/{$item->alias}/";
33
-		$item_array['comment_count'] = 0; // todo - this
34
-		$item_array['date'] = $this->get_parsed_date($item->date);
28
+        $item_array['title'] = $item->title;
29
+        $item_array['image'] = $this->get_image_element($item->photo_category, $item->photo, $item->photo_description);
30
+        $item_array['waterfall_list'] = LogCollector::getWaterfallListForLog($item->id);
31
+        $item_array['introduction'] = $item->introduction;
32
+        $item_array['path'] = "/journal/{$item->alias}/";
33
+        $item_array['comment_count'] = 0; // todo - this
34
+        $item_array['date'] = $this->get_parsed_date($item->date);
35 35
 		
36
-		return $item_array;
37
-	}
36
+        return $item_array;
37
+    }
38 38
 
39
-	final protected function get_sidebar()
40
-	{
41
-		$companion_result = CompanionCollector::getCompanionList();
42
-		$companion_list = array();
39
+    final protected function get_sidebar()
40
+    {
41
+        $companion_result = CompanionCollector::getCompanionList();
42
+        $companion_list = array();
43 43
 		
44
-		foreach($companion_result as $companion_row)
45
-		{
46
-			$companion = new stdclass();
47
-			$companion->name = $companion_row->name;
48
-			$companion->uri = "/companion/{$companion_row->alias}/";
49
-			$companion->count = $companion_row->count;
44
+        foreach($companion_result as $companion_row)
45
+        {
46
+            $companion = new stdclass();
47
+            $companion->name = $companion_row->name;
48
+            $companion->uri = "/companion/{$companion_row->alias}/";
49
+            $companion->count = $companion_row->count;
50 50
 			
51
-			$companion_list[] = $companion;
52
-		}
51
+            $companion_list[] = $companion;
52
+        }
53 53
 		
54
-		$period_result = PeriodCollector::getPeriodList();
55
-		$period_list = array();
54
+        $period_result = PeriodCollector::getPeriodList();
55
+        $period_list = array();
56 56
 		
57
-		foreach($period_result as $period_row)
58
-		{
59
-			$period = new stdclass();
60
-			$period->name = $period_row->name;
61
-			$period->uri = "/period/{$period_row->alias}/";
62
-			$period->count = $period_row->count;
57
+        foreach($period_result as $period_row)
58
+        {
59
+            $period = new stdclass();
60
+            $period->name = $period_row->name;
61
+            $period->uri = "/period/{$period_row->alias}/";
62
+            $period->count = $period_row->count;
63 63
 			
64
-			$period_list[] = $period;
65
-		}
64
+            $period_list[] = $period;
65
+        }
66 66
 		
67
-		return array(
68
-			'companion_list' => $companion_list,
69
-			'period_list' => $period_list);
70
-	}
67
+        return array(
68
+            'companion_list' => $companion_list,
69
+            'period_list' => $period_list);
70
+    }
71 71
 
72 72
 }
Please login to merge, or discard this patch.
controller/waterfalls/SearchListController.class.inc.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 	protected function get_page_number()
28 28
 	{
29 29
 		$page = URLDecode::getPiece(2);
30
-		if(isset($page) && is_numeric($page))
30
+		if (isset($page) && is_numeric($page))
31 31
 			return $page;
32 32
 		return 1;
33 33
 	}
Please login to merge, or discard this patch.
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -5,62 +5,62 @@
 block discarded – undo
5 5
 final class SearchListController extends DefaultListController
6 6
 {
7 7
 
8
-	private static $TITLE = 'Search Listing';
9
-	private static $DESCRIPTION = '';
8
+    private static $TITLE = 'Search Listing';
9
+    private static $DESCRIPTION = '';
10 10
 
11
-	private static $KEYWORD_ARRAY = array();
11
+    private static $KEYWORD_ARRAY = array();
12 12
 
13
-	protected function set_head_data()
14
-	{
15
-		parent::set_head_data();
13
+    protected function set_head_data()
14
+    {
15
+        parent::set_head_data();
16 16
 		
17
-		$this->set_title(self::$TITLE);
18
-		$this->set_description(self::$DESCRIPTION);
19
-		$this->set_keywords(self::$KEYWORD_ARRAY);
20
-	}
17
+        $this->set_title(self::$TITLE);
18
+        $this->set_description(self::$DESCRIPTION);
19
+        $this->set_keywords(self::$KEYWORD_ARRAY);
20
+    }
21 21
 
22
-	protected function get_introduction()
23
-	{
24
-		return;
25
-	}
22
+    protected function get_introduction()
23
+    {
24
+        return;
25
+    }
26 26
 
27
-	protected function get_page_number()
28
-	{
29
-		$page = URLDecode::getPiece(2);
30
-		if(isset($page) && is_numeric($page))
31
-			return $page;
32
-		return 1;
33
-	}
27
+    protected function get_page_number()
28
+    {
29
+        $page = URLDecode::getPiece(2);
30
+        if(isset($page) && is_numeric($page))
31
+            return $page;
32
+        return 1;
33
+    }
34 34
 
35
-	protected function get_items()
36
-	{
37
-		return array();
38
-	}
35
+    protected function get_items()
36
+    {
37
+        return array();
38
+    }
39 39
 
40
-	protected function get_list_description()
41
-	{
42
-		return 'yay cloud';
43
-	}
40
+    protected function get_list_description()
41
+    {
42
+        return 'yay cloud';
43
+    }
44 44
 
45
-	protected function get_list_next_link()
46
-	{
47
-		return '/';
48
-	}
45
+    protected function get_list_next_link()
46
+    {
47
+        return '/';
48
+    }
49 49
 
50
-	protected function get_list_prev_link()
51
-	{
52
-		return '/';
53
-	}
50
+    protected function get_list_prev_link()
51
+    {
52
+        return '/';
53
+    }
54 54
 
55
-	private $total_post_count;
56
-	protected function get_item_count()
57
-	{
58
-		return 20;
59
-	}
55
+    private $total_post_count;
56
+    protected function get_item_count()
57
+    {
58
+        return 20;
59
+    }
60 60
 
61
-	protected function get_item_count_per_page()
62
-	{
63
-		return 20;
64
-	}
61
+    protected function get_item_count_per_page()
62
+    {
63
+        return 20;
64
+    }
65 65
 
66 66
 }
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +23 added lines, -22 removed lines patch added patch discarded remove patch
@@ -2,16 +2,16 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('controller', 'waterfalls/DefaultListController');
4 4
 
5
-final class SearchListController extends DefaultListController
6
-{
5
+final class SearchListController extends DefaultListController
6
+{
7 7
 
8 8
 	private static $TITLE = 'Search Listing';
9 9
 	private static $DESCRIPTION = '';
10 10
 
11 11
 	private static $KEYWORD_ARRAY = array();
12 12
 
13
-	protected function set_head_data()
14
-	{
13
+	protected function set_head_data()
14
+	{
15 15
 		parent::set_head_data();
16 16
 		
17 17
 		$this->set_title(self::$TITLE);
@@ -19,47 +19,48 @@  discard block
 block discarded – undo
19 19
 		$this->set_keywords(self::$KEYWORD_ARRAY);
20 20
 	}
21 21
 
22
-	protected function get_introduction()
23
-	{
22
+	protected function get_introduction()
23
+	{
24 24
 		return;
25 25
 	}
26 26
 
27
-	protected function get_page_number()
28
-	{
27
+	protected function get_page_number()
28
+	{
29 29
 		$page = URLDecode::getPiece(2);
30
-		if(isset($page) && is_numeric($page))
31
-			return $page;
30
+		if(isset($page) && is_numeric($page)) {
31
+					return $page;
32
+		}
32 33
 		return 1;
33 34
 	}
34 35
 
35
-	protected function get_items()
36
-	{
36
+	protected function get_items()
37
+	{
37 38
 		return array();
38 39
 	}
39 40
 
40
-	protected function get_list_description()
41
-	{
41
+	protected function get_list_description()
42
+	{
42 43
 		return 'yay cloud';
43 44
 	}
44 45
 
45
-	protected function get_list_next_link()
46
-	{
46
+	protected function get_list_next_link()
47
+	{
47 48
 		return '/';
48 49
 	}
49 50
 
50
-	protected function get_list_prev_link()
51
-	{
51
+	protected function get_list_prev_link()
52
+	{
52 53
 		return '/';
53 54
 	}
54 55
 
55 56
 	private $total_post_count;
56
-	protected function get_item_count()
57
-	{
57
+	protected function get_item_count()
58
+	{
58 59
 		return 20;
59 60
 	}
60 61
 
61
-	protected function get_item_count_per_page()
62
-	{
62
+	protected function get_item_count_per_page()
63
+	{
63 64
 		return 20;
64 65
 	}
65 66
 
Please login to merge, or discard this patch.
controller/waterfalls/DefaultWaterfallListController.class.inc.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		$county_result = CountyCollector::getCountyList();
42 42
 		$county_list = array();
43 43
 		
44
-		foreach($county_result as $county_row)
44
+		foreach ($county_result as $county_row)
45 45
 		{
46 46
 			$county = new stdclass();
47 47
 			$county->name = $county_row->name;
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		$watercourse_result = WatercourseCollector::getWatercourseList();
55 55
 		$watercourse_list = array();
56 56
 		
57
-		foreach($watercourse_result as $watercourse_row)
57
+		foreach ($watercourse_result as $watercourse_row)
58 58
 		{
59 59
 			$watercourse = new stdclass();
60 60
 			$watercourse->name = $watercourse_row->name;
Please login to merge, or discard this patch.
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,23 +7,23 @@  discard block
 block discarded – undo
7 7
 	'waterfall/WaterfallCollector'));
8 8
 Loader::load('controller', 'waterfalls/DefaultListController');
9 9
 
10
-abstract class DefaultWaterfallListController extends DefaultListController
11
-{
10
+abstract class DefaultWaterfallListController extends DefaultListController
11
+{
12 12
 
13 13
 	protected static $ITEM_COUNT_PER_PAGE = 24;
14 14
 
15
-	final protected function get_list_view()
16
-	{
15
+	final protected function get_list_view()
16
+	{
17 17
 		return 'FallListing';
18 18
 	}
19 19
 
20
-	protected function get_item_count_per_page()
21
-	{
20
+	protected function get_item_count_per_page()
21
+	{
22 22
 		return self::$ITEM_COUNT_PER_PAGE;
23 23
 	}
24 24
 
25
-	final protected function format_item($item)
26
-	{
25
+	final protected function format_item($item)
26
+	{
27 27
 		$item_array = array();
28 28
 		
29 29
 		$item_array['name'] = $item->name;
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 		return $item_array;
37 37
 	}
38 38
 
39
-	final protected function get_sidebar()
40
-	{
39
+	final protected function get_sidebar()
40
+	{
41 41
 		$county_result = CountyCollector::getCountyList();
42 42
 		$county_list = array();
43 43
 		
Please login to merge, or discard this patch.
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -1,71 +1,71 @@
 block discarded – undo
1 1
 <?
2 2
 
3 3
 Loader::load('collector', array(
4
-	'waterfall/CountyCollector',
5
-	'waterfall/WatercourseCollector',
6
-	'waterfall/WaterfallCollector'));
4
+    'waterfall/CountyCollector',
5
+    'waterfall/WatercourseCollector',
6
+    'waterfall/WaterfallCollector'));
7 7
 Loader::load('controller', 'waterfalls/DefaultListController');
8 8
 
9 9
 abstract class DefaultWaterfallListController extends DefaultListController
10 10
 {
11 11
 
12
-	protected static $ITEM_COUNT_PER_PAGE = 24;
12
+    protected static $ITEM_COUNT_PER_PAGE = 24;
13 13
 
14
-	final protected function get_list_view()
15
-	{
16
-		return 'FallListing';
17
-	}
14
+    final protected function get_list_view()
15
+    {
16
+        return 'FallListing';
17
+    }
18 18
 
19
-	protected function get_item_count_per_page()
20
-	{
21
-		return self::$ITEM_COUNT_PER_PAGE;
22
-	}
19
+    protected function get_item_count_per_page()
20
+    {
21
+        return self::$ITEM_COUNT_PER_PAGE;
22
+    }
23 23
 
24
-	final protected function format_item($item)
25
-	{
26
-		$item_array = array();
24
+    final protected function format_item($item)
25
+    {
26
+        $item_array = array();
27 27
 		
28
-		$item_array['name'] = $item->name;
29
-		$item_array['watercourse'] = $item->watercourse;
30
-		$item_array['county'] = $item->county;
31
-		$item_array['image'] = $this->get_image_element($item->photo_category, $item->photo, $item->photo_description, 'medium');
32
-		$item_array['path'] = "/{$item->watercourse_alias}/{$item->waterfall_alias}/";
33
-		$item_array['comment_count'] = 0; // todo this
28
+        $item_array['name'] = $item->name;
29
+        $item_array['watercourse'] = $item->watercourse;
30
+        $item_array['county'] = $item->county;
31
+        $item_array['image'] = $this->get_image_element($item->photo_category, $item->photo, $item->photo_description, 'medium');
32
+        $item_array['path'] = "/{$item->watercourse_alias}/{$item->waterfall_alias}/";
33
+        $item_array['comment_count'] = 0; // todo this
34 34
 		
35
-		return $item_array;
36
-	}
35
+        return $item_array;
36
+    }
37 37
 
38
-	final protected function get_sidebar()
39
-	{
40
-		$county_result = CountyCollector::getCountyList();
41
-		$county_list = array();
38
+    final protected function get_sidebar()
39
+    {
40
+        $county_result = CountyCollector::getCountyList();
41
+        $county_list = array();
42 42
 		
43
-		foreach($county_result as $county_row)
44
-		{
45
-			$county = new stdclass();
46
-			$county->name = $county_row->name;
47
-			$county->uri = "/{$county_row->alias}/";
48
-			$county->count = $county_row->count;
43
+        foreach($county_result as $county_row)
44
+        {
45
+            $county = new stdclass();
46
+            $county->name = $county_row->name;
47
+            $county->uri = "/{$county_row->alias}/";
48
+            $county->count = $county_row->count;
49 49
 			
50
-			$county_list[] = $county;
51
-		}
50
+            $county_list[] = $county;
51
+        }
52 52
 		
53
-		$watercourse_result = WatercourseCollector::getWatercourseList();
54
-		$watercourse_list = array();
53
+        $watercourse_result = WatercourseCollector::getWatercourseList();
54
+        $watercourse_list = array();
55 55
 		
56
-		foreach($watercourse_result as $watercourse_row)
57
-		{
58
-			$watercourse = new stdclass();
59
-			$watercourse->name = $watercourse_row->name;
60
-			$watercourse->uri = "/{$watercourse_row->alias}/";
61
-			$watercourse->count = $watercourse_row->count;
56
+        foreach($watercourse_result as $watercourse_row)
57
+        {
58
+            $watercourse = new stdclass();
59
+            $watercourse->name = $watercourse_row->name;
60
+            $watercourse->uri = "/{$watercourse_row->alias}/";
61
+            $watercourse->count = $watercourse_row->count;
62 62
 			
63
-			$watercourse_list[] = $watercourse;
64
-		}
63
+            $watercourse_list[] = $watercourse;
64
+        }
65 65
 		
66
-		return array(
67
-			'county_list' => $county_list,
68
-			'watercourse_list' => $watercourse_list);
69
-	}
66
+        return array(
67
+            'county_list' => $county_list,
68
+            'watercourse_list' => $watercourse_list);
69
+    }
70 70
 
71 71
 }
Please login to merge, or discard this patch.
controller/blog/DefaultListController.class.inc.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,11 +56,11 @@
 block discarded – undo
56 56
 	final private function get_list_posts()
57 57
 	{
58 58
 		$post_array = array();
59
-		foreach($this->get_list_results() as $post)
59
+		foreach ($this->get_list_results() as $post)
60 60
 		{
61 61
 			$post_array[] = $this->format_post($post, true);
62 62
 		}
63
-		if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search')
63
+		if (count($post_array) < 1 && URLDecode::getPiece(1) !== 'search')
64 64
 			$this->eject();
65 65
 		return $post_array;
66 66
 	}
Please login to merge, or discard this patch.
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -5,64 +5,64 @@
 block discarded – undo
5 5
 abstract class DefaultListController extends DefaultPageController
6 6
 {
7 7
 
8
-	protected static $POSTS_PER_PAGE = 10;
8
+    protected static $POSTS_PER_PAGE = 10;
9 9
 
10
-	protected $page;
11
-	protected $offset;
10
+    protected $page;
11
+    protected $offset;
12 12
 
13
-	public function __construct()
14
-	{
15
-		parent::__construct();
13
+    public function __construct()
14
+    {
15
+        parent::__construct();
16 16
 		
17
-		$this->page = $this->get_page_number();
18
-		$this->total_pages = ceil($this->get_total_post_count() / self::$POSTS_PER_PAGE);
19
-		$this->offset = ($this->page - 1) * self::$POSTS_PER_PAGE;
20
-	}
17
+        $this->page = $this->get_page_number();
18
+        $this->total_pages = ceil($this->get_total_post_count() / self::$POSTS_PER_PAGE);
19
+        $this->offset = ($this->page - 1) * self::$POSTS_PER_PAGE;
20
+    }
21 21
 
22
-	abstract protected function get_page_number();
23
-	abstract protected function get_list_results();
24
-	abstract protected function get_list_description();
25
-	abstract protected function get_list_next_link();
26
-	abstract protected function get_list_prev_link();
27
-	abstract protected function get_total_post_count();
22
+    abstract protected function get_page_number();
23
+    abstract protected function get_list_results();
24
+    abstract protected function get_list_description();
25
+    abstract protected function get_list_next_link();
26
+    abstract protected function get_list_prev_link();
27
+    abstract protected function get_total_post_count();
28 28
 
29
-	protected function set_head_data()
30
-	{
31
-		parent::set_head_data();
29
+    protected function set_head_data()
30
+    {
31
+        parent::set_head_data();
32 32
 		
33
-		$this->set_head('next_link', $this->get_list_next_link());
34
-		$this->set_head('previous_link', $this->get_list_prev_link());
35
-	}
33
+        $this->set_head('next_link', $this->get_list_next_link());
34
+        $this->set_head('previous_link', $this->get_list_prev_link());
35
+    }
36 36
 
37
-	protected function set_body_data()
38
-	{
39
-		parent::set_body_data();
37
+    protected function set_body_data()
38
+    {
39
+        parent::set_body_data();
40 40
 		
41
-		$this->set_body('view', 'Listing');
42
-		$this->set_body('data', $this->get_list_body_data());
43
-	}
41
+        $this->set_body('view', 'Listing');
42
+        $this->set_body('data', $this->get_list_body_data());
43
+    }
44 44
 
45
-	final private function get_list_body_data()
46
-	{
47
-		return array(
48
-			'posts' => $this->get_list_posts(),
49
-			'show_top_navigation' => ($this->page !== 1),
50
-			'navigation' => array(
51
-				'description' => $this->get_list_description(),
52
-				'next' => $this->get_list_next_link(),
53
-				'prev' => $this->get_list_prev_link()));
54
-	}
45
+    final private function get_list_body_data()
46
+    {
47
+        return array(
48
+            'posts' => $this->get_list_posts(),
49
+            'show_top_navigation' => ($this->page !== 1),
50
+            'navigation' => array(
51
+                'description' => $this->get_list_description(),
52
+                'next' => $this->get_list_next_link(),
53
+                'prev' => $this->get_list_prev_link()));
54
+    }
55 55
 
56
-	final private function get_list_posts()
57
-	{
58
-		$post_array = array();
59
-		foreach($this->get_list_results() as $post)
60
-		{
61
-			$post_array[] = $this->format_post($post, true);
62
-		}
63
-		if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search')
64
-			$this->eject();
65
-		return $post_array;
66
-	}
56
+    final private function get_list_posts()
57
+    {
58
+        $post_array = array();
59
+        foreach($this->get_list_results() as $post)
60
+        {
61
+            $post_array[] = $this->format_post($post, true);
62
+        }
63
+        if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search')
64
+            $this->eject();
65
+        return $post_array;
66
+    }
67 67
 
68 68
 }
69 69
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +15 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,16 +2,16 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('controller', 'blog/DefaultPageController');
4 4
 
5
-abstract class DefaultListController extends DefaultPageController
6
-{
5
+abstract class DefaultListController extends DefaultPageController
6
+{
7 7
 
8 8
 	protected static $POSTS_PER_PAGE = 10;
9 9
 
10 10
 	protected $page;
11 11
 	protected $offset;
12 12
 
13
-	public function __construct()
14
-	{
13
+	public function __construct()
14
+	{
15 15
 		parent::__construct();
16 16
 		
17 17
 		$this->page = $this->get_page_number();
@@ -26,24 +26,24 @@  discard block
 block discarded – undo
26 26
 	abstract protected function get_list_prev_link();
27 27
 	abstract protected function get_total_post_count();
28 28
 
29
-	protected function set_head_data()
30
-	{
29
+	protected function set_head_data()
30
+	{
31 31
 		parent::set_head_data();
32 32
 		
33 33
 		$this->set_head('next_link', $this->get_list_next_link());
34 34
 		$this->set_head('previous_link', $this->get_list_prev_link());
35 35
 	}
36 36
 
37
-	protected function set_body_data()
38
-	{
37
+	protected function set_body_data()
38
+	{
39 39
 		parent::set_body_data();
40 40
 		
41 41
 		$this->set_body('view', 'Listing');
42 42
 		$this->set_body('data', $this->get_list_body_data());
43 43
 	}
44 44
 
45
-	final private function get_list_body_data()
46
-	{
45
+	final private function get_list_body_data()
46
+	{
47 47
 		return array(
48 48
 			'posts' => $this->get_list_posts(),
49 49
 			'show_top_navigation' => ($this->page !== 1),
@@ -53,15 +53,16 @@  discard block
 block discarded – undo
53 53
 				'prev' => $this->get_list_prev_link()));
54 54
 	}
55 55
 
56
-	final private function get_list_posts()
57
-	{
56
+	final private function get_list_posts()
57
+	{
58 58
 		$post_array = array();
59 59
 		foreach($this->get_list_results() as $post)
60 60
 		{
61 61
 			$post_array[] = $this->format_post($post, true);
62 62
 		}
63
-		if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search')
64
-			$this->eject();
63
+		if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') {
64
+					$this->eject();
65
+		}
65 66
 		return $post_array;
66 67
 	}
67 68
 
Please login to merge, or discard this patch.
controller/site/DefaultPageController.class.inc.php 3 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		$active_page = $this->get_active_page();
42 42
 		
43 43
 		$menu = array();
44
-		foreach(self::$MENU as $item)
44
+		foreach (self::$MENU as $item)
45 45
 		{
46 46
 			$menu[] = (object) array(
47 47
 				'name' => $item['name'],
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 	{
57 57
 		$current_uri = URLDecode::getPiece(1);
58 58
 		
59
-		if(!isset($current_uri))
59
+		if (!isset($current_uri))
60 60
 			return 'About';
61 61
 		
62 62
 		$menu = self::$MENU;
63
-		foreach($menu as $link)
63
+		foreach ($menu as $link)
64 64
 		{
65
-			if($link['uri'] == $current_uri)
65
+			if ($link['uri'] == $current_uri)
66 66
 				return $link['name'];
67 67
 		}
68 68
 		
Please login to merge, or discard this patch.
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -5,68 +5,68 @@
 block discarded – undo
5 5
 abstract class DefaultPageController extends PageController
6 6
 {
7 7
 
8
-	private static $MENU = array(
9
-		array(
10
-			'name' => 'About',
11
-			'uri' => ''),
12
-		array(
13
-			'name' => 'Terms',
14
-			'uri' => 'terms'),
15
-		array(
16
-			'name' => 'Change Log',
17
-			'uri' => 'change-log'),
18
-		array(
19
-			'name' => 'Contact',
20
-			'uri' => 'contact'));
8
+    private static $MENU = array(
9
+        array(
10
+            'name' => 'About',
11
+            'uri' => ''),
12
+        array(
13
+            'name' => 'Terms',
14
+            'uri' => 'terms'),
15
+        array(
16
+            'name' => 'Change Log',
17
+            'uri' => 'change-log'),
18
+        array(
19
+            'name' => 'Contact',
20
+            'uri' => 'contact'));
21 21
 
22
-	protected function set_head_data()
23
-	{
24
-		$this->add_css('reset');
25
-		$this->add_css('site');
26
-	}
22
+    protected function set_head_data()
23
+    {
24
+        $this->add_css('reset');
25
+        $this->add_css('site');
26
+    }
27 27
 
28
-	protected function set_body_data()
29
-	{
30
-		$this->set_body('top_data', array());
31
-		$this->set_body('body_data', array());
28
+    protected function set_body_data()
29
+    {
30
+        $this->set_body('top_data', array());
31
+        $this->set_body('body_data', array());
32 32
 		
33
-		$this->set_body('left_side_data', array('menu' => $this->get_menu()));
33
+        $this->set_body('left_side_data', array('menu' => $this->get_menu()));
34 34
 		
35
-		$this->set_body('activity_array', $this->get_recent_activity());
36
-		$this->set_body_view('Page');
37
-	}
35
+        $this->set_body('activity_array', $this->get_recent_activity());
36
+        $this->set_body_view('Page');
37
+    }
38 38
 
39
-	private function get_menu()
40
-	{
41
-		$active_page = $this->get_active_page();
39
+    private function get_menu()
40
+    {
41
+        $active_page = $this->get_active_page();
42 42
 		
43
-		$menu = array();
44
-		foreach(self::$MENU as $item)
45
-		{
46
-			$menu[] = (object) array(
47
-				'name' => $item['name'],
48
-				'uri' => (strlen($item['uri']) > 0) ? "/{$item['uri']}/" : '/',
49
-				'is_active' => ($item['name'] == $active_page));
50
-		}
43
+        $menu = array();
44
+        foreach(self::$MENU as $item)
45
+        {
46
+            $menu[] = (object) array(
47
+                'name' => $item['name'],
48
+                'uri' => (strlen($item['uri']) > 0) ? "/{$item['uri']}/" : '/',
49
+                'is_active' => ($item['name'] == $active_page));
50
+        }
51 51
 		
52
-		return $menu;
53
-	}
52
+        return $menu;
53
+    }
54 54
 
55
-	private function get_active_page()
56
-	{
57
-		$current_uri = URLDecode::getPiece(1);
55
+    private function get_active_page()
56
+    {
57
+        $current_uri = URLDecode::getPiece(1);
58 58
 		
59
-		if(!isset($current_uri))
60
-			return 'About';
59
+        if(!isset($current_uri))
60
+            return 'About';
61 61
 		
62
-		$menu = self::$MENU;
63
-		foreach($menu as $link)
64
-		{
65
-			if($link['uri'] == $current_uri)
66
-				return $link['name'];
67
-		}
62
+        $menu = self::$MENU;
63
+        foreach($menu as $link)
64
+        {
65
+            if($link['uri'] == $current_uri)
66
+                return $link['name'];
67
+        }
68 68
 		
69
-		return 'About';
70
-	}
69
+        return 'About';
70
+    }
71 71
 
72 72
 }
Please login to merge, or discard this patch.
Braces   +16 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('controller', '/PageController');
4 4
 
5
-abstract class DefaultPageController extends PageController
6
-{
5
+abstract class DefaultPageController extends PageController
6
+{
7 7
 
8 8
 	private static $MENU = array(
9 9
 		array(
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
19 19
 			'name' => 'Contact',
20 20
 			'uri' => 'contact'));
21 21
 
22
-	protected function set_head_data()
23
-	{
22
+	protected function set_head_data()
23
+	{
24 24
 		$this->add_css('reset');
25 25
 		$this->add_css('site');
26 26
 	}
27 27
 
28
-	protected function set_body_data()
29
-	{
28
+	protected function set_body_data()
29
+	{
30 30
 		$this->set_body('top_data', array());
31 31
 		$this->set_body('body_data', array());
32 32
 		
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 		$this->set_body_view('Page');
37 37
 	}
38 38
 
39
-	private function get_menu()
40
-	{
39
+	private function get_menu()
40
+	{
41 41
 		$active_page = $this->get_active_page();
42 42
 		
43 43
 		$menu = array();
@@ -52,18 +52,20 @@  discard block
 block discarded – undo
52 52
 		return $menu;
53 53
 	}
54 54
 
55
-	private function get_active_page()
56
-	{
55
+	private function get_active_page()
56
+	{
57 57
 		$current_uri = URLDecode::getPiece(1);
58 58
 		
59
-		if(!isset($current_uri))
60
-			return 'About';
59
+		if(!isset($current_uri)) {
60
+					return 'About';
61
+		}
61 62
 		
62 63
 		$menu = self::$MENU;
63 64
 		foreach($menu as $link)
64 65
 		{
65
-			if($link['uri'] == $current_uri)
66
-				return $link['name'];
66
+			if($link['uri'] == $current_uri) {
67
+							return $link['name'];
68
+			}
67 69
 		}
68 70
 		
69 71
 		return 'About';
Please login to merge, or discard this patch.
utility/content/MarkupCodeContent.class.inc.php 4 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
 	protected function execute($title = '')
11 11
 	{
12 12
 		preg_match_all(self::$MARKUP_DELIMITER, $this->content, $matches);
13
-		if(count($matches[1]) == 0)
13
+		if (count($matches[1]) == 0)
14 14
 			return;
15 15
 		
16
-		foreach($matches[3] as $key => $match)
16
+		foreach ($matches[3] as $key => $match)
17 17
 		{
18 18
 			$replacement = $match;
19 19
 			$replacement = $this->wrap_in_list($replacement);
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	{
30 30
 		$content_array = explode("\n", $content);
31 31
 		
32
-		foreach($content_array as $key => $row)
32
+		foreach ($content_array as $key => $row)
33 33
 		{
34 34
 			$new_row = ($key % 2 == 0) ? '<li class="even">' : '<li class="odd">';
35 35
 			$new_row .= '<p>';
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
 	private function highlight_code($content, $type)
48 48
 	{
49
-		switch($type)
49
+		switch ($type)
50 50
 		{
51 51
 			default :
52 52
 				return $content;
Please login to merge, or discard this patch.
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -5,53 +5,53 @@
 block discarded – undo
5 5
 final class MarkupCodeContent extends Content
6 6
 {
7 7
 
8
-	private static $MARKUP_DELIMITER = '@<pre( rel="(.*?)")?>(.*?)</pre>@s';
8
+    private static $MARKUP_DELIMITER = '@<pre( rel="(.*?)")?>(.*?)</pre>@s';
9 9
 
10
-	protected function execute($title = '')
11
-	{
12
-		preg_match_all(self::$MARKUP_DELIMITER, $this->content, $matches);
13
-		if(count($matches[1]) == 0)
14
-			return;
10
+    protected function execute($title = '')
11
+    {
12
+        preg_match_all(self::$MARKUP_DELIMITER, $this->content, $matches);
13
+        if(count($matches[1]) == 0)
14
+            return;
15 15
 		
16
-		foreach($matches[3] as $key => $match)
17
-		{
18
-			$replacement = $match;
19
-			$replacement = $this->wrap_in_list($replacement);
20
-			$replacement = $this->highlight_code($replacement, $matches[2][$key]);
16
+        foreach($matches[3] as $key => $match)
17
+        {
18
+            $replacement = $match;
19
+            $replacement = $this->wrap_in_list($replacement);
20
+            $replacement = $this->highlight_code($replacement, $matches[2][$key]);
21 21
 			
22
-			$this->content = str_replace($match, $replacement, $this->content);
23
-		}
22
+            $this->content = str_replace($match, $replacement, $this->content);
23
+        }
24 24
 		
25
-		return;
26
-	}
25
+        return;
26
+    }
27 27
 
28
-	private function wrap_in_list($content)
29
-	{
30
-		$content_array = explode("\n", $content);
28
+    private function wrap_in_list($content)
29
+    {
30
+        $content_array = explode("\n", $content);
31 31
 		
32
-		foreach($content_array as $key => $row)
33
-		{
34
-			$new_row = ($key % 2 == 0) ? '<li class="even">' : '<li class="odd">';
35
-			$new_row .= '<p>';
36
-			$new_row .= $row;
37
-			$new_row .= '</p>';
38
-			$new_row .= '</li>';
39
-			$content_array[$key] = $new_row;
40
-		}
32
+        foreach($content_array as $key => $row)
33
+        {
34
+            $new_row = ($key % 2 == 0) ? '<li class="even">' : '<li class="odd">';
35
+            $new_row .= '<p>';
36
+            $new_row .= $row;
37
+            $new_row .= '</p>';
38
+            $new_row .= '</li>';
39
+            $content_array[$key] = $new_row;
40
+        }
41 41
 		
42
-		$content = implode($content_array);
43
-		$content = "<ol>{$content}</ol>";
44
-		return $content;
45
-	}
42
+        $content = implode($content_array);
43
+        $content = "<ol>{$content}</ol>";
44
+        return $content;
45
+    }
46 46
 
47
-	private function highlight_code($content, $type)
48
-	{
49
-		switch($type)
50
-		{
51
-			default :
52
-				return $content;
53
-			break;
54
-		}
55
-	}
47
+    private function highlight_code($content, $type)
48
+    {
49
+        switch($type)
50
+        {
51
+            default :
52
+                return $content;
53
+            break;
54
+        }
55
+    }
56 56
 
57 57
 }
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +11 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,16 +2,17 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('utility', 'Content');
4 4
 
5
-final class MarkupCodeContent extends Content
6
-{
5
+final class MarkupCodeContent extends Content
6
+{
7 7
 
8 8
 	private static $MARKUP_DELIMITER = '@<pre( rel="(.*?)")?>(.*?)</pre>@s';
9 9
 
10
-	protected function execute($title = '')
11
-	{
10
+	protected function execute($title = '')
11
+	{
12 12
 		preg_match_all(self::$MARKUP_DELIMITER, $this->content, $matches);
13
-		if(count($matches[1]) == 0)
14
-			return;
13
+		if(count($matches[1]) == 0) {
14
+					return;
15
+		}
15 16
 		
16 17
 		foreach($matches[3] as $key => $match)
17 18
 		{
@@ -25,8 +26,8 @@  discard block
 block discarded – undo
25 26
 		return;
26 27
 	}
27 28
 
28
-	private function wrap_in_list($content)
29
-	{
29
+	private function wrap_in_list($content)
30
+	{
30 31
 		$content_array = explode("\n", $content);
31 32
 		
32 33
 		foreach($content_array as $key => $row)
@@ -44,8 +45,8 @@  discard block
 block discarded – undo
44 45
 		return $content;
45 46
 	}
46 47
 
47
-	private function highlight_code($content, $type)
48
-	{
48
+	private function highlight_code($content, $type)
49
+	{
49 50
 		switch($type)
50 51
 		{
51 52
 			default :
Please login to merge, or discard this patch.
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -25,6 +25,9 @@  discard block
 block discarded – undo
25 25
 		return;
26 26
 	}
27 27
 
28
+	/**
29
+	 * @param string $content
30
+	 */
28 31
 	private function wrap_in_list($content)
29 32
 	{
30 33
 		$content_array = explode("\n", $content);
@@ -44,6 +47,9 @@  discard block
 block discarded – undo
44 47
 		return $content;
45 48
 	}
46 49
 
50
+	/**
51
+	 * @param string $type
52
+	 */
47 53
 	private function highlight_code($content, $type)
48 54
 	{
49 55
 		switch($type)
Please login to merge, or discard this patch.
utility/content/ElapsedTimeContent.class.inc.php 3 patches
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -10,61 +10,61 @@
 block discarded – undo
10 10
 		$previous_time = strtotime($this->content);
11 11
 		$current_time = time();
12 12
 		
13
-		if($current_time <= $previous_time)
13
+		if ($current_time <= $previous_time)
14 14
 			$this->content = 'few seconds ago';
15
-		else if(($current_time - $previous_time) < 30)
15
+		else if (($current_time - $previous_time) < 30)
16 16
 			$this->content = 'few seconds ago';
17
-		else if(($current_time - $previous_time) < 1.5 * 60)
17
+		else if (($current_time - $previous_time) < 1.5 * 60)
18 18
 			$this->content = 'a minute ago';
19
-		else if(($current_time - $previous_time) < 4 * 60)
19
+		else if (($current_time - $previous_time) < 4 * 60)
20 20
 			$this->content = 'few minutes ago';
21
-		else if(($current_time - $previous_time) < 7 * 60)
21
+		else if (($current_time - $previous_time) < 7 * 60)
22 22
 			$this->content = 'five minutes ago';
23
-		else if(($current_time - $previous_time) < 12 * 60)
23
+		else if (($current_time - $previous_time) < 12 * 60)
24 24
 			$this->content = 'ten minutes ago';
25
-		else if(($current_time - $previous_time) < 17 * 60)
25
+		else if (($current_time - $previous_time) < 17 * 60)
26 26
 			$this->content = 'fifteen minutes ago';
27
-		else if(($current_time - $previous_time) < 22 * 60)
27
+		else if (($current_time - $previous_time) < 22 * 60)
28 28
 			$this->content = 'twenty minutes ago';
29
-		else if(($current_time - $previous_time) < 37 * 60)
29
+		else if (($current_time - $previous_time) < 37 * 60)
30 30
 			$this->content = 'half hour ago';
31
-		else if(($current_time - $previous_time) < 52 * 60)
31
+		else if (($current_time - $previous_time) < 52 * 60)
32 32
 			$this->content = 'forty-five minutes ago';
33
-		else if(($current_time - $previous_time) < 1.5 * 60 * 60)
33
+		else if (($current_time - $previous_time) < 1.5 * 60 * 60)
34 34
 			$this->content = 'an hour ago';
35
-		else if(($current_time - $previous_time) < 2.5 * 60 * 60)
35
+		else if (($current_time - $previous_time) < 2.5 * 60 * 60)
36 36
 			$this->content = 'two hours ago';
37
-		else if(($current_time - $previous_time) < 3.5 * 60 * 60)
37
+		else if (($current_time - $previous_time) < 3.5 * 60 * 60)
38 38
 			$this->content = 'three hours ago';
39
-		else if(($current_time - $previous_time) < 4.5 * 60 * 60)
39
+		else if (($current_time - $previous_time) < 4.5 * 60 * 60)
40 40
 			$this->content = 'few hours ago';
41
-		else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'pm')
41
+		else if (($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'pm')
42 42
 			$this->content = 'this afternoon';
43
-		else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'am')
43
+		else if (($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'am')
44 44
 			$this->content = 'this morning';
45
-		else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm' && date('G', $previous_time) >= 17)
45
+		else if (($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm' && date('G', $previous_time) >= 17)
46 46
 			$this->content = 'yesterday evening';
47
-		else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm')
47
+		else if (($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm')
48 48
 			$this->content = 'yesterday afternoon';
49
-		else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'am')
49
+		else if (($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'am')
50 50
 			$this->content = 'yesterday morning';
51
-		else if(($current_time - $previous_time) < 3 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 2)
51
+		else if (($current_time - $previous_time) < 3 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 2)
52 52
 			$this->content = 'two days ago';
53
-		else if(($current_time - $previous_time) < 4 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 3)
53
+		else if (($current_time - $previous_time) < 4 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 3)
54 54
 			$this->content = 'three days ago';
55
-		else if(($current_time - $previous_time) < 1 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time))
55
+		else if (($current_time - $previous_time) < 1 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time))
56 56
 			$this->content = 'earlier this week';
57
-		else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1 && date('w', $previous_time) >= 3)
57
+		else if (($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1 && date('w', $previous_time) >= 3)
58 58
 			$this->content = 'late last week';
59
-		else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1)
59
+		else if (($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1)
60 60
 			$this->content = 'early last week';
61
-		else if(($current_time - $previous_time) < 3 * 7 * 24 * 60 * 60)
61
+		else if (($current_time - $previous_time) < 3 * 7 * 24 * 60 * 60)
62 62
 			$this->content = 'few weeks ago';
63
-		else if(($current_time - $previous_time) < 1.25* 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time))
63
+		else if (($current_time - $previous_time) < 1.25 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time))
64 64
 			$this->content = 'earlier this month';
65
-		else if(($current_time - $previous_time) < 2 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time) + 1)
65
+		else if (($current_time - $previous_time) < 2 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time) + 1)
66 66
 			$this->content = 'last month';
67
-		else if(($current_time - $previous_time) < 4 * 4 * 7 * 24 * 60 * 60)
67
+		else if (($current_time - $previous_time) < 4 * 4 * 7 * 24 * 60 * 60)
68 68
 			$this->content = 'several months ago';
69 69
 		else
70 70
 			$this->content = 'long ago';
Please login to merge, or discard this patch.
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -5,69 +5,69 @@
 block discarded – undo
5 5
 final class ElapsedTimeContent extends Content
6 6
 {
7 7
 
8
-	protected function execute()
9
-	{
10
-		$previous_time = strtotime($this->content);
11
-		$current_time = time();
8
+    protected function execute()
9
+    {
10
+        $previous_time = strtotime($this->content);
11
+        $current_time = time();
12 12
 		
13
-		if($current_time <= $previous_time)
14
-			$this->content = 'few seconds ago';
15
-		else if(($current_time - $previous_time) < 30)
16
-			$this->content = 'few seconds ago';
17
-		else if(($current_time - $previous_time) < 1.5 * 60)
18
-			$this->content = 'a minute ago';
19
-		else if(($current_time - $previous_time) < 4 * 60)
20
-			$this->content = 'few minutes ago';
21
-		else if(($current_time - $previous_time) < 7 * 60)
22
-			$this->content = 'five minutes ago';
23
-		else if(($current_time - $previous_time) < 12 * 60)
24
-			$this->content = 'ten minutes ago';
25
-		else if(($current_time - $previous_time) < 17 * 60)
26
-			$this->content = 'fifteen minutes ago';
27
-		else if(($current_time - $previous_time) < 22 * 60)
28
-			$this->content = 'twenty minutes ago';
29
-		else if(($current_time - $previous_time) < 37 * 60)
30
-			$this->content = 'half hour ago';
31
-		else if(($current_time - $previous_time) < 52 * 60)
32
-			$this->content = 'forty-five minutes ago';
33
-		else if(($current_time - $previous_time) < 1.5 * 60 * 60)
34
-			$this->content = 'an hour ago';
35
-		else if(($current_time - $previous_time) < 2.5 * 60 * 60)
36
-			$this->content = 'two hours ago';
37
-		else if(($current_time - $previous_time) < 3.5 * 60 * 60)
38
-			$this->content = 'three hours ago';
39
-		else if(($current_time - $previous_time) < 4.5 * 60 * 60)
40
-			$this->content = 'few hours ago';
41
-		else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'pm')
42
-			$this->content = 'this afternoon';
43
-		else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'am')
44
-			$this->content = 'this morning';
45
-		else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm' && date('G', $previous_time) >= 17)
46
-			$this->content = 'yesterday evening';
47
-		else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm')
48
-			$this->content = 'yesterday afternoon';
49
-		else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'am')
50
-			$this->content = 'yesterday morning';
51
-		else if(($current_time - $previous_time) < 3 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 2)
52
-			$this->content = 'two days ago';
53
-		else if(($current_time - $previous_time) < 4 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 3)
54
-			$this->content = 'three days ago';
55
-		else if(($current_time - $previous_time) < 1 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time))
56
-			$this->content = 'earlier this week';
57
-		else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1 && date('w', $previous_time) >= 3)
58
-			$this->content = 'late last week';
59
-		else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1)
60
-			$this->content = 'early last week';
61
-		else if(($current_time - $previous_time) < 3 * 7 * 24 * 60 * 60)
62
-			$this->content = 'few weeks ago';
63
-		else if(($current_time - $previous_time) < 1.25* 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time))
64
-			$this->content = 'earlier this month';
65
-		else if(($current_time - $previous_time) < 2 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time) + 1)
66
-			$this->content = 'last month';
67
-		else if(($current_time - $previous_time) < 4 * 4 * 7 * 24 * 60 * 60)
68
-			$this->content = 'several months ago';
69
-		else
70
-			$this->content = 'long ago';
71
-	}
13
+        if($current_time <= $previous_time)
14
+            $this->content = 'few seconds ago';
15
+        else if(($current_time - $previous_time) < 30)
16
+            $this->content = 'few seconds ago';
17
+        else if(($current_time - $previous_time) < 1.5 * 60)
18
+            $this->content = 'a minute ago';
19
+        else if(($current_time - $previous_time) < 4 * 60)
20
+            $this->content = 'few minutes ago';
21
+        else if(($current_time - $previous_time) < 7 * 60)
22
+            $this->content = 'five minutes ago';
23
+        else if(($current_time - $previous_time) < 12 * 60)
24
+            $this->content = 'ten minutes ago';
25
+        else if(($current_time - $previous_time) < 17 * 60)
26
+            $this->content = 'fifteen minutes ago';
27
+        else if(($current_time - $previous_time) < 22 * 60)
28
+            $this->content = 'twenty minutes ago';
29
+        else if(($current_time - $previous_time) < 37 * 60)
30
+            $this->content = 'half hour ago';
31
+        else if(($current_time - $previous_time) < 52 * 60)
32
+            $this->content = 'forty-five minutes ago';
33
+        else if(($current_time - $previous_time) < 1.5 * 60 * 60)
34
+            $this->content = 'an hour ago';
35
+        else if(($current_time - $previous_time) < 2.5 * 60 * 60)
36
+            $this->content = 'two hours ago';
37
+        else if(($current_time - $previous_time) < 3.5 * 60 * 60)
38
+            $this->content = 'three hours ago';
39
+        else if(($current_time - $previous_time) < 4.5 * 60 * 60)
40
+            $this->content = 'few hours ago';
41
+        else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'pm')
42
+            $this->content = 'this afternoon';
43
+        else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'am')
44
+            $this->content = 'this morning';
45
+        else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm' && date('G', $previous_time) >= 17)
46
+            $this->content = 'yesterday evening';
47
+        else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm')
48
+            $this->content = 'yesterday afternoon';
49
+        else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'am')
50
+            $this->content = 'yesterday morning';
51
+        else if(($current_time - $previous_time) < 3 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 2)
52
+            $this->content = 'two days ago';
53
+        else if(($current_time - $previous_time) < 4 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 3)
54
+            $this->content = 'three days ago';
55
+        else if(($current_time - $previous_time) < 1 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time))
56
+            $this->content = 'earlier this week';
57
+        else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1 && date('w', $previous_time) >= 3)
58
+            $this->content = 'late last week';
59
+        else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1)
60
+            $this->content = 'early last week';
61
+        else if(($current_time - $previous_time) < 3 * 7 * 24 * 60 * 60)
62
+            $this->content = 'few weeks ago';
63
+        else if(($current_time - $previous_time) < 1.25* 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time))
64
+            $this->content = 'earlier this month';
65
+        else if(($current_time - $previous_time) < 2 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time) + 1)
66
+            $this->content = 'last month';
67
+        else if(($current_time - $previous_time) < 4 * 4 * 7 * 24 * 60 * 60)
68
+            $this->content = 'several months ago';
69
+        else
70
+            $this->content = 'long ago';
71
+    }
72 72
 
73 73
 }
74 74
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +63 added lines, -62 removed lines patch added patch discarded remove patch
@@ -2,72 +2,73 @@
 block discarded – undo
2 2
 
3 3
 Loader::load('utility', 'Content');
4 4
 
5
-final class ElapsedTimeContent extends Content
6
-{
5
+final class ElapsedTimeContent extends Content
6
+{
7 7
 
8
-	protected function execute()
9
-	{
8
+	protected function execute()
9
+	{
10 10
 		$previous_time = strtotime($this->content);
11 11
 		$current_time = time();
12 12
 		
13
-		if($current_time <= $previous_time)
14
-			$this->content = 'few seconds ago';
15
-		else if(($current_time - $previous_time) < 30)
16
-			$this->content = 'few seconds ago';
17
-		else if(($current_time - $previous_time) < 1.5 * 60)
18
-			$this->content = 'a minute ago';
19
-		else if(($current_time - $previous_time) < 4 * 60)
20
-			$this->content = 'few minutes ago';
21
-		else if(($current_time - $previous_time) < 7 * 60)
22
-			$this->content = 'five minutes ago';
23
-		else if(($current_time - $previous_time) < 12 * 60)
24
-			$this->content = 'ten minutes ago';
25
-		else if(($current_time - $previous_time) < 17 * 60)
26
-			$this->content = 'fifteen minutes ago';
27
-		else if(($current_time - $previous_time) < 22 * 60)
28
-			$this->content = 'twenty minutes ago';
29
-		else if(($current_time - $previous_time) < 37 * 60)
30
-			$this->content = 'half hour ago';
31
-		else if(($current_time - $previous_time) < 52 * 60)
32
-			$this->content = 'forty-five minutes ago';
33
-		else if(($current_time - $previous_time) < 1.5 * 60 * 60)
34
-			$this->content = 'an hour ago';
35
-		else if(($current_time - $previous_time) < 2.5 * 60 * 60)
36
-			$this->content = 'two hours ago';
37
-		else if(($current_time - $previous_time) < 3.5 * 60 * 60)
38
-			$this->content = 'three hours ago';
39
-		else if(($current_time - $previous_time) < 4.5 * 60 * 60)
40
-			$this->content = 'few hours ago';
41
-		else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'pm')
42
-			$this->content = 'this afternoon';
43
-		else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'am')
44
-			$this->content = 'this morning';
45
-		else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm' && date('G', $previous_time) >= 17)
46
-			$this->content = 'yesterday evening';
47
-		else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm')
48
-			$this->content = 'yesterday afternoon';
49
-		else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'am')
50
-			$this->content = 'yesterday morning';
51
-		else if(($current_time - $previous_time) < 3 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 2)
52
-			$this->content = 'two days ago';
53
-		else if(($current_time - $previous_time) < 4 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 3)
54
-			$this->content = 'three days ago';
55
-		else if(($current_time - $previous_time) < 1 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time))
56
-			$this->content = 'earlier this week';
57
-		else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1 && date('w', $previous_time) >= 3)
58
-			$this->content = 'late last week';
59
-		else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1)
60
-			$this->content = 'early last week';
61
-		else if(($current_time - $previous_time) < 3 * 7 * 24 * 60 * 60)
62
-			$this->content = 'few weeks ago';
63
-		else if(($current_time - $previous_time) < 1.25* 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time))
64
-			$this->content = 'earlier this month';
65
-		else if(($current_time - $previous_time) < 2 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time) + 1)
66
-			$this->content = 'last month';
67
-		else if(($current_time - $previous_time) < 4 * 4 * 7 * 24 * 60 * 60)
68
-			$this->content = 'several months ago';
69
-		else
70
-			$this->content = 'long ago';
13
+		if($current_time <= $previous_time) {
14
+					$this->content = 'few seconds ago';
15
+		} else if(($current_time - $previous_time) < 30) {
16
+					$this->content = 'few seconds ago';
17
+		} else if(($current_time - $previous_time) < 1.5 * 60) {
18
+					$this->content = 'a minute ago';
19
+		} else if(($current_time - $previous_time) < 4 * 60) {
20
+					$this->content = 'few minutes ago';
21
+		} else if(($current_time - $previous_time) < 7 * 60) {
22
+					$this->content = 'five minutes ago';
23
+		} else if(($current_time - $previous_time) < 12 * 60) {
24
+					$this->content = 'ten minutes ago';
25
+		} else if(($current_time - $previous_time) < 17 * 60) {
26
+					$this->content = 'fifteen minutes ago';
27
+		} else if(($current_time - $previous_time) < 22 * 60) {
28
+					$this->content = 'twenty minutes ago';
29
+		} else if(($current_time - $previous_time) < 37 * 60) {
30
+					$this->content = 'half hour ago';
31
+		} else if(($current_time - $previous_time) < 52 * 60) {
32
+					$this->content = 'forty-five minutes ago';
33
+		} else if(($current_time - $previous_time) < 1.5 * 60 * 60) {
34
+					$this->content = 'an hour ago';
35
+		} else if(($current_time - $previous_time) < 2.5 * 60 * 60) {
36
+					$this->content = 'two hours ago';
37
+		} else if(($current_time - $previous_time) < 3.5 * 60 * 60) {
38
+					$this->content = 'three hours ago';
39
+		} else if(($current_time - $previous_time) < 4.5 * 60 * 60) {
40
+					$this->content = 'few hours ago';
41
+		} else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'pm') {
42
+					$this->content = 'this afternoon';
43
+		} else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'am') {
44
+					$this->content = 'this morning';
45
+		} else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm' && date('G', $previous_time) >= 17) {
46
+					$this->content = 'yesterday evening';
47
+		} else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm') {
48
+					$this->content = 'yesterday afternoon';
49
+		} else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'am') {
50
+					$this->content = 'yesterday morning';
51
+		} else if(($current_time - $previous_time) < 3 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 2) {
52
+					$this->content = 'two days ago';
53
+		} else if(($current_time - $previous_time) < 4 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 3) {
54
+					$this->content = 'three days ago';
55
+		} else if(($current_time - $previous_time) < 1 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time)) {
56
+					$this->content = 'earlier this week';
57
+		} else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1 && date('w', $previous_time) >= 3) {
58
+					$this->content = 'late last week';
59
+		} else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1) {
60
+					$this->content = 'early last week';
61
+		} else if(($current_time - $previous_time) < 3 * 7 * 24 * 60 * 60) {
62
+					$this->content = 'few weeks ago';
63
+		} else if(($current_time - $previous_time) < 1.25* 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time)) {
64
+					$this->content = 'earlier this month';
65
+		} else if(($current_time - $previous_time) < 2 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time) + 1) {
66
+					$this->content = 'last month';
67
+		} else if(($current_time - $previous_time) < 4 * 4 * 7 * 24 * 60 * 60) {
68
+					$this->content = 'several months ago';
69
+		} else {
70
+					$this->content = 'long ago';
71
+		}
71 72
 	}
72 73
 
73 74
 }
74 75
\ No newline at end of file
Please login to merge, or discard this patch.