| Current Path : /home/w/u/e/wuectly/www/03cbe/ |
| Current File : /home/w/u/e/wuectly/www/03cbe/Jce.php.tar |
home/wuectly/www/plugins/system/jce/src/Extension/Jce.php 0000604 00000004553 15245650567 0017561 0 ustar 00 <?php
/**
* @package JCE
* @subpackage Editors.Jce
*
* @copyright Copyright (C) 2005 - 2023 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\System\Jce\Extension;
use JLoader;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Plugin\System\Jce\PluginTraits\EventTrait;
use Joomla\Plugin\System\Jce\PluginTraits\FormTrait;
JLoader::register('WfBrowserHelper', JPATH_ADMINISTRATOR . '/components/com_jce/helpers/browser.php');
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* JCE WYSIWYG Editor Plugin.
*
* @since 1.5
*/
final class Jce extends CMSPlugin
{
use FormTrait;
use EventTrait;
/**
* Affects constructor behavior. If true, language files will be loaded automatically.
*
* @var boolean
*/
protected $autoloadLanguage = true;
private $booted = false;
private function bootEditorPlugins()
{
if ($this->booted) {
return;
}
$app = Factory::getApplication();
// only in "site"
if ($app->getClientId() !== 0) {
return;
}
$plugins = PluginHelper::getPlugin('jce');
foreach ($plugins as $plugin) {
if (!preg_match('/^editor[-_]/', $plugin->name)) {
continue;
}
$path = JPATH_PLUGINS . '/jce/' . $plugin->name;
// only modern plugins
if (!is_dir($path . '/src')) {
continue;
}
$plugin = $app->bootPlugin($plugin->name, $plugin->type);
$plugin->setDispatcher($app->getDispatcher());
$plugin->registerListeners();
}
$this->booted = true;
}
public function onAfterDispatch()
{
$app = Factory::getApplication();
// only in "site"
if ($app->getClientId() !== 0) {
return;
}
$document = Factory::getDocument();
// must be an html doctype
if ($document->getType() !== 'html') {
return true;
}
$this->bootEditorPlugins();
$app->triggerEvent('onWfPluginAfterDispatch');
}
}
home/wuectly/www/plugins/installer/jce/src/Extension/Jce.php 0000604 00000004741 15245670463 0020226 0 ustar 00 <?php
/**
* @package JCE
* @subpackage Installer.Jce
*
* @copyright Copyright (C) 2005 - 2023 Open Source Matters, Inc. All rights reserved
* @copyright Copyright (C) 2023 - 2024 Ryan Demmer. All rights reserved
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\Installer\Jce\Extension;
\defined('_JEXEC') or die;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Database\DatabaseAwareTrait;
use Joomla\Plugin\Installer\Jce\PluginTraits\EventsTrait;
class Jce extends CMSPlugin
{
use EventsTrait;
use DatabaseAwareTrait;
/**
* Affects constructor behavior. If true, language files will be loaded automatically.
*
* @var boolean
*/
protected $autoloadLanguage = true;
private function getDownloadKeyFromUpdateSites()
{
$db = $this->getDatabase();
$query = $db->getQuery(true)
->select('package_id')
->from('#__extensions')
->where('element = ' . $db->quote('com_jce'));
$db->setQuery($query);
$packageId = $db->loadResult();
if (is_null($packageId)) {
return null;
}
$query = $db->getQuery(true)
->select($db->quoteName('update_sites.extra_query'))
->from($db->quoteName('#__update_sites', 'update_sites'))
->join(
'INNER',
$db->quoteName('#__update_sites_extensions', 'update_sites_extensions') . ' ON ' . $db->quoteName('update_sites_extensions.update_site_id') . ' = ' . $db->quoteName('update_sites.update_site_id')
)
->where($db->quoteName('update_sites_extensions.extension_id') . ' = ' . (int) $packageId);
$db->setQuery($query);
$result = $db->loadResult();
if ($result) {
// Parse the `extra_query` to extract the key value
parse_str($result, $parsedQuery);
if (isset($parsedQuery['key'])) {
return $parsedQuery['key'];
}
}
return null;
}
/**
* Get the download key from the update sites table.
*
* @return string|null The download key or null if not found
*/
public function getDownloadKey()
{
// get the key directly from the update sites table, eg: when updating a plugin
$key = $this->getDownloadKeyFromUpdateSites();
// Return the key or null if not found
return $key;
}
}