| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/catalog/plugins/system/djclassifiedsyt/ |
Upload File : |
<?php
/**
* @package DJ-Classifieds-Yootheme
* @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email contact@dj-extensions.com
*/
// No direct access to this file
defined('_JEXEC') or die;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
/**
* Script file of HelloWorld module
*/
class plgSystemDJClassifiedsYTInstallerScript
{
private $oldversion;
/**
* Method to install the extension
* $parent is the class calling this method
*
* @return void
*/
function install($parent)
{
$html = '<style type="text/css">
.djex-info { padding: 20px 30px 10px; margin: 0 0 20px 0; background: #1790e9; color: #fff; border: 1px solid #453d38; font-family: Arial, Helvetica, sans-serif; font-size: 13px; font-weight: normal; -webkit-border-radius: 4px; border-radius: 4px; }
.djex-title { text-transform: uppercase; font-weight: bold; font-size: 14px; }
.djex-info a:link, .djex-info a:visited, .djex-info a:hover { color:#fff; text-decoration:underline; font-weight: 600; }
.djex-info img { float: left; margin: 0 30px 10px 0; }
</style>
<div class="djex-info"><img src="'.Uri::root().'plugins/system/djclassifiedsyt/assets/djcf-integration-yootheme.png" style="width: 25%;"> <p class="djex-title">DJ-Classifieds - YooTheme Integrator plugin has been installed (version ' . $parent->getManifest()->version .')</p>
<p>Please read <a target="_blank" href="https://dj-extensions.com/my-account/downloads/dj-classifieds-integrator">Changelog</a> and visit our <a target="_blank" href="https://dj-extensions.com/faq">FAQ Section</a></p>
<p>Check out our other extensions at <a target="_blank" href="https://dj-extensions.com">DJ-Extensions.com</a></p>
<div style="clear:both"></div></div>';
echo $html;
}
/**
* Method to update the extension
* $parent is the class calling this method
*
* @return void
*/
function update($parent)
{
$html = '<style type="text/css">
.djex-info { padding: 20px 30px 10px; margin: 0 0 20px 0; background: #1790e9; color: #fff; border: 1px solid #453d38; font-family: Arial, Helvetica, sans-serif; font-size: 13px; font-weight: normal; -webkit-border-radius: 4px; border-radius: 4px; }
.djex-title { text-transform: uppercase; font-weight: bold; font-size: 14px; }
.djex-info a:link, .djex-info a:visited, .djex-info a:hover { color:#fff; text-decoration:underline; font-weight: 600; }
.djex-info img { float: left; margin: 0 30px 10px 0; }
</style>
<div class="djex-info"><img src="'.Uri::root().'plugins/system/djclassifiedsyt/assets/djcf-integration-yootheme.png" style="width: 25%;"> <p class="djex-title">DJ-Classifieds - YooTheme Integrator plugin has been updated to version ' . $parent->getManifest()->version .'</p>
<p>Please read <a target="_blank" href="https://dj-extensions.com/my-account/downloads/dj-classifieds-integrator">Changelog</a> and visit our <a target="_blank" href="https://dj-extensions.com/faq">FAQ Section</a></p>
<p>Check out our other extensions at <a target="_blank" href="https://dj-extensions.com">DJ-Extensions.com</a></p>
<div style="clear:both"></div></div>';
echo $html;
}
/**
* Method to run before an install/update/uninstall method
* $parent is the class calling this method
* $type is the type of change (install, update or discover_install)
*
* @return void
*/
function preflight($type, $parent)
{
$db = JFactory::getDbo();
$db->setQuery("SELECT enabled FROM #__extensions WHERE name = 'yootheme' AND type = 'template' ");
$yootheme_enabled = $db->loadResult();
if($type == 'update' || $type == 'install'){
if ($yootheme_enabled == 0) {
JFactory::getApplication()->enqueueMessage(JText::_('Please install YooTheme Builder before installing DJCF-YooTheme-Integration plugin!'));
return false;
}
if (!JComponentHelper::getComponent('com_djclassifieds', true)->enabled)
{
JFactory::getApplication()->enqueueMessage(JText::_('Please install DJ-Classifieds component before installing DJCF-YooTheme-Integration plugin!'));
return false;
}
}
if($type == 'update'){ // remove trash elements
$this->oldversion = self::getParam('version');
$trash = array(
'/modules/form/elements/form_option',
'/modules/form/elements/form_radio',
'/modules/form/elements/form_checkbox',
'/modules/builder-joomla-source/elements/classifieds-order-table',
'/modules/builder-joomla-source/elements/classifieds-order-table_item',
'/modules/builder-joomla-source/elements/classifieds-bid',
'/modules/builder-joomla-source/elements/classifieds-buynow',
'/modules/builder-joomla-source/elements/grid_item'
);
foreach($trash as $path){
$dir = JPATH_ROOT.'/plugins/system/djclassifiedsyt'.$path;
if(JFolder::exists($dir)){
JFolder::delete($dir);
}
}
}
}
/**
* Method to run after an install/update/uninstall method
* $parent is the class calling this method
* $type is the type of change (install, update or discover_install)
*
* @return void
*/
function postflight($type, $parent)
{
$db = JFactory::getDbo();
if($type == 'install'){
$query = $db->getQuery(true);
$fields = array(
$db->quoteName('enabled') . ' = 1',
);
$conditions = array(
$db->quoteName('element') . ' = ' . $db->quote('djclassifiedsyt'),
$db->quoteName('type') . ' = ' . $db->quote('plugin')
);
$query->update($db->quoteName('#__extensions'))->set($fields)->where($conditions);
$db->setQuery($query);
$db->execute();
}elseif($type == 'update'){
if(version_compare($this->oldversion, '1.4.0', '<')){
// customCategories core J! categories conflict fix
$query = 'UPDATE `#__content` SET `fulltext`=REPLACE(`fulltext`, \'"source":{"query":{"name":"customCategories","arguments":{"catid":\', \'"source":{"query":{"name":"customDJCFCategories","arguments":{"catid":\') WHERE `fulltext` LIKE \'%"source":{"query":{"name":"customCategories","arguments":{"catid":%\'';
$db->setQuery($query);
$db->execute();
}
}
}
static function getParam($name)
{
$db = JFactory::getDbo();
$db->setQuery('SELECT manifest_cache FROM #__extensions WHERE type="plugin" AND folder="system" AND element="djclassifiedsyt"');
$manifest = json_decode($db->loadResult(), true);
return $manifest[$name];
}
}