Completed
Push — master ( a64665...107bc7 )
by Josh
02:21
created
SimpleBlogCommon.php 2 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 				message($langmessage['OOPS']);
487 487
 				return false;
488 488
 			}
489
-		}elseif( !unlink($post_file) ){
489
+		} elseif( !unlink($post_file) ){
490 490
 			message($langmessage['OOPS']);
491 491
 			return false;
492 492
 		}
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 			$blog_comments = '<span class="simple_blog_comments">';
537 537
 			if( $cacheable ){
538 538
 				$blog_comments .= gpOutput::SelectText('Comments');
539
-			}else{
539
+			} else{
540 540
 				$blog_comments .= gpOutput::GetAddonText('Comments');
541 541
 			}
542 542
 			$blog_comments .= ': '.$count;
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 			}
841 841
 			$key										= str_replace(array('"','>'),'',$key);
842 842
 			SimpleBlogCommon::$data[$data_string]		.= $key.'>'.$new_value.'"';
843
-		}else{
843
+		} else{
844 844
 			$offset										+= strlen($prev_key_str);
845 845
 			$length										= strpos(SimpleBlogCommon::$data[$data_string],'"',$offset) - $offset;
846 846
 			SimpleBlogCommon::$data[$data_string]		= substr_replace(SimpleBlogCommon::$data[$data_string],$new_value,$offset,$length);
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 
16 16
 	public static $index_file;
17 17
 	public static $data;
18
-	public static $root_url		= 'Special_Blog';
18
+	public static $root_url = 'Special_Blog';
19 19
 
20
-	public $new_install			= false;
20
+	public $new_install = false;
21 21
 	public $addonPathData;
22
-	public $post_id				= null;
22
+	public $post_id = null;
23 23
 
24 24
 	public static $data_dir;
25 25
 
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
 			return;
46 46
 		}
47 47
 
48
-		self::$data_dir			= $addonPathData;
49
-		self::$index_file		= self::$data_dir.'/index.php';
48
+		self::$data_dir = $addonPathData;
49
+		self::$index_file = self::$data_dir.'/index.php';
50 50
 
51 51
 
52 52
 		self::$root_url = 'Special_Blog';
