primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 additions and 0 deletions

View File

@ -0,0 +1,94 @@
<?php
/**
* @package ShackDefaultFiles
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2015-2021 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackDefaultFiles.
*
* ShackDefaultFiles is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackDefaultFiles is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackDefaultFiles. If not, see <https://www.gnu.org/licenses/>.
*/
use Joomla\CMS\Form\FormField;
defined('_JEXEC') or die();
/**
* Class ShackFormFieldBase
*
* @property bool $fromInstaller
*/
class ShackFormFieldBase extends FormField
{
/**
* @var bool
*/
protected $fromInstaller = false;
public function __set($name, $value = null)
{
switch ($name) {
case 'fromInstaller':
$this->fromInstaller = (bool)$value;
break;
default:
parent::__set($name, $value);
}
}
/**
* @inheritDoc
*/
protected function getInput()
{
return '';
}
/**
* @param ?string $path
*
* @return string
*/
protected function getStyle(?string $path): string
{
if ($path && is_file($path)) {
return '<style>' . file_get_contents($path) . '</style>';
}
return '';
}
/**
* @inheritDoc
*/
protected function getLabel()
{
return '';
}
/**
* @param SimpleXMLElement $element
*
* @return ?string
*/
public function getInputUsingCustomElement(SimpleXMLElement $element): ?string
{
$this->element = $element;
$this->setup($element, null);
return $this->getInput();
}
}

View File

@ -0,0 +1,176 @@
<?php
/**
* @package ShackDefaultFiles
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2015-2024 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackDefaultFiles.
*
* ShackDefaultFiles is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackDefaultFiles is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackDefaultFiles. If not, see <https://www.gnu.org/licenses/>.
*/
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormField;
// phpcs:disable PSR1.Files.SideEffects
defined('_JEXEC') or die();
// phpcs:enable PSR1.Files.SideEffects
// phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
/**
* @property bool $fromInstaller
*/
class JFormFieldCustomFooter extends FormField
{
/**
* @inheritdoc
*/
protected $layout = 'alledia.customfooter';
/**
* @var bool
*/
protected $fromInstaller = false;
/**
* @inheritDoc
*/
public function __set($name, $value = null)
{
switch ($name) {
case 'fromInstaller':
$this->fromInstaller = (bool)$value;
break;
default:
parent::__set($name, $value);
}
}
/**
* @inheritDoc
*/
public function setup(SimpleXMLElement $element, $value, $group = null)
{
if ($path = realpath(__DIR__ . '/../..')) {
Factory::getLanguage()->load('shackdefaultfiles', $path);
}
return parent::setup($element, $value, $group);
}
/**
* @inheritDoc
*/
protected function getInput()
{
return $this->getRenderer($this->layout)->render($this->getLayoutData());
}
/**
* @inheritDoc
*/
protected function getRenderer($layoutId = 'default')
{
$renderer = parent::getRenderer($layoutId);
if ($layoutId == $this->layout) {
$renderer->addIncludePath(__DIR__ . '/layouts');
}
return $renderer;
}
/**
* @inheritDoc
*/
protected function getLayoutData()
{
$displayData = parent::getLayoutData();
$requiredClasses = [
'joomlashack-footer',
'row-fluid'
];
if ($this->fromInstaller) {
$requiredClasses[] = 'installer';
}
$classes = array_unique(
array_filter(
array_merge(
preg_split('/\s/', $displayData['class']),
$requiredClasses
)
)
);
$goProUrl = (string)$this->element['showgoproad'] ?: '0';
$showGoProAd = !($goProUrl == '0' || $goProUrl == 'false');
if ($showGoProAd && !filter_var($goProUrl, FILTER_VALIDATE_URL)) {
$goProUrl = 'https://www.joomlashack.com/plans';
}
return array_merge(
$displayData,
[
'class' => join(' ', $classes),
'media' => $this->element['media'],
'jslogo' => (string)$this->element['jslogo'] ?: 'joomlashack-logo.png',
'jshome' => (string)$this->element['jshome'] ?: 'https://www.joomlashack.com',
'jedurl' => (string)$this->element['jedurl'],
'fromInstaller' => $this->fromInstaller,
'showGoProAd' => $showGoProAd,
'goProUrl' => $goProUrl
]
);
}
/**
* @param ?string $path
*
* @return string
* @TODO: Doesn't seem to be useful
*/
protected function getStyle(?string $path): string
{
if ($path && is_file($path)) {
return '<style>' . file_get_contents($path) . '</style>';
}
return '';
}
/**
* @inheritDoc
*/
protected function getLabel()
{
return '';
}
/**
* @param SimpleXMLElement $element
*
* @return ?string
*/
public function getInputUsingCustomElement(SimpleXMLElement $element): ?string
{
$this->element = $element;
$this->setup($element, null);
return $this->getInput();
}
}

View File

