示例#1
0
 /**
  * Получение карты сайта
  * 
  * @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
0
文件: init.php 项目: ortodesign/cms
<?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
0
<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
0
}
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
0
文件: System.php 项目: NegoCore/core
 /**
  * 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
0
<?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>