From a0e8b431938cd169d571ed45f2eac69364727b1e Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Tue, 25 Mar 2014 17:00:07 +0400 Subject: [PATCH] https://github.com/PHPOffice/PHPWord/issues/58 - "\PhpOffice\PhpWord\Shared\File" class was cut out. --- src/PhpWord/Reader/Word2007.php | 3 +- src/PhpWord/Shared/File.php | 77 -------------------- src/PhpWord/Writer/ODText/Manifest.php | 3 +- src/PhpWord/Writer/Word2007/ContentTypes.php | 3 +- tests/PhpWord/Tests/Shared/FileTest.php | 42 ----------- 5 files changed, 3 insertions(+), 125 deletions(-) delete mode 100755 src/PhpWord/Shared/File.php delete mode 100644 tests/PhpWord/Tests/Shared/FileTest.php diff --git a/src/PhpWord/Reader/Word2007.php b/src/PhpWord/Reader/Word2007.php index 4eca69db..f76f2e48 100644 --- a/src/PhpWord/Reader/Word2007.php +++ b/src/PhpWord/Reader/Word2007.php @@ -28,7 +28,6 @@ namespace PhpOffice\PhpWord\Reader; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\DocumentProperties; use PhpOffice\PhpWord\Exceptions\Exception; -use PhpOffice\PhpWord\Shared\File; /** * Reader for Word2007 @@ -87,7 +86,7 @@ class Word2007 extends AbstractReader implements IReader if (strpos($fileName, '//') !== false) { $fileName = substr($fileName, strpos($fileName, '//') + 1); } - $fileName = File::realpath($fileName); + $fileName = realpath($fileName); // Apache POI fixes $contents = $archive->getFromName($fileName); diff --git a/src/PhpWord/Shared/File.php b/src/PhpWord/Shared/File.php deleted file mode 100755 index 90309a1b..00000000 --- a/src/PhpWord/Shared/File.php +++ /dev/null @@ -1,77 +0,0 @@ - 0) { - unset($pathArray[$i]); - unset($pathArray[$i - 1]); - break; - } - } - } - $returnValue = implode('/', $pathArray); - } - - // Return - return $returnValue; - } -} diff --git a/src/PhpWord/Writer/ODText/Manifest.php b/src/PhpWord/Writer/ODText/Manifest.php index a7071810..e19bcb18 100755 --- a/src/PhpWord/Writer/ODText/Manifest.php +++ b/src/PhpWord/Writer/ODText/Manifest.php @@ -27,7 +27,6 @@ namespace PhpOffice\PhpWord\Writer\ODText; use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\PhpWord; -use PhpOffice\PhpWord\Shared\File; use PhpOffice\PhpWord\Shared\XMLWriter; /** @@ -123,7 +122,7 @@ class Manifest extends WriterPart */ private function _getImageMimeType($pFile = '') { - if (File::fileExists($pFile)) { + if (file_exists($pFile)) { $image = getimagesize($pFile); return image_type_to_mime_type($image[2]); } else { diff --git a/src/PhpWord/Writer/Word2007/ContentTypes.php b/src/PhpWord/Writer/Word2007/ContentTypes.php index 2f6ab4e1..0d61dfcb 100755 --- a/src/PhpWord/Writer/Word2007/ContentTypes.php +++ b/src/PhpWord/Writer/Word2007/ContentTypes.php @@ -26,7 +26,6 @@ namespace PhpOffice\PhpWord\Writer\Word2007; use PhpOffice\PhpWord\Exceptions\Exception; -use PhpOffice\PhpWord\Shared\File; use PhpOffice\PhpWord\Shared\XMLWriter; /** @@ -189,7 +188,7 @@ class ContentTypes extends WriterPart */ private function _getImageMimeType($pFile = '') { - if (File::fileExists($pFile)) { + if (file_exists($pFile)) { $image = getimagesize($pFile); return image_type_to_mime_type($image[2]); } else { diff --git a/tests/PhpWord/Tests/Shared/FileTest.php b/tests/PhpWord/Tests/Shared/FileTest.php deleted file mode 100644 index 83764748..00000000 --- a/tests/PhpWord/Tests/Shared/FileTest.php +++ /dev/null @@ -1,42 +0,0 @@ -assertTrue(File::fileExists('blank.docx')); - } - /** - * Test file_exists() - */ - public function testNoFileExists() - { - $dir = __DIR__ . "/../_files/templates"; - chdir($dir); - $this->assertFalse(File::fileExists('404.docx')); - } - - /** - * Test realpath() - */ - public function testRealpath() - { - $dir = realpath(__DIR__ . "/../_files/templates"); - chdir($dir); - $file = 'blank.docx'; - $expected = $dir . \DIRECTORY_SEPARATOR . $file; - $this->assertEquals($expected, File::realpath($file)); - } -}