@ -0,0 +1,112 @@
<?php
/**
* @package ShackDefaultFiles
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2018-2024 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackDefaultFiles.
*
* ShackDefaultFiles is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackDefaultFiles is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackDefaultFiles. If not, see <https://www.gnu.org/licenses/>.
*/
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
defined('_JEXEC') or die();
/**
* @var array $displayData
*/
$class = $displayData['class'];
$media = $displayData['media'];
$jslogo = $media . '/' . $displayData['jslogo'];
$jedurl = $displayData['jedurl'];
$showGoProAd = $displayData['showGoProAd'];
$goProUrl = $displayData['goProUrl'];
$fromInstaller = $displayData['fromInstaller'];
$footerCss = HTMLHelper::_('stylesheet', $media . '/field_customfooter.css', ['relative' => true, 'pathOnly' => true]);
$adminCss = HTMLHelper::_('stylesheet', $media . '/admin-default.css', ['relative' => true, 'pathOnly' => true]);
?>
<link href="<?php echo $footerCss; ?>" rel="stylesheet"/>
<link href="<?php echo $adminCss; ?>" rel="stylesheet"/>
<div class="<?php echo $class; ?>">
<div>
<?php
if ($showGoProAd) :
?>
<div class="gopro-ad">
<?php
echo HTMLHelper::_(
'link',
$goProUrl,
Text::_('SHACKDEFAULTFILES_GO_PRO'),
'class="gopto-btn" target="_blank"'
);
?>
</div>
<?php endif;
if ($jedurl) : ?>
<div class="joomlashack-jedlink">
<?php
echo Text::_('SHACKDEFAULTFILES_LIKE_THIS_EXTENSION');
echo '&nbsp;'
. HTMLHelper::_(
'link',
$jedurl,
Text::_('SHACKDEFAULTFILES_LEAVE_A_REVIEW_ON_JED'),
'target="_blank"'
);
echo '&nbsp;' . str_repeat("<i class=\"icon-star\"></i>", 5);
?>
</div>
<?php endif; ?>
<div class="poweredby">
Powered by
<?php
echo HTMLHelper::_(
'link',
'https://www.joomlashack.com',
HTMLHelper::_('image', $jslogo, 'Joomlashack', 'class="joomlashack-logo" width="150"', true),
'target="_blank"'
);
?>
</div>
<div class="joomlashack-copyright">
<?php echo '&copy; ' . date('Y'); ?> Joomlashack.com. All rights reserved.
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
let footer = document.getElementsByClassName('joomlashack-footer').item(0),
container = footer ? footer.parentElement : null,
wrapper = null;
if (container && container.classList.contains('controls')) {
wrapper = document.getElementById('content') || document.querySelector('.container-popup');
}
if (footer && wrapper) {
wrapper.parentNode.insertBefore(footer, wrapper.nextSibling);
} else if (footer) {
footer.remove();
}
});
</script>

View File

@ -0,0 +1,83 @@
<?php
/**
* @package ShackDefaultFiles
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2015-2024 Joomlashack.com. All rights reserved
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
*
* This file is part of ShackDefaultFiles.
*
* ShackDefaultFiles is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* ShackDefaultFiles is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ShackDefaultFiles. If not, see <https://www.gnu.org/licenses/>.
*/
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
defined('_JEXEC') or die();
FormHelper::loadFieldClass('Spacer');
class JFormFieldSubtitle extends JFormFieldSpacer
{
/**
* @inheritDoc
*/
protected function getLabel()
{
$html = [];
$class = $this->class ?: sprintf(' class="%s"', $this->class);
$tag = $this->element['tag'] ? (string)$this->element['tag'] : 'h4';
$html[] = '<span class="spacer">';
$html[] = '<span class="before"></span>';
$html[] = '<span' . $class . '>';
if ((string)$this->element['hr'] == 'true') {
$html[] = '<hr' . $class . '>';
} else {
$label = '';
// Get the label text from the XML element, defaulting to the element name.
$text = (string)$this->element['label'] ?: (string)$this->element['name'];
$text = $this->translateLabel ? Text::_($text) : $text;
// Build the class for the label.
$class = $this->description ? 'hasTooltip' : '';
$class = $this->required == true ? $class . ' required' : $class;
// Add the opening label tag and main attributes attributes.
$label .= '<' . $tag . ' id="' . $this->id . '-lbl" class="' . $class . '"';
if ($this->description) {
// Use description to build a tooltip.
HTMLHelper::_('bootstrap.tooltip');
$label .= sprintf(
' title="%s"',
HTMLHelper::tooltipText(trim($text, ':'), Text::_($this->description), 0)
);
}
// Add the label text and closing tag.
$label .= '>' . $text . '</' . $tag . '>';
$html[] = $label;
}
$html[] = '</span>';
$html[] = '<span class="after"></span>';
$html[] = '</span>';
return implode('', $html);
}
}