1 | <?php |
||
8 | class Gallery_Cache extends Fragment_Cache { |
||
9 | |||
10 | /** @var mixed $original_shortcode Callback originally registered for gallery shortcode. */ |
||
11 | protected $original_shortcode; |
||
12 | |||
13 | /** |
||
14 | * @inheritDoc |
||
15 | */ |
||
16 | public function enable() { |
||
26 | |||
27 | /** |
||
28 | * @inheritDoc |
||
29 | */ |
||
30 | public function disable() { |
||
36 | |||
37 | /** |
||
38 | * Fetch and return cached gallery. |
||
39 | * |
||
40 | * @param array $args Gallery arguments. |
||
41 | * |
||
42 | * @return string |
||
43 | */ |
||
44 | public function gallery_shortcode( $args ) { |
||
59 | |||
60 | /** |
||
61 | * Retrieve array of attachment IDs for current post. |
||
62 | * |
||
63 | * @return array |
||
64 | */ |
||
65 | public function get_attachment_ids() { |
||
83 | |||
84 | /** |
||
85 | * Set up post context and generate gallery output. |
||
86 | * |
||
87 | * @param string $name Fragment name. |
||
88 | * @param array $args Arguments. |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | protected function callback( $name, $args ) { |
||
104 | } |
||
105 |
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state