예제 #1
0
 private function markProfilesAsNotConfiguredYet()
 {
     try {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_akeeba'));
         $jsonData = $db->setQuery($query)->loadResult();
         if (class_exists('JRegistry')) {
             $reg = new JRegistry($jsonData);
         } else {
             $reg = new \Joomla\Registry\Registry($jsonData);
         }
         $reg->set('confwiz_upgrade', 1);
         $jsonData = $reg->toString('JSON');
         $query = $db->getQuery()->update($db->qn('#__extensions'))->set($db->qn('params') . ' = ' . $db->q($jsonData))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_akeeba'));
         $db->setQuery($query)->execute();
     } catch (Exception $e) {
         // If that fails it's not the end of the world. The component is still usable, so just swallow any
         // exception.
     }
 }
예제 #2
0
 protected function adjustTemplateSettings()
 {
     $extension = JTable::getInstance('extension');
     if (!$extension->load(array('type' => 'component', 'element' => 'com_templates'))) {
         return;
     }
     $params = new Joomla\Registry\Registry($extension->params);
     $params->set('source_formats', $this->addParam($params->get('source_formats'), array('scss', 'yaml', 'twig')));
     $params->set('font_formats', $this->addParam($params->get('font_formats'), array('eot', 'svg')));
     $extension->params = $params->toString();
     $extension->store();
 }
예제 #3
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;
 }