@@ -588,8 +588,7 @@ |
||
588 | 588 | |
589 | 589 | if($current_notification_status =="ON"){ |
590 | 590 | update_user_meta( get_current_user_id(), $_GET['notification'], "OFF"); |
591 | - } |
|
592 | - else{ |
|
591 | + } else{ |
|
593 | 592 | update_user_meta( get_current_user_id(), $_GET['notification'], "ON"); |
594 | 593 | } |
595 | 594 |
@@ -6,7 +6,9 @@ |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | // Exit if accessed directly |
9 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
9 | +if ( ! defined( 'ABSPATH' ) ) { |
|
10 | + exit; |
|
11 | +} |
|
10 | 12 | |
11 | 13 | // Load basic setup. Plugin list links, text domain, footer links etc. |
12 | 14 | require_once( BRIGHTY_CORE_PLUGIN_DIR . 'admin/basic-setup.php' ); |
@@ -10,7 +10,9 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined('ABSPATH') ) exit; |
|
13 | +if ( ! defined('ABSPATH') ) { |
|
14 | + exit; |
|
15 | +} |
|
14 | 16 | |
15 | 17 | /** |
16 | 18 | * Add admin menu pages |
@@ -12,7 +12,9 @@ |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
15 | +if ( ! defined( 'ABSPATH' ) ) { |
|
16 | + exit; |
|
17 | +} |
|
16 | 18 | |
17 | 19 | /** |
18 | 20 | * Plugin activatation todo list |
@@ -7,10 +7,14 @@ |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // Exit if accessed directly |
10 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
10 | +if ( ! defined( 'ABSPATH' ) ) { |
|
11 | + exit; |
|
12 | +} |
|
11 | 13 | |
12 | 14 | // If uninstall not called from WordPress, then die. |
13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) die; |
|
15 | +if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
16 | + die; |
|
17 | +} |
|
14 | 18 | |
15 | 19 | /** |
16 | 20 | * Delete database settings |
@@ -172,8 +172,7 @@ discard block |
||
172 | 172 | $CurrentBlock = $Block; |
173 | 173 | |
174 | 174 | continue; |
175 | - } |
|
176 | - else |
|
175 | + } else |
|
177 | 176 | { |
178 | 177 | if ($this->isBlockCompletable($CurrentBlock['type'])) |
179 | 178 | { |
@@ -232,8 +231,7 @@ discard block |
||
232 | 231 | if (isset($CurrentBlock) and ! isset($CurrentBlock['type']) and ! isset($CurrentBlock['interrupted'])) |
233 | 232 | { |
234 | 233 | $CurrentBlock['element']['text'] .= "\n".$text; |
235 | - } |
|
236 | - else |
|
234 | + } else |
|
237 | 235 | { |
238 | 236 | $Blocks []= $CurrentBlock; |
239 | 237 | |
@@ -700,8 +698,7 @@ discard block |
||
700 | 698 | |
701 | 699 | $Block['void'] = true; |
702 | 700 | } |
703 | - } |
|
704 | - else |
|
701 | + } else |
|
705 | 702 | { |
706 | 703 | if (isset($matches[2]) or in_array($matches[1], $this->voidElements)) |
707 | 704 | { |
@@ -725,18 +722,21 @@ discard block |
||
725 | 722 | return; |
726 | 723 | } |
727 | 724 | |
728 | - if (preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) # open |
|
725 | + if (preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) { |
|
726 | + # open |
|
729 | 727 | { |
730 | 728 | $Block['depth'] ++; |
731 | 729 | } |
730 | + } |
|
732 | 731 | |
733 | - if (preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) # close |
|
732 | + if (preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) { |
|
733 | + # close |
|
734 | 734 | { |
735 | 735 | if ($Block['depth'] > 0) |
736 | 736 | { |
737 | 737 | $Block['depth'] --; |
738 | - } |
|
739 | - else |
|
738 | + } |
|
739 | + } else |
|
740 | 740 | { |
741 | 741 | $Block['closed'] = true; |
742 | 742 | } |
@@ -1113,12 +1113,10 @@ discard block |
||
1113 | 1113 | if ($Excerpt['text'][1] === $marker and preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches)) |
1114 | 1114 | { |
1115 | 1115 | $emphasis = 'strong'; |
1116 | - } |
|
1117 | - elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) |
|
1116 | + } elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) |
|
1118 | 1117 | { |
1119 | 1118 | $emphasis = 'em'; |
1120 | - } |
|
1121 | - else |
|
1119 | + } else |
|
1122 | 1120 | { |
1123 | 1121 | return; |
1124 | 1122 | } |
@@ -1201,8 +1199,7 @@ discard block |
||
1201 | 1199 | $extent += strlen($matches[0]); |
1202 | 1200 | |
1203 | 1201 | $remainder = substr($remainder, $extent); |
1204 | - } |
|
1205 | - else |
|
1202 | + } else |
|
1206 | 1203 | { |
1207 | 1204 | return; |
1208 | 1205 | } |
@@ -1217,8 +1214,7 @@ discard block |
||
1217 | 1214 | } |
1218 | 1215 | |
1219 | 1216 | $extent += strlen($matches[0]); |
1220 | - } |
|
1221 | - else |
|
1217 | + } else |
|
1222 | 1218 | { |
1223 | 1219 | if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches)) |
1224 | 1220 | { |
@@ -1226,8 +1222,7 @@ discard block |
||
1226 | 1222 | $definition = strtolower($definition); |
1227 | 1223 | |
1228 | 1224 | $extent += strlen($matches[0]); |
1229 | - } |
|
1230 | - else |
|
1225 | + } else |
|
1231 | 1226 | { |
1232 | 1227 | $definition = strtolower($Element['text']); |
1233 | 1228 | } |
@@ -1375,8 +1370,7 @@ discard block |
||
1375 | 1370 | if ($this->breaksEnabled) |
1376 | 1371 | { |
1377 | 1372 | $text = preg_replace('/[ ]*\n/', "<br />\n", $text); |
1378 | - } |
|
1379 | - else |
|
1373 | + } else |
|
1380 | 1374 | { |
1381 | 1375 | $text = preg_replace('/(?:[ ][ ]+|[ ]*\\\\)\n/', "<br />\n", $text); |
1382 | 1376 | $text = str_replace(" \n", "\n", $text); |
@@ -1413,15 +1407,13 @@ discard block |
||
1413 | 1407 | if (isset($Element['handler'])) |
1414 | 1408 | { |
1415 | 1409 | $markup .= $this->{$Element['handler']}($Element['text']); |
1416 | - } |
|
1417 | - else |
|
1410 | + } else |
|
1418 | 1411 | { |
1419 | 1412 | $markup .= $Element['text']; |
1420 | 1413 | } |
1421 | 1414 | |
1422 | 1415 | $markup .= '</'.$Element['name'].'>'; |
1423 | - } |
|
1424 | - else |
|
1416 | + } else |
|
1425 | 1417 | { |
1426 | 1418 | $markup .= ' />'; |
1427 | 1419 | } |
@@ -21,8 +21,9 @@ discard block |
||
21 | 21 | function parse_readme_contents( $file_contents ) { |
22 | 22 | $file_contents = str_replace(array("\r\n", "\r"), "\n", $file_contents); |
23 | 23 | $file_contents = trim($file_contents); |
24 | - if ( 0 === strpos( $file_contents, "\xEF\xBB\xBF" ) ) |
|
25 | - $file_contents = substr( $file_contents, 3 ); |
|
24 | + if ( 0 === strpos( $file_contents, "\xEF\xBB\xBF" ) ) { |
|
25 | + $file_contents = substr( $file_contents, 3 ); |
|
26 | + } |
|
26 | 27 | |
27 | 28 | // Markdown transformations |
28 | 29 | $file_contents = preg_replace( "|^###([^#]+)#*?\s*?\n|im", '=$1='."\n", $file_contents ); |
@@ -31,8 +32,10 @@ discard block |
||
31 | 32 | |
32 | 33 | // === Plugin Name === |
33 | 34 | // Must be the very first thing. |
34 | - if ( !preg_match('|^===(.*)===|', $file_contents, $_name) ) |
|
35 | - return array(); // require a name |
|
35 | + if ( !preg_match('|^===(.*)===|', $file_contents, $_name) ) { |
|
36 | + return array(); |
|
37 | + } |
|
38 | + // require a name |
|
36 | 39 | $name = trim($_name[1], '='); |
37 | 40 | $name = $this->sanitize_text( $name ); |
38 | 41 | |
@@ -40,17 +43,19 @@ discard block |
||
40 | 43 | |
41 | 44 | |
42 | 45 | // Requires at least: 1.5 |
43 | - if ( preg_match('|Requires at least:(.*)|i', $file_contents, $_requires_at_least) ) |
|
44 | - $requires_at_least = $this->sanitize_text($_requires_at_least[1]); |
|
45 | - else |
|
46 | - $requires_at_least = NULL; |
|
46 | + if ( preg_match('|Requires at least:(.*)|i', $file_contents, $_requires_at_least) ) { |
|
47 | + $requires_at_least = $this->sanitize_text($_requires_at_least[1]); |
|
48 | + } else { |
|
49 | + $requires_at_least = NULL; |
|
50 | + } |
|
47 | 51 | |
48 | 52 | |
49 | 53 | // Tested up to: 2.1 |
50 | - if ( preg_match('|Tested up to:(.*)|i', $file_contents, $_tested_up_to) ) |
|
51 | - $tested_up_to = $this->sanitize_text( $_tested_up_to[1] ); |
|
52 | - else |
|
53 | - $tested_up_to = NULL; |
|
54 | + if ( preg_match('|Tested up to:(.*)|i', $file_contents, $_tested_up_to) ) { |
|
55 | + $tested_up_to = $this->sanitize_text( $_tested_up_to[1] ); |
|
56 | + } else { |
|
57 | + $tested_up_to = NULL; |
|
58 | + } |
|
54 | 59 | |
55 | 60 | // Requires PHP: 5.2.4 |
56 | 61 | if ( preg_match('|Requires PHP:(.*)|i', $file_contents, $_requires_php) ) { |
@@ -60,17 +65,20 @@ discard block |
||
60 | 65 | } |
61 | 66 | |
62 | 67 | // Stable tag: 10.4-ride-the-fire-eagle-danger-day |
63 | - if ( preg_match('|Stable tag:(.*)|i', $file_contents, $_stable_tag) ) |
|
64 | - $stable_tag = $this->sanitize_text( $_stable_tag[1] ); |
|
65 | - else |
|
66 | - $stable_tag = NULL; // we assume trunk, but don't set it here to tell the difference between specified trunk and default trunk |
|
68 | + if ( preg_match('|Stable tag:(.*)|i', $file_contents, $_stable_tag) ) { |
|
69 | + $stable_tag = $this->sanitize_text( $_stable_tag[1] ); |
|
70 | + } else { |
|
71 | + $stable_tag = NULL; |
|
72 | + } |
|
73 | + // we assume trunk, but don't set it here to tell the difference between specified trunk and default trunk |
|
67 | 74 | |
68 | 75 | |
69 | 76 | // Tags: some tag, another tag, we like tags |
70 | 77 | if ( preg_match('|Tags:(.*)|i', $file_contents, $_tags) ) { |
71 | 78 | $tags = preg_split('|,[\s]*?|', trim($_tags[1])); |
72 | - foreach ( array_keys($tags) as $t ) |
|
73 | - $tags[$t] = $this->sanitize_text( $tags[$t] ); |
|
79 | + foreach ( array_keys($tags) as $t ) { |
|
80 | + $tags[$t] = $this->sanitize_text( $tags[$t] ); |
|
81 | + } |
|
74 | 82 | } else { |
75 | 83 | $tags = array(); |
76 | 84 | } |
@@ -82,18 +90,20 @@ discard block |
||
82 | 90 | $temp_contributors = preg_split('|,[\s]*|', trim($_contributors[1])); |
83 | 91 | foreach ( array_keys($temp_contributors) as $c ) { |
84 | 92 | $tmp_sanitized = $this->user_sanitize( $temp_contributors[$c] ); |
85 | - if ( strlen(trim($tmp_sanitized)) > 0 ) |
|
86 | - $contributors[$c] = $tmp_sanitized; |
|
93 | + if ( strlen(trim($tmp_sanitized)) > 0 ) { |
|
94 | + $contributors[$c] = $tmp_sanitized; |
|
95 | + } |
|
87 | 96 | unset($tmp_sanitized); |
88 | 97 | } |
89 | 98 | } |
90 | 99 | |
91 | 100 | |
92 | 101 | // Donate Link: URL |
93 | - if ( preg_match('|Donate link:(.*)|i', $file_contents, $_donate_link) ) |
|
94 | - $donate_link = esc_url( $_donate_link[1] ); |
|
95 | - else |
|
96 | - $donate_link = NULL; |
|
102 | + if ( preg_match('|Donate link:(.*)|i', $file_contents, $_donate_link) ) { |
|
103 | + $donate_link = esc_url( $_donate_link[1] ); |
|
104 | + } else { |
|
105 | + $donate_link = NULL; |
|
106 | + } |
|
97 | 107 | |
98 | 108 | |
99 | 109 | // togs, conts, etc are optional and order shouldn't matter. So we chop them only after we've grabbed their values. |
@@ -108,17 +118,21 @@ discard block |
||
108 | 118 | |
109 | 119 | |
110 | 120 | // short-description fu |
111 | - if ( !preg_match('/(^(.*?))^[\s]*=+?[\s]*.+?[\s]*=+?/ms', $file_contents, $_short_description) ) |
|
112 | - $_short_description = array( 1 => &$file_contents, 2 => &$file_contents ); |
|
121 | + if ( !preg_match('/(^(.*?))^[\s]*=+?[\s]*.+?[\s]*=+?/ms', $file_contents, $_short_description) ) { |
|
122 | + $_short_description = array( 1 => &$file_contents, 2 => &$file_contents ); |
|
123 | + } |
|
113 | 124 | $short_desc_filtered = $this->sanitize_text( $_short_description[2] ); |
114 | 125 | $short_desc_length = strlen($short_desc_filtered); |
115 | 126 | $short_description = substr($short_desc_filtered, 0, 150); |
116 | - if ( $short_desc_length > strlen($short_description) ) |
|
117 | - $truncated = true; |
|
118 | - else |
|
119 | - $truncated = false; |
|
120 | - if ( $_short_description[1] ) |
|
121 | - $file_contents = $this->chop_string( $file_contents, $_short_description[1] ); // yes, the [1] is intentional |
|
127 | + if ( $short_desc_length > strlen($short_description) ) { |
|
128 | + $truncated = true; |
|
129 | + } else { |
|
130 | + $truncated = false; |
|
131 | + } |
|
132 | + if ( $_short_description[1] ) { |
|
133 | + $file_contents = $this->chop_string( $file_contents, $_short_description[1] ); |
|
134 | + } |
|
135 | + // yes, the [1] is intentional |
|
122 | 136 | |
123 | 137 | // == Section == |
124 | 138 | // Break into sections |
@@ -149,16 +163,18 @@ discard block |
||
149 | 163 | unset($sections[$special_section]); |
150 | 164 | } |
151 | 165 | } |
152 | - if ( isset($final_sections['change_log']) && empty($final_sections['changelog']) ) |
|
153 | - $final_sections['changelog'] = $final_sections['change_log']; |
|
166 | + if ( isset($final_sections['change_log']) && empty($final_sections['changelog']) ) { |
|
167 | + $final_sections['changelog'] = $final_sections['change_log']; |
|
168 | + } |
|
154 | 169 | |
155 | 170 | |
156 | 171 | $final_screenshots = array(); |
157 | 172 | if ( isset($final_sections['screenshots']) ) { |
158 | 173 | preg_match_all('|<li>(.*?)</li>|s', $final_sections['screenshots'], $screenshots, PREG_SET_ORDER); |
159 | 174 | if ( $screenshots ) { |
160 | - foreach ( (array) $screenshots as $ss ) |
|
161 | - $final_screenshots[] = $ss[1]; |
|
175 | + foreach ( (array) $screenshots as $ss ) { |
|
176 | + $final_screenshots[] = $ss[1]; |
|
177 | + } |
|
162 | 178 | } |
163 | 179 | } |
164 | 180 | |
@@ -228,8 +244,10 @@ discard block |
||
228 | 244 | } |
229 | 245 | |
230 | 246 | function user_sanitize( $text, $strict = false ) { // whitelisted chars |
231 | - if ( function_exists('user_sanitize') ) // bbPress native |
|
247 | + if ( function_exists('user_sanitize') ) { |
|
248 | + // bbPress native |
|
232 | 249 | return user_sanitize( $text, $strict ); |
250 | + } |
|
233 | 251 | |
234 | 252 | if ( $strict ) { |
235 | 253 | $text = preg_replace('/[^a-z0-9-]/i', '', $text); |
@@ -290,8 +308,9 @@ discard block |
||
290 | 308 | function code_trick( $text, $markdown ) { // Don't use bbPress native function - it's incompatible with Markdown |
291 | 309 | // If doing markdown, first take any user formatted code blocks and turn them into backticks so that |
292 | 310 | // markdown will preserve things like underscores in code blocks |
293 | - if ( $markdown ) |
|
294 | - $text = preg_replace_callback("!(<pre><code>|<code>)(.*?)(</code></pre>|</code>)!s", array( __CLASS__,'decodeit'), $text); |
|
311 | + if ( $markdown ) { |
|
312 | + $text = preg_replace_callback("!(<pre><code>|<code>)(.*?)(</code></pre>|</code>)!s", array( __CLASS__,'decodeit'), $text); |
|
313 | + } |
|
295 | 314 | |
296 | 315 | $text = str_replace(array("\r\n", "\r"), "\n", $text); |
297 | 316 | if ( !$markdown ) { |
@@ -313,8 +332,10 @@ discard block |
||
313 | 332 | } |
314 | 333 | |
315 | 334 | function encodeit( $matches ) { |
316 | - if ( function_exists('encodeit') ) // bbPress native |
|
335 | + if ( function_exists('encodeit') ) { |
|
336 | + // bbPress native |
|
317 | 337 | return encodeit( $matches ); |
338 | + } |
|
318 | 339 | |
319 | 340 | $text = trim($matches[2]); |
320 | 341 | $text = htmlspecialchars($text, ENT_QUOTES); |
@@ -323,14 +344,17 @@ discard block |
||
323 | 344 | $text = str_replace('&lt;', '<', $text); |
324 | 345 | $text = str_replace('&gt;', '>', $text); |
325 | 346 | $text = "<code>$text</code>"; |
326 | - if ( "`" != $matches[1] ) |
|
327 | - $text = "<pre>$text</pre>"; |
|
347 | + if ( "`" != $matches[1] ) { |
|
348 | + $text = "<pre>$text</pre>"; |
|
349 | + } |
|
328 | 350 | return $text; |
329 | 351 | } |
330 | 352 | |
331 | 353 | function decodeit( $matches ) { |
332 | - if ( function_exists('decodeit') ) // bbPress native |
|
354 | + if ( function_exists('decodeit') ) { |
|
355 | + // bbPress native |
|
333 | 356 | return decodeit( $matches ); |
357 | + } |
|
334 | 358 | |
335 | 359 | $text = $matches[2]; |
336 | 360 | $trans_table = array_flip(get_html_translation_table(HTML_ENTITIES)); |
@@ -338,8 +362,9 @@ discard block |
||
338 | 362 | $text = str_replace('<br />', '', $text); |
339 | 363 | $text = str_replace('&', '&', $text); |
340 | 364 | $text = str_replace(''', "'", $text); |
341 | - if ( '<pre><code>' == $matches[1] ) |
|
342 | - $text = "\n$text\n"; |
|
365 | + if ( '<pre><code>' == $matches[1] ) { |
|
366 | + $text = "\n$text\n"; |
|
367 | + } |
|
343 | 368 | return "`$text`"; |
344 | 369 | } |
345 | 370 |
@@ -67,8 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | if(is_user_logged_in()){ |
69 | 69 | echo ' '.$current_user->display_name; |
70 | - } |
|
71 | - else { |
|
70 | + } else { |
|
72 | 71 | echo _(' There!','brighty-core'); |
73 | 72 | } |
74 | 73 | |
@@ -575,8 +574,7 @@ discard block |
||
575 | 574 | |
576 | 575 | if(is_user_logged_in()){ |
577 | 576 | $menuLocation = 'user-dashboard-footer-menu-logged-in'; |
578 | - } |
|
579 | - else{ |
|
577 | + } else{ |
|
580 | 578 | $menuLocation = 'user-dashboard-footer-menu-not-logged-in'; |
581 | 579 | } |
582 | 580 |