@@ -19,22 +19,22 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 ' '; |
| 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 ' '; |
| 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 |
||
| 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 |
||
| 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 |
||
| 235 | 235 | echo '<div class="blog_post post_list_item'.$class.'" '.$id.'>'; |
| 236 | 236 | |
| 237 | 237 | $header = '<h2 id="blog_post_'.$post_index.'">'; |
| 238 | - if( SimpleBlogCommon::AStrGet('drafts',$post_index) ){ |
|
| 238 | + if( SimpleBlogCommon::AStrGet('drafts', $post_index) ){ |
|
| 239 | 239 | $header .= '<span style="opacity:0.3;">'; |
| 240 | 240 | $header .= gpOutput::SelectText('Draft'); |
| 241 | 241 | $header .= '</span> '; |
@@ -245,19 +245,19 @@ discard block |
||
| 245 | 245 | $header .= '</span> '; |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - $label = SimpleBlogCommon::Underscores( $post['title'] ); |
|
| 249 | - $header .= SimpleBlogCommon::PostLink($post_index,$label); |
|
| 248 | + $label = SimpleBlogCommon::Underscores($post['title']); |
|
| 249 | + $header .= SimpleBlogCommon::PostLink($post_index, $label); |
|
| 250 | 250 | $header .= '</h2>'; |
| 251 | 251 | |
| 252 | - SimpleBlogCommon::BlogHead($header,$post_index,$post); |
|
| 252 | + SimpleBlogCommon::BlogHead($header, $post_index, $post); |
|
| 253 | 253 | |
| 254 | 254 | echo '<div class="twysiwygr">'; |
| 255 | 255 | |
| 256 | - if( !empty(SimpleBlogCommon::$data['post_abbrev']) && SimpleBlogCommon::$data['abbrev_image'] ){ |
|
| 256 | + if( !empty(SimpleBlogCommon::$data['post_abbrev']) && SimpleBlogCommon::$data['abbrev_image'] ){ |
|
| 257 | 257 | $this->GetImageFromPost($post['content']); |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - echo $this->AbbrevContent( $post['content'], $post_index, SimpleBlogCommon::$data['post_abbrev']); |
|
| 260 | + echo $this->AbbrevContent($post['content'], $post_index, SimpleBlogCommon::$data['post_abbrev']); |
|
| 261 | 261 | echo '</div>'; |
| 262 | 262 | |
| 263 | 263 | echo '</div>'; |
@@ -266,12 +266,12 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -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,27 +32,27 @@ 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) ){ |
|
| 50 | + $parts[1] = str_replace('_', ' ', $parts[1]); |
|
| 51 | + if( array_key_exists($parts[1], $this->categories) ){ |
|
| 52 | 52 | return $parts[1]; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - return array_search($parts[1],$this->categories); |
|
| 55 | + return array_search($parts[1], $this->categories); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $start = $page * $per_page; |
| 71 | 71 | |
| 72 | 72 | $include_drafts = common::LoggedIn(); |
| 73 | - $show_posts = $this->WhichCatPosts( $start, $per_page, $include_drafts); |
|
| 73 | + $show_posts = $this->WhichCatPosts($start, $per_page, $include_drafts); |
|
| 74 | 74 | |
| 75 | 75 | $this->ShowPosts($show_posts); |
| 76 | 76 | |
@@ -79,15 +79,15 @@ discard block |
||
| 79 | 79 | echo '<p class="blog_nav_links">'; |
| 80 | 80 | |
| 81 | 81 | if( $page > 0 ){ |
| 82 | - $html = SimpleBlogCommon::CategoryLink( $this->catindex, $catname, '%s', 'page='.($page-1), 'class="blog_newer"' ); |
|
| 83 | - echo gpOutput::GetAddonText('Newer Entries',$html); |
|
| 82 | + $html = SimpleBlogCommon::CategoryLink($this->catindex, $catname, '%s', 'page='.($page-1), 'class="blog_newer"'); |
|
| 83 | + echo gpOutput::GetAddonText('Newer Entries', $html); |
|
| 84 | 84 | echo ' '; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
| 88 | - if( ( ($page+1) * $per_page) < $this->total_posts ){ |
|
| 89 | - $html = SimpleBlogCommon::CategoryLink( $this->catindex, $catname, '%s', 'page='.($page+1), 'class="blog_older"' ); |
|
| 90 | - echo gpOutput::GetAddonText('Older Entries',$html); |
|
| 88 | + if( (($page+1) * $per_page) < $this->total_posts ){ |
|
| 89 | + $html = SimpleBlogCommon::CategoryLink($this->catindex, $catname, '%s', 'page='.($page+1), 'class="blog_older"'); |
|
| 90 | + echo gpOutput::GetAddonText('Older Entries', $html); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
@@ -105,12 +105,12 @@ discard block |
||
| 105 | 105 | //remove drafts |
| 106 | 106 | $show_posts = array(); |
| 107 | 107 | if( !$include_drafts ){ |
| 108 | - foreach($cat_posts as $post_id){ |
|
| 109 | - if( SimpleBlogCommon::AStrGet('drafts',$post_id) ){ |
|
| 108 | + foreach( $cat_posts as $post_id ){ |
|
| 109 | + if( SimpleBlogCommon::AStrGet('drafts', $post_id) ){ |
|
| 110 | 110 | continue; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - $time = SimpleBlogCommon::AStrGet('post_times',$post_id); |
|
| 113 | + $time = SimpleBlogCommon::AStrGet('post_times', $post_id); |
|
| 114 | 114 | if( $time > time() ){ |
| 115 | 115 | continue; |
| 116 | 116 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | $this->total_posts = count($show_posts); |
| 124 | 124 | |
| 125 | - return array_slice($show_posts,$start,$len); |
|
| 125 | + return array_slice($show_posts, $start, $len); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
@@ -134,22 +134,22 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | |
| 136 | 136 | echo '<ul>'; |
| 137 | - foreach($this->categories as $catindex => $catname){ |
|
| 137 | + foreach( $this->categories as $catindex => $catname ){ |
|
| 138 | 138 | |
| 139 | 139 | //skip hidden categories |
| 140 | - if( SimpleBlogCommon::AStrGet('categories_hidden',$catindex) ){ |
|
| 140 | + if( SimpleBlogCommon::AStrGet('categories_hidden', $catindex) ){ |
|
| 141 | 141 | continue; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $cat_posts_str =& SimpleBlogCommon::$data['category_posts_'.$catindex]; |
|
| 145 | - $count = substr_count($cat_posts_str ,'>'); |
|
| 144 | + $cat_posts_str = & SimpleBlogCommon::$data['category_posts_'.$catindex]; |
|
| 145 | + $count = substr_count($cat_posts_str, '>'); |
|
| 146 | 146 | |
| 147 | 147 | if( !$count ){ |
| 148 | 148 | continue; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | echo '<li>'; |
| 152 | - echo SimpleBlogCommon::CategoryLink( $catindex, $catname, $catname.' ('.$count.')' ); |
|
| 152 | + echo SimpleBlogCommon::CategoryLink($catindex, $catname, $catname.' ('.$count.')'); |
|
| 153 | 153 | echo '</li>'; |
| 154 | 154 | } |
| 155 | 155 | echo '</ul>'; |