xref: /plugin/siteexport/inc/settings.php (revision 351a4959501979a9ed258674f9692c084472dbb6)
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
420571ece2SScrutinizer Auto-Fixer    /**
430571ece2SScrutinizer Auto-Fixer     * @param siteexport_functions $functions
440571ece2SScrutinizer Auto-Fixer     */
45a8c17ab5Si-net /// software    public function __construct($functions) {
469801ffe0SGerry Weißbach        global $ID, $conf, $INPUT;
477d101cc1SGerry Weißbach
482270cdc5SGerry Weißbach        $functions->debug->setDebugFile($this->getConf('debugFile'));
499801ffe0SGerry Weißbach        $debugLevel = $INPUT->int('debug', -1, true);
509801ffe0SGerry Weißbach        if ( $debugLevel >= 0 && $debugLevel <= 5) {
519801ffe0SGerry Weißbach            $functions->debug->setDebugLevel($debugLevel);
526792d0cfSGerry Weißbach        } else
536792d0cfSGerry Weißbach        {
546792d0cfSGerry Weißbach            $functions->debug->setDebugLevel($this->getConf('debugLevel'));
556792d0cfSGerry Weißbach        }
56c8022393SGerry Weißbach
57c8022393SGerry Weißbach        $functions->debug->isAJAX = $this->getConf('ignoreAJAXError') ? false : $functions->debug->isAJAX;
582270cdc5SGerry Weißbach
599801ffe0SGerry Weißbach        // Set the pattern
609801ffe0SGerry Weißbach        $this->pattern = $INPUT->str('pattern');
619801ffe0SGerry Weißbach        if ( empty( $this->pattern ) )
627d101cc1SGerry Weißbach        {
637d101cc1SGerry Weißbach            $params = $_REQUEST;
647d101cc1SGerry Weißbach            $this->pattern = $functions->requestParametersToCacheHash($params);
657d101cc1SGerry Weißbach        }
667d101cc1SGerry Weißbach
677d101cc1SGerry Weißbach        $this->isCLI = (!$_SERVER['REMOTE_ADDR'] && 'cli' == php_sapi_name());
687d101cc1SGerry Weißbach
69f8fd18e7SGerry Weißbach        $this->cachetime = $this->getConf('cachetime');
709801ffe0SGerry Weißbach        if ( $INPUT->has( 'disableCache' ) ) {
719801ffe0SGerry Weißbach            $this->cachetime = 0;
72f8fd18e7SGerry Weißbach        }
73f8fd18e7SGerry Weißbach
74d98cce67SGerry Weißbach        // Load variables
757d101cc1SGerry Weißbach        $this->origZipFile = $this->getConf('zipfilename');
767d101cc1SGerry Weißbach
77cb168401SGerry Weißbach        $this->ignoreNon200 = $this->getConf('ignoreNon200');
78cb168401SGerry Weißbach
797d101cc1SGerry Weißbach        // ID
807d101cc1SGerry Weißbach        $this->downloadZipFile = $functions->getSpecialExportFileName($this->origZipFile, $this->pattern);
817d101cc1SGerry Weißbach        //        $this->eclipseZipFile = $functions->getSpecialExportFileName(getNS($this->origZipFile) . ':' . $this->origEclipseZipFile, $this->pattern);
827d101cc1SGerry Weißbach
837d101cc1SGerry Weißbach        $this->zipFile = mediaFN($this->downloadZipFile);
847d101cc1SGerry Weißbach
857d101cc1SGerry Weißbach        $this->tmpDir = mediaFN(getNS($this->origZipFile));
86*351a4959Si-net /// software        $this->exportLinkedPages = $INPUT->bool( 'exportLinkedPages', true );
877d101cc1SGerry Weißbach
889801ffe0SGerry Weißbach        $this->namespace = $functions->getNamespaceFromID( $INPUT->str('ns'), $PAGE );
899801ffe0SGerry Weißbach        $this->addParams = $INPUT->bool( 'addParams' );
907d101cc1SGerry Weißbach
919801ffe0SGerry Weißbach        $this->useTOCFile = $INPUT->bool( 'useTocFile' );
927d101cc1SGerry Weißbach
937d101cc1SGerry Weißbach        // set export Namespace - which is a virtual Root
947d101cc1SGerry Weißbach        $pg = noNS($ID);
957d101cc1SGerry Weißbach        if (empty($this->namespace)) { $this->namespace = $functions->getNamespaceFromID(getNS($ID), $pg); }
969801ffe0SGerry Weißbach        $ens = $INPUT->str( 'ens' );
979801ffe0SGerry Weißbach        $this->exportNamespace = !empty($ens) && preg_match("%^" . preg_quote($functions->getNamespaceFromID($ens, $pg), '%') . "%", $this->namespace) ? $functions->getNamespaceFromID($ens, $pg) : $this->namespace;
987d101cc1SGerry Weißbach
997d101cc1SGerry Weißbach        $this->TOCMapWithoutTranslation = intval($_REQUEST['TOCMapWithoutTranslation']) == 1 ? true : false;
1007d101cc1SGerry Weißbach
1019801ffe0SGerry Weißbach        $this->defaultLang = $INPUT->str( 'defaultLang', $conf['lang'], true );
10213326eabSGerry Weißbach
1037d101cc1SGerry Weißbach        // Strip params that should be forwarded
1047d101cc1SGerry Weißbach        $this->additionalParameters = $_REQUEST;
1057d101cc1SGerry Weißbach        $functions->removeWikiVariables($this->additionalParameters, true);
1067d101cc1SGerry Weißbach    }
1077d101cc1SGerry Weißbach}
108