1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-04 12:17:42 +02:00
This commit is contained in:
metal_gvc
2014-02-12 21:29:53 +02:00
34 changed files with 4124 additions and 393 deletions

View File

@@ -6,17 +6,27 @@ Monstra 2.4.0, 2014-xx-xx
- Site: New default theme
- W3 layout fixes
- Idiorm Updated to 1.4.1
- Filesmanager plugin: added ability to create & rename directories.
- Prefetch DNS to reduce look up times
- Files Manager: added ability to create & rename directories.
- Files Manager: Maximum upload file size message - added.
- Files Manager: Bootstrap fileinput.js updated to 3.0.0
- Backup: Restore Site from Backup added
- Plugins Manager: Uploading new plugins via the admin panel added
- Plugins Manager: Read plugin help(README.MD) ability added.
- Responsive Chocolat Lightbox instead of TB Lightbox
- Blog Plugin as a part of Monstra CMS
- CodeMirror Plugin as a part of Monstra CMS
- Markdown Plugin as a part of Monstra CMS
- Site Url without trailing slashes
- Admin Help Section - added
- Monstra Dashboard created and set as default Plugin for Admin Panel
- Monstra Dashboard Google Analytics statistic added.
- Ink Framework for Monstra Email Templates
- iCheck plugin for checkboxes
- iCheck plugin for checkboxes added.
- Emails Manager Plugin added.
- HubSpot Messaging Library added for notifications
- Gelato: Unzip Functionality added.
- Gelato: Number Class new method convertToBytes() added.
- Update jQuery to v1.10.2
- Users Plugin getGravatarURL() improve
- Plugin API - Actions - Closure support added.
@@ -27,7 +37,8 @@ Monstra 2.4.0, 2014-xx-xx
- Core: Added ability to avoid caching JS/CSS by the browser.
- Prefetch DNS added to reduce look up times
- Sandbox Plugin cleanup
- Localization: Japanese(JA), Indonesian(ID) translations added
- New Flags: Japanese(JA), Indonesian(ID) added.
- Localization: Japanese(JA), Indonesian(ID) translations added.
- Localization: Major Fixes
Monstra 2.3.1, 2013-12-25

View File

@@ -209,17 +209,24 @@ a.navbar-brand {
.alert,
.tooltip,
.tooltip-inner,
pre,
code {
border-radius: 0px;
}
.badge,
.tooltip,
.tooltip-inner,
.label {
.label,
pre,
code {
font-weight: normal;
text-shadow: none;
}
pre {
border: none;
}
/* Inputs */
select,
textarea,
@@ -411,6 +418,7 @@ td, th {
border-bottom: 1px solid #ccc;
}
/* Editor */
#editor_area {
height: 400px!important;
@@ -434,6 +442,10 @@ td, th {
border-bottom: 1px solid #F3F3F3;
}
.modal-header .close {
font-size: 26px;
}
.modal-footer {
border-top: 1px solid #F3F3F3;
}
@@ -460,6 +472,14 @@ td, th {
border: none;
}
#readme .modal-dialog {
width: 70%;
}
#readme .modal-body {
padding-top: 0px;
}
/*************************************
3. MEDIA QUERIES
*************************************/

View File

@@ -1,2 +1,40 @@
Monstra CMS Blog
Blog
================
### Usage
#### Get Post
<?php echo Blog::getPost(); ?>
#### Get Posts
<?php echo Blog::getPosts(); ?>
#### Get 5 Posts (could be any amount, 5 or 1 or 25):
<?php echo Blog::getPosts(5); ?>
#### Get related Posts
<?php echo Blog::getRelatedPosts(); ?>
#### Get 4 latest posts from Blog
<?php echo Blog::getPostsBlock(4); ?>
#### Get Tags&Keywords
<?php Blog::getTags(); ?>
#### Get Tags&Keywords for current page
<?php Blog::getTags(Page::slug()); ?>
Get Post Title
<?php echo Blog::getPostTitle(); ?>
### Shortcode for content
#### Divided post into 2 parts (short and full)
{cut}
Example:
<p>Best free themes for Monstra CMS at monstrathemes.com</p>
{cut}
<p>There is going to display your content as blog post =)</p>

View File

