当前位置: 首页>>代码示例>>PHP>>正文


PHP form_prep函数代码示例

本文整理汇总了PHP中form_prep函数的典型用法代码示例。如果您正苦于以下问题:PHP form_prep函数的具体用法?PHP form_prep怎么用?PHP form_prep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了form_prep函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: set_value

/**
 * Set Value
 *
 * We have removed the part using form validation.
 *
 * @access	public
 * @param	string
 * @return	mixed
 */
function set_value($field = '', $default = '')
{
    if (!isset($_POST[$field])) {
        return $default;
    }
    return form_prep($_POST[$field], $field);
}
开发者ID:kulgee001,项目名称:yggdrasil,代码行数:16,代码来源:MY_form_helper.php

示例2: display_input

 /**
  * Display Low Variables field
  *
  * @param mixed $data the variable data
  *
  * @return string    the field's display
  */
 public function display_input($var_id, $var_data, $var_settings)
 {
     // Local cache
     static $loaded;
     // Load the RTE lib
     ee()->load->add_package_path(PATH_MOD . 'rte');
     ee()->load->library('rte_lib');
     //add the RTE js if it hasn't already been added
     if ($loaded !== TRUE) {
         // Load JS lib
         ee()->load->library('javascript');
         // Add RTE JS to CP
         ee()->javascript->output(ee()->rte_lib->build_js(0, '.WysiHat-field', NULL, TRUE));
         // Add FileManager JS to CP
         ee()->load->library(array('filemanager', 'file_field'));
         ee()->file_field->browser();
         $loaded = TRUE;
     }
     // Translate settings
     $settings = array('field_ta_rows' => $this->get_setting('rows', $var_settings), 'field_text_direction' => $this->get_setting('text_direction', $var_settings), 'field_fmt' => 'xhtml');
     $field_id = 'var_' . $var_id;
     //do this once to properly prep the data,
     //otherwise HTML special chars get wrongly converted
     $var_data = form_prep($var_data, $field_id);
     //use the channel field display_field method
     $field = ee()->rte_lib->display_field($var_data, $field_id, $settings);
     return preg_replace('/name="var_(\\d+)"/i', 'name="var[$1]"', $field);
 }
开发者ID:kentonquatman,项目名称:iofa,代码行数:35,代码来源:vt.low_rte.php

示例3: _parse_form_attributes_ex

 function _parse_form_attributes_ex($attributes, $default)
 {
     if (is_array($attributes)) {
         foreach ($default as $key => $val) {
             if (isset($attributes[$key])) {
                 $default[$key] = $attributes[$key];
                 unset($attributes[$key]);
             }
         }
         if (count($attributes) > 0) {
             $default = array_merge($default, $attributes);
         }
     }
     $att = '';
     foreach ($default as $key => $val) {
         if ($key == 'value') {
             $val = form_prep($val, $default['name']);
         }
         if (strpos($val, '"') >= 0) {
             $att .= $key . '=\'' . $val . '\' ';
         } else {
             $att .= $key . '="' . $val . '" ';
         }
     }
     return $att;
 }
开发者ID:ardissoebrata,项目名称:ci-beam,代码行数:26,代码来源:MY_form_helper.php

示例4: display_input

 /**
  * Display Low Variables field
  *
  * @param mixed $data the variable data
  *
  * @return string    the field's display
  */
 public function display_input($var_id, $var_data, $var_settings)
 {
     // Only supported in 2.5.3+
     if (version_compare(APP_VER, '2.5.3') < 0) {
         return '<em>The RTE for Low Variables requires ExpressionEngine 2.5.3+</em>';
     }
     // Local cache
     static $loaded;
     // Load the RTE lib
     $this->EE->load->add_package_path(PATH_MOD . 'rte');
     $this->EE->load->library('rte_lib');
     //add the RTE js if it hasn't already been added
     if ($loaded !== TRUE) {
         // Load JS lib
         $this->EE->load->library('javascript');
         // Add RTE JS to CP
         $this->EE->javascript->output($this->EE->rte_lib->build_js(0, '.WysiHat-field', NULL, TRUE));
         // Add FileManager JS to CP
         $this->EE->load->library(array('filemanager', 'file_field'));
         $this->EE->file_field->browser();
         $loaded = TRUE;
     }
     // Translate settings
     $settings = array('field_ta_rows' => $this->get_setting('rows', $var_settings), 'field_text_direction' => $this->get_setting('text_direction', $var_settings), 'field_fmt' => 'none');
     $field_id = 'var_' . $var_id;
     //do this once to properly prep the data,
     //otherwise HTML special chars get wrongly converted
     form_prep($var_data, $field_id);
     //use the channel field display_field method
     $field = $this->EE->rte_lib->display_field($var_data, $field_id, $settings);
     return preg_replace('/name="var_(\\d+)"/i', 'name="var[$1]"', $field);
 }
