Completed
Push — master ( 39fef6...39ead3 )
by
unknown
02:03
created
SimpleBlogCategories.php 2 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
 		if( $this->catindex && isset($this->categories[$this->catindex]) && !SimpleBlogCommon::AStrGet('categories_hidden',$this->catindex) ){
23 23
 			$this->ShowCategory();
24
-		}else{
24
+		} else{
25 25
 			$this->ShowCategories();
26 26
 		}
27 27
 	}
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 				$show_posts[] = $post_id;
115 115
 			}
116
-		}else{
116
+		} else{
117 117
 			$show_posts = $cat_posts;
118 118
 		}
119 119
 		$this->total_posts = count($show_posts);
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@  discard block
 block discarded – undo
14 14
 		global $page;
15 15
 
16 16
 		SimpleBlogCommon::Init();
17
-		$this->categories = SimpleBlogCommon::AStrToArray( 'categories' );
17
+		$this->categories = SimpleBlogCommon::AStrToArray('categories');
18 18
 
19 19
 
20 20
 		$this->catindex = $this->CatIndex($page->requested);
21 21
 
22
-		if( $this->catindex && isset($this->categories[$this->catindex]) && !SimpleBlogCommon::AStrGet('categories_hidden',$this->catindex) ){
22
+		if( $this->catindex && isset($this->categories[$this->catindex]) && !SimpleBlogCommon::AStrGet('categories_hidden', $this->catindex) ){
23 23
 			$this->ShowCategory();
24 24
 		}else{
25 25
 			$this->ShowCategories();
@@ -32,27 +32,27 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	function CatIndex($requested){
34 34
 
35
-		if( isset($_REQUEST['cat'])	){
35
+		if( isset($_REQUEST['cat']) ){
36 36
 			return $_REQUEST['cat'];
37 37
 		}
38 38
 
39
-		if( strpos($requested,'/') === false ){
39
+		if( strpos($requested, '/') === false ){
40 40
 			return false;
41 41
 		}
42 42
 
43
-		$parts	= explode('/',$requested);
43
+		$parts = explode('/', $requested);
44 44
 
45 45
 		if( ctype_digit($parts[1]) ){
46 46
 			return $parts[1];
47 47
 		}
48 48
 
49 49
 
50
-		$parts[1] = str_replace('_',' ',$parts[1]);
51
-		if( array_key_exists($parts[1],$this->categories) ){
50
+		$parts[1] = str_replace('_', ' ', $parts[1]);
51
+		if( array_key_exists($parts[1], $this->categories) ){
52 52
 			return $parts[1];
53 53
 		}
54 54
 
55
-		return array_search($parts[1],$this->categories);
55
+		return array_search($parts[1], $this->categories);
56 56
 	}
57 57
 
58 58
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		$start = $page * $per_page;
71 71
 
72 72
 		$include_drafts = common::LoggedIn();
73
-		$show_posts = $this->WhichCatPosts( $start, $per_page, $include_drafts);
73
+		$show_posts = $this->WhichCatPosts($start, $per_page, $include_drafts);
74 74
 
75 75
 		$this->ShowPosts($show_posts);
76 76
 
@@ -79,15 +79,15 @@  discard block
 block discarded – undo
79 79
 		echo '<p class="blog_nav_links">';
80 80
 
81 81
 		if( $page > 0 ){
82
-			$html = SimpleBlogCommon::CategoryLink( $this->catindex, $catname, '%s', 'page='.($page-1), 'class="blog_newer"' );
83
-			echo gpOutput::GetAddonText('Newer Entries',$html);
82
+			$html = SimpleBlogCommon::CategoryLink($this->catindex, $catname, '%s', 'page='.($page-1), 'class="blog_newer"');
83
+			echo gpOutput::GetAddonText('Newer Entries', $html);
84 84
 			echo '&nbsp;';
85 85
 		}
86 86
 
87 87
 
88
-		if( ( ($page+1) * $per_page) < $this->total_posts ){
89
-			$html = SimpleBlogCommon::CategoryLink( $this->catindex, $catname, '%s', 'page='.($page+1), 'class="blog_older"' );
90
-			echo gpOutput::GetAddonText('Older Entries',$html);
88
+		if( (($page+1) * $per_page) < $this->total_posts ){
89
+			$html = SimpleBlogCommon::CategoryLink($this->catindex, $catname, '%s', 'page='.($page+1), 'class="blog_older"');
90
+			echo gpOutput::GetAddonText('Older Entries', $html);
91 91
 		}
92 92
 
93 93
 
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
 		//remove drafts
106 106
 		$show_posts = array();
107 107
 		if( !$include_drafts ){
108
-			foreach($cat_posts as $post_id){
109
-				if( SimpleBlogCommon::AStrGet('drafts',$post_id) ){
108
+			foreach( $cat_posts as $post_id ){
109
+				if( SimpleBlogCommon::AStrGet('drafts', $post_id) ){
110 110
 					continue;
111 111
 				}
112 112
 
113
-				$time = SimpleBlogCommon::AStrGet('post_times',$post_id);
113
+				$time = SimpleBlogCommon::AStrGet('post_times', $post_id);
114 114
 				if( $time > time() ){
115 115
 					continue;
116 116
 				}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		}
123 123
 		$this->total_posts = count($show_posts);
124 124
 
125
-		return array_slice($show_posts,$start,$len);
125
+		return array_slice($show_posts, $start, $len);
126 126
 	}
127 127
 
128 128
 
@@ -134,22 +134,22 @@  discard block
 block discarded – undo
134 134
 
135 135
 
136 136
 		echo '<ul>';
137
-		foreach($this->categories as $catindex => $catname){
137
+		foreach( $this->categories as $catindex => $catname ){
138 138
 
139 139
 			//skip hidden categories
140
-			if( SimpleBlogCommon::AStrGet('categories_hidden',$catindex) ){
140
+			if( SimpleBlogCommon::AStrGet('categories_hidden', $catindex) ){
141 141
 				continue;
142 142
 			}
143 143
 
144
-			$cat_posts_str =& SimpleBlogCommon::$data['category_posts_'.$catindex];
145
-			$count = substr_count($cat_posts_str ,'>');
144
+			$cat_posts_str = & SimpleBlogCommon::$data['category_posts_'.$catindex];
145
+			$count = substr_count($cat_posts_str, '>');
146 146
 
147 147
 			if( !$count ){
148 148
 				continue;
149 149
 			}
150 150
 
151 151
 			echo '<li>';
152
-			echo SimpleBlogCommon::CategoryLink( $catindex, $catname, $catname.' ('.$count.')' );
152
+			echo SimpleBlogCommon::CategoryLink($catindex, $catname, $catname.' ('.$count.')');
153 153
 			echo '</li>';
154 154
 		}
155 155
 		echo '</ul>';
Please login to merge, or discard this patch.
Admin/Comments.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
 		echo '<br/>';
72 72
 		if( (SimpleBlogCommon::$data['commenter_website'] == 'nofollow') && !empty($comment['website']) ){
73 73
 			echo '<a href="'.$comment['website'].'" rel="nofollow">'.$comment['website'].'</a>';
74
-		}elseif( (SimpleBlogCommon::$data['commenter_website'] == 'link') && !empty($comment['website']) ){
74
+		} elseif( (SimpleBlogCommon::$data['commenter_website'] == 'link') && !empty($comment['website']) ){
75 75
 			echo '<a href="'.$comment['website'].'">'.$comment['website'].'</a>';
76 76
 		}
77 77
 
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 		parent::__construct();
18 18
 
19 19
 
20
-		$this->dir			= SimpleBlogCommon::$data_dir.'/comments';
20
+		$this->dir = SimpleBlogCommon::$data_dir.'/comments';
21 21
 
22 22
 		$this->GetCache();
23 23
 
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 		echo 'Options';
48 48
 		echo '</th></tr>';
49 49
 
50
-		uasort($this->cache, array('SimpleBlogComments','Sort') );
50
+		uasort($this->cache, array('SimpleBlogComments', 'Sort'));
51 51
 
52
-		foreach($this->cache as $comment){
52
+		foreach( $this->cache as $comment ){
53 53
 			$this->OutputComment($comment);
54 54
 		}
55 55
 		echo '</table>';
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
 		echo '</td><td>';
69 69
 		//echo strftime(SimpleBlogCommon::$data['strftime_format'],$comment['time']);
70
-		echo strftime( "%Y-%m-%d %H:%M:%S", $comment['time'] );
70
+		echo strftime("%Y-%m-%d %H:%M:%S", $comment['time']);
71 71
 		echo '<br/>';
72 72
 		if( (SimpleBlogCommon::$data['commenter_website'] == 'nofollow') && !empty($comment['website']) ){
73 73
 			echo '<a href="'.$comment['website'].'" rel="nofollow">'.$comment['website'].'</a>';
@@ -76,25 +76,25 @@  discard block
 block discarded – undo
76 76
 		}
77 77
 
78 78
 		echo '</td><td>';
79
-		echo SimpleBlogCommon::PostLink($comment['post_id'],'View&nbsp;Post');
79
+		echo SimpleBlogCommon::PostLink($comment['post_id'], 'View&nbsp;Post');
80 80
 		echo ' &nbsp; ';
81
-		echo common::Link('Admin_BlogComments',$langmessage['delete'],'cmd=delete_comment&id='.$comment['post_id'].'&comment_time='.$comment['time'],array('name'=>'postlink','class'=>'gpconfirm','title'=>$langmessage['delete_confirm']));
81
+		echo common::Link('Admin_BlogComments', $langmessage['delete'], 'cmd=delete_comment&id='.$comment['post_id'].'&comment_time='.$comment['time'], array('name'=>'postlink', 'class'=>'gpconfirm', 'title'=>$langmessage['delete_confirm']));
82 82
 		echo '</td></tr>';
83 83
 	}
84 84
 
85 85
 	function DeleteComment(){
86 86
 
87
-		$post_id		= $_REQUEST['id'];
88
-		$comment_time	= $_REQUEST['comment_time'];
89
-		$data			= SimpleBlogCommon::GetCommentData($post_id);
87
+		$post_id = $_REQUEST['id'];
88
+		$comment_time = $_REQUEST['comment_time'];
89
+		$data = SimpleBlogCommon::GetCommentData($post_id);
90 90
 
91
-		foreach($data as $key => $comment){
91
+		foreach( $data as $key => $comment ){
92 92
 			if( $comment['time'] == $comment_time ){
93 93
 				unset($data[$key]);
94 94
 			}
95 95
 		}
96 96
 
97
-		SimpleBlogCommon::SaveCommentData($post_id,$data);
97
+		SimpleBlogCommon::SaveCommentData($post_id, $data);
98 98
 		$this->GetCache();
99 99
 	}
100 100
 
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
 		$new_entries = false;
126 126
 
127 127
 		$files = scandir($this->dir);
128
-		foreach($files as $file){
128
+		foreach( $files as $file ){
129 129
 
130 130
 			if( $file == '.' || $file == '..' ){
131 131
 				continue;
132 132
 			}
133 133
 
134
-			list($post_id,$ext) = explode('.',$file,2);
134
+			list($post_id, $ext) = explode('.', $file, 2);
135 135
 
136 136
 			if( !is_numeric($post_id) ){
137 137
 				continue;
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
 			$data = SimpleBlogCommon::FileData($full_path);
148 148
 
149
-			foreach($data as $comment){
149
+			foreach( $data as $comment ){
150 150
 				if( $comment['time'] < $this->cache_mod ){
151 151
 					continue;
152 152
 				}
@@ -158,13 +158,13 @@  discard block
 block discarded – undo
158 158
 		}
159 159
 
160 160
 		if( $new_entries ){
161
-			uasort($this->cache, array('SimpleBlogComments','Sort') );
161
+			uasort($this->cache, array('SimpleBlogComments', 'Sort'));
162 162
 			$dataTxt = serialize($this->cache);
163
-			gpFiles::Save($this->cache_file,$dataTxt);
163
+			gpFiles::Save($this->cache_file, $dataTxt);
164 164
 		}
165 165
 	}
166 166
 
167
-	function Sort($a,$b){
167
+	function Sort($a, $b){
168 168
 		if( $a['time'] == $b['time'] ){
169 169
 			return 0;
170 170
 		}
Please login to merge, or discard this patch.
Admin/Configuration.php 2 patches
Braces   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 		if( is_numeric($_POST['post_abbrev']) ){
56 56
 			SimpleBlogCommon::$data['post_abbrev'] = (int)$_POST['post_abbrev'];
57
-		}elseif( empty($_POST['post_abbrev']) ){
57
+		} elseif( empty($_POST['post_abbrev']) ){
58 58
 			SimpleBlogCommon::$data['post_abbrev'] = '';
59 59
 		}
60 60
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		echo '<tr><td>Urls</td><td>';
128 128
 		if( version_compare($gpversion,'4.0','>=') ){
129 129
 			self::Radio('urls',$options['urls'],$array['urls']);
130
-		}else{
130
+		} else{
131 131
 			echo 'Available in gpEasy 4.0+';
132 132
 		}
133 133
 		echo '</td><td>';
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 		echo '</td><td>';
183 183
 		if( $array['abbrev_image'] ){
184 184
 			echo '<input type="checkbox" name="abbrev_image" value="allow" checked="checked" />';
185
-		}else{
185
+		} else{
186 186
 			echo '<input type="checkbox" name="abbrev_image" value="allow" />';
187 187
 		}
188 188
 		echo '</td><td></td></tr>';
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 		echo '</td><td>';
195 195
 		if( $array['abbrev_cat'] ){
196 196
 			echo '<input type="checkbox" name="abbrev_cat" value="allow" checked="checked" />';
197
-		}else{
197
+		} else{
198 198
 			echo '<input type="checkbox" name="abbrev_cat" value="allow" />';
199 199
 		}
200 200
 		echo '</td><td></td></tr>';
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 		echo '</td><td>';
263 263
 		if( $array['allow_comments'] ){
264 264
 			echo '<input type="checkbox" name="allow_comments" value="allow" checked="checked" />';
265
-		}else{
265
+		} else{
266 266
 			echo '<input type="checkbox" name="allow_comments" value="allow" />';
267 267
 		}
268 268
 		echo '</td><td></td></tr>';
@@ -285,11 +285,11 @@  discard block
 block discarded – undo
285 285
 				echo '<option value="">Hide</option>';
286 286
 				echo '<option value="nofollow" selected="selected">Nofollow Link</option>';
287 287
 				echo '<option value="link">Follow Link</option>';
288
-			}elseif( $array['commenter_website'] == 'link' ){
288
+			} elseif( $array['commenter_website'] == 'link' ){
289 289
 				echo '<option value="">Hide</option>';
290 290
 				echo '<option value="nofollow" selected="selected">Nofollow Link</option>';
291 291
 				echo '<option value="link" selected="selected">Follow Link</option>';
292
-			}else{
292
+			} else{
293 293
 				echo '<option value="">Hide</option>';
294 294
 				echo '<option value="nofollow">Nofollow Link</option>';
295 295
 				echo '<option value="link">Follow Link</option>';
@@ -305,13 +305,13 @@  discard block
 block discarded – undo
305 305
 
306 306
 		if( !gp_recaptcha::isActive() ){
307 307
 			$disabled = ' disabled="disabled" ';
308
-		}else{
308
+		} else{
309 309
 			$disabled = '';
310 310
 		}
311 311
 
312 312
 		if( $array['comment_captcha'] ){
313 313
 			echo '<input type="checkbox" name="comment_captcha" value="allow" checked="checked" '.$disabled.'/>';
314
-		}else{
314
+		} else{
315 315
 			echo '<input type="checkbox" name="comment_captcha" value="allow" '.$disabled.'/>';
316 316
 		}
317 317
 		echo '</td><td>';
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 
16 16
 		$cmd = common::GetCommand();
17
-		switch($cmd){
17
+		switch( $cmd ){
18 18
 			//regen
19 19
 			case 'regen':
20 20
 				SimpleBlogCommon::GenStaticContent();
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 			SimpleBlogCommon::$data['urls'] = $_POST['urls'];
51 51
 		}
52 52
 
53
-		SimpleBlogCommon::$data['per_page']				= (int)$_POST['per_page'];
53
+		SimpleBlogCommon::$data['per_page'] = (int)$_POST['per_page'];
54 54
 
55 55
 		if( is_numeric($_POST['post_abbrev']) ){
56 56
 			SimpleBlogCommon::$data['post_abbrev'] = (int)$_POST['post_abbrev'];
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 		}
60 60
 
61 61
 
62
-		SimpleBlogCommon::$data['gadget_entries']		= (int)$_POST['gadget_entries'];
63
-		SimpleBlogCommon::$data['gadget_abbrev']		= (int)$_POST['gadget_abbrev'];
62
+		SimpleBlogCommon::$data['gadget_entries'] = (int)$_POST['gadget_entries'];
63
+		SimpleBlogCommon::$data['gadget_abbrev'] = (int)$_POST['gadget_abbrev'];
64 64
 
65 65
 		$format = htmlspecialchars($_POST['strftime_format']);
66 66
 		if( @strftime($format) ){
@@ -69,19 +69,19 @@  discard block
 block discarded – undo
69 69
 
70 70
 
71 71
 		SimpleBlogCommon::$data['feed_entries']			= (int)$_POST['feed_entries'];
72
-		SimpleBlogCommon::$data['feed_abbrev']			= (int)$_POST['feed_abbrev'];
72
+		SimpleBlogCommon::$data['feed_abbrev'] = (int)$_POST['feed_abbrev'];
73 73
 
74 74
 		SimpleBlogCommon::$data['abbrev_image']			= isset($_POST['abbrev_image']);
75
-		SimpleBlogCommon::$data['abbrev_cat']			= isset($_POST['abbrev_cat']);
75
+		SimpleBlogCommon::$data['abbrev_cat'] = isset($_POST['abbrev_cat']);
76 76
 
77 77
 
78 78
 		//comments
79
-		SimpleBlogCommon::$data['allow_comments']		= isset($_POST['allow_comments']);
80
-		SimpleBlogCommon::$data['commenter_website']	= (string)$_POST['commenter_website'];
81
-		SimpleBlogCommon::$data['comment_captcha']		= isset($_POST['comment_captcha']);
79
+		SimpleBlogCommon::$data['allow_comments'] = isset($_POST['allow_comments']);
80
+		SimpleBlogCommon::$data['commenter_website'] = (string)$_POST['commenter_website'];
81
+		SimpleBlogCommon::$data['comment_captcha'] = isset($_POST['comment_captcha']);
82 82
 
83
-		SimpleBlogCommon::$data['subtitle_separator']	= (string)$_POST['subtitle_separator'];
84
-		SimpleBlogCommon::$data['email_comments']		= $_POST['email_comments'];
83
+		SimpleBlogCommon::$data['subtitle_separator'] = (string)$_POST['subtitle_separator'];
84
+		SimpleBlogCommon::$data['email_comments'] = $_POST['email_comments'];
85 85
 
86 86
 		if( !SimpleBlogCommon::SaveIndex() ){
87 87
 			message($langmessage['OOPS']);
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
 
105 105
 		$defaults = SimpleBlogCommon::Defaults();
106
-		$array =& SimpleBlogCommon::$data;
106
+		$array = & SimpleBlogCommon::$data;
107 107
 
108 108
 		$label = gpOutput::SelectText('Blog');
109 109
 
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 
126 126
 		//Pretty Urls
127 127
 		echo '<tr><td>Urls</td><td>';
128
-		if( version_compare($gpversion,'4.0','>=') ){
129
-			self::Radio('urls',$options['urls'],$array['urls']);
128
+		if( version_compare($gpversion, '4.0', '>=') ){
129
+			self::Radio('urls', $options['urls'], $array['urls']);
130 130
 		}else{
131 131
 			echo 'Available in gpEasy 4.0+';
132 132
 		}
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 
330 330
 
331 331
 		echo '<p style="text-align:center">';
332
-			echo common::Link('Admin_Theme_Content',$langmessage['editable_text'],'cmd=addontext&addon='.urlencode($addonFolderName),' title="'.urlencode($langmessage['editable_text']).'" name="gpabox" ');
332
+			echo common::Link('Admin_Theme_Content', $langmessage['editable_text'], 'cmd=addontext&addon='.urlencode($addonFolderName), ' title="'.urlencode($langmessage['editable_text']).'" name="gpabox" ');
333 333
 			echo ' &nbsp; &nbsp; ';
334
-			echo common::Link('Admin_BlogConfig','Regenerate Gadget','cmd=regen',' name="creq"');
334
+			echo common::Link('Admin_BlogConfig', 'Regenerate Gadget', 'cmd=regen', ' name="creq"');
335 335
 		echo '</p>';
336 336
 
337 337
 		echo '</form>';
@@ -352,11 +352,11 @@  discard block
 block discarded – undo
352 352
 
353 353
 	}
354 354
 
355
-	function Select($name,$options,$current){
355
+	function Select($name, $options, $current){
356 356
 		echo '<select name="'.$name.'" class="gpselect">';
357
-		foreach($options as $value => $label){
357
+		foreach( $options as $value => $label ){
358 358
 			$selected = '';
359
-			if( $current == $value){
359
+			if( $current == $value ){
360 360
 				$selected = ' selected="selected"';
361 361
 			}
362 362
 			echo '<option value="'.$value.'"'.$selected.'">'.$label.'</option>';
@@ -367,12 +367,12 @@  discard block
 block discarded – undo
367 367
 	/**
368 368
 	 * @param string $name
369 369
 	 */
370
-	function Radio($name,$options,$current){
370
+	function Radio($name, $options, $current){
371 371
 
372
-		foreach($options as $value => $label){
372
+		foreach( $options as $value => $label ){
373 373
 			echo '<div><label>';
374 374
 			$checked = '';
375
-			if( $current == $value){
375
+			if( $current == $value ){
376 376
 				$checked = ' checked';
377 377
 			}
378 378
 			echo '<input type="radio" name="'.$name.'" value="'.$value.'" '.$checked.' /> ';
Please login to merge, or discard this patch.
Admin/SimpleBlogPage.php 2 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 		if( $closed ){
55 55
 			SimpleBlogCommon::AStrSet('comments_closed',$post_id,1);
56
-		}else{
56
+		} else{
57 57
 			SimpleBlogCommon::AStrRm('comments_closed',$post_id);
58 58
 		}
59 59
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		if( SimpleBlogCommon::SaveIndex() ){
62 62
 			$this->comments_closed = $closed;
63 63
 			message($langmessage['SAVED']);
64
-		}else{
64
+		} else{
65 65
 			message($langmessage['OOPS']);
66 66
 		}
67 67
 	}
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		if( SimpleBlogCommon::SaveCommentData($this->post_id,$data) ){
88 88
 			message($langmessage['SAVED']);
89 89
 			return true;
90
-		}else{
90
+		} else{
91 91
 			message($langmessage['OOPS']);
92 92
 			return false;
93 93
 		}
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 		$cmd = common::GetCommand();
13 13
 
14
-		switch($cmd){
14
+		switch( $cmd ){
15 15
 
16 16
 			// inline editing
17 17
 			case 'inlineedit':
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @param boolean $closed
51 51
 	 */
52
-	function ToggleComments($closed, $post_id ){
52
+	function ToggleComments($closed, $post_id){
53 53
 		global $langmessage;
54 54
 
55 55
 		if( $closed ){
56
-			SimpleBlogCommon::AStrSet('comments_closed',$post_id,1);
56
+			SimpleBlogCommon::AStrSet('comments_closed', $post_id, 1);
57 57
 		}else{
58
-			SimpleBlogCommon::AStrRm('comments_closed',$post_id);
58
+			SimpleBlogCommon::AStrRm('comments_closed', $post_id);
59 59
 		}
60 60
 
61 61
 
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	function DeleteComment(){
76 76
 		global $langmessage;
77 77
 
78
-		$data		= SimpleBlogCommon::GetCommentData($this->post_id);
79
-		$comment	= $_POST['comment_index'];
78
+		$data = SimpleBlogCommon::GetCommentData($this->post_id);
79
+		$comment = $_POST['comment_index'];
80 80
 
81 81
 		if( !isset($data[$comment]) ){
82 82
 			message($langmessage['OOPS']);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 		unset($data[$comment]);
87 87
 
88
-		if( SimpleBlogCommon::SaveCommentData($this->post_id,$data) ){
88
+		if( SimpleBlogCommon::SaveCommentData($this->post_id, $data) ){
89 89
 			message($langmessage['SAVED']);
90 90
 			return true;
91 91
 		}else{
@@ -151,19 +151,19 @@  discard block
 block discarded – undo
151 151
 		global $gpAdmin;
152 152
 
153 153
 		gpFiles::cleanText($post['content']);
154
-		$post['username']		= $gpAdmin['username'];
155
-		$post_file				= SimpleBlogCommon::PostFilePath($post_index);
154
+		$post['username'] = $gpAdmin['username'];
155
+		$post_file = SimpleBlogCommon::PostFilePath($post_index);
156 156
 
157
-		if( !gpFiles::SaveArray($post_file,'post',$post) ){
157
+		if( !gpFiles::SaveArray($post_file, 'post', $post) ){
158 158
 			message($langmessage['OOPS'].' (Post not saved)');
159 159
 			return false;
160 160
 		}
161 161
 
162 162
 		//remove from old data file
163
-		$posts					= SimpleBlogCommon::GetPostFile($post_index,$post_file);
163
+		$posts = SimpleBlogCommon::GetPostFile($post_index, $post_file);
164 164
 		if( isset($posts[$post_index]) ){
165 165
 			unset($posts[$post_index]);
166
-			gpFiles::SaveArray($post_file,'posts',$posts);
166
+			gpFiles::SaveArray($post_file, 'posts', $posts);
167 167
 		}
168 168
 
169 169
 		return true;
Please login to merge, or discard this patch.
Admin/Admin.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 		foreach($options as $slug => $label){
36 36
 			if( $slug == $current ){
37 37
 				$links[] = $label;
38
-			}else{
38
+			} else{
39 39
 				$links[] = common::Link($slug,$label);
40 40
 			}
41 41
 		}
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		SimpleBlogCommon::Init();
15 15
 
16 16
 		$page->css_admin[]	= '/include/css/addons.css'; //for hmargin css pre gpEasy 3.6
17
-		$page->head_js[]	= '/data/_addoncode/'.$addonFolderName.'/static/admin.js';
17
+		$page->head_js[] = '/data/_addoncode/'.$addonFolderName.'/static/admin.js';
18 18
 		$page->css_admin[]	= '/data/_addoncode/'.$addonFolderName.'/static/admin.css'; //gpPlugin::css('admin.css'); //gpeasy 4.0+
19 19
 
20 20
 
@@ -35,21 +35,21 @@  discard block
 block discarded – undo
35 35
 			);
36 36
 
37 37
 		$links = array();
38
-		foreach($options as $slug => $label){
38
+		foreach( $options as $slug => $label ){
39 39
 			if( $slug == $current ){
40 40
 				$links[] = $label;
41 41
 			}else{
42
-				$links[] = common::Link($slug,$label);
42
+				$links[] = common::Link($slug, $label);
43 43
 			}
44 44
 		}
45 45
 
46
-		echo common::Link('Admin_Blog','New Blog Post','cmd=new_form',' class="gpsubmit" style="float:right"');
46
+		echo common::Link('Admin_Blog', 'New Blog Post', 'cmd=new_form', ' class="gpsubmit" style="float:right"');
47 47
 
48 48
 		echo '<h2 class="hmargin">';
49 49
 		$label = gpOutput::SelectText('Blog');
50
-		echo common::Link('Special_Blog',$label);
50
+		echo common::Link('Special_Blog', $label);
51 51
 		echo ' &#187; ';
52
-		echo implode('<span>|</span>',$links);
52
+		echo implode('<span>|</span>', $links);
53 53
 		echo '</h2>';
54 54
 	}
55 55
 
Please login to merge, or discard this patch.
SimpleBlogPage.php 2 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 			$header		.= '<span style="opacity:0.3;">';
57 57
 			$header		.= gpOutput::SelectText('Draft');
58 58
 			$header		.= '</span> ';
59
-		}elseif( $this->post['time'] > time() ){
59
+		} elseif( $this->post['time'] > time() ){
60 60
 			$header .= '<span style="opacity:0.3;">';
61 61
 			$header .= gpOutput::SelectText('Pending');
62 62
 			$header .= '</span> ';
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 			if( !isset($_POST['anti_spam_submitted']) ){
206 206
 				return false;
207 207
 
208
-			}elseif( !gp_recaptcha::Check() ){
208
+			} elseif( !gp_recaptcha::Check() ){
209 209
 				return false;
210 210
 
211 211
 			}
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
 		echo '<p class="name">';
325 325
 		if( (SimpleBlogCommon::$data['commenter_website'] == 'nofollow') && !empty($comment['website']) ){
326 326
 			echo '<b><a href="'.$comment['website'].'" rel="nofollow">'.$comment['name'].'</a></b>';
327
-		}elseif( (SimpleBlogCommon::$data['commenter_website'] == 'link') && !empty($comment['website']) ){
327
+		} elseif( (SimpleBlogCommon::$data['commenter_website'] == 'link') && !empty($comment['website']) ){
328 328
 			echo '<b><a href="'.$comment['website'].'">'.$comment['name'].'</a></b>';
329
-		}else{
329
+		} else{
330 330
 			echo '<b>'.$comment['name'].'</b>';
331 331
 		}
332 332
 		echo ' &nbsp; ';
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
 
8 8
 	public $post_id;
9 9
 	public $post;
10
-	public $comment_saved		= false;
10
+	public $comment_saved = false;
11 11
 	public $comments_closed;
12 12
 
13 13
 	public function __construct($post_id){
14
-		$this->post_id			= $post_id;
15
-		$this->post				= SimpleBlogCommon::GetPostContent($this->post_id);
16
-		$this->comments_closed	= SimpleBlogCommon::AStrGet('comments_closed',$this->post_id);
14
+		$this->post_id = $post_id;
15
+		$this->post = SimpleBlogCommon::GetPostContent($this->post_id);
16
+		$this->comments_closed = SimpleBlogCommon::AStrGet('comments_closed', $this->post_id);
17 17
 	}
18 18
 
19 19
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 			return;
29 29
 		}
30 30
 
31
-		if( !common::LoggedIn() && SimpleBlogCommon::AStrGet('drafts',$this->post_id) ){
31
+		if( !common::LoggedIn() && SimpleBlogCommon::AStrGet('drafts', $this->post_id) ){
32 32
 			$this->Error_404();
33 33
 			return;
34 34
 		}
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	public function _ShowPost(){
42 42
 		global $page;
43 43
 
44
-		$page->label = SimpleBlogCommon::Underscores( $this->post['title'] );
44
+		$page->label = SimpleBlogCommon::Underscores($this->post['title']);
45 45
 
46 46
 		$class = $id = '';
47 47
 		if( common::LoggedIn() ){
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 		echo '<div class="blog_post single_blog_item '.$class.'" '.$id.'>';
52 52
 
53 53
 		//heading
54
-		$header			= '<h2 id="blog_post_'.$this->post_id.'">';
55
-		if( SimpleBlogCommon::AStrGet('drafts',$this->post_id) ){
54
+		$header = '<h2 id="blog_post_'.$this->post_id.'">';
55
+		if( SimpleBlogCommon::AStrGet('drafts', $this->post_id) ){
56 56
 			$header		.= '<span style="opacity:0.3;">';
57 57
 			$header		.= gpOutput::SelectText('Draft');
58 58
 			$header		.= '</span> ';
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 			$header .= '</span> ';
63 63
 		}
64 64
 
65
-		$header			.= SimpleBlogCommon::PostLink($this->post_id,$page->label);
65
+		$header			.= SimpleBlogCommon::PostLink($this->post_id, $page->label);
66 66
 		$header			.= '</h2>';
67
-		SimpleBlogCommon::BlogHead($header,$this->post_id,$this->post);
67
+		SimpleBlogCommon::BlogHead($header, $this->post_id, $this->post);
68 68
 
69 69
 
70 70
 		//content
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
 
96 96
 		if( empty($cmd) ){
97 97
 			//redirect to correct url if needed
98
-			SimpleBlogCommon::UrlQuery( $this->post_id, $expected_url, $query );
99
-			$expected_url = str_replace('&amp;','&',$expected_url); //because of htmlspecialchars($cattitle)
98
+			SimpleBlogCommon::UrlQuery($this->post_id, $expected_url, $query);
99
+			$expected_url = str_replace('&amp;', '&', $expected_url); //because of htmlspecialchars($cattitle)
100 100
 			if( $page->requested != $expected_url ){
101
-				$expected_url = common::GetUrl( $expected_url, $query, false );
101
+				$expected_url = common::GetUrl($expected_url, $query, false);
102 102
 				common::Redirect($expected_url);
103 103
 			}
104 104
 			return;
105 105
 		}
106 106
 
107 107
 
108
-		switch($cmd){
108
+		switch( $cmd ){
109 109
 			case 'Add Comment':
110 110
 				$this->AddComment();
111 111
 			break;
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 		}
127 127
 
128 128
 		$temp = array();
129
-		foreach($this->post['categories'] as $catindex){
130
-			$title = SimpleBlogCommon::AStrGet( 'categories', $catindex );
129
+		foreach( $this->post['categories'] as $catindex ){
130
+			$title = SimpleBlogCommon::AStrGet('categories', $catindex);
131 131
 			if( !$title ){
132 132
 				continue;
133 133
 			}
134
-			if( SimpleBlogCommon::AStrGet('categories_hidden',$catindex) ){
134
+			if( SimpleBlogCommon::AStrGet('categories_hidden', $catindex) ){
135 135
 				continue;
136 136
 			}
137 137
 			$temp[] = SimpleBlogCommon::CategoryLink($catindex, $title, $title);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 			echo '<b>';
143 143
 			echo gpOutput::GetAddonText('Categories');
144 144
 			echo ':</b> ';
145
-			echo implode(', ',$temp);
145
+			echo implode(', ', $temp);
146 146
 			echo '</div>';
147 147
 		}
148 148
 	}
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
 			return false;
217 217
 		}
218 218
 
219
-		$data		= SimpleBlogCommon::GetCommentData($this->post_id);
220
-		$data[]		= $comment;
219
+		$data = SimpleBlogCommon::GetCommentData($this->post_id);
220
+		$data[] = $comment;
221 221
 
222
-		if( !SimpleBlogCommon::SaveCommentData($this->post_id,$data) ){
222
+		if( !SimpleBlogCommon::SaveCommentData($this->post_id, $data) ){
223 223
 			message($langmessage['OOPS']);
224 224
 			return false;
225 225
 		}
@@ -240,25 +240,25 @@  discard block
 block discarded – undo
240 240
 
241 241
 		if( empty($_POST['name']) ){
242 242
 			$field = gpOutput::SelectText('Name');
243
-			message($langmessage['OOPS_REQUIRED'],$field);
243
+			message($langmessage['OOPS_REQUIRED'], $field);
244 244
 			return false;
245 245
 		}
246 246
 
247 247
 		if( empty($_POST['comment']) ){
248 248
 			$field = gpOutput::SelectText('Comment');
249
-			message($langmessage['OOPS_REQUIRED'],$field);
249
+			message($langmessage['OOPS_REQUIRED'], $field);
250 250
 			return false;
251 251
 		}
252 252
 
253 253
 
254
-		$comment				= array();
254
+		$comment = array();
255 255
 		$comment['name']		= htmlspecialchars($_POST['name']);
256
-		$comment['comment']		= nl2br(strip_tags($_POST['comment']));
256
+		$comment['comment'] = nl2br(strip_tags($_POST['comment']));
257 257
 		$comment['time']		= time();
258 258
 
259 259
 		if( !empty($_POST['website']) && ($_POST['website'] !== 'http://') ){
260 260
 			$website = $_POST['website'];
261
-			if( mb_strpos($website,'://') === false ){
261
+			if( mb_strpos($website, '://') === false ){
262 262
 				$website = false;
263 263
 			}
264 264
 			if( $website ){
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 		includeFile('tool/email_mailer.php');
285 285
 
286 286
 
287
-		$body		= '';
287
+		$body = '';
288 288
 		if( !empty($comment['name']) ){
289 289
 			$body .= '<p>From: '.$comment['name'].'</p>';
290 290
 		}
@@ -302,14 +302,14 @@  discard block
 block discarded – undo
302 302
 	 * Output the html for a blog post's comments
303 303
 	 *
304 304
 	 */
305
-	public function GetCommentHtml( $data ){
305
+	public function GetCommentHtml($data){
306 306
 
307 307
 		if( !is_array($data) ){
308 308
 			return;
309 309
 		}
310 310
 
311
-		foreach($data as $key => $comment){
312
-			$this->OutputComment($key,$comment);
311
+		foreach( $data as $key => $comment ){
312
+			$this->OutputComment($key, $comment);
313 313
 		}
314 314
 	}
315 315
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 * Output single comment
318 318
 	 *
319 319
 	 */
320
-	private function OutputComment($key,$comment){
320
+	private function OutputComment($key, $comment){
321 321
 		global $langmessage;
322 322
 
323 323
 		echo '<div class="comment_area">';
@@ -331,14 +331,14 @@  discard block
 block discarded – undo
331 331
 		}
332 332
 		echo ' &nbsp; ';
333 333
 		echo '<span>';
334
-		echo strftime(SimpleBlogCommon::$data['strftime_format'],$comment['time']);
334
+		echo strftime(SimpleBlogCommon::$data['strftime_format'], $comment['time']);
335 335
 		echo '</span>';
336 336
 
337 337
 
338 338
 		if( common::LoggedIn() ){
339 339
 			echo ' &nbsp; ';
340
-			$attr = 'class="delete gpconfirm" title="'.$langmessage['delete_confirm'].'" name="postlink" data-nonce= "'.common::new_nonce('post',true).'"';
341
-			echo SimpleBlogCommon::PostLink($this->post_id,$langmessage['delete'],'cmd=delete_comment&comment_index='.$key,$attr);
340
+			$attr = 'class="delete gpconfirm" title="'.$langmessage['delete_confirm'].'" name="postlink" data-nonce= "'.common::new_nonce('post', true).'"';
341
+			echo SimpleBlogCommon::PostLink($this->post_id, $langmessage['delete'], 'cmd=delete_comment&comment_index='.$key, $attr);
342 342
 		}
343 343
 
344 344
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 		}
369 369
 
370 370
 
371
-		$_POST += array('name'=>'','website'=>'http://','comment'=>'');
371
+		$_POST += array('name'=>'', 'website'=>'http://', 'comment'=>'');
372 372
 
373 373
 		echo '<h3>';
374 374
 		echo gpOutput::GetAddonText('Leave Comment');
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 		echo '<li>';
424 424
 		echo '<input type="hidden" name="cmd" value="Add Comment" />';
425 425
 		$html = '<input type="submit" name="" class="submit" value="%s" />';
426
-		echo gpOutput::GetAddonText('Add Comment',$html);
426
+		echo gpOutput::GetAddonText('Add Comment', $html);
427 427
 		echo '</li>';
428 428
 
429 429
 		echo '</ul>';
@@ -449,14 +449,14 @@  discard block
 block discarded – undo
449 449
 	 */
450 450
 	public function PostLinks(){
451 451
 
452
-		$post_key = SimpleBlogCommon::AStrKey('str_index',$this->post_id);
452
+		$post_key = SimpleBlogCommon::AStrKey('str_index', $this->post_id);
453 453
 
454 454
 		echo '<p class="blog_nav_links">';
455 455
 
456 456
 
457 457
 		//blog home
458
-		$html = common::Link('Special_Blog','%s','','class="blog_home"');
459
-		echo gpOutput::GetAddonText('Blog Home',$html);
458
+		$html = common::Link('Special_Blog', '%s', '', 'class="blog_home"');
459
+		echo gpOutput::GetAddonText('Blog Home', $html);
460 460
 		echo '&nbsp;';
461 461
 
462 462
 
@@ -465,17 +465,17 @@  discard block
 block discarded – undo
465 465
 		if( $post_key > 0 ){
466 466
 
467 467
 			$i = 0;
468
-			do {
468
+			do{
469 469
 				$i++;
470
-				$next_index = SimpleBlogCommon::AStrGet('str_index',$post_key-$i);
470
+				$next_index = SimpleBlogCommon::AStrGet('str_index', $post_key-$i);
471 471
 				if( !common::loggedIn() ){
472
-					$isDraft = SimpleBlogCommon::AStrGet('drafts',$next_index);
472
+					$isDraft = SimpleBlogCommon::AStrGet('drafts', $next_index);
473 473
 				}
474 474
 			}while( $isDraft );
475 475
 
476 476
 			if( !$isDraft ){
477
-				$html = SimpleBlogCommon::PostLink($next_index,'%s','','class="blog_newer"');
478
-				echo gpOutput::GetAddonText('Newer Entry',$html);
477
+				$html = SimpleBlogCommon::PostLink($next_index, '%s', '', 'class="blog_newer"');
478
+				echo gpOutput::GetAddonText('Newer Entry', $html);
479 479
 				echo '&nbsp;';
480 480
 			}
481 481
 		}
@@ -486,19 +486,19 @@  discard block
 block discarded – undo
486 486
 		$isDraft = false;
487 487
 		do{
488 488
 			$i++;
489
-			$prev_index = SimpleBlogCommon::AStrGet('str_index',$post_key+$i);
489
+			$prev_index = SimpleBlogCommon::AStrGet('str_index', $post_key+$i);
490 490
 
491 491
 			if( $prev_index === false ){
492 492
 				break;
493 493
 			}
494 494
 
495 495
 			if( !common::loggedIn() ){
496
-				$isDraft = SimpleBlogCommon::AStrGet('drafts',$prev_index);
496
+				$isDraft = SimpleBlogCommon::AStrGet('drafts', $prev_index);
497 497
 			}
498 498
 
499 499
 			if( !$isDraft ){
500
-				$html = SimpleBlogCommon::PostLink($prev_index,'%s','','class="blog_older"');
501
-				echo gpOutput::GetAddonText('Older Entry',$html);
500
+				$html = SimpleBlogCommon::PostLink($prev_index, '%s', '', 'class="blog_older"');
501
+				echo gpOutput::GetAddonText('Older Entry', $html);
502 502
 			}
503 503
 
504 504
 		}while( $isDraft );
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 
507 507
 		if( common::LoggedIn() ){
508 508
 			echo '&nbsp;';
509
-			echo common::Link('Admin_Blog','New Post','cmd=new_form','class="blog_post_new"');
509
+			echo common::Link('Admin_Blog', 'New Post', 'cmd=new_form', 'class="blog_post_new"');
510 510
 		}
511 511
 
512 512
 		echo '</p>';
Please login to merge, or discard this patch.
SimpleBlog.php 2 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 		if( common::LoggedIn() ){
139 139
 			gpPlugin_incl('Admin/SimpleBlogPage.php');
140 140
 			$blog_page = new AdminSimpleBlogPage($this->post_id);
141
-		}else{
141
+		} else{
142 142
 			gpPlugin_incl('SimpleBlogPage.php');
143 143
 			$blog_page = new SimpleBlogPage($this->post_id);
144 144
 		}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 			$header .= '<span style="opacity:0.3;">';
240 240
 			$header .= gpOutput::SelectText('Draft');
241 241
 			$header .= '</span> ';
242
-		}elseif( $post['time'] > time() ){
242
+		} elseif( $post['time'] > time() ){
243 243
 			$header .= '<span style="opacity:0.3;">';
244 244
 			$header .= gpOutput::SelectText('Pending');
245 245
 			$header .= '</span> ';
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		//make it an absolute path
324 324
 		if( isset($_SERVER['HTTP_HOST']) ){
325 325
 			$server = $_SERVER['HTTP_HOST'];
326
-		}else{
326
+		} else{
327 327
 			$server = $_SERVER['SERVER_NAME'];
328 328
 		}
329 329
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 			if( $comments_closed ){
363 363
 				$label = gpOutput::SelectText('Open Comments');
364 364
 				echo SimpleBlogCommon::PostLink($post_index,$label,'cmd=opencomments','name="cnreq" style="display:none"');
365
-			}else{
365
+			} else{
366 366
 				$label = gpOutput::SelectText('Close Comments');
367 367
 				echo SimpleBlogCommon::PostLink($post_index,$label,'cmd=closecomments','name="cnreq" style="display:none"');
368 368
 			}
Please login to merge, or discard this patch.
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -19,22 +19,22 @@  discard block
 block discarded – undo
19 19
 
20 20
 		//get the post id
21 21
 		if( $page->pagetype == 'special_display' ){
22
-			$this->post_id	= $this->PostID($page->requested);
22
+			$this->post_id = $this->PostID($page->requested);
23 23
 		}
24 24
 
25 25
 
26 26
 		if( common::LoggedIn() ){
27 27
 
28
-			$page->admin_links[]		= array('Special_Blog','Blog Home');
29
-			$page->admin_links[]		= array('Admin_Blog','New Blog Post','cmd=new_form');
30
-			$page->admin_links[]		= array('Admin_Blog','Configuration');
31
-			$page->admin_links[]		= array('Admin_Theme_Content',$langmessage['editable_text'],'cmd=addontext&addon='.urlencode($addonFolderName),' name="gpabox" ');
32
-			$label						= 'Number of Posts: '. SimpleBlogCommon::$data['post_count'];
33
-			$page->admin_links[$label]	= '';
34
-			$cmd						= common::GetCommand();
28
+			$page->admin_links[]		= array('Special_Blog', 'Blog Home');
29
+			$page->admin_links[]		= array('Admin_Blog', 'New Blog Post', 'cmd=new_form');
30
+			$page->admin_links[]		= array('Admin_Blog', 'Configuration');
31
+			$page->admin_links[]		= array('Admin_Theme_Content', $langmessage['editable_text'], 'cmd=addontext&addon='.urlencode($addonFolderName), ' name="gpabox" ');
32
+			$label = 'Number of Posts: '.SimpleBlogCommon::$data['post_count'];
33
+			$page->admin_links[$label] = '';
34
+			$cmd = common::GetCommand();
35 35
 
36 36
 
37
-			switch($cmd){
37
+			switch( $cmd ){
38 38
 
39 39
 
40 40
 				//delete
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 		if( common::LoggedIn() && !file_exists(self::$index_file) ){
59 59
 			echo '<p>Congratulations on successfully installing Simple Blog for gpEasy.</p> ';
60
-			echo '<p>You\'ll probably want to get started by '.common::Link('Admin_Blog','creating a blog post','cmd=new_form').'.</p>';
60
+			echo '<p>You\'ll probably want to get started by '.common::Link('Admin_Blog', 'creating a blog post', 'cmd=new_form').'.</p>';
61 61
 		}
62 62
 
63 63
 	}
@@ -74,20 +74,20 @@  discard block
 block discarded – undo
74 74
 			return $_REQUEST['id'];
75 75
 		}
76 76
 
77
-		if( strpos($requested,'/') === false ){
77
+		if( strpos($requested, '/') === false ){
78 78
 			return;
79 79
 		}
80 80
 
81
-		$parts	= explode('/',$requested);
81
+		$parts	= explode('/', $requested);
82 82
 
83 83
 		if( SimpleBlogCommon::$data['urls'] != 'Title' ){
84
-			$ints	= strspn($parts[1],'0123456789');
84
+			$ints	= strspn($parts[1], '0123456789');
85 85
 			if( $ints ){
86
-				return substr($parts[1],0,$ints);
86
+				return substr($parts[1], 0, $ints);
87 87
 			}
88 88
 		}
89 89
 
90
-		$id = SimpleBlogCommon::AStrKey('titles',$parts[1], true);
90
+		$id = SimpleBlogCommon::AStrKey('titles', $parts[1], true);
91 91
 		if( $id !== false ){
92 92
 			return $id;
93 93
 		}
@@ -104,17 +104,17 @@  discard block
 block discarded – undo
104 104
 		global $config;
105 105
 
106 106
 		$titles				= SimpleBlogCommon::AStrToArray('titles');
107
-		$post_times			= SimpleBlogCommon::AStrToArray('post_times');
107
+		$post_times = SimpleBlogCommon::AStrToArray('post_times');
108 108
 		$similar			= array();
109
-		$lower				= str_replace(' ','_',strtolower($title));
109
+		$lower = str_replace(' ', '_', strtolower($title));
110 110
 
111
-		foreach($titles as $post_id => $title){
111
+		foreach( $titles as $post_id => $title ){
112 112
 
113 113
 			if( $post_times[$post_id] > time() ){
114 114
 				continue;
115 115
 			}
116 116
 
117
-			similar_text($lower,strtolower($title),$percent);
117
+			similar_text($lower, strtolower($title), $percent);
118 118
 			$similar[$percent] = $post_id; //if similarity is the same for two posts, the newer post will take precedence
119 119
 		}
120 120
 
@@ -156,23 +156,23 @@  discard block
 block discarded – undo
156 156
 
157 157
 		$per_page		= SimpleBlogCommon::$data['per_page'];
158 158
 		$page_num		= 0;
159
-		$expected_q		= '';
159
+		$expected_q = '';
160 160
 		if( isset($_GET['page']) && is_numeric($_GET['page']) ){
161
-			$page_num		= (int)$_GET['page'];
162
-			$expected_q		= 'page='.$page_num;
161
+			$page_num = (int)$_GET['page'];
162
+			$expected_q = 'page='.$page_num;
163 163
 		}
164 164
 
165 165
 
166 166
 		//redirect if the request isn't correct
167 167
 		if( $page->requested != SimpleBlogCommon::$root_url ){
168
-			$expected_url = common::GetUrl( SimpleBlogCommon::$root_url, $expected_q, false );
168
+			$expected_url = common::GetUrl(SimpleBlogCommon::$root_url, $expected_q, false);
169 169
 			common::Redirect($expected_url);
170 170
 		}
171 171
 
172 172
 
173
-		$start				= $page_num * $per_page;
174
-		$include_drafts		= common::LoggedIn();
175
-		$show_posts			= SimpleBlogCommon::WhichPosts($start,$per_page,$include_drafts);
173
+		$start = $page_num * $per_page;
174
+		$include_drafts = common::LoggedIn();
175
+		$show_posts = SimpleBlogCommon::WhichPosts($start, $per_page, $include_drafts);
176 176
 
177 177
 		$this->ShowPosts($show_posts);
178 178
 
@@ -181,19 +181,19 @@  discard block
 block discarded – undo
181 181
 
182 182
 		if( $page_num > 0 ){
183 183
 
184
-			$html = common::Link('Special_Blog','%s');
185
-			echo gpOutput::GetAddonText('Blog Home',$html);
184
+			$html = common::Link('Special_Blog', '%s');
185
+			echo gpOutput::GetAddonText('Blog Home', $html);
186 186
 			echo '&nbsp;';
187 187
 
188
-			$html = common::Link('Special_Blog','%s','page='.($page_num-1),'class="blog_newer"');
189
-			echo gpOutput::GetAddonText('Newer Entries',$html);
188
+			$html = common::Link('Special_Blog', '%s', 'page='.($page_num-1), 'class="blog_newer"');
189
+			echo gpOutput::GetAddonText('Newer Entries', $html);
190 190
 			echo '&nbsp;';
191 191
 
192 192
 		}
193 193
 
194
-		if( ( ($page_num+1) * $per_page) < SimpleBlogCommon::$data['post_count'] ){
195
-			$html = common::Link('Special_Blog','%s','page='.($page_num+1),'class="blog_older"');
196
-			echo gpOutput::GetAddonText('Older Entries',$html);
194
+		if( (($page_num+1) * $per_page) < SimpleBlogCommon::$data['post_count'] ){
195
+			$html = common::Link('Special_Blog', '%s', 'page='.($page_num+1), 'class="blog_older"');
196
+			echo gpOutput::GetAddonText('Older Entries', $html);
197 197
 		}
198 198
 
199 199
 		echo '</p>';
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 	public function ShowPosts($post_list){
209 209
 
210 210
 		$posts = array();
211
-		foreach($post_list as $post_index){
212
-			$this->ShowPostContent( $post_index );
211
+		foreach( $post_list as $post_index ){
212
+			$this->ShowPostContent($post_index);
213 213
 		}
214 214
 
215 215
 	}
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
 	 * Display the html for a single blog post
219 219
 	 *
220 220
 	 */
221
-	public function ShowPostContent( $post_index ){
221
+	public function ShowPostContent($post_index){
222 222
 
223
-		if( !common::LoggedIn() && SimpleBlogCommon::AStrGet('drafts',$post_index) ){
223
+		if( !common::LoggedIn() && SimpleBlogCommon::AStrGet('drafts', $post_index) ){
224 224
 			return false;
225 225
 		}
226 226
 
227
-		$post	= SimpleBlogCommon::GetPostContent($post_index);
228
-		$class	= $id = '';
227
+		$post = SimpleBlogCommon::GetPostContent($post_index);
228
+		$class = $id = '';
229 229
 
230 230
 		if( common::LoggedIn() ){
231 231
 			SimpleBlog::EditLinks($post_index, $class, $id);
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		echo '<div class="blog_post post_list_item'.$class.'" '.$id.'>';
236 236
 
237 237
 		$header = '<h2 id="blog_post_'.$post_index.'">';
238
-		if( SimpleBlogCommon::AStrGet('drafts',$post_index) ){
238
+		if( SimpleBlogCommon::AStrGet('drafts', $post_index) ){
239 239
 			$header .= '<span style="opacity:0.3;">';
240 240
 			$header .= gpOutput::SelectText('Draft');
241 241
 			$header .= '</span> ';
@@ -245,19 +245,19 @@  discard block
 block discarded – undo
245 245
 			$header .= '</span> ';
246 246
 		}
247 247
 
248
-		$label = SimpleBlogCommon::Underscores( $post['title'] );
249
-		$header .= SimpleBlogCommon::PostLink($post_index,$label);
248
+		$label = SimpleBlogCommon::Underscores($post['title']);
249
+		$header .= SimpleBlogCommon::PostLink($post_index, $label);
250 250
 		$header .= '</h2>';
251 251
 
252
-		SimpleBlogCommon::BlogHead($header,$post_index,$post);
252
+		SimpleBlogCommon::BlogHead($header, $post_index, $post);
253 253
 
254 254
 		echo '<div class="twysiwygr">';
255 255
 
256
-		if( !empty(SimpleBlogCommon::$data['post_abbrev']) && SimpleBlogCommon::$data['abbrev_image']  ){
256
+		if( !empty(SimpleBlogCommon::$data['post_abbrev']) && SimpleBlogCommon::$data['abbrev_image'] ){
257 257
 			$this->GetImageFromPost($post['content']);
258 258
 		}
259 259
 
260
-		echo $this->AbbrevContent( $post['content'], $post_index, SimpleBlogCommon::$data['post_abbrev']);
260
+		echo $this->AbbrevContent($post['content'], $post_index, SimpleBlogCommon::$data['post_abbrev']);
261 261
 		echo '</div>';
262 262
 
263 263
 		echo '</div>';
@@ -266,12 +266,12 @@  discard block
 block discarded – undo
266 266
 
267 267
 		if( SimpleBlogCommon::$data['abbrev_cat'] && isset($post['categories']) && count($post['categories']) ){
268 268
 			$temp = array();
269
-			foreach($post['categories'] as $catindex){
270
-				$title = SimpleBlogCommon::AStrGet( 'categories', $catindex );
269
+			foreach( $post['categories'] as $catindex ){
270
+				$title = SimpleBlogCommon::AStrGet('categories', $catindex);
271 271
 				if( !$title ){
272 272
 					continue;
273 273
 				}
274
-				if( SimpleBlogCommon::AStrGet('categories_hidden',$catindex) ){
274
+				if( SimpleBlogCommon::AStrGet('categories_hidden', $catindex) ){
275 275
 					continue;
276 276
 				}
277 277
 				$temp[] = SimpleBlogCommon::CategoryLink($catindex, $title, $title);
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 			if( count($temp) ){
281 281
 				echo '<div class="category_container">';
282 282
 				echo gpOutput::GetAddonText('Categories').' ';
283
-				echo implode(', ',$temp);
283
+				echo implode(', ', $temp);
284 284
 				echo '</div>';
285 285
 			}
286 286
 		}
@@ -297,28 +297,28 @@  discard block
 block discarded – undo
297 297
 	 */
298 298
 	public function GetImageFromPost($item){
299 299
 
300
-		$img_pos = strpos($item,'<img');
300
+		$img_pos = strpos($item, '<img');
301 301
 		if( $img_pos === false ){
302 302
 			return;
303 303
 		}
304
-		$src_pos = strpos($item,'src=',$img_pos);
304
+		$src_pos = strpos($item, 'src=', $img_pos);
305 305
 		if( $src_pos === false ){
306 306
 			return;
307 307
 		}
308
-		$src = substr($item,$src_pos+4);
308
+		$src = substr($item, $src_pos+4);
309 309
 		$quote = $src[0];
310 310
 		if( $quote != '"' && $quote != "'" ){
311 311
 			return;
312 312
 		}
313
-		$src_pos = strpos($src,$quote,1);
314
-		$src = substr($src,1,$src_pos-1);
313
+		$src_pos = strpos($src, $quote, 1);
314
+		$src = substr($src, 1, $src_pos-1);
315 315
 
316 316
 		// check for resized image, get original source if img is resized
317
-		if( strpos($src,'image.php') !== false && strpos($src,'img=') !== false ){
318
-			$src = $dirPrefix . '/data/_uploaded/' . urldecode(substr($src,strpos($src,'img=')+4));
317
+		if( strpos($src, 'image.php') !== false && strpos($src, 'img=') !== false ){
318
+			$src = $dirPrefix.'/data/_uploaded/'.urldecode(substr($src, strpos($src, 'img=')+4));
319 319
 		}
320 320
 
321
-		$thumb_path		= common::ThumbnailPath($src);
321
+		$thumb_path = common::ThumbnailPath($src);
322 322
 
323 323
 		//make it an absolute path
324 324
 		if( isset($_SERVER['HTTP_HOST']) ){
@@ -342,36 +342,36 @@  discard block
 block discarded – undo
342 342
 	public static function EditLinks($post_index, &$class, &$id){
343 343
 		global $langmessage;
344 344
 
345
-		$query		= 'du'; //dummy parameter
345
+		$query = 'du'; //dummy parameter
346 346
 
347
-		SimpleBlogCommon::UrlQuery( $post_index, $url, $query );
347
+		SimpleBlogCommon::UrlQuery($post_index, $url, $query);
348 348
 
349
-		$edit_link	= gpOutput::EditAreaLink($edit_index,$url,$langmessage['edit'].' (TWYSIWYG)',$query,'name="inline_edit_generic" rel="text_inline_edit"');
350
-		$class 		= ' editable_area';
351
-		$id			= 'id="ExtraEditArea'.$edit_index.'"';
349
+		$edit_link = gpOutput::EditAreaLink($edit_index, $url, $langmessage['edit'].' (TWYSIWYG)', $query, 'name="inline_edit_generic" rel="text_inline_edit"');
350
+		$class = ' editable_area';
351
+		$id = 'id="ExtraEditArea'.$edit_index.'"';
352 352
 
353 353
 
354 354
 		echo '<span style="display:none;" id="ExtraEditLnks'.$edit_index.'">';
355 355
 		echo $edit_link;
356 356
 
357
-		echo common::Link('Admin_Blog/'.$post_index,$langmessage['edit'].' (All)','cmd=edit_post',' style="display:none"');
357
+		echo common::Link('Admin_Blog/'.$post_index, $langmessage['edit'].' (All)', 'cmd=edit_post', ' style="display:none"');
358 358
 
359
-		echo common::Link('Special_Blog',$langmessage['delete'],'cmd=deleteentry&del_id='.$post_index,array('class'=>'delete gpconfirm','data-cmd'=>'cnreq','title'=>$langmessage['delete_confirm']));
359
+		echo common::Link('Special_Blog', $langmessage['delete'], 'cmd=deleteentry&del_id='.$post_index, array('class'=>'delete gpconfirm', 'data-cmd'=>'cnreq', 'title'=>$langmessage['delete_confirm']));
360 360
 
361 361
 		if( SimpleBlogCommon::$data['allow_comments'] ){
362 362
 
363
-			$comments_closed = SimpleBlogCommon::AStrGet('comments_closed',$post_index);
363
+			$comments_closed = SimpleBlogCommon::AStrGet('comments_closed', $post_index);
364 364
 			if( $comments_closed ){
365 365
 				$label = gpOutput::SelectText('Open Comments');
366
-				echo SimpleBlogCommon::PostLink($post_index,$label,'cmd=opencomments','name="cnreq" style="display:none"');
366
+				echo SimpleBlogCommon::PostLink($post_index, $label, 'cmd=opencomments', 'name="cnreq" style="display:none"');
367 367
 			}else{
368 368
 				$label = gpOutput::SelectText('Close Comments');
369
-				echo SimpleBlogCommon::PostLink($post_index,$label,'cmd=closecomments','name="cnreq" style="display:none"');
369
+				echo SimpleBlogCommon::PostLink($post_index, $label, 'cmd=closecomments', 'name="cnreq" style="display:none"');
370 370
 			}
371 371
 		}
372 372
 
373
-		echo common::Link('Admin_Blog','New Blog Post','cmd=new_form',' style="display:none"');
374
-		echo common::Link('Admin_Blog',$langmessage['administration'],'',' style="display:none"');
373
+		echo common::Link('Admin_Blog', 'New Blog Post', 'cmd=new_form', ' style="display:none"');
374
+		echo common::Link('Admin_Blog', $langmessage['administration'], '', ' style="display:none"');
375 375
 		echo '</span>';
376 376
 	}
377 377
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 	 * Abbreviate $content if a $limit greater than zero is given
380 380
 	 *
381 381
 	 */
382
-	public function AbbrevContent( $content, $post_index, $limit = 0 ){
382
+	public function AbbrevContent($content, $post_index, $limit = 0){
383 383
 
384 384
 		if( !is_numeric($limit) || $limit == 0 ){
385 385
 			return $content;
@@ -391,14 +391,14 @@  discard block
 block discarded – undo
391 391
 			return $content;
392 392
 		}
393 393
 
394
-		$pos = mb_strpos($content,' ',$limit-5);
394
+		$pos = mb_strpos($content, ' ', $limit-5);
395 395
 
396 396
 		if( ($pos > 0) && ($limit+20 > $pos) ){
397 397
 			$limit = $pos;
398 398
 		}
399
-		$content = mb_substr($content,0,$limit).' ... ';
399
+		$content = mb_substr($content, 0, $limit).' ... ';
400 400
 		$label = gpOutput::SelectText('Read More');
401
-		return $content . SimpleBlogCommon::PostLink($post_index,$label);
401
+		return $content.SimpleBlogCommon::PostLink($post_index, $label);
402 402
 	}
403 403
 
404 404
 
Please login to merge, or discard this patch.
Admin/StaticGenerator.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -301,6 +301,7 @@
 block discarded – undo
301 301
 	/**
302 302
 	 * Change relative link to absolute link
303 303
 	 *
304
+	 * @param string $server
304 305
 	 */
305 306
 	public static function FixLink(&$content,$server,$match){
306 307
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 		if( isset($_SERVER['HTTP_HOST']) ){
33 33
 			$server = 'http://'.$_SERVER['HTTP_HOST'];
34
-		}else{
34
+		} else{
35 35
 			$server = 'http://'.$_SERVER['SERVER_NAME'];
36 36
 		}
37 37
 		$serverWithDir = $server.$dirPrefix;
@@ -219,7 +219,9 @@  discard block
 block discarded – undo
219 219
 
220 220
 		//get list of posts and times
221 221
 		$list = SimpleBlogCommon::AStrToArray( 'post_times' );
222
-		if( !count($list) ) return;
222
+		if( !count($list) ){
223
+			return;
224
+		}
223 225
 
224 226
 		//get year counts
225 227
 		$archive = array();
@@ -313,7 +315,7 @@  discard block
 block discarded – undo
313 315
 
314 316
 		if( mb_strpos($match[1],'/') === 0 ){
315 317
 			$replacement = $server.$match[1];
316
-		}else{
318
+		} else{
317 319
 			$replacement = $server.common::GetUrl($match[1]);
318 320
 		}
319 321
 
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 		ob_start();
26 26
 
27 27
 		$atomFormat = 'Y-m-d\TH:i:s\Z';
28
-		$show_posts = SimpleBlogCommon::WhichPosts(0,SimpleBlogCommon::$data['feed_entries']);
28
+		$show_posts = SimpleBlogCommon::WhichPosts(0, SimpleBlogCommon::$data['feed_entries']);
29 29
 
30 30
 
31 31
 		if( isset($_SERVER['HTTP_HOST']) ){
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
 		echo '<?xml version="1.0" encoding="utf-8"?>'."\n";
40 40
 		echo '<feed xmlns="http://www.w3.org/2005/Atom">'."\n";
41 41
 		echo '<title>'.$config['title'].'</title>'."\n";
42
-		echo '<link href="'.$serverWithDir.'/data/_addondata/'.str_replace(' ', '%20',$addonFolderName).'/feed.atom" rel="self" />'."\n";
42
+		echo '<link href="'.$serverWithDir.'/data/_addondata/'.str_replace(' ', '%20', $addonFolderName).'/feed.atom" rel="self" />'."\n";
43 43
 		echo '<link href="'.$server.common::GetUrl('Special_Blog').'" />'."\n";
44 44
 		echo '<id>urn:uuid:'.self::uuid($serverWithDir).'</id>'."\n";
45 45
 		echo '<updated>'.date($atomFormat, time()).'</updated>'."\n";
46 46
 		echo '<author><name>'.$config['title'].'</name></author>'."\n";
47 47
 
48 48
 
49
-		foreach($show_posts as $post_index){
49
+		foreach( $show_posts as $post_index ){
50 50
 
51 51
 			$post = SimpleBlogCommon::GetPostContent($post_index);
52 52
 
@@ -55,31 +55,31 @@  discard block
 block discarded – undo
55 55
 			}
56 56
 
57 57
 			echo '<entry>'."\n";
58
-			echo '<title>'.SimpleBlogCommon::Underscores( $post['title'] ).'</title>'."\n";
58
+			echo '<title>'.SimpleBlogCommon::Underscores($post['title']).'</title>'."\n";
59 59
 			echo '<link href="'.$server.SimpleBlogCommon::PostUrl($post_index).'"></link>'."\n";
60 60
 			echo '<id>urn:uuid:'.self::uuid($post_index).'</id>'."\n";
61 61
 			echo '<updated>'.date($atomFormat, $post['time']).'</updated>'."\n";
62 62
 
63
-			$content =& $post['content'];
64
-			if( (SimpleBlogCommon::$data['feed_abbrev']> 0) && (mb_strlen($content) > SimpleBlogCommon::$data['feed_abbrev']) ){
65
-				$content = mb_substr($content,0,SimpleBlogCommon::$data['feed_abbrev']).' ... ';
63
+			$content = & $post['content'];
64
+			if( (SimpleBlogCommon::$data['feed_abbrev'] > 0) && (mb_strlen($content) > SimpleBlogCommon::$data['feed_abbrev']) ){
65
+				$content = mb_substr($content, 0, SimpleBlogCommon::$data['feed_abbrev']).' ... ';
66 66
 				$label = gpOutput::SelectText('Read More');
67
-				$content .= '<a href="'.$server.SimpleBlogCommon::PostUrl($post_index,$label).'">'.$label.'</a>';
67
+				$content .= '<a href="'.$server.SimpleBlogCommon::PostUrl($post_index, $label).'">'.$label.'</a>';
68 68
 			}
69 69
 
70 70
 			//old images
71 71
 			$replacement = $server.'/';
72
-			$content = str_replace('src="/', 'src="'.$replacement,$content);
72
+			$content = str_replace('src="/', 'src="'.$replacement, $content);
73 73
 
74 74
 			//new images
75
-			$content = str_replace('src="../', 'src="'.$serverWithDir,$content);
75
+			$content = str_replace('src="../', 'src="'.$serverWithDir, $content);
76 76
 
77 77
 			//images without /index.php/
78
-			$content = str_replace('src="./', 'src="'.$serverWithDir,$content);
78
+			$content = str_replace('src="./', 'src="'.$serverWithDir, $content);
79 79
 
80 80
 
81 81
 			//href
82
-			self::FixLinks($content,$server,0);
82
+			self::FixLinks($content, $server, 0);
83 83
 
84 84
 			echo '<summary type="html"><![CDATA['.$content.']]></summary>'."\n";
85 85
 			echo '</entry>'."\n";
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
 		$feed = ob_get_clean();
91 91
 		$feedFile = SimpleBlogCommon::$data_dir.'/feed.atom';
92
-		gpFiles::Save($feedFile,$feed);
92
+		gpFiles::Save($feedFile, $feed);
93 93
 	}
94 94
 
95 95
 
@@ -103,31 +103,31 @@  discard block
 block discarded – undo
103 103
 		global $langmessage;
104 104
 
105 105
 		$posts = array();
106
-		$show_posts = SimpleBlogCommon::WhichPosts(0,SimpleBlogCommon::$data['gadget_entries']);
106
+		$show_posts = SimpleBlogCommon::WhichPosts(0, SimpleBlogCommon::$data['gadget_entries']);
107 107
 
108 108
 
109 109
 		ob_start();
110 110
 		$label = gpOutput::SelectText('Blog');
111 111
 		if( !empty($label) ){
112 112
 			echo '<h3>';
113
-			echo common::Link('Special_Blog',$label);
113
+			echo common::Link('Special_Blog', $label);
114 114
 			echo '</h3>';
115 115
 		}
116 116
 
117
-		foreach($show_posts as $post_index){
117
+		foreach( $show_posts as $post_index ){
118 118
 
119
-			$post		= SimpleBlogCommon::GetPostContent($post_index);
119
+			$post = SimpleBlogCommon::GetPostContent($post_index);
120 120
 
121 121
 			if( !$post ){
122 122
 				continue;
123 123
 			}
124 124
 
125
-			$header		= '<b class="simple_blog_title">';
126
-			$label		= SimpleBlogCommon::Underscores( $post['title'] );
127
-			$header		.= SimpleBlogCommon::PostLink($post_index,$label);
125
+			$header = '<b class="simple_blog_title">';
126
+			$label = SimpleBlogCommon::Underscores($post['title']);
127
+			$header		.= SimpleBlogCommon::PostLink($post_index, $label);
128 128
 			$header		.= '</b>';
129 129
 
130
-			SimpleBlogCommon::BlogHead($header,$post_index,$post,true);
130
+			SimpleBlogCommon::BlogHead($header, $post_index, $post, true);
131 131
 
132 132
 
133 133
 			$content = strip_tags($post['content']);
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
 
137 137
 				$cut = SimpleBlogCommon::$data['gadget_abbrev'];
138 138
 
139
-				$pos = mb_strpos($content,' ',$cut-5);
139
+				$pos = mb_strpos($content, ' ', $cut-5);
140 140
 				if( ($pos > 0) && ($cut+20 > $pos) ){
141 141
 					$cut = $pos;
142 142
 				}
143
-				$content = mb_substr($content,0,$cut).' ... ';
143
+				$content = mb_substr($content, 0, $cut).' ... ';
144 144
 
145 145
 				$label = gpOutput::SelectText('Read More');
146
-				$content .= SimpleBlogCommon::PostLink($post_index,$label);
146
+				$content .= SimpleBlogCommon::PostLink($post_index, $label);
147 147
 			}
148 148
 
149 149
 			echo '<p class="simple_blog_abbrev">';
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
 		if( SimpleBlogCommon::$data['post_count'] > 3 ){
156 156
 
157 157
 			$label = gpOutput::SelectText('More Blog Entries');
158
-			echo common::Link('Special_Blog',$label);
158
+			echo common::Link('Special_Blog', $label);
159 159
 		}
160 160
 
161 161
 		$gadget = ob_get_clean();
162 162
 		$gadgetFile = SimpleBlogCommon::$data_dir.'/gadget.php';
163
-		gpFiles::Save($gadgetFile,$gadget);
163
+		gpFiles::Save($gadgetFile, $gadget);
164 164
 	}
165 165
 
166 166
 
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
 	static function GenCategoryGadget(){
172 172
 		global $addonPathData;
173 173
 
174
-		$categories = SimpleBlogCommon::AStrToArray( 'categories' );
174
+		$categories = SimpleBlogCommon::AStrToArray('categories');
175 175
 
176 176
 		ob_start();
177 177
 		echo '<ul>';
178
-		foreach($categories as $catindex => $catname){
178
+		foreach( $categories as $catindex => $catname ){
179 179
 
180 180
 			//skip hidden categories
181
-			if( SimpleBlogCommon::AStrGet('categories_hidden',$catindex) ){
181
+			if( SimpleBlogCommon::AStrGet('categories_hidden', $catindex) ){
182 182
 				continue;
183 183
 			}
184 184
 
@@ -191,10 +191,10 @@  discard block
 block discarded – undo
191 191
 			echo '<li>';
192 192
 			echo '<a class="blog_gadget_link">'.$catname.' ('.$sum.')</a>';
193 193
 			echo '<ul class="nodisplay">';
194
-			foreach($posts as $post_id){
195
-				$post_title = SimpleBlogCommon::AStrGet('titles',$post_id);
194
+			foreach( $posts as $post_id ){
195
+				$post_title = SimpleBlogCommon::AStrGet('titles', $post_id);
196 196
 				echo '<li>';
197
-				echo SimpleBlogCommon::PostLink( $post_id, $post_title );
197
+				echo SimpleBlogCommon::PostLink($post_id, $post_title);
198 198
 				echo '</li>';
199 199
 			}
200 200
 			echo '</ul></li>';
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 
207 207
 		$gadgetFile = $addonPathData.'/gadget_categories.php';
208
-		gpFiles::Save( $gadgetFile, $content );
208
+		gpFiles::Save($gadgetFile, $content);
209 209
 	}
210 210
 
211 211
 
@@ -217,13 +217,13 @@  discard block
 block discarded – undo
217 217
 		global $addonPathData;
218 218
 
219 219
 		//get list of posts and times
220
-		$list = SimpleBlogCommon::AStrToArray( 'post_times' );
220
+		$list = SimpleBlogCommon::AStrToArray('post_times');
221 221
 		if( !count($list) ) return;
222 222
 
223 223
 		//get year counts
224 224
 		$archive = array();
225
-		foreach($list as $post_id => $time){
226
-			$ym = date('Y-m',$time); //year&month
225
+		foreach( $list as $post_id => $time ){
226
+			$ym = date('Y-m', $time); //year&month
227 227
 			$archive[$ym][] = $post_id;
228 228
 		}
229 229
 
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 		$prev_year = false;
234 234
 		echo '<ul>';
235 235
 		foreach( $archive as $ym => $posts ){
236
-			$y = substr($ym,0,4);
237
-			$m = substr($ym,-2);
236
+			$y = substr($ym, 0, 4);
237
+			$m = substr($ym, -2);
238 238
 			if( $y != $prev_year ){
239 239
 				if( $prev_year !== false ){
240 240
 					echo '</li>';
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
 			echo '<ul>';
252 252
 			echo '<li><a class="blog_gadget_link">';
253 253
 			$time = strtotime($ym.'-01');
254
-			echo strftime('%B',$time);
254
+			echo strftime('%B', $time);
255 255
 			echo ' ('.$sum.')</a>';
256 256
 			echo '<ul class="simple_blog_category_posts nodisplay">';
257
-			foreach($posts as $post_id ){
258
-				$post_title = SimpleBlogCommon::AStrGet('titles',$post_id);
257
+			foreach( $posts as $post_id ){
258
+				$post_title = SimpleBlogCommon::AStrGet('titles', $post_id);
259 259
 				echo '<li>';
260
-				echo SimpleBlogCommon::PostLink($post_id, $post_title );
260
+				echo SimpleBlogCommon::PostLink($post_id, $post_title);
261 261
 				echo '</li>';
262 262
 			}
263 263
 			echo '</ul>';
@@ -270,16 +270,16 @@  discard block
 block discarded – undo
270 270
 		$content = ob_get_clean();
271 271
 
272 272
 		$gadgetFile = $addonPathData.'/gadget_archive.php';
273
-		gpFiles::Save( $gadgetFile, $content );
273
+		gpFiles::Save($gadgetFile, $content);
274 274
 	}
275 275
 
276 276
 	static function uuid($str){
277 277
 		$chars = md5($str);
278
-		return mb_substr($chars,0,8)
279
-				.'-'. mb_substr($chars,8,4)
280
-				.'-'. mb_substr($chars,12,4)
281
-				.'-'. mb_substr($chars,16,4)
282
-				.'-'. mb_substr($chars,20,12);
278
+		return mb_substr($chars, 0, 8)
279
+				.'-'.mb_substr($chars, 8, 4)
280
+				.'-'.mb_substr($chars, 12, 4)
281
+				.'-'.mb_substr($chars, 16, 4)
282
+				.'-'.mb_substr($chars, 20, 12);
283 283
 		return $uuid;
284 284
 	}
285 285
 
@@ -291,11 +291,11 @@  discard block
 block discarded – undo
291 291
 	 * @param string $server
292 292
 	 * @param integer $offset
293 293
 	 */
294
-	public static function FixLinks(&$content,$server,$offset){
294
+	public static function FixLinks(&$content, $server, $offset){
295 295
 
296
-		preg_match_all('#href="([^<>"]+)"#i',$content,$matches,PREG_SET_ORDER);
297
-		foreach($matches as $match){
298
-			self::FixLink($content,$server,$match);
296
+		preg_match_all('#href="([^<>"]+)"#i', $content, $matches, PREG_SET_ORDER);
297
+		foreach( $matches as $match ){
298
+			self::FixLink($content, $server, $match);
299 299
 		}
300 300
 
301 301
 	}
@@ -305,24 +305,24 @@  discard block
 block discarded – undo
305 305
 	 * Change relative link to absolute link
306 306
 	 *
307 307
 	 */
308
-	public static function FixLink(&$content,$server,$match){
308
+	public static function FixLink(&$content, $server, $match){
309 309
 
310
-		if( strpos($match[1],'mailto:') !== false ){
310
+		if( strpos($match[1], 'mailto:') !== false ){
311 311
 			return;
312 312
 		}
313
-		if( strpos($match[1],'://') !== false ){
313
+		if( strpos($match[1], '://') !== false ){
314 314
 			return;
315 315
 		}
316 316
 
317
-		if( mb_strpos($match[1],'/') === 0 ){
317
+		if( mb_strpos($match[1], '/') === 0 ){
318 318
 			$replacement = $server.$match[1];
319 319
 		}else{
320 320
 			$replacement = $server.common::GetUrl($match[1]);
321 321
 		}
322 322
 
323
-		$replacement = str_replace($match[1],$replacement,$match[0]);
323
+		$replacement = str_replace($match[1], $replacement, $match[0]);
324 324
 
325
-		$content = str_replace($match[0],$replacement,$content);
325
+		$content = str_replace($match[0], $replacement, $content);
326 326
 	}
327 327
 
328 328
 
Please login to merge, or discard this patch.
Admin/Categories.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
 
15 15
 		parent::__construct();
16 16
 
17
-		$this->categories = SimpleBlogCommon::AStrToArray( 'categories' );
17
+		$this->categories = SimpleBlogCommon::AStrToArray('categories');
18 18
 
19 19
 
20 20
 		$cmd = common::GetCommand();
21
-		switch($cmd){
21
+		switch( $cmd ){
22 22
 
23 23
 			//category commands
24 24
 			case 'save_categories':
@@ -52,19 +52,19 @@  discard block
 block discarded – undo
52 52
 			echo '<input type="text" name="cattitle['.$catindex.']" value="'.$catname.'" class="gpinput" />';
53 53
 			echo '</td><td>';
54 54
 
55
-			$astr =& SimpleBlogCommon::$data['category_posts_'.$catindex];
56
-			echo substr_count($astr,'>');
55
+			$astr = & SimpleBlogCommon::$data['category_posts_'.$catindex];
56
+			echo substr_count($astr, '>');
57 57
 
58 58
 			echo '</td><td>';
59 59
 
60 60
 			$checked = '';
61
-			if( !SimpleBlogCommon::AStrGet('categories_hidden',$catindex) ){
61
+			if( !SimpleBlogCommon::AStrGet('categories_hidden', $catindex) ){
62 62
 				$checked = ' checked="checked"';
63 63
 			}
64 64
 
65 65
 			echo ' <input type="checkbox" name="catvis['.$catindex.']"'.$checked.'/> ';
66 66
 			echo '</td><td>';
67
-			echo common::Link('Admin_BlogCategories',$langmessage['delete'],'cmd=delete_category&index='.$catindex,' name="postlink" class="gpconfirm" title="Delete this Category?" ');
67
+			echo common::Link('Admin_BlogCategories', $langmessage['delete'], 'cmd=delete_category&index='.$catindex, ' name="postlink" class="gpconfirm" title="Delete this Category?" ');
68 68
 			echo '</td></tr>';
69 69
 		}
70 70
 		echo '</tbody>';
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		echo '<input type="hidden" name="cmd" value="save_categories" />';
75 75
 		echo '<input type="submit" value="'.$langmessage['save_changes'].'" class="gpsubmit"/>';
76 76
 		echo ' &nbsp; ';
77
-		echo common::Link('Admin_BlogCategories','Add New Category','cmd=new_category',' name="gpabox" ');
77
+		echo common::Link('Admin_BlogCategories', 'Add New Category', 'cmd=new_category', ' name="gpabox" ');
78 78
 		echo '</p>';
79 79
 		echo '</form>';
80 80
 
@@ -110,18 +110,18 @@  discard block
 block discarded – undo
110 110
 	function SaveCategories(){
111 111
 		global $langmessage;
112 112
 
113
-		$_POST += array('cattitle'=>array(),'catvis'=>array());
113
+		$_POST += array('cattitle'=>array(), 'catvis'=>array());
114 114
 
115 115
 		//category titles
116 116
 		$categories_hidden = array();
117 117
 		$this->categories = array();
118
-		foreach($_POST['cattitle'] as $key => $title){
118
+		foreach( $_POST['cattitle'] as $key => $title ){
119 119
 			$this->categories[$key] = htmlspecialchars($title);
120 120
 			$categories_hidden[$key] = 1;
121 121
 		}
122 122
 
123 123
 		//visibility
124
-		foreach($_POST['catvis'] as $key => $title){
124
+		foreach( $_POST['catvis'] as $key => $title ){
125 125
 			unset($categories_hidden[$key]);
126 126
 		}
127 127
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	function NewCatIndex(){
203 203
 		$num_index = count($this->categories);
204 204
 		do{
205
-			$index = base_convert($num_index,10,36);
205
+			$index = base_convert($num_index, 10, 36);
206 206
 			$num_index++;
207 207
 		}while( ctype_digit($index) || isset($this->categories[$index]) );
208 208
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
 		unset($this->categories[$index]);
232 232
 		unset(SimpleBlogCommon::$data['category_posts_'.$index]);
233
-		SimpleBlogCommon::AStrRm('categories_hidden',$index);
233
+		SimpleBlogCommon::AStrRm('categories_hidden', $index);
234 234
 
235 235
 		SimpleBlogCommon::$data['categories'] = SimpleBlogCommon::AStrFromArray($this->categories);
236 236
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@  discard block
 block discarded – undo
3 3
 
4 4
 gpPlugin_incl('Admin/Admin.php');
5 5
 
6
-class AdminSimpleBlogCategories extends SimipleBlogAdmin{
6
+class AdminSimpleBlogCategories extends SimipleBlogAdmin{
7 7
 
8 8
 	var $itlist = array();
9 9
 	var $categories;
10 10
 
11 11
 
12
-	function __construct(){
12
+	function __construct(){
13 13
 		global $langmessage, $addonRelativeCode, $addonFolderName, $page;
14 14
 
15 15
 		parent::__construct();
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 * Save changes to the list of existing categories
108 108
 	 *
109 109
 	 */
110
-	function SaveCategories(){
110
+	function SaveCategories(){
111 111
 		global $langmessage;
112 112
 
113 113
 		$_POST += array('cattitle'=>array(),'catvis'=>array());
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * Add a new category to the configuration
144 144
 	 *
145 145
 	 */
146
-	function SaveNewCategory(){
146
+	function SaveNewCategory(){
147 147
 		global $langmessage;
148 148
 
149 149
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 * Prompt user to create a new category
177 177
 	 *
178 178
 	 */
179
-	function NewCategory(){
179
+	function NewCategory(){
180 180
 		global $langmessage;
181 181
 		echo '<div class="inline_box">';
182 182
 		echo '<h3>Add New Category</h3>';
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * Return a new non-numeric index
200 200
 	 *
201 201
 	 */
202
-	function NewCatIndex(){
202
+	function NewCatIndex(){
203 203
 		$num_index = count($this->categories);
204 204
 		do{
205 205
 			$index = base_convert($num_index,10,36);
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 * Remove a category
215 215
 	 *
216 216
 	 */
217
-	function DeleteCategory(){
217
+	function DeleteCategory(){
218 218
 		global $langmessage;
219 219
 
220 220
 		if( !isset($_POST['index']) ){
Please login to merge, or discard this patch.