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

Monstra General Updates

This commit is contained in:
Awilum
2015-10-16 18:09:58 +03:00
parent 43297d2006
commit 1854cfe80e
34 changed files with 560 additions and 712 deletions

View File

@@ -1,20 +1,17 @@
<?php defined('MONSTRA_ACCESS') or die('No direct script access.');
/**
* Monstra Engine
* Monstra
*
* This source file is part of the Monstra Engine. More information,
* documentation and tutorials can be found at http://monstra.org
*
* @package Monstra
*
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @copyright 2012-2014 Romanenko Sergey / Awilum <awilum@msn.com>
* @package Monstra
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @link http://monstra.org
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Action
{
/**
@@ -102,23 +99,15 @@ class Action
} else {
call_user_func_array($action['function'], $args);
}
} else {
if ($return) {
return call_user_func_array($action['function'], $action['args']);
} else {
call_user_func_array($action['function'], $action['args']);
}
}
}
}
}
}
}

View File

@@ -1,15 +1,11 @@
<?php defined('MONSTRA_ACCESS') or die('No direct script access.');
/**
* Monstra Engine
* Monstra
*
* This source file is part of the Monstra Engine. More information,
* documentation and tutorials can be found at http://monstra.org
*
* @package Monstra
*
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @copyright 2012-2014 Romanenko Sergey / Awilum <awilum@msn.com>
* @package Monstra
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @link http://monstra.org
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -17,5 +13,7 @@
class Backend
{
public static function main() { }
public static function main()
{
}
}

View File

@@ -1,20 +1,17 @@
<?php defined('MONSTRA_ACCESS') or die('No direct script access.');
/**
* Monstra Engine
* Monstra
*
* This source file is part of the Monstra Engine. More information,
* documentation and tutorials can be found at http://monstra.org
*
* @package Monstra
*
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @copyright 2012-2014 Romanenko Sergey / Awilum <awilum@msn.com>
* @package Monstra
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @link http://monstra.org
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Filter
{
/**
@@ -52,12 +49,12 @@ class Filter
$args = array_slice(func_get_args(), 2);
if ( ! isset(Filter::$filters[$filter_name])) {
if (! isset(Filter::$filters[$filter_name])) {
return $value;
}
foreach (Filter::$filters[$filter_name] as $priority => $functions) {
if ( ! is_null($functions)) {
if (! is_null($functions)) {
foreach ($functions as $function) {
$all_args = array_merge(array($value), $args);
$function_name = $function['function'];
@@ -120,5 +117,4 @@ class Filter
return true;
}
}

View File

@@ -1,27 +1,40 @@
<?php defined('MONSTRA_ACCESS') or die('No direct script access.');
/**
* Monstra Engine
* Monstra
*
* This source file is part of the Monstra Engine. More information,
* documentation and tutorials can be found at http://monstra.org
*
* @package Monstra
*
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @copyright 2012-2014 Romanenko Sergey / Awilum <awilum@msn.com>
* @package Monstra
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @link http://monstra.org
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Frontend
{
public static function main() { }
public static function title() { return ''; }
public static function description() { return ''; }
public static function keywords() { return ''; }
public static function template() { return 'index'; }
public static function content() { return ''; }
public static function main()
{
}
public static function title()
{
return '';
}
public static function description()
{
return '';
}
public static function keywords()
{
return '';
}
public static function template()
{
return 'index';
}
public static function content()
{
return '';
}
}

View File

@@ -1,20 +1,17 @@
<?php defined('MONSTRA_ACCESS') or die('No direct script access.');
/**
* Monstra Engine
* Monstra
*
* This source file is part of the Monstra Engine. More information,
* documentation and tutorials can be found at http://monstra.org
*
* @package Monstra
*
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @copyright 2012-2014 Romanenko Sergey / Awilum <awilum@msn.com>
* @package Monstra
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @link http://monstra.org
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class I18n
{
/**
@@ -77,7 +74,9 @@ class I18n
*/
public static function init($locale)
{
if ( ! isset(self::$instance)) self::$instance = new I18n($locale);
if (! isset(self::$instance)) {
self::$instance = new I18n($locale);
}
return self::$instance;
}
@@ -116,7 +115,6 @@ class I18n
// Loop through each installed plugin
foreach ($records as $record) {
if (is_dir(ROOT . DS . dirname($record['location']) . DS . 'languages')) {
// Init var
@@ -127,7 +125,6 @@ class I18n
// Merge the language strings into the sub table
$t = array_merge($t, include ROOT . DS . dirname($record['location']) . DS . 'languages' . DS . $locale . '.lang.php');
}
// Append the sub table, preventing less specific language files from overloading more specific files
@@ -164,9 +161,12 @@ class I18n
$string = (string) $string;
// Return string
if (isset(I18n::$dictionary[$namespace][$string])) return I18n::$dictionary[$namespace][$string]; else return $string;
if (isset(I18n::$dictionary[$namespace][$string])) {
return I18n::$dictionary[$namespace][$string];
} else {
return $string;
}
}
}
/**

View File

@@ -1,20 +1,17 @@
<?php defined('MONSTRA_ACCESS') or die('No direct script access.');
/**
* Monstra Engine
* Monstra
*
* This source file is part of the Monstra Engine. More information,
* documentation and tutorials can be found at http://monstra.org
*
* @package Monstra
*
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @copyright 2012-2014 Romanenko Sergey / Awilum <awilum@msn.com>
* @package Monstra
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @link http://monstra.org
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Javascript
{
/**
@@ -66,7 +63,6 @@ class Javascript
// Load javascripts
if (count(Javascript::$javascripts) > 0) {
$backend_buffer = '';
$backend_regenerate = false;
@@ -80,8 +76,8 @@ class Javascript
// Build backend site javascript
foreach ($javascripts as $javascript) {
if ((file_exists(ROOT . DS . $javascript['file'])) and (($javascript['load'] == 'backend') or ($javascript['load'] == 'both')) ) {
if ( ! file_exists($backend_site_js_path) or filemtime(ROOT . DS . $javascript['file']) > filemtime($backend_site_js_path)) {
if ((file_exists(ROOT . DS . $javascript['file'])) and (($javascript['load'] == 'backend') or ($javascript['load'] == 'both'))) {
if (! file_exists($backend_site_js_path) or filemtime(ROOT . DS . $javascript['file']) > filemtime($backend_site_js_path)) {
$backend_regenerate = true;
break;
}
@@ -91,20 +87,19 @@ class Javascript
// Regenerate site javascript
if ($backend_regenerate) {
foreach ($javascripts as $javascript) {
if ((file_exists(ROOT . DS . $javascript['file'])) and (($javascript['load'] == 'backend') or ($javascript['load'] == 'both')) ) {
if ((file_exists(ROOT . DS . $javascript['file'])) and (($javascript['load'] == 'backend') or ($javascript['load'] == 'both'))) {
$backend_buffer .= file_get_contents(ROOT . DS . $javascript['file'])."\n";
}
}
file_put_contents($backend_site_js_path, $backend_buffer);
$backend_regenerate = false;
}
} else {
// Build frontend site javascript
foreach ($javascripts as $javascript) {
if ((file_exists(ROOT . DS . $javascript['file'])) and (($javascript['load'] == 'frontend') or ($javascript['load'] == 'both')) ) {
if ( ! file_exists($frontend_site_js_path) or filemtime(ROOT . DS . $javascript['file']) > filemtime($frontend_site_js_path)) {
if ((file_exists(ROOT . DS . $javascript['file'])) and (($javascript['load'] == 'frontend') or ($javascript['load'] == 'both'))) {
if (! file_exists($frontend_site_js_path) or filemtime(ROOT . DS . $javascript['file']) > filemtime($frontend_site_js_path)) {
$frontend_regenerate = true;
break;
}
@@ -114,14 +109,13 @@ class Javascript
// Regenerate site javascript
if ($frontend_regenerate) {
foreach ($javascripts as $javascript) {
if ((file_exists(ROOT . DS . $javascript['file'])) and (($javascript['load'] == 'frontend') or ($javascript['load'] == 'both')) ) {
if ((file_exists(ROOT . DS . $javascript['file'])) and (($javascript['load'] == 'frontend') or ($javascript['load'] == 'both'))) {
$frontend_buffer .= file_get_contents(ROOT . DS . $javascript['file'])."\n";
}
}
file_put_contents($frontend_site_js_path, $frontend_buffer);
$frontend_regenerate = false;
}
}
// Render
@@ -136,9 +130,8 @@ class Javascript
/**
* javascriptVersionIncrement
*/
public static function javascriptVersionIncrement() {
Option::update('javascript_version', (int) Option::get('javascript_version') + 1);
public static function javascriptVersionIncrement()
{
Option::update('javascript_version', (int) Option::get('javascript_version') + 1);
}
}

