Element inheritance refinements
This commit is contained in:
parent
3ef0f41c25
commit
cd2dba0848
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Exception\InvalidImageException;
|
||||
use PhpOffice\PhpWord\Exception\InvalidObjectException;
|
||||
use PhpOffice\PhpWord\Media;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
|
|
@ -482,7 +481,6 @@ abstract class AbstractElement
|
|||
'table' => array('section', 'header', 'footer'),
|
||||
'footnote' => array('section', 'textrun', 'cell'),
|
||||
'preservetext' => array('header', 'footer', 'cell'),
|
||||
'relationid' => array('header', 'footer', 'footnote'),
|
||||
'title' => array('section'),
|
||||
);
|
||||
// Special condition, e.g. preservetext can only exists in cell when
|
||||
|
|
|
|||
|
|
@ -32,13 +32,6 @@ class Image extends AbstractElement
|
|||
*/
|
||||
private $style;
|
||||
|
||||
/**
|
||||
* Image relation ID specific only for DOCX
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $rId;
|
||||
|
||||
/**
|
||||
* Is watermark
|
||||
*
|
||||
|
|
@ -155,26 +148,6 @@ class Image extends AbstractElement
|
|||
return $this->style;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image relation ID
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRelationId()
|
||||
{
|
||||
return $this->rId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set image relation ID
|
||||
*
|
||||
* @param int $rId
|
||||
*/
|
||||
public function setRelationId($rId)
|
||||
{
|
||||
$this->rId = $rId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image source
|
||||
*
|
||||
|
|
|
|||
|
|
@ -31,13 +31,6 @@ class Link extends AbstractElement
|
|||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* Link Relation ID
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $relationId;
|
||||
|
||||
/**
|
||||
* Font style
|
||||
*
|
||||
|
|
@ -71,26 +64,6 @@ class Link extends AbstractElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Link Relation ID
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRelationId()
|
||||
{
|
||||
return $this->relationId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Link Relation ID
|
||||
*
|
||||
* @param int $rId
|
||||
*/
|
||||
public function setRelationId($rId)
|
||||
{
|
||||
$this->relationId = $rId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Link source
|
||||
*
|
||||
|
|
|
|||
|
|
@ -30,13 +30,6 @@ class Object extends AbstractElement
|
|||
*/
|
||||
private $style;
|
||||
|
||||
/**
|
||||
* Object Relation ID
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $relationId;
|
||||
|
||||
/**
|
||||
* Image Relation ID
|
||||
*
|
||||
|
|
@ -84,26 +77,6 @@ class Object extends AbstractElement
|
|||
return $this->source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Object Relation ID
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRelationId()
|
||||
{
|
||||
return $this->relationId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object Relation ID
|
||||
*
|
||||
* @param int $rId
|
||||
*/
|
||||
public function setRelationId($rId)
|
||||
{
|
||||
$this->relationId = $rId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Image Relation ID
|
||||
*
|
||||
|
|
|
|||
|
|
@ -90,7 +90,10 @@ abstract class AbstractReader implements ReaderInterface
|
|||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
fclose($this->fileHandle);
|
||||
if (is_resource($this->fileHandle)) {
|
||||
fclose($this->fileHandle);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ class Template
|
|||
* @param string $blockname
|
||||
* @param integer $clones
|
||||
* @param boolean $replace
|
||||
* @return null
|
||||
* @return string|null
|
||||
*/
|
||||
public function cloneBlock($blockname, $clones = 1, $replace = true)
|
||||
{
|
||||
|
|
@ -263,7 +263,6 @@ class Template
|
|||
* Delete a block of text
|
||||
*
|
||||
* @param string $blockname
|
||||
* @param string $replacement
|
||||
*/
|
||||
public function deleteBlock($blockname)
|
||||
{
|
||||
|
|
@ -317,7 +316,7 @@ class Template
|
|||
*
|
||||
* @param string $documentPartXML
|
||||
* @param string $search
|
||||
* @param mixed $replace
|
||||
* @param string $replace
|
||||
* @param integer $limit
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -335,16 +334,10 @@ class Template
|
|||
$search = '${' . $search . '}';
|
||||
}
|
||||
|
||||
if (!is_array($replace)) {
|
||||
if (!String::isUTF8($replace)) {
|
||||
$replace = utf8_encode($replace);
|
||||
}
|
||||
$replace = htmlspecialchars($replace);
|
||||
} else {
|
||||
foreach ($replace as $key => $value) {
|
||||
$replace[$key] = htmlspecialchars($value);
|
||||
}
|
||||
if (!String::isUTF8($replace)) {
|
||||
$replace = utf8_encode($replace);
|
||||
}
|
||||
$replace = htmlspecialchars($replace);
|
||||
|
||||
$regExpDelim = '/';
|
||||
$escapedSearch = preg_quote($search, $regExpDelim);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ namespace PhpOffice\PhpWord\Writer;
|
|||
|
||||
use PhpOffice\PhpWord\Exception\Exception;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Settings;
|
||||
use PhpOffice\PhpWord\Writer\ODText\Content;
|
||||
use PhpOffice\PhpWord\Writer\ODText\Manifest;
|
||||
use PhpOffice\PhpWord\Writer\ODText\Meta;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\ODText;
|
||||
|
||||
use PhpOffice\PhpWord\Exception\Exception;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue