本文整理汇总了PHP中qa_lang函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_lang函数的具体用法?PHP qa_lang怎么用?PHP qa_lang使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_lang函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
global $qa_login_userid, $questionid, $relatedcount, $question, $relatedquestions, $qa_cookieid, $usershtml;
list($question, $relatedquestions) = qa_db_select_with_pending(qa_db_full_post_selectspec($qa_login_userid, $questionid), qa_db_related_qs_selectspec($qa_login_userid, $questionid));
if ($relatedcount > 1 && !$question['hidden']) {
$minscore = qa_match_to_min_score(qa_opt('match_related_qs'));
foreach ($relatedquestions as $key => $related) {
if ($related['postid'] == $questionid || $related['score'] < $minscore) {
unset($relatedquestions[$key]);
}
}
if (count($relatedquestions)) {
$themeobject->output('<h2>' . qa_lang('main/related_qs_title') . '</h2>');
} else {
$themeobject->output('<h2>' . qa_lang('main/no_related_qs_title') . '</h2>');
}
$upper = qa_opt('related_qs_num') < count($relatedquestions) ? qa_opt('related_qs_num') : count($relatedquestions);
foreach ($relatedquestions as $related) {
if ($upper <= 0) {
break;
}
$themeobject->output('<p style="margin:0 0 10px 0; font-weight:bold;"><a href="' . qa_path_html(qa_q_request($related['postid'], $related['title'])) . '">' . $related['title'] . '</a></p>');
$upper--;
}
}
}
示例2: admin_form
function admin_form(&$qa_content)
{
// process the admin form if admin hits Save-Changes-button
$ok = null;
if (qa_clicked('q2apro_popularqu_save')) {
qa_opt('q2apro_popularqu_enabled', (bool) qa_post_text('q2apro_popularqu_enabled'));
// empty or 1
qa_opt('q2apro_popularqu_maxqu', (int) qa_post_text('q2apro_popularqu_maxqu'));
qa_opt('q2apro_popularqu_lastdays', (int) qa_post_text('q2apro_popularqu_lastdays'));
qa_opt('q2apro_popularqu_checkhours', (int) qa_post_text('q2apro_popularqu_checkhours'));
qa_opt('q2apro_popularqu_answercount', (bool) qa_post_text('q2apro_popularqu_answercount'));
$ok = qa_lang('admin/options_saved');
// in case the options have been changed, update the widget
q2apro_save_most_viewed_questions();
}
// form fields to display frontend for admin
$fields = array();
$fields[] = array('type' => 'checkbox', 'label' => qa_lang('q2apro_popularqu_lang/enable_plugin'), 'tags' => 'name="q2apro_popularqu_enabled"', 'value' => qa_opt('q2apro_popularqu_enabled'));
$fields[] = array('type' => 'input', 'label' => qa_lang('q2apro_popularqu_lang/admin_maxqu'), 'tags' => 'name="q2apro_popularqu_maxqu"', 'value' => qa_opt('q2apro_popularqu_maxqu'));
$fields[] = array('type' => 'checkbox', 'label' => qa_lang('q2apro_popularqu_lang/admin_answercount'), 'tags' => 'name="q2apro_popularqu_answercount"', 'value' => qa_opt('q2apro_popularqu_answercount'));
$fields[] = array('type' => 'input', 'label' => qa_lang('q2apro_popularqu_lang/admin_lastdays'), 'tags' => 'name="q2apro_popularqu_lastdays"', 'value' => qa_opt('q2apro_popularqu_lastdays'));
$fields[] = array('type' => 'input', 'label' => qa_lang('q2apro_popularqu_lang/admin_checkhours'), 'tags' => 'name="q2apro_popularqu_checkhours"', 'value' => qa_opt('q2apro_popularqu_checkhours'));
$fields[] = array('type' => 'static', 'note' => qa_lang('q2apro_popularqu_lang/admin_lastcache') . ' ' . date('Y-m-d H:i:s', (double) qa_opt('q2apro_popularqu_checktime')));
$fields[] = array('type' => 'static', 'note' => qa_lang('q2apro_popularqu_lang/admin_remember') . ' <a href="' . qa_path('admin/layout') . '">/admin/layout</a>');
$fields[] = array('type' => 'static', 'note' => '<span style="font-size:75%;color:#789;">' . strtr(qa_lang('q2apro_popularqu_lang/contact'), array('^1' => '<a target="_blank" href="http://www.q2apro.com/forum/">', '^2' => '</a>')) . '</span>');
return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang('main/save_button'), 'tags' => 'name="q2apro_popularqu_save"')));
}
示例3: admin_form
function admin_form(&$qa_content)
{
// Process form input
$ok = null;
if (qa_clicked('cp_save')) {
// Save
qa_db_query_sub('CREATE TABLE IF NOT EXISTS ^postmeta (
meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
post_id bigint(20) unsigned NOT NULL,
meta_key varchar(255) DEFAULT \'\',
meta_value longtext,
PRIMARY KEY (meta_id),
KEY post_id (post_id),
KEY meta_key (meta_key)
) ENGINE=MyISAM DEFAULT CHARSET=utf8');
qa_opt('cp_enable', (bool) qa_post_text('cp_enable'));
$ok = qa_lang('admin/options_saved');
} else {
if (qa_clicked('cp_reset')) {
// Reset
foreach ($_POST as $i => $v) {
$def = $this->option_default($i);
if ($def !== null) {
qa_opt($i, $def);
}
}
qa_opt('cp_enable', true);
$ok = qa_lang('admin/options_reset');
}
}
// Create the form for display
$fields = array();
$fields[] = array('label' => qa_lang('cp/enable_community_posts'), 'tags' => 'NAME="cp_enable"', 'value' => qa_opt('cp_enable'), 'type' => 'checkbox');
return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="cp_save"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="cp_reset"')));
}
示例4: admin_form
function admin_form(&$qa_content)
{
// Process form input
$ok = null;
if (qa_clicked('prevnav_save_button')) {
qa_opt('prevnav_plugin_css', qa_post_text('prevnav_plugin_css'));
qa_opt('prevnav_plugin_widget_only', (bool) qa_post_text('prevnav_plugin_widget_only'));
qa_opt('prevnav_plugin_widget_title', qa_post_text('prevnav_plugin_widget_title'));
$ok = qa_lang('admin/options_saved');
} else {
if (qa_clicked('prevnav_reset_button')) {
foreach ($_POST as $i => $v) {
$def = $this->option_default($i);
if ($def !== null) {
qa_opt($i, $def);
}
}
$ok = qa_lang('admin/options_reset');
}
}
// Create the form for display
$fields = array();
$fields[] = array('type' => 'blank');
$fields[] = array('label' => 'PrevNav buttons custom css', 'tags' => 'NAME="prevnav_plugin_css"', 'value' => qa_opt('prevnav_plugin_css'), 'type' => 'textarea', 'rows' => 20);
$fields[] = array('label' => 'Widget Title', 'tags' => 'NAME="prevnav_plugin_widget_title"', 'value' => qa_opt('prevnav_plugin_widget_title'));
$fields[] = array('type' => 'blank');
$fields[] = array('type' => 'blank');
return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="prevnav_save_button"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="prevnav_reset_button"')));
}
示例5: admin_form
function admin_form(&$qa_content)
{
// Process form input
$ok = null;
if (qa_clicked('adchat_save_button')) {
qa_opt('adchat_plugin_css', qa_post_text('adchat_plugin_css'));
if (qa_post_text('adchat-expand-categories') == 1) {
qa_opt('adchat-expand-categories', "1");
} else {
qa_opt('adchat-expand-categories', "0");
}
$ok = qa_lang('admin/options_saved');
} else {
if (qa_clicked('adchat_reset_button')) {
foreach ($_POST as $i => $v) {
$def = $this->option_default($i);
if ($def !== null) {
qa_opt($i, $def);
}
}
$ok = qa_lang('admin/options_reset');
}
}
// Create the form for display
$fields = array();
$fields[] = array('type' => 'blank');
$fields[] = array('label' => 'Adchat custom css', 'tags' => 'NAME="adchat_plugin_css"', 'value' => qa_opt('adchat_plugin_css'), 'type' => 'textarea', 'rows' => 20);
$fields[] = array('label' => 'Make all categories into chat room', 'note' => 'Otherwise only top level categories are made to chat room', 'tags' => 'NAME="adchat-expand-categories"', 'value' => qa_opt('adchat-expand-categories'), 'type' => 'checkbox');
return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="adchat_save_button"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="adchat_reset_button"')));
}
示例6: q2apro_save_most_viewed_questions
function q2apro_save_most_viewed_questions()
{
// save checktime of cache
qa_opt('q2apro_popularqu_checktime', time());
$maxquestions = qa_opt('q2apro_popularqu_maxqu');
$lastdays = qa_opt('q2apro_popularqu_lastdays');
$ourTopQuestions = qa_db_read_all_assoc(qa_db_query_sub('SELECT postid, title, acount FROM `^posts`
WHERE `created` > NOW() - INTERVAL # DAY
AND `type` = "Q"
AND `closedbyid` IS NULL
ORDER BY views DESC
LIMIT #;', $lastdays, $maxquestions));
$saveoutput = '';
foreach ($ourTopQuestions as $qu) {
$activity_url = qa_path_html(qa_q_request($qu['postid'], $qu['title']), null, qa_opt('site_url'), null, null);
$questionlink = '<a href="' . $activity_url . '">' . htmlspecialchars($qu['title']) . '</a>';
$answercnt = '';
if (qa_opt('q2apro_popularqu_answercount')) {
$acnttitle = $qu['acount'] == 1 ? qa_lang('q2apro_popularqu_lang/answer_one') : $qu['acount'] . ' ' . qa_lang('q2apro_popularqu_lang/answers');
$answercnt = ' <span title="' . $acnttitle . '">(' . $qu['acount'] . ')</span>';
}
$saveoutput .= '<li>
' . $questionlink . $answercnt . '
</li>
';
}
// save into cache
qa_opt('q2apro_popularqu_cached', $saveoutput);
}
示例7: qa_question_set_selchildid
function qa_question_set_selchildid($userid, $handle, $cookieid, $oldquestion, $selchildid, $answers)
{
$oldselchildid = $oldquestion['selchildid'];
qa_db_post_set_selchildid($oldquestion['postid'], isset($selchildid) ? $selchildid : null);
qa_db_points_update_ifuser($oldquestion['userid'], 'aselects');
if (isset($oldselchildid)) {
if (isset($answers[$oldselchildid])) {
qa_db_points_update_ifuser($answers[$oldselchildid]['userid'], 'aselecteds');
qa_report_event('a_unselect', $userid, $handle, $cookieid, array('parentid' => $oldquestion['postid'], 'postid' => $oldselchildid));
}
}
if (isset($selchildid)) {
$answer = $answers[$selchildid];
qa_db_points_update_ifuser($answer['userid'], 'aselecteds');
if (isset($answer['notify']) && !qa_post_is_by_user($answer, $userid, $cookieid)) {
require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
require_once QA_INCLUDE_DIR . 'qa-app-options.php';
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
$blockwordspreg = qa_get_block_words_preg();
$sendtitle = qa_block_words_replace($oldquestion['title'], $blockwordspreg);
$sendcontent = qa_viewer_text($answer['content'], $answer['format'], array('blockwordspreg' => $blockwordspreg));
qa_send_notification($answer['userid'], $answer['notify'], @$answer['handle'], qa_lang('emails/a_selected_subject'), qa_lang('emails/a_selected_body'), array('^s_handle' => isset($handle) ? $handle : qa_lang('main/anonymous'), '^q_title' => $sendtitle, '^a_content' => $sendcontent, '^url' => qa_path(qa_q_request($oldquestion['postid'], $sendtitle), null, qa_opt('site_url'), null, qa_anchor('A', $selchildid))));
}
qa_report_event('a_select', $userid, $handle, $cookieid, array('parentid' => $oldquestion['postid'], 'postid' => $selchildid));
}
}
示例8: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
$widget_opt = @$themeobject->current_widget['param']['options'];
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-q-list.php';
$categoryslugs = '';
$userid = qa_get_logged_in_userid();
// Get lists of recent activity in all its forms, plus category information
list($questions1, $questions2, $questions3, $questions4) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, $categoryslugs, null, false, false, $qcount), qa_db_recent_a_qs_selectspec($userid, 0, $categoryslugs), qa_db_recent_c_qs_selectspec($userid, 0, $categoryslugs), qa_db_recent_edit_qs_selectspec($userid, 0, $categoryslugs));
// Prepare and return content for theme
$content = qa_q_list_page_content(qa_any_sort_and_dedupe(array_merge($questions1, $questions2, $questions3, $questions4)), $qcount, 0, null, null, null, null, null, true, 'activity/', null, null, null, null);
$content = $content['q_list']['qs'];
if (@$themeobject->current_widget['param']['locations']['show_title']) {
$themeobject->output('<h3 class="widget-title">' . qa_lang('cleanstrap/recent_activities') . ' <a href="' . qa_path_html('activity') . '">' . qa_lang('cleanstrap/view_all') . '</a></h3>');
}
$themeobject->output('<div class="ra-question-activity-widget">');
$q_list = $content;
$themeobject->output('<ul class="activity-list">');
foreach ($q_list as $list) {
$themeobject->output('<li class="clearfix ' . (is_featured($list['raw']['postid']) ? ' featured' : '') . '"><span class="fav-star icon-heart' . (@$list['raw']['userfavoriteq'] ? ' active' : '') . '"></span><span class="post-status-c">' . cs_post_status($list) . '</span><a href="' . $list['url'] . '">' . $list['title'] . '<span class="time">' . implode(' ', $list['when']) . '</span><span class="ans-count total-' . $list['raw']['acount'] . '">' . $list['raw']['acount'] . '</span></a></li>');
}
$themeobject->output('</ul>');
$themeobject->output('</div>');
}
示例9: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
if (!qa_opt('event_logger_to_database')) {
return;
}
$badges = qa_db_read_all_assoc(qa_db_query_sub('SELECT event,handle,params, UNIX_TIMESTAMP(datetime) AS datetime FROM ^eventlog WHERE event=$' . (qa_opt('badge_widget_date_max') ? ' AND DATE_SUB(CURDATE(),INTERVAL ' . (int) qa_opt('badge_widget_date_max') . ' DAY) <= datetime' : '') . ' ORDER BY datetime DESC' . (qa_opt('badge_widget_list_max') ? ' LIMIT ' . (int) qa_opt('badge_widget_list_max') : ''), 'badge_awarded'));
if (empty($badges)) {
return;
}
$themeobject->output('<h2>' . qa_lang('badges/badge_widget_title') . '</h2>');
foreach ($badges as $badge) {
$params = array();
$paramsa = explode("\t", $badge['params']);
foreach ($paramsa as $param) {
$parama = explode('=', $param);
$params[$parama[0]] = $parama[1];
}
$slug = $params['badge_slug'];
$typea = qa_get_badge_type_by_slug($slug);
$types = $typea['slug'];
$typed = $typea['name'];
$badge_name = qa_lang('badges/' . $slug);
if (!qa_opt('badge_' . $slug . '_name')) {
qa_opt('badge_' . $slug . '_name', $badge_name);
}
$var = qa_opt('badge_' . $slug . '_var');
$name = qa_opt('badge_' . $slug . '_name');
$desc = qa_badge_desc_replace($slug, $var, $name);
$string = '<span class="badge-' . $types . '" title="' . $desc . ' (' . $typed . ')">' . qa_html($name) . '<br/>- ' . $badge['handle'] . ' -</span>';
$themeobject->output('<div class="badge-widget-entry" style="padding-top:8px;">', $string, '</div>');
}
}
示例10: admin_form
function admin_form(&$qa_content)
{
// process the admin form if admin hit Save-Changes-button
$ok = null;
if (qa_clicked('qa_blog_save')) {
qa_opt('qa_blog_enabled', (bool) qa_post_text('qa_blog_enabled'));
qa_opt('qa_blog_title', qa_post_text('qa_blog_title'));
qa_opt('qa_blog_tagline', qa_post_text('qa_blog_tagline'));
qa_opt('qa_blog_cat_1', qa_post_text('qa_blog_cat_1'));
qa_opt('qa_blog_cat_2', qa_post_text('qa_blog_cat_2'));
qa_opt('qa_blog_cat_3', qa_post_text('qa_blog_cat_3'));
qa_opt('qa_blog_cat_4', qa_post_text('qa_blog_cat_4'));
qa_opt('qa_blog_cat_5', qa_post_text('qa_blog_cat_5'));
qa_opt('qa_blog_rules', qa_post_text('qa_blog_rules'));
qa_opt('qa_blog_content_max', (int) qa_post_text('qa_blog_content_max_field'));
$ok = qa_lang('qa_blog_lang/blog_save');
}
qa_set_display_rules($qa_content, array('field_2' => 'field_1', 'field_3' => 'field_1', 'field_5' => 'field_1', 'field_6' => 'field_1', 'field_7' => 'field_1', 'field_8' => 'field_1', 'field_9' => 'field_1', 'field_10' => 'field_1', 'field_11' => 'field_1'));
// form fields to display frontend for admin
$fields = array();
$fields[] = array('label' => qa_lang('qa_blog_lang/enable_plugin'), 'type' => 'checkbox', 'value' => qa_opt('qa_blog_enabled'), 'tags' => 'name="qa_blog_enabled" id="field_1"');
$fields[] = array('id' => 'field_2', 'type' => 'input', 'label' => qa_lang('qa_blog_lang/blog_title'), 'value' => qa_opt('qa_blog_title'), 'tags' => 'name="qa_blog_title"');
$fields[] = array('id' => 'field_3', 'type' => 'textarea', 'label' => qa_lang('qa_blog_lang/blog_tagline'), 'value' => qa_opt('qa_blog_tagline'), 'rows' => 4, 'tags' => 'name="qa_blog_tagline"');
$fields[] = array('id' => 'field_5', 'type' => 'input', 'label' => qa_lang('qa_blog_lang/cat_1'), 'value' => qa_opt('qa_blog_cat_1'), 'tags' => 'name="qa_blog_cat_1"');
$fields[] = array('id' => 'field_6', 'type' => 'input', 'label' => qa_lang('qa_blog_lang/cat_2'), 'value' => qa_opt('qa_blog_cat_2'), 'tags' => 'name="qa_blog_cat_2"');
$fields[] = array('id' => 'field_7', 'type' => 'input', 'label' => qa_lang('qa_blog_lang/cat_3'), 'value' => qa_opt('qa_blog_cat_3'), 'tags' => 'name="qa_blog_cat_3"');
$fields[] = array('id' => 'field_8', 'type' => 'input', 'label' => qa_lang('qa_blog_lang/cat_4'), 'value' => qa_opt('qa_blog_cat_4'), 'tags' => 'name="qa_blog_cat_4"');
$fields[] = array('id' => 'field_9', 'type' => 'input', 'label' => qa_lang('qa_blog_lang/cat_5'), 'value' => qa_opt('qa_blog_cat_5'), 'tags' => 'name="qa_blog_cat_5"');
$fields[] = array('id' => 'field_10', 'type' => 'textarea', 'label' => qa_lang('qa_blog_lang/blog_rules'), 'value' => qa_opt('qa_blog_rules'), 'tags' => 'name="qa_blog_rules"', 'rows' => 4);
$fields[] = array('id' => 'field_11', 'label' => qa_lang('qa_blog_lang/content_max'), 'suffix' => qa_lang('qa_blog_lang/suffix'), 'type' => 'number', 'value' => (int) qa_opt('qa_blog_content_max'), 'tags' => 'name="qa_blog_content_max_field"');
return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'name="qa_blog_save"')));
}
示例11: mp_announcement_create
function mp_announcement_create($userid, $handle, $cookieid, $title, $content, $format, $text, $notify, $categoryid)
{
/*
* Proceeds to create an announcement
*
*/
require_once QA_INCLUDE_DIR . 'qa-db-post-create.php';
require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
require_once QA_INCLUDE_DIR . 'mp-app-users.php';
// persist data to database
$postid = qa_db_post_create('AN', null, $userid, $cookieid, qa_remote_ip_address(), $title, $content, $format, null, $notify, $categoryid);
qa_user_report_action(qa_get_logged_in_userid(), null, null, null, null);
// update new post with category path hierarchy
qa_db_posts_calc_category_path($postid);
// send notifications
if ($notify && isset($postid)) {
$category = mp_get_categoryinfo($categoryid);
$recipients = mp_get_category_userids($categoryid);
foreach ($recipients as $recipient) {
// retrieve the user flags
$userflags = mp_get_user_flags($recipient['userid']);
// check user flags to determine whether user should be notified or not
// of the new answer post
if (!($userflags & QA_USER_FLAGS_NOTIFY_ANNOUNCEMENTS)) {
qa_send_notification($recipient['userid'], null, null, qa_lang('emails/an_posted_subject'), qa_lang('emails/an_posted_body'), array('^an_handle' => $handle, '^category_title' => $category['title'], '^an_title' => $title, '^an_url' => qa_path('mp-announcements-page', null, qa_opt('site_url'), null, null)));
}
}
}
// report announcement create event
qa_report_event('an_post', $userid, $handle, $cookieid, array('postid' => $postid, 'title' => $title, 'content' => $content, 'format' => $format, 'text' => $text, 'categoryid' => $categoryid, 'notify' => $notify));
return $postid;
}
示例12: admin_form
function admin_form(&$qa_content)
{
$ok = null;
if (qa_clicked('short_url_save_button')) {
qa_opt('short_url_content_on', (bool) qa_post_text('short_url_content_on'));
qa_opt('short_url_bitly_username', (string) qa_post_text('short_url_bitly_username'));
qa_opt('short_url_bitly_api_key', (string) qa_post_text('short_url_bitly_api_key'));
$ok = qa_lang('admin/options_saved');
} else {
if (qa_clicked('short_url_reset_button')) {
foreach ($_POST as $i => $v) {
$def = $this->option_default($i);
if ($def !== null) {
qa_opt($i, $def);
}
}
$ok = qa_lang('admin/options_reset');
}
}
$fields = array();
$ready = strlen(qa_opt('short_url_bitly_username')) && strlen(qa_opt('short_url_bitly_api_key'));
if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1') {
$fields[] = array('label' => 'You cannot enable when in localhost', 'tags' => 'NAME="short_url_content_on"', 'value' => qa_opt('short_url_content_on'), 'type' => 'checkbox', 'disabled' => 'disabled');
} else {
$fields[] = array('label' => 'Enable Short Url', 'tags' => 'NAME="short_url_content_on"', 'value' => qa_opt('short_url_content_on'), 'type' => 'checkbox');
}
$fields[] = array('label' => 'Your Bitly username', 'tags' => 'NAME="short_url_bitly_username"', 'value' => qa_opt('short_url_bitly_username'), 'type' => 'string');
$fields[] = array('label' => 'Your Bitly api key', 'tags' => 'NAME="short_url_bitly_api_key"', 'value' => qa_opt('short_url_bitly_api_key'), 'type' => 'string', 'error' => $ready ? null : 'You can find your api key <a href="https://bitly.com/a/your_api_key">here</a>');
return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="short_url_save_button"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="short_url_reset_button"')));
}
示例13: admin_form
function admin_form(&$qa_content)
{
$ok = null;
if (qa_clicked('obvious_save_button')) {
qa_opt('obvious_content_on', (bool) qa_post_text('obvious_content_on'));
qa_opt('obvious_content_color', (string) qa_post_text('obvious_content_color'));
qa_opt('obvious_max_tags', (int) qa_post_text('obvious_max_tags'));
qa_opt('obvious_content_category_on', (bool) qa_post_text('obvious_content_category_on'));
qa_opt('obvious_content_category_color', (string) qa_post_text('obvious_content_category_color'));
$ok = qa_lang('admin/options_saved');
} else {
if (qa_clicked('obvious_reset_button')) {
foreach ($_POST as $i => $v) {
$def = $this->option_default($i);
if ($def !== null) {
qa_opt($i, $def);
}
}
$ok = qa_lang('admin/options_reset');
}
}
$fields = array();
$fields[] = array('label' => 'Enable Obvious Favorite Tags', 'tags' => 'NAME="obvious_content_on"', 'value' => qa_opt('obvious_content_on'), 'type' => 'checkbox');
$fields[] = array('label' => 'Your color in Hex', 'tags' => 'NAME="obvious_content_color"', 'value' => qa_opt('obvious_content_color'), 'type' => 'string');
$fields[] = array('label' => 'Enable Obvious Favorite Category', 'tags' => 'NAME="obvious_content_category_on"', 'value' => qa_opt('obvious_content_category_on'), 'type' => 'checkbox');
$fields[] = array('label' => 'Your color in Hex', 'tags' => 'NAME="obvious_content_category_color"', 'value' => qa_opt('obvious_content_category_color'), 'type' => 'string');
$fields[] = array('type' => 'blank');
$fields[] = array('label' => 'Maximum tags for the Widget', 'tags' => 'NAME="obvious_max_tags"', 'value' => qa_opt('obvious_max_tags'), 'type' => 'int');
return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="obvious_save_button"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="obvious_reset_button"')));
}
示例14: cs_events
function cs_events($limit = 10, $events_type = false)
{
if (!$events_type) {
$events_type = array('q_post', 'a_post', 'c_post', 'a_select', 'badge_awarded');
}
// query last 3 events
$posts = qa_db_read_all_assoc(qa_db_query_sub('SELECT datetime,ipaddress,handle,event,params FROM ^eventlog WHERE event IN ("q_post", "a_post", "c_post") ORDER BY datetime DESC LIMIT #', $limit));
if (empty($posts)) {
return;
}
$postids = '';
$i = 1;
foreach ($posts as $post) {
$params = preg_replace('/\\s+/', '&', $post['params']);
parse_str($params, $data);
$postids .= ($i != 1 ? ', ' : '') . $data['postid'];
$i++;
}
$posts = qa_db_read_all_assoc(qa_db_query_sub('SELECT ^posts.* , ^users.handle FROM ^posts, ^users WHERE (^posts.userid=^users.userid AND ^posts.postid IN (' . $postids . ')) AND ^posts.type IN ("Q", "A", "C") ORDER BY ^posts.created DESC'));
$o = '<ul class="ra-activity">';
foreach ($posts as $p) {
$event_name = '';
$event_icon = '';
if ($p['type'] == 'Q') {
$event_name = qa_lang('cleanstrap/asked');
$event_icon = 'icon-question';
} else {
if ($p['type'] == 'A') {
$event_name = qa_lang('cleanstrap/answered');
$event_icon = 'icon-answer';
} else {
$event_name = qa_lang('cleanstrap/commented');
$event_icon = 'icon-chat';
}
}
$username = is_null($p['handle']) ? qa_lang('cleanstrap/anonymous') : htmlspecialchars($p['handle']);
$usernameLink = is_null($p['handle']) ? qa_lang('cleanstrap/anonymous') : '<a href="' . qa_path_html('user/' . $p['handle']) . '">' . $p['handle'] . '</a>';
$timeCode = qa_when_to_html(strtotime($p['created']), 7);
$time = @$timeCode['prefix'] . @$timeCode['data'] . @$timeCode['suffix'];
$o .= '<li class="event-item">';
$o .= '<div class="event-inner">';
$o .= '<div class="event-icon pull-left ' . $event_icon . '"></div>';
$o .= '<div class="event-content">';
$o .= '<p class="title"><strong class="avatar" data-handle="' . $p['handle'] . '" data-id="' . $p['userid'] . '">' . @$usernameLink . '</strong> <span class="what">' . $event_name . '</span></p>';
if ($p['type'] == 'Q') {
$o .= '<a class="event-title" href="' . qa_q_path_html($p['postid'], $p['title']) . '" title="' . $p['title'] . '">' . cs_truncate($p['title'], 100) . '</a>';
} elseif ($p['type'] == 'A') {
$o .= '<a class="event-title" href="' . cs_post_link($p['parentid']) . '#a' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 100) . '</a>';
} else {
$o .= '<a class="event-title" href="' . cs_post_link($p['parentid']) . '#c' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 100) . '</a>';
}
$o .= '<span class="time">' . $time . '</span>';
$o .= '</div>';
$o .= '</div>';
$o .= '</li>';
}
$o .= '</ul>';
return $o;
}
示例15: donut_options_lang
/**
* Returns the language value as defined in lang/donut-options-lang-*.php
*
* @param $indentifier
* @param null $subs
*
* @return mixed|string
*/
function donut_options_lang($indentifier, $subs = null)
{
if (!is_array($subs)) {
return empty($subs) ? qa_lang('donut_options/' . $indentifier) : qa_lang_sub('donut_options/' . $indentifier, $subs);
} else {
return strtr(qa_lang('donut_options/' . $indentifier), $subs);
}
}