當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。