本文整理汇总了PHP中JRegistry::set方法的典型用法代码示例。如果您正苦于以下问题:PHP JRegistry::set方法的具体用法?PHP JRegistry::set怎么用?PHP JRegistry::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRegistry
的用法示例。
在下文中一共展示了JRegistry::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
jimport('joomla.html.pane');
$pane = JPane::getInstance('Tabs');
$this->assignRef('pane', $pane);
$model = $this->getModel();
$numOfK2Items = $model->countK2Items();
$this->assignRef('numOfK2Items', $numOfK2Items);
$numOfVmProducts = $model->countVmProducts();
$this->assignRef('numOfVmProducts', $numOfVmProducts);
$numOfK2martProducts = $model->countK2martProducts();
$this->assignRef('numOfK2martProducts', $numOfK2martProducts);
$module = JModuleHelper::getModule('mod_k2mart');
$params = new JRegistry();
$params->loadString($module->params);
$params->set('modLogo', "0");
$params->set('modCSSStyling', "1");
$module->params = $params->toString();
$charts = JModuleHelper::renderModule($module);
$this->assignRef('charts', $charts);
$document = JFactory::getDocument();
$document->addCustomTag('<!--[if lte IE 7]><link href="' . JURI::base() . 'components/com_k2mart/css/style_ie7.css" rel="stylesheet" type="text/css" /><![endif]-->');
$this->loadHelper('html');
K2martHTMLHelper::title('K2MART_DASHBOARD');
K2martHTMLHelper::toolbar();
K2martHTMLHelper::subMenu();
parent::display($tpl);
}
示例2: 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();
}
示例3: onAlbumPrepare
/**
* Plugin that returns the object list for DJ-Mediatools album
*
* Each object must contain following properties (mandatory): title, description, image
* Optional properties: link, target (_blank or _self), alt (alt attribute for image)
*
* @param object The album params
*/
public function onAlbumPrepare(&$source, &$params)
{
// Lets check the requirements
$check = $this->onCheckRequirements($source);
if (is_null($check) || is_string($check)) {
return null;
}
$app = JFactory::getApplication();
$default_image = $params->get('plg_k2_image');
require_once JPATH_BASE . '/modules/mod_k2_content/helper.php';
// fix K2 models path inclusion, we need to add path with prefix to avoid conflicts with other extensions
JModelLegacy::addIncludePath(JPATH_BASE . '/components/com_k2/models', 'K2Model');
// create parameters for K2 content module helper
$mparams = new JRegistry();
$mparams->def('itemCount', $params->get('max_images'));
$mparams->def('source', $params->get('plg_k2_source'));
$mparams->def('catfilter', $params->get('plg_k2_catfilter'));
$mparams->set('category_id', $params->get('plg_k2_category_id', array()));
$mparams->def('getChildren', $params->get('plg_k2_getChildren'));
$mparams->def('itemsOrdering', $params->get('plg_k2_itemsOrdering'));
$mparams->def('FeaturedItems', $params->get('plg_k2_FeaturedItems'));
$mparams->def('popularityRange', $params->get('plg_k2_popularityRange'));
$mparams->def('videosOnly', $params->get('plg_k2_videosOnly'));
$mparams->def('item', $params->get('plg_k2_item'));
$mparams->set('items', $params->get('plg_k2_items', array()));
$mparams->def('itemImage', 1);
$mparams->def('itemIntroText', 1);
//JFactory::getApplication()->enqueueMessage("<pre>".print_r($mparams, true)."</pre>");
//$mparams->def('extra_fields', 1);
$items = modK2ContentHelper::getItems($mparams);
$slides = array();
foreach ($items as $item) {
$slide = (object) array();
if (isset($item->imageXLarge)) {
$slide->image = str_replace(JURI::base(true), '', $item->imageXLarge);
} else {
$slide->image = DJMediatoolsLayoutHelper::getImageFromText($item->introtext);
}
// if no image found in article images and introtext then try fulltext
if (!$slide->image) {
$slide->image = DJMediatoolsLayoutHelper::getImageFromText($item->fulltext);
}
// if no image found in fulltext then take default image
if (!$slide->image) {
$slide->image = $default_image;
}
// if no default image set then don't display this article
if (!$slide->image) {
continue;
}
$slide->title = $item->title;
$slide->description = $item->introtext;
if (empty($slide->description)) {
$slide->description = $item->fulltext;
}
$slide->link = $item->link;
$slides[] = $slide;
}
return $slides;
}
示例4: setupAuthentication
function setupAuthentication()
{
$options = new JRegistry();
$options->set('authurl', 'https://api.instagram.com/oauth/authorize');
$options->set('tokenurl', 'https://api.instagram.com/oauth/access_token');
$options->set('authmethod', 'get');
$headers = array();
$headers['Content-Type'] = 'application/json';
$options->set('headers', $headers);
$options->set('scope', '');
$this->client = new JFBConnectAuthenticationOauth2($options);
$token = JFactory::getApplication()->getUserState('com_jfbconnect.' . strtolower($this->name) . '.token', null);
if ($token) {
$token = (array) json_decode($token);
$this->client->setToken($token);
}
$this->client->initialize($this);
// Need to override the callback URL to force http or https
$origRedirect = $this->client->getOption('redirecturi');
if (JFBCFactory::config()->get('instagram_callback_ssl')) {
$redirect = str_replace('http://', 'https://', $origRedirect);
} else {
$redirect = str_replace('https://', 'http://', $origRedirect);
}
$this->client->setOption('redirecturi', $redirect);
}
示例5: displayRows
/**
* Method to display the layout of search results
*
* @return void
*/
public function displayRows()
{
// Run events
$params = new JRegistry();
$params->set('ksource', 'kunena');
$params->set('kunena_view', 'search');
$params->set('kunena_layout', 'default');
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('kunena');
$dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->results, &$params, 0));
foreach ($this->results as $this->message) {
$this->topic = $this->message->getTopic();
$this->category = $this->message->getCategory();
$this->categoryLink = $this->getCategoryLink($this->category->getParent()) . ' / ' . $this->getCategoryLink($this->category);
$ressubject = KunenaHtmlParser::parseText($this->message->subject);
$resmessage = KunenaHtmlParser::parseBBCode($this->message->message, 500);
$profile = KunenaFactory::getUser((int) $this->message->userid);
$this->useravatar = $profile->getAvatarImage('kavatar', 'post');
foreach ($this->searchwords as $searchword) {
if (empty($searchword)) {
continue;
}
$ressubject = preg_replace("/" . preg_quote($searchword, '/') . "/iu", '<span class="searchword" >' . $searchword . '</span>', $ressubject);
// FIXME: enable highlighting, but only after we can be sure that we do not break html
// $resmessage = preg_replace ( "/" . preg_quote ( $searchword, '/' ) . "/iu", '<span class="searchword" >' . $searchword . '</span>', $resmessage );
}
$this->author = $this->message->getAuthor();
$this->topicAuthor = $this->topic->getAuthor();
$this->topicTime = $this->topic->first_post_time;
$this->subjectHtml = $ressubject;
$this->messageHtml = $resmessage;
$contents = $this->subLayout('Search/Results/Row')->setProperties($this->getProperties());
echo $contents;
}
}
示例6: before
/**
* Prepare menu display.
*
* @return bool
*/
protected function before()
{
parent::before();
$this->basemenu = $basemenu = KunenaRoute::getMenu();
if (!$basemenu)
{
return false;
}
$parameters = new JRegistry;
$template = KunenaFactory::getTemplate();
$parameters->set('showAllChildren', $template->params->get('menu_showall', 0));
$parameters->set('menutype', $basemenu->menutype);
$parameters->set('startLevel', $basemenu->level + 1);
$parameters->set('endLevel', $basemenu->level + $template->params->get('menu_levels', 1));
$this->list = KunenaMenuHelper::getList($parameters);
$this->menu = $this->app->getMenu();
$this->active = $this->menu->getActive();
$this->active_id = isset($this->active) ? $this->active->id : $this->menu->getDefault()->id;
$this->path = isset($this->active) ? $this->active->tree : array();
$this->showAll = $parameters->get('showAllChildren');
$this->class_sfx = htmlspecialchars($parameters->get('pageclass_sfx'), ENT_COMPAT, 'UTF-8');
return true;
}
示例7: bind
function bind($array, $ignore = array())
{
$cfg = JEVConfig::getInstance();
$array['id'] = isset($array['id']) ? intval($array['id']) : 0;
parent::bind($array);
$params = new JRegistry($this->params);
if (!$params->get("catcolour", false)) {
$color = array_key_exists("color", $array) ? $array['color'] : "#000000";
if (!preg_match("/^#[0-9a-f]+\$/i", $color)) {
$color = "#000000";
}
$params->set("catcolor", $color);
}
if (!$params->get("admin", false)) {
$admin = array_key_exists("admin", $array) ? $array['admin'] : 0;
$params->set("admin", $admin);
}
if (!$params->get("overlaps", false)) {
$overlaps = array_key_exists("overlaps", $array) ? intval($array['overlaps']) : 0;
$params->set("overlaps", $overlaps);
}
if (!$params->get("image", false)) {
$image = array_key_exists("image", $array) ? intval($array['image']) : "";
$params->set("image", $image);
}
$this->params = (string) $params;
// Fill in the gaps
$this->parent_id = array_key_exists("parent_id", $array) ? intval($array['parent_id']) : 1;
$this->level = array_key_exists("level", $array) ? intval($array['level']) : 1;
$this->extension = "com_jevents";
$this->language = "*";
$this->setLocation(1, 'last-child');
return true;
}
示例8: before
/**
* Prepare reply history display.
*
* @return void
*/
protected function before()
{
parent::before();
$id = $this->input->getInt('id');
$this->topic = KunenaForumTopicHelper::get($id);
$this->history = KunenaForumMessageHelper::getMessagesByTopic($this->topic, 0, (int) $this->config->historylimit, 'DESC');
$this->replycount = $this->topic->getReplies();
$this->historycount = count($this->history);
KunenaAttachmentHelper::getByMessage($this->history);
$userlist = array();
foreach ($this->history as $message) {
$userlist[(int) $message->userid] = (int) $message->userid;
}
KunenaUserHelper::loadUsers($userlist);
// Run events
$params = new JRegistry();
$params->set('ksource', 'kunena');
$params->set('kunena_view', 'topic');
$params->set('kunena_layout', 'history');
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin('kunena');
$dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->history, &$params, 0));
// FIXME: need to improve BBCode class on this...
$this->attachments = KunenaAttachmentHelper::getByMessage($this->history);
$this->inline_attachments = array();
$this->headerText = JText::_('COM_KUNENA_POST_EDIT') . ' ' . $this->topic->subject;
}
示例9: getCategories
public static function getCategories($parent = 'root', $count = 0)
{
require_once JPATH_ROOT . '/modules/mod_articles_categories/helper.php';
$params = new JRegistry();
$params->set('parent', $parent);
$params->set('count', $count);
return ModArticlesCategoriesHelper::getList($params);
}
示例10: __construct
public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
$options = new JRegistry();
$options->set('api.username', $this->params->get('mediawiki_username'));
$options->set('api.password', $this->params->get('mediawiki_password'));
$options->set('api.url', $this->params->get('mediawiki_siteurl'));
$this->mediawiki = new JMediawiki($options);
}
示例11: onAfterSaveSubscriptionPlan
/**
* Store setting into database
* @param PlanOsMembership $row
* @param Boolean $isNew true if create new plan, false if edit
*/
function onAfterSaveSubscriptionPlan($row, $data, $isNew)
{
$params = new JRegistry($row->params);
$params->set('joomla_group_ids', implode(',', $data['joomla_group_ids']));
$params->set('subscription_expired_joomla_group_ids', implode(',', $data['subscription_expired_joomla_group_ids']));
$params->set('joomla_expried_group_ids', implode(',', $data['joomla_expried_group_ids']));
$row->params = $params->toString();
$row->store();
}
示例12: before
/**
* Prepare topic reply form.
*
* @return void
*
* @throws RuntimeException
* @throws KunenaExceptionAuthorise
*/
protected function before()
{
parent::before();
$catid = $this->input->getInt('catid');
$id = $this->input->getInt('id');
$mesid = $this->input->getInt('mesid');
$quote = $this->input->getBool('quote', false);
$saved = $this->app->getUserState('com_kunena.postfields');
$this->me = KunenaUserHelper::getMyself();
$this->template = KunenaFactory::getTemplate();
if (!$mesid) {
$this->topic = KunenaForumTopicHelper::get($id);
$parent = KunenaForumMessageHelper::get($this->topic->first_post_id);
} else {
$parent = KunenaForumMessageHelper::get($mesid);
$this->topic = $parent->getTopic();
}
$this->category = $this->topic->getCategory();
if ($parent->isAuthorised('reply') && $this->me->canDoCaptcha()) {
if (JPluginHelper::isEnabled('captcha')) {
$plugin = JPluginHelper::getPlugin('captcha');
$params = new JRegistry($plugin[0]->params);
$captcha_pubkey = $params->get('public_key');
$catcha_privkey = $params->get('private_key');
if (!empty($captcha_pubkey) && !empty($catcha_privkey)) {
JPluginHelper::importPlugin('captcha');
$dispatcher = JDispatcher::getInstance();
$result = $dispatcher->trigger('onInit', 'dynamic_recaptcha_1');
$this->captchaEnabled = $result[0];
}
} else {
$this->captchaEnabled = false;
}
}
$parent->tryAuthorise('reply');
// Run event.
$params = new JRegistry();
$params->set('ksource', 'kunena');
$params->set('kunena_view', 'topic');
$params->set('kunena_layout', 'reply');
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('kunena');
$dispatcher->trigger('onKunenaPrepare', array('kunena.topic', &$this->topic, &$params, 0));
// Can user edit topic icons?
if ($this->config->topicicons && $this->topic->isAuthorised('edit')) {
$this->topicIcons = $this->template->getTopicIcons(false, $saved ? $saved['icon_id'] : $this->topic->icon_id);
}
list($this->topic, $this->message) = $parent->newReply($saved ? $saved : $quote);
$this->action = 'post';
$this->allowedExtensions = KunenaAttachmentHelper::getExtensions($this->category);
$this->post_anonymous = $saved ? $saved['anonymous'] : !empty($this->category->post_anonymous);
$this->subscriptionschecked = $saved ? $saved['subscribe'] : $this->config->subscriptionschecked == 1;
$this->app->setUserState('com_kunena.postfields', null);
$this->canSubscribe = $this->canSubscribe();
$this->headerText = JText::_('COM_KUNENA_BUTTON_MESSAGE_REPLY') . ' ' . $this->topic->subject;
}
示例13: onAfterSaveSubscriptionPlan
/**
* Store setting into database, in this case, use params field of plans table
* @param PlanOsMembership $row
* @param Boolean $isNew true if create new plan, false if edit
*/
function onAfterSaveSubscriptionPlan($row, $data, $isNew)
{
if (!$this->canRun) {
return;
}
// $row of table osmembership_plans
$params = new JRegistry($row->params);
$params->set('docman_group_ids', implode(',', $data['docman_group_ids']));
$params->set('docman_expried_group_ids', implode(',', $data['docman_expried_group_ids']));
$row->params = $params->toString();
$row->store();
}
示例14: quickAddAjax
/**
* An ajax connector for QuickAdd JS.
*/
public function quickAddAjax()
{
// Init Variables
$input = JFactory::getApplication()->input;
$data = $input->post->get($input->get('formctrl'), array(), 'array');
$result = new JRegistry();
$result->set('Result', false);
$model_name = $input->get('model_name');
$component = $input->get('component');
$extension = $input->get('extension');
// Include Needed Classes
JControllerLegacy::addModelPath(JPATH_BASE . "/components/com_{$component}/models");
JForm::addFormPath(JPATH_BASE . "/components/com_{$component}/models/forms");
JForm::addFieldPath(JPATH_BASE . "/components/com_{$component}/models/fields");
JTable::addIncludePath(JPATH_BASE . "/components/com_{$component}/tables");
AKHelper::_('lang.loadLanguage', $extension, null);
// Get Model
$model = $this->getModel(ucfirst($model_name), ucfirst($component) . 'Model', array('ignore_request' => true));
// For WindWalker Component only
if (is_callable(array($model, 'getFieldsName'))) {
$fields_name = $model->getFieldsName();
$data = AKHelper::_('array.pivotToTwoDimension', $data, $fields_name);
}
// Get Form
$form = $model->getForm($data, false);
if (!$form) {
$result->set('errorMsg', $model->getError());
jexit($result);
}
// Test whether the data is valid.
$validData = $model->validate($form, $data);
// Check for validation errors.
if ($validData === false) {
// Get the validation messages.
$errors = $model->getErrors();
$errorMsg = is_string($errors[0]) ? $errors[0] : $errors[0]->getMessage();
$result->set('errorMsg', $errorMsg);
jexit($result);
}
// Do Save
if (!$model->save($validData)) {
// Return Error Message.
$result->set('errorMsg', JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()));
jexit($result);
}
// Set ID
$data['id'] = $model->getstate($model_name . '.id');
// Set Result
$result->set('Result', true);
$result->set('data', $data);
jexit($result);
}
示例15: onJHarvestDiscover
/**
* Attempts to discover whether the harvest configuration points to an OAI-enabled url.
*
* @param string $sourceUrl The source url to discover.
*
* @return JRegistry An OAI description as a JRegistry or false if no description can be
* found.
*/
public function onJHarvestDiscover($sourceUrl)
{
$discovered = false;
$url = new JUri($sourceUrl);
$url->setVar('verb', 'Identify');
$http = JHttpFactory::getHttp();
$response = $http->get($url);
$contentType = JArrayHelper::getValue($response->headers, 'Content-Type');
$contentType = $this->parseContentType($contentType);
$validContentType = in_array($contentType, array('text/xml', 'application/xml')) !== false;
if ((int) $response->code === 200 && $validContentType) {
$url->setVar('verb', 'ListMetadataFormats');
$http = JHttpFactory::getHttp();
$response = $http->get($url);
if ((int) $response->code === 200) {
$dom = new DomDocument();
$dom->loadXML($response->body);
$nodes = $dom->getElementsByTagName('metadataPrefix');
$availablePrefixes = array();
foreach ($nodes as $node) {
$availablePrefixes[] = (string) $node->nodeValue;
}
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin("joai");
$result = $dispatcher->trigger('onJOaiQueryMetadataFormat');
$found = false;
while (($metadataPrefix = current($result)) && !$found) {
if (array_search($metadataPrefix, $availablePrefixes) !== false) {
$discovered = new JRegistry();
$discovered->set('discovery.type', 'oai');
$discovered->set('discovery.url', (string) $sourceUrl);
$discovered->set('discovery.plugin.metadata', (string) $metadataPrefix);
$found = true;
}
next($result);
}
// if a metadata format can be discovered, also discover the asset format.
if ($discovered) {
$result = $dispatcher->trigger('onJOaiQueryAssetFormat');
$found = false;
while (($assetPrefix = current($result)) && !$found) {
if (array_search($assetPrefix, $availablePrefixes) !== false) {
$discovered->set('discovery.plugin.assets', (string) $assetPrefix);
$found = true;
}
next($result);
}
}
}
}
return $discovered;
}