本文整理汇总了PHP中JRegistry::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP JRegistry::toString方法的具体用法?PHP JRegistry::toString怎么用?PHP JRegistry::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRegistry
的用法示例。
在下文中一共展示了JRegistry::toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addService
/**
* Adds the ilike service to user tables;
* @param unknown_type $post
* @param unknown_type $userid
*/
public function addService($post, $userid)
{
TuiyoLoader::helper("parameter");
$table =& TuiyoLoader::table("userplugins", true);
$table->load(null);
//blank
$table->name = "ilike";
$table->type = "service";
$table->userid = (int) $userid;
$table->privacy = '%p00%';
//get parameters;
$registry = new JRegistry();
$postParams = JRequest::getVar('params', array(), 'post', 'array');
if (count($postParams)) {
$registry->loadArray($postParams);
$table->params = $registry->toString();
//store the username and password and anything else;
}
if (!$table->store()) {
echo $table->getError();
return false;
//get the eror;
}
return true;
}
示例2: save
function save($data)
{
// Get the previous configuration.
if (is_object($data)) {
$data = JArrayHelper::fromObject($data);
}
$prev = JTheFactoryHelper::getConfig();
$prev = JArrayHelper::fromObject($prev);
$data = array_merge($prev, $data);
$configfile = JTheFactoryAdminHelper::getConfigFile();
$config = new JRegistry('config');
$config->loadArray($data);
jimport('joomla.filesystem.path');
jimport('joomla.filesystem.file');
jimport('joomla.client.helper');
// Get the new FTP credentials.
$ftp = JClientHelper::getCredentials('ftp', true);
// Attempt to make the file writeable if using FTP.
if (!$ftp['enabled'] && JPath::isOwner($configfile) && !JPath::setPermissions($configfile, '0644')) {
JError::raiseNotice(101, JText::_('FACTORY_SETTINGS_FILE_IS_NOT_WRITABLE'));
}
// Attempt to write the configuration file as a PHP class named JConfig.
$configString = $config->toString('PHP', array('class' => ucfirst(APP_PREFIX) . "Config", 'closingtag' => false));
if (!JFile::write($configfile, $configString)) {
JError::raiseWarning(101, JText::_('FACTORY_SETTINGS_FILE_WRITE_FAILED'));
return false;
}
// Attempt to make the file unwriteable if using FTP.
if (!$ftp['enabled'] && JPath::isOwner($configfile) && !JPath::setPermissions($configfile, '0444')) {
JError::raiseNotice(101, JText::_('FACTORY_SETTINGS_FILE_IS_NOT_WRITABLE'));
}
return true;
}
示例3: save
public function save()
{
$task = $this->getTask();
// get the Application Object
$app = JFactory::getApplication();
// get the payment id
$payment_id = $app->input->getInt('extension_id');
// if payment id exists
if ($payment_id) {
$data = $app->input->getArray($_POST);
$paymentdata = array();
$paymentdata['extension_id'] = $payment_id;
$registry = new JRegistry();
$registry->loadArray($data);
$paymentdata['params'] = $registry->toString('JSON');
try {
F0FTable::getAnInstance('Payment', 'J2StoreTable')->save($paymentdata);
} catch (Exception $e) {
$msg = $e->getMessage();
}
switch ($task) {
case 'apply':
parent::apply();
break;
case 'save':
parent::save();
break;
case 'savenew':
parent::savenew();
break;
}
}
}
示例4: saveParams
/**
* TuiyoParameter::saveParams()
*
* @param mixed $postParams
* @param mixed $key
* @param string $type
* @return
*/
public function saveParams($postParams, $key, $type = "system")
{
jimport('joomla.filesystem.file');
jimport('joomla.client.helper');
// Set FTP credentials, if given
JClientHelper::setCredentialsFromRequest('ftp');
$ftp = JClientHelper::getCredentials('ftp');
$file = TUIYO_CONFIG . DS . strtolower($key) . ".ini";
if (JFile::exists($file)) {
JFile::write($file);
}
if (count($postParams)) {
$registry = new JRegistry();
$registry->loadArray($postParams);
$iniTxt = $registry->toString();
// Try to make the params file writeable
if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0755')) {
JError::raiseNotice('SOME_ERROR_CODE', _('Could not make the template parameter file writable'));
return false;
}
//Write the file
$return = JFile::write($file, $iniTxt);
// Try to make the params file unwriteable
if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) {
JError::raiseNotice('SOME_ERROR_CODE', _('Could not make the template parameter file unwritable'));
return false;
}
if (!$return) {
JError::raiseError(TUIYO_SERVER_ERROR, _("Could not save the template parameters"));
return false;
}
return $return;
}
}
示例5: bind
/**
* Method to bind an associative array or object to the JTable instance.This
* method only binds properties that are publicly accessible and optionally
* takes an array of properties to ignore when binding.
*
* @param mixed $src An associative array or object to bind to the JTable instance.
* @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
*
* @return boolean True on success.
*
* @link http://docs.joomla.org/JTable/bind
* @since 11.1
* @throws InvalidArgumentException
*/
public function bind($src, $ignore = array())
{
if (is_object($src)) {
$src = get_object_vars($src);
}
if (isset($src['params']) && is_array($src['params'])) {
$registry = new JRegistry();
$registry->loadArray($src['params']);
$src['params'] = $registry->toString();
}
if (isset($src['plugins']) && is_array($src['plugins'])) {
$registry = new JRegistry();
$registry->loadArray($src['plugins']);
$src['plugins'] = $registry->toString();
}
if (isset($src['rules']) && is_array($src['rules'])) {
$rules = array();
foreach ((array) $src['rules'] as $action => $ids) {
$rules[$action] = array();
foreach ($ids as $id => $p) {
if ($p !== '') {
$rules[$action][$id] = $p == '1' || $p == 'true' ? true : false;
}
}
}
$this->setRules(new JAccessRules($rules));
}
return parent::bind($src, $ignore);
}
示例6: wizardstep
public function wizardstep()
{
$wizardstep = (int) $this->input->getInt('wizardstep', 0);
// Fetch the component parameters
$db = JFactory::getDbo();
$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_akeebasubs'));
$db->setQuery($sql);
$rawparams = $db->loadResult();
$params = new JRegistry();
$params->loadString($rawparams, 'JSON');
// Set the wzardstep parameter to whatever we were told to
$params->set('wizardstep', $wizardstep);
// Save the component parameters
$data = $params->toString('JSON');
$sql = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('params') . ' = ' . $db->q($data))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_akeebasubs'));
$db->setQuery($sql);
$db->execute();
// Redirect back to the control panel
$url = '';
$returnurl = $this->input->getBase64('returnurl', '');
if (!empty($returnurl)) {
$url = base64_decode($returnurl);
}
if (empty($url)) {
$url = JURI::base() . 'index.php?option=com_akeebasubs';
}
$this->setRedirect($url);
}
示例7: save
function save()
{
$config = new JRegistry('config');
$config_array = array();
// affichage des boutons
$config_array['bt_jamendo'] = JRequest::getVar('bt_jamendo', 0, 'post', 'int');
$config_array['bt_artiste'] = JRequest::getVar('bt_artiste', 0, 'post', 'int');
$config_array['bt_categories'] = JRequest::getVar('bt_categories', 0, 'post', 'int');
$config_array['bt_sms'] = JRequest::getVar('bt_sms', 0, 'post', 'int');
$config_array['bt_stats'] = JRequest::getVar('bt_stats', 0, 'post', 'int');
$config_array['bt_aide'] = JRequest::getVar('bt_aide', 0, 'post', 'int');
$config->loadArray($config_array);
//Fichier de configuration
$fname = JPATH_BASE . "/components/com_muzeetop/config.php";
//écriture du fichier
jimport('joomla.filesystem.file');
$string = $config->toString('PHP', array('class' => 'JMztOptions'));
if (JFile::write($fname, &$string)) {
$msg = JTEXT::_('COM_MUZEETOP_OPTIONS_ENREGISTRE');
} else {
$msg = JTEXT::_('COM_MUZEETOP_ERREUR_OPTIONS_ENREGISTRE');
}
$link = 'index.php?option=com_muzeetop';
$this->setRedirect($link, $msg);
}
示例8: 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 JRegistry('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'));
}
}
示例9: saveDetails
function saveDetails()
{
jimport('joomla.filesystem.file');
$option = JRequest::getVar('option', '', '', 'cmd');
$post = JRequest::get('post');
$basepath = JPATH_ADMINISTRATOR . '/components/com_jsecure';
$configFile = $basepath . '/params.php';
$xml = $basepath . '/com_jsecure.xml';
require_once $configFile;
// Read the ini file
if (JFile::exists($configFile)) {
$content = JFile::read($configFile);
} else {
$content = null;
}
$config = new JRegistry('JSecureConfig');
$config_array = array();
$config_array['publish'] = JRequest::getVar('publish', 0, 'post', 'int');
$config_array['enableMasterPassword'] = JRequest::getVar('enableMasterPassword', 0, 'post', 'int');
$config_array['master_password'] = JRequest::getVar('master_password', '', 'post', 'string');
$config_array['passkeytype'] = JRequest::getVar('passkeytype', 'url', 'post', 'string');
$config_array['key'] = JRequest::getVar('key', '', 'post', 'string');
$config_array['options'] = JRequest::getVar('options', 0, 'post', 'string');
$config_array['custom_path'] = JRequest::getVar('custom_path', '', 'post', 'string');
$config_array['sendemail'] = JRequest::getVar('sendemail', 0, 'post', 'string');
$config_array['sendemaildetails'] = JRequest::getVar('sendemaildetails', '3', 'post', 'string');
$config_array['emailid'] = JRequest::getVar('emailid', '', 'post', 'string');
$config_array['emailsubject'] = JRequest::getVar('emailsubject', '', 'post', 'string');
$config_array['iptype'] = JRequest::getVar('iptype', 0, 'post', 'int');
$config_array['iplist'] = JRequest::getVar('iplist', '', 'post', 'string');
$config_array['mpsendemail'] = JRequest::getVar('mpsendemail', 0, 'post', 'int');
$config_array['mpemailsubject'] = JRequest::getVar('mpemailsubject', '', 'post', 'string');
$config_array['mpemailid'] = JRequest::getVar('mpemailid', '', 'post', 'string');
$oldValue = new JSecureConfig();
if ($config_array['key'] == '') {
$config_array['key'] = $oldValue->key;
} else {
$keyvalue = $config_array['key'];
$config_array['key'] = md5(base64_encode($config_array['key']));
}
if ($config_array['master_password'] == '') {
$config_array['master_password'] = $oldValue->master_password;
} else {
$masterkeyvalue = $config_array['master_password'];
$config_array['master_password'] = md5(base64_encode($config_array['master_password']));
}
$modifiedFieldName = $this->checkModifiedFieldName($config_array, $oldValue, $JSecureCommon, $keyvalue, $masterkeyvalue);
$config->loadArray($config_array);
$fname = JPATH_COMPONENT_ADMINISTRATOR . DS . 'params.php';
if (JFile::write($fname, $config->toString('PHP', 'JSecureConfig', array('class' => 'JSecureConfig')))) {
$msg = JText::_('The Configuration Details have been updated');
} else {
$msg = JText::_('ERRORCONFIGFILE');
}
$JSecureConfig = new JSecureConfig();
if ($JSecureConfig->mpsendemail != '0') {
$result = $this->sendmail($JSecureConfig, $modifiedFieldName);
}
return true;
}
示例10: install
public function install($adapter)
{
/** @var $plugin JTableExtension */
$plugin = JTable::getInstance('extension');
if (!$plugin->load(array('type' => 'plugin', 'folder' => 'system', 'element' => 'communitybuilder'))) {
return false;
}
/** @var $legacy JTableExtension */
$legacy = JTable::getInstance('extension');
if ($legacy->load(array('type' => 'plugin', 'folder' => 'system', 'element' => 'cbcoreredirect'))) {
$pluginParams = new JRegistry();
$pluginParams->loadString($plugin->get('params'));
$legacyParams = new JRegistry();
$legacyParams->loadString($legacy->get('params'));
$pluginParams->set('rewrite_urls', $legacyParams->get('rewrite_urls', 1));
$pluginParams->set('itemids', $legacyParams->get('itemids', 1));
$plugin->set('params', $pluginParams->toString());
$installer = new JInstaller();
try {
$installer->uninstall('plugin', $legacy->get('extension_id'));
} catch (RuntimeException $e) {
}
}
$plugin->set('enabled', 1);
return $plugin->store();
}
示例11: bind
public function bind($array, $ignore = '')
{
if (is_object($array))
{
$array = get_object_vars($array);
}
if (isset($array['params']) && !is_string($array['params']))
{
if ($array['params'] instanceof JRegistry)
{
$registry = $array['params'];
}
elseif (is_array($array['params']))
{
$registry = new JRegistry;
$registry->loadArray($array['params']);
}
else
{
$registry = new JRegistry;
}
// TODO: convert to J!2.5: (string) $registry
$array['params'] = $registry->toString();
}
return parent::bind($array, $ignore);
}
示例12: render
function render($position = "")
{
global $gantry;
$output = '';
$renderer = $gantry->document->loadRenderer('module');
$options = array('style' => "raw");
$params = array();
$group_params = $gantry->getParams($this->_feature_prefix . "-" . $this->_feature_name, true);
$group_params_reg = new JRegistry();
foreach ($group_params as $param_name => $param_value) {
$group_params_reg->set($param_name, $param_value['value']);
}
if ($position == $this->get('mainmenu-position')) {
$params = $gantry->getParams($this->_feature_prefix . "-" . $this->_feature_name . "-mainmenu", true);
$module = JModuleHelper::getModule('mod_menu', '_z_empty');
$reg = new JRegistry();
foreach ($params as $param_name => $param_value) {
$reg->set($param_name, $param_value['value']);
}
$reg->merge($group_params_reg);
$module->params = $reg->toString();
$output .= $renderer->render($module, $options);
}
return $output;
}
示例13: addActivityHashtag
/**
* Add hashtag to an activity
* @param $tag
* @param $activityId
*/
public function addActivityHashtag($tag, $activityId)
{
$tag = trim($tag);
if ($tag[0] != '#') {
$tag = "#" . $tag;
}
$db = JFactory::getDBO();
$query = 'SELECT id FROM ' . $db->quoteName('#__community_hashtag') . ' WHERE ' . $db->quoteName('tag') . ' LIKE ' . $db->quote(strtolower($tag));
$db->setQuery($query);
$id = $db->loadResult();
if ($id) {
$hashtagTable = JTable::getInstance('Hashtag', 'CTable');
$hashtagTable->load($id);
$hashtagTable->tag = $tag;
$params = new JRegistry($hashtagTable->params);
$tempParam = array_unique(array_merge($params->get('activity_id'), array($activityId)));
$params->set('activity_id', $tempParam);
$hashtagTable->params = $params->toString();
$hashtagTable->store();
} else {
$hashtagTable = JTable::getInstance('Hashtag', 'CTable');
$params = new JRegistry();
$hashtagTable->tag = $tag;
$params->set('activity_id', array($activityId));
$hashtagTable->params = $params->toString();
$hashtagTable->store();
}
}
示例14: install
public function install($parent)
{
// init vars
$installer = $parent->getParent();
$extensions = $this->getAdditionalExtensions($installer);
// install additional extensions
foreach ($extensions as $extension) {
if (!$extension->preInstall() || !$extension->install()) {
// rollback on installation errors
$installer->abort(JText::_('Component') . ' ' . JText::_('Install') . ': ' . JText::_('Error'), 'component');
foreach ($extensions as $extension) {
if ($extension->status) {
$extension->abort();
}
}
break;
}
if ($extension->type == 'plugin') {
$extension->enable();
}
}
// display table
if ($extensions) {
self::displayAdditionalExtensions($extensions);
}
// update tinymce
$db = JFactory::getDBO();
$db->setQuery("SELECT e.params FROM #__extensions AS e WHERE e.name='plg_editors_tinymce'");
$data = new JRegistry($db->loadResult());
$data->set('extended_elements', $data->get('extended_elements') . ',@[data-lightbox],@[data-spotlight]');
$db->setQuery("UPDATE #__extensions AS e SET e.params='" . $data->toString() . "' WHERE e.name='plg_editors_tinymce'");
$db->query();
}
示例15: apply
function apply()
{
$app = JFactory::getApplication();
$configs = JRequest::get('POST');
$model = JFBCFactory::config();
JPluginHelper::importPlugin('socialprofiles');
$profilePlugins = $app->triggerEvent('socialProfilesGetPlugins');
foreach ($profilePlugins as $plugin) {
$pluginName = $plugin->getName();
$settings = new JRegistry();
$search = "profiles_" . $pluginName . "_";
$stdFields = JRequest::getVar('profiles_' . $pluginName);
$settings->loadArray($stdFields);
foreach ($configs as $key => $value) {
$pos = strpos($key, $search);
if ($pos === 0) {
$key = str_replace($search, "", $key);
if (strpos($key, "field_map") != false) {
$key = str_replace("_field_map", ".", $key);
$settings->set('field_map.' . $key, $value);
}
}
}
$model->update("profile_" . $pluginName, $settings->toString());
}
JFBCFactory::log(JText::_('COM_JFBCONNECT_MSG_SETTINGS_UPDATED'));
$this->display();
}