From 1dbc39348bbaeade86a730cf2f79c7f62d71e141 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 17 Mar 2015 12:50:45 +0200 Subject: [PATCH] Make CSS compiler to use theme settings , make admin to compile all files at once --- .gitignore | 16 +- bin/install.sh | 61 +++++--- .../admin}/access.xml | 2 +- .../admin}/blueprints/menu/menuitem.yaml | 0 .../admin}/config.xml | 2 +- .../admin}/css-compiled/joomla-admin.css | 48 +++--- .../admin}/css-compiled/joomla-admin.css.map | 0 .../admin/gantry5.php} | 16 +- .../joomla/com_gantry5/admin/gantry5.xml | 32 ++++ .../admin}/images/gantrylogo.png | Bin .../language/en-GB/en-GB.com_gantry5.ini | 3 + .../language/en-GB/en-GB.com_gantry5.sys.ini | 2 + .../scss/configuration/admin/_base.scss | 0 .../scss/configuration/admin/_colors.scss | 0 .../scss/configuration/admin/_typography.scss | 0 .../admin}/scss/joomla-admin.scss | 0 .../admin}/scss/joomla-admin/_buttons.scss | 0 .../admin}/scss/joomla-admin/_core.scss | 6 +- .../admin}/scss/joomla-admin/_headers.scss | 4 +- .../admin}/scss/joomla-admin/_overview.scss | 0 .../admin}/scss/joomla-admin/_typography.scss | 0 .../assignments/assignments.html.twig | 0 .../admin}/templates/partials/page.html.twig | 0 .../joomla/com_gantryadmin/gantryadmin.xml | 32 ---- .../com_gantryadmin/includes/gantry.php | 47 ------ .../language/en-GB/en-GB.com_gantryadmin.ini | 1 - .../en-GB/en-GB.com_gantryadmin.sys.ini | 1 - .../joomla/gantry5_media/gantry5_media.xml | 20 +++ platforms/joomla/install.php | 148 ++++++++++++++++++ platforms/joomla/lib_gantry5/gantry5.xml | 21 +++ .../language/en-GB/en-GB.lib_gantry5.ini | 2 + .../language/en-GB/en-GB.lib_gantry5.sys.ini | 2 + platforms/joomla/pkg_gantry5.xml | 35 +++++ .../joomla/plg_quickicon_gantry5/gantry5.php | 84 ++++++++++ .../joomla/plg_quickicon_gantry5/gantry5.xml | 29 ++++ .../en-GB/en-GB.plg_quickicon_gantry5.sys.ini | 8 + .../gantry5.php} | 125 ++++++++------- .../joomla/plg_system_gantry5/gantry5.xml | 22 +++ .../en-GB/en-GB.plg_system_gantry5.sys.ini | 3 + .../plg_system_gantryadmin/gantryadmin.xml | 20 --- .../en-GB.plg_system_gantryadmin.sys.ini | 1 - platforms/joomla/updates/5.0/list.xml | 7 +- .../{com_gantryadmin.xml => pkg_gantry5.xml} | 16 +- ...{tmpl_hydrogen.xml => tpl_g5_hydrogen.xml} | 10 +- src/Loader.php | 84 ++++++++++ src/bootstrap.php | 32 +--- .../Component/Response/JsonResponse.php | 6 +- .../Gantry/Platform/Joomla/Admin/Router.php | 2 +- .../Platform/Joomla/Admin/Theme/ThemeList.php | 2 +- .../Platform/Joomla/Framework/Platform.php | 10 +- composer.json => src/composer.json | 4 +- src/includes/autoload.php | 38 ----- src/includes/defines.php | 16 -- themes/hydrogen/joomla/includes/gantry.php | 52 ++---- .../language/en-GB/en-GB.tpl_g5_hydrogen.ini | 2 + .../en-GB/en-GB.tpl_g5_hydrogen.sys.ini | 2 + .../language/en-GB/en-GB.tpl_hydrogen.ini | 0 .../language/en-GB/en-GB.tpl_hydrogen.sys.ini | 0 themes/hydrogen/joomla/templateDetails.xml | 68 ++++---- 59 files changed, 731 insertions(+), 413 deletions(-) rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/access.xml (89%) rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/blueprints/menu/menuitem.yaml (100%) rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/config.xml (89%) rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/css-compiled/joomla-admin.css (54%) rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/css-compiled/joomla-admin.css.map (100%) rename platforms/joomla/{com_gantryadmin/gantryadmin.php => com_gantry5/admin/gantry5.php} (58%) create mode 100644 platforms/joomla/com_gantry5/admin/gantry5.xml rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/images/gantrylogo.png (100%) create mode 100644 platforms/joomla/com_gantry5/admin/language/en-GB/en-GB.com_gantry5.ini create mode 100644 platforms/joomla/com_gantry5/admin/language/en-GB/en-GB.com_gantry5.sys.ini rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/scss/configuration/admin/_base.scss (100%) rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/scss/configuration/admin/_colors.scss (100%) rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/scss/configuration/admin/_typography.scss (100%) rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/scss/joomla-admin.scss (100%) rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/scss/joomla-admin/_buttons.scss (100%) rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/scss/joomla-admin/_core.scss (90%) rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/scss/joomla-admin/_headers.scss (98%) rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/scss/joomla-admin/_overview.scss (100%) rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/scss/joomla-admin/_typography.scss (100%) rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/templates/pages/configurations/assignments/assignments.html.twig (100%) rename platforms/joomla/{com_gantryadmin => com_gantry5/admin}/templates/partials/page.html.twig (100%) delete mode 100644 platforms/joomla/com_gantryadmin/gantryadmin.xml delete mode 100644 platforms/joomla/com_gantryadmin/includes/gantry.php delete mode 100644 platforms/joomla/com_gantryadmin/language/en-GB/en-GB.com_gantryadmin.ini delete mode 100644 platforms/joomla/com_gantryadmin/language/en-GB/en-GB.com_gantryadmin.sys.ini create mode 100644 platforms/joomla/gantry5_media/gantry5_media.xml create mode 100644 platforms/joomla/install.php create mode 100644 platforms/joomla/lib_gantry5/gantry5.xml create mode 100644 platforms/joomla/lib_gantry5/language/en-GB/en-GB.lib_gantry5.ini create mode 100644 platforms/joomla/lib_gantry5/language/en-GB/en-GB.lib_gantry5.sys.ini create mode 100644 platforms/joomla/pkg_gantry5.xml create mode 100644 platforms/joomla/plg_quickicon_gantry5/gantry5.php create mode 100644 platforms/joomla/plg_quickicon_gantry5/gantry5.xml create mode 100644 platforms/joomla/plg_quickicon_gantry5/language/en-GB/en-GB.plg_quickicon_gantry5.sys.ini rename platforms/joomla/{plg_system_gantryadmin/gantryadmin.php => plg_system_gantry5/gantry5.php} (60%) create mode 100644 platforms/joomla/plg_system_gantry5/gantry5.xml create mode 100644 platforms/joomla/plg_system_gantry5/language/en-GB/en-GB.plg_system_gantry5.sys.ini delete mode 100644 platforms/joomla/plg_system_gantryadmin/gantryadmin.xml delete mode 100644 platforms/joomla/plg_system_gantryadmin/language/en-GB/en-GB.plg_system_gantryadmin.sys.ini rename platforms/joomla/updates/5.0/{com_gantryadmin.xml => pkg_gantry5.xml} (56%) rename platforms/joomla/updates/5.0/{tmpl_hydrogen.xml => tpl_g5_hydrogen.xml} (69%) create mode 100644 src/Loader.php rename composer.json => src/composer.json (88%) delete mode 100644 src/includes/autoload.php delete mode 100644 src/includes/defines.php create mode 100644 themes/hydrogen/joomla/language/en-GB/en-GB.tpl_g5_hydrogen.ini create mode 100644 themes/hydrogen/joomla/language/en-GB/en-GB.tpl_g5_hydrogen.sys.ini delete mode 100644 themes/hydrogen/joomla/language/en-GB/en-GB.tpl_hydrogen.ini delete mode 100644 themes/hydrogen/joomla/language/en-GB/en-GB.tpl_hydrogen.sys.ini diff --git a/.gitignore b/.gitignore index b5eaa2cfc..b48bd38d8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,22 +3,21 @@ ehthumbs.db Thumbs.db -# Composer -composer.lock -vendor/** - # PhpStorm .idea +# Composer +src/composer.lock +src/vendor/** + # Symbolic links in admin +platforms/joomla/com_gantry5/*/common platforms/*/*/common platforms/*/*/src -platforms/*/*/vendor # Symbolic links in themes themes/*/*/common themes/*/*/src -themes/*/*/vendor themes/*/*/cache themes/*/*/custom themes/*/magento/design/default/gantry/common @@ -26,11 +25,8 @@ themes/*/magento/design/default/gantry/src themes/*/magento/design/default/gantry/vendor themes/*/magento/skin/default/common -!**/scss/vendor - # Compiled -.sass-cache/* +**/.sass-cache node_modules/* platforms/wordpress/gantryadmin/cache platforms/common/node_modules -.sass-cache diff --git a/bin/install.sh b/bin/install.sh index ddebb7d93..45405d33f 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -5,32 +5,57 @@ OPT_DELETE=0 if [ -f $GIT_TARGET/configuration.php ]; then PLATFORM=Joomla - mkdir "$GIT_TARGET/media/gantry" + mkdir "$GIT_TARGET/libraries/gantry5" + mkdir "$GIT_TARGET/media/gantry5" sources=( - 'platforms/joomla/com_gantryadmin' + # Manifest files + 'platforms/joomla/pkg_gantry5.xml' + 'platforms/joomla/lib_gantry5/gantry5.xml' + 'platforms/joomla/gantry5_media/gantry5_media.xml' + # Component + 'platforms/joomla/com_gantry5/admin' 'platforms/common' - 'src' - 'vendor' - 'platforms/joomla/plg_system_gantryadmin' + # Library + 'src/classes' + 'platforms/joomla/lib_gantry5/language' + 'src/vendor' + 'src/Loader.php' + # Plugins + 'platforms/joomla/plg_system_gantry5' + 'platforms/joomla/plg_quickicon_gantry5' + # Media 'assets' 'engines' + # Templates 'themes/hydrogen/joomla' 'themes/hydrogen/common' - 'themes/hydrogen-demo/joomla' - 'themes/hydrogen-demo/common' +# 'themes/hydrogen-demo/joomla' +# 'themes/hydrogen-demo/common' ) targets=( - 'administrator/components/com_gantryadmin' - 'administrator/components/com_gantryadmin/common' - 'administrator/components/com_gantryadmin/src' - 'administrator/components/com_gantryadmin/vendor' - 'plugins/system/gantryadmin' - 'media/gantry/assets' - 'media/gantry/engines' - 'templates/hydrogen' - 'templates/hydrogen/common' - 'templates/hydrogen-demo' - 'templates/hydrogen-demo/common' + # Manifest files + 'administrator/manifests/packages/pkg_gantry5.xml' + 'administrator/manifests/libraries/gantry5.xml' + 'administrator/manifests/files/gantry5_media.xml' + # Component + 'administrator/components/com_gantry5' + 'administrator/components/com_gantry5/common' + # Library + 'libraries/gantry5/classes' + 'libraries/gantry5/language' + 'libraries/gantry5/vendor' + 'libraries/gantry5/Loader.php' + # Plugins + 'plugins/system/gantry5' + 'plugins/quickicon/gantry5' + # Media + 'media/gantry5/assets' + 'media/gantry5/engines' + # Templates + 'templates/g5_hydrogen' + 'templates/g5_hydrogen/common' +# 'templates/g5_hydrogen-demo' +# 'templates/g5_hydrogen-demo/common' ) elif [ -f $GIT_TARGET/wp-config.php ]; then PLATFORM=WordPress diff --git a/platforms/joomla/com_gantryadmin/access.xml b/platforms/joomla/com_gantry5/admin/access.xml similarity index 89% rename from platforms/joomla/com_gantryadmin/access.xml rename to platforms/joomla/com_gantry5/admin/access.xml index 8a9e5ac37..5935bc2aa 100644 --- a/platforms/joomla/com_gantryadmin/access.xml +++ b/platforms/joomla/com_gantry5/admin/access.xml @@ -1,6 +1,6 @@ - +
diff --git a/platforms/joomla/com_gantryadmin/blueprints/menu/menuitem.yaml b/platforms/joomla/com_gantry5/admin/blueprints/menu/menuitem.yaml similarity index 100% rename from platforms/joomla/com_gantryadmin/blueprints/menu/menuitem.yaml rename to platforms/joomla/com_gantry5/admin/blueprints/menu/menuitem.yaml diff --git a/platforms/joomla/com_gantryadmin/config.xml b/platforms/joomla/com_gantry5/admin/config.xml similarity index 89% rename from platforms/joomla/com_gantryadmin/config.xml rename to platforms/joomla/com_gantry5/admin/config.xml index f0b19eecb..cdec9b326 100644 --- a/platforms/joomla/com_gantryadmin/config.xml +++ b/platforms/joomla/com_gantry5/admin/config.xml @@ -2,6 +2,6 @@
- +
diff --git a/platforms/joomla/com_gantryadmin/css-compiled/joomla-admin.css b/platforms/joomla/com_gantry5/admin/css-compiled/joomla-admin.css similarity index 54% rename from platforms/joomla/com_gantryadmin/css-compiled/joomla-admin.css rename to platforms/joomla/com_gantry5/admin/css-compiled/joomla-admin.css index c62143d35..436d63247 100644 --- a/platforms/joomla/com_gantryadmin/css-compiled/joomla-admin.css +++ b/platforms/joomla/com_gantry5/admin/css-compiled/joomla-admin.css @@ -1,19 +1,19 @@ -body.com_gantryadmin { +body.com_gantry5 { color: #ddd; background-color: #404040 !important; } - body.com_gantryadmin a { + body.com_gantry5 a { text-decoration: none; } - body.com_gantryadmin .subhead-collapse.collapse, body.com_gantryadmin .header { + body.com_gantry5 .subhead-collapse.collapse, body.com_gantry5 .header { display: none; } - body.com_gantryadmin .container-main { + body.com_gantry5 .container-main { padding: 0; } - body.com_gantryadmin #status { + body.com_gantry5 #status { box-shadow: none !important; } - body.com_gantryadmin #footer a { + body.com_gantry5 #footer a { color: #3180C2; } - body.com_gantryadmin #g5-container .inner-container { + body.com_gantry5 #g5-container .inner-container { margin: 0 0 1.5rem 0; } - body.com_gantryadmin #g5-container li { + body.com_gantry5 #g5-container li { line-height: inherit; } #g5-container .button-primary { @@ -23,43 +23,43 @@ body.com_gantryadmin { background: #2b70aa; color: #fff; } -body.com_gantryadmin #g5-container [data-mode-indicator="production"] { +body.com_gantry5 #g5-container [data-mode-indicator="production"] { background-color: #3180C2; } -body.com_gantryadmin #g5-container #main-header .g-content { +body.com_gantry5 #g5-container #main-header .g-content { padding: 0 1.563rem; } -body.com_gantryadmin #g5-container #main-header .dev-mode-toggle { +body.com_gantry5 #g5-container #main-header .dev-mode-toggle { background: #276599; } - body.com_gantryadmin #g5-container #main-header .dev-mode-toggle a { + body.com_gantry5 #g5-container #main-header .dev-mode-toggle a { background: #67a5d9; } -body.com_gantryadmin #g5-container #main-header .button-save { +body.com_gantry5 #g5-container #main-header .button-save { background: #67a5d9; color: #fff; } - body.com_gantryadmin #g5-container #main-header .button-save:hover { + body.com_gantry5 #g5-container #main-header .button-save:hover { background: #4e96d2; color: #fff; } -body.com_gantryadmin #g5-container #main-header ul li:hover a { +body.com_gantry5 #g5-container #main-header ul li:hover a { background: #2c73ae; } -body.com_gantryadmin #g5-container #main-header ul li.active a { +body.com_gantry5 #g5-container #main-header ul li.active a { background: #225885; } -body.com_gantryadmin #g5-container #navbar { +body.com_gantry5 #g5-container #navbar { padding: 0 0.625rem; } -body.com_gantryadmin #g5-container .navbar-block .gantry-logo { +body.com_gantry5 #g5-container .navbar-block .gantry-logo { right: 1.563rem; } -body.com_gantryadmin #g5-container .inner-header { +body.com_gantry5 #g5-container .inner-header { background-color: #222; color: #3180C2; } - body.com_gantryadmin #g5-container .inner-header .gantry-logo { + body.com_gantry5 #g5-container .inner-header .gantry-logo { background-image: url(../images/gantrylogo.png); } -body.com_gantryadmin #g5-container .settings-state { +body.com_gantry5 #g5-container .settings-state { background: #3180C2; color: #fff; } -body.com_gantryadmin #g5-container .button.button-update { +body.com_gantry5 #g5-container .button.button-update { background: #633679; color: #fff; } - body.com_gantryadmin #g5-container .button.button-update:hover { + body.com_gantry5 #g5-container .button.button-update:hover { background: #522c64; color: #fff; } -body.com_gantryadmin #g5-container .tooltip { +body.com_gantry5 #g5-container .tooltip { position: static; opacity: 1; line-height: inherit; diff --git a/platforms/joomla/com_gantryadmin/css-compiled/joomla-admin.css.map b/platforms/joomla/com_gantry5/admin/css-compiled/joomla-admin.css.map similarity index 100% rename from platforms/joomla/com_gantryadmin/css-compiled/joomla-admin.css.map rename to platforms/joomla/com_gantry5/admin/css-compiled/joomla-admin.css.map diff --git a/platforms/joomla/com_gantryadmin/gantryadmin.php b/platforms/joomla/com_gantry5/admin/gantry5.php similarity index 58% rename from platforms/joomla/com_gantryadmin/gantryadmin.php rename to platforms/joomla/com_gantry5/admin/gantry5.php index 8016c022c..8d8a5ffb2 100644 --- a/platforms/joomla/com_gantryadmin/gantryadmin.php +++ b/platforms/joomla/com_gantry5/admin/gantry5.php @@ -4,27 +4,25 @@ defined('_JEXEC') or die; $user = JFactory::getUser(); // ACL for hardening the access to the template manager. -if (!$user->authorise('core.manage', 'com_templates') +if ((!$user->authorise('core.manage', 'com_templates') || !$user->authorise('core.manage', 'com_gantry5')) || !$user->authorise('core.edit', 'com_templates') || !$user->authorise('core.create', 'com_templates') - || !$user->authorise('core.admin', 'com_templates')) -{ + || !$user->authorise('core.admin', 'com_templates')) { $app = JFactory::getApplication(); $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); return false; } -if (!defined('GANTRYADMIN_PATH')) -{ +if (!defined('GANTRYADMIN_PATH')) { define('GANTRYADMIN_PATH', JPATH_COMPONENT_ADMINISTRATOR); } -// Bootstrap Gantry framework or fail gracefully (inside included file). -$gantry = include __DIR__ . '/includes/gantry.php'; +// Setup Gantry Framework or throw exception. +Gantry5\Loader::setup(); -$gantry['router'] = function ($c) -{ +$gantry = Gantry\Framework\Gantry::instance(); +$gantry['router'] = function ($c) { return new \Gantry\Admin\Router($c); }; diff --git a/platforms/joomla/com_gantry5/admin/gantry5.xml b/platforms/joomla/com_gantry5/admin/gantry5.xml new file mode 100644 index 000000000..c97e70c92 --- /dev/null +++ b/platforms/joomla/com_gantry5/admin/gantry5.xml @@ -0,0 +1,32 @@ + + + COM_GANTRY5 + @version@ + @versiondate@ + RocketTheme, LLC + support@rockettheme.com + http://www.rockettheme.com + (C) 2005 - 2015 RocketTheme, LLC. All rights reserved. + http://www.gnu.org/copyleft/gpl.html GNU/GPL + COM_GANTRY5_DESCRIPTION + + + + access.xml + config.xml + gantry5.php + application + blueprints + css-compiled + fonts + images + js + language + node_modules + scss + templates + + COM_GANTRY5 + + + diff --git a/platforms/joomla/com_gantryadmin/images/gantrylogo.png b/platforms/joomla/com_gantry5/admin/images/gantrylogo.png similarity index 100% rename from platforms/joomla/com_gantryadmin/images/gantrylogo.png rename to platforms/joomla/com_gantry5/admin/images/gantrylogo.png diff --git a/platforms/joomla/com_gantry5/admin/language/en-GB/en-GB.com_gantry5.ini b/platforms/joomla/com_gantry5/admin/language/en-GB/en-GB.com_gantry5.ini new file mode 100644 index 000000000..bd39079cf --- /dev/null +++ b/platforms/joomla/com_gantry5/admin/language/en-GB/en-GB.com_gantry5.ini @@ -0,0 +1,3 @@ +COM_GANTRY5="Gantry5 Templates" +COM_GANTRY5_DESC="Gantry5 templates administration." +COM_GANTRY5_CONFIGURATION="Gantry5 Configuration" diff --git a/platforms/joomla/com_gantry5/admin/language/en-GB/en-GB.com_gantry5.sys.ini b/platforms/joomla/com_gantry5/admin/language/en-GB/en-GB.com_gantry5.sys.ini new file mode 100644 index 000000000..fab01091b --- /dev/null +++ b/platforms/joomla/com_gantry5/admin/language/en-GB/en-GB.com_gantry5.sys.ini @@ -0,0 +1,2 @@ +COM_GANTRY5="Gantry5 Templates" +COM_GANTRY5_DESC="Gantry5 templates administration." diff --git a/platforms/joomla/com_gantryadmin/scss/configuration/admin/_base.scss b/platforms/joomla/com_gantry5/admin/scss/configuration/admin/_base.scss similarity index 100% rename from platforms/joomla/com_gantryadmin/scss/configuration/admin/_base.scss rename to platforms/joomla/com_gantry5/admin/scss/configuration/admin/_base.scss diff --git a/platforms/joomla/com_gantryadmin/scss/configuration/admin/_colors.scss b/platforms/joomla/com_gantry5/admin/scss/configuration/admin/_colors.scss similarity index 100% rename from platforms/joomla/com_gantryadmin/scss/configuration/admin/_colors.scss rename to platforms/joomla/com_gantry5/admin/scss/configuration/admin/_colors.scss diff --git a/platforms/joomla/com_gantryadmin/scss/configuration/admin/_typography.scss b/platforms/joomla/com_gantry5/admin/scss/configuration/admin/_typography.scss similarity index 100% rename from platforms/joomla/com_gantryadmin/scss/configuration/admin/_typography.scss rename to platforms/joomla/com_gantry5/admin/scss/configuration/admin/_typography.scss diff --git a/platforms/joomla/com_gantryadmin/scss/joomla-admin.scss b/platforms/joomla/com_gantry5/admin/scss/joomla-admin.scss similarity index 100% rename from platforms/joomla/com_gantryadmin/scss/joomla-admin.scss rename to platforms/joomla/com_gantry5/admin/scss/joomla-admin.scss diff --git a/platforms/joomla/com_gantryadmin/scss/joomla-admin/_buttons.scss b/platforms/joomla/com_gantry5/admin/scss/joomla-admin/_buttons.scss similarity index 100% rename from platforms/joomla/com_gantryadmin/scss/joomla-admin/_buttons.scss rename to platforms/joomla/com_gantry5/admin/scss/joomla-admin/_buttons.scss diff --git a/platforms/joomla/com_gantryadmin/scss/joomla-admin/_core.scss b/platforms/joomla/com_gantry5/admin/scss/joomla-admin/_core.scss similarity index 90% rename from platforms/joomla/com_gantryadmin/scss/joomla-admin/_core.scss rename to platforms/joomla/com_gantry5/admin/scss/joomla-admin/_core.scss index 3f61c6850..0859b201a 100644 --- a/platforms/joomla/com_gantryadmin/scss/joomla-admin/_core.scss +++ b/platforms/joomla/com_gantry5/admin/scss/joomla-admin/_core.scss @@ -1,5 +1,5 @@ -body.com_gantryadmin { - color: $light-gray; +body.com_gantry5 { + color: $light-gray; background-color: $body-bg !important; a { @@ -34,4 +34,4 @@ body.com_gantryadmin { } } -} \ No newline at end of file +} diff --git a/platforms/joomla/com_gantryadmin/scss/joomla-admin/_headers.scss b/platforms/joomla/com_gantry5/admin/scss/joomla-admin/_headers.scss similarity index 98% rename from platforms/joomla/com_gantryadmin/scss/joomla-admin/_headers.scss rename to platforms/joomla/com_gantry5/admin/scss/joomla-admin/_headers.scss index fd2f718c1..832e7d731 100644 --- a/platforms/joomla/com_gantryadmin/scss/joomla-admin/_headers.scss +++ b/platforms/joomla/com_gantry5/admin/scss/joomla-admin/_headers.scss @@ -1,4 +1,4 @@ -body.com_gantryadmin { +body.com_gantry5 { #g5-container { [data-mode-indicator="production"] { @@ -77,4 +77,4 @@ body.com_gantryadmin { } } -} \ No newline at end of file +} diff --git a/platforms/joomla/com_gantryadmin/scss/joomla-admin/_overview.scss b/platforms/joomla/com_gantry5/admin/scss/joomla-admin/_overview.scss similarity index 100% rename from platforms/joomla/com_gantryadmin/scss/joomla-admin/_overview.scss rename to platforms/joomla/com_gantry5/admin/scss/joomla-admin/_overview.scss diff --git a/platforms/joomla/com_gantryadmin/scss/joomla-admin/_typography.scss b/platforms/joomla/com_gantry5/admin/scss/joomla-admin/_typography.scss similarity index 100% rename from platforms/joomla/com_gantryadmin/scss/joomla-admin/_typography.scss rename to platforms/joomla/com_gantry5/admin/scss/joomla-admin/_typography.scss diff --git a/platforms/joomla/com_gantryadmin/templates/pages/configurations/assignments/assignments.html.twig b/platforms/joomla/com_gantry5/admin/templates/pages/configurations/assignments/assignments.html.twig similarity index 100% rename from platforms/joomla/com_gantryadmin/templates/pages/configurations/assignments/assignments.html.twig rename to platforms/joomla/com_gantry5/admin/templates/pages/configurations/assignments/assignments.html.twig diff --git a/platforms/joomla/com_gantryadmin/templates/partials/page.html.twig b/platforms/joomla/com_gantry5/admin/templates/partials/page.html.twig similarity index 100% rename from platforms/joomla/com_gantryadmin/templates/partials/page.html.twig rename to platforms/joomla/com_gantry5/admin/templates/partials/page.html.twig diff --git a/platforms/joomla/com_gantryadmin/gantryadmin.xml b/platforms/joomla/com_gantryadmin/gantryadmin.xml deleted file mode 100644 index 380937237..000000000 --- a/platforms/joomla/com_gantryadmin/gantryadmin.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - COM_GANTRYADMIN - RocketTheme, LLC - September 4th, 2014 - (C) 2005 - 2014 RocketTheme, LLC. All rights reserved. - http://www.gnu.org/copyleft/gpl.html GNU/GPL - support@rockettheme.com - http://www.rockettheme.com - 5.0.0-DEV - Gantry Administration - - - - controller.php - gantryadmin.php - assets - classes - language - views - - - - en-GB/en-GB.com_gantryadmin.ini - en-GB/en-GB.com_gantryadmin.sys.ini - - - - - http://updates.gantry-framework.org/5.0/joomla/com_gantryadmin.xml - - diff --git a/platforms/joomla/com_gantryadmin/includes/gantry.php b/platforms/joomla/com_gantryadmin/includes/gantry.php deleted file mode 100644 index 319d85306..000000000 --- a/platforms/joomla/com_gantryadmin/includes/gantry.php +++ /dev/null @@ -1,47 +0,0 @@ -getMessage()); -} diff --git a/platforms/joomla/com_gantryadmin/language/en-GB/en-GB.com_gantryadmin.ini b/platforms/joomla/com_gantryadmin/language/en-GB/en-GB.com_gantryadmin.ini deleted file mode 100644 index b099aff73..000000000 --- a/platforms/joomla/com_gantryadmin/language/en-GB/en-GB.com_gantryadmin.ini +++ /dev/null @@ -1 +0,0 @@ -COM_GANTRYADMIN="Gantry Templates" diff --git a/platforms/joomla/com_gantryadmin/language/en-GB/en-GB.com_gantryadmin.sys.ini b/platforms/joomla/com_gantryadmin/language/en-GB/en-GB.com_gantryadmin.sys.ini deleted file mode 100644 index b099aff73..000000000 --- a/platforms/joomla/com_gantryadmin/language/en-GB/en-GB.com_gantryadmin.sys.ini +++ /dev/null @@ -1 +0,0 @@ -COM_GANTRYADMIN="Gantry Templates" diff --git a/platforms/joomla/gantry5_media/gantry5_media.xml b/platforms/joomla/gantry5_media/gantry5_media.xml new file mode 100644 index 000000000..5b4af2e2e --- /dev/null +++ b/platforms/joomla/gantry5_media/gantry5_media.xml @@ -0,0 +1,20 @@ + + + Gantry5 Media Files + @version@ + @versiondate@ + RocketTheme, LLC + support@rockettheme.com + http://www.rockettheme.com + (C) 2005 - 2015 RocketTheme, LLC. All rights reserved. + http://www.gnu.org/copyleft/gpl.html GNU/GPL + Gantry5 media files + + + + css + fonts + js + + + diff --git a/platforms/joomla/install.php b/platforms/joomla/install.php new file mode 100644 index 000000000..636589593 --- /dev/null +++ b/platforms/joomla/install.php @@ -0,0 +1,148 @@ + array ( + '5.4' => '5.4.0', + '0' => '5.5.9' // Preferred version + ), + 'Joomla!' => array ( + '3.4' => '3.4.0', + '0' => '3.4.0' // Preferred version + ) + ); + /** + * List of required PHP extensions. + * @var array + */ + protected $extensions = array ('json', 'pcre'); + + public function install($parent) + { + return true; + } + + public function discover_install($parent) + { + return self::install($parent); + } + + public function update($parent) + { + return self::install($parent); + } + + public function uninstall($parent) + { + return true; + } + + public function preflight($type, $parent) + { + /** @var JInstallerComponent $parent */ + $manifest = $parent->getParent()->getManifest(); + + // Prevent installation if requirements are not met. + if (!$this->checkRequirements($manifest->version)) { + return false; + } + + // Remove old log file before installation. + $logFile = JFactory::getConfig()->get('log_path') . '/gantry5-install.php'; + + if (is_file($logFile)) { + @unlink($logFile); + } + + return true; + } + + public function postflight($type, $parent) + { + // Clear Joomla system cache. + /** @var JCache|JCacheController $cache */ + $cache = JFactory::getCache(); + $cache->clean('_system'); + + // Remove all compiled files from APC cache. + if (function_exists('apc_clear_cache')) { + @apc_clear_cache(); + } + + if ($type == 'uninstall') return true; + + $this->enablePlugin('system', 'gantry5'); + $this->enablePlugin('quickicon', 'gantry5'); + + return true; + } + + // Internal functions + + protected function enablePlugin($group, $element) + { + $plugin = JTable::getInstance('extension'); + + if (!$plugin->load(array('type' => 'plugin', 'folder' => $group, 'element' => $element))) { + return false; + } + + $plugin->enabled = 1; + + return $plugin->store(); + } + + protected function checkRequirements($version) + { + $pass = $this->checkVersion('PHP', phpversion()); + $pass &= $this->checkVersion('Joomla!', JVERSION); + $pass &= $this->checkExtensions($this->extensions); + + return $pass; + } + + protected function checkVersion($name, $version) + { + $app = JFactory::getApplication(); + + $major = $minor = 0; + + foreach ($this->versions[$name] as $major=>$minor) { + if (!$major || version_compare($version, $major, '<')) continue; + if (version_compare($version, $minor, '>=')) return true; + break; + } + + if (!$major) { + $minor = reset($this->versions[$name]); + } + + $recommended = end($this->versions[$name]); + $app->enqueueMessage(sprintf("%s %s is not supported. Minimum required version is %s %s, but it is highly recommended to use %s %s or later.", $name, $version, $name, $minor, $name, $recommended), 'notice'); + + return false; + } + + + protected function checkExtensions($extensions) + { + $app = JFactory::getApplication(); + + $pass = 1; + foreach ($extensions as $name) { + if (!extension_loaded($name)) { + $pass = 0; + $app->enqueueMessage(sprintf("Required PHP extension '%s' is missing. Please install it into your system.", $name), 'notice'); + } + } + return $pass; + } +} diff --git a/platforms/joomla/lib_gantry5/gantry5.xml b/platforms/joomla/lib_gantry5/gantry5.xml new file mode 100644 index 000000000..362de2aff --- /dev/null +++ b/platforms/joomla/lib_gantry5/gantry5.xml @@ -0,0 +1,21 @@ + + + LIB_GANTRY5 + gantry5 + @version@ + @versiondate@ + RocketTheme, LLC + support@rockettheme.com + http://www.rockettheme.com + (C) 2005 - 2015 RocketTheme, LLC. All rights reserved. + http://www.gnu.org/copyleft/gpl.html GNU/GPL + LIB_GANTRY5_DESCRIPTION + + + bootstrap.php + Loader.php + classes + language + vendor + + diff --git a/platforms/joomla/lib_gantry5/language/en-GB/en-GB.lib_gantry5.ini b/platforms/joomla/lib_gantry5/language/en-GB/en-GB.lib_gantry5.ini new file mode 100644 index 000000000..b24961342 --- /dev/null +++ b/platforms/joomla/lib_gantry5/language/en-GB/en-GB.lib_gantry5.ini @@ -0,0 +1,2 @@ +LIB_GANTRY5="Gantry5 Framework" +LIB_GANTRY5_DESC="Gantry5 Framework" diff --git a/platforms/joomla/lib_gantry5/language/en-GB/en-GB.lib_gantry5.sys.ini b/platforms/joomla/lib_gantry5/language/en-GB/en-GB.lib_gantry5.sys.ini new file mode 100644 index 000000000..b24961342 --- /dev/null +++ b/platforms/joomla/lib_gantry5/language/en-GB/en-GB.lib_gantry5.sys.ini @@ -0,0 +1,2 @@ +LIB_GANTRY5="Gantry5 Framework" +LIB_GANTRY5_DESC="Gantry5 Framework" diff --git a/platforms/joomla/pkg_gantry5.xml b/platforms/joomla/pkg_gantry5.xml new file mode 100644 index 000000000..22519d60d --- /dev/null +++ b/platforms/joomla/pkg_gantry5.xml @@ -0,0 +1,35 @@ + + + Gantry5 Package + gantry5 + 5.0.0-DEV + @versiondate@ + RocketTheme, LLC + support@rockettheme.com + http://www.rockettheme.com + (C) 2005 - 2015 RocketTheme, LLC. All rights reserved. + http://www.gnu.org/copyleft/gpl.html GNU/GPL + Gantry5 Framework Package + + install.php + + + + plg_system_gantry5_v@version@.zip + + plg_quickicon_gantry5_v@version@.zip + + lib_gantry5_v@version@.zip + + media_gantry5_v@version@.zip + + com_gantry5_v@version@.zip + + tpl_g5_hydrogen_v@version@.zip + + + + http://updates.gantry-framework.org/5.0/joomla/pkg_gantry5.xml + http://updates.gantry-framework.org/5.0/joomla/list.xml + + diff --git a/platforms/joomla/plg_quickicon_gantry5/gantry5.php b/platforms/joomla/plg_quickicon_gantry5/gantry5.php new file mode 100644 index 000000000..d4949f2d5 --- /dev/null +++ b/platforms/joomla/plg_quickicon_gantry5/gantry5.php @@ -0,0 +1,84 @@ +load('com_gantry5.sys') || $lang->load('com_gantry5.sys', JPATH_ADMINISTRATOR . '/components/com_gantry5'); + $this->loadLanguage('plg_quickicon_gantry5.sys'); + } + + /** + * Display Gantry5 backend icon + * + * @param string $context + * @return array|null + */ + public function onGetIcons($context) + { + $user = JFactory::getUser(); + + if ($context != $this->params->get('context', 'mod_quickicon') + || !$user->authorise('core.manage', 'com_gantry5')) { + return null; + } + + try { + $updates = null; + if ($user->authorise('core.manage', 'com_installer')) + { + // Initialise Gantry. + Gantry5\Loader::setup(); + $gantry = Gantry\Framework\Gantry::instance(); + $gantry['streams']; + + /** @var Gantry\Framework\Platform $platform */ + $platform = $gantry['platform']; + $updates = $platform->updates(); + } + } catch (Exception $e) { + $app = JFactory::getApplication(); + $app->enqueueMessage($e->getMessage(), 'warning'); + $updates = false; + } + + $quickicons = array( + array( + 'link' => JRoute::_('index.php?option=com_gantry5'), + 'image' => 'eye', + 'text' => JText::_('COM_GANTRY5'), + 'group' => 'MOD_QUICKICON_EXTENSIONS', + 'access' => array('core.manage', 'com_gantry5') + ) + ); + + if ($updates === false) { + // Disabled + $quickicons[] = array( + 'link' => JRoute::_('index.php?option=com_gantry5'), + 'image' => 'eye', + 'text' => JText::_('PLG_QUICKICON_GANTRY5_UPDATES_DISABLED'), + 'group' => 'MOD_QUICKICON_MAINTENANCE' + ); + + } elseif (!empty($updates)) { + // Has updates + $quickicons[] = array( + 'link' => JRoute::_('index.php?option=com_installer&view=update&filter_search=gantry5'), + 'image' => 'download', + 'text' => JText::_('PLG_QUICKICON_GANTRY5_UPDATE_NOW'), + 'group' => 'MOD_QUICKICON_MAINTENANCE' + ); + } + + return $quickicons; + } +} diff --git a/platforms/joomla/plg_quickicon_gantry5/gantry5.xml b/platforms/joomla/plg_quickicon_gantry5/gantry5.xml new file mode 100644 index 000000000..5a38f636c --- /dev/null +++ b/platforms/joomla/plg_quickicon_gantry5/gantry5.xml @@ -0,0 +1,29 @@ + + + plg_quickicon_gantry5 + @version@ + @versiondate@ + RocketTheme, LLC + support@rockettheme.com + http://www.rockettheme.com + (C) 2005 - 2015 RocketTheme, LLC. All rights reserved. + http://www.gnu.org/copyleft/gpl.html GNU/GPL + Gantry5 Quick Icon + + + gantry5.php + language + + + + +
+ +
+
+
diff --git a/platforms/joomla/plg_quickicon_gantry5/language/en-GB/en-GB.plg_quickicon_gantry5.sys.ini b/platforms/joomla/plg_quickicon_gantry5/language/en-GB/en-GB.plg_quickicon_gantry5.sys.ini new file mode 100644 index 000000000..1243176bf --- /dev/null +++ b/platforms/joomla/plg_quickicon_gantry5/language/en-GB/en-GB.plg_quickicon_gantry5.sys.ini @@ -0,0 +1,8 @@ +PLG_QUICKICON_GANTRY5="Quick Icon - Gantry5" +PLG_QUICKICON_GANTRY5_DESC="Links to Gantry5 and displays if there are updates when you visit the Control Panel page." + +PLG_QUICKICON_GANTRY5_UPDATE_NOW="Gantry5 - Update now!" +PLG_QUICKICON_GANTRY5_UPDATES_DISABLED="Gantry5 Updates disabled" + +PLG_QUICKICON_GANTRY5_GROUP_DESC="The group of this plugin (this value is compared with the group value used in 'Quick Icons' modules to inject icons)" +PLG_QUICKICON_GANTRY5_GROUP_LABEL="Group" diff --git a/platforms/joomla/plg_system_gantryadmin/gantryadmin.php b/platforms/joomla/plg_system_gantry5/gantry5.php similarity index 60% rename from platforms/joomla/plg_system_gantryadmin/gantryadmin.php rename to platforms/joomla/plg_system_gantry5/gantry5.php index 07948815d..626b9459c 100644 --- a/platforms/joomla/plg_system_gantryadmin/gantryadmin.php +++ b/platforms/joomla/plg_system_gantry5/gantry5.php @@ -1,10 +1,11 @@ app = JFactory::getApplication(); + JLoader::register('Gantry5\Loader', JPATH_LIBRARIES . '/gantry5/Loader.php'); + + // Detect Gantry Framework or fail gracefully. + if (!class_exists('Gantry5\Loader')) { + if ($this->app->isAdmin()) { + $this->loadLanguage('plg_system_gantry5.sys'); + $this->app->enqueueMessage( + JText::sprintf('PLG_SYSTEM_GANTRY5_LIBRARY_MISSING', JText::_('PLG_SYSTEM_GANTRY5')), + 'warning' + ); + } + return; + } + parent::__construct($subject, $config); } @@ -20,12 +35,10 @@ class plgSystemGantryadmin extends JPlugin */ public function onAfterRoute() { - if ($this->app->isSite()) - { + if ($this->app->isSite()) { $this->onAfterRouteSite(); - } - elseif ($this->app->isAdmin()) - { + + } elseif ($this->app->isAdmin()) { $this->onAfterRouteAdmin(); } } @@ -46,8 +59,7 @@ class plgSystemGantryadmin extends JPlugin $view = $this->app->input->getString('view', 'styles'); $task = $this->app->input->getString('task'); - if ($option == 'com_templates' && $view == 'styles' && !$task && $type == 'html') - { + if ($option == 'com_templates' && $view == 'styles' && !$task && $type == 'html') { $this->styles = $this->getStyles(); $body = preg_replace_callback('/(]*href=")([^"]*)("[^>]*>)(.*)(<\/a>)/siU', [$this, 'appendHtml'], $this->app->getBody()); @@ -62,14 +74,40 @@ class plgSystemGantryadmin extends JPlugin private function onAfterRouteSite() { $template = $this->app->getTemplate(true); - $path = JPATH_THEMES . '/' . $template->template; - if (!file_exists("{$path}/includes/gantry.php")) - { + if (!file_exists(JPATH_THEMES . "/{$template->template}/gantry/theme.yaml")) { return; } - include "{$path}/includes/gantry.php"; + $path = JPATH_THEMES . "/{$template->template}/includes/gantry.php"; + + if (is_file($path)) { + // Manually setup Gantry5 Framework from the template. + include $path; + + return; + } + + // Setup Gantry5 Framework or throw exception. + Gantry5\Loader::setup(); + + // Get Gantry instance. + $gantry = Gantry\Framework\Gantry::instance(); + + // Get information from the current template. + $app = JFactory::getApplication(); + $template = $app->getTemplate(true); + + // Initialize the template. + $gantry['theme.id'] = $template->id; + $gantry['theme.path'] = JPATH_THEMES . "/{$template->template}"; + $gantry['theme.name'] = $template->template; + $gantry['theme.params'] = $template->params->toArray(); + + $themePath = $gantry['theme.path'] . '/includes/theme.php'; + + //if (is_file($themePath)) { + include_once $themePath; } /** @@ -82,53 +120,31 @@ class plgSystemGantryadmin extends JPlugin $option = $input->getCmd('option'); $task = $input->getCmd('task'); - if ($option == 'com_templates' && $task && strpos($task, 'style') === 0) - { + if ($option == 'com_templates' && $task && strpos($task, 'style') === 0) { // Get all ids. $cid = $input->post->get('cid', (array) $input->getInt('id'), 'array'); - if ($cid) - { + if ($cid) { $styles = $this->getStyles(); $selected = array_intersect(array_keys($styles), $cid); // If no Gantry templates were selected, just let com_templates deal with the request. - if (!$selected) - { + if (!$selected) { return; } // Special handling for tasks coming from com_template. - switch ($task) { - case 'style.edit': - $id = (int) array_shift($cid); - if (isset($styles[$id])) { - $this->app->redirect('index.php?option=com_gantryadmin&view=about&style=' . $id); - } - break; - default: - // $this->setRequestOption('option', 'com_gantryadmin'); - break; + if ($task == 'style.edit') { + $id = (int) array_shift($cid); + + if (isset($styles[$id])) { + $this->app->redirect("index.php?option=com_gantry5&view=about&style={$id}"); + } } } } } - /** - * @param string $key - * @param string $value - */ - private function setRequestOption($key, $value) - { - $this->app->input->set($key, $value); - $this->app->input->get->set($key, $value); - - if (class_exists('JRequest')) - { - JRequest::setVar($key, $value, 'GET'); - } - } - /** * @param array $matches * @return string @@ -137,15 +153,13 @@ class plgSystemGantryadmin extends JPlugin { $html = $matches[0]; - if (strpos($matches[2], 'task=style.edit')) - { + if (strpos($matches[2], 'task=style.edit')) { $uri = new JUri($matches[2]); $id = (int) $uri->getVar('id'); - if ($id && $uri->getVar('option') == 'com_templates' && isset($this->styles[$id])) - { + if ($id && $uri->getVar('option') == 'com_templates' && isset($this->styles[$id])) { $html = $matches[1] . $uri . $matches[3] . $matches[4] . $matches[5]; - $html .= 'Gantry'; + $html .= ' Gantry5'; } } @@ -160,8 +174,7 @@ class plgSystemGantryadmin extends JPlugin $cache = JFactory::getCache('com_templates', ''); $list = $cache->get('gantry-templates'); - if ($list === false) - { + if ($list === false) { // Load styles $db = JFactory::getDbo(); $query = $db @@ -177,11 +190,9 @@ class plgSystemGantryadmin extends JPlugin $list = array(); - foreach ($templates as $template) - { - if (file_exists(JPATH_SITE . '/templates/' . $template->template . '/includes/gantry.php')) - { - $params = new JRegistry; + foreach ($templates as $template) { + if (file_exists(JPATH_SITE . "/templates/{$template->template}/gantry/theme.yaml")) { + $params = new \Joomla\Registry\Registry; $params->loadString($template->params); $list[$template->id] = ($params->get('master') == 'true'); diff --git a/platforms/joomla/plg_system_gantry5/gantry5.xml b/platforms/joomla/plg_system_gantry5/gantry5.xml new file mode 100644 index 000000000..056c81106 --- /dev/null +++ b/platforms/joomla/plg_system_gantry5/gantry5.xml @@ -0,0 +1,22 @@ + + + PLG_SYSTEM_GANTRY5 + @version@ + @versiondate@ + RocketTheme, LLC + support@rockettheme.com + http://www.rockettheme.com + (C) 2005 - 2015 RocketTheme, LLC. All rights reserved. + http://www.gnu.org/copyleft/gpl.html GNU/GPL + PLG_SYSTEM_GANTRY5_DESCRIPTION + + + gantry5.php + language + + + + + + + diff --git a/platforms/joomla/plg_system_gantry5/language/en-GB/en-GB.plg_system_gantry5.sys.ini b/platforms/joomla/plg_system_gantry5/language/en-GB/en-GB.plg_system_gantry5.sys.ini new file mode 100644 index 000000000..c003acf59 --- /dev/null +++ b/platforms/joomla/plg_system_gantry5/language/en-GB/en-GB.plg_system_gantry5.sys.ini @@ -0,0 +1,3 @@ +PLG_SYSTEM_GANTRY5="System - Gantry5 Framework" +PLG_SYSTEM_GANTRY5_DESC="Gantry5 Framework" +PLG_SYSTEM_GANTRY5_LIBRARY_MISSING="%s: Gantry5 Library is missing!" diff --git a/platforms/joomla/plg_system_gantryadmin/gantryadmin.xml b/platforms/joomla/plg_system_gantryadmin/gantryadmin.xml deleted file mode 100644 index 0cb5c32dd..000000000 --- a/platforms/joomla/plg_system_gantryadmin/gantryadmin.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - PLG_SYSTEM_GANTRYADMIN - ${author} - ${build_date} - ${copyright} - ${license} - ${authorEmail} - ${authorUrl} - ${project.version} - ${project.description} - - gantryadmin.php - language - - - - - - diff --git a/platforms/joomla/plg_system_gantryadmin/language/en-GB/en-GB.plg_system_gantryadmin.sys.ini b/platforms/joomla/plg_system_gantryadmin/language/en-GB/en-GB.plg_system_gantryadmin.sys.ini deleted file mode 100644 index 139b0a278..000000000 --- a/platforms/joomla/plg_system_gantryadmin/language/en-GB/en-GB.plg_system_gantryadmin.sys.ini +++ /dev/null @@ -1 +0,0 @@ -PLG_SYSTEM_GANTRYADMIN="System - Gantry Administration" diff --git a/platforms/joomla/updates/5.0/list.xml b/platforms/joomla/updates/5.0/list.xml index c4c83e3d9..0285396b0 100644 --- a/platforms/joomla/updates/5.0/list.xml +++ b/platforms/joomla/updates/5.0/list.xml @@ -1,6 +1,5 @@ - - - - + + + diff --git a/platforms/joomla/updates/5.0/com_gantryadmin.xml b/platforms/joomla/updates/5.0/pkg_gantry5.xml similarity index 56% rename from platforms/joomla/updates/5.0/com_gantryadmin.xml rename to platforms/joomla/updates/5.0/pkg_gantry5.xml index 68c5b6044..66195f123 100644 --- a/platforms/joomla/updates/5.0/com_gantryadmin.xml +++ b/platforms/joomla/updates/5.0/pkg_gantry5.xml @@ -1,14 +1,14 @@ - + - com_gantryadmin - Gantry Templates - com_gantryadmin - component + pkg_gantry5 + Gantry Framework + pkg_gantry5 + package 5.0.0-DEV http://gantry-framework.org - http://update.gantry-framework.org/download/com_gantry-5.0.0-DEV.zip + http://update.gantry-framework.org/download/pkg_gantry-5.0.0-DEV.zip dev @@ -16,7 +16,7 @@ RocketTheme, LLC http://gantry-framework.org
Updates
- - administrator + + site
diff --git a/platforms/joomla/updates/5.0/tmpl_hydrogen.xml b/platforms/joomla/updates/5.0/tpl_g5_hydrogen.xml similarity index 69% rename from platforms/joomla/updates/5.0/tmpl_hydrogen.xml rename to platforms/joomla/updates/5.0/tpl_g5_hydrogen.xml index 419247bbb..4b314a088 100644 --- a/platforms/joomla/updates/5.0/tmpl_hydrogen.xml +++ b/platforms/joomla/updates/5.0/tpl_g5_hydrogen.xml @@ -1,14 +1,14 @@ - + - hydrogen + g5_hydrogen Hydrogen Template - hydrogen + g5_hydrogen template 1.0.0-DEV http://gantry-framework.org - http://update.gantry-framework.org/download/tmpl_hydrogen-1.0.0-DEV.zip + http://update.gantry-framework.org/download/tpl_g5_hydrogen-1.0.0-DEV.zip dev @@ -16,7 +16,7 @@ RocketTheme, LLC http://gantry-framework.org
Updates
- + site
diff --git a/src/Loader.php b/src/Loader.php new file mode 100644 index 000000000..4c385c48c --- /dev/null +++ b/src/Loader.php @@ -0,0 +1,84 @@ +loader; + } + + protected function __construct() + { + $errorMessage = 'You are running PHP %s, but Gantry5 Framework needs at least PHP %s to run.'; + + // Fail safe version check for PHP <5.4.0. + if (version_compare($phpVersion = PHP_VERSION, '5.4.0', '<')) { + throw new \RuntimeException(sprintf($errorMessage, $phpVersion, '5.4.0')); + } + + /** + * @name GANTRY_VERSION + */ + define('GANTRY5_VERSION', '5.0.0-DEV'); + + if (!defined('DS')) { + define('DS', DIRECTORY_SEPARATOR); + } + + if (!defined('GANTRY5_DEBUG')) { + define('GANTRY5_DEBUG', false); + } + + $this->loader = $this->autoload(); + } + + protected function autoload() + { + $base = __DIR__; + + // Initialize auto-loading. + if (!file_exists($base . '/vendor/autoload.php')) { + throw new \LogicException('Please run composer in Gantry5 Library!'); + } + + /** @var \Composer\Autoload\ClassLoader $loader */ + $loader = require_once $base . '/vendor/autoload.php'; + + // Register platform specific overrides. + if (defined('JVERSION')) { + define('GANTRY5_ROOT', JPATH_ROOT); + $loader->addPsr4('Gantry\\', $base . '/classes/Gantry/Platform/Joomla', true); + } elseif (defined('WP_DEBUG')) { + define('GANTRY5_ROOT', ABSPATH); + $loader->addPsr4('Gantry\\', $base . '/classes/Gantry/Platform/WordPress', true); + } elseif (defined('GRAV_VERSION')) { + define('GANTRY5_ROOT', rtrim(ROOT_DIR, '/')); + $loader->addPsr4('Gantry\\', $base . '/classes/Gantry/Platform/Grav', true); + } elseif (defined('MAGENTO_ROOT')) { + define('GANTRY5_ROOT', MAGENTO_ROOT); + $loader->addPsr4('Gantry\\', $base . '/classes/Gantry/Platform/Magento', true); + } elseif (defined('IN_PHPBB')) { + global $phpbb_root_path; + define('GANTRY5_ROOT', $phpbb_root_path); + } elseif (defined('PRIME_ROOT')) { + define('GANTRY5_ROOT', PRIME_ROOT); + $loader->addPsr4('Gantry\\', $base . '/classes/Gantry/Platform/Prime', true); + } + + return $loader; + } +} diff --git a/src/bootstrap.php b/src/bootstrap.php index c61599c4b..d35c0192a 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -1,33 +1,5 @@ messages['php'][] = $output; } } @@ -99,7 +99,7 @@ class JsonResponse extends Response 'message' => $e->getMessage() ]; - if (GANTRY_DEBUG) { + if (GANTRY5_DEBUG) { $exception += [ 'type' => get_class($e), 'file' => $e->getFile(), @@ -110,7 +110,7 @@ class JsonResponse extends Response $exceptions[] = $exception; $e = $e->getPrevious(); } - while (GANTRY_DEBUG && $e); + while (GANTRY5_DEBUG && $e); return $exceptions; } diff --git a/src/classes/Gantry/Platform/Joomla/Admin/Router.php b/src/classes/Gantry/Platform/Joomla/Admin/Router.php index 243d4f0f3..c21d48ac8 100644 --- a/src/classes/Gantry/Platform/Joomla/Admin/Router.php +++ b/src/classes/Gantry/Platform/Joomla/Admin/Router.php @@ -50,7 +50,7 @@ class Router extends BaseRouter $this->container['theme.params'] = (new Registry($table->params))->toArray(); } - $this->container['base_url'] = \JUri::base(true) . '/index.php?option=com_gantryadmin'; + $this->container['base_url'] = \JUri::base(true) . '/index.php?option=com_gantry5'; $this->container['ajax_suffix'] = '&format=json'; diff --git a/src/classes/Gantry/Platform/Joomla/Admin/Theme/ThemeList.php b/src/classes/Gantry/Platform/Joomla/Admin/Theme/ThemeList.php index 0353724b0..d03e45e70 100644 --- a/src/classes/Gantry/Platform/Joomla/Admin/Theme/ThemeList.php +++ b/src/classes/Gantry/Platform/Joomla/Admin/Theme/ThemeList.php @@ -74,7 +74,7 @@ class ThemeList $details['title'] = $template->title; $details['thumbnail'] = 'template_thumbnail.png'; $details['preview_url'] = \JUri::root(false) . 'index.php?templateStyle=' . $template->id; - $details['admin_url'] = \JRoute::_('index.php?option=com_gantryadmin&view=about&style=' . $template->id, false); + $details['admin_url'] = \JRoute::_('index.php?option=com_gantry5&view=about&style=' . $template->id, false); $details['params'] = $params->toArray(); $list[$template->id] = $details; diff --git a/src/classes/Gantry/Platform/Joomla/Framework/Platform.php b/src/classes/Gantry/Platform/Joomla/Framework/Platform.php index 56cebd51e..0a84cba07 100644 --- a/src/classes/Gantry/Platform/Joomla/Framework/Platform.php +++ b/src/classes/Gantry/Platform/Joomla/Framework/Platform.php @@ -26,12 +26,12 @@ class Platform extends BasePlatform public function getMediaPaths() { - return ['' => ['gantry-theme://images', 'media/gantry']]; + return ['' => ['gantry-theme://images', 'media/gantry5']]; } public function getEnginesPaths() { - return ['' => ['media/gantry/engines']]; + return ['' => ['media/gantry5/engines']]; } public function getEnginePaths() @@ -41,7 +41,7 @@ class Platform extends BasePlatform public function getAssetsPaths() { - return ['' => ['gantry-theme://', 'media/gantry/assets']]; + return ['' => ['gantry-theme://', 'media/gantry5/assets']]; } public function getModules($position) @@ -52,7 +52,7 @@ class Platform extends BasePlatform public function settings() { - return \JRoute::_('index.php?option=com_config&view=component&component=com_gantryadmin', false); + return \JRoute::_('index.php?option=com_config&view=component&component=com_gantry5', false); } public function update() @@ -76,7 +76,7 @@ class Platform extends BasePlatform $query ->select('*') ->from('#__updates') - ->where("element='com_gantryadmin' OR extension_id IN ($extension_ids)"); + ->where("element='com_gantry5' OR extension_id IN ($extension_ids)"); $db->setQuery($query); diff --git a/composer.json b/src/composer.json similarity index 88% rename from composer.json rename to src/composer.json index ff41a659e..5708d20e6 100644 --- a/composer.json +++ b/src/composer.json @@ -1,7 +1,7 @@ { "name": "gantry", "version":"5.0.0@dev", - "description": "Gantry Library", + "description": "Gantry Framework Library", "license": "GPLv2", "minimum-stability": "dev", @@ -26,7 +26,7 @@ }, "autoload": { "psr-4": { - "Gantry\\": "src/classes/Gantry" + "Gantry\\": "classes/Gantry" } } } diff --git a/src/includes/autoload.php b/src/includes/autoload.php deleted file mode 100644 index 784f43e1b..000000000 --- a/src/includes/autoload.php +++ /dev/null @@ -1,38 +0,0 @@ -addPsr4('Gantry\\', $base . '/classes/Gantry/Platform/Joomla', true); - } elseif (defined('WP_DEBUG')) { - define('GANTRY5_ROOT', ABSPATH); - $loader->addPsr4('Gantry\\', $base . '/classes/Gantry/Platform/WordPress', true); - } elseif (defined('GRAV_VERSION')) { - define('GANTRY5_ROOT', rtrim(ROOT_DIR, '/')); - $loader->addPsr4('Gantry\\', $base . '/classes/Gantry/Platform/Grav', true); - } elseif (defined('MAGENTO_ROOT')) { - define('GANTRY5_ROOT', MAGENTO_ROOT); - $loader->addPsr4('Gantry\\', $base . '/classes/Gantry/Platform/Magento', true); - } elseif (defined('IN_PHPBB')) { - global $phpbb_root_path; - define('GANTRY5_ROOT', $phpbb_root_path); - } elseif (defined('PRIME_ROOT')) { - define('GANTRY5_ROOT', PRIME_ROOT); - $loader->addPsr4('Gantry\\', $base . '/classes/Gantry/Platform/Prime', true); - } - - return $loader; -} diff --git a/src/includes/defines.php b/src/includes/defines.php deleted file mode 100644 index 66bddf892..000000000 --- a/src/includes/defines.php +++ /dev/null @@ -1,16 +0,0 @@ -loadLanguage('plg_system_gantry5.sys'); + $this->app->enqueueMessage( + JText::sprintf('PLG_SYSTEM_GANTRY5_LIBRARY_MISSING', JText::_('PLG_SYSTEM_GANTRY5')), + 'warning' ); - - foreach ($gantryPaths as $gantryPath) - { - if ($gantryPath && is_file($gantryPath)) - { - $gantryBootstrap = $gantryPath; - } - } - - if (!isset($gantryBootstrap)) - { - throw new LogicException('Gantry Framework not found!'); - } - - require_once $gantryBootstrap; - - unset($gantryPaths, $gantryPath, $gantryBootstrap); + return; } + // Setup Gantry5 Framework or throw exception. + Gantry5\Loader::setup(); + // Get Gantry instance and return it. $gantry = Gantry::instance(); // Initialize the template if not done already. if (!isset($gantry['theme.id'])) { - $app = JFactory::getApplication(); - if ($app->isSite()) - { - $template = $app->getTemplate(true); + $template = $app->getTemplate(true); - $gantry['theme.id'] = $template->id; - $gantry['theme.path'] = dirname(__DIR__); - $gantry['theme.name'] = $template->template; - $gantry['theme.params'] = $template->params->toArray(); - } - else - { - throw new RuntimeException('Template was loaded in administration without properly initializing Gantry!'); - } + $gantry['theme.id'] = $template->id; + $gantry['theme.path'] = dirname(__DIR__); + $gantry['theme.name'] = $template->template; + $gantry['theme.params'] = $template->params->toArray(); } // Only a single template can be loaded at any time. @@ -64,7 +42,5 @@ try catch (Exception $e) { // Oops, something went wrong! - - // In frontend we want to prevent template from loading. JError::raiseError(500, 'Failed to load template: ' . $e->getMessage()); } diff --git a/themes/hydrogen/joomla/language/en-GB/en-GB.tpl_g5_hydrogen.ini b/themes/hydrogen/joomla/language/en-GB/en-GB.tpl_g5_hydrogen.ini new file mode 100644 index 000000000..f85fbb342 --- /dev/null +++ b/themes/hydrogen/joomla/language/en-GB/en-GB.tpl_g5_hydrogen.ini @@ -0,0 +1,2 @@ +TPL_G5_HYDROGEN="Hydrogen" +TPL_G5_HYDROGEN_DESC="Hydrogen template for Gantry5" diff --git a/themes/hydrogen/joomla/language/en-GB/en-GB.tpl_g5_hydrogen.sys.ini b/themes/hydrogen/joomla/language/en-GB/en-GB.tpl_g5_hydrogen.sys.ini new file mode 100644 index 000000000..f85fbb342 --- /dev/null +++ b/themes/hydrogen/joomla/language/en-GB/en-GB.tpl_g5_hydrogen.sys.ini @@ -0,0 +1,2 @@ +TPL_G5_HYDROGEN="Hydrogen" +TPL_G5_HYDROGEN_DESC="Hydrogen template for Gantry5" diff --git a/themes/hydrogen/joomla/language/en-GB/en-GB.tpl_hydrogen.ini b/themes/hydrogen/joomla/language/en-GB/en-GB.tpl_hydrogen.ini deleted file mode 100644 index e69de29bb..000000000 diff --git a/themes/hydrogen/joomla/language/en-GB/en-GB.tpl_hydrogen.sys.ini b/themes/hydrogen/joomla/language/en-GB/en-GB.tpl_hydrogen.sys.ini deleted file mode 100644 index e69de29bb..000000000 diff --git a/themes/hydrogen/joomla/templateDetails.xml b/themes/hydrogen/joomla/templateDetails.xml index 374a7ba3c..388044a01 100644 --- a/themes/hydrogen/joomla/templateDetails.xml +++ b/themes/hydrogen/joomla/templateDetails.xml @@ -1,46 +1,43 @@ - - - - hydrogen + + + TPL_G5_HYDROGEN 1.0 - February 17, 2014 + @versiondate@ RocketTheme, LLC support@rockettheme.com http://www.rockettheme.com (C) 2005 - 2015 RocketTheme, LLC. All rights reserved. - Default Gantry Template + http://www.gnu.org/copyleft/gpl.html GNU/GPL + TPL_G5_HYDROGEN_DESC + + admin + blueprints + config + css + css-compiled + fonts + custom + gantry + includes + language + layouts + particles + scss + twig + comingsoon.php + component.php + error.php + index.php + offline.php + template_preview.png + template_thumbnail.png + unsupported.php + - Header - Drawer - Top - Utility - Showcase - Slideshow - Breadcrumbs - Feature - Main Top - Expanded Top - Sidebar - Content Top - Content Bottom - Expanded Bottom - Main Bottom - Extension - Full Width - Bottom - Footer - Copyright - Debug - Analytics - Login - Popup - - en-GB/en-GB.tpl_hydrogen.ini - en-GB/en-GB.tpl_hydrogen.sys.ini - +
@@ -48,7 +45,8 @@
+ - http://updates.gantry-framework.org/5.0/joomla/tmpl_hydrogen.xml + http://updates.gantry-framework.org/5.0/joomla/tpl_g5_hydrogen.xml