| 1 |
<?php |
| 2 |
|
| 3 |
class WPUPG_Grid_Manager { |
| 4 |
|
| 5 |
private static $grids = array(); |
| 6 |
|
| 7 |
public static function get( $post_or_post_id ) |
| 8 |
{ |
| 9 |
if( is_object( $post_or_post_id ) && $post_or_post_id instanceof WP_Post ) { |
| 10 |
$post_id = $post_or_post_id->ID; |
| 11 |
} else if( is_numeric( $post_or_post_id ) ) { |
| 12 |
$post_id = $post_or_post_id; |
| 13 |
} |
| 14 |
|
| 15 |
if ( ! array_key_exists( $post_id, self::$grids ) ) { |
| 16 |
self::$grids[ $post_id ] = new WPUPG_Grid( $post_or_post_id ); |
| 17 |
} |
| 18 |
|
| 19 |
return self::$grids[ $post_id ]; |
| 20 |
} |
| 21 |
} |