Пример #1
0
 /**
  * Method to do additional instant update according config change
  *
  * @param	string	Name of changed config parameter
  * @param	mixed	Recent config parameter value
  * @return	void
  */
 protected function instantUpdate($name, $value)
 {
     $input = JFactory::getApplication()->input;
     if ($name == 'disable_all_messages') {
         // Get name of messages table
         $table = '#__jsn_' . substr(JRequest::getCmd('option'), 4) . '_messages';
         // Enable/disable all messages
         $db = JFactory::getDbo();
         $db->setQuery("UPDATE `{$table}` SET published = " . (1 - $value) . " WHERE 1");
         $db->query();
     } elseif ($name == 'languagemanager') {
         // Get variable
         $lang = $input->getVar('languagemanager', array(), 'default', 'array');
         // Install backend languages
         if (isset($lang['a'])) {
             JSNFactory::import('components.com_poweradmin.helpers.language');
             JSNLanguageHelper::installSupportedExtLangs($lang['a']);
             JSNUtilsLanguage::install($lang['a']);
         }
         // Install frontend languages
         if (isset($lang['s'])) {
             JSNUtilsLanguage::install($lang['s'], true);
         }
     } else {
         return parent::instantUpdate($name, $value);
     }
     return true;
 }
Пример #2
0
 /**
  * Register JSN Framework initialization.
  *
  * @return  void
  */
 public function onAfterInitialise()
 {
     // Initialize JSN Framework
     require_once dirname(__FILE__) . '/libraries/loader.php';
     require_once dirname(__FILE__) . '/jsnframework.defines.php';
     // Get application object
     self::$_app = JFactory::getApplication();
     // Get requested component, view and task
     $this->option = self::$_app->input->getCmd('option');
     $this->view = self::$_app->input->getCmd('view');
     $this->task = self::$_app->input->getCmd('task');
     // Redirect to update page if necessary
     if ($this->option == 'com_installer' and $this->view == 'update' and $this->task == 'update.update' and count($cid = (array) self::$_app->input->getVar('cid', array()))) {
         // Check if extension to updated is JoomlaShine product
         $db = JFactory::getDbo();
         $q = $db->getQuery(true);
         $q->select('element');
         $q->from('#__updates');
         $q->where('update_id = ' . (int) $cid[0]);
         $db->setQuery($q);
         $ext = $db->loadResult();
         if (in_array($ext, JSNVersion::$products)) {
             return self::$_app->redirect('index.php?option=' . $ext . '&view=update');
         }
     }
     // Get active language
     $lang = JFactory::getLanguage();
     // Check if language file exists for active language
     if (!file_exists(JPATH_ROOT . '/administrator/language/' . $lang->get('tag') . '/' . $lang->get('tag') . '.plg_system_jsnframework.ini')) {
         // If requested component has the language file, install then load it
         if (file_exists(JPATH_ROOT . '/administrator/components/' . $this->option . '/language/admin/' . $lang->get('tag') . '/' . $lang->get('tag') . '.plg_system_jsnframework.ini')) {
             JSNLanguageHelper::install((array) $lang->get('tag'), false, true);
             $lang->load('plg_system_jsnframework', JPATH_ADMINISTRATOR, null, true);
         } else {
             $lang->load('plg_system_jsnframework', JSN_PATH_FRAMEWORK, null, true);
         }
     } else {
         $lang->load('plg_system_jsnframework', JPATH_ADMINISTRATOR, null, true);
     }
     // Disable notice and warning by default for our products.
     // The reason for doing this is if any notice or warning appeared then handling JSON string will fail in our code.
     if (function_exists('error_reporting') and in_array($this->option, JSNVersion::$products)) {
         error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_STRICT);
     }
     // Set event handlers to detect and update dependency installation / removal
     self::$_app->registerEvent('onExtensionAfterInstall', 'jsnExtFrameworkUpdateDependencyAfterInstallExtension');
     self::$_app->registerEvent('onExtensionBeforeUninstall', 'jsnExtFrameworkUpdateDependencyBeforeUninstallExtension');
     // Do update checking for Joomla! 3.1
     if (self::$_app->isAdmin() and JSNVersion::isJoomlaCompatible('3.1') and in_array($this->option, JSNVersion::$products) and $this->task == 'checkUpdate') {
         $content = $this->checkUpdate();
         // Set header for XML content
         header('Content-Type: application/xml');
         // Send XML content to client
         echo $content;
         // Exit immediately to prevent Joomla! to process further
         exit;
     }
 }
Пример #3
0
 /**
  * Load plugin language.
  *
  * @return  void
  */
 private function _loadLanguage()
 {
     // Get active language
     $language = JFactory::getLanguage();
     self::$_app = JFactory::getApplication();
     // Check if language file exists for active language
     if (!file_exists(JPATH_ROOT . '/administrator/language/' . $language->getDefault() . '/' . $language->getDefault() . '.plg_system_jsnmobilize.ini')) {
         // If requested component has the language file, install then load it
         if (file_exists(JPATH_ROOT . '/administrator/components/' . self::$_app->input->getCmd('option') . '/language/admin/' . $language->getDefault() . '/' . $language->getDefault() . '.plg_system_jsnmobilize.ini')) {
             JSNLanguageHelper::install((array) $language->getDefault(), false, true);
             $language->load('plg_system_jsnmobilize', JPATH_BASE, null, true);
         } else {
             $language->load('plg_system_jsnmobilize', dirname(__FILE__), null, true);
         }
     } else {
         $language->load('plg_system_jsnmobilize', JPATH_BASE, null, true);
     }
 }