X-Git-Url: https://git.cweiske.de/phancap.git/blobdiff_plain/12fc66e66288365731ad40bf2016633d0569bf81..c2039a447e4bd044eedf31258bace2cc3f03fc29:/src/phancap/Config.php diff --git a/src/phancap/Config.php b/src/phancap/Config.php index b519454..4c0617e 100644 --- a/src/phancap/Config.php +++ b/src/phancap/Config.php @@ -110,6 +110,11 @@ class Config */ public $screenshotMinAge = 'PT1H'; + /** + * Cutycapt adapter options + */ + public $cutycapt = array(); + /** * Initialize default values and loads configuration file paths @@ -153,12 +158,18 @@ class Config */ protected function loadConfigFilePaths() { - $pharFile = \Phar::running(); - if ($pharFile == '') { - $this->cfgFiles[] = __DIR__ . '/../../data/phancap.config.php'; - } else { + $phar = false; + if (class_exists('\\Phar')) { + $pharFile = \Phar::running(); + if ($pharFile != '') { + $phar = true; + } + } + if ($phar) { //remove phar:// from the path $this->cfgFiles[] = substr($pharFile, 7) . '.config.php'; + } else { + $this->cfgFiles[] = __DIR__ . '/../../data/phancap.config.php'; } //TODO: add ~/.config/phancap.php @@ -223,14 +234,14 @@ class Config * @return string Directory of URL without trailing slash, * and without .phar file */ - protected function getCurrentUrlDir() + public function getCurrentUrlDir() { $url = $this->getCurrentUrl(); $url = preg_replace('/\?.*$/', '', $url); if (substr($url, -1) != '/') { $url = substr($url, 0, -strlen(basename($url)) - 1); } - if (\Phar::running()) { + if (class_exists('\\Phar') && \Phar::running()) { //remove .phar file name $url = substr($url, 0, -strlen(basename($url)) - 1); }