refactoring

This commit is contained in:
O3-Shop 2023-04-05 08:27:08 +02:00
parent 42a11bcf9c
commit efa900bb91
76 changed files with 3119 additions and 368 deletions

View File

@ -0,0 +1,166 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE;
use O3\TinyMCE\Application\Core\TinyMCE\Options\BaseUrl;
use O3\TinyMCE\Application\Core\TinyMCE\Options\CacheSuffix;
use O3\TinyMCE\Application\Core\TinyMCE\Options\ContentCss;
use O3\TinyMCE\Application\Core\TinyMCE\Options\ContextMenu;
use O3\TinyMCE\Application\Core\TinyMCE\Options\DocumentBaseUrl;
use O3\TinyMCE\Application\Core\TinyMCE\Options\EntityEncoding;
use O3\TinyMCE\Application\Core\TinyMCE\Options\ExternalPlugins;
use O3\TinyMCE\Application\Core\TinyMCE\Options\FilemanagerUrl;
use O3\TinyMCE\Application\Core\TinyMCE\Options\ImageAdvtab;
use O3\TinyMCE\Application\Core\TinyMCE\Options\Language;
use O3\TinyMCE\Application\Core\TinyMCE\Options\MaxHeight;
use O3\TinyMCE\Application\Core\TinyMCE\Options\MaxWidth;
use O3\TinyMCE\Application\Core\TinyMCE\Options\Menubar;
use O3\TinyMCE\Application\Core\TinyMCE\Options\MinHeight;
use O3\TinyMCE\Application\Core\TinyMCE\Options\OptionInterface;
use O3\TinyMCE\Application\Core\TinyMCE\Options\Plugins;
use O3\TinyMCE\Application\Core\TinyMCE\Options\Protect;
use O3\TinyMCE\Application\Core\TinyMCE\Options\QuickbarsInsertToolbar;
use O3\TinyMCE\Application\Core\TinyMCE\Options\RelativeUrls;
use O3\TinyMCE\Application\Core\TinyMCE\Options\Selector;
use O3\TinyMCE\Application\Core\TinyMCE\Options\Toolbar;
use O3\TinyMCE\Application\Core\TinyMCE\Options\ToolbarSticky;
class Configuration
{
protected Loader $loader;
protected array $options = [];
public function __construct(Loader $loader)
{
$this->loader = $loader;
}
public function build(): void
{
$this->addIntegrateOptions();
$this->addGuiOptions();
$this->addContentAppearance();
$this->addContentFiltering();
$this->addLocalizationOptions();
$this->addUrlHandling();
$this->addPlugins();
$this->addToolbar();
}
protected function addOption($key, OptionInterface $optionInstance): void
{
if (!$optionInstance->requireRegistration()) return;
$option = $optionInstance->get();
if ($optionInstance->mustQuote()) {
$option = (oxNew(Utils::class))->quote($option);
}
$this->options[$key] = $option;
}
public function getConfig()
{
/*
return implode(', ', array_map(
function ($v, $k) {
if (is_array($v)) {
return $k.'[]='.implode('&'.$k.'[]=', $v);
} else {
return $k.': '.$v;
}
},
$this->options,
array_keys($this->options)
));
http_build_query($this->options,'',', ')
*/
// $config = json_encode($this->options);
foreach ($this->options as $param => $value) {
$sConfig .= "$param: $value, ";
}
return $sConfig;
}
/**
* @return void
*/
protected function addIntegrateOptions(): void
{
$this->addOption( BaseUrl::KEY, oxNew( BaseUrl::class, $this->loader));
$this->addOption( CacheSuffix::KEY, oxNew( CacheSuffix::class, $this->loader));
$this->addOption( Selector::KEY, oxNew( Selector::class, $this->loader));
}
protected function addGuiOptions(): void
{
$this->addOption(ContextMenu::KEY, oxNew(ContextMenu::class, $this->loader));
$this->addOption(MinHeight::KEY, oxNew(MinHeight::class, $this->loader));
$this->addOption(MaxHeight::KEY, oxNew(MaxHeight::class, $this->loader));
$this->addOption(MaxWidth::KEY, oxNew(MaxWidth::class, $this->loader));
$this->addOption(Menubar::KEY, oxNew(Menubar::class, $this->loader));
$this->addOption(ToolbarSticky::KEY, oxNew(ToolbarSticky::class, $this->loader));
}
protected function addContentAppearance(): void
{
$this->addOption(ContentCss::KEY, oxNew(ContentCss::class,$this->loader));
}
protected function addContentFiltering(): void
{
$this->addOption(EntityEncoding::KEY, oxNew(EntityEncoding::class,$this->loader));
$this->addOption(Protect::KEY, oxNew(Protect::class,$this->loader));
}
protected function addLocalizationOptions(): void
{
$this->addOption( Language::KEY, oxNew( Language::class, $this->loader));
}
protected function addUrlHandling(): void
{
$this->addOption( DocumentBaseUrl::KEY, oxNew( DocumentBaseUrl::class, $this->loader));
$this->addOption( RelativeUrls::KEY, oxNew( RelativeUrls::class, $this->loader));
}
protected function addPlugins(): void
{
$this->addOption( ImageAdvtab::KEY, oxNew( ImageAdvtab::class, $this->loader));
$this->addOption( Plugins::KEY, oxNew( Plugins::class, $this->loader));
$this->addOption( ExternalPlugins::KEY, oxNew( ExternalPlugins::class, $this->loader));
$this->addOption( FilemanagerUrl::KEY, oxNew( FilemanagerUrl::class, $this->loader));
$this->addOption(QuickbarsInsertToolbar::KEY, oxNew(QuickbarsInsertToolbar::class, $this->loader));
}
protected function addToolbar(): void
{
$this->addOption( Toolbar::KEY, oxNew( Toolbar::class, $this->loader));
}
}

View File

