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


PHP Jetpack_PostImages::from_slideshow方法代码示例

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


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

示例1: test_from_slideshow_is_array

 /**
  * @author scotchfield
  * @covers Jetpack_PostImages::from_slideshow
  * @since 3.2
  */
 public function test_from_slideshow_is_array()
 {
     require_once plugin_dir_path(realpath(dirname(__FILE__) . '/../../modules/shortcodes/slideshow.php')) . 'slideshow.php';
     $slideshow = new Jetpack_Slideshow_Shortcode();
     $post_id = $this->factory->post->create(array('post_content' => '[slideshow]'));
     $images = Jetpack_PostImages::from_slideshow($post_id);
     $this->assertInternalType('array', $images);
 }
开发者ID:atrus1701,项目名称:jetpack,代码行数:13,代码来源:test_class.jetpack-post-images.php

示例2: get_image_fields

 /**
  * @param $post A post object
  * @param $args (array) Optional args, see defaults list for details
  * @returns array Returns an array of all images meeting the specified criteria in $args
  *
  * Uses Jetpack Post Images
  */
 private static function get_image_fields($post, $args = array())
 {
     $defaults = array('width' => 200, 'height' => 200);
     $args = wp_parse_args($args, $defaults);
     $image_list = array();
     $image_booleans = array();
     $image_booleans['gallery'] = 0;
     $from_slideshow = Jetpack_PostImages::from_slideshow($post->ID, $args['width'], $args['height']);
     if (!empty($from_slideshow)) {
         $srcs = wp_list_pluck($from_slideshow, 'src');
         $image_list = array_merge($image_list, $srcs);
     }
     $from_gallery = Jetpack_PostImages::from_gallery($post->ID);
     if (!empty($from_gallery)) {
         $srcs = wp_list_pluck($from_gallery, 'src');
         $image_list = array_merge($image_list, $srcs);
         $image_booleans['gallery']++;
         // @todo This count isn't correct, will only every count 1
     }
     // @todo Can we check width/height of these efficiently?  Could maybe use query args at least, before we strip them out
     $image_list = Jetpack_Media_Meta_Extractor::get_images_from_html($post->post_content, $image_list);
     return Jetpack_Media_Meta_Extractor::build_image_struct($image_list);
 }
开发者ID:ayoayco,项目名称:upbeat,代码行数:30,代码来源:class.media-extractor.php


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