本文整理汇总了PHP中qa_set_display_rules函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_set_display_rules函数的具体用法?PHP qa_set_display_rules怎么用?PHP qa_set_display_rules使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_set_display_rules函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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"')));
}
示例2: 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"')));
}
示例3: 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"')));
}
示例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)
{
$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());
}
示例6: 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"')));
}
示例7: admin_form
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"')));
}
示例8: admin_form
function admin_form(&$qa_content)
{
$saved = false;
if (qa_clicked('mouseover_save_button')) {
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'));
$saved = true;
}
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 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 number of characters to show:', '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"')));
}
示例9: admin_form
function admin_form(&$qa_content)
{
// load styles
$real_plugin_path = $this->directory;
$s_path = $real_plugin_path . 'styles';
if (is_dir($s_path) == false) {
//in case it could not read directory content try this to get absolute & real path of directories
$site_path = getcwd();
$path = $real_plugin_path;
$path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
$absolutes = array();
foreach ($parts as $part) {
if ('.' == $part) {
continue;
}
if ('..' == $part) {
array_pop($absolutes);
} else {
$absolutes[] = $part;
}
}
$plugin_path = implode(DIRECTORY_SEPARATOR, $absolutes);
$real_plugin_path = $site_path . '/' . $plugin_path;
$s_path = $real_plugin_path . '/styles';
}
// List of styles
$styles = array();
$files = scandir($s_path, 1);
$styles[] = "NO Costume Style";
foreach ($files as $file) {
if (!(empty($file) or $file == '.' or $file == '..')) {
$styles[] = preg_replace("/\\.[^.]*\$/", "", $file);
}
}
$saved = false;
if (qa_clicked('tw_save_button')) {
qa_opt('tw_custom_css', $styles[(int) qa_post_text('tw_custom_css')]);
qa_opt('tw_custom_css_index', (int) qa_post_text('tw_custom_css'));
qa_opt('tw_thumbnail_enable', (int) qa_post_text('tw_thumbnail_enable'));
qa_opt('tw_thumbnail', qa_post_text('tw_thumbnail'));
qa_opt('tw_popular_number', (int) qa_post_text('tw_popular_number'));
qa_opt('tw_recent_number', (int) qa_post_text('tw_recent_number'));
qa_opt('tw_recent_lable', qa_post_text('tw_recent_lable'));
qa_opt('tw_popular_lable', qa_post_text('tw_popular_lable'));
qa_opt('tw_ads', qa_post_text('tw_ads_field'));
qa_opt('tw_ads_pos', (int) qa_post_text('tw_ads_pos_field'));
$saved = true;
}
qa_set_display_rules($qa_content, array('tw_thumbnail' => 'tw_thumbnail_enable'));
return array('ok' => $saved ? 'Tag cloud settings saved' : null, 'fields' => array(array('label' => 'CSS Styles', 'tags' => 'NAME="tw_custom_css" ID="tw_custom_css"', 'type' => 'select', 'options' => @$styles, 'value' => @$styles[qa_opt('tw_custom_css_index')]), array('label' => 'Enable thumbnail image', 'type' => 'checkbox', 'value' => qa_opt('tw_thumbnail_enable'), 'tags' => 'NAME="tw_thumbnail_enable" ID="tw_thumbnail_enable"', 'note' => 'read first image inside question content and show it as thumbnail image'), array('label' => 'Default thumbnail image URL', 'value' => qa_opt('tw_thumbnail'), 'tags' => 'NAME="tw_thumbnail" ID="tw_thumbnail"', 'suffix' => 'leave empty to load no thumbnails', 'id' => 'tw_thumbnail', 'tags' => 'name="tw_thumbnail"'), array('label' => 'Lable of popular questions:', 'value' => qa_opt('tw_popular_lable'), 'tags' => 'NAME="tw_popular_lable" ID="tw_popular_lable"'), array('label' => 'Number of popular questions:', 'type' => 'number', 'value' => (int) qa_opt('tw_popular_number'), 'suffix' => 'tags', 'tags' => 'name="tw_popular_number"'), array('label' => 'Lable of recent questions:', 'value' => qa_opt('tw_recent_lable'), 'tags' => 'NAME="tw_recent_lable" ID="tw_recent_lable"'), array('label' => 'Number of recent questions:', 'type' => 'number', 'value' => (int) qa_opt('tw_recent_number'), 'tags' => 'name="tw_recent_number"'), array('label' => 'Advertisment box', 'type' => 'textbox', 'value' => qa_opt('tw_ads'), 'tags' => 'NAME="tw_ads_field" ID="tw_ads_field"', 'suffix' => 'HTML is supported', 'rows' => 3), array('label' => 'Advertisment position', 'value' => qa_opt('tw_ads_pos'), 'tags' => 'NAME="tw_ads_pos_field" ID="tw_ads_pos_field"', 'suffix' => 'Show Advertisment box after this number of questions')), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'name="tw_save_button"')));
}
示例10: admin_form
function admin_form(&$qa_content)
{
require_once QA_INCLUDE_DIR . 'qa-app-upload.php';
$saved = false;
if (qa_clicked('wysiwyg_editor_save_button')) {
qa_opt('wysiwyg_editor_upload_images', (int) qa_post_text('wysiwyg_editor_upload_images_field'));
qa_opt('wysiwyg_editor_upload_all', (int) qa_post_text('wysiwyg_editor_upload_all_field'));
qa_opt('wysiwyg_editor_upload_max_size', min(qa_get_max_upload_size(), 1048576 * (double) qa_post_text('wysiwyg_editor_upload_max_size_field')));
$saved = true;
}
qa_set_display_rules($qa_content, array('wysiwyg_editor_upload_all_display' => 'wysiwyg_editor_upload_images_field', 'wysiwyg_editor_upload_max_size_display' => 'wysiwyg_editor_upload_images_field'));
return array('ok' => $saved ? 'WYSIWYG editor settings saved' : null, 'fields' => array(array('label' => 'Allow images to be uploaded', 'type' => 'checkbox', 'value' => (int) qa_opt('wysiwyg_editor_upload_images'), 'tags' => 'name="wysiwyg_editor_upload_images_field" id="wysiwyg_editor_upload_images_field"'), array('id' => 'wysiwyg_editor_upload_all_display', 'label' => 'Allow other content to be uploaded, e.g. Flash, PDF', 'type' => 'checkbox', 'value' => (int) qa_opt('wysiwyg_editor_upload_all'), 'tags' => 'name="wysiwyg_editor_upload_all_field"'), array('id' => 'wysiwyg_editor_upload_max_size_display', 'label' => 'Maximum size of uploads:', 'suffix' => 'MB (max ' . $this->bytes_to_mega_html(qa_get_max_upload_size()) . ')', 'type' => 'number', 'value' => $this->bytes_to_mega_html(qa_opt('wysiwyg_editor_upload_max_size')), 'tags' => 'name="wysiwyg_editor_upload_max_size_field"')), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'name="wysiwyg_editor_save_button"')));
}
示例11: admin_form
public function admin_form(&$qa_content)
{
require_once QA_INCLUDE_DIR . 'app/upload.php';
$saved = false;
if (qa_clicked('wysiwyg_editor_save_button')) {
qa_opt('wysiwyg_editor_upload_images', (int) qa_post_text('wysiwyg_editor_upload_images_field'));
qa_opt('wysiwyg_editor_upload_all', (int) qa_post_text('wysiwyg_editor_upload_all_field'));
qa_opt('wysiwyg_editor_upload_max_size', min(qa_get_max_upload_size(), 1048576 * (double) qa_post_text('wysiwyg_editor_upload_max_size_field')));
$saved = true;
}
qa_set_display_rules($qa_content, array('wysiwyg_editor_upload_all_display' => 'wysiwyg_editor_upload_images_field', 'wysiwyg_editor_upload_max_size_display' => 'wysiwyg_editor_upload_images_field'));
// handle AJAX requests to 'wysiwyg-editor-ajax'
$js = array('function wysiwyg_editor_ajax(totalEdited) {', ' $.ajax({', ' url: ' . qa_js(qa_path('wysiwyg-editor-ajax')) . ',', ' success: function(response) {', ' var postsEdited = parseInt(response, 10);', ' var $btn = $("#wysiwyg_editor_ajax");', ' if (isNaN(postsEdited)) {', ' $btn.text("ERROR");', ' }', ' else if (postsEdited < 5) {', ' $btn.text("All posts converted.");', ' }', ' else {', ' totalEdited += postsEdited;', ' $btn.text("Updating posts... " + totalEdited)', ' window.setTimeout(function() {', ' wysiwyg_editor_ajax(totalEdited);', ' }, 1000);', ' }', ' }', ' });', '}', '$("#wysiwyg_editor_ajax").click(function() {', ' wysiwyg_editor_ajax(0);', ' return false;', '});');
$ajaxHtml = 'Update broken images from old CKeditor Smiley plugin: ' . '<button id="wysiwyg_editor_ajax">click here</button> ' . '<script>' . implode("\n", $js) . '</script>';
return array('ok' => $saved ? 'WYSIWYG editor settings saved' : null, 'fields' => array(array('label' => 'Allow images to be uploaded', 'type' => 'checkbox', 'value' => (int) qa_opt('wysiwyg_editor_upload_images'), 'tags' => 'name="wysiwyg_editor_upload_images_field" id="wysiwyg_editor_upload_images_field"'), array('id' => 'wysiwyg_editor_upload_all_display', 'label' => 'Allow other content to be uploaded, e.g. Flash, PDF', 'type' => 'checkbox', 'value' => (int) qa_opt('wysiwyg_editor_upload_all'), 'tags' => 'name="wysiwyg_editor_upload_all_field"'), array('id' => 'wysiwyg_editor_upload_max_size_display', 'label' => 'Maximum size of uploads:', 'suffix' => 'MB (max ' . $this->bytes_to_mega_html(qa_get_max_upload_size()) . ')', 'type' => 'number', 'value' => $this->bytes_to_mega_html(qa_opt('wysiwyg_editor_upload_max_size')), 'tags' => 'name="wysiwyg_editor_upload_max_size_field"'), array('type' => 'custom', 'html' => $ajaxHtml)), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'name="wysiwyg_editor_save_button"')));
}
示例12: admin_form
function admin_form(&$qa_content)
{
// Process form input
$ok = null;
if (qa_clicked('embed_save')) {
qa_opt('embed_enable', (bool) qa_post_text('embed_enable'));
qa_opt('embed_video_width', qa_post_text('embed_video_width'));
qa_opt('embed_video_height', qa_post_text('embed_video_height'));
qa_opt('embed_enable_img', (bool) qa_post_text('embed_enable_img'));
qa_opt('embed_image_width', qa_post_text('embed_image_width'));
qa_opt('embed_image_height', qa_post_text('embed_image_height'));
qa_opt('embed_enable_thickbox', (bool) qa_post_text('embed_enable_thickbox'));
qa_opt('embed_enable_mp3', (bool) qa_post_text('embed_enable_mp3'));
qa_opt('embed_enable_gmap', (bool) qa_post_text('embed_enable_gmap'));
qa_opt('embed_mp3_player_code', qa_post_text('embed_mp3_player_code'));
$ok = qa_lang('admin/options_saved');
} else {
if (qa_clicked('embed_reset')) {
foreach ($_POST as $i => $v) {
$def = $this->option_default($i);
if ($def !== null) {
qa_opt($i, $def);
}
}
$ok = qa_lang('admin/options_reset');
}
}
qa_set_display_rules($qa_content, array('embed_video_height' => 'embed_enable', 'embed_video_width' => 'embed_enable'));
// Create the form for display
$fields = array();
$fields[] = array('label' => 'Enable video embedding', 'tags' => 'NAME="embed_enable"', 'value' => qa_opt('embed_enable'), 'type' => 'checkbox');
$fields[] = array('label' => 'Embeded video width', 'type' => 'number', 'value' => qa_opt('embed_video_width'), 'tags' => 'NAME="embed_video_width"');
$fields[] = array('label' => 'Embeded video height', 'type' => 'number', 'value' => qa_opt('embed_video_height'), 'tags' => 'NAME="embed_video_height"');
$fields[] = array('type' => 'blank');
$fields[] = array('label' => 'Enable image embedding', 'tags' => 'NAME="embed_enable_img"', 'value' => qa_opt('embed_enable_img'), 'type' => 'checkbox');
$fields[] = array('label' => 'Image width', 'type' => 'number', 'value' => qa_opt('embed_image_width'), 'tags' => 'NAME="embed_image_width"');
$fields[] = array('label' => 'Image height', 'type' => 'number', 'value' => qa_opt('embed_image_height'), 'tags' => 'NAME="embed_image_height"');
$fields[] = array('label' => 'Enable thickbox image effect', 'tags' => 'NAME="embed_enable_thickbox"', 'value' => qa_opt('embed_enable_thickbox'), 'type' => 'checkbox');
$fields[] = array('type' => 'blank');
$fields[] = array('label' => 'Enable mp3 embedding', 'tags' => 'NAME="embed_enable_mp3"', 'value' => qa_opt('embed_enable_mp3'), 'type' => 'checkbox');
$fields[] = array('label' => 'mp3 flash player code', 'tags' => 'NAME="embed_mp3_player_code"', 'value' => qa_opt('embed_mp3_player_code'), 'type' => 'textarea', 'rows' => '5');
$fields[] = array('type' => 'blank');
$fields[] = array('label' => 'Enable Google maps embedding', 'tags' => 'NAME="embed_enable_gmap"', 'value' => qa_opt('embed_enable_gmap'), 'type' => 'checkbox');
$fields[] = array('label' => 'Map width', 'type' => 'number', 'value' => qa_opt('embed_gmap_width'), 'tags' => 'NAME="embed_gmap_width"');
$fields[] = array('label' => 'Map height', 'type' => 'number', 'value' => qa_opt('embed_gmap_height'), 'tags' => 'NAME="embed_gmap_height"');
return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="embed_save"'), array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="embed_reset"')));
}
示例13: doctype
function doctype()
{
if ($this->request == 'admin/permissions' && qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) {
$permits[] = 'signature_allow';
$permits[] = 'signature_edit_allow';
foreach ($permits as $optionname) {
$value = qa_opt($optionname);
$optionfield = array('id' => $optionname, 'label' => qa_lang_html('signature_plugin/' . $optionname) . ':', 'tags' => 'NAME="option_' . $optionname . '" ID="option_' . $optionname . '"', 'value' => $value, 'error' => qa_html(@$errors[$optionname]));
$widest = QA_PERMIT_USERS;
$narrowest = QA_PERMIT_ADMINS;
$permitoptions = qa_admin_permit_options($widest, $narrowest, !QA_FINAL_EXTERNAL_USERS && qa_opt('confirm_user_emails'));
if (count($permitoptions) > 1) {
qa_optionfield_make_select($optionfield, $permitoptions, $value, $value == QA_PERMIT_CONFIRMED ? QA_PERMIT_USERS : min(array_keys($permitoptions)));
}
$this->content['form']['fields'][$optionname] = $optionfield;
$this->content['form']['fields'][$optionname . '_points'] = array('id' => $optionname . '_points', 'tags' => 'NAME="option_' . $optionname . '_points" ID="option_' . $optionname . '_points"', 'type' => 'number', 'value' => qa_opt($optionname . '_points'), 'prefix' => qa_lang_html('admin/users_must_have') . ' ', 'note' => qa_lang_html('admin/points'));
$checkboxtodisplay[$optionname . '_points'] = '(option_' . $optionname . '==' . qa_js(QA_PERMIT_POINTS) . ') ||(option_' . $optionname . '==' . qa_js(QA_PERMIT_POINTS_CONFIRMED) . ')';
}
qa_set_display_rules($this->content, $checkboxtodisplay);
}
if (qa_opt('signatures_enable')) {
// add user signature
if ($this->template == 'user' && isset($this->content['form_activity']) && !qa_get('tab')) {
$sig_form = $this->content['user_signature_form'];
// from overrides
// insert our form
if (isset($this->content['q_list'])) {
// array splicing kungfu thanks to Stack Exchange
// This adds form-signature before q_list
$keys = array_keys($this->content);
$vals = array_values($this->content);
$insertBefore = array_search('q_list', $keys);
$keys2 = array_splice($keys, $insertBefore);
$vals2 = array_splice($vals, $insertBefore);
$keys[] = 'form-signature';
$vals[] = $sig_form;
$this->content = array_merge(array_combine($keys, $vals), array_combine($keys2, $vals2));
} else {
$this->content['form-signature'] = $sig_form;
}
}
}
qa_html_theme_base::doctype();
}
示例14: admin_form
function admin_form(&$qa_content)
{
$saved = false;
$error = '';
if (qa_clicked(self::SAVE_BUTTON)) {
if (qa_post_text(self::ENABLE . '_field')) {
if (trim(qa_post_text(self::REQUEST . '_field')) == '') {
$error = qa_lang_html(self::PLUGIN . '/' . self::REQUEST . '_error');
}
}
if ($error == '') {
qa_opt(self::ENABLE, (bool) qa_post_text(self::ENABLE . '_field'));
qa_opt(self::REQUEST, qa_post_text(self::REQUEST . '_field'));
$saved = true;
}
}
if (qa_clicked(self::DFL_BUTTON)) {
qa_opt(self::ENABLE, self::ENABLE_DFL);
qa_opt(self::REQUEST, self::REQUEST_DFL);
$saved = true;
}
$rules = array();
$rules[self::REQUEST] = self::ENABLE . '_field';
qa_set_display_rules($qa_content, $rules);
$ret = array();
if ($saved) {
$ret['ok'] = qa_lang_html(self::PLUGIN . '/' . self::SAVED_MESSAGE);
} else {
if ($error != '') {
$ret['ok'] = '<SPAN STYLE="color:#F00;">' . $error . '</SPAN>';
}
}
$fields = array();
$fields[] = array('id' => self::ENABLE, 'label' => qa_lang_html(self::PLUGIN . '/' . self::ENABLE . '_label'), 'type' => 'checkbox', 'value' => qa_opt(self::ENABLE), 'tags' => 'NAME="' . self::ENABLE . '_field" ID="' . self::ENABLE . '_field"');
$fields[] = array('id' => self::REQUEST, 'label' => qa_lang_html(self::PLUGIN . '/' . self::REQUEST . '_label'), 'value' => qa_opt(self::REQUEST), 'tags' => 'NAME="' . self::REQUEST . '_field" ID="' . self::REQUEST . '_field"');
$ret['fields'] = $fields;
$buttons = array();
$buttons[] = array('label' => qa_lang_html(self::PLUGIN . '/' . self::SAVE_BUTTON), 'tags' => 'NAME="' . self::SAVE_BUTTON . '" ID="' . self::SAVE_BUTTON . '"');
$buttons[] = array('label' => qa_lang_html(self::PLUGIN . '/' . self::DFL_BUTTON), 'tags' => 'NAME="' . self::DFL_BUTTON . '" ID="' . self::DFL_BUTTON . '"');
$ret['buttons'] = $buttons;
return $ret;
}
示例15: admin_form
function admin_form(&$qa_content)
{
$saved = false;
if (qa_clicked('tos_save_button')) {
qa_opt('tos_enable', (int) qa_post_text('tos_enable'));
qa_opt('tos_checkbox_label', qa_post_text('tos_checkbox_label'));
qa_opt('tos_error', qa_post_text('tos_error'));
qa_opt('tos_content', qa_post_text('tos_content'));
qa_opt('tos_serverside', (int) qa_post_text('tos_serverside'));
$saved = true;
}
qa_set_display_rules($qa_content, array('tos_checkbox_label' => 'tos_enable', 'tos_content' => 'tos_enable', 'tos_serverside' => 'tos_enable', 'tos_static' => 'tos_enable', 'tos_error' => 'tos_enable'));
qa_set_display_rules($qa_content, array('tos_static' => 'tos_serverside'));
if (qa_opt('tos_serverside')) {
$warning = 'Warning: activating This option overrides PHP file responsible for handling registration page. it\'s tested with Q2A 1.6 but might not work on other versions.';
} else {
$warning = '';
}
return array('ok' => $saved ? 'TOS settings saved' : null, 'fields' => array(array('label' => 'Enable Terms of Service on registration form', 'type' => 'checkbox', 'value' => qa_opt('tos_enable'), 'tags' => 'name="tos_enable" id="tos_enable"'), array('id' => 'tos_checkbox_label', 'label' => 'Terms of Service checkbox label:', 'type' => 'textarea', 'rows' => '2', 'suffix' => 'HTML is enabled, so you can add a link to TOS in this field', 'value' => qa_opt('tos_checkbox_label'), 'tags' => 'name="tos_checkbox_label"'), array('id' => 'tos_error', 'label' => 'Error Message if validation fails', 'value' => qa_opt('tos_error'), 'tags' => 'name="tos_error"'), array('id' => 'tos_content', 'label' => 'Terms of Service content', 'suffix' => 'you can leave this empty, so textbox with content of Terms of Service won\'t show up.', 'type' => 'textarea', 'rows' => '6', 'value' => qa_opt('tos_content'), 'tags' => 'name="tos_content"'), array('id' => 'tos_serverside', 'label' => 'Check validation in server side instead of using JavaScript', 'type' => 'checkbox', 'value' => qa_opt('tos_serverside'), 'tags' => 'name="tos_serverside"', 'error' => $warning)), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'name="tos_save_button"')));
}