Automad = $Automad; Debug::log('Created new instance'); } /** * Return the requested runtime variable. * * @param string $key * @return int|string|null The value of $key or NULL if the requested variable doesn't exsist */ public function get(string $key): int|string|null { if (array_key_exists($key, $this->data)) { return $this->data[$key]; } else { switch ($key) { case Fields::NOW: // The current date/time. return date(DATE_ATOM); case Fields::FILELIST_COUNT: // The filelist count represents the number of files within the last defined filelist. return count($this->Automad->getFilelist()->getFiles()); case Fields::PAGELIST_COUNT: // The pagelist count represents the number of pages within the last defined pagelist, ignoring limit and pagination. return count($this->Automad->getPagelist()->getPages(true)); case Fields::PAGELIST_DISPLAY_COUNT: // The pagelist display count represents the number of pages that will be displayed. return count($this->Automad->getPagelist()->getPages(false)); case Fields::PAGINATION_COUNT: // The last page number of the pagination of the current pagelist. return $this->Automad->getPagelist()->getPaginationCount(); case Fields::CAPTION: // Get the caption for the currently used ":file". // In case ":file" is "image.jpg", the parsed caption file is "image.jpg.caption" and the returned value is stored in ":caption". if (isset($this->data[Fields::FILE])) { return FileUtils::caption(AM_BASE_DIR . $this->data[Fields::FILE]); } else { return ''; } // no break default: // Return NULL in case the requested $key doesn't match any runtime variable // to distinguish false values from not existing keys. return null; } } } /** * Set a runtime variable. * * @param string $key * @param mixed $value */ public function set(string $key, $value): void { $this->data[$key] = $value; } /** * Get the $data array to be shelved and restored at a later point. * * @return array The runtime data array */ public function shelve(): array { Debug::log($this->data, 'Shelving'); return $this->data; } /** * Restore shelved $data array by replacing it with the passed $shelf array. * * @param array $shelf */ public function unshelve(array $shelf): void { $this->data = $shelf; Debug::log($this->data, 'Unshelving'); } } __halt_compiler();----SIGNATURE:----iJawAjmm5n22tKD8HId5t/X0SHvt1FWTHalfpNZlSaNmPA6/54+P7Ksdu20WZXndV6IBDxDZ9SBmZDSYvMI+TQgvdpgBI+nI/atZ/tSIvW1MZaISj0exKqjMFVy4B/OIZI159uWD2eCyT2wHJ9Mn7CF28V2zaQCbIeWQduM58zMYDGwCHiegDp8IDBysWvdlcWkx++3uUzirkHFlxeKmHY1DKUx9bmgWdX0KWeB2I0dUUJ/M5Kuxnntk0fmkGmAcVwORiSZ8ikvVZPwsyIhi4oYsyfKwWUGE8MksI+lbGWP099Kl1B0YWqtXXLOgAj8z+2RO6rqvqZOZ8/eAtc7islvfJwEwBCxmOnRYWeziLTPxsTyEFYa6nAjcW5AzfBZqdYtIuCYRIwnZNr44FzaCN2Y80bBog99vEHEnMoRlqqQC/h26dPrF4V76ZpxveHjx3peuFLtwiqccnTX6/3Gsqv2fLQxy/Uf62Rp1TQsMsqkSw7vaSdrFHBGxlCv1eQ7vECyT5u0pSqGmKQU+X2cjUQKUhy5EzGfTt6Zc0IJnJNmwthizWfb4lboRgXZzF8ZKch88tek/rU0l9d4cG9sKU/+J3uPAW6psiPUFFMcoE3onoxrGBG0fWCj6mkrDWwKlcf7xvg6DP+gIMPBcYJMI7RugG7egBvFwUAxaBEVDUO4=----ATTACHMENT:----MTU5MjkxMjMwMDM0OTMxMSAyMDA2Mjk1NDM1MjgyNzczIDExNzQ4MDA2MjU2MzY1NDQ=