← All changes
|
modules/tiled-gallery/tiled-gallery/tiled-gallery-shape.php
+21
-2
12.0.3
→
16.3
View file →
| @@ -1,5 +1,10 @@ | ||
| 1 | 1 | <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 | + | |
| 3 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 4 | + exit( 0 ); | |
| 5 | +} | |
| 6 | + | |
| 2 | 7 | // phpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound |
| 3 | 8 | /** |
| 4 | 9 | * Jetpack tiled gallery shape class. |
| 5 | 10 | */ |
| @@ -12,15 +17,29 @@ | ||
| 12 | 17 | */ |
| 13 | 18 | public static $shapes_used = array(); |
| 14 | 19 | |
| 15 | 20 | /** |
| 21 | + * The images to include in gallery. | |
| 22 | + * | |
| 23 | + * @var object[] | |
| 24 | + */ | |
| 25 | + protected $images; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * How many images are left after each row. | |
| 29 | + * | |
| 30 | + * @var int | |
| 31 | + */ | |
| 32 | + protected $images_left; | |
| 33 | + | |
| 34 | + /** | |
| 16 | 35 | * Constructor class. |
| 17 | 36 | * |
| 18 | - * @param object $images - the images. | |
| 37 | + * @param object[] $images - the images. | |
| 19 | 38 | */ |
| 20 | 39 | public function __construct( $images ) { |
| 21 | 40 | $this->images = $images; |
| 22 | - $this->images_left = count( $images ); | |
| 41 | + $this->images_left = is_countable( $images ) ? count( $images ) : 0; | |
| 23 | 42 | } |
| 24 | 43 | |
| 25 | 44 | /** |
| 26 | 45 | * Return the sum of ratio images. |