From 963288a896672a6228e1158abd3cd034858d700a Mon Sep 17 00:00:00 2001 From: Code Review Date: Mon, 8 Feb 2016 22:02:52 -0500 Subject: [PATCH] Fixing issue(s): 228:1 Line indented incorrectly; expected 4 spaces, found 0 228:1 4 spaces found before inline comment; expected "// drupal_process_states($elements);" but found "// drupal_process_states($elements);" 232:1 Line indented incorrectly; expected 4 spaces, found 0 232:1 4 spaces found before inline comment; expected "// drupal_process_attached($elements);" but found "// drupal_process_attached($elements);" 89:1 Missing function doc comment 89:46 Expected 1 space after closing parenthesis; found 0 91:1 Whitespace found at end of line 92:3 Expected 1 space after IF keyword; 0 found 92:12 Expected 1 space after closing parenthesis; found "" 94:4 Expected 1 space after ELSE keyword; 0 found 94:3 Expected newline after closing brace 95:11 There must not be a single space before a unary operator statement 97:1 Whitespace found at end of line 98:3 Expected 1 space after IF keyword; 0 found 98:15 Expected 1 space after closing parenthesis; found "" 101:1 Whitespace found at end of line 102:3 Expected 1 space after IF keyword; 0 found 102:24 Expected 1 space after closing parenthesis; found "" 118:5 Expected 1 space after FOREACH keyword; 0 found 118:39 Expected 1 space after closing parenthesis; found "" 125:1 Missing function doc comment 125:52 Expected 1 space after closing parenthesis; found 0 126:3 Expected 1 space after IF keyword; 0 found 126:22 Expected 1 space after closing parenthesis; found "" 128:5 Expected 1 space after IF keyword; 0 found 128:31 Expected 1 space after closing parenthesis; found "" 161:42 Space found before semicolon; expected "$expire_after;" but found "$expire_after ;" 166:1 Missing function doc comment 166:55 Expected 1 space after closing parenthesis; found 0 168:1 Whitespace found at end of line 169:3 Expected 1 space after IF keyword; 0 found 169:17 Expected 1 space after closing parenthesis; found "" 172:1 Whitespace found at end of line 173:3 Expected 1 space after IF keyword; 0 found 173:15 Expected 1 space after closing parenthesis; found "" 198:5 Expected 1 space after IF keyword; 0 found 198:33 Expected 1 space after closing parenthesis; found "" 199:7 Expected 1 space after FOREACH keyword; 0 found 199:49 Expected 1 space after closing parenthesis; found "" 203:5 Expected 1 space after IF keyword; 0 found 203:34 Expected 1 space after closing parenthesis; found "" 204:7 Expected 1 space after FOREACH keyword; 0 found 204:50 Expected 1 space after closing parenthesis; found "" 208:5 Expected 1 space after IF keyword; 0 found 208:39 Expected 1 space after closing parenthesis; found "" 209:7 Expected 1 space after FOREACH keyword; 0 found 209:55 Expected 1 space after closing parenthesis; found "" 213:1 Whitespace found at end of line 214:41 Concat operator must be surrounded by a single space 214:104 Concat operator must be surrounded by a single space 220:18 Space found before semicolon; expected "$return;" but found "$return ;" 245:1 Whitespace found at end of line 245:1 Functions must not contain multiple empty lines in a row; found 2 empty lines 246:1 Whitespace found at end of line 249:1 Whitespace found at end of line 252:1 Whitespace found at end of line 258:1 Whitespace found at end of line 274:1 Whitespace found at end of line 279:1 Whitespace found at end of line 309:1 Whitespace found at end of line 321:9 Expected 1 space after IF keyword; 0 found 321:72 Expected 1 space after closing parenthesis; found "" 321:50 Expected one space after the comma, 0 found 322:11 Expected 1 space after FOREACH keyword; 0 found 322:32 Expected 1 space after closing parenthesis; found "" 326:1 Whitespace found at end of line 330:9 Expected 1 space after IF keyword; 0 found 330:66 Expected 1 space after closing parenthesis; found "" 330:47 Expected one space after the comma, 0 found 331:11 Expected 1 space after FOREACH keyword; 0 found 331:32 Expected 1 space after closing parenthesis; found "" 335:1 Whitespace found at end of line 338:1 Whitespace found at end of line 339:9 Expected 1 space after IF keyword; 0 found 339:64 Expected 1 space after closing parenthesis; found "" 339:46 Expected one space after the comma, 0 found 340:11 Expected 1 space after FOREACH keyword; 0 found 340:32 Expected 1 space after closing parenthesis; found "" 345:1 Whitespace found at end of line 402:30 If the line declaring an array spans longer than 80 characters, each element should be broken into its own line 532:1 Missing function doc comment 532:72 Expected 1 space after closing parenthesis; found 0 534:3 Expected 1 space after IF keyword; 0 found 534:18 Expected 1 space after closing parenthesis; found "" 539:1 Whitespace found at end of line 541:7 Expected 1 space after FOREACH keyword; 0 found 541:43 Expected 1 space after closing parenthesis; found "" 544:7 Expected 1 space after FOREACH keyword; 0 found 544:51 Expected 1 space after closing parenthesis; found "" 546:1 Whitespace found at end of line 547:9 Expected 1 space after IF keyword; 0 found 547:40 Expected 1 space after closing parenthesis; found "" 551:9 Expected 1 space after IF keyword; 0 found 551:40 Expected 1 space after closing parenthesis; found "" 552:11 Expected 1 space after FOREACH keyword; 0 found 552:56 Expected 1 space after closing parenthesis; found "" 556:9 Expected 1 space after IF keyword; 0 found 556:41 Expected 1 space after closing parenthesis; found "" 557:11 Expected 1 space after FOREACH keyword; 0 found 557:57 Expected 1 space after closing parenthesis; found "" 561:9 Expected 1 space after IF keyword; 0 found 561:46 Expected 1 space after closing parenthesis; found "" 562:11 Expected 1 space after FOREACH keyword; 0 found 562:62 Expected 1 space after closing parenthesis; found "" 567:1 Whitespace found at end of line 568:7 Expected 1 space after FOREACH keyword; 0 found 568:39 Expected 1 space after closing parenthesis; found "" 573:62 A comma should follow the last multiline array item. Found: ) 575:6 Expected 1 space after ELSE keyword; 0 found 575:5 Expected newline after closing brace 576:1 Whitespace found at end of line 580:62 A comma should follow the last multiline array item. Found: ) 583:1 Whitespace found at end of line 584:7 Expected 1 space after IF keyword; 0 found 584:44 Expected 1 space after closing parenthesis; found "" 584:35 Expected one space after the comma, 0 found 587:48 Space found before semicolon; expected "$expire_after;" but found "$expire_after ;" 591:1 Whitespace found at end of line 593:4 Expected 1 space after ELSE keyword; 0 found 593:3 Expected newline after closing brace --- render_boost.module | 158 ++++++++++++++++++++++++-------------------- 1 file changed, 86 insertions(+), 72 deletions(-) diff --git a/render_boost.module b/render_boost.module index 81a09fc..eafa403 100644 --- a/render_boost.module +++ b/render_boost.module @@ -86,20 +86,24 @@ function render_boost_checksum($element) { return $checksum; } -function render_boost_sanitize_form(&$element){ +/** + * + */ +function render_boost_sanitize_form(&$element) { static $deep; - - if(!$deep){ + + if (!$deep) { $deep = 1; - }else{ - $deep ++; } - - if($deep > 3){ + else { + $deep++; + } + + if ($deep > 3) { return; } - - if(is_array($element)){ + + if (is_array($element)) { if (isset($element['form_token'])) { unset($element['form_token']); } @@ -115,17 +119,20 @@ function render_boost_sanitize_form(&$element){ if (isset($element['#attached'])) { unset($element['#attached']); } - foreach($element as $key => $value){ + foreach ($element as $key => $value) { render_boost_sanitize_form($value); $element[$key] = $value; } } } -function render_boost_sanitize_objects(&$item, $key){ - if(is_object($item)){ +/** + * + */ +function render_boost_sanitize_objects(&$item, $key) { + if (is_object($item)) { $item = render_boost_get_object_values($item); - if(isset($item['created'])){ + if (isset($item['created'])) { unset($item['created']); } } @@ -158,19 +165,22 @@ function render_boost_store_cache($checksum, $data) { $config = variable_get('render_boost_settings'); $expire_after = $config['expire'] ? $config['expire'] : 3600; - $expire = REQUEST_TIME + $expire_after ; + $expire = REQUEST_TIME + $expire_after; cache_set($checksum, $data, 'cache_render', $expire); $_render_boost_devel['store'] = $_render_boost_devel['store'] + (render_boost_microtime_float() - $now); } -function render_boost_store_checksums($checksum = NULL){ +/** + * + */ +function render_boost_store_checksums($checksum = NULL) { static $checksums; - - if(!$checksums){ + + if (!$checksums) { $checksums = array(); } - - if($checksum){ + + if ($checksum) { $checksums[] = $checksum; } return $checksums; @@ -195,29 +205,29 @@ function render_boost_get_cache($checksum) { if ($cache = cache_get($checksum, 'cache_render')) { - if(isset($cache->data['js'])){ - foreach($cache->data['js'] as $key => $val){ + if (isset($cache->data['js'])) { + foreach ($cache->data['js'] as $key => $val) { drupal_add_js($key, $val['type']); } } - if(isset($cache->data['css'])){ - foreach($cache->data['css'] as $key => $val){ + if (isset($cache->data['css'])) { + foreach ($cache->data['css'] as $key => $val) { drupal_add_css($key, $val); } } - if(isset($cache->data['settings'])){ - foreach($cache->data['settings'] as $key => $val){ + if (isset($cache->data['settings'])) { + foreach ($cache->data['settings'] as $key => $val) { drupal_add_js($val, 'setting'); } } - - $return = '' . $cache->data['output'] . ''; + + $return = '' . $cache->data['output'] . ''; } $checksums[$checksum] = $return; render_boost_store_checksums($checksum); $_render_boost_devel['get'] = $_render_boost_devel['get'] + (render_boost_microtime_float() - $now); - return $return ; + return $return; } /** @@ -225,11 +235,11 @@ function render_boost_get_cache($checksum) { */ function render_boost_enable_forms_states_attaches($elements) { if (!empty($elements['#states'])) { -// drupal_process_states($elements); + // drupal_process_states($elements); } if (!empty($elements['#attached'])) { -// drupal_process_attached($elements); + // drupal_process_attached($elements); } foreach ($elements as $key => $val) { if (is_array($val)) { @@ -242,20 +252,19 @@ function render_boost_enable_forms_states_attaches($elements) { * Main function. Replace drupal_render function. */ function render_boost_drupal_render(&$elements) { - - + $output = render_boost_render($elements); preg_match_all('/