예제 #1
0
파일: gantry5.php 프로젝트: naka211/myloyal
 /**
  * Save plugin parameters and trigger the save events.
  *
  * @param array $data
  * @return bool
  * @see JModelAdmin::save()
  */
 public function onGantry5SaveConfig(array $data)
 {
     $name = 'plg_' . $this->_type . '_' . $this->_name;
     // Initialise variables;
     $dispatcher = JEventDispatcher::getInstance();
     $table = JTable::getInstance('Extension');
     // Include the content plugins for the on save events.
     JPluginHelper::importPlugin('extension');
     // Load the row if saving an existing record.
     $table->load(array('type' => 'plugin', 'folder' => $this->_type, 'element' => $this->_name));
     $params = new Joomla\Registry\Registry($table->params);
     $params->loadArray($data);
     $table->params = $params->toString();
     // Check the data.
     if (!$table->check()) {
         throw new RuntimeException($table->getError());
     }
     // Trigger the onContentBeforeSave event.
     $result = $dispatcher->trigger('onExtensionBeforeSave', array($name, &$table, false));
     if (in_array(false, $result, true)) {
         throw new RuntimeException($table->getError());
     }
     // Store the data.
     if (!$table->store()) {
         throw new RuntimeException($table->getError());
     }
     // Clean the cache.
     $this->cleanCache();
     // Trigger the onExtensionAfterSave event.
     $dispatcher->trigger('onExtensionAfterSave', array($name, &$table, false));
     return true;
 }
예제 #2
0
 /**
  * Get vars from request
  * @return stdClass
  */
 protected function _getRequest()
 {
     $data = array('option' => $this->request('option'), 'view' => $this->request('view'), 'layout' => $this->request('layout'), 'tmpl' => $this->request('tmpl', 'index'), 'lang' => $this->request('lang', $this->langDef), 'Itemid' => $this->request('Itemid', 0, 'int'));
     if (class_exists('Joomla\\Registry\\Registry')) {
         $request = new Joomla\Registry\Registry();
         $request->loadArray($data);
     } else {
         if (class_exists('JRegistry')) {
             // is depricated since J!3
             $request = new JRegistry();
             $request->loadArray($data);
         } else {
             $request = (object) $data;
         }
     }
     return $request;
 }