Jetpack_Tiled_Gallery_Shape

The Jetpack by WordPress.com Jetpack Tiled Gallery Shape class.

Defined (1)

The class is defined in the following location(s).

/modules/tiled-gallery/tiled-gallery/tiled-gallery-shape.php  
  1. class Jetpack_Tiled_Gallery_Shape { 
  2. static $shapes_used = array(); 
  3.  
  4. public function __construct( $images ) { 
  5. $this->images = $images; 
  6. $this->images_left = count( $images ); 
  7.  
  8. public function sum_ratios( $number_of_images = 3 ) { 
  9. return array_sum( array_slice( wp_list_pluck( $this->images, 'ratio' ), 0, $number_of_images ) ); 
  10.  
  11. public function next_images_are_symmetric() { 
  12. return $this->images_left > 2 && $this->images[0]->ratio == $this->images[2]->ratio; 
  13.  
  14. public function is_not_as_previous( $n = 1 ) { 
  15. return ! in_array( get_class( $this ), array_slice( self::$shapes_used, -$n ) ); 
  16.  
  17. public function is_wide_theme() { 
  18. return Jetpack::get_content_width() > 1000; 
  19.  
  20. public function image_is_landscape( $image ) { 
  21. return $image->ratio >= 1 && $image->ratio < 2; 
  22.  
  23. public function image_is_portrait( $image ) { 
  24. return $image->ratio < 1; 
  25.  
  26. public function image_is_panoramic( $image ) { 
  27. return $image->ratio >= 2; 
  28.  
  29. public static function set_last_shape( $last_shape ) { 
  30. self::$shapes_used[] = $last_shape; 
  31.  
  32. public static function reset_last_shape() { 
  33. self::$shapes_used = array();