fix image

This commit is contained in:
Niels Nübel
2021-02-19 15:57:49 +01:00
parent c2e55b1240
commit ac6d74b582
10 changed files with 313 additions and 1 deletions
@@ -387,7 +387,20 @@ function bildHTML($typ, $id, $fixed_width = 0, $fixed_height = 0, $max_width = 0
return null; return null;
} }
return '<img src="' . $sportsmanager_joomla_url . 'images/sportsmanager/' . $typ . '/' . basename($pfad_angepasst) . '" width="' . $width . '" height="' . $height . '" ' . $zusatz . ' />'; /*
* #resize=250
#resize=250,250,blue
#resize=250,250,blue
#resize=250,250&sizes=60%,80%,200%
#resize=250,250,cover&sizes=60%,80%,200%
#resize=250,250,fill&sizes=60%,80%,200%
#crop=250,250,center,top
#crop=250,250
#crop=250,250,center,bottom
#crop=250,250,left
#crop=250,250,right
*/
return '<img class="el-image" data-src="images/sportsmanager/' . $typ . '/' . basename($pfad_angepasst) . '#crop=150,150,center,top" uk-img/>';
} }
$new_width = $width; $new_width = $width;
@@ -0,0 +1,34 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage System.kickyootheme
* @author Niels Nübel <niels@kicktemp.com>
* @author Stefan Wendhausen <stefan@kicktemp.com>
* @copyright Copyright © 2021 Kicktemp GmbH. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE.txt
* @link https://kicktemp.com
*/
// No direct access
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
/**
* Form Field class for Kicktemp Joomla! Extensions.
* Provides a donation code check.
*/
class JFormFieldKickDonation extends JFormField
{
protected $type = 'kickdonation';
protected function getInput()
{
$html = '<a class="btn btn-success" href="https://www.paypal.me/kicktemp/5" target="_blank"><span class="icon-smiley-2 icon-white" aria-hidden="true"></span> 5 €</a> <a class="btn btn-success" href="https://www.paypal.me/kicktemp/10" target="_blank"><span class="icon-thumbs-up icon-white" aria-hidden="true"></span> 10 €</a> <a class="btn btn-success" href="https://www.paypal.me/kicktemp/" target="_blank"><span class="icon-star icon-white" aria-hidden="true"></span> # €</a>';
return $html;
}
protected function getLabel()
{
return JText::_('KICKDONATION');
}
}
@@ -0,0 +1,155 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage System.kickyootheme
* @author Niels Nübel <niels@kicktemp.com>
* @author Stefan Wendhausen <stefan@kicktemp.com>
* @copyright Copyright © 2019 Kicktemp GmbH. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE.txt
* @link https://kicktemp.com
*/
class PlgSystemKickYOOthemeInstallerScript
{
private $min_joomla_version = '3.8.0';
private $min_php_version = '7.0';
private $name = 'System Plugin Kick YOOtheme Pro';
private $extname = 'plg_system_kickyootheme';
private $previous_version = '';
private $previous_version_simple = '';
private $dir = null;
public function __construct()
{
$this->dir = __DIR__;
}
public function postflight($route, $installer)
{
$changelog = $this->getChangelog();
JFactory::getApplication()->enqueueMessage($changelog, 'notice');
return true;
}
private function getChangelog()
{
$changelog = file_get_contents($this->dir . '/CHANGELOG.txt');
$changelog = "\n" . trim(preg_replace('#^.* \*/#s', '', $changelog));
$changelog = preg_replace("#\r#s", '', $changelog);
$parts = explode("\n\n", $changelog);
if (empty($parts))
{
return '';
}
$this_version = '';
$changelog = [];
// Add first entry to the changelog
$changelog[] = array_shift($parts);
// Add extra older entries if this is an upgrade based on previous installed version
if ($this->previous_version_simple)
{
if (preg_match('#^[0-9]+-[a-z]+-[0-9]+ : v([0-9\.]+(?:-dev[0-9]+)?)\n#i', trim($changelog[0]), $match))
{
$this_version = $match[1];
}
foreach ($parts as $part)
{
$part = trim($part);
if ( ! preg_match('#^[0-9]+-[a-z]+-[0-9]+ : v([0-9\.]+(?:-dev[0-9]+)?)\n#i', $part, $match))
{
continue;
}
$changelog_version = $match[1];
if (version_compare($changelog_version, $this->previous_version_simple, '<='))
{
break;
}
$changelog[] = $part;
}
}
$changelog = implode("\n\n", $changelog);
// + Added ! Removed ^ Changed # Fixed
$change_types = [
'+' => ['Added', 'success'],
'!' => ['Removed', 'danger'],
'^' => ['Changed', 'warning'],
'#' => ['Fixed', 'info'],
];
foreach ($change_types as $char => $type)
{
$changelog = preg_replace(
'#\n ' . preg_quote($char, '#') . ' #',
"\n" . '<span class="label label-sm label-' . $type[1] . '" title="' . $type[0] . '">' . $char . '</span> ',
$changelog
);
}
$changelog = preg_replace('#see: (https://www\.kicktemp\.com[^ \)]*)#s', '<a href="\1" target="_blank">see documentation</a>', $changelog);
$changelog = preg_replace(
"#(\n+)([0-9]+.*?) : v([0-9\.]+(?:-dev[0-9]+)?)([^\n]*?\n+)#",
'</pre>\1'
. '<h3><span class="label label-inverse" style="font-size: 0.8em;">v\3</span>'
. ' <small>\2</small></h3>'
. '\4<pre>',
$changelog
);
$changelog = str_replace(
[
'<pre>',
'[FREE]',
'[PRO]',
],
[
'<pre style="line-height: 1.6em;">',
'<span class="badge badge-sm badge-success">FREE</span>',
'<span class="badge badge-sm badge-info">PRO</span>',
],
$changelog
);
$changelog = preg_replace(
'#\[J([1-9][\.0-9]*)\]#',
'<span class="badge badge-sm badge-default">J\1</span>',
$changelog
);
$title = 'Latest changes for ' . JText::_($this->name);
if ($this->previous_version_simple && version_compare($this->previous_version_simple, $this_version, '<'))
{
$title .= ' since v' . $this->previous_version_simple;
}
if ($this->previous_version_simple
&& $this->getMajorVersionPart($this->previous_version_simple) < $this->getMajorVersionPart($this_version)
&& ! $this->hasMessagesOfType('warning')
)
{
JFactory::getApplication()->enqueueMessage(JText::sprintf('RLI_MAJOR_UPGRADE', JText::_($this->name)), 'warning');
}
return '<h3>' . $title . ':</h3>'
. '<div style="max-height: 240px; padding-right: 20px; margin-right: -20px; overflow: auto;">'
. $changelog
. '</div>';
}
}
@@ -0,0 +1,40 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage System.kickyootheme
* @author Niels Nübel <niels@kicktemp.com>
* @author Stefan Wendhausen <stefan@kicktemp.com>
* @copyright Copyright © 2020 Kicktemp GmbH. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE.txt
* @link https://kicktemp.com
*/
defined('_JEXEC') or die;
use function YOOtheme\app;
use YOOtheme\ImageProvider;
/**
* Plugin class to modify the JDocumentHTML object
*
* @since 3.1
*/
class plgSystemKickYOOtheme extends JPlugin
{
protected $app;
protected $buffer;
public function onBeforeRender()
{
if (!$this->app->isClient('site'))
{
return false;
}
$imageProvider = app(ImageProvider::class);
$content = JFactory::getDocument()->getBuffer('component');
JFactory::getDocument()->setBuffer($imageProvider->replace($content), 'component');
}
}
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.9" type="plugin" group="system" method="upgrade">
<name>plg_system_kickyootheme</name>
<author>Kicktemp GmbH</author>
<creationDate>30 September 2019</creationDate>
<copyright>Copyright © 2019 Kicktemp GmbH. All rights reserved.</copyright>
<license>GNU General Public License version 3 or later; see LICENSE.txt</license>
<authorEmail>hello@kicktemp.com</authorEmail>
<authorUrl>https://kicktemp.com</authorUrl>
<version>@@VERSION</version>
<description>PLG_SYSTEM_KICKYOOTHEME_XML_DESCRIPTION</description>
<files>
<folder>language</folder>
<folder>fields</folder>
<file plugin="kickyootheme">kickyootheme.php</file>
</files>
<scriptfile>kickscript.php</scriptfile>
<config>
<fields name="params" addfieldpath="/plugins/system/kickyootheme/fields">
<fieldset name="basic">
<field type="kickdonation" />
</fieldset>
</fields>
</config>
<updateservers>
<server type="extension" priority="1" name="System Plugin Kick YOOtheme Pro">
https://update.kicktemp.com/joomla/plugins/plg_system_kickyootheme/update.xml
</server>
</updateservers>
</extension>
@@ -0,0 +1,3 @@
PLG_SYSTEM_KICKYOOTHEME="System - Kick YOOtheme Pro ImageProvider"
PLG_SYSTEM_KICKYOOTHEME_XML_DESCRIPTION="System plugin to modify the Component"
KICKDONATION="Projekt unterstützen?"
@@ -0,0 +1,2 @@
PLG_SYSTEM_KICKYOOTHEME="System - Kick YOOtheme Pro ImageProvider"
PLG_SYSTEM_KICKYOOTHEME_XML_DESCRIPTION="System plugin to modify the Component"
@@ -0,0 +1,3 @@
PLG_SYSTEM_KICKYOOTHEME="System - Kick YOOtheme Pro ImageProvider"
PLG_SYSTEM_KICKYOOTHEME_XML_DESCRIPTION="System plugin to modify the Component"
KICKDONATION="Projekt unterstützen?"
@@ -0,0 +1,2 @@
PLG_SYSTEM_KICKYOOTHEME="System - Kick YOOtheme Pro ImageProvider"
PLG_SYSTEM_KICKYOOTHEME_XML_DESCRIPTION="System plugin to modify the Component"
@@ -0,0 +1,30 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage System.kickyootheme
* @author Niels Nübel <niels@kicktemp.com>
* @author Stefan Wendhausen <stefan@kicktemp.com>
* @copyright Copyright © 2019 Kicktemp GmbH. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE.txt
* @link https://kicktemp.com
*/
/**
* Installation class to perform additional changes during install/uninstall/update
*
* @since 1.0
*/
class PlgSystemKickYOOthemeScript extends JInstallerScript
{
/**
* Extension script constructor.
*
* @since 1.0
*/
public function __construct()
{
// Define the minumum versions to be supported.
$this->minimumJoomla = '3.8';
$this->minimumPhp = '7.0';
}
}