本文整理汇总了PHP中url::host方法的典型用法代码示例。如果您正苦于以下问题:PHP url::host方法的具体用法?PHP url::host怎么用?PHP url::host使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类url
的用法示例。
在下文中一共展示了url::host方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format
public function format(Node $node, $em)
{
if ($value = $node->{$this->value}) {
$result = html::em($em, array('host' => url::host($value)), html::cdata($value));
return $result;
}
}
示例2: canUploadToS3
/**
* Проверяет, можно ли загрузить файл в S3.
*/
private static function canUploadToS3(FileNode $node)
{
if (empty($node->remoteurl)) {
return true;
}
$host = url::host($node->remoteurl);
if ('.s3.amazonaws.com' == substr($host, -17)) {
return false;
}
return true;
}
示例3: on_get_head
/**
* Добавление скриптов к странице.
* @mcms_message ru.molinos.cms.page.head
*/
public static function on_get_head(Context $ctx, array $pathinfo)
{
if ($query = $ctx->get('query') and $key = $ctx->config->get('modules/search/gas_key')) {
$query = str_replace('"', "'", $query);
$paths = array(os::path(MCMS_SITE_FOLDER, 'gas.js'), os::path('lib', 'modules', 'search', 'gas.js'));
$output = '';
foreach ($paths as $path) {
if (file_exists($path)) {
$js = str_replace('QUERY', $query, file_get_contents($path));
$js = str_replace('HOSTNAME', url::host($_SERVER['HTTP_HOST']), $js);
$output = '<script type="text/javascript" src="http://www.google.com/jsapi?key=' . $key . '"></script>' . '<script type="text/javascript">' . $js . '</script>';
return html::wrap('head', html::cdata($output), array('module' => 'search'));
}
}
}
}
示例4: set
public function set($value, &$node)
{
$result = array();
foreach (preg_split('/[\\r\\n]+/', $value) as $line) {
if (count($parts = preg_split('/\\s+/', $line, 2, PREG_SPLIT_NO_EMPTY))) {
$link = array();
if ($tmp = array_shift($parts)) {
$link['href'] = $tmp;
}
if ($tmp = array_shift($parts)) {
$link['name'] = $tmp;
}
if (!empty($link['href'])) {
$link['host'] = url::host($link['href']);
}
try {
$head = http::head($link['href']);
if (200 == ($link['status'] = $head['_status'])) {
if (!empty($head['Content-Type'])) {
$link['type'] = $head['Content-Type'];
}
if (!empty($head['Content-Length'])) {
$link['size'] = intval($head['Content-Length']);
$link['sizefm'] = mcms::filesize($link['size']);
}
}
} catch (Exception $e) {
}
$result[] = $link;
}
}
if (empty($result)) {
unset($node->{$this->value});
} else {
$node->{$this->value} = $result;
}
}
示例5: array
<?php
c::set('routes', array(array('pattern' => 'autologin', 'action' => function () {
$username = 'YOURUSERNAME';
$password = 'YOURPASSWORD';
// Prevent access on the production system
if (url::host() !== 'localhost') {
return false;
}
$user = site()->user($username);
if ($user and $user->login($password)) {
go('panel');
// or use go(); to redirect to the frontpage
} else {
echo 'invalid username or password';
return false;
}
})));
示例6: kirby
<?php
$kirby = kirby();
// Prevent panel breakage
switch (url::host()) {
case 'evanosky.local':
$kirby->urls->index = 'http://evanosky.local';
default:
$kirby->urls->index = 'http://' . url::host();
}
// avatars folder
$kirby->roots->avatars = $kirby->roots()->index() . DS . 'public' . DS . 'avatars';
$kirby->urls->avatars = $kirby->urls()->index() . '/public/avatars';
// thumbs folder
$kirby->roots->thumbs = $kirby->roots()->index() . DS . 'public' . DS . 'thumbs';
$kirby->urls->thumbs = $kirby->urls()->index() . '/public/thumbs';
示例7: domain
public static function domain()
{
$domain = url::protocol() . '://' . url::host();
return $domain;
}
示例8: run
/**
* Iterate through every route to find a matching route.
*
* @param string $path Optional path to match against
* @param string $host Optional host to match against
* @return Route
*/
public function run($path = null, $host = null)
{
$method = r::method();
$ajax = r::ajax();
$https = r::ssl();
$routes = a::get($this->routes, $method, array());
// detect path and host if not set manually
if ($path === null) {
$path = implode('/', (array) url::fragments(detect::path()));
}
if ($host === null) {
$host = url::host();
}
// empty urls should never happen
if (empty($path)) {
$path = '/';
}
foreach ($routes as $route) {
if ($route->host && $route->host !== $host) {
continue;
}
if ($route->https && !$https) {
continue;
}
if ($route->ajax && !$ajax) {
continue;
}
// handle exact matches
if ($route->pattern == $path) {
$this->route = $route;
break;
}
// We only need to check routes with regular expression since all others
// would have been able to be matched by the search for literal matches
// we just did before we started searching.
if (strpos($route->pattern, '(') === false) {
continue;
}
$preg = '#^' . $this->wildcards($route->pattern) . '$#u';
// If we get a match we'll return the route and slice off the first
// parameter match, as preg_match sets the first array item to the
// full-text match of the pattern.
if (preg_match($preg, $path, $parameters)) {
$this->route = $route;
$this->route->arguments = array_slice($parameters, 1);
break;
}
}
if ($this->route && $this->filterer($this->route->filter, $this->route) !== false) {
return $this->route;
} else {
return null;
}
}