View File

@@ -1,20 +1,17 @@
<?php defined('MONSTRA_ACCESS') or die('No direct script access.');
/**
* Monstra Engine
* Monstra
*
* This source file is part of the Monstra Engine. More information,
* documentation and tutorials can be found at http://monstra.org
*
* @package Monstra
*
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @copyright 2012-2014 Romanenko Sergey / Awilum <awilum@msn.com>
* @package Monstra
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @link http://monstra.org
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Navigation
{
/**
@@ -83,7 +80,11 @@ class Navigation
foreach ($items as $item) {
// If current plugin id == selected item id then set class to current
if (Request::get('id') == $item['id'] && $item['external'] == false) $class = 'class = "current" '; else $class = '';
if (Request::get('id') == $item['id'] && $item['external'] == false) {
$class = 'class = "current" ';
} else {
$class = '';
}
// If current category == item category and navigation type is left them draw this item
if ($item['category'] == $category && $item['type'] == Navigation::LEFT) {
@@ -133,7 +134,11 @@ class Navigation
foreach ($items as $item) {
// If current plugin id == selected item id then set class to current
if (Request::get('id') == $item['id'] && $item['external'] == false) $class = 'class = "current" '; else $class = '';
if (Request::get('id') == $item['id'] && $item['external'] == false) {
$class = 'class = "current" ';
} else {
$class = '';
}
// If current category == item category and navigation type is left them draw this item
if ($item['category'] == $category && $item['type'] == Navigation::LEFT) {
@@ -158,7 +163,6 @@ class Navigation
}
}
}
}
/**
@@ -179,7 +183,11 @@ class Navigation
foreach ($items as $item) {
// If current plugin id == selected item id then set class to current
if (Request::get('id') == $item['id'] && $item['external'] == false) $class = 'selected = "selected" '; else $class = '';
if (Request::get('id') == $item['id'] && $item['external'] == false) {
$class = 'selected = "selected" ';
} else {
$class = '';
}
// If current category == item category and navigation type is left them draw this item
if ($item['category'] == $category && $item['type'] == Navigation::LEFT) {
@@ -191,5 +199,4 @@ class Navigation
}
}
}
}

View File

@@ -1,20 +1,17 @@
<?php defined('MONSTRA_ACCESS') or die('No direct script access.');
/**
* Monstra Engine
* Monstra
*
* This source file is part of the Monstra Engine. More information,
* documentation and tutorials can be found at http://monstra.org
*
* @package Monstra
*
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @copyright 2012-2014 Romanenko Sergey / Awilum <awilum@msn.com>
* @package Monstra
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @link http://monstra.org
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Plugin
{
/**
@@ -45,7 +42,9 @@ class Plugin
*/
public static function init()
{
if ( ! isset(self::$instance)) self::$instance = new Plugin();
if (! isset(self::$instance)) {
self::$instance = new Plugin();
}
return self::$instance;
}
@@ -102,7 +101,7 @@ class Plugin
if (BACKEND) {
// Plugin admin folder
if ( ! empty($alt_folder)) {
if (! empty($alt_folder)) {
$folder = $alt_folder . DS . strtolower($plug);
} else {
$folder = strtolower($plug);
@@ -157,7 +156,11 @@ class Plugin
$id = strtolower(basename($file, '.plugin.php'));
// Set plugin privilege 'box' if $box is true
if ($box) $privilege = 'box'; else $privilege = '';
if ($box) {
$privilege = 'box';
} else {
$privilege = '';
}
// Register plugin in global plugins array.
Plugin::$plugins[$id] = array(
@@ -175,9 +178,8 @@ class Plugin
// Example:
// www.example.org/guestbook
// www.example.org/news
if ( ! empty($component)) {
if (! empty($component)) {
Plugin::$components[] = $component;
}
}
}

View File

@@ -1,20 +1,17 @@
<?php defined('MONSTRA_ACCESS') or die('No direct script access.');
/**
* Monstra Engine
* Monstra
*
* This source file is part of the Monstra Engine. More information,
* documentation and tutorials can be found at http://monstra.org
*
* @package Monstra
*
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @copyright 2012-2014 Romanenko Sergey / Awilum <awilum@msn.com>
* @package Monstra
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @link http://monstra.org
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Stylesheet
{
/**
@@ -66,7 +63,6 @@ class Stylesheet
// Load stylesheets
if (count(Stylesheet::$stylesheets) > 0) {
$backend_buffer = '';
$backend_regenerate = false;
@@ -80,8 +76,8 @@ class Stylesheet
// Build backend site stylesheets
foreach ($stylesheets as $stylesheet) {
if ((file_exists(ROOT . DS . $stylesheet['file'])) and (($stylesheet['load'] == 'backend') or ($stylesheet['load'] == 'both')) ) {
if ( ! file_exists($backend_site_css_path) or filemtime(ROOT . DS . $stylesheet['file']) > filemtime($backend_site_css_path)) {
if ((file_exists(ROOT . DS . $stylesheet['file'])) and (($stylesheet['load'] == 'backend') or ($stylesheet['load'] == 'both'))) {
if (! file_exists($backend_site_css_path) or filemtime(ROOT . DS . $stylesheet['file']) > filemtime($backend_site_css_path)) {
$backend_regenerate = true;
break;
}
@@ -91,7 +87,7 @@ class Stylesheet
// Regenerate site stylesheet
if ($backend_regenerate) {
foreach ($stylesheets as $stylesheet) {
if ((file_exists(ROOT . DS . $stylesheet['file'])) and (($stylesheet['load'] == 'backend') or ($stylesheet['load'] == 'both')) ) {
if ((file_exists(ROOT . DS . $stylesheet['file'])) and (($stylesheet['load'] == 'backend') or ($stylesheet['load'] == 'both'))) {
$backend_buffer .= file_get_contents(ROOT . DS . $stylesheet['file']);
}
}
@@ -99,13 +95,12 @@ class Stylesheet
file_put_contents($backend_site_css_path, MinifyCSS::process($backend_buffer));
$backend_regenerate = false;
}
} else {
// Build frontend site stylesheets
foreach ($stylesheets as $stylesheet) {
if ((file_exists(ROOT . DS . $stylesheet['file'])) and (($stylesheet['load'] == 'frontend') or ($stylesheet['load'] == 'both')) ) {
if ( ! file_exists($frontend_site_css_path) or filemtime(ROOT . DS . $stylesheet['file']) > filemtime($frontend_site_css_path)) {
if ((file_exists(ROOT . DS . $stylesheet['file'])) and (($stylesheet['load'] == 'frontend') or ($stylesheet['load'] == 'both'))) {
if (! file_exists($frontend_site_css_path) or filemtime(ROOT . DS . $stylesheet['file']) > filemtime($frontend_site_css_path)) {
$frontend_regenerate = true;
break;
}
@@ -115,7 +110,7 @@ class Stylesheet
// Regenerate site stylesheet
if ($frontend_regenerate) {
foreach ($stylesheets as $stylesheet) {
if ((file_exists(ROOT . DS . $stylesheet['file'])) and (($stylesheet['load'] == 'frontend') or ($stylesheet['load'] == 'both')) ) {
if ((file_exists(ROOT . DS . $stylesheet['file'])) and (($stylesheet['load'] == 'frontend') or ($stylesheet['load'] == 'both'))) {
$frontend_buffer .= file_get_contents(ROOT . DS . $stylesheet['file']);
}
}
@@ -123,7 +118,6 @@ class Stylesheet
file_put_contents($frontend_site_css_path, MinifyCSS::process($frontend_buffer));
$frontend_regenerate = false;
}
}
// Render
@@ -152,8 +146,8 @@ class Stylesheet
/**
* stylesVersionIncrement
*/
public static function stylesVersionIncrement() {
Option::update('styles_version', (int) Option::get('styles_version') + 1);
public static function stylesVersionIncrement()
{
Option::update('styles_version', (int) Option::get('styles_version') + 1);
}
}

View File

@@ -1,20 +1,17 @@
<?php defined('MONSTRA_ACCESS') or die('No direct script access.');
/**
* Monstra Engine
* Monstra
*
* This source file is part of the Monstra Engine. More information,
* documentation and tutorials can be found at http://monstra.org
*
* @package Monstra
*
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @copyright 2012-2014 Romanenko Sergey / Awilum <awilum@msn.com>
* @package Monstra
* @author Romanenko Sergey / Awilum <awilum@msn.com>
* @link http://monstra.org
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class View
{
/**