53
-		if( is_callable( array('common','SpecialHref') ) ){
53
+		if( is_callable(array('common', 'SpecialHref')) ){
54 54
 			self::$root_url = common::SpecialHref('Special_Blog');
55 55
 		}
56 56
 
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 
61 61
 
62 62
 		//regenerate if there are pending posts that need to be published
63
-		if( !is_null(SimpleBlogCommon::$data['next_regen']) && SimpleBlogCommon::$data['next_regen'] < time()  ){
63
+		if( !is_null(SimpleBlogCommon::$data['next_regen']) && SimpleBlogCommon::$data['next_regen'] < time() ){
64 64
 			if( @gpFiles::WriteLock() ){
65 65
 				self::GenStaticContent();
66 66
 				SimpleBlogCommon::NextGenTime();
67 67
 				SimpleBlogCommon::SaveIndex();
68
-				gpFiles::Unlock('write',gp_random);
68
+				gpFiles::Unlock('write', gp_random);
69 69
 			}
70 70
 		}
71 71
 
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public static function NextGenTime(){
90 90
 
91
-		$post_times			= SimpleBlogCommon::AStrToArray('post_times');
91
+		$post_times = SimpleBlogCommon::AStrToArray('post_times');
92 92
 		arsort($post_times);
93 93
 
94 94
 
95 95
 		asort($post_times);
96 96
 		$next_regen = null;
97
-		foreach($post_times as $time){
97
+		foreach( $post_times as $time ){
98 98
 			if( $time > time() ){
99 99
 				$next_regen = $time;
100 100
 				break;
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 */
113 113
 	public static function AddCSS(){
114
-		global $addonFolderName,$page;
114
+		global $addonFolderName, $page;
115 115
 
116
-		static $added			= false;
116
+		static $added = false;
117 117
 
118 118
 		if( !$added ){
119
-			$page->jQueryCode	.= '$(".blog_gadget_link").click(function(){ $(this).next(".nodisplay").toggle(); });';
120
-			$page->css_user[]	= '/data/_addoncode/'.$addonFolderName.'/static/style.css';
121
-			$added				= true;
119
+			$page->jQueryCode .= '$(".blog_gadget_link").click(function(){ $(this).next(".nodisplay").toggle(); });';
120
+			$page->css_user[] = '/data/_addoncode/'.$addonFolderName.'/static/style.css';
121
+			$added = true;
122 122
 		}
123 123
 	}
124 124
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 			unset($blogData['twitter_password']);
141 141
 		}
142 142
 
143
-		SimpleBlogCommon::$data = $blogData + SimpleBlogCommon::Defaults();
143
+		SimpleBlogCommon::$data = $blogData+SimpleBlogCommon::Defaults();
144 144
 		self::GenIndexStr();
145 145
 
146 146
 		//update to simple blog 2.0 data
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
 		if( !empty(SimpleBlogCommon::$data['str_index']) ){
162 162
 			if( SimpleBlogCommon::$data['str_index'][0] == ',' ){
163
-				SimpleBlogCommon::$data['str_index'] = str_replace( array(',',':'), array('"','>'), SimpleBlogCommon::$data['str_index']);
163
+				SimpleBlogCommon::$data['str_index'] = str_replace(array(',', ':'), array('"', '>'), SimpleBlogCommon::$data['str_index']);
164 164
 			}
165 165
 			return;
166 166
 		}
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public static function DataUpdate20(){
180 180
 
181
-		$comment_counts	= array();
181
+		$comment_counts = array();
182 182
 		$comments_closed = array();
183 183
 		if( isset(SimpleBlogCommon::$data['post_info']) && is_array(SimpleBlogCommon::$data['post_info']) ){
184
-			foreach(SimpleBlogCommon::$data['post_info'] as $post_id => $info){
184
+			foreach( SimpleBlogCommon::$data['post_info'] as $post_id => $info ){
185 185
 				if( isset($info['comments']) ){
186 186
 					$comment_counts[$post_id] = $info['comments'];
187 187
 				}
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
 		$categories = $categories_hidden = $category_posts = $post_categories = array();
202 202
 		if( !isset(SimpleBlogCommon::$data['categories']) ){
203 203
 			$old_categories = self::load_blog_categories();
204
-			foreach($old_categories as $key => $cat){
205
-				$cat['ct'] = htmlspecialchars($cat['ct'],ENT_COMPAT,'UTF-8',false);
204
+			foreach( $old_categories as $key => $cat ){
205
+				$cat['ct'] = htmlspecialchars($cat['ct'], ENT_COMPAT, 'UTF-8', false);
206 206
 				$categories[$key] = $cat['ct'];
207 207
 				if( isset($cat['visible']) && !$cat['visible'] ){
208 208
 					$categories_hidden[$key] = 1;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
 				if( isset($cat['posts']) && is_array($cat['posts']) ){
212 212
 					$category_posts[$key] = array();
213
-					foreach($cat['posts'] as $post => $title){
213
+					foreach( $cat['posts'] as $post => $title ){
214 214
 						$category_posts[$key][] = $post;
215 215
 						$post_categories[$post][] = $key;
216 216
 					}
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
 		$i = 0;
228 228
 		do{
229 229
 
230
-			$posts = self::GetPostFile($i,$post_file);
230
+			$posts = self::GetPostFile($i, $post_file);
231 231
 			if( !$posts ){
232 232
 				break;
233 233
 			}
234 234
 
235
-			foreach($posts as $post_id => $post){
235
+			foreach( $posts as $post_id => $post ){
236 236
 
237 237
 				if( isset($post['isDraft']) && $post['isDraft'] ){
238 238
 					$drafts[$post_id] = 1;
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
 				}
247 247
 			}
248 248
 
249
-			gpFiles::SaveArray($post_file,'posts',$posts);
249
+			gpFiles::SaveArray($post_file, 'posts', $posts);
250 250
 
251
-			$i +=20 ;
251
+			$i += 20;
252 252
 		}while( $posts );
253 253
 
254 254
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 
260 260
 		SimpleBlogCommon::$data['categories'] = SimpleBlogCommon::AStrFromArray($categories);
261 261
 		SimpleBlogCommon::$data['categories_hidden'] = SimpleBlogCommon::AStrFromArray($categories_hidden);
262
-		foreach($category_posts as $key => $posts){
262
+		foreach( $category_posts as $key => $posts ){
263 263
 			SimpleBlogCommon::$data['category_posts_'.$key] = SimpleBlogCommon::AStrFromArray($posts);
264 264
 		}
265 265
 
@@ -283,24 +283,24 @@  discard block
 block discarded – undo
283 283
 	 */
284 284
 	public static function WhichPosts($start, $len, $include_drafts = false){
285 285
 
286
-		$posts		= array();
287
-		$end		= $start+$len;
288
-		for($i = $start; $i < $end; $i++){
286
+		$posts = array();
287
+		$end = $start+$len;
288
+		for( $i = $start; $i < $end; $i++ ){
289 289
 
290 290
 			//get post id
291
-			$post_id = SimpleBlogCommon::AStrGet('str_index',$i);
291
+			$post_id = SimpleBlogCommon::AStrGet('str_index', $i);
292 292
 			if( !$post_id ){
293 293
 				continue;
294 294
 			}
295 295
 
296 296
 			if( !$include_drafts ){
297 297
 				//exclude drafts
298
-				if( SimpleBlogCommon::AStrGet('drafts',$post_id) ){
298
+				if( SimpleBlogCommon::AStrGet('drafts', $post_id) ){
299 299
 					continue;
300 300
 				}
301 301
 
302 302
 				//exclude future posts
303
-				$time = SimpleBlogCommon::AStrGet('post_times',$post_id);
303
+				$time = SimpleBlogCommon::AStrGet('post_times', $post_id);
304 304
 				if( $time > time() ){
305 305
 					continue;
306 306
 				}
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
 	public static function Defaults(){
322 322
 		global $config;
323 323
 
324
-		$zero_strip = stristr(PHP_OS,'win') ? '' : '-';
324
+		$zero_strip = stristr(PHP_OS, 'win') ? '' : '-';
325 325
 
326
-		return array(	'post_index'			=> 0,
326
+		return array('post_index'			=> 0,
327 327
 						'per_page'				=> 10,
328 328
 						'post_abbrev'			=> '',
329 329
 						'gadget_entries'		=> 3,
@@ -356,10 +356,10 @@  discard block
 block discarded – undo
356 356
 	 */
357 357
 	public static function SaveIndex(){
358 358
 
359
-		SimpleBlogCommon::$data['str_index'] = '"'.trim(SimpleBlogCommon::$data['str_index'],'"').'"';
360
-		SimpleBlogCommon::$data['post_count'] = substr_count(SimpleBlogCommon::$data['str_index'],'>');
359
+		SimpleBlogCommon::$data['str_index'] = '"'.trim(SimpleBlogCommon::$data['str_index'], '"').'"';
360
+		SimpleBlogCommon::$data['post_count'] = substr_count(SimpleBlogCommon::$data['str_index'], '>');
361 361
 
362
-		return gpFiles::SaveArray(self::$index_file,'blogData',SimpleBlogCommon::$data);
362
+		return gpFiles::SaveArray(self::$index_file, 'blogData', SimpleBlogCommon::$data);
363 363
 	}
364 364
 
365 365
 
@@ -370,14 +370,14 @@  discard block
 block discarded – undo
370 370
 	 * @deprecated 3.0
371 371
 	 *
372 372
 	 */
373
-	public static function GetPostFile($post_index,&$post_file){
373
+	public static function GetPostFile($post_index, &$post_file){
374 374
 
375 375
 		if( !is_numeric($post_index) ){
376 376
 			return false;
377 377
 		}
378 378
 
379
-		$file_index		= floor($post_index/20);
380
-		$post_file		= self::$data_dir.'/posts_'.$file_index.'.php';
379
+		$file_index = floor($post_index / 20);
380
+		$post_file = self::$data_dir.'/posts_'.$file_index.'.php';
381 381
 
382 382
 		if( !file_exists($post_file) ){
383 383
 			return false;
@@ -398,13 +398,13 @@  discard block
 block discarded – undo
398 398
 	 */
399 399
 	public static function GetPostContent($post_index){
400 400
 
401
-		$file		= self::PostFilePath($post_index);
401
+		$file = self::PostFilePath($post_index);
402 402
 		if( file_exists($file) ){
403 403
 			require($file);
404 404
 			return $post;
405 405
 		}
406 406
 
407
-		$posts = self::GetPostFile($post_index,$post_file);
407
+		$posts = self::GetPostFile($post_index, $post_file);
408 408
 		if( $posts === false ){
409 409
 			return false;
410 410
 		}
@@ -434,15 +434,15 @@  discard block
 block discarded – undo
434 434
 	public static function Delete(){
435 435
 		global $langmessage;
436 436
 
437
-		$post_id		= $_POST['del_id'];
438
-		$posts			= false;
437
+		$post_id = $_POST['del_id'];
438
+		$posts = false;
439 439
 
440 440
 
441 441
 		//post in single file or collection
442
-		$post_file		= self::PostFilePath($post_id);
442
+		$post_file = self::PostFilePath($post_id);
443 443
 		if( !file_exists($post_file) ){
444 444
 
445
-			$posts		= self::GetPostFile($post_id,$post_file);
445
+			$posts = self::GetPostFile($post_id, $post_file);
446 446
 			if( $posts === false ){
447 447
 				message($langmessage['OOPS']);
448 448
 				return false;
@@ -463,15 +463,15 @@  discard block
 block discarded – undo
463 463
 		//reset the index string
464 464
 		$new_index = SimpleBlogCommon::$data['str_index'];
465 465
 		$new_index = preg_replace('#"\d+>'.$post_id.'"#', '"', $new_index);
466
-		preg_match_all('#(?:"\d+>)([^">]*)#',$new_index,$matches);
466
+		preg_match_all('#(?:"\d+>)([^">]*)#', $new_index, $matches);
467 467
 		SimpleBlogCommon::$data['str_index'] = SimpleBlogCommon::AStrFromArray($matches[1]);
468 468
 
469 469
 
470 470
 		//remove post from other index strings
471
-		SimpleBlogCommon::AStrRm('drafts',$post_id);
472
-		SimpleBlogCommon::AStrRm('comments_closed',$post_id);
473
-		SimpleBlogCommon::AStrRm('titles',$post_id);
474
-		SimpleBlogCommon::AStrRm('post_times',$post_id);
471
+		SimpleBlogCommon::AStrRm('drafts', $post_id);
472
+		SimpleBlogCommon::AStrRm('comments_closed', $post_id);
473
+		SimpleBlogCommon::AStrRm('titles', $post_id);
474
+		SimpleBlogCommon::AStrRm('post_times', $post_id);
475 475
 
476 476
 
477 477
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 
483 483
 		//save data file or remove the file
484 484
 		if( $posts ){
485
-			if( !gpFiles::SaveArray($post_file,'posts',$posts) ){
485
+			if( !gpFiles::SaveArray($post_file, 'posts', $posts) ){
486 486
 				message($langmessage['OOPS']);
487 487
 				return false;
488 488
 			}
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 	 *
514 514
 	 * @param string $header
515 515
 	 */
516
-	public static function BlogHead($header,$post_index,$post,$cacheable=false){
516
+	public static function BlogHead($header, $post_index, $post, $cacheable = false){
517 517
 
518 518
 
519 519
 		//subtitle
@@ -526,13 +526,13 @@  discard block
 block discarded – undo
526 526
 
527 527
 		//blog date
528 528
 		$blog_date = '<span class="simple_blog_date">';
529
-		$blog_date .= strftime(SimpleBlogCommon::$data['strftime_format'],$post['time']);
529
+		$blog_date .= strftime(SimpleBlogCommon::$data['strftime_format'], $post['time']);
530 530
 		$blog_date .= '</span>';
531 531
 
532 532
 
533 533
 		//blog comments
534 534
 		$blog_comments = '{empty_blog_piece}';
535
-		$count = SimpleBlogCommon::AStrGet('comment_counts',$post_index);
535
+		$count = SimpleBlogCommon::AStrGet('comment_counts', $post_index);
536 536
 		if( $count > 0 ){
537 537
 			$blog_comments = '<span class="simple_blog_comments">';
538 538
 			if( $cacheable ){
@@ -551,16 +551,16 @@  discard block
 block discarded – undo
551 551
 		$search = array('{header}', '{blog_info}', '{blog_date}', '{blog_comments}');
552 552
 		$replace = array($header, $blog_info, $blog_date, $blog_comments);
553 553
 
554
-		$result = str_replace($search,$replace,$format);
554
+		$result = str_replace($search, $replace, $format);
555 555
 
556 556
 
557 557
 		$reg = '#\{empty_blog_piece\}(\s*)\{separator\}#';
558
-		$result = preg_replace($reg,'\1',$result);
558
+		$result = preg_replace($reg, '\1', $result);
559 559
 
560 560
 		$reg = '#\{separator\}(\s*){empty_blog_piece\}#';
561
-		$result = preg_replace($reg,'\1',$result);
561
+		$result = preg_replace($reg, '\1', $result);
562 562
 
563
-		echo str_replace('{separator}',SimpleBlogCommon::$data['subtitle_separator'],$result);
563
+		echo str_replace('{separator}', SimpleBlogCommon::$data['subtitle_separator'], $result);
564 564
 	}
565 565
 
566 566
 
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 		global $addonPathData;
581 581
 		$categories_file = $addonPathData.'/categories.php';
582 582
 
583
-		$categories = array( 'a' => array( 'ct'=>'Unsorted posts', 'visible'=>false,'posts'=>array() ) );
583
+		$categories = array('a' => array('ct'=>'Unsorted posts', 'visible'=>false, 'posts'=>array()));
584 584
 		if( file_exists($categories_file) ){
585 585
 			include($categories_file);
586 586
 		}
@@ -592,11 +592,11 @@  discard block
 block discarded – undo
592 592
 	 * Remove a blog entry from a category
593 593
 	 *
594 594
 	 */
595
-	public static function DeletePostFromCategories( $post_id ){
595
+	public static function DeletePostFromCategories($post_id){
596 596
 
597
-		$categories = SimpleBlogCommon::AStrToArray( 'categories' );
598
-		foreach($categories as $catindex => $catname){
599
-			SimpleBlogCommon::AStrRmValue( 'category_posts_'.$catindex, $post_id );
597
+		$categories = SimpleBlogCommon::AStrToArray('categories');
598
+		foreach( $categories as $catindex => $catname ){
599
+			SimpleBlogCommon::AStrRmValue('category_posts_'.$catindex, $post_id);
600 600
 		}
601 601
 	}
602 602
 
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 	 * Save the comment data for a blog post
656 656
 	 *
657 657
 	 */
658
-	public static function SaveCommentData($post_index,$data){
658
+	public static function SaveCommentData($post_index, $data){
659 659
 		global $langmessage;
660 660
 
661 661
 
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 
668 668
 		$commentDataFile = $dir.'/'.$post_index.'.txt';
669 669
 		$dataTxt = serialize($data);
670
-		if( !gpFiles::Save($commentDataFile,$dataTxt) ){
670
+		if( !gpFiles::Save($commentDataFile, $dataTxt) ){
671 671
 			return false;
672 672
 		}
673 673
 
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 			unlink($commentDataFile);
679 679
 		}
680 680
 
681
-		SimpleBlogCommon::AStrSet('comment_counts',$post_index,count($data));
681
+		SimpleBlogCommon::AStrSet('comment_counts', $post_index, count($data));
682 682
 
683 683
 		SimpleBlogCommon::SaveIndex();
684 684
 
@@ -698,16 +698,16 @@  discard block
 block discarded – undo
698 698
 		}
699 699
 	}
700 700
 
701
-	public static function PostLink($post,$label,$query='',$attr=''){
702
-		return '<a href="'.SimpleBlogCommon::PostUrl($post,$query,true).'" '.$attr.'>'.common::Ampersands($label).'</a>';
701
+	public static function PostLink($post, $label, $query = '', $attr = ''){
702
+		return '<a href="'.SimpleBlogCommon::PostUrl($post, $query, true).'" '.$attr.'>'.common::Ampersands($label).'</a>';
703 703
 	}
704 704
 
705
-	public static function PostUrl( $post = false, $query='' ){
706
-		SimpleBlogCommon::UrlQuery( $post, $url, $query );
707
-		return common::GetUrl( $url, $query );
705
+	public static function PostUrl($post = false, $query = ''){
706
+		SimpleBlogCommon::UrlQuery($post, $url, $query);
707
+		return common::GetUrl($url, $query);
708 708
 	}
709 709
 
710
-	public static function UrlQuery( $post_id = false, &$url, &$query ){
710
+	public static function UrlQuery($post_id = false, &$url, &$query){
711 711
 
712 712
 		$url = SimpleBlogCommon::$root_url;
713 713
 
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 			switch( SimpleBlogCommon::$data['urls'] ){
716 716
 
717 717
 				case 'Full':
718
-					$title = SimpleBlogCommon::AStrGet('titles',$post_id);
719
-					$title = str_replace(array('?',' '),array('','_'),$title);
718
+					$title = SimpleBlogCommon::AStrGet('titles', $post_id);
719
+					$title = str_replace(array('?', ' '), array('', '_'), $title);
720 720
 					$url .= '/'.$post_id.'_'.$title;
721 721
 				break;
722 722
 
@@ -725,13 +725,13 @@  discard block
 block discarded – undo
725 725
 				break;
726 726
 
727 727
 				case 'Title':
728
-					$title = SimpleBlogCommon::AStrGet('titles',$post_id);
729
-					$title = str_replace(array('?',' '),array('','_'),$title);
728
+					$title = SimpleBlogCommon::AStrGet('titles', $post_id);
729
+					$title = str_replace(array('?', ' '), array('', '_'), $title);
730 730
 					$url .= '/'.$title;
731 731
 				break;
732 732
 
733 733
 				default:
734
-				$query = trim($query.'&id='.$post_id,'&');
734
+				$query = trim($query.'&id='.$post_id, '&');
735 735
 				break;
736 736
 			}
737 737
 		}
@@ -740,14 +740,14 @@  discard block
 block discarded – undo
740 740
 	/**
741 741
 	 * @param string $label
742 742
 	 */
743
-	public static function CategoryLink( $catindex, $cattitle, $label, $query = '', $attr = '' ){
743
+	public static function CategoryLink($catindex, $cattitle, $label, $query = '', $attr = ''){
744 744
 
745 745
 		$url = 'Special_Blog_Categories';
746 746
 		switch( SimpleBlogCommon::$data['urls'] ){
747 747
 
748 748
 			case 'Title':
749 749
 			case 'Full':
750
-				$cattitle = str_replace(array('?',' '),array('','_'),$cattitle);
750
+				$cattitle = str_replace(array('?', ' '), array('', '_'), $cattitle);
751 751
 				$url .= '/'.$cattitle;
752 752
 			break;
753 753
 
@@ -756,11 +756,11 @@  discard block
 block discarded – undo
756 756
 			break;
757 757
 
758 758
 			default:
759
-				$query = trim('cat='.$catindex.'&'.$query,'&');
759
+				$query = trim('cat='.$catindex.'&'.$query, '&');
760 760
 			break;
761 761
 		}
762 762
 
763
-		return '<a href="'.common::GetUrl( $url, $query ).'" '.$attr.'>'.common::Ampersands($label).'</a>';
763
+		return '<a href="'.common::GetUrl($url, $query).'" '.$attr.'>'.common::Ampersands($label).'</a>';
764 764
 	}
765 765
 
766 766
 
@@ -780,9 +780,9 @@  discard block
 block discarded – undo
780 780
 	 */
781 781
 	public static function AStrFromArray($array){
782 782
 		$str = '';
783
-		foreach($array as $key => $value){
784
-			$key = str_replace(array('"','>'),'',$key);
785
-			$value = str_replace(array('"','>'),'',$value);
783
+		foreach( $array as $key => $value ){
784
+			$key = str_replace(array('"', '>'), '', $key);
785
+			$value = str_replace(array('"', '>'), '', $value);
786 786
 			$str .= '"'.$key.'>'.$value;
787 787
 		}
788 788
 		return $str.'"';
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 	 * @param mixed $new_value
797 797
 	 * @deprecated 3.0.1
798 798
 	 */
799
-	public static function AStrValue( $data_string, $key, $new_value = false ){
799
+	public static function AStrValue($data_string, $key, $new_value = false){
800 800
 
801 801
 		if( $new_value === false ){
802 802
 			return self::AStrGet($data_string, $key);
@@ -811,18 +811,18 @@  discard block
 block discarded – undo
811 811
 	 * @param string $data_string
812 812
 	 * @param int|string $key
813 813
 	 */
814
-	public static function AStrGet( $data_string, $key){
814
+	public static function AStrGet($data_string, $key){
815 815
 
816
-		$string =& SimpleBlogCommon::$data[$data_string];
816
+		$string = & SimpleBlogCommon::$data[$data_string];
817 817
 
818 818
 		//get position of current value
819
-		$prev_key_str	= '"'.$key.'>';
820
-		$offset			= strpos($string,$prev_key_str);
819
+		$prev_key_str = '"'.$key.'>';
820
+		$offset = strpos($string, $prev_key_str);
821 821
 
822 822
 		if( $offset !== false ){
823
-			$offset		+= strlen($prev_key_str);
824
-			$length		= strpos($string,'"',$offset) - $offset;
825
-			return substr($string,$offset,$length);
823
+			$offset += strlen($prev_key_str);
824
+			$length = strpos($string, '"', $offset)-$offset;
825
+			return substr($string, $offset, $length);
826 826
 		}
827 827
 
828 828
 		return false;
@@ -835,25 +835,25 @@  discard block
 block discarded – undo
835 835
 	 * @param int|string $key
836 836
 	 * @param string $new_value
837 837
 	 */
838
-	public static function AStrSet( $data_string, $key, $new_value){
838
+	public static function AStrSet($data_string, $key, $new_value){
839 839
 
840
-		$string =& SimpleBlogCommon::$data[$data_string];
840
+		$string = & SimpleBlogCommon::$data[$data_string];
841 841
 
842 842
 		//get position of current value
843
-		$prev_key_str	= '"'.$key.'>';
844
-		$offset			= strpos($string,$prev_key_str);
843
+		$prev_key_str = '"'.$key.'>';
844
+		$offset = strpos($string, $prev_key_str);
845 845
 
846 846
 		//setting values
847 847
 		if( $offset === false ){
848 848
 			if( empty($string) ){
849
-				$string	= '"';
849
+				$string = '"';
850 850
 			}
851
-			$key		= str_replace(array('"','>'),'',$key);
851
+			$key = str_replace(array('"', '>'), '', $key);
852 852
 			$string		.= $key.'>'.$new_value.'"';
853 853
 		}else{
854 854
 			$offset		+= strlen($prev_key_str);
855
-			$length		= strpos($string,'"',$offset) - $offset;
856
-			$string		= substr_replace($string,$new_value,$offset,$length);
855
+			$length		= strpos($string, '"', $offset)-$offset;
856
+			$string		= substr_replace($string, $new_value, $offset, $length);
857 857
 		}
858 858
 
859 859
 		return true;
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 	 *
867 867
 	 * @param string $data_string
868 868
 	 */
869
-	public static function AStrKey( $data_string, $value, $url_search = false ){
869
+	public static function AStrKey($data_string, $value, $url_search = false){
870 870
 		static $integers = '0123456789';
871 871
 
872 872
 		if( !isset(SimpleBlogCommon::$data[$data_string]) ){
@@ -876,21 +876,21 @@  discard block
 block discarded – undo
876 876
 		$string			= SimpleBlogCommon::$data[$data_string];
877 877
 
878 878
 		if( $url_search ){
879
-			$string		= str_replace(array('?',' '),array('','_'),$string);
879
+			$string		= str_replace(array('?', ' '), array('', '_'), $string);
880 880
 		}
881 881
 
882
-		$len			= strlen($string);
883
-		$post_pos		= strpos($string,'>'.$value.'"');
882
+		$len = strlen($string);
883
+		$post_pos = strpos($string, '>'.$value.'"');
884 884
 
885 885
 		if( $post_pos === false ){
886 886
 			return false;
887 887
 		}
888 888
 
889
-		$offset			= $post_pos-$len;
890
-		$post_key_pos	= strrpos( $string, '"', $offset );
891
-		$post_key_len	= strspn( $string, $integers, $post_key_pos+1 );
889
+		$offset = $post_pos-$len;
890
+		$post_key_pos	= strrpos($string, '"', $offset);
891
+		$post_key_len	= strspn($string, $integers, $post_key_pos+1);
892 892
 
893
-		return substr( $string, $post_key_pos+1, $post_key_len );
893
+		return substr($string, $post_key_pos+1, $post_key_len);
894 894
 	}
895 895
 
896 896
 
@@ -899,9 +899,9 @@  discard block
 block discarded – undo
899 899
 	 *
900 900
 	 * @param string $data_string
901 901
 	 */
902
-	public static function AStrRm( $data_string, $key ){
902
+	public static function AStrRm($data_string, $key){
903 903
 
904
-		$string =& SimpleBlogCommon::$data[$data_string];
904
+		$string = & SimpleBlogCommon::$data[$data_string];
905 905
 		$string = preg_replace('#"'.$key.'>[^">]*\"#', '"', $string);
906 906
 	}
907 907
 
@@ -909,9 +909,9 @@  discard block
 block discarded – undo
909 909
 	/**
910 910
 	 * @param string $data_string
911 911
 	 */
912
-	public static function AStrRmValue( $data_string, $value ){
912
+	public static function AStrRmValue($data_string, $value){
913 913
 
914
-		$string =& SimpleBlogCommon::$data[$data_string];
914
+		$string = & SimpleBlogCommon::$data[$data_string];
915 915
 		$string = preg_replace('#"[^">]*>'.$value.'\"#', '"', $string);
916 916
 
917 917
 	}
@@ -922,9 +922,9 @@  discard block
 block discarded – undo
922 922
 	 *
923 923
 	 * @param string $data_string
924 924
 	 */
925
-	public static function AStrToArray( $data_string ){
925
+	public static function AStrToArray($data_string){
926 926
 
927
-		$string =& SimpleBlogCommon::$data[$data_string];
927
+		$string = & SimpleBlogCommon::$data[$data_string];
928 928
 
929 929
 		$count = preg_match_all('#(?:([^">]*)>)([^">]*)#', $string, $matches);
930 930
 		if( !$count ){
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
 		$keys = $matches[1];
935 935
 		$values = $matches[2];
936 936
 
937
-		return array_combine($matches[1],$matches[2]);
937
+		return array_combine($matches[1], $matches[2]);
938 938
 	}
939 939
 
940 940
 
Please login to merge, or discard this patch.
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   +22 added lines, -22 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,23 +32,23 @@  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
-		return array_search($parts[1],$this->categories);
50
+		$parts[1] = str_replace('_', ' ', $parts[1]);
51
+		return array_search($parts[1], $this->categories);
52 52
 	}
53 53
 
54 54
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		$start = $page * $per_page;
67 67
 
68 68
 		$include_drafts = common::LoggedIn();
69
-		$show_posts = $this->WhichCatPosts( $start, $per_page, $include_drafts);
69
+		$show_posts = $this->WhichCatPosts($start, $per_page, $include_drafts);
70 70
 
71 71
 		$this->ShowPosts($show_posts);
72 72
 
@@ -75,15 +75,15 @@  discard block
 block discarded – undo
75 75
 		echo '<p class="blog_nav_links">';
76 76
 
77 77
 		if( $page > 0 ){
78
-			$html = SimpleBlogCommon::CategoryLink( $this->catindex, $catname, '%s', 'page='.($page-1), 'class="blog_newer"' );
79
-			echo gpOutput::GetAddonText('Newer Entries',$html);
78
+			$html = SimpleBlogCommon::CategoryLink($this->catindex, $catname, '%s', 'page='.($page-1), 'class="blog_newer"');
79
+			echo gpOutput::GetAddonText('Newer Entries', $html);
80 80
 			echo '&nbsp;';
81 81
 		}
82 82
 
83 83
 
84
-		if( ( ($page+1) * $per_page) < $this->total_posts ){
85
-			$html = SimpleBlogCommon::CategoryLink( $this->catindex, $catname, '%s', 'page='.($page+1), 'class="blog_older"' );
86
-			echo gpOutput::GetAddonText('Older Entries',$html);
84
+		if( (($page+1) * $per_page) < $this->total_posts ){
85
+			$html = SimpleBlogCommon::CategoryLink($this->catindex, $catname, '%s', 'page='.($page+1), 'class="blog_older"');
86
+			echo gpOutput::GetAddonText('Older Entries', $html);
87 87
 		}
88 88
 
89 89
 
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 		//remove drafts
102 102
 		$show_posts = array();
103 103
 		if( !$include_drafts ){
104
-			foreach($cat_posts as $post_id){
105
-				if( SimpleBlogCommon::AStrGet('drafts',$post_id) ){
104
+			foreach( $cat_posts as $post_id ){
105
+				if( SimpleBlogCommon::AStrGet('drafts', $post_id) ){
106 106
 					continue;
107 107
 				}
108 108
 
109
-				$time = SimpleBlogCommon::AStrGet('post_times',$post_id);
109
+				$time = SimpleBlogCommon::AStrGet('post_times', $post_id);
110 110
 				if( $time > time() ){
111 111
 					continue;
112 112
 				}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		}
119 119
 		$this->total_posts = count($show_posts);
120 120
 
121
-		return array_slice($show_posts,$start,$len);
121
+		return array_slice($show_posts, $start, $len);
122 122
 	}
123 123
 
124 124
 
@@ -130,22 +130,22 @@  discard block
 block discarded – undo
130 130
 
131 131
 
132 132
 		echo '<ul>';
133
-		foreach($this->categories as $catindex => $catname){
133
+		foreach( $this->categories as $catindex => $catname ){
134 134
 
135 135
 			//skip hidden categories
136
-			if( SimpleBlogCommon::AStrGet('categories_hidden',$catindex) ){
136
+			if( SimpleBlogCommon::AStrGet('categories_hidden', $catindex) ){
137 137
 				continue;
138 138
 			}
139 139
 
140
-			$cat_posts_str =& SimpleBlogCommon::$data['category_posts_'.$catindex];
141
-			$count = substr_count($cat_posts_str ,'>');
140
+			$cat_posts_str = & SimpleBlogCommon::$data['category_posts_'.$catindex];
141
+			$count = substr_count($cat_posts_str, '>');
142 142
 
143 143
 			if( !$count ){
144 144
 				continue;
145 145
 			}
146 146
 
147 147
 			echo '<li>';
148
-			echo SimpleBlogCommon::CategoryLink( $catindex, $catname, $catname.' ('.$count.')' );
148
+			echo SimpleBlogCommon::CategoryLink($catindex, $catname, $catname.' ('.$count.')');
149 149
 			echo '</li>';
150 150
 		}
151 151
 		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   +72 added lines, -72 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,11 +245,11 @@  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
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
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.