Commit 6b0c8daf by Scott

Coding style (strict): function signatures

parent 7737918c
......@@ -94,8 +94,14 @@ class UserPosts extends \Q2A\Controllers\BaseController
$htmldefaults['avatarsize'] = 0;
foreach ($questions as $question) {
$qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $loginuserid, qa_cookie_get(),
$usershtml, null, array('voteview' => false) + qa_post_html_options($question, $htmldefaults));
$qa_content['q_list']['qs'][] = qa_any_to_q_html_fields(
$question,
$loginuserid,
qa_cookie_get(),
$usershtml,
null,
array('voteview' => false) + qa_post_html_options($question, $htmldefaults)
);
}
......@@ -171,8 +177,14 @@ class UserPosts extends \Q2A\Controllers\BaseController
$htmldefaults['avatarsize'] = 0;
foreach ($questions as $question) {
$qa_content['q_list']['qs'][] = qa_post_html_fields($question, $loginuserid, qa_cookie_get(),
$usershtml, null, qa_post_html_options($question, $htmldefaults));
$qa_content['q_list']['qs'][] = qa_post_html_fields(
$question,
$loginuserid,
qa_cookie_get(),
$usershtml,
null,
qa_post_html_options($question, $htmldefaults)
);
}
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'));
......@@ -256,8 +268,7 @@ class UserPosts extends \Q2A\Controllers\BaseController
$options = qa_post_html_options($question, $htmldefaults);
$options['voteview'] = qa_get_vote_view('A', false, false);
$qa_content['q_list']['qs'][] = qa_other_to_q_html_fields($question, $loginuserid, qa_cookie_get(),
$usershtml, null, $options);
$qa_content['q_list']['qs'][] = qa_other_to_q_html_fields($question, $loginuserid, qa_cookie_get(), $usershtml, null, $options);
}
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'));
......
......@@ -363,8 +363,8 @@ class UserProfile extends \Q2A\Controllers\BaseController
$favoritemap = qa_get_favorite_non_qs_map();
$favorite = @$favoritemap['user'][$useraccount['userid']];
$qa_content['favorite'] = qa_favorite_form(QA_ENTITY_USER, $useraccount['userid'], $favorite,
qa_lang_sub($favorite ? 'main/remove_x_favorites' : 'users/add_user_x_favorites', $handle));
$title = qa_lang_sub($favorite ? 'main/remove_x_favorites' : 'users/add_user_x_favorites', $handle);
$qa_content['favorite'] = qa_favorite_form(QA_ENTITY_USER, $useraccount['userid'], $favorite, $title);
}
......@@ -384,8 +384,15 @@ class UserProfile extends \Q2A\Controllers\BaseController
'type' => 'image',
'style' => 'tall',
'label' => '',
'html' => qa_get_user_avatar_html($useraccount['flags'], $useraccount['email'], $useraccount['handle'],
$useraccount['avatarblobid'], $useraccount['avatarwidth'], $useraccount['avatarheight'], qa_opt('avatar_profile_size')),
'html' => qa_get_user_avatar_html(
$useraccount['flags'],
$useraccount['email'],
$useraccount['handle'],
$useraccount['avatarblobid'],
$useraccount['avatarwidth'],
$useraccount['avatarheight'],
qa_opt('avatar_profile_size')
),
'id' => 'avatar',
),
......@@ -488,8 +495,15 @@ class UserProfile extends \Q2A\Controllers\BaseController
else
$fieldnavcategories = $navcategories;
qa_set_up_category_field($qa_content, $qa_content['form_profile']['fields']['uc_' . $index . '_cat'],
'uc_' . $index . '_cat', $fieldnavcategories, @$userlevel['entityid'], true, true);
qa_set_up_category_field(
$qa_content,
$qa_content['form_profile']['fields']['uc_' . $index . '_cat'],
'uc_' . $index . '_cat',
$fieldnavcategories,
@$userlevel['entityid'],
true,
true
);
unset($qa_content['form_profile']['fields']['uc_' . $index . '_cat']['note']);
}
......
......@@ -44,13 +44,13 @@ class UsersList extends \Q2A\Controllers\BaseController
public function top()
{
// callables to fetch user data
$fetchUsers = function($start, $pageSize) {
$fetchUsers = function ($start, $pageSize) {
return array(
qa_opt('cache_userpointscount'),
qa_db_select_with_pending(qa_db_top_users_selectspec($start, $pageSize))
);
};
$userScore = function($user) {
$userScore = function ($user) {
return qa_html(qa_format_number($user['points'], 0, true));
};
......@@ -79,13 +79,13 @@ class UsersList extends \Q2A\Controllers\BaseController
}
// callables to fetch user data
$fetchUsers = function($start, $pageSize) {
$fetchUsers = function ($start, $pageSize) {
return array(
qa_opt('cache_userpointscount'),
qa_db_select_with_pending(qa_db_newest_users_selectspec($start, $pageSize))
);
};
$userDate = function($user) {
$userDate = function ($user) {
$when = qa_when_to_html($user['created'], 7);
return $when['data'];
};
......@@ -115,12 +115,12 @@ class UsersList extends \Q2A\Controllers\BaseController
}
// callables to fetch user data
$fetchUsers = function($start, $pageSize) {
$fetchUsers = function ($start, $pageSize) {
// here we fetch *all* users to get the total instead of a separate query; there are unlikely to be many special users
$users = qa_db_select_with_pending(qa_db_users_from_level_selectspec(QA_USER_LEVEL_EXPERT));
return array(count($users), $users);
};
$userLevel = function($user) {
$userLevel = function ($user) {
return qa_html(qa_user_level_string($user['level']));
};
......@@ -140,7 +140,7 @@ class UsersList extends \Q2A\Controllers\BaseController
public function blocked()
{
// callables to fetch user data
$fetchUsers = function($start, $pageSize) {
$fetchUsers = function ($start, $pageSize) {
list($totalUsers, $users) = qa_db_select_with_pending(
qa_db_selectspec_count(qa_db_users_with_flag_selectspec(QA_USER_FLAGS_USER_BLOCKED)),
qa_db_users_with_flag_selectspec(QA_USER_FLAGS_USER_BLOCKED, $start, $pageSize)
......@@ -148,7 +148,7 @@ class UsersList extends \Q2A\Controllers\BaseController
return array($totalUsers['count'], $users);
};
$userLevel = function($user) {
$userLevel = function ($user) {
return qa_html(qa_user_level_string($user['level']));
};
......@@ -197,8 +197,16 @@ class UsersList extends \Q2A\Controllers\BaseController
if (QA_FINAL_EXTERNAL_USERS) {
$avatarHtml = qa_get_external_avatar_html($user['userid'], qa_opt('avatar_users_size'), true);
} else {
$avatarHtml = qa_get_user_avatar_html($user['flags'], $user['email'], $user['handle'],
$user['avatarblobid'], $user['avatarwidth'], $user['avatarheight'], qa_opt('avatar_users_size'), true);
$avatarHtml = qa_get_user_avatar_html(
$user['flags'],
$user['email'],
$user['handle'],
$user['avatarblobid'],
$user['avatarwidth'],
$user['avatarheight'],
qa_opt('avatar_users_size'),
true
);
}
$content['ranking']['items'][] = array(
......
......@@ -144,7 +144,9 @@ class DbConnection
} else {
echo sprintf(
'<hr><div style="color: red">Database %s<p>%s</p><code>%s</code></div>',
htmlspecialchars($type . ' error ' . $errno), nl2br(htmlspecialchars($error)), nl2br(htmlspecialchars($query))
htmlspecialchars($type . ' error ' . $errno),
nl2br(htmlspecialchars($error)),
nl2br(htmlspecialchars($query))
);
qa_exit('error');
}
......@@ -467,7 +469,7 @@ class DbConnection
*/
public function applyTableSub($query)
{
return preg_replace_callback('/\^([A-Za-z_0-9]+)/', function($matches) {
return preg_replace_callback('/\^([A-Za-z_0-9]+)/', function ($matches) {
return $this->addTablePrefix($matches[1]);
}, $query);
}
......
......@@ -39,8 +39,18 @@ class ReindexContentPostReindex extends AbstractStep
foreach ($posts as $postid => $post) {
qa_post_unindex($postid);
qa_post_index($postid, $post['type'], $post['questionid'], $post['parentid'], $post['title'], $post['content'],
$post['format'], qa_viewer_text($post['content'], $post['format']), $post['tags'], $post['categoryid']);
qa_post_index(
$postid,
$post['type'],
$post['questionid'],
$post['parentid'],
$post['title'],
$post['content'],
$post['format'],
qa_viewer_text($post['content'], $post['format']),
$post['tags'],
$post['categoryid']
);
}
$this->state->next = 1 + $lastpostid;
......
......@@ -17,8 +17,6 @@
<exclude name="Generic.ControlStructures.InlineControlStructure"/>
<exclude name="Squiz.ControlStructures.ControlSignature"/> <!-- doesn't work without above rule -->
<exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/>
<exclude name="PSR2.Methods.FunctionCallSignature"/>
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration"/>
</rule>
<arg name="tab-width" value="4"/>
......
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