Remove requiring vendor dependencies
Also avoid autoloading vendor.
This commit is contained in:
parent
50bd5cfdc9
commit
8a17c56345
|
@ -43,7 +43,7 @@ abstract class ApplicationBootstrap
|
||||||
/**
|
/**
|
||||||
* Base directory
|
* Base directory
|
||||||
*
|
*
|
||||||
* Parent folder for at least application, bin, modules, library/vendor and public
|
* Parent folder for at least application, bin, modules and public
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
@ -56,13 +56,6 @@ abstract class ApplicationBootstrap
|
||||||
*/
|
*/
|
||||||
protected $appDir;
|
protected $appDir;
|
||||||
|
|
||||||
/**
|
|
||||||
* Vendor library directory
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $vendorDir;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Icinga library directory
|
* Icinga library directory
|
||||||
*
|
*
|
||||||
|
@ -161,7 +154,6 @@ abstract class ApplicationBootstrap
|
||||||
}
|
}
|
||||||
$this->baseDir = $baseDir;
|
$this->baseDir = $baseDir;
|
||||||
$this->appDir = $baseDir . '/application';
|
$this->appDir = $baseDir . '/application';
|
||||||
$this->vendorDir = $baseDir . '/library/vendor';
|
|
||||||
if (substr(__DIR__, 0, 8) === 'phar:///') {
|
if (substr(__DIR__, 0, 8) === 'phar:///') {
|
||||||
$this->libDir = dirname(dirname(__DIR__));
|
$this->libDir = dirname(dirname(__DIR__));
|
||||||
} else {
|
} else {
|
||||||
|
@ -206,15 +198,6 @@ abstract class ApplicationBootstrap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set_include_path(
|
|
||||||
implode(
|
|
||||||
PATH_SEPARATOR,
|
|
||||||
array($this->vendorDir, get_include_path())
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
Benchmark::measure('Bootstrap, autoloader registered');
|
|
||||||
|
|
||||||
Icinga::setApp($this);
|
Icinga::setApp($this);
|
||||||
|
|
||||||
require_once dirname(__FILE__) . '/functions.php';
|
require_once dirname(__FILE__) . '/functions.php';
|
||||||
|
@ -328,18 +311,6 @@ abstract class ApplicationBootstrap
|
||||||
return $this->getDirWithSubDir($this->appDir, $subDir);
|
return $this->getDirWithSubDir($this->appDir, $subDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the vendor library directory
|
|
||||||
*
|
|
||||||
* @param string $subDir Optional sub directory to get
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getVendorDir($subDir = null)
|
|
||||||
{
|
|
||||||
return $this->getDirWithSubDir($this->vendorDir, $subDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the configuration directory
|
* Get the configuration directory
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
namespace Icinga\Application;
|
namespace Icinga\Application;
|
||||||
|
|
||||||
use Zend_Loader_Autoloader;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PSR-4 class loader
|
* PSR-4 class loader
|
||||||
*/
|
*/
|
||||||
|
@ -263,18 +261,6 @@ class ClassLoader
|
||||||
return array_key_exists($namespace, $this->applicationDirectories);
|
return array_key_exists($namespace, $this->applicationDirectories);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Require ZF autoloader
|
|
||||||
*
|
|
||||||
* @return Zend_Loader_Autoloader
|
|
||||||
*/
|
|
||||||
protected function requireZendAutoloader()
|
|
||||||
{
|
|
||||||
require_once 'Zend/Loader/Autoloader.php';
|
|
||||||
$this->gotZend = true;
|
|
||||||
return Zend_Loader_Autoloader::getInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the given class or interface
|
* Load the given class or interface
|
||||||
*
|
*
|
||||||
|
@ -284,20 +270,6 @@ class ClassLoader
|
||||||
*/
|
*/
|
||||||
public function loadClass($class)
|
public function loadClass($class)
|
||||||
{
|
{
|
||||||
// We are aware of the Zend_ prefix and lazyload it's autoloader.
|
|
||||||
// Return as fast as possible if we already did so.
|
|
||||||
if (substr($class, 0, 5) === 'Zend_') {
|
|
||||||
if (! $this->gotZend) {
|
|
||||||
$zendLoader = $this->requireZendAutoloader();
|
|
||||||
if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
|
|
||||||
// PHP7 seems to remember the autoload function stack before auto-loading. Thus
|
|
||||||
// autoload functions registered during autoload never get called
|
|
||||||
return $zendLoader::autoload($class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($file = $this->getSourceFile($class)) {
|
if ($file = $this->getSourceFile($class)) {
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
require $file;
|
require $file;
|
||||||
|
|
|
@ -11,21 +11,6 @@ use Icinga\Util\Environment;
|
||||||
use Icinga\Web\Hook;
|
use Icinga\Web\Hook;
|
||||||
use Icinga\Web\Url;
|
use Icinga\Web\Url;
|
||||||
|
|
||||||
call_user_func(function () {
|
|
||||||
/**
|
|
||||||
* @package dompdf
|
|
||||||
* @link http://dompdf.github.com/
|
|
||||||
* @author Benj Carson <benjcarson@digitaljunkies.ca>
|
|
||||||
* @author Fabien Ménager <fabien.menager@gmail.com>
|
|
||||||
* @author Alexander A. Klimov <alexander.klimov@icinga.com>
|
|
||||||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
|
||||||
*/
|
|
||||||
|
|
||||||
$baseDir = Icinga::app()->getBaseDir('library/vendor/dompdf');
|
|
||||||
|
|
||||||
require_once "$baseDir/vendor/autoload.php";
|
|
||||||
});
|
|
||||||
|
|
||||||
class Pdf
|
class Pdf
|
||||||
{
|
{
|
||||||
protected function assertNoHeadersSent()
|
protected function assertNoHeadersSent()
|
||||||
|
|
|
@ -6,8 +6,6 @@ namespace Icinga\Util;
|
||||||
use Icinga\Less\Visitor;
|
use Icinga\Less\Visitor;
|
||||||
use lessc;
|
use lessc;
|
||||||
|
|
||||||
require_once 'lessphp/lessc.inc.php';
|
|
||||||
|
|
||||||
class LessParser extends lessc
|
class LessParser extends lessc
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
|
|
@ -23,10 +23,6 @@ class HtmlPurifier
|
||||||
*/
|
*/
|
||||||
public function __construct($config = null)
|
public function __construct($config = null)
|
||||||
{
|
{
|
||||||
require_once 'HTMLPurifier/Bootstrap.php';
|
|
||||||
require_once 'HTMLPurifier.php';
|
|
||||||
require_once 'HTMLPurifier.autoload.php';
|
|
||||||
|
|
||||||
$purifierConfig = \HTMLPurifier_Config::createDefault();
|
$purifierConfig = \HTMLPurifier_Config::createDefault();
|
||||||
$purifierConfig->set('Core.EscapeNonASCIICharacters', true);
|
$purifierConfig->set('Core.EscapeNonASCIICharacters', true);
|
||||||
$purifierConfig->set('Attr.AllowedFrameTargets', array('_blank'));
|
$purifierConfig->set('Attr.AllowedFrameTargets', array('_blank'));
|
||||||
|
|
|
@ -10,8 +10,6 @@ class Markdown
|
||||||
{
|
{
|
||||||
public static function line($content, $config = null)
|
public static function line($content, $config = null)
|
||||||
{
|
{
|
||||||
require_once 'Parsedown/Parsedown.php';
|
|
||||||
|
|
||||||
if ($config === null) {
|
if ($config === null) {
|
||||||
$config = function (\HTMLPurifier_Config $config) {
|
$config = function (\HTMLPurifier_Config $config) {
|
||||||
$config->set('HTML.Parent', 'span'); // Only allow inline elements
|
$config->set('HTML.Parent', 'span'); // Only allow inline elements
|
||||||
|
@ -25,8 +23,6 @@ class Markdown
|
||||||
|
|
||||||
public static function text($content, $config = null)
|
public static function text($content, $config = null)
|
||||||
{
|
{
|
||||||
require_once 'Parsedown/Parsedown.php';
|
|
||||||
|
|
||||||
if ($config === null) {
|
if ($config === null) {
|
||||||
$config = function (\HTMLPurifier_Config $config) {
|
$config = function (\HTMLPurifier_Config $config) {
|
||||||
LinkTransformer::attachTo($config);
|
LinkTransformer::attachTo($config);
|
||||||
|
|
|
@ -190,7 +190,6 @@ class JavaScript
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($minified) {
|
if ($minified) {
|
||||||
require_once 'JShrink/Minifier.php';
|
|
||||||
$out .= Minifier::minify($js, ['flaggedComments' => false]);
|
$out .= Minifier::minify($js, ['flaggedComments' => false]);
|
||||||
$baseOut = Minifier::minify($baseJs, ['flaggedComments' => false]);
|
$baseOut = Minifier::minify($baseJs, ['flaggedComments' => false]);
|
||||||
$out = ';' . ltrim($baseOut, ';') . "\n" . $out;
|
$out = ';' . ltrim($baseOut, ';') . "\n" . $out;
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
namespace Icinga\Module\Doc\Renderer;
|
namespace Icinga\Module\Doc\Renderer;
|
||||||
|
|
||||||
require_once 'Parsedown/Parsedown.php';
|
|
||||||
|
|
||||||
use DOMDocument;
|
use DOMDocument;
|
||||||
use DOMXPath;
|
use DOMXPath;
|
||||||
use Parsedown;
|
use Parsedown;
|
||||||
|
|
|
@ -23,10 +23,6 @@ class Zend_View_Helper_EscapeComment extends Zend_View_Helper_Abstract
|
||||||
public function escapeComment($comment)
|
public function escapeComment($comment)
|
||||||
{
|
{
|
||||||
if (self::$purifier === null) {
|
if (self::$purifier === null) {
|
||||||
require_once 'HTMLPurifier/Bootstrap.php';
|
|
||||||
require_once 'HTMLPurifier.php';
|
|
||||||
require_once 'HTMLPurifier.autoload.php';
|
|
||||||
|
|
||||||
$config = HTMLPurifier_Config::createDefault();
|
$config = HTMLPurifier_Config::createDefault();
|
||||||
$config->set('Core.EscapeNonASCIICharacters', true);
|
$config->set('Core.EscapeNonASCIICharacters', true);
|
||||||
$config->set('HTML.Allowed', 'a[href]');
|
$config->set('HTML.Allowed', 'a[href]');
|
||||||
|
|
Loading…
Reference in New Issue