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


PHP RevSliderFunctions::assocToArray方法代码示例

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


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

示例1: getSlidesFromStream

 /**
  * get slides from posts
  */
 public function getSlidesFromStream($publishedOnly = false)
 {
     $slideTemplates = $this->getSlidesFromGallery($publishedOnly);
     $slideTemplates = RevSliderFunctions::assocToArray($slideTemplates);
     if (count($slideTemplates) == 0) {
         return array();
     }
     $arrPosts = array();
     $max_allowed = 999999;
     $sourceType = $this->getParam("source_type", "gallery");
     $additions = array('fb_type' => 'album');
     switch ($sourceType) {
         case "facebook":
             $facebook = new RevSliderFacebook($this->getParam('facebook-transient', '1200'));
             if ($this->getParam('facebook-type-source', 'timeline') == "album") {
                 $arrPosts = $facebook->get_photo_set_photos($this->getParam('facebook-album'), $this->getParam('facebook-count', 10), $this->getParam('facebook-app-id'), $this->getParam('facebook-app-secret'));
             } else {
                 $user_id = $facebook->get_user_from_url($this->getParam('facebook-page-url'));
                 $arrPosts = $facebook->get_photo_feed($user_id, $this->getParam('facebook-app-id'), $this->getParam('facebook-app-secret'), $this->getParam('facebook-count', 10));
                 $additions['fb_type'] = $this->getParam('facebook-type-source', 'timeline');
                 $additions['fb_user_id'] = $user_id;
             }
             if (!empty($arrPosts)) {
                 foreach ($arrPosts as $k => $p) {
                     if (!isset($p->status_type)) {
                         continue;
                     }
                     if (in_array($p->status_type, array("wall_post"))) {
                         unset($arrPosts[$k]);
                     }
                 }
             }
             $max_posts = $this->getParam('facebook-count', '25', self::FORCE_NUMERIC);
             $max_allowed = 25;
             break;
         case "twitter":
             $twitter = new RevSliderTwitter($this->getParam('twitter-consumer-key'), $this->getParam('twitter-consumer-secret'), $this->getParam('twitter-access-token'), $this->getParam('twitter-access-secret'), $this->getParam('twitter-transient', '1200'));
             $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'));
//.........这里部分代码省略.........
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:101,代码来源:slider.class.php


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