1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-07-31 02:10:37 +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

@@ -1,5 +1,5 @@
<?php defined('MONSTRA_ACCESS') or die('No direct script access.');
// Add New Options
Option::add('sandbox', 'sandbox test value');
Option::add('sandbox_template', 'index');
// Add New Options
Option::add('sandbox', 'sandbox test value');
Option::add('sandbox_template', 'index');

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,5 +1,5 @@
<?php defined('MONSTRA_ACCESS') or die('No direct script access.');
// Delete Options
Option::delete('sandbox');
Option::delete('sandbox_template');
// Delete Options
Option::delete('sandbox');
Option::delete('sandbox_template');

View File

@@ -1,10 +1,10 @@
<?php
return array(
'sandbox' => array(
'Sandbox' => 'Sandbox',
'Sandbox plugin for Monstra' => 'Sandbox Plugin für Monstra',
'Sandbox template' => 'Sandbox Template',
'Save' => 'Speichern',
)
);
<?php
return array(
'sandbox' => array(
'Sandbox' => 'Sandbox',
'Sandbox plugin for Monstra' => 'Sandbox Plugin für Monstra',
'Sandbox template' => 'Sandbox Template',
'Save' => 'Speichern',
)
);

View File

@@ -6,5 +6,5 @@
'Sandbox plugin for Monstra' => 'Sandbox plugin for Monstra',
'Sandbox template' => 'Sandbox template',
'Save' => 'Save',
)
);
)
);

View File

@@ -7,4 +7,4 @@
'Sandbox template' => 'Modello Sandbox',
'Save' => 'Salva',
)
);
);

View File

@@ -6,5 +6,5 @@
'Sandbox plugin for Monstra' => 'Sandbox papildinys',
'Sandbox template' => 'Sandbox šablonas',
'Save' => 'Išsaugoti',
)
);
)
);

View File

@@ -6,5 +6,5 @@
'Sandbox plugin for Monstra' => 'Plugin Caixa de Areia para o Monstra CMS',
'Sandbox template' => 'Template da caixa de areia',
'Save' => 'Salvar',
)
);
)
);

View File

@@ -7,4 +7,4 @@
'Sandbox template' => 'Шаблон песочницы',
'Save' => 'Сохранить',
)
);
);

View File

@@ -7,4 +7,4 @@
'Sandbox template' => 'Шаблон пісочниці',
'Save' => 'Зберегти',
)
);
);

View File