开发者ID:thomasvandoren,项目名称:teentix-site,代码行数:39,代码来源:vt.low_rte.php

示例5: set_value

 /**
  * ----------------------------------------------------------
  * Set Value: Get the value from a form
  * Extends method to return posted data for fields with no rules
  * ----------------------------------------------------------
  * 
  * @param string $field
  * @param string $default
  * @return string
  */
 function set_value($field = '', $default = '')
 {
     // no post?
     if (count($_POST) == 0) {
         return $default;
     }
     // no rules for this field?
     if (!isset($this->_field_data[$field])) {
         $this->set_rules($field, '', '');
         // fieldname is an array
         if ($this->_field_data[$field]['is_array']) {
             $keys = $this->_field_data[$field]['keys'];
             $value = $this->_traverse_array($_POST, $keys);
         } else {
             $value = isset($_POST[$field]) ? $_POST[$field] : FALSE;
         }
         // field was not in the post
         if ($value === FALSE) {
             return $default;
         } else {
             $this->_field_data[$field]['postdata'] = form_prep($value, $field);
         }
     }
     return parent::set_value($field, $default);
 }
开发者ID:boatechnology,项目名称:HealthAndWellness,代码行数:35,代码来源:MY_Form_validation.php

示例6: index

 /**
  * Main login form
  *
  * @access	public
  * @return	void
  */
 public function index()
 {
     // We don't want to allow access to the login screen to someone
     // who is already logged in.
     if ($this->session->userdata('member_id') !== 0 && ee()->session->userdata('admin_sess') == 1) {
         return $this->functions->redirect(BASE);
     }
     // If an ajax request ends up here the user is probably logged out
     if (AJAX_REQUEST) {
         //header('X-EERedirect: C=login');
         header('X-EE-Broadcast: modal');
         die('Logged out');
     }
     $username = $this->session->flashdata('username');
     $this->view->return_path = '';
     $this->view->focus_field = $username ? 'password' : 'username';
     $this->view->username = $username ? form_prep($username) : '';
     $this->view->message = $this->input->get('auto_expire') ? lang('session_auto_timeout') : $this->session->flashdata('message');
     if ($this->input->get('BK')) {
         $this->view->return_path = base64_encode($this->input->get('BK'));
     } else {
         if ($this->input->get('return')) {
             $this->view->return_path = $this->input->get('return');
         }
     }
     $this->view->cp_page_title = lang('login');
     $this->view->render('account/login');
 }
开发者ID:realfluid,项目名称:umbaugh,代码行数:34,代码来源:login.php

示例7: form_prep

/**
 * Form Prep
 *
 * 特殊文字のエスケープを行わないバージョン
 *
 */
function form_prep($str = '', $field_name = '')
{
    static $prepped_fields = array();
    // if the field name is an array we do this recursively
    if (is_array($str)) {
        foreach ($str as $key => $val) {
            $str[$key] = form_prep($val);
        }
        return $str;
    }
    if ($str === '') {
        return '';
    }
    // we've already prepped a field with this name
    // @todo need to figure out a way to namespace this so
    // that we know the *exact* field and not just one with
    // the same name
    if (isset($prepped_fields[$field_name])) {
        return $str;
    }
    //$str = htmlspecialchars($str);
    // In case htmlspecialchars misses these.
    //$str = str_replace(array("'", '"'), array("&#39;", "&quot;"), $str);
    if ($field_name != '') {
        $prepped_fields[$field_name] = $field_name;
    }
    return $str;
}
开发者ID:nise-nabe,项目名称:uzuramemo,代码行数:34,代码来源:MY_form_helper.php

