Example #1
0
 /**
  * Push current error documents content
  * values into the view for edition
  * this is a altered version of the same
  * method in the old config view.
  */
 private function _getErrorPageContent()
 {
     // find about sh404sef custom content category id
     $sh404sefContentCatId = Sh404sefHelperCategories::getSh404sefContentCat()->id;
     try {
         // read current content of 404 page in default language
         $article = ShlDbHelper::selectAssoc('#__content', array('id', 'introtext'), array('title' => '__404__', 'catid' => $sh404sefContentCatId, 'language' => '*'));
         $txt404 = empty($article['introtext']) ? JText::_('COM_SH404SEF_DEF_404_MSG') : $article['introtext'];
     } catch (Exception $e) {
         ShlSystem_Log::error('sh404sef', '%s::%s::%d: %s', __CLASS__, __METHOD__, __LINE__, $e->getMessage());
         $txt404 = JText::_('COM_SH404SEF_DEF_404_MSG');
     }
     // push params in to view
     return $txt404;
 }
 /**
  * Save parameters, then delete a plugin
  *
  * @param string $pluginName, the plugin name, mathcing 'element' column in plugins table
  * @param string $folder, the plugin folder (ie : 'content', 'search', 'system',...
  */
 private function _shSaveDeletePluginParams($pluginName, $folder, $folders = null)
 {
     try {
         $result = ShlDbHelper::selectAssoc('#__extensions', array('*'), array('type' => 'plugin', 'element' => $pluginName, 'folder' => $folder));
         if (empty($result)) {
             // invalid plugin name?
             return false;
         }
         // remove plugin db id
         $pluginId = $result['extension_id'];
         unset($result['extension_id']);
         // write everything on disk
         $this->_shWriteExtensionConfig($pluginName, array('shConfig' => $result));
         // now uninstall
         $installer = new JInstaller();
         $result = $installer->uninstall('plugin', $pluginId);
         // now remove plugin details from db
         //ShlDbHelper::delete( '#__extensions', array( 'type' => 'plugin', 'element' => $pluginName, 'folder' => $folder));
     } catch (Exception $e) {
     }
     // delete the plugin files
     //$basePath = JPATH_ROOT. '/plugins/' . $folder . '/' . $pluginName;
     //if (JFolder::exists($basePath)) {
     //  JFolder::delete( $basePath);
     //}
 }