public static function getFlag($id = null) { $flags = ContentFlag::getFlags(); if ($id !== null) { if (isset($flags[$id])) { return $flags[$id]; } return ''; } return $flags; }
public static function createContentFlagCache() { self::createCacheFile(); $content = '<?php' . self::$newLine; $dataList = ContentFlag::getFlags(); foreach ($dataList as $row) { $id = $row['id']; $content .= '$cachedContentFlags[\'' . $row['id'] . '\']=[' . self::$newLine; $content .= self::getCacheItem('id', $row); $content .= self::getCacheItem('name', $row); $content .= self::getCacheItem('value', $row, 'int'); $content .= self::getCacheItem('note', $row); $content .= "];" . self::$newLine; } self::writeFile('cachedContentFlags.php', $content); }