protected function runScript($path, array $globals = []) { // add script specified global variables $globals = array_merge($globals, WordPress::globals($path) ?: []); foreach ($globals as $global) { global ${$global}; } if (env('APP_ENV') == 'testing1') { ob_start(); // We'll evaluate the contents of the view inside a try/catch block so we can // flush out any stray output that might get out before an error occurs or // an exception is thrown. This prevents any partial views from leaking. try { require wordpress_path($path); } catch (Exception $e) { ob_end_clean(); } return ltrim(ob_get_clean()); } else { require wordpress_path($path); } }
protected function runScript($path, array $globals = []) { // add script specified global variables $globals = array_merge($globals, WordPress::globals($path) ?: []); foreach ($globals as $global) { global ${$global}; } require wordpress_path($path); }