PluginProbe
Meow Gallery / trunk
Meow Gallery vtrunk
5.5.4 5.5.3 5.5.2 5.5.1 5.5.0 5.4.9 5.4.8 5.4.7 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 All 156 releases
meow-gallery / classes / builders / horizontal.php

horizontal.php in Meow Gallery trunk, at classes/builders/horizontal.php

62 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class Meow_MGL_Builders_Horizontal extends Meow_MGL_Builders_Core {
4
5 public function __construct( $atts, $infinite, $isPreview = false ) {
6 parent::__construct( $atts, false, $isPreview );
7 $this->layout = 'horizontal';
8 }
9
10 function inline_css() {
11 $options = get_option( Meow_MGL_Core::get_plugin_option_name(), null );
12 $class_id = '#' . $this->class_id;
13 $gutter = isset( $this->atts['gutter'] ) ? $this->atts['gutter'] : ( $options['horizontal_gutter'] ?? 10 );
14 $image_height = isset( $this->atts['image_height'] ) ? $this->atts['image_height'] : ( $options['horizontal_image_height'] ?? 500 );
15 $hide_scrollbar = isset( $this->atts['hide_scrollbar'] ) ? $this->atts['hide_scrollbar'] : ( $options['horizontal_hide_scrollbar'] ?? false );
16 $isPreview = $this->isPreview;
17 ob_start();
18 include dirname( __FILE__ ) . '/horizontal.css.php';
19 $html = ob_get_clean();
20 return $html;
21 }
22
23 function build( $idsStr ) {
24
25 $options = get_option( Meow_MGL_Core::get_plugin_option_name(), null );
26
27 // Generate gallery
28 $classes = $this->build_classes();
29 $styles = $this->build_styles();
30 $out = "<div id='{$this->class_id}' class='{$classes}' style='{$styles}'>";
31 $gutter = isset( $this->atts['mgl_horizontal_gutter'] )
32 ? $this->atts['mgl_horizontal_gutter']
33 : ( $options['horizontal_gutter'] ?? 5 );
34 $hide_scrollbar = isset( $this->atts['hide_scrollbar'] )
35 ? $this->atts['hide_scrollbar']
36 : ( $options['horizontal_hide_scrollbar'] ?? false );
37 $classes = $hide_scrollbar ? "$classes hide-scrollbar" : $classes;
38 $attributes = "data-mgl-gutter=\"${gutter}\"";
39
40 $out = "<div id='{$this->class_id}' class='{$classes}' style='{$styles}' {$attributes}>";
41 $out .= '<div class="meow-horizontal-track">';
42 $this->prepare_data( $idsStr );
43 while ( count( $this->ids ) > 0 ) {
44 $id = array_pop( $this->ids );
45 $out .= $this->build_next_cell( $id, $this->data[$id] );
46 }
47 $out .= '</div>';
48 $out .= '</div>';
49 $out = apply_filters( 'mgl_gallery_written', $out, $this->layout );
50
51 // Generate gallery container
52 $container_classes = $this->build_container_classes();
53 $inline_css = $this->inline_css();
54 $container = "<div class='{$container_classes}'>{$inline_css}{$out}</div>";
55
56 return $container;
57 }
58
59 }
60
61 ?>
62