本文整理汇总了PHP中qa_post_text函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_post_text函数的具体用法?PHP qa_post_text怎么用?PHP qa_post_text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_post_text函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin_form
function admin_form(&$qa_content)
{
// Process form input
$ok = null;
if (qa_clicked('ajax_comment_save')) {
qa_opt('ajax_comment_enable', (bool) qa_post_text('ajax_comment_enable'));
qa_opt('ajax_comment_format', (int) qa_post_text('ajax_comment_format'));
qa_opt('ajax_comment_username', (bool) qa_post_text('ajax_comment_username'));
qa_opt('ajax_comment_flash_star', (bool) qa_post_text('ajax_comment_flash_star'));
qa_opt('ajax_comment_answer_reminder', (bool) qa_post_text('ajax_comment_answer_reminder'));
qa_opt('ajax_comment_answer_reminder_text', qa_post_text('ajax_comment_answer_reminder_text'));
qa_opt('ajax_comment_popup_notice', (bool) qa_post_text('ajax_comment_popup_notice'));
qa_opt('ajax_comment_popup_notice_text', qa_post_text('ajax_comment_popup_notice_text'));
$ok = 'Settings Saved.';
}
$formats = array();
$formats[] = 'plain text';
$editors = qa_list_modules('viewer');
if (in_array('Markdown Viewer', $editors)) {
$formats[] = 'markdown';
}
$formats[] = 'html';
// Create the form for display
$fields = array();
$fields[] = array('label' => 'Enable ajax comment form', 'tags' => 'NAME="ajax_comment_enable"', 'value' => qa_opt('ajax_comment_enable'), 'type' => 'checkbox');
$fields[] = array('label' => 'Comment format', 'tags' => 'NAME="ajax_comment_format"', 'type' => 'select', 'options' => $formats, 'value' => @$formats[qa_opt('ajax_comment_format')]);
$fields[] = array('label' => 'Add @username to comment box', 'tags' => 'NAME="ajax_comment_username"', 'value' => (int) qa_opt('ajax_comment_username'), 'type' => 'checkbox');
$fields[] = array('label' => 'Show reminder text if commenting on answer to own question', 'tags' => 'NAME="ajax_comment_answer_reminder" onclick="if(this.checked) jQuery(\'#ajax_comment_answer_reminder_text\').fadeIn(); else jQuery(\'#ajax_comment_answer_reminder_text\').fadeOut();"', 'value' => (int) qa_opt('ajax_comment_answer_reminder'), 'type' => 'checkbox');
$fields[] = array('tags' => 'id="ajax_comment_answer_reminder_text" name="ajax_comment_answer_reminder_text" style="display:' . (qa_opt('ajax_comment_answer_reminder') ? 'block' : 'none') . '"', 'value' => qa_html(qa_opt('ajax_comment_answer_reminder_text')), 'type' => 'text');
$fields[] = array('label' => 'Flash select star if commenting on answer to own question', 'tags' => 'NAME="ajax_comment_flash_star"', 'value' => (int) qa_opt('ajax_comment_flash_star'), 'type' => 'checkbox');
$fields[] = array('label' => 'Show reminder pop-up if if voting up answer to own question', 'tags' => 'NAME="ajax_comment_popup_notice" onclick="if(this.checked) jQuery(\'#ajax_comment_popup_notice_text\').fadeIn(); else jQuery(\'#ajax_comment_popup_notice_text\').fadeOut();"', 'value' => (int) qa_opt('ajax_comment_popup_notice'), 'type' => 'checkbox');
$fields[] = array('tags' => 'id="ajax_comment_popup_notice_text" name="ajax_comment_popup_notice_text" style="display:' . (qa_opt('ajax_comment_popup_notice') ? 'block' : 'none') . '"', 'value' => qa_html(qa_opt('ajax_comment_popup_notice_text')), 'type' => 'text');
return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => 'Save', 'tags' => 'NAME="ajax_comment_save"')));
}
示例2: 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"')));
}
示例3: admin_form
function admin_form(&$qa_content)
{
$saved = false;
if (qa_clicked(self::SAVE_BUTTON)) {
qa_opt(self::FACEBOOK_PAGE_URL, qa_post_text(self::FACEBOOK_PAGE_URL));
// for like box
qa_opt(self::SHOW_FB_LIKE_BOX, !!qa_post_text(self::SHOW_FB_LIKE_BOX));
qa_opt(self::LIKE_BOX_COLOR_SCHEME, qa_post_text(self::LIKE_BOX_COLOR_SCHEME));
qa_opt(self::LIKE_BOX_SHOW_HEADER, qa_post_text(self::LIKE_BOX_SHOW_HEADER));
qa_opt(self::LIKE_BOX_SHOW_BORDER, qa_post_text(self::LIKE_BOX_SHOW_BORDER));
qa_opt(self::LIKE_BOX_SHOW_FACES, qa_post_text(self::LIKE_BOX_SHOW_FACES));
qa_opt(self::LIKE_BOX_SHOW_DATA_STREAM, qa_post_text(self::LIKE_BOX_SHOW_DATA_STREAM));
qa_opt(self::LIKE_BOX_HEIGHT, qa_post_text(self::LIKE_BOX_HEIGHT));
qa_opt(self::LIKE_BOX_WIDTH, qa_post_text(self::LIKE_BOX_WIDTH));
// for modal
qa_opt(self::SHOW_FB_LIKE_MODAL, !!qa_post_text(self::SHOW_FB_LIKE_MODAL));
qa_opt(self::MODAL_COLOR_SCHEME, qa_post_text(self::MODAL_COLOR_SCHEME));
qa_opt(self::MODAL_SHOW_HEADER, qa_post_text(self::MODAL_SHOW_HEADER));
qa_opt(self::MODAL_SHOW_BORDER, qa_post_text(self::MODAL_SHOW_BORDER));
qa_opt(self::MODAL_SHOW_FACES, qa_post_text(self::MODAL_SHOW_FACES));
qa_opt(self::MODAL_SHOW_DATA_STREAM, qa_post_text(self::MODAL_SHOW_DATA_STREAM));
qa_opt(self::MODAL_HEIGHT, qa_post_text(self::MODAL_HEIGHT));
qa_opt(self::MODAL_WIDTH, qa_post_text(self::MODAL_WIDTH));
qa_opt(self::MODAL_COOKIE_EXPIRE, qa_post_text(self::MODAL_COOKIE_EXPIRE));
qa_opt(self::MODAL_HEADER_MAIN_TEXT, qa_post_text(self::MODAL_HEADER_MAIN_TEXT));
qa_opt(self::MODAL_FOOTER_TEXT, qa_post_text(self::MODAL_FOOTER_TEXT));
qa_opt(self::MODAL_USE_CSS_FROM_THEME, !!qa_post_text(self::MODAL_USE_CSS_FROM_THEME));
qa_opt(self::MODAL_COSTUM_CSS, qa_post_text(self::MODAL_COSTUM_CSS));
qa_opt(self::MODAL_DISPLAY_EVERY_TIME, !!qa_post_text(self::MODAL_DISPLAY_EVERY_TIME));
qa_opt(self::MODAL_DELAY, (int) qa_post_text(self::MODAL_DELAY));
$saved = true;
}
qa_set_display_rules($qa_content, array(self::LIKE_BOX_COLOR_SCHEME => self::SHOW_FB_LIKE_BOX, self::LIKE_BOX_SHOW_HEADER => self::SHOW_FB_LIKE_BOX, self::LIKE_BOX_SHOW_BORDER => self::SHOW_FB_LIKE_BOX, self::LIKE_BOX_SHOW_FACES => self::SHOW_FB_LIKE_BOX, self::LIKE_BOX_SHOW_DATA_STREAM => self::SHOW_FB_LIKE_BOX, self::LIKE_BOX_HEIGHT => self::SHOW_FB_LIKE_BOX, self::LIKE_BOX_WIDTH => self::SHOW_FB_LIKE_BOX, self::MODAL_COLOR_SCHEME => self::SHOW_FB_LIKE_MODAL, self::MODAL_SHOW_HEADER => self::SHOW_FB_LIKE_MODAL, self::MODAL_SHOW_BORDER => self::SHOW_FB_LIKE_MODAL, self::MODAL_SHOW_FACES => self::SHOW_FB_LIKE_MODAL, self::MODAL_SHOW_DATA_STREAM => self::SHOW_FB_LIKE_MODAL, self::MODAL_HEIGHT => self::SHOW_FB_LIKE_MODAL, self::MODAL_WIDTH => self::SHOW_FB_LIKE_MODAL, self::MODAL_COOKIE_EXPIRE => self::SHOW_FB_LIKE_MODAL, self::MODAL_HEADER_MAIN_TEXT => self::SHOW_FB_LIKE_MODAL, self::MODAL_FOOTER_TEXT => self::SHOW_FB_LIKE_MODAL, self::MODAL_USE_CSS_FROM_THEME => self::SHOW_FB_LIKE_MODAL, self::MODAL_COSTUM_CSS => self::SHOW_FB_LIKE_MODAL, self::MODAL_DISPLAY_EVERY_TIME => self::SHOW_FB_LIKE_MODAL, self::MODAL_DELAY => self::SHOW_FB_LIKE_MODAL));
return array('ok' => $saved ? qa_lang('flb_like_box/settings_saved') : null, 'fields' => array(self::FACEBOOK_PAGE_URL => $this->get_fb_page_url_field(), self::SHOW_FB_LIKE_BOX => $this->get_show_likebox_field(), self::LIKE_BOX_COLOR_SCHEME => $this->get_lokebox_color_scheme_field(), self::LIKE_BOX_SHOW_HEADER => $this->get_likebox_show_header_field(), self::LIKE_BOX_SHOW_BORDER => $this->get_likebox_show_border_field(), self::LIKE_BOX_SHOW_FACES => $this->get_likebox_show_faces_field(), self::LIKE_BOX_SHOW_DATA_STREAM => $this->get_likebox_show_data_stream(), self::LIKE_BOX_HEIGHT => $this->get_likebox_height_field(), self::LIKE_BOX_WIDTH => $this->get_likebox_width_field(), self::SHOW_FB_LIKE_MODAL => $this->get_show_like_modal_field(), self::MODAL_USE_CSS_FROM_THEME => $this->get_like_modal_use_css_from_theme_field(), self::MODAL_DISPLAY_EVERY_TIME => $this->get_like_modal_display_every_time_field(), self::MODAL_COLOR_SCHEME => $this->get_like_modal_color_scheme_field(), self::MODAL_SHOW_HEADER => $this->get_like_modal_show_header_field(), self::MODAL_SHOW_BORDER => $this->get_like_modal_show_border_field(), self::MODAL_SHOW_FACES => $this->get_like_modal_show_faces_field(), self::MODAL_SHOW_DATA_STREAM => $this->get_like_modal_show_data_stream_field(), self::MODAL_HEIGHT => $this->get_like_modal_height_field(), self::MODAL_WIDTH => $this->get_like_modal_width_field(), self::MODAL_DELAY => $this->get_like_modal_delay_field(), self::MODAL_COOKIE_EXPIRE => $this->get_like_modal_cookie_expire_field(), self::MODAL_HEADER_MAIN_TEXT => $this->get_like_modal_header_main_text_field(), self::MODAL_FOOTER_TEXT => $this->get_like_modal_footer_text_field(), self::MODAL_COSTUM_CSS => $this->get_like_modal_custom_css_field()), 'buttons' => $this->get_admin_buttons());
}
示例4: admin_form
function admin_form(&$qa_content)
{
$saved = false;
if (qa_clicked(self::SAVE_BUTTON)) {
qa_opt(self::FACEBOOK_PAGE_URL, qa_post_text(self::FACEBOOK_PAGE_URL));
// for like box
qa_opt(self::SHOW_FB_LIKE_BOX, !!qa_post_text(self::SHOW_FB_LIKE_BOX));
qa_opt(self::LIKE_BOX_COLOR_SCHEME, qa_post_text(self::LIKE_BOX_COLOR_SCHEME));
qa_opt(self::LIKE_BOX_SHOW_HEADER, qa_post_text(self::LIKE_BOX_SHOW_HEADER));
qa_opt(self::LIKE_BOX_SHOW_BORDER, qa_post_text(self::LIKE_BOX_SHOW_BORDER));
qa_opt(self::LIKE_BOX_SHOW_FACES, qa_post_text(self::LIKE_BOX_SHOW_FACES));
qa_opt(self::LIKE_BOX_SHOW_DATA_STREAM, qa_post_text(self::LIKE_BOX_SHOW_DATA_STREAM));
qa_opt(self::LIKE_BOX_HEIGHT, qa_post_text(self::LIKE_BOX_HEIGHT));
qa_opt(self::LIKE_BOX_WIDTH, qa_post_text(self::LIKE_BOX_WIDTH));
// for modal
qa_opt(self::SHOW_FB_LIKE_MODAL, !!qa_post_text(self::SHOW_FB_LIKE_MODAL));
qa_opt(self::MODAL_COLOR_SCHEME, qa_post_text(self::MODAL_COLOR_SCHEME));
qa_opt(self::MODAL_SHOW_HEADER, qa_post_text(self::MODAL_SHOW_HEADER));
qa_opt(self::MODAL_SHOW_BORDER, qa_post_text(self::MODAL_SHOW_BORDER));
qa_opt(self::MODAL_SHOW_FACES, qa_post_text(self::MODAL_SHOW_FACES));
qa_opt(self::MODAL_SHOW_DATA_STREAM, qa_post_text(self::MODAL_SHOW_DATA_STREAM));
qa_opt(self::MODAL_HEIGHT, qa_post_text(self::MODAL_HEIGHT));
qa_opt(self::MODAL_WIDTH, qa_post_text(self::MODAL_WIDTH));
qa_opt(self::MODAL_COOKIE_EXPIRE, qa_post_text(self::MODAL_COOKIE_EXPIRE));
qa_opt(self::MODAL_HEADER_MAIN_TEXT, qa_post_text(self::MODAL_HEADER_MAIN_TEXT));
qa_opt(self::MODAL_FOOTER_TEXT, qa_post_text(self::MODAL_FOOTER_TEXT));
qa_opt(self::MODAL_USE_CSS_FROM_THEME, !!qa_post_text(self::MODAL_USE_CSS_FROM_THEME));
qa_opt(self::MODAL_COSTUM_CSS, qa_post_text(self::MODAL_COSTUM_CSS));
qa_opt(self::MODAL_DISPLAY_EVERY_TIME, !!qa_post_text(self::MODAL_DISPLAY_EVERY_TIME));
qa_opt(self::MODAL_DELAY, (int) qa_post_text(self::MODAL_DELAY));
$saved = true;
}
qa_set_display_rules($qa_content, array(self::LIKE_BOX_COLOR_SCHEME => self::SHOW_FB_LIKE_BOX, self::LIKE_BOX_SHOW_HEADER => self::SHOW_FB_LIKE_BOX, self::LIKE_BOX_SHOW_BORDER => self::SHOW_FB_LIKE_BOX, self::LIKE_BOX_SHOW_FACES => self::SHOW_FB_LIKE_BOX, self::LIKE_BOX_SHOW_DATA_STREAM => self::SHOW_FB_LIKE_BOX, self::LIKE_BOX_HEIGHT => self::SHOW_FB_LIKE_BOX, self::LIKE_BOX_WIDTH => self::SHOW_FB_LIKE_BOX, self::MODAL_COLOR_SCHEME => self::SHOW_FB_LIKE_MODAL, self::MODAL_SHOW_HEADER => self::SHOW_FB_LIKE_MODAL, self::MODAL_SHOW_BORDER => self::SHOW_FB_LIKE_MODAL, self::MODAL_SHOW_FACES => self::SHOW_FB_LIKE_MODAL, self::MODAL_SHOW_DATA_STREAM => self::SHOW_FB_LIKE_MODAL, self::MODAL_HEIGHT => self::SHOW_FB_LIKE_MODAL, self::MODAL_WIDTH => self::SHOW_FB_LIKE_MODAL, self::MODAL_COOKIE_EXPIRE => self::SHOW_FB_LIKE_MODAL, self::MODAL_HEADER_MAIN_TEXT => self::SHOW_FB_LIKE_MODAL, self::MODAL_FOOTER_TEXT => self::SHOW_FB_LIKE_MODAL, self::MODAL_USE_CSS_FROM_THEME => self::SHOW_FB_LIKE_MODAL, self::MODAL_COSTUM_CSS => self::SHOW_FB_LIKE_MODAL, self::MODAL_DISPLAY_EVERY_TIME => self::SHOW_FB_LIKE_MODAL, self::MODAL_DELAY => self::SHOW_FB_LIKE_MODAL));
return array('ok' => $saved ? qa_lang('flb_like_box/settings_saved') : null, 'fields' => array(self::FACEBOOK_PAGE_URL => array('label' => qa_lang('flb_like_box/ur_fb_page_url'), 'type' => 'text', 'tags' => 'name="' . self::FACEBOOK_PAGE_URL . '"', 'value' => qa_opt(self::FACEBOOK_PAGE_URL), 'note' => qa_lang('flb_like_box/ur_fb_page_url_note')), self::SHOW_FB_LIKE_BOX => array('label' => qa_lang('flb_like_box/b_show_fb_like_box'), 'tags' => 'name="' . self::SHOW_FB_LIKE_BOX . '" id="' . self::SHOW_FB_LIKE_BOX . '"', 'value' => qa_opt(self::SHOW_FB_LIKE_BOX), 'type' => 'checkbox'), self::LIKE_BOX_COLOR_SCHEME => array('id' => self::LIKE_BOX_COLOR_SCHEME, 'label' => qa_lang('flb_like_box/b_colorscheme_label'), 'type' => 'select', 'tags' => 'name="' . self::LIKE_BOX_COLOR_SCHEME . '"', 'value' => qa_opt(self::LIKE_BOX_COLOR_SCHEME), 'options' => array('light' => 'light', 'dark' => 'dark')), self::LIKE_BOX_SHOW_HEADER => array('id' => self::LIKE_BOX_SHOW_HEADER, 'label' => qa_lang('flb_like_box/b_box_header_label'), 'type' => 'select', 'tags' => 'name="' . self::LIKE_BOX_SHOW_HEADER . '"', 'value' => qa_opt(self::LIKE_BOX_SHOW_HEADER), 'options' => array('false' => 'false', 'true' => 'true')), self::LIKE_BOX_SHOW_BORDER => array('id' => self::LIKE_BOX_SHOW_BORDER, 'label' => qa_lang('flb_like_box/b_show_border_label'), 'type' => 'select', 'tags' => 'name="' . self::LIKE_BOX_SHOW_BORDER . '"', 'value' => qa_opt(self::LIKE_BOX_SHOW_BORDER), 'options' => array('false' => 'false', 'true' => 'true')), self::LIKE_BOX_SHOW_FACES => array('id' => self::LIKE_BOX_SHOW_FACES, 'label' => qa_lang('flb_like_box/b_show_faces_label'), 'type' => 'select', 'tags' => 'name="' . self::LIKE_BOX_SHOW_FACES . '"', 'value' => qa_opt(self::LIKE_BOX_SHOW_FACES), 'options' => array('true' => 'true', 'false' => 'false')), self::LIKE_BOX_SHOW_DATA_STREAM => array('id' => self::LIKE_BOX_SHOW_DATA_STREAM, 'label' => qa_lang('flb_like_box/b_show_stream_label'), 'type' => 'select', 'tags' => 'name="' . self::LIKE_BOX_SHOW_DATA_STREAM . '"', 'value' => qa_opt(self::LIKE_BOX_SHOW_DATA_STREAM), 'options' => array('false' => 'false', 'true' => 'true')), self::LIKE_BOX_HEIGHT => array('id' => self::LIKE_BOX_HEIGHT, 'label' => qa_lang('flb_like_box/b_like_box_height_label'), 'type' => 'text', 'tags' => 'name="' . self::LIKE_BOX_HEIGHT . '"', 'value' => qa_opt(self::LIKE_BOX_HEIGHT)), self::LIKE_BOX_WIDTH => array('id' => self::LIKE_BOX_WIDTH, 'label' => qa_lang('flb_like_box/b_like_box_width_label'), 'type' => 'text', 'tags' => 'name="' . self::LIKE_BOX_WIDTH . '"', 'value' => !!qa_opt(self::LIKE_BOX_WIDTH) ? qa_opt(self::LIKE_BOX_WIDTH) : 200), self::SHOW_FB_LIKE_MODAL => array('label' => qa_lang('flb_like_box/m_show_fb_like_modal'), 'tags' => 'name="' . self::SHOW_FB_LIKE_MODAL . '" id="' . self::SHOW_FB_LIKE_MODAL . '"', 'value' => qa_opt(self::SHOW_FB_LIKE_MODAL), 'type' => 'checkbox'), self::MODAL_USE_CSS_FROM_THEME => array('id' => self::MODAL_USE_CSS_FROM_THEME, 'label' => qa_lang('flb_like_box/m_use_css_from_theme_file'), 'tags' => 'name="' . self::MODAL_USE_CSS_FROM_THEME . '"', 'value' => qa_opt(self::MODAL_USE_CSS_FROM_THEME), 'type' => 'checkbox'), self::MODAL_DISPLAY_EVERY_TIME => array('id' => self::MODAL_DISPLAY_EVERY_TIME, 'label' => qa_lang('flb_like_box/m_display_on_every_load'), 'tags' => 'name="' . self::MODAL_DISPLAY_EVERY_TIME . '"', 'value' => qa_opt(self::MODAL_DISPLAY_EVERY_TIME), 'type' => 'checkbox'), self::MODAL_COLOR_SCHEME => array('id' => self::MODAL_COLOR_SCHEME, 'label' => qa_lang('flb_like_box/m_colorscheme_label'), 'type' => 'select', 'tags' => 'name="' . self::MODAL_COLOR_SCHEME . '"', 'value' => qa_opt(self::MODAL_COLOR_SCHEME), 'options' => array('light' => 'light', 'dark' => 'dark')), self::MODAL_SHOW_HEADER => array('id' => self::MODAL_SHOW_HEADER, 'label' => qa_lang('flb_like_box/m_box_header_label'), 'type' => 'select', 'tags' => 'name="' . self::MODAL_SHOW_HEADER . '"', 'value' => qa_opt(self::MODAL_SHOW_HEADER), 'options' => array('false' => 'false', 'true' => 'true')), self::MODAL_SHOW_BORDER => array('id' => self::MODAL_SHOW_BORDER, 'label' => qa_lang('flb_like_box/m_show_border_label'), 'type' => 'select', 'tags' => 'name="' . self::MODAL_SHOW_BORDER . '"', 'value' => qa_opt(self::MODAL_SHOW_BORDER), 'options' => array('false' => 'false', 'true' => 'true')), self::MODAL_SHOW_FACES => array('id' => self::MODAL_SHOW_FACES, 'label' => qa_lang('flb_like_box/m_show_faces_label'), 'type' => 'select', 'tags' => 'name="' . self::MODAL_SHOW_FACES . '"', 'value' => qa_opt(self::MODAL_SHOW_FACES), 'options' => array('true' => 'true', 'false' => 'false')), self::MODAL_SHOW_DATA_STREAM => array('id' => self::MODAL_SHOW_DATA_STREAM, 'label' => qa_lang('flb_like_box/m_show_stream_label'), 'type' => 'select', 'tags' => 'name="' . self::MODAL_SHOW_DATA_STREAM . '"', 'value' => qa_opt(self::MODAL_SHOW_DATA_STREAM), 'options' => array('false' => 'false', 'true' => 'true')), self::MODAL_HEIGHT => array('id' => self::MODAL_HEIGHT, 'label' => qa_lang('flb_like_box/m_like_modal_height_label'), 'type' => 'text', 'tags' => 'name="' . self::MODAL_HEIGHT . '"', 'value' => qa_opt(self::MODAL_HEIGHT)), self::MODAL_WIDTH => array('id' => self::MODAL_WIDTH, 'label' => qa_lang('flb_like_box/m_like_modal_width_label'), 'type' => 'text', 'tags' => 'name="' . self::MODAL_WIDTH . '"', 'value' => qa_opt(self::MODAL_WIDTH)), self::MODAL_DELAY => array('id' => self::MODAL_DELAY, 'label' => qa_lang('flb_like_box/m_like_modal_delay'), 'type' => 'text', 'tags' => 'name="' . self::MODAL_DELAY . '"', 'value' => qa_opt(self::MODAL_DELAY), 'note' => qa_lang('flb_like_box/m_like_modal_delay_note')), self::MODAL_COOKIE_EXPIRE => array('id' => self::MODAL_COOKIE_EXPIRE, 'label' => qa_lang('flb_like_box/m_like_modal_cookie_expire'), 'type' => 'text', 'tags' => 'name="' . self::MODAL_COOKIE_EXPIRE . '"', 'value' => qa_opt(self::MODAL_COOKIE_EXPIRE), 'note' => qa_lang('flb_like_box/m_like_modal_cookie_expire_note')), self::MODAL_HEADER_MAIN_TEXT => array('id' => self::MODAL_HEADER_MAIN_TEXT, 'label' => qa_lang('flb_like_box/m_pop_up_header_text'), 'type' => 'textarea', 'rows' => 4, 'tags' => 'name="' . self::MODAL_HEADER_MAIN_TEXT . '"', 'value' => qa_opt(self::MODAL_HEADER_MAIN_TEXT)), self::MODAL_FOOTER_TEXT => array('id' => self::MODAL_FOOTER_TEXT, 'label' => qa_lang('flb_like_box/m_pop_up_footer_text'), 'type' => 'textarea', 'rows' => 4, 'tags' => 'name="' . self::MODAL_FOOTER_TEXT . '"', 'value' => qa_opt(self::MODAL_FOOTER_TEXT)), self::MODAL_COSTUM_CSS => array('id' => self::MODAL_COSTUM_CSS, 'label' => qa_lang('flb_like_box/m_costum_css'), 'type' => 'textarea', 'rows' => 4, 'tags' => 'name="' . self::MODAL_COSTUM_CSS . '"', 'value' => qa_opt(self::MODAL_COSTUM_CSS), 'note' => qa_lang_html('flb_like_box/m_costum_css_note'))), 'buttons' => array(array('label' => qa_lang('flb_like_box/save_changes'), 'tags' => 'name="' . self::SAVE_BUTTON . '"')));
}
示例5: admin_form
function admin_form(&$qa_content)
{
// Process form input
$saved = false;
if (qa_clicked('event_logger_save_button')) {
qa_opt('event_logger_to_database', (int) qa_post_text('event_logger_to_database_field'));
qa_opt('event_logger_to_files', qa_post_text('event_logger_to_files_field'));
qa_opt('event_logger_directory', qa_post_text('event_logger_directory_field'));
qa_opt('event_logger_hide_header', !qa_post_text('event_logger_hide_header_field'));
$saved = true;
// Create the database table if database logging was switched on
if (qa_opt('event_logger_to_database')) {
require_once QA_INCLUDE_DIR . 'qa-app-users.php';
require_once QA_INCLUDE_DIR . 'qa-db-maxima.php';
qa_db_query_sub('CREATE TABLE IF NOT EXISTS ^eventlog (' . 'datetime DATETIME NOT NULL,' . 'ipaddress VARCHAR (15) CHARACTER SET ascii,' . 'userid ' . qa_get_mysql_user_column_type() . ',' . 'handle VARCHAR(' . QA_DB_MAX_HANDLE_LENGTH . '),' . 'cookieid BIGINT UNSIGNED,' . 'event VARCHAR (20) CHARACTER SET ascii NOT NULL,' . 'params VARCHAR (800) NOT NULL,' . 'KEY datetime (datetime),' . 'KEY ipaddress (ipaddress),' . 'KEY userid (userid),' . 'KEY event (event)' . ') ENGINE=MyISAM DEFAULT CHARSET=utf8');
}
}
// Check the validity of the currently entered directory (if any)
$directory = qa_opt('event_logger_directory');
$note = null;
$error = null;
if (!strlen($directory)) {
$note = 'Please specify a directory that is writable by the web server.';
} elseif (!file_exists($directory)) {
$error = 'This directory cannot be found. Please enter the full path.';
} elseif (!is_dir($directory)) {
$error = 'This is a file. Please enter the full path of a directory.';
} elseif (!is_writable($directory)) {
$error = 'This directory is not writable by the web server. Please choose a different directory, use chown/chmod to change permissions, or contact your web hosting company for assistance.';
}
// Create the form for display
qa_set_display_rules($qa_content, array('event_logger_directory_display' => 'event_logger_to_files_field', 'event_logger_hide_header_display' => 'event_logger_to_files_field'));
return array('ok' => $saved && !isset($error) ? 'Event log settings saved' : null, 'fields' => array(array('label' => 'Log events to <code>' . QA_MYSQL_TABLE_PREFIX . 'eventlog</code> database table', 'tags' => 'NAME="event_logger_to_database_field"', 'value' => qa_opt('event_logger_to_database'), 'type' => 'checkbox'), array('label' => 'Log events to daily log files', 'tags' => 'NAME="event_logger_to_files_field" ID="event_logger_to_files_field"', 'value' => qa_opt('event_logger_to_files'), 'type' => 'checkbox'), array('id' => 'event_logger_directory_display', 'label' => 'Directory for log files (enter full path):', 'value' => qa_html($directory), 'tags' => 'NAME="event_logger_directory_field"', 'note' => $note, 'error' => $error), array('id' => 'event_logger_hide_header_display', 'label' => 'Include header lines at top of each log file', 'type' => 'checkbox', 'tags' => 'NAME="event_logger_hide_header_field"', 'value' => !qa_opt('event_logger_hide_header'))), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'NAME="event_logger_save_button"')));
}
示例6: admin_form
function admin_form(&$qa_content)
{
// process config change
$saved_msg = '';
if (qa_clicked('tag_synonyms_save_button')) {
qa_opt('tag_synonyms', trim(qa_post_text('tag_synonyms_text')));
qa_opt('tag_synonyms_prevent', (int) qa_post_text('tag_synonyms_prevent'));
qa_opt('tag_synonyms_rep', (int) qa_post_text('tag_synonyms_rep'));
$saved_msg = 'Tag Synonyms settings saved';
// convert all old tags based on synonyms
if (qa_post_text('tag_synonyms_convert')) {
$synonyms = $this->_synonyms_to_array(qa_opt('tag_synonyms'));
$edited = 0;
qa_suspend_event_reports(true);
// avoid infinite loop
foreach ($synonyms as $syn) {
list($questions, $qcount) = qa_db_select_with_pending(qa_db_tag_recent_qs_selectspec(null, $syn['from'], 0, false, 500), qa_db_tag_count_qs_selectspec($syn['from']));
foreach ($questions as $q) {
$oldtags = qa_tagstring_to_tags($q['tags']);
$newtags = $this->_convert_tags($oldtags, $synonyms);
qa_post_set_content($q['postid'], null, null, null, $newtags);
$edited++;
}
}
qa_suspend_event_reports(false);
$saved_msg .= ' (and ' . $edited . ' tags edited)';
}
}
// set fields to show/hide when checkbox is clicked
qa_set_display_rules($qa_content, array('tag_synonyms_rep' => 'tag_synonyms_prevent'));
return array('ok' => $saved_msg, 'fields' => array(array('label' => 'Tag Synonyms', 'tags' => 'name="tag_synonyms_text" id="tag_synonyms_text"', 'value' => qa_opt('tag_synonyms'), 'type' => 'textarea', 'rows' => 20, 'note' => 'Put each pair of synonyms on a new line. <code>q2a,question2answer</code> means that a tag of <code>q2a</code> will be replaced by <code>question2answer</code>, while <code>help</code> on its own means that tag will be removed.'), array('label' => 'Also convert existing tags using above rules', 'tags' => 'name="tag_synonyms_convert" id="tag_synonyms_convert"', 'value' => '', 'type' => 'checkbox'), array('type' => 'blank'), array('label' => 'Prevent new users from creating new tags', 'tags' => 'name="tag_synonyms_prevent" id="tag_synonyms_prevent"', 'value' => qa_opt('tag_synonyms_prevent'), 'type' => 'checkbox'), array('id' => 'tag_synonyms_rep', 'label' => 'Minimum reputation to create new tags', 'value' => qa_opt('tag_synonyms_rep'), 'tags' => 'name="tag_synonyms_rep"', 'type' => 'number')), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'name="tag_synonyms_save_button"')));
}
示例7: admin_form
public function admin_form()
{
require_once QA_INCLUDE_DIR . 'util/sort.php';
$saved = false;
if (qa_clicked('xml_sitemap_save_button')) {
qa_opt('xml_sitemap_show_questions', (int) qa_post_text('xml_sitemap_show_questions_field'));
if (!QA_FINAL_EXTERNAL_USERS) {
qa_opt('xml_sitemap_show_users', (int) qa_post_text('xml_sitemap_show_users_field'));
}
if (qa_using_tags()) {
qa_opt('xml_sitemap_show_tag_qs', (int) qa_post_text('xml_sitemap_show_tag_qs_field'));
}
if (qa_using_categories()) {
qa_opt('xml_sitemap_show_category_qs', (int) qa_post_text('xml_sitemap_show_category_qs_field'));
qa_opt('xml_sitemap_show_categories', (int) qa_post_text('xml_sitemap_show_categories_field'));
}
$saved = true;
}
$form = array('ok' => $saved ? 'XML sitemap settings saved' : null, 'fields' => array('questions' => array('label' => 'Include question pages', 'type' => 'checkbox', 'value' => (int) qa_opt('xml_sitemap_show_questions'), 'tags' => 'name="xml_sitemap_show_questions_field"')), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'name="xml_sitemap_save_button"')));
if (!QA_FINAL_EXTERNAL_USERS) {
$form['fields']['users'] = array('label' => 'Include user pages', 'type' => 'checkbox', 'value' => (int) qa_opt('xml_sitemap_show_users'), 'tags' => 'name="xml_sitemap_show_users_field"');
}
if (qa_using_tags()) {
$form['fields']['tagqs'] = array('label' => 'Include question list for each tag', 'type' => 'checkbox', 'value' => (int) qa_opt('xml_sitemap_show_tag_qs'), 'tags' => 'name="xml_sitemap_show_tag_qs_field"');
}
if (qa_using_categories()) {
$form['fields']['categoryqs'] = array('label' => 'Include question list for each category', 'type' => 'checkbox', 'value' => (int) qa_opt('xml_sitemap_show_category_qs'), 'tags' => 'name="xml_sitemap_show_category_qs_field"');
$form['fields']['categories'] = array('label' => 'Include category browser', 'type' => 'checkbox', 'value' => (int) qa_opt('xml_sitemap_show_categories'), 'tags' => 'name="xml_sitemap_show_categories_field"');
}
return $form;
}
示例8: process_request
function process_request($request)
{
$userid = qa_get_logged_in_userid();
$categoryoptions = array();
$qa_content = qa_content_prepare();
// check if we have done a post of the page
if (qa_post_text('okthen')) {
// update the current category
$newcategory = qa_post_text('category');
if (isset($newcategory)) {
mp_set_categoryid($newcategory);
// redirect to main page
qa_redirect('');
} else {
$qa_content['error'] = 'You must select a course to continue.';
}
}
// retrieve list of categories user is associated with
// populate category options
$results = mp_get_categories_for_user($userid);
foreach ($results as $row) {
$categoryoptions[$row['categoryid']] = $row['title'];
}
$qa_content['title'] = 'Registered courses';
$qa_content['custom'] = 'The following list displays all courses your account is associated with. Select a course from the list below and click <B>Select</B> to change to the new course<br /><br />';
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'fields' => array('courses' => array('type' => 'select-radio', 'label' => 'Courses', 'tags' => 'NAME="category"', 'options' => $categoryoptions, 'value' => mp_get_categoryid(), 'error' => qa_html(@$errors['course']))), 'buttons' => array('ok' => array('tags' => 'NAME="okthen"', 'label' => 'Select', 'value' => '1')));
return $qa_content;
}
示例9: 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"')));
}
示例10: 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"')));
}
示例11: 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"')));
}
示例12: 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"')));
}
示例13: admin_form
public function admin_form(&$qa_content)
{
// Process form input
$saved = false;
if (qa_clicked('event_logger_save_button')) {
qa_opt('event_logger_to_database', (int) qa_post_text('event_logger_to_database_field'));
qa_opt('event_logger_to_files', qa_post_text('event_logger_to_files_field'));
qa_opt('event_logger_directory', qa_post_text('event_logger_directory_field'));
qa_opt('event_logger_hide_header', !qa_post_text('event_logger_hide_header_field'));
$saved = true;
}
// Check the validity of the currently entered directory (if any)
$directory = qa_opt('event_logger_directory');
$note = null;
$error = null;
if (!strlen($directory)) {
$note = 'Please specify a directory that is writable by the web server.';
} elseif (!file_exists($directory)) {
$error = 'This directory cannot be found. Please enter the full path.';
} elseif (!is_dir($directory)) {
$error = 'This is a file. Please enter the full path of a directory.';
} elseif (!is_writable($directory)) {
$error = 'This directory is not writable by the web server. Please choose a different directory, use chown/chmod to change permissions, or contact your web hosting company for assistance.';
}
// Create the form for display
qa_set_display_rules($qa_content, array('event_logger_directory_display' => 'event_logger_to_files_field', 'event_logger_hide_header_display' => 'event_logger_to_files_field'));
return array('ok' => $saved && !isset($error) ? 'Event log settings saved' : null, 'fields' => array(array('label' => 'Log events to <code>' . QA_MYSQL_TABLE_PREFIX . 'eventlog</code> database table', 'tags' => 'name="event_logger_to_database_field"', 'value' => qa_opt('event_logger_to_database'), 'type' => 'checkbox'), array('label' => 'Log events to daily log files', 'tags' => 'name="event_logger_to_files_field" id="event_logger_to_files_field"', 'value' => qa_opt('event_logger_to_files'), 'type' => 'checkbox'), array('id' => 'event_logger_directory_display', 'label' => 'Directory for log files - enter full path:', 'value' => qa_html($directory), 'tags' => 'name="event_logger_directory_field"', 'note' => $note, 'error' => qa_html($error)), array('id' => 'event_logger_hide_header_display', 'label' => 'Include header lines at top of each log file', 'type' => 'checkbox', 'tags' => 'name="event_logger_hide_header_field"', 'value' => !qa_opt('event_logger_hide_header'))), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'name="event_logger_save_button"')));
}
示例14: 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"')));
}
示例15: 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"')));
}