@@ -1,387 +1,387 @@
<?php
/**
* Blog plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.7.3
*
*/
/**
* Blog plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.7.3
*
*/
// Register plugin
Plugin::register( __FILE__,
__('Blog', 'blog'),
__('Blog plugin for Monstra', 'blog'),
'1.7.3',
'Awilum',
'http://monstra.org/');
// Register plugin
Plugin::register( __FILE__,
__('Blog', 'blog'),
__('Blog plugin for Monstra', 'blog'),
'1.7.3',
'Awilum',
'http://monstra.org/');
/**
* Blog Class
*/
class Blog {
/**
* Blog Class
* Parrent page name(slug)
*
* @var string
*/
class Blog {
/**
* Parrent page name(slug)
*
* @var string
*/
public static $parent_page_name = 'blog';
/**
* Get tags
*
* <code>
* echo Blog::getTags();
* </code>
*
* @return string
*/
public static function getTags($slug = null) {
// Display view
return View::factory('blog/views/frontend/tags')
->assign('tags', Blog::getTagsArray($slug))
->render();
}
/**
* Get breadcrumbs
*
* <code>
* echo Blog::breadcrumbs();
* </code>
*
* @return string
*/
public static function breadcrumbs() {
$current_page = Pages::$requested_page;
$parent_page = '';
if ($current_page !== 'error404') {
$page = Pages::$pages->select('[slug="'.$current_page.'"]', null);
if (trim($page['parent']) !== '') {
$parent = true;
$parent_page = Pages::$pages->select('[slug="'.$page['parent'].'"]', null);
} else {
$parent = false;
}
// Display view
View::factory('blog/views/frontend/breadcrumbs')
->assign('current_page', $current_page)
->assign('page', $page)
->assign('parent', $parent)
->assign('parent_page', $parent_page)
->display();
}
}
/**
* Get tags array
*
* <code>
* echo Blog::getTagsArray();
* </code>
*
* @return array
*/
public static function getTagsArray($slug = null) {
// Init vars
$tags = array();
$tags_string = '';
if ($slug == null) {
$posts = Pages::$pages->select('[parent="'.Blog::$parent_page_name.'" and status="published"]', 'all');
} else {
$posts = Pages::$pages->select('[parent="'.Blog::$parent_page_name.'" and status="published" and slug="'.$slug.'"]', 'all');
}
foreach($posts as $post) {
$tags_string .= $post['keywords'].',';
}
$tags_string = substr($tags_string, 0, strlen($tags_string)-1);
// Explode tags in tags array
$tags = explode(',', $tags_string);
// Remove empty array elementss
foreach ($tags as $key => $value) {
if ($tags[$key] == '') {
unset($tags[$key]);
}
}
// Trim tags
array_walk($tags, create_function('&$val', '$val = trim($val);'));
// Get unique tags
$tags = array_unique($tags);
// Return tags
return $tags;
}
/**
* Get posts
*
* <code>
* // Get all posts
* echo Blog::getPosts();
*
* // Get last 5 posts
* echo Blog::getPosts(5);
* </code>
*
* @param integer $num Number of posts to show
* @return string
*/
public static function getPosts($nums = 10) {
// Get page param
$page = (Request::get('page')) ? (int)Request::get('page') : 1;
if (Request::get('tag')) {
$query = '[parent="'.Blog::$parent_page_name.'" and status="published" and contains(keywords, "'.Request::get('tag').'")]';
Notification::set('tag', Request::get('tag'));
} else {
$query = '[parent="'.Blog::$parent_page_name.'" and status="published"]';
Notification::clean();
}
// Get Elements Count
$elements = count(Pages::$pages->select($query, 'all'));
// Get Pages Count
$pages = ceil($elements/$nums);
if ($page < 1) {
$page = 1;
} elseif ($page > $pages) {
$page = $pages;
}
$start = ($page-1)*$nums;
// If there is no posts
if ($start < 0) $start = 0;
// Get posts and sort by DESC
$posts = Pages::$pages->select($query, $nums, $start, array('slug', 'title', 'author', 'date'), 'date', 'DESC');
// Loop
foreach($posts as $key => $post) {
$post_short = explode("{cut}", Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $post['id'] . '.page.txt')));
$posts[$key]['content'] = Filter::apply('content', $post_short[0]);
}
// Display view
return View::factory('blog/views/frontend/index')
->assign('posts', $posts)
->render().
View::factory('blog/views/frontend/pager')
->assign('pages', $pages)
->assign('page', $page)
->render();
}
/**
* Get posts block
*
* <code>
* // Get all posts
* echo Blog::getPostsBlock();
*
* // Get last 5 posts
* echo Blog::getPostsBlock(5);
* </code>
*
* @param integer $num Number of posts to show
* @return string
*/
public static function getPostsBlock($nums = 10) {
// XPath Query
$query = '[parent="'.Blog::$parent_page_name.'" and status="published"]';
// Get posts and sort by DESC
$posts = Pages::$pages->select($query, $nums, 0, array('slug', 'title', 'author', 'date'), 'date', 'DESC');
// Loop
foreach($posts as $key => $post) {
$post_short = explode("{cut}", Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $post['id'] . '.page.txt')));
$posts[$key]['content'] = Filter::apply('content', $post_short[0]);
}
// Display view
return View::factory('blog/views/frontend/block')
->assign('posts', $posts)
->render();
}
/**
* Get related posts
*
* <code>
* echo Blog::getRelatedPosts();
* </code>
*
* @return string
*/
public static function getRelatedPosts($limit = null) {
$related_posts = array();
$tags = Blog::getTagsArray(Page::slug());
foreach($tags as $tag) {
$query = '[parent="'.Blog::$parent_page_name.'" and status="published" and contains(keywords, "'.$tag.'") and slug!="'.Page::slug().'"]';
if ($result = Arr::subvalSort(Pages::$pages->select($query, ($limit == null) ? 'all' : (int)$limit), 'date', 'DESC')) {
$related_posts = $result;
}
}
// Display view
return View::factory('blog/views/frontend/related_posts')
->assign('related_posts', $related_posts)
->render();
}
/**
* Get post content
*
* <code>
* echo Blog::getPost();
* </code>
*
* @return string
*/
public static function getPost() {
// Get post
$post = Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . Pages::$page['id'] . '.page.txt'));
// Apply content filter
$post = Filter::apply('content', $post);
// Remove {cut} shortcode
$post = strtr($post, array('{cut}' => ''));
// Return post
return $post;
}
/**
* Get post content before cut
*
* <code>
* echo Blog::getPostBeforeCut('home');
* </code>
*
* @return string
*/
public static function getPostBeforeCut($slug) {
$page = Pages::$pages->select('[slug="'.$slug.'"]', null);
// Get post
$post = explode("{cut}", Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt')));
// Apply content filter
$post_content = Filter::apply('content', $post[0]);
// Return post
return $post_content;
}
/**
* Get post content after cut
*
* <code>
* echo Blog::getPostAfterCut('home');
* </code>
*
* @return string
*/
public static function getPostAfterCut($slug) {
$page = Pages::$pages->select('[slug="'.$slug.'"]', null);
// Get post
$post = explode("{cut}", Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt')));
// Apply content filter
$post_content = Filter::apply('content', $post[1]);
// Return post
return $post_content;
}
/**
* Get Blog Post title
*
* <code>
* echo Blog::getPostTitle();
* </code>
*
* @return string
*/
public static function getPostTitle() {
return Page::title();
}
/**
* Get Blog Post Date
*
* <code>
* echo Blog::getPostDate();
* </code>
*
* @param string $format Date format
* @return string
*/
public static function getPostDate($format = 'Y-m-d') {
return Page::date($format);
}
/**
* Get author of current post
*
* <code>
* echo Blog::getPostAuthor();
* </code>
*
* @return string
*/
public static function getPostAuthor()
{
return Page::author();
}
public static $parent_page_name = 'blog';
/**
* Get tags
*
* <code>
* echo Blog::getTags();
* </code>
*
* @return string
*/
public static function getTags($slug = null) {
// Display view
return View::factory('blog/views/frontend/tags')
->assign('tags', Blog::getTagsArray($slug))
->render();
}
/**
* Get breadcrumbs
*
* <code>
* echo Blog::breadcrumbs();
* </code>
*
* @return string
*/
public static function breadcrumbs() {
$current_page = Pages::$requested_page;
$parent_page = '';
if ($current_page !== 'error404') {
$page = Pages::$pages->select('[slug="'.$current_page.'"]', null);
if (trim($page['parent']) !== '') {
$parent = true;
$parent_page = Pages::$pages->select('[slug="'.$page['parent'].'"]', null);
} else {
$parent = false;
}
// Display view
View::factory('blog/views/frontend/breadcrumbs')
->assign('current_page', $current_page)
->assign('page', $page)
->assign('parent', $parent)
->assign('parent_page', $parent_page)
->display();
}
}
/**
* Get tags array
*
* <code>
* echo Blog::getTagsArray();
* </code>
*
* @return array
*/
public static function getTagsArray($slug = null) {
// Init vars
$tags = array();
$tags_string = '';
if ($slug == null) {
$posts = Pages::$pages->select('[parent="'.Blog::$parent_page_name.'" and status="published"]', 'all');
} else {
$posts = Pages::$pages->select('[parent="'.Blog::$parent_page_name.'" and status="published" and slug="'.$slug.'"]', 'all');
}
foreach($posts as $post) {
$tags_string .= $post['keywords'].',';
}
$tags_string = substr($tags_string, 0, strlen($tags_string)-1);
// Explode tags in tags array
$tags = explode(',', $tags_string);
// Remove empty array elementss
foreach ($tags as $key => $value) {
if ($tags[$key] == '') {
unset($tags[$key]);
}
}
// Trim tags
array_walk($tags, create_function('&$val', '$val = trim($val);'));
// Get unique tags
$tags = array_unique($tags);
// Return tags
return $tags;
}
/**
* Get posts
*
* <code>
* // Get all posts
* echo Blog::getPosts();
*
* // Get last 5 posts
* echo Blog::getPosts(5);
* </code>
*
* @param integer $num Number of posts to show
* @return string
*/
public static function getPosts($nums = 10) {
// Get page param
$page = (Request::get('page')) ? (int)Request::get('page') : 1;
if (Request::get('tag')) {
$query = '[parent="'.Blog::$parent_page_name.'" and status="published" and contains(keywords, "'.Request::get('tag').'")]';
Notification::set('tag', Request::get('tag'));
} else {
$query = '[parent="'.Blog::$parent_page_name.'" and status="published"]';
Notification::clean();
}
// Get Elements Count
$elements = count(Pages::$pages->select($query, 'all'));
// Get Pages Count
$pages = ceil($elements/$nums);
if ($page < 1) {
$page = 1;
} elseif ($page > $pages) {
$page = $pages;
}
$start = ($page-1)*$nums;
// If there is no posts
if ($start < 0) $start = 0;
// Get posts and sort by DESC
$posts = Pages::$pages->select($query, $nums, $start, array('slug', 'title', 'author', 'date'), 'date', 'DESC');
// Loop
foreach($posts as $key => $post) {
$post_short = explode("{cut}", Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $post['id'] . '.page.txt')));
$posts[$key]['content'] = Filter::apply('content', $post_short[0]);
}
// Display view
return View::factory('blog/views/frontend/index')
->assign('posts', $posts)
->render().
View::factory('blog/views/frontend/pager')
->assign('pages', $pages)
->assign('page', $page)
->render();
}
/**
* Get posts block
*
* <code>
* // Get all posts
* echo Blog::getPostsBlock();
*
* // Get last 5 posts
* echo Blog::getPostsBlock(5);
* </code>
*
* @param integer $num Number of posts to show
* @return string
*/
public static function getPostsBlock($nums = 10) {
// XPath Query
$query = '[parent="'.Blog::$parent_page_name.'" and status="published"]';
// Get posts and sort by DESC
$posts = Pages::$pages->select($query, $nums, 0, array('slug', 'title', 'author', 'date'), 'date', 'DESC');
// Loop
foreach($posts as $key => $post) {
$post_short = explode("{cut}", Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $post['id'] . '.page.txt')));
$posts[$key]['content'] = Filter::apply('content', $post_short[0]);
}
// Display view
return View::factory('blog/views/frontend/block')
->assign('posts', $posts)
->render();
}
/**
* Get related posts
*
* <code>
* echo Blog::getRelatedPosts();
* </code>
*
* @return string
*/
public static function getRelatedPosts($limit = null) {
$related_posts = array();
$tags = Blog::getTagsArray(Page::slug());
foreach($tags as $tag) {
$query = '[parent="'.Blog::$parent_page_name.'" and status="published" and contains(keywords, "'.$tag.'") and slug!="'.Page::slug().'"]';
if ($result = Arr::subvalSort(Pages::$pages->select($query, ($limit == null) ? 'all' : (int)$limit), 'date', 'DESC')) {
$related_posts = $result;
}
}
// Display view
return View::factory('blog/views/frontend/related_posts')
->assign('related_posts', $related_posts)
->render();
}
/**
* Get post content
*
* <code>
* echo Blog::getPost();
* </code>
*
* @return string
*/
public static function getPost() {
// Get post
$post = Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . Pages::$page['id'] . '.page.txt'));
// Apply content filter
$post = Filter::apply('content', $post);
// Remove {cut} shortcode
$post = strtr($post, array('{cut}' => ''));
// Return post
return $post;
}
/**
* Get post content before cut
*
* <code>
* echo Blog::getPostBeforeCut('home');
* </code>
*
* @return string
*/
public static function getPostBeforeCut($slug) {
$page = Pages::$pages->select('[slug="'.$slug.'"]', null);
// Get post
$post = explode("{cut}", Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt')));
// Apply content filter
$post_content = Filter::apply('content', $post[0]);
// Return post
return $post_content;
}
/**
* Get post content after cut
*
* <code>
* echo Blog::getPostAfterCut('home');
* </code>
*
* @return string
*/
public static function getPostAfterCut($slug) {
$page = Pages::$pages->select('[slug="'.$slug.'"]', null);
// Get post
$post = explode("{cut}", Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt')));
// Apply content filter
$post_content = Filter::apply('content', $post[1]);
// Return post
return $post_content;
}
/**
* Get Blog Post title
*
* <code>
* echo Blog::getPostTitle();
* </code>
*
* @return string
*/
public static function getPostTitle() {
return Page::title();
}
/**
* Get Blog Post Date
*
* <code>
* echo Blog::getPostDate();
* </code>
*
* @param string $format Date format
* @return string
*/
public static function getPostDate($format = 'Y-m-d') {
return Page::date($format);
}
/**
* Get author of current post
*
* <code>
* echo Blog::getPostAuthor();
* </code>
*
* @return string
*/
public static function getPostAuthor()
{
return Page::author();
}
}

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'Hole weitere Plugins',
'Install' => 'Installieren',
'Uninstall' => 'Deinstallieren',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'Get More Plugins',
'Install' => 'Install',
'Uninstall' => 'Uninstall',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'Obtener mas plugins',
'Install' => 'Instalar',
'Uninstall' => 'Desinstalar',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'دریافت افزونه های بیشتر',
'Install' => 'نصب',
'Uninstall' => 'حذف',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'Obtenez plus de plugins',
'Install' => 'Installer',
'Uninstall' => 'Désinstaller',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'Még több Plugin',
'Install' => 'Telepít',
'Uninstall' => 'Töröl',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'Cari Plugins Baru',
'Install' => 'Memasangkan',
'Uninstall' => 'Menghapus Program',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'Scarica altri plugin',
'Install' => 'Installa',
'Uninstall' => 'Disinstalla',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'さらにプラグインを取得',
'Install' => 'インストール',
'Uninstall' => '停止',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'Gauti daugiau papildinių',
'Install' => 'Įdiegti',
'Uninstall' => 'Išdiegti',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'Vind meer plugins',
'Install' => 'Installeren',
'Uninstall' => 'Deinstalleren',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'Pobierz więcej wtyczek',
'Install' => 'Instaluj',
'Uninstall' => 'Odinstaluj',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'Ver mais plugins',
'Install' => 'Instalar',
'Uninstall' => 'Desinstalar',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'Скачать другие плагины',
'Install' => 'Установить',
'Uninstall' => 'Удалить',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'Získať viacej pluginov',
'Install' => 'Inštalovať',
'Uninstall' => 'Odinštalovať',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'Dodaj još dodataka',
'Install' => 'Instaliraj',
'Uninstall' => 'Deinstaliraj',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -16,5 +16,6 @@
'Get More Plugins' => 'Завантажити інші плагіни',
'Install' => 'Установити',
'Uninstall' => 'Видалити',
'README.md not found' => 'README.md not found',
)
);

