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


PHP Registry::toString方法代码示例

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


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

示例1: admin_postinstall_eaccelerator_action

/**
 * Disables the unsupported eAccelerator caching method, replacing it with the
 * "file" caching method.
 *
 * @return  void
 *
 * @since   3.2
 */
function admin_postinstall_eaccelerator_action()
{
    $prev = new JConfig();
    $prev = JArrayHelper::fromObject($prev);
    $data = array('cacheHandler' => 'file');
    $data = array_merge($prev, $data);
    $config = new Registry('config');
    $config->loadArray($data);
    jimport('joomla.filesystem.path');
    jimport('joomla.filesystem.file');
    // Set the configuration file path.
    $file = JPATH_CONFIGURATION . '/configuration.php';
    // Get the new FTP credentials.
    $ftp = JClientHelper::getCredentials('ftp', true);
    // Attempt to make the file writeable if using FTP.
    if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) {
        JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'));
    }
    // Attempt to write the configuration file as a PHP class named JConfig.
    $configuration = $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false));
    if (!JFile::write($file, $configuration)) {
        JFactory::getApplication()->enqueueMessage(JText::_('COM_CONFIG_ERROR_WRITE_FAILED'), 'error');
        return;
    }
    // Attempt to make the file unwriteable if using FTP.
    if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) {
        JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'));
    }
}
开发者ID:grlf,项目名称:eyedock,代码行数:37,代码来源:eaccelerator.php

示例2: save

 /**
  * Actually Save the params into the db
  */
 public function save()
 {
     $db = $this->container->db;
     $data = $this->params->toString();
     $sql = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('params') . ' = ' . $db->q($data))->where($db->qn('element') . ' = ' . $db->q($this->container->componentName))->where($db->qn('type') . ' = ' . $db->q('component'));
     $db->setQuery($sql);
     try {
         $db->execute();
     } catch (\Exception $e) {
         // Don't sweat if it fails
     }
 }
开发者ID:akeeba,项目名称:fof,代码行数:15,代码来源:Params.php

示例3: storeData

 /**
  * Store data used during process of payment.
  *
  * <code>
  * $paymentSessionId  = 1;
  * $orderId           = "ORDER2";
  *
  * $paymentSession    = new Crowdfunding\Payment\Session(\JFactory::getDbo());
  * $paymentSession->load($paymentSessionId);
  *
  * $paymentSession->setData('order_id', $orderId);
  * $paymentSession->storeData();
  * </code>
  *
  * @return self
  */
 public function storeData()
 {
     // Convert the gateway data to JSON format.
     $gatewayData = 'NULL';
     if ($this->gateway_data instanceof Registry) {
         $gatewayData = $this->gateway_data->toString();
     }
     $query = $this->db->getQuery(true);
     $query->update($this->db->quoteName('#__crowdf_payment_sessions'))->set($this->db->quoteName('gateway_data') . '=' . $this->db->quote($gatewayData))->where($this->db->quoteName('id') . '=' . $this->db->quote($this->id));
     $this->db->setQuery($query);
     $this->db->execute();
     return $this;
 }
开发者ID:ITPrism,项目名称:CrowdfundingDistribution,代码行数:29,代码来源:Session.php

示例4: insertObject

 protected function insertObject()
 {
     $query = $this->db->getQuery(true);
     $query->insert($this->db->quoteName('#__gfy_badges'))->set($this->db->quoteName('title') . '=' . $this->db->quote($this->title))->set($this->db->quoteName('image') . '=' . $this->db->quote($this->image))->set($this->db->quoteName('published') . '=' . (int) $this->published)->set($this->db->quoteName('group_id') . '=' . (int) $this->group_id)->set($this->db->quoteName('points_number') . '=' . $this->db->quote($this->points_number))->set($this->db->quoteName('points_id') . '=' . $this->db->quote($this->points_id))->set($this->db->quoteName('params') . ' = ' . $this->db->quote($this->params->toString()))->set($this->db->quoteName('custom_data') . ' = ' . $this->db->quote($this->custom_data->toString()));
     if ($this->note !== null and $this->note !== '') {
         $query->set($this->db->quoteName('note') . '=' . $this->db->quote($this->note));
     }
     if ($this->description !== null and $this->description !== '') {
         $query->set($this->db->quoteName('description') . '=' . $this->db->quote($this->description));
     }
     if ($this->activity_text !== null and $this->activity_text !== '') {
         $query->set($this->db->quoteName('activity_text') . '=' . $this->db->quote($this->activity_text));
     }
     $this->db->setQuery($query);
     $this->db->execute();
     return $this->db->insertid();
 }
