本文整理汇总了PHP中form::protection方法的典型用法代码示例。如果您正苦于以下问题:PHP form::protection方法的具体用法?PHP form::protection怎么用?PHP form::protection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类form
的用法示例。
在下文中一共展示了form::protection方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: input
function input($key, $data, $inputOnly = false)
{
/*
* http://2.s3.envato.com/files/2408629/index.html
*/
//$formatTime='%Y-%m-%d %k';
$fieldName = parent::protection($key);
$input = '<input type="text" name="' . $fieldName . '" value="' . $data->value . '" class="field datetime any-time" id="' . $fieldName . '" style="float:left;" />' . self::button($fieldName . "-select-time", lang('Input Time'), 'timebutton');
// $input .='<script type="text/javascript">'
// .'var oTime = {format: "'.$formatTime.'", baseYear: 2000,earliest: new Date(2012,0,1,0,0,0), labelTitle: "Ch�n Th�i Gian",labelYear: "Năm",labelMonth: "Tháng",labelDays: "Ngà y Trong Tháng", labelHour: "Gi�"};'
// // ."$('#".parent::protection($key)."').click(function(e){"
// // ."$('#".parent::protection($key)."').AnyTime_noPicker().AnyTime_picker(oTime).focus();"
// // .'e.preventDefault();'
// // .'return false;'
// // .'});'
// ."$('#".$fieldName."-select-time').click(function(e){"
// ."$('input[name=".$fieldName."]').AnyTime_noPicker().AnyTime_picker(oTime).focus();"
// .'e.preventDefault();'
// .'return false;'
// .'});'
// .'</script>';
// $title = ($this->CI->lang->line($fieldKey)!='')?$this->CI->lang->line($fieldKey):$this->CI->lang->line($controller.' '.$fieldKey);
$this->CI->template->add_js_ready('time.bind("' . $fieldName . '")');
return self::rowForm($data->title, $input);
}
示例2: input
public function input($fieldKey, $fieldData)
{
$lable = preg_replace("/<.*?>/", "", $fieldData->lable);
$auto_resize = isset($fieldData->auto_resize) && $fieldData->auto_resize ? 'auto-resize' : '';
//$html = ;
$html = '<p><ul class="tabs js-tabs same-height">';
foreach ($this->CI->backpak->lang as $key => $val) {
$html .= '<li><a title="' . $val . '" href="#tablang-' . $fieldKey . $key . '">' . $val . '</a></li>';
}
$html .= '</ul><div class="tabs-content full-width" >';
$values = $fieldData->value;
foreach ($this->CI->backpak->lang as $key => $val) {
$html .= '<div id="tablang-' . $fieldKey . $key . '"><textarea rows=20 name="' . parent::protection($fieldKey . '-' . $key) . '" class="full-width ' . $auto_resize . '" >' . (isset($values[$key]) && $values[$key] ? $values[$key] : null) . '</textarea></div>';
}
$html .= '</div></p>';
if (isset($fieldData->wysiwyg) && $fieldData->wysiwyg == true) {
$script = 'jQuery("textarea[name^=' . self::protection($fieldKey . '-') . ']").tinymce({' . '});';
//$this->CI->template->add_js_ready('tinymce.init({ remove_script_host:false, document_base_url: "http://www.site.com/path1/"});',false);
$this->CI->template->add_js_ready($script);
}
return $html;
/*
if(!isset($fieldData->dir) || $fieldData->dir=='') {
$fieldData->dir = 'content';
}
$wysiwygScript = 'jQuery("textarea[name='.parent::protection($fieldKey).']").tinymce({imageDIR:encodeURI("'.base_url("resource/images_list?dir=$fieldData->dir").'")});';
if(isset($fieldData->wysiwyg) && $fieldData->wysiwyg==true) {
$this->CI->template->add_js_ready($wysiwygScript);
}
//return self::rowForm($controller,$fieldKey,$input);
//$html.=parent::inputHidden($fieldKey,$fieldData->value);
return $html;
*/
}
示例3: input
function input($key, $data, $inputOnly = false)
{
$input = "<input type='text' name='" . parent::protection($key) . "' value='{$key}' id='qform_input_{$key}' />" . parent::button("{$key}-select-coordinates", 'Nháºp Tá»�a Ä�á»™', 'coordinates') . '<div id="get_map" title="Lấy Tá»�a Ä�á»™ Trên Bản Ä�ồ (kéo thả đến Ä‘iểm cần để lấy tá»�a Ä‘á»™)"></div>';
$script = '' . "var map={" . "getPostion:function(){" . "\$('#dialog:ui-dialog' ).dialog('destroy' );" . "\$('#get_map').dialog({" . "draggable: false,resizable: false,height: 440, width:640,modal: true," . "open: function(event, ui) {" . "jQuery(this).html('<div id=\"gmap\" class=\"gmap3\"></div>');" . 'map.loadMap();' . "}" . "});" . "}," . "loadMap:function(){" . "\$('#gmap').gmap3({\n\t\taction: 'addMarker',\n\t\tlatLng: [21.029391714981056, 105.85231983068843],\n\t\tmap:{ center: true, zoom: 15},\n\t\tmarker:{\n\t\toptions:{ draggable:true },\n\t\tevents:{\n\t\tdragend: function(marker){\n\t\t\$(this).gmap3({\n\t\taction:'getAddress',\n\t\tlatLng:marker.getPosition(),\n\t\tcallback:function(results){\n\t\tvar map = \$(this).gmap3('get'),\n\t\tinfowindow = \$(this).gmap3({action:'get', name:'infowindow'});\n\t\taddressValue = results && results[1] ? results && results[1].formatted_address : 'no address';\n\t\tcontent ='<div class=\"address\">';\n\t\tcontent += addressValue;\n\t\tcontent +='</div>';\n\t\tcontent +='<div class=\"button2-left\" style=\"clear: both;\" ><div class=\"blank\">'\n\t\tcontent +='<input type=\"button\" title=\"\" value=\"Lấy T�a �ộ nà y\" onclick=\"\$(\\'#qform_input_" . $fieldKey . "\\').val(\\''+marker.getPosition().lat()+','+marker.getPosition().lng()+'\\'); \$(\\'#get_map\\' ).dialog(\\'close\\');\" /></div></div>';\n\t\tmap.panTo(marker.getPosition());\n\t\t\t\n\t\t\n\t\tif (infowindow){\n\t\tinfowindow.open(map, marker);\n\t\tinfowindow.setContent(content);\n\t\t} else {\n\t\t\$(this).gmap3({action:'addinfowindow', anchor:marker, options:{content: content}});\n\t\t}\n\t\t\n\t\t}\n\t\t});\n\t\t}\n\t\t}\n\t\t \n\t\t}\n\t\t}\n\t\t);" . "}," . "};";
$input .= '<script type="text/javascript">' . $script . "\$('#{$key}-select-coordinates').click(function(){" . 'map.getPostion();' . '});' . '</script>';
//$this->CI->template->add_js($script);
return self::rowForm($data->title, $input);
}
示例4: input
public function input($fieldKey, $fieldData)
{
$lable = preg_replace("/<.*?>/", "", $fieldData->lable);
$attribute = '';
$fullname = lang('tag coordinates on map');
$html = '<span class="input-with-button" ><input type="text" name="' . parent::protection($fieldKey) . '" value="' . $fieldData->value . '" class="" ' . $attribute . ' READONLY placeholder="' . lang('tag coordinates on map') . '" aria-label="' . lang('tag coordinates on map') . '" />' . '<button class="grey" type="button" name="' . parent::protection("{$fieldKey}-button") . '" >' . lang('Open Map') . '</button>' . '</span>';
$this->CI->template->add_js('http://maps.google.com/maps/api/js?sensor=true&language=vi');
//$html.=parent::inputHidden($fieldKey,$fieldData->value);
$script = '$("input[name=' . parent::protection("{$fieldKey}-readonly") . ']").focus(function() {' . 'choose_coordinates();' . '});' . '$("button[name=' . parent::protection("{$fieldKey}-button") . ']").click(function() {' . 'choose_coordinates();' . '});' . 'function choose_coordinates(){' . 'if( $("#modal").length > 0 && !$("#modal").is(":hidden") ) return false;' . '$.modal({' . 'content: "<div id=\\"maps\\" style=\\"height:100%; width:100%; display:inline-block; top:0;\\" ></div>",' . 'title: "' . lang('Google Map') . '", width: 800,height:400, buttons: { "Close": function(win) { win.closeModal(); } }' . '});' . '$(".block-content").css({"padding":0,"margin":0});' . '$(".block-footer").css({"padding":15,"margin":0});' . '$(".block-footer").append(' . '\'<p class="float-left align-left"><label>Latitude</label><input type="text" class="grid_11 align-center" value="16.509833" name="complex-latitude"></p>\'' . '+\'<p class="float-left align-left"><label>Longitude</label><input type="text" class="grid_11 align-center" value="107.006836" name="complex-longitude"></p>\'' . '+\'<button type="button" class="float-left red use-this" >Select</button>\'' . ');' . 'initialize();' . '$("button.use-this").click(function(){' . '$("input[name=' . parent::protection($fieldKey) . ']").val($("input[name=complex-latitude]").val()+","+$("input[name=complex-longitude]").val());' . '$("#modal").closeModal();' . 'return true;' . '});' . '}' . 'var map, marker;' . 'function initialize() {' . 'var $inputLat = $("input[name=complex-latitude]");' . 'var $inputLng = $("input[name=complex-longitude]");' . 'var myLatlng = new google.maps.LatLng( $inputLat.val(),$inputLng.val() );' . 'var myOptions = {zoom: 5, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP};' . 'map = new google.maps.Map(document.getElementById("maps"), myOptions);' . 'marker = new google.maps.Marker({ draggable: true, position: myLatlng, map: map, title: "Your location" });' . 'google.maps.event.addListener(marker,"dragend",function(event){' . '$inputLat.val( this.getPosition().lat() );' . '$inputLng.val( this.getPosition().lng() );' . '});' . '$inputLat.change(function(){ updateMarkerCenter($inputLat.val(), $inputLng.val() ); });' . '$inputLng.change(function(){ updateMarkerCenter($inputLat.val(), $inputLng.val() ); });' . '};' . 'function updateMarkerCenter(lat,lng){' . '$point = new google.maps.LatLng(lat,lng);' . 'map.panTo($point);' . 'marker.setPosition($point);' . '}';
$this->CI->template->add_js_ready($script);
return $html;
}
示例5: input
public function input($fieldKey, $fieldData, $view = 'default')
{
$lable = preg_replace("/<.*?>/", "", $fieldData->lable);
$attribute = '';
$fieldData->category = isset($fieldData->category) ? $fieldData->category : 'adv';
$fieldData->table = isset($fieldData->table) ? $fieldData->table : 'advertising';
$script = "tag.bind({" . "inputName:'" . self::protection($fieldKey) . "'," . "category:'" . $fieldData->category . "'," . "table:'" . $fieldData->table . "'," . "tagetItem:\$('input[type=hidden][name=" . parent::protection('id') . "]')," . "});" . "tag.itemCate.push('{$fieldData->category}')";
$this->CI->template->add_js_ready($script);
$default = isset($fieldData->default) && $fieldData->default != null ? 'default="' . $fieldData->default . '"' : null;
$html = '<div class="tag-field tags-' . self::protection($fieldKey) . '" category="' . $fieldData->category . '" table="' . $fieldData->table . '" name="' . self::protection($fieldKey) . '" ' . $default . ' >' . '<input type="text" value="" autocomplete="off" class="text newtag" name="' . $this->CI->form->protection('tag') . '" >' . '<button class="red dark send_right img_icon has_text text_only new-post" ><span>Add</span></button> ' . '<div class="tags_item clearfix"></div>' . '<fieldset class="tags_item_added clearfix"><legend>Tag Exist</legend></fieldset>' . '</div>';
return self::rowForm($fieldData->title, $html);
//return ;
}
示例6: input
public function input($fieldKey, $fieldData, $view = 'default')
{
$fullname = $attribute = null;
if ($fieldData->value) {
$user = $this->CI->Pak_Model->userGet($fieldData->value);
if ($user && $user->name) {
$fullname = $user->name;
}
if (!$fullname) {
$fullname = '-unname-';
}
}
$html = '<span class="input-with-button" ><input type="text" name="' . parent::protection("{$fieldKey}-readonly") . '" value="' . $fullname . '" class="" ' . $attribute . ' READONLY placeholder="' . lang('tag user first') . '" aria-label="' . lang('tag user first') . '" />' . parent::inputHidden($fieldKey, $fieldData->value) . '<button class="grey" type="button" name="' . parent::protection("{$fieldKey}-button") . '" >' . lang('Select User') . '</button>' . '</span>';
return $html;
}
示例7: input
public function input($fieldKey, $fieldData)
{
$lable = preg_replace("/<.*?>/", "", $fieldData->lable);
$attribute = '';
if (!isset($fieldData->dir) || $fieldData->dir == '') {
$fieldData->dir = 'content';
}
$resourceURL = $this->CI->config->item('resource_domain');
$directory = $fieldData->dir != '' ? "/" . $fieldData->dir != '' : '';
$subDir = $fieldData->dir != '' ? "?dir={$fieldData->dir}" : '';
$script = '' . 'jQuery("#' . $fieldKey . '-select-image").click(function(e){ ' . "e.preventDefault();" . "var fm = \$('<div/>').dialogelfinder({" . "url : '" . $this->CI->config->item('assets_url') . "/elfinder-2.0/php/connector.php'," . "lang : 'en', width : 840,destroyOnClose : true," . "getFileCallback : function(files, fm) {" . "jQuery('input[type=text][name=" . parent::protection($fieldKey) . "]').val(files.replace('" . $this->CI->config->item('resource_domain') . "/', ''));" . "},commandsOptions : {getfile : { oncomplete : 'close',folders : false}}" . "}).dialogelfinder('instance');" . 'return false;' . '});';
$this->CI->template->add_js_ready($script);
$html = '<input type="text" name="' . parent::protection($fieldKey) . '" value="' . $fieldData->value . '" class="field-image text" readonly />';
$html .= parent::button('select image', 'button', array('id' => "{$fieldKey}-select-image", 'class' => 'imagebutton button grey'));
return $html;
}
示例8: input
public function input($fieldKey, $fieldData)
{
$lable = preg_replace("/<.*?>/", "", $fieldData->lable);
$attribute = '';
$fullname = '';
if ($this->CI->input->get('user')) {
$fieldData->value = $this->CI->input->get('user');
}
// if($fieldData->value){
// if($fieldData->value > 0) {
// $uid = $fieldData->value;
// } else if ($this->CI->input->get('user')){
// $uid = $this->CI->input->get('user');
// } else {
// $uid = 0;
// }
if (!method_exists($this->CI, 'User_Model')) {
$this->CI->load->model('User_Model');
}
$user = $this->CI->User_Model->getUser($fieldData->value);
if ($user && $user->fullname) {
$fullname = $user->fullname;
}
// }
// bug($fieldData->value);exit;
$html = '<span class="input-with-button" ><input type="text" name="' . parent::protection("{$fieldKey}-readonly") . '" value="' . $fullname . '" class="" ' . $attribute . ' READONLY placeholder="' . lang('tag user first') . '" aria-label="' . lang('tag user first') . '" />' . '<button class="grey" type="button" name="' . parent::protection("{$fieldKey}-button") . '" >' . lang('Select User') . '</button>' . '</span>';
$html .= parent::inputHidden($fieldKey, $fieldData->value);
$script = '$("input[name=' . parent::protection("{$fieldKey}-readonly") . ']").focus(function() {' . 'select_user();' . '});' . '$("button[name=' . parent::protection("{$fieldKey}-button") . ']").click(function() {' . 'select_user();' . '});' . 'function select_user(){' . 'if( $("#modal").length > 0 && !$("#modal").is(":hidden") ) return false;' . '$.modal({' . 'content: "<table id=\\"datatable\\" class=\\"table\\" width=\\"100%\\" >"
+"<thead><tr>"
+"<th></th>"
+"<th>' . lang('Username Login') . '</th>"
+"<th>' . lang('Email Label') . '</th>"
+"<th>' . lang('Device Tracking') . '</th>"
+"<th>' . lang('Actions') . '</th>"
+"</tr></thead>"
+"<tbody></tbody><tfoot></tfoot></table>",' . 'title: "' . lang('User Data') . '", width: 800, buttons: { "Close": function(win) { win.closeModal(); } }' . '});' . 'var tableconfig = { "bProcessing": true,"bServerSide": true, "sPaginationType": "full_numbers",' . '"fnServerData": function ( sSource, aoData, fnCallback ) {' . 'jQuery.each(aoData, function(i, item) {' . '$.each(item, function(ii, itemSub) {' . 'if(ii=="name"){' . 'if(itemSub!="' . $this->CI->security->get_csrf_token_name() . '")' . 'aoData[i][ii] = "' . $this->CI->form->protection() . '"+itemSub;' . '}' . '});' . '});' . 'jQuery.ajax( {"dataType": "json","type": "POST","url": "' . site_url('users/manager') . '?format=json&show=popup","data": aoData,' . 'success: function(data) {' . 'fnCallback(data);' . '$("#datatable button.use").click(function(){' . '$id = $(this).parents("tr").children().eq(0).text();' . '$username = $(this).parents("tr").children().eq(1).text();' . '$("input[name=' . parent::protection("{$fieldKey}-readonly") . ']").val($username);' . '$("input[name=' . parent::protection("{$fieldKey}") . ']").val($id);' . '$("#modal").closeModal();' . 'return true;' . '});' . '}' . '});' . '}' . '};' . 'tableconfig["fnServerParams"]=function ( aoData ) {aoData.push( { "name": "' . $this->CI->security->get_csrf_token_name() . '", "value": "' . $this->CI->security->get_csrf_hash() . '" } );};' . 'jQuery("#datatable").dataTable().fnDestroy();' . 'var oTable = $("#datatable").dataTable(tableconfig);' . '};';
$this->CI->template->add_js_ready($script);
return $html;
}
示例9: input
function input($key, $data, $view = 'default')
{
$day = $data->value == '' ? '' : date('d', strtotime($data->value));
$month = $data->value == '' ? '' : date('m', strtotime($data->value));
$year = $data->value == '' ? '' : date('Y', strtotime($data->value));
$input = "<select name='" . parent::protection($key . 'month') . "' class='month left' >";
for ($i = 1; $i <= 12; $i++) {
$input .= "<option value='{$i}' " . ($month == $i ? 'selected="selected"' : '') . ">" . lang("monnth {$i}") . "</option>";
}
$input .= '</select>';
$input .= '<input type="text" name="' . parent::protection($key . 'day') . '" value="' . $day . '" class="day left" maxlength="2" placeholder="' . lang('day') . '" aria-label="' . lang('day') . '" />';
$input .= '<input type="text" name="' . parent::protection($key . 'year') . '" value="' . $year . '" class="year left" maxlength="4" placeholder="' . lang('year') . '" aria-label="' . lang('year') . '" />';
$input .= '<script type="text/javascript">' . 'jQuery(document).ready(function(){' . 'numberEvent(jQuery("input[type=text][name=' . $key . 'day]"));' . 'numberEvent(jQuery("input[type=text][name=' . $key . 'year]"));' . '});' . 'function numberEvent(el){' . 'el.keypress(function(e) {' . 'keycode = e.keyCode ? e.keyCode : e.which;' . 'if(keycode!=8 && keycode!=9 && (keycode < 48 || keycode > 57 )) {e.preventDefault();}' . '});' . '}' . '</script>';
if ($view == 'val') {
return date_format(date_create($data->value), 'd-m-Y');
} else {
if ($view == 'value') {
return self::rowForm($data->title, '<span>' . "{$day}/{$month}/{$year}" . '</span>');
} else {
return self::rowForm($data->title, $input);
}
}
}
示例10: input
public function input($fieldKey, $fieldData)
{
$lable = preg_replace("/<.*?>/", "", $fieldData->lable);
// if( isset($fieldData->attributes) ){
//
// $fieldData->attributes = parent::attributes($fieldData->attributes);
//
// } else {
// $fieldData->attributes = '';
// }
//bug($fieldData->attributes);exit;
if (!isset($fieldData->dir) || $fieldData->dir == '') {
$fieldData->dir = 'content';
}
$wysiwygScript = 'jQuery("textarea[name=' . parent::protection($fieldKey) . ']").tinymce({imageDIR:encodeURI("' . base_url("resource/images_list?dir={$fieldData->dir}") . '")});';
if (isset($fieldData->wysiwyg) && $fieldData->wysiwyg == true) {
$this->CI->template->add_js_ready($wysiwygScript);
}
$auto_resize = isset($fieldData->auto_resize) && $fieldData->auto_resize ? 'auto-resize' : '';
$html = '<textarea id="' . parent::protection($fieldKey) . '" name="' . parent::protection($fieldKey) . '" class="field-textarea ' . $auto_resize . '" >' . $fieldData->value . '</textarea>';
//return self::rowForm($controller,$fieldKey,$input);
//$html.=parent::inputHidden($fieldKey,$fieldData->value);
return $html;
}
示例11: input
public function input($fieldKey, $fieldData)
{
$on = $fieldData->value == '1' ? 'checked="checked"' : '';
$html = '<input type="checkbox" name="' . parent::protection("{$fieldKey}") . '" value="' . $fieldData->value . '" class="switch" ' . $on . ' >';
return $html;
}
示例12: post
/**
* Fetch an item from the POST array
*
* @access public
* @param string
* @param bool
* @return string
*/
function post($index = NULL, $xss_clean = FALSE)
{
// Check if a field has been provided
if ($index === NULL and !empty($_POST)) {
$post = array();
// Loop through the full _POST array and return it
foreach (array_keys($_POST) as $key) {
$post[$key] = $this->_fetch_from_array($_POST, $key, $xss_clean);
}
return $post;
}
if (!class_exists('form')) {
$CI =& get_instance();
$CI->load->library('form');
}
$index = form::protection() ? form::protection() . $index : '';
$data = $this->_fetch_from_array($_POST, $index, $xss_clean);
return $data;
}