Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions src/PhpWord/Element/Bookmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace PhpOffice\PhpWord\Element;

use PhpOffice\PhpWord\Shared\String;
use PhpOffice\PhpWord\Shared\SharedString;
use PhpOffice\PhpWord\Style;

/**
Expand Down Expand Up @@ -47,7 +47,7 @@ class Bookmark extends AbstractElement
public function __construct($name)
{

$this->name = String::toUTF8($name);
$this->name = SharedString::toUTF8($name);
return $this;
}

Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Element/CheckBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace PhpOffice\PhpWord\Element;

use PhpOffice\PhpWord\Shared\String;
use PhpOffice\PhpWord\Shared\SharedString;

/**
* Check box element
Expand Down Expand Up @@ -56,7 +56,7 @@ public function __construct($name = null, $text = null, $fontStyle = null, $para
*/
public function setName($name)
{
$this->name = String::toUTF8($name);
$this->name = SharedString::toUTF8($name);

return $this;
}
Expand Down
6 changes: 3 additions & 3 deletions src/PhpWord/Element/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace PhpOffice\PhpWord\Element;

use PhpOffice\PhpWord\Shared\String;
use PhpOffice\PhpWord\Shared\SharedString;
use PhpOffice\PhpWord\Style\Font;
use PhpOffice\PhpWord\Style\Paragraph;

Expand Down Expand Up @@ -78,8 +78,8 @@ class Link extends AbstractElement
*/
public function __construct($source, $text = null, $fontStyle = null, $paragraphStyle = null, $internal = false)
{
$this->source = String::toUTF8($source);
$this->text = is_null($text) ? $this->source : String::toUTF8($text);
$this->source = SharedString::toUTF8($source);
$this->text = is_null($text) ? $this->source : SharedString::toUTF8($text);
$this->fontStyle = $this->setNewStyle(new Font('text'), $fontStyle);
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);
$this->internal = $internal;
Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Element/ListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace PhpOffice\PhpWord\Element;

use PhpOffice\PhpWord\Shared\String;
use PhpOffice\PhpWord\Shared\SharedString;
use PhpOffice\PhpWord\Style\ListItem as ListItemStyle;

