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


PHP RevSlide::initByStreamData方法代码示例

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


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

示例1: getSlidesFromStream


//.........这里部分代码省略.........
             $arrPosts = $twitter->get_public_photos($this->getParam('twitter-user-id'), $this->getParam('twitter-include-retweets'), $this->getParam('twitter-exclude-replies'), $this->getParam('twitter-count'), $this->getParam('twitter-image-only'));
             $max_posts = $this->getParam('twitter-count', '500', self::FORCE_NUMERIC);
             $max_allowed = 500;
             $additions['twitter_user'] = $this->getParam('twitter-user-id');
             break;
         case "instagram":
             $instagram = new RevSliderInstagram($this->getParam('instagram-access-token'), $this->getParam('instagram-transient', '1200'));
             $search_user_id = $this->getParam('instagram-user-id');
             $arrPosts = $instagram->get_public_photos($search_user_id, $this->getParam('instagram-count'));
             $max_posts = $this->getParam('instagram-count', '33', self::FORCE_NUMERIC);
             $max_allowed = 33;
             break;
         case "flickr":
             $flickr = new RevSliderFlickr($this->getParam('flickr-api-key'), $this->getParam('flickr-transient', '1200'));
             switch ($this->getParam('flickr-type')) {
                 case 'publicphotos':
                     $user_id = $flickr->get_user_from_url($this->getParam('flickr-user-url'));
                     $arrPosts = $flickr->get_public_photos($user_id, $this->getParam('flickr-count'));
                     break;
                 case 'gallery':
                     $gallery_id = $flickr->get_gallery_from_url($this->getParam('flickr-gallery-url'));
                     $arrPosts = $flickr->get_gallery_photos($gallery_id, $this->getParam('flickr-count'));
                     break;
                 case 'group':
                     $group_id = $flickr->get_group_from_url($this->getParam('flickr-group-url'));
                     $arrPosts = $flickr->get_group_photos($group_id, $this->getParam('flickr-count'));
                     break;
                 case 'photosets':
                     $arrPosts = $flickr->get_photo_set_photos($this->getParam('flickr-photoset'), $this->getParam('flickr-count'));
                     break;
             }
             $max_posts = $this->getParam('flickr-count', '99', self::FORCE_NUMERIC);
             break;
         case 'youtube':
             $channel_id = $this->getParam('youtube-channel-id');
             $youtube = new RevSliderYoutube($this->getParam('youtube-api'), $channel_id, $this->getParam('youtube-transient', '1200'));
             if ($this->getParam('youtube-type-source') == "playlist") {
                 $arrPosts = $youtube->show_playlist_videos($this->getParam('youtube-playlist'), $this->getParam('youtube-count'));
             } else {
                 $arrPosts = $youtube->show_channel_videos($this->getParam('youtube-count'));
             }
             $additions['yt_type'] = $this->getParam('youtube-type-source', 'channel');
             $max_posts = $this->getParam('youtube-count', '25', self::FORCE_NUMERIC);
             $max_allowed = 50;
             break;
         case 'vimeo':
             $vimeo = new RevSliderVimeo($this->getParam('vimeo-transient', '1200'));
             $vimeo_type = $this->getParam('vimeo-type-source');
             switch ($vimeo_type) {
                 case 'user':
                     $arrPosts = $vimeo->get_vimeo_videos($vimeo_type, $this->getParam('vimeo-username'));
                     break;
                 case 'channel':
                     $arrPosts = $vimeo->get_vimeo_videos($vimeo_type, $this->getParam('vimeo-channelname'));
                     break;
                 case 'group':
                     $arrPosts = $vimeo->get_vimeo_videos($vimeo_type, $this->getParam('vimeo-groupname'));
                     break;
                 case 'album':
                     $arrPosts = $vimeo->get_vimeo_videos($vimeo_type, $this->getParam('vimeo-albumid'));
                     break;
                 default:
                     break;
             }
             $additions['vim_type'] = $this->getParam('vimeo-type-source', 'user');
             $max_posts = $this->getParam('vimeo-count', '25', self::FORCE_NUMERIC);
             $max_allowed = 60;
             break;
         default:
             RevSliderFunctions::throwError("getSlidesFromStream error: This source type must be from stream.");
             break;
     }
     if ($max_posts < 0) {
         $max_posts *= -1;
     }
     $arrPosts = apply_filters('revslider_pre_mod_stream_data', $arrPosts, $sourceType, $this->id);
     while (count($arrPosts) > $max_posts || count($arrPosts) > $max_allowed) {
         array_pop($arrPosts);
     }
     $arrPosts = apply_filters('revslider_post_mod_stream_data', $arrPosts, $sourceType, $this->id);
     $arrSlides = array();
     $templateKey = 0;
     $numTemplates = count($slideTemplates);
     if (empty($arrPosts)) {
         RevSliderFunctions::throwError(__('Failed to load Stream', REVSLIDER_TEXTDOMAIN));
     }
     foreach ($arrPosts as $postData) {
         $slideTemplate = $slideTemplates[$templateKey];
         //advance the templates
         $templateKey++;
         if ($templateKey == $numTemplates) {
             $templateKey = 0;
         }
         $slide = new RevSlide();
         $slide->initByStreamData($postData, $slideTemplate, $this->id, $sourceType, $additions);
         $arrSlides[] = $slide;
     }
     $this->arrSlides = $arrSlides;
     return $arrSlides;
 }
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:101,代码来源:slider.class.php


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