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"'))); }
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"'))); }
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()); }
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 . '"'))); }
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"'))); }
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"'))); }
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; }
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; }
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"'))); }
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"'))); }
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"'))); }
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"'))); }
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"'))); }
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"'))); }
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"'))); }
function theme_switch_form() { // displays signature form in user profile global $qa_request; $handle = preg_replace('/^[^\\/]+\\/([^\\/]+).*/', "\$1", $qa_request); $userid = $this->getuserfromhandle($handle); if (!$userid) { return; } if (qa_get_logged_in_handle() && qa_get_logged_in_handle() == $handle) { if (qa_clicked('theme_switch_save')) { qa_db_query_sub('INSERT INTO ^usermeta (user_id,meta_key,meta_value) VALUES (#,$,$) ON DUPLICATE KEY UPDATE meta_value=$', $userid, 'custom_theme', qa_post_text('theme_choice'), qa_post_text('theme_choice')); qa_redirect($this->request, array('ok' => qa_lang_html('admin/options_saved'))); } else { if (qa_clicked('theme_switch_user_reset')) { qa_db_query_sub('DELETE FROM ^usermeta WHERE user_id=# AND meta_key=$', $userid, 'custom_theme'); qa_redirect($this->request, array('ok' => qa_lang_html('admin/options_reset'))); } } require_once QA_INCLUDE_DIR . 'qa-app-admin.php'; $ok = qa_get('ok') ? qa_get('ok') : null; $theme_choice = qa_db_read_one_value(qa_db_query_sub('SELECT meta_value FROM ^usermeta WHERE user_id=# AND meta_key=$', $userid, 'custom_theme'), true); $themes = qa_admin_theme_options(); $fields['themes'] = array('label' => qa_opt('theme_switch_text'), 'tags' => 'NAME="theme_choice"', 'type' => 'select', 'options' => qa_admin_theme_options(), 'value' => @$themes[$theme_choice]); $form = array('ok' => $ok && !isset($error) ? $ok : null, 'style' => 'tall', 'title' => '<a name="theme_text"></a>' . qa_opt('theme_switch_title'), 'tags' => 'action="' . qa_self_html() . '#theme_text" method="POST"', 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="theme_switch_user_reset"'), array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="theme_switch_save"'))); return $form; } }
function html() { if (isset($_POST['ajax_bookmark_qid'])) { $this->ajaxBookmark(qa_post_text('ajax_bookmark_qid'), qa_post_text('ajax_bookmark_uid'), qa_post_text('ajax_bookmarked')); } else { qa_html_theme_base::html(); } }
function admin_form() { $saved = false; if (qa_clicked('related_qs_save_button')) { qa_opt('related_qs_num', (int) qa_post_text('related_qs_num_field')); $saved = true; } return array('ok' => $saved ? 'Related questions settings saved' : null, 'fields' => array(array('label' => 'Number of questions to show (max):', 'type' => 'number', 'value' => (int) qa_opt('related_qs_num'), 'tags' => 'NAME="related_qs_num_field"')), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'NAME="related_qs_save_button"'))); }
function process_request($request) { $qa_content = qa_content_prepare(); $qa_content['title'] = qa_lang_html('example_page/page_title'); $qa_content['error'] = 'An example error'; $qa_content['custom'] = 'Some <B>custom html</B>'; $qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'ok' => qa_post_text('okthen') ? 'You clicked OK then!' : null, 'title' => 'Form title', 'fields' => array('request' => array('label' => 'The request', 'tags' => 'NAME="request"', 'value' => qa_html($request), 'error' => qa_html('Another error'))), 'buttons' => array('ok' => array('tags' => 'NAME="okthen"', 'label' => 'OK then', 'value' => '1')), 'hidden' => array('hiddenfield' => '1')); $qa_content['custom_2'] = '<P><BR>More <I>custom html</I></P>'; return $qa_content; }
public function admin_form() { $saved = false; if (qa_clicked('nkconnect_save_button')) { qa_opt(Q2ANKConnect::NKCONNECT_SECRET, qa_post_text(self::FIELD_SECRET)); qa_opt(Q2ANKConnect::NKCONNECT_KEY, qa_post_text(self::FIELD_KEY)); $saved = true; } return array('ok' => $saved ? 'ustawienia nkConnect zapisane' : null, 'fields' => array(array('label' => 'nkConnect sekret:', 'value' => qa_html(qa_opt(Q2ANKConnect::NKCONNECT_SECRET)), 'tags' => 'NAME="' . self::FIELD_SECRET . '"'), array('label' => 'nkConnect klucz:', 'value' => qa_html(qa_opt(Q2ANKConnect::NKCONNECT_KEY)), 'tags' => 'NAME="' . self::FIELD_KEY . '"')), 'buttons' => array(array('label' => 'Zapisz zmiany', 'tags' => 'NAME="nkconnect_save_button"'))); }
function admin_form() { $saved = false; if (qa_clicked('google_analytics_save_button')) { qa_opt('google_analytics_UA', qa_post_text('google_analytics_UA_field')); qa_opt('google_analytics_show_for_admin', (bool) qa_post_text('google_analytics_show_for_admin_field')); $saved = true; } return array('ok' => $saved ? 'Google Analytics settings saved.' : null, 'fields' => array(array('label' => 'Enter Google UA id (should be like UA-xxxxxxx-x):', 'value' => qa_html(qa_opt('google_analytics_UA')), 'tags' => 'NAME="google_analytics_UA_field"'), array('label' => 'Check to exclude Super Admin visits from tracking.', 'type' => 'checkbox', 'value' => qa_opt('google_analytics_show_for_admin'), 'tags' => 'NAME="google_analytics_show_for_admin_field"')), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'NAME="google_analytics_save_button"'))); }
public function admin_form(&$qa_content) { $saved = qa_clicked('mouseover_save_button'); if ($saved) { qa_opt('mouseover_content_on', (int) qa_post_text('mouseover_content_on_field')); qa_opt('mouseover_content_max_len', (int) qa_post_text('mouseover_content_max_len_field')); } qa_set_display_rules($qa_content, array('mouseover_content_max_len_display' => 'mouseover_content_on_field')); return array('ok' => $saved ? 'Mouseover settings saved' : null, 'fields' => array(array('label' => 'Show content preview on mouseover in question lists', 'type' => 'checkbox', 'value' => qa_opt('mouseover_content_on'), 'tags' => 'name="mouseover_content_on_field" id="mouseover_content_on_field"'), array('id' => 'mouseover_content_max_len_display', 'label' => 'Maximum length of preview:', 'suffix' => 'characters', 'type' => 'number', 'value' => (int) qa_opt('mouseover_content_max_len'), 'tags' => 'name="mouseover_content_max_len_field"')), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'name="mouseover_save_button"'))); }
function admin_form(&$qa_content) { $saved = false; if (qa_clicked('email_formating_save_button')) { qa_opt('email_formating_overrule', (bool) qa_post_text('email_formating_overrule')); qa_opt('email_formating_body', qa_post_text('email_formating_body')); $saved = true; } return array('ok' => $saved ? 'Email formating settings saved' : null, 'fields' => array(array('label' => 'enable also for HTML based emails', 'type' => 'checkbox', 'value' => qa_opt('email_formating_overrule'), 'tags' => 'NAME="email_formating_overrule"'), array('label' => 'Body (^body and ^title will get value of plain text body and subject. ^site_title and ^site_url will be replaced with your site name and url, ^logo_url with the logo of your site) :', 'type' => 'text', 'rows' => '10', 'value' => qa_opt('email_formating_body'), 'tags' => 'NAME="email_formating_body"')), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'NAME="email_formating_save_button"'))); }
function process_request($request) { $qa_content = qa_content_prepare(); $qa_content['title'] = qa_lang_html('example_page/page_title'); $qa_content['error'] = 'An example error'; $qa_content['custom'] = 'Some <b>custom html</b>'; $qa_content['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'wide', 'ok' => qa_post_text('okthen') ? 'You clicked OK then!' : null, 'title' => 'Form title', 'fields' => array('request' => array('label' => 'The request', 'tags' => 'name="request"', 'value' => qa_html($request), 'error' => qa_html('Another error'))), 'buttons' => array('ok' => array('tags' => 'name="okthen"', 'label' => 'OK then', 'value' => '1')), 'hidden' => array('hiddenfield' => '1')); $qa_content['custom_2'] = '<p><br>More <i>custom html</i></p>'; return $qa_content; }
function admin_form(&$qa_content) { // Process form input $ok = null; if (qa_clicked('share_save_button')) { qa_opt('share_plugin_facebook', (bool) qa_post_text('share_plugin_facebook')); qa_opt('share_plugin_twitter', (bool) qa_post_text('share_plugin_twitter')); qa_opt('share_plugin_google', (bool) qa_post_text('share_plugin_google')); qa_opt('share_plugin_linkedin', (bool) qa_post_text('share_plugin_linkedin')); qa_opt('share_plugin_email', (bool) qa_post_text('share_plugin_email')); qa_opt('share_plugin_facebook_weight', (int) qa_post_text('share_plugin_facebook_weight')); qa_opt('share_plugin_twitter_weight', (int) qa_post_text('share_plugin_twitter_weight')); qa_opt('share_plugin_google_weight', (int) qa_post_text('share_plugin_google_weight')); qa_opt('share_plugin_linkedin_weight', (int) qa_post_text('share_plugin_linkedin_weight')); qa_opt('share_plugin_email_weight', (int) qa_post_text('share_plugin_email_weight')); qa_opt('share_plugin_css', qa_post_text('share_plugin_css')); qa_opt('share_plugin_widget_only', (bool) qa_post_text('share_plugin_widget_only')); qa_opt('share_plugin_widget_title', qa_post_text('share_plugin_widget_title')); qa_opt('share_plugin_suggest', (int) qa_post_text('share_plugin_suggest')); qa_opt('share_plugin_suggest_text', qa_post_text('share_plugin_suggest_text')); $ok = qa_lang('admin/options_saved'); } else { if (qa_clicked('share_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('label' => 'Show Facebook button', 'tags' => 'NAME="share_plugin_facebook"', 'value' => qa_opt('share_plugin_facebook'), 'type' => 'checkbox'); $fields[] = array('label' => 'Show Twitter button', 'tags' => 'NAME="share_plugin_twitter"', 'value' => qa_opt('share_plugin_twitter'), 'type' => 'checkbox'); $fields[] = array('label' => 'Show Google+ button', 'tags' => 'NAME="share_plugin_google"', 'value' => qa_opt('share_plugin_google'), 'type' => 'checkbox'); $fields[] = array('label' => 'Show LinkedIn button', 'tags' => 'NAME="share_plugin_linkedin"', 'value' => qa_opt('share_plugin_linkedin'), 'type' => 'checkbox'); $fields[] = array('label' => 'Show email button', 'tags' => 'NAME="share_plugin_email"', 'value' => qa_opt('share_plugin_email'), 'type' => 'checkbox'); $fields[] = array('type' => 'blank'); $fields[] = array('label' => 'Facebook button weight:', 'tags' => 'NAME="share_plugin_facebook_weight" title="smaller values come before larger values in the DOM"', 'value' => qa_opt('share_plugin_facebook_weight'), 'type' => 'number'); $fields[] = array('label' => 'Twitter button weight:', 'tags' => 'NAME="share_plugin_twitter_weight" title="smaller values come before larger values in the DOM"', 'value' => qa_opt('share_plugin_twitter_weight'), 'type' => 'number'); $fields[] = array('label' => 'Google+ button weight:', 'tags' => 'NAME="share_plugin_google_weight" title="smaller values come before larger values in the DOM"', 'value' => qa_opt('share_plugin_google_weight'), 'type' => 'number'); $fields[] = array('label' => 'LinkedIn button weight:', 'tags' => 'NAME="share_plugin_linkedin_weight" title="smaller values come before larger values in the DOM"', 'value' => qa_opt('share_plugin_linkedin_weight'), 'type' => 'number'); $fields[] = array('label' => 'Email button weight:', 'tags' => 'NAME="share_plugin_email_weight" title="smaller values come before larger values in the DOM"', 'value' => qa_opt('share_plugin_email_weight'), 'type' => 'number'); $fields[] = array('type' => 'blank'); $fields[] = array('label' => 'Share buttons custom css', 'tags' => 'NAME="share_plugin_css"', 'value' => qa_opt('share_plugin_css'), 'type' => 'textarea', 'rows' => 20); $fields[] = array('label' => 'Widget only', 'tags' => 'NAME="share_plugin_widget_only"', 'value' => qa_opt('share_plugin_widget_only'), 'type' => 'checkbox', 'note' => 'disables inline buttons - widget must be enabled via admin/layout'); $fields[] = array('label' => 'Widget Title', 'tags' => 'NAME="share_plugin_widget_title"', 'value' => qa_opt('share_plugin_widget_title')); $fields[] = array('type' => 'blank'); $fields[] = array('label' => 'Show notification text while there are still no answers to a question', 'tags' => 'NAME="share_plugin_suggest" onclick="if(this.checked) jQuery(\'#share_options_container\').fadeIn(); else jQuery(\'#share_options_container\').fadeOut();"', 'value' => qa_opt('share_plugin_suggest'), 'type' => 'checkbox', 'note' => '<table id="share_options_container" style="display:' . (qa_opt('share_plugin_suggest') ? 'block' : 'none') . '"><tr><td>'); $fields[] = array('tags' => 'NAME="share_plugin_suggest_text"', 'value' => qa_opt('share_plugin_suggest_text'), 'type' => 'text', 'note' => '<i style="font-size:10px;">(use <b>#</b> to specify button location)</i></td></tr></table>'); $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="share_save_button"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="share_reset_button"'))); }
function admin_form(&$qa_content) { $saved = false; if (qa_clicked('adsense_save_button')) { $trimchars = "=;\"\\' \t\r\n"; // prevent common errors by copying and pasting from Javascript qa_opt('adsense_publisher_id', trim(qa_post_text('adsense_publisher_id_field'), $trimchars)); $saved = true; } return array('ok' => $saved ? 'AdSense settings saved' : null, 'fields' => array(array('label' => 'AdSense Publisher ID:', 'value' => qa_html(qa_opt('adsense_publisher_id')), 'tags' => 'name="adsense_publisher_id_field"', 'note' => 'Example: <i>pub-1234567890123456</i>')), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'name="adsense_save_button"'))); }
function admin_form() { $saved_msg = null; if (qa_clicked('user_activity_save')) { // save options $hidecss = qa_post_text('ua_hidecss') ? '1' : '0'; qa_opt($this->cssopt, $hidecss); $saved_msg = 'Options saved.'; } return array('ok' => $saved_msg, 'style' => 'wide', 'fields' => array('css' => array('type' => 'checkbox', 'label' => 'Don\'t add CSS inline', 'tags' => 'NAME="ua_hidecss"', 'value' => qa_opt($this->cssopt) === '1', 'note' => 'Tick if you added the CSS to your own stylesheet (more efficient).')), 'buttons' => array('save' => array('tags' => 'NAME="user_activity_save"', 'label' => 'Save options', 'value' => '1'))); }
function admin_form(&$qa_content) { // Prepare errors $pagelength_error = ''; // Process form input $ok = null; if (qa_clicked('qa_eql_save')) { // Save options qa_opt('qa_eql_enabled', (bool) qa_post_text('qa_eql_enabled')); qa_opt('qa_eql_homepage', (bool) qa_post_text('qa_eql_homepage')); qa_opt('qa_eql_button', (bool) qa_post_text('qa_eql_button')); qa_opt('qa_eql_include', (bool) qa_post_text('qa_eql_include')); qa_opt('qa_homepage_url', qa_post_text('qa_homepage_url')); qa_opt('qa_homepage_separate', (bool) qa_post_text('qa_homepage_separate')); $ok = qa_lang('admin/options_saved'); } else { if (qa_clicked('qa_eql_reset')) { // Reset options qa_opt('qa_eql_enabled', $this->option_default('qa_eql_enabled')); qa_opt('qa_eql_homepage', $this->option_default('qa_eql_homepage')); qa_opt('qa_eql_button', $this->option_default('qa_eql_button')); qa_opt('qa_eql_include', $this->option_default('qa_eql_include')); qa_opt('qa_homepage_url', $this->option_default('qa_homepage_url')); qa_opt('qa_homepage_separate', $this->option_default('qa_homepage_separate')); $ok = qa_lang('admin/options_reset'); } } // Sync database (if admin wants so or if it is appropriate given the new settings) if (qa_clicked('qa_eql_calchomepage')) { $this->sync(); $ok = 'Database sync\'d!'; } // Create the form for display $fields = array(); $fields[] = array('label' => 'Make question links expandable', 'tags' => 'name="qa_eql_enabled" onchange="if (this.checked) $(\'.eql-checks\').show();else $(\'.eql-checks\').hide();"', 'value' => qa_opt('qa_eql_enabled'), 'type' => 'checkbox'); $fields[] = array('type' => 'custom', 'label' => '<span class="qa-form-tall-label eql-checks"' . (qa_opt('qa_eql_enabled') ? '' : ' style="display:none;"') . '> <h3>Additional options</h3> <label><input name="qa_eql_include" type="checkbox" class="qa-form-tall-checkbox"' . (qa_opt('qa_eql_include') ? ' checked=""' : '') . '>Include jquery.ias.min.js</label> <small>(Uncheck this if you already use Infinite AJAX Scroll on this website).</small> <br><br><br> <label><input name="qa_eql_homepage" type="checkbox" onchange="if (this.checked) $(\'.eql-hchecks\').show();else $(\'.eql-hchecks\').hide();" class="qa-form-tall-checkbox"' . (qa_opt('qa_eql_homepage') ? ' checked=""' : '') . '>Make the homepage expandable too</label> <br><br> <span class="qa-form-tall-label eql-hchecks"' . (qa_opt('qa_eql_enabled') && qa_opt('qa_eql_homepage') ? '' : ' style="display:none;"') . '> <h3>Homepage options</h3> <small>Use the button below to keep the homepage in sync (this may take a while on large fora). If this is the first time you make the homepage expandable, you\'ll have to sync first.</small><br><br> <label><input name="qa_homepage_separate" type="checkbox" class="qa-form-tall-checkbox"' . (qa_opt('qa_homepage_separate') ? ' checked=""' : '') . '>Use a custom homepage</label> <br><br> Custom homepage URL : <input name="qa_homepage_url" type="text" class="qa-form-tall-text" value="' . qa_opt('qa_homepage_url') . '" onclick="this.select();"> </span> </span>'); return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => 'Save', 'tags' => 'NAME="qa_eql_save"'), array('label' => 'Sync homepage', 'tags' => 'NAME="qa_eql_calchomepage"'), array('label' => 'Reset', 'tags' => 'NAME="qa_eql_reset"'))); }
function admin_form() { $saved = false; if (qa_clicked('recaptcha_save_button')) { qa_opt('recaptcha_public_key', qa_post_text('recaptcha_public_key_field')); qa_opt('recaptcha_private_key', qa_post_text('recaptcha_private_key_field')); $saved = true; } $form = array('ok' => $saved ? 'reCAPTCHA settings saved' : null, 'fields' => array('public' => array('label' => 'reCAPTCHA public key:', 'value' => qa_opt('recaptcha_public_key'), 'tags' => 'name="recaptcha_public_key_field"'), 'private' => array('label' => 'reCAPTCHA private key:', 'value' => qa_opt('recaptcha_private_key'), 'tags' => 'name="recaptcha_private_key_field"', 'error' => $this->recaptcha_error_html())), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'name="recaptcha_save_button"'))); return $form; }
function admin_form() { $saved = false; if (qa_clicked('tag_cloud_save_button')) { qa_opt('tag_cloud_count_tags', (int) qa_post_text('tag_cloud_count_tags_field')); qa_opt('tag_cloud_font_size', (int) qa_post_text('tag_cloud_font_size_field')); qa_opt('tag_cloud_size_popular', (int) qa_post_text('tag_cloud_size_popular_field')); $saved = true; } return array('ok' => $saved ? 'Tag cloud settings saved' : null, 'fields' => array(array('label' => 'Maximum tags to show:', 'type' => 'number', 'value' => (int) qa_opt('tag_cloud_count_tags'), 'suffix' => 'tags', 'tags' => 'name="tag_cloud_count_tags_field"'), array('label' => 'Starting font size:', 'suffix' => 'pixels', 'type' => 'number', 'value' => (int) qa_opt('tag_cloud_font_size'), 'tags' => 'name="tag_cloud_font_size_field"'), array('label' => 'Font size represents tag popularity', 'type' => 'checkbox', 'value' => qa_opt('tag_cloud_size_popular'), 'tags' => 'name="tag_cloud_size_popular_field"')), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'name="tag_cloud_save_button"'))); }