本文整理汇总了PHP中Zend_Controller_Request_Http::getBaseUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Http::getBaseUrl方法的具体用法?PHP Zend_Controller_Request_Http::getBaseUrl怎么用?PHP Zend_Controller_Request_Http::getBaseUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Http
的用法示例。
在下文中一共展示了Zend_Controller_Request_Http::getBaseUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _processRedirectOptions
/**
* Process redirect (R) and permanent redirect (RP)
*
* @return Mage_Core_Model_Url_Rewrite_Request
*/
protected function _processRedirectOptions()
{
$isPermanentRedirectOption = $this->_rewrite->hasOption('RP');
$external = substr($this->_rewrite->getTargetPath(), 0, 6);
if ($external === 'http:/' || $external === 'https:') {
$destinationStoreCode = $this->_app->getStore($this->_rewrite->getStoreId())->getCode();
$this->_setStoreCodeCookie($destinationStoreCode);
$this->_sendRedirectHeaders($this->_rewrite->getTargetPath(), $isPermanentRedirectOption);
}
$targetUrl = $this->_request->getBaseUrl() . '/' . $this->_rewrite->getTargetPath();
$storeCode = $this->_app->getStore()->getCode();
if (Mage::getStoreConfig('web/url/use_store') && !empty($storeCode)) {
$targetUrl = $this->_request->getBaseUrl() . '/' . $storeCode . '/' . $this->_rewrite->getTargetPath();
}
if ($this->_rewrite->hasOption('R') || $isPermanentRedirectOption) {
$this->_sendRedirectHeaders($targetUrl, $isPermanentRedirectOption);
}
$queryString = $this->_getQueryString();
if ($queryString) {
$targetUrl .= '?' . $queryString;
}
$this->_request->setRequestUri($targetUrl);
$this->_request->setPathInfo($this->_rewrite->getTargetPath());
return $this;
}
示例2: initialise
function initialise()
{
// No config file, so this is a first run for install. Before creating the config file, check some
// directory access
$readonlyDirs = array();
if (!is_writable(dirname(__FILE__) . "/application/config/")) {
$readonlyDirs[] = "/application/config/";
}
if (!is_writable(dirname(__FILE__) . "/application/logs/")) {
$readonlyDirs[] = "/application/logs/";
}
if (!is_writable(dirname(__FILE__) . "/application/cache/")) {
$readonlyDirs[] = "/application/cache/";
}
if (count($readonlyDirs) > 0) {
die('<div style="width:80%;margin:50px auto;text-align:center;">' . '<h3>Installation cannot proceed.</h3>' . '<p>The Warehouse installation needs write access priveleges to the following folders:</p>' . '<ul><li>' . implode('</li><li>', $readonlyDirs) . '</li></ul>' . '</div>');
}
$source = dirname(__FILE__) . "/application/config/config.php.example";
$dest = dirname(__FILE__) . "/application/config/config.php";
if (false === ($_source_content = file_get_contents($source))) {
die('<div style="width:80%;margin:50px auto;text-align:center;">' . '<h3>Config file not found.</h3>' . '<p>The <code>' . APPPATH . 'config/config' . EXT . '.example</code> file does not exist or could not be accessed.</p>' . '</div>');
}
include dirname(__FILE__) . '/modules/indicia_setup/libraries/Zend_Controller_Request_Http.php';
$zend_http = new Zend_Controller_Request_Http();
$site_domain = preg_replace("/index\\.php.*\$/", "", $zend_http->getHttpHost() . $zend_http->getBaseUrl());
$_source_content = str_replace("*site_domain*", $site_domain, $_source_content);
if (false === file_put_contents($dest, $_source_content)) {
die('<div style="width:80%;margin:50px auto;text-align:center;">' . '<h1>Indicia Installation</h1>' . '<h2>Config file cannot be written.</h2>' . '<p>The <code>' . APPPATH . 'config/config' . EXT . '</code> file cannot be created..</p>' . '</div>');
}
}
示例3: getBaseUrl
/**
* get the base url
* @return string $baseUrl
*/
public static function getBaseUrl()
{
if (!self::$baseUrl) {
$uri = new Zend_Controller_Request_Http();
self::$baseUrl = $uri->getScheme() . '://' . $uri->getHttpHost() . $uri->getBaseUrl();
}
return self::$baseUrl;
}
示例4: handle
public function handle()
{
try {
Tinebase_Core::initFramework();
} catch (Zend_Session_Exception $exception) {
if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' invalid session. Delete session cookie.');
}
Zend_Session::expireSessionCookie();
header('WWW-Authenticate: Basic realm="WebDAV for Tine 2.0"');
header('HTTP/1.1 401 Unauthorized');
return;
}
if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' is CalDav, CardDAV or WebDAV request.');
}
if (empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['REMOTE_USER']) && empty($_SERVER['REDIRECT_REMOTE_USER'])) {
header('WWW-Authenticate: Basic realm="WebDav for Tine 2.0"');
header('HTTP/1.1 401 Unauthorized');
return;
}
// when used with (f)cgi no PHP_AUTH variables are available without defining a special rewrite rule
if (!isset($_SERVER['PHP_AUTH_USER'])) {
// $_SERVER["REMOTE_USER"] == "Basic didhfiefdhfu4fjfjdsa34drsdfterrde..."
$basicAuthData = base64_decode(substr(isset($_SERVER["REMOTE_USER"]) ? $_SERVER["REMOTE_USER"] : $_SERVER['REDIRECT_REMOTE_USER'], 6));
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(":", $basicAuthData);
}
if (Tinebase_Controller::getInstance()->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], $_SERVER['REMOTE_ADDR'], 'TineWebDav') !== true) {
header('WWW-Authenticate: Basic realm="CardDav for Tine 2.0"');
header('HTTP/1.1 401 Unauthorized');
return;
}
self::$_server = new Sabre_DAV_Server(new Tinebase_WebDav_Root());
// compute base uri
$request = new Zend_Controller_Request_Http();
self::$_server->setBaseUri($request->getBaseUrl() . '/');
$tempDir = Tinebase_Core::getTempDir();
if (!empty($tempDir)) {
$lockBackend = new Sabre_DAV_Locks_Backend_File($tempDir . '/webdav.lock');
$lockPlugin = new Sabre_DAV_Locks_Plugin($lockBackend);
self::$_server->addPlugin($lockPlugin);
}
$authPlugin = new Sabre_DAV_Auth_Plugin(new Tinebase_WebDav_Auth(), null);
self::$_server->addPlugin($authPlugin);
$aclPlugin = new Sabre_DAVACL_Plugin();
$aclPlugin->defaultUsernamePath = 'principals/users';
$aclPlugin->principalCollectionSet = array($aclPlugin->defaultUsernamePath);
self::$_server->addPlugin($aclPlugin);
self::$_server->addPlugin(new Sabre_CardDAV_Plugin());
self::$_server->addPlugin(new Sabre_CalDAV_Plugin());
self::$_server->addPlugin(new Sabre_CalDAV_Schedule_Plugin());
self::$_server->addPlugin(new Sabre_DAV_Browser_Plugin());
self::$_server->exec();
}
示例5: logAdminRequest
public function logAdminRequest(Zend_Controller_Request_Http $request, array $requestData = null, $ipAddress = null)
{
$baseUrl = $request->getBaseUrl();
$requestUri = $request->getRequestUri();
if (substr($requestUri, 0, strlen($baseUrl)) == $baseUrl) {
$routeBase = substr($requestUri, strlen($baseUrl));
$routeBase = preg_replace('/^\\?/', '', $routeBase);
} else {
$routeBase = $requestUri;
}
if ($requestData === null) {
$requestData = $this->_filterAdminLogRequestData($_POST);
}
$ipAddress = XenForo_Helper_Ip::getBinaryIp(null, $ipAddress, '');
$this->_getDb()->insert('xf_admin_log', array('request_date' => XenForo_Application::$time, 'user_id' => XenForo_Visitor::getUserId(), 'ip_address' => $ipAddress, 'request_url' => $routeBase, 'request_data' => json_encode($requestData)));
}
示例6: initVariables
public static function initVariables()
{
if (self::$_request) {
self::$_rootUrl = self::$_request->getBaseUrl();
}
if (preg_match('{\\.php$}i', self::$_rootUrl)) {
self::$_rootUrl = dirname(self::$_rootUrl);
}
Lms_Text::setEncoding('CP1251');
Lms_Text::enableMultiByte();
Lms_Api_Formatter_Ajax::setEncoding('CP1251');
Lms_Api_Formatter_Json::setEncoding('CP1251');
Lms_Thumbnail::setHttpClient(self::getHttpClient());
Lms_Thumbnail::setThumbnailScript(self::getConfig('thumbnail', 'script'), self::getConfig('thumbnail', 'key'));
Lms_Thumbnail::setImageDir(rtrim($_SERVER['DOCUMENT_ROOT'] . self::$_rootUrl, '/\\') . '/media/images');
Lms_Thumbnail::setThumbnailDir(rtrim($_SERVER['DOCUMENT_ROOT'] . self::$_rootUrl, '/\\') . '/media/thumbnails');
Lms_Thumbnail::setCache(self::getConfig('thumbnail', 'cache'));
}
示例7: dispatchRequest
protected function dispatchRequest(Zend_Controller_Request_Http $request, X_Page_ItemList_PItem $items, Zend_Controller_Action $controller)
{
/* @var $view Zend_Controller_Action_Helper_ViewRenderer */
$view = $controller->getHelper('viewRenderer');
/* @var $layout Zend_Layout_Controller_Action_Helper_Layout */
$layout = $controller->getHelper('layout');
try {
$view->setNoRender(true);
$layout->disableLayout();
} catch (Exception $e) {
X_Debug::e("Layout or View not enabled: " . $e->getMessage());
}
$result = array();
$actionName = $request->getActionName();
$controllerName = $request->getControllerName();
$result['controller'] = $controllerName;
$result['action'] = $actionName;
$result['success'] = true;
$result['items'] = array();
/* @var $urlHelper Zend_Controller_Action_Helper_Url */
$urlHelper = $controller->getHelper('url');
$skipMethod = array('getCustom', 'getLinkParam', 'getLinkAction', 'getLinkController');
foreach ($items->getItems() as $itemId => $item) {
/* @var $item X_Page_Item_PItem */
$aItem = array();
$methods = get_class_methods(get_class($item));
foreach ($methods as $method) {
if (array_search($method, $skipMethod) !== false) {
continue;
}
if ($method == "getIcon") {
$aItem['icon'] = $request->getBaseUrl() . $item->getIcon();
} elseif (X_Env::startWith($method, 'get')) {
$aItem[lcfirst(substr($method, 3))] = $item->{$method}();
} elseif (X_Env::startWith($method, 'is')) {
$aItem[lcfirst(substr($method, 2))] = $item->{$method}();
}
}
$result['items'][] = $aItem;
}
/* @var $jsonHelper Zend_Controller_Action_Helper_Json */
$jsonHelper = $controller->getHelper('Json');
$jsonHelper->direct($result, true, false);
}
示例8: getBaseUrl
/**
* @param bool $raw
* @return string
*/
public function getBaseUrl($raw = false)
{
$url = parent::getBaseUrl($raw);
$url = str_replace('\\', '/', $url);
return $url;
}
示例9: testBasePathAutoDiscoveryWithPhpFile
public function testBasePathAutoDiscoveryWithPhpFile()
{
$_SERVER['REQUEST_URI'] = '/dir/action';
$_SERVER['PHP_SELF'] = '/dir/index.php';
$_SERVER['SCRIPT_FILENAME'] = '/var/web/dir/index.php';
$request = new Zend_Controller_Request_Http();
$this->assertEquals('/dir', $request->getBasePath(), $request->getBaseUrl());
}
示例10: testGetRequestUriShouldReturnDecodedUri
/**
* @group ZF-3527
*/
public function testGetRequestUriShouldReturnDecodedUri()
{
$request = new Zend_Controller_Request_Http();
$request->setBaseUrl('%7Euser');
$this->assertEquals('~user', $request->getBaseUrl());
}
示例11: _initFrontController
protected function _initFrontController()
{
Zend_Controller_Action_HelperBroker::addPath("Khcn/Controller/Action/Helper/", 'Khcn_Controller_Action_Helper');
$frontController = Zend_Controller_Front::getInstance();
$frontController->setDefaultModule('default')->setParam('viewSuffix', 'phtml')->setParam('prefixDefaultModule', 'true');
// Add our special path for action helpers
$this->initActionHelperPath();
// Our virtual index hack confuses the request class, this other hack will
// make it think it's in the root folder
$request = new Zend_Controller_Request_Http();
$script = $_SERVER['SCRIPT_NAME'];
$_SERVER['SCRIPT_NAME'] = str_replace('/application/', '/', $script);
$frontController->setBaseUrl($request->getBaseUrl());
$_SERVER['SCRIPT_NAME'] = $script;
// Save to registy and local container
Zend_Registry::set('Zend_Controller_Front', $frontController);
return $frontController;
}
示例12: setBody
public function setBody(array $arguments = array(), $assunto = 'MENSAGEM DE EMAIL')
{
//configuração servidor de envio
$modelBanco = new Application_Model_ConfigSendMail();
$dataBanco = $modelBanco->getConfig(1);
if (count($dataBanco)) {
$this->email_sender_sis = $dataBanco->snd_login;
$this->pass_sender_sis = $dataBanco->snd_senha;
$this->port_mailer = $dataBanco->snd_port;
$this->ssl_protocol = $dataBanco->snd_ssl_protocolo;
$this->smtp_account = $dataBanco->snd_smtp;
$this->email_sender_client = $dataBanco->snd_email_envio;
$this->name_sender_client = $dataBanco->snd_nome;
} else {
$this->email_sender_sis = EMAIL_SENDER_SIS;
$this->pass_sender_sis = PASS_SENDER_SIS;
$this->port_mailer = PORT_MAILER;
$this->ssl_protocol = SSL_PROTOCOL;
$this->smtp_account = SMTP_ACCOUNT;
$this->email_sender_client = EMAIL_SENDER_CLIENT;
$this->name_sender_client = NAME_SENDER_CLIENT;
}
$layout = $arguments['template'] ? $arguments['template'] : 'template_emkt.phtml';
$email_send = $this->email_sender_client;
$email_receive = $arguments['email_recebe'] ? $arguments['email_recebe'] : $this->email_sender_client;
$name_receive = $arguments['nome_recebe'] ? $arguments['nome_recebe'] : 'Usuário';
$text_receive = $arguments['dinamic_content'] ? $arguments['dinamic_content'] : '-';
$envia = array('email' => $email_send, 'nome' => $this->name_sender_client);
$recebe = array('email' => $email_receive, 'nome' => $name_receive);
$this->assunto = $assunto;
$front_controller = Zend_Controller_Front::getInstance();
$request = new Zend_Controller_Request_Http();
$this->_baseUrl = $request->getBaseUrl();
$myView = new Zend_View();
$myView->addScriptPath(APPLICATION_PATH . '/views/scripts/templates/');
//$myView->addScriptPath($url.'/views/scripts/templates/'.$layout;);
$html_body = $myView->render($layout);
//substituí as tags pelo original
$html_body = preg_replace('/{email}/', $email_receive, $html_body);
$html_body = preg_replace('/{nome}/', $name_receive, $html_body);
$html_body = preg_replace('/{texto_dinamico}/', $text_receive, $html_body);
$html_body = preg_replace('/^<a(.*?)href=("|\')(.+)("|\')(.*?)>$/', '<a$1href=$2$3$2$5>', $html_body);
preg_match_all('<a(.*?)href=("|\')([^"]+)("|\')(.*?)>', $html_body, $matches);
if (count($matches)) {
$arrayUrls = $matches[3];
$urls = array_values(array_filter($arrayUrls));
}
if (count($urls)) {
foreach ($urls as $k => $url) {
$urlString = SITE_SUBFOLDER . '/index/click/k/' . str_replace('/', '::', base64_encode($email_receive)) . '/url/' . str_replace('/', '::', base64_encode(urlencode($url)));
$urlString = $this->makeShortUrlBitly($urlString);
$html_body = preg_replace('/<a(.*?)href=("|\')' . preg_quote($url, '/') . '("|\')(.*?)>/', '<a$1href=$2' . $urlString . '$2$5 mc:disable-tracking>', $html_body);
}
}
// if(count($urls) ) {
// foreach ($urls as $k => $url) {
//
// $urlString = SITE_SUBFOLDER.'/index/click/k/'.str_replace('/','::',base64_encode($email_receive)).'/url/'.str_replace('/','::',base64_encode(utf8_encode($url)));
// $urlString = $this->makeShortUrlBitly($urlString);
// // $html_body = preg_replace('/<a(.*?)href=("|\')'.preg_quote($url, '/').'("|\')(.*?)>/', '<a$1href=$2'.$urlString.'$2$5 mc:disable-tracking>', $html_body);
//
// $html_body = str_replace($url, $urlString, $html_body);
//
// }
// }
$html_body .= '<p>Se não deseja receber mais mensagens, <a href="' . $this->makeShortUrlBitly(SITE_SUBFOLDER . '/index/remover-email/k/' . str_replace('/', '::', base64_encode($email_receive))) . '" mc:disable-tracking>clique aqui</a>.</p>';
$this->enviaEmail = $envia;
$this->recebeEmail = $recebe;
$this->retornoEmail = $recebe;
$this->html_body = $html_body;
}
示例13:
if (!XenForo_Application::debugMode()) {
echo 'Must be in debug mode.';
exit;
}
$dependencies = new XenForo_Dependencies_Admin();
$dependencies->preLoadData();
if (!function_exists('mb_detect_encoding')) {
// this is a hack to not require the mbstring functions for *1* function call
function mb_detect_encoding()
{
return 'UTF-8';
}
}
require $fileDir . '/library/Sabre/Sabre.autoload.php';
$request = new Zend_Controller_Request_Http();
$baseUrl = $request->getBaseUrl();
$auth = new Sabre_HTTP_BasicAuth();
$auth->setRealm('XenForo Admin CP WebDAV');
$authData = $auth->getUserPass();
/* @var $userModel XenForo_Model_User */
$userModel = XenForo_Model::create('XenForo_Model_User');
$authValid = false;
$userId = $userModel->validateAuthentication($authData[0], $authData[1]);
if ($userId) {
$visitor = XenForo_Visitor::setup($userId);
if ($visitor['is_admin']) {
$authValid = true;
}
}
if (!$authValid) {
$auth->requireLogin();
示例14: getRoutePath
/**
* Gets the path the to be routed based on the URL of the request
*
* @param Zend_Controller_Request_Http Request object
*
* @return string Routing path
*/
public function getRoutePath(Zend_Controller_Request_Http $request)
{
$baseUrl = $request->getBaseUrl();
$requestUri = $request->getRequestUri();
$result = null;
if (substr($requestUri, 0, strlen($baseUrl)) == $baseUrl) {
$routeBase = substr($requestUri, strlen($baseUrl));
if (preg_match('#^/([^?]+)(\\?|$)#U', $routeBase, $match)) {
// rewrite approach (starts with /). Must be non-empty rewrite up to query string.
$result = urldecode($match[1]);
} else {
if (preg_match('#\\?([^=&]+)(&|$)#U', $routeBase, $match)) {
// query string approach. Must start with non-empty, non-named param.
$result = urldecode($match[1]);
}
}
}
if ($result === null) {
$namedRouteVar = $request->getParam('_');
if ($namedRouteVar !== null && is_string($namedRouteVar)) {
$result = $namedRouteVar;
}
}
if ($result !== null) {
return ltrim($result, '/');
}
return '';
}
示例15: testSetBaseUrl
public function testSetBaseUrl()
{
$this->_request->setBaseUrl('/news');
$this->assertEquals('/news', $this->_request->getBaseUrl());
}