Use Config object to store config options

This commit is contained in:
QWp6t
2016-12-24 23:14:16 -08:00
parent 5d454ba8ed
commit c0fc19ef61
7 changed files with 134 additions and 28 deletions

View File

@@ -34,7 +34,11 @@ add_filter('excerpt_more', function () {
array_map(function ($type) {
add_filter("{$type}_template_hierarchy", function ($templates) {
return call_user_func_array('array_merge', array_map(function ($template) {
$normalizedTemplate = preg_replace(['%^/?(templates)?/?%', '%(\.blade)?(\.php)?$%'], '', $template);
$transforms = [
'%^/?(templates)?/?%' => config('sage.disable_option_hack') ? 'templates/' : '',
'%(\.blade)?(\.php)?$%' => ''
];
$normalizedTemplate = preg_replace(array_keys($transforms), array_values($transforms), $template);
return ["{$normalizedTemplate}.blade.php", "{$normalizedTemplate}.php"];
}, $templates));
});
@@ -53,7 +57,7 @@ add_filter('template_include', function ($template) {
echo template($template, $data);
// Return a blank file to make WordPress happy
return get_template_directory() . '/index.php';
return dirname(__DIR__).'/index.php';
}, PHP_INT_MAX);
/**