@ -0,0 +1,147 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE;
use OxidEsales\Eshop\Application\Model\Content;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Language;
use OxidEsales\Eshop\Core\Model\BaseModel;
use OxidEsales\Eshop\Core\Registry;
class Loader
{
protected Config $config;
protected Language $language;
public function __construct(Config $config, Language $language)
{
$this->config = $config;
$this->language = $language;
}
/**
* @return string
*/
public function getEditorSwitch(): string
{
if (!$this->isEnabledForCurrentController()) return '';
if ($this->contentIsPlain()) return $this->language->translateString('BLA_TINYMCE_PLAINCMS');
$configuration = oxNew(Configuration::class, $this);
$configuration->build();
$this->registerScripts($configuration);
$this->registerIncludes();
$smarty = Registry::getUtilsView()->getSmarty();
return $smarty->fetch('EditorSwitch.tpl');
}
/**
* @return bool
*/
protected function isEnabledForCurrentController(): bool
{
$aEnabledClasses = $this->getShopConfig()->getConfigParam( "aTinyMCE_classes", []);
return in_array( $this->getShopConfig()->getActiveView()->getClassKey(), $aEnabledClasses);
}
/**
* @return bool
*/
protected function contentIsPlain(): bool
{
/** @var BaseModel $oEditObject */
$oEditObject = $this->getShopConfig()->getActiveView()->getViewDataElement( "edit" );
return $oEditObject instanceof Content && $oEditObject->isPlain();
}
/**
* @return Language
*/
public function getLanguage(): Language
{
return $this->language;
}
/**
* @return Config
*/
public function getShopConfig(): Config
{
return $this->config;
}
/**
* @param Configuration $configuration
*
* @return void
*/
protected function registerScripts(Configuration $configuration): void
{
$sCopyLongDescFromTinyMCE = file_get_contents(__DIR__.'/../../../out/scripts/copyLongDesc.js');
$sUrlConverter = file_get_contents(__DIR__.'/../../../out/scripts/urlConverter.js');
$sInit = str_replace(
"'CONFIG':'VALUES'",
$configuration->getConfig(),
file_get_contents(__DIR__.'/../../../out/scripts/init.js')
);
dumpvar($sInit.PHP_EOL, 1);
$smarty = Registry::getUtilsView()->getSmarty();
$sSufix = ($smarty->_tpl_vars["__oxid_include_dynamic"]) ? '_dynamic' : '';
$aScript = (array) Registry::getConfig()->getGlobalParameter('scripts' . $sSufix);
$aScript[] = $sCopyLongDescFromTinyMCE;
$aScript[] = $sUrlConverter;
$aScript[] = $sInit;
Registry::getConfig()->setGlobalParameter('scripts' . $sSufix, $aScript);
}
/**
* @return void
* @throws \oxFileException
*/
protected function registerIncludes(): void
{
$smarty = Registry::getUtilsView()->getSmarty();
$sSuffix = ($smarty->_tpl_vars["__oxid_include_dynamic"]) ? '_dynamic' : '';
$aInclude = (array) Registry::getConfig()->getGlobalParameter('includes' . $sSuffix);
$aExtjs = Registry::getConfig()->getConfigParam('aTinyMCE_extjs', []);
foreach ($aExtjs as $js) {
$aInclude[3][] = $js;
}
$aInclude[3][] = Registry::getConfig()->getActiveView()->getViewConfig()->getModuleUrl(
'tinymce-editor',
'out/tinymce/tinymce.min.js'
);
Registry::getConfig()->setGlobalParameter('includes' . $sSuffix, $aInclude);
}
}

View File

@ -0,0 +1,48 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
use O3\TinyMCE\Application\Core\TinyMCE\Loader;
abstract class AbstractOption implements OptionInterface
{
protected Loader $loader;
public function __construct(Loader $loader)
{
$this->loader = $loader;
}
abstract public function get(): string;
public function mustQuote(): bool
{
return false;
}
public function requireRegistration(): bool
{
return true;
}
}

View File

@ -0,0 +1,46 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
class BaseUrl extends AbstractOption
{
public const KEY = 'base_url';
/**
* @return string
*/
public function get(): string
{
return $this->loader->getShopConfig()->getActiveView()->getViewConfig()->getBaseDir() .
'modules/o3-shop/tinymce-editor/out/tinymce/';
}
/**
* @return bool
*/
public function mustQuote(): bool
{
return true;
}
}

View File

@ -0,0 +1,43 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
use O3\TinyMCE\Application\Core\TinyMCE\Loader;
class CacheSuffix extends AbstractOption
{
public const KEY = 'cache_suffix';
protected Loader $loader;
public function get(): string
{
return '?v='.date('Ymd');
}
public function mustQuote(): bool
{
return true;
}
}

View File

@ -0,0 +1,44 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
use O3\TinyMCE\Application\Core\TinyMCE\Loader;
class ContentCss extends AbstractOption
{
public const KEY = 'content_css';
protected Loader $loader;
public function get(): string
{
// ToDo: use current theme
return '/out/wave/src/css/styles.min.css';
}
public function mustQuote(): bool
{
return true;
}
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
class ContextMenu extends AbstractOption
{
public const KEY = 'contextmenu';
public function get(): string
{
return 'link linkchecker image imagetools table';
}
public function mustQuote(): bool
{
return true;
}
}

View File

@ -0,0 +1,41 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
use OxidEsales\Eshop\Core\Registry;
class DocumentBaseUrl extends AbstractOption
{
public const KEY = 'document_base_url';
public function get(): string
{
return Registry::getConfig()->getActiveView()->getViewConfig()->getBaseDir();
}
public function mustQuote(): bool
{
return true;
}
}

View File

@ -0,0 +1,43 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
use O3\TinyMCE\Application\Core\TinyMCE\Loader;
class EntityEncoding extends AbstractOption
{
public const KEY = 'entity_encoding';
protected Loader $loader;
public function get(): string
{
return 'raw';
}
public function mustQuote(): bool
{
return true;
}
}

View File

@ -0,0 +1,63 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
use O3\TinyMCE\Application\Core\TinyMCE\PluginList;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\PluginInterface;
use O3\TinyMCE\Application\Core\TinyMCE\Utils;
class ExternalPlugins extends AbstractOption
{
public const KEY = 'external_plugins';
public function get(): string
{
$pluginList = oxNew(PluginList::class);
$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())
]
) : null;
},
$pluginList->get()
))
);
return '{ '.$list.' }';
// plugins for newsletter emails
if ( $this->getActiveClassName() === "newsletter_main" ) {
$aPlugins["legacyoutput"] = "";
$aPlugins["fullpage"] = "fullpage";
}
return 350;
}
}

View File

@ -0,0 +1,60 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
use O3\TinyMCE\Application\Core\TinyMCE\Loader;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\UtilsServer;
class FilemanagerUrl extends AbstractOption
{
public const KEY = 'filemanager_url';
protected Loader $loader;
public function get(): string
{
$sFilemanagerKey = md5_file(Registry::getConfig()->getConfigParam("sShopDir")."/config.inc.php");
Registry::get(UtilsServer::class)->setOxCookie("filemanagerkey", $sFilemanagerKey);
return str_replace(
'&amp;',
'&',
Registry::getConfig()->getActiveView()->getViewConfig()->getSslSelfLink()."cl=tinyfilemanager"
);
}
public function mustQuote(): bool
{
return true;
}
/**
* @return bool
*/
public function requireRegistration(): bool
{
return (bool) $this->loader->getShopConfig()->getConfigParam("blTinyMCE_filemanager");
}
}

View File

@ -0,0 +1,34 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
class ImageAdvtab extends AbstractOption
{
public const KEY = 'image_advtab';
public function get(): string
{
return 'true';
}
}

View File

