Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions ODT/ODTImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,13 @@ static protected function importOrderedListStyles(ODTInternalParams $params, css
$paddingLeft = 0;
if ( isset($properties ['padding-left']) ) {
$paddingLeft = $params->units->toCentimeters($properties ['padding-left'], 'y');
$paddingLeft = substr($paddingLeft, 0, -2);
$paddingLeft = trim($paddingLeft, 'cm');
}
}
$marginLeft = 1;
if ( isset($li_properties ['margin-left']) ) {
$marginLeft = $params->units->toCentimeters($li_properties ['margin-left'], 'y');
$marginLeft = substr($marginLeft, 0, -2);
$marginLeft = trim($marginLeft, 'cm');
}
// Set list params.
$params->document->setOrderedListParams($level, $listAlign, $paddingLeft, $marginLeft);
Expand All @@ -308,7 +308,7 @@ static protected function importOrderedListStyles(ODTInternalParams $params, css
// (see replaceURLPrefixes)
$file = $properties ['list-style-image'];

$this->setListStyleImage ($params, $style, $level, $file);
self::setListStyleImage ($params, $style, $level, $file);
}

// Workaround for ODT format:
Expand Down Expand Up @@ -433,13 +433,13 @@ static protected function importUnorderedListStyles(ODTInternalParams $params, c
$paddingLeft = 0;
if (isset($properties ['padding-left'])) {
$paddingLeft = $params->units->toCentimeters($properties ['padding-left'], 'y');
$paddingLeft = substr($paddingLeft, 0, -2);
$paddingLeft = trim($paddingLeft, 'cm');
}
}
$marginLeft = 1;
if (isset($li_properties ['margin-left'])) {
$marginLeft = $params->units->toCentimeters($li_properties ['margin-left'], 'y');
$marginLeft = substr($marginLeft, 0, -2);
$marginLeft = trim($marginLeft, 'cm');
}
// Set list params.
$params->document->setUnorderedListParams($level, $listAlign, $paddingLeft, $marginLeft);
Expand All @@ -455,7 +455,7 @@ static protected function importUnorderedListStyles(ODTInternalParams $params, c
}
$file = $media_path.$file;*/

$this->setListStyleImage ($params, $style, $level, $file);
self::setListStyleImage ($params, $style, $level, $file);
}

// Workaround for ODT format:
Expand Down Expand Up @@ -529,17 +529,18 @@ static protected function importTableStyles(ODTInternalParams $params, cssdocume
// If the style imported is a table adjust some properties
if ($style->getFamily() == 'table') {
// Move 'width' to 'rel-width' if it is relative
$width = $properties ['width'];
if (isset($width)) {
if (isset($properties ['width'])) {
$width = $properties ['width'];
if (!isset($properties ['align'])) {
// If width is set but align not, changing the width
// will not work. So we set it here if not done by the user.
$properties ['align'] = 'center';
}
}
if ($width [strlen($width)-1] == '%') {
$properties ['rel-width'] = $width;
unset ($properties ['width']);

if ($width [strlen($width)-1] == '%') {
$properties ['rel-width'] = $width;
unset ($properties ['width']);
}
}

// Convert property 'border-model' to ODT
Expand Down
8 changes: 7 additions & 1 deletion ODT/ODTUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,13 @@ public static function getImageSize($src, $maxwidth=NULL, $maxheight=NULL){
$info = getimagesize($src);
} else {
// FIXME: Add cache support for downloaded images.
$fetch = (new DokuHTTPClient())->get($src);
if (class_exists('dokuwiki\HTTP\DokuHTTPClient')) {
$http = new dokuwiki\HTTP\DokuHTTPClient();
} else {
$http = new DokuHTTPClient();
}
$fetch = @$http->get($src);
var_dump($fetch);
if(!$fetch) {
return array(0, 0);
}
Expand Down
2 changes: 1 addition & 1 deletion ODT/css/cssimportnew.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function matches (array $attributes=NULL) {
// Attribute value should contain
// a word starting with $this->value
$length = strlen ($this->value);
if (strncmp($attributes [$this->attribute], $this->value, $length) == 0) {
if (isset($attributes[$this->attribute]) && strncmp($attributes [$this->attribute], $this->value, $length) == 0) {
return true;
}
break;
Expand Down
9 changes: 7 additions & 2 deletions helper/dwcssloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,13 @@ public function load($plugin_name, $format, $template) {
$styleini = css_styleini($template);
} else {
// Greebo functionality
$styleUtils = new \dokuwiki\StyleUtils();
$styleini = $styleUtils->cssStyleini($template);
$this->config = plugin_load('helper', 'odt_config');
if($this->config->getParam('css_usage') !== "off (plugins only)") {
$styleUtils = new \dokuwiki\StyleUtils($template);
} else {
$styleUtils = new \dokuwiki\StyleUtils();
}
$styleini = $styleUtils->cssStyleini($template); // older versions need still the template
}

$template_files = array();
Expand Down