Skip to content

Commit

Permalink
Coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
svivian committed Jul 31, 2020
1 parent 4193905 commit cd3bee1
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion qa-include/pages/categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function qa_category_nav_to_browse(&$navigation, $categories, $categoryid, $favo
}

$navigation[$key]['note'] =
' - <a href="'.qa_path_html('questions/'.implode('/', array_reverse(explode('/', $category['backpath'])))).'">'.( ($category['qcount']==1)
' - <a href="'.qa_path_html('questions/'.implode('/', array_reverse(explode('/', $category['backpath'])))).'">'.( ($category['qcount'] == 1)
? qa_lang_html_sub('main/1_question', '1', '1')
: qa_lang_html_sub('main/x_questions', number_format($category['qcount']))
).'</a>';
Expand Down
4 changes: 2 additions & 2 deletions qa-include/plugins/qa-widget-ask-box.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public function output_widget($region, $place, $themeobject, $template, $request
<form method="post" action="<?php echo qa_path_html('ask', $params); ?>">
<table class="qa-form-tall-table" style="width:100%">
<tr style="vertical-align:middle;">
<td class="qa-form-tall-label" style="width: 1px; padding:8px; white-space:nowrap; <?php echo ($region=='side') ? 'padding-bottom:0;' : 'text-align:right;'?>">
<td class="qa-form-tall-label" style="width: 1px; padding:8px; white-space:nowrap; <?php echo ($region == 'side') ? 'padding-bottom:0;' : 'text-align:right;'?>">
<?php echo strtr(qa_lang_html('question/ask_title'), array(' ' => '&nbsp;'))?>:
</td>
<?php if ($region=='side') : ?>
<?php if ($region == 'side') : ?>
</tr>
<tr>
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion qa-plugin/tag-cloud-widget/qa-tag-cloud-lang-default.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'biggest_font_size' => 'Biggest font size:',
'font_size_popularity' => 'Font size represents tag popularity',
'max_tags' => 'Maximum tags to show:',
'pixels'=> 'pixels',
'pixels' => 'pixels',
'smallest_font_size' => 'Smallest allowed font size:',
'tags' => 'tags',
);
2 changes: 1 addition & 1 deletion qa-plugin/wysiwyg-editor/qa-wysiwyg-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function admin_form(&$qa_content)
if (qa_clicked('wysiwyg_editor_save_button')) {
qa_opt('wysiwyg_editor_upload_images', (int)qa_post_text('wysiwyg_editor_upload_images_field'));
qa_opt('wysiwyg_editor_upload_all', (int)qa_post_text('wysiwyg_editor_upload_all_field'));
qa_opt('wysiwyg_editor_upload_max_size', min(qa_get_max_upload_size(), 1048576*(float)qa_post_text('wysiwyg_editor_upload_max_size_field')));
qa_opt('wysiwyg_editor_upload_max_size', min(qa_get_max_upload_size(), 1048576 * (float)qa_post_text('wysiwyg_editor_upload_max_size_field')));
$saved = true;
}

Expand Down
10 changes: 5 additions & 5 deletions qa-src/Controllers/Admin/Categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ public function index()

qa_report_event('cat_edit', qa_get_logged_in_userid(), qa_get_logged_in_handle(), qa_cookie_get(), array(
'categoryid' => $editcategory['categoryid'],
'parentid' => isset($inparentid)?$inparentid:null,
'content' => isset($incontent)?$incontent:null,
'position' => isset($inposition)?$inposition:null,
'parentid' => isset($inparentid) ? $inparentid : null,
'content' => isset($incontent) ? $incontent : null,
'position' => isset($inposition) ? $inposition : null,
'name' => $inname,
'slug' => $inslug,
));
Expand All @@ -243,8 +243,8 @@ public function index()
qa_report_event('cat_new', qa_get_logged_in_userid(), qa_get_logged_in_handle(), qa_cookie_get(), array(
'categoryid' => $categoryid,
'parentid' => $inparentid,
'content' => isset($incontent)?$incontent:null,
'position' => isset($inposition)?$inposition:null,
'content' => isset($incontent) ? $incontent : null,
'position' => isset($inposition) ? $inposition : null,
'name' => $inname,
'slug' => $inslug,
));
Expand Down
2 changes: 1 addition & 1 deletion qa-src/Controllers/User/UserProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ public function profile($handle)
foreach ($userlevels as $userlevel) {
if ($userlevel['entitytype'] == QA_ENTITY_CATEGORY) {
$index++;
$id = 'ls_' . +$index;
$id = 'ls_' . (+$index);

$qa_content['form_profile']['fields']['uc_' . $index . '_level'] = array(
'label' => qa_lang_html('users/category_level_label'),
Expand Down
6 changes: 3 additions & 3 deletions qa-src/Util/Usage.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Usage
public function __construct()
{
$this->stages = array();
$this->databaseUsage = array('queries'=>0, 'clock'=>0);
$this->databaseUsage = array('queries' => 0, 'clock' => 0);
$this->databaseQueryLog = '';

$this->prevUsage = $this->startUsage = $this->getCurrent();
Expand Down Expand Up @@ -99,7 +99,7 @@ public function logDatabaseQuery($query, $usedtime, $gotrows, $gotcolumns)
$rowcolstring .= ' - ' . $gotcolumns . ($gotcolumns == 1 ? ' column' : ' columns');
}

$this->databaseQueryLog .= $query . "\n\n" . sprintf('%.2f ms', $usedtime*1000) . $rowcolstring . "\n\n";
$this->databaseQueryLog .= $query . "\n\n" . sprintf('%.2f ms', $usedtime * 1000) . $rowcolstring . "\n\n";
}

$this->databaseUsage['queries']++;
Expand Down Expand Up @@ -210,7 +210,7 @@ private function delta($oldusage, $newusage)
$delta = array();

foreach ($newusage as $key => $value) {
$delta[$key] = max(0, $value-@$oldusage[$key]);
$delta[$key] = max(0, $value - @$oldusage[$key]);
}

return $delta;
Expand Down
6 changes: 6 additions & 0 deletions qa-tests/phpcs/ruleset-strict.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
</properties>
</rule>

<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>

<!-- Not part of normal usage, but kept for testing (default severity = 5) -->
<rule ref="Squiz.Commenting.FunctionComment">
<severity>0</severity>
Expand Down
8 changes: 4 additions & 4 deletions qa-theme/Snow/qa-theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public function logged_in()
qa_html_theme_base::logged_in();

if (qa_is_logged_in()) { // adds points count after logged in username
$userpoints=qa_get_logged_in_points();
$userpoints = qa_get_logged_in_points();

$pointshtml=($userpoints==1)
$pointshtml = ($userpoints == 1)
? qa_lang_html_sub('main/1_point', '1', '1')
: qa_lang_html_sub('main/x_points', qa_html(qa_format_number($userpoints)));

Expand Down Expand Up @@ -102,7 +102,7 @@ public function header()
// removes sidebar for user profile pages
public function sidepanel()
{
if ($this->template!='user')
if ($this->template != 'user')
qa_html_theme_base::sidepanel();
}

Expand Down Expand Up @@ -140,7 +140,7 @@ public function q_item_stats($q_item)
// prevent display of view count in the usual place
public function view_count($q_item)
{
if ($this->template=='question')
if ($this->template == 'question')
qa_html_theme_base::view_count($q_item);
}

Expand Down

0 comments on commit cd3bee1

Please sign in to comment.