本文整理汇总了PHP中uri_safe_encode函数的典型用法代码示例。如果您正苦于以下问题:PHP uri_safe_encode函数的具体用法?PHP uri_safe_encode怎么用?PHP uri_safe_encode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uri_safe_encode函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list_items
function list_items($limit = null, $offset = 0, $col = 'name', $order = 'asc')
{
$CI =& get_instance();
$CI->load->helper('array');
$CI->load->helper('convert');
if (!isset($this->filters['group_id'])) {
return array();
}
$group_id = $this->filters['group_id'];
// not encoded yet... then decode
if (!$this->_encoded) {
$this->filters['group_id'] = uri_safe_encode($group_id);
// to pass the current folder
$this->_encoded = TRUE;
} else {
$group_id = uri_safe_decode($group_id);
}
$asset_dir = $this->get_dir($group_id);
$assets_path = $CI->asset->assets_server_path . $asset_dir . DIRECTORY_SEPARATOR;
$tmpfiles = directory_to_array($assets_path, TRUE, $CI->config->item('assets_excluded_dirs', 'fuel'), FALSE);
$files = get_dir_file_info($assets_path, TRUE);
$cnt = count($tmpfiles);
$return = array();
$asset_type_path = WEB_PATH . $CI->config->item('assets_path') . $asset_dir . '/';
//for ($i = $offset; $i < $cnt - 1; $i++)
for ($i = 0; $i < $cnt; $i++) {
if (!empty($tmpfiles[$i]) && !empty($files[$tmpfiles[$i]])) {
$key = $tmpfiles[$i];
if (empty($this->filters['name']) || !empty($this->filters['name']) && (strpos($files[$key]['name'], $this->filters['name']) !== FALSE || strpos($key, $this->filters['name']) !== FALSE)) {
$file['id'] = uri_safe_encode(assets_server_to_web_path($files[$tmpfiles[$i]]['server_path'], TRUE));
//$file['filename'] = $files[$key]['name'];
$file['name'] = $key;
$file['preview/kb'] = $files[$key]['size'];
$file['link'] = NULL;
$file['last_updated'] = english_date($files[$key]['date'], true);
$return[] = $file;
}
}
}
$return = array_sorter($return, $col, $order, TRUE);
// do a check for empty limit values to prevent issues found where an empty $limit value would return nothing in 5.16
$return = empty($limit) ? array_slice($return, $offset) : array_slice($return, $offset, $limit);
// after sorting add the images
foreach ($return as $key => $val) {
if (is_image_file($return[$key]['name'])) {
$return[$key]['preview/kb'] = $return[$key]['preview/kb'] . ' kb <div class="img_crop"><a href="' . $asset_type_path . $return[$key]['name'] . '" target="_blank"><img src="' . $asset_type_path . $return[$key]['name'] . '" border="0"></a></div>';
$return[$key]['link'] = '<a href="' . $asset_type_path . $return[$key]['name'] . '" target="_blank">' . $asset_dir . '/' . $return[$key]['name'] . '</a>';
} else {
$return[$key]['preview/kb'] = $return[$key]['preview/kb'];
$return[$key]['link'] = '<a href="' . $asset_type_path . $return[$key]['name'] . '" target="_blank">' . $asset_dir . '/' . $return[$key]['name'] . '</a>';
}
}
return $return;
}
示例2: _check_login
protected function _check_login()
{
// load this after the the above because it needs a database connection. Avoids a database connection error if there isn't one'
$this->load->module_library(FUEL_FOLDER, 'fuel_auth');
// check if logged in
if (!$this->fuel_auth->is_logged_in() or !is_fuelified()) {
$login = $this->config->item('fuel_path', 'fuel') . 'login';
$cookie = array('name' => $this->fuel_auth->get_fuel_trigger_cookie_name(), 'path' => WEB_PATH);
delete_cookie($cookie);
if (!is_ajax()) {
redirect($login . '/' . uri_safe_encode($this->uri->uri_string()));
} else {
$output = "<script type=\"text/javascript\" charset=\"utf-8\">\n";
$output .= "top.window.location = '" . site_url($login) . "'\n";
$output .= "</script>\n";
$this->output->set_output($output);
return;
}
}
}
示例3: dev_password
public function dev_password()
{
if (!USE_FUEL_ROUTES) {
$CI =& get_instance();
$CI->load->helper('convert');
// Offline maintenance page not required password
if (preg_match('#^offline(/?)$#', uri_path(FALSE))) {
return;
}
if ($CI->fuel->config('dev_password') and !$CI->fuel->auth->is_logged_in() and !preg_match('#^' . fuel_uri('login') . '#', uri_path(FALSE))) {
if (isset($_POST['fuel_dev_password']) and $_POST['fuel_dev_password'] == md5($CI->fuel->config('dev_password'))) {
return;
}
$CI->load->library('session');
if (!$CI->session->userdata('dev_password')) {
$forward = uri_safe_encode(uri_string());
redirect(FUEL_ROUTE . 'login/dev/' . $forward);
//to respect your MY_Fuel $config['fuel_path']
}
}
}
}
示例4: lang
" title="<?php
echo lang('inline_edit_logout_title');
?>
"><?php
echo lang('inline_edit_logout');
?>
</a></li>
<?php
} else {
$uri = uri_string();
if ($uri == '') {
$uri = 'home';
}
?>
<li class="txt"><a href="<?php
echo fuel_url('login/' . uri_safe_encode($uri));
?>
" title="<?php
echo lang('inline_edit_login_title');
?>
"><?php
echo lang('inline_edit_login');
?>
</a></li>
<?php
}
?>
<?php
示例5: uri_safe_batch_encode
/**
* Encode a key/value array or string into a URI safe value
*
* @access public
* @param string string to be converted
* @param boolean value is hexified
* @return string
*/
function uri_safe_batch_encode($uri, $delimiter = '|', $hexify = TRUE)
{
$str = '';
if (!empty($uri)) {
if (is_string($uri)) {
$arr = explode('/', $uri);
foreach ($arr as $val) {
$uri[$val] = next($arr);
}
}
foreach ($uri as $key => $val) {
if (!is_string($val)) {
$val = '??' . serialize($val);
}
$str .= $key . '/' . $val . $delimiter;
}
return uri_safe_encode($str, $hexify);
}
return $str;
}
示例6: fuelify
/**
* Renders the inline editing markers before final output
*
* @access public
* @param string The output to be rendered
* @return string
*/
public function fuelify($output)
{
// if not logged in then we remove the markers
if (!$this->fuel->config('admin_enabled') or $this->variables('fuelified') === FALSE or !$this->_fuelified or empty($output) or defined('FUELIFY') and FUELIFY === FALSE) {
return $this->remove_markers($output);
}
$this->CI->load->helper('convert');
// add top edit bar for fuel
$this->CI->config->module_load('fuel', 'fuel', TRUE);
// render the markers to the proper html
$output = $this->render_all_markers($output);
// set main image and assets path before switching to fuel assets path
$vars['init_params'] = array('assetsImgPath' => img_path(''), 'assetsPath' => assets_path(''));
$orig_asset_path = $this->CI->asset->assets_path;
$this->CI->asset->assets_path = $this->fuel->config('fuel_assets_path');
$this->CI->load->helper('ajax');
$this->CI->load->library('form');
$last_page = uri_path();
if (empty($last_page)) {
$last_page = $this->fuel->config('default_home_view');
}
$vars['last_page'] = uri_safe_encode($last_page);
if (!$this->_fuelified_processed) {
// create the inline edit toolbar
$inline_edit_bar = $this->fuel->admin->toolbar();
$fuel_js_obj = "<script>if (typeof fuel == 'undefined') fuel = {}</script>\n";
$inline_css = css('fuel_inline', 'fuel', array('output' => $this->fuel->config('fuel_assets_output')));
$output = preg_replace('#(</head>)#i', $fuel_js_obj . $inline_css . "\n\$1", $output);
$output = preg_replace('#(</body>)#i', $inline_edit_bar . "\n\$1", $output);
$this->CI->config->set_item('assets_path', $this->CI->config->item('assets_path'));
}
$this->_fuelified_processed = TRUE;
$this->CI->asset->assets_path = $orig_asset_path;
return $output;
}
示例7: _form
public function _form($field_values = NULL, $inline = FALSE)
{
$this->load->library('form_builder');
$this->load->helper('convert');
$model = $this->model;
$this->js_controller_params['method'] = 'add_edit';
$fields = $this->model->form_fields();
$fields['redirect_to'] = array('type' => 'hidden', 'value' => uri_safe_encode($this->input->get_post('redirect_to')));
$not_hidden = array();
if (!empty($field_values['hide_options']) and is_true_val($field_values['hide_options'])) {
$not_hidden = array('userfile');
} else {
if (!empty($field_values['hide_image_options']) and is_true_val($field_values['hide_image_options'])) {
$not_hidden = array('userfile', 'asset_folder', 'subfolder', 'userfile_file_name', 'overwrite', 'unzip');
}
}
if (!empty($field_values['accept'])) {
$fields['userfile']['accept'] = $field_values['accept'];
}
if (isset($field_values['multiple'])) {
if ((bool) $field_values['multiple'] === FALSE) {
$fields['userfile']['class'] = '';
} else {
// if their are multiple files being uploaded, the new file name won't really work
unset($fields['user_file_name']);
}
}
// hide certain fields if params were passed
if (!empty($not_hidden)) {
foreach ($fields as $key => $field) {
if (!in_array($key, $not_hidden)) {
$fields[$key]['type'] = 'hidden';
}
}
}
if ($this->session->flashdata('uploaded_post')) {
$field_values = $this->session->flashdata('uploaded_post');
}
// load custom fields
$this->form_builder->load_custom_fields(APPPATH . 'config/custom_fields.php');
$this->form_builder->submit_value = lang('btn_upload');
$this->form_builder->use_form_tag = FALSE;
$this->form_builder->set_fields($fields);
$this->form_builder->display_errors = FALSE;
$this->form_builder->set_field_values($field_values);
/* NOT QUITE WORKING DUE TO CANCEL BUTTON */
// if ($this->input->get_post('redirect_to'))
// {
// $this->form_builder->other_actions = $this->form->button('Back', 'back', 'style="margin: 10px 10px 0 0; float: left;" data-url="'.site_url($this->input->get_post('redirect_to')).'"');
// }
$vars['form'] = $this->form_builder->render();
// other variables
$vars['id'] = !empty($field_values['asset_folder']) ? uri_safe_encode($field_values['asset_folder']) : NULL;
$vars['data'] = array();
$vars['action'] = 'create';
// $preview_key = preg_replace('#^(.*)\{(.+)\}(.*)$#', "\\2", $this->preview_path);
// if (!empty($vars['data'][$preview_key])) $this->preview_path = preg_replace('#^(.*)\{(.+)\}(.*)$#e', "'\\1'.\$vars['data']['\\2'].'\\3'", $this->preview_path);
// active or publish fields
//$vars['publish'] = (!empty($saved['published']) && ($saved['published'] == 'yes')) ? 'Unpublish' : 'Publish';
$vars['module'] = $this->module;
$vars['actions'] = $this->load->view('_blocks/module_create_edit_actions', $vars, TRUE);
$vars['notifications'] = $this->load->view('_blocks/notifications', $vars, TRUE);
// setup query string
$query_str = query_str();
if ($inline === TRUE) {
$vars['form_action'] = $this->module_uri . '/inline_create/' . $vars['id'] . $query_str;
} else {
$vars['form_action'] = $this->module_uri . '/create/' . $vars['id'] . $query_str;
}
return $vars;
}
示例8: uri_safe_encode
// console.log($(this).data('itemid'));
// console.log($(this).data('action'));
// do_action($(this).data('itemid'),$(this).data('action'));
var thisId = $(this).data('itemid');
var thisPicPath = $(this).data('picpath');
var postData = {//"plan_id": $("#plan_id").val(),
"item_id": $(this).data('itemid'),
"action_code": $(this).data('action'),
"start" : '<?php
echo uri_safe_encode($event->start_date);
?>
',
"deadline" : '<?php
echo uri_safe_encode($event->deadline);
?>
'
};
// console.log(postData);
var span = $(this).find("span:last-child");
$.ajax({
url: '<?php
echo $do_action_url;
?>
',
type: 'POST',
示例9: fuelify
function fuelify($output)
{
// if not logged in then we remove the markers
if (!$this->_CI->config->item('admin_enabled', 'fuel') OR $this->variables('fuelified') === FALSE OR
!$this->_fuelified OR empty($output) OR (defined('FUELIFY') AND FUELIFY === FALSE))
{
return $this->remove_markers($output);
}
$this->_CI->load->library('session');
$this->_CI->load->helper('convert');
// add top edit bar for fuel
$this->_CI->config->module_load('fuel', 'fuel', TRUE);
// render the markers to the proper html
$output = $this->render_all_markers($output);
// set main image and assets path before switching to fuel assets path
$vars['init_params'] = array(
'assetsImgPath' => img_path(''),
'assetsPath' => assets_path(''),
);
$this->_CI->asset->assets_path = $this->_CI->config->item('fuel_assets_path', 'fuel');
$this->_CI->load->helper('ajax');
$this->_CI->load->library('form');
$vars['page'] = $this->properties();
$vars['layouts'] = $this->_CI->fuel_layouts->layouts_list(TRUE);
$last_page = uri_path();
if (empty($last_page)) $last_page = $this->_CI->config->item('default_home_view', 'fuel');
$vars['last_page'] = uri_safe_encode($last_page);
$editable_asset_types = $this->_CI->config->item('editable_asset_filetypes', 'fuel');
// add javascript
$vars['init_params']['pageId'] = (!empty($vars['page']['id']) ? $vars['page']['id'] : 0);
$vars['init_params']['basePath'] = WEB_PATH;
$vars['init_params']['imgPath'] = img_path('', 'fuel');
$vars['init_params']['cssPath'] = css_path('', 'fuel');
$vars['init_params']['jsPath'] = js_path('', 'fuel');
$vars['init_params']['editor'] = $this->_CI->config->item('text_editor', 'fuel');
$vars['init_params']['editorConfig'] = $this->_CI->config->item('ck_editor_settings', 'fuel');
// load language files
$this->_CI->load->module_language(FUEL_FOLDER, 'fuel_inline_edit');
$this->_CI->load->module_language(FUEL_FOLDER, 'fuel_js');
// json localization
$vars['js_localized'] = json_lang('fuel/fuel_js');
$vars['assetsAccept']['assetsAccept'] = (!empty($editable_asset_types['media']) ? $editable_asset_types['media'] : 'jpg|gif|png');
// database specific... so we must check the fuel mode to see if we actually need to make a call to the database.
// otherwise we get an error when the mode is set to views
if ($this->_CI->config->item('fuel_mode', 'fuel') == 'views')
{
$vars['others'] = array();
}
else
{
$this->_CI->load->module_model(FUEL_FOLDER, 'pages_model');
$vars['others'] = $this->_CI->pages_model->get_others('location', $this->location, 'location');
}
if (!$this->_fuelified_processed)
{
$inline_edit_bar = $this->_CI->load->module_view(FUEL_FOLDER, '_blocks/inline_edit_bar', $vars, TRUE);
$output = preg_replace('#(</head>)#i', css('fuel_inline', 'fuel')."\n$1", $output);
$output = preg_replace('#(</body>)#i', $inline_edit_bar."\n$1", $output);
$this->_CI->config->set_item('assets_path', $this->_CI->config->item('assets_path'));
}
$this->_fuelified_processed = TRUE;
return $output;
}
示例10: toolbar
/**
* Returns the inline editing toolbar HTML
*
* @access public
* @return void
*/
public function toolbar()
{
$user_lang = $this->fuel->auth->user_lang();
$this->fuel->load_language('fuel_inline_edit', $user_lang);
$this->fuel->load_language('fuel_js', $user_lang);
$vars['page'] = $this->fuel->page->properties();
$vars['layouts'] = $this->fuel->layouts->options_list();
$vars['language'] = $this->fuel->language->detect();
$vars['language_mode'] = $this->fuel->language->mode();
$vars['language_default'] = $this->fuel->language->default_option();
$vars['tools'] = $this->toolbar_tools();
$vars['js_localized'] = json_lang('fuel/fuel_js', $user_lang);
$vars['is_fuelified'] = is_fuelified();
$vars['can_edit_pages'] = $this->CI->fuel->auth->has_permission('pages', 'edit');
if ($this->fuel->pages->mode() == 'views') {
$vars['others'] = array();
} else {
$location = uri_path();
$this->CI->load->module_model(FUEL_FOLDER, 'fuel_pages_model');
$vars['others'] = $this->CI->fuel_pages_model->get_others('location', $location, 'location');
}
$vars['init_params']['pageId'] = !empty($vars['page']['id']) ? $vars['page']['id'] : 0;
$vars['init_params']['pageLocation'] = !empty($vars['page']['location']) ? $vars['page']['location'] : uri_path();
$vars['init_params']['basePath'] = WEB_PATH;
$vars['init_params']['cookiePath'] = $this->CI->fuel->config('fuel_cookie_path');
$vars['init_params']['imgPath'] = img_path('', 'fuel');
$vars['init_params']['cssPath'] = css_path('', 'fuel');
$vars['init_params']['jsPath'] = js_path('', 'fuel');
$vars['init_params']['editor'] = $this->fuel->config('text_editor');
$vars['init_params']['editorConfig'] = $this->fuel->config('ck_editor_settings');
$last_page = uri_path();
if (empty($last_page)) {
$last_page = $this->fuel->config('default_home_view');
}
$vars['last_page'] = uri_safe_encode($last_page);
$output = $this->CI->load->module_view(FUEL_FOLDER, '_blocks/inline_edit_bar', $vars, TRUE);
return $output;
}
示例11: _check_login
protected function _check_login()
{
// set no cache headers to prevent back button problems in FF
$this->_no_cache();
// load this after the the above because it needs a database connection. Avoids a database connection error if there isn't one'
$this->load->module_library(FUEL_FOLDER, 'fuel_auth');
// check if logged in
if (!$this->fuel_auth->is_logged_in() OR !is_fuelified())
{
$login = $this->config->item('fuel_path', 'fuel').'login';
// logout officially to unset the cookie data
$this->fuel_auth->logout();
if (!is_ajax())
{
redirect($login.'/'.uri_safe_encode($this->uri->uri_string()));
}
else
{
$output = "<script type=\"text/javascript\" charset=\"utf-8\">\n";
$output .= "top.window.location = '".site_url($login)."'\n";
$output .= "</script>\n";
$this->output->set_output($output);
return;
}
}
}