示例8: index

 /**
  * Main login form
  *
  * @access	public
  * @return	void
  */
 public function index()
 {
     // We don't want to allow access to the login screen to someone
     // who is already logged in.
     if ($this->session->userdata('member_id') !== 0 && ee()->session->userdata('admin_sess') == 1) {
         $member = ee('Model')->get('Member')->filter('member_id', ee()->session->userdata('member_id'))->first();
         return $this->functions->redirect($member->getCPHomepageURL());
     }
     // If an ajax request ends up here the user is probably logged out
     if (AJAX_REQUEST) {
         //header('X-EERedirect: C=login');
         header('X-EE-Broadcast: modal');
         die('Logged out');
     }
     // Are we here after a new install or update?
     $installer_dir = SYSPATH . 'installer_' . ee()->config->item('app_version') . '/';
     if (($type = ee()->input->get('after')) && is_dir($installer_dir)) {
         ee()->lang->load('installer', 'english', FALSE, TRUE, $installer_dir);
         $this->view->message = sprintf(lang("{$type}_success_note"), APP_VER) . BR . sprintf(lang('success_moved'), ee()->config->item('app_version'));
         $this->view->message_status = 'success';
     }
     $username = $this->session->flashdata('username');
     $this->view->return_path = '';
     $this->view->focus_field = $username ? 'password' : 'username';
     $this->view->username = $username ? form_prep($username) : '';
     if (!isset($this->view->message)) {
         $this->view->message = $this->input->get('auto_expire') ? lang('session_auto_timeout') : $this->session->flashdata('message');
     }
     // Normal login button state
     $this->view->btn_class = 'btn';
     $this->view->btn_label = lang('login');
     $this->view->btn_disabled = '';
     // Set lockout message and form state
     if (ee()->session->check_password_lockout($username) === TRUE) {
         $this->view->btn_class .= ' disable';
         $this->view->btn_label = lang('locked');
         $this->view->btn_disabled = 'disabled';
         $this->view->message = sprintf(lang('password_lockout_in_effect'), ee()->config->item('password_lockout_interval'));
     }
     if ($this->view->message != '' && !isset($this->view->message_status)) {
         $this->view->message_status = 'issue';
     }
     // Show the site label
     $site_label = ee('Model')->get('Site')->fields('site_label')->filter('site_id', ee()->config->item('site_id'))->first()->site_label;
     $this->view->header = $site_label ? lang('log_into') . ' ' . $site_label : lang('login');
     if ($this->input->get('BK')) {
         $this->view->return_path = base64_encode($this->input->get('BK'));
     } else {
         if ($this->input->get('return')) {
             $this->view->return_path = $this->input->get('return');
         }
     }
     $this->view->cp_page_title = lang('login');
     $this->view->cp_session_type = ee()->config->item('cp_session_type');
     $this->view->render('account/login');
 }
开发者ID:vigm,项目名称:advancedMD,代码行数:62,代码来源:login.php

示例9: set_value

function set_value($field = '', $default = '')
{
    if (!isset($_POST[$field])) {
        return $default;
    }
    if (FALSE === ($OBJ =& _get_validation_object())) {
        return form_prep($_POST[$field], $field);
    }
    return form_prep($OBJ->set_value($field, $_POST[$field]), $field);
}
开发者ID:navruzm,项目名称:navruz.net,代码行数:10,代码来源:MY_form_helper.php

示例10: set_value

 function set_value($field = '', $default = '')
 {
     $OBJ =& _get_validation_object();
     if ($OBJ === TRUE && isset($OBJ->_field_data[$field])) {
         return form_prep($OBJ->set_value($field, $default));
     } else {
         if (!isset($_POST[$field])) {
             return $default;
         }
         return form_prep($_POST[$field]);
     }
 }
