2018-08-07 14:02:51 +00:00
|
|
|
<?php
|
|
|
|
|
2018-08-09 09:49:10 +00:00
|
|
|
namespace PortableInfobox\Helpers;
|
2018-08-07 14:02:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class PortableInfoboxDataBag
|
2018-08-09 09:49:10 +00:00
|
|
|
* @package PortableInfobox\Helpers
|
2018-08-07 14:02:51 +00:00
|
|
|
*/
|
|
|
|
class PortableInfoboxDataBag {
|
|
|
|
private static $instance = null;
|
|
|
|
private $galleries = [];
|
|
|
|
|
|
|
|
private function __construct() {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return null|PortableInfoboxDataBag
|
|
|
|
*/
|
|
|
|
public static function getInstance() {
|
|
|
|
if ( is_null( self::$instance ) ) {
|
|
|
|
self::$instance = new self;
|
|
|
|
}
|
|
|
|
return self::$instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setGallery( $marker, $content ) {
|
|
|
|
$this->galleries[$marker] = $content;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve source content of a gallery identified by Parser marker id
|
|
|
|
*/
|
|
|
|
public function getGallery( $marker ) {
|
|
|
|
if ( isset( $this->galleries[$marker] ) ) {
|
|
|
|
return $this->galleries[$marker];
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|