开发者ID:ITPrism,项目名称:GamificationDistribution,代码行数:17,代码来源:Badge.php

示例5: checkout

 /**
  * checkout
  *
  * @param $profile
  *
  * @return bool
  * @throws \Exception
  */
 public function checkout($profile)
 {
     $listModel = new ProfilesModel();
     $profiles = $listModel->getList();
     if (!in_array($profile, $profiles)) {
         throw new \Exception(sprintf('Profile "%s" not exists.', $name));
     }
     $profileConfig = new Registry();
     $file = JPATH_ROOT . '/tmp/sqlsync/config.yml';
     $profileConfig->loadFile($file);
     $profileConfig->set('profile', $profile);
     $content = $profileConfig->toString('yaml');
     if (!\JFile::write($file, $content)) {
         throw new \Exception('Writing profile config fail.');
     }
     return true;
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:25,代码来源:ProfileModel.php

示例6: insertObject

 protected function insertObject()
 {
     $customData = $this->custom_data instanceof Registry ? $this->custom_data->toString() : '{}';
     $rewards = $this->rewards instanceof Registry ? $this->rewards->toString() : '{}';
     // Create a new query object.
     $query = $this->db->getQuery(true);
     $query->insert($this->db->quoteName('#__gfy_achievements'))->set($this->db->quoteName('title') . '=' . $this->db->quote($this->title))->set($this->db->quoteName('context') . '=' . $this->db->quote($this->context))->set($this->db->quoteName('image') . '=' . $this->db->quote($this->image))->set($this->db->quoteName('image_small') . '=' . $this->db->quote($this->image_small))->set($this->db->quoteName('image_square') . '=' . $this->db->quote($this->image_square))->set($this->db->quoteName('published') . '=' . (int) $this->published)->set($this->db->quoteName('custom_data') . '=' . $this->db->quote($customData))->set($this->db->quoteName('rewards') . '=' . $this->db->quote($rewards))->set($this->db->quoteName('points_id') . '=' . (int) $this->points_id)->set($this->db->quoteName('points_number') . '=' . (int) $this->points_number)->set($this->db->quoteName('group_id') . '=' . (int) $this->group_id);
     if ($this->note !== null and $this->note !== '') {
         $query->set($this->db->quoteName('note') . ' = ' . $this->db->quote($this->note));
     }
     if ($this->description !== null and $this->description !== '') {
         $query->set($this->db->quoteName('description') . ' = ' . $this->db->quote($this->description));
     }
     if ($this->activity_text !== null and $this->activity_text !== '') {
         $query->set($this->db->quoteName('activity_text') . ' = ' . $this->db->quote($this->activity_text));
     }
     $this->db->setQuery($query);
     $this->db->execute();
     return $this->db->insertid();
 }
开发者ID:ITPrism,项目名称:GamificationDistribution,代码行数:20,代码来源:Achievement.php

示例7: fixUpdateVersion

 /**
  * Fix Joomla version in #__extensions table if wrong (doesn't equal JVersion short version).
  *
  * @return   mixed  string update version if success, false if fail.
  */
 public function fixUpdateVersion()
 {
     $table = JTable::getInstance('Extension');
     $table->load('700');
     $cache = new Registry($table->manifest_cache);
     $updateVersion = $cache->get('version');
     $cmsVersion = new JVersion();
     if ($updateVersion == $cmsVersion->getShortVersion()) {
         return $updateVersion;
     } else {
         $cache->set('version', $cmsVersion->getShortVersion());
         $table->manifest_cache = $cache->toString();
         if ($table->store()) {
             return $cmsVersion->getShortVersion();
         } else {
             return false;
         }
     }
 }
开发者ID:Rajiii4u,项目名称:joomla-cms,代码行数:24,代码来源:database.php

示例8: testToString

 /**
  * Test the Joomla\Registry\Registry::toString method.
  *
  * @return  void
  *
  * @covers  Joomla\Registry\Registry::toString
  * @since   1.0
  */
 public function testToString()
 {
     $a = new Registry();
     $a->set('foo1', 'testtostring1');
     $a->set('foo2', 'testtostring2');
     $a->set('config.foo3', 'testtostring3');
     $this->assertThat(trim($a->toString('JSON')), $this->equalTo('{"foo1":"testtostring1","foo2":"testtostring2","config":{"foo3":"testtostring3"}}'), 'Line: ' . __LINE__ . '.');
     $this->assertThat(trim($a->toString('INI')), $this->equalTo("foo1=\"testtostring1\"\nfoo2=\"testtostring2\"\n\n[config]\nfoo3=\"testtostring3\""), 'Line: ' . __LINE__ . '.');
 }
开发者ID:ZerGabriel,项目名称:joomla-framework,代码行数:17,代码来源:RegistryTest.php

示例9: Registry

$config = new Registry();
$config->loadObject(new JConfig());
$options = $this->input->getVar('install');
$options['select'] = false;
$options['driver'] = $config->get('driver');
$db = JDatabaseDriver::getInstance($options);
try {
    // Create
    $db->setQuery('CREATE DATABASE IF NOT EXISTS ' . $db->qn($options['database']) . ' CHARACTER SET = "utf8"')->execute();
    $db->select($options['database']);
    // Import
    $sql = new SplFileInfo(JPATH_BASE . '/ezset-sql-backup.sql');
    $queries = file_get_contents($sql->getPathname());
    $queries = $db->splitSql($queries);
    foreach ($queries as $query) {
        $db->setQuery($query)->execute();
    }
    $config->set('host', $options['host']);
    $config->set('db', $options['database']);
    $config->set('password', $options['password']);
    $config->set('user', $options['user']);
    $config->set('log_path', JPATH_BASE . '/logs');
    $config->set('tmp_path', JPATH_BASE . '/tmp');
    file_put_contents($configFile->getPathname(), $config->toString('php', array('class' => 'JConfig')));
    // Fix UTF-8 files
    \Ezset\Library\Backup\Backup::fix();
    $this->redirect('index.php?page=complete');
} catch (\Exception $e) {
    echo $e;
    exit;
}
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:31,代码来源:install.php

示例10: _createConfiguration

 /**
  * Method to create the configuration file
  *
  * @param   array  $options  The session options
  *
  * @return  boolean  True on success
  *
  * @since   3.1
  */
 public function _createConfiguration($options)
 {
     // Create a new registry to build the configuration options.
     $registry = new Registry();
     // Site settings.
     $registry->set('offline', $options->site_offline);
     $registry->set('offline_message', JText::_('INSTL_STD_OFFLINE_MSG'));
     $registry->set('display_offline_message', 1);
     $registry->set('offline_image', '');
     $registry->set('sitename', $options->site_name);
     $registry->set('editor', 'tinymce');
     $registry->set('captcha', '0');
     $registry->set('list_limit', 20);
     $registry->set('access', 1);
     // Debug settings.
     $registry->set('debug', 0);
     $registry->set('debug_lang', 0);
     // Database settings.
     $registry->set('dbtype', $options->db_type);
     $registry->set('host', $options->db_host);
     $registry->set('user', $options->db_user);
     $registry->set('password', $options->db_pass);
     $registry->set('db', $options->db_name);
     $registry->set('dbprefix', $options->db_prefix);
     // Server settings.
     $registry->set('live_site', '');
     $registry->set('secret', JUserHelper::genRandomPassword(16));
     $registry->set('gzip', 0);
     $registry->set('error_reporting', 'default');
     $registry->set('helpurl', $options->helpurl);
     $registry->set('ftp_host', isset($options->ftp_host) ? $options->ftp_host : '');
     $registry->set('ftp_port', isset($options->ftp_host) ? $options->ftp_port : '');
     $registry->set('ftp_user', isset($options->ftp_save) && $options->ftp_save && isset($options->ftp_user) ? $options->ftp_user : '');
     $registry->set('ftp_pass', isset($options->ftp_save) && $options->ftp_save && isset($options->ftp_pass) ? $options->ftp_pass : '');
     $registry->set('ftp_root', isset($options->ftp_save) && $options->ftp_save && isset($options->ftp_root) ? $options->ftp_root : '');
     $registry->set('ftp_enable', isset($options->ftp_host) ? $options->ftp_enable : 0);
     // Locale settings.
     $registry->set('offset', 'UTC');
     // Mail settings.
     $registry->set('mailonline', 1);
     $registry->set('mailer', 'mail');
     $registry->set('mailfrom', $options->admin_email);
     $registry->set('fromname', $options->site_name);
     $registry->set('sendmail', '/usr/sbin/sendmail');
     $registry->set('smtpauth', 0);
     $registry->set('smtpuser', '');
     $registry->set('smtppass', '');
     $registry->set('smtphost', 'localhost');
     $registry->set('smtpsecure', 'none');
     $registry->set('smtpport', '25');
     // Cache settings.
     $registry->set('caching', 0);
     $registry->set('cache_handler', 'file');
     $registry->set('cachetime', 15);
     $registry->set('cache_platformprefix', 0);
     // Meta settings.
     $registry->set('MetaDesc', $options->site_metadesc);
     $registry->set('MetaKeys', '');
     $registry->set('MetaTitle', 1);
     $registry->set('MetaAuthor', 1);
     $registry->set('MetaVersion', 0);
     $registry->set('robots', '');
     // SEO settings.
     $registry->set('sef', 1);
     $registry->set('sef_rewrite', 0);
     $registry->set('sef_suffix', 0);
     $registry->set('unicodeslugs', 0);
     // Feed settings.
     $registry->set('feed_limit', 10);
     $registry->set('feed_email', 'none');
     $registry->set('log_path', JPATH_ADMINISTRATOR . '/logs');
     $registry->set('tmp_path', JPATH_ROOT . '/tmp');
     // Session setting.
     $registry->set('lifetime', 15);
     $registry->set('session_handler', 'database');
     // Generate the configuration class string buffer.
     $buffer = $registry->toString('PHP', array('class' => 'JConfig', 'closingtag' => false));
     // Build the configuration file path.
     $path = JPATH_CONFIGURATION . '/configuration.php';
     // Determine if the configuration file path is writable.
     if (file_exists($path)) {
         $canWrite = is_writable($path);
     } else {
         $canWrite = is_writable(JPATH_CONFIGURATION . '/');
     }
     /*
      * If the file exists but isn't writable OR if the file doesn't exist and the parent directory
      * is not writable we need to use FTP.
      */
     $useFTP = false;
     if (file_exists($path) && !is_writable($path) || !file_exists($path) && !is_writable(dirname($path) . '/')) {
//.........这里部分代码省略.........
开发者ID:N6REJ,项目名称:joomla-cms,代码行数:101,代码来源:configuration.php

示例11: finalise

 /**
  * Called at the end of a list save.
  * Update the created joins with the created list's id and db_table_name
  *
  * @param   FabrikTableList $row List data
  *
  * @return  void
  */
 public function finalise($row)
 {
     $source = $this->getSourceTableName();
     $targetTable = $row->get('db_table_name');
     foreach ($this->joinIds as $joinId) {
         $joinTable = FabTable::getInstance('Join', 'FabrikTable');
         $joinTable->load($joinId);
         if ((int) $joinTable->get('element_id') === 0) {
             // Group join
             $joinTable->set('list_id', $row->get('id'));
             $joinTable->set('join_from_table', $targetTable);
         } else {
             // Element join
             $tableLookUps = array('join_from_table', 'table_join', 'table_join_alias');
             foreach ($tableLookUps as $tableLookup) {
                 if ($joinTable->get($tableLookup) === $source) {
                     $joinTable->set($tableLookup, $targetTable);
                 }
             }
         }
         $joinTable->store();
     }
     // Update element params with source => target table name conversion
     foreach ($this->elementIds as $elementId) {
         /** @var FabrikTableElement $element */
         $element = FabTable::getInstance('Element', 'FabrikTable');
         $element->load($elementId);
         $elementParams = new Registry($element->params);
         if ($elementParams->get('join_db_name') === $source) {
             $elementParams->set('join_db_name', $targetTable);
             $element->set('params', $elementParams->toString());
             $element->store();
         }
     }
 }
开发者ID:glauberm,项目名称:cinevi,代码行数:43,代码来源:contenttypeimport.php

示例12: save

 /**
  * Save data into the DB
  *
  * @param array $data The data about item
  *
  * @throws \InvalidArgumentException
  * @throws \RuntimeException
  * @throws \UnexpectedValueException
  *
  * @return  int
  */
 public function save($data)
 {
     $id = ArrayHelper::getValue($data, 'id');
     $title = ArrayHelper::getValue($data, 'title');
     $points = ArrayHelper::getValue($data, 'points_number');
     $pointsId = ArrayHelper::getValue($data, 'points_id');
     $groupId = ArrayHelper::getValue($data, 'group_id');
     $published = ArrayHelper::getValue($data, 'published');
     $note = ArrayHelper::getValue($data, 'note');
     $params = ArrayHelper::getValue($data, 'params', [], 'array');
     $description = ArrayHelper::getValue($data, 'description');
     $activityText = ArrayHelper::getValue($data, 'activity_text');
     $customData = Gamification\Helper::prepareCustomData($data);
     $params = new Registry($params);
     // Load a record from the database
     $row = $this->getTable();
     /** @var $row GamificationTableBadge */
     $row->load($id);
     $row->set('title', $title);
     $row->set('points_number', $points);
     $row->set('points_id', $pointsId);
     $row->set('group_id', $groupId);
     $row->set('published', $published);
     $row->set('note', $note);
     $row->set('description', $description);
     $row->set('activity_text', $activityText);
     $row->set('custom_data', $customData);
     $row->set('params', $params->toString());
     $this->prepareTable($row);
     $this->prepareImage($row, $data);
     $row->store(true);
     return $row->get('id');
 }
开发者ID:ITPrism,项目名称:GamificationDistribution,代码行数:44,代码来源:badge.php

示例13: fixUpdateVersion

 /**
  * Fix Joomla version in #__extensions table if wrong (doesn't equal JVersion short version)
  *
  * @return   mixed  string update version if success, false if fail
  *
  * @since    1.7.0
  */
 public function fixUpdateVersion()
 {
     /** @var ChurchDirectoryTableMember $table */
     $table = JTable::getInstance('Extension');
     $table->load($this->getExtentionId());
     $cache = new Registry($table->manifest_cache);
     $updateVersion = $cache->get('version');
     if ($updateVersion == $this->getCompVersion()) {
         return $updateVersion;
     } else {
         $cache->set('version', $this->getCompVersion());
         $table->manifest_cache = $cache->toString();
         if ($table->store()) {
             return $this->getCompVersion();
         } else {
             return false;
         }
     }
 }
开发者ID:Joomla-Bible-Study,项目名称:joomla_churchdirectory,代码行数:26,代码来源:database.php

示例14: saveParams

 /**
  * Save the parameters object for the library
  *
  * @param   string    $element  Element of the library in the extensions table.
  * @param   Registry  $params   Params to save
  *
  * @return  Registry  A Registry object.
  *
  * @see     Registry
  * @since   3.2
  */
 public static function saveParams($element, $params)
 {
     if (static::isEnabled($element)) {
         // Save params in DB
         $db = JFactory::getDbo();
         $query = $db->getQuery(true)->update($db->quoteName('#__extensions'))->set($db->quoteName('params') . ' = ' . $db->quote($params->toString()))->where($db->quoteName('type') . ' = ' . $db->quote('library'))->where($db->quoteName('element') . ' = ' . $db->quote($element));
         $db->setQuery($query);
         $result = $db->execute();
         // Update params in libraries cache
         if ($result && isset(static::$libraries[$element])) {
             static::$libraries[$element]->params = $params;
         }
         return $result;
     }
     return false;
 }
开发者ID:eshiol,项目名称:joomla-cms,代码行数:27,代码来源:helper.php

示例15: prepareRewards

 /**
  * Prepare rewards that will be given for accomplishing this unit.
  *
  * @param array  $data
  *
  * @throws \InvalidArgumentException
  * @return string
  */
 public static function prepareRewards($data)
 {
     $rewards = ArrayHelper::getValue($data, 'rewards', [], 'array');
     $rewards['points'] = trim($rewards['points']);
     $rewards['points_id'] = (int) $rewards['points_id'];
     // Prepare badge IDs.
     $results = array();
     foreach ($rewards['badge_id'] as $itemId) {
         $itemId = (int) $itemId;
         if (!$itemId) {
             continue;
         }
         $results[] = $itemId;
     }
     $rewards['badge_id'] = $results;
     // Prepare rank IDs.
     $results = array();
     foreach ($rewards['rank_id'] as $itemId) {
         $itemId = (int) $itemId;
         if (!$itemId) {
             continue;
         }
         $results[] = $itemId;
     }
     $rewards['rank_id'] = $results;
     // Prepare badge IDs.
     $results = array();
     foreach ($rewards['reward_id'] as $itemId) {
         $itemId = (int) $itemId;
         if (!$itemId) {
             continue;
         }
         $results[] = $itemId;
     }
     $rewards['reward_id'] = $results;
     $rewards = new Registry($rewards);
     return $rewards->toString();
 }
开发者ID:ITPrism,项目名称:GamificationDistribution,代码行数:46,代码来源:Helper.php


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