Your IP : 216.73.216.240


Current Path : /home/juvelize/www/plugins/icagenda/pro/
Upload File :
Current File : /home/juvelize/www/plugins/icagenda/pro/script.php

<?php
/**
 *----------------------------------------------------------------------------
 * iCagenda     Plugin Pro
 *----------------------------------------------------------------------------
 * @version     1.0.1 2022-04-13
 *
 * @package     iCagenda.Plugin
 * @subpackage  icagenda.payment_paypal
 * @link        https://www.icagenda.com
 *
 * @author      Cyril Rezé
 * @copyright   (c) 2012-2024 Cyril Rezé / iCagenda. All rights reserved.
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 *
 *  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, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  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 this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @since       iCagenda 3.8
 *----------------------------------------------------------------------------
*/

defined('_JEXEC') or die;

use Joomla\CMS\Factory as JFactory;

/**
 * plgIcagendaPro Installer Script
 */
class plgIcagendaProInstallerScript
{
	/**
	 * A list of extensions (modules, plugins) to update options after installation.
	 * Each item has five values, in this order:
	 * type (plugin, module, ...), name (of the extension), ordering (pro plugin always first), group (for plugins),
	 * protected (0=normal, 1=protected).
	 *
	 * @var array
	 */
	protected $extensionsToUpdate = [
		// PRO plugins
		['plugin', 'pro', 1, 'icagenda', 0],
		['plugin', 'tickets', 2, 'icagenda', 0],
		['plugin', 'payment_paypal', 3, 'icagenda', 0],
	];

	/**
	 * method to run after an install/update/uninstall method.
	 */
	public function postflight($type, $parent)
	{
		$db = JFactory::getDbo();

		foreach ($this->extensionsToUpdate as $ext)
		{
			$query = $db->getQuery(true);

			$fields = array(
				$db->quoteName('ordering') . ' = ' . $db->quote($ext[2]),
				$db->quoteName('protected') . ' = ' . $db->quote($ext[4]),
			);

			$conditions = array(
				$db->quoteName('element') . ' = ' . $db->quote($ext[1]),
				$db->quoteName('folder') . ' = ' . $db->quote($ext[3]),
				$db->quoteName('type') . ' = ' . $db->quote($ext[0]),
			);

			$query->update($db->quoteName('#__extensions'))->set($fields)->where($conditions);

			$db->setQuery($query);
			$db->execute();
		}
	}
}