Fix conflict with WP core

This commit is contained in:
Ben Word
2016-12-30 12:51:55 -07:00
parent 7722579961
commit 9c522ed9f4

View File

@@ -10,7 +10,7 @@
* @param string $subtitle * @param string $subtitle
* @param string $title * @param string $title
*/ */
$error = function ($message, $subtitle = '', $title = '') { $sage_error = function ($message, $subtitle = '', $title = '') {
$title = $title ?: __('Sage › Error', 'sage'); $title = $title ?: __('Sage › Error', 'sage');
$footer = '<a href="https://roots.io/sage/docs">roots.io/sage/docs</a>'; $footer = '<a href="https://roots.io/sage/docs">roots.io/sage/docs</a>';
$message = "<h1>{$title}<br><small>{$subtitle}</small></h1><p>{$message}</p><p>{$footer}</p>"; $message = "<h1>{$title}<br><small>{$subtitle}</small></h1><p>{$message}</p><p>{$footer}</p>";
@@ -21,14 +21,14 @@ $error = function ($message, $subtitle = '', $title = '') {
* Ensure compatible version of PHP is used * Ensure compatible version of PHP is used
*/ */
if (version_compare('5.6.4', phpversion(), '>=')) { if (version_compare('5.6.4', phpversion(), '>=')) {
$error(__('You must be using PHP 5.6.4 or greater.', 'sage'), __('Invalid PHP version', 'sage')); $sage_error(__('You must be using PHP 5.6.4 or greater.', 'sage'), __('Invalid PHP version', 'sage'));
} }
/** /**
* Ensure dependencies are loaded * Ensure dependencies are loaded
*/ */
if (!file_exists($composer = __DIR__.'/vendor/autoload.php') && !class_exists('Roots\\Sage\\Container')) { if (!file_exists($composer = __DIR__.'/vendor/autoload.php') && !class_exists('Roots\\Sage\\Container')) {
$error( $sage_error(
__('You must run <code>composer install</code> from the Sage directory.', 'sage'), __('You must run <code>composer install</code> from the Sage directory.', 'sage'),
__('Autoloader not found.', 'sage') __('Autoloader not found.', 'sage')
); );
@@ -41,10 +41,10 @@ require_once $composer;
* The mapped array determines the code library included in your theme. * The mapped array determines the code library included in your theme.
* Add or remove files to the array as needed. Supports child theme overrides. * Add or remove files to the array as needed. Supports child theme overrides.
*/ */
array_map(function ($file) use ($error) { array_map(function ($file) use ($sage_error) {
$file = "src/{$file}.php"; $file = "src/{$file}.php";
if (!locate_template($file, true, true)) { if (!locate_template($file, true, true)) {
$error(sprintf(__('Error locating <code>%s</code> for inclusion.', 'sage'), $file), 'File not found'); $sage_error(sprintf(__('Error locating <code>%s</code> for inclusion.', 'sage'), $file), 'File not found');
} }
}, ['helpers', 'setup', 'filters', 'admin']); }, ['helpers', 'setup', 'filters', 'admin']);