当前位置: 首页>>代码示例>>PHP>>正文


PHP JParameter::setValue方法代码示例

本文整理汇总了PHP中JParameter::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP JParameter::setValue方法的具体用法?PHP JParameter::setValue怎么用?PHP JParameter::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JParameter的用法示例。


在下文中一共展示了JParameter::setValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

	public function save()
	{
		$data = self::$registry->toString('INI');
		
		$db =& JFactory::getDBO();
		
		// An interesting discovery: if your component is manually updating its
		// component parameters before Live Update is called, then calling Live
		// Update will reset the modified component parameters because
		// JComponentHelper::getComponent() returns the old, cached version of
		// them. So, we have to forget the following code and shoot ourselves in
		// the feet. Dammit!!!
		/*
		jimport('joomla.html.parameter');
		jimport('joomla.application.component.helper');
		$component =& JComponentHelper::getComponent(self::$component);
		$params = new JParameter($component->params);
		$params->setValue(self::$key, $data);
		*/

		if( version_compare(JVERSION,'1.6.0','ge') ) {
			$sql = 'SELECT '.$db->nameQuote('params').' FROM '.$db->nameQuote('#__extensions').
				' WHERE '.$db->nameQuote('type').' = '.$db->Quote('component').' AND '.
				$db->nameQuote('element').' = '.$db->Quote(self::$component);
			$db->setQuery($sql);
		} else {
			$sql = 'SELECT '.$db->nameQuote('params').' FROM '.$db->nameQuote('#__components').
				' WHERE '.$db->nameQuote('option').' = '.$db->Quote(self::$component).
				" AND `parent` = 0 AND `menuid` = 0";
			$db->setQuery($sql);
		}
		$rawparams = $db->loadResult();
		$params = new JParameter($rawparams);
		$params->setValue(self::$key, $data);
		
		if( version_compare(JVERSION,'1.6.0','ge') )
		{
			// Joomla! 1.6
			$data = $params->toString('JSON');
			$sql = 'UPDATE `#__extensions` SET `params` = '.$db->Quote($data).' WHERE '.
				"`element` = ".$db->Quote(self::$component)." AND `type` = 'component'";
		}
		else
		{
			// Joomla! 1.5
			$data = $params->toString('INI');
			$sql = 'UPDATE `#__components` SET `params` = '.$db->Quote($data).' WHERE '.
				"`option` = ".$db->Quote(self::$component)." AND `parent` = 0 AND `menuid` = 0";
		}

		$db->setQuery($sql);
		$db->query();
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:53,代码来源:component.php

示例2: setUserState

 /**
  * Set user state property into database.
  *
  * @param string $param property name
  * @param string $value property value
  */
 public static function setUserState($param, $value)
 {
     if (isset($_COOKIE['joomdoc'])) {
         $session = (int) $_COOKIE['joomdoc'];
     } else {
         $session = rand(100);
         $uri = JURI::getInstance();
         setcookie('joomdoc', $session, time() + 365 * 24 * 60 * 60, '/', $uri->toString(array('host')));
     }
     $db = JFactory::getDbo();
     $db->setQuery('SELECT `params` FROM `#__joomdoc_userstate` WHERE `session` = ' . $session);
     $params = new JParameter($db->loadResult());
     $params->setValue($param, $value);
     $params = $db->Quote($params->toString());
     $query = 'INSERT INTO `#__joomdoc_userstate` (`session`,`params`) VALUES (' . $session . ',' . $params . ') ';
     $query .= 'ON DUPLICATE KEY UPDATE `params` = ' . $params;
     $db->setQuery($query);
     $db->query();
 }
开发者ID:abdullah929,项目名称:bulletin,代码行数:25,代码来源:user.php

示例3: save

 public function save()
 {
     $enableSRP = $this->input->get('srp', 0, 'bool');
     $enableAutoupdate = $this->input->get('autoupdate', 0, 'bool');
     $runConfwiz = $this->input->get('confwiz', 0, 'bool');
     $angieupgrade = $this->input->get('angieupgrade', 0, 'bool');
     $minStability = $this->input->get('minstability', 'stable', 'cmd');
     $acceptlicense = $this->input->get('acceptlicense', 0, 'bool');
     $acceptsupport = $this->input->get('acceptsupport', 0, 'bool');
     $acceptbackuptest = $this->input->get('acceptbackuptest', 0, 'bool');
     if (!in_array($minStability, array('alpha', 'beta', 'rc', 'stable'))) {
         $minStability = 'stable';
     }
     // SRP is only supported on MySQL databases
     if (!$this->isMySQL()) {
         $enableSRP = false;
     }
     $db = JFactory::getDBO();
     if ($enableSRP) {
         $query = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('enabled') . ' = ' . $db->q('1'))->where($db->qn('element') . ' = ' . $db->q('srp'))->where($db->qn('folder') . ' = ' . $db->q('system'));
         $db->setQuery($query);
         $db->execute();
     } else {
         $query = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('enabled') . ' = ' . $db->q('0'))->where($db->qn('element') . ' = ' . $db->q('srp'))->where($db->qn('folder') . ' = ' . $db->q('system'));
         $db->setQuery($query);
         $db->execute();
     }
     if ($enableAutoupdate) {
         $query = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('enabled') . ' = ' . $db->q('1'))->where($db->qn('element') . ' = ' . $db->q('oneclickaction'))->where($db->qn('folder') . ' = ' . $db->q('system'));
         $db->setQuery($query);
         $db->execute();
         $query = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('enabled') . ' = ' . $db->q('1'))->where($db->qn('element') . ' = ' . $db->q('akeebaupdatecheck'))->where($db->qn('folder') . ' = ' . $db->q('system'));
         $db->setQuery($query);
         $db->execute();
     } else {
         $query = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('enabled') . ' = ' . $db->q('0'))->where($db->qn('element') . ' = ' . $db->q('oneclickaction'))->where($db->qn('folder') . ' = ' . $db->q('system'));
         $db->setQuery($query);
         $db->execute();
         $query = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('enabled') . ' = ' . $db->q('0'))->where($db->qn('element') . ' = ' . $db->q('akeebaupdatecheck'))->where($db->qn('folder') . ' = ' . $db->q('system'));
         $db->setQuery($query);
         $db->execute();
     }
     if ($angieupgrade) {
         $this->_angieUpgrade();
     }
     // Update last version check and minstability. DO NOT USE JCOMPONENTHELPER!
     $sql = $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'));
     $db->setQuery($sql);
     $rawparams = $db->loadResult();
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $params = new JRegistry();
         if (version_compare(JVERSION, '3.0', 'ge')) {
             $params->loadString($rawparams);
         } else {
             $params->loadJSON($rawparams);
         }
     } else {
         $params = new JParameter($rawparams);
     }
     if ($acceptlicense && $acceptsupport) {
         $version = AKEEBA_VERSION;
     } else {
         $version = '0.0.0';
     }
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $params->set('lastversion', $version);
         $params->set('minstability', $minStability);
         $params->set('acceptlicense', $acceptlicense);
         $params->set('acceptsupport', $acceptsupport);
         $params->set('acceptbackuptest', $acceptbackuptest);
         $params->set('angieupgrade', $angieupgrade ? 1 : 0);
     } else {
         $params->setValue('lastversion', $version);
         $params->setValue('minstability', $minStability);
         $params->setValue('acceptlicense', $acceptlicense);
         $params->setValue('acceptsupport', $acceptsupport);
         $params->setValue('acceptbackuptest', $acceptbackuptest);
         $params->setValue('angieupgrade', $angieupgrade ? 1 : 0);
     }
     $data = $params->toString('JSON');
     $sql = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('params') . ' = ' . $db->q($data))->where($db->qn('element') . ' = ' . $db->q('com_akeeba'))->where($db->qn('type') . ' = ' . $db->q('component'));
     $db->setQuery($sql);
     $db->execute();
     // Even better, create the "akeeba.lastversion.php" file with this information
     $fileData = "<" . "?php\ndefined('_JEXEC') or die();\ndefine('AKEEBA_LASTVERSIONCHECK','" . $version . "');";
     JLoader::import('joomla.filesystem.file');
     $fileName = JPATH_COMPONENT_ADMINISTRATOR . '/akeeba.lastversion.php';
     JFile::write($fileName, $fileData);
     // Force reload the Live Update information
     if ($version != '0.0.0') {
         $dummy = LiveUpdate::getUpdateInformation(true);
     }
     // Run the configuration wizard if requested
     $message = '';
     if ($runConfwiz) {
         $url = 'index.php?option=com_akeeba&view=confwiz';
     } else {
         $url = 'index.php?option=com_akeeba&view=cpanel';
     }
     if (!$acceptlicense) {
//.........这里部分代码省略.........
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:101,代码来源:postsetup.php

示例4: save

 public function save()
 {
     $enableSRP = JRequest::getBool('srp', 0);
     $enableAutoupdate = JRequest::getBool('autoupdate', 0);
     $runConfwiz = JRequest::getBool('confwiz', 0);
     $db = JFactory::getDBO();
     if ($enableSRP) {
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             $query = "UPDATE #__extensions SET enabled=1 WHERE element='srp' AND folder='system'";
             $db->setQuery($query);
             $db->query();
         } else {
             $query = "UPDATE #__plugins SET published=1 WHERE element='srp' AND folder='system'";
             $db->setQuery($query);
             $db->query();
         }
     } else {
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             $query = "UPDATE #__extensions SET enabled=0 WHERE element='srp' AND folder='system'";
             $db->setQuery($query);
             $db->query();
         } else {
             $query = "UPDATE #__plugins SET published=0 WHERE element='srp' AND folder='system'";
             $db->setQuery($query);
             $db->query();
         }
     }
     if ($enableAutoupdate) {
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             $query = "UPDATE #__extensions SET enabled=1 WHERE element='oneclickaction' AND folder='system'";
             $db->setQuery($query);
             $db->query();
             $query = "UPDATE #__extensions SET enabled=1 WHERE element='akeebaupdatecheck' AND folder='system'";
             $db->setQuery($query);
             $db->query();
         } else {
             $query = "UPDATE #__plugins SET published=1 WHERE element='oneclickaction' AND folder='system'";
             $db->setQuery($query);
             $db->query();
             $query = "UPDATE #__plugins SET published=1 WHERE element='akeebaupdatecheck' AND folder='system'";
             $db->setQuery($query);
             $db->query();
         }
     } else {
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             $query = "UPDATE #__extensions SET enabled=0 WHERE element='oneclickaction' AND folder='system'";
             $db->setQuery($query);
             $db->query();
             $query = "UPDATE #__extensions SET enabled=0 WHERE element='akeebaupdatecheck' AND folder='system'";
             $db->setQuery($query);
             $db->query();
         } else {
             $query = "UPDATE #__plugins SET published=0 WHERE element='oneclickaction' AND folder='system'";
             $db->setQuery($query);
             $db->query();
             $query = "UPDATE #__plugins SET published=0 WHERE element='akeebaupdatecheck' AND folder='system'";
             $db->setQuery($query);
             $db->query();
         }
     }
     // Update last version check. DO NOT USE JCOMPONENTHELPER!
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $sql = 'SELECT ' . $db->nameQuote('params') . ' FROM ' . $db->nameQuote('#__extensions') . ' WHERE ' . $db->nameQuote('type') . ' = ' . $db->Quote('component') . ' AND ' . $db->nameQuote('element') . ' = ' . $db->Quote('com_akeeba');
         $db->setQuery($sql);
     } else {
         $sql = 'SELECT ' . $db->nameQuote('params') . ' FROM ' . $db->nameQuote('#__components') . ' WHERE ' . $db->nameQuote('option') . ' = ' . $db->Quote('com_akeeba') . " AND `parent` = 0 AND `menuid` = 0";
         $db->setQuery($sql);
     }
     $rawparams = $db->loadResult();
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $params = new JRegistry();
         $params->loadJSON($rawparams);
     } else {
         $params = new JParameter($rawparams);
     }
     $params->setValue('lastversion', AKEEBA_VERSION);
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         // Joomla! 1.6
         $data = $params->toString('JSON');
         $sql = 'UPDATE `#__extensions` SET `params` = ' . $db->Quote($data) . ' WHERE ' . "`element` = " . $db->Quote('com_akeeba') . " AND `type` = 'component'";
     } else {
         // Joomla! 1.5
         $data = $params->toString('INI');
         $sql = 'UPDATE `#__components` SET `params` = ' . $db->Quote($data) . ' WHERE ' . "`option` = " . $db->Quote('com_akeeba') . " AND `parent` = 0 AND `menuid` = 0";
     }
     $db->setQuery($sql);
     $db->query();
     // Even better, create the "akeeba.lastversion.php" file with this information
     $fileData = "<" . "?php\ndefined('_JEXEC') or die();\ndefine('AKEEBA_LASTVERSIONCHECK','" . AKEEBA_VERSION . "');";
     jimport('joomla.filesystem.file');
     $fileName = JPATH_COMPONENT_ADMINISTRATOR . '/akeeba.lastversion.php';
     JFile::write($fileName, $fileData);
     // Force reload the Live Update information
     $dummy = LiveUpdate::getUpdateInformation(true);
     // Run the configuration wizard if requested
     if ($runConfwiz) {
         $url = 'index.php?option=com_akeeba&view=confwiz';
     } else {
         $url = 'index.php?option=com_akeeba&view=cpanel';
     }
