Commit 802f6879 by Scott

Coding style (more minor typos/spacing issues)

parent 59ad6e0a
......@@ -685,5 +685,4 @@ class Q2A_Util_String
return false;
}
}
......@@ -177,5 +177,4 @@ class Q2A_Util_Usage
$usage['ram'] ? ($usage['ram'] * 100 / $totalusage['ram']) : 0
);
}
}
......@@ -127,7 +127,7 @@
if (isset($metadata['display_name']))
$options[$code] = $metadata['display_name'];
// otherwise use an entry from above
else if (isset($codetolanguage[$code]))
elseif (isset($codetolanguage[$code]))
$options[$code] = $codetolanguage[$code];
}
......@@ -139,7 +139,8 @@
/**
* Return a sorted array of available themes, [theme name] => [theme name]
*/
function qa_admin_theme_options() {
function qa_admin_theme_options()
{
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$metadataUtil = new Q2A_Util_Metadata();
......
......@@ -281,8 +281,9 @@
if ($isquestion && isset($post['closedbyid']))
$fields['classes']=ltrim($fields['classes'].' qa-q-closed');
if ($microformats)
if ($microformats) {
$fields['classes'].=' hentry '.($isquestion ? 'question' : ($isanswer ? ($isselected ? 'answer answer-selected' : 'answer') : 'comment'));
}
// Question-specific stuff (title, URL, tags, answer count, category)
......@@ -503,7 +504,7 @@
$fields['meta_order']=qa_lang_html('main/meta_order'); // sets ordering of meta elements which can be language-specific
if (@$options['whatview'] ) {
if (@$options['whatview']) {
$fields['what']=qa_lang_html($isquestion ? 'main/asked' : ($isanswer ? 'main/answered' : 'main/commented'));
if (@$options['whatlink'] && strlen(@$options['q_request']))
......
......@@ -92,7 +92,7 @@
qa_db_flaggedcount_update();
}
else if ($oldquestion['type'] == 'Q') { // not hidden or queued
elseif ($oldquestion['type'] == 'Q') { // not hidden or queued
qa_post_index($oldquestion['postid'], 'Q', $oldquestion['postid'], $oldquestion['parentid'], $title, $content, $format, $text, $tagstring, $oldquestion['categoryid']);
}
......
......@@ -33,17 +33,19 @@
{
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$mindb=16777215; // from MEDIUMBLOB column type
$mindb = 16777215; // from MEDIUMBLOB column type
$minphp=trim(ini_get('upload_max_filesize'));
$minphp = trim(ini_get('upload_max_filesize'));
switch (strtolower(substr($minphp, -1))) {
case 'g':
$minphp*=1024;
$minphp *= 1024;
// fall-through
case 'm':
$minphp*=1024;
$minphp *= 1024;
// fall-through
case 'k':
$minphp*=1024;
$minphp *= 1024;
}
return min($mindb, $minphp);
......
......@@ -1103,7 +1103,7 @@ in a category for which they have elevated privileges).
if (!isset($value))
$silentproblems[]='code missing';
else if (!strlen($value))
elseif (!strlen($value))
$silentproblems[]='code empty';
else {
......@@ -1135,7 +1135,7 @@ in a category for which they have elevated privileges).
$silentproblems[]='key cookie missing';
elseif (!strlen($key))
$silentproblems[]='key cookie empty';
else if (strlen($key)!=QA_FORM_KEY_LENGTH)
elseif (strlen($key)!=QA_FORM_KEY_LENGTH)
$reportproblems[]='key cookie '.$key.' invalid';
}
}
......
......@@ -39,7 +39,7 @@
$req = qa_request_part(1);
if ($req === null)
$showOutbox = false;
else if ($req === 'sent')
elseif ($req === 'sent')
$showOutbox = true;
else
return include QA_INCLUDE_DIR.'qa-page-not-found.php';
......
......@@ -128,7 +128,7 @@
$pageerror=@$qerrors['page']; // for security code failure
}
} else if (($pagestate==('edit-'.$questionid)) && qa_page_q_permit_edit($question, 'permit_edit_q', $pageerror, 'permit_retag_cat'))
} elseif (($pagestate==('edit-'.$questionid)) && qa_page_q_permit_edit($question, 'permit_edit_q', $pageerror, 'permit_retag_cat'))
$formtype='q_edit';
if ($formtype=='q_edit') { // get tags for auto-completion
......
......@@ -358,7 +358,7 @@
$commentsall=$answerid;
}
} else if (($formtype=='c_edit') && (@$commentsfollows[$formpostid]['parentid']==$answerid)) { // ...being edited
} elseif (($formtype=='c_edit') && (@$commentsfollows[$formpostid]['parentid']==$answerid)) { // ...being edited
$a_view['c_form']=qa_page_q_edit_c_form($qa_content, 'c'.$formpostid, $commentsfollows[$formpostid],
@$ceditin[$formpostid], @$cediterrors[$formpostid]);
......
......@@ -1048,8 +1048,10 @@
switch (strtoupper($unit)) { // Gets an integer value that can be compared against the size of the HTTP request
case 'G':
$postmaxsize *= 1024;
// fall-through
case 'M':
$postmaxsize *= 1024;
// fall-through
case 'K':
$postmaxsize *= 1024;
}
......
......@@ -236,7 +236,7 @@
$result = implode(',', $parts);
}
else if (isset($argument)) {
elseif (isset($argument)) {
if ($alwaysquote || !is_numeric($argument))
$result = "'".qa_db_escape_string($argument)."'";
else
......
......@@ -249,7 +249,7 @@
$qa_content['navigation'][$navtype][$navprefix]['selected'] = true;
}
}
else if ($requestlower === $navprefix || $requestlower.'$' === $navprefix)
elseif ($requestlower === $navprefix || $requestlower.'$' === $navprefix)
$qa_content['navigation'][$navtype][$navprefix]['selected'] = true;
}
......
......@@ -20,10 +20,10 @@
More about this license: http://www.question2answer.org/license.php
*/
if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser
if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser
header('Location: ../');
exit;
}
}
/*
......@@ -37,8 +37,8 @@
code, please consult the online Q2A documentation.
*/
class qa_html_theme_base {
class qa_html_theme_base
{
protected $indent = 0;
protected $lines = 0;
protected $context = array();
......@@ -54,9 +54,9 @@
public function __construct($template, $content, $rooturl, $request)
/*
/*
Initialize the object and assign local variables
*/
*/
{
$this->template = $template;
$this->content = $content;
......@@ -77,11 +77,11 @@
public function output_array($elements)
/*
/*
Output each element in $elements on a separate line, with automatic HTML indenting.
This should be passed markup which uses the <tag/> form for unpaired tags, to help keep
track of indenting, although its actual output converts these to <tag> for W3C validation
*/
*/
{
foreach ($elements as $element) {
$delta = substr_count($element, '<') - substr_count($element, '<!') - 2*substr_count($element, '</') - substr_count($element, '/>');
......@@ -100,9 +100,9 @@
public function output() // other parameters picked up via func_get_args()
/*
/*
Output each passed parameter on a separate line - see output_array() comments
*/
*/
{
$args = func_get_args();
$this->output_array($args);
......@@ -110,10 +110,10 @@
public function output_raw($html)
/*
/*
Output $html at the current indent level, but don't change indent level based on the markup within.
Useful for user-entered HTML which is unlikely to follow the rules we need to track indenting
*/
*/
{
if (strlen($html))
echo str_repeat("\t", max(0, $this->indent)).$html."\n";
......@@ -121,10 +121,10 @@
public function output_split($parts, $class, $outertag='span', $innertag='span', $extraclass=null)
/*
/*
Output the three elements ['prefix'], ['data'] and ['suffix'] of $parts (if they're defined),
with appropriate CSS classes based on $class, using $outertag and $innertag in the markup.
*/
*/
{
if (empty($parts) && strtolower($outertag) != 'td')
return;
......@@ -140,28 +140,28 @@
public function set_context($key, $value)
/*
/*
Set some context, which be accessed via $this->context for a function to know where it's being used on the page
*/
*/
{
$this->context[$key] = $value;
}
public function clear_context($key)
/*
/*
Clear some context (used at the end of the appropriate loop)
*/
*/
{
unset($this->context[$key]);
}
public function reorder_parts($parts, $beforekey=null, $reorderrelative=true)
/*
/*
Reorder the parts of the page according to the $parts array which contains part keys in their new order. Call this
before main_parts(). See the docs for qa_array_reorder() in qa-util-sort.php for the other parameters.
*/
*/
{
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
......@@ -170,9 +170,9 @@
public function widgets($region, $place)
/*
/*
Output the widgets (as provided in $this->content['widgets']) for $region and $place
*/
*/
{
if (count(@$this->content['widgets'][$region][$place])) {
$this->output('<div class="qa-widgets-'.$region.' qa-widgets-'.$region.'-'.$place.'">');
......@@ -189,9 +189,9 @@
public function finish()
/*
/*
Post-output cleanup. For now, check that the indenting ended right, and if not, output a warning in an HTML comment
*/
*/
{
if ($this->indent) {
echo "<!--\nIt's no big deal, but your HTML could not be indented properly. To fix, please:\n".
......@@ -203,10 +203,10 @@
}
// From here on, we have a large number of class methods which output particular pieces of HTML markup
// The calling chain is initiated from qa-page.php, or qa-ajax-*.php for refreshing parts of a page,
// For most HTML elements, the name of the function is similar to the element's CSS class, for example:
// search() outputs <div class="qa-search">, q_list() outputs <div class="qa-q-list">, etc...
// From here on, we have a large number of class methods which output particular pieces of HTML markup
// The calling chain is initiated from qa-page.php, or qa-ajax-*.php for refreshing parts of a page,
// For most HTML elements, the name of the function is similar to the element's CSS class, for example:
// search() outputs <div class="qa-search">, q_list() outputs <div class="qa-q-list">, etc...
public function doctype()
{
......@@ -933,10 +933,10 @@
}
public function form_reorder_fields(&$form, $keys, $beforekey=null, $reorderrelative=true)
/*
/*
Reorder the fields of $form according to the $keys array which contains the field keys in their new order. Call
before any fields are output. See the docs for qa_array_reorder() in qa-util-sort.php for the other parameters.
*/
*/
{
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
......@@ -1112,10 +1112,10 @@
}
public function form_reorder_buttons(&$form, $keys, $beforekey=null, $reorderrelative=true)
/*
/*
Reorder the buttons of $form according to the $keys array which contains the button keys in their new order. Call
before any buttons are output. See the docs for qa_array_reorder() in qa-util-sort.php for the other parameters.
*/
*/
{
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
......@@ -2343,9 +2343,9 @@
public function q_title_list($q_list, $attrs=null)
/*
/*
Generic method to output a basic list of question links.
*/
*/
{
$this->output('<ul class="qa-q-title-list">');
foreach ($q_list as $q) {
......@@ -2359,9 +2359,9 @@
}
public function q_ask_similar($q_list, $pretext='')
/*
/*
Output block of similar questions when asking.
*/
*/
{
if (!count($q_list))
return;
......@@ -2374,9 +2374,4 @@
$this->output('</div>');
}
}
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
}
......@@ -73,6 +73,7 @@ class qa_basic_adsense
switch ($region) {
case 'full': // Leaderboard
$divstyle='width:728px; margin:0 auto;';
// fall-through
case 'main': // Leaderboard
$width=728;
......
......@@ -154,5 +154,4 @@ class UtilStringTest extends PHPUnit_Framework_TestCase
$this->assertTrue( qa_string_matches_one($this->strBasic, $matches) );
$this->assertFalse( qa_string_matches_one($this->strBasic, $nonMatches) );
}
}
......@@ -159,5 +159,4 @@ class qa_html_theme extends qa_html_theme_base
qa_html_theme_base::attribution();
}
}
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