more extensive extension() method

This commit is contained in:
Andy Miller
2015-08-04 09:40:59 -06:00
parent 8963d024a6
commit 1401102396

View File

@@ -605,22 +605,6 @@ class Page
return null;
}
/**
* Get page extension
*
* @param $var
*
* @return mixed
*/
public function extension($var = null)
{
if ($var !== null) {
$this->extension = $var;
}
return $this->extension;
}
/**
* Save page if there's a file assigned to it.
* @param bool $reorder Internal use.
@@ -853,11 +837,28 @@ class Page
$this->template = $var;
}
if (empty($this->template)) {
$this->template = ($this->modular() ? 'modular/' : '') . str_replace($this->extension, '', $this->name());
$this->template = ($this->modular() ? 'modular/' : '') . str_replace($this->extension(), '', $this->name());
}
return $this->template;
}
/**
* Gets and sets the extension field.
*
* @param null $var
* @return null|string
*/
public function extension($var = null)
{
if ($var !== null) {
$this->extension = $var;
}
if (empty($this->extension)) {
$this->extension = '.' . pathinfo($this->name(), PATHINFO_EXTENSION);
}
return $this->extension;
}
/**
* Gets and sets the expires field. If not set will return the default
*