Current Path :
/
home
/
develito
/
public_html
/
modules
/
mod_weblinklogo
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/develito/public_html/modules/mod_weblinklogo/installer.php
<?php /** * @copyright Copyright (C) 2011 Simplify Your Web, Inc. All rights reserved. * @license GNU General Public License version 3 or later; see LICENSE.txt */ // No direct access to this file defined('_JEXEC') or die; jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); /** * Script file of the Weblinklogo module */ class mod_weblinklogoInstallerScript { static $version = '1.2.3'; static $minimum_needed_library_version = '1.3.1'; static $download_link = 'http://www.simplifyyourweb.com/index.php/downloads/category/23-libraries'; static $weblinks_download_link = 'http://extensions.joomla.org/extensions/extension/official-extensions/weblinks'; /** * Called before an install/update method * * @return boolean True on success */ public function preflight($type, $parent) { // check if Weblinks component is present if (!JFolder::exists(JPATH_ROOT.'/components/com_weblinks')) { $message = JText::_('MOD_WEBLINKLOGO_MISSING_WEBLINKSCOMPONENT').'.<br /><a href="'.self::$weblinks_download_link.'" target="_blank">'.JText::_('MOD_WEBLINKLOGO_DOWNLOAD_WEBLINKSCOMPONENT').'</a>.'; JFactory::getApplication()->enqueueMessage($message, 'error'); return false; } // check if syw library is present if (!JFolder::exists(JPATH_ROOT.'/libraries/syw')) { $message = JText::_('SYW_MISSING_SYWLIBRARY').'.<br /><a href="'.self::$download_link.'" target="_blank">'.JText::_('SYW_DOWNLOAD_SYWLIBRARY').'</a>.'; JFactory::getApplication()->enqueueMessage($message, 'error'); return false; } else { jimport('syw.version'); if (SYWVersion::isCompatible(self::$minimum_needed_library_version)) { JFactory::getApplication()->enqueueMessage(JText::_('SYW_COMPATIBLE_SYWLIBRARY'), 'message'); return true; } else { $message = JText::_('SYW_NONCOMPATIBLE_SYWLIBRARY').'.<br />'.JText::_('SYW_UPDATE_SYWLIBRARY').JText::_('SYW_OR').'<a href="'.self::$download_link.'" target="_blank">'.strtolower(JText::_('SYW_DOWNLOAD_SYWLIBRARY')).'</a>.'; JFactory::getApplication()->enqueueMessage($message, 'error'); return false; } } } /** * Called after an install/update method * * @return boolean True on success */ public function postflight($type, $parent) { echo '<p style="margin: 10px 0 20px 0">'; echo '<img src="../modules/mod_weblinklogo/images/logo.png" />'; echo '<br /><br />'.JText::_('MOD_WEBLINKLOGO_VERSION').' <span class="label">'.self::$version.'</span>'; echo '<br /><br />Olivier Buisard @ <a href="http://www.simplifyyourweb.com" target="_blank">Simplify Your Web</a>'; echo '</p>'; if ($type == 'update') { // delete unnecessary files $files = array(); $files[] = '/modules/mod_weblinklogo/images/normal.png'; $files[] = '/modules/mod_weblinklogo/images/grow.png'; $files[] = '/modules/mod_weblinklogo/images/shrink.png'; $files[] = '/modules/mod_weblinklogo/stylemaster.css.php'; $files[] = '/modules/mod_weblinklogo/style.css.php'; foreach ($files as $file) { if (JFile::exists(JPATH_ROOT.$file) && !JFile::delete(JPATH_ROOT.$file)) { JFactory::getApplication()->enqueueMessage(JText::sprintf('MOD_WEBLINKLOGO_ERROR_DELETINGFILEFOLDER', $file), 'warning'); } } // upgrade warning JFactory::getApplication()->enqueueMessage(JText::_('MOD_WEBLINKLOGO_WARNING_RELEASENOTES'), 'warning'); // remove old cached headers which may interfere with fixes, updates or new additions $filenames_to_delete = array(); $filenames = glob(JPATH_ROOT.'/modules/mod_weblinklogo/style_*.css'); if ($filenames != false) { $filenames_to_delete = array_merge($filenames_to_delete, $filenames); } $filenames = glob(JPATH_ROOT.'/modules/mod_weblinklogo/styles/style_*.css'); if ($filenames != false) { $filenames_to_delete = array_merge($filenames_to_delete, $filenames); } $filenames = glob(JPATH_ROOT.'/modules/mod_weblinklogo/animation_*.js'); if ($filenames != false) { $filenames_to_delete = array_merge($filenames_to_delete, $filenames); } foreach ($filenames_to_delete as $filename) { if (JFile::exists($filename) && !JFile::delete($filename)) { JFactory::getApplication()->enqueueMessage(JText::sprintf('MOD_WEBLINKLOGO_ERROR_DELETINGFILEFOLDER', $filename), 'warning'); } } // overrides warning $defaultemplate = ''; $db = JFactory::getDBO(); $query = "SELECT template FROM #__template_styles WHERE client_id = 0 AND home = 1"; $db->setQuery($query); try { $defaultemplate = $db->loadResult(); } catch (RuntimeException $e) { JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); return true; } $overrides_path = JPATH_ROOT.'/templates/'.$defaultemplate.'/html/'; if (JFolder::exists($overrides_path.'mod_weblinklogo')) { JFactory::getApplication()->enqueueMessage(JText::_('MOD_WEBLINKLOGO_WARNING_OVERRIDES'), 'warning'); } } // language test $available_languages = array('en-GB', 'fr-FR', 'pt-BR', 'tr-TR', 'sl-SI'); $current_language = JFactory::getLanguage()->getTag(); if (!in_array($current_language, $available_languages)) { JFactory::getApplication()->enqueueMessage(JText::sprintf('MOD_WEBLINKLOGO_INFO_LANGUAGETRANSLATE', JFactory::getLanguage()->getName()), 'notice'); } return true; } /** * Called on installation * * @return boolean True on success */ public function install($parent) {} /** * Called on update * * @return boolean True on success */ public function update($parent) {} /** * Called on uninstallation */ public function uninstall($parent) {} } ?>