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


PHP FD::opengraph方法代码示例

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


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

示例1: end

 /**
  * This is the ending point of the page library.
  *
  * @access	public
  * @param	null
  * @return	null
  */
 public function end($options = array())
 {
     // Initialize required dependencies.
     FD::document()->init($options);
     $processStylesheets = isset($options['processStylesheets']) ? $options['processStylesheets'] : true;
     // @task: Process any scripts that needs to be injected into the head.
     if ($processStylesheets) {
         $this->processStylesheets();
     }
     // @task: Process any scripts that needs to be injected into the head.
     $this->processScripts();
     // @task: Process the document title.
     $this->processTitle();
     // @task: Process opengraph tags
     FD::opengraph()->render();
     // @task: Trigger profiler's end.
     if ($this->config->get('general.profiler')) {
         FD::profiler()->end();
     }
     // Additional triggers to be processed when the page starts.
     // $dispatcher 	= FD::dispatcher();
     // Trigger: onComponentStart
     // $dispatcher->trigger('user', 'onComponentEnd', array());
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:31,代码来源:page.php

示例2: item


//.........这里部分代码省略.........
                 $step->url = FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias(), 'type' => 'info'), false);
             } else {
                 $step->url = FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias(), 'type' => 'info', 'infostep' => $index), false);
             }
             $step->title = $step->get('title');
             $step->active = !$step->hide && $currentStep == $index;
             if ($step->active) {
                 $theme = FD::themes();
                 $theme->set('fields', $step->fields);
                 $contents = $theme->output('site/groups/item.info');
             }
             $step->index = $index;
             $index++;
         }
         $this->set('infoSteps', $steps);
     }
     $this->set('type', $type);
     $this->set('filterId', $filterId);
     $this->set('contents', $contents);
     if (!empty($contents)) {
         return parent::display('site/groups/item');
     }
     // If no content, only we get the stream. No point getting stream and contents at the same time.
     // Retrieve group's stream
     $stream = FD::stream();
     // Determine if the current request is for "tags"
     $hashtag = $this->input->get('tag', 0);
     $hashtagAlias = $this->input->get('tag');
     // If there's a hash tag, try to get the actual title to display on the site
     if ($hashtag) {
         $tag = $stream->getHashTag($hashtag);
         $hashtag = $tag->title;
     }
     // Retrieve story form for group
     $story = FD::get('Story', SOCIAL_TYPE_GROUP);
     $story->setCluster($group->id, SOCIAL_TYPE_GROUP);
     $story->showPrivacy(false);
     if ($hashtag) {
         $story->setHashtags(array($hashtag));
     }
     // Only group members allowed to post story updates on group page.
     if ($group->isMember() || $this->my->isSiteAdmin()) {
         // Set the story data on the stream
         $stream->story = $story;
         // Get the group params
         $params = $group->getParams();
         // Ensure that the user has permissions to see the story form
         $permissions = $params->get('stream_permissions', null);
         // If permissions has been configured before.
         if (!is_null($permissions)) {
             // If the user is not an admin, ensure that permissions has member
             if (!$group->isAdmin() && !in_array('member', $permissions)) {
                 unset($stream->story);
             }
             // If the user is an admin, ensure that permissions has admin
             if ($group->isAdmin() && !in_array('admin', $permissions) && !$group->isOwner()) {
                 unset($stream->story);
             }
         }
     }
     //lets get the sticky posts 1st
     $stickies = $stream->getStickies(array('clusterId' => $group->id, 'clusterType' => SOCIAL_TYPE_GROUP, 'limit' => 0));
     if ($stickies) {
         $stream->stickies = $stickies;
     }
     // lets get stream items for this group
     $options = array('clusterId' => $group->id, 'clusterType' => SOCIAL_TYPE_GROUP, 'nosticky' => true);
     // stream filter id
     $filterId = $this->input->get('filterId', 0, 'int');
     if ($filterId) {
         $sfilter = FD::table('StreamFilter');
         $sfilter->load($filterId);
         $hashtags = $sfilter->getHashTag();
         $tags = explode(',', $hashtags);
         if ($tags) {
             $options['tag'] = $tags;
         }
     }
     // we only wan streams thats has this hashtag associated.
     if ($hashtag) {
         $options['tag'] = array($hashtag);
     }
     $options['startlimit'] = $startlimit;
     // Filter stream item by specific context type
     if ($context) {
         $options['context'] = $context;
     }
     if ($type == 'moderation') {
         $options['onlyModerated'] = true;
         unset($stream->story);
     }
     $stream->get($options);
     // Apply opengraph tags for the group.
     FD::opengraph()->addGroup($group);
     $this->set('context', $context);
     $this->set('stream', $stream);
     $this->set('hashtag', $hashtag);
     $this->set('hashtagAlias', $hashtagAlias);
     parent::display('site/groups/item');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:view.html.php