@ -0,0 +1,58 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
class Language extends AbstractOption
{
public const KEY = 'language';
/**
* @return string
*/
public function get(): string
{
// https://www.tiny.cloud/docs/configure/localization/#language
$oLang = $this->loader->getLanguage();
$aLang = array(
"cs" => "cs",
"da" => "da",
"de" => "de",
"es" => "es_419",
"fr" => "fr_FR",
"it" => "it_IT",
"nl" => "nl",
"ru" => "ru"
);
$sLang = $aLang[ $oLang->getLanguageAbbr( $oLang->getTplLanguage() ) ] ?? "en";
return $sLang;
}
public function mustQuote(): bool
{
return true;
}
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
class MaxHeight extends AbstractOption
{
public const KEY = 'max_height';
public function get(): string
{
return '90%';
}
public function mustQuote(): bool
{
return true;
}
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
class MaxWidth extends AbstractOption
{
public const KEY = 'max_width';
public function get(): string
{
return '90%';
}
public function mustQuote(): bool
{
return true;
}
}

View File

@ -0,0 +1,34 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
class Menubar extends AbstractOption
{
public const KEY = 'menubar';
public function get(): string
{
return 'false';
}
}

View File

@ -0,0 +1,34 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
class MinHeight extends AbstractOption
{
public const KEY = 'min_height';
public function get(): string
{
return '350';
}
}

View File

@ -0,0 +1,37 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
use O3\TinyMCE\Application\Core\TinyMCE\Loader;
interface OptionInterface
{
public function __construct(Loader $loader);
public function get(): string;
public function mustQuote(): bool;
public function requireRegistration(): bool;
}

View File

@ -0,0 +1,89 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
use O3\TinyMCE\Application\Core\TinyMCE\PluginList;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\PluginInterface;
class Plugins extends AbstractOption
{
public const KEY = 'plugins';
public function get(): string
{
$pluginList = oxNew(PluginList::class);
return implode(' ', array_filter(
array_map(
function (PluginInterface $plugin) {
return $plugin->requireRegistration() ?
$plugin->getPluginName() :
null
;
},
$pluginList->get()
)
));
$aPlugins = array(
//'advlist' => '', // '' = plugin has no buttons
'anchor' => 'anchor',
'autolink' => '',
'autoresize' => '',
'charmap' => 'charmap',
'code' => 'code',
'hr' => 'hr',
'image' => 'image',
// 'imagetools' => '', // das hier klingt sehr kompliziert
'link' => 'link unlink',
'lists' => '',
'media' => 'media',
'nonbreaking' => 'nonbreaking',
'pagebreak' => 'pagebreak',
'paste' => 'pastetext',
'preview' => 'preview',
'quickbars' => '',//'quicklink quickimage quicktable',
'searchreplace' => 'searchreplace',
'table' => 'table',
'visualblocks' => 'visualblocks',
'wordcount' => '',
'oxfullscreen' => 'fullscreen', //custom fullscreen plugin
//'oxwidget' => 'widget'
//'oxgetseourl' => 'yolo' //custom seo url plugin // wip
);
// plugins for newsletter emails
if ( $this->getActiveClassName() === "newsletter_main" ) {
$aPlugins["legacyoutput"] = "";
$aPlugins["fullpage"] = "fullpage";
}
return 350;
}
public function mustQuote(): bool
{
return true;
}
}

View File

@ -0,0 +1,36 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
class Protect extends AbstractOption
{
public const KEY = 'protect';
public function get(): string
{
// ToDo: check this regexp
return '[ /\[\{((?!\}\]).)+\}\]/gm ]';
}
}

View File

@ -0,0 +1,66 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
use O3\TinyMCE\Application\Core\TinyMCE\PluginList;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\PluginInterface;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Quickbars;
use O3\TinyMCE\Application\Core\TinyMCE\Utils;
class QuickbarsInsertToolbar extends AbstractOption
{
public const KEY = 'quickbars_insert_toolbar';
public function get(): string
{
return implode(
' | ',
[
'quicktable',
'hr',
'pagebreak'
]
);
}
public function mustQuote(): bool
{
return true;
}
public function requireRegistration(): bool
{
$pluginList = oxNew(PluginList::class);
return in_array(
true,
array_map(
function (PluginInterface $plugin) {
return $plugin instanceof Quickbars;
},
$pluginList->get(),
)
);
}
}

View File

@ -0,0 +1,34 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
class RelativeUrls extends AbstractOption
{
public const KEY = 'relative_urls';
public function get(): string
{
return 'true';
}
}

View File

@ -0,0 +1,36 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
use O3\TinyMCE\Application\Core\TinyMCE\Loader;
class Selector extends AbstractOption
{
public const KEY = 'selector';
public function get(): string
{
return '"textarea:not(.mceNoEditor)"';
}
}

View File

@ -0,0 +1,80 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
use O3\TinyMCE\Application\Core\TinyMCE\Loader;
use O3\TinyMCE\Application\Core\TinyMCE\PluginList;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\PluginInterface;
use O3\TinyMCE\Application\Core\TinyMCE\ToolbarList;
class Toolbar extends AbstractOption
{
public const KEY = 'toolbar';
public function __construct( Loader $loader )
{
parent::__construct( $loader );
}
public function get(): string
{
$toolbarList = oxNew(ToolbarList::class);
$list = [];
foreach ($toolbarList->get() as $toolbar) {
$list[] = implode(
' | ',
array_filter(
array_map(
function ($toolbarElement) {
return implode(
' ',
$toolbarElement->getButtons()
);
},
$toolbar
)
)
);
}
$pluginList = oxNew(PluginList::class);
$list[] = $pluginToolbarElements = implode(
' | ',
array_filter(
array_map(
function (PluginInterface $plugin) {
return count($plugin->getToolbarElements()) ? implode(
' ',
$plugin->getToolbarElements()
) : null;
},
$pluginList->get()
)
)
);
return '["'.implode('", "', $list).'"]';
}
}

View File

@ -0,0 +1,34 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Options;
class ToolbarSticky extends AbstractOption
{
public const KEY = 'toolbar_sticky';
public function get(): string
{
return 'true';
}
}

View File

@ -0,0 +1,80 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Anchor;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Autolink;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\AutoResize;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Charmap;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Code;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\FullPage;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\FullScreen;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Hr;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Image;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Legacyoutput;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Link;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Lists;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Media;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Nonbreaking;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Pagebreak;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Paste;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Preview;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Quickbars;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Roxy;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\SearchReplace;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Table;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\Visualblocks;
use O3\TinyMCE\Application\Core\TinyMCE\Plugins\WordCount;
class PluginList
{
public function get(): array
{
return [
'anchor' => oxNew(Anchor::class),
'autolink' => oxNew(Autolink::class),
'autoresize' => oxNew(AutoResize::class),
'charmap' => oxNew(Charmap::class),
'code' => oxNew(Code::class),
'fullpage' => oxNew(FullPage::class),
'hr' => oxNew(Hr::class),
'image' => oxNew(Image::class),
'legacyoutput' => oxNew(Legacyoutput::class),
'link' => oxNew(Link::class),
'lists' => oxNew(Lists::class),
'media' => oxNew(Media::class),
'nonbreaking' => oxNew(Nonbreaking::class),
'pagebreak' => oxNew(Pagebreak::class),
'paste' => oxNew(Paste::class),
'preview' => oxNew(Preview::class),
'quickbars' => oxNew(Quickbars::class),
'searchreplace' => oxNew(SearchReplace::class),
'table' => oxNew(Table::class),
'visualblocks' => oxNew(Visualblocks::class),
'wordcount' => oxNew(WordCount::class),
'fullscreen' => oxNew(FullScreen::class),
'roxy' => oxNew(Roxy::class),
];
}
}

View File

@ -0,0 +1,49 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
abstract class AbstractPlugin implements PluginInterface
{
abstract public function getPluginName(): string;
public function getToolbarElements(): array
{
return [];
}
public function getScriptPath(): ?string
{
return null;
}
public function requireRegistration(): bool
{
return true;
}
public function requireScript(): bool
{
return true;
}
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class Anchor extends AbstractPlugin
{
public function getPluginName(): string
{
return 'anchor';
}
public function getToolbarElements(): array
{
return [
'anchor'
];
}
}

View File

@ -0,0 +1,32 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class AutoResize extends AbstractPlugin
{
public function getPluginName(): string
{
return 'autoresize';
}
}

View File

@ -0,0 +1,32 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class Autolink extends AbstractPlugin
{
public function getPluginName(): string
{
return 'autolink';
}
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class Charmap extends AbstractPlugin
{
public function getPluginName(): string
{
return 'charmap';
}
public function getToolbarElements(): array
{
return [
'charmap'
];
}
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class Code extends AbstractPlugin
{
public function getPluginName(): string
{
return 'code';
}
public function getToolbarElements(): array
{
return [
'code'
];
}
}

View File

@ -0,0 +1,46 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
use OxidEsales\Eshop\Core\Registry;
class FullPage extends AbstractPlugin
{
public function getPluginName(): string
{
return 'fullpage';
}
public function getToolbarElements(): array
{
return [
'fullpage'
];
}
public function requireRegistration(): bool
{
return strtolower(Registry::getConfig()->getActiveView()->getClassKey()) === 'newsletter_main';
}
}

View File

@ -0,0 +1,49 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
use OxidEsales\Eshop\Core\Registry;
class FullScreen extends AbstractPlugin
{
public function getPluginName(): string
{
return 'oxfullscreen';
}
public function getToolbarElements(): array
{
return [
'fullscreen'
];
}
public function getScriptPath(): ?string
{
return Registry::getConfig()->getActiveView()->getViewConfig()->getModuleUrl(
'tinymce-editor',
'out/plugins/oxfullscreen/plugin.js'
);
}
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class Hr extends AbstractPlugin
{
public function getPluginName(): string
{
return 'hr';
}
public function getToolbarElements(): array
{
return [
'hr'
];
}
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class Image extends AbstractPlugin
{
public function getPluginName(): string
{
return 'image';
}
public function getToolbarElements(): array
{
return [
'image'
];
}
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
use OxidEsales\Eshop\Core\Registry;
class Legacyoutput extends AbstractPlugin
{
public function getPluginName(): string
{
return 'legacyoutput';
}
public function requireRegistration(): bool
{
return strtolower(Registry::getConfig()->getActiveView()->getClassKey()) === 'newsletter_main';
}
}

View File

@ -0,0 +1,40 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class Link extends AbstractPlugin
{
public function getPluginName(): string
{
return 'link';
}
public function getToolbarElements(): array
{
return [
'link',
'unlink'
];
}
}

View File

@ -0,0 +1,37 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class Lists extends AbstractPlugin
{
public function getPluginName(): string
{
return 'lists';
}
public function getToolbarElements(): array
{
return [];
}
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class Media extends AbstractPlugin
{
public function getPluginName(): string
{
return 'media';
}
public function getToolbarElements(): array
{
return [
'media'
];
}
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class Nonbreaking extends AbstractPlugin
{
public function getPluginName(): string
{
return 'nonbreaking';
}
public function getToolbarElements(): array
{
return [
'nonbreaking'
];
}
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class Pagebreak extends AbstractPlugin
{
public function getPluginName(): string
{
return 'pagebreak';
}
public function getToolbarElements(): array
{
return [
'pagebreak'
];
}
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class Paste extends AbstractPlugin
{
public function getPluginName(): string
{
return 'paste';
}
public function getToolbarElements(): array
{
return [
'pastetext'
];
}
}

View File

@ -0,0 +1,37 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
interface PluginInterface
{
public function getPluginName(): string;
public function getToolbarElements(): array;
public function getScriptPath(): ?string;
public function requireRegistration(): bool;
public function requireScript(): bool;
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class Preview extends AbstractPlugin
{
public function getPluginName(): string
{
return 'preview';
}
public function getToolbarElements(): array
{
return [
'preview'
];
}
}

View File

@ -0,0 +1,32 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class Quickbars extends AbstractPlugin
{
public function getPluginName(): string
{
return 'quickbars';
}
}

View File

@ -0,0 +1,52 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
use OxidEsales\Eshop\Core\Registry;
class Roxy extends AbstractPlugin
{
public function getPluginName(): string
{
return 'roxy';
}
public function getScriptPath(): ?string
{
return Registry::getConfig()->getActiveView()->getViewConfig()->getModuleUrl(
'tinymce-editor',
'out/plugins/roxy/plugin.js'
);
}
public function requireRegistration(): bool
{
return false;
}
public function requireScript(): bool
{
return (bool) Registry::getConfig()->getConfigParam("blTinyMCE_filemanager");
}
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class SearchReplace extends AbstractPlugin
{
public function getPluginName(): string
{
return 'searchreplace';
}
public function getToolbarElements(): array
{
return [
'searchreplace'
];
}
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class Table extends AbstractPlugin
{
public function getPluginName(): string
{
return 'table';
}
public function getToolbarElements(): array
{
return [
'table'
];
}
}

View File

@ -0,0 +1,39 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class Visualblocks extends AbstractPlugin
{
public function getPluginName(): string
{
return 'visualblocks';
}
public function getToolbarElements(): array
{
return [
'visualblocks'
];
}
}

View File

@ -0,0 +1,37 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins;
class WordCount extends AbstractPlugin
{
public function getPluginName(): string
{
return 'wordcount';
}
public function getToolbarElements(): array
{
return [];
}
}

View 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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Toolbar;
abstract class AbstractToolbar implements ToolbarInterface
{
abstract public function getButtons(): array;
}

View File

@ -0,0 +1,37 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Toolbar;
class Align extends AbstractToolbar
{
public function getButtons(): array
{
return [
'alignleft',
'aligncenter',
'alignright',
'alignjustify',
];
}
}

View File

@ -0,0 +1,34 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Toolbar;
class Blockquote extends AbstractToolbar
{
public function getButtons(): array
{
return [
'blockquote',
];
}
}

View File

@ -0,0 +1,35 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Toolbar;
class Color extends AbstractToolbar
{
public function getButtons(): array
{
return [
'forecolor',
'backcolor'
];
}
}

View File

@ -0,0 +1,36 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Toolbar;
class CopyPaste extends AbstractToolbar
{
public function getButtons(): array
{
return [
'cut',
'copy',
'paste'
];
}
}

View File

@ -0,0 +1,37 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Toolbar;
class Font extends AbstractToolbar
{
public function getButtons(): array
{
return [
'bold',
'italic',
'underline',
'strikethrough',
];
}
}

View File

@ -0,0 +1,34 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Toolbar;
class Formatselect extends AbstractToolbar
{
public function getButtons(): array
{
return [
'formatselect',
];
}
}

View File

@ -0,0 +1,35 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Toolbar;
class Indent extends AbstractToolbar
{
public function getButtons(): array
{
return [
'outdent',
'indent',
];
}
}

View File

@ -0,0 +1,35 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Toolbar;
class Lists extends AbstractToolbar
{
public function getButtons(): array
{
return [
'bullist',
'numlist',
];
}
}

View File

@ -0,0 +1,34 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Toolbar;
class RemoveFormat extends AbstractToolbar
{
public function getButtons(): array
{
return [
'removeformat',
];
}
}

View File

@ -0,0 +1,34 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Toolbar;
class Subscript extends AbstractToolbar
{
public function getButtons(): array
{
return [
'subscript',
];
}
}

View File

@ -0,0 +1,34 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Toolbar;
class Superscript extends AbstractToolbar
{
public function getButtons(): array
{
return [
'superscript',
];
}
}

View 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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Toolbar;
interface ToolbarInterface
{
public function getButtons(): array;
}

View File

@ -0,0 +1,35 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE\Toolbar;
class Undo extends AbstractToolbar
{
public function getButtons(): array
{
return [
'undo',
'redo'
];
}
}

View File

@ -0,0 +1,96 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE;
use O3\TinyMCE\Application\Core\TinyMCE\Toolbar\Align;
use O3\TinyMCE\Application\Core\TinyMCE\Toolbar\Blockquote;
use O3\TinyMCE\Application\Core\TinyMCE\Toolbar\Color;
use O3\TinyMCE\Application\Core\TinyMCE\Toolbar\CopyPaste;
use O3\TinyMCE\Application\Core\TinyMCE\Toolbar\Font;
use O3\TinyMCE\Application\Core\TinyMCE\Toolbar\Formatselect;
use O3\TinyMCE\Application\Core\TinyMCE\Toolbar\Indent;
use O3\TinyMCE\Application\Core\TinyMCE\Toolbar\Lists;
use O3\TinyMCE\Application\Core\TinyMCE\Toolbar\RemoveFormat;
use O3\TinyMCE\Application\Core\TinyMCE\Toolbar\Subscript;
use O3\TinyMCE\Application\Core\TinyMCE\Toolbar\Superscript;
use O3\TinyMCE\Application\Core\TinyMCE\Toolbar\Undo;
class ToolbarList
{
public function get(): array
{
return [
[
'formatselect' => oxNew(Formatselect::class),
'font' => oxNew(Font::class),
'color' => oxNew(Color::class),
'align' => oxNew(Align::class),
'subscript' => oxNew(Subscript::class),
'superscript' => oxNew(Superscript::class),
],
[
'undo' => oxNew(Undo::class),
'copypaste' => oxNew(CopyPaste::class),
'lists' => oxNew(Lists::class),
'indent' => oxNew(Indent::class),
'blockquote' => oxNew(Blockquote::class),
'removeformat' => oxNew(RemoveFormat::class),
]
];
$all = $this->getAll();
if ($count && isset($all[$count])) {
return $all[$count];
} elseif (!$count) {
$allList = [];
foreach ($all as $toolbars) {
$allList = array_merge($allList, $toolbars);
}
return $allList;
}
}
protected function getAll(): array
{
return [
1 => [
'formatselect' => oxNew(Formatselect::class),
'font' => oxNew(Font::class),
'color' => oxNew(Color::class),
'align' => oxNew(Align::class),
'subscript' => oxNew(Subscript::class),
'superscript' => oxNew(Superscript::class),
],
2 => [
'undo' => oxNew(Undo::class),
'copypaste' => oxNew(CopyPaste::class),
'lists' => oxNew(Lists::class),
'indent' => oxNew(Indent::class),
'blockquote' => oxNew(Blockquote::class),
'removeformat' => oxNew(RemoveFormat::class),
]
];
}
}

View File

@ -0,0 +1,32 @@
<?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) 2022 OXID Marat Bedoev, bestlife AG
* @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)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core\TinyMCE;
class Utils
{
public function quote($string): string
{
return '"'.addslashes($string).'"';
}
}

View File

@ -19,312 +19,33 @@
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/
declare(strict_types=1);
namespace O3\TinyMCE\Application\Core;
use O3\TinyMCE\Application\Core\TinyMCE\Loader;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\UtilsServer;
/**
* funtion for adding quotes to config variables
* @param $string
* @return string
*/
function q($string) { return '"'.addslashes($string).'"'; }
/**
* ViewConfig class wrapper for TinyMCE module.
*
* @mixin \OxidEsales\Eshop\Core\ViewConfig
*/
class ViewConfig extends ViewConfig_parent
{
public function loadTinyMce()
/**
* @return string
*/
public function loadTinyMce(): string
{
$cfg = Registry::getConfig();
$config = Registry::getConfig();
$language = Registry::getLang();
// is tinymce enabled for current controller?
$aEnabledClasses = $cfg->getConfigParam("aTinyMCE_classes") ?? [];
if (!in_array($this->getActiveClassName(), $aEnabledClasses)) return '';
$loader = oxNew(Loader::class, $config, $language);
$oLang = Registry::getLang();
// filter plain cms pages
$oEditObject = $cfg->getActiveView()->getViewDataElement("edit");
$sCoreTableName = $oEditObject->getCoreTableName();
$aPlainCmsPages = $cfg->getConfigParam("aTinyMCE_plaincms") ?? [];
if ($sCoreTableName === "oxcontents" && in_array($oEditObject->getLoadId(), $aPlainCmsPages)) {
return $oLang->translateString("BLA_TINYMCE_PLAINCMS");
}
// ******************** TinyMCE Config ********************
// array to assign shop lang abbreviations to lang files of tinymce: shopLang => langfile (without .js )
$aLang = array(
"cs" => "cs",
"da" => "da",
"de" => "de",
"es" => "es_419",
"fr" => "fr_FR",
"it" => "it_IT",
"nl" => "nl",
"ru" => "ru"
);
$sLang = $aLang[$oLang->getLanguageAbbr($oLang->getTplLanguage())] ?? "en";
// processing editor config & other stuff
// default config, updated on 2021-10-10 according to
$aConfig = array(
// integration options https://www.tiny.cloud/docs/configure/integration-and-setup/
// 'auto_focus' => '', // don't think we need me, maybe for cms pages?
'base_url' => q($this->getBaseDir().'modules/o3-shop/tinymce-editor/out/tinymce/'),
'cache_suffix' => q('?v=20211010'),
'selector' => '"textarea:not(.mceNoEditor)"',
// gui options https://www.tiny.cloud/docs/configure/editor-appearance/
'contextmenu' => 'false', q("link linkchecker image imagetools table"),
'min_height' => 350,
'max_height' => q('90%'),
'max_width' => q('90%'),
'menubar' => 'false',
'toolbar_sticky' => 'true',
// content appearance https://www.tiny.cloud/docs/configure/content-appearance/
'content_css' => q('/out/wave/src/css/styles.min.css'), // hardcoded, for testing purposes
// content filtering https://www.tiny.cloud/docs/configure/content-filtering/
'entity_encoding' => q('raw'),
'protect' => '[ /\[\{((?!\}\]).)+\}\]/gm ]', // holy shit, this is like Weihnachten and Geburtstag all at once
// content formatting https://www.tiny.cloud/docs/configure/content-formatting/
// localization https://www.tiny.cloud/docs/configure/localization/
'language' => q($sLang),
// URL handling https://www.tiny.cloud/docs/configure/url-handling/
'document_base_url' => q($this->getBaseDir()),
'relative_urls' => 'true',
// plugins
'image_advtab' => 'true'
/*
// old
//'spellchecker_language' => '"' . (in_array($sLang, $aLang) ? $aLang[$sLang] : 'en') . '"',
'nowrap' => 'false',
// http://www.tinymce.com/wiki.php/Configuration:entity_encoding
// http://www.tinymce.com/wiki.php/Configuration:document_base_url
// http://www.tinymce.com/wiki.php/Configuration:relative_urls
'plugin_preview_width' => 'window.innerWidth',
'plugin_preview_height' => 'window.innerHeight-90',
'code_dialog_width' => 'window.innerWidth-50',
'code_dialog_height' => 'window.innerHeight-130',
'imagetools_toolbar' => '"rotateleft rotateright | flipv fliph | editimage imageoptions"',
'moxiemanager_fullscreen' => 'true',
'insertdatetime_formats' => '[ "%d.%m.%Y", "%H:%M" ]',
'nonbreaking_force_tab' => 'true',
// http://www.tinymce.com/wiki.php/Plugin:nonbreaking
'urlconverter_callback' => '"urlconverter"',
'filemanager_access_key' => '"' . md5($_SERVER['DOCUMENT_ROOT']) . '"',
'tinymcehelper' => '"' . $this->getSelfActionLink() . 'renderPartial=1"'
*/
);
//merging with onfig override
$aOverrideCfg = $this->_getTinyCustConfig();
if (!empty($aOverrideCfg) && is_array($aOverrideCfg)) {
$aConfig = array_merge($aConfig, $aOverrideCfg);
}
// default plugins and their buttons
$aPlugins = array(
//'advlist' => '', // '' = plugin has no buttons
'anchor' => 'anchor',
'autolink' => '',
'autoresize' => '',
'charmap' => 'charmap',
'code' => 'code',
'hr' => 'hr',
'image' => 'image',
// 'imagetools' => '', // das hier klingt sehr kompliziert
'link' => 'link unlink',
'lists' => '',
'media' => 'media',
'nonbreaking' => 'nonbreaking',
'pagebreak' => 'pagebreak',
'paste' => 'pastetext',
'preview' => 'preview',
'quickbars' => '',//'quicklink quickimage quicktable',
'searchreplace' => 'searchreplace',
'table' => 'table',
'visualblocks' => 'visualblocks',
'wordcount' => '',
'oxfullscreen' => 'fullscreen', //custom fullscreen plugin
//'oxwidget' => 'widget'
//'oxgetseourl' => 'yolo' //custom seo url plugin // wip
);
// plugins for newsletter emails
if ($this->getActiveClassName() === "newsletter_main") {
$aPlugins["legacyoutput"] = "";
$aPlugins["fullpage"] = "fullpage";
}
// override for active plugins
$aOverridePlgns = $cfg->getConfigParam("aTinyMCE_plugins");
if (!empty($aOverridePlgns) && is_array($aOverridePlgns)) {
$aPlugins = array_merge($aPlugins, $aOverridePlgns);
}
$aPlugins = array_filter($aPlugins, function ($value) {
return $value !== "false";
});
// array keys von $aPlugins enthalten aktive plugins
$aConfig['plugins'] = '"' . implode(' ', array_keys($aPlugins)) . '"';
// external plugins
$aConfig['external_plugins'] = '{ "oxfullscreen":"' . $this->getModuleUrl(
'tinymce-editor',
'out/plugins/oxfullscreen/plugin.js'
) . '" ';
//$aConfig['external_plugins'] .= ', "oxwidget":"' . $this->getModuleUrl('bla-tinymce', 'plugins/oxwidget/plugin.js') . '" ';
$blFilemanager = $cfg->getConfigParam("blTinyMCE_filemanager");
// @todo: $blFilemanager wiederherstellen
if ($blFilemanager)
{
$aConfig['filemanager_url'] = q(str_replace('&amp;','&',$this->getSslSelfLink())."cl=tinyfilemanager");
$sFilemanagerKey = md5_file(Registry::getConfig()->getConfigParam("sShopDir")."/config.inc.php");
//$aConfig['filemanager_access_key'] = q($sFilemanagerKey);
Registry::get(UtilsServer::class)->setOxCookie("filemanagerkey", $sFilemanagerKey);
$aConfig['external_plugins'] .= ',"roxy":' . q($this->getModuleUrl(
'tinymce-editor',
'out/plugins/roxy/plugin.js'
));
}
//$aConfig['external_plugins'] .= ',"oxgetseourl":"' . $this->getModuleUrl('bla-tinymce', 'plugins/oxgetseourl/plugin.js') . '" ';
$aExtPlugins = $this->_getTinyExtPlugins();
if (!empty($aExtPlugins) && is_array($aExtPlugins)) {
foreach ($aExtPlugins as $plugin => $file) {
$aConfig['external_plugins'] .= ', "' . $plugin . '": "' . $file . '" ';
}
}
$aConfig['external_plugins'] .= ' }';
// default toolbar buttons
$aDefaultButtons = array(
"undo redo",
//"cut copy paste",
"forecolor backcolor",
"bold italic underline strikethrough",
"alignleft aligncenter alignright alignjustify",
"bullist numlist",
"outdent indent",
"blockquote",
"subscript",
"superscript",
"formatselect",
//"fontselect",
//"fontsizeselect",
"removeformat"
);
$aOverrideButtons = $cfg->getConfigParam("aTinyMCE_buttons");
$aButtons = (empty($aOverrideButtons) || !is_array($aOverrideButtons)) ? $aDefaultButtons : $aOverrideButtons;
// plugin buttons
$aPluginButtons = array_filter($aPlugins);
// zusätzliche buttons
$aCustomButtons = $this->_getTinyToolbarControls();
$aButtons = array_merge(array_filter($aButtons), [" | "], array_filter($aPluginButtons), array_filter($aCustomButtons));
$aConfig['toolbar'] = '["' . implode(" | ", $aButtons) . '"]';
// compile the whole config stuff
$sConfig = '';
foreach ($aConfig as $param => $value) {
$sConfig .= "$param: $value, ";
}
// add init script
$sInit = 'tinymce.init({ ' . $sConfig . ' });';
$sCopyLongDescFromTinyMCE = 'function copyLongDescFromTinyMCE(sIdent) {
var editor = tinymce.get("editor_"+sIdent);
var content = (editor && !editor.isHidden()) ? editor.getContent() : document.getElementById("editor_"+sIdent).value;
document.getElementsByName("editval[" + sIdent + "]").item(0).value = content.replace(/\[{([^\]]*?)}\]/g, function(m) { return m.replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&amp;/g, "&") });
return true;
}
var origCopyLongDesc = copyLongDesc;
copyLongDesc = function(sIdent) {
if ( copyLongDescFromTinyMCE( sIdent ) ) return;
console.log("tinymce disabled, copy content from regular textarea");
origCopyLongDesc( sIdent );
}';
$sUrlConverter = 'function urlconverter(url, node, on_save) {
console.log(tinyMCE.activeEditor);
if(url.indexOf("[{") == 0) return url;
return (tinyMCE.activeEditor.settings.relative_urls) ? tinyMCE.activeEditor.documentBaseURI.toRelative(url) : tinyMCE.activeEditor.documentBaseURI.toAbsolute(url);
}';
// adding scripts to template
$smarty = Registry::getUtilsView()->getSmarty();
$sSufix = ($smarty->_tpl_vars["__oxid_include_dynamic"]) ? '_dynamic' : '';
$aScript = (array)$cfg->getGlobalParameter('scripts' . $sSufix);
$aScript[] = $sCopyLongDescFromTinyMCE;
$aScript[] = $sUrlConverter;
$aScript[] = $sInit;
$cfg->setGlobalParameter('scripts' . $sSufix, $aScript);
$aInclude = (array)$cfg->getGlobalParameter('includes' . $sSufix);
$aExtjs = $cfg->getConfigParam('aTinyMCE_extjs');
if (!empty($aExtjs) && is_array($aExtjs)) {
foreach ($aExtjs as $key => $js) {
$aInclude[3][] = $js;
}
}
$aInclude[3][] = $this->getModuleUrl('tinymce-editor', 'out/tinymce/tinymce.min.js');
$cfg->setGlobalParameter('includes' . $sSufix, $aInclude);
return '<li style="margin-left: 50px;"><button style="border: 1px solid #0089EE; color: #0089EE;padding: 3px 10px; margin-top: -10px; background: white;" ' .
'onclick="tinymce.each(tinymce.editors, function(editor) { if(editor.isHidden()) { editor.show(); } else { editor.hide(); } });"><span>' .
Registry::getLang()->translateString('BLA_TINYMCE_TOGGLE') . '</span></button></li>';
// javascript:tinymce.execCommand(\'mceToggleEditor\',false,\'editor1\');
}
protected function _getTinyToolbarControls()
{
$aControls = [];
return $aControls;
}
protected function _getTinyExtPlugins()
{
$aPlugins = Registry::getConfig()->getConfigParam("aTinyMCE_external_plugins");
return $aPlugins;
}
protected function _getTinyCustConfig()
{
//$oModCfg = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingBridgeInterface::class);
//$oModCfg->get('setting-name', 'module-id');
$aConfig = Registry::getConfig()->getConfigParam("aTinyMCE_config");
return $aConfig;
return $loader->getEditorSwitch();
}
}
// ToDo:
// https://www.tiny.cloud/docs/tinymce/6/toolbar-configuration-options/
// flexible MinHeight je nach Logineinstellung
// flexibles CSS basierend auf Wave
// MediaSelect Bug

View File

@ -19,6 +19,8 @@
* @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3)
*/
declare(strict_types=1);
function checkAccess($action)
{
//if(!session_id()) die("Access Denied!");

View File

@ -25,14 +25,8 @@ $aLang = array(
'SHOP_MODULE_blTinyMCE_filemanager' => 'Dateimanager aktivieren',
'HELP_SHOP_MODULE_blTinyMCE_filemanager' => 'Ist diese Option aktiv, können Bilder hochgeladen werden. Der Speicherort ist: out/pictures/wysiwigpro/',
'SHOP_MODULE_aTinyMCE_classes' => '<h3>TinyMCE für folgende Backend-Seiten laden:</h3><ul><li>article_main (Artikelbeschreibung)</li><li>content_main (CMS Seiten)</li><li>category_text (Kategorienbeschreibung)</li><li>newsletter_main (Newsletter)</li><li>news_text (Nachrichten-Text)</li></ul>',
'HELP_SHOP_MODULE_aTinyMCE_classes' => 'für die Benutzung von TinyMCE in eigenen Admin Views muss hier die entsprechende View Klasse eingetragen werden, dann werden für jedes textarea je ein Editor erzeugt',
'SHOP_MODULE_aTinyMCE_plaincms' => '<h3>plaintext CMS Seiten</h3>Für diese CMS Seiten wird TinyMCE deaktiviert.',
'HELP_SHOP_MODULE_aTinyMCE_plaincms' => 'Einige CMS Seiten dürfen keine HTML Tags enthalten, z.B: Plaintext Emails, Email Betreffzeilen, SEO Beschreibung, etc.',
'HELP_SHOP_MODULE_aTinyMCE_classes' => 'für die Benutzung von TinyMCE in eigenen Admin Views muss hier die entsprechende Controllerklasse eingetragen werden, dann wird für jedes Textarea je ein Editor erzeugt',
'SHOP_MODULE_aTinyMCE_extjs' => '<h3>Externe JS Abhängigkeiten</h3>',
'HELP_SHOP_MODULE_aTinyMCE_extjs' => 'Komplette URL mit http:// bzw https:// falls der Shop über HTTPS läuft.',
'SHOP_MODULE_GROUP_tinyMceSettings' => 'TinyMCE Einstellungen &amp; Plugins',
'SHOP_MODULE_aTinyMCE_config' => '<h3>eigene TinyMCE Konfiguration <a href="https://www.tinymce.com/docs/configure/" target="_blank" title="mehr Infos">(?)</a></h3>hier können Parameter für externe Plugins hinterlegt oder auch standard Werte überschreiben werden<br/><b>parameter => "wert"</b> (mit Anführungszeichen, falls erforderlich!)',
'SHOP_MODULE_aTinyMCE_plugins' => '<h3>TinyMCE Plugins aktivieren/überschreiben <a href="https://www.tinymce.com/docs/configure/integration-and-setup/#plugins" target="_blank">(?)</a></h3><b>Plugin hinzufügen:</b>&nbsp;<i>plugin => plugin buttons</i><br/><b>Plugin ohne Buttons:</b>&nbsp;<i>plugin => |</i><br/><b>Plugin entfernen:</b>&nbsp;<i>plugin => false</i>',
'SHOP_MODULE_aTinyMCE_external_plugins' => '<h3>externe Plugins <a href="https://www.tinymce.com/docs/configure/integration-and-setup/#external_plugins" target="_blank">(?)</a></h3>Eingabeformat:<br/>Pluginname => Pfad/zur/Datei.js <b>|</b> plugin buttons',
'SHOP_MODULE_aTinyMCE_buttons' => '<h3>Toolbar Buttons überschreiben <a href="https://www.tinymce.com/docs/advanced/editor-control-identifiers/#toolbarcontrols" target="_blank">(?)</a></h3><b style="color:#ff3600;">es betrifft nur Buttons (Toolbar controls) unter dem ersten Punkt: "core" + Buttons für externe Plugins</b><br/>Standard Buttons:' . "<textarea rows='7' cols='55'>undo redo\nbold italic underline strikethrough\nalignleft aligncenter alignright alignjustify\nbullist numlist\noutdent indent\nblockquote\nremoveformat\nsubscript\nsuperscript\nformatselect\nfontselect\nfontsizeselect</textarea>"
);

View File

@ -0,0 +1,8 @@
<li style="margin-left: 50px;">
<button style="border: 1px solid #0089EE; color: #0089EE;padding: 3px 10px; margin-top: -10px; background: white;"
onclick="tinymce.each(tinymce.editors, function(editor) { if(editor.isHidden()) { editor.show(); } else { editor.hide(); } });">
<span>
[{oxmultilang ident="BLA_TINYMCE_TOGGLE"}]
</span>
</button>
</li>

View File

@ -25,14 +25,8 @@ $aLang = array(
'SHOP_MODULE_blTinyMCE_filemanager' => 'enable filemanager',
'HELP_SHOP_MODULE_blTinyMCE_filemanager' => 'When enabled, you can upload pictures into this directory: out/pictures/wysiwigpro/',
'SHOP_MODULE_aTinyMCE_classes' => '<h3>Enable TinyMCE for following backend pages:</h3><ul><li>article_main (product details)</li><li>content_main (CMS pages)</li><li>category_text (category description)</li><li>newsletter_main (newsletter)</li><li>news_text (news text)</li></ul>',
'HELP_SHOP_MODULE_aTinyMCE_classes' => 'if you want to use TinyMCE for your custom views/controllers, you need to enter their class names here.',
'SHOP_MODULE_aTinyMCE_plaincms' => '<h3>Plain Text CMS pages</h3>TinyMCE will not be loaded for these cms pages. e.g: Plain text Emails, Email subjects, etc.',
'HELP_SHOP_MODULE_aTinyMCE_plaincms' => 'some cms pages may not contain HTML tags, because the are used as plain text emails. email subjects or SEO description',
'HELP_SHOP_MODULE_aTinyMCE_classes' => 'if you want to use TinyMCE for your custom controllers, you need to enter their class names here.',
'SHOP_MODULE_aTinyMCE_extjs' => '<h3>external JS dependencies</h3> (e.g. for plugins)',
'HELP_SHOP_MODULE_aTinyMCE_extjs' => 'full URL with http:// or https:// if your shop runs with HTTPS.',
'SHOP_MODULE_GROUP_tinyMceSettings' => 'TinyMCE Settings &amp; Plugins',
'SHOP_MODULE_aTinyMCE_config' => '<h3>custom TinyMCE configuration <a href="https://www.tinymce.com/docs/configure/" target="_blank" title="more info">(?)</a></h3>here you can add custom config params for external plugins or overwrite default params<br/><b>param => "value"</b> (with quotes, if required!)',
'SHOP_MODULE_aTinyMCE_plugins' => '<h3>enable/overwrite TinyMCE Plugins <a href="https://www.tinymce.com/docs/configure/integration-and-setup/#plugins" target="_blank">(?)</a></h3><b>add plugin:</b>&nbsp;<i>plugin => plugin buttons</i><br/><b>add plugin without buttons:</b>&nbsp;<i>plugin => |</i><br/><b>disable plugin:</b>&nbsp;<i>plugin => false</i>',
'SHOP_MODULE_aTinyMCE_external_plugins' => '<h3>external plugins <a href="https://www.tinymce.com/docs/configure/integration-and-setup/#external_plugins" target="_blank">(?)</a></h3>example:<br/>pluginname => path/to/file.js <b>|</b> plugin buttons',
'SHOP_MODULE_aTinyMCE_buttons' => '<h3>Toolbar Buttons <a href="https://www.tinymce.com/docs/advanced/editor-control-identifiers/#toolbarcontrols" target="_blank">(?)</a></h3><b style="color:#ff3600;">only for core toolbar controls and buttons for custom and external plugins!</b><br/>default buttons:' . "<textarea rows='7' cols='55'>undo redo\nbold italic underline strikethrough\nalignleft aligncenter alignright alignjustify\nbullist numlist\noutdent indent\nblockquote\nremoveformat\nsubscript\nsuperscript\nformatselect\nfontselect\nfontsizeselect\nsubscript superscript</textarea>"
);

View File

@ -38,7 +38,8 @@ $aModule = [
],
'templates' => [
'TinyFilemanager.tpl' => 'o3-shop/tinymce-editor/Application/views/admin/filemanager.tpl',
'TinyHelper.tpl' => 'o3-shop/tinymce-editor/Application/views/admin/helper.tpl'
'TinyHelper.tpl' => 'o3-shop/tinymce-editor/Application/views/admin/helper.tpl',
'EditorSwitch.tpl' => 'o3-shop/tinymce-editor/Application/views/admin/editorswitch.tpl'
],
'blocks' => [
[
@ -62,29 +63,6 @@ $aModule = [
],
'position' => 0
],
[
'group' => 'tinyMceMain',
'name' => 'aTinyMCE_plaincms',
'type' => 'arr',
'value' => [
"oxadminorderplainemail",
"oxadminordernpplainemail", // bestellbenachrichtigung admin + fremdländer
"oxuserorderplainemail",
"oxuserordernpplainemail",
"oxuserorderemailendplain", // bestellbenachrichtigung user + fremdländer + abschluss
"oxordersendplainemail", // versandbestätigung
"oxregisterplainemail",
"oxregisterplainaltemail", // registrierung
"oxupdatepassinfoplainemail", // passwort update
"oxnewsletterplainemail", // newsletter
"oxemailfooterplain", // email fußtext
"oxrighttocancellegend",
"oxrighttocancellegend2", // widerrufsrecht
"oxstartmetadescription",
"oxstartmetakeywords" // META Tags
],
'position' => 1
],
[
'group' => 'tinyMceMain',
'name' => 'blTinyMCE_filemanager',
@ -98,38 +76,6 @@ $aModule = [
'type' => 'arr',
'value' => [],
'position' => 3
],
// ################################################################# tinymce settings
[
'group' => 'tinyMceSettings',
'name' => 'aTinyMCE_config',
'type' => 'aarr',
'value' => [],
'position' => 0
],
[
'group' => 'tinyMceSettings',
'name' => 'aTinyMCE_plugins',
'type' => 'aarr',
'value' => [],
'position' => 1
],
[
'group' => 'tinyMceSettings',
'name' => 'aTinyMCE_external_plugins',
'type' => 'aarr',
'value' => [],
'position' => 2
],
[
'group' => 'tinyMceSettings',
'name' => 'aTinyMCE_buttons',
'type' => 'arr',
'value' => [],
'position' => 3
]
]
];

View File

@ -0,0 +1,13 @@
function copyLongDescFromTinyMCE(sIdent) {
var editor = tinymce.get("editor_"+sIdent);
var content = (editor && !editor.isHidden()) ? editor.getContent() : document.getElementById("editor_"+sIdent).value;
document.getElementsByName("editval[" + sIdent + "]").item(0).value = content.replace(/\[{([^\]]*?)}\]/g, function(m) { return m.replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&amp;/g, "&") });
return true;
}
var origCopyLongDesc = copyLongDesc;
copyLongDesc = function(sIdent) {
if ( copyLongDescFromTinyMCE( sIdent ) ) return;
console.log("tinymce disabled, copy content from regular textarea");
origCopyLongDesc( sIdent );
}

1
out/scripts/init.js Normal file
View File

@ -0,0 +1 @@
tinymce.init({ 'CONFIG':'VALUES' });

View File

@ -0,0 +1,7 @@
function urlconverter(url, node, on_save) {
console.log(tinyMCE.activeEditor);
if(url.indexOf("[{") === 0) return url;
return (tinyMCE.activeEditor.settings.relative_urls) ?
tinyMCE.activeEditor.documentBaseURI.toRelative(url) :
tinyMCE.activeEditor.documentBaseURI.toAbsolute(url);
}