本文整理汇总了PHP中f::modified方法的典型用法代码示例。如果您正苦于以下问题:PHP f::modified方法的具体用法?PHP f::modified怎么用?PHP f::modified使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类f
的用法示例。
在下文中一共展示了f::modified方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sync
/**
* Resets store if necessary to stay in sync with content file
*/
public function sync()
{
$file = $this->structure->model()->textfile();
$ageModel = f::exists($file) ? f::modified($file) : 0;
$ageStore = s::get($this->id() . '_age');
if ($ageStore < $ageModel) {
$this->reset();
$this->age = $ageModel;
} else {
$this->age = $ageStore;
}
}
示例2: testModified
public function testModified()
{
$site = $this->siteInstance();
$page = new Page($site, '1-a');
$modified = f::modified($page->root());
$this->assertEquals($modified, $page->modified());
$this->assertEquals(date('Y-m-d', $modified), $page->modified('Y-m-d'));
// switch the date handler
$kirby = $this->kirbyInstance(array('date.handler' => 'strftime'));
$site = $this->siteInstance($kirby);
$page = new Page($site, '1-a');
$this->assertEquals($modified, $page->modified());
$this->assertEquals(strftime('%Y-%m-%d', $modified), $page->modified('%Y-%m-%d'));
}
示例3: testModified
public function testModified()
{
$page = $this->siteInstance()->page('tests/file-extension-case-test');
$file = $page->file('a.json');
$modified = f::modified($file->root());
$this->assertEquals($modified, $file->modified());
$this->assertEquals(date('Y-m-d', $modified), $file->modified('Y-m-d'));
// switch the date handler
$kirby = $this->kirbyInstance(array('date.handler' => 'strftime'));
$site = $this->siteInstance($kirby);
$page = $site->page('tests/file-extension-case-test');
$file = $page->file('a.json');
$this->assertEquals($modified, $file->modified());
$this->assertEquals(strftime('%Y-%m-%d', $modified), $file->modified('%Y-%m-%d'));
}
示例4: modified
/**
* Get the file's last modification time.
*
* @return int
*/
public function modified($format = null, $handler = 'date')
{
return f::modified($this->root, $format, $handler);
}
示例5: modified
/**
* Returns the timestamp when the page
* has been modified
*
* @return int
*/
public function modified($format = null, $handler = null)
{
return f::modified($this->root, $format, $handler ? $handler : $this->kirby->options['date.handler']);
}
示例6: download
public static function download($file, $name = null)
{
// stop the download if the file does not exist or is not readable
if (!is_file($file) or !is_readable($file)) {
return false;
}
header::download(array('name' => $name ? $name : f::filename($file), 'size' => f::size($file), 'mime' => f::mime($file), 'modified' => f::modified($file)));
die(f::read($file));
}
示例7: modified
/**
* Returns the timestamp when the page
* has been modified
*
* @return int
*/
public function modified($format = null)
{
return f::modified($this->root, $format);
}
示例8: isThere
/**
* Checks if the thumbnail already exists
* and is newer than the original file
*
* @return boolean
*/
public function isThere()
{
if ($this->options['overwrite'] === true) {
return false;
}
// if the thumb already exists and the source hasn't been updated
// we don't need to generate a new thumbnail
if (file_exists($this->destination->root) and f::modified($this->destination->root) >= $this->source->modified()) {
return true;
}
return false;
}
示例9: kirby
$jsHandler = kirby()->option('js.handler');
$kirby->options['css.handler'] = function ($url, $media = false) use($cssHandler, $kirby) {
if (is_array($url)) {
$css = array();
foreach ($url as $u) {
$css[] = call($kirby->options['css.handler'], $u);
}
return implode(PHP_EOL, $css) . PHP_EOL;
}
$file = $kirby->roots()->index() . DS . $url;
if (file_exists($file)) {
$mod = f::modified($file);
$url = dirname($url) . '/' . f::name($url) . '.' . $mod . '.css';
}
return call($cssHandler, array($url, $media));
};
$kirby->options['js.handler'] = function ($src, $async = false) use($jsHandler, $kirby) {
if (is_array($src)) {
$js = array();
foreach ($src as $s) {
$js[] = call($kirby->options['js.handler'], $s);
}
return implode(PHP_EOL, $js) . PHP_EOL;
}
$file = $kirby->roots()->index() . DS . $src;
if (file_exists($file)) {
$mod = f::modified($file);
$src = dirname($src) . '/' . f::name($src) . '.' . $mod . '.js';
}
return call($jsHandler, array($src, $async));
};
示例10: testModified
public function testModified()
{
$this->assertEquals(filemtime($this->contentFile), f::modified($this->contentFile));
}
示例11: fileExist
public function fileExist()
{
if ($this->data[self::ARRAY_ATTR][self::PARA_OVERWRITE] === true) {
return false;
}
if (file_exists($this->data[self::ARRAY_ATTR][self::PARA_IMG_OUTPUT_ROOT]) && \f::modified($this->data[self::ARRAY_ATTR][self::PARA_IMG_OUTPUT_ROOT]) >= $this->data[self::ARRAY_ATTR][self::PARA_IMG_SOURCE_MODIFIED]) {
return true;
}
return false;
}