//.........这里部分代码省略.........
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:101,代码来源:postsetup.php

示例5: install

 function install($theme)
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $package = $this->_getPackageFromUpload();
     if (!$package) {
         JError::raiseWarning(1, JText::_('COM_PHOCAGALLERY_ERROR_FIND_INSTALL_PACKAGE'));
         $this->deleteTempFiles();
         return false;
     }
     if ($package['dir'] && JFolder::exists($package['dir'])) {
         $this->setPath('source', $package['dir']);
     } else {
         JError::raiseWarning(1, JText::_('COM_PHOCAGALLERY_ERROR_INSTALL_PATH_NOT_EXISTS'));
         $this->deleteTempFiles();
         return false;
     }
     // We need to find the installation manifest file
     if (!$this->_findManifest()) {
         JError::raiseWarning(1, JText::_('COM_PHOCAGALLERY_ERROR_FIND_INFO_INSTALL_PACKAGE'));
         $this->deleteTempFiles();
         return false;
     }
     // Files - copy files in manifest
     foreach ($this->_manifest->children() as $child) {
         if (is_a($child, 'JXMLElement') && $child->name() == 'files') {
             if ($this->parseFiles($child) === false) {
                 JError::raiseWarning(1, JText::_('COM_PHOCAGALLERY_ERROR_FIND_INFO_INSTALL_PACKAGE'));
                 $this->deleteTempFiles();
                 return false;
             }
         }
     }
     // File - copy the xml file
     $copyFile = array();
     $path['src'] = $this->getPath('manifest');
     // XML file will be copied too
     $path['dest'] = JPATH_SITE . DS . 'components' . DS . 'com_phocagallery' . DS . 'assets' . DS . 'images' . DS . basename($this->getPath('manifest'));
     $copyFile[] = $path;
     $this->copyFiles($copyFile, array());
     $this->deleteTempFiles();
     // -------------------
     // Themes
     // -------------------
     // Params -  Get new themes params
     $paramsThemes = $this->getParamsThemes();
     // -------------------
     // Component
     // -------------------
     if (isset($theme['component']) && $theme['component'] == 1) {
         $component = 'com_phocagallery';
         $paramsC = JComponentHelper::getParams($component);
         foreach ($paramsThemes as $keyT => $valueT) {
             $paramsC->setValue($valueT['name'], $valueT['value']);
         }
         $data['params'] = $paramsC->toArray();
         $table = JTable::getInstance('extension');
         $idCom = $table->find(array('element' => $component));
         $table->load($idCom);
         if (!$table->bind($data)) {
             JError::raiseWarning(500, 'Not a valid component');
             return false;
         }
         // pre-save checks
         if (!$table->check()) {
             JError::raiseWarning(500, $table->getError('Check Problem'));
             return false;
         }
         // save the changes
         if (!$table->store()) {
             JError::raiseWarning(500, $table->getError('Store Problem'));
             return false;
         }
     }
     // -------------------
     // Menu Categories
     // -------------------
     if (isset($theme['categories']) && $theme['categories'] == 1) {
         $link = 'index.php?option=com_phocagallery&view=categories';
         $where = array();
         $where[] = 'link = ' . $db->Quote($link);
         $query = 'SELECT id, params FROM #__menu WHERE ' . implode(' AND ', $where);
         $db->setQuery($query);
         $itemsCat = $db->loadObjectList();
         if (!empty($itemsCat)) {
             foreach ($itemsCat as $keyIT => $valueIT) {
                 $query = 'SELECT m.params FROM #__menu AS m WHERE m.id = ' . (int) $valueIT->id;
                 $db->setQuery($query);
                 $paramsCJSON = $db->loadResult();
                 //$paramsCJSON = $valueIT->params;
                 $paramsMc = new JParameter();
                 $paramsMc->loadJSON($paramsCJSON);
                 foreach ($paramsThemes as $keyT => $valueT) {
                     $paramsMc->setValue($valueT['name'], $valueT['value']);
                 }
                 $dataMc['params'] = $paramsMc->toArray();
                 $table =& JTable::getInstance('menu');
                 if (!$table->load((int) $valueIT->id)) {
                     JError::raiseWarning(500, 'Not a valid table');
                     return false;
//.........这里部分代码省略.........
开发者ID:optimosolution,项目名称:marhk,代码行数:101,代码来源:phocagalleryt.php


注:本文中的JParameter::setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。