本文整理匯總了PHP中Preferences::valueForModuleWithKey方法的典型用法代碼示例。如果您正苦於以下問題:PHP Preferences::valueForModuleWithKey方法的具體用法?PHP Preferences::valueForModuleWithKey怎麽用?PHP Preferences::valueForModuleWithKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Preferences
的用法示例。
在下文中一共展示了Preferences::valueForModuleWithKey方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getCounts
/**
* Returns information about the aggregate of photos on the site
*
* @access public
* @return array
*/
public function getCounts()
{
$this->counts['albums'] = Database::selectOne('albums', 'COUNT(*)');
$this->counts['topics'] = Database::selectOne('albums', 'COUNT(DISTINCT topic)');
$this->counts['photos'] = Database::selectOne('photos', 'COUNT(*)');
$this->counts['pixels'] = Database::selectOne('photos', 'SUM(width*height)');
$this->counts['albumhits'] = Database::selectOne('albums', 'SUM(hits)');
$this->counts['photohits'] = Database::selectOne('photos', 'SUM(hits)');
$this->counts['maxphotohits'] = Database::selectOne('photos', 'MAX(hits)');
$this->counts['maxalbumhits'] = Database::selectOne('albums', 'MAX(hits)');
$this->counts['daysonline'] = floor((time() - strtotime(Preferences::valueForModuleWithKey('CameraLife', 'sitedate'))) / 86400);
return $this->counts;
}
示例2: fileStoreWithName
/**
* fileStoreWithName function.
*
* @access public
* @param string $name -- 'photo' or 'other'
* @return void
*/
public static function fileStoreWithName($name)
{
$retval = new FileStore();
$path = null;
if ($name == 'photo') {
$path = Preferences::valueForModuleWithKey('LocalFileStore', 'photo_dir');
} elseif ($name = 'other') {
$path = Preferences::valueForModuleWithKey('LocalFileStore', 'cache_dir');
} else {
throw new \Exception('Bad FileStore name');
}
if (!realpath($path)) {
throw new \Exception('FileStore path does not exist for ' . $path);
}
$retval->baseDir = realpath($path);
return $retval;
}
示例3: isCacheMissing
/**
* isCacheMissing function.
* Return true if thumbnail is missing or if needed _mod is missing
*
* @access public
* @return bool
*/
public function isCacheMissing()
{
if ($this->record['modified'] == '1') {
return true;
//legacy before 2.7
}
$cacheBucket = FileStore::fileStoreWithName('other');
if ($this->record['modified']) {
$filename = '/' . $this->record['id'] . '_mod.' . $this->extension;
$stat = $cacheBucket->listFiles($filename);
if (!count($stat)) {
return true;
}
}
$sizes = array();
$sizes[] = Preferences::valueForModuleWithKey('CameraLife', 'thumbsize');
$sizes[] = Preferences::valueForModuleWithKey('CameraLife', 'scaledsize');
$options = Preferences::valueForModuleWithKey('CameraLife', 'optionsizes');
preg_match_all('/[0-9]+/', $options, $matches);
$sizes = array_merge($sizes, $matches[0]);
foreach ($sizes as $cursize) {
$filename = '/' . $this->record['id'] . '_' . $cursize . '.' . $this->extension;
$stat = $cacheBucket->listFiles($filename);
if (!count($stat)) {
return true;
}
}
return false;
}