/** * method to run after an install/update/uninstall method * * @return void */ public function postflight($type, $parent) { $db = JFactory::getDbo(); try { $q = $db->getQuery(true); $q->update('#__extensions'); $q->set(array('enabled = 1', 'ordering = -5000')); $q->where("element = 'yjsg'"); $q->where("type = 'plugin'", 'AND'); $q->where("folder = 'system'", 'AND'); $db->setQuery($q); method_exists($db, 'execute') ? $db->execute() : $db->query(); } catch (Exception $e) { throw $e; } JLoader::register('Yjsg', JPATH_ROOT . '/plugins/system/yjsg/includes/yjsgcore/classes/yjsg.class.php', true); $this->yjsg = Yjsg::getInstance(); $language = JFactory::getLanguage(); $language->load('plg_system_yjsg', JPATH_ADMINISTRATOR); $yjsgTemplateName = Yjsg::getDefaultTemplate(); $yjsgTemplateNameTxt = ucfirst(Yjsg::getDefaultTemplate()); $defaultTemplate = JPATH_ROOT . '/templates/' . $yjsgTemplateName; $beforeCleanup = JPATH_ROOT . '/templates/' . $yjsgTemplateName . '-beforeCleanup'; $extendFolder = JPATH_ROOT . '/plugins/system/yjsg/includes/yjsgcore/classes/extend/classes/'; $indexContent = ''; if (!JFolder::exists($beforeCleanup) && $this->yjsg->yjtmpl() && $this->yjsg->tmplVersion($yjsgTemplateName) == '1.0.16') { if (JFolder::copy($defaultTemplate, $beforeCleanup)) { $backedUpMsg = $yjsgTemplateNameTxt . JText::_('YJSG_INSTALLER_TMPL_BACKUP'); JFactory::getApplication()->enqueueMessage($backedUpMsg); } else { $nobackupMsg = JText::_('YJSG_INSTALLER_TMPL_NO_BACKUP1') . $yjsgTemplateNameTxt . JText::_('YJSG_INSTALLER_TMPL_NO_BACKUP2'); JError::raiseWarning(100, $nobackupMsg); } } if (JFolder::exists($extendFolder)) { JFolder::delete($extendFolder); JFolder::create($extendFolder); JFile::write($extendFolder . 'index.html', $indexContent); } }
function addShortcodes() { if ($this->yjsg->yjtmpl()) { if ($this->app->isSite()) { $imagemedia = 'index.php?option=com_media&view=images&tmpl=component&asset=com_templates&author=yjsg&fieldid='; } else { $imagemedia = 'administrator/index.php?option=com_media&view=images&tmpl=component&asset=com_templates&author=yjsg&fieldid='; } $document = JFactory::getDocument(); $document->addScriptDeclaration("\n\t\t\tvar siteroot ='" . JURI::root() . "';\n\t\t\tvar sitetemplate ='" . Yjsg::getDefaultTemplate() . "';\n\t\t\tvar imagemedia='{$imagemedia}';\n\t\t\t"); if (intval(JVERSION) < 3) { $tipClass = 'hasTip'; $document->addScript(JURI::root(true) . '/plugins/system/yjsg/assets/src/libraries/jquery.min.js'); $document->addScript(JURI::root(true) . '/plugins/system/yjsg/assets/src/libraries/jquery-noconflict.js'); } $document->addScript(JURI::root(true) . '/plugins/system/yjsg/elements/src/yjsgshortcodes.js'); // Yjsg custom shortcodes from template if (JFolder::exists(YJSGCUSTOMFOLDER . 'yjsgshortcodes' . YJDS)) { $document->addScript(JURI::root(true) . '/templates/' . Yjsg::getDefaultTemplate() . '/custom/yjsgshortcodes/src/yjsgshortcodes.js'); } $document->addStylesheet(JURI::root(true) . '/plugins/system/yjsg/elements/css/yjsgshortcodes.css'); } }