first commit

This commit is contained in:
2026-02-08 21:16:11 +01:00
commit e17b7026fd
8881 changed files with 1160453 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die;
use JchOptimize\ContainerFactory;
use Joomla\CMS\HTML\HTMLHelper;
include_once JPATH_ADMINISTRATOR . '/components/com_jchoptimize/autoload.php';
class JFormFieldAjax extends JFormField
{
protected $type = 'ajax';
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$params = ContainerFactory::getContainer()->get('params');
if (!defined('JCH_DEBUG')) {
define('JCH_DEBUG', ($params->get('debug', 0) && JDEBUG));
}
$script_options = ['framework' => false, 'relative' => true];
HTMLHelper::_('jquery.framework', true, null, false);
$document = JFactory::getDocument();
$script = '';
$options = ['version' => JCH_VERSION];
$document->addStyleSheet(JUri::root(true) . '/media/com_jchoptimize/core/css/admin.css', $options);
$document->addScript(JUri::root(true) . '/media/com_jchoptimize/core/js/admin-utility.js', $options);
$document->addScript(JUri::root(true) . '/media/com_jchoptimize/js/platform-joomla.js', $options);
$document->addScript(JUri::root(true) . '/media/com_jchoptimize/core/js/multiselect.js', $options);
$document->addScript(JUri::root(true) . '/media/com_jchoptimize/core/js/smart-combine.js', $options);
if (version_compare(JVERSION, '3.99.99', '>')) {
$document->addStyleSheet(JUri::root(true) . '/media/vendor/chosen/css/chosen.css');
$document->addStyleSheet(JUri::root(true) . '/media/com_jchoptimize/css/js-excludes-J4.css', $options);
$document->addScript(JUri::root(true) . '/media/vendor/chosen/js/chosen.jquery.js');
$document->addScriptDeclaration(
'jQuery(document).ready(function() {
jQuery(\'.jch-multiselect\').chosen({
width: "80%"
});
});'
);
} else {
$document->addStyleSheet(JUri::root(true) . '/media/com_jchoptimize/css/js-excludes-J3.css', $options);
}
$ajax_url = JRoute::_('index.php?option=com_jchoptimize&view=Ajax', false, JRoute::TLS_IGNORE, true);
$script .= <<<JS
var jch_observers = [];
var jch_ajax_url = '$ajax_url';
JS;
$document->addScriptDeclaration($script);
return false;
}
protected function getInput()
{
return false;
}
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/core
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2022 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
defined( '_JEXEC' ) or die;
include_once dirname( __FILE__ ) . '/exclude.php';
class JFormFieldCssbgimages extends JFormFieldExclude
{
public $type = 'cssbgimages';
public string $filetype = 'css';
public string $filegroup = 'class';
protected function getInput()
{
if ( ! JCH_PRO )
{
return Helper::proOnlyField();
}
else
{
return parent::getInput();
}
}
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldCustomextension extends JFormFieldExclude {
public $type = 'customextension';
public string $filetype = 'url';
public string $filegroup = 'file';
protected function getInput()
{
if ( ! JCH_PRO )
{
return Helper::proOnlyField();
}
else
{
return parent::getInput();
}
}
}

View File

@@ -0,0 +1,38 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldDynamicselectors extends JFormFieldExclude
{
public $type = 'dynamicselectors';
public string $filetype = 'selectors';
public string $filegroup = 'style';
protected function getInput()
{
if ( ! JCH_PRO )
{
return Helper::proOnlyField();
}
else
{
return parent::getInput();
}
}
}

View File

@@ -0,0 +1,106 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die;
use JchOptimize\ContainerFactory;
use JchOptimize\Core\Admin\MultiSelectItems;
use JchOptimize\Core\Helper;
use Joomla\CMS\Uri\Uri as JUri;
include_once JPATH_ADMINISTRATOR . '/components/com_jchoptimize/autoload.php';
include_once JPATH_ADMINISTRATOR . '/components/com_jchoptimize/version.php';
JFormHelper::loadFieldClass('textarea');
abstract class JFormFieldExclude extends JFormFieldTextarea
{
protected bool $first_field = false;
protected string $filegroup = 'file';
protected string $filetype = '';
/**
* @var MultiSelectItems
*/
protected $multiSelect;
public function __construct($form = null)
{
parent::__construct($form);
$container = ContainerFactory::getContainer();
$this->multiSelect = $container->buildObject(MultiSelectItems::class);
}
public function setup(SimpleXMLElement $element, $value, $group = null): bool
{
$value = $this->castValue($value);
return parent::setup($element, $value, $group);
}
/**
*
* @param string $value
*
* @return array
*/
protected function castValue($value)
{
if ( ! is_array($value)) {
$value = Helper::getArray($value);
}
return $value;
}
/**
*
* @return string
*/
protected function getInput()
{
$attributes = 'class="inputbox chzn-custom-value input-xlarge jch-multiselect" multiple size="5" data-jch_type="' . $this->filetype . '" data-jch_param="' . $this->fieldname . '" data-jch_group="' . $this->filegroup . '"';
$select = JHTML::_(
'select.genericlist',
$this->getOptions(),
'jform[' . $this->fieldname . '][]',
$attributes,
'id',
'name',
$this->value,
$this->id
);
$uriRoot = JUri::root();
return <<<HTML
<div id="div-{$this->fieldname}">{$select}
<img id="img-{$this->fieldname}" class="jch-multiselect-loading-image" src="{$uriRoot}media/com_jchoptimize/core/images/exclude-loader.gif" />
<button type="button" class="btn btn-sm btn-secondary jch-multiselect-add-button" onmousedown="jchMultiselect.addJchOption('jform_{$this->fieldname}')" style="display: none;">Add item</button>
</div>
HTML;
}
protected function getOptions(): array
{
$options = [];
foreach ($this->value as $excludeValue) {
$options[$excludeValue] = $this->multiSelect->{'prepare' . ucfirst($this->filegroup) . 'Values'}(
$excludeValue
);
}
return $options;
}
}

View File

@@ -0,0 +1,43 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\ContainerFactory;
use Joomla\Filesystem\Folder;
defined( '_JEXEC' ) or die;
include_once dirname( __FILE__ ) . '/exclude.php';
class JFormFieldExcludecomponent extends JFormFieldExclude
{
public $type = 'excludecomponent';
protected function getOptions(): array
{
$options = [];
$params = ContainerFactory::getContainer()->get( 'params' );
$installedComponents = Folder::folders( JPATH_SITE . '/components' );
$excludedComponents = $params->get( 'cache_exclude_component', [ 'com_ajax' ] );
$components = array_unique( array_merge( $installedComponents, $excludedComponents ) );
foreach ( $components as $component )
{
$options[ $component ] = $component;
}
return $options;
}
}

View File

@@ -0,0 +1,39 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined( '_JEXEC' ) or die;
use JchOptimize\Platform\Plugin;
use Joomla\CMS\HTML\HTMLHelper;
include_once dirname( __FILE__ ) . '/exclude.php';
class JFormFieldExcludecss extends JFormFieldExclude
{
public $type = 'excludecss';
public string $filetype = 'css';
public string $filegroup = 'file';
/**
*
* @return type
*/
protected function getInput()
{
$this->first_field = true;
return parent::getInput();
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldExcludecssextns extends JFormFieldExclude
{
public $type = 'excludecssextns';
public string $filetype = 'css';
public string $filegroup = 'extension';
}

View File

@@ -0,0 +1,36 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldExcludehttp2 extends JFormFieldExclude
{
public $type = 'excludehttp2';
public string $filegroup = 'file';
protected function getInput()
{
if ( ! JCH_PRO )
{
return Helper::proOnlyField();
}
else
{
return parent::getInput();
}
}
}

View File

@@ -0,0 +1,24 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldExcludeimages extends JFormFieldExclude
{
public $type = 'excludeimages';
public string $filetype = 'images';
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldExcludejs extends JFormFieldExclude
{
public $type = 'excludejs';
public string $filetype = 'js';
public string $filegroup = 'file';
}

View File

@@ -0,0 +1,24 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldExcludejsextns extends JFormFieldExclude
{
public $type = 'excludejsextns';
public string $filetype = 'js';
public string $filegroup = 'extension';
}

View File

@@ -0,0 +1,24 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/excludejspei.php';
class JFormFieldExcludejsextnspei extends JFormFieldExcludejspei
{
public $type = 'excludejsextnspei';
public string $filetype = 'js';
public string $filegroup = 'extension';
}

View File

@@ -0,0 +1,105 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Uri\Uri;
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldExcludejspei extends JFormFieldExclude
{
public $type = 'excludejspei';
public string $filetype = 'js';
public string $filegroup = 'file';
protected string $valueType = 'url';
protected function getInput(): string
{
$this->value = array_values($this->value);
$i = 0;
$nextIndex = count($this->value);
$field = <<<HTML
<fieldset id="fieldset-{$this->fieldname}" data-index="{$nextIndex}">
<div class="jch-js-fieldset-children jch-js-excludes-header">
<span class="jch-js-ieo-header">&nbsp;&nbsp;Ignore execution order&nbsp;&nbsp;&nbsp;</span>
<span class="jch-js-dontmove-header">&nbsp;&nbsp;&nbsp;Don't move to bottom&nbsp;&nbsp;</span>
</div>
HTML;
foreach ($this->value as $value) {
//Sanity check
if (!isset($value[$this->valueType])) {
continue;
}
$ieoChecked = isset($value['ieo']) ? 'checked' : '';
$dontMoveChecked = isset($value['dontmove']) ? 'checked' : '';
$dataValue = $this->multiSelect->{'prepare' . ucfirst($this->filegroup) . 'Values'}(
$value[$this->valueType]
);
$size = strlen($value[$this->valueType]);
$field .= <<<HTML
<div id="div-{$this->fieldname}-{$i}" class="jch-js-fieldset-children jch-js-excludes-container">
<span class="jch-js-excludes"><span><input type="text" readonly size="{$size}" value="{$value[$this->valueType]}" name="jform[{$this->fieldname}][$i][{$this->valueType}]">
{$dataValue}
<button type="button" class="jch-multiselect-remove-button" onmouseup="jchMultiselect.removeJchJsOption('div-{$this->fieldname}-{$i}', 'jform_{$this->fieldname}')"></button>
</span></span>
<span class="jch-js-ieo">
<input type="checkbox" name="jform[{$this->fieldname}][$i][ieo]" {$ieoChecked}/>
</span>
<span class="jch-js-dontmove">
<input type="checkbox" name="jform[{$this->fieldname}][$i][dontmove]" {$dontMoveChecked} />
</span>
</div>
HTML;
$i++;
}
$attributes = 'class="inputbox chzn-custom-value input-large jch-multiselect" multiple data-jch_type="' . $this->filetype . '" data-jch_param="' . $this->fieldname . '" data-jch_group="' . $this->filegroup . '"';
$select = HTMLHelper::_(
'select.genericlist',
$this->getOptions(),
'jform[' . $this->fieldname . '][][' . $this->valueType . ']',
$attributes,
'id',
'name',
$this->value,
$this->id
);
$uriRoot = Uri::root();
$field .= <<<HTML
</fieldset>
<div id="div-{$this->fieldname}">{$select}
<img id="img-{$this->fieldname}" class="jch-multiselect-loading-image" src="{$uriRoot}media/com_jchoptimize/core/images/exclude-loader.gif" />
<button type="button" class="btn btn-sm btn-secondary jch-multiselect-add-button" onmousedown="jchMultiselect.addJchJsOption('jform_{$this->fieldname}', '{$this->fieldname}', '{$this->valueType}')" style="display: none;">Add item</button>
</div>
<script>
jQuery('#jform_{$this->fieldname}').on('change', function(evt, params){
jchMultiselect.appendJchJsOption('jform_{$this->fieldname}', '{$this->fieldname}', params, '{$this->valueType}');
});
</script>
HTML;
return $field;
}
protected function getOptions(): array
{
return [];
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldExcludejsurls extends JFormFieldExclude
{
public $type = 'excludejsurls';
public string $filetype = 'js';
public string $filegroup = 'file';
}

View File

@@ -0,0 +1,24 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldExcludelazyload extends JFormFieldExclude
{
public $type = 'excludelazyload';
public string $filetype = 'lazyload';
public string $filegroup = 'file';
}

View File

@@ -0,0 +1,38 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldExcludelazyloadclass extends JFormFieldExclude
{
public $type = 'excludelazyloadclass';
public string $filetype = 'lazyload';
public string $filegroup = 'class';
protected function getInput()
{
if ( ! JCH_PRO )
{
return Helper::proOnlyField();
}
else
{
return parent::getInput();
}
}
}

View File

@@ -0,0 +1,39 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldExcludelazyloadfolders extends JFormFieldExclude
{
public $type = 'excludelazyloadfolders';
public string $filetype = 'lazyload';
public string $filegroup = 'folder';
protected function getInput()
{
if ( ! JCH_PRO )
{
return Helper::proOnlyField();
}
else
{
return parent::getInput();
}
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldExcludescripts extends JFormFieldExclude
{
public $type = 'excludescripts';
public string $filetype = 'js';
public string $filegroup = 'script';
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/excludejspei.php';
class JFormFieldExcludescriptspei extends JFormFieldExcludejspei
{
public $type = 'excludescriptspei';
public string $filetype = 'js';
public string $filegroup = 'script';
protected string $valueType = 'script';
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldExcludestyles extends JFormFieldExclude
{
public $type = 'excludestyles';
public string $filetype = 'css';
public string $filegroup = 'style';
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldExcludeurl extends JFormFieldExclude
{
public $type = 'excludeurl';
public string $filetype = 'url';
public string $filegroup = 'file';
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldExcludeurlwithquery extends JFormFieldExclude
{
public $type = 'excludeurlwithquery';
public string $filetype = 'url';
public string $filegroup = 'class';
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldIncludehttp2 extends JFormFieldExclude
{
public $type = 'includehttp2';
public string $filegroup = 'file';
protected function getInput()
{
if ( ! JCH_PRO )
{
return Helper::proOnlyField();
}
else
{
return parent::getInput();
}
}
}

View File

@@ -0,0 +1,23 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldIncludeimages extends JFormFieldExclude
{
public $type = 'includeimages';
public string $filetype = 'images';
}

View File

@@ -0,0 +1,4 @@
<html>
<body>
</body>
</html>

View File

@@ -0,0 +1,78 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die('No direct access');
class JFormFieldJchgroup extends JFormField
{
public $type = 'jchgroup';
protected function getLabel()
{
return '';
}
protected function getInput()
{
$attributes = $this->element->attributes();
$html = '';
$header = isset($attributes['label']) ? '<h4>' . JText::_($attributes['label']) . '<span class="fa"></span></h4>' : '';
$description = isset($attributes['description']) ? '<p><em>' . JText::_($attributes['description']) . '</em></p>' : '';
$section = $attributes['section'];
$name = $attributes['name'];
$class = isset($attributes['class']) !== false ? 'class="' . $attributes['class'] . '" ' : '';
$collapsible = '<div ' . $class . '>';
$collapsible .= $header;
$collapsible .= $description . '<br>';
$collapsible .= '</div><div>';
if (version_compare(JVERSION, '3.0', '>='))
{
$html .= '</div></div>';
if ($section == 'start')
{
$html .= '<div class="well well-small">';
$html .= $collapsible;
}
else
{
$html .= '</div></div>';
}
$html .= '<div><div>';
}
else
{
if ($section == 'start')
{
$html .= '<div class="jchgroup">';
$html .= $collapsible;
$html .= '<ul class="adminformlist">';
}
else
{
$html .= '</ul></div></div>';
}
}
return $html;
}
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldLoadfilesasync extends JFormFieldExclude
{
public $type = 'loadfilesasync';
protected $jch_params = 'pro_loadFilesAsync';
protected function getInput()
{
$this->setAjaxParams('js', $this->jch_params, 'file');
return parent::getInput();
}
}

View File

@@ -0,0 +1,176 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined( '_JEXEC' ) or die( 'No direct access' );
use Joomla\CMS\HTML\HTMLHelper;
require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
class JFormFieldMenuselection extends JFormField
{
public $type = 'menuselection';
public function setup( SimpleXMLElement $element, $value, $group = null )
{
$script_options = array( 'framework' => false, 'relative' => true );
if ( version_compare( JVERSION, '3.99.99', '<' ) )
{
JHtml::script( 'jui/jquery.min.js' );
JHtml::_( 'script', 'jui/treeselectmenu.jquery.min.js', false, true );
}
else
{
HTMLHelper::_( 'script', 'vendor/jquery/jquery.min.js', $script_options );
$oDocument = JFactory::getDocument();
$oDocument->addScript( JUri::root( true ) . '/media/legacy/js/treeselectmenu.js' );
}
if ( ! is_array( $value ) )
{
$value = array();
}
return parent::setup( $element, $value, $group );
}
protected function getInput()
{
$menuTypes = MenusHelper::getMenuLinks();
$html = '';
if ( ! empty( $menuTypes ) ) :
$id = 'jform_menuselect';
$html .= '<div>
<div class="form-inline">
<span class="small">' . JText::_( 'JSELECT' ) . ':
<a id="treeCheckAll" href="javascript://">' . JText::_( 'JALL' ) . '</a>,
<a id="treeUncheckAll" href="javascript://">' . JText::_( 'JNONE' ) . '</a>
</span>
<span class="width-20">|</span>
<span class="small">' . JText::_( 'JCH_EXPAND' ) . ':
<a id="treeExpandAll" href="javascript://">' . JText::_( 'JALL' ) . '</a>,
<a id="treeCollapseAll" href="javascript://">' . JText::_( 'JNONE' ) . '</a>
</span>
<input type="text" id="treeselectfilter" name="treeselectfilter" class="input-medium search-query pull-right" size="16"
autocomplete="off" placeholder="' . JText::_( 'JSEARCH_FILTER' ) . '" aria-invalid="false" tabindex="-1">
</div>
<div class="clearfix"></div>
<hr class="hr-condensed" />
<ul class="treeselect">';
foreach ( $menuTypes as &$type ) :
if ( count( $type->links ) ) :
$prevlevel = 0;
$html .= '<li>
<div class="treeselect-item pull-left">
<label class="pull-left nav-header">' . $type->title . '</label></div>';
foreach ( $type->links as $i => $link ) :
if ( $prevlevel < $link->level )
{
$html .= '<ul class="treeselect-sub">';
}
elseif ( $prevlevel > $link->level )
{
$html .= str_repeat( '</li></ul>', $prevlevel - $link->level );
}
else
{
$html .= '</li>';
}
// $selected = 0;
// if ($pluginassignment == 0)
// {
// $selected = 1;
// } elseif ($pluginassingment < 0)
// {
// $selected = in_array(-$link->value, $this->value);
// } elseif ($pluginassignment > 0)
// {
$selected = in_array( $link->value, $this->value );
// }
$html .= '<li>
<div class="treeselect-item pull-left">
<input type="checkbox" class="pull-left" name="jform[menuexcluded][]" id="' . $id . $link->value . '" value="' . (int)$link->value . '"' . ( $selected ? ' checked="checked"' : '' ) . ' />
<label for="' . $id . $link->value . '" class="pull-left">
' . $link->text . ' <span class="small">' . JText::sprintf( 'JGLOBAL_LIST_ALIAS', htmlentities( $link->alias ) ) . '</span>
';
if ( JLanguageMultilang::isEnabled() && $link->language != '' && $link->language != '*' )
{
$html .= JHtml::_( 'image', 'mod_languages/' . $link->language_image . '.gif', $link->language_title, array( 'title' => $link->language_title ), true );
}
if ( $link->published == 0 )
{
$html .= ' <span class="label">' . JText::_( 'JUNPUBLISHED' ) . '</span>';
}
$html .= ' </label>
</div>';
$menuitems_limit = 50;
if ( ! isset( $type->links[ $i + 1 ] ) || $i > $menuitems_limit )
{
$html .= str_repeat( '</li></ul>', $link->level );
}
$prevlevel = $link->level;
if ( $i > $menuitems_limit )
{
break;
}
endforeach;
$html .= ' </li>';
endif;
endforeach;
$html .= ' </ul>
<div id="noresultsfound" style="display:none;" class="alert alert-no-items">
' . JText::_( 'JGLOBAL_NO_MATCHING_RESULTS' ) . '
</div>
<div style="display:none;" id="treeselectmenu">
<div class="pull-left nav-hover treeselect-menu">
<div class="btn-group">
<a href="#" data-toggle="dropdown" class="dropdown-toggle btn btn-micro">
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li class="nav-header">' . JText::_( 'JCH_SUBITEMS' ) . '</li> <li class="divider"></li>
<li class=""><a class="checkall" href="javascript://"><span class="icon-checkbox"></span> ' . JText::_( 'JSELECT' ) . '</a>
</li>
<li><a class="uncheckall" href="javascript://"><span class="icon-checkbox-unchecked"></span> ' . JText::_( 'JCH_DESELECT' ) . '</a>
</li>
<div class="treeselect-menu-expand">
<li class="divider"></li>
<li><a class="expandall" href="javascript://"><span class="icon-plus"></span>' . JText::_( 'JCH_EXPAND' ) . '</a></li>
<li><a class="collapseall" href="javascript://"><span class="icon-minus"></span>' . JText::_( 'JCH_COLLAPSE' ) . '</a></li>
</div>
</ul>
</div>
</div>
</div>
</div>';
endif;
return $html;
}
}

View File

@@ -0,0 +1,63 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') or die('No direct access');
require_once(JPATH_ADMINISTRATOR . '/components/com_modules/helpers/modules.php');
class JFormFieldPluginassignment extends JFormField
{
public $type = 'pluginassignment';
public function setup(SimpleXMLElement $element, $value, $group = NULL)
{
$script = "
jQuery(document).ready(function()
{
menuHide(jQuery('#jform_assignment').val());
jQuery('#jform_assignment').change(function()
{
menuHide(jQuery(this).val());
})
});
function menuHide(val)
{
if (val == 0 || val == '-')
{
jQuery('#menuselect-group').hide();
}
else
{
jQuery('#menuselect-group').show();
}
}
";
// Add the script to the document head
JFactory::getDocument()->addScriptDeclaration($script);
return parent::setup($element, $value, $group);
}
protected function getInput()
{
$html = '<select name="jform[assignment]" id="jform_assignment"> ' .
JHtml::_('select.options', ModulesHelper::getAssignmentOptions(0), 'value', 'text', $this->value, true) .
'</select>';
return $html;
}
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/core
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2023 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldProcriticaljs extends JFormFieldExclude
{
public $type = 'procriticaljs';
public string $filetype = 'criticaljs';
public string $filegroup = 'file';
protected function getInput()
{
if ( ! JCH_PRO) {
return Helper::proOnlyField();
} else {
return parent::getInput();
}
}
}

View File

@@ -0,0 +1,33 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/core
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2022 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
defined( '_JEXEC' ) or die;
include_once dirname( __FILE__ ) . '/excludecss.php';
class JFormFieldProexcludecss extends JFormFieldExcludecss
{
protected function getInput()
{
if ( ! JCH_PRO )
{
return Helper::proOnlyField();
}
else
{
return parent::getInput();
}
}
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/excludejsurls.php';
class JFormFieldProexcludejsurls extends JFormFieldExcludejsurls
{
protected function getInput()
{
if ( ! JCH_PRO )
{
return Helper::proOnlyField();
}
else
{
return parent::getInput();
}
}
}

View File

@@ -0,0 +1,33 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/excludescripts.php';
class JFormFieldProexcludescripts extends JFormFieldExcludescripts
{
protected function getInput()
{
if ( ! JCH_PRO )
{
return Helper::proOnlyField();
}
else
{
return parent::getInput();
}
}
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
defined('_JEXEC') or die;
include_once dirname(__FILE__) . '/exclude.php';
class JFormFieldPromodules extends JFormFieldExclude
{
public $type = 'promodules';
public string $filetype = 'modules';
public string $filegroup = 'file';
protected function getInput()
{
if ( ! JCH_PRO) {
return Helper::proOnlyField();
} else {
return parent::getInput();
}
}
}

View File

@@ -0,0 +1,38 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
defined('_JEXEC') or die;
JFormHelper::loadFieldClass('checkboxes');
class JFormFieldProonlycheckboxes extends JFormFieldCheckboxes
{
public $type = 'proonlycheckboxes';
protected function getInput()
{
if ( ! JCH_PRO )
{
return Helper::proOnlyField();
}
else
{
return parent::getInput();
}
}
}
?>

View File

@@ -0,0 +1,77 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/core
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2023 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use Joomla\CMS\Cache\Cache;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
defined('_JEXEC') or die('Restricted Access');
FormHelper::loadFieldClass('list');
class JFormFieldProonlyjchcachehandler extends JFormFieldList
{
public $type = 'proonlyjchcachehandler';
protected function getOptions()
{
$optionsMap = [
'file' => 'filesystem',
'redis' => 'redis',
'apcu' => 'apcu',
'memcached' => 'memcached',
'wincache' => 'wincache'
];
$availableStores = Cache::getStores();
foreach ($optionsMap as $joomlaStorage => $laminasStorage) {
if (JCH_PRO || $laminasStorage == 'filesystem') {
if (in_array($joomlaStorage, $availableStores)) {
$options[] = HTMLHelper::_(
'select.option',
$laminasStorage,
Text::_('COM_JCHOPTIMIZE_STORAGE_' . strtoupper($laminasStorage)),
'value',
'text',
false
);
} else {
$options[] = HTMLHelper::_(
'select.option',
$laminasStorage,
Text::_('COM_JCHOPTIMIZE_STORAGE_' . strtoupper($laminasStorage)),
'value',
'text',
true
);
}
} else {
$options[] = HTMLHelper::_(
'select.option',
$laminasStorage,
Text::_('COM_JCHOPTIMIZE_STORAGE_' . strtoupper($laminasStorage)) . ' (Pro Only)',
[
'disable' => true,
]
);
}
}
$options = array_merge(parent::getOptions(), $options);
return $options;
}
}

View File

@@ -0,0 +1,71 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/core
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2023 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\ContainerFactory;
use JchOptimize\Core\Admin\Helper;
use JchOptimize\Model\ModeSwitcher;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
defined('_JEXEC') or die('Restricted Access');
FormHelper::loadFieldClass('list');
class JFormFieldProonlyjchpagecache extends JFormFieldList
{
public $type = 'proonlyjchpagecache';
protected function getInput()
{
if (!JCH_PRO) {
return Helper::proOnlyField();
}
return parent::getInput();
}
protected function getOptions(): array
{
/** @var ModeSwitcher $modeSwitcher */
$modeSwitcher = ContainerFactory::getContainer()->get(ModeSwitcher::class);
$availablePlugins = $modeSwitcher->getAvailablePageCachePlugins();
foreach ($modeSwitcher->pageCachePlugins as $pageCache => $title) {
if (in_array($pageCache, $availablePlugins)) {
$options[] = HTMLHelper::_(
'select.option',
$pageCache,
Text::_($title),
'value',
'text',
false
);
} else {
$options[] = HTMLHelper::_(
'select.option',
$pageCache,
Text::_($title),
'value',
'text',
true
);
}
}
$options = array_merge(parent::getOptions(), $options);
return $options;
}
}

View File

@@ -0,0 +1,39 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
use Joomla\CMS\Form\FormHelper;
defined('_JEXEC') or die;
FormHelper::loadFieldClass('list');
class JFormFieldProonlylist extends JFormFieldList
{
public $type = 'proonlylist';
protected function getInput()
{
if ( ! JCH_PRO )
{
return Helper::proOnlyField();
}
else
{
return parent::getInput();
}
}
}
?>

View File

@@ -0,0 +1,38 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
defined('_JEXEC') or die;
JFormHelper::loadFieldClass('radio');
class JFormFieldProonlyradio extends JFormFieldRadio
{
public $type = 'proonlyradio';
protected function getInput()
{
if ( ! JCH_PRO )
{
return Helper::proOnlyField();
}
else
{
return parent::getInput();
}
}
}
?>

View File

@@ -0,0 +1,38 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
defined('_JEXEC') or die;
JFormHelper::loadFieldClass('text');
class JFormFieldProonlytext extends JFormFieldText
{
public $type = 'proonlytext';
protected function getInput()
{
if ( ! JCH_PRO )
{
return Helper::proOnlyField();
}
else
{
return parent::getInput();
}
}
}
?>

View File

@@ -0,0 +1,46 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
use JchOptimize\Core\Admin\Helper;
defined( '_JEXEC' ) or die( 'Restricted access' );
class JFormFieldSmartCombine extends JFormFieldRadio
{
protected $type = 'SmartCombine';
protected function getInput()
{
if ( ! JCH_PRO )
{
return Helper::proOnlyField();
}
else
{
return '<div id="div-' . $this->fieldname . '">' . parent::getInput() . '<img id="img-' . $this->fieldname . '" src="' . JUri::root() . 'media/com_jchoptimize/core/images/exclude-loader.gif" style="display: none;"/> <button id="btn-' . $this->fieldname . '" type="button" class="btn btn-sm btn-secondary" style="display: none;">Reprocess Smart Combine</button>
</div>';
}
//</div>
//</div>
//<div class="control-group" style="display: none;">
//<div class="control-label"></div>
//<div class="controls">
//<select id="jform_params_pro_smart_combine_values" name="jform[params][pro_smart_combine_values][]" style="display: none;" multiple="multiple" //></select>
//</div>
//</div>
//<div class="control-group" style="display: none;">
//<div class="control-label">
//';
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
* JCH Optimize - Performs several front-end optimizations for fast downloads
*
* @package jchoptimize/joomla-platform
* @author Samuel Marshall <samuel@jch-optimize.net>
* @copyright Copyright (c) 2020 Samuel Marshall / JCH Optimize
* @license GNU/GPLv3, or later. See LICENSE file
*
* If LICENSE file missing, see <http://www.gnu.org/licenses/>.
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
class JFormFieldSmartCombineValues extends JFormFieldList
{
protected $type = 'SmartCombineValues';
protected function getOptions()
{
$aOptions = array();
$aValueArray = $this->value;
if ( ! empty( $aValueArray ) )
{
foreach ( $aValueArray as $sValue )
{
$tmp = new stdClass();
$tmp->value = $sValue;
$tmp->text = '';
$tmp->disable = '';
$tmp->class = '';
$tmp->selected = true;
$tmp->checked = '';
$tmp->onclick = '';
$tmp->onchange = '';
$aOptions[] = $tmp;
}
}
return $aOptions;
}
}