Esempio n. 1
0
 /**
  * Set plugin parameter.
  * http://stackoverflow.com/questions/22236929/setting-persistent-plugin-parameters-in-joomla-3
  * http://stackoverflow.com/questions/22236929/setting-persistent-plugin-parameters-in-joomla-3
  */
 public static function setPluginParameter($name, $value)
 {
     if (class_exists('JTableExtension')) {
         $db = JFactory::getDBO();
         $extensionTable = new JTableExtension($db);
         //$pluginId = $extensionTable->find('element', self::PLG_NAME);
         $pluginId = self::getPluginId($db);
         if (empty($pluginId)) {
             return false;
         }
         $extensionTable->load($pluginId);
         $plugin =& JPluginHelper::getPlugin(self::PLG_TYPE, self::PLG_NAME);
         if (empty($plugin)) {
             return false;
         }
         $params = self::getPluginParams();
         $params->set($name, $value);
         $extensionTable->bind(array('params' => $params->toString()));
         // check and store
         if (!$extensionTable->check()) {
             return false;
         }
         if (!$extensionTable->store()) {
             return false;
         }
         return true;
     }
     return false;
 }