first commit
This commit is contained in:
1
plugins/system/jce/css/content.css
Normal file
1
plugins/system/jce/css/content.css
Normal file
File diff suppressed because one or more lines are too long
1
plugins/system/jce/css/media.css
Normal file
1
plugins/system/jce/css/media.css
Normal file
@@ -0,0 +1 @@
|
||||
div[data-url].wf-media-wrapper>div.modal,div[data-url]>div.modal-dialog>div.modal-content{height:90vh}.wf-media-wrapper .modal .modal-header h3{font-size:0}.wf-media-wrapper .modal .modal-body{max-height:100%!important;width:auto;overflow:hidden;padding:0}.wf-media-wrapper .modal .modal-body iframe{height:calc(100% - 27px)!important}.wf-media-wrapper .modal .modal-body iframe[name=field-media-modal]{height:calc(90vh - 54px)!important;max-height:100vh}.wf-media-wrapper .modal .modal-footer{display:none}#sbox-window{padding:5px!important}#sbox-window #sbox-content,#sbox-window #sbox-content iframe{margin:0!important;padding:0!important}.input-append a[role=button].wf-media-upload-button,.input-group a[role=button].wf-media-upload-button{position:relative;border-radius:0;overflow:hidden}.wf-media-upload-button>input[type=file]{position:absolute;left:0;top:0;width:100%;height:100%;font-size:100px;opacity:0;cursor:pointer;overflow:hidden}input.wf-media-upload-busy,input.wf-media-upload-hover{background-color:#eee}@media (max-width:1400px){.input-append input.wf-media-input-upload{width:100px}}.wf-media-wrapper-custom .field-media-preview{display:flex;align-items:center;justify-content:center;height:180px;padding:10px;overflow:hidden;background-color:#f2f2f2;border:1px solid rgba(0,0,0,.15);border-width:1px 1px 0;border-radius:.25rem .25rem 0 0}.wf-media-wrapper-custom .field-media-preview .field-media-preview-icon{width:7rem;height:7rem;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath fill='rgba(0,0,0,.25)' d='M464 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm-6 336H54a6 6 0 0 1-6-6V118a6 6 0 0 1 6-6h404a6 6 0 0 1 6 6v276a6 6 0 0 1-6 6zM128 152c-22.091 0-40 17.909-40 40s17.909 40 40 40 40-17.909 40-40-17.909-40-40-40zM96 352h320v-80l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L192 304l-39.515-39.515c-4.686-4.686-12.284-4.686-16.971 0L96 304v48z'/%3E%3C/svg%3E");background-size:7rem}.wf-media-wrapper-custom .field-media-preview img{max-width:100%;max-height:100%}.wf-media-wrapper-custom .field-media-preview img+.field-media-preview-icon,.wf-media-wrapper-custom .field-media-preview img[src=""]{display:none}.wf-media-wrapper-custom .field-media-preview img[src=""]+.field-media-preview-icon{display:block}
|
||||
300
plugins/system/jce/jce.php
Normal file
300
plugins/system/jce/jce.php
Normal file
@@ -0,0 +1,300 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2015 Ryan Demmer. All rights reserved
|
||||
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Form;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
|
||||
/**
|
||||
* JCE.
|
||||
*
|
||||
* @since 2.5.5
|
||||
*/
|
||||
class PlgSystemJce extends CMSPlugin
|
||||
{
|
||||
public function onPlgSystemJceContentPrepareForm($form, $data)
|
||||
{
|
||||
return $this->onContentPrepareForm($form, $data);
|
||||
}
|
||||
|
||||
private function getMediaRedirectUrl()
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
|
||||
require_once JPATH_ADMINISTRATOR . '/components/com_jce/helpers/browser.php';
|
||||
|
||||
$id = $app->input->get('fieldid', '');
|
||||
$mediatype = $app->input->getVar('mediatype', $app->input->getVar('view', 'images'));
|
||||
$context = $app->input->getVar('context', '');
|
||||
$plugin = $app->input->getCmd('plugin', '');
|
||||
|
||||
$options = WFBrowserHelper::getMediaFieldOptions(array(
|
||||
'element' => $id,
|
||||
'converted' => true,
|
||||
'mediatype' => $mediatype,
|
||||
'context' => $context,
|
||||
'plugin' => $plugin,
|
||||
));
|
||||
|
||||
if (empty($options['url'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $options['url'];
|
||||
}
|
||||
|
||||
private function redirectMedia()
|
||||
{
|
||||
$url = $this->getMediaRedirectUrl();
|
||||
|
||||
if ($url) {
|
||||
Factory::getApplication()->redirect($url);
|
||||
}
|
||||
}
|
||||
|
||||
private function isEditorEnabled()
|
||||
{
|
||||
return ComponentHelper::isEnabled('com_jce') && PluginHelper::isEnabled('editors', 'jce');
|
||||
}
|
||||
|
||||
private function canRedirectMedia()
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
$params = ComponentHelper::getParams('com_jce');
|
||||
|
||||
// must have fieldid
|
||||
if (!$app->input->get('fieldid')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// jce converted mediafield
|
||||
if ($app->input->getCmd('option') == 'com_jce' && $app->input->getCmd('task') == 'mediafield.display') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((bool) $params->get('replace_media_manager', 1) == true) {
|
||||
// flexi-content mediafield
|
||||
if ($app->input->getCmd('option') == 'com_media' && $app->input->getCmd('asset') == 'com_flexicontent') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onAfterRoute()
|
||||
{
|
||||
if (false == $this->isEditorEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->canRedirectMedia() && $this->isEditorEnabled()) {
|
||||
// redirect to file browser
|
||||
$this->redirectMedia();
|
||||
}
|
||||
}
|
||||
|
||||
public function onAfterDispatch()
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
|
||||
// only in "site"
|
||||
if ($app->getClientId() !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$document = Factory::getDocument();
|
||||
|
||||
// only if enabled
|
||||
if ((int) $this->params->get('column_styles', 1)) {
|
||||
$hash = md5_file(__DIR__ . '/css/content.css');
|
||||
$document->addStyleSheet(JURI::root(true) . '/plugins/system/jce/css/content.css?' . $hash);
|
||||
}
|
||||
}
|
||||
|
||||
public function onWfContentPreview($context, &$article, &$params, $page)
|
||||
{
|
||||
$article->text = '<style type="text/css">@import url("' . JURI::root(true) . '/plugins/system/jce/css/content.css");</style>' . $article->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* adds additional fields to the user editing form.
|
||||
*
|
||||
* @param JForm $form The form to be altered
|
||||
* @param mixed $data The associated data for the form
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 2.5.20
|
||||
*/
|
||||
public function onContentPrepareForm($form, $data)
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
|
||||
$version = new Joomla\CMS\Version();
|
||||
|
||||
// Joomla 3.10 or later...
|
||||
if (!$version->isCompatible('3.9')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!($form instanceof Form)) {
|
||||
$this->_subject->setError('JERROR_NOT_A_FORM');
|
||||
return false;
|
||||
}
|
||||
|
||||
// editor not enabled
|
||||
if (false == $this->isEditorEnabled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// File Browser not enabled
|
||||
if (false == $this->getMediaRedirectUrl()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$params = ComponentHelper::getParams('com_jce');
|
||||
|
||||
$hasMedia = false;
|
||||
$fields = $form->getFieldset();
|
||||
|
||||
// should the Joomla Media field be converted?
|
||||
$replace_media_manager = (bool) $params->get('replace_media_manager', 1);
|
||||
|
||||
foreach ($fields as $field) {
|
||||
if (method_exists($field, 'getAttribute') === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$name = $field->getAttribute('name');
|
||||
|
||||
// avoid processing twice
|
||||
if ($form->getFieldAttribute($name, 'class') && strpos($form->getFieldAttribute($name, 'class'), 'wf-media-input') !== false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$type = $field->getAttribute('type');
|
||||
|
||||
if ($type) {
|
||||
// joomla media field and flexi-content converted media field
|
||||
if (strtolower($type) == 'media' || strtolower($type) == 'fcmedia') {
|
||||
|
||||
// media replacement disabled, skip...
|
||||
if ($replace_media_manager == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$group = (string) $field->group;
|
||||
$form->setFieldAttribute($name, 'type', 'mediajce', $group);
|
||||
$form->setFieldAttribute($name, 'converted', '1', $group);
|
||||
$hasMedia = true;
|
||||
}
|
||||
|
||||
// jce media field
|
||||
if (strtolower($type) == 'mediajce' || strtolower($type) == 'extendedmedia') {
|
||||
$hasMedia = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// form has a media field
|
||||
if ($hasMedia) {
|
||||
$option = $app->input->getCmd('option');
|
||||
$component = ComponentHelper::getComponent($option);
|
||||
|
||||
Factory::getDocument()->addScriptOptions('plg_system_jce', array(
|
||||
'replace_media' => $replace_media_manager,
|
||||
'context' => $component->id,
|
||||
), true);
|
||||
|
||||
$form->addFieldPath(JPATH_PLUGINS . '/fields/mediajce/fields');
|
||||
|
||||
// Include jQuery
|
||||
HTMLHelper::_('jquery.framework');
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScript(JURI::root(true) . '/plugins/system/jce/js/media.js', array('version' => 'auto'));
|
||||
$document->addStyleSheet(JURI::root(true) . '/plugins/system/jce/css/media.css', array('version' => 'auto'));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function onBeforeWfEditorLoad()
|
||||
{
|
||||
$items = glob(__DIR__ . '/templates/*.php');
|
||||
|
||||
$app = Factory::getApplication();
|
||||
|
||||
if (method_exists($app, 'getDispatcher')) {
|
||||
$dispatcher = Factory::getApplication()->getDispatcher();
|
||||
} else {
|
||||
$dispatcher = JEventDispatcher::getInstance();
|
||||
}
|
||||
|
||||
foreach ($items as $item) {
|
||||
$name = basename($item, '.php');
|
||||
|
||||
$className = 'WfTemplate' . ucfirst($name);
|
||||
|
||||
require_once $item;
|
||||
|
||||
if (class_exists($className)) {
|
||||
// Instantiate and register the event
|
||||
$plugin = new $className($dispatcher);
|
||||
|
||||
if ($plugin instanceof \Joomla\CMS\Extension\PluginInterface) {
|
||||
$plugin->registerListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function onWfPluginInit($instance)
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
$user = Factory::getUser();
|
||||
|
||||
// set mediatype values for Template Manager parameters
|
||||
if ($app->input->getCmd('plugin') == 'browser.templatemanager') {
|
||||
|
||||
// only in "admin"
|
||||
if ($app->getClientId() !== 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// restrict to admin with component manage access
|
||||
if (!$user->authorise('core.manage', 'com_jce')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check for element and standalone should indicate mediafield
|
||||
if ($app->input->getVar('element') && $app->input->getInt('standalone')) {
|
||||
$mediatype = $app->input->getVar('mediatype');
|
||||
|
||||
if (!$mediatype) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$accept = $instance->getParam('templatemanager.extensions', '');
|
||||
|
||||
if ($accept) {
|
||||
$instance->setFileTypes($accept);
|
||||
$accept = $instance->getFileTypes();
|
||||
$mediatype = implode(',', array_intersect(explode(',', $mediatype), $accept));
|
||||
}
|
||||
|
||||
$instance->setFileTypes($mediatype);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
plugins/system/jce/jce.xml
Normal file
34
plugins/system/jce/jce.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension version="3.8" type="plugin" group="system" method="upgrade">
|
||||
<name>plg_system_jce</name>
|
||||
<version>2.9.32</version>
|
||||
<creationDate>01-11-2022</creationDate>
|
||||
<author>Ryan Demmer</author>
|
||||
<authorEmail>info@joomlacontenteditor.net</authorEmail>
|
||||
<authorUrl>http://www.joomlacontenteditor.net</authorUrl>
|
||||
<copyright>Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved</copyright>
|
||||
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
|
||||
<description>PLG_SYSTEM_JCE_XML_DESCRIPTION</description>
|
||||
<files folder="plugins/system/jce">
|
||||
<file plugin="jce">jce.php</file>
|
||||
<folder>css</folder>
|
||||
<folder>js</folder>
|
||||
<folder>templates</folder>
|
||||
</files>
|
||||
<languages folder="administrator/language/en-GB">
|
||||
<language tag="en-GB">en-GB.plg_system_jce.ini</language>
|
||||
<language tag="en-GB">en-GB.plg_system_jce.sys.ini</language>
|
||||
</languages>
|
||||
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="options">
|
||||
<field name="column_styles" type="radio" default="1" label="PLG_SYSTEM_JCE_COLUMN_STYLES_LABEL" description="PLG_SYSTEM_JCE_COLUMN_STYLES_DESC" class="btn-group btn-group-yesno">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
|
||||
</extension>
|
||||
2
plugins/system/jce/js/media.js
Normal file
2
plugins/system/jce/js/media.js
Normal file
File diff suppressed because one or more lines are too long
38
plugins/system/jce/templates/astroid.php
Normal file
38
plugins/system/jce/templates/astroid.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2021 Ryan Demmer. All rights reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
class WfTemplateAstroid extends JPlugin
|
||||
{
|
||||
public function onWfGetTemplateStylesheets(&$files, $template)
|
||||
{
|
||||
// Joomla 4
|
||||
$path = JPATH_SITE . '/media/templates/site/' . $template->name;
|
||||
|
||||
if (is_dir($path . '/astroid')) {
|
||||
$items = glob($path . '/css/compiled-*.css');
|
||||
|
||||
foreach($items as $item) {
|
||||
$files[] = 'media/templates/site/' . $template->name . '/css/' . basename($item);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Joomla 3
|
||||
$path = JPATH_SITE . '/templates/' . $template->name;
|
||||
|
||||
if (is_dir($path . '/astroid')) {
|
||||
$items = glob($path . '/css/compiled-*.css');
|
||||
|
||||
foreach($items as $item) {
|
||||
// add compiled css file
|
||||
$files[] = 'templates/' . $template->name . '/css/' . basename($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
36
plugins/system/jce/templates/core.php
Normal file
36
plugins/system/jce/templates/core.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2021 Ryan Demmer. All rights reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
class WfTemplateCore extends JPlugin
|
||||
{
|
||||
public function onWfGetTemplateStylesheets(&$files, $template)
|
||||
{
|
||||
// already processed by a framework
|
||||
if (!empty($files)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// search for template.css file using JPath
|
||||
$file = JPath::find(array(
|
||||
JPATH_SITE . '/templates/' . $template->name . '/css',
|
||||
JPATH_SITE . '/media/templates/site/' . $template->name . '/css'
|
||||
), 'template.css');
|
||||
|
||||
if (!$file) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// make relative
|
||||
$file = str_replace(JPATH_SITE, '', $file);
|
||||
|
||||
// remove leading slash
|
||||
$file = trim($file, '/');
|
||||
|
||||
$files[] = $file;
|
||||
}
|
||||
}
|
||||
108
plugins/system/jce/templates/gantry.php
Normal file
108
plugins/system/jce/templates/gantry.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2021 Ryan Demmer. All rights reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
class WfTemplateGantry extends JPlugin
|
||||
{
|
||||
public function onWfGetTemplateStylesheets(&$files, $template)
|
||||
{
|
||||
$path = JPATH_SITE . '/templates/' . $template->name;
|
||||
|
||||
// not a gantry template
|
||||
if (!is_dir($path . '/gantry') && !is_file($path . '/gantry.config.php')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$name = substr($template->name, strpos($template->name, '_') + 1);
|
||||
|
||||
// try Gantry5 templates
|
||||
$gantry5 = $path . '/custom/css-compiled';
|
||||
$gantry4 = $path . '/css-compiled';
|
||||
|
||||
if (is_dir($gantry5)) {
|
||||
// update url
|
||||
$url = 'templates/' . $template->name . '/custom/css-compiled';
|
||||
|
||||
// editor.css file
|
||||
$editor_css = $gantry5 . '/editor.css';
|
||||
|
||||
// check for editor.css file
|
||||
if (is_file($editor_css) && filesize($editor_css) > 0) {
|
||||
$files[] = $url . '/' . basename($editor_css);
|
||||
return true;
|
||||
}
|
||||
|
||||
// load gantry base files
|
||||
$files[] = 'media/gantry5/assets/css/bootstrap-gantry.css';
|
||||
$files[] = 'media/gantry5/engines/nucleus/css-compiled/nucleus.css';
|
||||
|
||||
$items = array();
|
||||
$custom = array();
|
||||
|
||||
$list = glob($gantry5 . '/*_[0-9]*.css');
|
||||
|
||||
foreach ($list as $file) {
|
||||
if (strpos(basename($file), 'custom_') !== false) {
|
||||
$custom[filemtime($file)] = $file;
|
||||
} else {
|
||||
$items[filemtime($file)] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($items)) {
|
||||
// sort items by modified time key
|
||||
ksort($items, SORT_NUMERIC);
|
||||
|
||||
// get the last item in the array
|
||||
$item = end($items);
|
||||
|
||||
$path = dirname($item);
|
||||
$file = basename($item);
|
||||
|
||||
// load css files
|
||||
$files[] = $url . '/' . $file;
|
||||
}
|
||||
|
||||
// load custom css file if it exists
|
||||
if (!empty($custom)) {
|
||||
// sort custom by modified time key
|
||||
ksort($custom, SORT_NUMERIC);
|
||||
|
||||
// get the last custom file in the array
|
||||
$custom_file = end($custom);
|
||||
// create custom file url
|
||||
$files[] = $url . '/' . basename($custom_file);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_dir($gantry4)) {
|
||||
// update url
|
||||
$url = 'templates/' . $template->name . '/css-compiled';
|
||||
// load gantry bootstrap files
|
||||
$files[] = $url . '/bootstrap.css';
|
||||
|
||||
$items = array();
|
||||
|
||||
$list = glob($gantry4 . '/master-*.css');
|
||||
|
||||
if (!empty($list)) {
|
||||
foreach ($list as $file) {
|
||||
$items[filemtime($file)] = $file;
|
||||
}
|
||||
|
||||
// sort by modified time key
|
||||
ksort($items, SORT_NUMERIC);
|
||||
|
||||
// get the last item in the array
|
||||
$item = end($items);
|
||||
|
||||
// load css files
|
||||
$files[] = $url . '/' . basename($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
36
plugins/system/jce/templates/helix.php
Normal file
36
plugins/system/jce/templates/helix.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2021 Ryan Demmer. All rights reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
class WfTemplateHelix extends JPlugin
|
||||
{
|
||||
public function onWfGetTemplateStylesheets(&$files, $template)
|
||||
{
|
||||
$path = JPATH_SITE . '/templates/' . $template->name;
|
||||
|
||||
if (!is_file($path . '/comingsoon.php')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// add bootstrap
|
||||
$files[] = 'templates/' . $template->name . '/css/bootstrap.min.css';
|
||||
|
||||
// add base template.css file
|
||||
$files[] = 'templates/' . $template->name . '/css/template.css';
|
||||
|
||||
$params = new JRegistry($template->params);
|
||||
$preset = $params->get('preset', '');
|
||||
|
||||
$data = json_decode($preset);
|
||||
|
||||
if ($data) {
|
||||
if (isset($data->preset)) {
|
||||
$files[] = 'templates/' . $template->name . '/css/presets/' . $data->preset . '.css';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
39
plugins/system/jce/templates/joomlart.php
Normal file
39
plugins/system/jce/templates/joomlart.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2021 Ryan Demmer. All rights reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
class WfTemplateJoomlart extends JPlugin
|
||||
{
|
||||
public function onWfGetTemplateStylesheets(&$files, $template)
|
||||
{
|
||||
$path = JPATH_SITE . '/templates/' . $template->name;
|
||||
|
||||
if (!is_file($path . '/templateInfo.php')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// add base template.css file
|
||||
$files[] = 'templates/' . $template->name . '/css/template.css';
|
||||
|
||||
$items = array();
|
||||
|
||||
$list = glob(JPATH_SITE . '/media/t4/css/*.css');
|
||||
|
||||
foreach($list as $file) {
|
||||
$items[filemtime($file)] = $file;
|
||||
}
|
||||
|
||||
// sort by modified time key
|
||||
ksort($items, SORT_NUMERIC);
|
||||
|
||||
// get the last item in the array
|
||||
$item = end($items);
|
||||
|
||||
// add compiled css file
|
||||
$files[] = 'media/t4/css/' . basename($item);
|
||||
}
|
||||
}
|
||||
40
plugins/system/jce/templates/sun.php
Normal file
40
plugins/system/jce/templates/sun.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2021 Ryan Demmer. All rights reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
class WfTemplateSun extends JPlugin
|
||||
{
|
||||
public function onWfGetTemplateStylesheets(&$files, $template)
|
||||
{
|
||||
$path = JPATH_SITE . '/templates/' . $template->name;
|
||||
|
||||
if (!is_file($path . '/template.defines.php')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// add bootstrap
|
||||
$files[] = 'plugins/system/jsntplframework/assets/3rd-party/bootstrap/css/bootstrap-frontend.min.css';
|
||||
|
||||
// add base template.css file
|
||||
$files[] = 'templates/' . $template->name . '/css/template.css';
|
||||
|
||||
$params = new JRegistry($template->params);
|
||||
$preset = $params->get('preset', '');
|
||||
|
||||
$data = json_decode($preset);
|
||||
|
||||
if ($data) {
|
||||
if (isset($data->templateColor)) {
|
||||
$files[] = 'templates/' . $template->name . '/css/color/' . $data->templateColor . '.css';
|
||||
}
|
||||
|
||||
if (isset($data->fontStyle) && isset($data->fontStyle->style)) {
|
||||
$files[] = 'templates/' . $template->name . '/css/styles/' . $data->fontStyle->style . '.css';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
plugins/system/jce/templates/wright.php
Normal file
34
plugins/system/jce/templates/wright.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2021 Ryan Demmer. All rights reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
class WfTemplateWright extends JPlugin
|
||||
{
|
||||
public function onWfGetTemplateStylesheets(&$files, $template)
|
||||
{
|
||||
$path = JPATH_SITE . '/templates/' . $template->name;
|
||||
|
||||
// not a wright template
|
||||
if (!is_dir($path . '/wright')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// add bootstrap
|
||||
$files[] = 'templates/' . $template->name . '/wright/css/bootstrap.min.css';
|
||||
|
||||
$params = new JRegistry($template->params);
|
||||
$style = $params->get('style', 'default');
|
||||
|
||||
// check style-custom.css file
|
||||
$file = $path . '/css/style-' . $style . '.css';
|
||||
|
||||
// add base theme.css file
|
||||
if (is_file($file)) {
|
||||
$files[] = 'templates/' . $template->name . '/css/style-' . $style . '.css';
|
||||
}
|
||||
}
|
||||
}
|
||||
62
plugins/system/jce/templates/yootheme.php
Normal file
62
plugins/system/jce/templates/yootheme.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2021 Ryan Demmer. All rights reserved
|
||||
* @license GNU General Public License version 2 or later
|
||||
*/
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
class WfTemplateYootheme extends JPlugin
|
||||
{
|
||||
public function onWfGetTemplateStylesheets(&$files, $template)
|
||||
{
|
||||
$path = JPATH_SITE . '/templates/' . $template->name;
|
||||
|
||||
// not a yootheme / warp template
|
||||
if (!is_dir($path . '/warp') && !is_dir($path . '/vendor/yootheme')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_dir($path . '/warp')) {
|
||||
$file = 'css/theme.css';
|
||||
|
||||
$config = $path . '/config.json';
|
||||
|
||||
if (is_file($config)) {
|
||||
$data = file_get_contents($config);
|
||||
$json = json_decode($data);
|
||||
|
||||
$style = '';
|
||||
|
||||
if ($json) {
|
||||
if (!empty($json->layouts->default->style)) {
|
||||
$style = $json->layouts->default->style;
|
||||
}
|
||||
}
|
||||
|
||||
if ($style && $style !== 'default') {
|
||||
$file = 'styles/' . $style . '/css/theme.css';
|
||||
}
|
||||
}
|
||||
|
||||
// add base theme.css file
|
||||
if (is_file($path . '/' . $file)) {
|
||||
$files[] = 'templates/' . $template->name . '/' . $file;
|
||||
}
|
||||
|
||||
// add custom css file
|
||||
if (is_file($path . '/css/custom.css')) {
|
||||
$files[] = 'templates/' . $template->name . '/css/custom.css';
|
||||
}
|
||||
}
|
||||
|
||||
if (is_dir($path . '/vendor/yootheme')) {
|
||||
$files[] = 'templates/' . $template->name . '/css/theme.css';
|
||||
|
||||
// add custom css file
|
||||
if (is_file($path . '/css/custom.css')) {
|
||||
$files[] = 'templates/' . $template->name . '/css/custom.css';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user