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:
5
plugins/sandbox/install/sandbox.install.php
Normal file
5
plugins/sandbox/install/sandbox.install.php
Normal 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');
|
11
plugins/sandbox/install/sandbox.manifest.xml
Normal file
11
plugins/sandbox/install/sandbox.manifest.xml
Normal 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>
|
5
plugins/sandbox/install/sandbox.uninstall.php
Normal file
5
plugins/sandbox/install/sandbox.uninstall.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php defined('MONSTRA_ACCESS') or die('No direct script access.');
|
||||
|
||||
// Delete Options
|
||||
Option::delete('sandbox');
|
||||
Option::delete('sandbox_template');
|
10
plugins/sandbox/languages/en.lang.php
Normal file
10
plugins/sandbox/languages/en.lang.php
Normal 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',
|
||||
)
|
||||
);
|
10
plugins/sandbox/languages/ru.lang.php
Normal file
10
plugins/sandbox/languages/ru.lang.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'sandbox' => array(
|
||||
'Sandbox' => 'Песочница',
|
||||
'Sandbox plugin for Monstra' => 'Плагин песочница для Monstra',
|
||||
'Sandbox template' => 'Шаблон песочницы',
|
||||
'Save' => 'Сохранить',
|
||||
)
|
||||
);
|
90
plugins/sandbox/sandbox.admin.php
Normal file
90
plugins/sandbox/sandbox.admin.php
Normal 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()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
79
plugins/sandbox/sandbox.plugin.php
Normal file
79
plugins/sandbox/sandbox.plugin.php
Normal 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';
|
||||
}
|
||||
}
|
1
plugins/sandbox/views/backend/index.view.php
Normal file
1
plugins/sandbox/views/backend/index.view.php
Normal file
@@ -0,0 +1 @@
|
||||
Sandbox backend view
|
1
plugins/sandbox/views/frontend/index.view.php
Normal file
1
plugins/sandbox/views/frontend/index.view.php
Normal file
@@ -0,0 +1 @@
|
||||
Sandbox frontend view
|
Reference in New Issue
Block a user