/**
Expand Down Expand Up @@ -57,7 +57,7 @@ class ListItem extends AbstractElement
*/
public function __construct($text, $depth = 0, $fontStyle = null, $listStyle = null, $paragraphStyle = null)
{
$this->textObject = new Text(String::toUTF8($text), $fontStyle, $paragraphStyle);
$this->textObject = new Text(SharedString::toUTF8($text), $fontStyle, $paragraphStyle);
$this->depth = $depth;

// Version >= 0.10.0 will pass numbering style name. Older version will use old method
Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Element/PreserveText.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace PhpOffice\PhpWord\Element;

use PhpOffice\PhpWord\Shared\String;
use PhpOffice\PhpWord\Shared\SharedString;
use PhpOffice\PhpWord\Style\Font;
use PhpOffice\PhpWord\Style\Paragraph;

Expand Down Expand Up @@ -61,7 +61,7 @@ public function __construct($text = null, $fontStyle = null, $paragraphStyle = n
$this->fontStyle = $this->setNewStyle(new Font('text'), $fontStyle);
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);

$this->text = String::toUTF8($text);
$this->text = SharedString::toUTF8($text);
$matches = preg_split('/({.*?})/', $this->text, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
if (isset($matches[0])) {
$this->text = $matches;
Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Element/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace PhpOffice\PhpWord\Element;

use PhpOffice\PhpWord\Shared\String;
use PhpOffice\PhpWord\Shared\SharedString;
use PhpOffice\PhpWord\Style\Font;
use PhpOffice\PhpWord\Style\Paragraph;

Expand Down Expand Up @@ -136,7 +136,7 @@ public function getParagraphStyle()
*/
public function setText($text)
{
$this->text = String::toUTF8($text);
$this->text = SharedString::toUTF8($text);

return $this;
}
Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Element/Title.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace PhpOffice\PhpWord\Element;

use PhpOffice\PhpWord\Shared\String;
use PhpOffice\PhpWord\Shared\SharedString;
use PhpOffice\PhpWord\Style;

/**
Expand Down Expand Up @@ -61,7 +61,7 @@ class Title extends AbstractElement
*/
public function __construct($text, $depth = 1)
{
$this->text = String::toUTF8($text);
$this->text = SharedString::toUTF8($text);
$this->depth = $depth;
if (array_key_exists("Heading_{$this->depth}", Style::getStyles())) {
$this->style = "Heading{$this->depth}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* Common string functions
*/
class String
class SharedString
{
/**
* Control characters array
Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Style/AbstractStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace PhpOffice\PhpWord\Style;

use PhpOffice\PhpWord\Shared\String;
use PhpOffice\PhpWord\Shared\SharedString;

/**
* Abstract style class
Expand Down Expand Up @@ -161,7 +161,7 @@ public function setStyleValue($key, $value)
if (isset($this->aliases[$key])) {
$key = $this->aliases[$key];
}
$method = 'set' . String::removeUnderscorePrefix($key);
$method = 'set' . SharedString::removeUnderscorePrefix($key);
if (method_exists($this, $method)) {
$this->$method($value);
}
Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Style/Paragraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace PhpOffice\PhpWord\Style;

use PhpOffice\PhpWord\Exception\InvalidStyleException;
use PhpOffice\PhpWord\Shared\String;
use PhpOffice\PhpWord\Shared\SharedString;

/**
* Paragraph style
Expand Down Expand Up @@ -169,7 +169,7 @@ class Paragraph extends Border
*/
public function setStyleValue($key, $value)
{
$key = String::removeUnderscorePrefix($key);
$key = SharedString::removeUnderscorePrefix($key);
if ($key == 'indent' || $key == 'hanging') {
$value = $value * 720;
} elseif ($key == 'spacing') {
Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/TemplateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use PhpOffice\PhpWord\Exception\CopyFileException;
use PhpOffice\PhpWord\Exception\CreateTemporaryFileException;
use PhpOffice\PhpWord\Exception\Exception;
use PhpOffice\PhpWord\Shared\String;
use PhpOffice\PhpWord\Shared\SharedString;
use PhpOffice\PhpWord\Shared\ZipArchive;

class TemplateProcessor
Expand Down Expand Up @@ -403,7 +403,7 @@ protected function setValueForPart($documentPartXML, $search, $replace, $limit)
$search = '${' . $search . '}';
}

if (!String::isUTF8($replace)) {
if (!SharedString::isUTF8($replace)) {
$replace = utf8_encode($replace);
}

Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Writer/RTF/Element/AbstractElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace PhpOffice\PhpWord\Writer\RTF\Element;

use PhpOffice\PhpWord\Shared\String;
use PhpOffice\PhpWord\Shared\SharedString;
use PhpOffice\PhpWord\Style\Font as FontStyle;
use PhpOffice\PhpWord\Style;
use PhpOffice\PhpWord\Style\Paragraph as ParagraphStyle;
Expand Down Expand Up @@ -112,7 +112,7 @@ protected function writeOpening()
*/
protected function writeText($text)
{
return String::toUnicode($text);
return SharedString::toUnicode($text);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/PhpWord/Writer/Word2007/Element/AbstractElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace PhpOffice\PhpWord\Writer\Word2007\Element;

use PhpOffice\PhpWord\Element\AbstractElement as Element;
use PhpOffice\PhpWord\Shared\String;
use PhpOffice\PhpWord\Shared\SharedString;
use PhpOffice\PhpWord\Shared\XMLWriter;

/**
Expand Down Expand Up @@ -167,6 +167,6 @@ private function writeTextStyle($styleType)
*/
protected function getText($text)
{
return String::controlCharacterPHP2OOXML($text);
return SharedString::controlCharacterPHP2OOXML($text);
}
}