first commit
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
PLG_QUANTUMYOOTHEMEPRO="System - Quantum Manager integration with YOOtheme Pro"
|
||||
PLG_QUANTUMYOOTHEMEPRO_XML_DESCRIPTION="Quantum Manager plugin for integration with YOOtheme Pro."
|
||||
@@ -0,0 +1,2 @@
|
||||
PLG_QUANTUMYOOTHEMEPRO="System - Quantum Manager integration with YOOtheme Pro"
|
||||
PLG_QUANTUMYOOTHEMEPRO_XML_DESCRIPTION="Quantum Manager plugin for integration with YOOtheme Pro."
|
||||
@@ -0,0 +1,2 @@
|
||||
PLG_QUANTUMYOOTHEMEPRO="Система - Интеграция Quantum Manager с YOOtheme Pro"
|
||||
PLG_QUANTUMYOOTHEMEPRO_XML_DESCRIPTION="Плагин для интеграции Quantum Manager с YOOtheme Pro."
|
||||
@@ -0,0 +1,2 @@
|
||||
PLG_QUANTUMYOOTHEMEPRO="Система - Интеграция Quantum Manager с YOOtheme Pro"
|
||||
PLG_QUANTUMYOOTHEMEPRO_XML_DESCRIPTION="Плагин для интеграции Quantum Manager с YOOtheme Pro."
|
||||
109
plugins/system/quantumyoothemepro/quantumyoothemepro.php
Normal file
109
plugins/system/quantumyoothemepro/quantumyoothemepro.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
* @package quantummanager
|
||||
*
|
||||
* @author Dmitry Tsymbal <cymbal@delo-design.ru>
|
||||
* @copyright Copyright © 2019 Delo Design & NorrNext. All rights reserved.
|
||||
* @license GNU General Public License version 3 or later; see license.txt
|
||||
* @link https://www.norrnext.com
|
||||
*/
|
||||
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\FileLayout;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\Database\DatabaseDriver;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Quantumyoothemepro plugin.
|
||||
*
|
||||
* @package quantumyoothemepro
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class plgSystemQuantumyoothemepro extends CMSPlugin
|
||||
{
|
||||
/**
|
||||
* Application object
|
||||
*
|
||||
* @var CMSApplication
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* Database object
|
||||
*
|
||||
* @var DatabaseDriver
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* Affects constructor behavior. If true, language files will be loaded automatically.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
|
||||
/**
|
||||
* onAfterRender.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function onBeforeCompileHead()
|
||||
{
|
||||
|
||||
$admin = $this->app->isClient('administrator');
|
||||
$p = $this->app->input->getCmd('p', '');
|
||||
|
||||
if(!$admin)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(empty($p))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HTMLHelper::_('script', 'plg_system_quantumyoothemepro/modal.js', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
HTMLHelper::_('script', 'com_quantummanager/utils.js', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
JLoader::register('QuantummanagerHelper', JPATH_SITE . '/administrator/components/com_quantummanager/helpers/quantummanager.php');
|
||||
QuantummanagerHelper::loadLang();
|
||||
|
||||
$insert = htmlspecialchars(Text::_('COM_QUANTUMMANAGER_ACTION_SELECT'), ENT_QUOTES);
|
||||
$cancel = htmlspecialchars(Text::_('COM_QUANTUMMANAGER_ACTION_CANCEL'), ENT_QUOTES);
|
||||
Factory::getDocument()->addScriptDeclaration(<<<EOT
|
||||
window.QuantumYoothemeproLang = {
|
||||
'insert': "{$insert}",
|
||||
'cancel': "{$cancel}",
|
||||
};
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function onAjaxQuantumyoothemepro()
|
||||
{
|
||||
$layout = new FileLayout('select', JPATH_SITE . '/plugins/system/quantumyoothemepro/tmpl');
|
||||
echo $layout->render();
|
||||
//$this->app->close();
|
||||
}
|
||||
|
||||
}
|
||||
33
plugins/system/quantumyoothemepro/quantumyoothemepro.xml
Normal file
33
plugins/system/quantumyoothemepro/quantumyoothemepro.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="plugin" version="3.8" group="system" method="upgrade">
|
||||
<name>PLG_QUANTUMYOOTHEMEPRO</name>
|
||||
<creationDate>23.12.2019</creationDate>
|
||||
<author>Tsymbal</author>
|
||||
<authorEmail>cymbal@delo-design.ru</authorEmail>
|
||||
<authorUrl>https://www.norrnext.com</authorUrl>
|
||||
<copyright>Copyright © 2019 Delo Design & NorrNext. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 3 or later; see license.txt</license>
|
||||
<version>1.7</version>
|
||||
<description>PLG_QUANTUMYOOTHEMEPRO_XML_DESCRIPTION</description>
|
||||
|
||||
<scriptfile>script.php</scriptfile>
|
||||
|
||||
<languages folder="language">
|
||||
<language tag="en-GB">en-GB/en-GB.plg_system_quantumyoothemepro.ini</language>
|
||||
<language tag="en-GB">en-GB/en-GB.plg_system_quantumyoothemepro.sys.ini</language>
|
||||
<language tag="ru-RU">ru-RU/ru-RU.plg_system_quantumyoothemepro.ini</language>
|
||||
<language tag="ru-RU">ru-RU/ru-RU.plg_system_quantumyoothemepro.sys.ini</language>
|
||||
</languages>
|
||||
|
||||
<media folder="media" destination="plg_system_quantumyoothemepro">
|
||||
<folder>css</folder>
|
||||
<folder>js</folder>
|
||||
</media>
|
||||
|
||||
<files>
|
||||
<filename plugin="quantumyoothemepro">quantumyoothemepro.php</filename>
|
||||
<folder>language</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
|
||||
</extension>
|
||||
65
plugins/system/quantumyoothemepro/script.php
Normal file
65
plugins/system/quantumyoothemepro/script.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* @package quantumyoothemepro
|
||||
*
|
||||
* @author tsymb <your@email.com>
|
||||
* @copyright A copyright
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
* @link http://your.url.com
|
||||
*/
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Quantumyoothemepro script file.
|
||||
*
|
||||
* @package quantumyoothemepro
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class plgSystemQuantumyoothemeproInstallerScript
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Called after any type of action
|
||||
*
|
||||
* @param string $route Which action is happening (install|uninstall|discover_install|update)
|
||||
* @param JAdapterInstance $adapter The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function postflight($route, $adapter)
|
||||
{
|
||||
if ($route === 'install')
|
||||
{
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('extension_id');
|
||||
$query->from('#__extensions');
|
||||
$query->where($db->qn('element') . ' = ' . $db->q('yootheme'));
|
||||
$query->where($db->qn('type') . ' = ' . $db->q('plugin'));
|
||||
$query->where($db->qn('folder') . ' = ' . $db->q('system'));
|
||||
$result = $db->setQuery($query)->loadObject();
|
||||
|
||||
if (!empty($result->extension_id))
|
||||
{
|
||||
$this->enablePlugin($adapter);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function enablePlugin($parent)
|
||||
{
|
||||
$plugin = new stdClass();
|
||||
$plugin->type = 'plugin';
|
||||
$plugin->element = $parent->getElement();
|
||||
$plugin->folder = (string) $parent->getParent()->manifest->attributes()['group'];
|
||||
$plugin->enabled = 1;
|
||||
|
||||
Factory::getDbo()->updateObject('#__extensions', $plugin, ['type', 'element', 'folder']);
|
||||
}
|
||||
|
||||
}
|
||||
160
plugins/system/quantumyoothemepro/tmpl/select.php
Normal file
160
plugins/system/quantumyoothemepro/tmpl/select.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
/**
|
||||
* @package quantummanager
|
||||
* @author Dmitry Tsymbal <cymbal@delo-design.ru>
|
||||
* @copyright Copyright © 2019 Delo Design & NorrNext. All rights reserved.
|
||||
* @license GNU General Public License version 3 or later; see license.txt
|
||||
* @link https://www.norrnext.com
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$folder = $app->input->get('folder', '', 'string');
|
||||
$app->getSession()->clear('quantummanageraddscripts');
|
||||
|
||||
if(!empty($folder))
|
||||
{
|
||||
$app->getSession()->set('quantummanagerroot', 'images/' . $folder);
|
||||
}
|
||||
else
|
||||
{
|
||||
$app->getSession()->clear('quantummanagerroot');
|
||||
}
|
||||
|
||||
$app->getSession()->clear('quantummanageraddscripts');
|
||||
|
||||
HTMLHelper::_('stylesheet', 'plg_system_quantummanagermedia/modal.css', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
HTMLHelper::_('script', 'plg_system_quantumyoothemepro/select.js', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
try {
|
||||
JLoader::register('JFormFieldQuantumCombine', JPATH_ROOT . '/administrator/components/com_quantummanager/fields/quantumcombine.php');
|
||||
JLoader::register('QuantummanagerHelper', JPATH_SITE . '/administrator/components/com_quantummanager/helpers/quantummanager.php');
|
||||
$folderRoot = 'root';
|
||||
|
||||
$buttonsBun = [];
|
||||
$fields = [
|
||||
'quantumtreecatalogs' => [
|
||||
'label' => '',
|
||||
'directory' => $folderRoot,
|
||||
'position' => 'container-left',
|
||||
],
|
||||
'quantumtoolbar' => [
|
||||
'label' => '',
|
||||
'position' => 'container-center-top',
|
||||
'buttons' => 'all',
|
||||
'buttonsBun' => '',
|
||||
'cssClass' => 'qm-padding-small-left qm-padding-small-right qm-padding-small-top qm-padding-small-bottom',
|
||||
],
|
||||
'quantumupload' => [
|
||||
'label' => '',
|
||||
'position' => 'container-center-top',
|
||||
'maxsize' => QuantummanagerHelper::getParamsComponentValue('maxsize', '10'),
|
||||
'dropAreaHidden' => QuantummanagerHelper::getParamsComponentValue('dropareahidden', '0'),
|
||||
'directory' => $folderRoot,
|
||||
'cssClass' => 'qm-padding-small-left qm-padding-small-right qm-padding-small-bottom',
|
||||
],
|
||||
'quantumviewfiles' => [
|
||||
'label' => '',
|
||||
'position' => 'container-center-center',
|
||||
'directory' => $folderRoot,
|
||||
'view' => 'list-grid',
|
||||
'onlyfiles' => '0',
|
||||
'watermark' => QuantummanagerHelper::getParamsComponentValue('overlay' , 0) > 0 ? '1' : '0',
|
||||
'help' => QuantummanagerHelper::getParamsComponentValue('help' , '1'),
|
||||
'metafile' => QuantummanagerHelper::getParamsComponentValue('metafile' , '1'),
|
||||
],
|
||||
'quantumcropperjs' => [
|
||||
'label' => '',
|
||||
'position' => 'bottom'
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
if((int)QuantummanagerHelper::getParamsComponentValue('unsplash', '1'))
|
||||
{
|
||||
$fields['quantumunsplash'] = [
|
||||
'position' => 'bottom'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if((int)QuantummanagerHelper::getParamsComponentValue('pexels', '1'))
|
||||
{
|
||||
$fields['quantumpexels'] = [
|
||||
'position' => 'bottom'
|
||||
];
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if((int)QuantummanagerHelper::getParamsComponentValue('pixabay', '1'))
|
||||
{
|
||||
$fields['quantumpixabay'] = [
|
||||
'position' => 'bottom'
|
||||
];
|
||||
}*/
|
||||
|
||||
$actions = QuantummanagerHelper::getActions();
|
||||
if (!$actions->get('core.create'))
|
||||
{
|
||||
$buttonsBun[] = 'viewfilesCreateDirectory';
|
||||
unset($fields['quantumupload']);
|
||||
}
|
||||
|
||||
if (!$actions->get('core.delete'))
|
||||
{
|
||||
unset($fields['quantumcropperjs']);
|
||||
}
|
||||
|
||||
if (!$actions->get('core.delete'))
|
||||
{
|
||||
$buttonsBun[] = 'viewfilesDelete';
|
||||
}
|
||||
|
||||
$optionsForField = [
|
||||
'name' => 'filemanager',
|
||||
'label' => '',
|
||||
'fields' => json_encode($fields)
|
||||
];
|
||||
|
||||
$field = new JFormFieldQuantumCombine();
|
||||
foreach ($optionsForField as $name => $value)
|
||||
{
|
||||
$field->__set($name, $value);
|
||||
}
|
||||
echo $field->getInput();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
window.QuantumwindowLang = {
|
||||
'buttonInsert': '<?php echo Text::_('COM_QUANTUMMANAGER_WINDOW_INSERT'); ?>',
|
||||
'inputAlt': '<?php echo Text::_('PLG_QUANTUMMANAGERMEDIA_WINDOW_ALT'); ?>',
|
||||
'inputWidth': '<?php echo Text::_('PLG_QUANTUMMANAGERMEDIA_WINDOW_WIDTH'); ?>',
|
||||
'inputHeight': '<?php echo Text::_('PLG_QUANTUMMANAGERMEDIA_WINDOW_HEIGHT'); ?>',
|
||||
'inputHspace': '<?php echo Text::_('PLG_QUANTUMMANAGERMEDIA_WINDOW_HSPACE'); ?>',
|
||||
'inputVspace': '<?php echo Text::_('PLG_QUANTUMMANAGERMEDIA_WINDOW_VSPACES'); ?>',
|
||||
'inputAlign': '<?php echo Text::_('PLG_QUANTUMMANAGERMEDIA_WINDOW_ALIGN'); ?>',
|
||||
'inputCssClass': '<?php echo Text::_('PLG_QUANTUMMANAGERMEDIA_WINDOW_CLASS'); ?>'
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user