本文整理汇总了PHP中getBaseURL函数的典型用法代码示例。如果您正苦于以下问题:PHP getBaseURL函数的具体用法?PHP getBaseURL怎么用?PHP getBaseURL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getBaseURL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __register_template
function __register_template()
{
global $conf;
if (!empty($_REQUEST['q'])) {
require_once DOKU_INC . 'inc/JSON.php';
$json = new JSON();
$tempREQUEST = (array) $json->dec(stripslashes($_REQUEST['q']));
} else {
if (!empty($_REQUEST['template'])) {
$tempREQUEST = $_REQUEST;
} else {
if (preg_match("/(js|css)\\.php\$/", $_SERVER['SCRIPT_NAME']) && isset($_SERVER['HTTP_REFERER'])) {
// this is a css or script, nothing before matched and we have a referrer.
// lets asume we came from the dokuwiki page.
// Parse the Referrer URL
$url = parse_url($_SERVER['HTTP_REFERER']);
parse_str($url['query'], $tempREQUEST);
} else {
return;
}
}
}
// define Template baseURL
if (empty($tempREQUEST['template'])) {
return;
}
$tplDir = DOKU_INC . 'lib/tpl/' . $tempREQUEST['template'] . '/';
if (!file_exists($tplDir)) {
return;
}
// Set hint for Dokuwiki_Started event
if (!defined('SITEEXPORT_TPL')) {
define('SITEEXPORT_TPL', $tempREQUEST['template']);
}
// define baseURL
// This should be DEPRECATED - as it is in init.php which suggest tpl_basedir and tpl_incdir
/* **************************************************************************************** */
if (!defined('DOKU_REL')) {
define('DOKU_REL', getBaseURL(false));
}
if (!defined('DOKU_URL')) {
define('DOKU_URL', getBaseURL(true));
}
if (!defined('DOKU_BASE')) {
if (isset($conf['canonical'])) {
define('DOKU_BASE', DOKU_URL);
} else {
define('DOKU_BASE', DOKU_REL);
}
}
// This should be DEPRECATED - as it is in init.php which suggest tpl_basedir and tpl_incdir
if (!defined('DOKU_TPL')) {
define('DOKU_TPL', (empty($tempREQUEST['base']) ? DOKU_BASE : $tempREQUEST['base']) . 'lib/tpl/' . $tempREQUEST['template'] . '/');
}
if (!defined('DOKU_TPLINC')) {
define('DOKU_TPLINC', $tplDir);
}
/* **************************************************************************************** */
}
示例2: collectParameters
function collectParameters()
{
$parameters = new stdClass();
$parameters->app_id = filter_input(INPUT_GET, "app_id");
$parameters->account_id = filter_input(INPUT_GET, "account_id");
$parameters->api_key = filter_input(INPUT_GET, "api_key");
$parameters->baseURL = getBaseURL(true);
return $parameters;
}
示例3: redirectHash
function redirectHash($hash)
{
$hash = assertValidHash($hash);
$link = getBaseURL() . "#{$hash}";
header("Location: {$link}");
echo "Redirecting to <a href=\"{$link}\">{$link}</a>. ";
echo "Click on that link if you're not redirected.";
die;
}
示例4: redirect
public static function redirect($name)
{
if (!isset($_SESSION[$name])) {
$config = eval(substr(file_get_contents(SYSC . 'config.php'), 5));
if (!isset($config["route_defauls"]["login"])) {
throw new Exception("Please specify route_defauls-login in config file.");
}
redirect(getBaseURL($config["route_defauls"]["login"]) . "?redirect=" . urlencode(System::getCurrentURL()));
}
}
示例5: sendPWRecoveryEmail
/**
*
* @param be_account $account
*/
private static function sendPWRecoveryEmail($account)
{
$recoveryURL = getBaseURL("pvcloud") . "#/passwordrecovery/{$account->account_id}/{$account->confirmation_guid}";
$message = "Le comunicamos que el proceso de recuperación de contraseña fue completado con éxito.\n\n";
$to = $account->email;
$subject = "pvCloud - Recuperación de Contraseña Completada";
$enter = "\r\n";
$headers = "From: donotreply@costaricamakers.com {$enter}";
$headers .= "MIME-Version: 1.0 {$enter}";
$headers .= "Content-type: text/plain; charset=utf-8 {$enter}";
$result = mail($to, $subject, $message, $headers);
}
示例6: sendPWRecoveryEmail
/**
*
* @param be_account $account
*/
private static function sendPWRecoveryEmail($account)
{
$recoveryURL = getBaseURL("pvcloud") . "#/passwordrecovery/{$account->account_id}/{$account->confirmation_guid}";
$message = "Hemos recibido una solicitud de recuperación de contraseña para su cuenta en pvCloud.\n\n";
$message .= "Para recuperar su contraseña sírvase acceder al siguiente enlace dentro de las próximas 24 horas.\n\n";
$message .= $recoveryURL . "\n\n";
$message .= "Si usted no necesita recuperar su contraseña, por favor ignore este mensaje.\n\n";
$message .= "Si usted no solicitó un cambio de contraseña, puede que alguien esté intentando violentar su cuenta;\n\n";
$message .= "en cuyo caso por favor reporte el incidente a pvcloud_seguridad@costaricamakers.com\n\n";
$to = $account->email;
$subject = "pvCloud - Recuperación de Contraseña";
$enter = "\r\n";
$headers = "From: donotreply@costaricamakers.com {$enter}";
$headers .= "MIME-Version: 1.0 {$enter}";
$headers .= "Content-type: text/plain; charset=utf-8 {$enter}";
$result = mail($to, $subject, $message, $headers);
}
示例7: checkUser
/**
* Caso exista o cookie de autenticação, verifica se o token é válido
*/
public static function checkUser()
{
$user = self::user();
if ($user == null) {
\Log::warning('Usuário do cookie inválido. Removendo cookie');
// remove o cookie
\Controllers\SessionsController::destroySessionCookie();
} else {
$data = \Controllers\SessionsController::extractCookieInfo();
$cookieToken = isset($data['token']) ? $data['token'] : null;
$dbToken = $user->getToken();
if ($data == null || $cookieToken != $dbToken) {
\Log::warning('Token do cookie inválido. Removendo cookie');
// remove o cookie
\Controllers\SessionsController::destroySessionCookie();
redirect(getBaseURL());
}
}
}
示例8: handle_feed_item
/**
* Removes draft entries from feeds
*
* @author Michael Klier <chi@chimeric.de>
*/
function handle_feed_item(&$event, $param)
{
global $conf;
$url = parse_url($event->data['item']->link);
$base_url = getBaseURL();
// determine page id by rewrite mode
switch ($conf['userewrite']) {
case 0:
preg_match('#id=([^&]*)#', $url['query'], $match);
if ($base_url != '/') {
$id = cleanID(str_replace($base_url, '', $match[1]));
} else {
$id = cleanID($match[1]);
}
break;
case 1:
if ($base_url != '/') {
$id = cleanID(str_replace('/', ':', str_replace($base_url, '', $url['path'])));
} else {
$id = cleanID(str_replace('/', ':', $url['path']));
}
break;
case 2:
preg_match('#doku.php/([^&]*)#', $url['path'], $match);
if ($base_url != '/') {
$id = cleanID(str_replace($base_url, '', $match[1]));
} else {
$id = cleanID($match[1]);
}
break;
}
// don't add drafts to the feed
if (p_get_metadata($id, 'type') == 'draft') {
$event->preventDefault();
return;
}
}
示例9: test12
/**
* Absolute URL with IPv6 domain name.
* lighttpd, fastcgi
*
* data provided by Michael Hamann <michael@content-space.de>
*/
function test12()
{
global $conf;
$conf['basedir'] = '';
$conf['baseurl'] = '';
$conf['canonical'] = 0;
$_SERVER['DOCUMENT_ROOT'] = '/srv/http/';
$_SERVER['HTTP_HOST'] = '[fd00::6592:39ed:a2ed:2c78]';
$_SERVER['SCRIPT_FILENAME'] = '/srv/http/~michitux/dokuwiki/doku.php';
$_SERVER['REQUEST_URI'] = '/~michitux/dokuwiki/doku.php?do=debug';
$_SERVER['SCRIPT_NAME'] = '/~michitux/dokuwiki/doku.php';
$_SERVER['PATH_INFO'] = null;
$_SERVER['PATH_TRANSLATED'] = null;
$_SERVER['PHP_SELF'] = '/~michitux/dokuwiki/doku.php';
$_SERVER['SERVER_PORT'] = '80';
$_SERVER['SERVER_NAME'] = '[fd00';
$this->assertEquals(getBaseURL(true), 'http://[fd00::6592:39ed:a2ed:2c78]/~michitux/dokuwiki/');
}
示例10: getMainURL
/**
* Get the website of the restaurant
*/
public function getMainURL()
{
return getBaseURL($this->getBaseMenuURL());
}
示例11: getCurrentURL
/**
* Retorna a URL atual
* @return string URL atual
*/
function getCurrentURL()
{
return getBaseURL() . $_SERVER['REQUEST_URI'];
}
示例12: getBaseURL
<?php
// Raidplaner RSS Feed
// This is a demo implementation of an RSS feed, but it can be used as is, too.
//
// Usage:
// feed.php?token=<private token>&timezone=<timezone>
//
// Timezone is optional and has to be compatible to date_default_timezone_set().
require_once "lib/private/api.php";
require_once "lib/private/out.class.php";
Out::writeHeadersXML();
echo '<rss version="2.0">';
// Build RSS header
$BaseURL = getBaseURL();
$Out = new Out();
$Out->pushValue("title", "Raidplaner RSS feed");
$Out->pushValue("link", $BaseURL . "index.php");
$Out->pushValue("description", "Upcoming raids for the next 2 weeks.");
$Out->pushValue("language", "en-en");
$Out->pushValue("copyright", "packedpixel");
$Out->pushValue("pubDate", date(DATE_RSS));
// Requires private token to be visible
$Token = isset($_REQUEST["token"]) ? $_REQUEST["token"] : null;
if (Api::testPrivateToken($Token)) {
// Setting the correct timezones
$Timezone = isset($_REQUEST["timezone"]) ? $_REQUEST["timezone"] : date_default_timezone_get();
// Query API
date_default_timezone_set("UTC");
$Parameters = array("start" => time() - 24 * 60 * 60, "end" => time() + 14 * 24 * 60 * 60, "limit" => 0, "closed" => true, "canceled" => true);
$Locations = Api::queryLocation(null);
示例13: mysqli_fetch_assoc
$appointmentInfo = mysqli_fetch_assoc($result);
// delete record
sendQuery("DELETE FROM Schedules WHERE Timestamp='{$timestamp}'");
sendEmail('TokBox Demo', 'demo@tokbox.com', $appointmentInfo['Name'], $appointmentInfo['Email'], "Cancelled: Your TokBox appointment on " . $appointmentInfo['Timestring'], "Your appointment on " . $appointmentInfo['Timestring'] . ". has been cancelled. We are sorry for the inconvenience, please reschedule on " . getBaseURL() . "/index.php/");
header("Content-Type: application/json");
echo json_encode($appointmentInfo);
});
$app->post('/schedule', function () use($app, $con, $opentok) {
$name = $app->request->post("name");
$email = $app->request->post("email");
$comment = $app->request->post("comment");
$timestamp = $app->request->post("timestamp");
$daystring = $app->request->post("daystring");
$session = $opentok->createSession();
$sessionId = $session->getSessionId();
$timestring = $app->request->post("timestring");
$query = sprintf("INSERT INTO Schedules (Name, Email, Comment, Timestamp, Daystring, Sessionid, Timestring) VALUES ('%s', '%s', '%s', '%d', '%s', '%s', '%s')", mysqli_real_escape_string($con, $name), mysqli_real_escape_string($con, $email), mysqli_real_escape_string($con, $comment), intval($timestamp), mysqli_real_escape_string($con, $daystring), mysqli_real_escape_string($con, $sessionId), mysqli_real_escape_string($con, $timestring));
sendQuery($query);
sendEmail('TokBox Demo', 'demo@tokbox.com', $name, $email, "Your TokBox appointment on " . $timestring, "You are confirmed for your appointment on " . $timestring . ". On the day of your appointment, go here: " . getBaseURL() . "/index.php/chat/" . $sessionId);
$app->render('schedule.php');
});
$app->get('/rep', function () use($app) {
$app->render('rep.php');
});
$app->get('/chat/:session_id', function ($session_id) use($app, $con, $apiKey, $opentok) {
$result = sendQuery("SELECT * FROM Schedules WHERE Sessionid='{$session_id}'");
$appointmentInfo = mysqli_fetch_assoc($result);
$token = $opentok->generateToken($session_id);
$app->render('chat.php', array('name' => $appointmentInfo['Name'], 'email' => $appointmentInfo['Email'], 'comment' => $appointmentInfo['Comment'], 'apiKey' => $apiKey, 'session_id' => $session_id, 'token' => $token));
});
$app->run();
示例14: delete
/**
* Remove uma pergunta
* @param int $id ID da pergunta
*/
public static function delete($id)
{
// impede acesso por não administradores
\Auth::denyNonAdminUser();
if (\Models\Question::delete((int) $id)) {
redirect(getBaseURL());
} else {
echo "Erro ao remover pergunta";
}
}
示例15: getPDFURL
/**
* pattern: first <a> with class 'wa-but-txt '
*/
protected function getPDFURL()
{
$doc = parent::getDOMDocument();
$finder = new DomXPath($doc);
$spaner = $finder->query("//*[contains(@class, 'wa-but-txt ')]");
// get first <a>
if ($spaner->length > 0) {
$pdfLink = $spaner->item(0);
return getBaseURL($this->getBaseMenuURL()) . $pdfLink->getAttribute('href');
}
return null;
}