mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-16 10:04:34 +02:00
Add Monstra from HG Commit 683dcb70c4cc
This commit is contained in:
11
plugins/box/themes/install/themes.manifest.xml
Normal file
11
plugins/box/themes/install/themes.manifest.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<plugin_location>plugins/box/themes/themes.plugin.php</plugin_location>
|
||||
<plugin_status>active</plugin_status>
|
||||
<plugin_priority>3</plugin_priority>
|
||||
<plugin_name>Themes</plugin_name>
|
||||
<plugin_description>Themes managment plugin</plugin_description>
|
||||
<plugin_version>1.0.0</plugin_version>
|
||||
<plugin_author>Awilum</plugin_author>
|
||||
<plugin_author_uri>http://monstra.org/</plugin_author_uri>
|
||||
</root>
|
49
plugins/box/themes/languages/en.lang.php
Normal file
49
plugins/box/themes/languages/en.lang.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'themes' => array(
|
||||
'Themes' => 'Themes',
|
||||
'Themes manager' => 'Themes manager',
|
||||
'Select theme' => 'Select theme',
|
||||
'Save' => 'Save',
|
||||
'Save and exit' => 'Save and exit',
|
||||
'Name' => 'Name',
|
||||
'Create new template' => 'Create new template',
|
||||
'New template' => 'New template',
|
||||
'Delete template: :name' => 'Delete template: :name',
|
||||
'Delete chunk: :name' => 'Delete chunk: :name',
|
||||
'Delete styles: :name' => 'Delete styles: :name',
|
||||
'Templates' => 'Templates',
|
||||
'Clone' => 'Clone',
|
||||
'Edit' => 'Edit',
|
||||
'Delete' => 'Delete',
|
||||
'Actions' => 'Actions',
|
||||
'Create new chunk' => 'Create new chunk',
|
||||
'New chunk' => 'New chunk',
|
||||
'Chunks' => 'Chunks',
|
||||
'Create new styles' => 'Create new styles',
|
||||
'New styles' => 'New styles',
|
||||
'Styles' => 'Styles',
|
||||
'Template content' => 'Template content',
|
||||
'Styles content' => 'Styles content',
|
||||
'Chunk content' => 'Chunk content',
|
||||
'Edit template' => 'Edit template',
|
||||
'Edit chunk' => 'Edit chunk',
|
||||
'Edit styles' => 'Edit styles',
|
||||
'Current site theme' => 'Current site theme',
|
||||
'Current admin theme' => 'Current admin theme',
|
||||
'This template already exists' => 'This template already exists',
|
||||
'This chunk already exists' => 'This chunk already exists',
|
||||
'This styles already exists' => 'This styles already exists',
|
||||
'Components templates' => 'Components templates',
|
||||
'Your changes to the chunk <i>:name</i> have been saved.' => 'Your changes to the chunk <i>:name</i> have been saved.',
|
||||
'Your changes to the styles <i>:name</i> have been saved.' => 'Your changes to the styles <i>:name</i> have been saved.',
|
||||
'Your changes to the template <i>:name</i> have been saved.' => 'Your changes to the template <i>:name</i> have been saved.',
|
||||
'This field should not be empty' => 'This field should not be empty',
|
||||
'Scripts' => 'Scripts',
|
||||
'Create new script' => 'Create new script',
|
||||
'Script content' => 'Script content',
|
||||
'New script' => 'New script',
|
||||
'Edit script' => 'Edit script',
|
||||
)
|
||||
);
|
51
plugins/box/themes/languages/ru.lang.php
Normal file
51
plugins/box/themes/languages/ru.lang.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'themes' => array(
|
||||
'Themes' => 'Темы',
|
||||
'Themes manager' => 'Менеджер тем',
|
||||
'Select theme' => 'Выбрать тему',
|
||||
'Save' => 'Сохранить',
|
||||
'Name' => 'Название',
|
||||
'Save and exit' => 'Сохранить и выйти',
|
||||
'Create new template' => 'Создать новый шаблон',
|
||||
'New template' => 'Новый шаблон',
|
||||
'Delete template: :name' => 'Удалить шаблон: :name',
|
||||
'Delete chunk: :name' => 'Удалить чанк: :name',
|
||||
'Delete styles: :name' => 'Удалить стили: :name',
|
||||
'Templates' => 'Шаблоны',
|
||||
'Clone' => 'Клонировать',
|
||||
'Edit' => 'Редактировать',
|
||||
'Delete' => 'Удалить',
|
||||
'Actions' => 'Действия',
|
||||
'Create new chunk' => 'Создать новый чанк',
|
||||
'New chunk' => 'Новый чанк',
|
||||
'Chunks' => 'Чанки',
|
||||
'Create new styles' => 'Создать новые стили',
|
||||
'New styles' => 'Новые стили',
|
||||
'Styles' => 'Стили',
|
||||
'Template content' => 'Содержимое шаблона',
|
||||
'Styles content' => 'Содержимое стилей',
|
||||
'Chunk content' => 'Содержимое чанка',
|
||||
'Edit template' => 'Редактирование шаблона',
|
||||
'Edit chunk' => 'Редактирование чанка',
|
||||
'Edit styles' => 'Редкатирование стилей',
|
||||
'Site theme' => 'Тема сайта',
|
||||
'Admin theme' => 'Тема админки',
|
||||
'Current site theme' => 'Текущая тема сайта',
|
||||
'Current admin theme' => 'Текущая тема админки',
|
||||
'This template already exists' => 'Этот шаблон уже существует',
|
||||
'This chunk already exists' => 'Этот чанк уже существует',
|
||||
'This styles already exists' => 'Эти стили уже существуют',
|
||||
'Components templates' => 'Шаблоны компонентов',
|
||||
'Your changes to the chunk <i>:name</i> have been saved.' => 'Ваши изменения к чанку <i>:name</i> были сохранены',
|
||||
'Your changes to the styles <i>:name</i> have been saved.' => 'Ваши изменения к стилям <i>:name</i> были сохранены',
|
||||
'Your changes to the template <i>:name</i> have been saved.' => 'Ваши изменения к шаблону <i>:name</i> были сохранены',
|
||||
'This field should not be empty' => 'Это поле не должно быть пустым',
|
||||
'Scripts' => 'Скрипты',
|
||||
'Create new script' => 'Создать новый скрипт',
|
||||
'Script content' => 'Содержимое скрипта',
|
||||
'New script' => 'Новый скрипт',
|
||||
'Edit script' => 'Редактирование скрипта',
|
||||
)
|
||||
);
|
547
plugins/box/themes/themes.admin.php
Normal file
547
plugins/box/themes/themes.admin.php
Normal file
@@ -0,0 +1,547 @@
|
||||
<?php
|
||||
|
||||
Navigation::add(__('Themes', 'themes'), 'extends', 'themes', 2);
|
||||
|
||||
|
||||
class ThemesAdmin extends Backend {
|
||||
|
||||
|
||||
/**
|
||||
* Themes plugin admin
|
||||
*/
|
||||
public static function main() {
|
||||
|
||||
// Get current themes
|
||||
$current_site_theme = Option::get('theme_site_name');
|
||||
$current_admin_theme = Option::get('theme_admin_name');
|
||||
|
||||
// Init vsrs
|
||||
$themes_site = Themes::getSiteThemes();
|
||||
$themes_admin = Themes::getAdminThemes();
|
||||
$templates = Themes::getTemplates();
|
||||
$chunks = Themes::getChunks();
|
||||
$styles = Themes::getStyles();
|
||||
$scripts = Themes::getScripts();
|
||||
$errors = array();
|
||||
|
||||
$chunk_path = THEMES_SITE . DS . $current_site_theme . DS;
|
||||
$template_path = THEMES_SITE . DS . $current_site_theme . DS;
|
||||
$style_path = THEMES_SITE . DS . $current_site_theme . DS . 'css' . DS;
|
||||
$script_path = THEMES_SITE . DS . $current_site_theme . DS . 'js' . DS;
|
||||
|
||||
|
||||
// Save site theme
|
||||
if (Request::post('save_site_theme')) {
|
||||
|
||||
if (Security::check(Request::post('csrf'))) {
|
||||
|
||||
Option::update('theme_site_name', Request::post('themes'));
|
||||
|
||||
// Cleanup minify
|
||||
if (count($files = File::scan(MINIFY, array('css', 'js', 'php'))) > 0) foreach ($files as $file) File::delete(MINIFY . DS . $file);
|
||||
|
||||
Request::redirect('index.php?id=themes');
|
||||
|
||||
} else { die('csrf detected!'); }
|
||||
}
|
||||
|
||||
// Save site theme
|
||||
if (Request::post('save_admin_theme')) {
|
||||
|
||||
if (Security::check(Request::post('csrf'))) {
|
||||
|
||||
Option::update('theme_admin_name', Request::post('themes'));
|
||||
|
||||
// Cleanup minify
|
||||
if (count($files = File::scan(MINIFY, array('css', 'js', 'php'))) > 0) foreach ($files as $file) File::delete(MINIFY . DS . $file);
|
||||
|
||||
Request::redirect('index.php?id=themes');
|
||||
|
||||
} else { die('csrf detected!'); }
|
||||
}
|
||||
|
||||
// Its mean that you can add your own actions for this plugin
|
||||
Action::run('admin_themes_extra_actions');
|
||||
|
||||
// Check for get actions
|
||||
// -------------------------------------
|
||||
if (Request::get('action')) {
|
||||
|
||||
// Switch actions
|
||||
// -------------------------------------
|
||||
switch (Request::get('action')) {
|
||||
|
||||
// Add chunk
|
||||
// -------------------------------------
|
||||
case "add_chunk":
|
||||
if (Request::post('add_file') || Request::post('add_file_and_exit')) {
|
||||
|
||||
if (Security::check(Request::post('csrf'))) {
|
||||
|
||||
if (trim(Request::post('name')) == '') $errors['file_empty_name'] = __('Required field', 'themes');
|
||||
if (file_exists($chunk_path.Security::safeName(Request::post('name')).'.chunk.php')) $errors['file_exists'] = __('This chunk already exists', 'themes');
|
||||
|
||||
if (count($errors) == 0) {
|
||||
|
||||
// Save chunk
|
||||
File::setContent($chunk_path.Security::safeName(Request::post('name')).'.chunk.php', Request::post('content'));
|
||||
|
||||
Notification::set('success', __('Your changes to the chunk <i>:name</i> have been saved.', 'themes', array(':name' => Security::safeName(Request::post('name')))));
|
||||
|
||||
if (Request::post('add_file_and_exit')) {
|
||||
Request::redirect('index.php?id=themes');
|
||||
} else {
|
||||
Request::redirect('index.php?id=themes&action=edit_chunk&filename='.Security::safeName(Request::post('name')));
|
||||
}
|
||||
}
|
||||
|
||||
} else { die('csrf detected!'); }
|
||||
}
|
||||
|
||||
// Save fields
|
||||
if (Request::post('name')) $name = Request::post('name'); else $name = '';
|
||||
if (Request::post('content')) $content = Request::post('content'); else $content = '';
|
||||
|
||||
// Display view
|
||||
View::factory('box/themes/views/backend/add')
|
||||
->assign('name', $name)
|
||||
->assign('content', $content)
|
||||
->assign('errors', $errors)
|
||||
->assign('action', 'chunk')
|
||||
->display();
|
||||
break;
|
||||
|
||||
// Add template
|
||||
// -------------------------------------
|
||||
case "add_template":
|
||||
if (Request::post('add_file') || Request::post('add_file_and_exit')) {
|
||||
|
||||
if (Security::check(Request::post('csrf'))) {
|
||||
|
||||
if (trim(Request::post('name')) == '') $errors['file_empty_name'] = __('Required field', 'themes');
|
||||
if (file_exists($template_path.Security::safeName(Request::post('name')).'.template.php')) $errors['file_exists'] = __('This template already exists', 'themes');
|
||||
|
||||
if (count($errors) == 0) {
|
||||
|
||||
// Save chunk
|
||||
File::setContent($template_path.Security::safeName(Request::post('name')).'.template.php', Request::post('content'));
|
||||
|
||||
Notification::set('success', __('Your changes to the chunk <i>:name</i> have been saved.', 'themes', array(':name' => Security::safeName(Request::post('name')))));
|
||||
|
||||
if (Request::post('add_file_and_exit')) {
|
||||
Request::redirect('index.php?id=themes');
|
||||
} else {
|
||||
Request::redirect('index.php?id=themes&action=edit_template&filename='.Security::safeName(Request::post('name')));
|
||||
}
|
||||
}
|
||||
|
||||
} else { die('csrf detected!'); }
|
||||
}
|
||||
|
||||
// Save fields
|
||||
if (Request::post('name')) $name = Request::post('name'); else $name = '';
|
||||
if (Request::post('content')) $content = Request::post('content'); else $content = '';
|
||||
|
||||
// Display view
|
||||
View::factory('box/themes/views/backend/add')
|
||||
->assign('name', $name)
|
||||
->assign('content', $content)
|
||||
->assign('errors', $errors)
|
||||
->assign('action', 'template')
|
||||
->display();
|
||||
break;
|
||||
|
||||
// Add styles
|
||||
// -------------------------------------
|
||||
case "add_styles":
|
||||
if (Request::post('add_file') || Request::post('add_file_and_exit')) {
|
||||
|
||||
if (Security::check(Request::post('csrf'))) {
|
||||
|
||||
if (trim(Request::post('name')) == '') $errors['file_empty_name'] = __('Required field', 'themes');
|
||||
if (file_exists($style_path.Security::safeName(Request::post('name')).'.css')) $errors['file_exists'] = __('This styles already exists', 'themes');
|
||||
|
||||
if (count($errors) == 0) {
|
||||
|
||||
// Save chunk
|
||||
File::setContent($style_path.Security::safeName(Request::post('name')).'.css', Request::post('content'));
|
||||
|
||||
Notification::set('success', __('Your changes to the styles <i>:name</i> have been saved.', 'themes', array(':name' => Security::safeName(Request::post('name')))));
|
||||
|
||||
if (Request::post('add_file_and_exit')) {
|
||||
Request::redirect('index.php?id=themes');
|
||||
} else {
|
||||
Request::redirect('index.php?id=themes&action=edit_styles&filename='.Security::safeName(Request::post('name')));
|
||||
}
|
||||
}
|
||||
|
||||
} else { die('csrf detected!'); }
|
||||
}
|
||||
|
||||
// Save fields
|
||||
if (Request::post('name')) $name = Request::post('name'); else $name = '';
|
||||
if (Request::post('content')) $content = Request::post('content'); else $content = '';
|
||||
|
||||
// Display view
|
||||
View::factory('box/themes/views/backend/add')
|
||||
->assign('name', $name)
|
||||
->assign('content', $content)
|
||||
->assign('errors', $errors)
|
||||
->assign('action', 'styles')
|
||||
->display();
|
||||
break;
|
||||
|
||||
// Add script
|
||||
// -------------------------------------
|
||||
case "add_script":
|
||||
if (Request::post('add_file') || Request::post('add_file_and_exit')) {
|
||||
|
||||
if (Security::check(Request::post('csrf'))) {
|
||||
|
||||
if (trim(Request::post('name')) == '') $errors['file_empty_name'] = __('Required field', 'themes');
|
||||
if (file_exists($script_path.Security::safeName(Request::post('name')).'.js')) $errors['file_exists'] = __('This script already exists', 'themes');
|
||||
|
||||
if (count($errors) == 0) {
|
||||
|
||||
// Save chunk
|
||||
File::setContent($script_path.Security::safeName(Request::post('name')).'.js', Request::post('content'));
|
||||
|
||||
Notification::set('success', __('Your changes to the script <i>:name</i> have been saved.', 'themes', array(':name' => Security::safeName(Request::post('name')))));
|
||||
|
||||
if (Request::post('add_file_and_exit')) {
|
||||
Request::redirect('index.php?id=themes');
|
||||
} else {
|
||||
Request::redirect('index.php?id=themes&action=edit_script&filename='.Security::safeName(Request::post('name')));
|
||||
}
|
||||
}
|
||||
|
||||
} else { die('csrf detected!'); }
|
||||
}
|
||||
|
||||
// Save fields
|
||||
if (Request::post('name')) $name = Request::post('name'); else $name = '';
|
||||
if (Request::post('content')) $content = Request::post('content'); else $content = '';
|
||||
|
||||
// Display view
|
||||
View::factory('box/themes/views/backend/add')
|
||||
->assign('name', $name)
|
||||
->assign('content', $content)
|
||||
->assign('errors', $errors)
|
||||
->assign('action', 'script')
|
||||
->display();
|
||||
break;
|
||||
|
||||
|
||||
// Edit chunk
|
||||
// -------------------------------------
|
||||
case "edit_chunk":
|
||||
|
||||
// Save current chunk action
|
||||
if (Request::post('edit_file') || Request::post('edit_file_and_exit') ) {
|
||||
|
||||
if (Security::check(Request::post('csrf'))) {
|
||||
|
||||
if (trim(Request::post('name')) == '') $errors['file_empty_name'] = __('Required field', 'themes');
|
||||
if ((file_exists($chunk_path.Security::safeName(Request::post('name')).'.chunk.php')) and (Security::safeName(Request::post('chunk_old_name')) !== Security::safeName(Request::post('name')))) $errors['file_exists'] = __('This chunk already exists', 'themes');
|
||||
|
||||
// Save fields
|
||||
if (Request::post('content')) $content = Request::post('content'); else $content = '';
|
||||
if (count($errors) == 0) {
|
||||
|
||||
$chunk_old_filename = $chunk_path.Request::post('chunk_old_name').'.chunk.php';
|
||||
$chunk_new_filename = $chunk_path.Security::safeName(Request::post('name')).'.chunk.php';
|
||||
if ( ! empty($chunk_old_filename)) {
|
||||
if ($chunk_old_filename !== $chunk_new_filename) {
|
||||
rename($chunk_old_filename, $chunk_new_filename);
|
||||
$save_filename = $chunk_new_filename;
|
||||
} else {
|
||||
$save_filename = $chunk_new_filename;
|
||||
}
|
||||
} else {
|
||||
$save_filename = $chunk_new_filename;
|
||||
}
|
||||
|
||||
// Save chunk
|
||||
File::setContent($save_filename, Request::post('content'));
|
||||
|
||||
Notification::set('success', __('Your changes to the chunk <i>:name</i> have been saved.', 'themes', array(':name' => basename($save_filename, '.chunk.php'))));
|
||||
|
||||
if (Request::post('edit_file_and_exit')) {
|
||||
Request::redirect('index.php?id=themes');
|
||||
} else {
|
||||
Request::redirect('index.php?id=themes&action=edit_chunk&filename='.Security::safeName(Request::post('name')));
|
||||
}
|
||||
}
|
||||
|
||||
} else { die('csrf detected!'); }
|
||||
}
|
||||
if (Request::post('name')) $name = Request::post('name'); else $name = File::name(Request::get('filename'));
|
||||
$content = File::getContent($chunk_path.Request::get('filename').'.chunk.php');
|
||||
|
||||
// Display view
|
||||
View::factory('box/themes/views/backend/edit')
|
||||
->assign('content', $content)
|
||||
->assign('name', $name)
|
||||
->assign('errors', $errors)
|
||||
->assign('action', 'chunk')
|
||||
->display();
|
||||
|
||||
break;
|
||||
|
||||
// Edit template
|
||||
// -------------------------------------
|
||||
case "edit_template":
|
||||
|
||||
// Save current chunk action
|
||||
if (Request::post('edit_file') || Request::post('edit_file_and_exit') ) {
|
||||
|
||||
if (Security::check(Request::post('csrf'))) {
|
||||
|
||||
if (trim(Request::post('name')) == '') $errors['file_empty_name'] = __('Required field', 'themes');
|
||||
if ((file_exists($template_path.Security::safeName(Request::post('name')).'.template.php')) and (Security::safeName(Request::post('template_old_name')) !== Security::safeName(Request::post('name')))) $errors['template_exists'] = __('This template already exists', 'themes');
|
||||
|
||||
// Save fields
|
||||
if (Request::post('content')) $content = Request::post('content'); else $content = '';
|
||||
if (count($errors) == 0) {
|
||||
|
||||
$template_old_filename = $template_path.Request::post('template_old_name').'.template.php';
|
||||
$template_new_filename = $template_path.Security::safeName(Request::post('name')).'.template.php';
|
||||
if ( ! empty($template_old_filename)) {
|
||||
if ($template_old_filename !== $template_new_filename) {
|
||||
rename($template_old_filename, $template_new_filename);
|
||||
$save_filename = $template_new_filename;
|
||||
} else {
|
||||
$save_filename = $template_new_filename;
|
||||
}
|
||||
} else {
|
||||
$save_filename = $template_new_filename;
|
||||
}
|
||||
|
||||
// Save chunk
|
||||
File::setContent($save_filename, Request::post('content'));
|
||||
|
||||
Notification::set('success', __('Your changes to the template <i>:name</i> have been saved.', 'themes', array(':name' => basename($save_filename, '.template.php'))));
|
||||
|
||||
if (Request::post('edit_file_and_exit')) {
|
||||
Request::redirect('index.php?id=themes');
|
||||
} else {
|
||||
Request::redirect('index.php?id=themes&action=edit_template&filename='.Security::safeName(Request::post('name')));
|
||||
}
|
||||
}
|
||||
|
||||
} else { die('csrf detected!'); }
|
||||
}
|
||||
if (Request::post('name')) $name = Request::post('name'); else $name = File::name(Request::get('filename'));
|
||||
$content = File::getContent($chunk_path.Request::get('filename').'.template.php');
|
||||
|
||||
// Display view
|
||||
View::factory('box/themes/views/backend/edit')
|
||||
->assign('content', $content)
|
||||
->assign('name', $name)
|
||||
->assign('errors', $errors)
|
||||
->assign('action', 'template')
|
||||
->display();
|
||||
|
||||
break;
|
||||
|
||||
// Edit styles
|
||||
// -------------------------------------
|
||||
case "edit_styles":
|
||||
|
||||
// Save current chunk action
|
||||
if (Request::post('edit_file') || Request::post('edit_file_and_exit') ) {
|
||||
|
||||
if (Security::check(Request::post('csrf'))) {
|
||||
|
||||
if (trim(Request::post('name')) == '') $errors['file_empty_name'] = __('Required field', 'themes');
|
||||
if ((file_exists($style_path.Security::safeName(Request::post('name')).'.css')) and (Security::safeName(Request::post('styles_old_name')) !== Security::safeName(Request::post('name')))) $errors['file_exists'] = __('This styles already exists', 'themes');
|
||||
|
||||
// Save fields
|
||||
if (Request::post('content')) $content = Request::post('content'); else $content = '';
|
||||
if (count($errors) == 0) {
|
||||
|
||||
$styles_old_filename = $style_path.Request::post('styles_old_name').'.css';
|
||||
$styles_new_filename = $style_path.Security::safeName(Request::post('name')).'.css';
|
||||
if ( ! empty($styles_old_filename)) {
|
||||
if ($styles_old_filename !== $styles_new_filename) {
|
||||
rename($styles_old_filename, $styles_new_filename);
|
||||
$save_filename = $styles_new_filename;
|
||||
} else {
|
||||
$save_filename = $styles_new_filename;
|
||||
}
|
||||
} else {
|
||||
$save_filename = $styles_new_filename;
|
||||
}
|
||||
|
||||
// Save chunk
|
||||
File::setContent($save_filename, Request::post('content'));
|
||||
|
||||
Notification::set('success', __('Your changes to the styles <i>:name</i> have been saved.', 'themes', array(':name' => basename($save_filename, '.css'))));
|
||||
|
||||
if (Request::post('edit_file_and_exit')) {
|
||||
Request::redirect('index.php?id=themes');
|
||||
} else {
|
||||
Request::redirect('index.php?id=themes&action=edit_styles&filename='.Security::safeName(Request::post('name')));
|
||||
}
|
||||
}
|
||||
|
||||
} else { die('csrf detected!'); }
|
||||
}
|
||||
if (Request::post('name')) $name = Request::post('name'); else $name = File::name(Request::get('filename'));
|
||||
$content = File::getContent($style_path.Request::get('filename').'.css');
|
||||
|
||||
// Display view
|
||||
View::factory('box/themes/views/backend/edit')
|
||||
->assign('content', $content)
|
||||
->assign('name', $name)
|
||||
->assign('errors', $errors)
|
||||
->assign('action', 'styles')
|
||||
->display();
|
||||
|
||||
break;
|
||||
|
||||
|
||||
// Edit script
|
||||
// -------------------------------------
|
||||
case "edit_script":
|
||||
|
||||
// Save current chunk action
|
||||
if (Request::post('edit_file') || Request::post('edit_file_and_exit') ) {
|
||||
|
||||
if (Security::check(Request::post('csrf'))) {
|
||||
|
||||
if (trim(Request::post('name')) == '') $errors['file_empty_name'] = __('Required field', 'themes');
|
||||
if ((file_exists($script_path.Security::safeName(Request::post('name')).'.js')) and (Security::safeName(Request::post('script_old_name')) !== Security::safeName(Request::post('name')))) $errors['file_exists'] = __('This script already exists', 'themes');
|
||||
|
||||
// Save fields
|
||||
if (Request::post('content')) $content = Request::post('content'); else $content = '';
|
||||
if (count($errors) == 0) {
|
||||
|
||||
$script_old_filename = $script_path.Request::post('script_old_name').'.js';
|
||||
$script_new_filename = $script_path.Security::safeName(Request::post('name')).'.js';
|
||||
if ( ! empty($script_old_filename)) {
|
||||
if ($script_old_filename !== $script_new_filename) {
|
||||
rename($script_old_filename, $script_new_filename);
|
||||
$save_filename = $script_new_filename;
|
||||
} else {
|
||||
$save_filename = $script_new_filename;
|
||||
}
|
||||
} else {
|
||||
$save_filename = $script_new_filename;
|
||||
}
|
||||
|
||||
// Save chunk
|
||||
File::setContent($save_filename, Request::post('content'));
|
||||
|
||||
Notification::set('success', __('Your changes to the script <i>:name</i> have been saved.', 'themes', array(':name' => basename($save_filename, '.js'))));
|
||||
|
||||
if (Request::post('edit_file_and_exit')) {
|
||||
Request::redirect('index.php?id=themes');
|
||||
} else {
|
||||
Request::redirect('index.php?id=themes&action=edit_script&filename='.Security::safeName(Request::post('name')));
|
||||
}
|
||||
}
|
||||
|
||||
} else { die('csrf detected!'); }
|
||||
}
|
||||
if (Request::post('name')) $name = Request::post('name'); else $name = File::name(Request::get('filename'));
|
||||
$content = File::getContent($script_path.Request::get('filename').'.js');
|
||||
|
||||
// Display view
|
||||
View::factory('box/themes/views/backend/edit')
|
||||
->assign('content', $content)
|
||||
->assign('name', $name)
|
||||
->assign('errors', $errors)
|
||||
->assign('action', 'script')
|
||||
->display();
|
||||
|
||||
break;
|
||||
|
||||
// Delete chunk
|
||||
// -------------------------------------
|
||||
case "delete_chunk":
|
||||
File::delete($chunk_path.Request::get('filename').'.chunk.php');
|
||||
Notification::set('success', __('Chunk <i>:name</i> deleted', 'themes', array(':name' => File::name(Request::get('filename')))));
|
||||
Request::redirect('index.php?id=themes');
|
||||
break;
|
||||
|
||||
|
||||
// Delete styles
|
||||
// -------------------------------------
|
||||
case "delete_styles":
|
||||
File::delete($style_path.Request::get('filename').'.css');
|
||||
Notification::set('success', __('Styles <i>:name</i> deleted', 'themes', array(':name' => File::name(Request::get('filename')))));
|
||||
Request::redirect('index.php?id=themes');
|
||||
break;
|
||||
|
||||
// Delete script
|
||||
// -------------------------------------
|
||||
case "delete_script":
|
||||
File::delete($style_path.Request::get('filename').'.js');
|
||||
Notification::set('success', __('Script <i>:name</i> deleted', 'themes', array(':name' => File::name(Request::get('filename')))));
|
||||
Request::redirect('index.php?id=themes');
|
||||
break;
|
||||
|
||||
// Delete template
|
||||
// -------------------------------------
|
||||
case "delete_template":
|
||||
File::delete($template_path.Request::get('filename').'.template.php');
|
||||
Notification::set('success', __('Template <i>:name</i> deleted', 'themes', array(':name' => File::name(Request::get('filename')))));
|
||||
Request::redirect('index.php?id=themes');
|
||||
break;
|
||||
|
||||
// Clone styles
|
||||
// -------------------------------------
|
||||
case "clone_styles":
|
||||
File::setContent(THEMES_SITE . DS . $current_site_theme . DS . 'css' . DS . Request::get('filename') .'_clone_'.date("Ymd_His").'.css',
|
||||
File::getContent(THEMES_SITE . DS . $current_site_theme . DS . 'css' . DS . Request::get('filename') . '.css'));
|
||||
|
||||
Request::redirect('index.php?id=themes');
|
||||
break;
|
||||
|
||||
// Clone script
|
||||
// -------------------------------------
|
||||
case "clone_script":
|
||||
File::setContent(THEMES_SITE . DS . $current_site_theme . DS . 'js' . DS . Request::get('filename') .'_clone_'.date("Ymd_His").'.js',
|
||||
File::getContent(THEMES_SITE . DS . $current_site_theme . DS . 'js' . DS . Request::get('filename') . '.js'));
|
||||
|
||||
Request::redirect('index.php?id=themes');
|
||||
break;
|
||||
|
||||
// Clone template
|
||||
// -------------------------------------
|
||||
case "clone_template":
|
||||
File::setContent(THEMES_SITE . DS . $current_site_theme . DS . Request::get('filename') .'_clone_'.date("Ymd_His").'.template.php',
|
||||
File::getContent(THEMES_SITE . DS . $current_site_theme . DS . Request::get('filename') . '.template.php'));
|
||||
|
||||
Request::redirect('index.php?id=themes');
|
||||
break;
|
||||
|
||||
// Clone chunk
|
||||
// -------------------------------------
|
||||
case "clone_chunk":
|
||||
File::setContent(THEMES_SITE . DS . $current_site_theme . DS . Request::get('filename') .'_clone_'.date("Ymd_His").'.chunk.php',
|
||||
File::getContent(THEMES_SITE . DS . $current_site_theme . DS . Request::get('filename') . '.chunk.php'));
|
||||
|
||||
Request::redirect('index.php?id=themes');
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// Display view
|
||||
View::factory('box/themes/views/backend/index')
|
||||
->assign('themes_site', $themes_site)
|
||||
->assign('themes_admin', $themes_admin)
|
||||
->assign('templates', $templates)
|
||||
->assign('chunks', $chunks)
|
||||
->assign('styles', $styles)
|
||||
->assign('scripts', $scripts)
|
||||
->assign('current_site_theme', $current_site_theme)
|
||||
->assign('current_admin_theme', $current_admin_theme)
|
||||
->display();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
195
plugins/box/themes/themes.plugin.php
Normal file
195
plugins/box/themes/themes.plugin.php
Normal file
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Themes plugin
|
||||
*
|
||||
* @package Monstra
|
||||
* @subpackage Plugins
|
||||
* @author Romanenko Sergey / Awilum
|
||||
* @copyright 2012 Romanenko Sergey / Awilum
|
||||
* @version 1.0.0
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Register plugin
|
||||
Plugin::register( __FILE__,
|
||||
__('Themes', 'themes'),
|
||||
__('Themes manager', 'themes'),
|
||||
'1.0.0',
|
||||
'Awilum',
|
||||
'http://monstra.org/',
|
||||
null,
|
||||
'box');
|
||||
|
||||
|
||||
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin'))) {
|
||||
|
||||
// Include Admin
|
||||
Plugin::admin('themes', 'box');
|
||||
|
||||
}
|
||||
|
||||
|
||||
class Themes {
|
||||
|
||||
|
||||
/**
|
||||
* Get Themes
|
||||
*/
|
||||
public static function getAdminThemes() {
|
||||
|
||||
$themes_folders = array();
|
||||
|
||||
// Get all themes folders
|
||||
$_themes_admin_folders = Dir::scan(THEMES_ADMIN);
|
||||
|
||||
// Create an array of valid themes folders
|
||||
foreach($_themes_admin_folders as $folder) if (File::exists(THEMES_ADMIN . DS . $folder . DS . 'index.template.php')) $__themes_admin_folders[] = $folder;
|
||||
foreach($__themes_admin_folders as $theme) $themes[$theme] = $theme;
|
||||
|
||||
return $themes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Admin Themes
|
||||
*/
|
||||
public static function getSiteThemes() {
|
||||
|
||||
$themes_folders = array();
|
||||
|
||||
// Get all themes folders
|
||||
$_themes_folders = Dir::scan(THEMES_SITE);
|
||||
|
||||
// Create an array of valid themes folders
|
||||
foreach($_themes_folders as $folder) if (File::exists(THEMES_SITE . DS . $folder . DS . 'index.template.php')) $__themes_folders[] = $folder;
|
||||
foreach($__themes_folders as $theme) $themes[$theme] = $theme;
|
||||
|
||||
return $themes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Templates
|
||||
*
|
||||
* @param string $theme Theme name
|
||||
* @return array
|
||||
*/
|
||||
public static function getTemplates($theme = null) {
|
||||
|
||||
$theme = ($theme === null) ? null : (string) $theme;
|
||||
|
||||
if ($theme == null) $theme = Option::get('theme_site_name');
|
||||
|
||||
$templates = array();
|
||||
|
||||
// Get all templates in current theme folder
|
||||
$templates = File::scan(THEMES_SITE . DS . $theme, '.template.php');
|
||||
|
||||
return $templates;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Chunks
|
||||
*
|
||||
* @param string $theme Theme name
|
||||
* @return array
|
||||
*/
|
||||
public static function getChunks($theme = null) {
|
||||
|
||||
$theme = ($theme === null) ? null : (string) $theme;
|
||||
|
||||
if ($theme == null) $theme = Option::get('theme_site_name');
|
||||
|
||||
$chunks = array();
|
||||
|
||||
// Get all templates in current theme folder
|
||||
$chunks = File::scan(THEMES_SITE . DS . $theme, '.chunk.php');
|
||||
|
||||
return $chunks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Styles
|
||||
*
|
||||
* @param string $theme Theme name
|
||||
* @return array
|
||||
*/
|
||||
public static function getStyles($theme = null) {
|
||||
|
||||
$theme = ($theme === null) ? null : (string) $theme;
|
||||
|
||||
if ($theme == null) $theme = Option::get('theme_site_name');
|
||||
|
||||
$styles = array();
|
||||
|
||||
// Get all templates in current theme folder
|
||||
$styles = File::scan(THEMES_SITE . DS . $theme . DS . 'css', '.css');
|
||||
|
||||
return $styles;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Scripts
|
||||
*
|
||||
* @param string $theme Theme name
|
||||
* @return array
|
||||
*/
|
||||
public static function getScripts($theme = null) {
|
||||
|
||||
$theme = ($theme === null) ? null : (string) $theme;
|
||||
|
||||
if ($theme == null) $theme = Option::get('theme_site_name');
|
||||
|
||||
$scripts = array();
|
||||
|
||||
// Get all templates in current theme folder
|
||||
$scripts = File::scan(THEMES_SITE . DS . $theme . DS . 'js', '.js');
|
||||
|
||||
return $scripts;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Chunk frontend class
|
||||
*/
|
||||
class Chunk {
|
||||
|
||||
/**
|
||||
* Get chunk
|
||||
*
|
||||
* @param string $name Chunk name
|
||||
* @param string $theme Theme name
|
||||
*/
|
||||
public static function get($name, $theme = null) {
|
||||
|
||||
$name = (string) $name;
|
||||
$current_theme = ($theme === null) ? null : (string) $theme;
|
||||
|
||||
if ($current_theme == null) $current_theme = Option::get('theme_site_name');
|
||||
|
||||
$chunk_path = THEMES_SITE . DS . $current_theme . DS;
|
||||
|
||||
// Is chunk exist ?
|
||||
if (file_exists($chunk_path . $name . '.chunk.php')) {
|
||||
|
||||
// Is chunk minified
|
||||
if ( ! file_exists(MINIFY . DS . 'theme.' . $current_theme . '.minify.' . $name . '.chunk.php') or
|
||||
filemtime(THEMES_SITE . DS . $current_theme . DS . $name .'.chunk.php') > filemtime(MINIFY . DS . 'theme.' . $current_theme . '.minify.' . $name . '.chunk.php')) {
|
||||
$buffer = file_get_contents(THEMES_SITE. DS . $current_theme . DS . $name .'.chunk.php');
|
||||
$buffer = Minify::html($buffer);
|
||||
file_put_contents(MINIFY . DS . 'theme.' . $current_theme . '.minify.' . $name . '.chunk.php', $buffer);
|
||||
}
|
||||
|
||||
// Include chunk
|
||||
include MINIFY . DS . 'theme.' . $current_theme . '.minify.' . $name . '.chunk.php';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
47
plugins/box/themes/views/backend/add.view.php
Normal file
47
plugins/box/themes/views/backend/add.view.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php if ($action == 'chunk') { ?><h2><?php echo __('New chunk', 'themes'); ?></h2><?php } ?>
|
||||
<?php if ($action == 'template') { ?><h2><?php echo __('New template', 'themes'); ?></h2><?php } ?>
|
||||
<?php if ($action == 'styles') { ?><h2><?php echo __('New styles', 'themes'); ?></h2><?php } ?>
|
||||
<?php if ($action == 'script') { ?><h2><?php echo __('New script', 'themes'); ?></h2><?php } ?>
|
||||
<br />
|
||||
|
||||
<?php if (Notification::get('success')) Alert::success(Notification::get('success')); ?>
|
||||
|
||||
<?php if (isset($errors['file_empty_name']) || isset($errors['file_exists'])) $error_class = 'error'; else $error_class = ''; ?>
|
||||
|
||||
<?php echo (Form::open(null, array('class' => 'form-horizontal'))); ?>
|
||||
|
||||
<?php echo (Form::hidden('csrf', Security::token())); ?>
|
||||
|
||||
<?php echo (Form::label('name', __('Name', 'themes'))); ?>
|
||||
|
||||
<div class="input-append">
|
||||
<?php echo (Form::input('name', $name, array('class' => 'input-xlarge'))); ?>
|
||||
<?php if ($action == 'chunk') { ?><span class="add-on">.chunk.php</span><?php } ?>
|
||||
<?php if ($action == 'template') { ?><span class="add-on">.template.php</span><?php } ?>
|
||||
<?php if ($action == 'styles') { ?><span class="add-on">.css</span><?php } ?>
|
||||
<?php if ($action == 'script') { ?><span class="add-on">.js</span><?php } ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if (isset($errors['file_empty_name'])) echo ' <span style="color:red">'.$errors['file_empty_name'].'</span>';
|
||||
if (isset($errors['file_exists'])) echo ' <span style="color:red">'.$errors['file_exists'].'</span>';
|
||||
?>
|
||||
|
||||
<br><br>
|
||||
|
||||
<?php
|
||||
|
||||
if ($action == 'chunk') { echo Form::label('content', __('Chunk content', 'themes')); }
|
||||
if ($action == 'template') { echo Form::label('content', __('Template content', 'themes')); }
|
||||
if ($action == 'styles') { echo Form::label('content', __('Styles content', 'themes')); }
|
||||
if ($action == 'script') { echo Form::label('content', __('Script content', 'themes')); }
|
||||
|
||||
echo Form::textarea('content', $content, array('style' => 'width:100%;height:400px;', 'class' => 'source-editor'));
|
||||
|
||||
echo (
|
||||
Html::br(2).
|
||||
Form::submit('add_file_and_exit', __('Save and exit', 'themes'), array('class' => 'btn')).Html::nbsp(2).
|
||||
Form::submit('add_file', __('Save', 'themes'), array('class' => 'btn')).
|
||||
Form::close()
|
||||
);
|
||||
?>
|
64
plugins/box/themes/views/backend/edit.view.php
Normal file
64
plugins/box/themes/views/backend/edit.view.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php if ($action == 'chunk') { ?><h2><?php echo __('Edit chunk', 'themes'); ?></h2><?php } ?>
|
||||
<?php if ($action == 'template') { ?><h2><?php echo __('Edit template', 'themes'); ?></h2><?php } ?>
|
||||
<?php if ($action == 'styles') { ?><h2><?php echo __('Edit styles', 'themes'); ?></h2><?php } ?>
|
||||
<?php if ($action == 'script') { ?><h2><?php echo __('Edit script', 'themes'); ?></h2><?php } ?>
|
||||
<br />
|
||||
|
||||
<?php if (Notification::get('success')) Alert::success(Notification::get('success')); ?>
|
||||
|
||||
<?php
|
||||
if ($content !== null) {
|
||||
|
||||
if (isset($errors['file_empty_name']) or isset($errors['file_exists'])) $error_class = 'error'; else $error_class = '';
|
||||
|
||||
echo (Form::open(null, array('class' => 'form-horizontal')));
|
||||
|
||||
echo (Form::hidden('csrf', Security::token()));
|
||||
|
||||
?>
|
||||
|
||||
<?php if ($action == 'chunk') { echo (Form::hidden('chunk_old_name', Request::get('filename'))); } ?>
|
||||
<?php if ($action == 'template') { echo (Form::hidden('template_old_name', Request::get('filename'))); } ?>
|
||||
<?php if ($action == 'styles') { echo (Form::hidden('styles_old_name', Request::get('filename'))); } ?>
|
||||
<?php if ($action == 'script') { echo (Form::hidden('script_old_name', Request::get('filename'))); } ?>
|
||||
|
||||
|
||||
<?php echo (Form::label('name', __('Name', 'themes'))); ?>
|
||||
|
||||
<div class="input-append">
|
||||
<?php echo (Form::input('name', $name, array('class' => 'input-xlarge'))); ?>
|
||||
<?php if ($action == 'chunk') { ?><span class="add-on">.chunk.php</span><?php } ?>
|
||||
<?php if ($action == 'template') { ?><span class="add-on">.template.php</span><?php } ?>
|
||||
<?php if ($action == 'styles') { ?><span class="add-on">.css</span><?php } ?>
|
||||
<?php if ($action == 'script') { ?><span class="add-on">.js</span><?php } ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if (isset($errors['file_empty_name'])) echo ' <span style="color:red">'.$errors['file_empty_name'].'</span>';
|
||||
if (isset($errors['file_exists'])) echo ' <span style="color:red">'.$errors['file_exists'].'</span>';
|
||||
?>
|
||||
|
||||
<br><br>
|
||||
|
||||
<?php
|
||||
|
||||
if ($action == 'chunk') { echo Form::label('content', __('Chunk content', 'themes')); }
|
||||
if ($action == 'template') { echo Form::label('content', __('Template content', 'themes')); }
|
||||
if ($action == 'styles') { echo Form::label('content', __('Styles content', 'themes')); }
|
||||
if ($action == 'script') { echo Form::label('content', __('Script content', 'themes')); }
|
||||
|
||||
echo (
|
||||
Form::textarea('content', Html::toText($content), array('style' => 'width:100%;height:400px;', 'class' => 'source-editor')).
|
||||
Html::br(2).
|
||||
Form::submit('edit_file_and_exit', __('Save and exit', 'themes'), array('class' => 'btn default')).Html::nbsp(2).
|
||||
Form::submit('edit_file', __('Save', 'themes'), array('class' => 'btn default')). Html::nbsp().
|
||||
Form::close()
|
||||
);
|
||||
|
||||
} else {
|
||||
if ($action == 'chunk') { echo '<div class="message-error">'.__('This chunk does not exist', 'themes').'</div>'; }
|
||||
if ($action == 'template') { echo '<div class="message-error">'.__('This template does not exist', 'themes').'</div>'; }
|
||||
if ($action == 'styles') { echo '<div class="message-error">'.__('This styles does not exist', 'themes').'</div>'; }
|
||||
if ($action == 'script') { echo '<div class="message-error">'.__('This script does not exist', 'themes').'</div>'; }
|
||||
}
|
||||
?>
|
199
plugins/box/themes/views/backend/index.view.php
Normal file
199
plugins/box/themes/views/backend/index.view.php
Normal file
@@ -0,0 +1,199 @@
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span6">
|
||||
|
||||
<h2><?php echo __('Site theme', 'themes'); ?></h2>
|
||||
<br />
|
||||
|
||||
<!-- Themes_selector -->
|
||||
<?php
|
||||
echo (
|
||||
Form::open().
|
||||
Form::hidden('csrf', Security::token()).
|
||||
Form::label('themes', __('Select theme', 'themes')).
|
||||
Form::select('themes', $themes_site, $current_site_theme, array('class' => 'span6')). Html::br().
|
||||
Form::submit('save_site_theme', __('Save', 'themes'), array('class' => 'btn')).
|
||||
Form::close()
|
||||
);
|
||||
?>
|
||||
<!-- /Themes_selector -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="span6">
|
||||
|
||||
<h2><?php echo __('Admin theme', 'themes'); ?></h2>
|
||||
<br />
|
||||
|
||||
<!-- Themes_selector -->
|
||||
<?php
|
||||
echo (
|
||||
Form::open().
|
||||
Form::hidden('csrf', Security::token()).
|
||||
Form::label('themes', __('Select theme', 'themes')).
|
||||
Form::select('themes', $themes_admin, $current_admin_theme, array('class' => 'span6')). Html::br().
|
||||
Form::submit('save_admin_theme', __('Save', 'themes'), array('class' => 'btn')).
|
||||
Form::close()
|
||||
);
|
||||
?>
|
||||
<!-- /Themes_selector -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span12">
|
||||
|
||||
<?php
|
||||
echo (
|
||||
Html::heading(__('Current site theme', 'themes') . ': '. $current_site_theme, 2). Html::br()
|
||||
);
|
||||
?>
|
||||
|
||||
|
||||
<?php echo (Html::anchor(__('Create new template', 'themes'), 'index.php?id=themes&action=add_template', array('title' => __('Create new template'), 'class' => 'btn btn-small')).Html::br(2)); ?>
|
||||
|
||||
<!-- Templates_list -->
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr><td><?php echo __('Templates', 'themes'); ?></td><td width="40%"><?php echo __('Actions', 'themes'); ?></td></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (count($templates) != 0) foreach ($templates as $template) { ?>
|
||||
<tr>
|
||||
<td><?php echo basename($template, '.template.php'); ?></td>
|
||||
<td>
|
||||
<div class="btn-toolbar">
|
||||
<div class="btn-group">
|
||||
<?php echo Html::anchor(__('Edit', 'themes'), 'index.php?id=themes&action=edit_template&filename='.basename($template, '.template.php'), array('class' => 'btn btn-actions')); ?>
|
||||
<a class="btn dropdown-toggle btn-actions" data-toggle="dropdown" href="#" style="font-family:arial;"><span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><?php echo Html::anchor(__('Clone', 'themes'), 'index.php?id=themes&action=clone_template&filename='.basename($template, '.template.php'), array('title' => __('Clone'))); ?></li>
|
||||
</ul>
|
||||
<?php echo Html::anchor(__('Delete', 'themes'),
|
||||
'index.php?id=themes&action=delete_template&filename='.basename($template, '.template.php'),
|
||||
array('class' => 'btn btn-actions btn-actions-default', 'onclick' => "return confirmDelete('".__('Delete template: :name', 'themes', array(':name' => basename($template, '.template.php')))."')"));
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- /Templates_list -->
|
||||
|
||||
<?php echo (Html::anchor(__('Create new chunk', 'themes'), 'index.php?id=themes&action=add_chunk', array('title' => __('Create new chnuk', 'themes'), 'class' => 'btn btn-small')).Html::br(2)); ?>
|
||||
|
||||
<!-- Chunks_list -->
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr><td><?php echo __('Chunks', 'themes'); ?></td><td width="40%"><?php echo __('Actions', 'themes'); ?></td></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (count($chunks) != 0) foreach ($chunks as $chunk) { ?>
|
||||
<tr>
|
||||
<td><?php echo basename($chunk, '.chunk.php'); ?></td>
|
||||
<td>
|
||||
<div class="btn-toolbar">
|
||||
<div class="btn-group">
|
||||
<?php echo Html::anchor(__('Edit', 'themes'), 'index.php?id=themes&action=edit_chunk&filename='.basename($chunk, '.chunk.php'), array('class' => 'btn btn-actions')); ?>
|
||||
<a class="btn dropdown-toggle btn-actions" data-toggle="dropdown" href="#" style="font-family:arial;"><span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><?php echo Html::anchor(__('Clone', 'themes'), 'index.php?id=themes&action=clone_chunk&filename='.basename($chunk, '.chunk.php'), array('title' => __('Clone', 'themes'))); ?></li>
|
||||
</ul>
|
||||
<?php echo Html::anchor(__('Delete', 'themes'),
|
||||
'index.php?id=themes&action=delete_chunk&filename='.basename($chunk, '.chunk.php'),
|
||||
array('class' => 'btn btn-actions btn-actions-default', 'onclick' => "return confirmDelete('".__('Delete chunk: :name', 'themes', array(':name' => basename($chunk, '.chunk.php')))."')"));
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- /Chunks_list -->
|
||||
|
||||
<?php echo (Html::anchor(__('Create new styles', 'themes'), 'index.php?id=themes&action=add_styles', array('title' => __('Create new style', 'themes'), 'class' => 'btn btn-small')).Html::br(2)); ?>
|
||||
|
||||
<!-- Styles_list -->
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr><td><?php echo __('Styles', 'themes'); ?></td><td width="40%"><?php echo __('Actions', 'themes'); ?></td></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (count($styles) != 0) foreach ($styles as $style) { ?>
|
||||
<tr>
|
||||
<td><?php echo basename($style, '.css'); ?></td>
|
||||
<td>
|
||||
<div class="btn-toolbar">
|
||||
<div class="btn-group">
|
||||
<?php echo Html::anchor(__('Edit', 'themes'), 'index.php?id=themes&action=edit_styles&filename='.basename($style, '.css'), array('class' => 'btn btn-actions')); ?>
|
||||
<a class="btn dropdown-toggle btn-actions" data-toggle="dropdown" href="#" style="font-family:arial;"><span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><?php echo Html::anchor(__('Clone', 'themes'), 'index.php?id=themes&action=clone_styles&filename='.basename($style, '.css'), array('title' => __('Clone', 'themes'))); ?></li>
|
||||
</ul>
|
||||
<?php echo Html::anchor(__('Delete', 'themes'),
|
||||
'index.php?id=themes&action=delete_styles&filename='.basename($style, '.css'),
|
||||
array('class' => 'btn btn-actions btn-actions-default', 'onclick' => "return confirmDelete('".__('Delete styles: :name', 'themes', array(':name' => basename($style, '.css')))."')"));
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- /Styles_list -->
|
||||
|
||||
<?php echo (Html::anchor(__('Create new script', 'themes'), 'index.php?id=themes&action=add_script', array('title' => __('Create new script', 'themes'), 'class' => 'btn btn-small')).Html::br(2)); ?>
|
||||
|
||||
<!-- Scripts_list -->
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr><td><?php echo __('Scripts', 'themes'); ?></td><td width="40%"><?php echo __('Actions', 'themes'); ?></td></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (count($scripts) != 0) foreach ($scripts as $script) { ?>
|
||||
<tr>
|
||||
<td><?php echo basename($script, '.js'); ?></td>
|
||||
<td>
|
||||
<div class="btn-toolbar">
|
||||
<div class="btn-group">
|
||||
<?php echo Html::anchor(__('Edit', 'themes'), 'index.php?id=themes&action=edit_script&filename='.basename($script, '.js'), array('class' => 'btn btn-actions')); ?>
|
||||
<a class="btn dropdown-toggle btn-actions" data-toggle="dropdown" href="#" style="font-family:arial;"><span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><?php echo Html::anchor(__('Clone', 'themes'), 'index.php?id=themes&action=clone_script&filename='.basename($script, '.js'), array('title' => __('Clone', 'themes'))); ?></li>
|
||||
</ul>
|
||||
<?php echo Html::anchor(__('Delete', 'themes'),
|
||||
'index.php?id=themes&action=delete_script&filename='.basename($script, '.js'),
|
||||
array('class' => 'btn btn-actions btn-actions-default', 'onclick' => "return confirmDelete('".__('Delete script: :name', 'themes', array(':name' => basename($script, '.js')))."')"));
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- /Scripts_list -->
|
||||
|
||||
|
||||
<?php // All exept Pages, Users and Sitemap plugins
|
||||
if(count(Plugin::$components) > 3) {
|
||||
?>
|
||||
<h2><?php echo __('Components templates', 'themes'); ?></h2><br />
|
||||
<?php
|
||||
// Its mean that you can add your own actions for this plugin
|
||||
Action::run('admin_themes_extra_index_template_actions');
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user