开发者ID:mandress64,项目名称:cordova,代码行数:12,代码来源:MY_form_helper.php

示例11: set_value

/**
 * Set Value
 *
 * We have removed the part using form validation.
 * And added support for POST field arrays.
 *
 * @access	public
 * @param	string
 * @return	mixed
 */
function set_value($field = '', $default = '')
{
    if (stristr($field, '[') !== false) {
        # It uses field arrays, let's work with that.
        $field = explode('[', $field);
        $arrayIndex = str_ireplace(']', '', $field[1]);
        $field = $field[0];
        return isset($_POST[$field][$arrayIndex]) ? form_prep($_POST[$field][$arrayIndex], $field) : $default;
    } else {
        return isset($_POST[$field]) ? form_prep($_POST[$field], $field) : $default;
    }
}
开发者ID:kulgee001,项目名称:yggdrasil,代码行数:22,代码来源:My_form_helper.php

示例12: form_hidden

 function form_hidden($name, $value = '', $id = false)
 {
     if (!is_array($name)) {
         return '<input type="hidden" id="' . ($id ? $id : $name) . '" name="' . $name . '" value="' . form_prep($value) . '" />';
     }
     $form = '';
     foreach ($name as $name => $value) {
         $form .= "\n";
         $form .= '<input type="hidden"  id="' . ($id ? $id : $name) . '" name="' . $name . '" value="' . form_prep($value) . '" />';
     }
     return $form;
 }
开发者ID:binaek89,项目名称:cms-canvas,代码行数:12,代码来源:MY_form_helper.php

示例13: type2

 function type2()
 {
     //return data piramida penduduk
     $json_laki = $this->getDataDataUmur('1');
     $json_perempuan = $this->getDataDataUmur('2');
     //$json = json_encode($json_laki+$json_perempuan+$dataPekerjaan);
     $diagram = json_encode($json_laki + $json_perempuan);
     $diagram = str_replace('":', '<=>', $diagram);
     $diagram = str_replace(',"', '","', $diagram);
     $diagram = str_replace('{', '[', $diagram);
     $diagram = str_replace('}', '"]', $diagram);
     $array = array('type' => "2", 'diagram' => form_prep($diagram));
     $json = json_encode($array);
     $json = str_replace('"[', '[', $json);
     $json = str_replace(']"', ']', $json);
     return $json;
 }
开发者ID:lahirwisada,项目名称:sideka,代码行数:17,代码来源:c_portal.php

示例14: build

 function build()
 {
     $output = "";
     switch ($this->status) {
         case "disabled":
         case "show":
             break;
         case "create":
         case "modify":
             $output = '<input type="button" value="' . form_prep($this->label) . '">';
             //ci do not have form helper for buttons
             break;
         case "hidden":
             break;
         default:
     }
     $this->output = "\n" . $output . "\n";
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:18,代码来源:button.php

示例15: display_cell

 /**
  * Display Cell
  */
 function display_cell($data)
 {
     $this->_prep_settings($this->settings);
     if (!isset($this->cache['displayed'])) {
         // include matrix_rte.js
         $theme_url = $this->EE->session->cache['matrix']['theme_url'];
         $this->EE->cp->add_to_foot('<script type="text/javascript" src="' . $theme_url . 'scripts/matrix_rte.js"></script>');
         $this->cache['displayed'] = TRUE;
     }
     $this->EE->load->add_package_path(PATH_MOD . 'rte/');
     $this->EE->load->library('rte_lib');
     //prep the data
     form_prep($data, $this->cell_name);
     //use the Rte_ft::display_field method
     $this->EE->load->library('rte_lib');
     $cell = array('data' => $this->EE->rte_lib->display_field($data, $this->cell_name, $this->settings), 'class' => 'matrix-rte');
     return $cell;
 }
开发者ID:thomasvandoren,项目名称:teentix-site,代码行数:21,代码来源:rte.php


注:本文中的form_prep函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。