示例3: display

 /**
  * Displays a user profile to a 3rd person perspective.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	null
  **/
 public function display($tpl = null)
 {
     // Get the user's id.
     $id = $this->input->get('id', 0, 'int');
     // The current logged in user might be viewing their own profile.
     if ($id == 0) {
         $id = FD::user()->id;
     }
     // When the user tries to view his own profile but if he isn't logged in, throw a login page.
     if ($id == 0) {
         return FD::requireLogin();
     }
     // Check for user profile completeness
     FD::checkCompleteProfile();
     // Get the user's object.
     $user = FD::user($id);
     // If the user still don't exist, throw a 404
     if (!$user->id) {
         return JError::raiseError(404, JText::_('COM_EASYSOCIAL_PROFILE_INVALID_USER'));
     }
     if (Foundry::user()->id != $user->id) {
         if (FD::user()->isBlockedBy($user->id)) {
             return JError::raiseError(404, JText::_('COM_EASYSOCIAL_PROFILE_INVALID_USER'));
         }
     }
     if ($user->isBlock()) {
         FD::info()->set(JText::sprintf('COM_EASYSOCIAL_PROFILE_USER_NOT_EXIST', $user->getName()), SOCIAL_MSG_ERROR);
         return $this->redirect(FRoute::dashboard(array(), false));
     }
     // Set the page title
     FD::page()->title(FD::string()->escape($user->getName()));
     // Set the page breadcrumb
     FD::page()->breadcrumb(FD::string()->escape($user->getName()));
     // Apply opengraph tags.
     FD::opengraph()->addProfile($user);
     // Get the current logged in user's object.
     $my = FD::user();
     // Do not assign badge if i view myself.
     if ($user->id != $my->id && $my->id) {
         // @badge: profile.view
         $badge = FD::badges();
         $badge->log('com_easysocial', 'profile.view', $my->id, JText::_('COM_EASYSOCIAL_PROFILE_VIEWED_A_PROFILE'));
     }
     $startlimit = JRequest::getInt('limitstart', 0);
     // Determine if the current request is to load an app
     $appId = JRequest::getInt('appId');
     // Get site configuration
     $config = FD::config();
     // Get the apps library.
     $appsLib = FD::apps();
     $contents = '';
     if ($appId) {
         // Load the app
         $app = FD::table('App');
         $app->load($appId);
         // Check if the user has access to this app
         if (!$app->accessible($user->id)) {
             FD::info()->set(null, JText::_('COM_EASYSOCIAL_PROFILE_APP_IS_NOT_INSTALLED_BY_USER'), SOCIAL_MSG_ERROR);
             return $this->redirect(FRoute::profile(array('id' => $user->getAlias()), false));
         }
         // Set the page title
         FD::page()->title(FD::string()->escape($user->getName()) . ' - ' . $app->get('title'));
         $contents = $appsLib->renderView(SOCIAL_APPS_VIEW_TYPE_EMBED, 'profile', $app, array('userId' => $user->id));
     }
     $layout = JRequest::getCmd('layout');
     // @since 1.3.7
     // If layout is empty, means we want to get the default view
     // Previously timeline is always the default
     if (empty($appId) && empty($layout)) {
         $defaultDisplay = FD::config()->get('users.profile.display', 'timeline');
         $layout = $defaultDisplay;
     }
     if ($layout === 'about') {
         FD::language()->loadAdmin();
         $currentStep = JRequest::getInt('step', 1);
         $steps = FD::model('Steps')->getSteps($user->profile_id, SOCIAL_TYPE_PROFILES, SOCIAL_PROFILES_VIEW_DISPLAY);
         $fieldsLib = FD::fields();
         $fieldsModel = FD::model('Fields');
         $index = 1;
         foreach ($steps as $step) {
             $step->fields = $fieldsModel->getCustomFields(array('step_id' => $step->id, 'data' => true, 'dataId' => $user->id, 'dataType' => SOCIAL_TYPE_USER, 'visible' => SOCIAL_PROFILES_VIEW_DISPLAY));
             if (!empty($step->fields)) {
                 $args = array($user);
                 $fieldsLib->trigger('onDisplay', SOCIAL_FIELDS_GROUP_USER, $step->fields, $args);
             }
             $step->hide = true;
             foreach ($step->fields as $field) {
                 // As long as one of the field in the step has an output, then this step shouldn't be hidden
                 // If step has been marked false, then no point marking it as false again
                 // We don't break from the loop here because there is other checking going on
                 if (!empty($field->output) && $step->hide === true) {
                     $step->hide = false;
//.........这里部分代码省略.........
开发者ID:ppantilla,项目名称:bbninja,代码行数:101,代码来源:view.html.php

示例4: display

 /**
  * Displays a user profile to a 3rd person perspective.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	null
  **/
 public function display($tpl = null)
 {
     // Get the user's id.
     $id = $this->input->get('id', 0, 'int');
     // Check if there is any stream filtering or not.
     $filter = $this->input->get('type', '', 'word');
     // The current logged in user might be viewing their own profile.
     if ($id == 0) {
         $id = FD::user()->id;
     }
     // When the user tries to view his own profile but if he isn't logged in, throw a login page.
     if ($id == 0) {
         return JError::raiseError(404, JText::_('COM_EASYSOCIAL_PROFILE_INVALID_USER'));
     }
     // Check for user profile completeness
     FD::checkCompleteProfile();
     // Get the user's object.
     $user = FD::user($id);
     // If the user doesn't exist throw an error
     if (!$user->id) {
         return JError::raiseError(404, JText::_('COM_EASYSOCIAL_PROFILE_INVALID_USER'));
     }
     // If the user is blocked or the user doesn't have community access
     if ($this->my->id != $user->id && $this->my->isBlockedBy($user->id) || !$user->hasCommunityAccess()) {
         return JError::raiseError(404, JText::_('COM_EASYSOCIAL_PROFILE_INVALID_USER'));
     }
     // If the user is blocked, they should not be accessible
     if ($user->isBlock()) {
         return JError::raiseError(404, JText::_('COM_EASYSOCIAL_PROFILE_INVALID_USER'));
     }
     // Set the page properties
     $this->page->title($this->string->escape($user->getName()));
     $this->page->breadcrumb($this->string->escape($user->getName()));
     // Get the current user's privacy object
     $privacy = $this->my->getPrivacy();
     // Let's test if the current viewer is allowed to view this profile.
     if ($this->my->id != $user->id && !$privacy->validate('profiles.view', $user->id, SOCIAL_TYPE_USER)) {
         $this->set('user', $user);
         return parent::display('site/profile/restricted');
     }
     // Apply opengraph tags.
     FD::opengraph()->addProfile($user);
     // Do not assign badge if i view myself.
     if ($user->id != $this->my->id && $this->my->id) {
         // @badge: profile.view
         $badge = FD::badges();
         $badge->log('com_easysocial', 'profile.view', $this->my->id, JText::_('COM_EASYSOCIAL_PROFILE_VIEWED_A_PROFILE'));
     }
     // Get the limit start
     $startLimit = $this->input->get('limitstart', 0, 'int');
     // Determine if the current request is to load an app
     $appId = $this->input->get('appId', 0, 'int');
     // Get the apps library.
     $appsLib = FD::apps();
     // Default contents
     $contents = '';
     // Load the app when necessary
     if ($appId) {
         $app = FD::table('App');
         $app->load($appId);
         // Check if the user has access to this app
         if (!$app->accessible($user->id)) {
             FD::info()->set(false, JText::_('COM_EASYSOCIAL_PROFILE_APP_IS_NOT_INSTALLED_BY_USER'), SOCIAL_MSG_ERROR);
             $redirect = FRoute::profile(array('id' => $user->getAlias()), false);
             return $this->redirect($redirect);
         }
         // Set the page title
         $this->page->title(FD::string()->escape($user->getName()) . ' - ' . $app->get('title'));
         // Render the app contents
         $contents = $appsLib->renderView(SOCIAL_APPS_VIEW_TYPE_EMBED, 'profile', $app, array('userId' => $user->id));
     }
     // Get the layout
     $layout = $this->input->get('layout', '', 'cmd');
     // @since 1.3.7
     // If layout is empty, means we want to get the default view
     // Previously timeline is always the default
     if (empty($appId) && empty($layout) && $filter != 'appFilter') {
         $defaultDisplay = $this->config->get('users.profile.display', 'timeline');
         $layout = $defaultDisplay;
     }
     // Default variables
     $timeline = null;
     $newCover = false;
     // Viewing info of a user.
     if ($layout === 'about') {
         $showTimeline = false;
         $usersModel = FD::model('Users');
         $steps = $usersModel->getAbout($user);
         // We should generate a canonical link if user is viewing the about section and the default page is about
         if ($this->config->get('users.profile.display') == 'about') {
             $this->page->canonical($user->getPermalink(false, true));
         }
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:view.html.php

示例5: item

 /**
  * Displays the album item
  *
  * @since	1.0
  * @access	public
  */
 public function item()
 {
     // Check for user profile completeness
     FD::checkCompleteProfile();
     // Check if photos is enabled
     $this->checkFeature();
     // Retrieve the album from request
     $id = $this->input->get('id', 0, 'int');
     // Get the unique id and type
     $uid = $this->input->get('uid', 0, 'int');
     $type = $this->input->get('type', SOCIAL_TYPE_USER, 'string');
     // If id is provided but UID is not provided, probably they created a menu that links to a single album
     if ($id && !$uid) {
         $album = FD::table('Album');
         $album->load($id);
         if (!$album->id) {
             return $this->deleted();
         }
         $uid = $album->uid;
         $type = $album->type;
     }
     if ($type == SOCIAL_TYPE_USER && $uid) {
         if (FD::user()->id != $uid) {
             if (FD::user()->isBlockedBy($uid)) {
                 return JError::raiseError(404, JText::_('COM_EASYSOCIAL_ALBUMS_INVALID_USER_PROVIDED'));
             }
         }
     }
     // Load up the albums library
     $lib = FD::albums($uid, $type, $id);
     // Determines if the viewer is trying to view albums for a valid node.
     if (!$lib->isValidNode()) {
         $this->setMessage($lib->getError(), SOCIAL_MSG_ERROR);
         $this->info->set($this->getMessage());
         $this->redirect(FRoute::dashboard(array(), false));
         $this->close();
     }
     // Empty id or invalid id is not allowed.
     if (!$id || !$lib->data->id) {
         return $this->deleted();
     }
     // Check if the album is viewable
     $viewable = $lib->viewable();
     if (!$viewable) {
         return $this->restricted($lib->data->uid, $lib->data->type);
     }
     // Increment the hit of the album
     $lib->data->addHit();
     // Get a list of photos within this album
     $photos = $lib->getPhotos($lib->data->id);
     $photos = $photos['photos'];
     // Set the opengraph data for photos within this album
     if ($photos) {
         foreach ($photos as $photo) {
             FD::opengraph()->addImage($photo->getSource());
         }
     }
     // Set page title
     $title = $lib->getPageTitle($this->getLayout());
     FD::page()->title($title);
     // Set the breadcrumbs
     $lib->setBreadcrumbs($this->getLayout());
     // Render options
     $options = array('viewer' => $this->my->id);
     // Render item
     $output = $lib->renderItem($options);
     return $this->output($uid, $type, $output, $lib->data);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:74,代码来源:view.html.php

示例6: renderItem

 /**
  * Wraps the provided album
  *
  * @since	1.0
  * @access	public
  */
 public function renderItem($options = array())
 {
     $album = $this->data;
     // Determine if album is passed in options
     if (isset($options['album'])) {
         $album = $options['album'];
     }
     // Set the default settings for opening photos in a popup
     $config = FD::config();
     $this->renderItemOptions['photoItem']['openInPopup'] = $config->get('photos.popup.default');
     // Built preset options
     $presetOptions = array('canUpload' => $this->canUpload());
     // Normalize render options
     $options = array_merge($this->renderItemOptions, $presetOptions, $options);
     if (!empty($options['photoItem'])) {
         $options['photoItem'] = array_merge($this->renderItemOptions['photoItem'], $options['photoItem']);
     }
     // Inherit photo item's viewer from album if it is not given
     if (empty($options['photoItem']['viewer'])) {
         $options['photoItem']['viewer'] = $options['viewer'];
     }
     // Set the layout for the photo
     $options['photoItem']['layout'] = $options['layout'];
     // Photos cannot be uploaded to core albums
     if ($album->core) {
         $options['canUpload'] = false;
     }
     // Get album privacy
     // @TODO: Get proper album privacy
     $privacy = FD::privacy();
     // Get album creator
     $creator = FD::user($album->user_id);
     // Get album viewer
     $viewer = FD::user($options['viewer']);
     // Get the photo options
     $photoOptions = array();
     if ($options['limit'] !== 'auto') {
         $photoOptions['limit'] = $options['limit'];
     }
     //privacy
     if (isset($options['privacy'])) {
         $photoOptions['privacy'] = $options['privacy'];
     }
     // Get album phtoos
     $photos = $album->getPhotos($photoOptions);
     // // Add opengraph data for each photos
     if ($photos['photos']) {
         foreach ($photos['photos'] as $photo) {
             FD::opengraph()->addImage($photo->getSource());
         }
     }
     // Get album likes
     $likes = FD::likes($album->id, SOCIAL_TYPE_ALBUM, 'create', SOCIAL_APPS_GROUP_USER);
     // Get album shares
     $shares = FD::get('Repost', $album->id, SOCIAL_TYPE_ALBUM, SOCIAL_APPS_GROUP_USER);
     // Get album comments
     $comments = FD::comments($album->id, SOCIAL_TYPE_ALBUM, 'create', SOCIAL_APPS_GROUP_USER, array('url' => $album->getPermalink()));
     // Get a list of tags from this album
     $tags = $album->getTags(true);
     // Build the user alias
     $userAlias = $creator->getAlias();
     // Generate item layout
     $theme = FD::themes();
     // Determines if the current document is RTL
     $rtl = $this->doc->getDirection() == 'rtl' ? true : false;
     $theme->set('rtl', $rtl);
     $theme->set('lib', $this);
     $theme->set('options', $options);
     $theme->set('userAlias', $userAlias);
     $theme->set('album', $album);
     $theme->set('tags', $tags);
     $theme->set('creator', $creator);
     $theme->set('privacy', $privacy);
     $theme->set('likes', $likes);
     $theme->set('shares', $shares);
     $theme->set('comments', $comments);
     $theme->set('photos', $photos['photos']);
     $theme->set('nextStart', $photos['nextStart']);
     return $theme->output('site/albums/item');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:86,代码来源:albums.php


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