Skip to content

Commit 0e08986

Browse files
committed
2 parents 1370174 + 3b8afe3 commit 0e08986

File tree

5 files changed

+38
-27
lines changed

5 files changed

+38
-27
lines changed

helper/csscolors.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class helper_plugin_odt_csscolors extends DokuWiki_Plugin {
158158
protected static $names = array(
159159
'#F0F8FF' => 'AliceBlue',
160160
'#FAEBD7' => 'AntiqueWhite',
161-
'#00FFFF' => 'Aqua',
161+
// '#00FFFF' => 'Aqua', //duplicated key with Cyan
162162
'#7FFFD4' => 'Aquamarine',
163163
'#F0FFFF' => 'Azure',
164164
'#F5F5DC' => 'Beige',
@@ -201,7 +201,7 @@ class helper_plugin_odt_csscolors extends DokuWiki_Plugin {
201201
'#B22222' => 'FireBrick',
202202
'#FFFAF0' => 'FloralWhite',
203203
'#228B22' => 'ForestGreen',
204-
'#FF00FF' => 'Fuchsia',
204+
//'#FF00FF' => 'Fuchsia', //duplicated key with Magenta
205205
'#DCDCDC' => 'Gainsboro',
206206
'#F8F8FF' => 'GhostWhite',
207207
'#FFD700' => 'Gold',
@@ -222,7 +222,7 @@ class helper_plugin_odt_csscolors extends DokuWiki_Plugin {
222222
'#ADD8E6' => 'LightBlue',
223223
'#F08080' => 'LightCoral',
224224
'#E0FFFF' => 'LightCyan',
225-
'#E0FFFF' => 'LightGoldenRodYellow',
225+
//'#E0FFFF' => 'LightGoldenRodYellow', //duplicated key with LightCyan
226226
'#D3D3D3' => 'LightGray',
227227
'#90EE90' => 'LightGreen',
228228
'#FFB6C1' => 'LightPink',

helper/cssimport.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,6 @@ protected function explodeBorderShorthand (&$decls) {
420420
}
421421
if ( $border_color_set === false ) {
422422
$decls [] = new css_declaration ('border-color', $values [$index]);
423-
$border_color_set = true;
424-
$index++;
425423

426424
// This is the last value.
427425
break;
@@ -1178,7 +1176,7 @@ function loadReplacements($filename) {
11781176
// Find the start of the replacements section
11791177
$rep_start = strpos ($contents, '[replacements]');
11801178
if ( $rep_start === false ) {
1181-
break;
1179+
return false;
11821180
}
11831181
$rep_start += strlen ('[replacements]');
11841182

@@ -1203,7 +1201,7 @@ function loadReplacements($filename) {
12031201

12041202
$lineend = strpos ($defs, "\n", $linestart);
12051203
if ( $lineend === false ) {
1206-
$lineend = $def_end;
1204+
$lineend = $defs_end;
12071205
}
12081206

12091207
$equal_sign = strpos ($defs, '=', $linestart);

helper/stylefactory.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,11 @@ public static function createTextStyle(&$style, $properties, $disabled_props = N
169169

170170
// Replace sub and super with text-position.
171171
$odt_valign = $properties ['vertical-align'];
172-
unset($odt_text_pos);
172+
$odt_text_pos = '';
173173
if ( $odt_valign == 'sub' ) {
174174
$odt_text_pos = '-33% 100%';
175175
unset($odt_valign);
176-
}
177-
if ( $odt_valign == 'super' ) {
176+
} elseif ( $odt_valign == 'super' ) {
178177
$odt_text_pos = '33% 100%';
179178
unset($odt_valign);
180179
}
@@ -199,7 +198,6 @@ public static function createTextStyle(&$style, $properties, $disabled_props = N
199198
// (Except style-name, already inserted above)
200199
$header = '';
201200
$text = '';
202-
$paragraph = '';
203201
foreach ($properties as $property => $value) {
204202
if ( empty ($disabled_props [$property]) && !empty ($properties [$property]) ) {
205203
$name = $params [$property]['name'];
@@ -318,12 +316,11 @@ public static function createParagraphStyle(&$style, $properties, $disabled_prop
318316

319317
// Replace sub and super with text-position.
320318
$odt_valign = $properties ['vertical-align'];
321-
unset($odt_text_pos);
319+
$odt_text_pos = '';
322320
if ( $odt_valign == 'sub' ) {
323321
$odt_text_pos = '-33% 100%';
324322
unset($odt_valign);
325-
}
326-
if ( $odt_valign == 'super' ) {
323+
} elseif ( $odt_valign == 'super' ) {
327324
$odt_text_pos = '33% 100%';
328325
unset($odt_valign);
329326
}

plugin.info.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
base odt
22
author Andreas Gohr, Aurelien Bompard, Florian Lamml, LarsDW223
33
email andi@splitbrain.org, aurelien@bompard.org, infor@florian-lamml.de
4-
date 2015-06-08
4+
date 2015-06-10
55
name Open Document Plugin
66
desc Export the current Wiki page to a OpenOffice ODT file
77
url http://www.dokuwiki.org/plugin:odt

renderer.php

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* The Renderer
2727
*/
2828
class renderer_plugin_odt extends Doku_Renderer {
29+
/** @var helper_plugin_odt_stylefactory */
2930
var $factory = null;
3031
/** @var helper_plugin_odt_cssimport */
3132
var $import = null;
@@ -1195,7 +1196,7 @@ function doublequoteclosing() {
11951196
*
11961197
* @param string $text The PHP code
11971198
*/
1198-
function php($text, $wrapper='dummy') {
1199+
function php($text) {
11991200
$this->monospace_open();
12001201
$this->doc .= $this->_xmlEntities($text);
12011202
$this->monospace_close();
@@ -1215,7 +1216,7 @@ function phpblock($text) {
12151216
*
12161217
* @param string $text The HTML
12171218
*/
1218-
function html($text, $wrapper='dummy') {
1219+
function html($text) {
12191220
$this->monospace_open();
12201221
$this->doc .= $this->_xmlEntities($text);
12211222
$this->monospace_close();
@@ -1639,19 +1640,19 @@ function _getLinkTitle($title, $default, & $isImage, $id=null) {
16391640
global $conf;
16401641

16411642
$isImage = false;
1642-
if ( is_null($title) ) {
1643+
if (is_null($title) || trim($title) == '') {
16431644
if ($conf['useheading'] && $id) {
16441645
$heading = p_get_first_heading($id);
16451646
if ($heading) {
16461647
return $this->_xmlEntities($heading);
16471648
}
16481649
}
16491650
return $this->_xmlEntities($default);
1650-
} else if ( is_string($title) ) {
1651-
return $this->_xmlEntities($title);
16521651
} else if ( is_array($title) ) {
16531652
$isImage = true;
16541653
return $title;
1654+
} else {
1655+
return $this->_xmlEntities($title);
16551656
}
16561657
}
16571658

@@ -1707,6 +1708,7 @@ function rss ($url,$params){
17071708
$feed->feed_url($url);
17081709

17091710
//disable warning while fetching
1711+
$elvl = null;
17101712
if (!defined('DOKU_E_LEVEL')) { $elvl = error_reporting(E_ERROR); }
17111713
$rc = $feed->init();
17121714
if (!defined('DOKU_E_LEVEL')) { error_reporting($elvl); }
@@ -1827,10 +1829,12 @@ function _addStringAsSVGImage($string, $width = NULL, $height = NULL, $align = N
18271829
* in the odt frame and image tag which can not be changed using the function _odtAddImage.
18281830
*
18291831
* @author LarsDW223
1832+
*
18301833
* @param string $src
18311834
* @return string
18321835
*/
18331836
function _odtAddImageAsFileOnly($src){
1837+
$name = '';
18341838
if (file_exists($src)) {
18351839
list($ext,$mime) = mimetype($src);
18361840
$name = 'Pictures/'.md5($src).'.'.$ext;
@@ -2106,6 +2110,8 @@ function _odtParagraphOpenUseCSSStyle($style, $baseURL = NULL){
21062110
* The paragraph must be closed by calling 'p_close'.
21072111
*
21082112
* @author LarsDW223
2113+
*
2114+
* @param array $properties
21092115
*/
21102116
function _odtParagraphOpenUseProperties($properties){
21112117
$disabled = array ();
@@ -2154,6 +2160,7 @@ function _odtParagraphOpenUseProperties($properties){
21542160
* The div should be closed by calling '_odtDivCloseAsFrame'.
21552161
*
21562162
* @author LarsDW223
2163+
*
21572164
* @param helper_plugin_odt_cssimport $import
21582165
* @param $classes
21592166
* @param null $baseURL
@@ -2197,6 +2204,9 @@ function _odtDivOpenAsFrameUseCSS (helper_plugin_odt_cssimport $import, $classes
21972204

21982205
$min_height = $properties ['min-height'];
21992206

2207+
$pic_link = '';
2208+
$pic_width = '';
2209+
$pic_height = '';
22002210
if ( !empty ($picture) ) {
22012211
// If a picture/background-image is set in the CSS, than we insert it manually here.
22022212
// This is a workaround because ODT does not support the background-image attribute in a span.
@@ -2744,6 +2754,10 @@ protected function _odtTableCellOpenUsePropertiesInternal ($properties, $inHeade
27442754
* Simple helper function for creating a style $name setting the specfied font size $size.
27452755
*
27462756
* @author LarsDW223
2757+
*
2758+
* @param string $name
2759+
* @param string $size
2760+
* @return string
27472761
*/
27482762
protected function _odtBuildSizeStyle ($name, $size) {
27492763
$style = '<style:style style:name="'.$name.'" style:display-name="'.$name.'" style:family="text"><style:text-properties fo:font-size="'.$size.'" style:font-size-asian="'.$size.'" style:font-size-complex="'.$size.'"/></style:style>';
@@ -2766,7 +2780,7 @@ protected function _odtBuildSizeStyle ($name, $size) {
27662780
*
27672781
* @param array $properties
27682782
* @param array $disabled_props
2769-
* @return null
2783+
* @return null|string
27702784
*/
27712785
protected function _createTextStyle($properties, $disabled_props = NULL){
27722786
$save = $disabled_props ['font-size'];
@@ -2775,7 +2789,7 @@ protected function _createTextStyle($properties, $disabled_props = NULL){
27752789
if ( empty ($disabled_props ['font-size']) ) {
27762790
$odt_fo_size = $properties ['font-size'];
27772791
}
2778-
unset ($parent);
2792+
$parent = '';
27792793
$length = strlen ($odt_fo_size);
27802794
if ( $length > 0 && $odt_fo_size [$length-1] == '%' ) {
27812795
// A font-size in percent is only supported in common style definitions, not in automatic
@@ -2816,7 +2830,7 @@ protected function _createParagraphStyle($properties, $disabled_props = NULL){
28162830
if ( empty ($disabled_props ['font-size']) ) {
28172831
$odt_fo_size = $properties ['font-size'];
28182832
}
2819-
unset ($parent);
2833+
$parent = '';
28202834
$length = strlen ($odt_fo_size);
28212835
if ( $length > 0 && $odt_fo_size [$length-1] == '%' ) {
28222836
// A font-size in percent is only supported in common style definitions, not in automatic
@@ -2957,6 +2971,8 @@ function _odtCloseMultiColumnFrame () {
29572971
* The div should be closed by calling '_odtDivCloseAsFrame'.
29582972
*
29592973
* @author LarsDW223
2974+
*
2975+
* @param array $properties
29602976
*/
29612977
function _odtOpenTextBoxUseProperties ($properties) {
29622978
$this->in_div_as_frame++;
@@ -2990,6 +3006,9 @@ function _odtOpenTextBoxUseProperties ($properties) {
29903006
$width = $properties ['width'];
29913007
$horiz_pos = $properties ['float'];
29923008

3009+
$pic_link = '';
3010+
$pic_width = '';
3011+
$pic_height = '';
29933012
if ( !empty ($picture) ) {
29943013
// If a picture/background-image is set in the CSS, than we insert it manually here.
29953014
// This is a workaround because ODT does not support the background-image attribute in a span.
@@ -3013,9 +3032,6 @@ function _odtOpenTextBoxUseProperties ($properties) {
30133032
$min_height = '1pt';
30143033
}
30153034

3016-
// For safety, init width_abs with value for 100%
3017-
$width_abs = $this->_getAbsWidthMindMargins (100);
3018-
30193035
// Different handling for relative and absolute size...
30203036
if ( $width [strlen($width)-1] == '%' ) {
30213037
// Convert percentage values to absolute size, respecting page margins
@@ -3184,7 +3200,7 @@ public function getCSSProperties (&$dest, $element, $classString, $inlineStyle)
31843200
}
31853201

31863202
/**
3187-
* @param $dest
3203+
* @param array $dest
31883204
* @param $element
31893205
* @param $classString
31903206
* @param $inlineStyle

0 commit comments

Comments
 (0)