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


PHP FD::registry方法代码示例

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


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

示例1: makeDefault

 /**
  * Set's the template as the default template
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function makeDefault()
 {
     // Check for request forgeries
     FD::checkToken();
     $element = JRequest::getVar('cid');
     $element = $element[0];
     $element = strtolower($element);
     // Get the current view
     $view = $this->getCurrentView();
     // Get the configuration object
     $configTable = FD::table('Config');
     $config = FD::registry();
     if ($configTable->load('site')) {
         $config->load($configTable->value);
     }
     // Convert the config object to a json string.
     $config->set('theme.site', $element);
     // Convert the configuration to string
     $jsonString = $config->toString();
     // Store the setting
     $configTable->value = $jsonString;
     if (!$configTable->store()) {
         $view->setMessage($configTable->getError(), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     return $view->call(__FUNCTION__);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:35,代码来源:themes.php

示例2: createStream

 public function createStream($verb)
 {
     // Create a new stream item for this discussion
     $stream = FD::stream();
     // Get the stream template
     $tpl = $stream->getTemplate();
     // Someone just joined the event
     $tpl->setActor($this->created_by, SOCIAL_TYPE_USER);
     // Set the params to cache the event data
     $registry = FD::registry();
     $registry->set('news', $this);
     // Set the context
     $tpl->setContext($this->id, 'news');
     $event = FD::event($this->cluster_id);
     // Set the cluster
     $tpl->setCluster($this->cluster_id, SOCIAL_TYPE_EVENT, $event->type);
     // Set the verb
     $tpl->setVerb($verb);
     // Set the params
     $tpl->setParams($registry);
     if ($this->_stream_date) {
         $tpl->setDate($this->_stream_date);
     }
     $tpl->setAccess('core.view');
     // Add the stream
     $stream->add($tpl);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:27,代码来源:eventnews.php

示例3: request

 /**
  * Displays the registration request
  *
  * @since   1.3
  * @access  public
  * @param   string
  * @return
  */
 public function request()
 {
     $id = $this->input->getInt('id');
     $table = JTable::getInstance('Module');
     $table->load($id);
     FD::language()->load('mod_easysocial_registration_requester', JPATH_SITE);
     $params = FD::registry($table->params);
     $profileId = $params->get('profile_id');
     // If there's no profile id, then we automatically assign the default profile id
     if (empty($profileId)) {
         $profileModel = FD::model('profiles');
         $defaultProfile = $profileModel->getDefaultProfile();
         $profileId = $defaultProfile->id;
     }
     $fieldsModel = FD::model('fields');
     $options = array('visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION, 'profile_id' => $profileId);
     $fields = $fieldsModel->getCustomFields($options);
     if (!empty($fields)) {
         FD::language()->loadAdmin();
         $fieldsLib = FD::fields();
         $session = JFactory::getSession();
         $registration = FD::table('Registration');
         $registration->load($session->getId());
         $data = $registration->getValues();
         $args = array(&$data, &$registration);
         $fieldsLib->trigger('onRegisterMini', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
     }
     $theme = FD::themes();
     $theme->set('params', $params);
     $theme->set('config', FD::config());
     $theme->set('fields', $fields);
     $output = $theme->output('site/registration/dialog.request');
     return $this->ajax->resolve($output);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:42,代码来源:view.ajax.php

示例4: onPrepareStream

 public function onPrepareStream(SocialStreamItem &$stream, $includePrivacy = true)
 {
     if ($stream->context != 'relationship') {
         return;
     }
     $params = $this->getParams();
     if (!$params->get('stream_approve', true)) {
         return;
     }
     // Get the actor
     $actor = $stream->actor;
     // check if the actor is ESAD profile or not, if yes, we skip the rendering.
     if (!$actor->hasCommunityAccess()) {
         $stream->title = '';
         return;
     }
     $my = FD::user();
     $privacy = FD::privacy($my->id);
     if ($includePrivacy && !$privacy->validate('core.view', $stream->contextId, 'relationship', $stream->actor->id)) {
         return;
     }
     $stream->color = '#DC554F';
     $stream->fonticon = 'ies-heart';
     $stream->label = FD::_('APP_USER_RELATIONSHIP_STREAM_TOOLTIP', true);
     $stream->display = SOCIAL_STREAM_DISPLAY_FULL;
     $registry = FD::registry($stream->params);
     $this->set('type', $registry->get('type'));
     $this->set('actor', $stream->actor);
     $this->set('target', $stream->targets[0]);
     $stream->title = parent::display('streams/' . $stream->verb . '.title');
     if ($includePrivacy) {
         $stream->privacy = $privacy->form($stream->contextId, 'relationship', $stream->actor->id, 'core.view', false, $stream->uid);
     }
     return true;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:35,代码来源:relationship.php

示例5: __construct

 /**
  * Construct and initialise this event class per single event class.
  *
  * @author  Jason Rey <jasonrey@stackideas.com>
  * @since   1.3
  * @access  public
  * @param   array     $params The parameters to init.
  */
 public function __construct($params = array())
 {
     // Create the user parameters object
     $this->_params = FD::registry();
     // Initialize user's property locally.
     $this->initParams($params);
     $this->table = FD::table('Event');
     $this->table->bind($this);
     $this->meta = FD::Table('EventMeta');
     $this->meta->load(array('cluster_id' => $this->id));
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:19,代码来源:event.php

示例6: bind

 /**
  * Bind the params
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function bind($params = null)
 {
     if (is_object($params)) {
         $this->params = $params;
         return;
     }
     if (is_file($params)) {
         $params = JFile::read($params);
     }
     $this->params = FD::registry($params);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:19,代码来源:form.php

示例7: onRegister

 /**
  * Displays the field for creation.
  *
  * @author  Jason Rey <jasonrey@stackideas.com>
  * @since   1.3
  * @access  public
  * @param   array                   $post       The posted data.
  * @param   SocialTableStepSession  $session    The session table.
  * @return  string                              The html codes for this field.
  */
 public function onRegister(&$post, &$session)
 {
     // Support for group event
     // If this is a group event, we do not allow user to change the type as the type follows the group
     $reg = FD::registry();
     $reg->load($session->values);
     if ($reg->exists('group_id')) {
         return;
     }
     $value = isset($post['event_type']) ? $post['event_type'] : $this->params->get('default');
     $this->set('value', $value);
     return $this->display();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:23,代码来源:type.php

示例8: onRegister

 public function onRegister(&$post, &$session)
 {
     $reg = FD::registry();
     $reg->load($session->values);
     $groupId = $reg->get('group_id');
     if (empty($groupId)) {
         return;
     }
     $value = isset($post['member_transfer']) ? $post['member_transfer'] : $this->params->get('default', 'invite');
     $this->set('value', $value);
     $allowed = $this->params->get('allowed', array());
     $this->set('allowed', $allowed);
     return $this->display();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:14,代码来源:membertransfer.php

示例9: getImage

 private function getImage(SocialTableNotification &$item)
 {
     // Get the links that are posted for this stream
     $model = FD::model('Stream');
     $links = $model->getAssets($item->uid, SOCIAL_TYPE_LINKS);
     if (!isset($links[0])) {
         return;
     }
     // Initialize default values
     $link = $links[0];
     $actor = FD::user($item->actor_id);
     $meta = FD::registry($link->data);
     $item->content = $meta->get('link');
     // If there's an image, use it
     if ($meta->get('image')) {
         return $meta->get('image');
     }
     return false;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:19,代码来源:notification.comments.php

示例10: onAfterStorySave

 /**
  * Processes a saved story.
  *
  * @since   1.0
  * @access  public
  * @param   string
  * @return
  */
 public function onAfterStorySave(&$stream, &$streamItem, &$template)
 {
     // Get the link information from the request
     $link = JRequest::getVar('links_url', '');
     $title = JRequest::getVar('links_title', '');
     $content = JRequest::getVar('links_description', '');
     $image = JRequest::getVar('links_image', '');
     $video = JRequest::getVar('links_video', '');
     // If there's no data, we don't need to store in the assets table.
     if (empty($title) && empty($content) && empty($image)) {
         return;
     }
     $registry = FD::registry();
     $registry->set('title', $title);
     $registry->set('content', $content);
     $registry->set('image', $image);
     $registry->set('link', $link);
     return true;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:27,代码来源:links.php

示例11: onStreamCountValidation

 /**
  * Triggered to validate the stream item whether should put the item as valid count or not.
  *
  * @since   1.2
  * @access  public
  * @param   jos_social_stream, boolean
  * @return  0 or 1
  */
 public function onStreamCountValidation(&$item, $includePrivacy = true)
 {
     // If this is not it's context, we don't want to do anything here.
     if ($item->context_type != 'story') {
         return false;
     }
     // if this is a cluster stream, let check if user can view this stream or not.
     $params = FD::registry($item->params);
     $group = FD::group($params->get('group'));
     if (!$group) {
         return;
     }
     $item->cnt = 1;
     if ($group->type != SOCIAL_GROUPS_PUBLIC_TYPE) {
         if (!$group->isMember(FD::user()->id)) {
             $item->cnt = 0;
         }
     }
     return true;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:28,代码来源:story.php

示例12: setValue

 public function setValue($key, $value)
 {
     $reg = FD::registry();
     if (!empty($this->values)) {
         $reg->load($this->values);
     }
     $reg->set($key, $value);
     $this->values = $reg->toString();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:9,代码来源:stepsession.php

示例13: prepareCreateStream

 private function prepareCreateStream(SocialStreamItem &$item, SocialGroup $group)
 {
     if (!$group->canViewItem()) {
         return;
     }
     $params = FD::registry($item->params);
     $data = $params->get('news');
     // Load the group
     $group = FD::group($data->cluster_id);
     $news = FD::table('GroupNews');
     $news->load($data->id);
     // Get the permalink
     $permalink = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $this->getApp()->getAlias(), 'newsId' => $news->id), false);
     // Get the app params
     $appParams = $this->getApp()->getParams();
     // Format the content
     $this->format($news, $appParams->get('stream_length'));
     // Attach actions to the stream
     $this->attachActions($item, $news, $permalink, $appParams);
     $this->set('group', $group);
     $this->set('appParams', $appParams);
     $this->set('permalink', $permalink);
     $this->set('news', $news);
     $this->set('actor', $item->actor);
     // Load up the contents now.
     $item->title = parent::display('streams/create.title');
     $item->content = parent::display('streams/create.content');
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:28,代码来源:news.php

示例14: save

 /**
  * Processes the saving of the settings.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @author	Mark Lee <mark@stackideas.com>
  */
 public function save()
 {
     // Check for request forgeries.
     FD::checkToken();
     // Since there are more than 1 tasks are linked here, get the appropriate task here.
     $task = $this->getTask();
     $method = $task;
     $page = JRequest::getVar('page', '');
     $view = FD::view('Settings');
     // Get the posted data.
     $post = JRequest::get('POST');
     // Only load the config that is already stored.
     // We don't want to store everything as we want to have hidden settings.
     $configTable = FD::table('Config');
     $config = FD::registry();
     if ($configTable->load('site')) {
         $config->load($configTable->value);
     }
     $token = FD::token();
     if (!$post) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_INVALID_POST_DATA'), SOCIAL_MSG_ERROR);
         return $view->call($method, $page);
     }
     // Some post vars are unwanted / unecessary because of the hidden inputs.
     $ignored = array('task', 'option', 'controller', 'view', $token, 'page');
     $updatedUserIndexing = false;
     foreach ($post as $key => $value) {
         if (!in_array($key, $ignored)) {
             // Replace all _ with .
             $key = str_ireplace('_', '.', $key);
             // If the value is an array, and there's only 1 index,
             // the input might need to be checked if it needs to be in an array form.
             // E.g: some,values,here,should,be,an,array
             if (is_array($value) && count($value) == 1) {
                 $value = FD::makeArray($value[0], ',');
             }
             if ($key == 'users.indexer.name' || $key == 'users.indexer.email') {
                 $previousVal = $config->get($key);
                 if ($previousVal != $value) {
                     $updatedUserIndexing = true;
                 }
             }
             $config->set($key, $value);
         }
     }
     // Convert the config object to a json string.
     $jsonString = $config->toString();
     $configTable = FD::table('Config');
     if (!$configTable->load('site')) {
         $configTable->type = 'site';
     }
     $configTable->set('value', $jsonString);
     // Try to store the configuration.
     if (!$configTable->store()) {
         $view->setMessage($configTable->getError(), SOCIAL_MSG_ERROR);
         return $view->call($method, $page);
     }
     // Check if any of the configurations are stored as non local
     if (($config->get('storage.photos') == 'amazon' || $config->get('storage.conversations') == 'amazon') && $config->get('storage.amazon.bucket') == '') {
         // Initialize the storage
         $bucket = FD::storage('Amazon')->init();
         $config->set('storage.amazon.bucket', $bucket);
         $configTable->set('value', $config->toString());
         $configTable->store();
     }
     $message = $updatedUserIndexing ? JText::_('COM_EASYSOCIAL_SETTINGS_SAVED_SUCCESSFULLY_WITH_USER_INDEXING_UPDATED') : JText::_('COM_EASYSOCIAL_SETTINGS_SAVED_SUCCESSFULLY');
     $view->setMessage($message, SOCIAL_MSG_SUCCESS);
     return $view->call($method, $page);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:77,代码来源:settings.php

示例15: save

 /**
  * Creates a new discussion
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function save()
 {
     // Check for request forgeriess
     FD::checkToken();
     // Ensure that the user is logged in.
     FD::requireLogin();
     // Load up ajax lib
     $ajax = FD::ajax();
     // Load the discussion
     $id = JRequest::getInt('id');
     $discussion = FD::table('Discussion');
     $discussion->load($id);
     // Get the current logged in user.
     $my = FD::user();
     // Get the group
     $groupId = JRequest::getInt('cluster_id', 0);
     $group = FD::group($groupId);
     // Only allow owner and admin to modify the
     if ($discussion->id) {
         if ($discussion->created_by != $my->id && !$group->isAdmin() && !$my->isSiteAdmin()) {
             return $this->redirect($group->getPermalink(false));
         }
     }
     // Check if the user is allowed to create a discussion
     if (!$group->isMember()) {
         FD::info()->set(JText::_('APP_GROUP_DISCUSSIONS_NOT_ALLOWED_CREATE'), SOCIAL_MSG_ERROR);
         // Perform a redirection
         return JFactory::getApplication()->redirect(FRoute::dashboard());
     }
     // Assign discussion properties
     $discussion->uid = $group->id;
     $discussion->type = SOCIAL_TYPE_GROUP;
     $discussion->title = JRequest::getVar('title', '');
     $discussion->content = JRequest::getVar('content', '', 'POST', 'none', JREQUEST_ALLOWRAW);
     // If discussion is edited, we don't want to modify the following items
     if (!$discussion->id) {
         $discussion->created_by = $my->id;
         $discussion->parent_id = 0;
         $discussion->hits = 0;
         $discussion->state = SOCIAL_STATE_PUBLISHED;
         $discussion->votes = 0;
         $discussion->lock = false;
     }
     $app = $this->getApp();
     // Ensure that the title is valid
     if (!$discussion->title) {
         Foundry::info()->set(JText::_('APP_GROUP_DISCUSSIONS_INVALID_TITLE'), SOCIAL_MSG_ERROR);
         // Get the redirection url
         $url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'create', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias()), false);
         return $this->redirect($url);
     }
     // Lock the discussion
     $state = $discussion->store();
     if (!$state) {
         FD::info()->set(JText::_('APP_GROUP_DISCUSSIONS_DISCUSSION_CREATED_FAILED'));
         // Get the redirection url
         $url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'form', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias()), false);
         return $this->redirect($url);
     }
     // Process any files that needs to be created.
     $discussion->mapFiles();
     // Get the app
     $app = $this->getApp();
     // If it is a new discussion, we want to run some other stuffs here.
     if (!$id) {
         // @points: groups.discussion.create
         // Add points to the user that updated the group
         $points = FD::points();
         $points->assign('groups.discussion.create', 'com_easysocial', $my->id);
         // Create a new stream item for this discussion
         $stream = FD::stream();
         // Get the stream template
         $tpl = $stream->getTemplate();
         // Someone just joined the group
         $tpl->setActor($my->id, SOCIAL_TYPE_USER);
         // Set the context
         $tpl->setContext($discussion->id, 'discussions');
         // Set the cluster
         $tpl->setCluster($group->id, SOCIAL_TYPE_GROUP, $group->type);
         // Set the verb
         $tpl->setVerb('create');
         // Set the params to cache the group data
         $registry = FD::registry();
         $registry->set('group', $group);
         $registry->set('discussion', $discussion);
         $tpl->setParams($registry);
         $tpl->setAccess('core.view');
         // Add the stream
         $stream->add($tpl);
         // Set info message
         FD::info()->set(false, JText::_('APP_GROUP_DISCUSSIONS_DISCUSSION_CREATED_SUCCESS'), SOCIAL_MSG_SUCCESS);
         // Send notification to group members only if it is new discussion
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:discussion.php


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