@@ -25,7 +25,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -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,11 +245,11 @@ 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 | |
@@ -257,7 +257,7 @@ discard block |
||
| 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 | |