about
2 years ago
fields
2 years ago
helpers
2 years ago
interfaces
3 years ago
storages
2 years ago
templates
2 years ago
walkers
2 years ago
autoloader.php
2 years ago
clone.php
3 years ago
core.php
3 years ago
field-registry.php
3 years ago
field.php
3 years ago
functions.php
3 years ago
loader.php
2 years ago
media-modal.php
2 years ago
meta-box-registry.php
3 years ago
meta-box.php
3 years ago
request.php
3 years ago
sanitizer.php
2 years ago
shortcode.php
3 years ago
storage-registry.php
3 years ago
validation.php
2 years ago
wpml.php
2 years ago
storage-registry.php
22 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Storage registry class |
| 4 | */ |
| 5 | class RWMB_Storage_Registry { |
| 6 | protected $storages = []; |
| 7 | |
| 8 | /** |
| 9 | * Get storage instance. |
| 10 | * |
| 11 | * @param string $class_name Storage class name. |
| 12 | * @return RWMB_Storage_Interface |
| 13 | */ |
| 14 | public function get( $class_name ) { |
| 15 | if ( empty( $this->storages[ $class_name ] ) ) { |
| 16 | $this->storages[ $class_name ] = new $class_name(); |
| 17 | } |
| 18 | |
| 19 | return $this->storages[ $class_name ]; |
| 20 | } |
| 21 | } |
| 22 |