本文整理汇总了PHP中current_url函数的典型用法代码示例。如果您正苦于以下问题:PHP current_url函数的具体用法?PHP current_url怎么用?PHP current_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了current_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_to_ios
function send_to_ios($apnsHost, $apnsCertPath, $device_token, $data)
{
header('Content-Type: text/html; charset=UTF-8');
$deviceToken = $device_token;
/*
* $apnsHost
* development : gateway.sandbox.push.apple.com
* deployment : gateway.push.apple.com
*/
$apnsPort = 2195;
$alert = '';
if (array_key_exists('ios_alert', $data)) {
$alert = $data['ios_alert'];
}
$payload = array('aps' => array('alert' => $alert, 'badge' => 0, 'sound' => 'default'));
if (array_key_exists('ios_custom', $data)) {
$payload['ios_custom'] = $data['ios_custom'];
}
$payload = json_encode($payload);
$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCertPath);
$apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext);
if ($apns) {
$apnsMessage = chr(0) . chr(0) . chr(32) . pack('H*', str_replace(' ', '', $deviceToken)) . chr(0) . chr(strlen($payload)) . $payload;
fwrite($apns, $apnsMessage);
fclose($apns);
return TRUE;
}
//middle.error.log
MDI_Log::write('IOS_PUSH_ERROR-' . $this->input->ip_address() . '-' . $this->input->user_agent() . '-' . current_url());
return FALSE;
}
示例2: form_open
function form_open($action = '', $attributes = '', $hidden = array())
{
$ING =& get_instance();
$ING->load->helper('url');
if ($attributes == '') {
$attributes = 'method="post"';
}
// If an action is not a full URL then turn it into one
if ($action && strpos($action, '://') === FALSE) {
$action = site_url($action);
}
// If no action is provided then set to the current url
$action or $action = current_url();
$form = '<form action="' . $action . '"';
$form .= _attributes_to_string($attributes, TRUE);
$form .= '>';
// Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
if (config_item('csrf_protection') === TRUE and !(strpos($action, base_url()) === FALSE or strpos($form, 'method="get"'))) {
$hidden[$ING->security->get_csrf_token_name()] = $ING->security->get_csrf_hash();
}
if (is_array($hidden) and count($hidden) > 0) {
$form .= sprintf("<div style=\"display:none\">%s</div>", form_hidden($hidden));
}
return $form;
}
示例3: loadpageviews
public function loadpageviews($pagetoload, $cdata = NULL)
{
if (!file_exists(APPPATH . '/views/' . $pagetoload . '.php')) {
// Whoops, we don't have a page for that!
show_404();
}
$this->load->view('global/view_html_header', $cdata);
$this->load->view('global/view_session');
$this->load->view('global/view_header');
$this->passMyGlobalData();
$this->load->view('global/view_top_nav');
//$this->loadmenu();
$this->is_Home();
if (current_url() !== base_url()) {
if ($this->pagebanner === true) {
$this->load->view('view_page_banner');
}
} else {
$this->load->view('view_jumbotron');
}
$this->load->view($pagetoload);
$this->load->view('global/view_footer');
$this->load->view('global/view_sub_footer');
$this->load->view('global/view_html_footer');
}
示例4: require_login
public function require_login()
{
if (strlen($this->CI->session->userdata('Name')) == 0) {
$this->CI->session->set_flashdata('redirect_url', current_url());
redirect('login');
}
}
示例5: maintain_ssl
function maintain_ssl($maintain = FALSE, $port = 443)
{
$CI =& get_instance();
if ($maintain) {
// remove protocol
$segments = explode('://', $CI->config->config['base_url']);
// explode url into segements
$segments = explode('/', $segments[1]);
// remove port number
$domain = explode(':', $segments[0]);
// form temp base url
$temp_base_url = 'https://' . $domain[0] . ':' . $port . '/';
// replace segments
for ($i = 1; $i < sizeof($segments); $i++) {
if ($segments[$i]) {
$temp_base_url .= $segments[$i] . '/';
}
}
// Temporarily overwrite base url
$CI->config->config['base_url'] = $temp_base_url;
}
// if don't maintain but SSL is on -OR- maintain but SSL isn't on, correct by redirect
if (!$maintain && !empty($_SERVER['HTTPS']) || $maintain && empty($_SERVER['HTTPS'])) {
// Keep flashdata - Requires MY_Session keep_flashdata()
$CI->load->library('session');
$CI->session->keep_flashdata();
// Correct by redirect
$CI->load->helper('url');
header('Location: ' . current_url() . (empty($_SERVER['QUERY_STRING']) ? '' : '?' . $_SERVER['QUERY_STRING']));
}
}
示例6: getCurrentUrl
/**
* (non-PHPdoc)
*
* @see \mithra62\BackupPro\Platforms\PlatformInterface::getCurrentUrl()
*/
public function getCurrentUrl()
{
if (!function_exists('current_url')) {
ee()->load->helper('url');
}
return current_url();
}
示例7: paginacion
public function paginacion($segment = 3, $perpage = 10)
{
$config['base_url'] = current_url();
$config['uri_segment'] = $segment;
$config['num_links'] = 4;
$config['per_page'] = $perpage;
$config['full_tag_open'] = '<div class="pagination"><ul>';
$config['full_tag_close'] = '</ul></div>';
$config['first_link'] = '« Primero';
$config['first_tag_open'] = '<li class="previous">';
$config['first_tag_close'] = '</li>';
$config['last_link'] = 'Ultimo »';
$config['last_tag_open'] = '<li class="next">';
$config['last_tag_close'] = '</li>';
$config['next_link'] = '<i class="fa fa-arrow-right"></i>';
$config['next_tag_open'] = '<li class="next">';
$config['next_tag_close'] = '</li>';
$config['prev_link'] = '<i class="fa fa-arrow-left"></i>';
$config['prev_tag_open'] = '<li class="previous">';
$config['prev_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="active"><a>';
$config['cur_tag_close'] = '</a></li>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$config['anchor_class'] = '';
return $config;
}
示例8: open
/**
* Create form open
* @param array $data Data array
* @return string HTML form open
*/
public function open($data=NULL) {
$form_action = NULL;
$uri = NULL;
if (isset($this->uri)) {
$uri = $this->uri;
} else {
$uri = $data['uri'];
if (empty($uri)) {
$uri = current_url();
}
}
if (isset($this->on_success)) {
$data['form_action'] = array('form_action' => 'auto');
}
$name = isset($this->name) ? $this->name : $data['name'];
$data['name'] = $name;
$data['id'] = isset($data['id']) ? $data['id'] : $data['name'];
if (! $this->render) {
$data['id'] = 'form_'.$data['id'];
$data['id'] = str_replace('form_form_', 'form_', $data['id']);
$data['uri'] = $uri;
$this->data[] = array('open' => $data);
}
$data = $this->_sanitize_param($data);
$returns = form_open($uri, $data, $data['form_action']);
$this->returns[] = $returns;
return $returns;
}
示例9: __construct
/**
* Constructor
*/
function __construct()
{
parent::__construct();
// must be logged in
if (!$this->user) {
if (current_url() != base_url()) {
//store requested URL to session - will load once logged in
$data = array('redirect' => current_url());
$this->session->set_userdata($data);
}
redirect('login');
}
// make sure this user is setup as admin
if (!$this->user['is_admin']) {
redirect(base_url());
}
// load the admin language file
$this->lang->load('admin');
// prepare theme name
$this->settings->theme = strtolower($this->config->item('admin_theme'));
// set up global header data
$this->add_css_theme("{$this->settings->theme}.css,summernote-bs3.css")->add_js_theme("summernote.min.js")->add_js_theme("{$this->settings->theme}_i18n.js", TRUE);
// declare main template
$this->template = "../../htdocs/themes/{$this->settings->theme}/template.php";
}
示例10: setLang
function setLang($get = array())
{
$num = $get ? count($get) : 0;
$langconfig = $this->loadConfig('lang');
$this->defaultLang = $langconfig['site_frontlang'];
$this->defaultAdminLang = $langconfig['site_adminlang'];
switch ($num) {
case 0:
$this->currentLang = $this->defaultLang;
$this->langurl = '';
break;
case 1:
$langarr = $this->loadLang();
if (isset($get['lang']) && isset($langarr[$get['lang']])) {
if ($get['lang'] == $this->defaultLang) {
redirect(current_url());
} else {
$this->currentLang = $get['lang'];
$this->langurl = '?lang=' . $get['lang'];
}
} else {
show_404();
}
break;
default:
show_404();
break;
}
}
示例11: edit
function edit()
{
// Init
$data = array();
$data['breadcrumb'] = set_crumbs(array('navigations/groups' => 'Navigations', current_url() => 'Navigation Edit'));
$data['Group'] = $Group = $this->load->model('navigations_model');
$data['edit_mode'] = $edit_mode = FALSE;
$group_id = $this->uri->segment(4);
if (!empty($group_id)) {
$data['edit_mode'] = $edit_mode = TRUE;
$Group->get_by_id($group_id);
if (!$Group->exists()) {
return show_404();
}
}
$this->form_validation->set_rules('title', 'Title', 'trim|required|max_length[255]');
// Form validation
if ($this->form_validation->run() == TRUE) {
$Group->from_array($this->input->post());
$Group->save();
$this->session->set_flashdata('message', '<p class="success">Navigation Saved.<p>');
if ($edit_mode) {
redirect(ADMIN_PATH . '/navigations');
} else {
redirect(ADMIN_PATH . '/navigations/items/tree/' . $Group->id);
}
}
$this->template->view('admin/navigations/edit', $data);
}
示例12: __construct
function __construct($ThemeDirName = '')
{
parent::__construct();
$this->setThemeDirName($ThemeDirName);
$this->site_dir = $this->getConfig('siteDir');
$this->site_current_url = current_url();
}
示例13: save
function save()
{
$this->form_validation->set_rules('txtstatus', 'Text Status', 'trim|required|htmlspecialchars|xss_clean');
$url = current_url();
$user = $this->session->userdata('username');
$output['message'] = "";
$output['success'] = FALSE;
if ($this->form_validation->run() == FALSE) {
$output['message'] = validation_errors("<p class='error'>", "</p>");
} else {
$id = (string) $this->session->userdata('user_id');
$txtstatus = $this->input->post('txtstatus', TRUE);
$this->mongo_db->select_db("Social");
$this->mongo_db->select_collection("Social");
$datatinsert = array('type' => 'StateOfMind', "StateMind" => $txtstatus, "user_id" => $id, 'datetime' => $this->mongo_db->time(strtotime(date("Y-m-d H:i:s"))));
$this->mongo_db->insert($datatinsert);
$this->m_user->tulis_log("Add New Status", $url, $user);
$output['message'] = "<i class='success'>New Data is added</i>";
$output['success'] = TRUE;
}
if (IS_AJAX) {
echo json_encode($output);
} else {
redirect('member/timeline/index');
}
}
示例14: inserir
public function inserir()
{
esta_logado(TRUE);
$this->form_validation->set_rules('nome', 'NOME', 'trim|required|ucfirst');
$this->form_validation->set_rules('descricao', 'DESCRIÇÃO', 'trim');
if ($this->form_validation->run() == TRUE) {
$upload = $this->midia_model->fazer_upload('arquivo');
if (is_array($upload) && $upload['file_name'] != '') {
$dados = elements(array('nome', 'descricao'), $this->input->post());
$dados['arquivo'] = $upload['file_name'];
$this->midia_model->fazer_insert($dados);
} else {
define_msg('midiaerro', $upload, 'erro');
redirect(current_url());
}
}
//vai carregar o modulo usuarios e mostrar a tela de recuperação de senha
set_tema('footerinc', '<script>
$(document).ready(function() {
App.init();
$("#arquivo").fileinput({\'showUpload\':false, \'previewFileType\':\'any\', \'language\':\'pt-BR\',\'allowedFileExtensions\' : [\'jpg\', \'png\',\'gif\'], \'maxFileSize\': 5000,
});
});
</script>', FALSE);
set_tema('headerinc', load_css('fileinput', 'css/upload/css'), FALSE);
set_tema('headerinc', load_js(array('fileinput.min', 'fileinput_locale_pt-BR'), 'js/upload'), FALSE);
set_tema('titulo', 'Upload de Imagens');
set_tema('conteudo', load_modulo('midia', 'inserir'));
set_tema('rodape', '');
//vai substituir o rodape padrao
load_template();
}
示例15: add
function add()
{
$data['action'] = 'Add';
/* for insert page */
if ($this->form_validate() == FALSE) {
$data['error_message'] = validation_errors();
} else {
$postdata = array('page_title' => 'About Me', 'page_content' => $this->input->post('page_content'), 'published' => 1);
//echo '<pre>';print_r($postdata);die;
$table['name'] = 'dumkal_pages';
$success = $this->Common_model->save_data($table, $postdata);
if ($success) {
$this->session->set_flashdata('success_message', 'Page Content successfully inserted');
redirect('admin/manage_pages');
} else {
$this->session->set_flashdata('error_message', 'Invalid username or password! Please try again.');
redirect(current_url());
}
}
/* for insert page */
$data['head'] = $this->load->view('admin/elements/head', '', true);
$data['header'] = $this->load->view('admin/elements/header', '', true);
$data['left_sidebar'] = $this->load->view('admin/elements/left-sidebar', '', true);
$data['footer'] = $this->load->view('admin/elements/footer', '', true);
$data['maincontent'] = $this->load->view('admin/maincontents/add-edit-page-view', $data, true);
$this->load->view('admin/layout_after_login', $data);
}