@@ -1,95 +1,91 @@
<?php
<?php
// Admin Navigation: add new item
Navigation::add(__('Sandbox', 'sandbox'), 'content', 'sandbox', 10);
// Admin Navigation: add new item
Navigation::add(__('Sandbox', 'sandbox'), 'content', 'sandbox', 10);
// Add actions
Action::add('admin_themes_extra_index_template_actions','SandboxAdmin::formComponent');
Action::add('admin_themes_extra_actions','SandboxAdmin::formComponentSave');
// Add actions
Action::add('admin_themes_extra_index_template_actions','SandboxAdmin::formComponent');
Action::add('admin_themes_extra_actions','SandboxAdmin::formComponentSave');
/**
* Sandbox admin class
*/
class SandboxAdmin extends Backend
{
/**
* Main Sandbox admin function
*/
public static function main()
{
//
// Do something here...
//
// Check for get actions
// -------------------------------------
if (Request::get('action')) {
// Switch actions
// -------------------------------------
switch (Request::get('action')) {
// Plugin action
// -------------------------------------
case "add":
//
// Do something here...
//
break;
// Plugin action
// -------------------------------------
case "delete":
//
// Do something here...
//
break;
}
} else {
// Display view
View::factory('sandbox/views/backend/index')->display();
}
}
/**
* Sandbox admin class
* Form Component Save
*/
class SandboxAdmin extends Backend {
/**
* Main Sandbox admin function
*/
public static function main() {
//
// Do something here...
//
// Check for get actions
// -------------------------------------
if (Request::get('action')) {
// Switch actions
// -------------------------------------
switch (Request::get('action')) {
// Plugin action
// -------------------------------------
case "add":
//
// Do something here...
//
break;
// Plugin action
// -------------------------------------
case "delete":
//
// Do something here...
//
break;
}
} else {
// Display view
View::factory('sandbox/views/backend/index')->display();
}
}
/**
* Form Component Save
*/
public static function formComponentSave() {
if (Request::post('sandbox_component_save')) {
if (Security::check(Request::post('csrf'))) {
Option::update('sandbox_template', Request::post('sandbox_form_template'));
Request::redirect('index.php?id=themes');
}
public static function formComponentSave()
{
if (Request::post('sandbox_component_save')) {
if (Security::check(Request::post('csrf'))) {
Option::update('sandbox_template', Request::post('sandbox_form_template'));
Request::redirect('index.php?id=themes');
}
}
}
/**
* Form Component
*/
public static function formComponent() {
$_templates = Themes::getTemplates();
foreach($_templates as $template) {
$templates[basename($template, '.template.php')] = basename($template, '.template.php');
}
echo (
Form::open().
Form::hidden('csrf', Security::token()).
Form::label('sandbox_form_template', __('Sandbox template', 'sandbox')).
Form::select('sandbox_form_template', $templates, Option::get('sandbox_template')).
Html::br().
Form::submit('sandbox_component_save', __('Save', 'sandbox'), array('class' => 'btn')).
Form::close()
);
/**
* Form Component
*/
public static function formComponent()
{
$_templates = Themes::getTemplates();
foreach ($_templates as $template) {
$templates[basename($template, '.template.php')] = basename($template, '.template.php');
}
echo (
Form::open().
Form::hidden('csrf', Security::token()).
Form::label('sandbox_form_template', __('Sandbox template', 'sandbox')).
Form::select('sandbox_form_template', $templates, Option::get('sandbox_template')).
Html::br().
Form::submit('sandbox_component_save', __('Save', 'sandbox'), array('class' => 'btn')).
Form::close()
);
}
}
}

View File

@@ -1,79 +1,82 @@
<?php
/**
* Sandbox plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
*
*/
// Register plugin
Plugin::register( __FILE__,
__('Sandbox', 'sandbox'),
__('Sandbox plugin for Monstra', 'sandbox'),
'1.0.0',
'Awilum',
'http://monstra.org/',
'sandbox');
// Load Sandbox Admin for Editor and Admin
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor'))) {
Plugin::admin('sandbox');
}
/**
* Sandbox class
*/
class Sandbox extends Frontend
{
/**
* Sandbox plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
*
* Sandbox main function
*/
// Register plugin
Plugin::register( __FILE__,
__('Sandbox', 'sandbox'),
__('Sandbox plugin for Monstra', 'sandbox'),
'1.0.0',
'Awilum',
'http://monstra.org/',
'sandbox');
// Load Sandbox Admin for Editor and Admin
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor'))) {
Plugin::admin('sandbox');
public static function main()
{
// Do something...
}
/**
* Set Sandbox title
*/
public static function title()
{
return 'Sandbox title';
}
/**
* Sandbox class
* Set Sandbox keywords
*/
class Sandbox extends Frontend {
/**
* Sandbox main function
*/
public static function main(){
// Do something...
}
/**
* Set Sandbox title
*/
public static function title(){
return 'Sandbox title';
}
/**
* Set Sandbox keywords
*/
public static function keywords(){
return 'Sandbox keywords';
}
/**
* Set Sandbox description
*/
public static function description(){
return 'Sandbox description';
}
/**
* Set Sandbox content
*/
public static function content(){
return 'Sandbox content';
}
/**
* Set Sandbox template
*/
public static function template() {
return 'index';
}
public static function keywords()
{
return 'Sandbox keywords';
}
/**
* Set Sandbox description
*/
public static function description()
{
return 'Sandbox description';
}
/**
* Set Sandbox content
*/
public static function content()
{
return 'Sandbox content';
}
/**
* Set Sandbox template
*/
public static function template()
{
return 'index';
}
}

View File

@@ -1 +1 @@
Sandbox backend view
Sandbox backend view

View File

@@ -1 +1 @@
Sandbox frontend view
Sandbox frontend view