1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-07 21:56:39 +02:00

Add Monstra from HG Commit 683dcb70c4cc

This commit is contained in:
Awilum
2012-09-25 19:09:50 +03:00
parent d2db42b2bb
commit 4a5fea5f5b
251 changed files with 35026 additions and 0 deletions

View File

@@ -0,0 +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');

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<plugin_location>plugins/sandbox/sandbox.plugin.php</plugin_location>
<plugin_status>active</plugin_status>
<plugin_priority>15</plugin_priority>
<plugin_name>Sandbox</plugin_name>
<plugin_description>Sandbox plugin for Monstra</plugin_description>
<plugin_version>1.0.0</plugin_version>
<plugin_author>Awilum</plugin_author>
<plugin_author_uri>http://monstra.org/</plugin_author_uri>
</root>

View File

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

View File

@@ -0,0 +1,10 @@
<?php
return array(
'sandbox' => array(
'Sandbox' => 'Sandbox',
'Sandbox plugin for Monstra' => 'Sandbox plugin for Monstra',
'Sandbox template' => 'Sandbox template',
'Save' => 'Save',
)
);

View File

@@ -0,0 +1,10 @@
<?php
return array(
'sandbox' => array(
'Sandbox' => 'Песочница',
'Sandbox plugin for Monstra' => 'Плагин песочница для Monstra',
'Sandbox template' => 'Шаблон песочницы',
'Save' => 'Сохранить',
)
);

View File

@@ -0,0 +1,90 @@
<?php
// 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');
/**
* 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();
}
}
/**
* Form Component Save
*/
public static function formComponentSave() {
if (Request::post('sandbox_component_save')) {
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::label('sandbox_form_template', __('Sandbox template')).
Form::select('sandbox_form_template', $templates, Option::get('sandbox_template')).
Html::br().
Form::submit('sandbox_component_save', __('Save'), array('class' => 'btn')).
Form::close()
);
}
}

View File

@@ -0,0 +1,79 @@
<?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 simple class
*/
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';
}
}

View File

@@ -0,0 +1 @@
Sandbox backend view

View File

@@ -0,0 +1 @@
Sandbox frontend view