From e42c900c17ff76baf4e3ab958d97804a736648af Mon Sep 17 00:00:00 2001 From: dignajar Date: Fri, 7 Aug 2015 18:33:43 -0300 Subject: [PATCH] Bug fixes --- admin/controllers/configure-plugin.php | 2 +- admin/views/plugins.php | 2 +- kernel/abstract/plugin.class.php | 106 ---------------------- kernel/boot/admin.php | 4 +- kernel/boot/rules/80.plugins.php | 6 +- languages/en_US.json | 1 - languages/es_AR.json | 23 +++-- plugins/maintancemode/language/en_US.json | 15 +++ plugins/maintancemode/plugin.php | 36 ++++++++ 9 files changed, 67 insertions(+), 128 deletions(-) create mode 100755 plugins/maintancemode/language/en_US.json create mode 100755 plugins/maintancemode/plugin.php diff --git a/admin/controllers/configure-plugin.php b/admin/controllers/configure-plugin.php index d1c1c9f4..13039d16 100644 --- a/admin/controllers/configure-plugin.php +++ b/admin/controllers/configure-plugin.php @@ -32,7 +32,7 @@ if($_Plugin===false) { } // Check if the plugin has the method form() -if($_Plugin->form()===false) { +if(!method_exists($_Plugin, 'form')) { Redirect::page('admin', 'plugins'); } diff --git a/admin/views/plugins.php b/admin/views/plugins.php index ddc437cd..8f862ae8 100644 --- a/admin/views/plugins.php +++ b/admin/views/plugins.php @@ -10,7 +10,7 @@ echo ''.$Language->g('Version').': '.$Plugin->version().''.$Language->g('author').': '.$Plugin->author().''; if($Plugin->installed()) { - if($Plugin->form()) { + if(method_exists($Plugin, 'form')) { echo ''.$Language->g('Configure plugin').''; } echo ''.$Language->g('Uninstall plugin').''; diff --git a/kernel/abstract/plugin.class.php b/kernel/abstract/plugin.class.php index 18bbbd5f..ff0e32f0 100644 --- a/kernel/abstract/plugin.class.php +++ b/kernel/abstract/plugin.class.php @@ -191,110 +191,4 @@ class Plugin { // The user can define your own dbFields. } - // HOOKS - - - - // Before the posts load. - public function beforePostsLoad() - { - return false; - } - - // After the posts load. - public function afterPostsLoad() - { - return false; - } - - // Before the pages load. - public function beforePagesLoad() - { - return false; - } - - // After the pages load. - public function afterPagesLoad() - { - return false; - } - - // SITE HOOKS - - public function beforeSiteLoad() { - return false; - } - - public function afterSiteLoad() { - return false; - } - - public function siteHead() { - return false; - } - - public function siteBodyBegin() { - return false; - } - - public function siteBodyEnd() { - return false; - } - - public function siteSidebar() { - return false; - } - - public function postBegin() { - return false; - } - - public function postEnd() { - return false; - } - - public function pageBegin() { - return false; - } - - public function pageEnd() { - return false; - } - - // LOGIN HOOKS - - public function loginHead() { - return false; - } - - public function loginBodyBegin() { - return false; - } - - public function loginBodyEnd() { - return false; - } - - // ADMIN HOOKS - - public function adminHead() { - return false; - } - - public function adminBodyBegin() { - return false; - } - - public function adminBodyEnd() { - return false; - } - - public function adminSidebar() { - return false; - } - - public function form() { - return false; - } - } \ No newline at end of file diff --git a/kernel/boot/admin.php b/kernel/boot/admin.php index 1c6e42fb..fcf9ceac 100644 --- a/kernel/boot/admin.php +++ b/kernel/boot/admin.php @@ -48,8 +48,8 @@ else if($Url->notFound() || !$Login->isLogged() || ($Url->slug()==='login') ) { $layout['controller'] = 'login'; - $layout['view'] = 'login'; - $layout['template'] = 'login.php'; + $layout['view'] = 'login'; + $layout['template'] = 'login.php'; } // Admin theme init.php diff --git a/kernel/boot/rules/80.plugins.php b/kernel/boot/rules/80.plugins.php index 1f7385cf..5e3607a9 100644 --- a/kernel/boot/rules/80.plugins.php +++ b/kernel/boot/rules/80.plugins.php @@ -88,11 +88,7 @@ function build_plugins() { foreach($pluginsEvents as $event=>$value) { - /* - if($Plugin->onSiteHead()!==false) - array_push($plugins['onSiteHead'], $Plugin); - */ - if($Plugin->{$event}()!==false) { + if(method_exists($Plugin, $event)) { array_push($plugins[$event], $Plugin); } } diff --git a/languages/en_US.json b/languages/en_US.json index b1c315b5..4fb8fe50 100644 --- a/languages/en_US.json +++ b/languages/en_US.json @@ -120,7 +120,6 @@ "you-can-modify-the-url-which-identifies":"You can modify the URL which identifies a page or post using human-readable keywords. No more than 150 characters.", "this-field-can-help-describe-the-content": "This field can help describe the content in a few words. No more than 150 characters.", "write-the-tags-separeted-by-comma": "Write the tags separeted by comma. eg: tag1, tag2, tag3", - "delete": "Delete", "delete-the-user-and-all-its-posts":"Delete the user and all its posts", "delete-the-user-and-associate-its-posts-to-admin-user": "Delete the user and associate its posts to admin user", "read-more": "Read more", diff --git a/languages/es_AR.json b/languages/es_AR.json index 954d0d5f..8fa3d00f 100644 --- a/languages/es_AR.json +++ b/languages/es_AR.json @@ -114,28 +114,27 @@ "number-of-posts-to-show-per-page": "Number of posts to show per page.", "the-url-of-your-site": "The URL of your site.", "add-or-edit-description-tags-or": "Add or edit description, tags or modify the friendly URL.", - "select-your-sites-language": "Select your site's language.", + "select-your-sites-language": "Seleccione el lenguage de su sitio.", "select-a-timezone-for-a-correct": "Select a timezone for a correct date/time display on your site.", "you-can-use-this-field-to-define-a-set-of": "You can use this field to define a set of parameters related to the languege, country and special preferences.", "you-can-modify-the-url-which-identifies":"You can modify the URL which identifies a page or post using human-readable keywords. No more than 150 characters.", "this-field-can-help-describe-the-content": "This field can help describe the content in a few words. No more than 150 characters.", "write-the-tags-separeted-by-comma": "Write the tags separeted by comma. eg: tag1, tag2, tag3", - "delete": "Delete", "delete-the-user-and-all-its-posts":"Delete the user and all its posts", "delete-the-user-and-associate-its-posts-to-admin-user": "Delete the user and associate its posts to admin user", - "read-more": "Read more", - "show-blog": "Show blog", - "default-home-page": "Default home page", + "read-more": "Leer mas", + "show-blog": "Mostrar blog", + "default-home-page": "Pagina de inicio predeterminada", "version": "Version", - "there-are-no-drafts": "There are no drafts.", + "there-are-no-drafts": "No hay borradores.", "create-a-new-article-for-your-blog":"Create a new article for your blog.", "create-a-new-page-for-your-website":"Create a new page for your website.", "invite-a-friend-to-collaborate-on-your-website":"Invite a friend to collaborate on your website.", "change-your-language-and-region-settings":"Change your language and region settings.", - "language-and-timezone":"Language and timezone", - "author": "Author", - "start-here": "Start here", - "install-theme": "Install theme", + "language-and-timezone":"Lenguage y zona horaria", + "author": "Autor", + "start-here": "Comience aqui", + "install-theme": "Instalar tema", "first-post": "Primer post", "congratulations-you-have-successfully-installed-your-bludit": "Congratulations you have successfully installed your **Bludit**", "whats-next": "Que sigue", @@ -143,7 +142,7 @@ "follow-bludit-on": "Siga Bludit en", "visit-the-support-forum": "Visite el [foro](http://forum.bludit.com) para soporte", "read-the-documentation-for-more-information": "Lea la [documentacion](http://docs.bludit.com) para mas informacion", - "share-with-your-friends-and-enjoy": "Share with your friends and enjoy", - "the-page-has-not-been-found": "The page has not been found.", + "share-with-your-friends-and-enjoy": "Comparti con tus amigos y a disfrutar", + "the-page-has-not-been-found": "La pagina no fue encontrada.", "error": "Error" } \ No newline at end of file diff --git a/plugins/maintancemode/language/en_US.json b/plugins/maintancemode/language/en_US.json new file mode 100755 index 00000000..d57a2d40 --- /dev/null +++ b/plugins/maintancemode/language/en_US.json @@ -0,0 +1,15 @@ +{ + "plugin-data": + { + "name": "Maintenance mode", + "description": "Set your site on maintenance mode, you can access to admin area.", + "author": "Bludit", + "email": "", + "website": "http://www.bludit.com", + "version": "0.1", + "releaseDate": "2015-08-02" + }, + + "enable-maintence-mode": "Enable maintence mode", + "message": "Message" +} \ No newline at end of file diff --git a/plugins/maintancemode/plugin.php b/plugins/maintancemode/plugin.php new file mode 100755 index 00000000..a40048bd --- /dev/null +++ b/plugins/maintancemode/plugin.php @@ -0,0 +1,36 @@ +dbFields = array( + 'enable'=>true, + 'message'=>'Temporarily down for maintenance.' + ); + } + + public function form() + { + global $Language; + + $html = '
'; + $html .= 'getDbField('enable')?'checked':'').'>'; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + return $html; + } + + public function beforeSiteLoad() + { + if($this->getDbField('enable')) { + exit( $this->getDbField('message') ); + } + } +}