├── .github
└── style.yml
├── .gitignore
├── .scrutinizer.yml
├── .travis.yml
├── LICENSE
├── MenuItem.php
├── README.md
├── _test
├── phantomjs
│ ├── plugin_siteexport_javascript_compressed.test.html
│ ├── plugin_siteexport_javascript_test.js
│ ├── plugin_siteexport_javascript_uncompressed.test.html
│ └── runPhantomJs.sh
├── plugin_siteexport_functions_getrelativeurl.test.php
├── plugin_siteexport_javascript.test.php
└── plugin_siteexport_move.test.php
├── action
├── aggregate.php
├── ajax.php
├── move.php
├── pdfstyles.php
├── sendfile.php
└── startup.php
├── admin.php
├── conf
├── default.php
└── metadata.php
├── cron.php
├── exe
└── siteexportmanager.php
├── helper.php
├── images
├── pagetools.png
├── siteexport.sketch
├── siteexport.svg
└── toolbar.png
├── inc
├── debug.php
├── filewriter.php
├── functions.php
├── httpproxy.php
├── javahelp.php
├── mpdf.php
├── patchCSSmgr.php
├── pdfgenerator.php
├── readCSS.patch
├── settings.php
└── toc.php
├── jquery.filedownload.js
├── lang
├── de
│ ├── intro.txt
│ ├── lang.php
│ ├── managerintro.txt
│ └── settings.php
├── en
│ ├── intro.txt
│ ├── lang.php
│ ├── managerintro.txt
│ └── settings.php
├── fr
│ ├── intro.txt
│ ├── lang.php
│ ├── managerintro.txt
│ └── settings.php
├── ja
│ ├── intro.txt
│ ├── lang.php
│ ├── managerintro.txt
│ └── settings.php
├── ko
│ ├── intro.txt
│ ├── lang.php
│ ├── managerintro.txt
│ └── settings.php
├── nl
│ ├── intro.txt
│ ├── lang.php
│ ├── managerintro.txt
│ └── settings.php
├── ru
│ ├── intro.txt
│ ├── lang.php
│ ├── managerintro.txt
│ └── settings.php
└── sv
│ ├── intro.txt
│ ├── lang.php
│ ├── managerintro.txt
│ └── settings.php
├── plugin.info.txt
├── preload.php
├── print.css
├── renderer
└── pdf.php
├── req-travis.txt
├── script.js
├── style.css
└── syntax
├── aggregate.php
├── siteexport.php
├── toc.php
└── toctools.php
/.github/style.yml:
--------------------------------------------------------------------------------
1 | # Number of days of inactivity before an issue becomes stale
2 | daysUntilStale: 120
3 | # Number of days of inactivity before a stale issue is closed
4 | daysUntilClose: 30
5 | # Issues with these labels will never be considered stale
6 | exemptLabels:
7 | - bug
8 | - pinned
9 | - security
10 | # Label to use when marking an issue as stale
11 | staleLabel: wontfix
12 | # Comment to post when marking an issue as stale. Set to `false` to disable
13 | markComment: >
14 | This issue has been automatically marked as stale because it has not had
15 | recent activity. It will be closed after 30 days if no further activity occurs.
16 | Thank you for your contributions.
17 | # Comment to post when closing a stale issue. Set to `false` to disable
18 | closeComment: false
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | _test/phantomjs/*.js
2 | phantom*.js
3 |
4 | # IDE/Editor temp files
5 | .idea/
6 |
--------------------------------------------------------------------------------
/.scrutinizer.yml:
--------------------------------------------------------------------------------
1 | checks:
2 | php: true
3 | javascript: true
4 | filter:
5 | excluded_paths:
6 | - '_test/'
7 | - 'jquery.filedownload.js'
8 | build:
9 | nodes:
10 | analysis:
11 | tests:
12 | override:
13 | -
14 | command: phpcs-run
15 | use_website_config: true
16 | - php-scrutinizer-run
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 | php:
3 | - "8.0"
4 | - "7.4"
5 | - "7.1"
6 | - "7.0"
7 | - "5.6"
8 | env:
9 | - DOKUWIKI=master
10 | - DOKUWIKI=stable
11 | - DOKUWIKI=old-stable
12 | before_install:
13 | - "rm .gitignore"
14 | - "wget https://raw.github.com/splitbrain/dokuwiki-travis/master/travis.sh"
15 | - "wget https://raw.github.com/mark-rushakoff/OpenPhantomScripts/master/phantom-qunit.js -P _test"
16 | install:
17 | - "mv req-travis.txt requirements.txt"
18 | - "sh travis.sh"
19 | script:
20 | - "cd _test && php fetchphpunit.php && php phpunit.phar --stderr --group plugin_siteexport"
21 | # - "cd ../lib/plugins/siteexport/_test && sh phantomjs/runPhantomJs.sh"
22 |
--------------------------------------------------------------------------------
/MenuItem.php:
--------------------------------------------------------------------------------
1 | getLang('siteexport_button');
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Dokuwiki Site Export
2 |
3 | Site Export is an admin plugin that offers a convenient way to download your dokuwiki site as a standalone version. It cycles through your namespaces - a starting point can be given at run-time - and packs the result into a zip file.
4 | The result can be unpacked at any place and viewed without having an internet connection. That makes the plugin perfect for providing static documentation to customers on a CD or DVD.
5 |
6 | [](https://travis-ci.org/i-net-software/dokuwiki-plugin-siteexport)
7 |
8 | ## Requirements
9 |
10 | * [DokuWiki](http://dokuwiki.org) version **Weatherwax**, **Binky** and newer
11 | * You need to log in as administrator to have access to the siteexport plugin
12 | * You have to have the [zip compression library of your php](http://de.php.net/manual/en/book.zip.php) installation activated.
13 | * [dw2pdf](https://www.dokuwiki.org/plugin:dw2pdf) for PDF export options
14 | * a writable /inc/preload.php
file for template switching
15 |
16 | ## Configuration
17 |
18 | This is about the Admin --> Configuration Manager page.
19 |
20 | * **Default Export Depth:**
21 | How far in should the export go. This option will be used when selecting "_specific depth_" as _Export Type_.
22 | * **Try to export non-public pages:**
23 | SiteExport only allows to export public pages. This option will allow to export non-public pages that the currently logged in user has access too as well. **(no yet implemented)**
24 | * **Wiki Path and name for exported ZIP file:**
25 | DokuWiki namespace and file name that will be used to create temporary files.
26 | * **Pattern to exclude resources:**
27 | A regular expression to define paths that should not be exported
28 | * **Maximum script execution time:**
29 | Defines an execution time in seconds for how long the script may run while exporting a site via URL Request or wget/curl request. Due to PHP settings this may be very limited and if you export a very large site or namespace the script will time out. This option will take care of redirecting the request as many times as needed until the export is finished for all pages (the time should be long enough to have at least one page exported).
30 | * **Debug Level:**
31 | Level of Debug during export job. This may be important to find errors for the support.
32 | * **Debug File:**
33 | Where will the debug log be written to? It has to be a writable destination.
34 | * **Cache time for export:**
35 | The siteexport uses its own cache timer to determine when an export should be discarded.
36 |
37 | ## How to export pages
38 |
39 | SiteExport is only available from the Admin menu at the _Additional Plugins_ section. When starting of from the page you want to export, simply go to the export menu, and hit _start_.
40 |
41 | ### Enter your starting Namespace
42 |
43 | Basic export options
44 |
45 | #### Set Namespace
46 | The namespace/page you actually want to export. This will be predefined with the page you currently visited.
47 |
48 | #### Parent Namespace to export
49 | By default this is the same namespace/page that you are going to export. That will result in a flat structure, with the pages at the top level.
50 |
51 | You can define a higher namespace which will result in the structure below being exported with potentially empty folders but having the lib (plugins, template) directories beeing at top level.
52 |
53 | This is usefull for exporting translated namespaces starting with the root of the translation.
54 |
55 | #### Export Type
56 | How many pages should be exported?
57 |
58 | * **This page only:**
59 | Attemps to only export this one page.
60 | * **All sub namespaces:**
61 | Exports everything below the defined namespace
62 | * **Specific depth:**
63 | Exports everything below the defined namespace but only for the defined depth. The depth means how many namespaces it will go down.
64 |
65 | ##### Depth
66 | Number of namespaces to go down into.
67 |
68 | ##### Export Linked Pages
69 | Will export linked pages outside or even deeper of the defined namespace as well.
70 |
71 | ### Select your Options
72 |
73 | #### Export Absolute Paths
74 |
75 | #### Export Body only
76 | Adds the option for renderes to only export the inner body other than exporting the whole page.
77 |
78 | #### Export all parameters (e.g. "do")
79 | Adds all parameters to the links in exported pages - which may make sense when using JavaScript that relies on the links
80 |
81 | #### Render Engine
82 | By default the engine of the DokuWiki. This allows exporting the pages with other renderers, e.g. the siteexport_pdf (derived from dw2pdf) to have pages in PDF file format.
83 |
84 | #### Export Template
85 | **Only available if inc/preload.php
is writable.**
86 | Allows to export the pages with a different template than the default one.
87 |
88 | #### PDF Export
89 | **Only available if the dw2pdf plugin is installed.**
90 | Exports the pages into PDF files, one per page. There are options ([TOC](#table-of-contents-definition)) to export multiple pages into one large PDF.
91 |
92 | #### Numbered Headings
93 | **Only available if the dw2pdf plugin is installed.**
94 | Adds a number to each heading. Usefull for a Table Of Contents inside the PDF.
95 |
96 | ### Select one of the Help Creation Options (optional)
97 | This is totaly optional.
98 |
99 | #### Create Eclipse Help:
100 | Allows the creation of context.xml
and map.xml
files that can be used by Eclipse and its Plugins.
101 |
102 | #### Create Java Help:
103 | Allows the creation of tox.xml
and map.xml
files that can be used by Java and the Java Help implementation.
104 |
105 | #### Use TOC file in Namespace
106 | If you do not want the export to be structured like your DokuWiki is, you can create a file called toc
in the namespace and create a custom structure that will be used instead.
107 |
108 | This is great for having all the chapters of a documentation in their own file and exporting them into PDF as a single file.
109 |
110 | See [Table Of Contents definition](#table-of-contents-definition).
111 |
112 | ### Disable (JS/CSS) Plugins while export
113 | The checkboxes stand for each plugin. By checking it the plugin will be disabled temporarily and therefore not generate any CSS or JS output.
114 |
115 | This is great for a static export that does not need any other or only some plugins. Be adviced that disabling plugins might improve the speed of PDF export.
116 |
117 | ### Custom Options
118 | Here you can add additional variables that will be given to exported page. This can help to create content dynamically when using other plugins or PHP execution.
119 |
120 | Simply hit _add Option_ for a new _name_ / _value_ field, enter the variables name and value. Done.
121 |
122 | ### Start Process
123 | The three links are convenience links. They will be regenerated by every change of any option. They reflect static URLs that can be copied and used e.g. for _ant_ jobs.
124 |
125 | Now: Hit start and your pages will be exported.
126 |
127 | ### Status
128 | Reflects what is currently going on and will display errors that occur during exporting or changing options.
129 |
130 | ### Save as Cron Job
131 | If your configuration directory is writable - which it should after setup, you can save your current setup here.
132 |
133 | You can show what has been saved, view them, delete them and re-run them.
134 |
135 | If you have CLI access (terminal or whatever) and cron access to your server, you can add the cron.php
file to schedule runs of your cron jobs.
136 |
137 |
138 | ## Table Of Contents definition
139 | If you do not want the export to be structured like your DokuWiki is, you can create a file called toc
in the namespace and create a custom structure that will be used instead.
140 |
141 | This is great for having all the chapters of a documentation in their own file and exporting them into PDF as a single file.
142 |
143 | The structure is basically a list of links:
144 |
145 |
146 | <toc>
147 | * [[.:index|Index of the page]]
148 | * [[.:sub:index|Index of the sub namespace]]
149 | * [[.:sub:sub:index|Index of the sub/sub namespace]]
150 | * [[.:sub:page|Page in the sub namespace]]
151 | * [[.:another-page|Another page]]
152 | * [[.:another-sub:index|Index of another sub namespace]]
153 | </toc>
154 |
155 |
156 | The <toc> tag support several options:
157 |
158 | Option | Behavior
159 | ---- | ----
160 | notoc | hide the user defined TOC in the document
161 | description | display the description abstract below of the linked page below the link (usefull together with:`~~META:description abstract=This is my abstract.~~`
162 | merge | this will merge all the defined documents from the TOC into the current document.
163 | mergeheader | this will, as addition to merge, merge all headers starting with the first document (new headers of later documents will be appended at the end, the will not be sorted alphabetically)
164 | mergehint | add hints about the merged content. It can be configured using the meta plugin and the key "mergehint = ". It falls back to the "thema" key or the page title.
165 | pagebreak | inserts a pagebreak after each page defined by the namespace
166 |
167 | You have to define the options like this: <toc notoc merge>
168 |
169 | ## Siteexport
170 | Add a download button for the current page - or any other page
171 |
172 |
173 | {{siteexport [options]}}
174 |
175 |
176 | ## Siteexport Aggregator
177 | There is the additional syntax: aggregator. This allows an in-page selection of an ordered list of pages in the current namespace and sub-namespaces. Once selected and submitted, that page will be generated with the options provided - and merged back up the list (it actually starts merging top down). (What?!)
178 |
179 | The Syntax is (and can be used multiple times per document):
180 |
181 |
182 | {{siteexportAGGREGATOR [options]}}
183 |
184 |
185 | * This will actually create a `` internally, using the options `merge` and `mergeheader`
186 | * Without options it will generate a dropdown-list of all pages in the namespace (except the current) one
187 | * The list will be ordered by a meta key `mergecompare` which has to be added via the META plugin.
188 | * You can create an element with predefined options using the editor button.
189 | * There are two additional options:
190 | * `exportSelectedVersionOnly` - if set it will only export this one selected entry. It will then export this one page with the metadata of the page that has the aggregator.
191 | * `includeSelectedVersion` - will export all documents starting from the newest to the document directly prior to the selected one.
192 | * `mergehint=false` - disable the addition of merge hints
193 |
--------------------------------------------------------------------------------
/_test/phantomjs/plugin_siteexport_javascript_compressed.test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Siteexport JavaScript Compressed Test
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/_test/phantomjs/plugin_siteexport_javascript_test.js:
--------------------------------------------------------------------------------
1 | test("JavaScript did compile successfully", function(assert){
2 |
3 | ok(jQuery, "jQuery does exist");
4 | ok(jQuery.siteexport().throbberCount == 0, "Siteexport does exist");
5 |
6 | });
--------------------------------------------------------------------------------
/_test/phantomjs/plugin_siteexport_javascript_uncompressed.test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Siteexport JavaScript unCompressed Test
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/_test/phantomjs/runPhantomJs.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/sh
2 |
3 | RET=0
4 |
5 | for FILE in $(find . -name "*.test.html")
6 | do
7 | echo "Running '$FILE' via phantomJS"
8 | phantomjs phantom-qunit.js "file://$(pwd)/$FILE"
9 | RET=$(($RET + $?))
10 | done
11 |
12 | exit $RET
--------------------------------------------------------------------------------
/_test/plugin_siteexport_functions_getrelativeurl.test.php:
--------------------------------------------------------------------------------
1 | assertFileExists(DOKU_PLUGIN . 'siteexport/inc/functions.php', 'The functions.php file could not be found.');
15 | $this->assertTrue(class_exists('siteexport_functions'), 'The class for the functions could not be found.');
16 | }
17 |
18 | /**
19 | * @depends test_functionsExist
20 | */
21 | public function test_getRelativeURL() {
22 |
23 | $functions = new siteexport_functions();
24 | // $functions->debug->setDebugLevel(1);
25 | // $functions->debug->setDebugFile('/tmp/siteexport.log');
26 |
27 | $testMatrix = array(
28 |
29 | // Same directory
30 | array(
31 | 'base' => "test/test.html",
32 | 'relative' => "../test/test2.html",
33 | 'expected' => "test2.html",
34 | ),
35 |
36 | // Same directory at base
37 | array(
38 | 'base' => "test.html",
39 | 'relative' => "test2.html",
40 | 'expected' => "test2.html",
41 | ),
42 |
43 | // Different directory
44 | array(
45 | 'base' => "test.html",
46 | 'relative' => "../test/test2.html",
47 | 'expected' => "test/test2.html",
48 | ),
49 |
50 | array(
51 | 'base' => "test/test.html",
52 | 'relative' => "../test2.html",
53 | 'expected' => "../test2.html",
54 | ),
55 |
56 | array(
57 | 'base' => "test/test.html",
58 | 'relative' => "../test2/test2.html",
59 | 'expected' => "../test2/test2.html",
60 | ),
61 | );
62 |
63 | foreach ($testMatrix as $test) {
64 | $result = $functions->getRelativeURL($test['relative'], $test['base']);
65 | $this->assertTrue($test['expected'] == $result, "Result '{$result}' did not match expected result '{$test['expected']}' (base: '{$test['base']}', relative: '{$test['relative']}')");
66 | }
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/_test/plugin_siteexport_javascript.test.php:
--------------------------------------------------------------------------------
1 | setUpJavascript(0));
22 | $this->assertFileExists($uncompressed, "The uncompressed javascript version does not exist.");
23 |
24 | file_put_contents($compressed, $this->setUpJavascript(1));
25 | $this->assertFileExists($compressed, "The compressed javascript version does not exist.");
26 | }
27 |
28 | private function setUpJavascript($compress = 1) {
29 |
30 | global $conf;
31 |
32 | $_SERVER['SERVER_PORT'] = rand();
33 | $conf['compress'] = $compress;
34 |
35 | ob_start();
36 | js_out();
37 | $js = ob_get_contents();
38 | ob_end_clean();
39 |
40 | return $js;
41 | }
42 | }
--------------------------------------------------------------------------------
/_test/plugin_siteexport_move.test.php:
--------------------------------------------------------------------------------
1 | pluginsEnabled[] = 'siteexport';
11 | $this->pluginsEnabled[] = 'move';
12 | parent::setup();
13 | }
14 |
15 | public function test_move() {
16 | /** @var $move helper_plugin_move_op */
17 | $move = plugin_load('helper', 'move_op');
18 | if (!$move) return; // disable the test when move is not installed
19 | saveWikiText('pagetomove', '
20 | * [[index|Index of the page]]
21 | * [[foo:bar|Index of the sub namespace]]
22 | * [[foo:index|Index of the sub/sub namespace]]
23 | * [[.:foo:page|Page in the sub namespace]]
24 | ', 'testcase created');
25 | idx_addPage('pagetomove');
26 | $this->assertTrue($move->movePage('pagetomove', 'test:movedpage'));
27 | $this->assertEquals('
28 | * [[:index|Index of the page]]
29 | * [[foo:bar|Index of the sub namespace]]
30 | * [[foo:index|Index of the sub/sub namespace]]
31 | * [[foo:page|Page in the sub namespace]]
32 | ',rawWiki('test:movedpage'));
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/action/aggregate.php:
--------------------------------------------------------------------------------
1 |
7 | * @author Gerry Weissbach
8 | */
9 |
10 | // must be run within Dokuwiki
11 | if (!defined('DOKU_INC')) define('DOKU_INC', /** @scrutinizer ignore-type */ realpath(dirname(__FILE__) . '/../../') . '/');
12 | if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
13 | require_once(DOKU_PLUGIN . 'action.php');
14 |
15 | class action_plugin_siteexport_aggregate extends DokuWiki_Action_Plugin {
16 |
17 | /**
18 | * Register Plugin in DW
19 | **/
20 | public function register(Doku_Event_Handler $controller) {
21 | $controller->register_hook('TPL_ACT_RENDER', 'BEFORE', $this, 'siteexport_aggregate');
22 | $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'siteexport_aggregate_button', array ());
23 | }
24 |
25 | private function prefixStart($namespace) {
26 | global $conf;
27 | return getNS($namespace) . ':' . $conf['start'];
28 | }
29 |
30 | public function siteexport_aggregate(Doku_Event &$event)
31 | {
32 | global $ID, $INFO, $conf, $INPUT;
33 |
34 | // Aggregate only if
35 | // (1) this page really has an aggregator and we did submit a request to do so
36 | // (2) this page really has an aggregator and we export as PDF
37 | if ( !( (!empty($INFO['meta']['siteexport']) && $INFO['meta']['siteexport']['hasaggregator'] == true) && ( $INPUT->has( 'siteexport_aggregate' ) || $conf['renderer_xhtml'] == 'siteexport_pdf' ) ) ) { return true; }
38 |
39 | $exportBase = $INPUT->str('baseID');
40 | $namespaces = empty($exportBase) ? $INFO['meta']['siteexport']['baseID'] : getNs($exportBase);
41 | $namespaces = explode('|', $namespaces);
42 | $namespaces = array_map('cleanID', $namespaces);
43 | $namespace = $exportBase = $namespaces[0];
44 |
45 | $functions = plugin_load('helper', 'siteexport');
46 | $values = $functions->__getOrderedListOfPagesForID($namespaces, $exportBase);
47 | /*
48 | print '' . print_r($namespaces, 1) . ' ';
49 | print '' . print_r($values, 1) . ' ';
50 | exit(0);
51 | //*/
52 | // If no base given, take the first one from the ordered list.
53 | if ( empty($exportBase) ) {
54 | // Reset to latest element
55 | list($exportBase) = reset( $values );
56 | }
57 |
58 | // If only the one file should be exported, strip it down.
59 | if ( $INPUT->bool('exportSelectedVersionOnly' ) ) {
60 | // Strip down values
61 | $lookupNS = array_map(array($this, 'prefixStart'), $namespaces);
62 | if ( $INPUT->has( 'mergecompare_start' ) && $INPUT->has( 'mergecompare_end' ) ) {
63 | $values = $functions->__getOrderedListOfPagesForStartEnd($lookupNS, $INPUT->int( 'mergecompare_start' ), $INPUT->int( 'mergecompare_end', PHP_INT_MAX ) );
64 | } else {
65 | $values = $functions->__getOrderedListOfPagesForID($lookupNS, $exportBase);
66 | }
67 | }
68 |
69 | $includeSelected = $INPUT->str('includeSelectedVersion', 'true', true ) === 'true';
70 | if( !$includeSelected ) {
71 | // Remove entries that are from the selectes version, but only if more than these entries exists
72 | $baseVersion = intval(p_get_metadata($exportBase, 'mergecompare'));
73 | if ( $baseVersion == 0 ) {
74 | // Not set?!
75 | // print_r($values);
76 | $baseVersion = $values[count($values)-1][2];
77 | }
78 |
79 | $checkValues = array_filter($values, array(new helper_plugin_siteexport_page_remove($baseVersion +1), '_page_remove'));
80 | if ( count($checkValues) > 0 ) {
81 | $values = $checkValues;
82 | }
83 | }
84 |
85 | $originalID = (string) $ID;
86 |
87 | // Generate a TOC that can be exported
88 | $TOC = "bool('mergehint', true, true ) ) {
92 | $TOC .= " mergehint";
93 | }
94 |
95 | $TOC .= ">\n";
96 | $thema = array();
97 | foreach( $values as $value ) {
98 | list($id, $title) = $value;
99 |
100 | $thema[] = p_get_metadata($id, 'thema', METADATA_RENDER_USING_SIMPLE_CACHE);
101 | $TOC .= " * [[{$id}|{$title}]]\n";
102 | }
103 |
104 | $TOC .= " ";
105 |
106 | // Only get first and last element
107 | $thema = array_reverse(array_unique(array(reset($thema), end($thema))));
108 |
109 | $meta = p_read_metadata($originalID);
110 | // Temporary ID for rendering a document.
111 | $ID = (string) cleanID($originalID . '-toc-' . implode('-', array_filter($thema)));
112 |
113 | $meta['current']['thema'] = implode(' - ', array_filter($thema));
114 | p_save_metadata($originalID, $meta);
115 | p_save_metadata($ID, $meta);
116 |
117 | if (empty($TOC)) { return true; }
118 | $event->preventDefault();
119 |
120 | $renderer = $INPUT->str('renderer', $conf['renderer_xhtml'], true);
121 | $INPUT->set('do', 'export_' . $renderer);
122 |
123 | $html = p_render($renderer, p_get_instructions($TOC), $INFO);
124 | if ($INFO['prependTOC']) $html = tpl_toc(true) . $html;
125 |
126 | if (@unlink(metaFN($ID, '.meta')) === false) {
127 | dbglog("Could not delete old meta file", metaFN($ID, '.meta'), 1 );
128 | }
129 |
130 | $ID = (string) $originalID;
131 | echo $html;
132 |
133 | return true;
134 | }
135 |
136 | /**
137 | * Inserts a toolbar button
138 | */
139 | public function siteexport_aggregate_button(& $event, $param) {
140 | $event->data[] = array (
141 | 'type' => 'mediapopup',
142 | 'title' => $this->getLang('toolbarButton'),
143 | 'icon' => '../../plugins/siteexport/images/toolbar.png',
144 | 'url' => 'lib/plugins/siteexport/exe/siteexportmanager.php?ns=',
145 | 'options' => 'width=750,height=500,left=20,top=20,scrollbars=yes,resizable=yes',
146 | 'block' => false,
147 | );
148 | }
149 | }
150 |
--------------------------------------------------------------------------------
/action/move.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 |
9 | // must be run within Dokuwiki
10 | if (!defined('DOKU_INC')) die('Not inside DokuWiki');
11 |
12 | class action_plugin_siteexport_move extends DokuWiki_Action_Plugin {
13 | /**
14 | * Register Plugin in DW
15 | **/
16 | public function register(Doku_Event_Handler $controller) {
17 | $controller->register_hook('PLUGIN_MOVE_HANDLERS_REGISTER', 'BEFORE', $this, 'register_move_handler');
18 | }
19 |
20 | /**
21 | * Register the handler for the move plugin.
22 | */
23 | public function register_move_handler(Doku_Event $event) {
24 | $event->data['handlers']['siteexport_toc'] = array($this, 'move_handler');
25 | }
26 |
27 | /**
28 | * Handle rewrites for the move plugin. Currently only the link/toc syntax is handled.
29 | */
30 | public function move_handler($match, $state, $pos, $pluginname, $handler) {
31 | if ($state === DOKU_LEXER_SPECIAL) {
32 | $handler->internallink($match, $state, $pos);
33 | return '';
34 | } else {
35 | return $match;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/action/pdfstyles.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 |
9 | // must be run within Dokuwiki
10 | if(!defined('DOKU_INC')) die();
11 |
12 | class action_plugin_siteexport_pdfstyles extends DokuWiki_Action_Plugin {
13 |
14 | /**
15 | * Registers a callback function for a given event
16 | *
17 | * @param Doku_Event_Handler $controller DokuWiki's event controller object
18 | * @return void
19 | */
20 | public function register(Doku_Event_Handler $controller) {
21 | global $INPUT;
22 | if ( !strrpos( $_SERVER['SCRIPT_FILENAME'], 'css.php', -7 ) ) { return; }
23 | if ( !$INPUT->has('pdfExport') ) { return true; }
24 |
25 | $controller->register_hook('CSS_STYLES_INCLUDED', 'BEFORE', $this, 'handle_css_styles');
26 | $controller->register_hook('CSS_CACHE_USE', 'BEFORE', $this, 'handle_use_cache');
27 | }
28 |
29 | /**
30 | * This function serves debugging purposes and has to be enabled in the register phase
31 | *
32 | * @param Doku_Event $event event object by reference
33 | * @param mixed $param [the parameters passed as fifth argument to register_hook() when this
34 | * handler was registered]
35 | * @return void
36 | */
37 | public function handle_use_cache(Doku_Event &$event, $param) {
38 | global $INPUT;
39 |
40 | // We need different keys for each style sheet.
41 | $event->data->key .= $INPUT->str('pdfExport', '0');
42 | $event->data->cache = getCacheName( $event->data->key, $event->data->ext );
43 | }
44 |
45 | /**
46 | * Finally, handle the JS script list. The script would be fit to do even more stuff / types
47 | * but handles only admin and default currently.
48 | *
49 | * @param Doku_Event $event event object by reference
50 | * @param mixed $param [the parameters passed as fifth argument to register_hook() when this
51 | * handler was registered]
52 | * @return void
53 | */
54 | public function handle_css_styles(Doku_Event &$event, $param) {
55 | global $INPUT, $conf;
56 |
57 | $conf['cssdatauri'] = false;
58 |
59 | switch( $event->data['mediatype'] ) {
60 |
61 | case 'print':
62 | case 'all':
63 | // Keep the styles
64 | break;
65 | case 'screen':
66 | case 'speech':
67 | case 'DW_DEFAULT':
68 | // throw away
69 | $event->preventDefault();
70 | break;
71 | }
72 | }
73 | }
74 |
75 | // vim:ts=4:sw=4:et:
76 |
--------------------------------------------------------------------------------
/action/sendfile.php:
--------------------------------------------------------------------------------
1 |
7 | * @author Gerry Weissbach
8 | */
9 |
10 | // must be run within Dokuwiki
11 | if (!defined('DOKU_INC')) die();
12 |
13 | if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
14 |
15 | require_once(DOKU_PLUGIN . 'action.php');
16 | require_once(DOKU_PLUGIN . 'siteexport/inc/debug.php');
17 | require_once(DOKU_PLUGIN . 'siteexport/inc/functions.php');
18 |
19 | class action_plugin_siteexport_sendfile extends DokuWiki_Action_Plugin {
20 |
21 | public function register(Doku_Event_Handler $controller) {
22 | // Download of a file
23 |
24 | $controller->register_hook('MEDIA_SENDFILE', 'BEFORE', $this, 'siteexport_sendfile');
25 | $controller->register_hook('FETCH_MEDIA_STATUS', 'BEFORE', $this, 'siteexport_sendfile_not_found');
26 | }
27 |
28 | /*
29 | * Redirect File to real File
30 | */
31 | public function siteexport_sendfile(Doku_Event &$event, $args) {
32 | global $conf;
33 |
34 | if (empty($_REQUEST['siteexport']) /* || $event->data['orig'] != $this->getConf('zipfilename') */) {
35 | return;
36 | }
37 |
38 | $functions = new siteexport_functions();
39 | $functions->debug->message("Starting to send a file from siteexporter", null, 2);
40 | $filewriter = new siteexport_zipfilewriter($functions);
41 | $functions->settings->pattern = $_REQUEST['siteexport'];
42 |
43 | // Try injecting another name ... can't do, because sendFile sets this right after me and right before sending the actual data.
44 | // header('Content-Disposition: attachment; filename="'. basename($functions->settings->zipFile) .'";');
45 |
46 | // Try getting the cached file ...
47 | $event->data['file'] = $functions->getCacheFileNameForPattern();
48 |
49 | $functions->debug->message("fetching cached file from pattern '{$functions->settings->pattern}' with name '{$event->data['file']}'", null, 2);
50 | $functions->debug->message("Event Data Before:", $event->data, 3);
51 |
52 | $functions->checkIfCacheFileExistsForFileWithPattern($event->data['file'], $_REQUEST['siteexport']);
53 |
54 | $filewriter->getOnlyFileInZip($event->data);
55 |
56 | header('Set-Cookie: fileDownload=true; path=' . DOKU_BASE);
57 | header('Cache-Control: max-age=60, must-revalidate');
58 |
59 | $functions->debug->message("Event Data After:", $event->data, 3);
60 | }
61 |
62 | public function siteexport_sendfile_not_found(Doku_Event &$event, $args)
63 | {
64 | if (empty($_REQUEST['siteexport']) ||
65 | /**
66 | $event->data['media'] != $this->getConf('zipfilename')
67 | /*/
68 | $event->data['status'] >= 500
69 | //*/
70 | ) { return true; }
71 | $event->data['status'] = 200;
72 | return true;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/action/startup.php:
--------------------------------------------------------------------------------
1 |
7 | * @author Gerry Weissbach
8 | */
9 |
10 | // must be run within Dokuwiki
11 | if (!defined('DOKU_INC')) define('DOKU_INC', /** @scrutinizer ignore-type */ realpath(dirname(__FILE__) . '/../../') . '/');
12 | if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
13 | require_once(DOKU_PLUGIN . 'action.php');
14 |
15 | class action_plugin_siteexport_startup extends DokuWiki_Action_Plugin {
16 |
17 | /**
18 | * Register Plugin in DW
19 | **/
20 | public function register(Doku_Event_Handler $controller) {
21 | $controller->register_hook('INIT_LANG_LOAD', 'BEFORE', $this, 'siteexport_check_template');
22 | $controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'siteexport_check_template');
23 | $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'siteexport_check_export');
24 | $controller->register_hook('TPL_ACT_UNKNOWN', 'BEFORE', $this, 'siteexport_addpage');
25 | $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'siteexport_metaheaders');
26 | $controller->register_hook('JS_CACHE_USE', 'BEFORE', $this, 'siteexport_check_js_cache');
27 |
28 | $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'siteexport_toolbar_define');
29 |
30 | $controller->register_hook('TEMPLATE_PAGETOOLS_DISPLAY', 'BEFORE', $this, 'siteexport_add_page_export');
31 | $controller->register_hook('MENU_ITEMS_ASSEMBLY', 'AFTER', $this, 'siteexport_add_svg_page_export', array());
32 | }
33 |
34 | private function hasSiteexportHeaders() {
35 | $headers = function_exists('getallheaders') ? getallheaders() : null;
36 | return is_array($headers) && array_key_exists('X-Site-Exporter', $headers);
37 | }
38 |
39 | /**
40 | * Check for Template changes
41 | **/
42 | public function siteexport_check_template()
43 | {
44 | global $conf, $INFO;
45 |
46 | if ( $this->hasSiteexportHeaders() || defined('SITEEXPORT_TPL') ) {
47 | // This is a request via the HTTPProxy of the SiteExporter ... set config to what we need here.
48 | $conf['useslash'] = 1;
49 | }
50 |
51 | if ( !defined('SITEEXPORT_TPL') ) { return; }
52 | $conf['template'] = SITEEXPORT_TPL;
53 | }
54 |
55 | /**
56 | * Check for Template changes in JS
57 | **/
58 | public function siteexport_check_js_cache(Doku_Event &$event)
59 | {
60 | global $conf, $INFO;
61 |
62 | if ( !defined('SITEEXPORT_TPL') ) { return; }
63 | $event->data->key .= SITEEXPORT_TPL;
64 | $event->data->cache = getCacheName($event->data->key,$event->data->ext);
65 | }
66 |
67 | public function siteexport_check_export(Doku_Event &$event)
68 | {
69 | global $conf;
70 | $keys = is_array($event->data) ? array_keys($event->data) : null;
71 | $command = is_array($keys) ? array_shift($keys) : $event->data;
72 | if ( $command == 'export_siteexport_pdf')
73 | {
74 | $event->data = 'show';
75 | $conf['renderer_xhtml'] = 'siteexport_pdf';
76 | }
77 |
78 | if ( $command == 'siteexport_addpage' && $this->__executeCommand() )
79 | {
80 | $event->preventDefault();
81 | }
82 | }
83 |
84 | public function siteexport_addpage(Doku_Event &$event)
85 | {
86 | if ( $event->data != 'siteexport_addpage' || ! $this->__executeCommand() ) { return; }
87 | if ( ! $functions=& plugin_load('helper', 'siteexport') ) {
88 | msg("Can't initialize");
89 | return false;
90 | }
91 |
92 | $functions->__siteexport_addpage();
93 | $event->preventDefault();
94 | }
95 |
96 | public function siteexport_add_page_export(Doku_Event &$event)
97 | {
98 | global $ID;
99 |
100 | if ( $this->__executeCommand() ) {
101 | $event->data['items'][] = '' . tpl_link(wl($ID, array('do' => 'siteexport_addpage')), 'Export Page ',
102 | 'class="action siteexport_addpage" title="Export Page (Siteexport)"', 1) . ' ';
103 |
104 | require_once(DOKU_PLUGIN . 'siteexport/inc/functions.php');
105 | $functions = new siteexport_functions();
106 |
107 | $check = array();
108 | $mapIDs = $functions->getMapID($ID, null, $check);
109 | $mapID = array_shift($mapIDs);
110 | if ( !empty($mapID) ) {
111 | $event->data['items'][] = '' . tpl_link('', 'Copy Map-ID: '.$mapID.' ',
112 | 'class="action siteexport_mapid" title="Show Map-ID"" data-mapid="'.$mapID.'" onclick="copyMapIDToClipBoard.call(this); return false;"', 1) . ' ';
113 | }
114 | }
115 | }
116 |
117 | public function siteexport_add_svg_page_export(Doku_Event $event) {
118 | /* if this is not a page OR ckgedit/ckgedoku is not active -> return */
119 | if($event->data['view'] != 'page') return;
120 | array_splice($event->data['items'], -1, 0, [new \dokuwiki\plugin\siteexport\MenuItem()]);
121 | }
122 |
123 | public function siteexport_metaheaders(Doku_Event &$event)
124 | {
125 | global $conf;
126 | $template = defined('SITEEXPORT_TPL') ? SITEEXPORT_TPL : $conf['template'];
127 |
128 | $head =& $event->data;
129 |
130 | foreach( $head['script'] as &$script ) {
131 | if ( !empty($script['src']) && strstr($script['src'], 'js.php') ) {
132 | $script['src'] .= '&template=' . $template;
133 | }
134 | }
135 |
136 | return true;
137 | }
138 |
139 | public function siteexport_toolbar_define(Doku_Event &$event) {
140 |
141 | if ( $this->hasSiteexportHeaders() ) {
142 | // Remove Toolbar
143 | // This is pr 5.4 syntax.
144 | $event->data = array();
145 | }
146 | }
147 |
148 | private function __executeCommand() {
149 | return ($this->getConf('allowallusers') || auth_isadmin() || auth_ismanager());
150 | }
151 | }
152 |
--------------------------------------------------------------------------------
/admin.php:
--------------------------------------------------------------------------------
1 | setupLocale();
21 | }
22 |
23 | /**
24 | * return sort order for position in admin menu
25 | */
26 | public function getMenuSort() {
27 | return 100;
28 | }
29 |
30 | public function forAdminOnly() {
31 | return false;
32 | }
33 |
34 | /**
35 | * handle user request
36 | */
37 | public function handle() {
38 | }
39 |
40 | /**
41 | * output appropriate html
42 | */
43 | public function html() {
44 |
45 | if (!$functions = & plugin_load('helper', 'siteexport')) {
46 | msg("Can't initialize");
47 | return false;
48 | }
49 |
50 | $functions->__siteexport_addpage();
51 | }
52 | }
53 | //Setup VIM: ex: et ts=4 enc=utf-8 :
54 |
--------------------------------------------------------------------------------
/conf/default.php:
--------------------------------------------------------------------------------
1 | array('5', '4', '3', '2', '1'));
15 | $meta['debugFile'] = array('string');
16 |
17 | $meta['cachetime'] = array('numeric');
18 |
19 | $meta['PDFHeaderPagebreak'] = array('numeric');
20 |
21 | $meta['useOddEven'] = array('onoff');
22 |
23 | $meta['defaultAuthenticationUser'] = array('string');
24 | $meta['defaultAuthenticationPassword'] = array('password');
25 |
26 | $meta['useProxy'] = array('onoff');
27 |
28 |
29 | $meta['offSiteLinkTemplate'] = array('string');
30 | //Setup VIM: ex: et ts=2 enc=utf-8 :
31 |
--------------------------------------------------------------------------------
/cron.php:
--------------------------------------------------------------------------------
1 |
10 | * @author Gerry Weissbach
11 | *
12 | */
13 | class cron_plugin_siteexport {
14 |
15 | private $configFile;
16 | public $configuration;
17 |
18 | /**
19 | * Initial setup for this class
20 | */
21 | function __construct()
22 | {
23 | $this->configFile = DOKU_INC . 'conf/cron.config.php';
24 | $this->readCronSettings();
25 | }
26 |
27 | /**
28 | * Save a new entry, or overwrite an existing entry in the cron config
29 | * @param $parameters parameters which define the cron job
30 | * @param $canOverwrite information if an existing entry should be overwritten
31 | */
32 | public function saveCronDataWithParameters($parameters, $canOverwrite=false)
33 | {
34 | if ( !$canOverwrite && $this->hasCronJobForParameters($parameters) )
35 | {
36 | return "Cannot save. The Cron Job already exists - but no permission given to overwrite";
37 | }
38 |
39 | $this->configuration[$this->cronJobNameForParameters($parameters)] = $parameters;
40 | if ( !$this->writeCronSettings() ) {
41 | return "There was an error while saving the Cron configuration during a save action";
42 | }
43 | }
44 |
45 | public function deleteCronDataWithParameters($parameters)
46 | {
47 | unset($this->configuration[$this->cronJobNameForParameters($parameters)]);
48 | if ( !$this->writeCronSettings() ) {
49 | return "There was an error while saving the Cron configuration during a deletion action";
50 | }
51 | }
52 |
53 | /**
54 | * Reads the Configuration if not loaded yet
55 | */
56 | public function readCronSettings()
57 | {
58 | if ( !$this->configFile )
59 | {
60 | return false;
61 | }
62 |
63 | $settings = array();
64 | if ( file_exists($this->configFile) )
65 | {
66 | include($this->configFile);
67 | }
68 |
69 | $this->configuration = $settings;
70 | return true;
71 | }
72 |
73 | /**
74 | * Writes the Configuration if it is being set
75 | */
76 | public function writeCronSettings()
77 | {
78 | global $conf;
79 |
80 | if ( !$this->configFile )
81 | {
82 | // Nothing has changed.
83 | return true;
84 | }
85 |
86 | // backup current file (remove any existing backup)
87 | if (@file_exists($this->configFile)) {
88 | if (@file_exists($this->configFile.'.bak')) @unlink($this->configFile.'.bak');
89 | if (!io_rename($this->configFile, $this->configFile.'.bak')) return false;
90 | }
91 |
92 | if (!$fh = @fopen($this->configFile, 'wb')) {
93 | io_rename($this->configFile.'.bak', $this->configFile); // problem opening, restore the backup
94 | return false;
95 | }
96 |
97 | $out = $this->cronHeading();
98 | $out .= $this->recurseSettingsToOut($this->configuration);
99 | $out .= $this->cronFooter();
100 |
101 | // Finally write it out.
102 | @fwrite($fh, $out);
103 | fclose($fh);
104 | if($conf['fperm']) chmod($this->configFile, $conf['fperm']);
105 | return true;
106 | }
107 |
108 | /**
109 | * Header text for the cron config file
110 | */
111 | private function cronHeading()
112 | {
113 | $DOKU_URL = DOKU_URL;
114 | return <<configFile) && !$this->writeCronSettings() )
149 | {
150 | return false;
151 | }
152 |
153 | return is_writable($this->configFile);
154 | }
155 |
156 | /**
157 | * Recursively walk through the settings and generate a nice looking string
158 | * @param $settings Array of named settings
159 | * @param $levelPrefix Prefix that will be build during recursion. It will contain a string for the named array depth
160 | */
161 | private function recurseSettingsToOut($settings, $levelPrefix = null)
162 | {
163 | if ( !is_array($settings) )
164 | {
165 | // If this is a value and the levelPrefix is not empty, print it out
166 | if ( $levelPrefix == null || empty($settings) )
167 | {
168 | return '';
169 | }
170 |
171 | return '$settings' . $levelPrefix . ' = "' . trim($settings) . "\";\n";
172 | }
173 |
174 | $out = '';
175 |
176 | // walk recursively through the content and giv it all back
177 | foreach ($settings as $name => $value )
178 | {
179 | $out .= $this->recurseSettingsToOut($value, $levelPrefix . '["' . trim($name) . '"]');
180 | }
181 | return $out;
182 | }
183 |
184 | /**
185 | * Checks if there is already a Cron Job for the given parameters
186 | * @param $parameters
187 | */
188 | public function hasCronJobForParameters($parameters)
189 | {
190 | return array_key_exists($this->cronJobNameForParameters($parameters), $this->configuration);
191 | }
192 |
193 | /**
194 | * returns a name for the parameters
195 | * @param $parameters
196 | */
197 | public function cronJobNameForParameters($parameters)
198 | {
199 | return md5($parameters);
200 | }
201 | }
202 |
203 | // ensure that the request comes from the cli
204 | if ( !array_key_exists('REMOTE_ADDR', $_SERVER) && 'cli' == php_sapi_name()) {
205 | ini_set('memory_limit','512M');
206 |
207 | // overriding this will lead to too many error messages
208 | // error_reporting(E_ALL);
209 |
210 | /**
211 | * Cli Cron is responsible for doing the actual fetching of documentation
212 | * @author gamma
213 | *
214 | */
215 | class plugin_siteexport_cli_cron {
216 |
217 | private $cronPlugin;
218 | private $siteexportAjax;
219 | public $error;
220 |
221 | /**
222 | * Instantiate and load plugin
223 | */
224 | public function __construct()
225 | {
226 | // Needs to go first, to initialize the config which holds some special treatment
227 | $this->cronPlugin = new cron_plugin_siteexport();
228 |
229 | // Load later to have the config up and running.
230 | // the config needs to adjust some variables of the server
231 | @require_once(DOKU_INC . 'inc/init.php');
232 | @require_once(DOKU_INC . 'inc/common.php');
233 | @require_once(DOKU_INC . 'inc/indexer.php');
234 | @require_once(DOKU_INC . 'inc/io.php');
235 | @require_once(DOKU_INC . 'inc/confutils.php');
236 |
237 | if ( !$this->siteexportAjax = plugin_load('action', 'siteexport_ajax' ) ) {
238 | $this->error = "Faild! Ajax Plugin not loaded\n";
239 | }
240 | }
241 |
242 | /**
243 | * let the plugin run!
244 | */
245 | public function run() {
246 | global $ID;
247 | global $INFO;
248 |
249 | $originalREquest = $_REQUEST;
250 |
251 | foreach ( $this->cronPlugin->configuration as $name => $config )
252 | {
253 | // retrieve parameters
254 | list($id,$parameters) = explode('?', $config, 2);
255 |
256 | $function = new siteexport_functions(false);
257 | $_REQUEST = $function->parseStringToRequestArray($parameters, true);
258 | unset($function);
259 |
260 | $ID = $_REQUEST['id'] = cleanID($id); // re-set the ID
261 | // $ID = getID();
262 |
263 | // Lets start over!
264 | $this->siteexportAjax->__init_functions();
265 | $this->siteexportAjax->functions->settings->isCLI = true;
266 | $this->siteexportAjax->functions->settings->isAuthed = true;
267 | $INFO['perm'] = AUTH_DELETE; // Fake authentication
268 |
269 | // Fake security Token if none given
270 | if ( empty( $_REQUEST['sectok'] ) ) {
271 | $_REQUEST['sectok'] = $this->siteexportAjax->functions->getSecurityToken();
272 | }
273 |
274 | $data = $this->siteexportAjax->__get_siteexport_list_and_init_tocs($ID);
275 |
276 | // If there is nothing in there - ignore. This may mean we have a valid cache
277 | if ( count($data) == 0 ) {
278 | continue;
279 | }
280 |
281 | foreach ( $data as $site ) {
282 |
283 | // We want to create a specific file! - have to reset it every time in here
284 | // $_REQUEST['pattern'] = $name;
285 | $status = $this->siteexportAjax->__siteexport_add_site($site['id']);
286 | }
287 |
288 | $this->siteexportAjax->functions->checkIfCacheFileExistsForFileWithPattern($this->siteexportAjax->functions->getCacheFileNameForPattern(), $name);
289 |
290 | // Wat zum geier?
291 | $this->siteexportAjax->cleanCacheFiles();
292 | }
293 | }
294 | }
295 |
296 | $cron = new plugin_siteexport_cli_cron();
297 | if ( empty($cron->error) )
298 | {
299 | $cron->run();
300 | } else
301 | {
302 | echo <<error}
308 | ************************************************************************
309 |
310 |
311 | OUTPUT;
312 | }
313 | }
314 |
315 | ?>
--------------------------------------------------------------------------------
/exe/siteexportmanager.php:
--------------------------------------------------------------------------------
1 |
8 | * @author Gerry Weissbach
9 | * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
10 | */
11 | if(!defined('DOKU_INC')) {
12 | define('DOKU_INC',dirname(__FILE__).'/../../../../');
13 | }
14 | define('DOKU_SITEEXPORT_MANAGER',1);
15 |
16 | require_once(DOKU_INC.'inc/init.php');
17 |
18 | global $INFO, $JSINFO, $INPUT, $ID, $conf;
19 |
20 | $NS = cleanID($INPUT->str('ns'));
21 |
22 | if ( empty($ID) ) {
23 | if ( empty($conf['basedir']) ) {
24 |
25 | $path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, dirname(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)).'/../../../../');
26 | $parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
27 | $absolutes = array();
28 | foreach ($parts as $part) {
29 | if ('.' == $part) continue;
30 | if ('..' == $part) {
31 | array_pop($absolutes);
32 | } else {
33 | $absolutes[] = $part;
34 | }
35 | }
36 | $conf['basedir']='/'.implode(DIRECTORY_SEPARATOR, $absolutes);
37 | }
38 |
39 | $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_REFERER'];
40 | $ID = $NS . ':' . getID();
41 | }
42 |
43 | $INFO = !empty($INFO) ? array_merge($INFO, mediainfo()) : mediainfo();
44 | $JSINFO = array('id' => $ID, 'namespace' => $NS);
45 | $AUTH = $INFO['perm']; // shortcut for historical reasons
46 |
47 | // do not display the manager if user does not have read access
48 | if($AUTH < AUTH_READ) {
49 | http_status(403);
50 | die($lang['accessdenied']);
51 | }
52 |
53 | header('Content-Type: text/html; charset=utf-8');
54 | ?>
55 |
56 |
57 |
58 |
59 |
60 | []
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | __siteexport_addpage();
76 | ?>
77 |
78 |
79 |
80 |
81 |
82 |
7 | * @author Gerry Weissbach
8 | */
9 |
10 | // must be run within Dokuwiki
11 | if(!defined('DOKU_INC')) die();
12 | require_once(DOKU_PLUGIN.'siteexport/preload.php');
13 |
14 | class helper_plugin_siteexport_page_remove {
15 | private $start, $end;
16 |
17 | /**
18 | * @param integer $start
19 | * @param integer $end
20 | */
21 | public function __construct($start, $end=null) {
22 | $this->start = $start;
23 | $this->end = $end;
24 | }
25 |
26 | public function _page_remove($elem) {
27 | return $elem[2] >= $this->start && ( is_null( $this->end ) || $elem[2] <= $this->end);
28 | }
29 | }
30 |
31 | class helper_plugin_siteexport extends DokuWiki_Plugin {
32 |
33 | /*
34 | * return all the templates that this wiki has
35 | */
36 | public function __getTemplates() {
37 |
38 | // populate $this->_choices with a list of directories
39 | $list = array();
40 |
41 | $_dir = DOKU_INC . 'lib/tpl/';
42 | $_pattern = '/^[\w-]+$/';
43 | if ($dh = @opendir($_dir)) {
44 | while (false !== ($entry = readdir($dh))) {
45 | if ($entry == '.' || $entry == '..') {
46 | continue;
47 | }
48 | if ($entry == '.' || $entry == '..') {
49 | continue;
50 | }
51 | if ($_pattern && !preg_match($_pattern,$entry)) {
52 | continue;
53 | }
54 |
55 | $file = (is_link($_dir.$entry)) ? readlink($_dir.$entry) : $entry;
56 | if (is_dir($_dir.$file)) {
57 | $list[] = $entry;
58 | }
59 | }
60 | closedir($dh);
61 | }
62 |
63 |
64 | sort($list);
65 | return $list;
66 | }
67 |
68 | /*
69 | * Return array list of plugins that exist
70 | */
71 | public function __getPluginList() {
72 | global $plugin_controller;
73 |
74 | $allPlugins = array();
75 | foreach ($plugin_controller->getList(null, true) as $plugin) { // All plugins
76 | // check for CSS or JS
77 | if (!file_exists(DOKU_PLUGIN . "$plugin/script.js") && !file_exists(DOKU_PLUGIN . "$plugin/style.css") && !file_exists(DOKU_PLUGIN . "$plugin/print.css")) { continue; }
78 | $allPlugins[] = $plugin;
79 | }
80 |
81 | return array($allPlugins, $plugin_controller->getList());
82 | }
83 |
84 | public function _page_sort($a, $b)
85 | {
86 | if ( $a[2] == $b[2] ) {
87 | return 0;
88 | }
89 |
90 | return $a[2] > $b[2] ? -1 : 1;
91 | }
92 |
93 | public function __getOrderedListOfPagesForID($IDs, $start=null)
94 | {
95 | global $conf;
96 | require_once(dirname(__FILE__)."/inc/functions.php");
97 | $functions = new siteexport_functions(false);
98 |
99 | if ( !is_array($IDs) ) {
100 | $IDs = array($IDs);
101 | }
102 |
103 | $sites = $values = array();
104 | foreach( $IDs as $ID ) {
105 | $page = null;
106 | search($sites, $conf['datadir'], 'search_allpages', array(), $functions->getNamespaceFromID($ID, $page));
107 | foreach( $sites as $site ) {
108 |
109 | if ( $ID == $site['id'] ) {
110 | continue;
111 | }
112 | $sortIdentifier = intval(p_get_metadata($site['id'], 'mergecompare'));
113 | $entry = array(':' . $site['id'], $functions->getSiteTitle($site['id']), $sortIdentifier);
114 |
115 | if ( !in_array($entry[0], array_column($values, 0)) ) {
116 | array_push($values, $entry);
117 | }
118 | }
119 | }
120 |
121 |
122 | if ( $start != null ) {
123 | // filter using the newerThanPage indicator
124 | $sortIdentifier = intval(p_get_metadata($start, 'mergecompare'));
125 | $values = array_filter($values, array(new helper_plugin_siteexport_page_remove($sortIdentifier), '_page_remove'));
126 | }
127 |
128 | usort($values, array($this, '_page_sort'));
129 |
130 | return $values;
131 | }
132 |
133 | public function __getOrderedListOfPagesForStartEnd($ID, $start, $end)
134 | {
135 | $values = $this->__getOrderedListOfPagesForID($ID);
136 |
137 | // filter using the newerThanPage indicator
138 | $values = array_filter($values, array(new helper_plugin_siteexport_page_remove(intval($start), intval($end)), '_page_remove'));
139 |
140 | usort($values, array($this, '_page_sort'));
141 | return $values;
142 | }
143 |
144 | public function __siteexport_addpage() {
145 |
146 | global $ID, $conf;
147 |
148 | $templateSwitching = false;
149 | $pdfExport = false;
150 | $translationAvailable = false;
151 | $usenumberedheading = true;
152 | $trans = array();
153 |
154 | $preload = plugin_load('preload', 'siteexport');
155 | if ($preload && $preload->__create_preload_function()) {
156 | $templateSwitching = true;
157 | }
158 |
159 | $dw2pdf = plugin_load('action', 'dw2pdf');
160 | if ($dw2pdf) {
161 | $pdfExport = true;
162 | }
163 |
164 | $translation = plugin_load('helper', 'autotranslation');
165 | if ($translation) {
166 | $translationAvailable = true;
167 | $trans = $translation->translations;
168 | }
169 |
170 | print $this->locale_xhtml((defined('DOKU_SITEEXPORT_MANAGER') ? 'manager' : '') . 'intro');
171 |
172 | $form = new Doku_Form('siteexport', null, 'post');
173 | $form->startFieldset($this->getLang('startingNamespace'));
174 |
175 | $form->addElement(form_makeTextField('ns', $ID, $this->getLang('ns') . ':', 'ns'));
176 | $form->addElement(form_makeTag('br'));
177 | $form->addElement(form_makeTextField('ens', $ID, $this->getLang('ens') . ':', 'ens'));
178 |
179 | $form->addElement(form_makeTag('br'));
180 | $form->addElement(form_makeListboxField('depthType', array("0.0" => $this->getLang('depth.pageOnly'), "1.0" => $this->getLang('depth.allSubNameSpaces'), "2.0" => $this->getLang('depth.specifiedDepth')), (empty($_REQUEST['depthType']) ? $this->getLang('depth.allSubNameSpaces') : $_REQUEST['depthType']), $this->getLang('depthType') . ':', 'depthType', null, array_merge(array('class' => 'edit'))));
181 |
182 | $form->addElement(form_makeTag('br'));
183 | $form->addElement(form_makeOpenTag("div", array('style' => 'display:' . ($_REQUEST['depthType'] == "2" ? "block" : "none") . ';', 'id' => 'depthContainer')));
184 | $form->addElement(form_makeTextField('depth', $this->getConf('depth'), $this->getLang('depth') . ':', 'depth'));
185 | $form->addElement(form_makeCloseTag("div"));
186 |
187 | $form->endFieldset();
188 | $form->addElement(form_makeTag('br'));
189 |
190 | $form->startFieldset($this->getLang('selectYourOptions'));
191 | $form->addElement(form_makeCheckboxField('absolutePath', 1, $this->getLang('absolutePath') . ':', 'absolutePath'));
192 | $form->addElement(form_makeTag('br'));
193 | // The parameter needs lowercase
194 | $form->addElement(form_makeCheckboxField('exportbody', 1, $this->getLang('exportBody') . ':', 'exportbody'));
195 | $form->addElement(form_makeTag('br'));
196 | $form->addElement(form_makeCheckboxField('exportLinkedPages', 1, $this->getLang('exportLinkedPages') . ':', 'exportLinkedPages', 'sendIfNotSet', array('checked' => 'checked')));
197 | $form->addElement(form_makeTag('br'));
198 | $form->addElement(form_makeCheckboxField('disableCache', 1, $this->getLang('disableCache') . ':', 'disableCache'));
199 | $form->addElement(form_makeTag('br'));
200 | $form->addElement(form_makeCheckboxField('addParams', 1, $this->getLang('addParams') . ':', 'addParams', null, array_merge(array('checked' => ($conf['userewrite'] != 1 ? 'checked' : '')))));
201 | $form->addElement(form_makeTag('br'));
202 | $form->addElement(form_makeTag('br'));
203 | $form->addElement(form_makeListboxField('renderer', array_merge(array('', 'xhtml'), plugin_list('renderer')), '', $this->getLang('renderer') . ':', 'renderer', null, array_merge(array('class' => 'edit'))));
204 |
205 | $form->addElement(form_makeTag('br'));
206 | if ($templateSwitching) {
207 | $form->addElement(form_makeListboxField('template', $this->__getTemplates(), $conf['template'], $this->getLang('template') . ':', 'template', null, array_merge(array('class' => 'edit'))));
208 | $form->addElement(form_makeTag('br'));
209 | } else
210 | {
211 | $form->addElement(form_makeTag('br'));
212 | $form->addElement(form_makeOpenTag('p', array('style' => 'color: #a00;')));
213 | $form->addElement('Can\'t create preload file in \'inc\' directory. Template switching is not available. Plugin disabling is not available.');
214 | $form->addElement(form_makeCloseTag('p'));
215 | }
216 |
217 | $form->addElement(form_makeTag('br'));
218 | $form->addElement(form_makeCheckboxField('pdfExport', 1, $this->getLang('pdfExport') . ':', 'pdfExport', null, $pdfExport ? array() : array_merge(array('disabled' => 'disabled'))));
219 |
220 | // Hint for dw2pdf
221 | $this->addPluginHint( $form, $pdfExport, "the PDF export", "dw2pdf" );
222 |
223 | $form->addElement(form_makeTag('br'));
224 | $form->addElement(form_makeCheckboxField('usenumberedheading', 1, $this->getLang('usenumberedheading') . ':', 'usenumberedheading', null, $usenumberedheading && $pdfExport ? array() : array_merge(array('disabled' => 'disabled'))));
225 | $form->addElement(form_makeTag('br'));
226 |
227 | // Hint for nodetailsxhtml
228 | $this->addPluginHint( $form, $usenumberedheading, "numbered headings", "nodetailsxhtml" );
229 |
230 | $form->endFieldset();
231 | $form->addElement(form_makeTag('br'));
232 |
233 | $form->startFieldset($this->getLang('helpCreationOptions'));
234 | $form->addElement(form_makeCheckboxField('eclipseDocZip', 1, $this->getLang('eclipseDocZip') . ':', 'eclipseDocZip'));
235 | $form->addElement(form_makeTag('br'));
236 | $form->addElement(form_makeCheckboxField('JavaHelpDocZip', 1, $this->getLang('JavaHelpDocZip') . ':', 'JavaHelpDocZip'));
237 | $form->addElement(form_makeTag('br'));
238 | $form->addElement(form_makeCheckboxField('useTocFile', 1, $this->getLang('useTocFile') . ':', 'useTocFile'));
239 | $form->addElement(form_makeTag('br'));
240 | $form->addElement(form_makeCheckboxField('emptyTocElem', 1, $this->getLang('emptyTocElem') . ':', 'emptyTocElem'));
241 | $form->addElement(form_makeTag('br'));
242 | if (!$translationAvailable) {
243 | $form->addElement(form_makeCheckboxField('TOCMapWithoutTranslation', 1, $this->getLang('TOCMapWithoutTranslation') . ':', 'TOCMapWithoutTranslation'));
244 | $form->addElement(form_makeTag('br'));
245 | } else {
246 |
247 | if (!is_array($trans)) {
248 | $trans = array($trans);
249 | }
250 |
251 | $trans = array_unique(array_merge($trans, array($conf['lang'])));
252 | $form->addElement(form_makeListboxField('defaultLang', $trans, $conf['lang'], $this->getLang('defaultLang') . ':', 'defaultLang'));
253 | $form->addElement(form_makeTag('br'));
254 | }
255 | $form->endFieldset();
256 | $form->addElement(form_makeTag('br'));
257 |
258 | if ($templateSwitching)
259 | {
260 | $form->startFieldset($this->getLang('disablePluginsOption'));
261 |
262 | $form->addElement(form_makeCheckboxField("disableall", 1, 'Disable All:', "disableall", 'forceVisible'));
263 | $form->addElement(form_makeTag('br'));
264 | $form->addElement(form_makeTag('br'));
265 |
266 | list($allPlugins, $enabledPlugins) = $this->__getPluginList();
267 | foreach ($allPlugins as $plugin) {
268 | $form->addElement(form_makeCheckboxField("disableplugin[]", $plugin, $plugin . ':', "disableplugin_$plugin", null, (!in_array($plugin, $enabledPlugins) ? array('checked' => 'checked', 'disabled' => 'disabled') : array())));
269 | $form->addElement(form_makeTag('br'));
270 | }
271 |
272 | $form->endFieldset();
273 | $form->addElement(form_makeTag('br'));
274 | }
275 |
276 | $form->startFieldset( $this->getLang('customOptions') );
277 | $form->addElement(form_makeOpenTag('p'));
278 | $form->addElement( $this->getLang('customOptionsDescription') );
279 | $form->addElement(form_makeCloseTag('p'));
280 |
281 | $form->addElement(form_makeOpenTag('ul', array('id' => 'siteexport__customActions')));
282 | $form->addElement(form_makeCloseTag('ul'));
283 | $form->addElement(form_makeTag('br', array('class'=>'clear')));
284 | $form->addElement(form_makeButton('submit', 'addoption', $this->getLang('addCustomOption') , array('style' => 'float:right;') ));
285 |
286 | $form->endFieldset();
287 | $form->addElement(form_makeTag('br'));
288 |
289 | if ( !defined('DOKU_SITEEXPORT_MANAGER') ) {
290 |
291 |
292 | $form->startFieldset( $this->getLang('startProcess') );
293 | $form->addElement(form_makeTextField('copyurl', "", $this->getLang('directDownloadLink') . ':', 'copyurl', null, array('readonly' => 'readonly') ));
294 | $form->addElement(form_makeTag('br'));
295 | $form->addElement(form_makeTextField('wgeturl', "", $this->getLang('wgetURLLink') . ':', 'wgeturl', null, array('readonly' => 'readonly') ));
296 | $form->addElement(form_makeTag('br'));
297 | $form->addElement(form_makeTextField('curlurl', "", $this->getLang('curlURLLink') . ':', 'curlurl', null, array('readonly' => 'readonly') ));
298 | $form->addElement(form_makeTag('br', array('class'=>'clear')));
299 | $form->addElement(form_makeButton('submit', 'siteexport', $this->getLang('start') , array('style' => 'float:right;')));
300 | $form->endFieldset();
301 | $form->addElement(form_makeTag('br'));
302 |
303 | $form->endFieldset();
304 | $form->addElement(form_makeTag('br'));
305 |
306 | $form->startFieldset( $this->getLang('status') );
307 | $form->addElement(form_makeOpenTag('span', array('id' => 'siteexport__out')));
308 |
309 | $form->addElement(form_makeCloseTag('span'));
310 | $form->addElement(form_makeOpenTag('span', array('class' => 'siteexport__throbber')));
311 |
312 | $throbber = DOKU_BASE.'lib/images/loading.gif';
313 | if ( !file_exists( $throbber) ) {
314 | $throbber = DOKU_BASE.'lib/images/throbber.gif';
315 | }
316 |
317 | $form->addElement(form_makeTag('img', array('src' => $throbber, 'id' => 'siteexport__throbber')));
318 | $form->addElement(form_makeCloseTag('span'));
319 | $form->endFieldset();
320 | $form->addElement(form_makeTag('br'));
321 |
322 | } else {
323 | $form->startFieldset( $this->getLang('startProcess') );
324 | $form->addElement(form_makeButton('submit', 'siteexport', $this->getLang('useOptionsInEditor') , array('style' => 'width:100%;')));
325 | }
326 |
327 | $form->endFieldset();
328 | $form->addElement(form_makeTag('br'));
329 |
330 | $form->printForm();
331 | }
332 |
333 | private function addPluginHint( &$form, $condition, $hint, $plugin ) {
334 | if ($condition) { return; }
335 |
336 | $form->addElement(form_makeOpenTag('p', array('style' => 'color: #a00;')));
337 | $form->addElement('In order to use ' . $hint . ', please ');
338 | $form->addElement(form_makeOpenTag('a', array('href' => 'http://www.dokuwiki.org/plugin:' . $plugin, 'alt' => 'install plugin', 'target' => '_blank')));
339 | $form->addElement('install the ' . $plugin . ' plugin.');
340 | $form->addElement(form_makeCloseTag('a'));
341 | $form->addElement(form_makeCloseTag('p'));
342 | }
343 |
344 | }
345 |
--------------------------------------------------------------------------------
/images/pagetools.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/i-net-software/dokuwiki-plugin-siteexport/097de436951b7b0e78db4c7496140fe129d333aa/images/pagetools.png
--------------------------------------------------------------------------------
/images/siteexport.sketch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/i-net-software/dokuwiki-plugin-siteexport/097de436951b7b0e78db4c7496140fe129d333aa/images/siteexport.sketch
--------------------------------------------------------------------------------
/images/siteexport.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/images/toolbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/i-net-software/dokuwiki-plugin-siteexport/097de436951b7b0e78db4c7496140fe129d333aa/images/toolbar.png
--------------------------------------------------------------------------------
/inc/debug.php:
--------------------------------------------------------------------------------
1 | logger = Logger::getInstance('siteexport');
22 | }
23 |
24 | /**
25 | * Debug Level
26 | * the level of what should be logged during the proxied session.
27 | * To activate the logging, you have to enter a loglevel below 5 (see below) to log
28 | * to the screen. If you use the debugFile option the logstream will be rerouted
29 | * to this file.
30 | *
31 | * Default: 5 / No logging
32 | *
33 | * Available DEBUG Levels:
34 | * 5 = off - only socket exceptions will be shown to avoid blank pages
35 | * 4 = ERROR - Log errors of the proxy process
36 | * 3 = WARN - Log warnings during the proxy process
37 | * 2 = INFO - Log information about the ongoing connection process
38 | * 1 = DEBUG - detailed log about variable states
39 | * 0 = VERBOSE - Additionally logs the reponse body from the server
40 | *
41 | * @param $level
42 | */
43 | public function setDebugLevel($level = 5)
44 | {
45 | $this->debugLevel = $level;
46 | }
47 |
48 | public function debugLevel()
49 | {
50 | return $this->debugLevel;
51 | }
52 |
53 | /**
54 | * Set a valid and writeable filename to have the debug information written into a file
55 | * Set the debugLevel below 5 to enable the debugging.
56 | *
57 | * e.g. $CC->debugFile = '/temp/ccproxy.txt';
58 | * e.g. $CC->debugFile = 'C:\temp\ccproxy.txt';
59 | */
60 | public function setDebugFile($file = null)
61 | {
62 | if (!$file || empty($file))
63 | {
64 | $file = null;
65 | }
66 |
67 | $this->debugFile = $file;
68 | }
69 |
70 | public function firstRE()
71 | {
72 | return $this->firstRE;
73 | }
74 |
75 | /**
76 | * print debug info to file if exists
77 | */
78 | public function message($info,$var=null,$level=4){
79 |
80 | $ajaxCanLog = $this->isAJAX && $level == 4;
81 | $fh = false;
82 |
83 | if( $this->debugLevel > $level && !$ajaxCanLog ) return; // only log certain Debug Levels
84 |
85 | switch($level) {
86 | case 4: $this->logger->error( $info, $var ); break;
87 | case 3: $this->logger->log( $info, $var ); break;
88 | case 2: $this->logger->log( $info, $var ); break;
89 | case 1: $this->logger->debug( $info, $var ); break;
90 | default: $TYPE = " NONE"; break;
91 | }
92 |
93 | if ( empty($this->debugFile) ) {
94 | $this->runtimeException("DebugFile not properly configured. Make sure, it is set, readable and writable. We suggest to use a file in the DokuWiki's media directory.", true);
95 | $this->debugLevel = 5; // shutdown debug
96 | } else {
97 | $fh = @fopen($this->debugFile, "a+");
98 | if ( !$fh && !$ajaxCanLog ) {
99 | $this->runtimeException("Could not create/open/append logfile: '{$this->debugFile}'", true);
100 | $this->debugLevel = 5; // shutdown debug
101 | return;
102 | }
103 | }
104 |
105 | switch($level) {
106 | case 4: $TYPE = "ERROR"; break;
107 | case 3: $TYPE = " WARN"; break;
108 | case 2: $TYPE = " INFO"; break;
109 | case 1: $TYPE = "DEBUG"; break;
110 | default: $TYPE = " NONE"; break;
111 | }
112 |
113 | $prepend = "[" . (date('Y-m-d H:i:s') ?: "") . " $TYPE] ";
114 | $log = $prepend . str_replace("\n", "\n" . $prepend . "\t", trim($info)) . "\n";
115 |
116 | if ( $fh !== false ) {
117 | fwrite($fh, $log);
118 | }
119 | if ( $ajaxCanLog ) {
120 | if ( !headers_sent() ) {
121 | header("HTTP/1.0 500 Internal Server Error", true, 500);
122 | header("Status: 500 Internal Server Error", true, 500);
123 | }
124 | echo $log;
125 | }
126 |
127 | if ( !empty($var) ) {
128 |
129 | if ( is_array($var) ) {
130 | ob_start();
131 | print_r($var);
132 | $content = ob_get_contents();
133 | ob_end_clean();
134 | } else {
135 | $content = $var;
136 | }
137 |
138 | $log = $prepend . "\t" . str_replace("\n", "\n" . $prepend . "\t", str_replace("\r\n", "\n", trim($content))) . "\n";
139 | if ( $fh ) {
140 | fwrite($fh, $log);
141 | }
142 | if ( $ajaxCanLog ) {
143 | echo $log;
144 | }
145 | }
146 |
147 | if ( $fh ) {
148 | fclose($fh);
149 | }
150 | }
151 |
152 | public function runtimeException($message, $wasDebug=false) {
153 |
154 | if ( empty($message) ) { return; }
155 |
156 | if ( !$this->isAJAX ) {
157 | ob_start();
158 | } else if ( !headers_sent() ) {
159 | header("HTTP/1.0 500 Internal Server Error", true, 500);
160 | header("Status: 500 Internal Server Error", true, 500);
161 | }
162 |
163 | if ( !$this->isAJAX ) {
164 | if ( $this->firstRE ) {
165 | print 'Runtime Error' . "\n";
166 | }
167 |
168 | print ''.$message.' ' . "\n";
169 | if ( $this->firstRE ) {
170 | print 'If this error persists, please contact the server administrator. ' . "\n";
171 | }
172 | } else {
173 | if ( !$wasDebug ) {
174 | $this->message('Runtime Error: ' . $message, null, 4);
175 | } else {
176 | print 'Runtime Error: ' . $message . "\n";
177 | }
178 | }
179 |
180 | $this->firstRE = false;
181 |
182 | if (!$this->isAJAX) {
183 | $this->runtimeErrors .= ob_get_contents();
184 | ob_end_clean();
185 | }
186 |
187 | return;
188 | }
189 | }
190 |
--------------------------------------------------------------------------------
/inc/filewriter.php:
--------------------------------------------------------------------------------
1 | functions = $functions;
17 | if (class_exists('siteexport_pdfgenerator'))
18 | {
19 | $this->pdfGenerator = new siteexport_pdfgenerator($functions);
20 | }
21 | }
22 |
23 | public function canDoPDF()
24 | {
25 | return $this->pdfGenerator !== null;
26 | }
27 |
28 |
29 | /**
30 | * Wrapper for fetching the Context or the TOC for Eclipse Documentation
31 | * This also puts the file into the zip package
32 | **/
33 | public function __moveDataToZip($DATA, $FILENAME = 'toc.xml', $ZIP = null, $JUSTWRITE = false) {
34 |
35 | if (empty($DATA)) { return false; }
36 |
37 | $tmpFile = tempnam($this->functions->settings->tmpDir, 'siteexport__') ?: $this->functions->settings->tmpDir . 'siteexport__';
38 |
39 | if (@file_put_contents($tmpFile, $DATA) === false) {
40 | // There was an error here
41 | }
42 |
43 | // Add to zip
44 | if ($JUSTWRITE) {
45 | $status = $this->__writeFileToZip($tmpFile, $FILENAME, $ZIP);
46 | } else {
47 | $status = $this->__addFileToZip($tmpFile, $FILENAME, $ZIP);
48 | }
49 |
50 | if (@unlink($tmpFile) === false) {
51 | unset($tmpFile);
52 | }
53 |
54 | return $status;
55 | }
56 |
57 | /**
58 | * Adds a file to the zip file
59 | * @param $FILE String file-name of the zip
60 | * @param $NAME String name of the file that is being added
61 | * @param $ZIP String name of the zip file to which we add
62 | */
63 | public function __addFileToZip($FILE, $NAME, $ZIP = null) {
64 |
65 | if ($NAME[0] === "/") {
66 | $this->functions->debug->message("Weird, the NAME for the ZIP started with a '/'. This may result in wrong links!", null, 3);
67 | $NAME = substr($NAME, 1);
68 | }
69 |
70 | // check for mpdf
71 | if ($this->canDoPDF()) {
72 | $this->functions->debug->message("Trying to create PDF from File '$FILE' with name '$NAME' for ZIP '$ZIP'", null, 2);
73 |
74 | $succeeded = $this->pdfGenerator->createPDFFromFile($FILE, $NAME);
75 |
76 | if ($this->functions->debug->debugLevel() <= 1) { // 2011-01-12 Write HTML to ZIP for Debug purpose
77 | $this->__moveDataToZip($succeeded, "_debug/$NAME.html", $ZIP, true);
78 | }
79 |
80 | if ($succeeded === false) {
81 | $this->functions->debug->runtimeException("Create PDF from File '$FILE' with name '$NAME' went wrong and is not being added!");
82 | return false;
83 | }
84 | }
85 |
86 | return $this->__writeFileToZip($FILE, $NAME, $ZIP);
87 | }
88 |
89 | /**
90 | * This really writes a file to a zip-file
91 | * @param $FILE String file-name of the zip
92 | * @param $NAME String name of the file that is being added
93 | * @param $ZIP String name of the zip file to which we add
94 | */
95 | private function __writeFileToZip($FILE, $NAME, $ZIPFILE) {
96 | if (empty($ZIPFILE)) $ZIPFILE = $this->functions->settings->zipFile;
97 |
98 | if (!class_exists('ZipArchive')) {
99 | $this->functions->debug->runtimeException("PHP class 'ZipArchive' does not exist. Please make sure that you have the ziplib extension for PHP installed.");
100 | return false;
101 | }
102 |
103 | $zip = new ZipArchive();
104 | if (!$zip) {
105 | $this->functions->debug->runtimeException("Can't create new instance of 'ZipArchive'. Please make sure that you have the ziplib extension for PHP installed.");
106 | return false;
107 | }
108 |
109 | $code = $zip->open($ZIPFILE, ZipArchive::CREATE);
110 | if ($code === TRUE) {
111 |
112 | $this->functions->debug->message("Adding file '{$NAME}' to ZIP {$ZIPFILE}", null, 2);
113 |
114 | $zip->addFile($FILE, $NAME);
115 | $zip->close();
116 |
117 | // If this has worked out, we may put this version into the cache ... ?
118 |
119 | // ALibi Touching - 2011-09-13 wird nicht gebraucht nach Umstellung
120 |
121 | return true;
122 | }
123 |
124 | $this->functions->debug->runtimeException("Zip Error #{$code} for file {$NAME}");
125 | return false;
126 | }
127 |
128 | /**
129 | * check if a file exists allready
130 | * @param $NAME String name of the file in the zip
131 | */
132 | public function fileExistsInZip($NAME)
133 | {
134 | $zip = new ZipArchive();
135 | $code = $zip->open($this->functions->settings->zipFile, ZipArchive::CREATE);
136 | if ($code === TRUE) {
137 | $exists = !($zip->statName($NAME) === FALSE);
138 | $zip->close();
139 | return $exists;
140 | }
141 |
142 | return false;
143 | }
144 |
145 | /**
146 | * Checks if a valid cache file exists for the given request parameters
147 | * @param $requestData
148 | */
149 | public function hasValidCacheFile($requestData, $depends = array())
150 | {
151 | $pattern = $this->functions->requestParametersToCacheHash($requestData);
152 | return $this->hasValidCacheFileForPattern($pattern, $depends);
153 | }
154 |
155 | private function hasValidCacheFileForPattern($pattern, $depends = array())
156 | {
157 | $this->functions->debug->message("HASH-Pattern for CacheFile: ", $pattern, 2);
158 | $this->functions->settings->hasValidCacheFile = false; // reset the cache settings
159 | $cacheFile = $this->functions->getCacheFileNameForPattern($pattern);
160 |
161 | $mtime = @filemtime($cacheFile); // 0 if not exists
162 |
163 | // Check if the file is expired - if so, just create a new one.
164 | if ($mtime == 0 || $mtime < time()-$this->functions->settings->cachetime)
165 | {
166 | $this->__clearCacheFile( $cacheFile );
167 | $this->functions->debug->message("New CacheFile because the file was over the cachetime: ", $cacheFile, 2);
168 | return false;
169 | }
170 |
171 | // Check for dependencies
172 | if (!empty($depends))
173 | {
174 | $this->functions->debug->message("Checking dependencies: ", $depends, 1);
175 | foreach ($depends as $site) {
176 |
177 | if (!page_exists($site['id']))
178 | {
179 | $this->functions->debug->message("File does not exist: ", $site['id'], 2);
180 | continue;
181 | }
182 |
183 | if ($mtime < @filemtime(wikiFN($site['id']))) {
184 | $this->__clearCacheFile( $cacheFile );
185 | $this->functions->debug->message("New CacheFile, because a page changed: ", $cacheFile, 2);
186 | return false; // cache older than files it depends on?
187 | }
188 | }
189 | }
190 |
191 | $this->functions->debug->message("CacheFile exists: ", $cacheFile, 2);
192 | return $this->functions->settings->hasValidCacheFile = true;
193 | }
194 |
195 | private function __clearCacheFile( $cacheFile ) {
196 | if ( @unlink($cacheFile) === false ||
197 | @unlink($this->functions->settings->zipFile) === false ) {
198 | $this->functions->debug->message("Cannot remove cache Files: ", $cacheFile, 2);
199 | }
200 | }
201 |
202 | public function getOnlyFileInZip(&$data = null) {
203 |
204 | if (is_null($data['file'])) $data['file'] = $this->functions->settings->zipFile;
205 |
206 | $zip = new ZipArchive();
207 | $code = $zip->open($data['file']);
208 | if ($code !== TRUE) {
209 | $this->functions->debug->message("Can't open the zip-file.", $data['file'], 2);
210 | return false;
211 | }
212 |
213 | if ($zip->numFiles != 1) {
214 | $zip->close();
215 | $this->functions->debug->message("More than one ({$zip->numFiles}) file in zip.", $data['file'], 2);
216 | return false;
217 | }
218 |
219 | $stat = $zip->statIndex(0);
220 | $this->functions->debug->message("Stat.", $stat, 3);
221 | if (substr($stat['name'], -3) != 'pdf') {
222 | $zip->close();
223 | $this->functions->debug->message("The file was not a PDF ({$stat['name']}).", $stat['name'], 2);
224 | return false;
225 | }
226 |
227 | $data['mime'] = 'application/pdf';
228 |
229 | // Extract single file.
230 | $folder = dirname($data['file']);
231 |
232 | $data['orig'] = utf8_basename($stat['name']);
233 | $zip->extractTo($folder, $stat['name']);
234 | $zip->close();
235 |
236 | sleep(1);
237 | $data['file'] .= '.' . cleanID($data['orig']); // Wee need the other file for cache reasons.
238 | return (@rename($folder.'/'.$data['orig'], $data['file'])) === true;
239 | }
240 | }
241 |
242 |
--------------------------------------------------------------------------------
/inc/httpproxy.php:
--------------------------------------------------------------------------------
1 | getConf('useProxy')) {
44 | unset($conf['proxy']);
45 | }
46 |
47 | // call parent constructor
48 | $this->debugClass = $functions->debug;
49 | $this->settings = $functions->settings;
50 | parent::__construct();
51 |
52 | $this->timeout = 60; //max. 25 sec
53 | $this->headers['If-Modified-Since'] = gmdate('r', 0);
54 | $this->status = -1;
55 | $this->debug = true;
56 |
57 | if ($this->settings->cookie == null) {
58 | $this->_debug("Has to re-authenticate request.");
59 | if (!$this->authenticate()) {
60 |
61 | $this->_debug("Trying other Authentication (auth.php):"); // Try again.
62 | if (!(auth_setup() && $this->authenticate(true))) {
63 | $this->_debug("Trying other Authentication (config):", $functions->authenticate() && $this->authenticate(true) ? 'authenticated' : 'not authenticated'); // Try again.
64 | } else {
65 | $this->_debug("Ok, using default auth.php"); // Try again.
66 | }
67 | }
68 |
69 | $this->_debug("Using Authentication:", array('user' => $this->user, 'password' => '*****'));
70 |
71 | } else {
72 | $this->cookies = $this->settings->cookie;
73 | }
74 |
75 | $this->headers['X-Real-Ip'] = clientIP(true);
76 | $this->headers['X-Site-Exporter'] = $functions->getSecurityToken();
77 | $this->headers['Accept-Encoding'] = $_SERVER['HTTP_ACCEPT_ENCODING'] ?? '';
78 | $this->headers['Accept-Charset'] = $_SERVER['HTTP_ACCEPT_CHARSET'] ?? '';
79 | $this->agent = $_SERVER['HTTP_USER_AGENT'] . ' DokuWiki/SiteExport';
80 | }
81 |
82 | /**
83 | * Authenticate using currently logged in user
84 | */
85 | private function authenticate($secondAttempt = false) {
86 |
87 | global $auth, $INPUT;
88 |
89 | // Ok, this is evil. We read the login information of the current user and forward it to the HTTPClient
90 | list($this->user, $sticky, $this->pass) = auth_getCookie();
91 |
92 | // Logged in in second attempt is now in Session.
93 | if ($secondAttempt && !isset($this->user) && $INPUT->str('u') && $INPUT->str('p')) {
94 |
95 | // We hacked directly into the login mechanism which provides the login information without encryption via $INPUT
96 | $this->user = $INPUT->str('u');
97 | $this->pass = $INPUT->str('p');
98 | } else {
99 | $secret = auth_cookiesalt(!$sticky, true); //bind non-sticky to session
100 | $this->pass = !empty($this->pass) ? $this->auth_decrypt($this->pass, $secret) : '';
101 | }
102 |
103 | return isset($this->user);
104 | }
105 |
106 | /**
107 | * Auth Decryption has changed from Weatherwax to Binky
108 | */
109 | private function auth_decrypt($pass, $secret) {
110 |
111 | if (function_exists('auth_decrypt')) {
112 | // Binky
113 | return auth_decrypt($pass, $secret);
114 | } else if (function_exists('PMA_blowfish_decrypt')) {
115 | // Weatherwax
116 | return PMA_blowfish_decrypt($pass, $secret);
117 | } else {
118 | $this->debugClass->runtimeException("No decryption method found");
119 | }
120 | }
121 |
122 | /**
123 | * Remeber HTTPClient Cookie after successfull authentication
124 | */
125 | public function sendRequest($url, $data = '', $method = 'GET') {
126 |
127 | $returnCode = parent::sendRequest($url, $data, $method);
128 | if ($this->settings->cookie == null) {
129 | $this->settings->cookie = $this->cookies;
130 | }
131 |
132 | return $returnCode;
133 | }
134 |
135 | /**
136 | * print debug info to file if exists
137 | * @param string $info
138 | * @param mixed $var
139 | */
140 | public function _debug($info, $var = null) {
141 |
142 | if (!$this->debugClass) {
143 | return;
144 | }
145 |
146 | $this->debugClass->message("[HTTPClient] " . $info, $var, 1);
147 | }
148 |
149 | /**
150 | * print debug info to file if exists
151 | * @param string $info
152 | * @param mixed $var
153 | */
154 | protected function debug($info, $var = null) {
155 | $this->_debug( $info, $var );
156 | }
157 | }
158 |
159 | //Setup VIM: ex: et ts=4 enc=utf-8 :
160 |
--------------------------------------------------------------------------------
/inc/javahelp.php:
--------------------------------------------------------------------------------
1 | NS = $NS;
23 | $this->functions = $functions;
24 | $this->filewriter = $filewriter;
25 | $translation = plugin_load('helper', 'autotranslation');
26 | $this->translation = &$translation;
27 | }
28 |
29 | public function createTOCFiles($data)
30 | {
31 | global $conf, $ID;
32 |
33 | // Split Tree for translation
34 | $translationHSFiles = array();
35 | $toc = new siteexport_toc($this->functions, $this->NS);
36 | $toc->debug("### Starting to create TOC Files ###");
37 |
38 | $count = count($data);
39 | for ($i = 0; $i < $count ; $i++)
40 | {
41 | $lang = '';
42 | if ($this->translation)
43 | {
44 | $this->translation->translationsNs = $this->translation->setupTNS($data[$i]['id'], true);
45 | $lang = $this->translation->getLangPart($data[$i]['id']);
46 | $this->functions->debug->message("Setting up translation:", array(
47 | 'id' => $data[$i]['id'],
48 | 'tns' => $this->translation->translationsNs,
49 | 'lang' => $lang
50 | ), 3);
51 | }
52 |
53 | $toc->debug($lang . " -> " . $data[$i]['id'] );
54 | // get all the relative URLs
55 | $translationHSFiles[$lang][] = $data[$i];
56 | }
57 |
58 | // +":" at the end becaus this is already a namespace
59 | $baseNameSpace = str_replace('/', ':', $this->translation && !empty($this->translation->translationsNs) ? $this->translation->translationsNs : $this->NS . ':');
60 | $translationRoot = curNS($baseNameSpace);
61 | $hsPrename = curNS(getNS($baseNameSpace));
62 |
63 | $this->functions->debug->message("HelpSetPre-Name: {$hsPrename}", null, 3);
64 | $this->functions->debug->message("Translation-Root: {$translationRoot}", null, 3);
65 | $this->functions->debug->message("HSFiles:", $translationHSFiles, 1);
66 |
67 | $last_key = end((array_keys($translationHSFiles)));
68 |
69 | foreach ($translationHSFiles as $lang => $data)
70 | {
71 | // Prepare Translations
72 | if (!empty($lang) && !$this->functions->settings->TOCMapWithoutTranslation)
73 | {
74 | $toc->translation = &$this->translation;
75 | $rootNode = cleanID($this->translation->translationsNs . $lang) . ':';
76 | } else {
77 | $toc->translation = null;
78 | $rootNode = '';
79 | }
80 |
81 | $toc->debug("*** Writing for Language rootNode: '".$rootNode."'***");
82 |
83 | $tsRootPath = $hsPrename . '/' . $this->translationRootPath($translationRoot);
84 | $this->functions->debug->message("Generating JavaHelpDocZip for language '$lang'", $tsRootPath, 3);
85 |
86 | // Create toc and map for each lang
87 | list($tocData, $mapData, $startPageID) = $toc->__getJavaHelpTOCXML($data);
88 | $this->filewriter->__moveDataToZip($tocData, $tsRootPath . (empty($lang) ? '' : $lang . '/') . $this->tocName);
89 | $this->filewriter->__moveDataToZip($mapData, $tsRootPath . (empty($lang) ? '' : $lang . '/') . $this->mapName);
90 |
91 | // Create HS File
92 | $HS = $this->getHSXML($startPageID, $this->functions->getSiteTitle($rootNode), $lang, $tsRootPath);
93 | $this->filewriter->__moveDataToZip($HS, $translationRoot . (empty($lang) ? '' : '_' . $lang) . '.hs');
94 |
95 | // Default Lang
96 | if ($lang == $this->functions->settings->defaultLang || $lang == $last_key)
97 | {
98 | $this->functions->debug->message("Writing Default HS File for Language:", $lang, 3);
99 | $this->filewriter->__moveDataToZip($HS, $translationRoot . '.hs');
100 | $last_key = null;
101 | }
102 | }
103 |
104 | $toc->debug("THE END", true);
105 | }
106 |
107 | private function translationRootPath($translationRoot = '')
108 | {
109 | if (!empty($translationRoot))
110 | {
111 | return $translationRoot . '/';
112 | }
113 |
114 | return $translationRoot;
115 | }
116 |
117 | private function getHSXML($rootID, $title, $lang = '', $translationRoot = '')
118 | {
119 | if (empty($lang) && substr($translationRoot, -1) != '/') {
120 | $translationRoot .= '/';
121 | } else if (!empty($lang) && substr($lang, -1) != '/') {
122 | $lang .= '/';
123 | }
124 |
125 | return <<
127 |
128 |
129 | {$title}
130 |
131 | {$rootID}
132 |
133 |
134 |
135 |
136 | TOC
137 | {$this->functions->getLang('toc')}
138 | javax.help.TOCView
139 | {$translationRoot}{$lang}{$this->tocName}
140 |
141 |
142 |
143 | Search
144 | {$this->functions->getLang('search')}
145 | javax.help.SearchView
146 |
147 | {$translationRoot}{$lang}JavaHelpSearch
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 | OUTPUT;
157 | }
158 | }
159 |
--------------------------------------------------------------------------------
/inc/mpdf.php:
--------------------------------------------------------------------------------
1 |
7 | * @author Gerry Weissbach
8 | */
9 |
10 | if (file_exists(DOKU_PLUGIN . 'dw2pdf/mpdf/mpdf.php')) {
11 |
12 | global $conf;
13 | if (!defined('_MPDF_TEMP_PATH')) {
14 | define('_MPDF_TEMP_PATH', $conf['tmpdir'] . '/dwpdf/' . rand(1, 1000) . '/');
15 | }
16 | if (!defined('_MPDF_TTFONTDATAPATH')) {
17 | define('_MPDF_TTFONTDATAPATH', $conf['cachedir'] . '/mpdf_ttf/');
18 | }
19 |
20 | require_once(DOKU_PLUGIN . 'dw2pdf/mpdf/mpdf.php');
21 |
22 | class siteexportPDF extends mpdf {
23 |
24 | private $debugObj = null;
25 |
26 | public function __construct($debug) {
27 | global $INPUT;
28 | global $conf;
29 |
30 | $dw2pdf = plugin_load('action', 'dw2pdf');
31 |
32 | // decide on the paper setup from param or config
33 | $pagesize = $INPUT->str('pagesize', $dw2pdf->getConf('pagesize'), true);
34 | $orientation = $INPUT->str('orientation', $dw2pdf->getConf('orientation'), true);
35 |
36 | io_mkdir_p(_MPDF_TTFONTDATAPATH);
37 | io_mkdir_p(_MPDF_TEMP_PATH);
38 |
39 | $format = $pagesize;
40 | if ($orientation == 'landscape') {
41 | $format .= '-L';
42 | }
43 |
44 | switch ($conf['lang']) {
45 | case 'zh':
46 | case 'zh-tw':
47 | case 'ja':
48 | case 'ko':
49 | $mode = '+aCJK';
50 | break;
51 | default:
52 | $mode = 'UTF-8-s';
53 |
54 | }
55 |
56 | // we're always UTF-8
57 | parent::__construct($mode, $format);
58 | $this->ignore_invalid_utf8 = true;
59 | $this->tabSpaces = 4;
60 | $this->debugObj = $debug;
61 | $this->debug = $debug !== false;
62 | $this->shrink_tables_to_fit = 1; // Does not shrink tables by default, only in emergency
63 | $this->use_kwt = true; // avoids page-breaking in H1-H6 if a table follows directly
64 | $this->useSubstitutions = true;
65 | }
66 |
67 | public function message($msg, $vars = null, $lvl = 1)
68 | {
69 | if ($this->debugObj !== null) {
70 | $this->debugObj->message($msg, $vars, $lvl);
71 | }
72 | }
73 |
74 | public function Error($msg)
75 | {
76 | if ($this->debugObj !== null && method_exists($this->debugObj, 'runtimeException')) {
77 | $this->debugObj->runtimeException($msg);
78 | } else {
79 | parent::Error($msg);
80 | }
81 | }
82 |
83 | public function GetFullPath(&$path,$basepath='') {
84 |
85 | // Full Path might return a doubled path like /~gamma/documentation/lib//~gamma/documentation/lib/tpl/clearreports/./_print-images/background-bottom.jpg
86 |
87 | $path = str_replace("\\","/",$path); //If on Windows
88 | $path = preg_replace('/^\/\//','http://',$path); // mPDF 5.6.27
89 | $regexp = '|^./|'; // Inadvertently corrects "./path/etc" and "//www.domain.com/etc"
90 | $path = preg_replace($regexp,'',$path);
91 |
92 | if ( preg_match("/^.+\/\.\.\//", $path) ) {
93 | // ../ not at the beginning
94 | $newpath = array();
95 | $oldpath = explode('/', $path);
96 |
97 | foreach( $oldpath as $slice ) {
98 | if ( $slice == ".." && count($newpath) > 0 ) {
99 | array_pop($newpath);
100 | continue;
101 | }
102 |
103 | $newpath[] = $slice;
104 | }
105 |
106 | $path = implode('/', $newpath);
107 | }
108 |
109 | parent::GetFullPath($path, $basepath);
110 |
111 | $regex = "/^(". preg_quote(DOKU_BASE, '/') .".+)\\1/";
112 | if ( preg_match($regex, $path, $matches) ) {
113 | $path = preg_replace($regex, "\\1", $path);
114 | }
115 |
116 | }
117 |
118 | /*
119 | Only when the toc is being generated
120 | */
121 | public function MovePages($target_page, $start_page, $end_page = -1) {
122 | parent::MovePages($target_page, $start_page, $end_page);
123 | }
124 |
125 | public function OpenTag($tag, $attr, &$ahtml, &$ihtml) {
126 | switch ($tag) {
127 | case 'BOOKMARK':
128 | case 'TOCENTRY':
129 | if ($attr['CONTENT']) {
130 | // resolve double encoding
131 | $attr['CONTENT'] = htmlspecialchars_decode($attr['CONTENT'], ENT_QUOTES);
132 | }
133 | break;
134 | }
135 | return parent::OpenTag($tag, $attr, $ahtml, $ihtml);
136 | }
137 | }
138 |
139 | if (file_exists(DOKU_PLUGIN . 'dw2pdf/mpdf/classes/cssmgr.php') && !class_exists('cssmgr', false)) {
140 | //*
141 | require_once(DOKU_PLUGIN . 'siteexport/inc/patchCSSmgr.php');
142 | $objPatch = new CSSMgrPatch(DOKU_PLUGIN . 'dw2pdf/mpdf/classes/cssmgr.php');
143 | if ($objPatch->redefineFunction(file_get_contents(DOKU_PLUGIN . 'siteexport/inc/readCSS.patch'))) {
144 | eval($objPatch->getCode());
145 | }
146 | /*/
147 | //*/
148 | }
149 |
150 | }
151 |
--------------------------------------------------------------------------------
/inc/patchCSSmgr.php:
--------------------------------------------------------------------------------
1 | includeCode($include_file);
14 | }
15 | }
16 |
17 | public function setCode($code) {
18 | $this->_code = $code;
19 | }
20 |
21 | public function includeCode($path) {
22 |
23 | $fp = fopen($path, 'r');
24 | if ( !$fp ) { return; }
25 | $contents = fread($fp, filesize($path));
26 | $contents = str_replace('', '', $contents);
28 | fclose($fp);
29 |
30 | $this->setCode($contents);
31 | }
32 |
33 | public function redefineFunction($new_function) {
34 |
35 | preg_match('/function (.+)\(/', $new_function, $aryMatches);
36 | $func_name = trim($aryMatches[1]);
37 |
38 | if (preg_match('/(function ' . $func_name . '[\w\W\n]+?)(function)/s', $this->_code, $aryMatches)) {
39 |
40 | $search_code = $aryMatches[1];
41 |
42 | $new_code = str_replace($search_code, $new_function . "\n\n", $this->_code);
43 | $new_code = str_replace("function cssmgr", "function __construct", $new_code);
44 |
45 | $this->setCode($new_code);
46 |
47 | return true;
48 |
49 | } else {
50 |
51 | return false;
52 |
53 | }
54 | }
55 |
56 | public function getCode() {
57 | return $this->_code;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/inc/pdfgenerator.php:
--------------------------------------------------------------------------------
1 | functions = $functions;
15 | }
16 |
17 | public function createPDFFromFile($filename, &$NAME) {
18 |
19 | global $INPUT;
20 |
21 | if (!preg_match("/" . $this->functions->settings->fileType . "$/", $NAME)) {
22 | $this->functions->debug->message("Filetype " . $this->functions->settings->fileType . " did not match filename '$NAME'", null, 4);
23 | return false;
24 | }
25 |
26 | $mpdf = new siteexportPDF($this->functions->debug);
27 |
28 | if (!$mpdf) {
29 | $this->functions->debug->message("Could not instantiate MPDF", null, 4);
30 | return false;
31 | }
32 |
33 | $html = @file_get_contents($filename);
34 |
35 | if (!strstr($html, "functions->debug->message("Filecontent had no HTML starting tag", null, 4);
37 | return false;
38 | }
39 |
40 | // Save HTML too
41 | $this->functions->debug->message("Arranging HTML", null, 2);
42 | $this->arrangeHtml($html, 'bl,acronym');
43 | $this->functions->debug->message("Done arranging HTML:", $html, 1);
44 |
45 | $mpdf->debug = false;
46 | $mpdf->list_indent_first_level = 1; // Indents the first level of lists.
47 |
48 | $mpdf->usepre = false;
49 | $mpdf->margin_bottom_collapse = true;
50 | $mpdf->SetDisplayMode('fullpage');
51 | $mpdf->restoreBlockPageBreaks = true;
52 |
53 | $mpdf->dpi = $INPUT->int('dpi', 96, true);
54 | $mpdf->img_dpi = $INPUT->int('dpi', 96, true);
55 |
56 | $mpdf->setBasePath(empty($this->functions->settings->depth) ? './' : $this->functions->settings->depth);
57 |
58 | $mpdf->ignore_invalid_utf8 = true;
59 | $mpdf->mirrorMargins = $this->functions->getConf('useOddEven'); // don't mirror margins
60 | $mpdf->setAutoTopMargin = 'pad';
61 | $mpdf->setAutoBottomMargin = 'pad';
62 |
63 | $mpdf->WriteHTML($html);
64 | $mpdf->Output($filename, "F");
65 |
66 | return $html;
67 | }
68 |
69 | private function arrangeHtml(&$html, $norendertags = '')
70 | {
71 | global $conf;
72 |
73 | // add bookmark links
74 | $html = preg_replace_callback("/(.*?)<\/h\\1>/s", array($this, '__pdfHeaderCallback'), $html);
75 | $html = preg_replace_callback("/<\/div>\s*?/s", array($this, '__pdfHeaderCallbackPagebreak'), $html);
76 | $html = preg_replace("/( )/", "", $html);
77 |
78 | // Remove p arround img and table
79 | $html = preg_replace("/]*?>(\s*? ]*?\/?>\s*?)<\/p>/s", "$1", $html);
80 | $html = preg_replace("/
]*?>(\s*?
\s*?)<\/p>/s", "$1", $html);
81 | $html = preg_replace_callback("/(.*?)<\/pre>/s", array($this, '__pdfPreCodeCallback'), $html);
82 | $html = preg_replace_callback("/(.*?)<\/a>/s", array($this, '__pdfMailtoCallback'), $html);
83 | /**/
84 |
85 | $standardReplacer = array(
86 | // insert a pagebreak for support of WRAP and PAGEBREAK plugins
87 | ' ' => ' ',
88 | '
' => ' ',
89 | '' => '',
90 | '' => '',
91 | '' => ''
92 | );
93 | $html = str_replace(array_keys($standardReplacer), array_values($standardReplacer), $html);
94 |
95 | // thanks to Jared Ong
96 | // Customized to strip all span tags so that the wiki SQL would display properly
97 | $norender = explode(',', $norendertags);
98 | $html = $this->strip_only($html, $norender); //array('span','acronym'));
99 | $html = $this->strip_htmlencodedchars($html);
100 | // Customized to strip all span tags so that the wiki SQL would display properly
101 | }
102 |
103 | private function __pdfMailtoCallback($DATA) {
104 | if ($DATA[1] == $DATA[2]) {
105 | $DATA[2] = $this->deobfuscate($DATA[2]);
106 | }
107 | $DATA[1] = $this->deobfuscate($DATA[1]);
108 | return "{$DATA[2]} ";
109 | }
110 |
111 | private function __pdfPreCodeCallback($DATA) {
112 |
113 | $code = nl2br($DATA[2]);
114 | $code = preg_replace_callback("/(^| )(\s+)(\S)/s", array($this, '__pdfPreWhitespacesCallback'), $code);
115 |
116 | return "\n\n" . $code . "\n \n";
117 | }
118 |
119 | private function __pdfPreWhitespacesCallback($DATA) {
120 | return $DATA[1] . "\n" . str_repeat(" ", strlen($DATA[2])-($DATA[2][0] == "\n" ? 1 : 0)) . $DATA[3];
121 | }
122 |
123 | private function __pdfHeaderCallback($DATA) {
124 | $contentText = htmlspecialchars_decode(preg_replace("/<\/?.*?>/s", '', $DATA[3]), ENT_NOQUOTES); // 2014-07-23 Do not encode again. or ä -> ä
125 | return ' ' . $DATA[3] . ' ';
126 | }
127 |
128 | private function __pdfHeaderCallbackPagebreak($DATA) {
129 | return '' . "\r\n" . ' ' . "\r\n\r\n" . '';
130 | }
131 | // thanks to Jared Ong
132 | // Custom function for help in stripping span tags
133 | private function strip_only($str, $tags) {
134 | if (!is_array($tags)) {
135 | $tags = (strpos($str, '>') !== false ? explode('>', str_replace('<', '', $tags)) : array($tags));
136 | if (end($tags) == '') array_pop($tags);
137 | }
138 |
139 | foreach ($tags as $tag) $str = preg_replace('#?' . $tag . '[^>]*>#is', '', $str);
140 | return $str;
141 | }
142 | // Custom function for help in stripping span tags
143 |
144 | // Custom function for help in replacing ' " > < &
145 | private function strip_htmlencodedchars($str) {
146 | $str = str_replace(''', '\'', $str);
147 | return $str;
148 | }
149 | // Custom function for help in replacing ' " > < &
150 |
151 | /**
152 | * return an de-obfuscated email address in line with $conf['mailguard'] setting
153 | */
154 | private function deobfuscate($email) {
155 | global $conf;
156 |
157 | switch ($conf['mailguard']) {
158 | case 'visible' :
159 | return /** @scrutinizer ignore-call */ strtr($email, array(' [at] ' => '@', ' [dot] ' => '.', ' [dash] ' => '-'));
160 |
161 | case 'hex' :
162 | $encode = '';
163 | $len = strlen($email);
164 | for ($x = 0; $x < $len; $x += 6) {
165 | $encode .= chr((int)hexdec($email[$x+3] . $email[$x+4]));
166 | }
167 | return $encode;
168 |
169 | case 'none' :
170 | default :
171 | return $email;
172 | }
173 | }
174 | }
175 | }
176 |
--------------------------------------------------------------------------------
/inc/settings.php:
--------------------------------------------------------------------------------
1 | debug->setDebugFile($this->getConf('debugFile'));
51 | $debugLevel = $INPUT->int('debug', -1, true);
52 | if ( $debugLevel >= 0 && $debugLevel <= 5) {
53 | $functions->debug->setDebugLevel($debugLevel);
54 | } else
55 | {
56 | $functions->debug->setDebugLevel($this->getConf('debugLevel'));
57 | }
58 |
59 | $functions->debug->isAJAX = $this->getConf('ignoreAJAXError') ? false : $functions->debug->isAJAX;
60 |
61 | // Set the pattern
62 | $this->pattern = $INPUT->str('pattern');
63 | if ( empty( $this->pattern ) )
64 | {
65 | $params = $_REQUEST;
66 | $this->pattern = $functions->requestParametersToCacheHash($params);
67 | }
68 |
69 | $this->isCLI = (!$_SERVER['REMOTE_ADDR'] && 'cli' == php_sapi_name());
70 |
71 | $this->cachetime = $this->getConf('cachetime');
72 | if ( $INPUT->has( 'disableCache' ) ) {
73 | $this->cachetime = 0;
74 | }
75 |
76 | // Load variables
77 | $this->origZipFile = $this->getConf('zipfilename');
78 |
79 | $this->ignoreNon200 = $this->getConf('ignoreNon200');
80 |
81 | // ID
82 | $this->downloadZipFile = $functions->getSpecialExportFileName($this->origZipFile, $this->pattern);
83 | // $this->eclipseZipFile = $functions->getSpecialExportFileName(getNS($this->origZipFile) . ':' . $this->origEclipseZipFile, $this->pattern);
84 |
85 | $this->zipFile = mediaFN($this->downloadZipFile);
86 |
87 | $this->tmpDir = mediaFN(getNS($this->origZipFile));
88 | $this->exportLinkedPages = $INPUT->bool( 'exportLinkedPages', true );
89 |
90 | $this->namespace = $functions->getNamespaceFromID( $INPUT->str('ns'), $PAGE );
91 | $this->addParams = $INPUT->bool( 'addParams' );
92 |
93 | $this->useTOCFile = $INPUT->bool( 'useTocFile' );
94 |
95 | // set export Namespace - which is a virtual Root
96 | $pg = noNS($ID);
97 | if (empty($this->namespace)) { $this->namespace = $functions->getNamespaceFromID(getNS($ID), $pg); }
98 | $ens = $INPUT->str( 'ens' );
99 | $this->exportNamespace = !empty($ens) && preg_match("%^" . preg_quote($functions->getNamespaceFromID($ens, $pg), '%') . "%", $this->namespace) ? $functions->getNamespaceFromID($ens, $pg) : $this->namespace;
100 |
101 | $this->TOCMapWithoutTranslation = intval($_REQUEST['TOCMapWithoutTranslation'] ?? 0) == 1 ? true : false;
102 |
103 | $this->defaultLang = $INPUT->str( 'defaultLang', $conf['lang'], true );
104 |
105 | // Strip params that should be forwarded
106 | $this->additionalParameters = $_REQUEST;
107 | $functions->removeWikiVariables($this->additionalParameters, true);
108 |
109 | if ( $INPUT->has( 'disableCache' ) ) {
110 | $this->additionalParameters['nocache']=1;
111 | }
112 |
113 | $this->excludePattern = $INPUT->str( 'exclude', $this->getConf('exclude'), true );
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/lang/de/intro.txt:
--------------------------------------------------------------------------------
1 | ====== Site Export Manager ======
2 |
3 | Hier können Sie vollständige Seiten Ihres Wikis in eine Stand-Alone version exportieren.
--------------------------------------------------------------------------------
/lang/de/lang.php:
--------------------------------------------------------------------------------
1 |
7 | * @author Thor Weinreich
8 | * @author Gerry Weißbach
9 | * @author Padhie
10 | */
11 | $lang['encoding'] = 'utf-8';
12 | $lang['direction'] = 'ltr';
13 | $lang['menu'] = 'Site Export';
14 | $lang['absolutePath'] = 'Absolute Pfade exportieren';
15 | $lang['pdfExport'] = 'Als PDF exportieren';
16 | $lang['usenumberedheading'] = 'Nummerierte Überschriften';
17 | $lang['template'] = 'Export Vorlage';
18 | $lang['exportBody'] = 'Nur den Seiteninhalt exportieren (export_body)';
19 | $lang['addParams'] = 'Parameter in Links exportieren (z.B. "do")';
20 | $lang['disableCache'] = 'Cache für aktuelle Anfrage abschalten';
21 | $lang['startingNamespace'] = 'Namensraum Einstellungen';
22 | $lang['selectYourOptions'] = 'Wählen Sie Ihre Optionen aus';
23 | $lang['helpCreationOptions'] = 'Wählen Sie zusätzlich eine Hilfe-Erstellungs Option';
24 | $lang['eclipseDocZip'] = 'Eclipse Hilfe erstellen';
25 | $lang['JavaHelpDocZip'] = 'Java Hilfe erstellen';
26 | $lang['TOCMapWithoutTranslation'] = 'Übersetzungs-Wurzel entfernen';
27 | $lang['useTocFile'] = 'Die TOC Datei des Startnamensraumes verwenden';
28 | $lang['emptyTocElem'] = 'Leere Namensräume im TOC anzeigen';
29 | $lang['startProcess'] = 'Starten des Exports';
30 | $lang['directDownloadLink'] = 'Link für den direkten Download';
31 | $lang['wgetURLLink'] = 'wget Download URL';
32 | $lang['curlURLLink'] = 'curl Download URL';
33 | $lang['start'] = 'Starten';
34 | $lang['status'] = 'Status';
35 | $lang['ns'] = 'Start Namensraum für den Export (Elternelement)';
36 | $lang['ens'] = 'Übergeordneter Namensraum, der exportiert werden soll';
37 | $lang['defaultLang'] = 'Standartsprache für Mehrspracheige Namespaces';
38 | $lang['disablePluginsOption'] = '(JS/CSS) Plugins während des Exports deaktivieren';
39 | $lang['depthType'] = 'Export-Typ';
40 | $lang['depth.pageOnly'] = 'nur diese Seite';
41 | $lang['depth.allSubNameSpaces'] = 'alle untergeordneten Namensräume';
42 | $lang['depth.specifiedDepth'] = 'festgelegte Tiefe';
43 | $lang['depth'] = 'Tiefe';
44 | $lang['renderer'] = 'Renderer';
45 | $lang['exportLinkedPages'] = 'Verlinkte Seiten exportieren';
46 | $lang['customOptions'] = 'Benutzerdefinierte Optionen';
47 | $lang['customOptionsDescription'] = 'Du kannst weitere, benutzerdefinierte Optionen hinzufügen, die während des Exports beachtet werden';
48 | $lang['addCustomOption'] = 'Option hinzufügen';
49 | $lang['search'] = 'Suche';
50 | $lang['toc'] = 'Übersicht';
51 | $lang['AggregateSubmitLabel'] = 'Download';
52 | $lang['AggragateExportPages'] = 'Anfangsseite für das zusammenfügen';
53 | $lang['SiteSubmitLabel'] = 'Als PDF speichern';
54 | $lang['toolbarButton'] = 'Site Exporter einfügen';
55 | $lang['useOptionsInEditor'] = 'Ein {{siteAggregator}} Element mit diesen Einstellungen erzeugen';
56 | $lang['NoEntriesFoundHint'] = 'Es wurden keine Seiten zum Zusammenfassen gefunden';
57 | $lang['siteexport_button'] = 'Seite als HTML/PDF exportieren';
58 | $lang['js']['loadingpage'] = 'Dokument wird erstellt';
59 | $lang['js']['startdownload'] = 'Download beginnt';
60 | $lang['js']['downloadfinished'] = 'Download beendet';
61 | $lang['js']['finishedbutdownloadfailed'] = 'Laden beendet, aber der Download war fehlerhaft.';
62 |
--------------------------------------------------------------------------------
/lang/de/managerintro.txt:
--------------------------------------------------------------------------------
1 | ====== Site Export Manager ======
2 |
3 | Konfiguration eines a ''%%{{siteAGGREGATOR}}%%'' elements mit den folgenden Optionen.
4 |
--------------------------------------------------------------------------------
/lang/de/settings.php:
--------------------------------------------------------------------------------
1 |
7 | * @author Gerry Weißbach
8 | * @author Padhie
9 | */
10 | $lang['depth'] = 'Standard Export Tiefe';
11 | $lang['skipacl'] = 'Nichtöffentliche Seiten exportieren';
12 | $lang['zipfilename'] = 'Wiki-Pfad und Name für exportierte ZIP-Datei';
13 | $lang['exclude'] = 'Regulärer Ausdruck um Ressourcen zu überspringen';
14 | $lang['max_execution_time'] = 'Maximale Ausführungszeit für das Skript';
15 | $lang['cachetime'] = 'Cachezeit für das exportierte Ergebnis';
16 | $lang['allowallusers'] = 'Allen Benutzern erlauben, Seiten zu exportieren';
17 | $lang['ignoreNon200'] = 'Nicht-200er Status ignorieren';
18 | $lang['ignoreAJAXError'] = 'Fehler während eines Exports ignorieren';
19 | $lang['debugFile'] = 'Debug Datei';
20 | $lang['debugLevel'] = 'Debug Level';
21 | $lang['debugLevel_o_5'] = 'Nicht debuggen';
22 | $lang['debugLevel_o_4'] = 'Fehler';
23 | $lang['debugLevel_o_3'] = 'Warnen';
24 | $lang['debugLevel_o_2'] = 'Info';
25 | $lang['debugLevel_o_1'] = 'Debug';
26 | $lang['useOddEven'] = 'Erlaube unterschiedliche Einstellungen im Header und Footer auf jeder Seite. TOC wird aud jeder Seite gestartet.';
27 | $lang['defaultAuthenticationUser'] = 'Benutzername für nicht öffentliche Seiten';
28 | $lang['defaultAuthenticationPassword'] = 'Password für nicht öffentliche Seiten';
29 |
--------------------------------------------------------------------------------
/lang/en/intro.txt:
--------------------------------------------------------------------------------
1 | ====== Site Export Manager ======
2 |
3 | This page allows you to export your whole site into any format that you have a renderer for.
--------------------------------------------------------------------------------
/lang/en/lang.php:
--------------------------------------------------------------------------------
1 |
7 | * @author Alain Becker
8 | * @author NICOLAS ORTH
9 | * @author Florian TASSIN
10 | * @author tuxun
11 | * @author ubibene
12 | * @author Olivier Humbert
13 | */
14 | $lang['encoding'] = 'utf-8';
15 | $lang['direction'] = 'ltr';
16 | $lang['menu'] = 'Export du site';
17 | $lang['absolutePath'] = 'Chemins d\'export (en absolu)';
18 | $lang['pdfExport'] = 'Export pdf';
19 | $lang['usenumberedheading'] = 'Titre avec numérotation';
20 | $lang['template'] = 'Exporter les modèles';
21 | $lang['exportBody'] = 'Export du corps uniquement';
22 | $lang['addParams'] = 'Export de tous les paramètres (exp.: "do")';
23 | $lang['disableCache'] = 'Désactive le cache pour cette requête';
24 | $lang['startingNamespace'] = 'Entrez le nom de votre espace de départ';
25 | $lang['selectYourOptions'] = 'Sélectionnez vos options';
26 | $lang['helpCreationOptions'] = 'Sélectionnez l\'une de vos options pour l\'aide à la création (option)';
27 | $lang['eclipseDocZip'] = 'Crée une aide Eclipse';
28 | $lang['JavaHelpDocZip'] = 'Crée une aide Java';
29 | $lang['TOCMapWithoutTranslation'] = 'Retire la traduction à la racine';
30 | $lang['useTocFile'] = 'Utilisez un fichier TOC dans le nom de l\'espace';
31 | $lang['emptyTocElem'] = 'Catégorie vide dans la TDM';
32 | $lang['startProcess'] = 'Démarrer le processus';
33 | $lang['directDownloadLink'] = 'Lien de téléchargement direct';
34 | $lang['wgetURLLink'] = 'Lien de téléchargement wget';
35 | $lang['curlURLLink'] = 'Lien de téléchargement curl';
36 | $lang['start'] = 'Démarrer';
37 | $lang['status'] = 'Statut';
38 | $lang['ns'] = 'Définir l\'espace de nom';
39 | $lang['ens'] = 'Catégorie parente à exporter';
40 | $lang['defaultLang'] = 'Langue par défaut pour les catégories multilingues.';
41 | $lang['disablePluginsOption'] = 'Désactive les plugins (JS/CSS) durant l\'export';
42 | $lang['depthType'] = 'Type d\'export';
43 | $lang['depth.pageOnly'] = 'cette page uniquement';
44 | $lang['depth.allSubNameSpaces'] = 'Toutes les sous catégories';
45 | $lang['depth.specifiedDepth'] = 'Profondeur spécifiée';
46 | $lang['depth'] = 'Profondeur';
47 | $lang['renderer'] = 'Moteur de rendu';
48 | $lang['exportLinkedPages'] = 'Exporter les pages liées';
49 | $lang['customOptions'] = 'Options personnalisées';
50 | $lang['customOptionsDescription'] = 'Vous pouvez ajouter d\'autres options personnalisées, qui seront prises en compte durant l\'export';
51 | $lang['addCustomOption'] = 'Ajouter une option';
52 | $lang['search'] = 'Chercher';
53 | $lang['toc'] = 'Table des matières';
54 | $lang['AggregateSubmitLabel'] = 'Télécharger';
55 | $lang['AggragateExportPages'] = 'Page de début a fusionner';
56 | $lang['SiteSubmitLabel'] = 'Télécharger au format PDF';
57 | $lang['toolbarButton'] = 'Insérer Siteexporter';
58 | $lang['useOptionsInEditor'] = 'Utiliser ces options et insérer l\'élément {{siteAggregator}}';
59 | $lang['NoEntriesFoundHint'] = 'Aucune page n\'a été trouvé pour aggrégation';
60 | $lang['siteexport_button'] = 'Exporter la page en HTML/PDF';
61 | $lang['js']['loadingpage'] = 'Création du document';
62 | $lang['js']['startdownload'] = 'Début du téléchargement';
63 | $lang['js']['downloadfinished'] = 'Téléchargement terminé';
64 | $lang['js']['finishedbutdownloadfailed'] = 'Téléchargement échoué.';
65 |
--------------------------------------------------------------------------------
/lang/fr/managerintro.txt:
--------------------------------------------------------------------------------
1 | ====== gestionnaire d'export de site ======
2 |
3 | Configurez un element ''%%{{siteAGGREGATOR}}%%'' avec ces options.
4 |
5 | Ceci fait, pressez le bouton à la fin de la page et les options seront insérées dans la page.
--------------------------------------------------------------------------------
/lang/fr/settings.php:
--------------------------------------------------------------------------------
1 |
7 | * @author Alain Becker
8 | * @author NICOLAS ORTH
9 | * @author Florian TASSIN
10 | * @author tuxun
11 | * @author Nicolas Friedli
12 | * @author ubibene
13 | */
14 | $lang['depth'] = 'Profondeur d\'export par défaut';
15 | $lang['skipacl'] = 'Essayer d\'exporter des pages non-publiques';
16 | $lang['zipfilename'] = 'Chemin et nom du wiki pour le fichier ZIP exporté';
17 | $lang['exclude'] = 'Motif pour exclure des ressources';
18 | $lang['max_execution_time'] = 'Temps d\'exécution maximum pour un script';
19 | $lang['cachetime'] = 'Durée du cache pour l\'exportation';
20 | $lang['allowallusers'] = 'Autoriser tous les utilisateurs à exporter des pages';
21 | $lang['ignoreNon200'] = 'Ignorer les statuts HTTP autres que 200';
22 | $lang['ignoreAJAXError'] = 'Ne pas interrompre l\'exportation en cas d\'erreurs';
23 | $lang['debugFile'] = 'Fichier de débogage';
24 | $lang['debugLevel'] = 'Niveau de débogage';
25 | $lang['debugLevel_o_5'] = 'Aucun';
26 | $lang['debugLevel_o_4'] = 'Erreur';
27 | $lang['debugLevel_o_3'] = 'Avertissement';
28 | $lang['debugLevel_o_2'] = 'Info';
29 | $lang['debugLevel_o_1'] = 'Débogage';
30 | $lang['useOddEven'] = 'Permettre une configuration des entêtes et pieds de pages différenciée pour les pages paires/impaires. Les tables des matières commencent toujours sur une page impaire.';
31 | $lang['defaultAuthenticationUser'] = 'Nom d\'utilisateur pour les pages non publiques';
32 | $lang['defaultAuthenticationPassword'] = 'Mot de passe pour les pages non publiques';
33 |
--------------------------------------------------------------------------------
/lang/ja/intro.txt:
--------------------------------------------------------------------------------
1 | ====== サイトエクスポート管理 ======
2 | このページでは、描画処理があれば任意の形式にサイト全体を出力できます。
--------------------------------------------------------------------------------
/lang/ja/lang.php:
--------------------------------------------------------------------------------
1 |
7 | * @author Hideaki SAWADA
8 | */
9 | $lang['encoding'] = 'utf-8';
10 | $lang['direction'] = 'ltr';
11 | $lang['menu'] = 'サイトエクスポート';
12 | $lang['absolutePath'] = '絶対パスを出力する';
13 | $lang['pdfExport'] = 'PDF 出力';
14 | $lang['usenumberedheading'] = '番号付き見出し';
15 | $lang['template'] = 'テンプレートに従って出力する';
16 | $lang['exportBody'] = '本文のみ出力する';
17 | $lang['addParams'] = 'すべてのパラメータを出力する(例: "do")';
18 | $lang['disableCache'] = '現在の要求のキャッシュを無効化する';
19 | $lang['startingNamespace'] = '起点の名前空間を入力する';
20 | $lang['selectYourOptions'] = 'オプションを選択する';
21 | $lang['helpCreationOptions'] = 'ヘルプ作成オプション(任意)を選択する';
22 | $lang['eclipseDocZip'] = 'Eclipse ヘルプを作成する';
23 | $lang['JavaHelpDocZip'] = 'Java ヘルプを作成する';
24 | $lang['TOCMapWithoutTranslation'] = '翻訳ルートを削除する';
25 | $lang['useTocFile'] = '名前空間内の目次ファイルを使用する';
26 | $lang['emptyTocElem'] = '目次内の名前空間を空にする';
27 | $lang['startProcess'] = '処理開始';
28 | $lang['directDownloadLink'] = 'ダウンロードリンク';
29 | $lang['wgetURLLink'] = 'wget 用のダウンロード URL';
30 | $lang['curlURLLink'] = 'curl 用のダウンロード URL';
31 | $lang['start'] = '開始';
32 | $lang['status'] = '状態';
33 | $lang['ns'] = '名前空間を設定する';
34 | $lang['ens'] = 'エクスポート用の親名前空間';
35 | $lang['defaultLang'] = '多言語の名前空間内でのデフォルト言語';
36 | $lang['disablePluginsOption'] = '出力中(JS/CSS)プラグインを無効化する';
37 | $lang['depthType'] = '出力形式';
38 | $lang['depth.pageOnly'] = 'このページのみ';
39 | $lang['depth.allSubNameSpaces'] = 'サブ名前空間全て';
40 | $lang['depth.specifiedDepth'] = '指定された階層';
41 | $lang['depth'] = '階層';
42 | $lang['renderer'] = '描画処理エンジン';
43 | $lang['exportLinkedPages'] = 'リンクされたページを出力する';
44 | $lang['customOptions'] = 'カスタムオプション';
45 | $lang['customOptionsDescription'] = '出力時に考慮されるカスタムオプションを追加できます';
46 | $lang['addCustomOption'] = 'オプションを追加する';
47 | $lang['search'] = '検索';
48 | $lang['toc'] = '目次';
49 | $lang['AggregateSubmitLabel'] = 'ダウンロード';
50 | $lang['AggragateExportPages'] = '統合するページの開始:';
51 | $lang['SiteSubmitLabel'] = 'PDF ファイルとしてダウンロードする';
52 | $lang['toolbarButton'] = 'サイトエクスポートを挿入';
53 | $lang['useOptionsInEditor'] = 'これらのオプションを使用し {{siteAggregator}} 要素を挿入する';
54 | $lang['NoEntriesFoundHint'] = '統合されるページがありません';
55 | $lang['siteexport_button'] = 'ページをHTML/PDFに出力';
56 | $lang['js']['loadingpage'] = '読み込み';
57 | $lang['js']['startdownload'] = 'ダウンロードを開始する';
58 | $lang['js']['downloadfinished'] = 'ダウンロードが終了した';
59 | $lang['js']['finishedbutdownloadfailed'] = 'ダウンロードが失敗した';
60 |
--------------------------------------------------------------------------------
/lang/ja/managerintro.txt:
--------------------------------------------------------------------------------
1 | ====== サイトエクスポート管理 ======
2 |
3 | これらのオプションを使用し ''%%{{siteAGGREGATOR}}%%'' 要素を設定します。
4 |
5 | 設定完了後、ページ最後のボタンを押すとオプションをページに挿入します。
--------------------------------------------------------------------------------
/lang/ja/settings.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 | $lang['depth'] = 'デフォルト出力階層数';
9 | $lang['skipacl'] = '非公開ページの出力を試みる';
10 | $lang['zipfilename'] = '出力 ZIP ファイルの Wiki パスと名前';
11 | $lang['exclude'] = '除外するページのパターン';
12 | $lang['max_execution_time'] = 'スクリプト実行時間の最大値';
13 | $lang['cachetime'] = '出力用のキャッシュ時間';
14 | $lang['allowallusers'] = 'ページ出力を全ユーザーに許可する';
15 | $lang['ignoreNon200'] = '出力時の 200 番代エラーを無視する';
16 | $lang['ignoreAJAXError'] = 'エラー時に出力を中断しない';
17 | $lang['debugFile'] = 'デバッグファイル';
18 | $lang['debugLevel'] = 'デバッグレベル';
19 | $lang['debugLevel_o_5'] = 'None';
20 | $lang['debugLevel_o_4'] = 'Error';
21 | $lang['debugLevel_o_3'] = 'Warn';
22 | $lang['debugLevel_o_2'] = 'Info';
23 | $lang['debugLevel_o_1'] = 'Debug';
24 | $lang['useOddEven'] = '奇数・偶数ページに異なるヘッダー・フッター設定を許可する。目次は常に奇数ページから始める。';
25 | $lang['defaultAuthenticationUser'] = '非公開ページ用のユーザー名';
26 | $lang['defaultAuthenticationPassword'] = '非公開ページ用のパスワード';
27 |
--------------------------------------------------------------------------------
/lang/ko/intro.txt:
--------------------------------------------------------------------------------
1 | ====== 사이트 내보내기 관리자 ======
2 |
3 | 이 페이지는 렌더러을 가지고 어떠한 형식으로든 전체 사이트를 내보낼 수 있습니다.
--------------------------------------------------------------------------------
/lang/ko/lang.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 | $lang['encoding'] = 'utf-8';
9 | $lang['direction'] = 'ltr';
10 | $lang['menu'] = '사이트 내보내기';
11 | $lang['absolutePath'] = '절대 경로 내보내기';
12 | $lang['pdfExport'] = 'PDF 내보내기';
13 | $lang['usenumberedheading'] = '번호가 매겨진 문단 제목';
14 | $lang['template'] = '템플릿 내보내기';
15 | $lang['exportBody'] = '본문만 내보내기';
16 | $lang['addParams'] = '모든 변수 내보내기 (예로 "do")';
17 | $lang['disableCache'] = '현재 요청에 대한 캐시 비활성화';
18 | $lang['startingNamespace'] = '시작하는 이름공간을 입력하세요';
19 | $lang['selectYourOptions'] = '옵션을 선택하세요';
20 | $lang['helpCreationOptions'] = '도움말 만들기 옵션 중 하나를 선택하세요 (선택 사항)';
21 | $lang['eclipseDocZip'] = 'Eclipse 도움말 만들기';
22 | $lang['JavaHelpDocZip'] = 'Java 도움말 만들기';
23 | $lang['TOCMapWithoutTranslation'] = '번역 루트 제거';
24 | $lang['useTocFile'] = '이름공간에 목차 파일 사용';
25 | $lang['emptyTocElem'] = '목차에서의 빈 이름공간';
26 | $lang['startProcess'] = '시작 과정';
27 | $lang['directDownloadLink'] = '직접 다운로드 링크';
28 | $lang['wgetURLLink'] = 'wget 다운로드 URL';
29 | $lang['curlURLLink'] = 'curl 다운로드 URL';
30 | $lang['start'] = '시작';
31 | $lang['status'] = '상태';
32 | $lang['ns'] = '이름공간 설정';
33 | $lang['ens'] = '내보낼 상위 이름공간';
34 | $lang['defaultLang'] = '다중 언어 이름공간에 대한 기본 언어';
35 | $lang['disablePluginsOption'] = '내보낼 때 (JS/CSS) 플러그인 비활성화';
36 | $lang['depthType'] = '내보내기 유형';
37 | $lang['depth.pageOnly'] = '이 문서만';
38 | $lang['depth.allSubNameSpaces'] = '모든 하위 이름공간';
39 | $lang['depth.specifiedDepth'] = '지정된 깊이';
40 | $lang['depth'] = '깊이';
41 | $lang['renderer'] = '렌더 엔진';
42 | $lang['exportLinkedPages'] = '링크된 문서 내보내기';
43 | $lang['customOptions'] = '사용자 지정 옵션';
44 | $lang['customOptionsDescription'] = '내보내는 동안 고려되는 추가 사용자 지정 옵션을 추가할 수 있습니다';
45 | $lang['addCustomOption'] = '옵션 추가';
46 | $lang['search'] = '검색';
47 | $lang['toc'] = '목차';
48 | $lang['AggregateSubmitLabel'] = '다운로드';
49 | $lang['AggragateExportPages'] = '병합을 위한 시작하는 문서:';
50 | $lang['toolbarButton'] = 'Siteexporter 넣기';
51 | $lang['useOptionsInEditor'] = '이러한 옵션을 사용하고 {{siteAggregator}} 요소 넣기';
52 | $lang['NoEntriesFoundHint'] = '집계를 위한 문서를 찾을 수 없습니다.';
53 | $lang['js']['loadingpage'] = '불러오는 중';
54 | $lang['js']['startdownload'] = '다운로드 시작 중';
55 | $lang['js']['downloadfinished'] = '다운로드 마침';
56 | $lang['js']['finishedbutdownloadfailed'] = '마쳤지만 다운로드에 실패했습니다.';
57 |
--------------------------------------------------------------------------------
/lang/ko/managerintro.txt:
--------------------------------------------------------------------------------
1 | ====== 사이트 내보내기 관리자 ======
2 |
3 | 이러한 옵션으로 된 ''%%{{siteAGGREGATOR}}%%'' 요소를 구성합니다.
4 |
5 | 완료될 때, 페이지 끝에 있는 버튼을 누르면 옵션이 페이지 안으로 들어갈 것입니다.
6 |
--------------------------------------------------------------------------------
/lang/ko/settings.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 | $lang['depth'] = '기본 내보내기 깊이';
9 | $lang['skipacl'] = '비공개 문서 내보내기를 시도';
10 | $lang['zipfilename'] = '내보내는 ZIP 파일을 위한 위키 경로와 이름';
11 | $lang['exclude'] = '자료를 제외할 패턴';
12 | $lang['max_execution_time'] = '최대 스크립트 실행 시간';
13 | $lang['cachetime'] = '내보내기 위한 캐시 시간';
14 | $lang['allowallusers'] = '모든 사용자가 문서를 내보낼 수 있음';
15 | $lang['ignoreNon200'] = '내보내는 동안 200이 아닌 상태를 무시';
16 | $lang['ignoreAJAXError'] = '오류가 있는 내보내기를 중단하지 마십시오';
17 | $lang['debugFile'] = '디버그 파일';
18 | $lang['debugLevel'] = '디버그 수준';
19 | $lang['debugLevel_o_5'] = '없음';
20 | $lang['debugLevel_o_4'] = '오류';
21 | $lang['debugLevel_o_3'] = '경고';
22 | $lang['debugLevel_o_2'] = '정보';
23 | $lang['debugLevel_o_1'] = '디버그';
24 | $lang['useOddEven'] = '홀수/짝수 페이지에 다른 머릿글과 바닥글을 설정할 수 있습니다. 목차는 항상 홀수 페이지에 시작합니다.';
25 | $lang['defaultAuthenticationUser'] = '비공개 문서를 위한 사용자 이름';
26 | $lang['defaultAuthenticationPassword'] = '비공개 문서를 위한 비밀번호';
27 |
--------------------------------------------------------------------------------
/lang/nl/intro.txt:
--------------------------------------------------------------------------------
1 | ====== Site Export Beheerder ======
2 |
3 | Deze pagina stelt u in staat om de het site te exporteren naar elk formaat waarvoor u een renderer heeft.
--------------------------------------------------------------------------------
/lang/nl/lang.php:
--------------------------------------------------------------------------------
1 |
7 | * @author Rene
8 | * @author hugo smet
9 | */
10 | $lang['encoding'] = 'utf-8';
11 | $lang['direction'] = 'Ltr';
12 | $lang['menu'] = 'Site Export';
13 | $lang['absolutePath'] = 'Exporteer absolute paden';
14 | $lang['pdfExport'] = 'PDF Export';
15 | $lang['usenumberedheading'] = 'Genummerde Titels';
16 | $lang['template'] = 'Export Template';
17 | $lang['exportBody'] = 'Exporteer alleen de body';
18 | $lang['addParams'] = 'Exporteer alle parameters (e.g. "do")';
19 | $lang['disableCache'] = 'Zet de cache uit voor het huidige verzoek';
20 | $lang['startingNamespace'] = 'Geef de start Namespace';
21 | $lang['selectYourOptions'] = 'Kies uw instellingen';
22 | $lang['helpCreationOptions'] = 'Kies een van de Help Creation Options (optioneel)';
23 | $lang['eclipseDocZip'] = 'Maak Eclipse Help';
24 | $lang['JavaHelpDocZip'] = 'Maak Java Help';
25 | $lang['TOCMapWithoutTranslation'] = 'Verwijder de Vertaal Root';
26 | $lang['useTocFile'] = 'Gebruik TOC bestand in de Namespace';
27 | $lang['emptyTocElem'] = 'Lege Namespace in de TOC';
28 | $lang['startProcess'] = 'Begin het proces';
29 | $lang['directDownloadLink'] = 'Directe Download Link';
30 | $lang['wgetURLLink'] = 'wget Download URL';
31 | $lang['curlURLLink'] = 'curl Download URL';
32 | $lang['start'] = 'Start';
33 | $lang['status'] = 'Status';
34 | $lang['ns'] = 'Stel Namespace in';
35 | $lang['ens'] = 'Ouder Namespace om te exporteren ';
36 | $lang['defaultLang'] = 'Verstekwaarde taal voor multi-taal naamruimtes';
37 | $lang['disablePluginsOption'] = 'Schakel (JS/CSS) Plugins uit tijdens het exporteren';
38 | $lang['depthType'] = 'Export Type';
39 | $lang['depth.pageOnly'] = 'Alleen deze pagina';
40 | $lang['depth.allSubNameSpaces'] = 'alle sub namespaces';
41 | $lang['depth.specifiedDepth'] = 'Opgegeven diepte';
42 | $lang['depth'] = 'Diepte';
43 | $lang['renderer'] = 'Render Engine';
44 | $lang['exportLinkedPages'] = 'Geëxporteerde gelinkte pagina\'s ';
45 | $lang['customOptions'] = 'Aangepaste instellingen';
46 | $lang['customOptionsDescription'] = 'U kunt verder aangepaste instellingen toevoegen waarmee rekening wordt gehouden bij het exporteren';
47 | $lang['addCustomOption'] = 'Voeg een optie toe';
48 | $lang['search'] = 'Zoeken';
49 | $lang['toc'] = 'Inhouds opgave ';
50 | $lang['AggregateSubmitLabel'] = 'Download';
51 | $lang['AggragateExportPages'] = 'Startpagina voor samenvoegen:';
52 | $lang['SiteSubmitLabel'] = 'Download als PDF';
53 | $lang['toolbarButton'] = 'Voeg Siteexporter toe';
54 | $lang['useOptionsInEditor'] = 'Gebruik deze opties en voeg het {{siteAggregator}}element toe';
55 | $lang['NoEntriesFoundHint'] = 'Er werden geen pagina\'s gevonden voor samenvoeging.';
56 | $lang['siteexport_button'] = 'Exporteer Pagina naar HTML/PDF';
57 | $lang['js']['loadingpage'] = 'Laden';
58 | $lang['js']['startdownload'] = 'Begin Download';
59 | $lang['js']['downloadfinished'] = 'Beëindigde Download';
60 | $lang['js']['finishedbutdownloadfailed'] = 'Beëindigde maar mislukte download';
61 |
--------------------------------------------------------------------------------
/lang/nl/managerintro.txt:
--------------------------------------------------------------------------------
1 | ====== Site Export Beheerder ======
2 |
3 | Configureer een "%%{{siteAggregator}}%%" element met deze instellingen.
4 |
5 | Druk op knop aan het einde van de pagina om de instellingen toe te voegen aan de pagina.
--------------------------------------------------------------------------------
/lang/nl/settings.php:
--------------------------------------------------------------------------------
1 |
7 | * @author Mijndert
8 | * @author hugo smet
9 | */
10 | $lang['depth'] = 'Standaard Export Diepte';
11 | $lang['skipacl'] = 'Probeer niet publieke pagina\'s te exporteren';
12 | $lang['zipfilename'] = 'Wiki pad en naam voor het geëxporteerde Zip bestand';
13 | $lang['exclude'] = 'Patroon om bepaalde bronnen uit te sluiten';
14 | $lang['max_execution_time'] = 'Maximale duur van uitvoering van het script';
15 | $lang['cachetime'] = 'Cache tijd voor export';
16 | $lang['allowallusers'] = 'Sta gebruikers toe om pagina\'s te exporteren';
17 | $lang['ignoreNon200'] = 'Houdt geen rekening met non-200 status';
18 | $lang['ignoreAJAXError'] = 'Onderbreek de export met fouten niet.';
19 | $lang['debugFile'] = 'Debug bestand';
20 | $lang['debugLevel'] = 'Debug nivo';
21 | $lang['debugLevel_o_5'] = 'Geen';
22 | $lang['debugLevel_o_4'] = 'Fout';
23 | $lang['debugLevel_o_3'] = 'Waarschuwing';
24 | $lang['debugLevel_o_2'] = 'Info';
25 | $lang['debugLevel_o_1'] = 'Debug';
26 | $lang['useOddEven'] = 'Instellingen van verschillende kop en voetteksten toelaten op oneven/even pagina\'s. Inhoudstafels starten altijd op oneven pagina\'s.';
27 | $lang['defaultAuthenticationUser'] = 'Gebruikersnaam voor niet publieke pagina\'s';
28 | $lang['defaultAuthenticationPassword'] = 'Wachtwoord voor niet publieke pagina\'s';
29 |
--------------------------------------------------------------------------------
/lang/ru/intro.txt:
--------------------------------------------------------------------------------
1 | ======= Экспорт сайта =============
2 |
3 | Эта страница позволяет вам экспортировать весь ваш сайт в любом доступном формате, который вы выберете.
--------------------------------------------------------------------------------
/lang/ru/lang.php:
--------------------------------------------------------------------------------
1 |
7 | * @author Igor Banatov
8 | */
9 | $lang['encoding'] = 'utf-8';
10 | $lang['direction'] = 'ltr';
11 | $lang['menu'] = 'Экспорт сайта';
12 | $lang['absolutePath'] = 'Экспорт абсолютных путей размещения';
13 | $lang['pdfExport'] = 'Экспорт в PDF';
14 | $lang['usenumberedheading'] = 'Нумерованные заголовки';
15 | $lang['template'] = 'Шаблон экспорта';
16 | $lang['exportBody'] = 'Экспорт только тела';
17 | $lang['addParams'] = 'Экспорт всех параметров (например, do)';
18 | $lang['disableCache'] = 'Выключить кэширование для текущего запроса';
19 | $lang['startingNamespace'] = 'Введите вашу стартовую именованную область ';
20 | $lang['selectYourOptions'] = 'Выберите ваши параметры';
21 | $lang['helpCreationOptions'] = 'Выберите одну из опций создания Помощи (опционально)';
22 | $lang['eclipseDocZip'] = 'Создать Помощь для Eclipse ';
23 | $lang['JavaHelpDocZip'] = 'Создать Помощь для Java ';
24 | $lang['TOCMapWithoutTranslation'] = 'Удалить изначальный перевод';
25 | $lang['useTocFile'] = 'Использовать файл Содержания в именованной области';
26 | $lang['emptyTocElem'] = 'Пустые именованные области в Содержании';
27 | $lang['startProcess'] = 'Запустить процесс';
28 | $lang['directDownloadLink'] = 'Прямая ссылка для загрузки';
29 | $lang['wgetURLLink'] = 'wget-ссылка для загрузки';
30 | $lang['curlURLLink'] = 'curl-ссылка для загрузки';
31 | $lang['start'] = 'Запуск';
32 | $lang['status'] = 'Статус';
33 | $lang['ns'] = 'Задать именованную область';
34 | $lang['ens'] = 'Родительская именовая область для экспорта';
35 | $lang['defaultLang'] = 'Язык по умолчанию для мультиязыковой именованной области';
36 | $lang['disablePluginsOption'] = 'Выключить JS/CSS-плагины при экспорте';
37 | $lang['depthType'] = 'Тип экспорта';
38 | $lang['depth.pageOnly'] = 'только эту страницу';
39 | $lang['depth.allSubNameSpaces'] = 'все подчиненные именованные области';
40 | $lang['depth.specifiedDepth'] = 'указанной глубины';
41 | $lang['depth'] = 'Глубина';
42 | $lang['renderer'] = 'Способ преобразования';
43 | $lang['exportLinkedPages'] = 'Экспорт связаных страниц';
44 | $lang['customOptions'] = 'Пользовательские опции';
45 | $lang['customOptionsDescription'] = 'Вы можете добавить свои пользовательские опции, которые будут использоваться при экспорте';
46 | $lang['addCustomOption'] = 'добавить опцию';
47 | $lang['search'] = 'Поиск';
48 | $lang['toc'] = 'Содержание';
49 | $lang['AggregateSubmitLabel'] = 'Загрузка';
50 | $lang['AggragateExportPages'] = 'Начальная страница для слияния';
51 | $lang['SiteSubmitLabel'] = 'Загрузить в формате PDF';
52 | $lang['toolbarButton'] = 'Вставить Siteexporter';
53 | $lang['useOptionsInEditor'] = 'Использовать данные опции и вставить элементы {{siteAggregator}} ';
54 | $lang['NoEntriesFoundHint'] = 'Не найдено станиц для объединения';
55 | $lang['siteexport_button'] = 'Экспорт страницы в формате HTML/PDF';
56 | $lang['js']['loadingpage'] = 'Создание документа';
57 | $lang['js']['startdownload'] = 'Начало загрузки';
58 | $lang['js']['downloadfinished'] = 'Оконченная загрузка';
59 | $lang['js']['finishedbutdownloadfailed'] = 'Закончено, но загрузка неуспешна.';
60 |
--------------------------------------------------------------------------------
/lang/ru/managerintro.txt:
--------------------------------------------------------------------------------
1 | ====== Экспорт сайта ======
2 |
3 | Примените ''%%{{siteAGGREGATOR}}%%'' элементы с этими опциями.
4 |
5 | После завершения нажмите кнопку в конце страницы и опции применятся к этой странице
--------------------------------------------------------------------------------
/lang/ru/settings.php:
--------------------------------------------------------------------------------
1 |
7 | * @author Igor Banatov
8 | */
9 | $lang['depth'] = 'Глубина экспорта по умолчанию';
10 | $lang['skipacl'] = 'Пытаться экспортировать непубличные страницы ';
11 | $lang['zipfilename'] = 'Путь и имя вики для экспорта в ZIP-файл';
12 | $lang['exclude'] = 'Шаблон для исключения источников';
13 | $lang['max_execution_time'] = 'Максимальное время выполнения скрипта';
14 | $lang['cachetime'] = 'Время кэширования для экспорта';
15 | $lang['allowallusers'] = 'Разрешить всем пользователям экспортировать страницы';
16 | $lang['ignoreNon200'] = 'Игнорировать статусы non-200 во время экспорта';
17 | $lang['ignoreAJAXError'] = 'Не прерывать экспорт при ошибках';
18 | $lang['debugFile'] = 'Файл отладки';
19 | $lang['debugLevel'] = 'Уровень отладки';
20 | $lang['debugLevel_o_5'] = 'Нет';
21 | $lang['debugLevel_o_4'] = 'Ошибка';
22 | $lang['debugLevel_o_3'] = 'Предупреждение';
23 | $lang['debugLevel_o_2'] = 'Информация';
24 | $lang['debugLevel_o_1'] = 'Отладка';
25 | $lang['useOddEven'] = 'Разрешить разные заголовки верхних и нижних полей страницы на чётных/нёчетных страницах.';
26 | $lang['defaultAuthenticationUser'] = 'Имя пользователя для непубличных страниц';
27 | $lang['defaultAuthenticationPassword'] = 'Пароль для непубличных страниц';
28 |
--------------------------------------------------------------------------------
/lang/sv/intro.txt:
--------------------------------------------------------------------------------
1 | ====== Webbplatsexport-hanterare ======
2 |
3 | Denna sida låter dig exportera hela din wiki-webbplats till valfritt format som du har en renderingsmotor för.
--------------------------------------------------------------------------------
/lang/sv/lang.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 | $lang['encoding'] = 'utf-8';
9 | $lang['direction'] = 'ltr';
10 | $lang['menu'] = 'Webbplatsexportering';
11 | $lang['absolutePath'] = 'Exportera absoluta sökvägar';
12 | $lang['pdfExport'] = 'Exportera PDF';
13 | $lang['usenumberedheading'] = 'Numrerade rubriker';
14 | $lang['template'] = 'Exporttemplat';
15 | $lang['exportBody'] = 'Exportera enbart innehåll';
16 | $lang['addParams'] = 'Exportera alla parametrar (t ex "do")';
17 | $lang['disableCache'] = 'Avaktivera cache för aktuell begäran';
18 | $lang['startingNamespace'] = 'Fyll i första namnrymd';
19 | $lang['selectYourOptions'] = 'Välj dina alternativ';
20 | $lang['helpCreationOptions'] = 'Välj en av hjälpskaparalternativen (valfritt)';
21 | $lang['eclipseDocZip'] = 'Skapa Eclipse-hjälp';
22 | $lang['JavaHelpDocZip'] = 'Skapa Java-hjälp';
23 | $lang['useTocFile'] = 'Använd innehållstörteckningsfil i namnrymd';
24 | $lang['emptyTocElem'] = 'Tomma namnrymder i innehållsförteckning';
25 | $lang['startProcess'] = 'Inled processen';
26 | $lang['directDownloadLink'] = 'Direkt nedladdningslänk';
27 | $lang['wgetURLLink'] = 'Nedladdningslänk wget';
28 | $lang['curlURLLink'] = 'Nedladdningslänk curl';
29 | $lang['start'] = 'starta';
30 | $lang['status'] = 'Status';
31 | $lang['ns'] = 'Ange namnrymd';
32 | $lang['ens'] = 'Ovanliggande namnrymd att exportera';
33 | $lang['defaultLang'] = 'Standardspråk för flerspråkiga namnrymder';
34 | $lang['disablePluginsOption'] = 'Avaktivera (JS/CSS) plugin vid export';
35 | $lang['depthType'] = 'Exporttyp';
36 | $lang['depth.pageOnly'] = 'enbart denna sida';
37 | $lang['depth.allSubNameSpaces'] = 'alla underliggande namnrymder';
38 | $lang['depth.specifiedDepth'] = 'valt djup';
39 | $lang['depth'] = 'Djup';
40 | $lang['renderer'] = 'Renderingsmotor';
41 | $lang['exportLinkedPages'] = 'Exportera länkade sidor';
42 | $lang['customOptions'] = 'Anpassade alternativ';
43 | $lang['customOptionsDescription'] = 'Du kan lägga till fler anpassade alternativ som kommer att tas i beaktande under export';
44 | $lang['addCustomOption'] = 'lägg till alternativ';
45 | $lang['search'] = 'Sök';
46 | $lang['toc'] = 'Innehållsförteckning';
47 | $lang['AggregateSubmitLabel'] = 'Ladda ner';
48 | $lang['SiteSubmitLabel'] = 'Ladda ner som PDF';
49 | $lang['useOptionsInEditor'] = 'Använd dessa val och lägg till en {{siteAggregator}}-sektion';
50 | $lang['NoEntriesFoundHint'] = 'Inga sidor har hittats för aggregering.';
51 | $lang['js']['loadingpage'] = 'Skapar dokument';
52 | $lang['js']['startdownload'] = 'Inleder nedladdning';
53 | $lang['js']['downloadfinished'] = 'Avslutat nedladdning';
54 | $lang['js']['finishedbutdownloadfailed'] = 'Avslutat med nedladdning misslyckades';
55 |
--------------------------------------------------------------------------------
/lang/sv/managerintro.txt:
--------------------------------------------------------------------------------
1 | ====== Webbplatsexport-hanterare ======
2 |
3 | Konfigurera en ''%%{{siteAGGREGATOR}}%%''-sektion med dessa alternativ.
4 |
5 | När du är färdig, klicka på knappen vid nederst på sidan så kommer detta val att placeras på sidan.
--------------------------------------------------------------------------------
/lang/sv/settings.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 | $lang['depth'] = 'Exportdjup som standard';
9 | $lang['skipacl'] = 'Försök att exportera icke-publika sidor';
10 | $lang['zipfilename'] = 'Wiki-sökväg och namn på exporterad ZIP-fil';
11 | $lang['exclude'] = 'Mönster för att exkludering av resurser/tillgångar';
12 | $lang['max_execution_time'] = 'Maximal tid för exekvering av manus';
13 | $lang['cachetime'] = 'Spara tid för exekvering av manus i cacheminne';
14 | $lang['allowallusers'] = 'Tillåt alla användare att exportera sidor';
15 | $lang['ignoreNon200'] = 'Ignorera icke-200-status under export';
16 | $lang['ignoreAJAXError'] = 'Stör inte exporten med fel';
17 | $lang['debugFile'] = 'Avlusningsfil';
18 | $lang['debugLevel'] = 'Avlusningsnivå';
19 | $lang['debugLevel_o_5'] = 'Ingen';
20 | $lang['debugLevel_o_4'] = 'Fel';
21 | $lang['debugLevel_o_3'] = 'Varna';
22 | $lang['debugLevel_o_2'] = 'Info';
23 | $lang['debugLevel_o_1'] = 'Avlusa';
24 | $lang['useOddEven'] = 'Tillåt olika sidhuvuden och sidfötter på udde/jämna sidor. Innehållsförteckning inleds alltid på udda sidnummer.';
25 | $lang['defaultAuthenticationUser'] = 'Användarnamn för icke-publika sidor';
26 | $lang['defaultAuthenticationPassword'] = 'Lösenord för icke-publika sidor';
27 |
--------------------------------------------------------------------------------
/plugin.info.txt:
--------------------------------------------------------------------------------
1 | # General Plugin Info do not edit
2 |
3 | base siteexport
4 | author i-net software
5 | email tools@inetsoftware.de
6 | date 2023-07-07
7 | name Site Export
8 | desc exports the dokuwiki site in the given format
9 | url https://www.dokuwiki.org/plugin:siteexport
10 |
--------------------------------------------------------------------------------
/preload.php:
--------------------------------------------------------------------------------
1 | __disablePlugins();
99 | }
100 |
101 | private function __disablePlugins() {
102 | global $plugin_controller_class;
103 | $plugin_controller_class = 'preload_plugin_siteexport_controller';
104 | }
105 |
106 | public function __create_preload_function() {
107 |
108 | $PRELOADFILE = DOKU_INC . 'inc/preload.php';
109 | $CURRENTFILE = 'DOKU_INC' . " . 'lib/plugins/siteexport/preload.php'";
110 | $CONTENT = <<__register_template();
116 | \$siteexport_preload->__temporary_disable_plugins();
117 | unset(\$siteexport_preload);
118 | }
119 | /* SITE EXPORT END *********************************************************** */
120 |
121 | OUTPUT;
122 |
123 | if (file_exists($PRELOADFILE)) {
124 |
125 | if (!is_readable($PRELOADFILE)) {
126 | $this->error = "Preload File locked. It exists, but it can't be read.";
127 | msg($this->error, -1);
128 | return false;
129 | }
130 |
131 | if (!is_writeable($PRELOADFILE)) {
132 | $this->error = "Preload File locked. It exists and is readable, but it can't be written.";
133 | msg($this->error, -1);
134 | return false;
135 | }
136 |
137 | $fileContent = file($PRELOADFILE);
138 | if (!strstr(implode("", $fileContent ?: array()), $CONTENT)) {
139 |
140 | $fp = fopen($PRELOADFILE, "a");
141 | if ( !$fp ) { return false; }
142 | if (!strstr(implode("", $fileContent), "")) {
143 | fputs($fp, "error = "Could not create/modify preload.php. Please check the write permissions for your DokuWiki/inc directory.";
164 | msg($this->error, -1);
165 | return false;
166 | }
167 |
168 | }
169 |
170 | // return a custom plugin list
171 | class preload_plugin_siteexport_controller extends _preload_plugin_siteexport_controller {
172 |
173 | protected $tmp_plugins = array();
174 |
175 | /**
176 | * Setup disabling
177 | */
178 | public function __construct() {
179 | parent::__construct();
180 |
181 | $disabledPlugins = array();
182 |
183 | // support of old syntax
184 | if (is_array($_REQUEST['diPlu'] ?? null)) {
185 | $disabledPlugins = $_REQUEST['diPlu'];
186 | }
187 |
188 | if (!empty($_REQUEST['diInv']))
189 | {
190 | $allPlugins = array();
191 | foreach ($this->tmp_plugins as $plugin => $enabled) { // All plugins
192 | // check for CSS or JS
193 | if ($enabled == 1 && !file_exists(DOKU_PLUGIN . "$plugin/script.js") && !file_exists(DOKU_PLUGIN . "$plugin/style.css") && !file_exists(DOKU_PLUGIN . "$plugin/print.css")) { continue; }
194 | $allPlugins[] = $plugin;
195 | }
196 | $disabledPlugins = empty($_REQUEST['diPlu']) ? $allPlugins : array_diff($allPlugins, $_REQUEST['diPlu']);
197 | }
198 |
199 | // if this is defined, it overrides the settings made above. obviously.
200 | $disabledPlugins = empty($_REQUEST['disableplugin']) ? $disabledPlugins : $_REQUEST['disableplugin'];
201 |
202 | foreach ($disabledPlugins as $plugin) {
203 | $this->disable($plugin);
204 | }
205 |
206 | // always enabled - JS and CSS will be cut out later.
207 | $this->enable('siteexport');
208 | }
209 |
210 | /**
211 | * Disable the plugin
212 | *
213 | * @param string $plugin name of plugin
214 | * @return bool; true allways.
215 | */
216 | public function disable($plugin) {
217 | $this->tmp_plugins[$plugin] = 0;
218 | return true;
219 | }
220 |
221 | /**
222 | * Enable the plugin
223 | *
224 | * @param string $plugin name of plugin
225 | * @return bool; true allways.
226 | */
227 | public function enable($plugin) {
228 | $this->tmp_plugins[$plugin] = 1;
229 | return true;
230 | }
231 |
232 | public function hasSiteexportHeaders() {
233 | $headers = function_exists('getallheaders') ? getallheaders() : null;
234 | return is_array($headers) && array_key_exists('X-Site-Exporter', $headers) /* && $headers['X-Site-Exporter'] = getSecurityToken() */;
235 | }
236 |
237 | /**
238 | * Filter the List of Plugins for the siteexport plugin
239 | */
240 | private function isSiteexportPlugin($item) {
241 | return $item != 'siteexport';
242 | }
243 |
244 | /**
245 | * Get the list of plugins, bute remove Siteexport from Style and
246 | * JS if in export Mode
247 | */
248 | public function getList($type = '', $all = false) {
249 | $plugins = parent::getList($type, $all);
250 |
251 | list(,, $caller) = debug_backtrace();
252 | if ($this->hasSiteexportHeaders() && $caller != null && preg_match("/^(js|css)_/", $caller['function']) && preg_match("/(js|css)\.php$/", $caller['file'])) {
253 | $plugins = array_filter($plugins, array($this, 'isSiteexportPlugin'));
254 | }
255 |
256 | return $plugins;
257 | }
258 | }
259 |
--------------------------------------------------------------------------------
/print.css:
--------------------------------------------------------------------------------
1 | div.siteexporter {
2 | display: none;
3 | }
4 |
--------------------------------------------------------------------------------
/renderer/pdf.php:
--------------------------------------------------------------------------------
1 |
6 | * @author Gerry Weissbach
7 | */
8 |
9 | if (!defined('DOKU_INC')) die();
10 | if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
11 |
12 | require_once DOKU_INC . 'inc/parser/xhtml.php';
13 |
14 |
15 | use dokuwiki\File\PageResolver;
16 | use dokuwiki\File\MediaResolver;
17 |
18 | /**
19 | * The Renderer
20 | */
21 | class renderer_plugin_siteexport_pdf extends Doku_Renderer_xhtml {
22 |
23 | public $acronymsExchanged = null;
24 |
25 | private $hasSeenHeader = false;
26 |
27 | private $currentLevel = 0;
28 |
29 | public $levels = array( '======'=>1,
30 | '====='=>2,
31 | '===='=>3,
32 | '==='=>4,
33 | '=='=>5
34 | );
35 |
36 | public $info = array(
37 | 'cache' => true, // may the rendered result cached?
38 | 'toc' => true, // render the TOC?
39 | 'forceTOC' => false, // shall I force the TOC?
40 | 'scriptmode' => false, // In scriptmode, some tags will not be encoded => '<%', '%>'
41 | );
42 |
43 | public $headingCount = array( 1=>0,
44 | 2=>0,
45 | 3=>0,
46 | 4=>0,
47 | 5=>0
48 | );
49 |
50 | public function document_start() {
51 | global $TOC, $ID, $INFO;
52 |
53 | parent::document_start();
54 |
55 | // Cheating in again
56 | $newMeta = p_get_metadata($ID, 'description tableofcontents', false); // 2010-10-23 This should be save to use
57 | if (!empty($newMeta) && count($newMeta) > 1) {
58 | // $TOC = $this->toc = $newMeta; // 2010-08-23 doubled the TOC
59 | $TOC = $newMeta;
60 | }
61 | }
62 |
63 | public function document_end() {
64 |
65 | parent::document_end();
66 |
67 | // Prepare the TOC
68 | global $TOC, $ID;
69 | $meta = array();
70 |
71 | // NOTOC, and no forceTOC
72 | if ($this->info['toc'] === false && !($this->info['forceTOC'] || $this->meta['forceTOC'])) {
73 | $TOC = $this->toc = array();
74 | $meta['internal']['toc'] = false;
75 | $meta['description']['tableofcontents'] = array();
76 | $meta['forceTOC'] = false;
77 |
78 | } else if ($this->info['forceTOC'] || $this->meta['forceTOC'] || (utf8_strlen(strip_tags($this->doc)) >= $this->getConf('documentlengthfortoc') && count($this->toc) > 1)) {
79 | $TOC = $this->toc;
80 | // This is a little bit like cheating ... but this will force the TOC into the metadata
81 | $meta = array();
82 | $meta['internal']['toc'] = true;
83 | $meta['forceTOC'] = $this->info['forceTOC'] || $this->meta['forceTOC'];
84 | $meta['description']['tableofcontents'] = $TOC;
85 | }
86 |
87 | // allways write new metadata
88 | p_set_metadata($ID, $meta);
89 | $this->doc = preg_replace('#\s*
#', '', $this->doc);
90 | }
91 |
92 | public function header($text, $level, $pos, $returnonly = false) {
93 | global $conf;
94 | global $ID;
95 | global $INFO;
96 |
97 | if ($text)
98 | {
99 | $hid = $this->_headerToLink($text, true);
100 |
101 | //only add items within configured levels
102 | $this->toc_additem($hid, $text, $level);
103 |
104 | // adjust $node to reflect hierarchy of levels
105 | $this->node[$level-1]++;
106 | if ($level < $this->lastlevel) {
107 | for ($i = 0; $i < $this->lastlevel-$level; $i++) {
108 | $this->node[$this->lastlevel-$i-1] = 0;
109 | }
110 | }
111 | $this->lastlevel = $level;
112 |
113 | /* There should be no class for "sectioneditX" if there is no edit perm */
114 | if ($INFO['perm'] > AUTH_READ &&
115 | $level <= $conf['maxseclevel'] &&
116 | count($this->sectionedits) > 0 &&
117 | $this->sectionedits[count($this->sectionedits)-1][2] === 'section') {
118 | $this->finishSectionEdit($pos-1);
119 | }
120 |
121 | $headingNumber = '';
122 | $useNumbered = p_get_metadata($ID, 'usenumberedheading', true); // 2011-02-07 This should be save to use
123 | if ($this->getConf('usenumberedheading') || !empty($useNumbered) || !empty($INFO['meta']['usenumberedheading']) || isset($_REQUEST['usenumberedheading'])) {
124 |
125 | // increment the number of the heading
126 | $this->headingCount[$level]++;
127 |
128 | // build the actual number
129 | for ($i = 1; $i <= 5; $i++) {
130 |
131 | // reset the number of the subheadings
132 | if ($i > $level) {
133 | $this->headingCount[$i] = 0;
134 | }
135 |
136 | // build the number of the heading
137 | $headingNumber .= $this->headingCount[$i] . '.';
138 | }
139 |
140 | $headingNumber = preg_replace("/(\.0)+\.?$/", '', $headingNumber) . ' ';
141 | }
142 |
143 | // write the header
144 | $this->doc .= DOKU_LF.' AUTH_READ &&
147 | $level <= $conf['maxseclevel']) {
148 | $class[] = $this->startSectionEdit($pos, array( 'target' => 'section', 'name' => $text ) );
149 | }
150 |
151 | if ( !empty($headingNumber) ) {
152 | $class[] = 'level' . trim($headingNumber);
153 | if ( intval($headingNumber) > 1 ) {
154 | $class[] = 'notfirst';
155 | } else {
156 | $class[] = 'first';
157 | }
158 | }
159 |
160 | if ( !empty($class) ) {
161 | $this->doc .= ' class="' . implode(' ', $class) . '"';
162 | }
163 |
164 | $this->doc .= '>';
165 | $this->doc .= $this->_xmlEntities($headingNumber . $text);
166 | $this->doc .= " ".DOKU_LF;
167 |
168 | } else if ( $INFO['perm'] > AUTH_READ ) {
169 |
170 | if ( $this->hasSeenHeader ) {
171 | $this->finishSectionEdit($pos);
172 | }
173 |
174 | // write the header
175 | $name = rand() . $level;
176 | $sectionEdit = $this->startSectionEdit($pos, array( 'target' => 'section_empty', 'name' => $name));
177 | $this->doc .= DOKU_LF.' '.DOKU_LF;
178 | }
179 |
180 | $this->hasSeenHeader = true;
181 | }
182 |
183 | public function section_open($level) {
184 | $this->currentLevel = $level;
185 | parent::section_open($level);
186 | }
187 |
188 | public function p_open() {
189 | $this->doc .= DOKU_LF . '' . DOKU_LF;
190 | }
191 |
192 | public function listu_open($classes = null) {
193 | $this->doc .= '
' . DOKU_LF;
194 | }
195 |
196 | public function listo_open($classes = null) {
197 | $this->doc .= '' . DOKU_LF;
198 | }
199 |
200 | public function finishSectionEdit($end = null, $hid = null) {
201 | return '';
202 | }
203 |
204 | /**
205 | * @param string $type
206 | */
207 | public function startSectionEdit($start, $data) {
208 | return '';
209 | }
210 |
211 | /**
212 | * Wrap centered media in a div to center it
213 | */
214 | public function _media ($src, $title=NULL, $align=NULL, $width=NULL,
215 | $height=NULL, $cache=NULL, $render = true) {
216 |
217 | $out = '';
218 | if($align == 'center'){
219 | $out .= '';
220 | }
221 |
222 | $out .= parent::_media ($src, $title, $align, $width, $height, $cache, $render);
223 |
224 | if($align == 'center'){
225 | $out .= '
';
226 | }
227 |
228 | return $out;
229 | }
230 |
231 | public function internalmedia($src, $title = NULL, $align = NULL, $width = NULL, $height = NULL, $cache = NULL, $linking = NULL, $return = false) {
232 | global $ID;
233 | list($src,$hash) = explode('#',$src,2);
234 | $src = (new MediaResolver(getNS($ID)))->resolveId($src);
235 | $exists = media_exists( $src );
236 |
237 | $noLink = false;
238 | $render = ($linking == 'linkonly') ? false : true;
239 | $link = $this->_getMediaLinkConf($src, $title, $align, $width, $height, $cache, $render);
240 |
241 | list($ext,$mime,$dl) = mimetype($src);
242 | if(substr($mime,0,5) == 'image' && $render){
243 | $link['url'] = ml($src,array('id'=>$ID,'cache'=>$cache),($linking=='direct'));
244 | if ( substr($mime,0,5) == 'image' && $linking='details' ) { $noLink = true;}
245 | } elseif($mime == 'application/x-shockwave-flash' && $render){
246 | // don't link flash movies
247 | $noLink = true;
248 | } else{
249 | // add file icons
250 | $class = preg_replace('/[^_\-a-z0-9]+/i','_',$ext);
251 | $link['class'] .= ' mediafile mf_'.$class;
252 | $link['url'] = ml($src,array('id'=>$ID,'cache'=>$cache),true);
253 | }
254 |
255 | if($hash) {
256 | $link['url'] .= '#'.$hash;
257 | }
258 |
259 | //markup non existing files
260 | if (!$exists) {
261 | $link['class'] .= ' wikilink2';
262 | }
263 |
264 | //output formatted
265 | if ($linking == 'nolink' || $noLink) {
266 | $this->doc .= $link['name'];
267 | } else {
268 | $this->doc .= $this->_formatLink($link);
269 | }
270 | }
271 |
272 | /**
273 | * Render an internal Wiki Link
274 | *
275 | * $search,$returnonly & $linktype are not for the renderer but are used
276 | * elsewhere - no need to implement them in other renderers
277 | *
278 | * @author Andreas Gohr
279 | */
280 | public function internallink($id, $name = NULL, $search = NULL, $returnonly = false, $linktype = 'content') {
281 | global $conf;
282 | global $ID;
283 | // default name is based on $id as given
284 | $default = $this->_simpleTitle($id);
285 |
286 | // now first resolve and clean up the $id
287 | $id = (new PageResolver( $ID ))->resolveId($id);
288 | $exists = media_exists( $id );
289 | $name = $this->_getLinkTitle($name, $default, $isImage, $id, $linktype);
290 | if (!$isImage) {
291 | if ($exists) {
292 | $class = 'wikilink1';
293 | } else {
294 | $class = 'wikilink2';
295 | $link['rel'] = 'nofollow';
296 | }
297 | } else {
298 | $class = 'media';
299 | }
300 |
301 | //keep hash anchor
302 | list($id, $hash) = explode('#', $id, 2);
303 | if (!empty($hash)) $hash = $this->_headerToLink($hash);
304 |
305 | //prepare for formating
306 | $link['target'] = $conf['target']['wiki'];
307 | $link['style'] = '';
308 | $link['pre'] = '';
309 | $link['suf'] = '';
310 | // highlight link to current page
311 | if ($id == $ID) {
312 | $link['pre'] = '';
313 | $link['suf'] = ' ';
314 | }
315 | $link['more'] = '';
316 | $link['class'] = $class;
317 | $link['url'] = wl($id);
318 | $link['name'] = $name;
319 | $link['title'] = $this->_getLinkTitle(null, $default, $isImage, $id, $linktype);
320 |
321 | //add search string
322 | if ($search) {
323 | ($conf['userewrite']) ? $link['url'] .= '?' : $link['url'] .= '&';
324 | if (is_array($search)) {
325 | $search = array_map('rawurlencode', $search);
326 | $link['url'] .= 's[]=' . join('&s[]=', $search);
327 | } else {
328 | $link['url'] .= 's=' . rawurlencode($search);
329 | }
330 | }
331 |
332 | //keep hash
333 | if ($hash) $link['url'] .= '#' . $hash;
334 |
335 | //output formatted
336 | if ($returnonly) {
337 | return $this->_formatLink($link);
338 | } else {
339 | $this->doc .= $this->_formatLink($link);
340 | }
341 | }
342 |
343 | public function acronym($acronym) {
344 |
345 | if (empty($this->acronymsExchanged)) {
346 | $this->acronymsExchanged = $this->acronyms;
347 | $this->acronyms = array();
348 |
349 | foreach ($this->acronymsExchanged as $key => $value) {
350 | $this->acronyms[str_replace('_', ' ', $key)] = $value;
351 | }
352 | }
353 |
354 | parent::acronym($acronym);
355 | }
356 |
357 | /**
358 | * @param string $string
359 | */
360 | public function _xmlEntities($string) {
361 |
362 | $string = parent::_xmlEntities($string);
363 | $string = htmlentities($string, 8, 'UTF-8');
364 | $string = $this->superentities($string);
365 |
366 | if ($this->info['scriptmode']) {
367 | $string = str_replace(array("<%", "%>", "<?", "?>"),
368 | array("<%", "%>", "", "?>"),
369 | $string);
370 | }
371 |
372 | return $string;
373 | }
374 |
375 | // Unicode-proof htmlentities.
376 | // Returns 'normal' chars as chars and weirdos as numeric html entites.
377 |
378 | /**
379 | * @param string $str
380 | */
381 | public function superentities( $str ){
382 | // get rid of existing entities else double-escape
383 | $str2 = '';
384 | $str = html_entity_decode(stripslashes($str),ENT_QUOTES,'UTF-8');
385 | $ar = preg_split('/(? 1) || /* multi-byte [unicode] */
389 | ($o > 127) // || /* <- control / latin weirdos -> */
390 | // ($o <32 || $o > 126) || /* <- control / latin weirdos -> */
391 | // ($o >33 && $o < 40) ||/* quotes + ambersand */
392 | // ($o >59 && $o < 63) /* html */
393 |
394 | ) {
395 | // convert to numeric entity
396 | $c = mb_encode_numericentity($c, array(0x0, 0xffff, 0, 0xffff), 'UTF-8');
397 | }
398 | $str2 .= $c;
399 | }
400 | return $str2;
401 | }
402 |
403 | public function preformatted($text) {
404 | $this->doc .= '';
405 | parent::preformatted($text);
406 | $this->doc .= '
';
407 | }
408 |
409 | public function _highlight($type, $text, $language = NULL, $filename = NULL, $options = NULL) {
410 | $this->doc .= '';
411 | parent::_highlight($type, $text, $language, $filename, $options);
412 | $this->doc .= '
';
413 | }
414 |
415 | /**
416 | * API of the imagereference plugin
417 | * https://github.com/i-net-software/dokuwiki-plugin-imagereference
418 | *
419 | * Allows to specify special imagecaption tags that the renderer (mpdf) can use
420 | */
421 | public function imageCaptionTags(&$imagereferenceplugin)
422 | {
423 | if ( !$imagereferenceplugin->accepts('table') ) {
424 | return array( '', // $captionStart
425 | ' ', // $captionEnd
426 | '', // $underCaptionStart
427 | ' ' // $underCaptionEnd
428 | );
429 | }
430 |
431 | return null;
432 | }
433 |
434 | /**
435 | * Render a page local link
436 | *
437 | * @param string $hash hash link identifier
438 | * @param string $name name for the link
439 | * @param bool $returnonly whether to return html or write to doc attribute
440 | * @return void|string writes to doc attribute or returns html depends on $returnonly
441 | */
442 | public function locallink($hash, $name = null, $returnonly = false) {
443 | global $ID;
444 | $name = $this->_getLinkTitle($name, $hash, $isImage);
445 | $hash = $this->_headerToLink($hash);
446 | $title = $name;
447 |
448 | $doc = '';
449 | $doc .= $name;
450 | $doc .= ' ';
451 |
452 | if($returnonly) {
453 | return $doc;
454 | } else {
455 | $this->doc .= $doc;
456 | }
457 | }
458 | }
459 |
460 | //Setup VIM: ex: et ts=4 enc=utf-8 :
461 |
--------------------------------------------------------------------------------
/req-travis.txt:
--------------------------------------------------------------------------------
1 | # we need additional plugin(s) for testing
2 | https://github.com/michitux/dokuwiki-plugin-move.git lib/plugins/move
3 |
--------------------------------------------------------------------------------
/style.css:
--------------------------------------------------------------------------------
1 | #siteexport__throbber {
2 | visibility: hidden;
3 | }
4 |
5 | #siteexport, #siteexport__manager {
6 | margin: 1em auto 1em auto;
7 | vertical-align: middle;
8 | width: 80%;
9 | text-align: left;
10 | }
11 |
12 | #siteexport__manager {
13 | margin-top: 0px;
14 | padding-top: 1em;
15 | }
16 |
17 | #siteexport fieldset {
18 | text-align: left;
19 | }
20 |
21 | #siteexport fieldset label input, #siteexport fieldset label select {
22 | float: right;
23 | text-align: left;
24 | width: 50%;
25 | }
26 |
27 | #siteexport fieldset label input[type=checkbox] {
28 | width: auto;
29 | }
30 |
31 | #siteexport fieldset.hideOptions > *
32 | {
33 | display: none;
34 | }
35 |
36 | #siteexport fieldset legend, #siteexport fieldset.hideOptions .forceVisible
37 | {
38 | display: block !important;
39 | }
40 |
41 | #siteexport fieldset legend
42 | {
43 | cursor: pointer;
44 | }
45 |
46 | #siteexport fieldset legend:hover
47 | {
48 | color: __existing__;
49 | text-decoration: underline;
50 | }
51 |
52 | #siteexport fieldset br {
53 | clear: both;
54 | }
55 |
56 | #siteexport fieldset p {
57 | margin-top: 0px;
58 | color: #a9a9a9;
59 | }
60 |
61 | #siteexport__errorlog {
62 | overflow: auto;
63 | max-height: 200px;
64 | }
65 |
66 | #siteexport__errorlog p {
67 | color: #a00;
68 | margin: 0px;
69 | padding: 0px 5px;
70 | overflow: hidden;
71 | }
72 |
73 | #siteexport__errorlog p:nth-child(odd) {
74 | background-color: #FFEDED;
75 | }
76 |
77 | #siteexport__errorlog p:nth-child(even) {
78 | background-color: #FFD4D4;
79 | }
80 |
81 | #siteexport__customActions {
82 | margin: 0px;
83 | padding: 0px;
84 | }
85 |
86 | #siteexport__customActions li {
87 | list-style: none;
88 |
89 | border-bottom: 1px solid #ccc;
90 | float: left;
91 | clear: both;
92 |
93 | width: 100%;
94 | margin: 0px;
95 | padding: 0px;
96 | }
97 |
98 | #siteexport__customActions li input {
99 | margin: 2px 1%;
100 | width: 45%;
101 | }
102 |
103 | #siteexport__customActions li:last-child {
104 | border-bottom: none;
105 | }
106 |
107 | #siteexport__customActions li:nth-child(odd) {
108 | background-color: #eee;
109 | }
110 |
111 | #siteexport__customActions li:nth-child(even) {
112 | background-color: #f0f0f0;
113 | }
114 |
115 | #siteexport__customActions li button {
116 | float: right;
117 | }
118 |
119 | div.sitetoc ul li div.li > a
120 | {
121 | display: block;
122 | margin-bottom: 5px !important;
123 | margin-top: 15px !important;
124 | }
125 |
126 | #siteexport .siteexport__throbber,
127 | #siteexport .siteexport__throbber img {
128 | display: block;
129 | margin-left: auto;
130 | margin-right: auto;
131 | }
132 |
133 | #dokuwiki__pagetools ul li a.siteexport_addpage::before {
134 | content: url(images/pagetools.png);
135 | }
136 |
137 | #dokuwiki__pagetools:hover ul li a.siteexport_addpage,
138 | #dokuwiki__pagetools ul li a.siteexport_addpage:focus,
139 | #dokuwiki__pagetools ul li a.siteexport_addpage:active {
140 | background-image: url(images/pagetools.png);
141 | }
142 |
143 | #dokuwiki__pagetools ul li a.siteexport_addpage:hover,
144 | #dokuwiki__pagetools ul li a.siteexport_addpage:active,
145 | #dokuwiki__pagetools ul li a.siteexport_addpage:focus {
146 | background-position: right -32px;
147 | }
148 |
149 | #dokuwiki__pagetools ul li a.siteexport_mapid {
150 | .mapID {
151 | position: relative;
152 |
153 | &:before {
154 | position: absolute;
155 | left: 0; right: 0;
156 | content: attr(data-done);
157 | color: #0a0;
158 | opacity: 0;
159 | background: #efe;
160 | text-align: center;
161 |
162 | transition: opacity ease-in-out 500ms;
163 | }
164 |
165 | &.done:before {
166 | opacity: 1;
167 | }
168 | }
169 | }
170 |
171 | div.siteexport.mergehint {
172 |
173 | position: relative;
174 |
175 | span.mergehint {
176 | position: absolute;
177 | right: 100%;
178 | font-size: 90%;
179 | }
180 | }
181 |
182 | // Setup VIM: ex: et ts=4 enc=utf-8 :
183 |
--------------------------------------------------------------------------------
/syntax/aggregate.php:
--------------------------------------------------------------------------------
1 |
7 | * @author Gerry Weissbach
8 | */
9 |
10 | if (!defined('DOKU_INC')) die();
11 | if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
12 | require_once(DOKU_PLUGIN . 'syntax.php');
13 |
14 | /**
15 | * All DokuWiki plugins to extend the parser/rendering mechanism
16 | * need to inherit from this class
17 | */
18 | class syntax_plugin_siteexport_aggregate extends DokuWiki_Syntax_Plugin {
19 |
20 | private $headers = array();
21 |
22 | public function getType() { return 'substition'; }
23 | public function getPType() { return 'block'; }
24 | public function getSort() { return 300; }
25 |
26 | public function connectTo($mode) {
27 | // $this->Lexer->addSpecialPattern('\{\{(?=siteexport|siteexportAGGREGATOR).*?\}\}', $mode, 'plugin_siteexport_aggregate');
28 | $this->Lexer->addSpecialPattern('\{\{siteexportAGGREGATOR .*?\}\}', $mode, 'plugin_siteexport_aggregate');
29 | }
30 |
31 | public function handle($match, $state, $pos, Doku_Handler $handler) {
32 |
33 | $options = explode(' ', trim(substr($match, 2, -2)?:""));
34 |
35 | return $options;
36 | }
37 |
38 | private function checkComplete( &$item, $key, $namespaces ) {
39 | foreach( $namespaces as $namespace ) {
40 | if ( !(strpos($item[0], getNS($namespace)) > 0 || strpos($item[0], '|:' . getNS($namespace)) > 0) ) {
41 | $item[0] .= '|:' . $namespace;
42 | }
43 | }
44 | }
45 |
46 | public function render($mode, Doku_Renderer $renderer, $data) {
47 | global $ID, $conf;
48 |
49 | // $isAggregator = (array_shift($data) == 'siteexportAGGREGATOR');
50 | $isAggregator = true;
51 | $namespace = array();
52 | foreach( $data as $option ) {
53 |
54 | list($key, $value) = explode('=', $option);
55 | if ($key == "namespace") {
56 | $ns = $value;
57 | if ( substr($value, -1) != ':' ) {
58 | $ns .= ':';
59 | }
60 |
61 | // The following function wants an page but we only have an NS at this moment
62 | $ns .= 'index';
63 | $namespace[] = $ns;
64 | }
65 | }
66 |
67 | if ( empty($namespace) ) {
68 | $namespace[] = $ID;
69 | }
70 |
71 | if ($mode == 'xhtml'){
72 |
73 | $renderer->info['toc'] = false;
74 | $renderer->nocache();
75 |
76 | $formParams = array( 'id' => sectionID('siteexport_site_aggregator', $this->headers), 'action' => wl($ID), 'class' => 'siteexport aggregator' );
77 | $form = new Doku_Form($formParams);
78 | $functions=& plugin_load('helper', 'siteexport');
79 |
80 | $form->addHidden('ns', $ID);
81 | $form->addHidden('site', $ID);
82 |
83 | if ( $isAggregator ) {
84 | $form->addHidden('siteexport_aggregate', '1');
85 | }
86 |
87 | $submitLabel = $this->getLang('AggregateSubmitLabel');
88 | $introduction = $this->getLang('AggragateExportPages');
89 | $listAllNamespaces = false;
90 | foreach( $data as $option ) {
91 |
92 | list($key, $value) = explode('=', $option);
93 | switch ($key) {
94 | case "namespace":
95 | // Done at the top.
96 | break;
97 | case "buttonTitle":
98 | $submitLabel = urldecode($value);
99 | break;
100 | case "introduction":
101 | $introduction = urldecode($value);
102 | break;
103 | case "listAllNamespaces":
104 | $listAllNamespaces = boolval($value);
105 | break;
106 | default:
107 | $form->addHidden($key, $value);
108 | break;
109 | }
110 | }
111 |
112 | $values = array();
113 | $allNamespaces = $functions->__getOrderedListOfPagesForID( $listAllNamespaces ? $namespace : $namespace[0] );
114 |
115 | foreach( $allNamespaces as $ns ) {
116 | if ( !array_key_exists('_'.$ns[2], $values) ) {
117 | $values['_'.$ns[2]] = $ns;
118 | } else if ( !in_array($ns[0], $values['_'.$ns[2]][4]) ) {
119 | $values['_'.$ns[2]][0] .= '|' . $ns[0];
120 | }
121 | $values['_'.$ns[2]][4][] = $ns[0];
122 | }
123 |
124 | array_walk( $values, array( $this, 'checkComplete'), $namespace);
125 | $values = array_values($values);
126 |
127 | $renderer->doc .= '';
128 |
129 | if ( empty($values) ) {
130 | $renderer->doc .= ''.$this->getLang('NoEntriesFoundHint').' ';
131 | } else {
132 | $form->addElement(form_makeMenuField('baseID', $values, isset($_REQUEST['baseID']) ? $_REQUEST['baseID'] : $values[0], $introduction));
133 | $form->addElement(form_makeButton('submit', 'siteexport', $submitLabel, array('class' => 'button download')));
134 |
135 | ob_start();
136 | $form->printForm();
137 | $renderer->doc .= ob_get_contents();
138 | ob_end_clean();
139 | }
140 |
141 | $renderer->doc .= '
';
142 | return true;
143 | } else if ($mode == 'metadata') {
144 | $renderer->meta['siteexport']['hasaggregator'] = $isAggregator;
145 | $renderer->meta['siteexport']['baseID'] = implode('|', $namespace);
146 | }
147 |
148 | return false;
149 | }
150 | }
151 |
152 | //Setup VIM: ex: et ts=4 enc=utf-8 :
153 |
--------------------------------------------------------------------------------
/syntax/siteexport.php:
--------------------------------------------------------------------------------
1 |
7 | * @author Gerry Weissbach
8 | */
9 |
10 | if (!defined('DOKU_INC')) die();
11 | if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
12 | require_once(DOKU_PLUGIN . 'syntax.php');
13 |
14 | /**
15 | * All DokuWiki plugins to extend the parser/rendering mechanism
16 | * need to inherit from this class
17 | */
18 | class syntax_plugin_siteexport_siteexport extends DokuWiki_Syntax_Plugin {
19 |
20 | private $headers = array();
21 |
22 | public function getType() { return 'substition'; }
23 | public function getPType() { return 'block'; }
24 | public function getSort() { return 300; }
25 |
26 | public function connectTo($mode) {
27 | $this->Lexer->addSpecialPattern('\{\{siteexport .*?\}\}', $mode, 'plugin_siteexport_siteexport');
28 | }
29 |
30 | public function handle($match, $state, $pos, Doku_Handler $handler) {
31 |
32 | $options = explode(' ', trim(substr($match, 2, -2)?:""));
33 | return $options;
34 | }
35 |
36 | public function render($mode, Doku_Renderer $renderer, $data) {
37 | global $ID, $conf, $INFO;
38 |
39 | $namespace = $INFO['id'] != $ID ? $INFO['id'] : $ID;
40 | $id = $INFO['id'] != $ID ? $INFO['id'] : $ID;
41 |
42 | if ($mode == 'xhtml'){
43 |
44 | $renderer->info['toc'] = false;
45 | $renderer->nocache();
46 |
47 | $formParams = array( 'id' => sectionID('siteexport_siteexporter', $this->headers), 'action' => wl($id), 'class' => 'siteexport siteexporter' );
48 | $form = new Doku_Form($formParams);
49 |
50 | $form->addHidden('ns', $id);
51 | $form->addHidden('site', $id);
52 | $form->addHidden('baseID', $id);
53 |
54 | $submitLabel = $this->getLang('SiteSubmitLabel');
55 | foreach( $data as $option ) {
56 |
57 | list($key, $value) = explode('=', $option);
58 | switch ($key) {
59 | case "buttonTitle":
60 | $submitLabel = urldecode($value);
61 | break;
62 | default:
63 | $form->addHidden($key, $value);
64 | break;
65 | }
66 | }
67 |
68 | $renderer->doc .= '';
69 | $form->addElement(form_makeButton('submit', 'siteexport', $submitLabel, array('class' => 'button download')));
70 |
71 | ob_start();
72 | $form->printForm();
73 | $renderer->doc .= ob_get_contents();
74 | ob_end_clean();
75 |
76 | $renderer->doc .= '
';
77 | return false;
78 | } else if ($mode == 'metadata') {
79 | $renderer->meta['siteexport']['siteexporter'] = true;
80 | $renderer->meta['siteexport']['baseID'] = $namespace;
81 | }
82 |
83 | return false;
84 | }
85 | }
86 |
87 | //Setup VIM: ex: et ts=4 enc=utf-8 :
88 |
--------------------------------------------------------------------------------
/syntax/toctools.php:
--------------------------------------------------------------------------------
1 |
7 | * @author Gerry Weissbach
8 | */
9 |
10 | if (!defined('DOKU_INC')) define('DOKU_INC', /** @scrutinizer ignore-type */ realpath(dirname(__FILE__) . '/../../') . '/');
11 | if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
12 | require_once(DOKU_PLUGIN . 'syntax.php');
13 |
14 | /**
15 | * All DokuWiki plugins to extend the parser/rendering mechanism
16 | * need to inherit from this class
17 | */
18 | class syntax_plugin_siteexport_toctools extends DokuWiki_Syntax_Plugin {
19 |
20 | protected $special_pattern = '\r\n]*?/>';
21 | protected $entry_pattern = '(?=.*? )';
22 | protected $exit_pattern = ' ';
23 |
24 | private $checkArray = array();
25 |
26 | public function getType(){ return 'substition';}
27 | public function getAllowedTypes() { return array('container', 'formatting', 'substition', 'protected', 'disabled', 'paragraphs'); }
28 | public function getPType(){ return 'stack';}
29 | public function getSort(){ return 999; }
30 |
31 | /**
32 | * Connect pattern to lexer
33 | */
34 | public function connectTo($mode) {
35 | $this->Lexer->addSpecialPattern($this->special_pattern,$mode,'plugin_siteexport_toctools');
36 | $this->Lexer->addEntryPattern($this->entry_pattern,$mode,'plugin_siteexport_toctools');
37 | }
38 |
39 | public function postConnect() {
40 | $this->Lexer->addExitPattern($this->exit_pattern, 'plugin_siteexport_toctools');
41 | }
42 |
43 | private function findPreviousSectionOpen( Doku_Handler $handler ) {
44 | foreach( array_reverse( $handler->calls ) as $calls ) {
45 | if ( $calls[0] == 'section_open' ) {
46 | return $calls[1][0];
47 | }
48 | }
49 | return 1;
50 | }
51 |
52 | private function addInstructionstoHandler( $match, $state, $pos, Doku_Handler $handler, $instructions ) {
53 |
54 | // Switch for DW Hogfather+
55 | if ( ( method_exists( $handler, 'getStatus') && $handler->getStatus('section') ) || $handler->status['section'] ) {
56 | $handler->_addCall('section_close', array(), $pos);
57 | }
58 |
59 | // We need to add the current plugin first and then open the section again.
60 | $level = $this->findPreviousSectionOpen( $handler );
61 | $handler->_addCall('plugin', array('siteexport_toctools', $instructions, $state), $pos);
62 | $handler->_addCall('section_open', array($level), $pos+strlen($match) );
63 | }
64 |
65 | /**
66 | * Handle the match
67 | */
68 | public function handle($match, $state, $pos, Doku_Handler $handler){
69 | global $conf;
70 | switch ($state) {
71 | case DOKU_LEXER_ENTER:
72 | case DOKU_LEXER_SPECIAL:
73 | $data = trim(substr($match,strpos($match,' '),-1)," \t\n/");
74 | $this->addInstructionstoHandler( $match, $state, $pos, $handler, array('mergehint', 'start', $data, sectionID( $data, $this->checkArray ) ) );
75 | break;
76 | case DOKU_LEXER_UNMATCHED:
77 | $handler->_addCall('cdata', array($match), $pos);
78 | break;
79 | case DOKU_LEXER_EXIT:
80 | $this->addInstructionstoHandler( $match, $state, $pos, $handler, array('mergehint', 'end', 'syntax' ) );
81 | break;
82 | }
83 | return false;
84 | }
85 |
86 | /**
87 | * Create output
88 | */
89 | public function render($mode, Doku_Renderer $renderer, $data) {
90 |
91 | list( $type, $pos, $title, $id ) = $data;
92 | if ($mode == 'xhtml') {
93 | if ( $type == 'mergehint' ) {
94 |
95 | $startHint = '';
100 | $renderer->doc .= '' . $lastDiv;
101 | } else {
102 |
103 | // check if anything was inserted. We have to strip all tags,
104 | // we're just looking for real content here
105 | $lastPos = strrpos($renderer->doc, $lastDiv);
106 | if ( $lastPos !== false ) {
107 |
108 | $remaining = substr( $renderer->doc, $lastPos + strlen($lastDiv) );
109 | $remaining = strip_tags( $remaining );
110 | $remaining = trim($remaining);
111 | if ( strlen( $remaining ) == 0 ) {
112 | // empty
113 | $lastPos = strrpos($renderer->doc, $startHint);
114 | $renderer->doc = substr($renderer->doc, 0, $lastPos);
115 | return true;
116 | }
117 | }
118 |
119 | $renderer->doc .= '
';
120 | $renderer->doc .= '';
121 | }
122 | } else {
123 | $renderer->doc .= " ";
124 | }
125 | return true;
126 | } else if ( $mode = 'markdown' && $type == 'mergehint' && $pos == 'start' ) {
127 | $renderer->doc .= DOKU_LF . '##### ' . $title . DOKU_LF;
128 | return true;
129 | }
130 | return false;
131 | }
132 | }
133 |
134 | //Setup VIM: ex: et ts=4 enc=utf-8 :
--------------------------------------------------------------------------------