本文整理汇总了PHP中phpbb\request\request::is_set方法的典型用法代码示例。如果您正苦于以下问题:PHP request::is_set方法的具体用法?PHP request::is_set怎么用?PHP request::is_set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\request\request
的用法示例。
在下文中一共展示了request::is_set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: viewtopic_modify_data
/**
* Show bbcodes and smilies in the quickreply
* Template data for Ajax submit
*
* @param object $event The event object
* @return null
* @access public
*/
public function viewtopic_modify_data($event)
{
$forum_id = $event['forum_id'];
$topic_data = $event['topic_data'];
$post_list = $event['post_list'];
$topic_id = $topic_data['topic_id'];
$s_quick_reply = false;
if (($this->user->data['is_registered'] || $this->config['qr_allow_for_guests']) && $this->config['allow_quick_reply'] && $topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY && $this->auth->acl_get('f_reply', $forum_id)) {
// Quick reply enabled forum
$s_quick_reply = $topic_data['forum_status'] == ITEM_UNLOCKED && $topic_data['topic_status'] == ITEM_UNLOCKED || $this->auth->acl_get('m_edit', $forum_id) ? true : false;
}
if (!$this->user->data['is_registered'] && $s_quick_reply) {
add_form_key('posting');
$s_attach_sig = $this->config['allow_sig'] && $this->user->optionget('attachsig') && $this->auth->acl_get('f_sigs', $forum_id) && $this->auth->acl_get('u_sig');
$s_smilies = $this->config['allow_smilies'] && $this->user->optionget('smilies') && $this->auth->acl_get('f_smilies', $forum_id);
$s_bbcode = $this->config['allow_bbcode'] && $this->user->optionget('bbcode') && $this->auth->acl_get('f_bbcode', $forum_id);
$s_notify = false;
$qr_hidden_fields = array('topic_cur_post_id' => (int) $topic_data['topic_last_post_id'], 'lastclick' => (int) time(), 'topic_id' => (int) $topic_data['topic_id'], 'forum_id' => (int) $forum_id);
// Originally we use checkboxes and check with isset(), so we only provide them if they would be checked
!$s_bbcode ? $qr_hidden_fields['disable_bbcode'] = 1 : true;
!$s_smilies ? $qr_hidden_fields['disable_smilies'] = 1 : true;
!$this->config['allow_post_links'] ? $qr_hidden_fields['disable_magic_url'] = 1 : true;
$s_attach_sig ? $qr_hidden_fields['attach_sig'] = 1 : true;
$s_notify ? $qr_hidden_fields['notify'] = 1 : true;
$topic_data['topic_status'] == ITEM_LOCKED ? $qr_hidden_fields['lock_topic'] = 1 : true;
$this->template->assign_vars(array('S_QUICK_REPLY' => true, 'U_QR_ACTION' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&f={$forum_id}&t={$topic_id}"), 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), 'USERNAME' => $this->request->variable('username', '', true)));
if ($this->config['enable_post_confirm']) {
$captcha = $this->captcha->get_instance($this->config['captcha_plugin']);
$captcha->init(CONFIRM_POST);
}
if ($this->config['enable_post_confirm'] && (isset($captcha) && $captcha->is_solved() === false)) {
$this->template->assign_vars(array('S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $captcha->get_template()));
}
// Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
if (isset($captcha) && $captcha->is_solved() !== false) {
$this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields()));
}
}
// Ajaxify viewtopic data
if ($this->request->is_ajax() && $this->request->is_set('qr_request')) {
if (!$this->user->data['is_registered'] && $this->config['enable_post_confirm']) {
$captcha = $this->captcha->get_instance($this->config['captcha_plugin']);
$captcha->init(CONFIRM_POST);
// Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
if (isset($captcha) && $captcha->is_solved() !== false) {
$this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields()));
}
}
// Fix issues if the inserted post is not the first.
if ($this->qr_insert && !$this->qr_first) {
$this->template->alter_block_array('postrow', array('S_FIRST_ROW' => false), false, 'change');
}
$page_title = $event['page_title'];
$this->template->assign_vars(array('S_QUICKREPLY_REQUEST' => true, 'S_QR_NO_FIRST_POST' => $this->qr_insert, 'S_QR_FULL_QUOTE' => $this->config['qr_full_quote']));
$this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields(array('qr' => 1, 'qr_cur_post_id' => (int) max($post_list))));
// Output the page
page_header($page_title, false, $forum_id);
page_footer(false, false, false);
$json_response = new \phpbb\json_response();
$json_response->send(array('success' => true, 'result' => $this->template->assign_display('@tatiana5_quickreply/quickreply_template.html', '', true), 'insert' => $this->qr_insert));
}
if ($s_quick_reply) {
include_once $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
// HTML, BBCode, Smilies, Images and Flash status
$bbcode_status = $this->config['allow_bbcode'] && $this->config['qr_bbcode'] && $this->auth->acl_get('f_bbcode', $forum_id) ? true : false;
$smilies_status = $this->config['allow_smilies'] && $this->config['qr_smilies'] && $this->auth->acl_get('f_smilies', $forum_id) ? true : false;
$img_status = $bbcode_status && $this->auth->acl_get('f_img', $forum_id) ? true : false;
$url_status = $this->config['allow_post_links'] ? true : false;
$flash_status = $bbcode_status && $this->auth->acl_get('f_flash', $forum_id) && $this->config['allow_post_flash'] ? true : false;
$quote_status = true;
// Build custom bbcodes array
if ($bbcode_status) {
display_custom_bbcodes();
}
// Generate smiley listing
if ($smilies_status) {
generate_smilies('inline', $forum_id);
}
// Show attachment box for adding attachments if true
$form_enctype = @ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$this->config['allow_attachments'] || !$this->auth->acl_get('u_attach') || !$this->auth->acl_get('f_attach', $forum_id) ? '' : '" enctype="multipart/form-data';
$allowed = $this->auth->acl_get('f_attach', $forum_id) && $this->auth->acl_get('u_attach') && $this->config['allow_attachments'] && $form_enctype;
$attachment_data = false;
if ($bbcode_status || $smilies_status || $this->config['qr_attach'] && $allowed) {
$this->user->add_lang('posting');
}
if ($this->config['qr_attach'] && $allowed) {
$this->template->assign_vars(array('U_QR_ACTION' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&f={$forum_id}&t={$topic_id}") . $form_enctype));
include_once $this->phpbb_root_path . 'includes/message_parser.' . $this->php_ext;
$message_parser = new \parse_message();
$message_parser->set_plupload($this->plupload);
$message_parser->set_mimetype_guesser($this->mimetype_guesser);
$message_parser->get_submitted_attachment_data($this->user->data['user_id']);
//.........这里部分代码省略.........
示例2: process
/**
* Validate config vars and update config table if needed
*
* @return null
*/
public function process()
{
$submit = $this->request->is_set_post('submit') ? true : false;
$this->new_config = $this->config;
$cfg_array = $this->request->is_set('config') ? $this->request->variable('config', array('' => ''), true) : $this->new_config;
$error = array();
// We validate the complete config if whished
validate_config_vars($this->display_vars['vars'], $cfg_array, $error);
// Do not write values if there is an error
if (sizeof($error)) {
$submit = false;
}
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
foreach ($this->display_vars['vars'] as $config_name => $null) {
if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
continue;
}
$this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
if ($submit) {
$this->config->set($config_name, $config_value);
}
}
if ($submit) {
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'DIR_CONFIG_SETTINGS');
trigger_error($this->user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
$this->template->assign_vars(array('L_TITLE' => $this->user->lang[$this->display_vars['title']], 'L_TITLE_EXPLAIN' => $this->user->lang[$this->display_vars['title'] . '_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
}
示例3: prepare_hidden_fields
/**
* {@inheritDoc}
*/
public function prepare_hidden_fields($step, $key, $action, &$field_data)
{
if ($key == 'l_lang_options' && $this->request->is_set('l_lang_options'))
{
return $this->request->variable($key, array(array('')), true);
}
else if ($key == 'field_default_value')
{
return $this->request->variable($key, $field_data[$key]);
}
else
{
if (!$this->request->is_set($key))
{
return false;
}
else if ($key == 'field_ident' && isset($field_data[$key]))
{
return $field_data[$key];
}
else
{
return ($key == 'lang_options') ? $this->request->variable($key, array(''), true) : $this->request->variable($key, '', true);
}
}
}
示例4: generate_stuff_for_cfg_template
/**
* Abstracted method to generate acp configuration pages out of a list of display vars, using
* the function build_cfg_template().
* Build configuration template for acp configuration pages
*
* @param array $display_vars The display vars for this acp site
*/
protected function generate_stuff_for_cfg_template($display_vars)
{
$this->new_config = $this->config;
$cfg_array = $this->request->is_set('config') ? $this->request->variable('config', ['' => ''], true) : $this->new_config;
$error = isset($error) ? $error : [];
validate_config_vars($display_vars['vars'], $cfg_array, $error);
foreach ($display_vars['vars'] as $config_key => $vars) {
if (!is_array($vars) && strpos($config_key, 'legend') === false) {
continue;
}
if (strpos($config_key, 'legend') !== false) {
$this->template->assign_block_vars('options', ['S_LEGEND' => true, 'LEGEND' => isset($this->user->lang[$vars]) ? $this->user->lang[$vars] : $vars]);
continue;
}
$type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain'])) {
$l_explain = isset($this->user->lang[$vars['lang_explain']]) ? $this->user->lang[$vars['lang_explain']] : $vars['lang_explain'];
} else {
if ($vars['explain']) {
$l_explain = isset($this->user->lang[$vars['lang'] . '_EXPLAIN']) ? $this->user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}
}
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
if (empty($content)) {
continue;
}
$this->template->assign_block_vars('options', ['KEY' => $config_key, 'TITLE' => isset($this->user->lang[$vars['lang']]) ? $this->user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content]);
//unset($display_vars['vars'][$config_key]);
}
$this->template->assign_vars(['S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action]);
}
示例5: generate_field
/**
* {@inheritDoc}
*/
public function generate_field($profile_row, $preview_options = false)
{
$profile_row['field_ident'] = isset($profile_row['var_name']) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident'];
$field_ident = $profile_row['field_ident'];
$default_value = $profile_row['lang_default_value'];
$profile_row['field_value'] = $this->request->is_set($field_ident) ? $this->request->variable($field_ident, $default_value, true) : (!isset($this->user->profile_fields[$field_ident]) || $preview_options !== false ? $default_value : $this->user->profile_fields[$field_ident]);
$this->template->assign_block_vars($this->get_name_short(), array_change_key_case($profile_row, CASE_UPPER));
}
示例6: prepare_hidden_fields
/**
* {@inheritDoc}
*/
public function prepare_hidden_fields($step, $key, $action, &$field_data)
{
if ($key == 'field_length' && $this->request->is_set('rows')) {
$field_data['rows'] = $this->request->variable('rows', 0);
$field_data['columns'] = $this->request->variable('columns', 0);
return $field_data['rows'] . '|' . $field_data['columns'];
}
return parent::prepare_hidden_fields($step, $key, $action, $field_data);
}
示例7: enable_quick_edit
/**
* Enable quick edit
*
* @param object $event The event object
* @return null
* @access public
*/
public function enable_quick_edit($event)
{
$cfg_array = $this->request->is_set('config') ? $this->request->variable('config', array('' => '')) : '';
if (isset($cfg_array['allow_quick_edit'])) {
$this->config->set('allow_quick_edit', (bool) $cfg_array['allow_quick_edit']);
\enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', log(self::QUICKEDIT_FLAG, 2));
}
$event->offsetSet('submit', true);
}
示例8: viewtopic_modify_data
/**
* Show bbcodes and smilies in the quickreply
* Template data for Ajax submit
*
* @param object $event The event object
* @return null
* @access public
*/
public function viewtopic_modify_data($event)
{
$forum_id = $event['forum_id'];
$topic_data = $event['topic_data'];
$post_list = $event['post_list'];
$topic_id = $topic_data['topic_id'];
$s_quick_reply = false;
if (($this->user->data['is_registered'] || $this->config['qr_allow_for_guests']) && $this->config['allow_quick_reply'] && $topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY && $this->auth->acl_get('f_reply', $forum_id)) {
// Quick reply enabled forum
$s_quick_reply = $topic_data['forum_status'] == ITEM_UNLOCKED && $topic_data['topic_status'] == ITEM_UNLOCKED || $this->auth->acl_get('m_edit', $forum_id) ? true : false;
}
if (!$this->user->data['is_registered'] && $s_quick_reply) {
$this->helper->enable_qr_for_guests($forum_id, $topic_data);
}
// Ajaxify viewtopic data
if ($this->request->is_ajax() && $this->request->is_set('qr_request')) {
$this->helper->ajax_response($event['page_title'], max($post_list), $forum_id);
}
if ($s_quick_reply) {
if (!function_exists('generate_smilies')) {
include $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
}
// HTML, BBCode, Smilies, Images, Url, Flash and Quote status
$bbcode_status = $this->config['allow_bbcode'] && $this->config['qr_bbcode'] && $this->auth->acl_get('f_bbcode', $forum_id) ? true : false;
$smilies_status = $this->config['allow_smilies'] && $this->config['qr_smilies'] && $this->auth->acl_get('f_smilies', $forum_id) ? true : false;
$img_status = $bbcode_status && $this->auth->acl_get('f_img', $forum_id) ? true : false;
$url_status = $this->config['allow_post_links'] ? true : false;
$flash_status = $bbcode_status && $this->auth->acl_get('f_flash', $forum_id) && $this->config['allow_post_flash'] ? true : false;
$quote_status = true;
// Build custom bbcodes array
if ($bbcode_status) {
display_custom_bbcodes();
}
// Generate smiley listing
if ($smilies_status) {
generate_smilies('inline', $forum_id);
}
$this->template->assign_vars(array('S_BBCODE_ALLOWED' => $bbcode_status ? 1 : 0, 'S_SMILIES_ALLOWED' => $smilies_status, 'S_BBCODE_IMG' => $img_status, 'S_LINKS_ALLOWED' => $url_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => $quote_status));
// Show attachment box for adding attachments
$show_attach_box = @ini_get('file_uploads') != '0' && strtolower(@ini_get('file_uploads')) != 'off' && $this->config['allow_attachments'] && $this->auth->acl_get('u_attach') && $this->auth->acl_get('f_attach', $forum_id);
if ($bbcode_status || $smilies_status || $this->config['qr_attach'] && $show_attach_box) {
$this->user->add_lang('posting');
}
if ($this->config['qr_attach'] && $show_attach_box) {
$this->helper->handle_attachments($forum_id, $topic_id, $show_attach_box);
}
$this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields(array('qr' => 1, 'qr_cur_post_id' => (int) max($post_list))));
$this->helper->assign_template_variables_for_qr($forum_id);
$add_re = $this->config['qr_enable_re'] ? 'Re: ' : '';
$this->template->assign_var('SUBJECT', $this->request->variable('subject', $add_re . censor_text($topic_data['topic_title']), true));
}
$this->template->assign_vars(array('QR_HIDE_POSTS_SUBJECT' => !$this->config['qr_show_subjects']));
}
示例9: prepare_hidden_fields
/**
* {@inheritDoc}
*/
public function prepare_hidden_fields($step, $key, $action, &$field_data)
{
if ($key == 'field_default_value') {
$field_length = $this->request->variable('field_length', 0);
// Do a simple is set check if using checkbox.
if ($field_length == 2) {
return $this->request->is_set($key);
}
return $this->request->variable($key, $field_data[$key], true);
}
$default_lang_options = array('l_lang_options' => array(0 => array('')), 'lang_options' => array(0 => ''));
if (isset($default_lang_options[$key]) && $this->request->is_set($key)) {
return $this->request->variable($key, $default_lang_options[$key], true);
}
return parent::prepare_hidden_fields($step, $key, $action, $field_data);
}
示例10: profile_side_switcher
public function profile_side_switcher($event)
{
$topic_data = $event['topic_data'];
$forum_id = $event['forum_id'];
if ($this->request->is_set('pss')) {
$pss_left = $this->request->variable('pss', 0);
$sql = 'UPDATE ' . USERS_TABLE . ' SET allow_pss_left = ' . (int) $pss_left . ' WHERE user_id = ' . (int) $this->user->data['user_id'];
$result = $this->db->sql_query($sql);
if ($this->request->is_ajax()) {
$json_response = new \phpbb\json_response();
$json_response->send(array('success' => $result ? true : false));
}
$this->db->sql_freeresult($result);
}
$this->template->assign_vars(array('PSS_URL_LEFT' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . $forum_id . '&t=' . $topic_data['topic_id'] . '&pss=1'), 'PSS_URL_RIGHT' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . $forum_id . '&t=' . $topic_data['topic_id'] . '&pss=0')));
}
示例11: prepare_hidden_fields
/**
* {@inheritDoc}
*/
public function prepare_hidden_fields($step, $key, $action, &$field_data)
{
if ($key == 'field_default_value') {
$always_now = $this->request->variable('always_now', 0);
if ($always_now) {
return 'now';
} else {
if ($this->request->is_set('field_default_value_day')) {
$field_data['field_default_value_day'] = $this->request->variable('field_default_value_day', 0);
$field_data['field_default_value_month'] = $this->request->variable('field_default_value_month', 0);
$field_data['field_default_value_year'] = $this->request->variable('field_default_value_year', 0);
return sprintf('%2d-%2d-%4d', $field_data['field_default_value_day'], $field_data['field_default_value_month'], $field_data['field_default_value_year']);
}
}
}
return parent::prepare_hidden_fields($step, $key, $action, $field_data);
}
示例12: prepare_hidden_fields
/**
* {@inheritDoc}
*/
public function prepare_hidden_fields($step, $key, $action, &$field_data)
{
if (!$this->request->is_set($key)) {
// Do not set this variable, we will use the default value
return null;
} else {
if ($key == 'field_ident' && isset($field_data[$key])) {
return $field_data[$key];
} else {
$default_value = '';
$lang_fields = array('l_lang_name', 'l_lang_explain', 'l_lang_default_value', 'l_lang_options');
if (in_array($key, $lang_fields)) {
$default_value = array(0 => '');
}
return $this->request->variable($key, $default_value, true);
}
}
}
示例13: page_header
/**
* Create the options to show the cookie acceptance box
*
* @param object $event The event object
* @return null
* @access public
*/
public function page_header($event)
{
$cookie_enabled = $this->config['cookie_policy_enabled'];
// If we have already set the cookie on this device then there is no need to process
$cookie_set = $this->request->is_set($this->config['cookie_name'] . '_ca', \phpbb\request\request_interface::COOKIE) ? true : false;
if ($this->config['cookie_policy_enabled'] && !$cookie_set && !$this->user->data['is_bot']) {
// Only need to do this if we are trying to detect if cookie required
if ($this->config['cookie_eu_detect']) {
// Setting this to true here means that if there is a problem with the IP lookup then the cookie will be enabled - just in case we have got it wrong!
$cookie_enabled = true;
// Check if cURL is available on the server
if (function_exists('curl_version')) {
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_URL, 'http://ip-api.com/json/' . $this->user->ip . '?fields=status,countryCode');
$ip_query = curl_exec($curl_handle);
curl_close($curl_handle);
if (!empty($ip_query)) {
$ip_array = json_decode($ip_query, true);
$eu_array = array('AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'EU', 'FI', 'FR', 'FX', 'GB', 'GR', 'HR', 'HU', 'IE', 'IM', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK', 'UK');
if ($ip_array['status'] == 'success' && !in_array($ip_array['countryCode'], $eu_array)) {
// IP not in an EU country therefore we do not need to invoke the Cookie Policy
$cookie_enabled = false;
} else {
if ($ip_array['status'] != 'success' && $this->config['cookie_log_errors']) {
$this->log->add('critical', $this->user->data['user_id'], $this->user->ip, 'LOG_COOKIE_ERROR');
}
}
} else {
if ($this->config['cookie_log_errors']) {
$this->log->add('critical', $this->user->data['user_id'], $this->user->ip, 'LOG_SERVER_ERROR');
}
}
} else {
if ($this->config['cookie_log_errors']) {
$this->log->add('critical', $this->user->data['user_id'], $this->user->ip, 'LOG_CURL_ERROR');
}
}
}
$this->template->assign_vars(array('COOKIE_BOX_BG_COLOUR' => addslashes($this->config['cookie_box_bg_colour']), 'COOKIE_BOX_HREF_COLOUR' => addslashes($this->config['cookie_box_href_colour']), 'COOKIE_BOX_TXT_COLOUR' => addslashes($this->config['cookie_box_txt_colour']), 'COOKIE_CLASS' => $this->config['cookie_box_position'] ? addslashes('cookie-box rightside') : addslashes('cookie-box leftside'), 'COOKIE_EXPIRES' => addslashes($this->config['cookie_expire']), 'COOKIE_NAME' => addslashes($this->config['cookie_name']), 'S_COOKIE_CUSTOM_BOX' => $this->config['cookie_custom_box']));
}
$this->template->assign_vars(array('S_SHOW_COOKIE_ACCEPT' => $cookie_set, 'S_COOKIE_ENABLED' => $cookie_enabled));
}
示例14: generate_field
/**
* {@inheritDoc}
*/
public function generate_field($profile_row, $preview_options = false)
{
$profile_row['field_ident'] = isset($profile_row['var_name']) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident'];
$field_ident = $profile_row['field_ident'];
$default_value = $profile_row['field_default_value'];
$value = $this->request->is_set($field_ident) ? $this->request->variable($field_ident, $default_value) : (!isset($this->user->profile_fields[$field_ident]) || $preview_options !== false ? $default_value : $this->user->profile_fields[$field_ident]);
if (!$this->lang_helper->is_set($profile_row['field_id'], $profile_row['lang_id'], 1)) {
if ($preview_options) {
$this->lang_helper->load_preview_options($profile_row['field_id'], $profile_row['lang_id'], $preview_options);
} else {
$this->lang_helper->load_option_lang($profile_row['lang_id']);
}
}
$profile_row['field_value'] = (int) $value;
$this->template->assign_block_vars('dropdown', array_change_key_case($profile_row, CASE_UPPER));
$options = $this->lang_helper->get($profile_row['field_id'], $profile_row['lang_id']);
foreach ($options as $option_id => $option_value) {
$this->template->assign_block_vars('dropdown.options', array('OPTION_ID' => $option_id, 'SELECTED' => $value == $option_id ? ' selected="selected"' : '', 'VALUE' => $option_value));
}
}
示例15: generate_field
/**
* {@inheritDoc}
*/
public function generate_field($profile_row, $preview_options = false)
{
$profile_row['field_ident'] = isset($profile_row['var_name']) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident'];
$field_ident = $profile_row['field_ident'];
$default_value = $profile_row['field_default_value'];
if ($this->request->is_set($field_ident)) {
$value = $this->request->variable($field_ident, '') === '' ? null : $this->request->variable($field_ident, $default_value);
} else {
if ($preview_options === false && array_key_exists($field_ident, $this->user->profile_fields) && is_null($this->user->profile_fields[$field_ident])) {
$value = null;
} else {
if (!isset($this->user->profile_fields[$field_ident]) || $preview_options !== false) {
$value = $default_value;
} else {
$value = $this->user->profile_fields[$field_ident];
}
}
}
$profile_row['field_value'] = is_null($value) || $value === '' ? '' : (int) $value;
$this->template->assign_block_vars('int', array_change_key_case($profile_row, CASE_UPPER));
}