slug = sanitize_title(basename($base, '.php')); $this->wrapper = [$base]; $this->template = $template; $str = substr($base, 0, -4); array_unshift($this->wrapper, sprintf($str . '-%s.php', basename($template, '.php'))); } /** * @return string * @see getTemplate */ public function __toString() { return $this->unwrap(); } /** {@inheritdoc} */ public function wrap() { $wrappers = apply_filters('sage/wrap_' . $this->slug, $this->wrapper) ?: $this->wrapper; return locate_template($wrappers); } /** {@inheritdoc} */ public function slug() { return $this->slug; } /** {@inheritdoc} */ public function unwrap() { $template = apply_filters('sage/unwrap_' . $this->slug, $this->template) ?: $this->template; return locate_template($template) ?: $template; } }