本文整理汇总了PHP中URL::match方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::match方法的具体用法?PHP URL::match怎么用?PHP URL::match使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URL
的用法示例。
在下文中一共展示了URL::match方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Получение карты сайта
*
* @param boolean $include_hidden Включить скрытые страницы
* @return Model_Page_Sitemap
*/
public static function get($include_hidden = FALSE)
{
if (Kohana::$profiling) {
$benchmark = Profiler::start('Sitemap', __METHOD__);
}
$status = (bool) $include_hidden ? 1 : 0;
if (!array_key_exists($status, Model_Page_Sitemap::$_sitemap)) {
$pages = ORM::factory('page')->order_by('parent_id', 'asc')->order_by('position', 'asc');
if ((bool) $include_hidden === FALSE) {
$pages->where('status_id', 'in', array(Model_Page::STATUS_PASSWORD_PROTECTED, Model_Page::STATUS_PUBLISHED));
}
$res_pages = $pages->find_all();
$_pages = array();
foreach ($res_pages as $page) {
$_pages[$page->id] = $page->as_array();
$_pages[$page->id]['uri'] = '';
$_pages[$page->id]['url'] = '';
$_pages[$page->id]['slug'] = $page->slug;
$_pages[$page->id]['level'] = 0;
$_pages[$page->id]['is_active'] = TRUE;
}
$pages = array();
foreach ($_pages as &$page) {
$pages[$page['parent_id']][] =& $page;
}
foreach ($_pages as &$page) {
if (isset($pages[$page['id']])) {
foreach ($pages[$page['id']] as &$_page) {
$_page['level'] = $page['level'] + 1;
$_page['parent'] = $page;
$_page['uri'] = $page['uri'] . '/' . $_page['slug'];
$_page['url'] = URL::frontend($_page['uri']);
$_page['is_active'] = URL::match($_page['uri']);
if (empty($_page['layout_file'])) {
$_page['layout_file'] = $page['layout_file'];
}
if ($_page['is_active']) {
$page['is_active'] = TRUE;
}
}
$page['childs'] = $pages[$page['id']];
}
}
Model_Page_Sitemap::$_sitemap[$status] = new Sitemap(reset($pages));
}
if (isset($benchmark)) {
Profiler::stop($benchmark);
}
return clone Model_Page_Sitemap::$_sitemap[$status];
}
示例2: defined
<?php
defined('SYSPATH') or die('No direct access allowed.');
if (PHP_SAPI != 'cli') {
define('IS_BACKEND', URL::match(ADMIN_DIR_NAME, Request::detect_uri()));
}
if (!defined('IS_BACKEND')) {
define('IS_BACKEND', FALSE);
}
if (!defined('SESSION_TYPE')) {
define('SESSION_TYPE', 'native');
}
// CMS defaults
define('ADMIN_URL', BASE_URL . ADMIN_DIR_NAME . '/');
define('PLUGINS_URL', BASE_URL . 'cms/plugins/');
define('PUBLIC_URL', BASE_URL . 'public/');
/**
* Set the default time zone.
*
* @see http://kohanaframework.org/guide/using.configuration
* @see http://php.net/timezones
*/
date_default_timezone_set(DEFAULT_TIMEZONE);
/**
* Cookie Salt
* @see http://kohanaframework.org/3.3/guide/kohana/cookies
*
* If you have not defined a cookie salt in your Cookie class then
* uncomment the line below and define a preferrably long salt.
*/
Cookie::$salt = COOKIE_SALT;
示例3:
<br />
<div class="navbar">
<div class="navbar-inner">
<a class="brand" href="/"><?php
echo Config::get('site', 'title');
?>
</a>
<ul class="nav">
<?php
if (!URL::match('/')) {
?>
<li>
<?php
echo HTML::anchor('', 'Home');
?>
</li>
<?php
}
?>
<?php
foreach ($pages as $page) {
?>
<li class="<?php
echo $page['is_active'] ? 'active' : '';
?>
">
<?php
echo HTML::anchor($page['uri'], $page['title']);
?>
</li>
<?php
示例4: define
}
if (!defined('PLUGINS_URL')) {
define('PLUGINS_URL', BASE_URL . 'cms/plugins/');
}
if (!defined('IS_BACKEND')) {
define('IS_BACKEND', FALSE);
}
/**
* Set the default cookie salt
*/
Cookie::$salt = 'install_system';
/**
* Disable kohana caching
*/
Kohana::$caching = FALSE;
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array('api' => MODPATH . 'api', 'users' => MODPATH . 'users', 'kodicms' => MODPATH . 'kodicms', 'assets' => MODPATH . 'assets', 'cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'auth' => MODPATH . 'auth', 'orm' => MODPATH . 'orm', 'minion' => MODPATH . 'minion', 'filesystem' => MODPATH . 'filesystem', 'breadcrumbs' => MODPATH . 'breadcrumbs', 'widget' => MODPATH . 'widget', 'email' => MODPATH . 'email', 'plugins' => MODPATH . 'plugins', 'installer' => MODPATH . 'installer'));
Observer::notify('modules::after_load');
/**
* Проверка на существование модуля `installer`
*/
if (array_key_exists('installer', Kohana::modules()) === FALSE) {
throw HTTP_Exception::factory(404, __('System not installed. Installer not found.'));
}
if (PHP_SAPI != 'cli') {
if (!URL::match('install', Request::detect_uri()) and !URL::match('cms/media/', Request::detect_uri())) {
$uri = Route::get('install')->uri();
}
}
示例5: is_backend
/**
* The current request is a backend request?
*
* @return bool
* @throws Kohana_Exception
*/
public function is_backend()
{
return is_string(BACKEND_DIR_NAME) ? URL::match(BACKEND_DIR_NAME, Request::detect_uri()) : false;
}
示例6:
<?php
if (!URL::match('about-us')) {
?>
<h3>About Me</h3>
<p>I'm just a demonstration of how easy it is to use KoDi CMS to power a blog.
<?php
echo HTML::anchor('about-us', 'more ...');
?>
</p>
<hr />
<?php
}
?>
<h4>Favorite Sites</h4>
<ul class="unstyled">
<li>
<?php
echo HTML::anchor('https://github.com/butschster/kodicms', 'KodiCMS');
?>
</li>
</ul>