Current File : /home/pacjaorg/public_html/kmm/plugins/system/djclassifiedsyt/djclassifiedsyt.script.php |
<?php
/**
* @package DJ-Catalog2-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
{
/**
* 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: #1a7de5; 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">Thank you for installing DJC2-YooTheme-Integration plugin!</p>
<p>The DJC2-YooTheme-Integration is an advanced system plugin for your Joomla and YooTheme! It provides dynamic-content support for DJ-Catalog2 component and many more functions.
If you want to learn how to use DJC2-YooTheme-Integration plugin please read <a target="_blank" href="https://dj-extensions.com/documentation">Documentation</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/documentation">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 DJC2-YooTheme-Integration plugin!'));
return false;
}
if (!JComponentHelper::getComponent('com_djclassifieds', true)->enabled)
{
JFactory::getApplication()->enqueueMessage(JText::_('Please install DJ-Classifieds component before installing DJC2-YooTheme-Integration plugin!'));
return false;
}
}
}
/**
* 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)
{
{
if($type == 'install'){
$db = JFactory::getDbo();
$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();
}
}
}
}