本文整理汇总了PHP中currentUrl函数的典型用法代码示例。如果您正苦于以下问题:PHP currentUrl函数的具体用法?PHP currentUrl怎么用?PHP currentUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了currentUrl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkAuth
function checkAuth($redirectIfNeeded)
{
// is the user already logged in?
if (isset($_SESSION["uid"]) && $_SESSION["uid"] != "") {
// yes, already logged in
return $_SESSION["uid"];
} else {
if ($redirectIfNeeded) {
// user is not logged in and needs to do so
// send to the login page
// pass the current URL so that we can come back here after login
$currentUrl = currentUrl();
// rawurlencode converts the string so it's safe to pass as a URL GET parameter
$urlOfLogin = "login.php?sendBackTo=" . rawurlencode($currentUrl) . "&cb=" . microtime(true);
// use a JavaScript redirect; FYI, there's also an http header (Location:) that
// can be used to redirect, but that MUST be sent before any HTML, and this
// function (checkAuth) might be called after some HTML is sent
echo "<script>location.replace('{$urlOfLogin}');</script>";
return "";
} else {
// user is not logged in, but whoever called this function doesn't care
return "";
}
}
}
示例2: indexAct
public function indexAct()
{
$id = I('get.id');
$info = D('activity')->where(array('id' => $id))->find();
$this->assign('info', $info);
$this->assign('inviteurl', currentUrl());
$this->display();
}
示例3: currentPage
function currentPage()
{
$currentPage = end(explode('/', currentUrl()));
$currentPage = str_replace('.php', '', $currentPage);
$currentPage = preg_replace('/\\?.*/', '', $currentPage);
if (empty($currentPage) || $currentPage === 'home') {
$currentPage = 'home';
}
return $currentPage;
}
示例4: __construct
public function __construct()
{
parent::__construct();
$this->ogType = 'website';
$this->ogUrl = currentUrl();
$this->ogTitle = appName();
$this->ogDescription = appDescription();
$this->ogImage = appLogo();
$this->ogSiteName = appName();
$this->ogLocale = currentFullLocaleCode();
$this->ogLocaleAlternate = allSupportedFullLocaleCodes();
}
示例5: redirect
/**
* Digunakan untuk pengalihan halaman (URL)
*
* @param string $url URL Tujuan
* @return void
*/
function redirect($url = '', $delay = false)
{
if (PHP_SAPI != 'cli') {
$url = strpos('?', $url) === 1 ? currentUrl($url) : siteUrl($url);
if ($delay !== false) {
header("refresh: {$delay}; url={$url}");
} else {
header("Location: " . $url);
}
unset($_POST, $_GET, $_REQUEST);
exit;
}
return;
}
示例6: _session_openid
protected function _session_openid()
{
$wechatObj = wechatInstance();
if ($_GET['code']) {
$result = $wechatObj->getOauthAccessToken();
$userInfo = $wechatObj->getUserInfo($result['openid']);
$this->_saveUserInfo($userInfo);
session('openid', $result['openid']);
} else {
//$callBackUrl = __BASE__.substr(UC(MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME),1);
$callBackUrl = currentUrl();
$url = $wechatObj->getOauthRedirect($callBackUrl, '', 'snsapi_base');
redirect($url);
}
}
示例7: anchor
/**
* Setup Anchor tag
*
* @param mixed $url Path or Permalink
* @param string $label Text label
* @return string
*/
function anchor($url, $label = '', array $extras = [])
{
if (is_array($url) and $label == '') {
$attrs = $url;
$label = $attrs['label'];
unset($attrs['label']);
} else {
$attrs = ['href' => $url];
}
$attrs = array_merge($extras, $attrs);
if ($attrs['href'] == '' || substr($attrs['href'], 0, 2) != '//') {
$attrs['href'] = siteUrl($attrs['href']);
} elseif (strpos('?', $attrs['href']) === 1) {
$attrs['href'] = currentUrl($attrs['href'], true);
}
if (!isset($attrs['class']) or isset($attrs['class']) and strpos($attrs['class'], 'btn') === false) {
$attrs['tabindex'] = '-1';
}
return '<a ' . parseAttrs($attrs) . '>' . $label . '</a>';
}
示例8: current
public function current(string $fix = NULL) : string
{
return currentUrl($fix);
}
示例9: define
//--------------------------------------------------------------------------------------------------
// SITE_URL
//--------------------------------------------------------------------------------------------------
//
// @return example.com/zeroneed.php
//
//--------------------------------------------------------------------------------------------------
define('SITE_URL', siteUrl());
//--------------------------------------------------------------------------------------------------
// CURRENT_URL
//--------------------------------------------------------------------------------------------------
//
// @return example.com/aktive
//
//--------------------------------------------------------------------------------------------------
define('CURRENT_URL', currentUrl());
//--------------------------------------------------------------------------------------------------
// PREV_URL
//--------------------------------------------------------------------------------------------------
//
// @return example.com/prev
//
//--------------------------------------------------------------------------------------------------
define('PREV_URL', prevUrl());
//--------------------------------------------------------------------------------------------------
// HOST_URL
//--------------------------------------------------------------------------------------------------
//
// @return hostname
//
//--------------------------------------------------------------------------------------------------
示例10: header
if (!isset($context)) {
header('Location: ' . $link['kb'] . '?code=' . $errorCode['FORUM_INTEGRATION']);
}
//Load other classes and database login info
require_once $link['root'] . 'classes/Format.php';
require_once $link['root'] . 'classes/Validation.php';
require_once $link['root'] . 'setting.php';
require_once $link['root'] . 'classes/Help.php';
//Gets website setting !DO NOT REMOVE IT!
$setting = getSetting();
//Save current page url into session for login/logout redirect............ well it does not work anyway! could be a SMF Bug.
if (!strpos(currentUrl(), 'login') && !strpos(currentUrl(), 'logout') && !strpos(currentUrl(), 'includes') && !strpos(currentUrl(), 'styles') && !strpos(currentUrl(), 'img') && !strpos(currentUrl(), 'kb')) {
$_SESSION['login_url'] = currentUrl();
$_SESSION['logout_url'] = currentUrl();
$_SESSION['old_url'] = currentUrl();
$_SESSION['redirect'] = currentUrl();
}
$_SESSION['previous_page'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $link['url'];
// var_dump($_SESSION['redirect']);
//Get user avatar or use the default avatar
$user_avatar = $context['user']['avatar'] != null ? $context['user']['avatar']['href'] : $link['url'] . 'img/usersmall.jpg';
//Get the musicbee satble and beta release data
$releaseData['stable'] = getVersionInfo(0, 'byCurrentVersion')[0];
$releaseData['beta'] = getVersionInfo(1, 'byCurrentVersion')[0];
//Contains EVERYTHING in single multidimensional array! DO NOT REMOVE IT!
$mb = array('website' => array('ver' => '1.9.0', 'show_warning' => false, 'is_test' => false, 'github_link' => 'https://github.com/Avik-B/mb_web/'), 'charset' => 'UTF-8', 'user' => array('id' => $context['user']['id'], 'is_logged' => $context['user']['is_logged'], 'is_guest' => $context['user']['is_guest'], 'is_admin' => $context['user']['is_admin'], 'is_mod' => $context['user']['is_mod'], 'is_elite' => false, 'is_newbie' => false, 'rank_name' => null, 'need_approval' => true, 'can_mod' => $context['user']['can_mod'], 'username' => $context['user']['name'], 'email' => $context['user']['email'], 'name' => $context['user']['name'], 'messages' => $context['user']['messages'], 'unread_messages' => $context['user']['unread_messages'], 'avatar' => $user_avatar), 'session_var' => $context['session_var'], 'session_id' => $context['session_id'], 'current_time' => array('date' => date("F j, Y"), 'date_time' => date("F j, Y, g:i a")), 'main_menu' => array('dashboard' => array('title' => $lang['dashboard'], 'href' => $link['addon']['dashboard'], 'restriction' => 'login', 'sub_menu' => array()), 'member-panel' => array('title' => '<img src="' . $user_avatar . '" class="user_avatar">', 'href' => $link['forum'] . '?action=profile', 'restriction' => 'login', 'sub_menu' => array('user-profile' => array('title' => '' . sprintf($lang['hey_username'], $context['user']['name']) . '', 'href' => $link['forum'] . '?action=profile'), 'line1' => array('title' => $lang['line']), 'admin-panel' => array('title' => $lang['web_admin'], 'href' => $link['addon']['dashboard'] . '#admin_setting', 'icon' => $lang['20'], 'restriction' => 'admin'), 'forum-admin' => array('title' => $lang['forum_admin'], 'href' => $link['admin']['forum-panel'], 'icon' => $lang['21'], 'restriction' => 'admin'), 'line2' => array('title' => $lang['line']), 'sign-out' => array('title' => $lang['sign_out'], 'href' => $link['logout'], 'icon' => $lang['23']))), 'download' => array('title' => $lang['download'], 'href' => $link['download'], 'sub_menu' => array()), 'add-ons' => array('title' => $lang['addons'], 'href' => $link['addon']['home'], 'sub_menu' => array('1' => array('title' => $lang['skins'], 'href' => $link['addon']['home'] . "s/?type=1", 'icon' => $lang['24'], 'desc' => $lang['description_1'], 'id' => 1), '2' => array('title' => $lang['plugins'], 'href' => $link['addon']['home'] . "s/?type=2", 'icon' => $lang['25'], 'desc' => $lang['description_2'], 'id' => 2), '3' => array('title' => $lang['visualizer'], 'href' => $link['addon']['home'] . "s/?type=3", 'icon' => $lang['26'], 'desc' => $lang['description_3'], 'id' => 3), '4' => array('title' => $lang['theater_mode'], 'href' => $link['addon']['home'] . "s/?type=4", 'icon' => $lang['28'], 'desc' => $lang['description_5'], 'id' => 4), '5' => array('title' => $lang['misc'], 'href' => $link['addon']['home'] . "s/?type=5", 'icon' => $lang['29'], 'desc' => $lang['description_6'], 'id' => 5))), 'forum' => array('title' => $lang['forum'], 'href' => $link['forum'], 'sub_menu' => array()), 'help' => array('title' => $lang['help'], 'href' => $link['faq'], 'sub_menu' => array('faq' => array('title' => $lang['faq'], 'href' => $link['faq'], 'icon' => $lang['faq_icon']), 'api' => array('title' => $lang['dev_api'], 'href' => $link['api'], 'icon' => $lang['code_icon']), 'line2' => array('title' => $lang['line']), 'release-note' => array('title' => $lang['release-note'], 'href' => $link['release-note'], 'icon' => $lang['note_icon']), 'press' => array('title' => $lang['press'], 'href' => $link['press'], 'icon' => $lang['press_icon']), 'line3' => array('title' => $lang['line']), 'bug' => array('title' => $lang['report_bug'], 'href' => $link['bugreport'], 'icon' => $lang['bug_icon'], 'hide' => true), 'wiki' => array('title' => $lang['mb_wiki'], 'href' => $setting['wikiaLink'], 'icon' => $lang['wiki_icon'], 'target' => '_blank', 'hide' => true)))), 'musicbee_download' => array('stable' => array('appname' => isset($releaseData['stable']['appname']) ? $releaseData['stable']['appname'] : "NA", 'version' => isset($releaseData['stable']['version']) ? $releaseData['stable']['version'] : "NA", 'release_date' => isset($releaseData['stable']['release_date']) ? $releaseData['stable']['release_date'] : "NA", 'supported_os' => isset($releaseData['stable']['supported_os']) ? $releaseData['stable']['supported_os'] : "NA", 'download' => array('available' => isset($releaseData['stable']['available']) ? $releaseData['stable']['available'] : 0, 'installer' => array('link1' => isset($releaseData['stable']['DownloadLink']) ? $releaseData['stable']['DownloadLink'] : "NA", 'link2' => isset($releaseData['stable']['MirrorLink1']) ? $releaseData['stable']['MirrorLink1'] : null, 'link3' => isset($releaseData['stable']['MirrorLink2']) ? $releaseData['stable']['MirrorLink2'] : null), 'portable' => array('link1' => isset($releaseData['stable']['PortableLink']) ? $releaseData['stable']['PortableLink'] : "NA"))), 'beta' => array('appname' => isset($releaseData['beta']['appname']) ? $releaseData['beta']['appname'] : "NA", 'version' => isset($releaseData['beta']['version']) ? $releaseData['beta']['version'] : "NA", 'release_date' => isset($releaseData['beta']['release_date']) ? $releaseData['beta']['release_date'] : "NA", 'supported_os' => isset($releaseData['beta']['supported_os']) ? $releaseData['beta']['supported_os'] : "NA", 'download' => array('available' => isset($releaseData['beta']['available']) ? $releaseData['beta']['available'] : 0, 'link1' => isset($releaseData['beta']['DownloadLink']) ? $releaseData['beta']['DownloadLink'] : "NA"), 'message' => isset($releaseData['beta']['message']) ? $releaseData['beta']['message'] : null), 'patch' => getVersionInfo(2, 'byCurrentVersion')[0]), 'help' => Help::getHelp(), 'view_range' => array('addon_view_range' => 20, 'dashboard_all_view_range' => 20, 'release_all_view_range' => 20));
//var_dump($mb['musicbee_download']);
/**
* Maybe we don't wan't anyone except admin to see this, show error to anyone else. Or maybe
* this is only available for logged in users. No guest is allowed kicked them to error page
*/
示例11: createLink
public static function createLink()
{
self::$totalPages = ceil(self::$numberOfRows / self::$resultPerPage);
$halfPages = floor(self::$numberOfPages / 2);
$range = ['Start' => 1, 'End' => self::$totalPages];
$isEven = self::$numberOfPages % 2 == 0;
$atRangeEnd = self::$totalPages - $halfPages;
$parseUrl = parse_url(currentUrl());
$url = $parseUrl['scheme'] . "://" . $parseUrl['host'] . $parseUrl['path'];
unset($_GET['page']);
if (count($_GET) > 0) {
$url .= '?' . http_build_query($_GET);
}
$query = parse_url($url, PHP_URL_QUERY);
if ($query) {
$url = $url . '&page=';
} else {
$url = $url . '?page=';
}
if ($isEven) {
$atRangeEnd++;
}
if (self::$totalPages > self::$numberOfPages) {
if (self::$page <= $halfPages) {
$range['End'] = self::$numberOfPages;
} else {
if (self::$page >= $atRangeEnd) {
$range['Start'] = self::$totalPages - self::$numberOfPages + 1;
} else {
$range['Start'] = self::$page - $halfPages;
$range['End'] = self::$page + $halfPages;
if ($isEven) {
$range['End']--;
}
}
}
}
$result = self::$fullTagOpen . PHP_EOL;
if (!empty(self::$firstLabel) && self::$page > 1) {
$result .= self::$tagOpen . '<a href="' . $url . '1">' . self::$firstLabel . '</a>' . self::$tagClose . PHP_EOL;
}
if (!empty(self::$prevLabel) && self::$page > 1) {
$result .= self::$tagOpen . '<a href="' . $url . (self::$page - 1) . '">' . self::$prevLabel . '</a>' . self::$tagClose . PHP_EOL;
}
if (self::$usePageNumber) {
for ($i = $range['Start']; $i <= $range['End']; $i++) {
if ($i == self::$page) {
$result .= self::$tagOpen . self::$activeTagOpen . $i . self::$activeTagClose . self::$tagClose . PHP_EOL;
} else {
$result .= self::$tagOpen . '<a href="' . $url . $i . '">' . $i . '</a>' . self::$tagClose . PHP_EOL;
}
}
}
if (!empty(self::$nextLabel) && self::$page < self::$totalPages) {
$result .= self::$tagOpen . '<a href="' . $url . (self::$page + 1) . '">' . self::$nextLabel . '</a>' . self::$tagClose . PHP_EOL;
}
if (!empty(self::$lastLabel) && self::$page < self::$totalPages) {
$result .= self::$tagOpen . '<a href="' . $url . self::$totalPages . '">' . self::$lastLabel . '</a>' . self::$tagClose . PHP_EOL;
}
$result .= self::$fullTagClose;
return $result;
}
示例12: includeTargetUrl
private function includeTargetUrl($targetUrl, $queueUrl)
{
$queueUrl = preg_replace("/(&?t=[^&]*&?)/i", "", $queueUrl);
if ($targetUrl == null) {
$targetUrl = $this->defaultIncludeTargetUrl;
}
if (is_bool($targetUrl) && $targetUrl == true) {
$targetUrl = currentUrl();
}
if (is_bool($targetUrl) && $targetUrl == false) {
return $queueUrl;
}
if (!strpos($queueUrl, '?')) {
return $queueUrl . '?t=' . urlencode($targetUrl);
}
return $queueUrl . '&t=' . urlencode($targetUrl);
}
示例13: run
//.........这里部分代码省略.........
height:23px;
padding: 2px;
white-space: nowrap;
overflow: hidden;
color:<?php
echo $settings['textColor'];
?>
;
text-align:center;
padding-top:12px;
}
.terminal .commands
{
padding: 2px;
padding-right: 0;
}
.terminal #command
{
width: 90%;
outline:none;
border:none;
}
</style>
<div class="content">
<div class="terminal" onclick="document.getElementById('command').focus();" id="terminal">
<div class="bar">
<?php
echo 'ZN Framework Terminal Application ';
?>
</div>
<form action="<?php
echo currentUrl();
?>
" method="post" class="commands" id="commands">
<?php
if (!empty($_SESSION['commands'])) {
?>
<div>
<?php
foreach ($_SESSION['commands'] as $index => $command) {
?>
<pre><?php
echo $terminalType . ' > ', $command, "\n";
?>
</pre>
<?php
foreach ($_SESSION['commandResponses'][$index] as $value) {
?>
<pre><?php
echo htmlentities($value), "\n";
?>
</pre>
<?php
}
?>
<?php
}
?>
</div>
<?php
示例14: unsubscribe
function unsubscribe()
{
global $wpdb;
if ($_GET['action'] == 'unsubscribe') {
?>
<div id="unsubscribe">
<form action="<?php
echo currentUrl();
?>
" method="get">
<p><?php
_e('Enter your email bellow');
?>
</p>
<p><input size="10" type="text" name="unsub_email" /></p>
<p>
<input type="submit" value="Unsubscribe" />
<input type="hidden" value="yes" name="unsub" />
</p>
</form>
</div>
<?php
}
?>
<?php
if (isset($_GET['unsub_email']) && $_GET['unsub'] == 'yes') {
?>
<?php
$queryResult = $wpdb->query($wpdb->prepare("UPDATE epicwin_feed SET opt_in=0 WHERE email='" . $_GET['unsub_email'] . "'"));
if ($queryResult > 0) {
?>
<div id="unsubscribe">
<p><?php
_e('You have been removed form our mailing list. If you would like to join the mailing list in the future, just fill in the subscribe box again');
?>
.</p>
<a href="#" class="close" onclick="document.getElementById('unsubscribe').style.visibility='hidden'">Close</a>
</div>
<?php
} else {
?>
<div id="unsubscribe">
<p><?php
_e('You have either already unsubscribed or we could not find your email in our recrods');
?>
.</p>
<a href="#" class="close" onclick="document.getElementById('unsubscribe').style.visibility='hidden'">Close</a>
</div>
<?php
}
}
}
示例15: defined
<?php
defined('ROOT') or die('Not allowed!');
require ADMIN_SIDEBAR;
?>
<div id="main-contents">
<form action="<?php
echo currentUrl();
?>
" id="user-form" method="post" class="form">
<div class="control-group">
<label class="label" for="nama_lengkap">Nama lengkap</label>
<div class="control-input">
<input type="text" required name="nama_lengkap" id="nama_lengkap" <?php
echo $data ? 'value="' . $data->nama_lengkap . '"' : '';
?>
>
</div>
</div>
<div class="control-group">
<label class="label" for="alamat">Alamat</label>
<div class="control-input">
<textarea name="alamat" id="alamat"><?php
echo $data ? $data->alamat : '';
?>
</textarea>
</div>
</div>
<div class="control-group">