本文整理汇总了PHP中JParameter::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP JParameter::toString方法的具体用法?PHP JParameter::toString怎么用?PHP JParameter::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JParameter
的用法示例。
在下文中一共展示了JParameter::toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onBeforeDisplayContent
function onBeforeDisplayContent( &$article, &$params, $limitstart ){
//this may fire fron a component other than com_content
if(!file_exists(JPATH_SITE.DS.'plugins'.DS.'system'.DS.'myApiConnectFacebook.php') || ( !array_key_exists('category',$article) && !array_key_exists('showK2Plugins',$params) )){ return; }
if((@$article->id != '') && (@$_POST['fb_sig_api_key'] == '') && class_exists('plgSystemmyApiOpenGraph')){
$row = & JTable::getInstance('content');
$row->load($article->id);
$attribs = new JParameter($row->attribs);
if($attribs->get('ogimage','') == ''){
$attribs->set('ogimage',plgContentmyApiOpenGraphContent::getContentImage($article->text));
$row->attribs = $attribs->toString();
$row->bind($row);
$row->store();
}
//Set open graph tags
if(JRequest::getVar('view','','get') == 'article' || (JRequest::getVar('option','','get') == 'com_k2' && JRequest::getVar('view','','get') == 'item')){
if(isset($article->slug)){
require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
$link = ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid);
}elseif(method_exists('K2HelperRoute','getItemRoute')){
$link = K2HelperRoute::getItemRoute($article->id.':'.urlencode($article->alias),$article->catid.':'.urlencode($article->category->alias));
}else{
error_log('myApi unable to calculate link for the article id '.$article->id);
return;
}
$u =& JURI::getInstance( JURI::base().$link );
$port = ($u->getPort() == '') ? '' : ":".$u->getPort();
$articleURL = 'http://'.$u->getHost().$port.$u->getPath().'?'.$u->getQuery();
$rawText = strip_tags($article->introtext);
$newTags = array();
$newTags['og:title'] = $article->title;
$newTags['og:description'] = (strlen($rawText) > 247) ? substr($rawText,0,247).'...' : $rawText;
$newTags['og:type'] = 'article';
$newTags['og:author'] = (is_object($article->author)) ? $article->author->name : $article->author;
$newTags['og:url'] = $articleURL;
if($attribs->get('ogimage','0') != '0') $newTags['og:image'] = $attribs->get('ogimage');
plgSystemmyApiOpenGraph::setTags($newTags);
}
}
}
示例2: run
function run($form, $actiondata)
{
$params = new JParameter($actiondata->params);
$mainframe =& JFactory::getApplication();
//save the data to db
$db_save_details = $actiondata;
$db_save_details->type = 'db_save';
//create params
$db_save_details_params = new JParameter('');
$db_save_details_params->set('table_name', $mainframe->getCfg('dbprefix') . 'content');
$db_save_details_params->set('model_id', 'Article');
$db_save_details->params = $db_save_details_params->toString();
//set data
$user =& JFactory::getUser();
$form->data['created_by'] = $user->id;
$form->data['created'] = date("Y-m-d H:i:s");
$form->data['catid'] = $params->get('catid', '');
$form->data['sectionid'] = $params->get('sectionid', 0);
$form->data['state'] = $params->get('state', 0);
$form->data['title'] = $form->data[$params->get('title', '')];
$form->data['fulltext'] = $form->data[$params->get('fulltext', '')];
$form->data['introtext'] = isset($form->data[$params->get('introtext', '')]) ? $form->data[$params->get('introtext', '')] : '';
$form->data['created_by_alias'] = $form->data[$params->get('created_by_alias', '')];
//alias
$form->data['alias'] = JFilterOutput::stringURLSafe($form->data['title']);
$form->data['id'] = null;
//$form->data['alias'] = null;
$form->runAction($db_save_details);
}
示例3: up
/**
* Up
**/
public function up()
{
$query = "CREATE TABLE IF NOT EXISTS `jos_announcements` (\n\t\t\t\t\t\t`id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t`scope` varchar(100) DEFAULT NULL,\n\t\t\t\t\t\t`scope_id` int(11) DEFAULT NULL,\n\t\t\t\t\t\t`content` text,\n\t\t\t\t\t\t`priority` tinyint(2) NOT NULL DEFAULT '0',\n\t\t\t\t\t\t`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t\t\t\t\t`created_by` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t\t\t`state` tinyint(2) NOT NULL DEFAULT '0',\n\t\t\t\t\t\t`publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t\t\t\t\t`publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t\t\t\t\t`sticky` tinyint(2) NOT NULL DEFAULT '0',\n\t\t\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
$this->db->setQuery($query);
$this->db->query();
$params = array('plugin_access' => 'members', 'display_tab' => 1);
$this->addPluginEntry('groups', 'announcements', 1, $params);
//get citation params
if ($this->db->tableExists('#__extensions')) {
$sql = "SELECT `params` FROM `#__extensions` WHERE `type`='plugin' AND `element`='messages' AND `folder` = 'groups'";
} else {
$sql = "SELECT `params` FROM `#__plugins` WHERE `element`='messages' AND `folder`='groups'";
}
$this->db->setQuery($sql);
$p = $this->db->loadResult();
//load params object
$params = new \JParameter($p);
//set param to hide messages tab
$params->set('display_tab', 0);
//save new params
if ($this->db->tableExists('#__extensions')) {
$query = "UPDATE `#__extensions` SET `params`=" . $this->db->quote(json_encode($params->toArray())) . " WHERE `element`='messages' AND `folder`='groups'";
} else {
$query = "UPDATE `#__plugins` SET `params`='" . $params->toString() . "' WHERE `element`='messages' AND `folder`='groups'";
}
$this->db->setQuery($query);
$this->db->query();
}
示例4: loadAction
function loadAction($form, $actiondata)
{
$params = new JParameter($actiondata->params);
$output = '';
$mainframe =& JFactory::getApplication();
$document =& JFactory::getDocument();
JHTML::_('behavior.mootools');
$uri =& JFactory::getURI();
$CF_PATH = $mainframe->isSite() ? JURI::Base() : $uri->root();
$document->addScript($CF_PATH . 'administrator/components/com_chronoforms/form_actions/auto_javascript_validation/assets/auto_javascript_validation.js');
$rules = array('required', 'alpha', 'alphanum', 'digit', 'nodigit', 'number', 'email', 'phone', 'phone_inter', 'url', 'image');
ob_start();
?>
window.addEvent('domready', function() {
<?php
$object_list = array();
foreach ($rules as $rule) {
$fields_list = array();
if (trim($params->get($rule, ''))) {
$fields_list = explode(',', trim($params->get($rule, '')));
}
foreach ($fields_list as $k => $field) {
$fields_list[$k] = "'" . $field . "'";
}
$n_fields_list = implode(',', $fields_list);
$object_list[] = "'" . $rule . "': [" . $n_fields_list . "]";
}
?>
new AutoJavascriptValidation('<?php
echo $form->form_name;
?>
', <?php
echo "{" . implode(",", $object_list) . "}";
?>
);
});
<?php
$script = ob_get_clean();
if ((bool) $form->form_params->get('dynamic_files', 0) === false) {
$document->addScriptDeclaration("//<![CDATA[" . "\n" . $script . "\n" . "//]]>");
} else {
//load the action class
$form->loadActionHelper('load_js');
$CfactionLoadJsHelper = new CfactionLoadJsHelper();
$JSactiondata = new stdClass();
$JSactiondata->content1 = $script;
$JSParams = new JParameter('');
$JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0));
$JSactiondata->params = $JSParams->toString();
$CfactionLoadJsHelper->load($form, $JSactiondata);
}
//load validation files
$form->loadActionHelper('show_html');
$CfactionShowHtmlHelper = new CfactionShowHtmlHelper();
$CfactionShowHtmlHelper->_loadValidationScripts($form);
}
示例5: _actionSave
/**
* Saves a configuration
*
* @param KCommandContext $context
*
* @return
*/
protected function _actionSave(KCommandContext $context)
{
$context->append(array('data' => array('params' => array())));
//find or create a new component
$component = $this->getService('repos://admin/components.component')->findOrAddNew(array('option' => 'com_' . $this->getIdentifier()->package), array('data' => array('name' => ucfirst($this->getIdentifier()->package))));
$params = new JParameter('');
$params->loadArray((array) $context->data['params']);
$component->params = $params->toString();
$component->save();
}
示例6: JParameter
function &getIni()
{
static $ini = 0;
if (empty($ini)) {
$basepath = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jdefender';
$p = new JParameter('');
$conf = JD_Vars_Helper::getGroup('configuration');
$p->bind($conf);
$ini = $p->toString('ini');
}
return $ini;
}
示例7: block
/**
* Method to block either an email address or an IP from submitting data
*
* @access public
* @param string $type The type of entity to block (eg. email, ip)
* @param array $ids The items to extract block data from
* @return mixed Boolean true on success, or JException on failure
* @since 1.0
*/
function block($type, $ids)
{
// make sure we have addresses to block
if (empty($ids)) {
return new JException('No item(s) supplied');
}
// sanitize array
jimport('joomla.utilities.arrayhelper');
JArrayHelper::toInteger($ids);
// get the data to set based on the block type
switch ($type) {
case 'address':
// get a database connection object
$db =& $this->getDBO();
// get the list of addresses to block
$db->setQuery('SELECT `address`' . ' FROM `#__jxcomments_comments`' . ' WHERE `id` IN (' . implode(',', $ids) . ')');
if ($list = $db->loadResultArray()) {
// load the component data for com_comments
$table =& JTable::getInstance('component');
if (!$table->loadByOption('com_comments')) {
$this->setError($table->getError());
return false;
}
// get the existing blocked addresses and add the new ones to it
$params = new JParameter($table->params);
$blocked = $params->get('blockips');
foreach (explode(',', $blocked) as $ip) {
if ($ip = trim($ip)) {
$list[] = trim($ip);
}
}
// remove duplicates and set the blocked addresses in the configuration object
$list = array_unique($list);
$params->set('blockips', implode(', ', $list));
$table->set('params', $params->toString());
// check the row.
if (!$table->check()) {
$this->setError($table->getError());
return false;
}
// store the row.
if (!$table->store()) {
$this->setError($table->getError());
return false;
}
return true;
}
break;
default:
return new JException('Unknown block type');
break;
}
}
示例8: 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();
}
示例9: saveItemPrices
function saveItemPrices($d)
{
$params = new JParameter();
$params->set('price_powerseller', JArrayHelper::getValue($d, 'price_powerseller'));
$params->set('price_verified', JArrayHelper::getValue($d, 'price_verified'));
$params->set('category_pricing_enabled', JArrayHelper::getValue($d, 'category_pricing_enabled'));
$p = $params->toString('INI');
$price = JArrayHelper::getValue($d, 'default_price');
$currency = JArrayHelper::getValue($d, 'currency');
$db = $this->getDbo();
$db->setQuery("update `#__" . APP_PREFIX . "_pricing`\r\n set `price`='{$price}',`currency`='{$currency}',\r\n `params`='{$p}'\r\n where `itemname`='" . $this->name . "'");
$db->query();
}
示例10: getSlices
public function getSlices(JParameter &$params)
{
$conf =& JFactory::getConfig();
if ($conf->getValue('config.caching') && $params->get('module_cache')) {
$user =& JFactory::getUser();
$cache =& JFactory::getCache('mod_rokgallery');
$cache->setCaching(true);
$args = array($params);
$checksum = md5($params->toString());
$slices = $cache->get(array($this, '_getSlices'), $args, 'mod_rokgallery-' . $user->get('aid', 0) . '-' . $checksum);
} else {
$slices = $this->_getSlices($params);
}
return $slices;
}
示例11: defr
function defr()
{
if (!JRequest::checkToken('request')) {
return $this->setRedirect(index, 'invalid token');
}
$r = 'div.linkr-rl {' . "\n" . ' margin-top:20px;' . "\n" . ' padding:10px 5px 0 5px;' . "\n" . ' border-top:1px dotted #ccc;' . "\n" . '}' . "\n" . 'div.linkr-rl div.linkr-rl-t {' . "\n" . ' font-size:1.1em;' . "\n" . ' letter-spacing:2px;' . "\n" . ' text-transform:uppercase;' . "\n" . '}' . "\n" . 'div.linkr-rl ul {' . "\n" . ' list-style-type:square;' . "\n" . ' line-height:1.5em;' . "\n" . ' text-indent:5px;' . "\n" . '}' . "\n" . 'div.linkr-rl ul li {' . "\n" . ' padding:0 5px;' . "\n" . ' background:none;' . "\n" . '}';
// Restore default
$table =& JTable::getInstance('component');
$table->loadByOption('com_linkr');
$params = new JParameter($table->params);
$params->set('rcss', base64_encode($r));
$table->params = $params->toString();
$m = $table->store() ? JText::_('NOTICE_SAVED') : $table->getError();
$this->setRedirect(index . '&view=css', $m);
}
示例12: load
function load($form = null, $actiondata = null)
{
$params = new JParameter($actiondata->params);
$document =& JFactory::getDocument();
JHTML::_('behavior.mootools');
$mainframe =& JFactory::getApplication();
$uri =& JFactory::getURI();
$CF_PATH = $mainframe->isSite() ? JURI::Base() : $uri->root();
$document->addStyleSheet($CF_PATH . 'components/com_chronoforms/css/datepicker/datepicker_dashboard.css');
$document->addScript($CF_PATH . 'components/com_chronoforms/js/datepicker/datepicker.js');
$con_str = "'." . $params->get('field_class', 'cf_datetime_picker') . "', {pickerClass: '" . $params->get('pickerClass', 'datepicker_dashboard') . "', format: '" . $params->get('format', 'd-m-Y H:i:s') . "', inputOutputFormat: '" . $params->get('inputOutputFormat', 'Y-m-d H:i:s') . "', allowEmpty: " . $params->get('allowEmpty', 'true') . ", timePicker: " . $params->get('timePicker', 'true') . ", timePickerOnly: " . $params->get('timePickerOnly', 'false');
ob_start();
eval('?>' . $actiondata->content1);
$actiondata->content1 = ob_get_clean();
if (!empty($actiondata->content1)) {
$con_str .= ", " . $actiondata->content1;
$con_str .= "}";
} else {
$con_str .= "}";
}
ob_start();
?>
window.addEvent('load', function() {
new DatePicker(<?php
echo $con_str;
?>
);
});
<?php
$script = ob_get_clean();
if ((bool) $form->form_params->get('dynamic_files', 0) === false) {
$document->addScriptDeclaration("//<![CDATA[" . "\n" . $script . "\n" . "//]]>");
} else {
//load the action class
$form->loadActionHelper('load_js');
$CfactionLoadJsHelper = new CfactionLoadJsHelper();
$JSactiondata = new stdClass();
$JSactiondata->content1 = $script;
$JSParams = new JParameter('');
$JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0));
$JSactiondata->params = $JSParams->toString();
$CfactionLoadJsHelper->load($form, $JSactiondata);
}
}
示例13: run
function run($form, $actiondata)
{
ob_start();
?>
function(){
$('chronoform_<?php
echo $form->form_name;
?>
').removeClass('hasValidation');
request_caller_<?php
echo $actiondata->id;
?>
();
}
<?php
$jsvalidation_onValidateSuccess = ob_get_clean();
$form_params = new JParameter($form->form_details->params);
$form_params->set('jsvalidation_onValidateSuccess', $jsvalidation_onValidateSuccess);
$form->form_params->set('jsvalidation_onValidateSuccess', $jsvalidation_onValidateSuccess);
$form->form_details->params = $form_params->toString();
}
示例14: run
function run($form, $actiondata)
{
$mainframe = JFactory::getApplication();
$uri = JFactory::getURI();
$params = new JParameter($actiondata->params);
//save the data to db
$db_save_details = $actiondata;
$db_save_details->type = 'db_save';
$db_save_Params = new JParameter('');
$db_save_Params->set('table_name', $params->get('table_name'));
$db_save_details->params = $db_save_Params->toString();
$form->data[trim($params->get('verify_field', 'verify'))] = md5(uniqid(rand(), true));
$form->data[trim($params->get('verification_status_field', 'verified'))] = 0;
if (trim($params->get('files_array_field', ''))) {
$form->data[trim($params->get('files_array_field'))] = var_export($form->files, true);
}
$form->runAction($db_save_details);
//add the verification link value to the data array
$form->data['verification_link'] = $params->get('verification_link_path', $uri->root() . 'index.php?option=com_chronoforms&chronoform=' . $form->form_name);
$form->data['verification_link'] .= '&action=verify&hash=' . $form->data[trim($params->get('verify_field', 'verify'))];
}
示例15: saveItemPrices
function saveItemPrices($d)
{
$params = new JParameter();
$params->set('price_powerseller', JArrayHelper::getValue($d, 'price_powerseller'));
$params->set('price_verified', JArrayHelper::getValue($d, 'price_verified'));
$params->set('category_pricing_enabled', JArrayHelper::getValue($d, 'category_pricing_enabled'));
$p = $params->toString('INI');
$price = JArrayHelper::getValue($d, 'default_price');
$currency = JArrayHelper::getValue($d, 'currency');
$db = $this->getDbo();
$db->setQuery("update `#__" . APP_PREFIX . "_pricing`\r\n set `price`='{$price}',`currency`='{$currency}',\r\n `params`='{$p}'\r\n where `itemname`='listing'");
$db->query();
$db->setQuery("delete from `#__" . APP_PREFIX . "_pricing_categories` where `itemname`='" . $this->name . "'");
$db->query();
$category_pricing = JArrayHelper::getValue($d, 'category_pricing', array(), 'array');
foreach ($category_pricing as $k => $v) {
if (!empty($v) || $v === '0') {
$db->setQuery("insert into `#__" . APP_PREFIX . "_pricing_categories` (`category`,`price`,`itemname`) values ('{$k}','{$v}','" . $this->name . "')");
$db->query();
}
}
}