function docx_get($src, $type = 'norm', $re = false) { return Docx::get($src, $type, $re); }
} $result = $file; }, scandir(Path::theme($folder))); if (!$result) { return false; } return Path::theme($folder . $result); }, array($fdata['path']), isset($_GET['re'])); $ans = array('src' => $isrc); if (!$src) { if (!Load::isphp()) { header('HTTP/1.0 404 Not Found'); } return; } $fdata = Load::srcInfo($src); if (in_array($fdata['ext'], array('docx'))) { $txt = Docx::get($src); return Ans::txt($txt); } if (in_array($fdata['ext'], array('mht'))) { $txt = Mht::get($src); return Ans::txt($txt); } if (in_array($fdata['ext'], array('tpl', 'html', 'htm', 'php'))) { $txt = Load::loadTEXT($src); return Ans::txt($txt); } if (!Load::isphp()) { header('HTTP/1.0 400 Bad Request'); }
<?php namespace infrajs\doc; use infrajs\access\Access; use infrajs\ans\Ans; use infrajs\path\Path; if (!is_file('vendor/autoload.php')) { chdir('../../../../'); require_once 'vendor/autoload.php'; } $ans = array(); Access::test(true); $text = Docx::get('-test-akiyatkin/resources/test.docx'); if (!$text || mb_strlen($text) != 1048) { return Ans::err($ans, 'Cant read file .docx mb_strlen ' . mb_strlen($text)); } $preview = Docx::preview('-test-akiyatkin/resources/test.docx'); if (sizeof($preview) != 12) { return Ans::err($ans, 'Cant read preview test.docx ' . sizeof($preview)); } if (sizeof($preview['links']) != 4) { return Ans::err($ans, 'Cant read links test.docx'); } if (sizeof($preview['images']) != 1) { return Ans::err($ans, 'Cant read images test.docx'); } if (mb_strlen($preview['preview']) != 119) { return Ans::err($ans, 'Cant read test.docx preview ' . mb_strlen($preview['preview'])); } $name = 'test.tpl';