Commit 9b5766d2 by Scott

Coding style (various minor typos/spacing issues)

parent 4a51a213
...@@ -573,7 +573,7 @@ class Q2A_Util_String ...@@ -573,7 +573,7 @@ class Q2A_Util_String
// replace all word separators with spaces of same length // replace all word separators with spaces of same length
if (empty(self::$utf8PunctuationKeepLength)) { if (empty(self::$utf8PunctuationKeepLength)) {
foreach (self::$utf8Punctuation as $key=>$value) foreach (self::$utf8Punctuation as $key => $value)
self::$utf8PunctuationKeepLength[$key] = str_repeat(' ', strlen($key)); self::$utf8PunctuationKeepLength[$key] = str_repeat(' ', strlen($key));
} }
......
...@@ -107,7 +107,9 @@ ...@@ -107,7 +107,9 @@
/** /**
* @deprecated Deprecated since Q2A 1.3 now that all options are retrieved together. * @deprecated Deprecated since Q2A 1.3 now that all options are retrieved together.
*/ */
function qa_options_set_pending($names) {} function qa_options_set_pending($names)
{
}
function qa_preload_options() function qa_preload_options()
......
...@@ -307,7 +307,7 @@ ...@@ -307,7 +307,7 @@
array_push($showoptions, 'show_custom_register', 'custom_register', 'show_register_terms', 'register_terms', 'show_notice_welcome', 'notice_welcome', 'show_custom_welcome', 'custom_welcome'); array_push($showoptions, 'show_custom_register', 'custom_register', 'show_register_terms', 'register_terms', 'show_notice_welcome', 'notice_welcome', 'show_custom_welcome', 'custom_welcome');
array_push($showoptions, '' ,'allow_login_email_only', 'allow_change_usernames', 'allow_private_messages', 'show_message_history', 'page_size_pms', 'allow_user_walls', 'page_size_wall', '', 'avatar_allow_gravatar'); array_push($showoptions, '', 'allow_login_email_only', 'allow_change_usernames', 'allow_private_messages', 'show_message_history', 'page_size_pms', 'allow_user_walls', 'page_size_wall', '', 'avatar_allow_gravatar');
if (qa_has_gd_image()) if (qa_has_gd_image())
array_push($showoptions, 'avatar_allow_upload', 'avatar_store_size', 'avatar_default_show'); array_push($showoptions, 'avatar_allow_upload', 'avatar_store_size', 'avatar_default_show');
...@@ -1142,7 +1142,7 @@ ...@@ -1142,7 +1142,7 @@
$optionfield['note'] = qa_lang_html('admin/pixels'); $optionfield['note'] = qa_lang_html('admin/pixels');
break; break;
case 'avatar_default_show'; case 'avatar_default_show':
$qa_content['form']['tags'] .= 'enctype="multipart/form-data"'; $qa_content['form']['tags'] .= 'enctype="multipart/form-data"';
$optionfield['label'] .= ' <span style="margin:2px 0; display:inline-block;">'. $optionfield['label'] .= ' <span style="margin:2px 0; display:inline-block;">'.
qa_get_avatar_blob_html(qa_opt('avatar_default_blobid'), qa_opt('avatar_default_width'), qa_opt('avatar_default_height'), 32). qa_get_avatar_blob_html(qa_opt('avatar_default_blobid'), qa_opt('avatar_default_width'), qa_opt('avatar_default_height'), 32).
...@@ -1287,7 +1287,7 @@ ...@@ -1287,7 +1287,7 @@
$optionfield['label'] = '<span id="moderate_points_label_off" style="display:none;">'.$optionfield['label'].'</span><span id="moderate_points_label_on">'.qa_lang_html('options/moderate_points_limit').'</span>'; $optionfield['label'] = '<span id="moderate_points_label_off" style="display:none;">'.$optionfield['label'].'</span><span id="moderate_points_label_on">'.qa_lang_html('options/moderate_points_limit').'</span>';
break; break;
case 'moderate_points_limit'; case 'moderate_points_limit':
unset($optionfield['label']); unset($optionfield['label']);
$optionfield['note'] = qa_lang_html('admin/points'); $optionfield['note'] = qa_lang_html('admin/points');
break; break;
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
if (empty($inemailhandle) || isset($errors['emailhandle'])) if (empty($inemailhandle) || isset($errors['emailhandle']))
$forgotpath=qa_path('forgot'); $forgotpath=qa_path('forgot');
else else
$forgotpath=qa_path('forgot', array('e' => $inemailhandle)); $forgotpath=qa_path('forgot', array('e' => $inemailhandle));
$qa_content['form']=array( $qa_content['form']=array(
'tags' => 'method="post" action="'.qa_self_html().'"', 'tags' => 'method="post" action="'.qa_self_html().'"',
......
...@@ -556,11 +556,11 @@ ...@@ -556,11 +556,11 @@
// Low-level functions used throughout Q2A // Low-level functions used throughout Q2A
/**
* Calls eval() on the PHP code in $eval which came from the file $filename. It supplements PHP's regular error reporting by
* displaying/logging (as appropriate) the original source filename, if an error occurred when evaluating the code.
*/
function qa_eval_from_file($eval, $filename) function qa_eval_from_file($eval, $filename)
/*
Calls eval() on the PHP code in $eval which came from the file $filename. It supplements PHP's regular error reporting by
displaying/logging (as appropriate) the original source filename, if an error occurred when evaluating the code.
*/
{ {
// could also use ini_set('error_append_string') but apparently it doesn't work for errors logged on disk // could also use ini_set('error_append_string') but apparently it doesn't work for errors logged on disk
...@@ -585,18 +585,25 @@ ...@@ -585,18 +585,25 @@
} }
/**
* Call $function with the arguments in the $args array (doesn't work with call-by-reference functions)
*/
function qa_call($function, $args) function qa_call($function, $args)
/*
Call $function with the arguments in the $args array (doesn't work with call-by-reference functions)
*/
{ {
switch (count($args)) { // call_user_func_array(...) is very slow, so we break out most cases // call_user_func_array(...) is very slow, so we break out most common cases first
case 0: return $function(); switch (count($args)) {
case 1: return $function($args[0]); case 0:
case 2: return $function($args[0], $args[1]); return $function();
case 3: return $function($args[0], $args[1], $args[2]); case 1:
case 4: return $function($args[0], $args[1], $args[2], $args[3]); return $function($args[0]);
case 5: return $function($args[0], $args[1], $args[2], $args[3], $args[4]); case 2:
return $function($args[0], $args[1]);
case 3:
return $function($args[0], $args[1], $args[2]);
case 4:
return $function($args[0], $args[1], $args[2], $args[3]);
case 5:
return $function($args[0], $args[1], $args[2], $args[3], $args[4]);
} }
return call_user_func_array($function, $args); return call_user_func_array($function, $args);
......
...@@ -376,7 +376,7 @@ ...@@ -376,7 +376,7 @@
*/ */
function qa_db_random_bigint() function qa_db_random_bigint()
{ {
return sprintf('%d%06d%06d', mt_rand(1,18446743), mt_rand(0,999999), mt_rand(0,999999)); return sprintf('%d%06d%06d', mt_rand(1, 18446743), mt_rand(0, 999999), mt_rand(0, 999999));
} }
......
...@@ -1780,7 +1780,7 @@ ...@@ -1780,7 +1780,7 @@
*/ */
public function post_avatar($post, $class, $prefix=null) public function post_avatar($post, $class, $prefix=null)
{ {
$this->avatar($post, $class, $prefix=null); $this->avatar($post, $class, $prefix);
} }
public function post_meta($post, $class, $prefix=null, $separator='<br/>') public function post_meta($post, $class, $prefix=null, $separator='<br/>')
......
...@@ -47,11 +47,13 @@ ...@@ -47,11 +47,13 @@
switch (strtolower(substr($gotbytes, -1))) { switch (strtolower(substr($gotbytes, -1))) {
case 'g': case 'g':
$gotbytes*=1024; $gotbytes *= 1024;
// fall-through
case 'm': case 'm':
$gotbytes*=1024; $gotbytes *= 1024;
// fall-through
case 'k': case 'k':
$gotbytes*=1024; $gotbytes *= 1024;
} }
if ($gotbytes>0) { // otherwise we clearly don't know our limit if ($gotbytes>0) { // otherwise we clearly don't know our limit
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
class BaseTest extends PHPUnit_Framework_TestCase class BaseTest extends PHPUnit_Framework_TestCase
{ {
public function test__qa_js() { public function test__qa_js()
{
$test = qa_js('test'); $test = qa_js('test');
$this->assertEquals($test, "'test'"); $this->assertEquals($test, "'test'");
......
...@@ -204,7 +204,7 @@ class qam_snow_theme ...@@ -204,7 +204,7 @@ class qam_snow_theme
{ {
$this->data['ask_search_box_color'] = $this->qam_opt('ask_search_box_color'); $this->data['ask_search_box_color'] = $this->qam_opt('ask_search_box_color');
$this->data['welcome_widget_color'] = $this->qam_opt('welcome_widget_color'); $this->data['welcome_widget_color'] = $this->qam_opt('welcome_widget_color');
$this->data['fixed_topbar'] = (($this->qam_opt('fixed_topbar')) ? 'fixed' : NULL); $this->data['fixed_topbar'] = (($this->qam_opt('fixed_topbar')) ? 'fixed' : null);
$this->data['header_custom_content'] = $this->qam_opt('header_custom_content'); $this->data['header_custom_content'] = $this->qam_opt('header_custom_content');
$this->data['footer_custom_content'] = $this->qam_opt('above_footer_custom_content'); $this->data['footer_custom_content'] = $this->qam_opt('above_footer_custom_content');
...@@ -315,7 +315,7 @@ class qam_snow_theme ...@@ -315,7 +315,7 @@ class qam_snow_theme
return $points; return $points;
} }
return NULL; return null;
} }
/** /**
...@@ -339,9 +339,9 @@ class qam_snow_theme ...@@ -339,9 +339,9 @@ class qam_snow_theme
return $html; return $html;
} }
} }
/* ---------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------- */
// create a function to instanciate the class // create a function to instanciate the class
......
...@@ -261,7 +261,7 @@ class qa_html_theme extends qa_html_theme_base ...@@ -261,7 +261,7 @@ class qa_html_theme extends qa_html_theme_base
$qam_note_class = ''; $qam_note_class = '';
if (strpos($navlink['note'], '> -') !== false) { if (strpos($navlink['note'], '> -') !== false) {
$qam_note_class = !empty($navlink['note']) ? ' qam-cat-note' : NULL; $qam_note_class = !empty($navlink['note']) ? ' qam-cat-note' : null;
} }
// search and replace within the string // search and replace within the string
...@@ -418,7 +418,7 @@ class qa_html_theme extends qa_html_theme_base ...@@ -418,7 +418,7 @@ class qa_html_theme extends qa_html_theme_base
// add closed image // add closed image
$closed = (!empty($q_view['closed']) ? $closed = (!empty($q_view['closed']) ?
'<img src="' . $this->rooturl . $this->icon_url . '/closed-q-view.png" class="qam-q-view-close-icon" alt="question-closed" width="24" height="24" title="' . qa_lang('main/closed') . '" />' : NULL ); '<img src="' . $this->rooturl . $this->icon_url . '/closed-q-view.png" class="qam-q-view-close-icon" alt="question-closed" width="24" height="24" title="' . qa_lang('main/closed') . '" />' : null );
if (isset($this->content['title'])) { if (isset($this->content['title'])) {
$this->output( $this->output(
...@@ -594,11 +594,11 @@ class qa_html_theme extends qa_html_theme_base ...@@ -594,11 +594,11 @@ class qa_html_theme extends qa_html_theme_base
* @since Snow 1.4 * @since Snow 1.4
* @version 1.0 * @version 1.0
*/ */
public function qam_search($addon_class = FALSE, $ids = FALSE) public function qam_search($addon_class = false, $ids = false)
{ {
$default_color = 'turquoise'; $default_color = 'turquoise';
$id = (($ids) ? ' id="' . $ids . '"' : NULL); $id = (($ids) ? ' id="' . $ids . '"' : null);
$this->output('<div class="qam-search ' . $default_color . ' ' . $addon_class . '" ' . $id . ' >'); $this->output('<div class="qam-search ' . $default_color . ' ' . $addon_class . '" ' . $id . ' >');
qa_html_theme_base::search(); qa_html_theme_base::search();
...@@ -617,7 +617,7 @@ class qa_html_theme extends qa_html_theme_base ...@@ -617,7 +617,7 @@ class qa_html_theme extends qa_html_theme_base
{ {
$css = '<style>'; $css = '<style>';
$css .= ( (!qa_is_logged_in() ) ? '.qa-nav-user{margin:0 !important;}' : NULL ); $css .= ( (!qa_is_logged_in() ) ? '.qa-nav-user{margin:0 !important;}' : null );
if (qa_request_part(1) !== qa_get_logged_in_handle()) { if (qa_request_part(1) !== qa_get_logged_in_handle()) {
$css .= '@media (max-width: 979px){'; $css .= '@media (max-width: 979px){';
$css .= 'body.qa-template-user.fixed, body[class^="qa-template-user-"].fixed, body[class*="qa-template-user-"].fixed{'; $css .= 'body.qa-template-user.fixed, body[class^="qa-template-user-"].fixed, body[class*="qa-template-user-"].fixed{';
...@@ -670,6 +670,4 @@ class qa_html_theme extends qa_html_theme_base ...@@ -670,6 +670,4 @@ class qa_html_theme extends qa_html_theme_base
return $icons_info; return $icons_info;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment