This commit is contained in:
wangjinlei
2024-07-17 09:23:45 +08:00
parent edf9deeb1a
commit 881ac3e056
1001 changed files with 41032 additions and 5452 deletions

View File

@@ -5,6 +5,7 @@ namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Queue;
use think\Env;
use think\Validate;
class Email extends Controller
@@ -192,6 +193,46 @@ class Email extends Controller
}
public function pushEmailForBMEC(){
// $a = readExcel("/home/wwwroot/api.tmrjournals.com/public/system/1.xlsx");
// $a = readExcel("D:/1.xlsx");
$a[] = ["wangjinlei","testtesttest","13662001490@126.com"];
$a[] = ["wangjinlei1","testtesttest1","751475802@qq.com"];
$journal_info = $this->journal_obj->where("journal_id",23)->find();
// $email = "1300364247@qq.com";
// $email = "751475802@qq.com";
foreach ($a as $k=>$v){
$content = "Dear Dr. ".trim($v['0']).",<br/><br/>";
$content .= 'We recently read your article "'.trim($v[1]).'", and we consider your research interests and expertise to be aligned well with the scope of the journal Biomedical Engineering Communications(https://www.tmrjournals.com/bmec/).<br/><br/>';
$content .= "Thus, on behalf of the editorial team of BMEC, we would like to invite you to publish a feature paper in BMEC, and please note that standard article processing charge of 0 CHF.<br/><br/>";
$content .= "If you plan to contribute, please kindly send us a short abstract via e-mail in advance.<br/><br/>";
$content .= "Biomedical Engineering Communications (ISSN: 2815-9063) is a peer-reviewed, open-access journal managed by TMR Publishing Group. Biomedical engineering is an interdisciplinary discipline that combines the principles of physics, chemistry, mathematics, computer and engineering, to study biomedicine and develop innovative biological products, materials, processing methods, implants, devices and informatics.<br/><br/>";
$content .= "The aim of Biomedical Engineering Communications is to promote the integration of new technologies, new ideas, new methods and life sciences in the field of engineering, and to enhance the digitization, automation and intelligence of biomedical engineering technology.<br/><br/>";
$content .= "You may find more information about the journal, including the editorial board and Special Issues, at https://www.tmrjournals.com/bmec/<br/><br/>";
$content .= "If you have any questions, please feel free to contact me.<br/><br/>We look forward to hearing from you.<br/>Best regards,<br/>Aubree zhu<br/>Journal Editor<br/>WeChat: 15620305727<br/><br/>";
$content .= "Recruiting reviewers<br/>https://submission.tmrjournals.com/reviewer<br/><br/>Biomedical Engineering Communications<br/>Email: bmec@tmrjournals.com<br/>Website: https://www.tmrjournals.com/bmec/<br/>";
$pre = Env::get('emailtemplete.pre');
$net = Env::get('emailtemplete.net');
$net1 = str_replace("{{email}}",trim($v[2]),$net);
$mailbody=$pre.$content.$net1;
$edata['email'] = trim($v[2]);
$edata['title'] = "[Biomedical Engineering Communications] Invitation for More Cooperation Without Free";
$edata['content'] = $mailbody;
$edata['tmail'] = $journal_info['email'];
$edata['tpassword'] = $journal_info['epassword'];
Queue::push('app\api\job\mail@fire', $edata, "tmail");
}
}
public function lsPushEmail()
{
// $journal_info = $this->journal_obj->where("journal_id", 4)->find();

View File

@@ -5,6 +5,7 @@ use think\Db;
use think\Env;
use think\Cache;
//use TCPDF;
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
@@ -23,6 +24,24 @@ function authcode($str)
return md5($key . $str1);
}
function readExcel($file){
// 读取Excel文件
$objPHPExcel = PHPExcel_IOFactory::load($file);
// 获取表格中的数据
$sheet = $objPHPExcel->getSheet(0); // 获取第一个工作表
$highestRow = $sheet->getHighestRow(); // 取得总行数
$highestColumn = $sheet->getHighestColumn(); // 取得总列数
$dataset = [];
for ($row = 1; $row <= $highestRow; $row++) {
$rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE);
array_push($dataset, $rowData[0]);
}
return $dataset;
}
/**
* @function sendEmail
* @intro 发送邮件(带附件)

View File

@@ -25,7 +25,8 @@
"topthink/think-queue": "1.1.4",
"phpoffice/phpword": "^1.0",
"topthink/think-image": "^1.0",
"mpdf/mpdf": "^8.1"
"mpdf/mpdf": "^8.1",
"phpoffice/phpexcel": "^1.8"
},
"autoload": {
"psr-4": {
@@ -36,6 +37,9 @@
"think-path": "thinkphp"
},
"config": {
"preferred-install": "dist"
"preferred-install": "dist",
"allow-plugins": {
"topthink/think-installer": true
}
}
}

View File

@@ -22,7 +22,7 @@
"require-dev": {
"phpunit/phpunit": "4.8.*",
"johnkary/phpunit-speedtrap": "^1.0",
"mikey179/vfsStream": "~1.6",
"mikey179/vfsstream": "~1.6",
"phploc/phploc": "2.*",
"sebastian/phpcpd": "2.*",
"phpdocumentor/reflection-docblock": "^2.0"

View File

@@ -211,6 +211,12 @@ class Lang
}
}
if (preg_match('/^([a-z\d\-]+)/i', $langSet, $matches)) {
$langSet = strtolower($matches[1]);
} else {
$langSet = self::$range;
}
// 合法的语言
if (empty(self::$allowLangList) || in_array($langSet, self::$allowLangList)) {
self::$range = $langSet ?: self::$range;

View File

@@ -70,7 +70,7 @@ class Redis extends Driver
*/
public function has($name)
{
return $this->handler->exists($this->getCacheKey($name));
return (bool) $this->handler->exists($this->getCacheKey($name));
}
/**

View File

@@ -1038,10 +1038,6 @@ class Query
return $this;
}
public function close(){
return $this->connection->close();
}
/**
* 指定OR查询条件
* @access public
@@ -1956,7 +1952,7 @@ class Query
if (!empty($this->pk)) {
$pk = $this->pk;
} else {
$pk = $this->getTableInfo(is_array($options) ? $options['table'] : $options, 'pk');
$pk = $this->getTableInfo(is_array($options) && isset($options['table']) ? $options['table'] : $options, 'pk');
}
return $pk;
}

View File

@@ -85,13 +85,11 @@ class File
*/
protected function getMasterLogFile()
{
$cli = PHP_SAPI == 'cli' ? '_cli' : '';
if ($this->config['single']) {
$name = is_string($this->config['single']) ? $this->config['single'] : 'single';
$destination = $this->config['path'] . $name . '.log';
$destination = $this->config['path'] . $name . $cli . '.log';
} else {
$cli = PHP_SAPI == 'cli' ? '_cli' : '';
if ($this->config['max_files']) {
$filename = date('Ymd') . $cli . '.log';
$files = glob($this->config['path'] . '*.log');
@@ -125,15 +123,13 @@ class File
if ($this->config['single']) {
$name = is_string($this->config['single']) ? $this->config['single'] : 'single';
$name .= '_' . $type;
} elseif ($this->config['max_files']) {
$name = date('Ymd') . '_' . $type . $cli;
$name = date('Ymd');
} else {
$name = date('d') . '_' . $type . $cli;
$name = date('d');
}
return $path . DIRECTORY_SEPARATOR . $name . '.log';
return $path . DIRECTORY_SEPARATOR . $name . '_' . $type . $cli . '.log';
}
/**
@@ -154,7 +150,13 @@ class File
$info['timestamp'] = date($this->config['time_format']);
foreach ($message as $type => $msg) {
$info[$type] = is_array($msg) ? implode("\r\n", $msg) : $msg;
$msg = is_array($msg) ? implode("\r\n", $msg) : $msg;
if (PHP_SAPI == 'cli') {
$info['msg'] = $msg;
$info['type'] = $type;
} else {
$info[$type] = $msg;
}
}
if (PHP_SAPI == 'cli') {

View File

@@ -196,7 +196,7 @@ class Windows extends Pipes
return;
}
if (null !== $w && 0 < count($r)) {
if (null !== $r && 0 < count($r)) {
$data = '';
while ($dataread = fread($r['input'], self::CHUNK_SIZE)) {
$data .= $dataread;

18
vendor/autoload.php vendored
View File

@@ -2,6 +2,24 @@
// autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
}
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit2bc4f313dba415539e266f7ac2c87dcd::getLoader();

View File

@@ -42,21 +42,76 @@ namespace Composer\Autoload;
*/
class ClassLoader
{
/** @var \Closure(string):void */
private static $includeFile;
/** @var string|null */
private $vendorDir;
// PSR-4
/**
* @var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array<string, list<string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var list<string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* List of PSR-0 prefixes
*
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
*/
private $prefixesPsr0 = array();
/**
* @var list<string>
*/
private $fallbackDirsPsr0 = array();
/** @var bool */
private $useIncludePath = false;
/**
* @var array<string, string>
*/
private $classMap = array();
/** @var bool */
private $classMapAuthoritative = false;
/**
* @var array<string, bool>
*/
private $missingClasses = array();
/** @var string|null */
private $apcuPrefix;
/**
* @var array<string, self>
*/
private static $registeredLoaders = array();
/**
* @param string|null $vendorDir
*/
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
self::initializeIncludeClosure();
}
/**
* @return array<string, list<string>>
*/
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
@@ -66,28 +121,42 @@ class ClassLoader
return array();
}
/**
* @return array<string, list<string>>
*/
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
/**
* @return list<string>
*/
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
/**
* @return list<string>
*/
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
/**
* @return array<string, string> Array of classname => path
*/
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
* @param array<string, string> $classMap Class to filename map
*
* @return void
*/
public function addClassMap(array $classMap)
{
@@ -103,21 +172,24 @@ class ClassLoader
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param list<string>|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
$paths
);
}
@@ -126,19 +198,19 @@ class ClassLoader
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
$this->prefixesPsr0[$first][$prefix] = $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
$paths
);
}
}
@@ -148,24 +220,27 @@ class ClassLoader
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param list<string>|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
$paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
@@ -175,18 +250,18 @@ class ClassLoader
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
$this->prefixDirsPsr4[$prefix] = $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
$paths
);
}
}
@@ -196,7 +271,9 @@ class ClassLoader
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
* @param list<string>|string $paths The PSR-0 base directories
*
* @return void
*/
public function set($prefix, $paths)
{
@@ -212,9 +289,11 @@ class ClassLoader
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param list<string>|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function setPsr4($prefix, $paths)
{
@@ -234,6 +313,8 @@ class ClassLoader
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*
* @return void
*/
public function setUseIncludePath($useIncludePath)
{
@@ -256,6 +337,8 @@ class ClassLoader
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*
* @return void
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
@@ -276,6 +359,8 @@ class ClassLoader
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*
* @return void
*/
public function setApcuPrefix($apcuPrefix)
{
@@ -296,33 +381,55 @@ class ClassLoader
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*
* @return void
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
if (null === $this->vendorDir) {
return;
}
if ($prepend) {
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
} else {
unset(self::$registeredLoaders[$this->vendorDir]);
self::$registeredLoaders[$this->vendorDir] = $this;
}
}
/**
* Unregisters this instance as an autoloader.
*
* @return void
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
* @return true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
$includeFile = self::$includeFile;
$includeFile($file);
return true;
}
return null;
}
/**
@@ -367,6 +474,21 @@ class ClassLoader
return $file;
}
/**
* Returns the currently registered loaders keyed by their corresponding vendor directories.
*
* @return array<string, self>
*/
public static function getRegisteredLoaders()
{
return self::$registeredLoaders;
}
/**
* @param string $class
* @param string $ext
* @return string|false
*/
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
@@ -432,14 +554,26 @@ class ClassLoader
return false;
}
}
/**
/**
* @return void
*/
private static function initializeIncludeClosure()
{
if (self::$includeFile !== null) {
return;
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
*/
function includeFile($file)
{
self::$includeFile = \Closure::bind(static function($file) {
include $file;
}, null, null);
}
}

View File

@@ -1,371 +1,359 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer;
use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser;
/**
* This class is copied in every Composer installed project and available to all
*
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/
class InstalledVersions
{
private static $installed = array (
'root' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
),
'reference' => '1271058defc5d0614bab48cdfb4359d752c2b266',
'name' => 'topthink/think',
),
'versions' =>
array (
'laminas/laminas-escaper' =>
array (
'pretty_version' => '2.9.0',
'version' => '2.9.0.0',
'aliases' =>
array (
),
'reference' => '891ad70986729e20ed2e86355fcf93c9dc238a5f',
),
'mpdf/mpdf' =>
array (
'pretty_version' => 'v8.1.2',
'version' => '8.1.2.0',
'aliases' =>
array (
),
'reference' => 'a8a22f4874157e490d41b486053a20bec42e182c',
),
'myclabs/deep-copy' =>
array (
'pretty_version' => '1.11.0',
'version' => '1.11.0.0',
'aliases' =>
array (
),
'reference' => '14daed4296fae74d9e3201d2c4925d1acb7aa614',
),
'paragonie/random_compat' =>
array (
'pretty_version' => 'v9.99.100',
'version' => '9.99.100.0',
'aliases' =>
array (
),
'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a',
),
'php-http/message-factory' =>
array (
'pretty_version' => 'v1.0.2',
'version' => '1.0.2.0',
'aliases' =>
array (
),
'reference' => 'a478cb11f66a6ac48d8954216cfed9aa06a501a1',
),
'phpmailer/phpmailer' =>
array (
'pretty_version' => 'v6.6.0',
'version' => '6.6.0.0',
'aliases' =>
array (
),
'reference' => 'e43bac82edc26ca04b36143a48bde1c051cfd5b1',
),
'phpoffice/phpword' =>
array (
'pretty_version' => '1.0.0',
'version' => '1.0.0.0',
'aliases' =>
array (
),
'reference' => '8521612b39edeec9055d3688ad555342a40857dd',
),
'psr/http-message' =>
array (
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'aliases' =>
array (
),
'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',
),
'psr/log' =>
array (
'pretty_version' => '1.1.4',
'version' => '1.1.4.0',
'aliases' =>
array (
),
'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
),
'setasign/fpdi' =>
array (
'pretty_version' => 'v2.3.6',
'version' => '2.3.6.0',
'aliases' =>
array (
),
'reference' => '6231e315f73e4f62d72b73f3d6d78ff0eed93c31',
),
'tecnickcom/tcpdf' =>
array (
'pretty_version' => '6.4.4',
'version' => '6.4.4.0',
'aliases' =>
array (
),
'reference' => '42cd0f9786af7e5db4fcedaa66f717b0d0032320',
),
'topthink/framework' =>
array (
'pretty_version' => 'v5.0.24',
'version' => '5.0.24.0',
'aliases' =>
array (
),
'reference' => 'c255c22b2f5fa30f320ecf6c1d29f7740eb3e8be',
),
'topthink/think' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
),
'reference' => '1271058defc5d0614bab48cdfb4359d752c2b266',
),
'topthink/think-captcha' =>
array (
'pretty_version' => 'v1.0.8',
'version' => '1.0.8.0',
'aliases' =>
array (
),
'reference' => '1d64363c814c92f6086c4fa5e3223fe7e23db09d',
),
'topthink/think-helper' =>
array (
'pretty_version' => 'v3.0.0',
'version' => '3.0.0.0',
'aliases' =>
array (
),
'reference' => '8ba5f66e68106369fcc3211e7d2dbaf7bc9ce455',
),
'topthink/think-image' =>
array (
'pretty_version' => 'v1.0.7',
'version' => '1.0.7.0',
'aliases' =>
array (
),
'reference' => '8586cf47f117481c6d415b20f7dedf62e79d5512',
),
'topthink/think-installer' =>
array (
'pretty_version' => 'v1.0.14',
'version' => '1.0.14.0',
'aliases' =>
array (
),
'reference' => 'eae1740ac264a55c06134b6685dfb9f837d004d1',
),
'topthink/think-queue' =>
array (
'pretty_version' => 'v1.1.4',
'version' => '1.1.4.0',
'aliases' =>
array (
),
'reference' => 'ad709611d516e13d6760234bc98e91faa901cae8',
),
'weiwei/api-doc' =>
array (
'pretty_version' => '1.6.2',
'version' => '1.6.2.0',
'aliases' =>
array (
),
'reference' => '6c2c3c03ce1139275cc5a5057677175ed8691e19',
),
),
);
/**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
*/
private static $installed;
/**
* @var bool|null
*/
private static $canGetVendors;
/**
* @var array[]
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static $installedByVendor = array();
/**
* Returns a list of all package names which are present, either by being installed, replaced or provided
*
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
/**
* Returns a list of all package names with a specific type e.g. 'library'
*
* @param string $type
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackagesByType($type)
{
$packagesByType = array();
public static function getInstalledPackages()
{
return array_keys(self::$installed['versions']);
}
public static function isInstalled($packageName)
{
return isset(self::$installed['versions'][$packageName]);
}
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
public static function getVersionRanges($packageName)
{
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
$ranges = array();
if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
public static function getVersion($packageName)
{
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
if (!isset(self::$installed['versions'][$packageName]['version'])) {
return null;
}
return self::$installed['versions'][$packageName]['version'];
}
public static function getPrettyVersion($packageName)
{
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return self::$installed['versions'][$packageName]['pretty_version'];
}
public static function getReference($packageName)
{
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
if (!isset(self::$installed['versions'][$packageName]['reference'])) {
return null;
}
return self::$installed['versions'][$packageName]['reference'];
}
public static function getRootPackage()
{
return self::$installed['root'];
}
public static function getRawData()
{
return self::$installed;
}
public static function reload($data)
{
self::$installed = $data;
}
foreach (self::getInstalled() as $installed) {
foreach ($installed['versions'] as $name => $package) {
if (isset($package['type']) && $package['type'] === $type) {
$packagesByType[] = $name;
}
}
}
return $packagesByType;
}
/**
* Checks whether the given package is installed
*
* This also returns true if the package name is provided or replaced by another package
*
* @param string $packageName
* @param bool $includeDevRequirements
* @return bool
*/
public static function isInstalled($packageName, $includeDevRequirements = true)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
}
}
return false;
}
/**
* Checks whether the given package satisfies a version constraint
*
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
*
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
*
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
* @param string $packageName
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
* @return bool
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
/**
* Returns a version constraint representing all the range(s) which are installed for a given package
*
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
* whether a given version of a package is installed, and not just whether it exists
*
* @param string $packageName
* @return string Version constraint usable with composer/semver
*/
public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
return $installed['versions'][$packageName]['version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
*/
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
*/
public static function getInstallPath($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @return array
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
*/
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
/**
* Returns the raw installed.php data for custom implementations
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
*/
public static function getRawData()
{
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
return self::$installed;
}
/**
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
public static function getAllRawData()
{
return self::getInstalled();
}
/**
* Lets you reload the static array from another file
*
* This is only useful for complex integrations in which a project needs to use
* this class but then also needs to execute another project's autoloader in process,
* and wants to ensure both projects have access to their version of installed.php.
*
* A typical case would be PHPUnit, where it would need to make sure it reads all
* the data it needs from this class, then call reload() with
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
* the project in which it runs can then also use this class safely, without
* interference between PHPUnit's dependencies and the project's dependencies.
*
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
*/
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
}
/**
* @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
}
}
}
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else {
self::$installed = array();
}
}
if (self::$installed !== array()) {
$installed[] = self::$installed;
}
return $installed;
}
}

View File

@@ -2,7 +2,7 @@
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(

View File

@@ -2,12 +2,13 @@
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'9b552a3cc426e3287cc811caefa3cf53' => $vendorDir . '/topthink/think-helper/src/helper.php',
'6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'db356362850385d08a5381de2638b5fd' => $vendorDir . '/mpdf/mpdf/src/functions.php',
'1cfd2761b63b0a29ed23657ea394cb2d' => $vendorDir . '/topthink/think-captcha/src/helper.php',
'cc56288302d9df745d97c934d6a6e5f0' => $vendorDir . '/topthink/think-queue/src/common.php',
'644e9cafc67b331e17cc7661548f33d0' => $vendorDir . '/weiwei/api-doc/src/helper.php',

View File

@@ -2,8 +2,9 @@
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'PHPExcel' => array($vendorDir . '/phpoffice/phpexcel/Classes'),
);

View File

@@ -2,23 +2,25 @@
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'think\\helper\\' => array($vendorDir . '/topthink/think-helper/src'),
'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'),
'think\\captcha\\' => array($vendorDir . '/topthink/think-captcha/src'),
'think\\' => array($baseDir . '/thinkphp/library/think', $vendorDir . '/topthink/think-image/src', $vendorDir . '/topthink/think-queue/src'),
'think\\' => array($vendorDir . '/topthink/think-image/src', $vendorDir . '/topthink/think-queue/src', $baseDir . '/thinkphp/library/think'),
'setasign\\Fpdi\\' => array($vendorDir . '/setasign/fpdi/src'),
'app\\' => array($baseDir . '/application'),
'Tests\\PhpOffice\\Math\\' => array($vendorDir . '/phpoffice/math/tests/Math'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
'PhpOffice\\PhpWord\\' => array($vendorDir . '/phpoffice/phpword/src/PhpWord'),
'PhpOffice\\Math\\' => array($vendorDir . '/phpoffice/math/src/Math'),
'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'),
'Mpdf\\PsrLogAwareTrait\\' => array($vendorDir . '/mpdf/psr-log-aware-trait/src'),
'Mpdf\\PsrHttpMessageShim\\' => array($vendorDir . '/mpdf/psr-http-message-shim/src'),
'Mpdf\\' => array($vendorDir . '/mpdf/mpdf/src'),
'Laminas\\Escaper\\' => array($vendorDir . '/laminas/laminas-escaper/src'),
'Http\\Message\\' => array($vendorDir . '/php-http/message-factory/src'),
'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'),
'Api\\Doc\\' => array($vendorDir . '/weiwei/api-doc/src'),
);

View File

@@ -25,51 +25,26 @@ class ComposerAutoloaderInit2bc4f313dba415539e266f7ac2c87dcd
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInit2bc4f313dba415539e266f7ac2c87dcd', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit2bc4f313dba415539e266f7ac2c87dcd', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
$filesToLoad = \Composer\Autoload\ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire2bc4f313dba415539e266f7ac2c87dcd($fileIdentifier, $file);
}, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) {
$requireFile($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire2bc4f313dba415539e266f7ac2c87dcd($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}

View File

@@ -9,6 +9,7 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
public static $files = array (
'9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php',
'6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'db356362850385d08a5381de2638b5fd' => __DIR__ . '/..' . '/mpdf/mpdf/src/functions.php',
'1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php',
'cc56288302d9df745d97c934d6a6e5f0' => __DIR__ . '/..' . '/topthink/think-queue/src/common.php',
'644e9cafc67b331e17cc7661548f33d0' => __DIR__ . '/..' . '/weiwei/api-doc/src/helper.php',
@@ -30,25 +31,24 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
array (
'app\\' => 4,
),
'T' =>
array (
'Tests\\PhpOffice\\Math\\' => 21,
),
'P' =>
array (
'Psr\\Log\\' => 8,
'Psr\\Http\\Message\\' => 17,
'PhpOffice\\PhpWord\\' => 18,
'PhpOffice\\Math\\' => 15,
'PHPMailer\\PHPMailer\\' => 20,
),
'M' =>
array (
'Mpdf\\PsrLogAwareTrait\\' => 22,
'Mpdf\\PsrHttpMessageShim\\' => 24,
'Mpdf\\' => 5,
),
'L' =>
array (
'Laminas\\Escaper\\' => 16,
),
'H' =>
array (
'Http\\Message\\' => 13,
),
'D' =>
array (
'DeepCopy\\' => 9,
@@ -74,9 +74,9 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
),
'think\\' =>
array (
0 => __DIR__ . '/../..' . '/thinkphp/library/think',
1 => __DIR__ . '/..' . '/topthink/think-image/src',
2 => __DIR__ . '/..' . '/topthink/think-queue/src',
0 => __DIR__ . '/..' . '/topthink/think-image/src',
1 => __DIR__ . '/..' . '/topthink/think-queue/src',
2 => __DIR__ . '/../..' . '/thinkphp/library/think',
),
'setasign\\Fpdi\\' =>
array (
@@ -86,6 +86,10 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
array (
0 => __DIR__ . '/../..' . '/application',
),
'Tests\\PhpOffice\\Math\\' =>
array (
0 => __DIR__ . '/..' . '/phpoffice/math/tests/Math',
),
'Psr\\Log\\' =>
array (
0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
@@ -98,22 +102,26 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
array (
0 => __DIR__ . '/..' . '/phpoffice/phpword/src/PhpWord',
),
'PhpOffice\\Math\\' =>
array (
0 => __DIR__ . '/..' . '/phpoffice/math/src/Math',
),
'PHPMailer\\PHPMailer\\' =>
array (
0 => __DIR__ . '/..' . '/phpmailer/phpmailer/src',
),
'Mpdf\\PsrLogAwareTrait\\' =>
array (
0 => __DIR__ . '/..' . '/mpdf/psr-log-aware-trait/src',
),
'Mpdf\\PsrHttpMessageShim\\' =>
array (
0 => __DIR__ . '/..' . '/mpdf/psr-http-message-shim/src',
),
'Mpdf\\' =>
array (
0 => __DIR__ . '/..' . '/mpdf/mpdf/src',
),
'Laminas\\Escaper\\' =>
array (
0 => __DIR__ . '/..' . '/laminas/laminas-escaper/src',
),
'Http\\Message\\' =>
array (
0 => __DIR__ . '/..' . '/php-http/message-factory/src',
),
'DeepCopy\\' =>
array (
0 => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy',
@@ -124,6 +132,16 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
),
);
public static $prefixesPsr0 = array (
'P' =>
array (
'PHPExcel' =>
array (
0 => __DIR__ . '/..' . '/phpoffice/phpexcel/Classes',
),
),
);
public static $classMap = array (
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'Datamatrix' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/barcodes/datamatrix.php',
@@ -147,6 +165,7 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd::$prefixesPsr0;
$loader->classMap = ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd::$classMap;
}, null, ClassLoader::class);

View File

@@ -1,101 +1,37 @@
{
"packages": [
{
"name": "laminas/laminas-escaper",
"version": "2.9.0",
"version_normalized": "2.9.0.0",
"source": {
"type": "git",
"url": "https://github.com/laminas/laminas-escaper.git",
"reference": "891ad70986729e20ed2e86355fcf93c9dc238a5f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laminas/laminas-escaper/zipball/891ad70986729e20ed2e86355fcf93c9dc238a5f",
"reference": "891ad70986729e20ed2e86355fcf93c9dc238a5f",
"shasum": ""
},
"require": {
"php": "^7.3 || ~8.0.0 || ~8.1.0"
},
"conflict": {
"zendframework/zend-escaper": "*"
},
"require-dev": {
"laminas/laminas-coding-standard": "~2.3.0",
"phpunit/phpunit": "^9.3",
"psalm/plugin-phpunit": "^0.12.2",
"vimeo/psalm": "^3.16"
},
"suggest": {
"ext-iconv": "*",
"ext-mbstring": "*"
},
"time": "2021-09-02T17:10:53+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Laminas\\Escaper\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs",
"homepage": "https://laminas.dev",
"keywords": [
"escaper",
"laminas"
],
"support": {
"chat": "https://laminas.dev/chat",
"docs": "https://docs.laminas.dev/laminas-escaper/",
"forum": "https://discourse.laminas.dev",
"issues": "https://github.com/laminas/laminas-escaper/issues",
"rss": "https://github.com/laminas/laminas-escaper/releases.atom",
"source": "https://github.com/laminas/laminas-escaper"
},
"funding": [
{
"url": "https://funding.communitybridge.org/projects/laminas-project",
"type": "community_bridge"
}
],
"install-path": "../laminas/laminas-escaper"
},
{
"name": "mpdf/mpdf",
"version": "v8.1.2",
"version_normalized": "8.1.2.0",
"version": "v8.2.4",
"version_normalized": "8.2.4.0",
"source": {
"type": "git",
"url": "https://github.com/mpdf/mpdf.git",
"reference": "a8a22f4874157e490d41b486053a20bec42e182c"
"reference": "9e3ff91606fed11cd58a130eabaaf60e56fdda88"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/a8a22f4874157e490d41b486053a20bec42e182c",
"reference": "a8a22f4874157e490d41b486053a20bec42e182c",
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/9e3ff91606fed11cd58a130eabaaf60e56fdda88",
"reference": "9e3ff91606fed11cd58a130eabaaf60e56fdda88",
"shasum": ""
},
"require": {
"ext-gd": "*",
"ext-mbstring": "*",
"mpdf/psr-http-message-shim": "^1.0 || ^2.0",
"mpdf/psr-log-aware-trait": "^2.0 || ^3.0",
"myclabs/deep-copy": "^1.7",
"paragonie/random_compat": "^1.4|^2.0|^9.99.99",
"php": "^5.6 || ^7.0 || ~8.0.0 || ~8.1.0",
"php-http/message-factory": "^1.0",
"psr/http-message": "^1.0",
"psr/log": "^1.0 || ^2.0",
"php": "^5.6 || ^7.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
"psr/http-message": "^1.0 || ^2.0",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"setasign/fpdi": "^2.1"
},
"require-dev": {
"mockery/mockery": "^1.3.0",
"mpdf/qrcode": "^1.1.0",
"squizlabs/php_codesniffer": "^3.5.0",
"tracy/tracy": "^2.4",
"tracy/tracy": "~2.5",
"yoast/phpunit-polyfills": "^1.0"
},
"suggest": {
@@ -103,10 +39,13 @@
"ext-xml": "Needed mainly for SVG manipulation",
"ext-zlib": "Needed for compression of embedded resources, such as fonts"
},
"time": "2022-08-15T08:15:09+00:00",
"time": "2024-06-14T16:06:41+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"Mpdf\\": "src/"
}
@@ -146,18 +85,116 @@
"install-path": "../mpdf/mpdf"
},
{
"name": "myclabs/deep-copy",
"version": "1.11.0",
"version_normalized": "1.11.0.0",
"name": "mpdf/psr-http-message-shim",
"version": "v2.0.1",
"version_normalized": "2.0.1.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614"
"url": "https://github.com/mpdf/psr-http-message-shim.git",
"reference": "f25a0153d645e234f9db42e5433b16d9b113920f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614",
"reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614",
"url": "https://api.github.com/repos/mpdf/psr-http-message-shim/zipball/f25a0153d645e234f9db42e5433b16d9b113920f",
"reference": "f25a0153d645e234f9db42e5433b16d9b113920f",
"shasum": ""
},
"require": {
"psr/http-message": "^2.0"
},
"time": "2023-10-02T14:34:03+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Mpdf\\PsrHttpMessageShim\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mark Dorison",
"email": "mark@chromatichq.com"
},
{
"name": "Kristofer Widholm",
"email": "kristofer@chromatichq.com"
},
{
"name": "Nigel Cunningham",
"email": "nigel.cunningham@technocrat.com.au"
}
],
"description": "Shim to allow support of different psr/message versions.",
"support": {
"issues": "https://github.com/mpdf/psr-http-message-shim/issues",
"source": "https://github.com/mpdf/psr-http-message-shim/tree/v2.0.1"
},
"install-path": "../mpdf/psr-http-message-shim"
},
{
"name": "mpdf/psr-log-aware-trait",
"version": "v2.0.0",
"version_normalized": "2.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/mpdf/psr-log-aware-trait.git",
"reference": "7a077416e8f39eb626dee4246e0af99dd9ace275"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mpdf/psr-log-aware-trait/zipball/7a077416e8f39eb626dee4246e0af99dd9ace275",
"reference": "7a077416e8f39eb626dee4246e0af99dd9ace275",
"shasum": ""
},
"require": {
"psr/log": "^1.0 || ^2.0"
},
"time": "2023-05-03T06:18:28+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Mpdf\\PsrLogAwareTrait\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mark Dorison",
"email": "mark@chromatichq.com"
},
{
"name": "Kristofer Widholm",
"email": "kristofer@chromatichq.com"
}
],
"description": "Trait to allow support of different psr/log versions.",
"support": {
"issues": "https://github.com/mpdf/psr-log-aware-trait/issues",
"source": "https://github.com/mpdf/psr-log-aware-trait/tree/v2.0.0"
},
"install-path": "../mpdf/psr-log-aware-trait"
},
{
"name": "myclabs/deep-copy",
"version": "1.12.0",
"version_normalized": "1.12.0.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c",
"reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c",
"shasum": ""
},
"require": {
@@ -165,14 +202,15 @@
},
"conflict": {
"doctrine/collections": "<1.6.8",
"doctrine/common": "<2.13.3 || >=3,<3.2.2"
"doctrine/common": "<2.13.3 || >=3 <3.2.2"
},
"require-dev": {
"doctrine/collections": "^1.6.8",
"doctrine/common": "^2.13.3 || ^3.2.2",
"phpspec/prophecy": "^1.10",
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
},
"time": "2022-03-03T13:19:32+00:00",
"time": "2024-06-12T14:39:25+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -197,7 +235,7 @@
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.11.0"
"source": "https://github.com/myclabs/DeepCopy/tree/1.12.0"
},
"funding": [
{
@@ -260,76 +298,19 @@
},
"install-path": "../paragonie/random_compat"
},
{
"name": "php-http/message-factory",
"version": "v1.0.2",
"version_normalized": "1.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/message-factory.git",
"reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1",
"reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1",
"shasum": ""
},
"require": {
"php": ">=5.4",
"psr/http-message": "^1.0"
},
"time": "2015-12-19T14:08:53+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "Factory interfaces for PSR-7 HTTP Message",
"homepage": "http://php-http.org",
"keywords": [
"factory",
"http",
"message",
"stream",
"uri"
],
"support": {
"issues": "https://github.com/php-http/message-factory/issues",
"source": "https://github.com/php-http/message-factory/tree/master"
},
"install-path": "../php-http/message-factory"
},
{
"name": "phpmailer/phpmailer",
"version": "v6.6.0",
"version_normalized": "6.6.0.0",
"version": "v6.9.1",
"version_normalized": "6.9.1.0",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "e43bac82edc26ca04b36143a48bde1c051cfd5b1"
"reference": "039de174cd9c17a8389754d3b877a2ed22743e18"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e43bac82edc26ca04b36143a48bde1c051cfd5b1",
"reference": "e43bac82edc26ca04b36143a48bde1c051cfd5b1",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/039de174cd9c17a8389754d3b877a2ed22743e18",
"reference": "039de174cd9c17a8389754d3b877a2ed22743e18",
"shasum": ""
},
"require": {
@@ -339,24 +320,27 @@
"php": ">=5.5.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"doctrine/annotations": "^1.2",
"php-parallel-lint/php-console-highlighter": "^0.5.0",
"php-parallel-lint/php-parallel-lint": "^1.3.1",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"doctrine/annotations": "^1.2.6 || ^1.13.3",
"php-parallel-lint/php-console-highlighter": "^1.0.0",
"php-parallel-lint/php-parallel-lint": "^1.3.2",
"phpcompatibility/php-compatibility": "^9.3.5",
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.6.2",
"yoast/phpunit-polyfills": "^1.0.0"
"squizlabs/php_codesniffer": "^3.7.2",
"yoast/phpunit-polyfills": "^1.0.4"
},
"suggest": {
"decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication",
"ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
"ext-openssl": "Needed for secure SMTP sending and DKIM signing",
"greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication",
"hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
"league/oauth2-google": "Needed for Google XOAUTH2 authentication",
"psr/log": "For optional PSR-3 debug logging",
"stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication",
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)",
"thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication"
},
"time": "2022-02-28T15:31:21+00:00",
"time": "2023-11-25T22:23:28+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -388,7 +372,7 @@
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"support": {
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.6.0"
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.9.1"
},
"funding": [
{
@@ -399,37 +383,164 @@
"install-path": "../phpmailer/phpmailer"
},
{
"name": "phpoffice/phpword",
"version": "1.0.0",
"version_normalized": "1.0.0.0",
"name": "phpoffice/math",
"version": "0.1.0",
"version_normalized": "0.1.0.0",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PHPWord.git",
"reference": "8521612b39edeec9055d3688ad555342a40857dd"
"url": "https://github.com/PHPOffice/Math.git",
"reference": "f0f8cad98624459c540cdd61d2a174d834471773"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PHPWord/zipball/8521612b39edeec9055d3688ad555342a40857dd",
"reference": "8521612b39edeec9055d3688ad555342a40857dd",
"url": "https://api.github.com/repos/PHPOffice/Math/zipball/f0f8cad98624459c540cdd61d2a174d834471773",
"reference": "f0f8cad98624459c540cdd61d2a174d834471773",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-xml": "*",
"php": "^7.1|^8.0"
},
"require-dev": {
"phpstan/phpstan": "^0.12.88 || ^1.0.0",
"phpunit/phpunit": "^7.0 || ^9.0"
},
"time": "2023-09-25T12:08:20+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"PhpOffice\\Math\\": "src/Math/",
"Tests\\PhpOffice\\Math\\": "tests/Math/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Progi1984",
"homepage": "https://lefevre.dev"
}
],
"description": "Math - Manipulate Math Formula",
"homepage": "https://phpoffice.github.io/Math/",
"keywords": [
"MathML",
"officemathml",
"php"
],
"support": {
"issues": "https://github.com/PHPOffice/Math/issues",
"source": "https://github.com/PHPOffice/Math/tree/0.1.0"
},
"install-path": "../phpoffice/math"
},
{
"name": "phpoffice/phpexcel",
"version": "1.8.2",
"version_normalized": "1.8.2.0",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PHPExcel.git",
"reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/1441011fb7ecdd8cc689878f54f8b58a6805f870",
"reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"ext-xml": "*",
"ext-xmlwriter": "*",
"php": "^5.2|^7.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "2.*"
},
"time": "2018-11-22T23:07:24+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"PHPExcel": "Classes/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1"
],
"authors": [
{
"name": "Maarten Balliauw",
"homepage": "http://blog.maartenballiauw.be"
},
{
"name": "Erik Tilt"
},
{
"name": "Franck Lefevre",
"homepage": "http://rootslabs.net"
},
{
"name": "Mark Baker",
"homepage": "http://markbakeruk.net"
}
],
"description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "https://github.com/PHPOffice/PHPExcel",
"keywords": [
"OpenXML",
"excel",
"php",
"spreadsheet",
"xls",
"xlsx"
],
"support": {
"issues": "https://github.com/PHPOffice/PHPExcel/issues",
"source": "https://github.com/PHPOffice/PHPExcel/tree/master"
},
"abandoned": "phpoffice/phpspreadsheet",
"install-path": "../phpoffice/phpexcel"
},
{
"name": "phpoffice/phpword",
"version": "1.2.0",
"version_normalized": "1.2.0.0",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PHPWord.git",
"reference": "e76b701ef538cb749641514fcbc31a68078550fa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PHPWord/zipball/e76b701ef538cb749641514fcbc31a68078550fa",
"reference": "e76b701ef538cb749641514fcbc31a68078550fa",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-json": "*",
"ext-xml": "*",
"laminas/laminas-escaper": ">=2.6",
"php": "^7.1|^8.0"
"php": "^7.1|^8.0",
"phpoffice/math": "^0.1"
},
"require-dev": {
"dompdf/dompdf": "^2.0",
"ext-gd": "*",
"ext-libxml": "*",
"ext-zip": "*",
"friendsofphp/php-cs-fixer": "^3.3",
"mpdf/mpdf": "^8.1",
"php-coveralls/php-coveralls": "^2.5",
"phpmd/phpmd": "^2.13",
"phpstan/phpstan-phpunit": "@stable",
"phpunit/phpunit": ">=7.0",
"symfony/process": "^4.4",
"symfony/process": "^4.4 || ^5.0",
"tecnickcom/tcpdf": "^6.5"
},
"suggest": {
@@ -439,13 +550,8 @@
"ext-xsl": "Allows applying XSL style sheet to headers, to main document part, and to footers of an OOXML template",
"ext-zip": "Allows writing OOXML and ODF"
},
"time": "2022-11-15T20:24:50+00:00",
"time": "2023-11-30T11:22:23+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-develop": "0.19-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
@@ -482,7 +588,7 @@
}
],
"description": "PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)",
"homepage": "https://phpword.readthedocs.io/",
"homepage": "https://phpoffice.github.io/PHPWord/",
"keywords": [
"ISO IEC 29500",
"OOXML",
@@ -510,33 +616,33 @@
],
"support": {
"issues": "https://github.com/PHPOffice/PHPWord/issues",
"source": "https://github.com/PHPOffice/PHPWord/tree/1.0.0"
"source": "https://github.com/PHPOffice/PHPWord/tree/1.2.0"
},
"install-path": "../phpoffice/phpword"
},
{
"name": "psr/http-message",
"version": "1.0.1",
"version_normalized": "1.0.1.0",
"version": "2.0",
"version_normalized": "2.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
"php": "^7.2 || ^8.0"
},
"time": "2016-08-06T14:39:51+00:00",
"time": "2023-04-04T09:54:51+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
"dev-master": "2.0.x-dev"
}
},
"installation-source": "dist",
@@ -552,7 +658,7 @@
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
@@ -566,7 +672,7 @@
"response"
],
"support": {
"source": "https://github.com/php-fig/http-message/tree/master"
"source": "https://github.com/php-fig/http-message/tree/2.0"
},
"install-path": "../psr/http-message"
},
@@ -625,17 +731,17 @@
},
{
"name": "setasign/fpdi",
"version": "v2.3.6",
"version_normalized": "2.3.6.0",
"version": "v2.6.0",
"version_normalized": "2.6.0.0",
"source": {
"type": "git",
"url": "https://github.com/Setasign/FPDI.git",
"reference": "6231e315f73e4f62d72b73f3d6d78ff0eed93c31"
"reference": "a6db878129ec6c7e141316ee71872923e7f1b7ad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Setasign/FPDI/zipball/6231e315f73e4f62d72b73f3d6d78ff0eed93c31",
"reference": "6231e315f73e4f62d72b73f3d6d78ff0eed93c31",
"url": "https://api.github.com/repos/Setasign/FPDI/zipball/a6db878129ec6c7e141316ee71872923e7f1b7ad",
"reference": "a6db878129ec6c7e141316ee71872923e7f1b7ad",
"shasum": ""
},
"require": {
@@ -647,15 +753,15 @@
},
"require-dev": {
"phpunit/phpunit": "~5.7",
"setasign/fpdf": "~1.8",
"setasign/tfpdf": "1.31",
"setasign/fpdf": "~1.8.6",
"setasign/tfpdf": "~1.33",
"squizlabs/php_codesniffer": "^3.5",
"tecnickcom/tcpdf": "~6.2"
},
"suggest": {
"setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured."
},
"time": "2021-02-11T11:37:01+00:00",
"time": "2023-12-11T16:03:32+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -688,7 +794,7 @@
],
"support": {
"issues": "https://github.com/Setasign/FPDI/issues",
"source": "https://github.com/Setasign/FPDI/tree/v2.3.6"
"source": "https://github.com/Setasign/FPDI/tree/v2.6.0"
},
"funding": [
{
@@ -700,23 +806,23 @@
},
{
"name": "tecnickcom/tcpdf",
"version": "6.4.4",
"version_normalized": "6.4.4.0",
"version": "6.7.5",
"version_normalized": "6.7.5.0",
"source": {
"type": "git",
"url": "https://github.com/tecnickcom/TCPDF.git",
"reference": "42cd0f9786af7e5db4fcedaa66f717b0d0032320"
"reference": "951eabf0338ec2522bd0d5d9c79b08a3a3d36b36"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/42cd0f9786af7e5db4fcedaa66f717b0d0032320",
"reference": "42cd0f9786af7e5db4fcedaa66f717b0d0032320",
"url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/951eabf0338ec2522bd0d5d9c79b08a3a3d36b36",
"reference": "951eabf0338ec2522bd0d5d9c79b08a3a3d36b36",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
"php": ">=5.5.0"
},
"time": "2021-12-31T08:39:24+00:00",
"time": "2024-04-20T17:25:10+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -741,7 +847,7 @@
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-only"
"LGPL-3.0-or-later"
],
"authors": [
{
@@ -763,7 +869,7 @@
],
"support": {
"issues": "https://github.com/tecnickcom/TCPDF/issues",
"source": "https://github.com/tecnickcom/TCPDF/tree/6.4.4"
"source": "https://github.com/tecnickcom/TCPDF/tree/6.7.5"
},
"funding": [
{
@@ -775,17 +881,17 @@
},
{
"name": "topthink/framework",
"version": "v5.0.24",
"version_normalized": "5.0.24.0",
"version": "v5.0.25",
"version_normalized": "5.0.25.0",
"source": {
"type": "git",
"url": "https://github.com/top-think/framework.git",
"reference": "c255c22b2f5fa30f320ecf6c1d29f7740eb3e8be"
"reference": "643c58ed1bd22a2823ce5e95b3b68a5075f9087c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/framework/zipball/c255c22b2f5fa30f320ecf6c1d29f7740eb3e8be",
"reference": "c255c22b2f5fa30f320ecf6c1d29f7740eb3e8be",
"url": "https://api.github.com/repos/top-think/framework/zipball/643c58ed1bd22a2823ce5e95b3b68a5075f9087c",
"reference": "643c58ed1bd22a2823ce5e95b3b68a5075f9087c",
"shasum": ""
},
"require": {
@@ -800,7 +906,7 @@
"phpunit/phpunit": "4.8.*",
"sebastian/phpcpd": "2.*"
},
"time": "2019-01-11T08:04:58+00:00",
"time": "2022-10-25T14:59:38+00:00",
"type": "think-framework",
"installation-source": "dist",
"autoload": {
@@ -827,7 +933,7 @@
],
"support": {
"issues": "https://github.com/top-think/framework/issues",
"source": "https://github.com/top-think/framework/tree/master"
"source": "https://github.com/top-think/framework/tree/v5.0.25"
},
"install-path": "../../thinkphp"
},

View File

@@ -1,186 +1,203 @@
<?php return array (
'root' =>
array (
<?php return array(
'root' => array(
'name' => 'topthink/think',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
'reference' => '5607aad50f14f7a7c9e593b8b5dba980843d2640',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev' => true,
),
'reference' => '1271058defc5d0614bab48cdfb4359d752c2b266',
'name' => 'topthink/think',
'versions' => array(
'mpdf/mpdf' => array(
'pretty_version' => 'v8.2.4',
'version' => '8.2.4.0',
'reference' => '9e3ff91606fed11cd58a130eabaaf60e56fdda88',
'type' => 'library',
'install_path' => __DIR__ . '/../mpdf/mpdf',
'aliases' => array(),
'dev_requirement' => false,
),
'versions' =>
array (
'laminas/laminas-escaper' =>
array (
'pretty_version' => '2.9.0',
'version' => '2.9.0.0',
'aliases' =>
array (
'mpdf/psr-http-message-shim' => array(
'pretty_version' => 'v2.0.1',
'version' => '2.0.1.0',
'reference' => 'f25a0153d645e234f9db42e5433b16d9b113920f',
'type' => 'library',
'install_path' => __DIR__ . '/../mpdf/psr-http-message-shim',
'aliases' => array(),
'dev_requirement' => false,
),
'reference' => '891ad70986729e20ed2e86355fcf93c9dc238a5f',
'mpdf/psr-log-aware-trait' => array(
'pretty_version' => 'v2.0.0',
'version' => '2.0.0.0',
'reference' => '7a077416e8f39eb626dee4246e0af99dd9ace275',
'type' => 'library',
'install_path' => __DIR__ . '/../mpdf/psr-log-aware-trait',
'aliases' => array(),
'dev_requirement' => false,
),
'mpdf/mpdf' =>
array (
'pretty_version' => 'v8.1.2',
'version' => '8.1.2.0',
'aliases' =>
array (
'myclabs/deep-copy' => array(
'pretty_version' => '1.12.0',
'version' => '1.12.0.0',
'reference' => '3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c',
'type' => 'library',
'install_path' => __DIR__ . '/../myclabs/deep-copy',
'aliases' => array(),
'dev_requirement' => false,
),
'reference' => 'a8a22f4874157e490d41b486053a20bec42e182c',
),
'myclabs/deep-copy' =>
array (
'pretty_version' => '1.11.0',
'version' => '1.11.0.0',
'aliases' =>
array (
),
'reference' => '14daed4296fae74d9e3201d2c4925d1acb7aa614',
),
'paragonie/random_compat' =>
array (
'paragonie/random_compat' => array(
'pretty_version' => 'v9.99.100',
'version' => '9.99.100.0',
'aliases' =>
array (
),
'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a',
'type' => 'library',
'install_path' => __DIR__ . '/../paragonie/random_compat',
'aliases' => array(),
'dev_requirement' => false,
),
'php-http/message-factory' =>
array (
'pretty_version' => 'v1.0.2',
'version' => '1.0.2.0',
'aliases' =>
array (
'phpmailer/phpmailer' => array(
'pretty_version' => 'v6.9.1',
'version' => '6.9.1.0',
'reference' => '039de174cd9c17a8389754d3b877a2ed22743e18',
'type' => 'library',
'install_path' => __DIR__ . '/../phpmailer/phpmailer',
'aliases' => array(),
'dev_requirement' => false,
),
'reference' => 'a478cb11f66a6ac48d8954216cfed9aa06a501a1',
'phpoffice/math' => array(
'pretty_version' => '0.1.0',
'version' => '0.1.0.0',
'reference' => 'f0f8cad98624459c540cdd61d2a174d834471773',
'type' => 'library',
'install_path' => __DIR__ . '/../phpoffice/math',
'aliases' => array(),
'dev_requirement' => false,
),
'phpmailer/phpmailer' =>
array (
'pretty_version' => 'v6.6.0',
'version' => '6.6.0.0',
'aliases' =>
array (
'phpoffice/phpexcel' => array(
'pretty_version' => '1.8.2',
'version' => '1.8.2.0',
'reference' => '1441011fb7ecdd8cc689878f54f8b58a6805f870',
'type' => 'library',
'install_path' => __DIR__ . '/../phpoffice/phpexcel',
'aliases' => array(),
'dev_requirement' => false,
),
'reference' => 'e43bac82edc26ca04b36143a48bde1c051cfd5b1',
'phpoffice/phpword' => array(
'pretty_version' => '1.2.0',
'version' => '1.2.0.0',
'reference' => 'e76b701ef538cb749641514fcbc31a68078550fa',
'type' => 'library',
'install_path' => __DIR__ . '/../phpoffice/phpword',
'aliases' => array(),
'dev_requirement' => false,
),
'phpoffice/phpword' =>
array (
'pretty_version' => '1.0.0',
'version' => '1.0.0.0',
'aliases' =>
array (
'psr/http-message' => array(
'pretty_version' => '2.0',
'version' => '2.0.0.0',
'reference' => '402d35bcb92c70c026d1a6a9883f06b2ead23d71',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-message',
'aliases' => array(),
'dev_requirement' => false,
),
'reference' => '8521612b39edeec9055d3688ad555342a40857dd',
),
'psr/http-message' =>
array (
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'aliases' =>
array (
),
'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',
),
'psr/log' =>
array (
'psr/log' => array(
'pretty_version' => '1.1.4',
'version' => '1.1.4.0',
'aliases' =>
array (
),
'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/log',
'aliases' => array(),
'dev_requirement' => false,
),
'setasign/fpdi' =>
array (
'pretty_version' => 'v2.3.6',
'version' => '2.3.6.0',
'aliases' =>
array (
'setasign/fpdi' => array(
'pretty_version' => 'v2.6.0',
'version' => '2.6.0.0',
'reference' => 'a6db878129ec6c7e141316ee71872923e7f1b7ad',
'type' => 'library',
'install_path' => __DIR__ . '/../setasign/fpdi',
'aliases' => array(),
'dev_requirement' => false,
),
'reference' => '6231e315f73e4f62d72b73f3d6d78ff0eed93c31',
'tecnickcom/tcpdf' => array(
'pretty_version' => '6.7.5',
'version' => '6.7.5.0',
'reference' => '951eabf0338ec2522bd0d5d9c79b08a3a3d36b36',
'type' => 'library',
'install_path' => __DIR__ . '/../tecnickcom/tcpdf',
'aliases' => array(),
'dev_requirement' => false,
),
'tecnickcom/tcpdf' =>
array (
'pretty_version' => '6.4.4',
'version' => '6.4.4.0',
'aliases' =>
array (
'topthink/framework' => array(
'pretty_version' => 'v5.0.25',
'version' => '5.0.25.0',
'reference' => '643c58ed1bd22a2823ce5e95b3b68a5075f9087c',
'type' => 'think-framework',
'install_path' => __DIR__ . '/../../thinkphp',
'aliases' => array(),
'dev_requirement' => false,
),
'reference' => '42cd0f9786af7e5db4fcedaa66f717b0d0032320',
),
'topthink/framework' =>
array (
'pretty_version' => 'v5.0.24',
'version' => '5.0.24.0',
'aliases' =>
array (
),
'reference' => 'c255c22b2f5fa30f320ecf6c1d29f7740eb3e8be',
),
'topthink/think' =>
array (
'topthink/think' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
'reference' => '5607aad50f14f7a7c9e593b8b5dba980843d2640',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'reference' => '1271058defc5d0614bab48cdfb4359d752c2b266',
),
'topthink/think-captcha' =>
array (
'topthink/think-captcha' => array(
'pretty_version' => 'v1.0.8',
'version' => '1.0.8.0',
'aliases' =>
array (
),
'reference' => '1d64363c814c92f6086c4fa5e3223fe7e23db09d',
'type' => 'library',
'install_path' => __DIR__ . '/../topthink/think-captcha',
'aliases' => array(),
'dev_requirement' => false,
),
'topthink/think-helper' =>
array (
'topthink/think-helper' => array(
'pretty_version' => 'v3.0.0',
'version' => '3.0.0.0',
'aliases' =>
array (
),
'reference' => '8ba5f66e68106369fcc3211e7d2dbaf7bc9ce455',
'type' => 'library',
'install_path' => __DIR__ . '/../topthink/think-helper',
'aliases' => array(),
'dev_requirement' => false,
),
'topthink/think-image' =>
array (
'topthink/think-image' => array(
'pretty_version' => 'v1.0.7',
'version' => '1.0.7.0',
'aliases' =>
array (
),
'reference' => '8586cf47f117481c6d415b20f7dedf62e79d5512',
'type' => 'library',
'install_path' => __DIR__ . '/../topthink/think-image',
'aliases' => array(),
'dev_requirement' => false,
),
'topthink/think-installer' =>
array (
'topthink/think-installer' => array(
'pretty_version' => 'v1.0.14',
'version' => '1.0.14.0',
'aliases' =>
array (
),
'reference' => 'eae1740ac264a55c06134b6685dfb9f837d004d1',
'type' => 'composer-plugin',
'install_path' => __DIR__ . '/../topthink/think-installer',
'aliases' => array(),
'dev_requirement' => false,
),
'topthink/think-queue' =>
array (
'topthink/think-queue' => array(
'pretty_version' => 'v1.1.4',
'version' => '1.1.4.0',
'aliases' =>
array (
),
'reference' => 'ad709611d516e13d6760234bc98e91faa901cae8',
'type' => 'think-extend',
'install_path' => __DIR__ . '/../topthink/think-queue',
'aliases' => array(),
'dev_requirement' => false,
),
'weiwei/api-doc' =>
array (
'weiwei/api-doc' => array(
'pretty_version' => '1.6.2',
'version' => '1.6.2.0',
'aliases' =>
array (
),
'reference' => '6c2c3c03ce1139275cc5a5057677175ed8691e19',
'type' => 'think-extend',
'install_path' => __DIR__ . '/../weiwei/api-doc',
'aliases' => array(),
'dev_requirement' => false,
),
),
);

View File

@@ -4,8 +4,8 @@
$issues = array();
if (!(PHP_VERSION_ID >= 70300)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.3.0". You are running ' . PHP_VERSION . '.';
if (!(PHP_VERSION_ID >= 70200)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0". You are running ' . PHP_VERSION . '.';
}
if ($issues) {

View File

@@ -1,5 +0,0 @@
{
"ignore_php_platform_requirements": {
"8.1": true
}
}

View File

@@ -1 +0,0 @@
Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. (https://getlaminas.org/)

View File

@@ -1,26 +0,0 @@
Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Laminas Foundation nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -1,28 +0,0 @@
# laminas-escaper
[![Build Status](https://github.com/laminas/laminas-escaper/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/laminas/laminas-escaper/actions/workflows/continuous-integration.yml)
[![Coverage Status](https://coveralls.io/repos/github/laminas/laminas-escaper/badge.svg?branch=master)](https://coveralls.io/github/laminas/laminas-escaper?branch=master)
The OWASP Top 10 web security risks study lists Cross-Site Scripting (XSS) in
second place. PHPs sole functionality against XSS is limited to two functions
of which one is commonly misapplied. Thus, the laminas-escaper component was written.
It offers developers a way to escape output and defend from XSS and related
vulnerabilities by introducing contextual escaping based on peer-reviewed rules.
## Installation
Run the following to install this library:
```bash
$ composer require laminas/laminas-escaper
```
## Documentation
Browse the documentation online at https://docs.laminas.dev/laminas-escaper/
## Support
* [Issues](https://github.com/laminas/laminas-escaper/issues/)
* [Chat](https://laminas.dev/chat/)
* [Forum](https://discourse.laminas.dev/)

View File

@@ -1,60 +0,0 @@
{
"name": "laminas/laminas-escaper",
"description": "Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs",
"license": "BSD-3-Clause",
"keywords": [
"laminas",
"escaper"
],
"homepage": "https://laminas.dev",
"support": {
"docs": "https://docs.laminas.dev/laminas-escaper/",
"issues": "https://github.com/laminas/laminas-escaper/issues",
"source": "https://github.com/laminas/laminas-escaper",
"rss": "https://github.com/laminas/laminas-escaper/releases.atom",
"chat": "https://laminas.dev/chat",
"forum": "https://discourse.laminas.dev"
},
"config": {
"sort-packages": true
},
"extra": {
},
"require": {
"php": "^7.3 || ~8.0.0 || ~8.1.0"
},
"suggest": {
"ext-iconv": "*",
"ext-mbstring": "*"
},
"require-dev": {
"laminas/laminas-coding-standard": "~2.3.0",
"phpunit/phpunit": "^9.3",
"psalm/plugin-phpunit": "^0.12.2",
"vimeo/psalm": "^3.16"
},
"autoload": {
"psr-4": {
"Laminas\\Escaper\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"LaminasTest\\Escaper\\": "test/"
}
},
"scripts": {
"check": [
"@cs-check",
"@test"
],
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"static-analysis": "psalm --shepherd --stats",
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
},
"conflict": {
"zendframework/zend-escaper": "*"
}
}

View File

@@ -1,21 +0,0 @@
<?xml version="1.0"?>
<ruleset
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd">
<arg name="basepath" value="."/>
<arg name="cache" value=".phpcs-cache"/>
<arg name="colors"/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="80"/>
<!-- Show progress -->
<arg value="p"/>
<!-- Paths to check -->
<file>src</file>
<file>test</file>
<!-- Include all rules from Laminas Coding Standard -->
<rule ref="LaminasCodingStandard"/>
</ruleset>

View File

@@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="3.18.2@19aa905f7c3c7350569999a93c40ae91ae4e1626">
<file src="src/Escaper.php">
<MixedArgument occurrences="10">
<code>$chr</code>
<code>$chr</code>
<code>$chr</code>
<code>$chr</code>
<code>$chr</code>
<code>$chr</code>
<code>$chr</code>
<code>$chr</code>
<code>$chr</code>
<code>$chr</code>
</MixedArgument>
<MixedArgumentTypeCoercion occurrences="3">
<code>$this-&gt;cssMatcher</code>
<code>$this-&gt;htmlAttrMatcher</code>
<code>$this-&gt;jsMatcher</code>
</MixedArgumentTypeCoercion>
<MixedAssignment occurrences="3">
<code>$chr</code>
<code>$chr</code>
<code>$chr</code>
</MixedAssignment>
<MixedOperand occurrences="1">
<code>static::$htmlNamedEntityMap[$ord]</code>
</MixedOperand>
<PossiblyInvalidArgument occurrences="1">
<code>$from</code>
</PossiblyInvalidArgument>
</file>
<file src="test/EscaperTest.php">
<InvalidReturnStatement occurrences="5"/>
<InvalidReturnType occurrences="5">
<code>array&lt;string, array{0: string, 1: string}&gt;</code>
<code>array&lt;string, array{0: string, 1: string}&gt;</code>
<code>array&lt;string, array{0: string, 1: string}&gt;</code>
<code>array&lt;string, array{0: string, 1: string}&gt;</code>
<code>array&lt;string, array{0: string}&gt;</code>
</InvalidReturnType>
<MissingReturnType occurrences="9">
<code>testCssEscapingReturnsStringIfContainsOnlyDigits</code>
<code>testCssEscapingReturnsStringIfZeroLength</code>
<code>testHtmlAttributeEscapingEscapesOwaspRecommendedRanges</code>
<code>testJavascriptEscapingReturnsStringIfContainsOnlyDigits</code>
<code>testJavascriptEscapingReturnsStringIfZeroLength</code>
<code>testReturnsEncodingFromGetter</code>
<code>testSettingEncodingToEmptyStringShouldThrowException</code>
<code>testSettingEncodingToInvalidValueShouldThrowException</code>
<code>testUnicodeCodepointConversionToUtf8</code>
</MissingReturnType>
</file>
<file src="vendor/symfony/polyfill-mbstring/bootstrap80.php">
<ParseError occurrences="1">
<code>=</code>
</ParseError>
</file>
</files>

View File

@@ -1,34 +0,0 @@
<?xml version="1.0"?>
<psalm
totallyTyped="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="psalm-baseline.xml"
>
<projectFiles>
<directory name="src"/>
<directory name="test"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
<issueHandlers>
<InternalMethod>
<errorLevel type="suppress">
<referencedMethod name="PHPUnit\Framework\MockObject\Builder\InvocationMocker::method"/>
</errorLevel>
<errorLevel type="suppress">
<referencedMethod name="PHPUnit\Framework\MockObject\Builder\InvocationMocker::willReturn"/>
</errorLevel>
<errorLevel type="suppress">
<referencedMethod name="PHPUnit\Framework\MockObject\Builder\InvocationMocker::with"/>
</errorLevel>
</InternalMethod>
</issueHandlers>
<plugins>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
</plugins>
</psalm>

View File

@@ -1,422 +0,0 @@
<?php
declare(strict_types=1);
namespace Laminas\Escaper;
use function bin2hex;
use function ctype_digit;
use function function_exists;
use function hexdec;
use function htmlspecialchars;
use function iconv;
use function in_array;
use function mb_convert_encoding;
use function ord;
use function preg_match;
use function preg_replace_callback;
use function rawurlencode;
use function sprintf;
use function strlen;
use function strtolower;
use function strtoupper;
use function substr;
use const ENT_QUOTES;
use const ENT_SUBSTITUTE;
/**
* Context specific methods for use in secure output escaping
*/
class Escaper
{
/**
* Entity Map mapping Unicode codepoints to any available named HTML entities.
*
* While HTML supports far more named entities, the lowest common denominator
* has become HTML5's XML Serialisation which is restricted to the those named
* entities that XML supports. Using HTML entities would result in this error:
* XML Parsing Error: undefined entity
*
* @var array
*/
protected static $htmlNamedEntityMap = [
34 => 'quot', // quotation mark
38 => 'amp', // ampersand
60 => 'lt', // less-than sign
62 => 'gt', // greater-than sign
];
/**
* Current encoding for escaping. If not UTF-8, we convert strings from this encoding
* pre-escaping and back to this encoding post-escaping.
*
* @var string
*/
protected $encoding = 'utf-8';
/**
* Holds the value of the special flags passed as second parameter to
* htmlspecialchars().
*
* @var int
*/
protected $htmlSpecialCharsFlags;
/**
* Static Matcher which escapes characters for HTML Attribute contexts
*
* @var callable
*/
protected $htmlAttrMatcher;
/**
* Static Matcher which escapes characters for Javascript contexts
*
* @var callable
*/
protected $jsMatcher;
/**
* Static Matcher which escapes characters for CSS Attribute contexts
*
* @var callable
*/
protected $cssMatcher;
/**
* List of all encoding supported by this class
*
* @var array
*/
protected $supportedEncodings = [
'iso-8859-1',
'iso8859-1',
'iso-8859-5',
'iso8859-5',
'iso-8859-15',
'iso8859-15',
'utf-8',
'cp866',
'ibm866',
'866',
'cp1251',
'windows-1251',
'win-1251',
'1251',
'cp1252',
'windows-1252',
'1252',
'koi8-r',
'koi8-ru',
'koi8r',
'big5',
'950',
'gb2312',
'936',
'big5-hkscs',
'shift_jis',
'sjis',
'sjis-win',
'cp932',
'932',
'euc-jp',
'eucjp',
'eucjp-win',
'macroman',
];
/**
* Constructor: Single parameter allows setting of global encoding for use by
* the current object.
*
* @throws Exception\InvalidArgumentException
*/
public function __construct(?string $encoding = null)
{
if ($encoding !== null) {
if ($encoding === '') {
throw new Exception\InvalidArgumentException(
static::class . ' constructor parameter does not allow a blank value'
);
}
$encoding = strtolower($encoding);
if (! in_array($encoding, $this->supportedEncodings)) {
throw new Exception\InvalidArgumentException(
'Value of \'' . $encoding . '\' passed to ' . static::class
. ' constructor parameter is invalid. Provide an encoding supported by htmlspecialchars()'
);
}
$this->encoding = $encoding;
}
// We take advantage of ENT_SUBSTITUTE flag to correctly deal with invalid UTF-8 sequences.
$this->htmlSpecialCharsFlags = ENT_QUOTES | ENT_SUBSTITUTE;
// set matcher callbacks
$this->htmlAttrMatcher = [$this, 'htmlAttrMatcher'];
$this->jsMatcher = [$this, 'jsMatcher'];
$this->cssMatcher = [$this, 'cssMatcher'];
}
/**
* Return the encoding that all output/input is expected to be encoded in.
*
* @return string
*/
public function getEncoding()
{
return $this->encoding;
}
/**
* Escape a string for the HTML Body context where there are very few characters
* of special meaning. Internally this will use htmlspecialchars().
*
* @return string
*/
public function escapeHtml(string $string)
{
return htmlspecialchars($string, $this->htmlSpecialCharsFlags, $this->encoding);
}
/**
* Escape a string for the HTML Attribute context. We use an extended set of characters
* to escape that are not covered by htmlspecialchars() to cover cases where an attribute
* might be unquoted or quoted illegally (e.g. backticks are valid quotes for IE).
*
* @return string
*/
public function escapeHtmlAttr(string $string)
{
$string = $this->toUtf8($string);
if ($string === '' || ctype_digit($string)) {
return $string;
}
$result = preg_replace_callback('/[^a-z0-9,\.\-_]/iSu', $this->htmlAttrMatcher, $string);
return $this->fromUtf8($result);
}
/**
* Escape a string for the Javascript context. This does not use json_encode(). An extended
* set of characters are escaped beyond ECMAScript's rules for Javascript literal string
* escaping in order to prevent misinterpretation of Javascript as HTML leading to the
* injection of special characters and entities. The escaping used should be tolerant
* of cases where HTML escaping was not applied on top of Javascript escaping correctly.
* Backslash escaping is not used as it still leaves the escaped character as-is and so
* is not useful in a HTML context.
*
* @return string
*/
public function escapeJs(string $string)
{
$string = $this->toUtf8($string);
if ($string === '' || ctype_digit($string)) {
return $string;
}
$result = preg_replace_callback('/[^a-z0-9,\._]/iSu', $this->jsMatcher, $string);
return $this->fromUtf8($result);
}
/**
* Escape a string for the URI or Parameter contexts. This should not be used to escape
* an entire URI - only a subcomponent being inserted. The function is a simple proxy
* to rawurlencode() which now implements RFC 3986 since PHP 5.3 completely.
*
* @return string
*/
public function escapeUrl(string $string)
{
return rawurlencode($string);
}
/**
* Escape a string for the CSS context. CSS escaping can be applied to any string being
* inserted into CSS and escapes everything except alphanumerics.
*
* @return string
*/
public function escapeCss(string $string)
{
$string = $this->toUtf8($string);
if ($string === '' || ctype_digit($string)) {
return $string;
}
$result = preg_replace_callback('/[^a-z0-9]/iSu', $this->cssMatcher, $string);
return $this->fromUtf8($result);
}
/**
* Callback function for preg_replace_callback that applies HTML Attribute
* escaping to all matches.
*
* @param array $matches
* @return string
*/
protected function htmlAttrMatcher($matches)
{
$chr = $matches[0];
$ord = ord($chr);
/**
* The following replaces characters undefined in HTML with the
* hex entity for the Unicode replacement character.
*/
if (
($ord <= 0x1f && $chr !== "\t" && $chr !== "\n" && $chr !== "\r")
|| ($ord >= 0x7f && $ord <= 0x9f)
) {
return '&#xFFFD;';
}
/**
* Check if the current character to escape has a name entity we should
* replace it with while grabbing the integer value of the character.
*/
if (strlen($chr) > 1) {
$chr = $this->convertEncoding($chr, 'UTF-32BE', 'UTF-8');
}
$hex = bin2hex($chr);
$ord = hexdec($hex);
if (isset(static::$htmlNamedEntityMap[$ord])) {
return '&' . static::$htmlNamedEntityMap[$ord] . ';';
}
/**
* Per OWASP recommendations, we'll use upper hex entities
* for any other characters where a named entity does not exist.
*/
if ($ord > 255) {
return sprintf('&#x%04X;', $ord);
}
return sprintf('&#x%02X;', $ord);
}
/**
* Callback function for preg_replace_callback that applies Javascript
* escaping to all matches.
*
* @param array $matches
* @return string
*/
protected function jsMatcher($matches)
{
$chr = $matches[0];
if (strlen($chr) === 1) {
return sprintf('\\x%02X', ord($chr));
}
$chr = $this->convertEncoding($chr, 'UTF-16BE', 'UTF-8');
$hex = strtoupper(bin2hex($chr));
if (strlen($hex) <= 4) {
return sprintf('\\u%04s', $hex);
}
$highSurrogate = substr($hex, 0, 4);
$lowSurrogate = substr($hex, 4, 4);
return sprintf('\\u%04s\\u%04s', $highSurrogate, $lowSurrogate);
}
/**
* Callback function for preg_replace_callback that applies CSS
* escaping to all matches.
*
* @param array $matches
* @return string
*/
protected function cssMatcher($matches)
{
$chr = $matches[0];
if (strlen($chr) === 1) {
$ord = ord($chr);
} else {
$chr = $this->convertEncoding($chr, 'UTF-32BE', 'UTF-8');
$ord = hexdec(bin2hex($chr));
}
return sprintf('\\%X ', $ord);
}
/**
* Converts a string to UTF-8 from the base encoding. The base encoding is set via this
*
* @param string $string
* @throws Exception\RuntimeException
* @return string
*/
protected function toUtf8($string)
{
if ($this->getEncoding() === 'utf-8') {
$result = $string;
} else {
$result = $this->convertEncoding($string, 'UTF-8', $this->getEncoding());
}
if (! $this->isUtf8($result)) {
throw new Exception\RuntimeException(
sprintf('String to be escaped was not valid UTF-8 or could not be converted: %s', $result)
);
}
return $result;
}
/**
* Converts a string from UTF-8 to the base encoding. The base encoding is set via this
*
* @param string $string
* @return string
*/
protected function fromUtf8($string)
{
if ($this->getEncoding() === 'utf-8') {
return $string;
}
return $this->convertEncoding($string, $this->getEncoding(), 'UTF-8');
}
/**
* Checks if a given string appears to be valid UTF-8 or not.
*
* @param string $string
* @return bool
*/
protected function isUtf8($string)
{
return $string === '' || preg_match('/^./su', $string);
}
/**
* Encoding conversion helper which wraps iconv and mbstring where they exist or throws
* and exception where neither is available.
*
* @param string $string
* @param string $to
* @param array|string $from
* @throws Exception\RuntimeException
* @return string
*/
protected function convertEncoding($string, $to, $from)
{
if (function_exists('iconv')) {
$result = iconv($from, $to, $string);
} elseif (function_exists('mb_convert_encoding')) {
$result = mb_convert_encoding($string, $to, $from);
} else {
throw new Exception\RuntimeException(
static::class
. ' requires either the iconv or mbstring extension to be installed'
. ' when escaping for non UTF-8 strings.'
);
}
if ($result === false) {
return ''; // return non-fatal blank string on encoding errors from users
}
return $result;
}
}

View File

@@ -1,9 +0,0 @@
<?php
declare(strict_types=1);
namespace Laminas\Escaper\Exception;
interface ExceptionInterface
{
}

View File

@@ -1,13 +0,0 @@
<?php
declare(strict_types=1);
namespace Laminas\Escaper\Exception;
/**
* Invalid argument exception
*/
class InvalidArgumentException extends \InvalidArgumentException implements
ExceptionInterface
{
}

View File

@@ -1,13 +0,0 @@
<?php
declare(strict_types=1);
namespace Laminas\Escaper\Exception;
/**
* Invalid argument exception
*/
class RuntimeException extends \RuntimeException implements
ExceptionInterface
{
}

View File

@@ -0,0 +1,35 @@
name: Bug report 🐛
description: The library does not work as expected
body:
- type: checkboxes
attributes:
label: Guidelines
description: Please confirm this is a bug report and not general troubleshooting.
options:
- label: I understand that [if I fail to adhere to contribution guidelines and/or fail to provide all required details, this issue may be closed without review](https://github.com/mpdf/mpdf/blob/development/.github/CONTRIBUTING.md).
required: true
- type: textarea
attributes:
label: Description of the bug
validations:
required: true
- type: input
attributes:
label: mPDF version
validations:
required: true
- type: input
attributes:
label: PHP Version and environment (server type, cli provider etc., enclosing libraries and their respective versions)
validations:
required: true
- type: textarea
attributes:
label: Reproducible PHP+CSS+HTML snippet suffering by the error
validations:
required: true

View File

@@ -0,0 +1,8 @@
name: Feature request 🚀
description: I would like to have a new functionality added
body:
- type: textarea
attributes:
label: Please describe the new functionality as best as you can.
validations:
required: true

View File

@@ -1,29 +0,0 @@
---
name: Bug report 🐛
about: The library does not work as expected (please use not for troubleshooting)
---
<!--
Fill in provided template with information about the bug
Provide a short and reproducible code example
⚠ Failing to provide necessary information will cause the issue to be closed until appropriately updated.
See Contributing guidelines for further information
-->
### I found this bug
### This is mPDF and PHP version and environment (server/fpm/cli etc) I am using
### This is the PHP code snippet I use
```
<?php
```
### This is the HTML/CSS code snippet I use
```
```

View File

@@ -1,8 +0,0 @@
---
name: Feature request 🚀
about: I would like to have a new functionality added
---
# Feature request
<!-- Please describe the new functionality as best as you can. -->

View File

@@ -1,3 +1,4 @@
blank_issues_enabled: false
contact_links:
- name: General questions and troubleshooting ❓
url: https://github.com/mpdf/mpdf/discussions

View File

@@ -2,5 +2,4 @@ How to disclose potential security issues
============
As mPDF does not have a domain or a dedicated contact apart from its Github repository, to prevent
disclosing maintainers' contacts publicly, please create an Issue about the security issue with means to contact you.
We will reach out to you as soon as possible.
disclosing maintainers' contacts publicly, please use [GitHub's Security Advisories system](https://github.com/mpdf/mpdf/security/advisories).

View File

@@ -25,7 +25,7 @@ jobs:
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"

View File

@@ -26,7 +26,7 @@ jobs:
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"

View File

@@ -30,11 +30,13 @@ jobs:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
operating-system: [ubuntu-latest, windows-latest]
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"

View File

@@ -1,3 +1,18 @@
mPDF 8.2.x
===========================
New features
------------
* Watermark text can now be colored using \Mpdf\Watermark DTO. \Mpdf\WatermarkImage DTO for images. (#1876)
* Added support for `psr/http-message` v2 without dropping v1. (@markdorison, @apotek, @greg-1-anderson, @NigelCunningham #1907)
* PHP 8.3 support in mPDF 8.2.1
* Add support for `page-break-before: avoid;` and `page-break-after: avoid;` for tr elements inside tables
Bugfixes
--------
* Replace character entities with characters when processing the `code` attribute in the `<barcode />` tag
mPDF 8.1.x
===========================
@@ -6,7 +21,10 @@ New features
* Service container for internal services
* Set /Lang entry for better accessibility when document language is available (@cuongmits, #1418)
* More verbose helper methods for `Output`: `OutputBinaryData`, `OutputHttpInline`, `OutputHttpDownload`, `OutputFile`
* More verbose helper methods for `Output`: `OutputBinaryData`, `OutputHttpInline`, `OutputHttpDownload`, `OutputFile` (since v8.1.2)
* Set font-size to `auto` in textarea and input in active forms to resize the font-size (@ChrisB9, #1721)
* PHP 8.2 support in mPDF 8.1.3
* Added support for `psr/log` v3 without dropping v2. (@markdorison, @apotek, @greg-1-anderson, #1857)
Bugfixes
--------
@@ -16,7 +34,8 @@ Bugfixes
* Testing and suppressing PNG file conversion errors
* Prevent hyphenation of urls starting with https and e-mail addresses (@HKandulla, #1634)
* Colorspace restrictor reads mode from Mpdf and works again (Fix for #1094)
* Prevent exception when multiple columns wrap to next page
* Update default `curlUserAgent` configuration variable from Firefox 13 to 108
mPDF 8.0.x
===========================

View File

@@ -18,11 +18,13 @@ Requirements
PHP versions and extensions
---------------------------
- `mPDF >=7.0` is supported on `PHP ^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0`
- `PHP >=5.6 <7.3.0` is supported for `mPDF >= 7.0`
- `PHP 7.3` is supported since `mPDF v7.1.7`
- `PHP 7.4` is supported since `mPDF v8.0.4`
- `PHP 8.0` is supported since `mPDF v8.0.10`
- `PHP 8.1` is supported as of `mPDF v8.0.13`
- `PHP 8.2` is supported as of `mPDF v8.1.3`
- `PHP 8.3` is supported as of `mPDF v8.2.1`
PHP `mbstring` and `gd` extensions have to be loaded.

View File

@@ -21,21 +21,22 @@
"docs": "http://mpdf.github.io"
},
"require": {
"php": "^5.6 || ^7.0 || ~8.0.0 || ~8.1.0",
"php": "^5.6 || ^7.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
"ext-gd": "*",
"ext-mbstring": "*",
"mpdf/psr-http-message-shim": "^1.0 || ^2.0",
"mpdf/psr-log-aware-trait": "^2.0 || ^3.0",
"myclabs/deep-copy": "^1.7",
"paragonie/random_compat": "^1.4|^2.0|^9.99.99",
"php-http/message-factory": "^1.0",
"psr/http-message": "^1.0",
"psr/log": "^1.0 || ^2.0",
"psr/http-message": "^1.0 || ^2.0",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"setasign/fpdi": "^2.1"
},
"require-dev": {
"mockery/mockery": "^1.3.0",
"mpdf/qrcode": "^1.1.0",
"squizlabs/php_codesniffer": "^3.5.0",
"tracy/tracy": "^2.4",
"tracy/tracy": "~2.5",
"yoast/phpunit-polyfills": "^1.0"
},
"suggest": {
@@ -46,7 +47,10 @@
"autoload": {
"psr-4": {
"Mpdf\\": "src/"
}
},
"files": [
"src/functions.php"
]
},
"autoload-dev": {
"psr-4": {

View File

@@ -6,7 +6,7 @@
<testsuites>
<testsuite name="Tests">
<directory suffix=".php">./tests</directory>
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>

View File

@@ -5,21 +5,22 @@ namespace Mpdf;
use Mpdf\File\LocalContentLoaderInterface;
use Mpdf\File\StreamWrapperChecker;
use Mpdf\Http\ClientInterface;
use Mpdf\Http\Request;
use Mpdf\Log\Context as LogContext;
use Mpdf\PsrHttpMessageShim\Request;
use Mpdf\PsrLogAwareTrait\PsrLogAwareTrait;
use Psr\Log\LoggerInterface;
class AssetFetcher implements \Psr\Log\LoggerAwareInterface
{
use PsrLogAwareTrait;
private $mpdf;
private $contentLoader;
private $http;
private $logger;
public function __construct(Mpdf $mpdf, LocalContentLoaderInterface $contentLoader, ClientInterface $http, LoggerInterface $logger)
{
$this->mpdf = $mpdf;
@@ -82,10 +83,10 @@ class AssetFetcher implements \Psr\Log\LoggerAwareInterface
$this->logger->debug(sprintf('Fetching remote content of file "%s"', $path), ['context' => LogContext::REMOTE_CONTENT]);
/** @var \Mpdf\Http\Response $response */
/** @var \Mpdf\PsrHttpMessageShim\Response $response */
$response = $this->http->sendRequest(new Request('GET', $path));
if ($response->getStatusCode() !== 200) {
if (!str_starts_with((string) $response->getStatusCode(), '2')) {
$message = sprintf('Non-OK HTTP response "%s" on fetching remote content "%s" because of an error', $response->getStatusCode(), $path);
if ($this->mpdf->debug) {
@@ -102,7 +103,7 @@ class AssetFetcher implements \Psr\Log\LoggerAwareInterface
} catch (\InvalidArgumentException $e) {
$message = sprintf('Unable to fetch remote content "%s" because of an error "%s"', $path, $e->getMessage());
if ($this->mpdf->debug) {
throw new \Mpdf\MpdfException($message, 0, $e);
throw new \Mpdf\MpdfException($message, 0, E_ERROR, null, null, $e);
}
$this->logger->warning($message);
@@ -113,12 +114,7 @@ class AssetFetcher implements \Psr\Log\LoggerAwareInterface
public function isPathLocal($path)
{
return strpos($path, '://') === false; // @todo More robust implementation
}
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
return str_starts_with($path, 'file://') || strpos($path, '://') === false; // @todo More robust implementation
}
}

View File

@@ -193,6 +193,10 @@ class ColorConverter
} elseif (strpos($color, '#') === 0) { // case of #nnnnnn or #nnn
$c = $this->processHashColor($color);
} elseif (preg_match('/(rgba|rgb|device-cmyka|cmyka|device-cmyk|cmyk|hsla|hsl|spot)\((.*?)\)/', $color, $m)) {
// ignore colors containing CSS variables
if (str_starts_with(mb_strtolower($m[2]), 'var(--')) {
$m[2] = '0, 0, 0, 100';
}
$c = $this->processModeColor($m[1], explode(',', $m[2]));
}

View File

@@ -515,7 +515,7 @@ class ConfigVariables
'curlExecutionTimeout' => null,
'curlProxy' => null,
'curlProxyAuth' => null,
'curlUserAgent' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:13.0) Gecko/20100101 Firefox/13.0.1',
'curlUserAgent' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0',
'exposeVersion' => true,
];

View File

@@ -6,7 +6,7 @@ use Mpdf\Color\ColorConverter;
use Mpdf\Css\TextVars;
use Mpdf\File\StreamWrapperChecker;
use Mpdf\Http\ClientInterface;
use Mpdf\Http\Request;
use Mpdf\PsrHttpMessageShim\Request;
use Mpdf\Utils\Arrays;
use Mpdf\Utils\UtfString;

View File

@@ -214,6 +214,10 @@ class Form
$js[] = ['K', $objattr['onKeystroke']];
}
if (!empty($objattr['use_auto_fontsize']) && $objattr['use_auto_fontsize'] === true) {
$this->mpdf->FontSizePt = 0.0;
}
$this->SetFormText($w, $h, $objattr['fieldname'], $val, $val, $objattr['title'], $flags, $fieldalign, false, (isset($objattr['maxlength']) ? $objattr['maxlength'] : false), $js, (isset($objattr['background-col']) ? $objattr['background-col'] : false), (isset($objattr['border-col']) ? $objattr['border-col'] : false));
} else {
@@ -319,6 +323,11 @@ class Form
if (!empty($objattr['onKeystroke'])) {
$js[] = ['K', $objattr['onKeystroke']];
}
if (!empty($objattr['use_auto_fontsize']) && $objattr['use_auto_fontsize'] === true) {
$this->mpdf->FontSizePt = 0.0;
}
$this->SetFormText($w, $h, $objattr['fieldname'], $texto, $texto, (isset($objattr['title']) ? $objattr['title'] : ''), $flags, $fieldalign, false, -1, $js, (isset($objattr['background-col']) ? $objattr['background-col'] : false), (isset($objattr['border-col']) ? $objattr['border-col'] : false));
$this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));

View File

@@ -53,7 +53,7 @@ class Gradient
$this->mpdf->gradients[$n]['stream'] = '';
for ($i = 0; $i < count($patch_array); $i++) {
$this->mpdf->gradients[$n]['stream'].=chr($patch_array[$i]['f']); //start with the edge flag as 8 bit
$this->mpdf->gradients[$n]['stream'] .= chr($patch_array[$i]['f']); //start with the edge flag as 8 bit
for ($j = 0; $j < count($patch_array[$i]['points']); $j++) {
@@ -93,7 +93,7 @@ class Gradient
$trans = true;
}
} elseif ($colspace === 'Gray') {
$this->mpdf->gradients[$n]['stream'].= $patch_array[$i]['colors'][$j][1];
$this->mpdf->gradients[$n]['stream'] .= $patch_array[$i]['colors'][$j][1];
if ($patch_array[$i]['colors'][$j][2] == 1) {
$trans = true;
} // transparency converted from rgba or cmyka()
@@ -620,15 +620,19 @@ class Gradient
$g['colorspace'] = 'RGB';
$g['extend'] = ['true', 'true'];
$v = trim($m[1]);
// Change commas inside e.g. rgb(x,x,x)
while (preg_match('/(\([^\)]*?),/', $v)) {
$v = preg_replace('/(\([^\)]*?),/', '\\1@', $v);
}
// Remove spaces inside e.g. rgb(x, x, x)
while (preg_match('/(\([^\)]*?)[ ]/', $v)) {
$v = preg_replace('/(\([^\)]*?)[ ]/', '\\1', $v);
}
$bgr = preg_split('/\s*,\s*/', $v);
for ($i = 0; $i < count($bgr); $i++) {
$bgr[$i] = preg_replace('/@/', ',', $bgr[$i]);
}
@@ -645,8 +649,10 @@ class Gradient
$startStops = 0;
}
}
// first part a valid point/angle?
if ($startStops === 1) { // default values
// [<point> || <angle>,] = [<% em px left center right bottom top> || <deg grad rad 0>,]
if (preg_match('/([\-]*[0-9\.]+)(deg|grad|rad)/i', $bgr[0], $m)) {
$angle = $m[1] + 0;
@@ -662,16 +668,19 @@ class Gradient
} elseif (trim($first[count($first) - 1]) === '0') {
$angle = 0;
}
if (stripos($bgr[0], 'left') !== false) {
$startx = 0;
} elseif (stripos($bgr[0], 'right') !== false) {
$startx = 1;
} elseif (stripos($bgr[0], 'right') !== false) {
$startx = 0;
}
if (stripos($bgr[0], 'top') !== false) {
$starty = 1;
} elseif (stripos($bgr[0], 'bottom') !== false) {
$starty = 0;
}
// Check for %? ?% or %%
if (preg_match('/(\d+)[%]/i', $first[0], $m)) {
$startx = $m[1] / 100;
@@ -681,6 +690,7 @@ class Gradient
$startx = $m[1];
}
}
if (isset($first[1]) && preg_match('/(\d+)[%]/i', $first[1], $m)) {
$starty = 1 - ($m[1] / 100);
} elseif (!isset($starty) && isset($first[1]) && preg_match('/([0-9.]+(px|em|ex|pc|pt|cm|mm|in))/i', $first[1], $m)) {
@@ -689,12 +699,15 @@ class Gradient
$starty = $m[1];
}
}
if (isset($startx) && !isset($starty)) {
$starty = 0.5;
}
if (!isset($startx) && isset($starty)) {
$startx = 0.5;
}
} else {
// If neither a <point> or <angle> is specified, i.e. the entire function consists of only <stop> values,
// the gradient axis starts from the top of the box and runs vertically downwards, ending at the bottom of
@@ -704,31 +717,41 @@ class Gradient
$endy = 0;
$endx = 0.5;
}
if (!isset($startx)) {
$startx = false;
}
if (!isset($starty)) {
$starty = false;
}
if (!isset($endx)) {
$endx = false;
}
if (!isset($endy)) {
$endy = false;
}
if (!isset($angle)) {
$angle = false;
}
$g['coords'] = [$startx, $starty, $endx, $endy, $angle, $repeat];
$g['stops'] = [];
for ($i = $startStops; $i < count($bgr); $i++) {
// parse stops
$el = preg_split('/\s+/', trim($bgr[$i]));
// mPDF 5.3.74
$col = $this->colorConverter->convert($el[0], $this->mpdf->PDFAXwarnings);
if (!$col) {
$col = $this->colorConverter->convert(255, $this->mpdf->PDFAXwarnings);
}
if ($col[0] == 1) {
$g['colorspace'] = 'Gray';
} elseif ($col[0] == 4 || $col[0] == 6) {
@@ -737,6 +760,7 @@ class Gradient
$g['stops'][] = $this->getStop($col, $el, true);
}
return $g;
}

View File

@@ -4,16 +4,18 @@ namespace Mpdf\Http;
use Mpdf\Log\Context as LogContext;
use Mpdf\Mpdf;
use Mpdf\PsrHttpMessageShim\Response;
use Mpdf\PsrHttpMessageShim\Stream;
use Mpdf\PsrLogAwareTrait\PsrLogAwareTrait;
use Psr\Http\Message\RequestInterface;
use Psr\Log\LoggerInterface;
class CurlHttpClient implements \Mpdf\Http\ClientInterface, \Psr\Log\LoggerAwareInterface
{
use PsrLogAwareTrait;
private $mpdf;
private $logger;
public function __construct(Mpdf $mpdf, LoggerInterface $logger)
{
$this->mpdf = $mpdf;
@@ -96,7 +98,7 @@ class CurlHttpClient implements \Mpdf\Http\ClientInterface, \Psr\Log\LoggerAware
}
$info = curl_getinfo($ch);
if (isset($info['http_code']) && $info['http_code'] !== 200) {
if (isset($info['http_code']) && !str_starts_with((string) $info['http_code'], '2')) {
$message = sprintf('HTTP error: %d', $info['http_code']);
$this->logger->error($message, ['context' => LogContext::REMOTE_CONTENT]);
@@ -116,9 +118,4 @@ class CurlHttpClient implements \Mpdf\Http\ClientInterface, \Psr\Log\LoggerAware
->withBody(Stream::create($data));
}
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
}

View File

@@ -3,13 +3,16 @@
namespace Mpdf\Http;
use Mpdf\Log\Context as LogContext;
use Mpdf\PsrHttpMessageShim\Response;
use Mpdf\PsrHttpMessageShim\Stream;
use Mpdf\PsrLogAwareTrait\PsrLogAwareTrait;
use Psr\Http\Message\RequestInterface;
use Psr\Log\LoggerInterface;
class SocketHttpClient implements \Mpdf\Http\ClientInterface, \Psr\Log\LoggerAwareInterface
{
private $logger;
use PsrLogAwareTrait;
public function __construct(LoggerInterface $logger)
{
@@ -104,9 +107,4 @@ class SocketHttpClient implements \Mpdf\Http\ClientInterface, \Psr\Log\LoggerAwa
->withBody($stream);
}
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
}

View File

@@ -13,12 +13,15 @@ use Mpdf\Language\ScriptToLanguageInterface;
use Mpdf\Log\Context as LogContext;
use Mpdf\Mpdf;
use Mpdf\Otl;
use Mpdf\PsrLogAwareTrait\PsrLogAwareTrait;
use Mpdf\SizeConverter;
use Psr\Log\LoggerInterface;
class ImageProcessor implements \Psr\Log\LoggerAwareInterface
{
use PsrLogAwareTrait;
/**
* @var \Mpdf\Mpdf
*/
@@ -89,11 +92,6 @@ class ImageProcessor implements \Psr\Log\LoggerAwareInterface
*/
private $assetFetcher;
/**
* @var \Psr\Log\LoggerInterface
*/
public $logger;
public function __construct(
Mpdf $mpdf,
Otl $otl,
@@ -126,18 +124,6 @@ class ImageProcessor implements \Psr\Log\LoggerAwareInterface
$this->failedImages = [];
}
/**
* @param \Psr\Log\LoggerInterface
*
* @return self
*/
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
return $this;
}
public function getImage(&$file, $firstTime = true, $allowvector = true, $orig_srcpath = false, $interpolation = false)
{
// mPDF 6

View File

@@ -10,11 +10,11 @@ use Mpdf\Css\TextVars;
use Mpdf\Log\Context as LogContext;
use Mpdf\Fonts\MetricsGenerator;
use Mpdf\Output\Destination;
use Mpdf\PsrLogAwareTrait\MpdfPsrLogAwareTrait;
use Mpdf\QrCode;
use Mpdf\Utils\Arrays;
use Mpdf\Utils\NumericString;
use Mpdf\Utils\UtfString;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
/**
@@ -30,11 +30,14 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
use Strict;
use FpdiTrait;
use MpdfPsrLogAwareTrait;
const VERSION = '8.1.2';
const VERSION = '8.2.4';
const SCALE = 72 / 25.4;
const OBJECT_IDENTIFIER = "\xbb\xa4\xac";
var $useFixedNormalLineHeight; // mPDF 6
var $useFixedTextBaseline; // mPDF 6
var $adjustFontDescLineheight; // mPDF 6
@@ -830,6 +833,9 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
private $preambleWritten = false;
private $watermarkTextObject;
private $watermarkImageObject;
/**
* @var string
*/
@@ -966,11 +972,6 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
*/
private $scriptToLanguage;
/**
* @var \Psr\Log\LoggerInterface
*/
private $logger;
/**
* @var \Mpdf\Writer\BaseWriter
*/
@@ -1224,7 +1225,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$this->breakpoints = []; // used in columnbuffer
$this->tableLevel = 0;
$this->tbctr = []; // counter for nested tables at each level
$this->page_box = [];
$this->page_box = new PageBox();
$this->show_marks = ''; // crop or cross marks
$this->kwt = false;
$this->kwt_height = 0;
@@ -1579,24 +1580,6 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$this->createdReaders = [];
}
/**
* @param \Psr\Log\LoggerInterface
*
* @return \Mpdf\Mpdf
*/
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
foreach ($this->services as $name) {
if ($this->$name && $this->$name instanceof \Psr\Log\LoggerAwareInterface) {
$this->$name->setLogger($logger);
}
}
return $this;
}
private function initConfig(array $config)
{
$configObject = new ConfigVariables();
@@ -1656,11 +1639,9 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
}
// e.g. A4-L = A4 landscape, A4-P = A4 portrait
$orientation = $orientation ?: 'P';
if (preg_match('/([0-9a-zA-Z]*)-([P,L])/i', $format, $m)) {
$format = $m[1];
$orientation = $m[2];
} elseif (empty($orientation)) {
$orientation = 'P';
list(, $format, $orientation) = $m;
}
$format = PageFormat::getSizeFromName($format);
@@ -1683,11 +1664,11 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
// Page orientation
$orientation = strtolower($orientation);
if ($orientation === 'p' || $orientation == 'portrait') {
if ($orientation === 'p' || $orientation === 'portrait') {
$orientation = 'P';
$this->wPt = $this->fwPt;
$this->hPt = $this->fhPt;
} elseif ($orientation === 'l' || $orientation == 'landscape') {
} elseif ($orientation === 'l' || $orientation === 'landscape') {
$orientation = 'L';
$this->wPt = $this->fhPt;
$this->hPt = $this->fwPt;
@@ -5435,26 +5416,15 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
function applyGPOSpdf($txt, $aix, $x, $y, $OTLdata, $textvar = 0)
{
// Generate PDF string
// ==============================
if ((isset($this->CurrentFont['sip']) && $this->CurrentFont['sip']) || (isset($this->CurrentFont['smp']) && $this->CurrentFont['smp'])) {
$sipset = true;
} else {
$sipset = false;
}
$sipset = (isset($this->CurrentFont['sip']) && $this->CurrentFont['sip'])
|| (isset($this->CurrentFont['smp']) && $this->CurrentFont['smp']);
if ($textvar & TextVars::FC_SMALLCAPS) {
$smcaps = true;
} // IF SmallCaps using transformation, NOT OTL
else {
$smcaps = false;
}
$smcaps = ($textvar & TextVars::FC_SMALLCAPS);
$fontid = $sipset
? $last_fontid = $original_fontid = $this->CurrentFont['subsetfontids'][0]
: $last_fontid = $original_fontid = $this->CurrentFont['i'];
if ($sipset) {
$fontid = $last_fontid = $original_fontid = $this->CurrentFont['subsetfontids'][0];
} else {
$fontid = $last_fontid = $original_fontid = $this->CurrentFont['i'];
}
$SmallCapsON = false; // state: uppercase/not
$lastSmallCapsON = false; // state: uppercase/not
$last_fontsize = $fontsize = $this->FontSizePt;
@@ -5471,14 +5441,9 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$XshiftAfter = 0;
$lastYPlacement = 0;
if ($sipset) {
// mPDF 6 DELETED ********
// $txt= preg_replace('/'.preg_quote($this->aliasNbPg,'/').'/', chr(7), $txt); // ? Need to adjust OTL info
// $txt= preg_replace('/'.preg_quote($this->aliasNbPgGp,'/').'/', chr(8), $txt); // ? Need to adjust OTL info
$tj = '<';
} else {
$tj = '(';
}
$tj = $sipset
? '<'
: '(';
for ($i = 0; $i < count($unicode); $i++) {
$c = $unicode[$i];
@@ -5496,7 +5461,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
}
// XPlacement from GPOS
if (isset($GPOSinfo[$i]['XPlacement']) && $GPOSinfo[$i]['XPlacement']) {
if (!isset($GPOSinfo[$i]['wDir']) || $GPOSinfo[$i]['wDir'] != 'RTL') {
if (!isset($GPOSinfo[$i]['wDir']) || $GPOSinfo[$i]['wDir'] !== 'RTL') {
if (isset($GPOSinfo[$i]['BaseWidth'])) {
$GPOSinfo[$i]['XPlacement'] -= $GPOSinfo[$i]['BaseWidth'];
}
@@ -5518,19 +5483,19 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$XshiftAfter += $wordspacing;
}
if (substr($OTLdata['group'], ($i + 1), 1) != 'M') { // Don't add inter-character spacing before Marks
if (substr($OTLdata['group'], ($i + 1), 1) !== 'M') { // Don't add inter-character spacing before Marks
$XshiftAfter += $charspacing;
}
// ...applyGPOSpdf...
// XAdvance from GPOS - Convert to PDF Text space (thousandths of a unit );
if (((isset($GPOSinfo[$i]['wDir']) && $GPOSinfo[$i]['wDir'] != 'RTL') || !isset($GPOSinfo[$i]['wDir'])) && isset($GPOSinfo[$i]['XAdvanceL']) && $GPOSinfo[$i]['XAdvanceL']) {
if (((isset($GPOSinfo[$i]['wDir']) && $GPOSinfo[$i]['wDir'] !== 'RTL') || !isset($GPOSinfo[$i]['wDir'])) && isset($GPOSinfo[$i]['XAdvanceL']) && $GPOSinfo[$i]['XAdvanceL']) {
$XshiftAfter += $GPOSinfo[$i]['XAdvanceL'] * 1000 / $this->CurrentFont['unitsPerEm'];
} elseif (isset($GPOSinfo[$i]['wDir']) && $GPOSinfo[$i]['wDir'] == 'RTL' && isset($GPOSinfo[$i]['XAdvanceR']) && $GPOSinfo[$i]['XAdvanceR']) {
} elseif (isset($GPOSinfo[$i]['wDir']) && $GPOSinfo[$i]['wDir'] === 'RTL' && isset($GPOSinfo[$i]['XAdvanceR']) && $GPOSinfo[$i]['XAdvanceR']) {
$XshiftAfter += $GPOSinfo[$i]['XAdvanceR'] * 1000 / $this->CurrentFont['unitsPerEm'];
}
} // Character & Word spacing - if NOT OTL
else {
} else { // Character & Word spacing - if NOT OTL
$XshiftAfter += $charspacing;
if ($c == 32) {
$XshiftAfter += $wordspacing;
@@ -5544,7 +5509,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
}
}
if ($YPlacement != $lastYPlacement) {
if ($YPlacement !== $lastYPlacement) {
$groupBreak = true;
}
@@ -5582,16 +5547,6 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
// Prepare Text and Select Font ID
if ($sipset) {
// mPDF 6 DELETED ********
// if ($c == 7 || $c == 8) {
// if ($original_fontid != $last_fontid) {
// $groupBreak = true;
// $fontid = $original_fontid;
// }
// if ($c == 7) { $tj .= $this->aliasNbPgHex; }
// else { $tj .= $this->aliasNbPgGpHex; }
// continue;
// }
for ($j = 0; $j < 99; $j++) {
$init = array_search($c, $this->CurrentFont['subsets'][$j]);
if ($init !== false) {
@@ -5600,8 +5555,11 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$fontid = $this->CurrentFont['subsetfontids'][$j];
}
$tx = sprintf("%02s", strtoupper(dechex($init)));
break;
} elseif (count($this->CurrentFont['subsets'][$j]) < 255) {
}
if (count($this->CurrentFont['subsets'][$j]) < 255) {
$n = count($this->CurrentFont['subsets'][$j]);
$this->CurrentFont['subsets'][$j][$n] = $c;
if ($this->CurrentFont['subsetfontids'][$j] != $last_fontid) {
@@ -5609,44 +5567,53 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$fontid = $this->CurrentFont['subsetfontids'][$j];
}
$tx = sprintf("%02s", strtoupper(dechex($n)));
break;
} elseif (!isset($this->CurrentFont['subsets'][($j + 1)])) {
}
if (!isset($this->CurrentFont['subsets'][($j + 1)])) {
$this->CurrentFont['subsets'][($j + 1)] = [0 => 0];
$this->CurrentFont['subsetfontids'][($j + 1)] = count($this->fonts) + $this->extraFontSubsets + 1;
$this->extraFontSubsets++;
}
}
} else {
$tx = UtfString::code2utf($c);
if ($this->usingCoreFont) {
$tx = utf8_decode($tx);
$tx = iconv('UTF-8', 'ISO-8859-1//TRANSLIT', $tx);
} else {
$tx = $this->writer->utf8ToUtf16BigEndian($tx, false);
}
$tx = $this->writer->escape($tx);
}
// If any settings require a new Text Group
if ($groupBreak || $fontstretch != $last_fontstretch) {
if ($sipset) {
$tj .= '>] TJ ';
} else {
$tj .= ')] TJ ';
}
$tj .= $sipset
? '>] TJ '
: ')] TJ ';
if ($fontid != $last_fontid || $fontsize != $last_fontsize) {
$tj .= sprintf(' /F%d %.3F Tf ', $fontid, $fontsize);
}
if ($fontstretch != $last_fontstretch) {
$tj .= sprintf('%d Tz ', $fontstretch);
}
if ($YPlacement != $lastYPlacement) {
$tj .= sprintf('%.3F Ts ', $YPlacement);
}
if ($sipset) {
$tj .= '[<';
} else {
$tj .= '[(';
}
$tj .= $sipset
? '[<'
: '[(';
}
// Output the code for the txt character
@@ -5667,32 +5634,43 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
// Get YPlacement from next Base character
$nextbase = $i + 1;
while ($OTLdata['group'][$nextbase] != 'C') {
while ($OTLdata['group'][$nextbase] !== 'C') {
$nextbase++;
}
if (isset($GPOSinfo[$nextbase]) && isset($GPOSinfo[$nextbase]['YPlacement']) && $GPOSinfo[$nextbase]['YPlacement']) {
$YPlacement = $GPOSinfo[$nextbase]['YPlacement'] * $this->FontSizePt / $this->CurrentFont['unitsPerEm'];
}
// Prepare Text and Select Font ID
if ($sipset) {
for ($j = 0; $j < 99; $j++) {
$init = array_search($c, $this->CurrentFont['subsets'][$j]);
if ($init !== false) {
if ($this->CurrentFont['subsetfontids'][$j] != $last_fontid) {
$fontid = $this->CurrentFont['subsetfontids'][$j];
}
$tx = sprintf("%02s", strtoupper(dechex($init)));
break;
} elseif (count($this->CurrentFont['subsets'][$j]) < 255) {
}
if (count($this->CurrentFont['subsets'][$j]) < 255) {
$n = count($this->CurrentFont['subsets'][$j]);
$this->CurrentFont['subsets'][$j][$n] = $c;
if ($this->CurrentFont['subsetfontids'][$j] != $last_fontid) {
$fontid = $this->CurrentFont['subsetfontids'][$j];
}
$tx = sprintf("%02s", strtoupper(dechex($n)));
break;
} elseif (!isset($this->CurrentFont['subsets'][($j + 1)])) {
}
if (!isset($this->CurrentFont['subsets'][($j + 1)])) {
$this->CurrentFont['subsets'][($j + 1)] = [0 => 0];
$this->CurrentFont['subsetfontids'][($j + 1)] = count($this->fonts) + $this->extraFontSubsets + 1;
$this->extraFontSubsets++;
@@ -5705,40 +5683,45 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
}
if ($kashida > $tatw) {
// Insert multiple tatweel characters, repositioning the last one to give correct total length
$fontstretch = 100;
$nt = intval($kashida / $tatw);
$nt = (int) ($kashida / $tatw);
$nudgeback = (($nt + 1) * $tatw) - $kashida;
$optx = str_repeat($tx, $nt);
if ($sipset) {
$optx .= sprintf('>%d<', ($nudgeback));
} else {
$optx .= sprintf(')%d(', ($nudgeback));
}
$optx .= $tx; // #last
} else {
// Insert single tatweel character and use fontstretch to get correct length
$fontstretch = ($kashida / $tatw) * 100;
$optx = $tx;
}
if ($sipset) {
$tj .= '>] TJ ';
} else {
$tj .= ')] TJ ';
}
$tj .= $sipset
? '>] TJ '
: ')] TJ ';
if ($fontid != $last_fontid || $fontsize != $last_fontsize) {
$tj .= sprintf(' /F%d %.3F Tf ', $fontid, $fontsize);
}
if ($fontstretch != $last_fontstretch) {
$tj .= sprintf('%d Tz ', $fontstretch);
}
$tj .= sprintf('%.3F Ts ', $YPlacement);
if ($sipset) {
$tj .= '[<';
} else {
$tj .= '[(';
}
$tj .= $sipset
? '[<'
: '[(';
// Output the code for the txt character(s)
$tj .= $optx;
@@ -5750,100 +5733,115 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$lastYPlacement = $YPlacement;
}
$tj .= $sipset
? '>'
: ')';
// Finish up
if ($sipset) {
$tj .= '>';
if ($XshiftAfter) {
$tj .= sprintf('%d', (-$XshiftAfter));
}
if ($last_fontid != $original_fontid) {
$tj .= '] TJ ';
$tj .= sprintf(' /F%d %.3F Tf ', $original_fontid, $fontsize);
$tj .= '[';
}
$tj = preg_replace('/([^\\\])<>/', '\\1 ', $tj);
} else {
$tj .= ')';
if ($XshiftAfter) {
$tj .= sprintf('%d', (-$XshiftAfter));
}
if ($last_fontid != $original_fontid) {
$tj .= '] TJ ';
$tj .= sprintf(' /F%d %.3F Tf ', $original_fontid, $fontsize);
$tj .= '[';
}
$tj = preg_replace('/([^\\\])\(\)/', '\\1 ', $tj);
}
$s = sprintf(' BT ' . $aix . ' 0 Tc 0 Tw [%s] TJ ET ', $x, $y, $tj);
$tj = $sipset
? preg_replace('/([^\\\])<>/', '\\1 ', $tj)
: preg_replace('/([^\\\])\(\)/', '\\1 ', $tj);
// echo $s."\n\n"; // exit;
return $s;
return sprintf(' BT ' . $aix . ' 0 Tc 0 Tw [%s] TJ ET ', $x, $y, $tj);
}
function _kern($txt, $mode, $aix, $x, $y)
{
if ($mode == 'MBTw') { // Multibyte requiring word spacing
if ($mode === 'MBTw') { // Multibyte requiring word spacing
$space = ' ';
// Convert string to UTF-16BE without BOM
$space = $this->writer->utf8ToUtf16BigEndian($space, false);
$space = $this->writer->escape($space);
$s = sprintf(' BT ' . $aix, $x * Mpdf::SCALE, ($this->h - $y) * Mpdf::SCALE);
$t = explode(' ', $txt);
for ($i = 0; $i < count($t); $i++) {
$tx = $t[$i];
foreach ($t as $i => $iValue) {
$tx = $iValue;
$tj = '(';
$unicode = $this->UTF8StringToArray($tx);
for ($ti = 0; $ti < count($unicode); $ti++) {
if ($ti > 0 && isset($this->CurrentFont['kerninfo'][$unicode[($ti - 1)]][$unicode[$ti]])) {
$kern = -$this->CurrentFont['kerninfo'][$unicode[($ti - 1)]][$unicode[$ti]];
foreach ($unicode as $ti => $tiValue) {
if ($ti > 0 && isset($this->CurrentFont['kerninfo'][$unicode[($ti - 1)]][$tiValue])) {
$kern = -$this->CurrentFont['kerninfo'][$unicode[($ti - 1)]][$tiValue];
$tj .= sprintf(')%d(', $kern);
}
$tc = UtfString::code2utf($unicode[$ti]);
$tc = UtfString::code2utf($tiValue);
$tc = $this->writer->utf8ToUtf16BigEndian($tc, false);
$tj .= $this->writer->escape($tc);
}
$tj .= ')';
$s .= sprintf(' %.3F Tc [%s] TJ', $this->charspacing, $tj);
if (($i + 1) < count($t)) {
$s .= sprintf(' %.3F Tc (%s) Tj', $this->ws + $this->charspacing, $space);
}
}
$s .= ' ET ';
} elseif (!$this->usingCoreFont) {
return $s;
}
if (!$this->usingCoreFont) {
$s = '';
$tj = '(';
$unicode = $this->UTF8StringToArray($txt);
for ($i = 0; $i < count($unicode); $i++) {
if ($i > 0 && isset($this->CurrentFont['kerninfo'][$unicode[($i - 1)]][$unicode[$i]])) {
$kern = -$this->CurrentFont['kerninfo'][$unicode[($i - 1)]][$unicode[$i]];
foreach ($unicode as $i => $iValue) {
if ($i > 0 && isset($this->CurrentFont['kerninfo'][$unicode[($i - 1)]][$iValue])) {
$kern = -$this->CurrentFont['kerninfo'][$unicode[($i - 1)]][$iValue];
$tj .= sprintf(')%d(', $kern);
}
$tx = UtfString::code2utf($unicode[$i]);
$tx = UtfString::code2utf($iValue);
$tx = $this->writer->utf8ToUtf16BigEndian($tx, false);
$tj .= $this->writer->escape($tx);
}
$tj .= ')';
$s .= sprintf(' BT ' . $aix . ' [%s] TJ ET ', $x * Mpdf::SCALE, ($this->h - $y) * Mpdf::SCALE, $tj);
} else { // CORE Font
return $s;
}
$s = '';
$tj = '(';
$l = strlen($txt);
for ($i = 0; $i < $l; $i++) {
if ($i > 0 && isset($this->CurrentFont['kerninfo'][$txt[($i - 1)]][$txt[$i]])) {
$kern = -$this->CurrentFont['kerninfo'][$txt[($i - 1)]][$txt[$i]];
$tj .= sprintf(')%d(', $kern);
}
$tj .= $this->writer->escape($txt[$i]);
}
$tj .= ')';
$s .= sprintf(' BT ' . $aix . ' [%s] TJ ET ', $x * Mpdf::SCALE, ($this->h - $y) * Mpdf::SCALE, $tj);
}
return $s;
}
@@ -7288,7 +7286,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$translate_x = $this->sizeConverter->convert($vv[0], $maxsize_x, false, false);
$tr2 .= $this->transformTranslate($translate_x, 0, true) . ' ';
} elseif ($c == 'translatey' && count($vv)) {
$translate_y = $this->sizeConverter->convert($vv[1], $maxsize_y, false, false);
$translate_y = $this->sizeConverter->convert($vv[0], $maxsize_y, false, false);
$tr2 .= $this->transformTranslate(0, $translate_y, true) . ' ';
} elseif ($c == 'scale' && count($vv)) {
$scale_x = $vv[0] * 100;
@@ -7302,7 +7300,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$scale_x = $vv[0] * 100;
$tr2 .= $this->transformScale($scale_x, 0, $cx, $cy, true) . ' ';
} elseif ($c == 'scaley' && count($vv)) {
$scale_y = $vv[1] * 100;
$scale_y = $vv[0] * 100;
$tr2 .= $this->transformScale(0, $scale_y, $cx, $cy, true) . ' ';
} elseif ($c == 'skew' && count($vv)) {
$angle_x = $this->ConvertAngle($vv[0], false);
@@ -7849,7 +7847,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
/* -- END CSS-IMAGE-FLOAT -- */
} // *TABLES*
// OBJECTS - IMAGES & FORM Elements (NB has already skipped line/page if required - in printbuffer)
if (substr($s, 0, 3) == "\xbb\xa4\xac") { // identifier has been identified!
if (substr($s, 0, 3) == Mpdf::OBJECT_IDENTIFIER) { // identifier has been identified!
$objattr = $this->_getObjAttr($s);
$h_corr = 0;
if ($is_table) { // *TABLES*
@@ -8230,8 +8228,13 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$contentB[count($content) - 1] = preg_replace('/R/', '', $contentB[count($content) - 1]); // ???
}
if ($type == 'hyphen') {
if ($type === 'hyphen') {
$hyphen = in_array(mb_substr($currContent, -1), ['-', '', '—'], true);
if (!$hyphen) {
$currContent .= '-';
} else {
$savedPreContent[count($savedPreContent) - 1] = '-' . $savedPreContent[count($savedPreContent) - 1];
}
if (!empty($cOTLdata[(count($cOTLdata) - 1)])) {
$cOTLdata[(count($cOTLdata) - 1)]['char_data'][] = ['bidi_class' => 9, 'uni' => 45];
$cOTLdata[(count($cOTLdata) - 1)]['group'] .= 'C';
@@ -9091,12 +9094,14 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
function _getObjAttr($t)
{
$c = explode("\xbb\xa4\xac", $t, 2);
$c = explode(",", $c[1], 2);
$c = explode(Mpdf::OBJECT_IDENTIFIER, $t, 2);
$c = explode(',', $c[1], 2);
foreach ($c as $v) {
$v = explode("=", $v, 2);
$sp[$v[0]] = $v[1];
$v = explode('=', $v, 2);
$sp[$v[0]] = trim($v[1], Mpdf::OBJECT_IDENTIFIER);
}
return (unserialize($sp['objattr']));
}
@@ -9741,6 +9746,13 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$this->margin_footer = $this->saveHTMLHeader[$n][$OE]['mf'];
$this->w = $this->saveHTMLHeader[$n][$OE]['pw'];
$this->h = $this->saveHTMLHeader[$n][$OE]['ph'];
if ($this->w > $this->h) {
$this->hPt = $this->fwPt;
$this->wPt = $this->fhPt;
} else {
$this->hPt = $this->fhPt;
$this->wPt = $this->fwPt;
}
$rotate = (isset($this->saveHTMLHeader[$n][$OE]['rotate']) ? $this->saveHTMLHeader[$n][$OE]['rotate'] : null);
$this->Reset();
$this->pageoutput[$n] = [];
@@ -9815,6 +9827,13 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$this->margin_footer = $this->saveHTMLFooter[$n][$OE]['mf'];
$this->w = $this->saveHTMLFooter[$n][$OE]['pw'];
$this->h = $this->saveHTMLFooter[$n][$OE]['ph'];
if ($this->w > $this->h) {
$this->hPt = $this->fwPt;
$this->wPt = $this->fhPt;
} else {
$this->hPt = $this->fhPt;
$this->wPt = $this->fwPt;
}
$rotate = (isset($this->saveHTMLFooter[$n][$OE]['rotate']) ? $this->saveHTMLFooter[$n][$OE]['rotate'] : null);
$this->Reset();
$this->pageoutput[$n] = [];
@@ -10129,6 +10148,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$this->page++;
$this->pages[$this->page] = '';
}
$this->state = 2;
$resetHTMLHeadersrequired = false;
@@ -10138,15 +10158,15 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
/* -- CSS-PAGE -- */
// Paged media (page-box)
if ($pagesel || (isset($this->page_box['using']) && $this->page_box['using'])) {
if ($pagesel || $this->page_box['using']) {
if ($pagesel || $this->page == 1) {
if ($pagesel || $this->page === 1) {
$first = true;
} else {
$first = false;
}
if ($this->mirrorMargins && ($this->page % 2 == 0)) {
if ($this->mirrorMargins && ($this->page % 2 === 0)) {
$oddEven = 'E';
} else {
$oddEven = 'O';
@@ -10162,7 +10182,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
list($orientation, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $hname, $fname, $bg, $resetpagenum, $pagenumstyle, $suppress, $marks, $newformat) = $this->SetPagedMediaCSS($psel, $first, $oddEven);
if ($this->mirrorMargins && ($this->page % 2 == 0)) {
if ($this->mirrorMargins && ($this->page % 2 === 0)) {
if ($hname) {
$ehvalue = 1;
@@ -10245,15 +10265,15 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
}
}
if ($orientation != $this->CurOrientation || $newformat) {
if ($orientation !== $this->CurOrientation || $newformat) {
// Change orientation
if ($orientation == 'P') {
if ($orientation === 'P') {
$this->wPt = $this->fwPt;
$this->hPt = $this->fhPt;
$this->w = $this->fw;
$this->h = $this->fh;
if (($this->forcePortraitHeaders || $this->forcePortraitMargins) && $this->DefOrientation == 'P') {
if (($this->forcePortraitHeaders || $this->forcePortraitMargins) && $this->DefOrientation === 'P') {
$this->tMargin = $this->orig_tMargin;
$this->bMargin = $this->orig_bMargin;
$this->DeflMargin = $this->orig_lMargin;
@@ -10269,7 +10289,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$this->w = $this->fh;
$this->h = $this->fw;
if (($this->forcePortraitHeaders || $this->forcePortraitMargins) && $this->DefOrientation == 'P') {
if (($this->forcePortraitHeaders || $this->forcePortraitMargins) && $this->DefOrientation === 'P') {
$this->tMargin = $this->orig_lMargin;
$this->bMargin = $this->orig_rMargin;
$this->DeflMargin = $this->orig_bMargin;
@@ -10290,10 +10310,10 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$this->pageDim[$this->page]['w'] = $this->w;
$this->pageDim[$this->page]['h'] = $this->h;
$this->pageDim[$this->page]['outer_width_LR'] = isset($this->page_box['outer_width_LR']) ? $this->page_box['outer_width_LR'] : 0;
$this->pageDim[$this->page]['outer_width_TB'] = isset($this->page_box['outer_width_TB']) ? $this->page_box['outer_width_TB'] : 0;
$this->pageDim[$this->page]['outer_width_LR'] = $this->page_box['outer_width_LR'] ?: 0;
$this->pageDim[$this->page]['outer_width_TB'] = $this->page_box['outer_width_TB'] ?: 0;
if (!isset($this->page_box['outer_width_LR']) && !isset($this->page_box['outer_width_TB'])) {
if (!$this->page_box['outer_width_LR'] && !$this->page_box['outer_width_TB']) {
$this->pageDim[$this->page]['bleedMargin'] = 0;
} elseif ($this->bleedMargin <= $this->page_box['outer_width_LR'] && $this->bleedMargin <= $this->page_box['outer_width_TB']) {
$this->pageDim[$this->page]['bleedMargin'] = $this->bleedMargin;
@@ -10573,7 +10593,8 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$this->SetAlpha($alpha);
$this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
$color = $this->watermarkTextObject ? $this->watermarkTextObject->getColor() : 0;
$this->SetTColor($this->colorConverter->convert($color, $this->PDFAXwarnings));
$szfont = $fontsize;
$loop = 0;
@@ -10603,6 +10624,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$this->Rotate($angle, $wx, $wy);
$this->Text($wx, $wy, $texte, $OTLdata, $textvar);
$this->Rotate(0);
$this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
$this->SetAlpha(1);
@@ -13067,17 +13089,41 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
function SetWatermarkText($txt = '', $alpha = -1)
{
if ($txt instanceof \Mpdf\WatermarkText) {
$this->watermarkTextObject = $txt;
$this->watermarkText = $txt->getText();
$this->watermarkTextAlpha = $txt->getAlpha();
$this->watermarkAngle = $txt->getAngle();
$this->watermark_font = $txt->getFont() === null ? $txt->getFont() : $this->watermark_font;
$this->watermark_size = $txt->getSize();
return;
}
if ($alpha >= 0) {
$this->watermarkTextAlpha = $alpha;
}
$this->watermarkText = $txt;
}
function SetWatermarkImage($src, $alpha = -1, $size = 'D', $pos = 'F')
{
if ($src instanceof \Mpdf\WatermarkImage) {
$this->watermarkImage = $src->getPath();
$this->watermark_size = $src->getSize();
$this->watermark_pos = $src->getPosition();
$this->watermarkImageAlpha = $src->getAlpha();
$this->watermarkImgBehind = $src->isBehindContent();
$this->watermarkImgAlphaBlend = $src->getAlphaBlend();
return;
}
if ($alpha >= 0) {
$this->watermarkImageAlpha = $alpha;
}
$this->watermarkImage = $src;
$this->watermark_size = $size;
$this->watermark_pos = $pos;
@@ -13185,7 +13231,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
/* -- WATERMARK -- */
if (($this->watermarkText) && ($this->showWatermarkText)) {
$this->watermark($this->watermarkText, $this->watermarkAngle, 120, $this->watermarkTextAlpha); // Watermark text
$this->watermark($this->watermarkText, $this->watermarkAngle, is_int($this->watermark_size) ? $this->watermark_size : 120, $this->watermarkTextAlpha); // Watermark text
}
if (($this->watermarkImage) && ($this->showWatermarkImage)) {
$this->watermarkImg($this->watermarkImage, $this->watermarkImageAlpha); // Watermark image
@@ -13595,7 +13641,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$objattr['text'] = $e;
$objattr['OTLdata'] = $this->OTLdata;
$this->OTLdata = [];
$te = "\xbb\xa4\xactype=textarea,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$te = Mpdf::OBJECT_IDENTIFIER . "type=textarea,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
if ($this->tdbegin) {
$this->_saveCellTextBuffer($te, $this->HREF);
} else {
@@ -15518,7 +15564,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$objattr['listmarkerposition'] = $listitemposition;
$e = "\xbb\xa4\xactype=image,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=image,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
$this->_saveTextBuffer($e);
if ($listitemposition == 'inside') {
@@ -15549,7 +15595,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$objattr['fontsizept'] = $this->FontSizePt;
$objattr['fontstyle'] = $this->FontStyle;
$e = "\xbb\xa4\xactype=listmarker,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=listmarker,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
$this->listitem = $this->_saveTextBuffer($e, '', '', true); // true returns array
} elseif (preg_match('/U\+([a-fA-F0-9]+)/i', $listitemtype, $m)) { // SYMBOL 2 (needs new font)
@@ -15587,7 +15633,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$objattr['fontsize'] = $this->FontSize;
$objattr['fontsizept'] = $this->FontSizePt;
$objattr['fontstyle'] = $this->FontStyle;
$e = "\xbb\xa4\xactype=listmarker,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=listmarker,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
$this->listitem = $this->_saveTextBuffer($e, '', '', true); // true returns array
}
@@ -15626,7 +15672,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$objattr['fontsize'] = $this->FontSize;
$objattr['fontsizept'] = $this->FontSizePt;
$objattr['fontstyle'] = $this->FontStyle;
$e = "\xbb\xa4\xactype=listmarker,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=listmarker,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
$this->listitem = $this->_saveTextBuffer($e, '', '', true); // true returns array
}
@@ -16019,7 +16065,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
// First make sure each element/chunk has the OTLdata for Bidi set.
for ($i = 0; $i < $array_size; $i++) {
if (empty($arrayaux[$i][18])) {
if (substr($arrayaux[$i][0], 0, 3) == "\xbb\xa4\xac") { // object identifier has been identified!
if (substr($arrayaux[$i][0], 0, 3) == Mpdf::OBJECT_IDENTIFIER) { // object identifier has been identified!
$unicode = [0xFFFC]; // Object replacement character
} else {
$unicode = $this->UTF8StringToArray($arrayaux[$i][0], false);
@@ -16042,10 +16088,9 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$array_size = count($arrayaux);
}
// Remove empty items // mPDF 6
for ($i = $array_size - 1; $i > 0; $i--) {
if (empty($arrayaux[$i][0]) && (isset($arrayaux[$i][16]) && $arrayaux[$i][16] !== '0') && empty($arrayaux[$i][7])) {
if ('' === $arrayaux[$i][0] && (isset($arrayaux[$i][16]) && $arrayaux[$i][16] !== '0') && empty($arrayaux[$i][7])) {
unset($arrayaux[$i]);
}
}
@@ -16092,7 +16137,8 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
}
// FIXED TO ALLOW IT TO SHOW '0'
if (empty($vetor[0]) && !($vetor[0] === '0') && empty($vetor[7])) { // Ignore empty text and not carrying an internal link
if (empty($vetor[0]) && !($vetor[0] === '0') && empty($vetor[7])) {
// Ignore empty text and not carrying an internal link
// Check if it is the last element. If so then finish printing the block
if ($i == ($array_size - 1)) {
$this->finishFlowingBlock(true);
@@ -16206,7 +16252,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
// SPECIAL CONTENT - IMAGES & FORM OBJECTS
// Print-out special content
if (substr($vetor[0], 0, 3) == "\xbb\xa4\xac") { // identifier has been identified!
if (substr($vetor[0], 0, 3) == Mpdf::OBJECT_IDENTIFIER) { // identifier has been identified!
$objattr = $this->_getObjAttr($vetor[0]);
/* -- TABLES -- */
@@ -19133,7 +19179,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
}
// IMAGES & FORM ELEMENTS
if (substr($line, 0, 3) == "\xbb\xa4\xac") { // inline object - FORM element or IMAGE!
if (substr($line, 0, 3) == Mpdf::OBJECT_IDENTIFIER) { // inline object - FORM element or IMAGE!
$objattr = $this->_getObjAttr($line);
if ($objattr['type'] != 'hr' && isset($objattr['width']) && ($objattr['width'] / $this->shrin_k) > ($maxwidth + 0.0001)) {
if (($objattr['width'] / $this->shrin_k) > $biggestword) {
@@ -20793,7 +20839,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
for ($i = $row + 1; $i < $table['nr']; $i++) {
$cellsset = 0;
for ($j = 0; $j < $table['nc']; $j++) {
if ($table['cells'][$i][$j]) {
if (!empty($table['cells'][$i][$j])) {
if (isset($table['cells'][$i][$j]['colspan'])) {
$cellsset += $table['cells'][$i][$j]['colspan'];
} else {
@@ -21908,10 +21954,10 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
if (isset($cell['textbuffer'])) {
for ($n = 0; $n < count($cell['textbuffer']); $n++) {
$t = $cell['textbuffer'][$n][0];
if (substr($t, 0, 19) == "\xbb\xa4\xactype=nestedtable") {
if (substr($t, 0, 19) == Mpdf::OBJECT_IDENTIFIER . "type=nestedtable") {
$objattr = $this->_getObjAttr($t);
$objattr['col'] = $col;
$cell['textbuffer'][$n][0] = "\xbb\xa4\xactype=nestedtable,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$cell['textbuffer'][$n][0] = Mpdf::OBJECT_IDENTIFIER . "type=nestedtable,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
$this->table[($this->tableLevel + 1)][$objattr['nestedcontent']]['nestedpos'][1] = $col;
}
}
@@ -22192,7 +22238,13 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$extra = $table['max_cell_border_width']['B'] / 2;
}
if ($j == $startcol && ((($y + $maxrowheight + $extra ) > ($pagetrigger + 0.001)) || (($this->keepColumns || !$this->ColActive) && !empty($tablefooter) && ($y + $maxrowheight + $tablefooterrowheight + $extra) > $pagetrigger) && ($this->tableLevel == 1 && $i < ($numrows - $table['headernrows']))) && ($y0 > 0 || $x0 > 0) && !$this->InFooter && $this->autoPageBreak) {
// lookahead for pagebreak
$pagebreaklookahead = 1;
while (isset($table['pagebreak-before']) && isset($table['pagebreak-before'][$i + $pagebreaklookahead]) && $table['pagebreak-before'][$i + $pagebreaklookahead] == 'avoid') {
// pagebreak-after is mapped to pagebreak-before on i+1 in Tags/Tr.php
$pagebreaklookahead++;
}
if ($j == $startcol && ((($y + $pagebreaklookahead * $maxrowheight + $extra ) > ($pagetrigger + 0.001)) || (($this->keepColumns || !$this->ColActive) && !empty($tablefooter) && ($y + $maxrowheight + $tablefooterrowheight + $extra) > $pagetrigger) && ($this->tableLevel == 1 && $i < ($numrows - $table['headernrows']))) && ($y0 > 0 || $x0 > 0) && !$this->InFooter && $this->autoPageBreak) {
if (!$skippage) {
$finalSpread = true;
$firstSpread = true;
@@ -24547,7 +24599,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$th = ($sum_h * $i / $this->NbCol);
foreach ($breaks as $bk => $val) {
if ($val > $th) {
if (($val - $th) < ($th - $breaks[$bk - 1])) {
if (!$bk || ($val - $th) < ($th - $breaks[$bk - 1])) {
$cbr[$i - 1] = $val;
} else {
$cbr[$i - 1] = $breaks[$bk - 1];
@@ -26090,7 +26142,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
{
if (!$this->is_utf8($html)) {
while (mb_convert_encoding(mb_convert_encoding($html, "UTF-32", "UTF-8"), "UTF-8", "UTF-32") != $html) {
while (mb_convert_encoding(mb_convert_encoding($html, "UTF-32", "UTF-8"), "UTF-8", "UTF-32") !== $html) {
$a = @iconv('UTF-8', 'UTF-8', $html);
$error = error_get_last();
@@ -27024,7 +27076,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
if (strlen($html) > (int) $limit) {
throw new \Mpdf\MpdfException(sprintf(
'The HTML code size is larger than pcre.backtrack_limit %d. You should use WriteHTML() with smaller string lengths.',
'The HTML code size is larger than pcre.backtrack_limit %d. You should use WriteHTML() with smaller string lengths. Pass your HTML in smaller chunks.',
$limit
));
}
@@ -27032,7 +27084,7 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
preg_match_all("/(<annotation.*?>)/si", $html, $m);
if (count($m[1])) {
for ($i = 0; $i < count($m[1]); $i++) {
$sub = preg_replace("/\n/si", "\xbb\xa4\xac", $m[1][$i]);
$sub = preg_replace("/\n/si", Mpdf::OBJECT_IDENTIFIER, $m[1][$i]);
$html = preg_replace('/' . preg_quote($m[1][$i], '/') . '/si', $sub, $html);
}
}
@@ -27170,8 +27222,16 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
$html = preg_replace('/<textarea([^>]*)><\/textarea>/si', '<textarea\\1> </textarea>', $html);
$html = preg_replace('/(<table[^>]*>)\s*(<caption)(.*?<\/caption>)(.*?<\/table>)/si', '\\2 position="top"\\3\\1\\4\\2 position="bottom"\\3', $html); // *TABLES*
$html = preg_replace('/<(h[1-6])([^>]*)(>(?:(?!h[1-6]).)*?<\/\\1>\s*<table)/si', '<\\1\\2 keep-with-table="1"\\3', $html); // *TABLES*
$html = preg_replace("/\xbb\xa4\xac/", "\n", $html);
if ($this->use_kwt) {
$returnHtml = preg_replace('/<(h[1-6])([^>]*(?<!\/))(>[^>]*<\/\\1>\s*<table)/si', '<\\1\\2 keep-with-table="1"\\3', $html);
/* If no errors then save the return value */
if (preg_last_error() === PREG_NO_ERROR) {
$html = $returnHtml;
}
}
$html = preg_replace('/' . Mpdf::OBJECT_IDENTIFIER . '/', "\n", $html);
// Fixes <p>&#8377</p> which browser copes with even though it is wrong!
$html = preg_replace("/(&#[x]{0,1}[0-9a-f]{1,5})</i", "\\1;<", $html);

View File

@@ -1539,6 +1539,10 @@ class Otl
continue;
}
if (!isset($this->OTLdata[$ptr + 1])) {
continue;
}
$nextGlyph = $this->OTLdata[$ptr + 1]['hex'];
$nextGID = $this->OTLdata[$ptr + 1]['uni'];
if (isset($this->GSLuCoverage[$lu][$c][$nextGID])) {

56
vendor/mpdf/mpdf/src/PageBox.php vendored Normal file
View File

@@ -0,0 +1,56 @@
<?php
namespace Mpdf;
class PageBox implements \ArrayAccess
{
private $container = [];
public function __construct()
{
$this->container = [
'current' => null,
'outer_width_LR' => null,
'outer_width_TB' => null,
'using' => null,
];
}
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
if (!$this->offsetExists($offset)) {
throw new \Mpdf\MpdfException('Invalid key to set for PageBox');
}
$this->container[$offset] = $value;
}
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return array_key_exists($offset, $this->container);
}
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
if (!$this->offsetExists($offset)) {
throw new \Mpdf\MpdfException('Invalid key to set for PageBox');
}
$this->container[$offset] = null;
}
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
if (!$this->offsetExists($offset)) {
throw new \Mpdf\MpdfException('Invalid key to set for PageBox');
}
return $this->container[$offset];
}
}

View File

@@ -4,10 +4,13 @@ namespace Mpdf;
use Psr\Log\LoggerInterface;
use Mpdf\Log\Context as LogContext;
use Mpdf\PsrLogAwareTrait\PsrLogAwareTrait;
class SizeConverter implements \Psr\Log\LoggerAwareInterface
{
use PsrLogAwareTrait;
private $dpi;
private $defaultFontSize;
@@ -17,11 +20,6 @@ class SizeConverter implements \Psr\Log\LoggerAwareInterface
*/
private $mpdf;
/**
* @var \Psr\Log\LoggerInterface
*/
private $logger;
public function __construct($dpi, $defaultFontSize, Mpdf $mpdf, LoggerInterface $logger)
{
$this->dpi = $dpi;
@@ -30,11 +28,6 @@ class SizeConverter implements \Psr\Log\LoggerAwareInterface
$this->logger = $logger;
}
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
/**
* Depends of maxsize value to make % work properly. Usually maxsize == pagewidth
* For text $maxsize = $fontsize

View File

@@ -2297,7 +2297,7 @@ class TTFontFile
$key = $vs['match'][1];
$tag = $v['tag'];
if (isset($loclsubs[$key])) {
${$tag[$loclsubs[$key]]} = $sub;
${$tag}[$loclsubs[$key]] = $sub;
}
$tmp = &$$tag;
$tmp[hexdec($key)] = hexdec($sub);
@@ -2307,7 +2307,7 @@ class TTFontFile
$key = $vs['match'][0];
$tag = $v['tag'];
if (isset($loclsubs[$key])) {
${$tag[$loclsubs[$key]]} = $sub;
${$tag}[$loclsubs[$key]] = $sub;
}
$tmp = &$$tag;
$tmp[hexdec($key)] = hexdec($sub);
@@ -2326,7 +2326,7 @@ class TTFontFile
$key = substr($key, 6, 5);
$tag = $v['tag'];
if (isset($loclsubs[$key])) {
${$tag[$loclsubs[$key]]} = $sub;
${$tag}[$loclsubs[$key]] = $sub;
}
$tmp = &$$tag;
$tmp[hexdec($key)] = hexdec($sub);
@@ -2334,7 +2334,7 @@ class TTFontFile
$key = substr($key, 0, 5);
$tag = $v['tag'];
if (isset($loclsubs[$key])) {
${$tag[$loclsubs[$key]]} = $sub;
${$tag}[$loclsubs[$key]] = $sub;
}
$tmp = &$$tag;
$tmp[hexdec($key)] = hexdec($sub);
@@ -2888,10 +2888,12 @@ class TTFontFile
$lup = $Lookup[$i]['Subtable'][$c]['SubstLookupRecord'][$b]['LookupListIndex'];
$seqIndex = $Lookup[$i]['Subtable'][$c]['SubstLookupRecord'][$b]['SequenceIndex'];
for ($lus = 0; $lus < $Lookup[$lup]['SubtableCount']; $lus++) {
if (count($Lookup[$lup]['Subtable'][$lus]['subs'])) {
if (empty($Lookup[$lup]['Subtable'][$lus]['subs']) || ! is_array($Lookup[$lup]['Subtable'][$lus]['subs'])) {
continue;
}
foreach ($Lookup[$lup]['Subtable'][$lus]['subs'] as $luss) {
$lookupGlyphs = $luss['Replace'];
$mLen = count($lookupGlyphs);
// Only apply if the (first) 'Replace' glyph from the
// Lookup list is in the [inputGlyphs] at ['SequenceIndex']
@@ -2912,7 +2914,6 @@ class TTFontFile
}
}
}
}
if (count($subRule['rules'])) {
$volt[] = $subRule;
}

View File

@@ -2,6 +2,8 @@
namespace Mpdf\Tag;
use Mpdf\Mpdf;
class A extends Tag
{
@@ -19,7 +21,7 @@ class A extends Tag
} else {
$objattr['bklevel'] = 0;
}
$e = "\xbb\xa4\xactype=bookmark,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=bookmark,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
}
/* -- END BOOKMARKS -- */
if ($this->mpdf->tableLevel) { // *TABLES*

View File

@@ -2,6 +2,8 @@
namespace Mpdf\Tag;
use Mpdf\Mpdf;
class Annotation extends Tag
{
@@ -84,7 +86,7 @@ class Annotation extends Tag
$objattr['POPUP'] = true;
}
}
$e = "\xbb\xa4\xactype=annot,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=annot,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
if ($this->mpdf->tableLevel) {
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['textbuffer'][] = [$e];
} // *TABLES*

View File

@@ -2,6 +2,8 @@
namespace Mpdf\Tag;
use Mpdf\Mpdf;
class BarCode extends Tag
{
@@ -31,7 +33,7 @@ class BarCode extends Tag
$objattr['border_bottom']['w'] = 0;
$objattr['border_left']['w'] = 0;
$objattr['border_right']['w'] = 0;
$objattr['code'] = $attr['CODE'];
$objattr['code'] = htmlspecialchars_decode($attr['CODE']);
if (isset($attr['TYPE'])) {
$objattr['btype'] = strtoupper(trim($attr['TYPE']));
@@ -249,7 +251,7 @@ class BarCode extends Tag
}
/* -- END CSS-IMAGE-FLOAT -- */
$e = "\xbb\xa4\xactype=barcode,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=barcode,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
/* -- TABLES -- */
// Output it to buffers

View File

@@ -4,6 +4,7 @@ namespace Mpdf\Tag;
use Mpdf\Conversion\DecToAlpha;
use Mpdf\Conversion\DecToRoman;
use Mpdf\Mpdf;
use Mpdf\Utils\Arrays;
use Mpdf\Utils\UtfString;
@@ -246,11 +247,9 @@ abstract class BlockTag extends Tag
/* -- END CSS-PAGE -- */
// If page-box has changed AND/OR PAGE-BREAK-BEFORE
// mPDF 6 (uses $p - preview of properties so blklvl can be imcremented after page-break)
if (!$this->mpdf->tableLevel && (($pagesel && (!isset($this->mpdf->page_box['current'])
|| $pagesel != $this->mpdf->page_box['current']))
|| (isset($p['PAGE-BREAK-BEFORE'])
&& $p['PAGE-BREAK-BEFORE']))) {
// mPDF 6 (uses $p - preview of properties so blklvl can be incremented after page-break)
if (!$this->mpdf->tableLevel && (($pagesel && (!$this->mpdf->page_box['current'] || $pagesel != $this->mpdf->page_box['current']))
|| (isset($p['PAGE-BREAK-BEFORE']) && $p['PAGE-BREAK-BEFORE']))) {
// mPDF 6 pagebreaktype
$startpage = $this->mpdf->page;
$pagebreaktype = $this->mpdf->defaultPagebreakType;
@@ -258,7 +257,7 @@ abstract class BlockTag extends Tag
if ($this->mpdf->ColActive) {
$pagebreaktype = 'cloneall';
}
if ($pagesel && (!isset($this->mpdf->page_box['current']) || $pagesel != $this->mpdf->page_box['current'])) {
if ($pagesel && (!$this->mpdf->page_box['current'] || $pagesel != $this->mpdf->page_box['current'])) {
$pagebreaktype = 'cloneall';
}
$this->mpdf->_preForcedPagebreak($pagebreaktype);
@@ -317,7 +316,7 @@ abstract class BlockTag extends Tag
} // *CSS-PAGE*
} /* -- CSS-PAGE -- */
// Must Add new page if changed page properties
elseif (!isset($this->mpdf->page_box['current']) || $pagesel != $this->mpdf->page_box['current']) {
elseif (!$this->mpdf->page_box['current'] || $pagesel != $this->mpdf->page_box['current']) {
$this->mpdf->AddPage($this->mpdf->CurOrientation, '', '', '', '', '', '', '', '', '', '', '', '', '', '', 0, 0, 0, 0, $pagesel);
}
/* -- END CSS-PAGE -- */
@@ -992,7 +991,7 @@ abstract class BlockTag extends Tag
$content = $this->mpdf->textbuffer[0][0];
} else {
for ($i = 0; $i < count($this->mpdf->textbuffer); $i++) {
if (0 !== strpos($this->mpdf->textbuffer[$i][0], "\xbb\xa4\xac")) { //inline object
if (0 !== strpos($this->mpdf->textbuffer[$i][0], Mpdf::OBJECT_IDENTIFIER)) { //inline object
$content .= $this->mpdf->textbuffer[$i][0];
}
}
@@ -1003,7 +1002,7 @@ abstract class BlockTag extends Tag
$objattr['type'] = 'toc';
$objattr['toclevel'] = $this->mpdf->h2toc[$tag];
$objattr['CONTENT'] = htmlspecialchars($content);
$e = "\xbb\xa4\xactype=toc,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=toc,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
array_unshift($this->mpdf->textbuffer, [$e]);
}
/* -- END TOC -- */
@@ -1013,7 +1012,7 @@ abstract class BlockTag extends Tag
$objattr['type'] = 'bookmark';
$objattr['bklevel'] = $this->mpdf->h2bookmarks[$tag];
$objattr['CONTENT'] = $content;
$e = "\xbb\xa4\xactype=toc,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=toc,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
array_unshift($this->mpdf->textbuffer, [$e]);
}
/* -- END BOOKMARKS -- */
@@ -1081,7 +1080,7 @@ abstract class BlockTag extends Tag
// called from after e.g. </table> </div> </div> ... Outputs block margin/border and padding
if (count($this->mpdf->textbuffer) && $this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1]) {
if (0 !== strpos($this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][0], "\xbb\xa4\xac")) { // not special content
if (0 !== strpos($this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][0], Mpdf::OBJECT_IDENTIFIER)) { // not special content
// Right trim last content and adjust OTLdata
if (preg_match('/[ ]+$/', $this->mpdf->textbuffer[count($this->mpdf->textbuffer) - 1][0], $m)) {
$strip = strlen($m[0]);

View File

@@ -2,6 +2,8 @@
namespace Mpdf\Tag;
use Mpdf\Mpdf;
class Bookmark extends Tag
{
@@ -16,7 +18,7 @@ class Bookmark extends Tag
} else {
$objattr['bklevel'] = 0;
}
$e = "\xbb\xa4\xactype=bookmark,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=bookmark,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
if ($this->mpdf->tableLevel) {
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['textbuffer'][] = [$e];
} // *TABLES*

View File

@@ -2,6 +2,8 @@
namespace Mpdf\Tag;
use Mpdf\Mpdf;
class DotTab extends Tag
{
@@ -45,7 +47,7 @@ class DotTab extends Tag
$objattr['fontfamily'] = $this->mpdf->FontFamily;
$objattr['fontsize'] = $this->mpdf->FontSizePt;
$e = "\xbb\xa4\xactype=dottab,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=dottab,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
/* -- TABLES -- */
// Output it to buffers
if ($this->mpdf->tableLevel) {

View File

@@ -2,6 +2,7 @@
namespace Mpdf\Tag;
use Mpdf\Mpdf;
use Mpdf\Utils\NumericString;
class Hr extends Tag
@@ -100,7 +101,7 @@ class Hr extends Tag
$objattr['type'] = 'hr';
$objattr['height'] = $objattr['linewidth'] + $objattr['margin_top'] + $objattr['margin_bottom'];
$e = "\xbb\xa4\xactype=image,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=image,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
/* -- TABLES -- */
// Output it to buffers

View File

@@ -407,7 +407,7 @@ class Img extends Tag
$objattr['transform'] = $properties['TRANSFORM'];
}
$e = "\xbb\xa4\xactype=image,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=image,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
/* -- TABLES -- */
// Output it to buffers
@@ -440,7 +440,7 @@ class Img extends Tag
$objattr['SUBJECT'] = '';
$objattr['OPACITY'] = $this->mpdf->annotOpacity;
$objattr['COLOR'] = $this->colorConverter->convert('yellow', $this->mpdf->PDFAXwarnings);
$e = "\xbb\xa4\xactype=annot,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=annot,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
if ($this->mpdf->tableLevel) { // *TABLES*
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['textbuffer'][] = [$e]; // *TABLES*
} // *TABLES*

View File

@@ -2,6 +2,8 @@
namespace Mpdf\Tag;
use Mpdf\Mpdf;
class IndexEntry extends Tag
{
@@ -16,7 +18,7 @@ class IndexEntry extends Tag
$objattr['CONTENT'] = htmlspecialchars_decode($attr['CONTENT'], ENT_QUOTES);
$objattr['type'] = 'indexentry';
$objattr['vertical-align'] = 'T';
$e = "\xbb\xa4\xactype=indexentry,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=indexentry,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
if ($this->mpdf->tableLevel) {
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['textbuffer'][] = [$e];
} // *TABLES*

View File

@@ -2,6 +2,7 @@
namespace Mpdf\Tag;
use Mpdf\Mpdf;
use Mpdf\Utils\UtfString;
abstract class InlineTag extends Tag
@@ -34,7 +35,7 @@ abstract class InlineTag extends Tag
$objattr['SUBJECT'] = '';
$objattr['OPACITY'] = $this->mpdf->annotOpacity;
$objattr['COLOR'] = $this->colorConverter->convert('yellow', $this->mpdf->PDFAXwarnings);
$annot = "\xbb\xa4\xactype=annot,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$annot = Mpdf::OBJECT_IDENTIFIER . "type=annot,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
}
/* -- END ANNOTATIONS -- */

View File

@@ -70,7 +70,7 @@ class Input extends Tag
if (isset($properties['FONT-FAMILY'])) {
$this->mpdf->SetFont($properties['FONT-FAMILY'], $this->mpdf->FontStyle, 0, false);
}
if (isset($properties['FONT-SIZE'])) {
if (isset($properties['FONT-SIZE']) && $properties['FONT-SIZE'] !== 'auto') {
$mmsize = $this->sizeConverter->convert($properties['FONT-SIZE'], $this->mpdf->default_font_size / Mpdf::SCALE);
$this->mpdf->SetFontSize($mmsize * Mpdf::SCALE, false);
}
@@ -356,6 +356,11 @@ class Input extends Tag
if (strtoupper($attr['TYPE']) === 'PASSWORD') {
$type = 'PASSWORD';
}
if ($properties['FONT-SIZE'] === 'auto' && $this->mpdf->useActiveForms) {
$objattr['use_auto_fontsize'] = true;
}
if (isset($attr['VALUE'])) {
if ($type === 'PASSWORD') {
$num_stars = mb_strlen($attr['VALUE'], $this->mpdf->mb_enc);
@@ -401,7 +406,7 @@ class Input extends Tag
$objattr['text'] = $texto;
$objattr['width'] = $width;
$objattr['height'] = $height;
$e = "\xbb\xa4\xactype=input,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=input,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
/* -- TABLES -- */
// Output it to buffers

View File

@@ -285,7 +285,7 @@ class Meter extends InlineTag
$objattr['width'] = $w + $extrawidth;
$objattr['image_height'] = $h;
$objattr['image_width'] = $w;
$e = "\xbb\xa4\xactype=image,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=image,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
if ($this->mpdf->tableLevel) {
$this->mpdf->_saveCellTextBuffer($e, $this->mpdf->HREF);
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] += $objattr['width'];

View File

@@ -27,7 +27,8 @@ class Option extends Tag
$attr['VALUE'] = mb_convert_encoding($attr['VALUE'], $this->mpdf->mb_enc, 'UTF-8');
}
}
$this->mpdf->selectoption['currentVAL'] = $attr['VALUE'];
$this->mpdf->selectoption['currentVAL'] = isset($attr['VALUE']) ? $attr['VALUE'] : $ahtml[$ihtml + 1];
}
public function close(&$ahtml, &$ihtml)

View File

@@ -132,7 +132,7 @@ class Select extends Tag
$objattr['height'] = ($this->mpdf->FontSize * $rows) + ($this->form->form_element_spacing['select']['outer']['v'] * 2)
+ ($this->form->form_element_spacing['select']['inner']['v'] * 2);
$e = "\xbb\xa4\xactype=select,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=select,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
// Output it to buffers
if ($this->mpdf->tableLevel) { // *TABLES*

View File

@@ -712,7 +712,7 @@ class Table extends Tag
$objattr['row'] = $this->mpdf->row;
$objattr['col'] = $this->mpdf->col;
$objattr['level'] = $this->mpdf->tableLevel;
$e = "\xbb\xa4\xactype=nestedtable,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=nestedtable,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
$this->mpdf->_saveCellTextBuffer($e);
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] += $tl;
if (!isset($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['maxs'])) {

View File

@@ -420,7 +420,7 @@ class Td extends Tag
}
}
if (isset($attr['ROWSPAN']) && $attr['ROWSPAN'] > 1) {
if (isset($attr['ROWSPAN']) && preg_match('/^\d+$/', $attr['ROWSPAN']) && $attr['ROWSPAN'] > 1) {
$rs = $this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['rowspan'] = $attr['ROWSPAN'];
}

View File

@@ -64,7 +64,7 @@ class TextArea extends Tag
if (isset($properties['FONT-FAMILY'])) {
$this->mpdf->SetFont($properties['FONT-FAMILY'], '', 0, false);
}
if (isset($properties['FONT-SIZE'])) {
if (isset($properties['FONT-SIZE']) && $properties['FONT-SIZE'] !== 'auto') {
$mmsize = $this->sizeConverter->convert($properties['FONT-SIZE'], $this->mpdf->default_font_size / Mpdf::SCALE);
$this->mpdf->SetFontSize($mmsize * Mpdf::SCALE, false);
}
@@ -143,6 +143,10 @@ class TextArea extends Tag
$objattr['rows'] = $rowsize;
$objattr['cols'] = $colsize;
if ($properties['FONT-SIZE'] === 'auto' && $this->mpdf->useActiveForms) {
$objattr['use_auto_fontsize'] = true;
}
$this->mpdf->specialcontent = serialize($objattr);
if ($this->mpdf->tableLevel) { // *TABLES*

View File

@@ -226,7 +226,7 @@ class TextCircle extends Tag
$objattr['width'] = $w + $extrawidth;
$objattr['type'] = 'textcircle';
$e = "\xbb\xa4\xactype=image,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=image,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
/* -- TABLES -- */
// Output it to buffers

View File

@@ -2,6 +2,8 @@
namespace Mpdf\Tag;
use Mpdf\Mpdf;
class TocEntry extends Tag
{
@@ -22,7 +24,7 @@ class TocEntry extends Tag
} else {
$objattr['toc_id'] = 0;
}
$e = "\xbb\xa4\xactype=toc,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
$e = Mpdf::OBJECT_IDENTIFIER . "type=toc,objattr=" . serialize($objattr) . Mpdf::OBJECT_IDENTIFIER;
if ($this->mpdf->tableLevel) {
$this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['textbuffer'][] = [$e];
} // *TABLES*

View File

@@ -17,6 +17,17 @@ class Tr extends Tag
$this->mpdf->col = -1;
$properties = $this->cssManager->MergeCSS('TABLE', 'TR', $attr);
// write pagebreak markers into row list, so _tableWrite can respect it
if (isset($properties['PAGE-BREAK-BEFORE']) && strtoupper($properties['PAGE-BREAK-BEFORE']) === 'AVOID'
&& !$this->mpdf->ColActive && !$this->mpdf->keep_block_together && !isset($attr['PAGEBREAKAVOIDCHECKED'])) {
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['pagebreak-before'][$this->mpdf->row] = 'avoid';
}
if (isset($properties['PAGE-BREAK-AFTER']) && strtoupper($properties['PAGE-BREAK-AFTER']) === 'AVOID'
&& !$this->mpdf->ColActive && !$this->mpdf->keep_block_together && !isset($attr['PAGEBREAKAVOIDCHECKED'])) {
$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['pagebreak-before'][$this->mpdf->row + 1] = 'avoid';
}
if (!$this->mpdf->simpleTables && (!isset($this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['borders_separate'])
|| !$this->mpdf->table[$this->mpdf->tableLevel][$this->mpdf->tbctr[$this->mpdf->tableLevel]]['borders_separate'])) {
if (!empty($properties['BORDER-LEFT'])) {

View File

@@ -36,17 +36,19 @@ class UtfString
{
// Returns the utf string corresponding to the unicode value
if ($num < 128) {
if ($lo) {
return chr($num);
}
return '&#' . $num . ';';
return $lo
? chr($num)
: '&#' . $num . ';';
}
if ($num < 2048) {
return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
}
if ($num < 65536) {
return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
}
if ($num < 2097152) {
return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
}

8
vendor/mpdf/mpdf/src/Watermark.php vendored Normal file
View File

@@ -0,0 +1,8 @@
<?php
namespace Mpdf;
interface Watermark
{
}

72
vendor/mpdf/mpdf/src/WatermarkImage.php vendored Normal file
View File

@@ -0,0 +1,72 @@
<?php
namespace Mpdf;
class WatermarkImage implements \Mpdf\Watermark
{
const SIZE_DEFAULT = 'D';
const SIZE_FIT_PAGE = 'P';
const SIZE_FIT_FRAME = 'F';
const POSITION_CENTER_PAGE = 'P';
const POSITION_CENTER_FRAME = 'F';
/** @var string */
private $path;
/** @var mixed */
private $size;
/** @var mixed */
private $position;
/** @var float */
private $alpha;
/** @var bool */
private $behindContent;
/** @var string */
private $alphaBlend;
public function __construct($path, $size = self::SIZE_DEFAULT, $position = self::POSITION_CENTER_PAGE, $alpha = -1, $behindContent = false, $alphaBlend = 'Normal')
{
$this->path = $path;
$this->size = $size;
$this->position = $position;
$this->alpha = $alpha;
$this->behindContent = $behindContent;
$this->alphaBlend = $alphaBlend;
}
public function getPath()
{
return $this->path;
}
public function getSize()
{
return $this->size;
}
public function getPosition()
{
return $this->position;
}
public function getAlpha()
{
return $this->alpha;
}
public function isBehindContent()
{
return $this->behindContent;
}
public function getAlphaBlend()
{
return $this->alphaBlend;
}
}

66
vendor/mpdf/mpdf/src/WatermarkText.php vendored Normal file
View File

@@ -0,0 +1,66 @@
<?php
namespace Mpdf;
class WatermarkText implements \Mpdf\Watermark
{
/** @var string */
private $text;
/** @var int */
private $size;
/** @var int */
private $angle;
/** @var mixed */
private $color;
/** @var float */
private $alpha;
/** @var string */
private $font;
public function __construct($text, $size = 96, $angle = 45, $color = 0, $alpha = 0.2, $font = null)
{
$this->text = $text;
$this->size = $size;
$this->angle = $angle;
$this->color = $color;
$this->alpha = $alpha;
$this->font = $font;
}
public function getText()
{
return $this->text;
}
public function getSize()
{
return $this->size;
}
public function getAngle()
{
return $this->angle;
}
public function getColor()
{
return $this->color;
}
public function getAlpha()
{
return $this->alpha;
}
public function getFont()
{
return $this->font;
}
}

View File

@@ -6,6 +6,7 @@ use Mpdf\Strict;
use Mpdf\Form;
use Mpdf\Mpdf;
use Mpdf\Pdf\Protection;
use Mpdf\PsrLogAwareTrait\PsrLogAwareTrait;
use Mpdf\Utils\PdfDate;
use Psr\Log\LoggerInterface;
@@ -14,6 +15,7 @@ class MetadataWriter implements \Psr\Log\LoggerAwareInterface
{
use Strict;
use PsrLogAwareTrait;
/**
* @var \Mpdf\Mpdf
@@ -35,11 +37,6 @@ class MetadataWriter implements \Psr\Log\LoggerAwareInterface
*/
private $protection;
/**
* @var \Psr\Log\LoggerInterface
*/
private $logger;
public function __construct(Mpdf $mpdf, BaseWriter $writer, Form $form, Protection $protection, LoggerInterface $logger)
{
$this->mpdf = $mpdf;
@@ -53,18 +50,19 @@ class MetadataWriter implements \Psr\Log\LoggerAwareInterface
{
$this->writer->object();
$this->mpdf->MetadataRoot = $this->mpdf->n;
$Producer = 'mPDF' . ($this->mpdf->exposeVersion ? (' ' . Mpdf::VERSION) : '');
$z = date('O'); // +0200
$offset = substr($z, 0, 3) . ':' . substr($z, 3, 2);
$CreationDate = date('Y-m-d\TH:i:s') . $offset; // 2006-03-10T10:47:26-05:00 2006-06-19T09:05:17Z
$uuid = sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', random_int(0, 0xffff), random_int(0, 0xffff), random_int(0, 0xffff), random_int(0, 0x0fff) | 0x4000, random_int(0, 0x3fff) | 0x8000, random_int(0, 0xffff), random_int(0, 0xffff), random_int(0, 0xffff));
$CreationDate = date('Y-m-d\TH:i:s') . $offset; // 2006-03-10T10:47:26-05:00 2006-06-19T09:05:17Z
$uuid = sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', random_int(0, 0xffff), random_int(0, 0xffff), random_int(0, 0xffff), random_int(0, 0x0fff) | 0x4000, random_int(0, 0x3fff) | 0x8000, random_int(0, 0xffff), random_int(0, 0xffff), random_int(0, 0xffff));
$m = '<?xpacket begin="' . chr(239) . chr(187) . chr(191) . '" id="W5M0MpCehiHzreSzNTczkc9d"?>' . "\n"; // begin = FEFF BOM
$m .= ' <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="3.1-701">' . "\n";
$m .= ' <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">' . "\n";
$m .= ' <rdf:Description rdf:about="uuid:' . $uuid . '" xmlns:pdf="http://ns.adobe.com/pdf/1.3/">' . "\n";
$m .= ' <pdf:Producer>' . $Producer . '</pdf:Producer>' . "\n";
$m .= ' <pdf:Producer>' . $this->getProducerString() . '</pdf:Producer>' . "\n";
if (!empty($this->mpdf->keywords)) {
$m .= ' <pdf:Keywords>' . $this->mpdf->keywords . '</pdf:Keywords>' . "\n";
}
@@ -150,7 +148,7 @@ class MetadataWriter implements \Psr\Log\LoggerAwareInterface
public function writeInfo() // _putinfo
{
$this->writer->write('/Producer ' . $this->writer->utf16BigEndianTextString('mPDF' . ($this->mpdf->exposeVersion ? (' ' . $this->getVersionString()) : '')));
$this->writer->write('/Producer ' . $this->writer->utf16BigEndianTextString($this->getProducerString()));
if (!empty($this->mpdf->title)) {
$this->writer->write('/Title ' . $this->writer->utf16BigEndianTextString($this->mpdf->title));
@@ -808,11 +806,6 @@ class MetadataWriter implements \Psr\Log\LoggerAwareInterface
}
}
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
private function getVersionString()
{
$return = Mpdf::VERSION;
@@ -832,4 +825,9 @@ class MetadataWriter implements \Psr\Log\LoggerAwareInterface
return $return;
}
private function getProducerString()
{
return 'mPDF' . ($this->mpdf->exposeVersion ? (' ' . $this->getVersionString()) : '');
}
}

View File

@@ -4,12 +4,14 @@ namespace Mpdf\Writer;
use Mpdf\Strict;
use Mpdf\Mpdf;
use Mpdf\PsrLogAwareTrait\PsrLogAwareTrait;
use Psr\Log\LoggerInterface;
final class ResourceWriter implements \Psr\Log\LoggerAwareInterface
{
use Strict;
use PsrLogAwareTrait;
/**
* @var \Mpdf\Mpdf
@@ -66,11 +68,6 @@ final class ResourceWriter implements \Psr\Log\LoggerAwareInterface
*/
private $javaScriptWriter;
/**
* @var \Psr\Log\LoggerInterface
*/
private $logger;
public function __construct(
Mpdf $mpdf,
BaseWriter $writer,
@@ -243,14 +240,4 @@ final class ResourceWriter implements \Psr\Log\LoggerAwareInterface
$this->writer->write('endobj');
}
}
/**
* @param \Psr\Log\LoggerInterface $logger
*
* @return void
*/
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
}

25
vendor/mpdf/mpdf/src/functions.php vendored Normal file
View File

@@ -0,0 +1,25 @@
<?php
if (!function_exists('str_starts_with')) {
function str_starts_with($haystack, $needle)
{
return 0 === strncmp($haystack, $needle, \strlen($needle));
}
}
if (!function_exists('str_ends_with')) {
function str_ends_with($haystack, $needle)
{
if ('' === $needle || $needle === $haystack) {
return true;
}
if ('' === $haystack) {
return false;
}
$needleLength = \strlen($needle);
return $needleLength <= \strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength);
}
}

View File

@@ -0,0 +1,16 @@
# psr-http-message-shim
Trait to allow support of different psr/http-message versions.
Based on the psr-log-aware-trait, developed by Matěj Humpál, K Widholm and Mark Dorison.
By including this shim, you can allow composer to resolve your Psr\Http\Message version for you.
## Use
Require the shim.
composer require mpdf/psr-http-message-shim
Modify any use of mpdf's Request.php, Response.php, Stream.php and Uri.php classes to instead use versions
from the Mpdf\HttpMessageShim namespace.

View File

@@ -0,0 +1,28 @@
{
"name": "mpdf/psr-http-message-shim",
"description": "Shim to allow support of different psr/message versions.",
"type": "library",
"require": {
"psr/http-message": "^2.0"
},
"license": "MIT",
"autoload": {
"psr-4": {
"Mpdf\\PsrHttpMessageShim\\": "src/"
}
},
"authors": [
{
"name": "Mark Dorison",
"email": "mark@chromatichq.com"
},
{
"name": "Kristofer Widholm",
"email": "kristofer@chromatichq.com"
},
{
"name": "Nigel Cunningham",
"email": "nigel.cunningham@technocrat.com.au"
}
]
}

View File

@@ -1,7 +1,9 @@
<?php
namespace Mpdf\Http;
namespace Mpdf\PsrHttpMessageShim;
use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\UriInterface;
@@ -66,7 +68,7 @@ class Request implements \Psr\Http\Message\RequestInterface
}
}
public function getRequestTarget()
public function getRequestTarget(): string
{
if ($this->requestTarget !== null) {
return $this->requestTarget;
@@ -83,7 +85,7 @@ class Request implements \Psr\Http\Message\RequestInterface
return $target;
}
public function withRequestTarget($requestTarget)
public function withRequestTarget(string $requestTarget): RequestInterface
{
if (preg_match('#\s#', $requestTarget)) {
throw new \InvalidArgumentException('Invalid request target provided; cannot contain whitespace');
@@ -95,12 +97,12 @@ class Request implements \Psr\Http\Message\RequestInterface
return $new;
}
public function getMethod()
public function getMethod(): string
{
return $this->method;
}
public function withMethod($method)
public function withMethod(string $method): RequestInterface
{
$new = clone $this;
$new->method = $method;
@@ -108,12 +110,12 @@ class Request implements \Psr\Http\Message\RequestInterface
return $new;
}
public function getUri()
public function getUri(): UriInterface
{
return $this->uri;
}
public function withUri(UriInterface $uri, $preserveHost = false)
public function withUri(UriInterface $uri, bool $preserveHost = false): RequestInterface
{
if ($uri === $this->uri) {
return $this;
@@ -152,12 +154,12 @@ class Request implements \Psr\Http\Message\RequestInterface
$this->headers = [$header => [$host]] + $this->headers;
}
public function getProtocolVersion()
public function getProtocolVersion(): string
{
return $this->protocol;
}
public function withProtocolVersion($version)
public function withProtocolVersion(string $version): MessageInterface
{
if ($this->protocol === $version) {
return $this;
@@ -169,17 +171,17 @@ class Request implements \Psr\Http\Message\RequestInterface
return $new;
}
public function getHeaders()
public function getHeaders(): array
{
return $this->headers;
}
public function hasHeader($header)
public function hasHeader(string $header): bool
{
return isset($this->headerNames[strtolower($header)]);
}
public function getHeader($header)
public function getHeader(string $header): array
{
$header = strtolower($header);
@@ -192,12 +194,12 @@ class Request implements \Psr\Http\Message\RequestInterface
return $this->headers[$header];
}
public function getHeaderLine($header)
public function getHeaderLine(string $header):string
{
return implode(', ', $this->getHeader($header));
}
public function withHeader($header, $value)
public function withHeader(string $header, $value): MessageInterface
{
if (!is_array($value)) {
$value = [$value];
@@ -216,7 +218,7 @@ class Request implements \Psr\Http\Message\RequestInterface
return $new;
}
public function withAddedHeader($header, $value)
public function withAddedHeader(string $header, $value): MessageInterface
{
if (!is_array($value)) {
$value = [$value];
@@ -237,7 +239,7 @@ class Request implements \Psr\Http\Message\RequestInterface
return $new;
}
public function withoutHeader($header)
public function withoutHeader(string $header): MessageInterface
{
$normalized = strtolower($header);
@@ -253,7 +255,7 @@ class Request implements \Psr\Http\Message\RequestInterface
return $new;
}
public function getBody()
public function getBody(): StreamInterface
{
if (!$this->stream) {
$this->stream = Stream::create('');
@@ -263,7 +265,7 @@ class Request implements \Psr\Http\Message\RequestInterface
return $this->stream;
}
public function withBody(StreamInterface $body)
public function withBody(StreamInterface $body): MessageInterface
{
if ($body === $this->stream) {
return $this;

View File

@@ -1,8 +1,10 @@
<?php
namespace Mpdf\Http;
namespace Mpdf\PsrHttpMessageShim;
use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\MessageInterface;
/**
* PSR-7 URI implementation ported from nyholm/psr7 and adapted for PHP 5.6
@@ -64,17 +66,17 @@ class Response implements \Psr\Http\Message\ResponseInterface
$this->protocol = $version;
}
public function getStatusCode()
public function getStatusCode(): int
{
return $this->statusCode;
}
public function getReasonPhrase()
public function getReasonPhrase(): string
{
return $this->reasonPhrase;
}
public function withStatus($code, $reasonPhrase = '')
public function withStatus(int $code, string $reasonPhrase = ''): ResponseInterface
{
if (!\is_int($code) && !\is_string($code)) {
throw new \InvalidArgumentException('Status code has to be an integer');
@@ -95,12 +97,12 @@ class Response implements \Psr\Http\Message\ResponseInterface
return $new;
}
public function getProtocolVersion()
public function getProtocolVersion(): string
{
return $this->protocol;
}
public function withProtocolVersion($version)
public function withProtocolVersion(string $version): MessageInterface
{
if ($this->protocol === $version) {
return $this;
@@ -112,17 +114,17 @@ class Response implements \Psr\Http\Message\ResponseInterface
return $new;
}
public function getHeaders()
public function getHeaders(): array
{
return $this->headers;
}
public function hasHeader($header)
public function hasHeader(string $header): bool
{
return isset($this->headerNames[strtolower($header)]);
}
public function getHeader($header)
public function getHeader(string $header): array
{
$header = strtolower($header);
@@ -135,12 +137,12 @@ class Response implements \Psr\Http\Message\ResponseInterface
return $this->headers[$header];
}
public function getHeaderLine($header)
public function getHeaderLine(string $header): string
{
return implode(', ', $this->getHeader($header));
}
public function withHeader($header, $value)
public function withHeader(string $header, $value): MessageInterface
{
if (!is_array($value)) {
$value = [$value];
@@ -159,7 +161,7 @@ class Response implements \Psr\Http\Message\ResponseInterface
return $new;
}
public function withAddedHeader($header, $value)
public function withAddedHeader(string $header, $value): MessageInterface
{
if (!is_array($value)) {
$value = [$value];
@@ -180,7 +182,7 @@ class Response implements \Psr\Http\Message\ResponseInterface
return $new;
}
public function withoutHeader($header)
public function withoutHeader(string $header): MessageInterface
{
$normalized = strtolower($header);
@@ -196,7 +198,7 @@ class Response implements \Psr\Http\Message\ResponseInterface
return $new;
}
public function getBody()
public function getBody(): StreamInterface
{
if (!$this->stream) {
$this->stream = Stream::create('');
@@ -205,7 +207,7 @@ class Response implements \Psr\Http\Message\ResponseInterface
return $this->stream;
}
public function withBody(StreamInterface $body)
public function withBody(StreamInterface $body): MessageInterface
{
if ($body === $this->stream) {
return $this;

View File

@@ -1,6 +1,6 @@
<?php
namespace Mpdf\Http;
namespace Mpdf\PsrHttpMessageShim;
/**
* @link nyholm/psr7
@@ -104,7 +104,7 @@ class Stream implements \Psr\Http\Message\StreamInterface
$this->close();
}
public function __toString()
public function __toString(): string
{
try {
if ($this->isSeekable()) {
@@ -117,7 +117,7 @@ class Stream implements \Psr\Http\Message\StreamInterface
}
}
public function close()
public function close(): void
{
if (isset($this->stream)) {
if (is_resource($this->stream)) {
@@ -141,14 +141,14 @@ class Stream implements \Psr\Http\Message\StreamInterface
return $result;
}
public function getSize()
public function getSize(): ?int
{
if ($this->size !== null) {
return $this->size;
}
if (!isset($this->stream)) {
return;
return null;
}
// Clear the stat cache if the stream has a URI
@@ -162,9 +162,10 @@ class Stream implements \Psr\Http\Message\StreamInterface
return $this->size;
}
return null;
}
public function tell()
public function tell(): int
{
$result = ftell($this->stream);
@@ -175,17 +176,17 @@ class Stream implements \Psr\Http\Message\StreamInterface
return $result;
}
public function eof()
public function eof(): bool
{
return !$this->stream || feof($this->stream);
}
public function isSeekable()
public function isSeekable(): bool
{
return $this->seekable;
}
public function seek($offset, $whence = SEEK_SET)
public function seek(int $offset, int $whence = SEEK_SET): void
{
if (!$this->seekable) {
throw new \RuntimeException('Stream is not seekable');
@@ -196,17 +197,17 @@ class Stream implements \Psr\Http\Message\StreamInterface
}
}
public function rewind()
public function rewind(): void
{
$this->seek(0);
}
public function isWritable()
public function isWritable(): bool
{
return $this->writable;
}
public function write($string)
public function write(string $string): int
{
if (!$this->writable) {
throw new \RuntimeException('Cannot write to a non-writable stream');
@@ -223,12 +224,12 @@ class Stream implements \Psr\Http\Message\StreamInterface
return $result;
}
public function isReadable()
public function isReadable(): bool
{
return $this->readable;
}
public function read($length)
public function read(int $length): string
{
if (!$this->readable) {
throw new \RuntimeException('Cannot read from non-readable stream');
@@ -237,7 +238,7 @@ class Stream implements \Psr\Http\Message\StreamInterface
return fread($this->stream, $length);
}
public function getContents()
public function getContents(): string
{
if (!isset($this->stream)) {
throw new \RuntimeException('Unable to read stream contents');
@@ -252,7 +253,7 @@ class Stream implements \Psr\Http\Message\StreamInterface
return $contents;
}
public function getMetadata($key = null)
public function getMetadata(?string $key = null): bool
{
if (!isset($this->stream)) {
return $key ? null : [];

View File

@@ -1,13 +1,15 @@
<?php
namespace Mpdf\Http;
namespace Mpdf\PsrHttpMessageShim;
use Psr\Http\Message\UriInterface;
/**
* PSR-7 URI implementation ported from nyholm/psr7 and adapted for PHP 5.6
*
* @link https://github.com/Nyholm/psr7/blob/master/src/Uri.php
*/
final class Uri implements \Psr\Http\Message\UriInterface
final class Uri implements UriInterface
{
private static $schemes = ['http' => 80, 'https' => 443];
@@ -57,17 +59,17 @@ final class Uri implements \Psr\Http\Message\UriInterface
}
}
public function __toString()
public function __toString(): string
{
return self::createUriString($this->scheme, $this->getAuthority(), $this->path, $this->query, $this->fragment);
}
public function getScheme()
public function getScheme(): string
{
return $this->scheme;
}
public function getAuthority()
public function getAuthority(): string
{
if ('' === $this->host) {
return '';
@@ -85,37 +87,37 @@ final class Uri implements \Psr\Http\Message\UriInterface
return $authority;
}
public function getUserInfo()
public function getUserInfo(): string
{
return $this->userInfo;
}
public function getHost()
public function getHost(): string
{
return $this->host;
}
public function getPort()
public function getPort(): ?int
{
return $this->port;
}
public function getPath()
public function getPath(): string
{
return $this->path;
}
public function getQuery()
public function getQuery(): string
{
return $this->query;
}
public function getFragment()
public function getFragment(): string
{
return $this->fragment;
}
public function withScheme($scheme)
public function withScheme(string $scheme): UriInterface
{
if (!\is_string($scheme)) {
throw new \InvalidArgumentException('Scheme must be a string');
@@ -132,7 +134,7 @@ final class Uri implements \Psr\Http\Message\UriInterface
return $new;
}
public function withUserInfo($user, $password = null)
public function withUserInfo(string $user, ?string $password = null): UriInterface
{
$info = $user;
if (null !== $password && '' !== $password) {
@@ -149,7 +151,7 @@ final class Uri implements \Psr\Http\Message\UriInterface
return $new;
}
public function withHost($host)
public function withHost(string $host): UriInterface
{
if (!\is_string($host)) {
throw new \InvalidArgumentException('Host must be a string');
@@ -165,7 +167,7 @@ final class Uri implements \Psr\Http\Message\UriInterface
return $new;
}
public function withPort($port)
public function withPort(?int $port): UriInterface
{
if ($this->port === $port = $this->filterPort($port)) {
return $this;
@@ -177,7 +179,7 @@ final class Uri implements \Psr\Http\Message\UriInterface
return $new;
}
public function withPath($path)
public function withPath(string $path): UriInterface
{
if ($this->path === $path = $this->filterPath($path)) {
return $this;
@@ -189,7 +191,7 @@ final class Uri implements \Psr\Http\Message\UriInterface
return $new;
}
public function withQuery($query)
public function withQuery(string $query): UriInterface
{
if ($this->query === $query = $this->filterQueryAndFragment($query)) {
return $this;
@@ -201,7 +203,7 @@ final class Uri implements \Psr\Http\Message\UriInterface
return $new;
}
public function withFragment($fragment)
public function withFragment(string $fragment): UriInterface
{
if ($this->fragment === $fragment = $this->filterQueryAndFragment($fragment)) {
return $this;
@@ -216,7 +218,7 @@ final class Uri implements \Psr\Http\Message\UriInterface
/**
* Create a URI string from its various parts.
*/
private static function createUriString($scheme, $authority, $path, $query, $fragment)
private static function createUriString(string $scheme, string $authority, string $path, string $query, string $fragment): string
{
$uri = '';
if ('' !== $scheme) {
@@ -258,12 +260,12 @@ final class Uri implements \Psr\Http\Message\UriInterface
/**
* Is a given port non-standard for the current scheme?
*/
private static function isNonStandardPort($scheme, $port)
private static function isNonStandardPort(string $scheme, int $port): bool
{
return !isset(self::$schemes[$scheme]) || $port !== self::$schemes[$scheme];
}
private function filterPort($port)
private function filterPort(int $port): ?int
{
if (null === $port) {
return null;

View File

@@ -0,0 +1,2 @@
composer.lock
vendor/

View File

@@ -0,0 +1,20 @@
# psr-log-aware-trait
Trait to allow support of different psr/log versions.
By including this PsrLogAwareTrait, you can allow composer to resolve your PsrLogger version for you.
## Use
Require the trait.
composer require chromatic/psr-log-aware-trait
In your code, you no longer have to set a $logger property on your classes, since that comes with the trait, and you do not need to implement the `function setLogger()` method, since that also comes along with the trait.
```php
use PsrLogAwareTrait;
```
Will allow you to call `setLogger()` in your classes and fulfil the requirements of the PsrLoggerAwareInterface implementation.

View File

@@ -0,0 +1,24 @@
{
"name": "mpdf/psr-log-aware-trait",
"description": "Trait to allow support of different psr/log versions.",
"type": "library",
"require": {
"psr/log": "^1.0 || ^2.0"
},
"license": "MIT",
"autoload": {
"psr-4": {
"Mpdf\\PsrLogAwareTrait\\": "src/"
}
},
"authors": [
{
"name": "Mark Dorison",
"email": "mark@chromatichq.com"
},
{
"name": "Kristofer Widholm",
"email": "kristofer@chromatichq.com"
}
]
}

View File

@@ -0,0 +1,27 @@
<?php
namespace Mpdf\PsrLogAwareTrait;
use Psr\Log\LoggerInterface;
trait MpdfPsrLogAwareTrait
{
/**
* @var \Psr\Log\LoggerInterface
*/
protected $logger;
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
if (property_exists($this, 'services') && is_array($this->services)) {
foreach ($this->services as $name) {
if ($this->$name && $this->$name instanceof \Psr\Log\LoggerAwareInterface) {
$this->$name->setLogger($logger);
}
}
}
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace Mpdf\PsrLogAwareTrait;
use Psr\Log\LoggerInterface;
trait PsrLogAwareTrait
{
/**
* @var \Psr\Log\LoggerInterface
*/
protected $logger;
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
}

View File

@@ -1,12 +0,0 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: "packagist/myclabs/deep-copy"
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@@ -1,101 +0,0 @@
name: "Continuous Integration"
on:
- pull_request
- push
env:
COMPOSER_ROOT_VERSION: 1.99
jobs:
composer-json-lint:
name: "Lint composer.json"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "8.1"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: composer-normalize
- name: "Get composer cache directory"
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Cache dependencies"
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-
- name: "Install dependencies"
run: "composer update --no-interaction --no-progress"
- name: "Validate composer.json"
run: "composer validate --strict"
- name: "Normalize composer.json"
run: "composer-normalize --dry-run"
tests:
name: "Tests"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
dependencies:
- "lowest"
- "highest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
ini-values: zend.assertions=1
- name: "Get composer cache directory"
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Cache dependencies"
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-
- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --no-interaction --no-progress --prefer-lowest"
- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress"
- name: "Run tests"
timeout-minutes: 3
run: "vendor/bin/phpunit"

Some files were not shown because too many files have changed in this diff Show More