1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-06 13:16:54 +02:00

Monstra Library: basic core improvments

This commit is contained in:
Awilum
2013-01-04 21:08:04 +02:00
parent 7437cc6abb
commit ef12b7492e
289 changed files with 16265 additions and 17155 deletions

View File

@@ -8,4 +8,4 @@
<plugin_version>1.0.0</plugin_version>
<plugin_author>Awilum</plugin_author>
<plugin_author_uri>http://monstra.org/</plugin_author_uri>
</root>
</root>

View File

@@ -1,54 +1,54 @@
<?php
return array(
'pages' => array(
'Pages' => 'Seiten',
'Pages manager' => 'Seiten Manager',
'Content' => 'Inhalt',
'Create New Page' => 'Neue Seite erstellen',
'New Page' => 'Neue Seite',
'Edit Page' => 'Seite bearbeiten',
'Date' => 'Datum',
'Clone' => 'Klonen',
'Edit' => 'Bearbeiten',
'Delete' => 'Löschen',
'Delete page: :page' => 'Lösche Seite: :page',
'Title' => 'Titel',
'Name' => 'Name',
'Author' => 'Author',
'Name (slug)' => 'Name (slug)',
'Description' => 'Beschreibung',
'Keywords' => 'Schlagwörter',
'Parent' => 'Übergeordnete',
'Template' => 'Vorlage',
'Year' => 'Jahr',
'Day' => 'Tag',
'Month' => 'Monat',
'Hour' => 'Stunde',
'Minute' => 'Minute',
'Second' => 'Sekunde',
'This field should not be empty' => 'Dieses Feld darf nicht leer sein',
'This page already exists' => 'Diese Seite existiert bereits',
'Extra' => 'Extra',
'Save' => 'Speichern',
'Save and Exit' => 'Speichern und Beenden',
'Your changes to the page <i>:page</i> have been saved.' => 'Deine Änderungen an der Seite <i> :page </i> wurden gespeichert.',
'The page <i>:page</i> cloned.' => 'Die Seite <i>:page</i> wurde gekloned.',
'Status' => 'Status',
'Actions' => 'Aktionen',
'Add' => 'Hinzufügen',
'Published' => 'Veröffentlicht',
'Draft' => 'Entwurf',
'Published on' => 'Veröffentlicht am',
'Edit 404 Page' => 'Bearbeite 404-Fehler Seite',
'Page <i>:page</i> deleted' => 'Seite <i>:page</i> wurde gelöscht',
'Search Engines Robots' => 'Suchmaschinen-Roboter',
'Page' => 'Seite',
'Metadata' => 'Metadata',
'Settings' => 'Einstellungen',
'Required field' => 'Pflichtfeld',
'Access' => 'Zugriff',
'Public' => 'Öffentlichkeit',
'Registered' => 'Eingetragen',
)
);
<?php
return array(
'pages' => array(
'Pages' => 'Seiten',
'Pages manager' => 'Seiten Manager',
'Content' => 'Inhalt',
'Create New Page' => 'Neue Seite erstellen',
'New Page' => 'Neue Seite',
'Edit Page' => 'Seite bearbeiten',
'Date' => 'Datum',
'Clone' => 'Klonen',
'Edit' => 'Bearbeiten',
'Delete' => 'Löschen',
'Delete page: :page' => 'Lösche Seite: :page',
'Title' => 'Titel',
'Name' => 'Name',
'Author' => 'Author',
'Name (slug)' => 'Name (slug)',
'Description' => 'Beschreibung',
'Keywords' => 'Schlagwörter',
'Parent' => 'Übergeordnete',
'Template' => 'Vorlage',
'Year' => 'Jahr',
'Day' => 'Tag',
'Month' => 'Monat',
'Hour' => 'Stunde',
'Minute' => 'Minute',
'Second' => 'Sekunde',
'This field should not be empty' => 'Dieses Feld darf nicht leer sein',
'This page already exists' => 'Diese Seite existiert bereits',
'Extra' => 'Extra',
'Save' => 'Speichern',
'Save and Exit' => 'Speichern und Beenden',
'Your changes to the page <i>:page</i> have been saved.' => 'Deine Änderungen an der Seite <i> :page </i> wurden gespeichert.',
'The page <i>:page</i> cloned.' => 'Die Seite <i>:page</i> wurde gekloned.',
'Status' => 'Status',
'Actions' => 'Aktionen',
'Add' => 'Hinzufügen',
'Published' => 'Veröffentlicht',
'Draft' => 'Entwurf',
'Published on' => 'Veröffentlicht am',
'Edit 404 Page' => 'Bearbeite 404-Fehler Seite',
'Page <i>:page</i> deleted' => 'Seite <i>:page</i> wurde gelöscht',
'Search Engines Robots' => 'Suchmaschinen-Roboter',
'Page' => 'Seite',
'Metadata' => 'Metadata',
'Settings' => 'Einstellungen',
'Required field' => 'Pflichtfeld',
'Access' => 'Zugriff',
'Public' => 'Öffentlichkeit',
'Registered' => 'Eingetragen',
)
);

