Jetpack_Tiled_Gallery_Layout

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

Defined (1)

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

/modules/tiled-gallery/tiled-gallery/tiled-gallery-layout.php  
  1. abstract class Jetpack_Tiled_Gallery_Layout { 
  2. // Template whitelist 
  3. private static $templates = array( 'carousel-container', 'circle-layout', 'rectangular-layout', 'square-layout' ); 
  4. private static $partials = array( 'carousel-image-args', 'item' ); 
  5.  
  6. protected $type; // Defined in child classes 
  7. public $attachments; 
  8. public $link; 
  9. public $grayscale; 
  10. public $columns; 
  11. public function __construct( $attachments, $link, $grayscale, $columns ) { 
  12.  
  13. $this->attachments = $attachments; 
  14. $this->link = $link; 
  15. $this->needs_attachment_link = ! ( isset( $link ) && $link == 'file' ); 
  16. $this->grayscale = $grayscale; 
  17. $this->columns = $columns; 
  18.  
  19. public function HTML( $context = array() ) { 
  20. // Render the carousel container template, which will take the 
  21. // appropriate strategy to fill it 
  22. ob_start(); 
  23. $this->template( 'carousel-container', array_merge( $context, array( 
  24. 'attachments' => $this->attachments,  
  25. 'link' => $this->link,  
  26. 'needs_attachment_link' => $this->needs_attachment_link,  
  27. 'grayscale' => $this->grayscale 
  28. ) ) ); 
  29. $html = ob_get_clean(); 
  30.  
  31. return $html; 
  32.  
  33. private function template( $name, $context = null ) { 
  34. if ( ! in_array( $name, self::$templates ) ) { 
  35. return; 
  36.  
  37. if ( isset( $context ) ) { 
  38. extract( $context ); 
  39.  
  40. require dirname( __FILE__ ) . "/templates/$name.php"; 
  41.  
  42. private function partial( $name, $context = null ) { 
  43. if ( ! in_array( $name, self::$partials ) ) { 
  44. return; 
  45.  
  46. if ( isset( $context ) ) { 
  47. extract( $context ); 
  48.  
  49. require dirname( __FILE__ ) . "/templates/partials/$name.php"; 
  50.  
  51. protected function get_container_extra_data() { 
  52. global $post; 
  53.  
  54. $blog_id = (int) get_current_blog_id(); 
  55.  
  56. if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { 
  57. $likes_blog_id = $blog_id; 
  58. } else { 
  59. $likes_blog_id = Jetpack_Options::get_option( 'id' ); 
  60.  
  61. if ( class_exists( 'Jetpack_Carousel' ) || in_array( 'carousel', Jetpack::get_active_modules() ) || 'carousel' == $this->link ) { 
  62. $extra_data = array( 'blog_id' => $blog_id, 'permalink' => get_permalink( isset( $post->ID ) ? $post->ID : 0 ), 'likes_blog_id' => $likes_blog_id ); 
  63. } else { 
  64. $extra_data = null; 
  65.  
  66. return $extra_data;