View File

@@ -6,11 +6,15 @@ Javascript::add('plugins/box/filesmanager/js/fileuploader.js', 'backend', 11);
// Add plugin navigation link
Navigation::add(__('Plugins', 'plugins'), 'extends', 'plugins', 1);
// Add action on admin_pre_render hook
Action::add('admin_pre_render','PluginsAdmin::_readmeLoadAjax');
/**
* Plugins Admin
*/
class PluginsAdmin extends Backend
{
/**
* Plugins admin
*/
@@ -113,6 +117,7 @@ class PluginsAdmin extends Backend
}
// Upload & extract plugin archive
// -------------------------------------
if (Request::post('upload_file')) {
@@ -218,4 +223,19 @@ class PluginsAdmin extends Backend
))
->display();
}
/**
* _readmeLoadAjax
*/
public static function _readmeLoadAjax() {
if (Request::post('readme_plugin')) {
if (File::exists($file = PLUGINS . DS . Request::post('readme_plugin') . DS . 'README.md')) {
echo Text::toHtml(markdown(Html::toText(File::getContent($file))));
} else {
echo __('README.md not found', 'plugins');
}
Request::shutdown();
}
}
}

View File

@@ -43,10 +43,12 @@
</td>
<td>
<div class="pull-right">
<?php if (File::exists(PLUGINS . DS . $plugin['id'] . DS . 'README.md')) { ?>
<?php echo Html::anchor(__('?', 'plugins'),
'#'.$plugin['id'],
array('class' => 'btn btn-info', 'data-toggle' => 'modal', 'data-target' => '#readme'));
'#',
array('class' => 'btn btn-info readme_plugin', 'data-toggle' => 'modal', 'data-target' => '#readme', 'readme_plugin' => $plugin['id']));
?>
<?php } ?>
<?php echo Html::anchor(__('Uninstall', 'plugins'),
'index.php?id=plugins&delete_plugin='.$plugin['id'].'&token='.Security::token(),
array('class' => 'btn btn-danger', 'onclick' => "return confirmDelete('".__('Delete plugin :plugin', 'plugins', array(':plugin' => $plugin['title']))."')"));
@@ -134,6 +136,21 @@
</div>
<script>
$(document).ready(function () {
$('.readme_plugin').click(function() {
$.ajax({
type:"post",
data:"readme_plugin="+$(this).attr('readme_plugin'),
url: "<?php echo Site::url(); ?>/admin/index.php?id=plugins",
success: function(data){
$('#readme .modal-body').html(data);
}
});
});
});
</script>
<!-- Modal -->
<div class="modal fade" id="readme" tabindex="-1" role="dialog" aria-hidden="true">
@@ -141,15 +158,9 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
<h4 class="modal-title" id="myModalLabel">README.md</h4>
</div>
<div class="modal-body"></div>
</div>
</div>
</div>