View File

@@ -2,15 +2,15 @@
return array(
'pages' => array(
'Pages' => 'Pages',
'Pages manager' => 'Pages manager',
'Pages' => 'Pages',
'Pages manager' => 'Pages manager',
'Content' => 'Content',
'Create New Page' => 'Create New Page',
'New Page' => 'New Page',
'Edit Page' => 'Edit Page',
'Edit Page' => 'Edit Page',
'Date' => 'Date',
'Clone' => 'Clone',
'Edit' => 'Edit',
'Edit' => 'Edit',
'Delete' => 'Delete',
'Delete page: :page' => 'Delete page: :page',
'Title' => 'Title',
@@ -51,4 +51,4 @@
'Public' => 'Public',
'Registered' => 'Registered',
)
);
);

View File

@@ -4,13 +4,13 @@
'pages' => array(
'Pages' => 'Pagine',
'Pages manager' => 'Gestione pagine',
'Content' => 'Contenuto',
'Content' => 'Contenuto',
'Create New Page' => 'Crea Nuova Pagina',
'New Page' => 'Nuova Pagina',
'Edit Page' => 'Modifica Pagina',
'Edit Page' => 'Modifica Pagina',
'Date' => 'Data',
'Clone' => 'Clona',
'Edit' => 'Modifica',
'Edit' => 'Modifica',
'Delete' => 'Elimina',
'Delete page: :page' => 'Elimina pagina: :page',
'Title' => 'Titolo',
@@ -51,4 +51,4 @@
'Public' => 'Pubblico',
'Registered' => 'Registrato',
),
);
);

View File

@@ -7,10 +7,10 @@
'Content' => 'Turinys',
'Create New page' => 'Sukurti Naują Puslapį',
'New Page' => 'Naujas Puslapis',
'Edit Page' => 'Redaguoti Puslapį',
'Edit Page' => 'Redaguoti Puslapį',
'Date' => 'Data',
'Clone' => 'Klonuoti',
'Edit' => 'Redaguoti',
'Edit' => 'Redaguoti',
'Delete' => 'Ištrinti',
'Delete page: :page' => 'Ištrinti puslapį :page',
'Title' => 'Antraštė',
@@ -51,4 +51,4 @@
'Public' => 'Viešas',
'Registered' => 'Registruotas',
)
);
);

View File

@@ -7,10 +7,10 @@
'Content' => 'Conteúdo',
'Create new page' => 'Criar nova página',
'New page' => 'Nova página',
'Edit page' => 'Editar página',
'Edit page' => 'Editar página',
'Date' => 'Data',
'Clone' => 'Clonar',
'Edit' => 'Editar',
'Edit' => 'Editar',
'Delete' => 'Deletar',
'Delete page: :page' => 'Deletar a página: :page',
'Title' => 'Título',
@@ -51,4 +51,4 @@
'Public' => 'Público',
'Registered' => 'Registrado',
)
);
);

View File

@@ -4,13 +4,13 @@
'pages' => array(
'Pages' => 'Страницы',
'Pages manager' => 'Менеджер страниц',
'Content' => 'Контент',
'Content' => 'Контент',
'Create New Page' => 'Создать новую страницу',
'New Page' => 'Новая страница',
'Edit Page' => 'Редактирование страницы',
'Edit Page' => 'Редактирование страницы',
'Date' => 'Дата',
'Clone' => 'Клонировать',
'Edit' => 'Редактировать',
'Edit' => 'Редактировать',
'Delete' => 'Удалить',
'Delete page: :page' => 'Удалить страницу: :page',
'Title' => 'Заголовок',
@@ -51,4 +51,4 @@
'Public' => 'Публичный',
'Registered' => 'Зарегистрированным',
),
);
);

View File

@@ -4,13 +4,13 @@
'pages' => array(
'Pages' => 'Сторінки',
'Pages manager' => 'Менеджер сторінок',
'Content' => 'Контент',
'Content' => 'Контент',
'Create New Page' => 'Створити нову сторінку',
'New Page' => 'Нова сторінка',
'Edit Page' => 'Редагування сторінки',
'Edit Page' => 'Редагування сторінки',
'Date' => 'Дата',
'Clone' => 'Клонувати',
'Edit' => 'Редагувати',
'Edit' => 'Редагувати',
'Delete' => 'Видалити',
'Delete page: :page' => 'Видалити сторінку: :page',
'Title' => 'Заголовок',
@@ -51,4 +51,4 @@
'Public' => 'Публічний',
'Registered' => 'Зареєстрованим',
),
);
);

File diff suppressed because it is too large Load Diff

View File

