@@ -14,12 +14,12 @@ discard block |
||
| 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,25 +32,25 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | function CatIndex($requested){ |
| 34 | 34 | |
| 35 | - if( isset($_REQUEST['cat']) ){ |
|
| 35 | + if( isset($_REQUEST['cat']) ){ |
|
| 36 | 36 | return $_REQUEST['cat']; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if( strpos($requested,'/') === false ){ |
|
| 39 | + if( strpos($requested, '/') === false ){ |
|
| 40 | 40 | return false; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $parts = explode('/',$requested); |
|
| 43 | + $parts = explode('/', $requested); |
|
| 44 | 44 | |
| 45 | 45 | if( ctype_digit($parts[1]) ){ |
| 46 | 46 | return $parts[1]; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | - $parts[1] = str_replace('_',' ',$parts[1]); |
|
| 51 | - if (array_key_exists($parts[1],$this->categories)){ |
|
| 52 | - return $parts[1];} |
|
| 53 | - return array_search($parts[1],$this->categories); |
|
| 50 | + $parts[1] = str_replace('_', ' ', $parts[1]); |
|
| 51 | + if( array_key_exists($parts[1], $this->categories) ){ |
|
| 52 | + return $parts[1]; } |
|
| 53 | + return array_search($parts[1], $this->categories); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $start = $page * $per_page; |
| 69 | 69 | |
| 70 | 70 | $include_drafts = common::LoggedIn(); |
| 71 | - $show_posts = $this->WhichCatPosts( $start, $per_page, $include_drafts); |
|
| 71 | + $show_posts = $this->WhichCatPosts($start, $per_page, $include_drafts); |
|
| 72 | 72 | |
| 73 | 73 | $this->ShowPosts($show_posts); |
| 74 | 74 | |
@@ -77,15 +77,15 @@ discard block |
||
| 77 | 77 | echo '<p class="blog_nav_links">'; |
| 78 | 78 | |
| 79 | 79 | if( $page > 0 ){ |
| 80 | - $html = SimpleBlogCommon::CategoryLink( $this->catindex, $catname, '%s', 'page='.($page-1), 'class="blog_newer"' ); |
|
| 81 | - echo gpOutput::GetAddonText('Newer Entries',$html); |
|
| 80 | + $html = SimpleBlogCommon::CategoryLink($this->catindex, $catname, '%s', 'page='.($page-1), 'class="blog_newer"'); |
|
| 81 | + echo gpOutput::GetAddonText('Newer Entries', $html); |
|
| 82 | 82 | echo ' '; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
| 86 | - if( ( ($page+1) * $per_page) < $this->total_posts ){ |
|
| 87 | - $html = SimpleBlogCommon::CategoryLink( $this->catindex, $catname, '%s', 'page='.($page+1), 'class="blog_older"' ); |
|
| 88 | - echo gpOutput::GetAddonText('Older Entries',$html); |
|
| 86 | + if( (($page+1) * $per_page) < $this->total_posts ){ |
|
| 87 | + $html = SimpleBlogCommon::CategoryLink($this->catindex, $catname, '%s', 'page='.($page+1), 'class="blog_older"'); |
|
| 88 | + echo gpOutput::GetAddonText('Older Entries', $html); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | //remove drafts |
| 104 | 104 | $show_posts = array(); |
| 105 | 105 | if( !$include_drafts ){ |
| 106 | - foreach($cat_posts as $post_id){ |
|
| 107 | - if( SimpleBlogCommon::AStrGet('drafts',$post_id) ){ |
|
| 106 | + foreach( $cat_posts as $post_id ){ |
|
| 107 | + if( SimpleBlogCommon::AStrGet('drafts', $post_id) ){ |
|
| 108 | 108 | continue; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - $time = SimpleBlogCommon::AStrGet('post_times',$post_id); |
|
| 111 | + $time = SimpleBlogCommon::AStrGet('post_times', $post_id); |
|
| 112 | 112 | if( $time > time() ){ |
| 113 | 113 | continue; |
| 114 | 114 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | $this->total_posts = count($show_posts); |
| 122 | 122 | |
| 123 | - return array_slice($show_posts,$start,$len); |
|
| 123 | + return array_slice($show_posts, $start, $len); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
@@ -132,22 +132,22 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | echo '<ul>'; |
| 135 | - foreach($this->categories as $catindex => $catname){ |
|
| 135 | + foreach( $this->categories as $catindex => $catname ){ |
|
| 136 | 136 | |
| 137 | 137 | //skip hidden categories |
| 138 | - if( SimpleBlogCommon::AStrGet('categories_hidden',$catindex) ){ |
|
| 138 | + if( SimpleBlogCommon::AStrGet('categories_hidden', $catindex) ){ |
|
| 139 | 139 | continue; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - $cat_posts_str =& SimpleBlogCommon::$data['category_posts_'.$catindex]; |
|
| 143 | - $count = substr_count($cat_posts_str ,'>'); |
|
| 142 | + $cat_posts_str = & SimpleBlogCommon::$data['category_posts_'.$catindex]; |
|
| 143 | + $count = substr_count($cat_posts_str, '>'); |
|
| 144 | 144 | |
| 145 | 145 | if( !$count ){ |
| 146 | 146 | continue; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | echo '<li>'; |
| 150 | - echo SimpleBlogCommon::CategoryLink( $catindex, $catname, $catname.' ('.$count.')' ); |
|
| 150 | + echo SimpleBlogCommon::CategoryLink($catindex, $catname, $catname.' ('.$count.')'); |
|
| 151 | 151 | echo '</li>'; |
| 152 | 152 | } |
| 153 | 153 | echo '</ul>'; |