reformat code
This commit is contained in:
parent
24c4264d87
commit
a55512cc6c
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
node_modules/
|
||||
.php_cs.cache
|
||||
|
29
.php-cs-fixer.php
Normal file
29
.php-cs-fixer.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of O3-Shop TinyMCE editor module.
|
||||
*
|
||||
* This program 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, version 3.
|
||||
*
|
||||
* This program 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 O3-Shop. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
* @copyright Copyright (c) 2023 O3-Shop (https://www.o3-shop.com)
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
|
||||
*/
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()->in(__DIR__);
|
||||
|
||||
$config = new PhpCsFixer\Config();
|
||||
return $config
|
||||
->setRules([
|
||||
'@PHP74Migration' => true,
|
||||
'@PSR12' => true
|
||||
])
|
||||
->setFinder($finder);
|
@ -26,5 +26,4 @@ use OxidEsales\Eshop\Application\Controller\Admin\AdminController;
|
||||
class TinyFileManager extends AdminController
|
||||
{
|
||||
protected $_sThisTemplate = "TinyFilemanager.tpl";
|
||||
|
||||
}
|
@ -75,7 +75,9 @@ class Configuration
|
||||
|
||||
protected function addOption(OptionInterface $optionInstance): void
|
||||
{
|
||||
if (!$optionInstance->requireRegistration()) return;
|
||||
if (!$optionInstance->requireRegistration()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$option = $optionInstance->get();
|
||||
|
||||
@ -106,10 +108,10 @@ class Configuration
|
||||
*/
|
||||
protected function addIntegrateOptions(): void
|
||||
{
|
||||
$this->addOption(oxNew( Setup::class, $this->loader));
|
||||
$this->addOption(oxNew( BaseUrl::class, $this->loader));
|
||||
$this->addOption(oxNew( CacheSuffix::class, $this->loader));
|
||||
$this->addOption(oxNew( Selector::class, $this->loader));
|
||||
$this->addOption(oxNew(Setup::class, $this->loader));
|
||||
$this->addOption(oxNew(BaseUrl::class, $this->loader));
|
||||
$this->addOption(oxNew(CacheSuffix::class, $this->loader));
|
||||
$this->addOption(oxNew(Selector::class, $this->loader));
|
||||
}
|
||||
|
||||
protected function addGuiOptions(): void
|
||||
@ -127,37 +129,37 @@ class Configuration
|
||||
|
||||
protected function addContentAppearance(): void
|
||||
{
|
||||
$this->addOption(oxNew(ContentCss::class,$this->loader));
|
||||
$this->addOption(oxNew(ContentCss::class, $this->loader));
|
||||
}
|
||||
|
||||
protected function addContentFiltering(): void
|
||||
{
|
||||
$this->addOption(oxNew(EntityEncoding::class,$this->loader));
|
||||
$this->addOption(oxNew(Protect::class,$this->loader));
|
||||
$this->addOption(oxNew(EntityEncoding::class, $this->loader));
|
||||
$this->addOption(oxNew(Protect::class, $this->loader));
|
||||
}
|
||||
|
||||
protected function addLocalizationOptions(): void
|
||||
{
|
||||
$this->addOption(oxNew( Language::class, $this->loader));
|
||||
$this->addOption(oxNew(Language::class, $this->loader));
|
||||
}
|
||||
|
||||
protected function addUrlHandling(): void
|
||||
{
|
||||
$this->addOption(oxNew( DocumentBaseUrl::class, $this->loader));
|
||||
$this->addOption(oxNew( RelativeUrls::class, $this->loader));
|
||||
$this->addOption(oxNew(DocumentBaseUrl::class, $this->loader));
|
||||
$this->addOption(oxNew(RelativeUrls::class, $this->loader));
|
||||
}
|
||||
|
||||
protected function addPlugins(): void
|
||||
{
|
||||
$this->addOption(oxNew( ImageAdvtab::class, $this->loader));
|
||||
$this->addOption(oxNew( Plugins::class, $this->loader));
|
||||
$this->addOption(oxNew( ExternalPlugins::class, $this->loader));
|
||||
$this->addOption(oxNew( FilemanagerUrl::class, $this->loader));
|
||||
$this->addOption(oxNew(ImageAdvtab::class, $this->loader));
|
||||
$this->addOption(oxNew(Plugins::class, $this->loader));
|
||||
$this->addOption(oxNew(ExternalPlugins::class, $this->loader));
|
||||
$this->addOption(oxNew(FilemanagerUrl::class, $this->loader));
|
||||
$this->addOption(oxNew(QuickbarsInsertToolbar::class, $this->loader));
|
||||
}
|
||||
|
||||
protected function addToolbar(): void
|
||||
{
|
||||
$this->addOption(oxNew( Toolbar::class, $this->loader));
|
||||
$this->addOption(oxNew(Toolbar::class, $this->loader));
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,9 @@ class Loader
|
||||
*/
|
||||
public function getEditorCode(): string
|
||||
{
|
||||
if (!$this->isEnabledForCurrentController()) return '';
|
||||
if (!$this->isEnabledForCurrentController()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($this->contentIsPlain()) {
|
||||
/** @var string $message */
|
||||
@ -71,9 +73,9 @@ class Loader
|
||||
protected function isEnabledForCurrentController(): bool
|
||||
{
|
||||
/** @var string[] $aEnabledClasses */
|
||||
$aEnabledClasses = $this->getShopConfig()->getConfigParam( "aTinyMCE_classes", []);
|
||||
$aEnabledClasses = $this->getShopConfig()->getConfigParam("aTinyMCE_classes", []);
|
||||
|
||||
return in_array( $this->getShopConfig()->getActiveView()->getClassKey(), $aEnabledClasses);
|
||||
return in_array($this->getShopConfig()->getActiveView()->getClassKey(), $aEnabledClasses);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,7 +84,7 @@ class Loader
|
||||
protected function contentIsPlain(): bool
|
||||
{
|
||||
/** @var BaseModel|Content $oEditObject */
|
||||
$oEditObject = $this->getShopConfig()->getActiveView()->getViewDataElement( "edit" );
|
||||
$oEditObject = $this->getShopConfig()->getActiveView()->getViewDataElement("edit");
|
||||
return $oEditObject instanceof Content && $oEditObject->isPlain();
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ class ContentCss extends AbstractOption
|
||||
[
|
||||
$this->darkMode ?
|
||||
'dark' :
|
||||
'/out/'.strtolower($theme).'/src/css/styles.min.css'
|
||||
'/out/'.strtolower($theme).'/src/css/styles.min.css',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -35,19 +35,22 @@ class ExternalPlugins extends AbstractOption
|
||||
{
|
||||
$pluginList = oxNew(PluginList::class);
|
||||
|
||||
$list = implode(', ', array_filter(
|
||||
$list = implode(
|
||||
', ',
|
||||
array_filter(
|
||||
array_map(
|
||||
function (PluginInterface $plugin) {
|
||||
return $plugin->getScriptPath() ? implode(
|
||||
':',
|
||||
[
|
||||
(oxNew(Utils::class))->quote($plugin->getPluginName()),
|
||||
(oxNew(Utils::class))->quote($plugin->getScriptPath())
|
||||
(oxNew(Utils::class))->quote($plugin->getScriptPath()),
|
||||
]
|
||||
) : null;
|
||||
},
|
||||
$pluginList->get()
|
||||
))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
return '{ '.$list.' }';
|
||||
|
@ -36,7 +36,7 @@ class Language extends AbstractOption
|
||||
|
||||
$oLang = $this->loader->getLanguage();
|
||||
|
||||
$aLang = array(
|
||||
$aLang = [
|
||||
"cs" => "cs",
|
||||
"da" => "da",
|
||||
"de" => "de",
|
||||
@ -44,9 +44,9 @@ class Language extends AbstractOption
|
||||
"fr" => "fr_FR",
|
||||
"it" => "it_IT",
|
||||
"nl" => "nl",
|
||||
"ru" => "ru"
|
||||
);
|
||||
return $aLang[ $oLang->getLanguageAbbr( (int) $oLang->getTplLanguage() ) ] ?? "en";
|
||||
"ru" => "ru",
|
||||
];
|
||||
return $aLang[ $oLang->getLanguageAbbr((int) $oLang->getTplLanguage()) ] ?? "en";
|
||||
}
|
||||
|
||||
public function mustQuote(): bool
|
||||
|
@ -34,7 +34,7 @@ class QuickbarsInsertToolbar extends AbstractOption
|
||||
public function get(): string
|
||||
{
|
||||
return 'false';
|
||||
/*
|
||||
/*
|
||||
return implode(
|
||||
' | ',
|
||||
[
|
||||
@ -44,7 +44,7 @@ class QuickbarsInsertToolbar extends AbstractOption
|
||||
'pagebreak'
|
||||
]
|
||||
);
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
public function mustQuote(): bool
|
||||
|
@ -33,7 +33,7 @@ class Setup extends AbstractOption
|
||||
(editor) => {
|
||||
editor.options.register("filemanager_url", { processor: "string" });
|
||||
}
|
||||
JS;
|
||||
JS;
|
||||
return trim((string) preg_replace('!\s+!', ' ', $js));
|
||||
}
|
||||
|
||||
|
@ -34,9 +34,9 @@ class Toolbar extends AbstractOption
|
||||
|
||||
protected bool $forceSingleLineToolbar = true;
|
||||
|
||||
public function __construct( Loader $loader )
|
||||
public function __construct(Loader $loader)
|
||||
{
|
||||
parent::__construct( $loader );
|
||||
parent::__construct($loader);
|
||||
}
|
||||
|
||||
public function get(): string
|
||||
|
@ -33,7 +33,7 @@ class Anchor extends AbstractPlugin
|
||||
public function getToolbarElements(): array
|
||||
{
|
||||
return [
|
||||
'anchor'
|
||||
'anchor',
|
||||
];
|
||||
}
|
||||
}
|
@ -33,7 +33,7 @@ class Charmap extends AbstractPlugin
|
||||
public function getToolbarElements(): array
|
||||
{
|
||||
return [
|
||||
'charmap'
|
||||
'charmap',
|
||||
];
|
||||
}
|
||||
}
|
@ -33,7 +33,7 @@ class Code extends AbstractPlugin
|
||||
public function getToolbarElements(): array
|
||||
{
|
||||
return [
|
||||
'code'
|
||||
'code',
|
||||
];
|
||||
}
|
||||
}
|
@ -35,7 +35,7 @@ class FullPage extends AbstractPlugin
|
||||
public function getToolbarElements(): array
|
||||
{
|
||||
return [
|
||||
'fullpage'
|
||||
'fullpage',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ class FullScreen extends AbstractPlugin
|
||||
public function getToolbarElements(): array
|
||||
{
|
||||
return [
|
||||
'fullscreen'
|
||||
'fullscreen',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ class Image extends AbstractPlugin
|
||||
public function getToolbarElements(): array
|
||||
{
|
||||
return [
|
||||
'image'
|
||||
'image',
|
||||
];
|
||||
}
|
||||
}
|
@ -34,7 +34,7 @@ class Link extends AbstractPlugin
|
||||
{
|
||||
return [
|
||||
'link',
|
||||
'unlink'
|
||||
'unlink',
|
||||
];
|
||||
}
|
||||
}
|
@ -33,7 +33,7 @@ class Media extends AbstractPlugin
|
||||
public function getToolbarElements(): array
|
||||
{
|
||||
return [
|
||||
'media'
|
||||
'media',
|
||||
];
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@ class Nonbreaking extends AbstractPlugin
|
||||
public function getToolbarElements(): array
|
||||
{
|
||||
return [
|
||||
'nonbreaking'
|
||||
'nonbreaking',
|
||||
];
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@ class Pagebreak extends AbstractPlugin
|
||||
public function getToolbarElements(): array
|
||||
{
|
||||
return [
|
||||
'pagebreak'
|
||||
'pagebreak',
|
||||
];
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@ class Preview extends AbstractPlugin
|
||||
public function getToolbarElements(): array
|
||||
{
|
||||
return [
|
||||
'preview'
|
||||
'preview',
|
||||
];
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@ class SearchReplace extends AbstractPlugin
|
||||
public function getToolbarElements(): array
|
||||
{
|
||||
return [
|
||||
'searchreplace'
|
||||
'searchreplace',
|
||||
];
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@ class Table extends AbstractPlugin
|
||||
public function getToolbarElements(): array
|
||||
{
|
||||
return [
|
||||
'table'
|
||||
'table',
|
||||
];
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@ class Visualblocks extends AbstractPlugin
|
||||
public function getToolbarElements(): array
|
||||
{
|
||||
return [
|
||||
'visualblocks'
|
||||
'visualblocks',
|
||||
];
|
||||
}
|
||||
}
|
@ -29,7 +29,7 @@ class Color extends AbstractToolbar
|
||||
{
|
||||
return [
|
||||
'forecolor',
|
||||
'backcolor'
|
||||
'backcolor',
|
||||
];
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@ class CopyPaste extends AbstractToolbar
|
||||
return [
|
||||
'cut',
|
||||
'copy',
|
||||
'paste'
|
||||
'paste',
|
||||
];
|
||||
}
|
||||
}
|
@ -32,7 +32,7 @@ class Undo extends AbstractToolbar
|
||||
{
|
||||
return [
|
||||
'undo',
|
||||
'redo'
|
||||
'redo',
|
||||
];
|
||||
}
|
||||
}
|
@ -56,7 +56,7 @@ class ToolbarList
|
||||
'indent' => oxNew(Indent::class),
|
||||
'blockquote' => oxNew(Blockquote::class),
|
||||
'removeformat' => oxNew(RemoveFormat::class),
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -23,5 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
function checkAccess(string $action): void
|
||||
{
|
||||
if($_COOKIE['filemanagerkey'] !== md5($_SERVER['DOCUMENT_ROOT'].$_COOKIE['admin_sid'])) die('Access Denied!!');
|
||||
if ($_COOKIE['filemanagerkey'] !== md5($_SERVER['DOCUMENT_ROOT'].$_COOKIE['admin_sid'])) {
|
||||
die('Access Denied!!');
|
||||
}
|
||||
}
|
@ -49,12 +49,12 @@ function getFilesNumber(string $path, string $type): array
|
||||
}
|
||||
}
|
||||
|
||||
return array('files' => $files, 'dirs' => $dirs);
|
||||
return ['files' => $files, 'dirs' => $dirs];
|
||||
}
|
||||
|
||||
function GetDirs(string $path, string $type): void
|
||||
{
|
||||
$ret = $sort = array();
|
||||
$ret = $sort = [];
|
||||
$files = listDirectory(fixPath($path));
|
||||
foreach ($files as $f) {
|
||||
$fullPath = $path . '/' . $f;
|
||||
@ -62,7 +62,7 @@ function GetDirs(string $path, string $type): void
|
||||
continue;
|
||||
}
|
||||
$tmp = getFilesNumber(fixPath($fullPath), $type);
|
||||
$ret[$fullPath] = array('path' => $fullPath, 'files' => $tmp['files'], 'dirs' => $tmp['dirs']);
|
||||
$ret[$fullPath] = ['path' => $fullPath, 'files' => $tmp['files'], 'dirs' => $tmp['dirs']];
|
||||
$sort[$fullPath] = $f;
|
||||
}
|
||||
natcasesort($sort);
|
||||
|
@ -32,8 +32,9 @@ function t(string $key): string
|
||||
if (defined('LANG')) {
|
||||
if (LANG == 'auto') {
|
||||
$lang = strtolower(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2));
|
||||
if (is_file($langPath . $lang . '.json'))
|
||||
if (is_file($langPath . $lang . '.json')) {
|
||||
$file = $lang . '.json';
|
||||
}
|
||||
} elseif (is_file($langPath . LANG . '.json')) {
|
||||
$file = LANG . '.json';
|
||||
}
|
||||
@ -116,8 +117,9 @@ function getFilesPath(): string
|
||||
if (!$ret) {
|
||||
$ret = RoxyFile::FixPath(BASE_PATH . '/Uploads');
|
||||
$tmp = $_SERVER['DOCUMENT_ROOT'];
|
||||
if (mb_substr($tmp, -1) == '/' || mb_substr($tmp, -1) == '\\')
|
||||
if (mb_substr($tmp, -1) == '/' || mb_substr($tmp, -1) == '\\') {
|
||||
$tmp = mb_substr($tmp, 0, -1);
|
||||
}
|
||||
$ret = str_replace(RoxyFile::FixPath($tmp), '', $ret);
|
||||
}
|
||||
return $ret;
|
||||
@ -146,7 +148,7 @@ function listDirectory(string $path): array
|
||||
|
||||
class RoxyFile
|
||||
{
|
||||
static public function CheckWritable(string $dir): bool
|
||||
public static function CheckWritable(string $dir): bool
|
||||
{
|
||||
$ret = false;
|
||||
if (self::CreatePath($dir)) {
|
||||
@ -167,16 +169,17 @@ class RoxyFile
|
||||
* @param $path
|
||||
* @return bool
|
||||
*/
|
||||
static public function CreatePath(string $path): bool
|
||||
public static function CreatePath(string $path): bool
|
||||
{
|
||||
if (is_dir($path))
|
||||
if (is_dir($path)) {
|
||||
return true;
|
||||
$prev_path = substr($path, 0, strrpos($path, '/', -2) + 1 );
|
||||
}
|
||||
$prev_path = substr($path, 0, strrpos($path, '/', -2) + 1);
|
||||
$return = self::createPath($prev_path);
|
||||
return $return && is_writable($prev_path) && mkdir($path);
|
||||
}
|
||||
|
||||
static function CanUploadFile(string $filename): bool
|
||||
public static function CanUploadFile(string $filename): bool
|
||||
{
|
||||
$forbidden = array_filter((array) preg_split('/[^\d\w]+/', strtolower(FORBIDDEN_UPLOADS)));
|
||||
$allowed = array_filter((array) preg_split('/[^\d\w]+/', strtolower(ALLOWED_UPLOADS)));
|
||||
@ -189,7 +192,7 @@ class RoxyFile
|
||||
return false;
|
||||
}
|
||||
|
||||
static public function ZipAddDir(string $path, ZipArchive $zip, string $zipPath): void
|
||||
public static function ZipAddDir(string $path, ZipArchive $zip, string $zipPath): void
|
||||
{
|
||||
$d = opendir($path);
|
||||
$zipPath = str_replace('//', '/', $zipPath);
|
||||
@ -198,8 +201,9 @@ class RoxyFile
|
||||
}
|
||||
if (is_resource($d)) {
|
||||
while (($f = readdir($d)) !== false) {
|
||||
if ($f == '.' || $f == '..')
|
||||
if ($f == '.' || $f == '..') {
|
||||
continue;
|
||||
}
|
||||
$filePath = $path . '/' . $f;
|
||||
if (is_file($filePath)) {
|
||||
$zip->addFile($filePath, ($zipPath ? $zipPath . '/' : '') . $f);
|
||||
@ -213,7 +217,7 @@ class RoxyFile
|
||||
}
|
||||
}
|
||||
|
||||
static public function ZipDir(string $path, string $zipFile, string $zipPath = ''): void
|
||||
public static function ZipDir(string $path, string $zipFile, string $zipPath = ''): void
|
||||
{
|
||||
$zip = new ZipArchive();
|
||||
$zip->open($zipFile, ZIPARCHIVE::CREATE);
|
||||
@ -221,7 +225,7 @@ class RoxyFile
|
||||
$zip->close();
|
||||
}
|
||||
|
||||
static public function IsImage(string $fileName): bool
|
||||
public static function IsImage(string $fileName): bool
|
||||
{
|
||||
$ext = strtolower(self::GetExtension($fileName));
|
||||
|
||||
@ -230,7 +234,7 @@ class RoxyFile
|
||||
return in_array($ext, $imageExtensions);
|
||||
}
|
||||
|
||||
static public function IsFlash(string $fileName): bool
|
||||
public static function IsFlash(string $fileName): bool
|
||||
{
|
||||
$ext = strtolower(self::GetExtension($fileName));
|
||||
|
||||
@ -245,7 +249,7 @@ class RoxyFile
|
||||
* @param int $filesize
|
||||
* @return string
|
||||
*/
|
||||
static public function FormatFileSize(int $filesize): string
|
||||
public static function FormatFileSize(int $filesize): string
|
||||
{
|
||||
$unit = 'B';
|
||||
if ($filesize > 1024) {
|
||||
@ -271,7 +275,7 @@ class RoxyFile
|
||||
* @param string $filename
|
||||
* @return string
|
||||
*/
|
||||
static public function GetMIMEType(string $filename): string
|
||||
public static function GetMIMEType(string $filename): string
|
||||
{
|
||||
$ext = self::GetExtension($filename);
|
||||
|
||||
@ -313,7 +317,7 @@ class RoxyFile
|
||||
* @param string $sep
|
||||
* @return string
|
||||
*/
|
||||
static public function CleanupFilename(string $filename, string $sep = '_'): string
|
||||
public static function CleanupFilename(string $filename, string $sep = '_'): string
|
||||
{
|
||||
$str = '';
|
||||
if (strpos($filename, '.')) {
|
||||
@ -340,7 +344,7 @@ class RoxyFile
|
||||
* @param string $filename
|
||||
* @return string
|
||||
*/
|
||||
static public function GetExtension(string $filename): string
|
||||
public static function GetExtension(string $filename): string
|
||||
{
|
||||
$ext = '';
|
||||
|
||||
@ -357,7 +361,7 @@ class RoxyFile
|
||||
* @param string $filename
|
||||
* @return string
|
||||
*/
|
||||
static public function GetName(string $filename): string
|
||||
public static function GetName(string $filename): string
|
||||
{
|
||||
$tmp = mb_strpos($filename, '?');
|
||||
if ($tmp !== false) {
|
||||
@ -373,7 +377,7 @@ class RoxyFile
|
||||
return $name;
|
||||
}
|
||||
|
||||
static public function GetFullName(string $filename): string
|
||||
public static function GetFullName(string $filename): string
|
||||
{
|
||||
$tmp = mb_strpos($filename, '?');
|
||||
if ($tmp !== false) {
|
||||
@ -382,7 +386,7 @@ class RoxyFile
|
||||
return basename($filename);
|
||||
}
|
||||
|
||||
static public function FixPath(string $path): string
|
||||
public static function FixPath(string $path): string
|
||||
{
|
||||
$path = (string) mb_ereg_replace('[\\\/]+', '/', $path);
|
||||
$path = (string) mb_ereg_replace('\.\.\/', '', $path);
|
||||
@ -397,7 +401,7 @@ class RoxyFile
|
||||
* @param string $filename
|
||||
* @return string
|
||||
*/
|
||||
static public function MakeUniqueFilename(string $dir, string $filename): string
|
||||
public static function MakeUniqueFilename(string $dir, string $filename): string
|
||||
{
|
||||
;
|
||||
$dir .= '/';
|
||||
@ -429,7 +433,7 @@ class RoxyFile
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
static public function MakeUniqueDirname(string $dir, string $name): string
|
||||
public static function MakeUniqueDirname(string $dir, string $name): string
|
||||
{
|
||||
$dir = self::FixPath($dir . '/');
|
||||
$name = mb_ereg_replace(' - Copy \\d+$', '', $name);
|
||||
@ -463,11 +467,11 @@ class RoxyImage
|
||||
|
||||
public static function OutputImage($img, string $type, ?string $destination = '', int $quality = 90)
|
||||
{
|
||||
if(is_string($img)) {
|
||||
if (is_string($img)) {
|
||||
$img = self::GetImage($img);
|
||||
}
|
||||
|
||||
switch(strtolower($type)){
|
||||
switch (strtolower($type)) {
|
||||
case 'png':
|
||||
imagepng($img, $destination);
|
||||
break;
|
||||
@ -497,8 +501,7 @@ class RoxyImage
|
||||
int $width = 150,
|
||||
int $height = 0,
|
||||
int $quality = 90
|
||||
): void
|
||||
{
|
||||
): void {
|
||||
$tmp = (array) getimagesize($source);
|
||||
$w = $tmp[0];
|
||||
$h = $tmp[1];
|
||||
@ -534,8 +537,7 @@ class RoxyImage
|
||||
int $width,
|
||||
int $height,
|
||||
int $quality = 90
|
||||
): void
|
||||
{
|
||||
): void {
|
||||
$tmp = (array) getimagesize($source);
|
||||
$w = $tmp[0];
|
||||
$h = $tmp[1];
|
||||
@ -576,8 +578,7 @@ class RoxyImage
|
||||
int $width,
|
||||
int $height,
|
||||
int $quality = 90
|
||||
): void
|
||||
{
|
||||
): void {
|
||||
$thumbImg = imagecreatetruecolor($width, $height);
|
||||
$img = self::GetImage($source);
|
||||
|
||||
|
@ -23,5 +23,7 @@
|
||||
function checkAccess(string $action): void
|
||||
{
|
||||
unset($action);
|
||||
if($_COOKIE['filemanagerkey'] !== md5_file("../../../../../../config.inc.php")) die('nice try, noob.');
|
||||
if ($_COOKIE['filemanagerkey'] !== md5_file("../../../../../../config.inc.php")) {
|
||||
die('nice try, noob.');
|
||||
}
|
||||
}
|
@ -39,7 +39,8 @@ $w = intval(empty($_GET['width']) ? '100' : $_GET['width']);
|
||||
$h = intval(empty($_GET['height']) ? '0' : $_GET['height']);
|
||||
|
||||
header('Content-type: '.RoxyFile::GetMIMEType(basename($path)));
|
||||
if($w && $h)
|
||||
if ($w && $h) {
|
||||
RoxyImage::CropCenter(fixPath($path), null, $w, $h);
|
||||
else
|
||||
} else {
|
||||
RoxyImage::Resize(fixPath($path), null, $w, $h);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ $isAjax = (isset($_POST['method']) && $_POST['method'] == 'ajax');
|
||||
$path = RoxyFile::FixPath(trim(empty($_POST['d']) ? getFilesPath() : $_POST['d']));
|
||||
verifyPath($path);
|
||||
$res = '';
|
||||
$errors = $errorsExt = array();
|
||||
$errors = $errorsExt = [];
|
||||
|
||||
if (is_dir(fixPath($path))) {
|
||||
if (!empty($_FILES['files']) && is_array($_FILES['files']['tmp_name'])) {
|
||||
|
@ -23,8 +23,7 @@
|
||||
error_reporting(0);
|
||||
ini_set('display_errors', 'off');
|
||||
// You DON'T have to make any changes to this file. For Roxy Fileman user configuration see conf.json file.
|
||||
define('BASE_PATH', dirname (__FILE__));
|
||||
define('BASE_PATH', dirname(__FILE__));
|
||||
date_default_timezone_set('UTC');
|
||||
mb_internal_encoding("UTF-8");
|
||||
mb_regex_encoding(mb_internal_encoding());
|
||||
?>
|
@ -1,2 +1,3 @@
|
||||
<?php
|
||||
|
||||
include("../en/module_options.php");
|
||||
|
@ -1,2 +1,3 @@
|
||||
<?php
|
||||
|
||||
include("../en/module_options.php");
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
$sLangName = 'Deutsch';
|
||||
$aLang = array(
|
||||
$aLang = [
|
||||
'charset' => 'UTF-8',
|
||||
'TINYMCE_TOGGLE' => 'Editor zeigen/verstecken',
|
||||
'TINYMCE_PLAINCMS' => '<b class="errorbox">Der Editor wurde für diese Seite deaktiviert, weil sie keine HTML Formatierung enthalten darf </b>',
|
||||
@ -33,4 +33,4 @@ $aLang = array(
|
||||
'SHOP_MODULE_aTinyMCE_extjs' => '<h3>Externe JS Abhängigkeiten</h3>',
|
||||
'HELP_SHOP_MODULE_aTinyMCE_extjs' => 'Komplette URL mit https://.',
|
||||
'SHOP_MODULE_GROUP_tinyMceSettings' => 'TinyMCE Einstellungen & Plugins',
|
||||
);
|
||||
];
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
$sLangName = 'English';
|
||||
$aLang = array(
|
||||
$aLang = [
|
||||
'charset' => 'UTF-8',
|
||||
'TINYMCE_TOGGLE' => 'toggle editor',
|
||||
'TINYMCE_PLAINCMS' => '<b class="errorbox">The editor was disabled for this page because it may not contain HTML code</b>',
|
||||
@ -33,4 +33,4 @@ $aLang = array(
|
||||
'SHOP_MODULE_aTinyMCE_extjs' => '<h3>external JS dependencies</h3> (e.g. for plugins)',
|
||||
'HELP_SHOP_MODULE_aTinyMCE_extjs' => 'Full URL with https://.',
|
||||
'SHOP_MODULE_GROUP_tinyMceSettings' => 'TinyMCE Settings & Plugins',
|
||||
);
|
||||
];
|
||||
|
@ -1,2 +1,3 @@
|
||||
<?php
|
||||
|
||||
include("../en/module_options.php");
|
||||
|
@ -1,2 +1,3 @@
|
||||
<?php
|
||||
|
||||
include("../en/module_options.php");
|
||||
|
@ -1,2 +1,3 @@
|
||||
<?php
|
||||
|
||||
include("../en/module_options.php");
|
||||
|
@ -1,2 +1,3 @@
|
||||
<?php
|
||||
|
||||
include("../en/module_options.php");
|
||||
|
24
metadata.php
24
metadata.php
@ -29,21 +29,21 @@ $aModule = [
|
||||
'author' => 'Marat Bedoev, O3-Shop',
|
||||
'url' => 'https://www.o3-shop.com/',
|
||||
'extend' => [
|
||||
OxidEsales\Eshop\Core\ViewConfig::class => O3\TinyMCE\Application\Core\ViewConfig::class
|
||||
OxidEsales\Eshop\Core\ViewConfig::class => O3\TinyMCE\Application\Core\ViewConfig::class,
|
||||
],
|
||||
'controllers' => [
|
||||
'tinyfilemanager' => O3\TinyMCE\Application\Controller\Admin\TinyFileManager::class
|
||||
'tinyfilemanager' => O3\TinyMCE\Application\Controller\Admin\TinyFileManager::class,
|
||||
],
|
||||
'templates' => [
|
||||
'TinyFilemanager.tpl' => 'o3-shop/tinymce-editor/Application/views/admin/filemanager.tpl',
|
||||
'EditorSwitch.tpl' => 'o3-shop/tinymce-editor/Application/views/admin/editorswitch.tpl'
|
||||
'EditorSwitch.tpl' => 'o3-shop/tinymce-editor/Application/views/admin/editorswitch.tpl',
|
||||
],
|
||||
'blocks' => [
|
||||
[
|
||||
'template' => 'bottomnaviitem.tpl',
|
||||
'block' => 'admin_bottomnaviitem',
|
||||
'file' => 'Application/views/blocks/admin/bottomnaviitem_admin_bottomnaviitem.tpl'
|
||||
]
|
||||
'file' => 'Application/views/blocks/admin/bottomnaviitem_admin_bottomnaviitem.tpl',
|
||||
],
|
||||
],
|
||||
'settings' => [
|
||||
/* enabling tinyMCE for these classes */
|
||||
@ -56,30 +56,30 @@ $aModule = [
|
||||
"category_text",
|
||||
"content_main",
|
||||
"newsletter_main",
|
||||
"news_text"
|
||||
"news_text",
|
||||
],
|
||||
'position' => 0
|
||||
'position' => 0,
|
||||
],
|
||||
[
|
||||
'group' => 'tinyMceMain',
|
||||
'name' => 'blTinyMCE_filemanager',
|
||||
'type' => 'bool',
|
||||
'value' => true,
|
||||
'position' => 2
|
||||
'position' => 2,
|
||||
],
|
||||
[
|
||||
'group' => 'tinyMceMain',
|
||||
'name' => 'sTinyMCE_apikey',
|
||||
'type' => 'str',
|
||||
'value' => '',
|
||||
'position' => 3
|
||||
'position' => 3,
|
||||
],
|
||||
[
|
||||
'group' => 'tinyMceMain',
|
||||
'name' => 'aTinyMCE_extjs',
|
||||
'type' => 'arr',
|
||||
'value' => [],
|
||||
'position' => 4
|
||||
]
|
||||
]
|
||||
'position' => 4,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user