function add_extra_head() { $cache = new \cache\main(); if ($show_from_cache = $cache->check('admin_head')) { return $show_from_cache; } else { $head = ''; foreach (\query\others::while_head_lines(array_merge(array('max' => 0, 'show' => 'admin', 'orderby' => 'date desc'))) as $line) { $head .= \site\plugin::replace_constant($line->text) . "\n"; } $cache->add('admin_head', $head); return $head; } }
function add_extra_head() { $cache = new \cache\main(); if ($show_from_cache = $cache->check('theme_head')) { return $show_from_cache; } else { $head = ''; foreach (\query\others::while_head_lines(array_merge(array('max' => 0, 'show' => 'theme', 'orderby' => 'date desc'))) as $line) { $head .= \site\plugin::replace_constant($line->text) . "\n"; } if (file_exists(COMMON_LOCATION . '/head.html')) { $head .= @file_get_contents(COMMON_LOCATION . '/head.html'); $head .= "\n"; } $cache->add('theme_head', $head); return $head; } }
public static function get_option($option = '') { global $db; if (empty($option)) { $stmt = $db->stmt_init(); $stmt->prepare("SELECT option_name, option_value FROM " . DB_TABLE_PREFIX . "options"); $stmt->execute(); $stmt->bind_result($name, $value); $params = array(); while ($stmt->fetch()) { $params[$name] = $value; } $stmt->close(); return (object) $params; } else { $cache = new \cache\main(); if ($show_from_cache = $cache->check('options_' . $option)) { return $show_from_cache; } else { $stmt = $db->stmt_init(); $stmt->prepare("SELECT COUNT(*), option_value FROM " . DB_TABLE_PREFIX . "options WHERE option_name = ?"); $stmt->bind_param("s", $option); $stmt->execute(); $stmt->bind_result($count, $value); $stmt->fetch(); $stmt->close(); if (empty($count)) { return false; } $cache->add('options_' . $option, $value); return $value; } } }