View File

@@ -1,4 +1,4 @@
CodeMirror
======================
CodeMirror is a versatile text editor implemented in JavaScript for the browser.
CodeMirror is a versatile text editor implemented in JavaScript for the browser.

View File

@@ -0,0 +1,4 @@
Markdown
======================
Markdown Syntax Documentation: [http://daringfireball.net/projects/markdown/syntax](http://daringfireball.net/projects/markdown/syntax)

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<plugin_location>plugins/markdown/markdown.plugin.php</plugin_location>
<plugin_status>active</plugin_status>
<plugin_priority>10</plugin_priority>
<plugin_name>Markdown</plugin_name>
<plugin_description>Markdown markup language 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,32 @@
<?php
/**
* Markdown plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2014 Romanenko Sergey / Awilum
* @version 1.0.0
*
*/
// Register plugin
Plugin::register( __FILE__,
__('Markdown'),
__('Markdown markup language plugin for Monstra'),
'1.0.0',
'Awilum',
'http://monstra.org/');
// Add new filter
Filter::add('content', 'markdown', 1);
use \Michelf\MarkdownExtra;
include PLUGINS . '/markdown/php-markdown/Michelf/Markdown.php';
include PLUGINS . '/markdown/php-markdown/Michelf/MarkdownExtra.php';
function markdown($content)
{
return MarkdownExtra::defaultTransform($content);
}

View File

@@ -0,0 +1,36 @@
PHP Markdown Lib
Copyright (c) 2004-2013 Michel Fortin
<http://michelf.ca/>
All rights reserved.
Based on Markdown
Copyright (c) 2003-2006 John Gruber
<http://daringfireball.net/>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name "Markdown" nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
This software is provided by the copyright holders and contributors "as
is" and any express or implied warranties, including, but not limited
to, the implied warranties of merchantability and fitness for a
particular purpose are disclaimed. In no event shall the copyright owner
or contributors be liable for any direct, indirect, incidental, special,
exemplary, or consequential damages (including, but not limited to,
procurement of substitute goods or services; loss of use, data, or
profits; or business interruption) however caused and on any theory of
liability, whether in contract, strict liability, or tort (including
negligence or otherwise) arising in any way out of the use of this
software, even if advised of the possibility of such damage.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,36 @@
<?php
#
# Markdown Extra - A text-to-HTML conversion tool for web writers
#
# PHP Markdown Extra
# Copyright (c) 2004-2013 Michel Fortin
# <http://michelf.com/projects/php-markdown/>
#
# Original Markdown
# Copyright (c) 2004-2006 John Gruber
# <http://daringfireball.net/projects/markdown/>
#
namespace Michelf;
# Just force Michelf/Markdown.php to load. This is needed to load
# the temporary implementation class. See below for details.
\Michelf\Markdown::MARKDOWNLIB_VERSION;
#
# Markdown Extra Parser Class
#
# Note: Currently the implementation resides in the temporary class
# \Michelf\MarkdownExtra_TmpImpl (in the same file as \Michelf\Markdown).
# This makes it easier to propagate the changes between the three different
# packaging styles of PHP Markdown. Once this issue is resolved, the
# _MarkdownExtra_TmpImpl will disappear and this one will contain the code.
#
class MarkdownExtra extends \Michelf\_MarkdownExtra_TmpImpl
{
### Parser Implementation ###
# Temporarily, the implemenation is in the _MarkdownExtra_TmpImpl class.
# See note above.
}

View File

@@ -0,0 +1,259 @@
PHP Markdown
============
PHP Markdown Lib 1.3 - 11 Apr 2013
by Michel Fortin
<http://michelf.ca/>
based on Markdown by John Gruber
<http://daringfireball.net/>
Introduction
------------
This is a library package that includes the PHP Markdown parser and its
sibling PHP Markdown Extra which additional features.
Markdown is a text-to-HTML conversion tool for web writers. Markdown
allows you to write using an easy-to-read, easy-to-write plain text
format, then convert it to structurally valid XHTML (or HTML).
"Markdown" is two things: a plain text markup syntax, and a software
tool, written in Perl, that converts the plain text markup to HTML.
PHP Markdown is a port to PHP of the original Markdown program by
John Gruber.
PHP Markdown can work as a plug-in for WordPress, as a modifier for
the Smarty templating engine, or as a replacement for Textile
formatting in any software that supports Textile.
Full documentation of Markdown's syntax is available on John's
Markdown page: <http://daringfireball.net/projects/markdown/>
Requirement
-----------
This library package requires PHP 5.3 or later.
Note: The older plugin/library hybrid package for PHP Markdown and
PHP Markdown Extra is still maintained and will work with PHP 4.0.5 and later.
Before PHP 5.3.7, pcre.backtrack_limit defaults to 100 000, which is too small
in many situations. You might need to set it to higher values. Later PHP
releases defaults to 1 000 000, which is usually fine.
Usage
-----
This library package is meant to be used with class autoloading. For autoloading
to work, your project needs have setup a PSR-0-compatible autoloader. See the
included Readme.php file for a minimal autoloader setup. (If you don't want to
use autoloading you can do a classic `require_once` to manually include the
files prior use instead.)
With class autoloading in place, putting the 'Michelf' folder in your
include path should be enough for this to work:
use \Michelf\Markdown;
$my_html = Markdown::defaultTransform($my_text);
Markdown Extra syntax is also available the same way:
use \Michelf\MarkdownExtra;
$my_html = MarkdownExtra::defaultTransform($my_text);
If you wish to use PHP Markdown with another text filter function
built to parse HTML, you should filter the text *after* the `transform`
function call. This is an example with [PHP SmartyPants][psp]:
use \Michelf\Markdown, \Michelf\SmartyPants;
$my_html = Markdown::defaultTransform($my_text);
$my_html = SmartyPants::defaultTransform($my_html);
All these examples are using the static `defaultTransform` static function
found inside the parser class. If you want to customize the parser
configuration, you can also instantiate it directly and change some
configuration variables:
use \Michelf\MarkdownExtra;
$parser = new MarkdownExtra;
$parser->fn_id_prefix = "post22-";
$my_html = $parser->transform($my_text);
Usage
-----
This library package is meant to be used with class autoloading. For autoloading
to work, your project needs have setup a PSR-0-compatible autoloader. See the
included Readme.php file for a minimal autoloader setup. (If you don't want to
use autoloading you can do a classic `require_once` to manually include the
files prior use instead.)
With class autoloading in place, putting the 'Michelf' folder in your
include path should be enough for this to work:
use \Michelf\Markdown;
$my_html = Markdown::defaultTransform($my_text);
Markdown Extra syntax is also available the same way:
use \Michelf\MarkdownExtra;
$my_html = MarkdownExtra::defaultTransform($my_text);
If you wish to use PHP Markdown with another text filter function
built to parse HTML, you should filter the text *after* the `transform`
function call. This is an example with [PHP SmartyPants][psp]:
use \Michelf\Markdown, \Michelf\SmartyPants;
$my_html = Markdown::defaultTransform($my_text);
$my_html = SmartyPants::defaultTransform($my_html);
All these examples are using the static `defaultTransform` static function
found inside the parser class. If you want to customize the parser
configuration, you can also instantiate it directly and change some
configuration variables:
use \Michelf\MarkdownExtra;
$parser = new MarkdownExtra;
$parser->fn_id_prefix = "post22-";
$my_html = $parser->transform($my_text);
To learn more, see the full list of [configuration variables].
[configuration variables]: http://michelf.ca/project/php-markdown/configuration/
Public API and Versionning Policy
---------------------------------
Version numbers are of the form *major*.*minor*.*patch*.
The public API of PHP Markdown consist of the two parser classes `Markdown`
and `MarkdownExtra`, their constructors, the `transform` and `defaultTransform`
functions and their configuration variables. The public API is stable for
a given major version number. It might get additions when the minor version
number increments.
**Protected members are not considered public API.** This is unconventionnal
and deserves an explanation. Incrementing the major version number every time
the underlying implementation of something changes is going to give nonsential
version numbers for the vast majority of people who just use the parser.
Protected members are meant to create parser subclasses that behave in
different ways. Very few people create parser subclasses. I don't want to
discourage it by making everything private, but at the same time I can't
guarenty any stable hook between versions if you use protected members.
**Syntax changes** will increment the minor number for new features, and the
patch number for small corrections. A *new feature* is something that needs a
change in the syntax documentation. Note that since PHP Markdown Lib includes
two parsers, a syntax change for either of them will increment the minor
number. Also note that there is nothigng perfectly backward-compatible with the
Markdown syntax: all inputs are always valid, so new features always replace
something that was previously legal, although generally non-sensial to do.
Bugs
----
To file bug reports please send email to:
<michel.fortin@michelf.ca>
Please include with your report: (1) the example input; (2) the output you
expected; (3) the output PHP Markdown actually produced.
If you have a problem where Markdown gives you an empty result, first check
that the backtrack limit is not too low by running `php --info | grep pcre`.
See Installation and Requirement above for details.
Version History
---------------
PHP Markdown Lib 1.3 (11 Apr 2013):
This is the first release of PHP Markdown Lib. This package requires PHP
version 4.3 or later and is designed to work with PSR-0 autoloading and,
optionally with Composer. Here is a list of the changes since
PHP Markdown Extra 1.2.6:
* Plugin interface for Wordpress and other systems is no longer present in
the Lib package. The classic package is still available if you need it:
<http://michelf.ca/projects/php-markdown/classic/>
* Added `public` and `protected` protection attributes, plus a section about
what is "public API" and what isn't in the Readme file.
* Changed HTML output for footnotes: now instead of adding `rel` and `rev`
attributes, footnotes links have the class name `footnote-ref` and
backlinks `footnote-backref`.
* Fixed some regular expressions to make PCRE not shout warnings about POSIX
collation classes (dependent on your version of PCRE).
* Added optional class and id attributes to images and links using the same
syntax as for headers:
[link](url){#id .class}
![img](url){#id .class}
It work too for reference-style links and images. In this case you need
to put those attributes at the reference definition:
[link][linkref] or [linkref]
![img][linkref]
[linkref]: url "optional title" {#id .class}
* Fixed a PHP notice message triggered when some table column separator
markers are missing on the separator line below column headers.
* Fixed a small mistake that could cause the parser to retain an invalid
state related to parsing links across multiple runs. This was never
observed (that I know of), but it's still worth fixing.
Copyright and License
---------------------
PHP Markdown Lib
Copyright (c) 2004-2013 Michel Fortin
<http://michelf.ca/>
All rights reserved.
Based on Markdown
Copyright (c) 2003-2005 John Gruber
<http://daringfireball.net/>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the
distribution.
* Neither the name "Markdown" nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
This software is provided by the copyright holders and contributors "as
is" and any express or implied warranties, including, but not limited
to, the implied warranties of merchantability and fitness for a
particular purpose are disclaimed. In no event shall the copyright owner
or contributors be liable for any direct, indirect, incidental, special,
exemplary, or consequential damages (including, but not limited to,
procurement of substitute goods or services; loss of use, data, or
profits; or business interruption) however caused and on any theory of
liability, whether in contract, strict liability, or tort (including
negligence or otherwise) arising in any way out of the use of this
software, even if advised of the possibility of such damage.

View File

@@ -0,0 +1,31 @@
<?php
# This file passes the content of the Readme.md file in the same directory
# through the Markdown filter. You can adapt this sample code in any way
# you like.
# Install PSR-0-compatible class autoloader
spl_autoload_register(function ($class) {
require preg_replace('{\\\\|_(?!.*\\\\)}', DIRECTORY_SEPARATOR, ltrim($class, '\\')).'.php';
});
# Get Markdown class
use \Michelf\Markdown;
# Read file and pass content through the Markdown praser
$text = file_get_contents('Readme.md');
$html = Markdown::defaultTransform($text);
?>
<!DOCTYPE html>
<html>
<head>
<title>PHP Markdown Lib - Readme</title>
</head>
<body>
<?php
# Put HTML content in the document
echo $html;
?>
</body>
</html>

View File

@@ -0,0 +1,31 @@
{
"name": "michelf/php-markdown",
"type": "library",
"description": "PHP Markdown",
"homepage": "http://michelf.ca/projects/php-markdown/",
"keywords": ["markdown"],
"license": "BSD-3-Clause",
"authors": [
{
"name": "Michel Fortin",
"email": "michel.fortin@michelf.ca",
"homepage": "http://michelf.ca/",
"role": "Developer"
},
{
"name": "John Gruber",
"homepage": "http://daringfireball.net/"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-0": { "Michelf": "" }
},
"extra": {
"branch-alias": {
"dev-lib": "1.3.x-dev"
}
}
}

View File

@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<root><options><autoincrement>26</autoincrement></options><fields><location/><name/><status/><priority/></fields><plugins><id>1</id><uid>dd4ef4d35c</uid><name>Pages</name><location>plugins/box/pages/pages.plugin.php</location><status>active</status><priority>1</priority></plugins><plugins><id>2</id><uid>ae8f24db1e</uid><name>Filesmanager</name><location>plugins/box/filesmanager/filesmanager.plugin.php</location><status>active</status><priority>2</priority></plugins><plugins><id>3</id><uid>63477fb180</uid><name>Plugins</name><location>plugins/box/plugins/plugins.plugin.php</location><status>active</status><priority>1</priority></plugins><plugins><id>4</id><uid>51cef0f1d7</uid><name>Themes</name><location>plugins/box/themes/themes.plugin.php</location><status>active</status><priority>3</priority></plugins><plugins><id>5</id><uid>96d232738b</uid><name>Menu</name><location>plugins/box/menu/menu.plugin.php</location><status>active</status><priority>4</priority></plugins><plugins><id>6</id><uid>f1b72e74c3</uid><name>System</name><location>plugins/box/system/system.plugin.php</location><status>active</status><priority>4</priority></plugins><plugins><id>7</id><uid>945b0245f0</uid><name>Snippets</name><location>plugins/box/snippets/snippets.plugin.php</location><status>active</status><priority>6</priority></plugins><plugins><id>8</id><uid>df8fb7decc</uid><name>Users</name><location>plugins/box/users/users.plugin.php</location><status>active</status><priority>7</priority></plugins><plugins><id>9</id><uid>5994da8240</uid><name>Backup</name><location>plugins/box/backup/backup.plugin.php</location><status>active</status><priority>8</priority></plugins><plugins><id>10</id><uid>fba0b8bdca</uid><name>Sitemap</name><location>plugins/box/sitemap/sitemap.plugin.php</location><status>active</status><priority>10</priority></plugins><plugins><id>11</id><uid>f4d1aa1d5a</uid><name>Information</name><location>plugins/box/information/information.plugin.php</location><status>active</status><priority>15</priority></plugins><plugins><id>14</id><uid>78b14de2e1</uid><name>editor</name><location>plugins/box/editor/editor.plugin.php</location><status>active</status><priority>1</priority></plugins><plugins><id>15</id><uid>78b14de2e2</uid><name>blocks</name><location>plugins/box/blocks/blocks.plugin.php</location><status>active</status><priority>6</priority></plugins><plugins><id>18</id><uid>3f28d7656a</uid><name>markitup</name><location>plugins/markitup/markitup.plugin.php</location><status>active</status><priority>15</priority></plugins><plugins><id>22</id><uid>f8c19df066</uid><name>captcha</name><location>plugins/captcha/captcha.plugin.php</location><status>active</status><priority>15</priority></plugins><plugins><id>23</id><uid>97e3bff319</uid><name>blog</name><location>plugins/blog/blog.plugin.php</location><status>active</status><priority>15</priority></plugins><plugins><id>24</id><uid>ff449c2bb0</uid><name>codemirror</name><location>plugins/codemirror/codemirror.plugin.php</location><status>active</status><priority>15</priority></plugins><plugins><id>25</id><uid>754e408ef5</uid><name>dashboard</name><location>plugins/box/dashboard/dashboard.plugin.php</location><status>active</status><priority>15</priority></plugins><plugins><id>26</id><uid>6ba11431c3</uid><name>emails</name><location>plugins/box/emails/emails.plugin.php</location><status>active</status><priority>15</priority></plugins></root>
<root><options><autoincrement>27</autoincrement></options><fields><location/><name/><status/><priority/></fields><plugins><id>1</id><uid>dd4ef4d35c</uid><name>Pages</name><location>plugins/box/pages/pages.plugin.php</location><status>active</status><priority>1</priority></plugins><plugins><id>2</id><uid>ae8f24db1e</uid><name>Filesmanager</name><location>plugins/box/filesmanager/filesmanager.plugin.php</location><status>active</status><priority>2</priority></plugins><plugins><id>3</id><uid>63477fb180</uid><name>Plugins</name><location>plugins/box/plugins/plugins.plugin.php</location><status>active</status><priority>1</priority></plugins><plugins><id>4</id><uid>51cef0f1d7</uid><name>Themes</name><location>plugins/box/themes/themes.plugin.php</location><status>active</status><priority>3</priority></plugins><plugins><id>5</id><uid>96d232738b</uid><name>Menu</name><location>plugins/box/menu/menu.plugin.php</location><status>active</status><priority>4</priority></plugins><plugins><id>6</id><uid>f1b72e74c3</uid><name>System</name><location>plugins/box/system/system.plugin.php</location><status>active</status><priority>4</priority></plugins><plugins><id>7</id><uid>945b0245f0</uid><name>Snippets</name><location>plugins/box/snippets/snippets.plugin.php</location><status>active</status><priority>6</priority></plugins><plugins><id>8</id><uid>df8fb7decc</uid><name>Users</name><location>plugins/box/users/users.plugin.php</location><status>active</status><priority>7</priority></plugins><plugins><id>9</id><uid>5994da8240</uid><name>Backup</name><location>plugins/box/backup/backup.plugin.php</location><status>active</status><priority>8</priority></plugins><plugins><id>10</id><uid>fba0b8bdca</uid><name>Sitemap</name><location>plugins/box/sitemap/sitemap.plugin.php</location><status>active</status><priority>10</priority></plugins><plugins><id>11</id><uid>f4d1aa1d5a</uid><name>Information</name><location>plugins/box/information/information.plugin.php</location><status>active</status><priority>15</priority></plugins><plugins><id>14</id><uid>78b14de2e1</uid><name>editor</name><location>plugins/box/editor/editor.plugin.php</location><status>active</status><priority>1</priority></plugins><plugins><id>15</id><uid>78b14de2e2</uid><name>blocks</name><location>plugins/box/blocks/blocks.plugin.php</location><status>active</status><priority>6</priority></plugins><plugins><id>18</id><uid>3f28d7656a</uid><name>markitup</name><location>plugins/markitup/markitup.plugin.php</location><status>active</status><priority>15</priority></plugins><plugins><id>22</id><uid>f8c19df066</uid><name>captcha</name><location>plugins/captcha/captcha.plugin.php</location><status>active</status><priority>15</priority></plugins><plugins><id>23</id><uid>97e3bff319</uid><name>blog</name><location>plugins/blog/blog.plugin.php</location><status>active</status><priority>15</priority></plugins><plugins><id>24</id><uid>ff449c2bb0</uid><name>codemirror</name><location>plugins/codemirror/codemirror.plugin.php</location><status>active</status><priority>15</priority></plugins><plugins><id>25</id><uid>754e408ef5</uid><name>dashboard</name><location>plugins/box/dashboard/dashboard.plugin.php</location><status>active</status><priority>15</priority></plugins><plugins><id>26</id><uid>6ba11431c3</uid><name>emails</name><location>plugins/box/emails/emails.plugin.php</location><status>active</status><priority>15</priority></plugins><plugins><id>27</id><uid>6de9688fa8</uid><name>markdown</name><location>plugins/markdown/markdown.plugin.php</location><status>active</status><priority>10</priority></plugins></root>