@@ -3,27 +3,27 @@ |
||
3 | 3 | |
4 | 4 | gpPlugin_incl('SimpleBlogCommon.php'); |
5 | 5 | |
6 | -class BlogSearch extends SimpleBlogCommon{ |
|
6 | +class BlogSearch extends SimpleBlogCommon { |
|
7 | 7 | |
8 | - function __construct($args){ |
|
8 | + function __construct($args) { |
|
9 | 9 | |
10 | 10 | SimpleBlogCommon::Init(); |
11 | 11 | |
12 | 12 | $search_obj = $args[0]; |
13 | 13 | $blog_label = common::GetLabelIndex('special_blog'); |
14 | - $post_ids = SimpleBlogCommon::AStrToArray('str_index'); |
|
14 | + $post_ids = SimpleBlogCommon::AStrToArray('str_index'); |
|
15 | 15 | |
16 | - foreach($post_ids as $id){ |
|
17 | - $post = SimpleBlogCommon::GetPostContent($id); |
|
16 | + foreach ($post_ids as $id) { |
|
17 | + $post = SimpleBlogCommon::GetPostContent($id); |
|
18 | 18 | |
19 | - if( !$post ){ |
|
19 | + if (!$post) { |
|
20 | 20 | continue; |
21 | 21 | } |
22 | 22 | |
23 | - $title = $blog_label.': '.str_replace('_',' ',$post['title']); |
|
24 | - $content = str_replace('_',' ',$post['title']).' '.$post['content']; |
|
23 | + $title = $blog_label.': '.str_replace('_', ' ', $post['title']); |
|
24 | + $content = str_replace('_', ' ', $post['title']).' '.$post['content']; |
|
25 | 25 | |
26 | - SimpleBlogCommon::UrlQuery( $id, $url, $query ); |
|
26 | + SimpleBlogCommon::UrlQuery($id, $url, $query); |
|
27 | 27 | $search_obj->FindString($content, $title, $url, $query); |
28 | 28 | } |
29 | 29 |
@@ -11,15 +11,15 @@ discard block |
||
11 | 11 | * |
12 | 12 | * |
13 | 13 | */ |
14 | -class SimpleBlogCommon{ |
|
14 | +class SimpleBlogCommon { |
|
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 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * When SimpleBlogCommon is created as an object, it will regenerate the static files |
30 | 30 | * |
31 | 31 | */ |
32 | - public function __construct(){ |
|
32 | + public function __construct() { |
|
33 | 33 | self::Init(); |
34 | 34 | self::GenStaticContent(); |
35 | 35 | } |
@@ -38,19 +38,19 @@ discard block |
||
38 | 38 | * Set variables for blog display |
39 | 39 | * |
40 | 40 | */ |
41 | - public static function Init(){ |
|
41 | + public static function Init() { |
|
42 | 42 | global $addonPathData; |
43 | 43 | |
44 | - if( isset(self::$data) ){ |
|
44 | + if (isset(self::$data)) { |
|
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 |
||
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() ){ |
|
64 | - if( @gpFiles::WriteLock() ){ |
|
63 | + if (!is_null(SimpleBlogCommon::$data['next_regen']) && SimpleBlogCommon::$data['next_regen'] < time()) { |
|
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 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * Regenerate feed and gadgets |
77 | 77 | * |
78 | 78 | */ |
79 | - public static function GenStaticContent(){ |
|
79 | + public static function GenStaticContent() { |
|
80 | 80 | gpPlugin_incl('Admin/StaticGenerator.php'); |
81 | 81 | StaticGenerator::Generate(); |
82 | 82 | } |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | * Get next static gen time |
87 | 87 | * |
88 | 88 | */ |
89 | - public static function NextGenTime(){ |
|
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){ |
|
98 | - if( $time > time() ){ |
|
97 | + foreach ($post_times as $time) { |
|
98 | + if ($time > time()) { |
|
99 | 99 | $next_regen = $time; |
100 | 100 | break; |
101 | 101 | } |
@@ -110,15 +110,15 @@ discard block |
||
110 | 110 | * Add css and some js to the page |
111 | 111 | * |
112 | 112 | */ |
113 | - public static function AddCSS(){ |
|
114 | - global $addonFolderName,$page; |
|
113 | + public static function AddCSS() { |
|
114 | + global $addonFolderName, $page; |
|
115 | 115 | |
116 | - static $added = false; |
|
116 | + static $added = false; |
|
117 | 117 | |
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; |
|
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; |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
@@ -127,24 +127,24 @@ discard block |
||
127 | 127 | * Get the user configuration and information about the current blog |
128 | 128 | * |
129 | 129 | */ |
130 | - public function GetBlogData(){ |
|
130 | + public function GetBlogData() { |
|
131 | 131 | |
132 | 132 | $blogData = array(); |
133 | - if( file_exists(self::$index_file) ){ |
|
133 | + if (file_exists(self::$index_file)) { |
|
134 | 134 | require(self::$index_file); |
135 | 135 | } |
136 | 136 | |
137 | 137 | //old twitter auth no longer works |
138 | - if( isset($blogData['twitter_username']) || isset($blogData['twitter_password']) ){ |
|
138 | + if (isset($blogData['twitter_username']) || isset($blogData['twitter_password'])) { |
|
139 | 139 | unset($blogData['twitter_username']); |
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 |
147 | - if( isset(SimpleBlogCommon::$data['post_info']) ){ |
|
147 | + if (isset(SimpleBlogCommon::$data['post_info'])) { |
|
148 | 148 | self::DataUpdate20(); |
149 | 149 | } |
150 | 150 | } |
@@ -156,15 +156,15 @@ discard block |
||
156 | 156 | * |
157 | 157 | * As of 2.0, Uses " and > instead , and : |
158 | 158 | */ |
159 | - public static function GenIndexStr(){ |
|
159 | + public static function GenIndexStr() { |
|
160 | 160 | |
161 | - if( !empty(SimpleBlogCommon::$data['str_index']) ){ |
|
162 | - if( SimpleBlogCommon::$data['str_index'][0] == ',' ){ |
|
163 | - SimpleBlogCommon::$data['str_index'] = str_replace( array(',',':'), array('"','>'), SimpleBlogCommon::$data['str_index']); |
|
161 | + if (!empty(SimpleBlogCommon::$data['str_index'])) { |
|
162 | + if (SimpleBlogCommon::$data['str_index'][0] == ',') { |
|
163 | + SimpleBlogCommon::$data['str_index'] = str_replace(array(',', ':'), array('"', '>'), SimpleBlogCommon::$data['str_index']); |
|
164 | 164 | } |
165 | 165 | return; |
166 | 166 | } |
167 | - if( !isset(SimpleBlogCommon::$data['post_list']) ){ |
|
167 | + if (!isset(SimpleBlogCommon::$data['post_list'])) { |
|
168 | 168 | return; |
169 | 169 | } |
170 | 170 | |
@@ -176,17 +176,17 @@ discard block |
||
176 | 176 | * Serialize comment counts |
177 | 177 | * |
178 | 178 | */ |
179 | - public static function DataUpdate20(){ |
|
179 | + public static function DataUpdate20() { |
|
180 | 180 | |
181 | - $comment_counts = array(); |
|
181 | + $comment_counts = array(); |
|
182 | 182 | $comments_closed = array(); |
183 | - if( isset(SimpleBlogCommon::$data['post_info']) && is_array(SimpleBlogCommon::$data['post_info']) ){ |
|
184 | - foreach(SimpleBlogCommon::$data['post_info'] as $post_id => $info){ |
|
185 | - if( isset($info['comments']) ){ |
|
183 | + if (isset(SimpleBlogCommon::$data['post_info']) && is_array(SimpleBlogCommon::$data['post_info'])) { |
|
184 | + foreach (SimpleBlogCommon::$data['post_info'] as $post_id => $info) { |
|
185 | + if (isset($info['comments'])) { |
|
186 | 186 | $comment_counts[$post_id] = $info['comments']; |
187 | 187 | } |
188 | 188 | |
189 | - if( isset($info['closecomments']) ){ |
|
189 | + if (isset($info['closecomments'])) { |
|
190 | 190 | $comments_closed[$post_id] = 1; |
191 | 191 | } |
192 | 192 | } |
@@ -199,18 +199,18 @@ discard block |
||
199 | 199 | |
200 | 200 | //use AStr data for categories |
201 | 201 | $categories = $categories_hidden = $category_posts = $post_categories = array(); |
202 | - if( !isset(SimpleBlogCommon::$data['categories']) ){ |
|
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 | - if( isset($cat['visible']) && !$cat['visible'] ){ |
|
207 | + if (isset($cat['visible']) && !$cat['visible']) { |
|
208 | 208 | $categories_hidden[$key] = 1; |
209 | 209 | } |
210 | 210 | |
211 | - if( isset($cat['posts']) && is_array($cat['posts']) ){ |
|
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 | } |
@@ -225,31 +225,31 @@ discard block |
||
225 | 225 | $post_times = array(); |
226 | 226 | |
227 | 227 | $i = 0; |
228 | - do{ |
|
228 | + do { |
|
229 | 229 | |
230 | - $posts = self::GetPostFile($i,$post_file); |
|
231 | - if( !$posts ){ |
|
230 | + $posts = self::GetPostFile($i, $post_file); |
|
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 | - if( isset($post['isDraft']) && $post['isDraft'] ){ |
|
237 | + if (isset($post['isDraft']) && $post['isDraft']) { |
|
238 | 238 | $drafts[$post_id] = 1; |
239 | 239 | } |
240 | 240 | $titles[$post_id] = $post['title']; |
241 | 241 | $post_times[$post_id] = $post['time']; |
242 | 242 | |
243 | 243 | $posts[$post_id]['categories'] = array(); |
244 | - if( isset($post_categories[$post_id]) ){ |
|
244 | + if (isset($post_categories[$post_id])) { |
|
245 | 245 | $posts[$post_id]['categories'] = $post_categories[$post_id]; |
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 ; |
|
252 | - }while( $posts ); |
|
251 | + $i += 20; |
|
252 | + }while ($posts); |
|
253 | 253 | |
254 | 254 | |
255 | 255 | //convert arrays to astr |
@@ -259,7 +259,7 @@ discard block |
||
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 | |
@@ -281,27 +281,27 @@ discard block |
||
281 | 281 | * Get a list of post indeces |
282 | 282 | * |
283 | 283 | */ |
284 | - public static function WhichPosts($start, $len, $include_drafts = false){ |
|
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); |
|
292 | - if( !$post_id ){ |
|
291 | + $post_id = SimpleBlogCommon::AStrGet('str_index', $i); |
|
292 | + if (!$post_id) { |
|
293 | 293 | continue; |
294 | 294 | } |
295 | 295 | |
296 | - if( !$include_drafts ){ |
|
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); |
|
304 | - if( $time > time() ){ |
|
303 | + $time = SimpleBlogCommon::AStrGet('post_times', $post_id); |
|
304 | + if ($time > time()) { |
|
305 | 305 | continue; |
306 | 306 | } |
307 | 307 | } |
@@ -318,12 +318,12 @@ discard block |
||
318 | 318 | * Return the configuration defaults |
319 | 319 | * @static |
320 | 320 | */ |
321 | - public static function Defaults(){ |
|
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, |
@@ -354,12 +354,12 @@ discard block |
||
354 | 354 | * Save the blog configuration and details about the blog |
355 | 355 | * |
356 | 356 | */ |
357 | - public static function SaveIndex(){ |
|
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,21 +370,21 @@ discard block |
||
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 | - if( !is_numeric($post_index) ){ |
|
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 | - if( !file_exists($post_file) ){ |
|
382 | + if (!file_exists($post_file)) { |
|
383 | 383 | return false; |
384 | 384 | } |
385 | 385 | |
386 | 386 | require($post_file); |
387 | - if( !is_array($posts) ){ |
|
387 | + if (!is_array($posts)) { |
|
388 | 388 | return false; |
389 | 389 | } |
390 | 390 | |
@@ -396,20 +396,20 @@ discard block |
||
396 | 396 | * Get the content from a single post |
397 | 397 | * |
398 | 398 | */ |
399 | - public static function GetPostContent($post_index){ |
|
399 | + public static function GetPostContent($post_index) { |
|
400 | 400 | |
401 | - $file = self::PostFilePath($post_index); |
|
402 | - if( file_exists($file) ){ |
|
401 | + $file = self::PostFilePath($post_index); |
|
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); |
|
408 | - if( $posts === false ){ |
|
407 | + $posts = self::GetPostFile($post_index, $post_file); |
|
408 | + if ($posts === false) { |
|
409 | 409 | return false; |
410 | 410 | } |
411 | 411 | |
412 | - if( !isset($posts[$post_index]) ){ |
|
412 | + if (!isset($posts[$post_index])) { |
|
413 | 413 | return false; |
414 | 414 | } |
415 | 415 | return $posts[$post_index]; |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | * @since 3.0 |
422 | 422 | * |
423 | 423 | */ |
424 | - public static function PostFilePath($post_index){ |
|
424 | + public static function PostFilePath($post_index) { |
|
425 | 425 | return self::$data_dir.'/posts/'.$post_index.'.php'; //3.0+ |
426 | 426 | } |
427 | 427 | |
@@ -431,24 +431,24 @@ discard block |
||
431 | 431 | * @return bool |
432 | 432 | * |
433 | 433 | */ |
434 | - public static function Delete(){ |
|
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); |
|
443 | - if( !file_exists($post_file) ){ |
|
442 | + $post_file = self::PostFilePath($post_id); |
|
443 | + if (!file_exists($post_file)) { |
|
444 | 444 | |
445 | - $posts = self::GetPostFile($post_id,$post_file); |
|
446 | - if( $posts === false ){ |
|
445 | + $posts = self::GetPostFile($post_id, $post_file); |
|
446 | + if ($posts === false) { |
|
447 | 447 | message($langmessage['OOPS']); |
448 | 448 | return false; |
449 | 449 | } |
450 | 450 | |
451 | - if( !isset($posts[$post_id]) ){ |
|
451 | + if (!isset($posts[$post_id])) { |
|
452 | 452 | message($langmessage['OOPS']); |
453 | 453 | return false; |
454 | 454 | } |
@@ -463,30 +463,30 @@ discard block |
||
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 | |
478 | - if( !SimpleBlogCommon::SaveIndex() ){ |
|
478 | + if (!SimpleBlogCommon::SaveIndex()) { |
|
479 | 479 | message($langmessage['OOPS']); |
480 | 480 | return false; |
481 | 481 | } |
482 | 482 | |
483 | 483 | //save data file or remove the file |
484 | - if( $posts ){ |
|
485 | - if( !gpFiles::SaveArray($post_file,'posts',$posts) ){ |
|
484 | + if ($posts) { |
|
485 | + if (!gpFiles::SaveArray($post_file, 'posts', $posts)) { |
|
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 | } |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | |
495 | 495 | //delete the comments |
496 | 496 | $commentDataFile = self::$data_dir.'/comments/'.$post_id.'.txt'; |
497 | - if( file_exists($commentDataFile) ){ |
|
497 | + if (file_exists($commentDataFile)) { |
|
498 | 498 | unlink($commentDataFile); |
499 | 499 | SimpleBlogCommon::ClearCommentCache(); |
500 | 500 | } |
@@ -512,12 +512,12 @@ discard block |
||
512 | 512 | * However, this would make it more difficult for theme developers to design for the blog plugin |
513 | 513 | * |
514 | 514 | */ |
515 | - public static function BlogHead($header,$post_index,$post,$cacheable=false){ |
|
515 | + public static function BlogHead($header, $post_index, $post, $cacheable = false) { |
|
516 | 516 | |
517 | 517 | |
518 | 518 | //subtitle |
519 | 519 | $blog_info = '{empty_blog_piece}'; |
520 | - if( !empty($post['subtitle']) ){ |
|
520 | + if (!empty($post['subtitle'])) { |
|
521 | 521 | $blog_info = '<span class="simple_blog_subtitle">'; |
522 | 522 | $blog_info .= $post['subtitle']; |
523 | 523 | $blog_info .= '</span>'; |
@@ -525,18 +525,18 @@ discard block |
||
525 | 525 | |
526 | 526 | //blog date |
527 | 527 | $blog_date = '<span class="simple_blog_date">'; |
528 | - $blog_date .= strftime(SimpleBlogCommon::$data['strftime_format'],$post['time']); |
|
528 | + $blog_date .= strftime(SimpleBlogCommon::$data['strftime_format'], $post['time']); |
|
529 | 529 | $blog_date .= '</span>'; |
530 | 530 | |
531 | 531 | |
532 | 532 | //blog comments |
533 | 533 | $blog_comments = '{empty_blog_piece}'; |
534 | - $count = SimpleBlogCommon::AStrGet('comment_counts',$post_index); |
|
535 | - if( $count > 0 ){ |
|
534 | + $count = SimpleBlogCommon::AStrGet('comment_counts', $post_index); |
|
535 | + if ($count > 0) { |
|
536 | 536 | $blog_comments = '<span class="simple_blog_comments">'; |
537 | - if( $cacheable ){ |
|
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; |
@@ -550,16 +550,16 @@ discard block |
||
550 | 550 | $search = array('{header}', '{blog_info}', '{blog_date}', '{blog_comments}'); |
551 | 551 | $replace = array($header, $blog_info, $blog_date, $blog_comments); |
552 | 552 | |
553 | - $result = str_replace($search,$replace,$format); |
|
553 | + $result = str_replace($search, $replace, $format); |
|
554 | 554 | |
555 | 555 | |
556 | 556 | $reg = '#\{empty_blog_piece\}(\s*)\{separator\}#'; |
557 | - $result = preg_replace($reg,'\1',$result); |
|
557 | + $result = preg_replace($reg, '\1', $result); |
|
558 | 558 | |
559 | 559 | $reg = '#\{separator\}(\s*){empty_blog_piece\}#'; |
560 | - $result = preg_replace($reg,'\1',$result); |
|
560 | + $result = preg_replace($reg, '\1', $result); |
|
561 | 561 | |
562 | - echo str_replace('{separator}',SimpleBlogCommon::$data['subtitle_separator'],$result); |
|
562 | + echo str_replace('{separator}', SimpleBlogCommon::$data['subtitle_separator'], $result); |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | |
@@ -575,12 +575,12 @@ discard block |
||
575 | 575 | * @deprecated 2.0 |
576 | 576 | * |
577 | 577 | */ |
578 | - public static function load_blog_categories(){ |
|
578 | + public static function load_blog_categories() { |
|
579 | 579 | global $addonPathData; |
580 | 580 | $categories_file = $addonPathData.'/categories.php'; |
581 | 581 | |
582 | - $categories = array( 'a' => array( 'ct'=>'Unsorted posts', 'visible'=>false,'posts'=>array() ) ); |
|
583 | - if( file_exists($categories_file) ){ |
|
582 | + $categories = array('a' => array('ct'=>'Unsorted posts', 'visible'=>false, 'posts'=>array())); |
|
583 | + if (file_exists($categories_file)) { |
|
584 | 584 | include($categories_file); |
585 | 585 | } |
586 | 586 | return $categories; |
@@ -591,29 +591,29 @@ discard block |
||
591 | 591 | * Remove a blog entry from a category |
592 | 592 | * |
593 | 593 | */ |
594 | - public static function DeletePostFromCategories( $post_id ){ |
|
594 | + public static function DeletePostFromCategories($post_id) { |
|
595 | 595 | |
596 | - $categories = SimpleBlogCommon::AStrToArray( 'categories' ); |
|
597 | - foreach($categories as $catindex => $catname){ |
|
598 | - SimpleBlogCommon::AStrRmValue( 'category_posts_'.$catindex, $post_id ); |
|
596 | + $categories = SimpleBlogCommon::AStrToArray('categories'); |
|
597 | + foreach ($categories as $catindex => $catname) { |
|
598 | + SimpleBlogCommon::AStrRmValue('category_posts_'.$catindex, $post_id); |
|
599 | 599 | } |
600 | 600 | } |
601 | 601 | |
602 | 602 | |
603 | - public static function Underscores($str){ |
|
604 | - if( function_exists('mb_ereg_replace') ){ |
|
603 | + public static function Underscores($str) { |
|
604 | + if (function_exists('mb_ereg_replace')) { |
|
605 | 605 | return mb_ereg_replace('_', ' ', $str); |
606 | 606 | } |
607 | 607 | return str_replace('_', ' ', $str); |
608 | 608 | } |
609 | 609 | |
610 | - public static function FileData($file){ |
|
610 | + public static function FileData($file) { |
|
611 | 611 | |
612 | - if( !file_exists($file) ){ |
|
612 | + if (!file_exists($file)) { |
|
613 | 613 | return false; |
614 | 614 | } |
615 | 615 | $dataTxt = file_get_contents($file); |
616 | - if( empty($dataTxt) ){ |
|
616 | + if (empty($dataTxt)) { |
|
617 | 617 | return false; |
618 | 618 | } |
619 | 619 | |
@@ -625,19 +625,19 @@ discard block |
||
625 | 625 | * Get the comment data for a single post |
626 | 626 | * |
627 | 627 | */ |
628 | - public static function GetCommentData($post_id){ |
|
628 | + public static function GetCommentData($post_id) { |
|
629 | 629 | |
630 | 630 | // pre 1.7.4 |
631 | 631 | $file = self::$data_dir.'/comments_data_'.$post_id.'.txt'; |
632 | 632 | $data = SimpleBlogCommon::FileData($file); |
633 | - if( is_array($data) ){ |
|
633 | + if (is_array($data)) { |
|
634 | 634 | return $data; |
635 | 635 | } |
636 | 636 | |
637 | 637 | // 1.7.4+ |
638 | 638 | $file = self::$data_dir.'/comments/'.$post_id.'.txt'; |
639 | 639 | $data = SimpleBlogCommon::FileData($file); |
640 | - if( is_array($data) ){ |
|
640 | + if (is_array($data)) { |
|
641 | 641 | return $data; |
642 | 642 | } |
643 | 643 | |
@@ -651,30 +651,30 @@ discard block |
||
651 | 651 | * Save the comment data for a blog post |
652 | 652 | * |
653 | 653 | */ |
654 | - public static function SaveCommentData($post_index,$data){ |
|
654 | + public static function SaveCommentData($post_index, $data) { |
|
655 | 655 | global $langmessage; |
656 | 656 | |
657 | 657 | |
658 | 658 | // check directory |
659 | 659 | $dir = self::$data_dir.'/comments'; |
660 | - if( !gpFiles::CheckDir($dir) ){ |
|
660 | + if (!gpFiles::CheckDir($dir)) { |
|
661 | 661 | return false; |
662 | 662 | } |
663 | 663 | |
664 | 664 | $commentDataFile = $dir.'/'.$post_index.'.txt'; |
665 | 665 | $dataTxt = serialize($data); |
666 | - if( !gpFiles::Save($commentDataFile,$dataTxt) ){ |
|
666 | + if (!gpFiles::Save($commentDataFile, $dataTxt)) { |
|
667 | 667 | return false; |
668 | 668 | } |
669 | 669 | |
670 | 670 | |
671 | 671 | // clean pre 1.7.4 files |
672 | 672 | $commentDataFile = self::$data_dir.'/comments_data_'.$post_index.'.txt'; |
673 | - if( file_exists($commentDataFile) ){ |
|
673 | + if (file_exists($commentDataFile)) { |
|
674 | 674 | unlink($commentDataFile); |
675 | 675 | } |
676 | 676 | |
677 | - SimpleBlogCommon::AStrSet('comment_counts',$post_index,count($data)); |
|
677 | + SimpleBlogCommon::AStrSet('comment_counts', $post_index, count($data)); |
|
678 | 678 | |
679 | 679 | SimpleBlogCommon::SaveIndex(); |
680 | 680 | |
@@ -687,32 +687,32 @@ discard block |
||
687 | 687 | * Delete the comments cache |
688 | 688 | * |
689 | 689 | */ |
690 | - public static function ClearCommentCache(){ |
|
690 | + public static function ClearCommentCache() { |
|
691 | 691 | $cache_file = self::$data_dir.'/comments/cache.txt'; |
692 | - if( file_exists($cache_file) ){ |
|
692 | + if (file_exists($cache_file)) { |
|
693 | 693 | unlink($cache_file); |
694 | 694 | } |
695 | 695 | } |
696 | 696 | |
697 | - public static function PostLink($post,$label,$query='',$attr=''){ |
|
698 | - return '<a href="'.SimpleBlogCommon::PostUrl($post,$query,true).'" '.$attr.'>'.common::Ampersands($label).'</a>'; |
|
697 | + public static function PostLink($post, $label, $query = '', $attr = '') { |
|
698 | + return '<a href="'.SimpleBlogCommon::PostUrl($post, $query, true).'" '.$attr.'>'.common::Ampersands($label).'</a>'; |
|
699 | 699 | } |
700 | 700 | |
701 | - public static function PostUrl( $post = false, $query='' ){ |
|
702 | - SimpleBlogCommon::UrlQuery( $post, $url, $query ); |
|
703 | - return common::GetUrl( $url, $query ); |
|
701 | + public static function PostUrl($post = false, $query = '') { |
|
702 | + SimpleBlogCommon::UrlQuery($post, $url, $query); |
|
703 | + return common::GetUrl($url, $query); |
|
704 | 704 | } |
705 | 705 | |
706 | - public static function UrlQuery( $post_id = false, &$url, &$query ){ |
|
706 | + public static function UrlQuery($post_id = false, &$url, &$query) { |
|
707 | 707 | |
708 | 708 | $url = SimpleBlogCommon::$root_url; |
709 | 709 | |
710 | - if( $post_id > 0 ){ |
|
711 | - switch( SimpleBlogCommon::$data['urls'] ){ |
|
710 | + if ($post_id > 0) { |
|
711 | + switch (SimpleBlogCommon::$data['urls']) { |
|
712 | 712 | |
713 | 713 | case 'Full': |
714 | - $title = SimpleBlogCommon::AStrGet('titles',$post_id); |
|
715 | - $title = str_replace(array('?',' '),array('','_'),$title); |
|
714 | + $title = SimpleBlogCommon::AStrGet('titles', $post_id); |
|
715 | + $title = str_replace(array('?', ' '), array('', '_'), $title); |
|
716 | 716 | $url .= '/'.$post_id.'_'.$title; |
717 | 717 | break; |
718 | 718 | |
@@ -721,26 +721,26 @@ discard block |
||
721 | 721 | break; |
722 | 722 | |
723 | 723 | case 'Title': |
724 | - $title = SimpleBlogCommon::AStrGet('titles',$post_id); |
|
725 | - $title = str_replace(array('?',' '),array('','_'),$title); |
|
724 | + $title = SimpleBlogCommon::AStrGet('titles', $post_id); |
|
725 | + $title = str_replace(array('?', ' '), array('', '_'), $title); |
|
726 | 726 | $url .= '/'.$title; |
727 | 727 | break; |
728 | 728 | |
729 | 729 | default: |
730 | - $query = trim($query.'&id='.$post_id,'&'); |
|
730 | + $query = trim($query.'&id='.$post_id, '&'); |
|
731 | 731 | break; |
732 | 732 | } |
733 | 733 | } |
734 | 734 | } |
735 | 735 | |
736 | - public static function CategoryLink( $catindex, $cattitle, $label, $query = '', $attr = '' ){ |
|
736 | + public static function CategoryLink($catindex, $cattitle, $label, $query = '', $attr = '') { |
|
737 | 737 | |
738 | 738 | $url = 'Special_Blog_Categories'; |
739 | - switch( SimpleBlogCommon::$data['urls'] ){ |
|
739 | + switch (SimpleBlogCommon::$data['urls']) { |
|
740 | 740 | |
741 | 741 | case 'Title': |
742 | 742 | case 'Full': |
743 | - $cattitle = str_replace(array('?',' '),array('','_'),$cattitle); |
|
743 | + $cattitle = str_replace(array('?', ' '), array('', '_'), $cattitle); |
|
744 | 744 | $url .= '/'.$cattitle; |
745 | 745 | break; |
746 | 746 | |
@@ -749,11 +749,11 @@ discard block |
||
749 | 749 | break; |
750 | 750 | |
751 | 751 | default: |
752 | - $query = trim('cat='.$catindex.'&'.$query,'&'); |
|
752 | + $query = trim('cat='.$catindex.'&'.$query, '&'); |
|
753 | 753 | break; |
754 | 754 | } |
755 | 755 | |
756 | - return '<a href="'.common::GetUrl( $url, $query ).'" '.$attr.'>'.common::Ampersands($label).'</a>'; |
|
756 | + return '<a href="'.common::GetUrl($url, $query).'" '.$attr.'>'.common::Ampersands($label).'</a>'; |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | |
@@ -771,11 +771,11 @@ discard block |
||
771 | 771 | * Serialize a simple array into a string |
772 | 772 | * |
773 | 773 | */ |
774 | - public static function AStrFromArray($array){ |
|
774 | + public static function AStrFromArray($array) { |
|
775 | 775 | $str = ''; |
776 | - foreach($array as $key => $value){ |
|
777 | - $key = str_replace(array('"','>'),'',$key); |
|
778 | - $value = str_replace(array('"','>'),'',$value); |
|
776 | + foreach ($array as $key => $value) { |
|
777 | + $key = str_replace(array('"', '>'), '', $key); |
|
778 | + $value = str_replace(array('"', '>'), '', $value); |
|
779 | 779 | $str .= '"'.$key.'>'.$value; |
780 | 780 | } |
781 | 781 | return $str.'"'; |
@@ -789,9 +789,9 @@ discard block |
||
789 | 789 | * @param mixed $new_value |
790 | 790 | * @deprecated 3.0.1 |
791 | 791 | */ |
792 | - public static function AStrValue( $data_string, $key, $new_value = false ){ |
|
792 | + public static function AStrValue($data_string, $key, $new_value = false) { |
|
793 | 793 | |
794 | - if( $new_value === false ){ |
|
794 | + if ($new_value === false) { |
|
795 | 795 | return self::AStrGet($data_string, $key); |
796 | 796 | } |
797 | 797 | |
@@ -804,16 +804,16 @@ discard block |
||
804 | 804 | * @param string $data_string |
805 | 805 | * @param int|string $key |
806 | 806 | */ |
807 | - public static function AStrGet( $data_string, $key){ |
|
807 | + public static function AStrGet($data_string, $key) { |
|
808 | 808 | |
809 | 809 | //get position of current value |
810 | - $prev_key_str = '"'.$key.'>'; |
|
811 | - $offset = strpos(SimpleBlogCommon::$data[$data_string],$prev_key_str); |
|
810 | + $prev_key_str = '"'.$key.'>'; |
|
811 | + $offset = strpos(SimpleBlogCommon::$data[$data_string], $prev_key_str); |
|
812 | 812 | |
813 | - if( $offset !== false ){ |
|
814 | - $offset += strlen($prev_key_str); |
|
815 | - $length = strpos(SimpleBlogCommon::$data[$data_string],'"',$offset) - $offset; |
|
816 | - return substr(SimpleBlogCommon::$data[$data_string],$offset,$length); |
|
813 | + if ($offset !== false) { |
|
814 | + $offset += strlen($prev_key_str); |
|
815 | + $length = strpos(SimpleBlogCommon::$data[$data_string], '"', $offset)-$offset; |
|
816 | + return substr(SimpleBlogCommon::$data[$data_string], $offset, $length); |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | return false; |
@@ -826,24 +826,24 @@ discard block |
||
826 | 826 | * @param int|string $key |
827 | 827 | * @param string $new_value |
828 | 828 | */ |
829 | - public static function AStrSet( $data_string, $key, $new_value){ |
|
829 | + public static function AStrSet($data_string, $key, $new_value) { |
|
830 | 830 | |
831 | 831 | |
832 | 832 | //get position of current value |
833 | - $prev_key_str = '"'.$key.'>'; |
|
834 | - $offset = strpos(SimpleBlogCommon::$data[$data_string],$prev_key_str); |
|
833 | + $prev_key_str = '"'.$key.'>'; |
|
834 | + $offset = strpos(SimpleBlogCommon::$data[$data_string], $prev_key_str); |
|
835 | 835 | |
836 | 836 | //setting values |
837 | - if( $offset === false ){ |
|
838 | - if( empty(SimpleBlogCommon::$data[$data_string]) ){ |
|
839 | - SimpleBlogCommon::$data[$data_string] = '"'; |
|
837 | + if ($offset === false) { |
|
838 | + if (empty(SimpleBlogCommon::$data[$data_string])) { |
|
839 | + SimpleBlogCommon::$data[$data_string] = '"'; |
|
840 | 840 | } |
841 | - $key = str_replace(array('"','>'),'',$key); |
|
842 | - SimpleBlogCommon::$data[$data_string] .= $key.'>'.$new_value.'"'; |
|
843 | - }else{ |
|
844 | - $offset += strlen($prev_key_str); |
|
845 | - $length = strpos(SimpleBlogCommon::$data[$data_string],'"',$offset) - $offset; |
|
846 | - SimpleBlogCommon::$data[$data_string] = substr_replace(SimpleBlogCommon::$data[$data_string],$new_value,$offset,$length); |
|
841 | + $key = str_replace(array('"', '>'), '', $key); |
|
842 | + SimpleBlogCommon::$data[$data_string] .= $key.'>'.$new_value.'"'; |
|
843 | + }else { |
|
844 | + $offset += strlen($prev_key_str); |
|
845 | + $length = strpos(SimpleBlogCommon::$data[$data_string], '"', $offset)-$offset; |
|
846 | + SimpleBlogCommon::$data[$data_string] = substr_replace(SimpleBlogCommon::$data[$data_string], $new_value, $offset, $length); |
|
847 | 847 | } |
848 | 848 | |
849 | 849 | return true; |
@@ -855,31 +855,31 @@ discard block |
||
855 | 855 | * Should be changed to allow for non-numeric keys |
856 | 856 | * |
857 | 857 | */ |
858 | - public static function AStrKey( $data_string, $value, $url_search = false ){ |
|
858 | + public static function AStrKey($data_string, $value, $url_search = false) { |
|
859 | 859 | static $integers = '0123456789'; |
860 | 860 | |
861 | - if( !isset(SimpleBlogCommon::$data[$data_string]) ){ |
|
861 | + if (!isset(SimpleBlogCommon::$data[$data_string])) { |
|
862 | 862 | return false; |
863 | 863 | } |
864 | 864 | |
865 | 865 | $string = SimpleBlogCommon::$data[$data_string]; |
866 | 866 | |
867 | - if( $url_search ){ |
|
868 | - $string = str_replace(array('?',' '),array('','_'),$string); |
|
867 | + if ($url_search) { |
|
868 | + $string = str_replace(array('?', ' '), array('', '_'), $string); |
|
869 | 869 | } |
870 | 870 | |
871 | - $len = strlen($string); |
|
872 | - $post_pos = strpos($string,'>'.$value.'"'); |
|
871 | + $len = strlen($string); |
|
872 | + $post_pos = strpos($string, '>'.$value.'"'); |
|
873 | 873 | |
874 | - if( $post_pos === false ){ |
|
874 | + if ($post_pos === false) { |
|
875 | 875 | return false; |
876 | 876 | } |
877 | 877 | |
878 | - $offset = $post_pos-$len; |
|
879 | - $post_key_pos = strrpos( $string, '"', $offset ); |
|
880 | - $post_key_len = strspn( $string, $integers, $post_key_pos+1 ); |
|
878 | + $offset = $post_pos-$len; |
|
879 | + $post_key_pos = strrpos($string, '"', $offset); |
|
880 | + $post_key_len = strspn($string, $integers, $post_key_pos+1); |
|
881 | 881 | |
882 | - return substr( $string, $post_key_pos+1, $post_key_len ); |
|
882 | + return substr($string, $post_key_pos+1, $post_key_len); |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | |
@@ -887,16 +887,16 @@ discard block |
||
887 | 887 | * Remove a key-value |
888 | 888 | * |
889 | 889 | */ |
890 | - public static function AStrRm( $data_string, $key ){ |
|
890 | + public static function AStrRm($data_string, $key) { |
|
891 | 891 | |
892 | - $string =& SimpleBlogCommon::$data[$data_string]; |
|
892 | + $string = & SimpleBlogCommon::$data[$data_string]; |
|
893 | 893 | $string = preg_replace('#"'.$key.'>[^">]*\"#', '"', $string); |
894 | 894 | } |
895 | 895 | |
896 | 896 | |
897 | - public static function AStrRmValue( $data_string, $value ){ |
|
897 | + public static function AStrRmValue($data_string, $value) { |
|
898 | 898 | |
899 | - $string =& SimpleBlogCommon::$data[$data_string]; |
|
899 | + $string = & SimpleBlogCommon::$data[$data_string]; |
|
900 | 900 | $string = preg_replace('#"[^">]*>'.$value.'\"#', '"', $string); |
901 | 901 | |
902 | 902 | } |
@@ -906,19 +906,19 @@ discard block |
||
906 | 906 | * Convert an AStr to an array |
907 | 907 | * |
908 | 908 | */ |
909 | - public static function AStrToArray( $data_string ){ |
|
909 | + public static function AStrToArray($data_string) { |
|
910 | 910 | |
911 | - $string =& SimpleBlogCommon::$data[$data_string]; |
|
911 | + $string = & SimpleBlogCommon::$data[$data_string]; |
|
912 | 912 | |
913 | 913 | $count = preg_match_all('#(?:([^">]*)>)([^">]*)#', $string, $matches); |
914 | - if( !$count ){ |
|
914 | + if (!$count) { |
|
915 | 915 | return array(); |
916 | 916 | } |
917 | 917 | |
918 | 918 | $keys = $matches[1]; |
919 | 919 | $values = $matches[2]; |
920 | 920 | |
921 | - return array_combine($matches[1],$matches[2]); |
|
921 | + return array_combine($matches[1], $matches[2]); |
|
922 | 922 | } |
923 | 923 | |
924 | 924 |
@@ -486,7 +486,7 @@ discard block |
||
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 |
||
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 |
||
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); |
@@ -3,26 +3,26 @@ |
||
3 | 3 | |
4 | 4 | gpPlugin_incl('SimpleBlogCommon.php'); |
5 | 5 | |
6 | -class SimpleBlogArchives{ |
|
6 | +class SimpleBlogArchives { |
|
7 | 7 | |
8 | - function __construct(){ |
|
8 | + function __construct() { |
|
9 | 9 | global $addonPathData; |
10 | 10 | |
11 | 11 | SimpleBlogCommon::AddCSS(); |
12 | 12 | |
13 | 13 | $content = ''; |
14 | 14 | $gadget_file = $addonPathData.'/gadget_archive.php'; |
15 | - if( file_exists($gadget_file) ){ |
|
15 | + if (file_exists($gadget_file)) { |
|
16 | 16 | $content = file_get_contents($gadget_file); |
17 | 17 | } |
18 | 18 | |
19 | 19 | //fix edit links |
20 | - if( strpos($content,'simple_blog_gadget_label') ){ |
|
20 | + if (strpos($content, 'simple_blog_gadget_label')) { |
|
21 | 21 | new SimpleBlogCommon(); |
22 | 22 | $content = file_get_contents($gadget_file); |
23 | 23 | } |
24 | 24 | |
25 | - if( empty($content) ){ |
|
25 | + if (empty($content)) { |
|
26 | 26 | return; |
27 | 27 | } |
28 | 28 |
@@ -4,24 +4,24 @@ discard block |
||
4 | 4 | //gpPlugin_incl('SimpleBlogCommon.php'); |
5 | 5 | gpPlugin_incl('SimpleBlog.php'); |
6 | 6 | |
7 | -class BlogCategories extends SimpleBlog{ |
|
7 | +class BlogCategories extends SimpleBlog { |
|
8 | 8 | |
9 | 9 | var $categories = array(); |
10 | 10 | var $catindex = false; |
11 | 11 | var $total_posts = 0; |
12 | 12 | |
13 | - function __construct(){ |
|
13 | + function __construct() { |
|
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 | - }else{ |
|
24 | + }else { |
|
25 | 25 | $this->ShowCategories(); |
26 | 26 | } |
27 | 27 | } |
@@ -30,29 +30,29 @@ discard block |
||
30 | 30 | * Get the category index from the request |
31 | 31 | * |
32 | 32 | */ |
33 | - function CatIndex($requested){ |
|
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 | - if( ctype_digit($parts[1]) ){ |
|
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 | |
55 | - function ShowCategory(){ |
|
55 | + function ShowCategory() { |
|
56 | 56 | |
57 | 57 | $this->showing_category = $this->catindex; |
58 | 58 | $catname = $this->categories[$this->catindex]; |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | //paginate |
61 | 61 | $per_page = SimpleBlogCommon::$data['per_page']; |
62 | 62 | $page = 0; |
63 | - if( isset($_GET['page']) && is_numeric($_GET['page']) ){ |
|
63 | + if (isset($_GET['page']) && is_numeric($_GET['page'])) { |
|
64 | 64 | $page = (int)$_GET['page']; |
65 | 65 | } |
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 | |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | //pagination links |
75 | 75 | echo '<p class="blog_nav_links">'; |
76 | 76 | |
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); |
|
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); |
|
80 | 80 | echo ' '; |
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 | |
@@ -93,36 +93,36 @@ discard block |
||
93 | 93 | |
94 | 94 | |
95 | 95 | |
96 | - function WhichCatPosts($start, $len, $include_drafts = false){ |
|
96 | + function WhichCatPosts($start, $len, $include_drafts = false) { |
|
97 | 97 | |
98 | 98 | $cat_posts = SimpleBlogCommon::AStrToArray('category_posts_'.$this->catindex); |
99 | 99 | |
100 | 100 | |
101 | 101 | //remove drafts |
102 | 102 | $show_posts = array(); |
103 | - if( !$include_drafts ){ |
|
104 | - foreach($cat_posts as $post_id){ |
|
105 | - if( SimpleBlogCommon::AStrGet('drafts',$post_id) ){ |
|
103 | + if (!$include_drafts) { |
|
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); |
|
110 | - if( $time > time() ){ |
|
109 | + $time = SimpleBlogCommon::AStrGet('post_times', $post_id); |
|
110 | + if ($time > time()) { |
|
111 | 111 | continue; |
112 | 112 | } |
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); |
120 | 120 | |
121 | - return array_slice($show_posts,$start,$len); |
|
121 | + return array_slice($show_posts, $start, $len); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | |
125 | - function ShowCategories(){ |
|
125 | + function ShowCategories() { |
|
126 | 126 | |
127 | 127 | echo '<h2>'; |
128 | 128 | echo gpOutput::GetAddonText('Categories'); |
@@ -130,22 +130,22 @@ discard block |
||
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 | - if( !$count ){ |
|
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>'; |
@@ -21,7 +21,7 @@ discard block |
||
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 |
||
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); |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | global $addonPathData; |
5 | 5 | $feed_file = $addonPathData.'/feed.atom'; |
6 | -if( !file_exists($feed_file) ){ |
|
6 | +if (!file_exists($feed_file)) { |
|
7 | 7 | die('Feed does not exist'); |
8 | 8 | } |
9 | 9 |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | |
31 | 31 | /* this function can be used to update the addon once changes to the text values have been made */ |
32 | -function OnTextChange(){ |
|
32 | +function OnTextChange() { |
|
33 | 33 | gpPlugin_incl('SimpleBlogCommon.php'); |
34 | - new SimpleBlogCommon();//regenerate the gadget and feed |
|
34 | + new SimpleBlogCommon(); //regenerate the gadget and feed |
|
35 | 35 | } |
@@ -5,17 +5,17 @@ discard block |
||
5 | 5 | gpPlugin_incl('Admin/Admin.php'); |
6 | 6 | |
7 | 7 | |
8 | -class AdminSimpleBlogPosts extends SimipleBlogAdmin{ |
|
8 | +class AdminSimpleBlogPosts extends SimipleBlogAdmin { |
|
9 | 9 | |
10 | - public function __construct(){ |
|
10 | + public function __construct() { |
|
11 | 11 | global $langmessage, $page; |
12 | 12 | parent::__construct(); |
13 | 13 | |
14 | 14 | |
15 | 15 | //post request |
16 | - if( strpos($page->requested,'/') ){ |
|
17 | - $parts = explode('/',$page->requested); |
|
18 | - if( $this->AdminPost($parts[1]) ){ |
|
16 | + if (strpos($page->requested, '/')) { |
|
17 | + $parts = explode('/', $page->requested); |
|
18 | + if ($this->AdminPost($parts[1])) { |
|
19 | 19 | return; |
20 | 20 | } |
21 | 21 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | //general admin |
25 | 25 | $cmd = common::GetCommand(); |
26 | - switch( $cmd ){ |
|
26 | + switch ($cmd) { |
|
27 | 27 | |
28 | 28 | //creating |
29 | 29 | case 'save_new'; |
@@ -56,44 +56,44 @@ discard block |
||
56 | 56 | * Show all blog posts |
57 | 57 | * |
58 | 58 | */ |
59 | - public function ShowPosts(){ |
|
59 | + public function ShowPosts() { |
|
60 | 60 | global $langmessage; |
61 | 61 | |
62 | 62 | $this->Heading('Admin_Blog'); |
63 | 63 | |
64 | - $post_ids = SimpleBlogCommon::AStrToArray('str_index'); |
|
64 | + $post_ids = SimpleBlogCommon::AStrToArray('str_index'); |
|
65 | 65 | $post_titles = SimpleBlogCommon::AStrToArray('titles'); |
66 | 66 | $post_times = SimpleBlogCommon::AStrToArray('post_times'); |
67 | - $post_comments = SimpleBlogCommon::AStrToArray('comment_counts'); |
|
67 | + $post_comments = SimpleBlogCommon::AStrToArray('comment_counts'); |
|
68 | 68 | $post_drafts = SimpleBlogCommon::AStrToArray('drafts'); |
69 | 69 | $total_posts = count($post_ids); |
70 | - $per_page = 20; |
|
71 | - $total_pages = ceil($total_posts/$per_page); |
|
72 | - $offset = 0; |
|
70 | + $per_page = 20; |
|
71 | + $total_pages = ceil($total_posts / $per_page); |
|
72 | + $offset = 0; |
|
73 | 73 | |
74 | 74 | |
75 | 75 | //offset |
76 | - if( isset($_REQUEST['offset']) && ctype_digit($_REQUEST['offset']) && $_REQUEST['offset'] > 0 ){ |
|
77 | - $offset = $_REQUEST['offset']; |
|
76 | + if (isset($_REQUEST['offset']) && ctype_digit($_REQUEST['offset']) && $_REQUEST['offset'] > 0) { |
|
77 | + $offset = $_REQUEST['offset']; |
|
78 | 78 | } |
79 | - $post_ids = array_slice($post_ids, $offset, $per_page); |
|
79 | + $post_ids = array_slice($post_ids, $offset, $per_page); |
|
80 | 80 | |
81 | 81 | |
82 | 82 | //pagination links |
83 | 83 | echo '<div style="float:right;margin:20px 0;">'; |
84 | 84 | echo '<span class="page_count">'; |
85 | - echo ($offset+1).' to '.min($total_posts,$offset+$per_page).' of '.$total_posts; |
|
85 | + echo ($offset+1).' to '.min($total_posts, $offset+$per_page).' of '.$total_posts; |
|
86 | 86 | echo '</span>'; |
87 | 87 | echo '<ul class="pagination">'; |
88 | 88 | |
89 | - if( $total_posts > $per_page ){ |
|
90 | - for($i = 0; $i < $total_pages; $i++){ |
|
91 | - $_offset = $i*$per_page; |
|
89 | + if ($total_posts > $per_page) { |
|
90 | + for ($i = 0; $i < $total_pages; $i++) { |
|
91 | + $_offset = $i * $per_page; |
|
92 | 92 | $class = ''; |
93 | - if( $_offset == $offset ){ |
|
93 | + if ($_offset == $offset) { |
|
94 | 94 | $class = ' class="active"'; |
95 | 95 | } |
96 | - echo '<li '.$class.'>'.common::Link('Admin_Blog',$i+1,'offset='.($_offset)).'</li>'; |
|
96 | + echo '<li '.$class.'>'.common::Link('Admin_Blog', $i+1, 'offset='.($_offset)).'</li>'; |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | echo '</ul>'; |
@@ -107,63 +107,63 @@ discard block |
||
107 | 107 | echo '<th>Options</th>'; |
108 | 108 | echo '</tr></thead>'; |
109 | 109 | echo '<tbody>'; |
110 | - foreach($post_ids as $i => $post_id){ |
|
110 | + foreach ($post_ids as $i => $post_id) { |
|
111 | 111 | |
112 | 112 | //draft/pending |
113 | 113 | echo '<tr><td width="1%">'; |
114 | - if( isset($post_drafts[$post_id]) ){ |
|
114 | + if (isset($post_drafts[$post_id])) { |
|
115 | 115 | echo 'Draft'; |
116 | - }elseif( $post_times[$post_id] > time() ){ |
|
116 | + }elseif ($post_times[$post_id] > time()) { |
|
117 | 117 | echo 'Pending'; |
118 | 118 | } |
119 | 119 | |
120 | 120 | //title |
121 | 121 | echo '</td><td>'; |
122 | 122 | $title = $post_titles[$post_id]; |
123 | - echo SimpleBlogCommon::PostLink($post_id,$title); |
|
123 | + echo SimpleBlogCommon::PostLink($post_id, $title); |
|
124 | 124 | |
125 | 125 | //post time |
126 | 126 | echo '</td><td>'; |
127 | - if( isset($post_times[$post_id]) ){ |
|
128 | - echo strftime(SimpleBlogCommon::$data['strftime_format'],$post_times[$post_id]); |
|
127 | + if (isset($post_times[$post_id])) { |
|
128 | + echo strftime(SimpleBlogCommon::$data['strftime_format'], $post_times[$post_id]); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | //comments |
132 | 132 | echo '</td><td>'; |
133 | 133 | echo '<span style="display:inline-block;min-width:30px">'; |
134 | - if( isset($post_comments[$post_id]) ){ |
|
134 | + if (isset($post_comments[$post_id])) { |
|
135 | 135 | echo number_format($post_comments[$post_id]); |
136 | - }else{ |
|
136 | + }else { |
|
137 | 137 | echo '0'; |
138 | 138 | } |
139 | 139 | echo '</span>'; |
140 | 140 | |
141 | 141 | |
142 | - if( SimpleBlogCommon::$data['allow_comments'] ){ |
|
143 | - $comments_closed = SimpleBlogCommon::AStrGet('comments_closed',$post_id); |
|
144 | - $open = gpOutput::SelectText('Open'); |
|
145 | - $close = gpOutput::SelectText('Close'); |
|
142 | + if (SimpleBlogCommon::$data['allow_comments']) { |
|
143 | + $comments_closed = SimpleBlogCommon::AStrGet('comments_closed', $post_id); |
|
144 | + $open = gpOutput::SelectText('Open'); |
|
145 | + $close = gpOutput::SelectText('Close'); |
|
146 | 146 | |
147 | - if( $comments_closed ){ |
|
148 | - echo common::Link('Admin_Blog',$open,'cmd=opencomments&id='.$post_id,'name="cnreq"'); |
|
147 | + if ($comments_closed) { |
|
148 | + echo common::Link('Admin_Blog', $open, 'cmd=opencomments&id='.$post_id, 'name="cnreq"'); |
|
149 | 149 | echo ' '; |
150 | 150 | echo gpOutput::SelectText('Closed'); |
151 | - }else{ |
|
151 | + }else { |
|
152 | 152 | echo $open; |
153 | 153 | echo ' '; |
154 | - echo common::Link('Admin_Blog',$close,'cmd=closecomments&id='.$post_id,'name="cnreq"'); |
|
154 | + echo common::Link('Admin_Blog', $close, 'cmd=closecomments&id='.$post_id, 'name="cnreq"'); |
|
155 | 155 | } |
156 | - }else{ |
|
157 | - echo common::Link('Admin_BlogConfig','Disabled'); |
|
156 | + }else { |
|
157 | + echo common::Link('Admin_BlogConfig', 'Disabled'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
161 | 161 | echo '</td><td>'; |
162 | - echo SimpleBlogCommon::PostLink($post_id,'View Post'); |
|
162 | + echo SimpleBlogCommon::PostLink($post_id, 'View Post'); |
|
163 | 163 | echo ' '; |
164 | - echo common::Link('Admin_Blog/'.$post_id,$langmessage['edit'],'cmd=edit_post'); |
|
164 | + echo common::Link('Admin_Blog/'.$post_id, $langmessage['edit'], 'cmd=edit_post'); |
|
165 | 165 | echo ' '; |
166 | - echo common::Link('Admin_Blog',$langmessage['delete'],'cmd=deleteentry&del_id='.$post_id,array('class'=>'delete gpconfirm','data-cmd'=>'cnreq','title'=>$langmessage['delete_confirm'])); |
|
166 | + echo common::Link('Admin_Blog', $langmessage['delete'], 'cmd=deleteentry&del_id='.$post_id, array('class'=>'delete gpconfirm', 'data-cmd'=>'cnreq', 'title'=>$langmessage['delete_confirm'])); |
|
167 | 167 | |
168 | 168 | echo '</td></tr>'; |
169 | 169 | } |
@@ -176,18 +176,18 @@ discard block |
||
176 | 176 | * Admin a blog post |
177 | 177 | * |
178 | 178 | */ |
179 | - public function AdminPost($id){ |
|
179 | + public function AdminPost($id) { |
|
180 | 180 | global $langmessage; |
181 | 181 | |
182 | - if( !ctype_digit($id) ){ |
|
182 | + if (!ctype_digit($id)) { |
|
183 | 183 | message($langmessage['OOPS'].' (Invalid Request)'); |
184 | 184 | return false; |
185 | 185 | } |
186 | 186 | |
187 | 187 | |
188 | - $this->post_id = $id; |
|
189 | - $this->post = SimpleBlogCommon::GetPostContent($id); |
|
190 | - if( !$this->post ){ |
|
188 | + $this->post_id = $id; |
|
189 | + $this->post = SimpleBlogCommon::GetPostContent($id); |
|
190 | + if (!$this->post) { |
|
191 | 191 | message($langmessage['OOPS'].' (No Post)'); |
192 | 192 | return false; |
193 | 193 | } |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | return true; |
198 | 198 | } |
199 | 199 | |
200 | - private function _AdminPost(){ |
|
200 | + private function _AdminPost() { |
|
201 | 201 | |
202 | 202 | $cmd = common::GetCommand(); |
203 | - switch( $cmd ){ |
|
203 | + switch ($cmd) { |
|
204 | 204 | |
205 | 205 | //editing |
206 | 206 | case 'save_edit': |
@@ -217,16 +217,16 @@ discard block |
||
217 | 217 | * Display the form for editing an existing post |
218 | 218 | * |
219 | 219 | */ |
220 | - private function EditPost(){ |
|
220 | + private function EditPost() { |
|
221 | 221 | global $langmessage, $page; |
222 | 222 | |
223 | 223 | |
224 | 224 | |
225 | - $page->ajaxReplace = array(); |
|
226 | - $post = $this->post; |
|
227 | - $_POST += $post; |
|
225 | + $page->ajaxReplace = array(); |
|
226 | + $post = $this->post; |
|
227 | + $_POST += $post; |
|
228 | 228 | |
229 | - $this->PostForm('Edit Post',$_POST,'save_edit',$this->post_id); |
|
229 | + $this->PostForm('Edit Post', $_POST, 'save_edit', $this->post_id); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | * Display the form for creating a new post |
235 | 235 | * |
236 | 236 | */ |
237 | - private function NewForm(){ |
|
238 | - $this->PostForm('New Blog Post',$_POST); |
|
237 | + private function NewForm() { |
|
238 | + $this->PostForm('New Blog Post', $_POST); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | |
@@ -247,19 +247,19 @@ discard block |
||
247 | 247 | * @param string $cmd |
248 | 248 | * @param int|string $post_id |
249 | 249 | */ |
250 | - private function PostForm($label,&$array,$cmd='save_new',$post_id=null){ |
|
250 | + private function PostForm($label, &$array, $cmd = 'save_new', $post_id = null) { |
|
251 | 251 | global $langmessage; |
252 | 252 | |
253 | 253 | includeFile('tool/editing.php'); |
254 | 254 | |
255 | - $array += array('title'=>'', 'content'=>'', 'subtitle'=>'', 'isDraft'=>false, 'categories'=>array(), 'time'=>time() ); |
|
256 | - if( $post_id ){ |
|
257 | - $array += array('isDraft'=>SimpleBlogCommon::AStrGet('drafts',$post_id)); |
|
255 | + $array += array('title'=>'', 'content'=>'', 'subtitle'=>'', 'isDraft'=>false, 'categories'=>array(), 'time'=>time()); |
|
256 | + if ($post_id) { |
|
257 | + $array += array('isDraft'=>SimpleBlogCommon::AStrGet('drafts', $post_id)); |
|
258 | 258 | } |
259 | - $array['title'] = SimpleBlogCommon::Underscores( $array['title'] ); |
|
259 | + $array['title'] = SimpleBlogCommon::Underscores($array['title']); |
|
260 | 260 | |
261 | 261 | $action = common::GetUrl('Admin_Blog'); |
262 | - if( $post_id ){ |
|
262 | + if ($post_id) { |
|
263 | 263 | $action = common::GetUrl('Admin_Blog/'.$post_id); |
264 | 264 | } |
265 | 265 | |
@@ -270,10 +270,10 @@ discard block |
||
270 | 270 | echo '<div style="float:right">'; |
271 | 271 | echo '<input type="hidden" name="cmd" value="'.$cmd.'" />'; |
272 | 272 | echo '<input class="gpsubmit" type="submit" name="" value="'.$langmessage['save'].'" /> '; |
273 | - echo common::Link('Admin_Blog',$langmessage['cancel'],'',' class="gpcancel"'); |
|
273 | + echo common::Link('Admin_Blog', $langmessage['cancel'], '', ' class="gpcancel"'); |
|
274 | 274 | |
275 | - if( $post_id ){ |
|
276 | - echo SimpleBlogCommon::PostLink($post_id,'View Post','','target="_blank"'); |
|
275 | + if ($post_id) { |
|
276 | + echo SimpleBlogCommon::PostLink($post_id, 'View Post', '', 'target="_blank"'); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | echo '<div class="sb_edit_group">'; |
310 | 310 | echo '<label>'; |
311 | 311 | echo '<input type="checkbox" name="isDraft" value="on" data-cmd="DraftCheckbox" '; |
312 | - if( $array['isDraft'] ) echo 'checked="true"'; |
|
312 | + if ($array['isDraft']) echo 'checked="true"'; |
|
313 | 313 | echo '" /> Draft</label>'; |
314 | 314 | echo '</div>'; |
315 | 315 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | //categories |
322 | 322 | echo '<div class="sb_edit_box">'; |
323 | 323 | echo '<div class="sb_edit_group">'; |
324 | - self::ShowCategoryList($post_id,$array); |
|
324 | + self::ShowCategoryList($post_id, $array); |
|
325 | 325 | echo '</div>'; |
326 | 326 | echo '</div>'; |
327 | 327 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | //content |
332 | 332 | echo '<div class="sb_post_container_left">'; |
333 | - gp_edit::UseCK($array['content'],'content'); |
|
333 | + gp_edit::UseCK($array['content'], 'content'); |
|
334 | 334 | echo '</div>'; |
335 | 335 | |
336 | 336 | echo '</div>'; |
@@ -350,10 +350,10 @@ discard block |
||
350 | 350 | * Display fields for setting publish date |
351 | 351 | * |
352 | 352 | */ |
353 | - public function FieldPublish($array){ |
|
353 | + public function FieldPublish($array) { |
|
354 | 354 | |
355 | 355 | $style = ''; |
356 | - if( $array['isDraft'] ){ |
|
356 | + if ($array['isDraft']) { |
|
357 | 357 | $style = ' style="display:none"'; |
358 | 358 | } |
359 | 359 | |
@@ -362,13 +362,13 @@ discard block |
||
362 | 362 | |
363 | 363 | |
364 | 364 | //month |
365 | - $pub_month = date('n',$array['time']); |
|
366 | - $months = array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); |
|
365 | + $pub_month = date('n', $array['time']); |
|
366 | + $months = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); |
|
367 | 367 | |
368 | 368 | echo '<select name="pub_month" style="width:4.3em">'; |
369 | - for($i = 1; $i <= 12; $i++){ |
|
369 | + for ($i = 1; $i <= 12; $i++) { |
|
370 | 370 | $selected = ''; |
371 | - if( $i == $pub_month ){ |
|
371 | + if ($i == $pub_month) { |
|
372 | 372 | $selected = 'selected'; |
373 | 373 | } |
374 | 374 | echo '<option value="'.$i.'" '.$selected.'>'.$months[$i-1].' ('.$i.')</option>'; |
@@ -376,15 +376,15 @@ discard block |
||
376 | 376 | echo '</select>'; |
377 | 377 | |
378 | 378 | //day |
379 | - echo '<input name="pub_day" value="'.date('d',$array['time']).'" style="width:2em"/>'; |
|
379 | + echo '<input name="pub_day" value="'.date('d', $array['time']).'" style="width:2em"/>'; |
|
380 | 380 | echo ', '; |
381 | - echo '<input name="pub_year" value="'.date('Y',$array['time']).'" style="width:4em"/>'; |
|
381 | + echo '<input name="pub_year" value="'.date('Y', $array['time']).'" style="width:4em"/>'; |
|
382 | 382 | |
383 | 383 | //time |
384 | 384 | echo '@'; |
385 | - echo '<input name="pub_hour" value="'.date('H',$array['time']).'" style="width:2em"/>'; |
|
385 | + echo '<input name="pub_hour" value="'.date('H', $array['time']).'" style="width:2em"/>'; |
|
386 | 386 | echo ':'; |
387 | - echo '<input name="pub_min" value="'.date('i',$array['time']).'" style="width:2em"/>'; |
|
387 | + echo '<input name="pub_min" value="'.date('i', $array['time']).'" style="width:2em"/>'; |
|
388 | 388 | |
389 | 389 | |
390 | 390 | echo '</div>'; |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | * @return bool |
398 | 398 | * |
399 | 399 | */ |
400 | - function SaveNew(){ |
|
400 | + function SaveNew() { |
|
401 | 401 | global $langmessage, $gpAdmin; |
402 | 402 | |
403 | 403 | //use current data file or create new one |
@@ -406,18 +406,18 @@ discard block |
||
406 | 406 | |
407 | 407 | //add new_id to list of indeces |
408 | 408 | $str_index = SimpleBlogCommon::AStrToArray('str_index'); |
409 | - array_unshift($str_index,$new_id); |
|
410 | - SimpleBlogCommon::$data['str_index'] = SimpleBlogCommon::AStrFromArray($str_index); |
|
409 | + array_unshift($str_index, $new_id); |
|
410 | + SimpleBlogCommon::$data['str_index'] = SimpleBlogCommon::AStrFromArray($str_index); |
|
411 | 411 | |
412 | 412 | |
413 | 413 | //save to data file |
414 | 414 | $post = array(); |
415 | - if( !self::SavePost($new_id, $post) ){ |
|
415 | + if (!self::SavePost($new_id, $post)) { |
|
416 | 416 | return false; |
417 | 417 | } |
418 | 418 | |
419 | 419 | //redirect to new post |
420 | - $url = common::GetUrl('Admin_Blog','',false); |
|
420 | + $url = common::GetUrl('Admin_Blog', '', false); |
|
421 | 421 | common::Redirect($url); |
422 | 422 | } |
423 | 423 | |
@@ -429,18 +429,18 @@ discard block |
||
429 | 429 | * @return bool |
430 | 430 | * |
431 | 431 | */ |
432 | - private function SaveEdit(){ |
|
432 | + private function SaveEdit() { |
|
433 | 433 | global $langmessage; |
434 | 434 | |
435 | 435 | |
436 | 436 | //save to data file |
437 | - if( !self::SavePost($this->post_id, $this->post) ){ |
|
437 | + if (!self::SavePost($this->post_id, $this->post)) { |
|
438 | 438 | message($langmessage['OOPS'].' (Post not saved)'); |
439 | 439 | return false; |
440 | 440 | } |
441 | 441 | |
442 | 442 | |
443 | - $this->post = SimpleBlogCommon::GetPostContent($this->post_id); |
|
443 | + $this->post = SimpleBlogCommon::GetPostContent($this->post_id); |
|
444 | 444 | |
445 | 445 | return true; |
446 | 446 | } |
@@ -450,14 +450,14 @@ discard block |
||
450 | 450 | * Save the post |
451 | 451 | * |
452 | 452 | */ |
453 | - public static function SavePost($post_id, $post){ |
|
453 | + public static function SavePost($post_id, $post) { |
|
454 | 454 | global $langmessage; |
455 | 455 | |
456 | - $_POST += array('title'=>'', 'content'=>'', 'subtitle'=>'', 'isDraft'=>'','category'=>array()); |
|
456 | + $_POST += array('title'=>'', 'content'=>'', 'subtitle'=>'', 'isDraft'=>'', 'category'=>array()); |
|
457 | 457 | $title = htmlspecialchars($_POST['title']); |
458 | 458 | $title = trim($title); |
459 | 459 | |
460 | - if( empty($title) ){ |
|
460 | + if (empty($title)) { |
|
461 | 461 | message($langmessage['TITLE_REQUIRED']); |
462 | 462 | return false; |
463 | 463 | } |
@@ -467,12 +467,12 @@ discard block |
||
467 | 467 | |
468 | 468 | //different time |
469 | 469 | //organize posts based on publish time |
470 | - SimpleBlogCommon::AStrSet('post_times',$post_id,$_POST['time']); |
|
471 | - $post_times = SimpleBlogCommon::AStrToArray('post_times'); |
|
470 | + SimpleBlogCommon::AStrSet('post_times', $post_id, $_POST['time']); |
|
471 | + $post_times = SimpleBlogCommon::AStrToArray('post_times'); |
|
472 | 472 | arsort($post_times); |
473 | 473 | |
474 | - $str_index = array_keys($post_times); |
|
475 | - SimpleBlogCommon::$data['str_index'] = SimpleBlogCommon::AStrFromArray($str_index); |
|
474 | + $str_index = array_keys($post_times); |
|
475 | + SimpleBlogCommon::$data['str_index'] = SimpleBlogCommon::AStrFromArray($str_index); |
|
476 | 476 | |
477 | 477 | |
478 | 478 | //get next static gen time |
@@ -480,33 +480,33 @@ discard block |
||
480 | 480 | |
481 | 481 | |
482 | 482 | //create post array |
483 | - $post['title'] = $title; |
|
484 | - $post['content'] = $_POST['content']; |
|
485 | - $post['subtitle'] = htmlspecialchars($_POST['subtitle']); |
|
486 | - $post['categories'] = $_POST['category']; |
|
487 | - $post['time'] = $_POST['time']; |
|
483 | + $post['title'] = $title; |
|
484 | + $post['content'] = $_POST['content']; |
|
485 | + $post['subtitle'] = htmlspecialchars($_POST['subtitle']); |
|
486 | + $post['categories'] = $_POST['category']; |
|
487 | + $post['time'] = $_POST['time']; |
|
488 | 488 | unset($post['isDraft']); |
489 | 489 | |
490 | 490 | |
491 | 491 | //save to data file |
492 | - if( !parent::SavePost($post_id, $post) ){ |
|
492 | + if (!parent::SavePost($post_id, $post)) { |
|
493 | 493 | return false; |
494 | 494 | } |
495 | 495 | |
496 | 496 | |
497 | 497 | //draft |
498 | - if( $_POST['isDraft'] === 'on' ){ |
|
499 | - SimpleBlogCommon::AStrSet('drafts',$post_id,1); |
|
500 | - }else{ |
|
501 | - SimpleBlogCommon::AStrRm('drafts',$post_id); |
|
498 | + if ($_POST['isDraft'] === 'on') { |
|
499 | + SimpleBlogCommon::AStrSet('drafts', $post_id, 1); |
|
500 | + }else { |
|
501 | + SimpleBlogCommon::AStrRm('drafts', $post_id); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | |
505 | 505 | |
506 | - SimpleBlogCommon::AStrSet('titles',$post_id,$title); |
|
507 | - self::UpdatePostCategories($post_id); //find and update the edited post in categories and archives |
|
506 | + SimpleBlogCommon::AStrSet('titles', $post_id, $title); |
|
507 | + self::UpdatePostCategories($post_id); //find and update the edited post in categories and archives |
|
508 | 508 | |
509 | - if( !SimpleBlogCommon::SaveIndex() ){ |
|
509 | + if (!SimpleBlogCommon::SaveIndex()) { |
|
510 | 510 | message($langmessage['OOPS'].' (Index not saved)'); |
511 | 511 | return false; |
512 | 512 | } |
@@ -524,14 +524,14 @@ discard block |
||
524 | 524 | * Get posted time |
525 | 525 | * |
526 | 526 | */ |
527 | - public static function GetPostedTime(){ |
|
528 | - $_POST['pub_year'] = ($_POST['pub_year'] <= 0 ) ? date('Y') : $_POST['pub_year']; |
|
529 | - $_POST['pub_month'] = ($_POST['pub_month'] <= 0 ) ? date('n') : $_POST['pub_month']; |
|
530 | - $_POST['pub_day'] = ($_POST['pub_day'] > 31 ) ? 31 : $_POST['pub_day']; |
|
531 | - $_POST['pub_day'] = ($_POST['pub_day'] <= 0 ) ? date('j') : $_POST['pub_day']; |
|
532 | - $_POST['pub_hour'] = ($_POST['pub_hour'] > 23 ) ? $_POST['pub_hour'] -24 : $_POST['pub_hour']; |
|
533 | - $_POST['pub_min'] = ($_POST['pub_min'] > 59 ) ? $_POST['pub_min'] -60 : $_POST['pub_min']; |
|
534 | - $_POST['time'] = gmmktime( $_POST['pub_hour'], $_POST['pub_min'], 0, $_POST['pub_month'], $_POST['pub_day'], $_POST['pub_year'] ); |
|
527 | + public static function GetPostedTime() { |
|
528 | + $_POST['pub_year'] = ($_POST['pub_year'] <= 0) ? date('Y') : $_POST['pub_year']; |
|
529 | + $_POST['pub_month'] = ($_POST['pub_month'] <= 0) ? date('n') : $_POST['pub_month']; |
|
530 | + $_POST['pub_day'] = ($_POST['pub_day'] > 31) ? 31 : $_POST['pub_day']; |
|
531 | + $_POST['pub_day'] = ($_POST['pub_day'] <= 0) ? date('j') : $_POST['pub_day']; |
|
532 | + $_POST['pub_hour'] = ($_POST['pub_hour'] > 23) ? $_POST['pub_hour']-24 : $_POST['pub_hour']; |
|
533 | + $_POST['pub_min'] = ($_POST['pub_min'] > 59) ? $_POST['pub_min']-60 : $_POST['pub_min']; |
|
534 | + $_POST['time'] = gmmktime($_POST['pub_hour'], $_POST['pub_min'], 0, $_POST['pub_month'], $_POST['pub_day'], $_POST['pub_year']); |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | |
@@ -539,25 +539,25 @@ discard block |
||
539 | 539 | * Show a list of all categories |
540 | 540 | * |
541 | 541 | */ |
542 | - public static function ShowCategoryList( $post_id, $post ){ |
|
542 | + public static function ShowCategoryList($post_id, $post) { |
|
543 | 543 | |
544 | 544 | $_POST += array('category'=>array()); |
545 | 545 | |
546 | 546 | echo '<label>Category</label>'; |
547 | 547 | echo '<select name="category[]" multiple="multiple" class="gpinput">'; |
548 | 548 | |
549 | - $categories = SimpleBlogCommon::AStrToArray( 'categories' ); |
|
550 | - foreach( $categories as $catindex => $catname ){ |
|
549 | + $categories = SimpleBlogCommon::AStrToArray('categories'); |
|
550 | + foreach ($categories as $catindex => $catname) { |
|
551 | 551 | |
552 | 552 | $selected = ''; |
553 | 553 | $label = $catname; |
554 | - if( $post_id && in_array($catindex, $post['categories']) ){ |
|
554 | + if ($post_id && in_array($catindex, $post['categories'])) { |
|
555 | 555 | $selected = 'selected="selected"'; |
556 | - }elseif( in_array($catindex, $_POST['category']) ){ |
|
556 | + }elseif (in_array($catindex, $_POST['category'])) { |
|
557 | 557 | $selected = 'selected="selected"'; |
558 | 558 | } |
559 | 559 | |
560 | - if( SimpleBlogCommon::AStrGet('categories_hidden', $catindex) ){ |
|
560 | + if (SimpleBlogCommon::AStrGet('categories_hidden', $catindex)) { |
|
561 | 561 | $label .= ' (Hidden)'; |
562 | 562 | } |
563 | 563 | |
@@ -573,26 +573,26 @@ discard block |
||
573 | 573 | * Update a category when a blog entry is edited |
574 | 574 | * |
575 | 575 | */ |
576 | - private static function UpdatePostCategories( $post_id ){ |
|
576 | + private static function UpdatePostCategories($post_id) { |
|
577 | 577 | |
578 | 578 | $_POST += array('category'=>array()); |
579 | 579 | |
580 | 580 | //get order of all posts |
581 | - $post_times = SimpleBlogCommon::AStrToArray( 'post_times' ); |
|
581 | + $post_times = SimpleBlogCommon::AStrToArray('post_times'); |
|
582 | 582 | arsort($post_times); |
583 | 583 | $post_times = array_keys($post_times); |
584 | 584 | |
585 | 585 | |
586 | 586 | //loop through each category |
587 | - $categories = SimpleBlogCommon::AStrToArray( 'categories' ); |
|
587 | + $categories = SimpleBlogCommon::AStrToArray('categories'); |
|
588 | 588 | |
589 | - foreach( $categories as $catindex => $catname ){ |
|
589 | + foreach ($categories as $catindex => $catname) { |
|
590 | 590 | |
591 | - SimpleBlogCommon::AStrRmValue('category_posts_'.$catindex, $post_id ); |
|
592 | - if( in_array($catindex, $_POST['category']) ){ |
|
591 | + SimpleBlogCommon::AStrRmValue('category_posts_'.$catindex, $post_id); |
|
592 | + if (in_array($catindex, $_POST['category'])) { |
|
593 | 593 | |
594 | 594 | //add and order correctly |
595 | - $category_posts = SimpleBlogCommon::AStrToArray( 'category_posts_'.$catindex ); |
|
595 | + $category_posts = SimpleBlogCommon::AStrToArray('category_posts_'.$catindex); |
|
596 | 596 | $category_posts[] = $post_id; |
597 | 597 | $category_posts = array_intersect($post_times, $category_posts); |
598 | 598 | SimpleBlogCommon::$data['category_posts_'.$catindex] = SimpleBlogCommon::AStrFromArray($category_posts); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | echo '<tr><td width="1%">'; |
114 | 114 | if( isset($post_drafts[$post_id]) ){ |
115 | 115 | echo 'Draft'; |
116 | - }elseif( $post_times[$post_id] > time() ){ |
|
116 | + } elseif( $post_times[$post_id] > time() ){ |
|
117 | 117 | echo 'Pending'; |
118 | 118 | } |
119 | 119 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | echo '<span style="display:inline-block;min-width:30px">'; |
134 | 134 | if( isset($post_comments[$post_id]) ){ |
135 | 135 | echo number_format($post_comments[$post_id]); |
136 | - }else{ |
|
136 | + } else{ |
|
137 | 137 | echo '0'; |
138 | 138 | } |
139 | 139 | echo '</span>'; |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | echo common::Link('Admin_Blog',$open,'cmd=opencomments&id='.$post_id,'name="cnreq"'); |
149 | 149 | echo ' '; |
150 | 150 | echo gpOutput::SelectText('Closed'); |
151 | - }else{ |
|
151 | + } else{ |
|
152 | 152 | echo $open; |
153 | 153 | echo ' '; |
154 | 154 | echo common::Link('Admin_Blog',$close,'cmd=closecomments&id='.$post_id,'name="cnreq"'); |
155 | 155 | } |
156 | - }else{ |
|
156 | + } else{ |
|
157 | 157 | echo common::Link('Admin_BlogConfig','Disabled'); |
158 | 158 | } |
159 | 159 | |
@@ -309,7 +309,9 @@ discard block |
||
309 | 309 | echo '<div class="sb_edit_group">'; |
310 | 310 | echo '<label>'; |
311 | 311 | echo '<input type="checkbox" name="isDraft" value="on" data-cmd="DraftCheckbox" '; |
312 | - if( $array['isDraft'] ) echo 'checked="true"'; |
|
312 | + if( $array['isDraft'] ) { |
|
313 | + echo 'checked="true"'; |
|
314 | + } |
|
313 | 315 | echo '" /> Draft</label>'; |
314 | 316 | echo '</div>'; |
315 | 317 | |
@@ -497,7 +499,7 @@ discard block |
||
497 | 499 | //draft |
498 | 500 | if( $_POST['isDraft'] === 'on' ){ |
499 | 501 | SimpleBlogCommon::AStrSet('drafts',$post_id,1); |
500 | - }else{ |
|
502 | + } else{ |
|
501 | 503 | SimpleBlogCommon::AStrRm('drafts',$post_id); |
502 | 504 | } |
503 | 505 | |
@@ -553,7 +555,7 @@ discard block |
||
553 | 555 | $label = $catname; |
554 | 556 | if( $post_id && in_array($catindex, $post['categories']) ){ |
555 | 557 | $selected = 'selected="selected"'; |
556 | - }elseif( in_array($catindex, $_POST['category']) ){ |
|
558 | + } elseif( in_array($catindex, $_POST['category']) ){ |
|
557 | 559 | $selected = 'selected="selected"'; |
558 | 560 | } |
559 | 561 |
@@ -5,24 +5,24 @@ discard block |
||
5 | 5 | gpPlugin_incl('Admin/Admin.php'); |
6 | 6 | |
7 | 7 | |
8 | -class SimpleBlogComments extends SimipleBlogAdmin{ |
|
8 | +class SimpleBlogComments extends SimipleBlogAdmin { |
|
9 | 9 | |
10 | 10 | var $dir; |
11 | 11 | var $cache = array(); |
12 | 12 | var $cache_mod = 0; |
13 | 13 | |
14 | - function __construct(){ |
|
14 | + function __construct() { |
|
15 | 15 | global $page, $addonFolderName; |
16 | 16 | |
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 | |
24 | 24 | $cmd = common::GetCommand(); |
25 | - switch( $cmd ){ |
|
25 | + switch ($cmd) { |
|
26 | 26 | case 'delete_comment': |
27 | 27 | $this->DeleteComment(); |
28 | 28 | break; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $this->ShowRecent(); |
32 | 32 | } |
33 | 33 | |
34 | - function ShowRecent(){ |
|
34 | + function ShowRecent() { |
|
35 | 35 | global $langmessage; |
36 | 36 | |
37 | 37 | |
@@ -47,15 +47,15 @@ discard block |
||
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>'; |
56 | 56 | } |
57 | 57 | |
58 | - function OutputComment($comment){ |
|
58 | + function OutputComment($comment) { |
|
59 | 59 | global $langmessage; |
60 | 60 | echo '<tr><td class="user_submitted">'; |
61 | 61 | echo '<b>'.$comment['name'].'</b>'; |
@@ -67,34 +67,34 @@ discard block |
||
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 | - if( (SimpleBlogCommon::$data['commenter_website'] == 'nofollow') && !empty($comment['website']) ){ |
|
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 | |
78 | 78 | echo '</td><td>'; |
79 | - echo SimpleBlogCommon::PostLink($comment['post_id'],'View Post'); |
|
79 | + echo SimpleBlogCommon::PostLink($comment['post_id'], 'View Post'); |
|
80 | 80 | echo ' '; |
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 | - function DeleteComment(){ |
|
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){ |
|
92 | - if( $comment['time'] == $comment_time ){ |
|
91 | + foreach ($data as $key => $comment) { |
|
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 | |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | * The cache file will store the 100 most recent comments |
104 | 104 | * |
105 | 105 | */ |
106 | - function GetCache(){ |
|
106 | + function GetCache() { |
|
107 | 107 | $this->cache = array(); |
108 | 108 | $this->cache_mod = 0; |
109 | 109 | $this->cache_file = SimpleBlogCommon::$data_dir.'/comments/cache.txt'; |
110 | 110 | |
111 | - if( file_exists($this->cache_file) ){ |
|
111 | + if (file_exists($this->cache_file)) { |
|
112 | 112 | $this->cache_mod = filemtime($this->cache_file)-100; |
113 | 113 | $this->cache = SimpleBlogCommon::FileData($this->cache_file); |
114 | 114 | } |
@@ -117,37 +117,37 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | |
120 | - function GetRecent(){ |
|
121 | - if( !file_exists($this->dir) ){ |
|
120 | + function GetRecent() { |
|
121 | + if (!file_exists($this->dir)) { |
|
122 | 122 | return false; |
123 | 123 | } |
124 | 124 | |
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 | - if( $file == '.' || $file == '..' ){ |
|
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 | - if( !is_numeric($post_id) ){ |
|
136 | + if (!is_numeric($post_id)) { |
|
137 | 137 | continue; |
138 | 138 | } |
139 | 139 | |
140 | 140 | //should already be part of the cache |
141 | 141 | $full_path = $this->dir.'/'.$file; |
142 | 142 | $mod_time = filemtime($full_path); |
143 | - if( $mod_time < $this->cache_mod ){ |
|
143 | + if ($mod_time < $this->cache_mod) { |
|
144 | 144 | continue; |
145 | 145 | } |
146 | 146 | |
147 | 147 | $data = SimpleBlogCommon::FileData($full_path); |
148 | 148 | |
149 | - foreach($data as $comment){ |
|
150 | - if( $comment['time'] < $this->cache_mod ){ |
|
149 | + foreach ($data as $comment) { |
|
150 | + if ($comment['time'] < $this->cache_mod) { |
|
151 | 151 | continue; |
152 | 152 | } |
153 | 153 | $unique = $post_id.'.'.$comment['time']; |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | - if( $new_entries ){ |
|
161 | - uasort($this->cache, array('SimpleBlogComments','Sort') ); |
|
160 | + if ($new_entries) { |
|
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){ |
|
168 | - if( $a['time'] == $b['time'] ){ |
|
167 | + function Sort($a, $b) { |
|
168 | + if ($a['time'] == $b['time']) { |
|
169 | 169 | return 0; |
170 | 170 | } |
171 | 171 | return ($a['time'] < $b['time']) ? 1 : -1; |
@@ -71,7 +71,7 @@ |
||
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 |
@@ -5,16 +5,16 @@ discard block |
||
5 | 5 | gpPlugin_incl('Admin/Admin.php'); |
6 | 6 | |
7 | 7 | |
8 | -class AdminSimpleBlogConfig extends SimipleBlogAdmin{ |
|
8 | +class AdminSimpleBlogConfig extends SimipleBlogAdmin { |
|
9 | 9 | |
10 | - function __construct(){ |
|
10 | + function __construct() { |
|
11 | 11 | global $langmessage; |
12 | 12 | |
13 | 13 | parent::__construct(); |
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(); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | //config |
26 | 26 | case 'save_config': |
27 | - if( $this->SaveConfig() ){ |
|
27 | + if ($this->SaveConfig()) { |
|
28 | 28 | SimpleBlogCommon::GenStaticContent(); |
29 | 29 | } |
30 | 30 | break; |
@@ -41,49 +41,49 @@ discard block |
||
41 | 41 | * @return bool |
42 | 42 | * |
43 | 43 | */ |
44 | - function SaveConfig(){ |
|
44 | + function SaveConfig() { |
|
45 | 45 | global $langmessage; |
46 | 46 | |
47 | 47 | |
48 | 48 | $options = self::Options(); |
49 | - if( isset($_POST['urls']) && isset($options['urls'][$_POST['urls']]) ){ |
|
49 | + if (isset($_POST['urls']) && isset($options['urls'][$_POST['urls']])) { |
|
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 | - if( is_numeric($_POST['post_abbrev']) ){ |
|
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 | |
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 | - if( @strftime($format) ){ |
|
66 | + if (@strftime($format)) { |
|
67 | 67 | SimpleBlogCommon::$data['strftime_format'] = $format; |
68 | 68 | } |
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 | - if( !SimpleBlogCommon::SaveIndex() ){ |
|
86 | + if (!SimpleBlogCommon::SaveIndex()) { |
|
87 | 87 | message($langmessage['OOPS']); |
88 | 88 | return false; |
89 | 89 | } |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | * Show the configuration form |
99 | 99 | * |
100 | 100 | */ |
101 | - function Config(){ |
|
101 | + function Config() { |
|
102 | 102 | global $langmessage, $addonFolderName, $gpversion; |
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,9 +125,9 @@ discard block |
||
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']); |
|
130 | - }else{ |
|
128 | + if (version_compare($gpversion, '4.0', '>=')) { |
|
129 | + self::Radio('urls', $options['urls'], $array['urls']); |
|
130 | + }else { |
|
131 | 131 | echo 'Available in gpEasy 4.0+'; |
132 | 132 | } |
133 | 133 | echo '</td><td>'; |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | echo '<tr><td>'; |
181 | 181 | echo 'Image in Abbrevation'; |
182 | 182 | echo '</td><td>'; |
183 | - if( $array['abbrev_image'] ){ |
|
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>'; |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | echo '<tr><td>'; |
193 | 193 | echo 'Categories in Abbrevation'; |
194 | 194 | echo '</td><td>'; |
195 | - if( $array['abbrev_cat'] ){ |
|
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>'; |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | echo '<tr><td>'; |
261 | 261 | echo 'Allow Comments'; |
262 | 262 | echo '</td><td>'; |
263 | - if( $array['allow_comments'] ){ |
|
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>'; |
@@ -281,15 +281,15 @@ discard block |
||
281 | 281 | echo 'Commenter Website'; |
282 | 282 | echo '</td><td>'; |
283 | 283 | echo '<select name="commenter_website" class="gpselect">'; |
284 | - if( $array['commenter_website'] == 'nofollow' ){ |
|
284 | + if ($array['commenter_website'] == 'nofollow') { |
|
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>'; |
@@ -303,15 +303,15 @@ discard block |
||
303 | 303 | echo 'reCaptcha'; |
304 | 304 | echo '</td><td>'; |
305 | 305 | |
306 | - if( !gp_recaptcha::isActive() ){ |
|
306 | + if (!gp_recaptcha::isActive()) { |
|
307 | 307 | $disabled = ' disabled="disabled" '; |
308 | - }else{ |
|
308 | + }else { |
|
309 | 309 | $disabled = ''; |
310 | 310 | } |
311 | 311 | |
312 | - if( $array['comment_captcha'] ){ |
|
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>'; |
@@ -329,15 +329,15 @@ discard block |
||
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 ' '; |
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>'; |
338 | 338 | } |
339 | 339 | |
340 | - static function Options(){ |
|
340 | + static function Options() { |
|
341 | 341 | |
342 | 342 | return array( |
343 | 343 | |
@@ -352,11 +352,11 @@ discard block |
||
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>'; |
@@ -364,12 +364,12 @@ discard block |
||
364 | 364 | echo '</select>'; |
365 | 365 | } |
366 | 366 | |
367 | - function Radio($name,$options,$current){ |
|
367 | + function Radio($name, $options, $current) { |
|
368 | 368 | |
369 | - foreach($options as $value => $label){ |
|
369 | + foreach ($options as $value => $label) { |
|
370 | 370 | echo '<div><label>'; |
371 | 371 | $checked = ''; |
372 | - if( $current == $value){ |
|
372 | + if ($current == $value) { |
|
373 | 373 | $checked = ' checked'; |
374 | 374 | } |
375 | 375 | echo '<input type="radio" name="'.$name.'" value="'.$value.'" '.$checked.' /> '; |
@@ -54,7 +54,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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>'; |