xref: /plugin/siteexport/inc/settings.php (revision 07931d7ccf0255e58cb004730cfe8fece18dd04b)
17d101cc1SGerry Weißbach<?php
27d101cc1SGerry Weißbach
37d101cc1SGerry Weißbachif (!defined('DOKU_PLUGIN')) die('meh');
47d101cc1SGerry Weißbachclass settings_plugin_siteexport_settings extends DokuWiki_Plugin
57d101cc1SGerry Weißbach{
6d98cce67SGerry Weißbach    public $fileType = 'html';
7d98cce67SGerry Weißbach    public $exportNamespace = '';
8d98cce67SGerry Weißbach    public $pattern = null;
97d101cc1SGerry Weißbach
10d98cce67SGerry Weißbach    public $isCLI = false;
117d101cc1SGerry Weißbach
12d98cce67SGerry Weißbach    public $depth = '';
137d101cc1SGerry Weißbach
14d98cce67SGerry Weißbach    public $zipFile = '';
15d98cce67SGerry Weißbach//    public  $origEclipseZipFile = 'doc.zip';
16d98cce67SGerry Weißbach//    public  $eclipseZipFile = '';
17d98cce67SGerry Weißbach    public $addParams = false;
18d98cce67SGerry Weißbach    public $origZipFile = '';
19d98cce67SGerry Weißbach    public $downloadZipFile = '';
20d98cce67SGerry Weißbach    public $exportLinkedPages = true;
21d98cce67SGerry Weißbach    public $additionalParameters = array();
22d98cce67SGerry Weißbach    public $isAuthed = false;
237d101cc1SGerry Weißbach
24d98cce67SGerry Weißbach    public $TOCMapWithoutTranslation = false;
257d101cc1SGerry Weißbach
26d98cce67SGerry Weißbach    public $cachetime = 0;
27d98cce67SGerry Weißbach    public $hasValidCacheFile = false;
287d101cc1SGerry Weißbach
29d98cce67SGerry Weißbach    public $useTOCFile = false;
30d98cce67SGerry Weißbach    public $cookie = null;
317d101cc1SGerry Weißbach
32d98cce67SGerry Weißbach    public $ignoreNon200 = true;
33cb168401SGerry Weißbach
34d98cce67SGerry Weißbach    public $defaultLang = 'en';
3513326eabSGerry Weißbach
36a8c17ab5Si-net /// software    public $tmpDir = null;
37a8c17ab5Si-net /// software
38a8c17ab5Si-net /// software    public $namespace = "";
39a8c17ab5Si-net /// software
40a8c17ab5Si-net /// software    public $cookies = null;
41a8c17ab5Si-net /// software
429f407042SGerry Weißbach    public $excludePattern = "";
439f407042SGerry Weißbach
440571ece2SScrutinizer Auto-Fixer    /**
450571ece2SScrutinizer Auto-Fixer     * @param siteexport_functions $functions
460571ece2SScrutinizer Auto-Fixer     */
47a8c17ab5Si-net /// software    public function __construct($functions) {
489801ffe0SGerry Weißbach        global $ID, $conf, $INPUT;
497d101cc1SGerry Weißbach
502270cdc5SGerry Weißbach        $functions->debug->setDebugFile($this->getConf('debugFile'));
519801ffe0SGerry Weißbach        $debugLevel = $INPUT->int('debug', -1, true);
529801ffe0SGerry Weißbach        if ( $debugLevel >= 0 && $debugLevel <= 5) {
539801ffe0SGerry Weißbach            $functions->debug->setDebugLevel($debugLevel);
546792d0cfSGerry Weißbach        } else
556792d0cfSGerry Weißbach        {
566792d0cfSGerry Weißbach            $functions->debug->setDebugLevel($this->getConf('debugLevel'));
576792d0cfSGerry Weißbach        }
58c8022393SGerry Weißbach
59c8022393SGerry Weißbach        $functions->debug->isAJAX = $this->getConf('ignoreAJAXError') ? false : $functions->debug->isAJAX;
602270cdc5SGerry Weißbach
619801ffe0SGerry Weißbach        // Set the pattern
629801ffe0SGerry Weißbach        $this->pattern = $INPUT->str('pattern');
639801ffe0SGerry Weißbach        if ( empty( $this->pattern ) )
647d101cc1SGerry Weißbach        {
657d101cc1SGerry Weißbach            $params = $_REQUEST;
667d101cc1SGerry Weißbach            $this->pattern = $functions->requestParametersToCacheHash($params);
677d101cc1SGerry Weißbach        }
687d101cc1SGerry Weißbach
697d101cc1SGerry Weißbach        $this->isCLI = (!$_SERVER['REMOTE_ADDR'] && 'cli' == php_sapi_name());
707d101cc1SGerry Weißbach
71f8fd18e7SGerry Weißbach        $this->cachetime = $this->getConf('cachetime');
729801ffe0SGerry Weißbach        if ( $INPUT->has( 'disableCache' ) ) {
739801ffe0SGerry Weißbach            $this->cachetime = 0;
74f8fd18e7SGerry Weißbach        }
75f8fd18e7SGerry Weißbach
76d98cce67SGerry Weißbach        // Load variables
777d101cc1SGerry Weißbach        $this->origZipFile = $this->getConf('zipfilename');
787d101cc1SGerry Weißbach
79cb168401SGerry Weißbach        $this->ignoreNon200 = $this->getConf('ignoreNon200');
80cb168401SGerry Weißbach
817d101cc1SGerry Weißbach        // ID
827d101cc1SGerry Weißbach        $this->downloadZipFile = $functions->getSpecialExportFileName($this->origZipFile, $this->pattern);
837d101cc1SGerry Weißbach        //        $this->eclipseZipFile = $functions->getSpecialExportFileName(getNS($this->origZipFile) . ':' . $this->origEclipseZipFile, $this->pattern);
847d101cc1SGerry Weißbach
857d101cc1SGerry Weißbach        $this->zipFile = mediaFN($this->downloadZipFile);
867d101cc1SGerry Weißbach
877d101cc1SGerry Weißbach        $this->tmpDir = mediaFN(getNS($this->origZipFile));
88351a4959Si-net /// software        $this->exportLinkedPages = $INPUT->bool( 'exportLinkedPages', true );
897d101cc1SGerry Weißbach
909801ffe0SGerry Weißbach        $this->namespace = $functions->getNamespaceFromID( $INPUT->str('ns'), $PAGE );
919801ffe0SGerry Weißbach        $this->addParams = $INPUT->bool( 'addParams' );
927d101cc1SGerry Weißbach
939801ffe0SGerry Weißbach        $this->useTOCFile = $INPUT->bool( 'useTocFile' );
947d101cc1SGerry Weißbach
957d101cc1SGerry Weißbach        // set export Namespace - which is a virtual Root
967d101cc1SGerry Weißbach        $pg = noNS($ID);
977d101cc1SGerry Weißbach        if (empty($this->namespace)) { $this->namespace = $functions->getNamespaceFromID(getNS($ID), $pg); }
989801ffe0SGerry Weißbach        $ens = $INPUT->str( 'ens' );
999801ffe0SGerry Weißbach        $this->exportNamespace = !empty($ens) && preg_match("%^" . preg_quote($functions->getNamespaceFromID($ens, $pg), '%') . "%", $this->namespace) ? $functions->getNamespaceFromID($ens, $pg) : $this->namespace;
1007d101cc1SGerry Weißbach
1017d101cc1SGerry Weißbach        $this->TOCMapWithoutTranslation = intval($_REQUEST['TOCMapWithoutTranslation']) == 1 ? true : false;
1027d101cc1SGerry Weißbach
1039801ffe0SGerry Weißbach        $this->defaultLang = $INPUT->str( 'defaultLang', $conf['lang'], true );
10413326eabSGerry Weißbach
1057d101cc1SGerry Weißbach        // Strip params that should be forwarded
1067d101cc1SGerry Weißbach        $this->additionalParameters = $_REQUEST;
1077d101cc1SGerry Weißbach        $functions->removeWikiVariables($this->additionalParameters, true);
108*07931d7cSGerry Weißbach
109*07931d7cSGerry Weißbach        if ( $INPUT->has( 'disableCache' ) ) {
110*07931d7cSGerry Weißbach            $this->additionalParameters['nocache']=!;
111*07931d7cSGerry Weißbach        }
1129f407042SGerry Weißbach
1139f407042SGerry Weißbach        $this->excludePattern = $INPUT->str( 'exclude', $this->getConf('exclude'), true );
1147d101cc1SGerry Weißbach    }
1157d101cc1SGerry Weißbach}
116