本文整理汇总了PHP中Misc::key方法的典型用法代码示例。如果您正苦于以下问题:PHP Misc::key方法的具体用法?PHP Misc::key怎么用?PHP Misc::key使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Misc
的用法示例。
在下文中一共展示了Misc::key方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse
function parse()
{
if (!$this->_is_parsed) {
$cache_data = false;
$cache_key = Misc::key('Q:', $this->selector);
$cache = Cache::factory();
if (!Config::get('debug.Q_nocache', FALSE)) {
$cache_data = $cache->get($cache_key);
}
if (false === $cache_data) {
$query = $this->parse_selector();
$cache_data = array('name' => $query->name, 'SQL' => $query->SQL, 'count_SQL' => $query->count_SQL, 'sum_SQL' => $query->sum_SQL);
if ($cache) {
$cache->set($cache_key, $cache_data);
}
}
$this->SQL = $cache_data['SQL'];
$this->count_SQL = $cache_data['count_SQL'];
$this->sum_SQL = $cache_data['sum_SQL'];
$this->_is_parsed = TRUE;
$this->name = $cache_data['name'];
}
}
示例2: connected_with
function connected_with($object, $type = '', $approved_only = FALSE)
{
$name1 = $this->_name;
$name2 = $object->_name;
$id1 = $this->id;
$id2 = $object->id;
if (strcmp($name1, $name2) < 0) {
$type = self::counterpart($type);
list($name1, $name2) = array($name2, $name1);
list($id1, $id2) = array($id2, $id1);
}
$db = self::db($name1);
$key = Misc::key($db->name(), $name1, $id1, $name2, $id2, $type);
if (isset(self::$conn_cache[$key])) {
return $approved_only ? self::$conn_cache[$key] : isset(self::$conn_cache[$key]);
}
$table = self::RELA_PREFIX . $name1 . '_' . $name2;
self::$conn_cache[$key] = $db->value('SELECT `approved` FROM `%s` WHERE `id1`=%d AND `id2`=%d AND `type`="%s"', $table, $id1, $id2, $type);
return $approved_only ? self::$conn_cache[$key] : isset(self::$conn_cache[$key]);
}
示例3: cache_content
static function cache_content($f)
{
$files = array_unique(explode(' ', $f));
$content = '';
foreach ($files as $file) {
$file = trim($file);
list($category, $file) = explode(':', $file, 2);
if (!$file) {
$file = $category;
$category = NULL;
}
if (!$file) {
continue;
}
$path = Core::file_exists(PRIVATE_BASE . 'css/' . $file . '.css', $category);
if ($path) {
$content .= CSS::format(@file_get_contents($path));
}
}
$url_base = preg_replace('/[^\\/]*$/', '', $_SERVER['SCRIPT_NAME']);
$content = preg_replace('/\\burl\\s*\\(\\s*(["\'])?\\s*([^:]+?)\\s*\\1?\\s*\\)/', 'url(' . $url_base . '\\2)', $content);
$css_file = Misc::key('css', $f) . '.css';
Cache::cache_content($css_file, $content);
return $content;
}
示例4: cache_content
static function cache_content($f)
{
$files = array_unique(explode(' ', $f));
$content = '';
foreach ($files as $file) {
$file = trim($file);
list($category, $file) = explode(':', $file, 2);
if (!$file) {
$file = $category;
$category = NULL;
}
if (!$file) {
continue;
}
$path = Core::file_exists(PRIVATE_BASE . 'js/' . $file . '.js', $category);
if ($path) {
$content .= self::format(@file_get_contents($path));
}
}
$js_file = Misc::key('js', $f) . '.js';
Cache::cache_content($js_file, $content);
return $content;
}