@@ -1,206 +1,195 @@
<?php
/**
* Pages plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
*
*/
// Register plugin
Plugin::register( __FILE__,
__('Pages' , 'pages'),
__('Pages manager', 'pages'),
'1.0.0',
'Awilum',
'http://monstra.org/',
'pages',
'box');
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor'))) {
// Include Admin
Plugin::Admin('pages', 'box');
}
// Add Plugin Javascript
Javascript::add('plugins/box/pages/js/pages.js', 'backend');
/**
* Pages Class
*/
class Pages extends Frontend
{
/**
* Pages plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
* Current page data
*
* @var object
*/
public static $page = null;
/**
* Pages tables
*
* @var object
*/
public static $pages = null;
// Register plugin
Plugin::register( __FILE__,
__('Pages' , 'pages'),
__('Pages manager', 'pages'),
'1.0.0',
'Awilum',
'http://monstra.org/',
'pages',
'box');
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor'))) {
// Include Admin
Plugin::Admin('pages', 'box');
/**
* Requested page
*
* @var string
*/
public static $requested_page = null;
/**
* Main function
*/
public static function main()
{
Pages::$pages = new Table('pages');
Pages::$page = Pages::pageLoader();
}
/**
* Page loader
*
* @param boolean $return_data data
* @return array
*/
public static function pageLoader($return_data = true)
{
$requested_page = Pages::lowLoader(Uri::segments());
Pages::$requested_page = $requested_page;
// Add Plugin Javascript
Javascript::add('plugins/box/pages/js/pages.js', 'backend');
return Pages::$pages->select('[slug="'.$requested_page.'"]', null);
}
/**
* Pages Class
* Load current page
*
* @global string $defpage default page
* @param array $data uri
* @return string
*/
class Pages extends Frontend {
public static function lowLoader($data)
{
$defpage = Option::get('defaultpage');
// If data count 2 then it has Parent/Child
if (count($data) >= 2) {
/**
* Current page data
*
* @var object
*/
public static $page = null;
// If exists parent file
if (count(Pages::$pages->select('[slug="'.$data[0].'"]')) !== 0) {
// Get child file and get parent page name
$child_page = Pages::$pages->select('[slug="'.$data[1].'"]', null);
/**
* Pages tables
*
* @var object
*/
public static $pages = null;
/**
* Requested page
*
* @var string
*/
public static $requested_page = null;
/**
* Main function
*/
public static function main() {
Pages::$pages = new Table('pages');
Pages::$page = Pages::pageLoader();
}
/**
* Page loader
*
* @param boolean $return_data data
* @return array
*/
public static function pageLoader($return_data = true) {
$requested_page = Pages::lowLoader(Uri::segments());
Pages::$requested_page = $requested_page;
return Pages::$pages->select('[slug="'.$requested_page.'"]', null);
}
/**
* Load current page
*
* @global string $defpage default page
* @param array $data uri
* @return string
*/
public static function lowLoader($data) {
$defpage = Option::get('defaultpage');
// If data count 2 then it has Parent/Child
if (count($data) >= 2) {
// If exists parent file
if (count(Pages::$pages->select('[slug="'.$data[0].'"]')) !== 0) {
// Get child file and get parent page name
$child_page = Pages::$pages->select('[slug="'.$data[1].'"]', null);
// If child page parent is not empty then get his parent
if (count($child_page) == 0) {
$c_p = '';
// If child page parent is not empty then get his parent
if (count($child_page) == 0) {
$c_p = '';
} else {
if ($child_page['parent'] != '') {
$c_p = $child_page['parent'];
} else {
if ($child_page['parent'] != '') {
$c_p = $child_page['parent'];
} else {
$c_p = '';
}
$c_p = '';
}
}
// Hack For old Monstra
$child_page['access'] = (isset($child_page['access'])) ? $child_page['access'] : 'public' ;
// Check is child_parent -> request parent
if ($c_p == $data[0]) {
if (count($data) < 3) { // Checking only for the parent and one child, the remaining issue 404
if ((($child_page['status'] == 'published') or
(Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor')))) and
($child_page['access'] == 'public')) {
// Hack For old Monstra
$child_page['access'] = (isset($child_page['access'])) ? $child_page['access'] : 'public' ;
$id = $data[1];
// Check is child_parent -> request parent
if ($c_p == $data[0]) {
} elseif (($child_page['access'] == 'registered') and
(Session::exists('user_id')) and
($child_page['status'] == 'published')) {
$id = $data[1];
if (count($data) < 3) { // Checking only for the parent and one child, the remaining issue 404
if ((($child_page['status'] == 'published') or
(Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor')))) and
($child_page['access'] == 'public')) {
$id = $data[1];
} elseif (($child_page['access'] == 'registered') and
(Session::exists('user_id')) and
($child_page['status'] == 'published')) {
$id = $data[1];
} else {
$id = 'error404';
Response::status(404);
}
} else {
$id = 'error404';
$id = 'error404';
Response::status(404);
}
} else {
$id = 'error404';
Response::status(404);
}
} else {
$id = 'error404';
Response::status(404);
}
} else {
$id = 'error404';
Response::status(404);
}
} else { // Only parent page come
if(empty($data[0])) {
$id = $defpage;
} else { // Only parent page come
if (empty($data[0])) {
} else {
$id = $defpage;
// Get current page
$current_page = Pages::$pages->select('[slug="'.$data[0].'"]', null);
// Hack For old Monstra
$current_page['access'] = (isset($current_page['access'])) ? $current_page['access'] : 'public' ;
} else {
if (count($current_page) != 0) {
if ( ! empty($current_page['parent'])) {
$c_p = $current_page['parent'];
} else {
$c_p = '';
}
// Get current page
$current_page = Pages::$pages->select('[slug="'.$data[0].'"]', null);
// Hack For old Monstra
$current_page['access'] = (isset($current_page['access'])) ? $current_page['access'] : 'public' ;
if (count($current_page) != 0) {
if ( ! empty($current_page['parent'])) {
$c_p = $current_page['parent'];
} else {
$c_p = '';
}
} else {
$c_p = '';
}
// Check if this page has parent
if ($c_p !== '') {
// Check if this page has parent
if ($c_p !== '') {
if ($c_p == $data[0]) {
if (count(Pages::$pages->select('[slug="'.$data[0].'"]', null)) != 0) {
if ($c_p == $data[0]) {
if (count(Pages::$pages->select('[slug="'.$data[0].'"]', null)) != 0) {
if ((($current_page['status'] == 'published') or
(Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor')))) and
($current_page['access'] == 'public')) {
if ((($current_page['status'] == 'published') or
(Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor')))) and
($current_page['access'] == 'public')) {
$id = $data[0];
$id = $data[0];
} elseif (($current_page['access'] == 'registered') and
(Session::exists('user_id')) and
($current_page['status'] == 'published')) {
$id = $data[0];
} elseif (($current_page['access'] == 'registered') and
(Session::exists('user_id')) and
($current_page['status'] == 'published')) {
$id = $data[0];
} else {
$id = 'error404';
Response::status(404);
}
} else {
$id = 'error404';
Response::status(404);
@@ -210,284 +199,285 @@
Response::status(404);
}
} else {
$id = 'error404';
Response::status(404);
}
} else {
if (count(Pages::$pages->select('[slug="'.$data[0].'"]', null)) != 0) {
if ((($current_page['status'] == 'published') or
(Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor')))) and
($current_page['access'] == 'public')) {
if (count(Pages::$pages->select('[slug="'.$data[0].'"]', null)) != 0) {
if ((($current_page['status'] == 'published') or
(Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor')))) and
($current_page['access'] == 'public')) {
$id = $data[0];
$id = $data[0];
} elseif (($current_page['access'] == 'registered') and
(Session::exists('user_id')) and
($current_page['status'] == 'published')) {
} elseif (($current_page['access'] == 'registered') and
(Session::exists('user_id')) and
($current_page['status'] == 'published')) {
$id = $data[0];
$id = $data[0];
} else {
$id = 'error404';
Response::status(404);
}
} else {
$id = 'error404';
Response::status(404);
}
} else {
$id = 'error404';
Response::status(404);
}
}
}
// Return page name/id to load
return $id;
}
// Return page name/id to load
return $id;
}
/**
* Get pages template
*
* @return string
*/
public static function template() {
if (Pages::$page['template'] == '') return 'index'; else return Pages::$page['template'];
}
/**
* Get pages template
*
* @return string
*/
public static function template()
{
if (Pages::$page['template'] == '') return 'index'; else return Pages::$page['template'];
}
/**
* Get pages contents
*
* @return string
*/
public static function content($slug = '')
{
if ( ! empty($slug)) {
/**
* Get pages contents
*
* @return string
*/
public static function content($slug = '') {
$page = Table::factory('pages')->select('[slug="'.$slug.'"]', null);
if ( ! empty($slug)) {
if ( ! empty($page)) {
$page = Table::factory('pages')->select('[slug="'.$slug.'"]', null);
$content = Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt'));
if ( ! empty($page)) {
$content = Filter::apply('content', $content);
$content = Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt'));
$content = Filter::apply('content', $content);
return $content;
} else {
return '';
}
return $content;
} else {
return Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . Pages::$page['id'] . '.page.txt'));
return '';
}
}
/**
* Get pages title
*
* <code>
* echo Page::title();
* </code>
*
* @return string
*/
public static function title() {
return Pages::$page['title'];
}
/**
* Get pages Description
*
* <code>
* echo Page::description();
* </code>
*
* @return string
*/
public static function description() {
return Pages::$page['description'];
}
/**
* Get pages Keywords
*
* <code>
* echo Page::keywords();
* </code>
*
* @return string
*/
public static function keywords() {
return Pages::$page['keywords'];
} else {
return Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . Pages::$page['id'] . '.page.txt'));
}
}
/**
* Get pages title
*
* <code>
* echo Page::title();
* </code>
*
* @return string
*/
public static function title()
{
return Pages::$page['title'];
}
/**
* Add new shortcodes {page_author} {page_slug} {page_url} {page_date} {page_content}
* Get pages Description
*
* <code>
* echo Page::description();
* </code>
*
* @return string
*/
Shortcode::add('page_author', 'Page::author');
Shortcode::add('page_slug', 'Page::slug');
Shortcode::add('page_url', 'Page::url');
Shortcode::add('page_content', 'Page::_content');
Shortcode::add('page_date', 'Page::_date');
public static function description()
{
return Pages::$page['description'];
}
/**
* Page class
* Get pages Keywords
*
* <code>
* echo Page::keywords();
* </code>
*
* @return string
*/
class Page extends Pages {
public static function keywords()
{
return Pages::$page['keywords'];
}
}
/**
* Get date of current page
*
* <code>
* echo Page::date();
* </code>
*
* @param string $format Date format
* @return string
*/
public static function date($format = 'Y-m-d') {
return Date::format(Pages::$page['date'], $format);
}
/**
* Add new shortcodes {page_author} {page_slug} {page_url} {page_date} {page_content}
*/
Shortcode::add('page_author', 'Page::author');
Shortcode::add('page_slug', 'Page::slug');
Shortcode::add('page_url', 'Page::url');
Shortcode::add('page_content', 'Page::_content');
Shortcode::add('page_date', 'Page::_date');
/**
* Page class
*/
class Page extends Pages
{
/**
* Get date of current page
*
* <code>
* echo Page::date();
* </code>
*
* @param string $format Date format
* @return string
*/
public static function date($format = 'Y-m-d')
{
return Date::format(Pages::$page['date'], $format);
}
/**
* Get author of current page
*
* <code>
* echo Page::author();
* </code>
*
* @return string
*/
public static function author() {
return Pages::$page['author'];
}
/**
* Get author of current page
*
* <code>
* echo Page::author();
* </code>
*
* @return string
*/
public static function author()
{
return Pages::$page['author'];
}
/**
* Get children pages for a specific parent page
*
* <code>
* $pages = Page::children('page');
* </code>
*
* @param string $parent Parent page
* @return array
*/
public static function children($parent)
{
return Pages::$pages->select('[parent="'.(string) $parent.'"]', 'all');
}
/**
* Get children pages for a specific parent page
*
* <code>
* $pages = Page::children('page');
* </code>
*
* @param string $parent Parent page
* @return array
*/
public static function children($parent) {
return Pages::$pages->select('[parent="'.(string)$parent.'"]', 'all');
}
/**
* Get the available children pages for requested page.
*
* <code>
* echo Page::available();
* </code>
*
*/
public static function available()
{
$pages = Pages::$pages->select('[parent="'.Pages::$requested_page.'"]', 'all');
// Display view
View::factory('box/pages/views/frontend/available_pages')
->assign('pages', $pages)
->display();
}
/**
* Get page breadcrumbs
*
* <code>
* echo Page::breadcrumbs();
* </code>
*
*/
public static function breadcrumbs()
{
$current_page = Pages::$requested_page;
$parent_page = '';
if ($current_page !== 'error404') {
$page = Pages::$pages->select('[slug="'.$current_page.'"]', null);
if (trim($page['parent']) !== '') {
$parent = true;
$parent_page = Pages::$pages->select('[slug="'.$page['parent'].'"]', null);
} else {
$parent = false;
}
/**
* Get the available children pages for requested page.
*
* <code>
* echo Page::available();
* </code>
*
*/
public static function available() {
$pages = Pages::$pages->select('[parent="'.Pages::$requested_page.'"]', 'all');
// Display view
View::factory('box/pages/views/frontend/available_pages')
->assign('pages', $pages)
View::factory('box/pages/views/frontend/breadcrumbs')
->assign('current_page', $current_page)
->assign('page', $page)
->assign('parent', $parent)
->assign('parent_page', $parent_page)
->display();
}
}
/**
* Get page breadcrumbs
*
* <code>
* echo Page::breadcrumbs();
* </code>
*
*/
public static function breadcrumbs() {
$current_page = Pages::$requested_page;
$parent_page = '';
if ($current_page !== 'error404') {
$page = Pages::$pages->select('[slug="'.$current_page.'"]', null);
if (trim($page['parent']) !== '') {
$parent = true;
$parent_page = Pages::$pages->select('[slug="'.$page['parent'].'"]', null);
} else {
$parent = false;
}
// Display view
View::factory('box/pages/views/frontend/breadcrumbs')
->assign('current_page', $current_page)
->assign('page', $page)
->assign('parent', $parent)
->assign('parent_page', $parent_page)
->display();
}
}
/**
* Get page url
*
* <code>
* echo Page::url();
* </code>
*
*/
public static function url()
{
return Option::get('siteurl').Pages::$page['slug'];
}
/**
* Get page slug
*
* <code>
* echo Page::slug();
* </code>
*
*/
public static function slug()
{
return Pages::$page['slug'];
}
/**
* Get page url
*
* <code>
* echo Page::url();
* </code>
*
*/
public static function url() {
return Option::get('siteurl').Pages::$page['slug'];
/**
* Get page meta robots
*
* <code>
* echo Page::robots();
* </code>
*
*/
public static function robots()
{
if (Pages::$page !== null) {
$_index = (isset(Pages::$page['robots_index'])) ? Pages::$page['robots_index'] : '';
$_follow = (isset(Pages::$page['robots_follow'])) ? Pages::$page['robots_follow'] : '';
$robots = ( ! empty($_index) && ! empty($_follow)) ? $_index.', '.$_follow : '';
} else {
$robots = '';
}
return $robots;
}
/**
* Get page slug
*
* <code>
* echo Page::slug();
* </code>
*
*/
public static function slug() {
return Pages::$page['slug'];
}
public static function _date($attributes)
{
return Page::date((isset($attributes['format'])) ? $attributes['format'] : 'Y-m-d');
}
public static function _content($attributes)
{
return Page::content((isset($attributes['name']) ? $attributes['name'] : ''));
}
/**
* Get page meta robots
*
* <code>
* echo Page::robots();
* </code>
*
*/
public static function robots() {
if (Pages::$page !== null) {
$_index = (isset(Pages::$page['robots_index'])) ? Pages::$page['robots_index'] : '';
$_follow = (isset(Pages::$page['robots_follow'])) ? Pages::$page['robots_follow'] : '';
$robots = ( ! empty($_index) && ! empty($_follow)) ? $_index.', '.$_follow : '';
} else {
$robots = '';
}
return $robots;
}
public static function _date($attributes) {
return Page::date((isset($attributes['format'])) ? $attributes['format'] : 'Y-m-d');
}
public static function _content($attributes) {
return Page::content((isset($attributes['name']) ? $attributes['name'] : ''));
}
}
}

View File

@@ -3,7 +3,7 @@
<?php if (Notification::get('success')) Alert::success(Notification::get('success')); ?>
<?php
<?php
echo (
Form::open().
Form::hidden('csrf', Security::token())
@@ -15,7 +15,7 @@
<li <?php if (Notification::get('metadata')) { ?>class="active"<?php } ?>><a href="#metadata" data-toggle="tab"><?php echo __('Metadata', 'pages'); ?></a></li>
<li <?php if (Notification::get('settings')) { ?>class="active"<?php } ?>><a href="#settings" data-toggle="tab"><?php echo __('Settings', 'pages'); ?></a></li>
</ul>
<div class="tab-content tab-page">
<div class="tab-pane <?php if (Notification::get('page')) { ?>active<?php } ?>" id="page">
<?php
@@ -25,16 +25,16 @@
);
if (isset($errors['pages_empty_title'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_empty_title'].'</span>';
echo (
echo (
Html::br(2).
Form::label('page_name', __('Name (slug)', 'pages')).
Form::label('page_name', __('Name (slug)', 'pages')).
Form::input('page_name', $post_name, array('class' => (isset($errors['pages_empty_name'])) ? 'input-xxlarge error-field' : 'input-xxlarge'))
);
if (isset($errors['pages_exists'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_exists'].'</span>';
if (isset($errors['pages_empty_name'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_empty_name'].'</span>';
?>
</div>
<div class="tab-pane <?php if (Notification::get('metadata')) { ?>active<?php } ?>" id="metadata">
<?php
@@ -43,14 +43,14 @@
Form::input('page_keywords', $post_keywords, array('class' => 'input-xxlarge')).
Html::br(2).
Form::label('page_description', __('Description', 'pages')).
Form::textarea('page_description', $post_description, array('class' => 'input-xxlarge'))
Form::textarea('page_description', $post_description, array('class' => 'input-xxlarge'))
);
?>
<?php
echo (
Html::br(2).
Form::label('robots', __('Search Engines Robots', 'pages')).
<?php
echo (
Html::br(2).
Form::label('robots', __('Search Engines Robots', 'pages')).
'no Index'.Html::nbsp().Form::checkbox('robots_index', 'index', $post_robots_index).Html::nbsp(2).
'no Follow'.Html::nbsp().Form::checkbox('robots_follow', 'follow', $post_robots_follow)
);
@@ -59,34 +59,34 @@
<div class="tab-pane <?php if (Notification::get('settings')) { ?>active<?php } ?>" id="settings">
<div class="row-fluid">
<div class="span3">
<?php
<?php
echo (
Form::label('pages', __('Parent', 'pages')).
Form::select('pages', $pages_array, $parent_page)
Form::select('pages', $pages_array, $parent_page)
);
?>
</div>
</div>
<div class="span3">
<?php
echo (
Form::label('templates', __('Template', 'pages')).
Form::select('templates', $templates_array, $post_template)
);
?>
</div>
<div class="span3">
<?php
echo (
Form::label('status', __('Status', 'pages')).
Form::select('status', $status_array, $post_status)
);
?>
</div>
<div class="span3">
<?php
<?php
echo (
Form::label('status', __('Status', 'pages')).
Form::select('status', $status_array, $post_status)
);
?>
</div>
<div class="span3">
<?php
echo (
Form::label('access', __('Access', 'pages')).
Form::select('access', $access_array, $post_access)
Form::select('access', $access_array, $post_access)
);
?>
</div>

View File

@@ -3,7 +3,7 @@
<?php if (Notification::get('success')) Alert::success(Notification::get('success')); ?>
<?php
<?php
echo (
Form::open().
Form::hidden('csrf', Security::token()).
@@ -18,7 +18,7 @@
<li <?php if (Notification::get('metadata')) { ?>class="active"<?php } ?>><a href="#metadata" data-toggle="tab"><?php echo __('Metadata', 'pages'); ?></a></li>
<li <?php if (Notification::get('settings')) { ?>class="active"<?php } ?>><a href="#settings" data-toggle="tab"><?php echo __('Settings', 'pages'); ?></a></li>
</ul>
<div class="tab-content tab-page">
<div class="tab-pane <?php if (Notification::get('page')) { ?>active<?php } ?>" id="page">
<?php
@@ -30,7 +30,7 @@
if (Request::get('name') !== 'error404') {
echo (
Html::br(2).
Html::br(2).
Form::label('page_name', __('Name (slug)', 'pages'))
);
}
@@ -49,19 +49,18 @@
</div>
<div class="tab-pane <?php if (Notification::get('metadata')) { ?>active<?php } ?>" id="metadata">
<?php
echo (
Form::label('page_keywords', __('Keywords', 'pages')).
Form::input('page_keywords', $keywords_to_edit, array('class' => 'input-xxlarge')).
Html::br(2).
Form::label('page_description', __('Description', 'pages')).
Form::textarea('page_description', $description_to_edit, array('class' => 'input-xxlarge'))
Form::textarea('page_description', $description_to_edit, array('class' => 'input-xxlarge'))
);
echo (
Html::br(2).
Form::label('robots', __('Search Engines Robots', 'pages')).
echo (
Html::br(2).
Form::label('robots', __('Search Engines Robots', 'pages')).
'no Index'.Html::nbsp().Form::checkbox('robots_index', 'index', $post_robots_index).Html::nbsp(2).
'no Follow'.Html::nbsp().Form::checkbox('robots_follow', 'follow', $post_robots_follow)
);
@@ -75,7 +74,7 @@
} else {
?>
<div class="span3">
<?php
<?php
echo (
Form::label('pages', __('Parent', 'pages')).
Form::select('pages', $pages_array, $parent_page)
@@ -92,16 +91,16 @@
echo (
Form::label('templates', __('Template', 'pages')).
Form::select('templates', $templates_array, $template)
);
);
?>
</div>
<?php
<?php
if (Request::get('name') == 'error404') {
echo Form::hidden('status', $status);
} else {
?>
<div class="span3">
<?php
<?php
echo (
Form::label('status', __('Status', 'pages')).
Form::select('status', $status_array, $status)
@@ -109,13 +108,13 @@
?>
</div>
<?php } ?>
<?php
<?php
if (Request::get('name') == 'error404') {
echo Form::hidden('access', $access);
} else {
?>
<div class="span3">
<?php
<?php
echo (
Form::label('access', __('Access', 'pages')).
Form::select('access', $access_array, $access)
@@ -127,7 +126,6 @@
</div>
</div>
<br /><br />
<?php Action::run('admin_editor', array(Html::toText($to_edit))); ?>

View File

@@ -4,10 +4,10 @@
<?php if (Notification::get('success')) Alert::success(Notification::get('success')); ?>
<?php
echo (
echo (
Html::anchor(__('Create New Page', 'pages'), 'index.php?id=pages&action=add_page', array('title' => __('Create New Page', 'pages'), 'class' => 'btn btn-small')). Html::nbsp(3).
Html::anchor(__('Edit 404 Page', 'pages'), 'index.php?id=pages&action=edit_page&name=error404', array('title' => __('Create New Page', 'pages'), 'class' => 'btn btn-small'))
);
Html::anchor(__('Edit 404 Page', 'pages'), 'index.php?id=pages&action=edit_page&name=error404', array('title' => __('Create New Page', 'pages'), 'class' => 'btn btn-small'))
);
?>
<br /><br />
@@ -26,33 +26,33 @@
</thead>
<tbody>
<?php
if (count($pages) != 0) {
if (count($pages) != 0) {
foreach ($pages as $page) {
if ($page['parent'] != '') { $dash = Html::arrow('right').'&nbsp;&nbsp;'; } else { $dash = ""; }
?>
<?php if ($page['slug'] != 'error404') { ?>
<?php
$expand = PagesAdmin::$pages->select('[slug="'.(string)$page['parent'].'"]', null);
$expand = PagesAdmin::$pages->select('[slug="'.(string) $page['parent'].'"]', null);
if ($page['parent'] !== '' && isset($expand['expand']) && $expand['expand'] == '1') { $visibility = 'style="display:none;"'; } else { $visibility = ''; }
?>
<tr <?php echo $visibility; ?> <?php if(trim($page['parent']) !== '') {?> rel="children_<?php echo $page['parent']; ?>" <?php } ?>>
<td>
<?php
if (count(PagesAdmin::$pages->select('[parent="'.(string)$page['slug'].'"]', 'all')) > 0) {
<tr <?php echo $visibility; ?> <?php if (trim($page['parent']) !== '') {?> rel="children_<?php echo $page['parent']; ?>" <?php } ?>>
<td>
<?php
if (count(PagesAdmin::$pages->select('[parent="'.(string) $page['slug'].'"]', 'all')) > 0) {
if (isset($page['expand']) && $page['expand'] == '1') {
echo '<a href="javascript:;" class="btn-expand parent" token="'.Security::token().'" rel="'.$page['slug'].'">+</a>';
} else {
echo '<a href="javascript:;" class="btn-expand parent" token="'.Security::token().'" rel="'.$page['slug'].'">-</a>';
}
}
?>
</td>
?>
</td>
<td>
<?php
$_parent = (trim($page['parent']) == '') ? '' : $page['parent'];
$parent = (trim($page['parent']) == '') ? '' : $page['parent'].'/';
echo (trim($page['parent']) == '') ? '' : '&nbsp;';
echo $dash.Html::anchor(Html::toText($page['title']), $site_url.$parent.$page['slug'], array('target' => '_blank', 'rel' => 'children_'.$_parent));
echo $dash.Html::anchor(Html::toText($page['title']), $site_url.$parent.$page['slug'], array('target' => '_blank', 'rel' => 'children_'.$_parent));
?>
</td>
<td class="hidden-phone">
@@ -67,7 +67,7 @@
<td class="hidden-phone">
<?php echo Date::format($page['date'], "j.n.Y"); ?>
</td>
<td>
<td>
<div class="pull-right">
<div class="btn-group">
<?php echo Html::anchor(__('Edit', 'pages'), 'index.php?id=pages&action=edit_page&name='.$page['slug'], array('class' => 'btn btn-small')); ?>
@@ -77,19 +77,19 @@
<li><a href="index.php?id=pages&action=add_page&parent_page=<?php echo $page['slug']; ?>" title="<?php echo __('Create New Page', 'pages'); ?>"><?php echo __('Add', 'pages'); ?></a></li>
<?php } ?>
<li><?php echo Html::anchor(__('Clone', 'pages'), 'index.php?id=pages&action=clone_page&name='.$page['slug'].'&token='.Security::token(), array('title' => __('Clone', 'pages'))); ?></li>
</ul>
</ul>
<?php echo Html::anchor(__('Delete', 'pages'),
'index.php?id=pages&action=delete_page&name='.$page['slug'].'&token='.Security::token(),
array('class' => 'btn btn-actions btn-small btn-actions-default', 'onclick' => "return confirmDelete('".__("Delete page: :page", 'pages', array(':page' => Html::toText($page['title'])))."')"));
?>
</div>
</div>
</div>
</div>
</td>
</tr>
</tr>
<?php } ?>
<?php
}
}
}
?>
</tbody>

View File

@@ -1,5 +1,5 @@
<ul>
<?php foreach ($pages as $page) { ?>
<li><a href="<?php echo $page['parent'].'/'.$page['slug']; ?>"><?php echo $page['title']; ?></a></li>
<li><a href="<?php echo $page['parent'].'/'.$page['slug']; ?>"><?php echo $page['title']; ?></a></li>
<?php } ?>
</ul>
</ul>

View File

@@ -2,4 +2,4 @@
<a href="<?php echo Site::url().$page['parent']; ?>"><?php echo $parent_page['title']; ?></a>&nbsp;<span>&rarr;</span>&nbsp;<a href="<?php echo Site::url().$page['parent'].'/'.$page['slug']; ?>"><?php echo $page['title']; ?></a>
<?php } else { ?>
<a href="<?php echo Site::url().$page['slug']; ?>"><?php echo $page['title']; ?></a>
<?php } ?>
<?php }