File manager - Edit - /home/linknsbh/sabel-eltaqwa.com/assets/lfm/files/shares/events/thumbs/dompdf.zip
Back
PK >�\��v� � dompdf/README.mdnu �[��� Dompdf ====== [](https://github.com/dompdf/dompdf/actions/workflows/test.yml) [](https://packagist.org/packages/dompdf/dompdf) [](https://packagist.org/packages/dompdf/dompdf) [](https://packagist.org/packages/dompdf/dompdf) **Dompdf is an HTML to PDF converter** At its heart, dompdf is (mostly) a [CSS 2.1](http://www.w3.org/TR/CSS2/) compliant HTML layout and rendering engine written in PHP. It is a style-driven renderer: it will download and read external stylesheets, inline style tags, and the style attributes of individual HTML elements. It also supports most presentational HTML attributes. *This document applies to the latest stable code which may not reflect the current release. For released code please [navigate to the appropriate tag](https://github.com/dompdf/dompdf/tags).* ---- **Check out the [demo](http://eclecticgeek.com/dompdf/debug.php) and ask any question on [StackOverflow](https://stackoverflow.com/questions/tagged/dompdf) or in [Discussions](https://github.com/dompdf/dompdf/discussions).** Follow us on [](http://www.twitter.com/dompdf). --- ## Features * Handles most CSS 2.1 and a few CSS3 properties, including @import, @media & @page rules * Supports most presentational HTML 4.0 attributes * Supports external stylesheets, either local or through http/ftp (via fopen-wrappers) * Supports complex tables, including row & column spans, separate & collapsed border models, individual cell styling * Image support (gif, png (8, 24 and 32 bit with alpha channel), bmp & jpeg) * No dependencies on external PDF libraries, thanks to the R&OS PDF class * Inline PHP support * Basic SVG support (see "Limitations" below) ## Requirements * PHP version 7.1 or higher * DOM extension * MBString extension * php-font-lib * php-svg-lib Note that some required dependencies may have further dependencies (notably php-svg-lib requires sabberworm/php-css-parser). ### Recommendations * OPcache (OPcache, XCache, APC, etc.): improves performance * GD (for image processing) * IMagick or GMagick extension: improves image processing performance Visit the wiki for more information: https://github.com/dompdf/dompdf/wiki/Requirements ## About Fonts & Character Encoding PDF documents internally support the following fonts: Helvetica, Times-Roman, Courier, Zapf-Dingbats, & Symbol. These fonts only support Windows ANSI encoding. In order for a PDF to display characters that are not available in Windows ANSI, you must supply an external font. Dompdf will embed any referenced font in the PDF so long as it has been pre-loaded or is accessible to dompdf and reference in CSS @font-face rules. See the [font overview](https://github.com/dompdf/dompdf/wiki/About-Fonts-and-Character-Encoding) for more information on how to use fonts. The [DejaVu TrueType fonts](https://dejavu-fonts.github.io/) have been pre-installed to give dompdf decent Unicode character coverage by default. To use the DejaVu fonts reference the font in your stylesheet, e.g. `body { font-family: DejaVu Sans; }` (for DejaVu Sans). The following DejaVu 2.34 fonts are available: DejaVu Sans, DejaVu Serif, and DejaVu Sans Mono. ## Easy Installation ### Install with composer To install with [Composer](https://getcomposer.org/), simply require the latest version of this package. ```bash composer require dompdf/dompdf ``` Make sure that the autoload file from Composer is loaded. ```php // somewhere early in your project's loading, require the Composer autoloader // see: http://getcomposer.org/doc/00-intro.md require 'vendor/autoload.php'; ``` ### Download and install Download a packaged archive of dompdf and extract it into the directory where dompdf will reside * You can download stable copies of dompdf from https://github.com/dompdf/dompdf/releases * Or download a nightly (the latest, unreleased code) from http://eclecticgeek.com/dompdf Use the packaged release autoloader to load dompdf, libraries, and helper functions in your PHP: ```php // include autoloader require_once 'dompdf/autoload.inc.php'; ``` Note: packaged releases are named according using semantic versioning (_dompdf_MAJOR-MINOR-PATCH.zip_). So the 1.0.0 release would be dompdf_1-0-0.zip. This is the only download that includes the autoloader for Dompdf and all its dependencies. ### Install with git From the command line, switch to the directory where dompdf will reside and run the following commands: ```sh git clone https://github.com/dompdf/dompdf.git cd dompdf/lib git clone https://github.com/PhenX/php-font-lib.git php-font-lib cd php-font-lib git checkout 0.5.1 cd .. git clone https://github.com/PhenX/php-svg-lib.git php-svg-lib cd php-svg-lib git checkout v0.3.2 cd .. git clone https://github.com/sabberworm/PHP-CSS-Parser.git php-css-parser cd php-css-parser git checkout 8.1.0 ``` Require dompdf and it's dependencies in your PHP. For details see the [autoloader in the utils project](https://github.com/dompdf/utils/blob/master/autoload.inc.php). ## Quick Start Just pass your HTML in to dompdf and stream the output: ```php // reference the Dompdf namespace use Dompdf\Dompdf; // instantiate and use the dompdf class $dompdf = new Dompdf(); $dompdf->loadHtml('hello world'); // (Optional) Setup the paper size and orientation $dompdf->setPaper('A4', 'landscape'); // Render the HTML as PDF $dompdf->render(); // Output the generated PDF to Browser $dompdf->stream(); ``` ### Setting Options Set options during dompdf instantiation: ```php use Dompdf\Dompdf; use Dompdf\Options; $options = new Options(); $options->set('defaultFont', 'Courier'); $dompdf = new Dompdf($options); ``` or at run time ```php use Dompdf\Dompdf; $dompdf = new Dompdf(); $options = $dompdf->getOptions(); $options->setDefaultFont('Courier'); $dompdf->setOptions($options); ``` See [Dompdf\Options](src/Options.php) for a list of available options. ### Resource Reference Requirements In order to protect potentially sensitive information Dompdf imposes restrictions on files referenced from the local file system or the web. Files accessed through web-based protocols have the following requirements: * The Dompdf option "isRemoteEnabled" must be set to "true" * PHP must either have the curl extension enabled or the allow_url_fopen setting set to true Files accessed through the local file system have the following requirement: * The file must fall within the path(s) specified for the Dompdf "chroot" option ## Limitations (Known Issues) * Table cells are not pageable, meaning a table row must fit on a single page. * Elements are rendered on the active page when they are parsed. * Embedding "raw" SVG's (`<svg><path...></svg>`) isn't working yet, you need to either link to an external SVG file, or use a DataURI like this: ```php $html = '<img src="data:image/svg+xml;base64,' . base64_encode($svg) . '" ...>'; ``` Watch https://github.com/dompdf/dompdf/issues/320 for progress * Does not support CSS flexbox. * Does not support CSS Grid. --- [](http://goo.gl/DSvWf) *If you find this project useful, please consider making a donation. Any funds donated will be used to help further development on this project.)* PK >�\�-j� � dompdf/AUTHORS.mdnu �[��� Dompdf was designed and developed by Benj Carson. ### Current Team * **Brian Sweeney** (maintainer) * **Till Berger** ### Alumni * **Benj Carson** (creator) * **Fabien Ménager** * **Simon Berger** * **Orion Richardson** ### Contributors * **Gabriel Bull** * **Barry vd. Heuvel** * **Ryan H. Masten** * **Helmut Tischer** * [and many more...](https://github.com/dompdf/dompdf/graphs/contributors) ### Thanks Dompdf would not have been possible without strong community support. PK >�\��P dompdf/VERSIONnu �[��� 2.0.3 PK >�\��kc dompdf/composer.jsonnu �[��� { "name": "dompdf/dompdf", "type": "library", "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", "homepage": "https://github.com/dompdf/dompdf", "license": "LGPL-2.1", "authors": [ { "name": "The Dompdf Community", "homepage": "https://github.com/dompdf/dompdf/blob/master/AUTHORS.md" } ], "autoload": { "psr-4": { "Dompdf\\": "src/" }, "classmap": [ "lib/" ] }, "autoload-dev": { "psr-4": { "Dompdf\\Tests\\": "tests/" } }, "require": { "php": "^7.1 || ^8.0", "ext-dom": "*", "ext-mbstring": "*", "masterminds/html5": "^2.0", "phenx/php-font-lib": ">=0.5.4 <1.0.0", "phenx/php-svg-lib": ">=0.3.3 <1.0.0" }, "require-dev": { "ext-json": "*", "ext-zip": "*", "phpunit/phpunit": "^7.5 || ^8 || ^9", "squizlabs/php_codesniffer": "^3.5", "mockery/mockery": "^1.3" }, "suggest": { "ext-gd": "Needed to process images", "ext-imagick": "Improves image processing performance", "ext-gmagick": "Improves image processing performance", "ext-zlib": "Needed for pdf stream compression" } } PK >�\呏�| �| dompdf/src/Options.phpnu �[��� <?php /** * @package dompdf * @link https://github.com/dompdf/dompdf * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License */ namespace Dompdf; class Options { /** * The root of your DOMPDF installation * * @var string */ private $rootDir; /** * The location of a temporary directory. * * The directory specified must be writable by the executing process. * The temporary directory is required to download remote images and when * using the PFDLib back end. * * @var string */ private $tempDir; /** * The location of the DOMPDF font directory * * The location of the directory where DOMPDF will store fonts and font metrics * Note: This directory must exist and be writable by the executing process. * * @var string */ private $fontDir; /** * The location of the DOMPDF font cache directory * * This directory contains the cached font metrics for the fonts used by DOMPDF. * This directory can be the same as $fontDir * * Note: This directory must exist and be writable by the executing process. * * @var string */ private $fontCache; /** * dompdf's "chroot" * * Utilized by Dompdf's default file:// protocol URI validation rule. * All local files opened by dompdf must be in a subdirectory of the directory * or directories specified by this option. * DO NOT set this value to '/' since this could allow an attacker to use dompdf to * read any files on the server. This should be an absolute path. * * ==== IMPORTANT ==== * This setting may increase the risk of system exploit. Do not change * this settings without understanding the consequences. Additional * documentation is available on the dompdf wiki at: * https://github.com/dompdf/dompdf/wiki * * @var array */ private $chroot; /** * Protocol whitelist * * Protocols and PHP wrappers allowed in URIs, and the validation rules * that determine if a resouce may be loaded. Full support is not guaranteed * for the protocols/wrappers specified * by this array. * * @var array */ private $allowedProtocols = [ "file://" => ["rules" => []], "http://" => ["rules" => []], "https://" => ["rules" => []] ]; /** * @var string */ private $logOutputFile; /** * Styles targeted to this media type are applied to the document. * This is on top of the media types that are always applied: * all, static, visual, bitmap, paged, dompdf * * @var string */ private $defaultMediaType = "screen"; /** * The default paper size. * * North America standard is "letter"; other countries generally "a4" * @see \Dompdf\Adapter\CPDF::PAPER_SIZES for valid sizes * * @var string|float[] */ private $defaultPaperSize = "letter"; /** * The default paper orientation. * * The orientation of the page (portrait or landscape). * * @var string */ private $defaultPaperOrientation = "portrait"; /** * The default font family * * Used if no suitable fonts can be found. This must exist in the font folder. * * @var string */ private $defaultFont = "serif"; /** * Image DPI setting * * This setting determines the default DPI setting for images and fonts. The * DPI may be overridden for inline images by explicitly setting the * image's width & height style attributes (i.e. if the image's native * width is 600 pixels and you specify the image's width as 72 points, * the image will have a DPI of 600 in the rendered PDF. The DPI of * background images can not be overridden and is controlled entirely * via this parameter. * * For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI). * If a size in html is given as px (or without unit as image size), * this tells the corresponding size in pt at 72 DPI. * This adjusts the relative sizes to be similar to the rendering of the * html page in a reference browser. * * In pdf, always 1 pt = 1/72 inch * * @var int */ private $dpi = 96; /** * A ratio applied to the fonts height to be more like browsers' line height * * @var float */ private $fontHeightRatio = 1.1; /** * Enable embedded PHP * * If this setting is set to true then DOMPDF will automatically evaluate * embedded PHP contained within <script type="text/php"> ... </script> tags. * * ==== IMPORTANT ==== * Enabling this for documents you do not trust (e.g. arbitrary remote html * pages) is a security risk. Embedded scripts are run with the same level of * system access available to dompdf. Set this option to false (recommended) * if you wish to process untrusted documents. * * This setting may increase the risk of system exploit. Do not change * this settings without understanding the consequences. Additional * documentation is available on the dompdf wiki at: * https://github.com/dompdf/dompdf/wiki * * @var bool */ private $isPhpEnabled = false; /** * Enable remote file access * * If this setting is set to true, DOMPDF will access remote sites for * images and CSS files as required. * * ==== IMPORTANT ==== * This can be a security risk, in particular in combination with isPhpEnabled and * allowing remote html code to be passed to $dompdf = new DOMPDF(); $dompdf->load_html(...); * This allows anonymous users to download legally doubtful internet content which on * tracing back appears to being downloaded by your server, or allows malicious php code * in remote html pages to be executed by your server with your account privileges. * * This setting may increase the risk of system exploit. Do not change * this settings without understanding the consequences. Additional * documentation is available on the dompdf wiki at: * https://github.com/dompdf/dompdf/wiki * * @var bool */ private $isRemoteEnabled = false; /** * Enable inline JavaScript * * If this setting is set to true then DOMPDF will automatically insert * JavaScript code contained within <script type="text/javascript"> ... </script> * tags as written into the PDF. * * NOTE: This is PDF-based JavaScript to be executed by the PDF viewer, * not browser-based JavaScript executed by Dompdf. * * @var bool */ private $isJavascriptEnabled = true; /** * Use the HTML5 Lib parser * * @deprecated * @var bool */ private $isHtml5ParserEnabled = true; /** * Whether to enable font subsetting or not. * * @var bool */ private $isFontSubsettingEnabled = true; /** * @var bool */ private $debugPng = false; /** * @var bool */ private $debugKeepTemp = false; /** * @var bool */ private $debugCss = false; /** * @var bool */ private $debugLayout = false; /** * @var bool */ private $debugLayoutLines = true; /** * @var bool */ private $debugLayoutBlocks = true; /** * @var bool */ private $debugLayoutInline = true; /** * @var bool */ private $debugLayoutPaddingBox = true; /** * The PDF rendering backend to use * * Valid settings are 'PDFLib', 'CPDF', 'GD', and 'auto'. 'auto' will * look for PDFLib and use it if found, or if not it will fall back on * CPDF. 'GD' renders PDFs to graphic files. {@link Dompdf\CanvasFactory} * ultimately determines which rendering class to instantiate * based on this setting. * * @var string */ private $pdfBackend = "CPDF"; /** * PDFlib license key * * If you are using a licensed, commercial version of PDFlib, specify * your license key here. If you are using PDFlib-Lite or are evaluating * the commercial version of PDFlib, comment out this setting. * * @link http://www.pdflib.com * * If pdflib present in web server and auto or selected explicitly above, * a real license code must exist! * * @var string */ private $pdflibLicense = ""; /** * HTTP context created with stream_context_create() * Will be used for file_get_contents * * @link https://www.php.net/manual/context.php * * @var resource */ private $httpContext; /** * @param array $attributes */ public function __construct(array $attributes = null) { $rootDir = realpath(__DIR__ . "/../"); $this->setChroot(array($rootDir)); $this->setRootDir($rootDir); $this->setTempDir(sys_get_temp_dir()); $this->setFontDir($rootDir . "/lib/fonts"); $this->setFontCache($this->getFontDir()); $ver = ""; $versionFile = realpath(__DIR__ . '/../VERSION'); if (($version = file_get_contents($versionFile)) !== false) { $version = trim($version); if ($version !== '$Format:<%h>$') { $ver = "/$version"; } } $this->setHttpContext([ "http" => [ "follow_location" => false, "user_agent" => "Dompdf$ver https://github.com/dompdf/dompdf" ] ]); $this->setAllowedProtocols(["file://", "http://", "https://"]); if (null !== $attributes) { $this->set($attributes); } } /** * @param array|string $attributes * @param null|mixed $value * @return $this */ public function set($attributes, $value = null) { if (!is_array($attributes)) { $attributes = [$attributes => $value]; } foreach ($attributes as $key => $value) { if ($key === 'tempDir' || $key === 'temp_dir') { $this->setTempDir($value); } elseif ($key === 'fontDir' || $key === 'font_dir') { $this->setFontDir($value); } elseif ($key === 'fontCache' || $key === 'font_cache') { $this->setFontCache($value); } elseif ($key === 'chroot') { $this->setChroot($value); } elseif ($key === 'allowedProtocols') { $this->setAllowedProtocols($value); } elseif ($key === 'logOutputFile' || $key === 'log_output_file') { $this->setLogOutputFile($value); } elseif ($key === 'defaultMediaType' || $key === 'default_media_type') { $this->setDefaultMediaType($value); } elseif ($key === 'defaultPaperSize' || $key === 'default_paper_size') { $this->setDefaultPaperSize($value); } elseif ($key === 'defaultPaperOrientation' || $key === 'default_paper_orientation') { $this->setDefaultPaperOrientation($value); } elseif ($key === 'defaultFont' || $key === 'default_font') { $this->setDefaultFont($value); } elseif ($key === 'dpi') { $this->setDpi($value); } elseif ($key === 'fontHeightRatio' || $key === 'font_height_ratio') { $this->setFontHeightRatio($value); } elseif ($key === 'isPhpEnabled' || $key === 'is_php_enabled' || $key === 'enable_php') { $this->setIsPhpEnabled($value); } elseif ($key === 'isRemoteEnabled' || $key === 'is_remote_enabled' || $key === 'enable_remote') { $this->setIsRemoteEnabled($value); } elseif ($key === 'isJavascriptEnabled' || $key === 'is_javascript_enabled' || $key === 'enable_javascript') { $this->setIsJavascriptEnabled($value); } elseif ($key === 'isHtml5ParserEnabled' || $key === 'is_html5_parser_enabled' || $key === 'enable_html5_parser') { $this->setIsHtml5ParserEnabled($value); } elseif ($key === 'isFontSubsettingEnabled' || $key === 'is_font_subsetting_enabled' || $key === 'enable_font_subsetting') { $this->setIsFontSubsettingEnabled($value); } elseif ($key === 'debugPng' || $key === 'debug_png') { $this->setDebugPng($value); } elseif ($key === 'debugKeepTemp' || $key === 'debug_keep_temp') { $this->setDebugKeepTemp($value); } elseif ($key === 'debugCss' || $key === 'debug_css') { $this->setDebugCss($value); } elseif ($key === 'debugLayout' || $key === 'debug_layout') { $this->setDebugLayout($value); } elseif ($key === 'debugLayoutLines' || $key === 'debug_layout_lines') { $this->setDebugLayoutLines($value); } elseif ($key === 'debugLayoutBlocks' || $key === 'debug_layout_blocks') { $this->setDebugLayoutBlocks($value); } elseif ($key === 'debugLayoutInline' || $key === 'debug_layout_inline') { $this->setDebugLayoutInline($value); } elseif ($key === 'debugLayoutPaddingBox' || $key === 'debug_layout_padding_box') { $this->setDebugLayoutPaddingBox($value); } elseif ($key === 'pdfBackend' || $key === 'pdf_backend') { $this->setPdfBackend($value); } elseif ($key === 'pdflibLicense' || $key === 'pdflib_license') { $this->setPdflibLicense($value); } elseif ($key === 'httpContext' || $key === 'http_context') { $this->setHttpContext($value); } } return $this; } /** * @param string $key * @return mixed */ public function get($key) { if ($key === 'tempDir' || $key === 'temp_dir') { return $this->getTempDir(); } elseif ($key === 'fontDir' || $key === 'font_dir') { return $this->getFontDir(); } elseif ($key === 'fontCache' || $key === 'font_cache') { return $this->getFontCache(); } elseif ($key === 'chroot') { return $this->getChroot(); } elseif ($key === 'allowedProtocols') { return $this->getAllowedProtocols(); } elseif ($key === 'logOutputFile' || $key === 'log_output_file') { return $this->getLogOutputFile(); } elseif ($key === 'defaultMediaType' || $key === 'default_media_type') { return $this->getDefaultMediaType(); } elseif ($key === 'defaultPaperSize' || $key === 'default_paper_size') { return $this->getDefaultPaperSize(); } elseif ($key === 'defaultPaperOrientation' || $key === 'default_paper_orientation') { return $this->getDefaultPaperOrientation(); } elseif ($key === 'defaultFont' || $key === 'default_font') { return $this->getDefaultFont(); } elseif ($key === 'dpi') { return $this->getDpi(); } elseif ($key === 'fontHeightRatio' || $key === 'font_height_ratio') { return $this->getFontHeightRatio(); } elseif ($key === 'isPhpEnabled' || $key === 'is_php_enabled' || $key === 'enable_php') { return $this->getIsPhpEnabled(); } elseif ($key === 'isRemoteEnabled' || $key === 'is_remote_enabled' || $key === 'enable_remote') { return $this->getIsRemoteEnabled(); } elseif ($key === 'isJavascriptEnabled' || $key === 'is_javascript_enabled' || $key === 'enable_javascript') { return $this->getIsJavascriptEnabled(); } elseif ($key === 'isHtml5ParserEnabled' || $key === 'is_html5_parser_enabled' || $key === 'enable_html5_parser') { return $this->getIsHtml5ParserEnabled(); } elseif ($key === 'isFontSubsettingEnabled' || $key === 'is_font_subsetting_enabled' || $key === 'enable_font_subsetting') { return $this->getIsFontSubsettingEnabled(); } elseif ($key === 'debugPng' || $key === 'debug_png') { return $this->getDebugPng(); } elseif ($key === 'debugKeepTemp' || $key === 'debug_keep_temp') { return $this->getDebugKeepTemp(); } elseif ($key === 'debugCss' || $key === 'debug_css') { return $this->getDebugCss(); } elseif ($key === 'debugLayout' || $key === 'debug_layout') { return $this->getDebugLayout(); } elseif ($key === 'debugLayoutLines' || $key === 'debug_layout_lines') { return $this->getDebugLayoutLines(); } elseif ($key === 'debugLayoutBlocks' || $key === 'debug_layout_blocks') { return $this->getDebugLayoutBlocks(); } elseif ($key === 'debugLayoutInline' || $key === 'debug_layout_inline') { return $this->getDebugLayoutInline(); } elseif ($key === 'debugLayoutPaddingBox' || $key === 'debug_layout_padding_box') { return $this->getDebugLayoutPaddingBox(); } elseif ($key === 'pdfBackend' || $key === 'pdf_backend') { return $this->getPdfBackend(); } elseif ($key === 'pdflibLicense' || $key === 'pdflib_license') { return $this->getPdflibLicense(); } elseif ($key === 'httpContext' || $key === 'http_context') { return $this->getHttpContext(); } return null; } /** * @param string $pdfBackend * @return $this */ public function setPdfBackend($pdfBackend) { $this->pdfBackend = $pdfBackend; return $this; } /** * @return string */ public function getPdfBackend() { return $this->pdfBackend; } /** * @param string $pdflibLicense * @return $this */ public function setPdflibLicense($pdflibLicense) { $this->pdflibLicense = $pdflibLicense; return $this; } /** * @return string */ public function getPdflibLicense() { return $this->pdflibLicense; } /** * @param array|string $chroot * @return $this */ public function setChroot($chroot, $delimiter = ',') { if (is_string($chroot)) { $this->chroot = explode($delimiter, $chroot); } elseif (is_array($chroot)) { $this->chroot = $chroot; } return $this; } /** * @return array */ public function getAllowedProtocols() { return $this->allowedProtocols; } /** * @param array $allowedProtocols The protocols to allow, as an array * formatted as ["protocol://" => ["rules" => [callable]], ...] * or ["protocol://", ...] * * @return $this */ public function setAllowedProtocols(array $allowedProtocols) { $protocols = []; foreach ($allowedProtocols as $protocol => $config) { if (is_string($protocol)) { $protocols[$protocol] = []; if (is_array($config)) { $protocols[$protocol] = $config; } } elseif (is_string($config)) { $protocols[$config] = []; } } $this->allowedProtocols = []; foreach ($protocols as $protocol => $config) { $this->addAllowedProtocol($protocol, ...($config["rules"] ?? [])); } return $this; } /** * Adds a new protocol to the allowed protocols collection * * @param string $protocol The scheme to add (e.g. "http://") * @param callable $rule A callable that validates the protocol * @return $this */ public function addAllowedProtocol(string $protocol, callable ...$rules) { $protocol = strtolower($protocol); if (empty($rules)) { $rules = []; switch ($protocol) { case "file://": $rules[] = [$this, "validateLocalUri"]; break; case "http://": case "https://": $rules[] = [$this, "validateRemoteUri"]; break; case "phar://": $rules[] = [$this, "validatePharUri"]; break; } } $this->allowedProtocols[$protocol] = ["rules" => $rules]; return $this; } /** * @return array */ public function getChroot() { $chroot = []; if (is_array($this->chroot)) { $chroot = $this->chroot; } return $chroot; } /** * @param boolean $debugCss * @return $this */ public function setDebugCss($debugCss) { $this->debugCss = $debugCss; return $this; } /** * @return boolean */ public function getDebugCss() { return $this->debugCss; } /** * @param boolean $debugKeepTemp * @return $this */ public function setDebugKeepTemp($debugKeepTemp) { $this->debugKeepTemp = $debugKeepTemp; return $this; } /** * @return boolean */ public function getDebugKeepTemp() { return $this->debugKeepTemp; } /** * @param boolean $debugLayout * @return $this */ public function setDebugLayout($debugLayout) { $this->debugLayout = $debugLayout; return $this; } /** * @return boolean */ public function getDebugLayout() { return $this->debugLayout; } /** * @param boolean $debugLayoutBlocks * @return $this */ public function setDebugLayoutBlocks($debugLayoutBlocks) { $this->debugLayoutBlocks = $debugLayoutBlocks; return $this; } /** * @return boolean */ public function getDebugLayoutBlocks() { return $this->debugLayoutBlocks; } /** * @param boolean $debugLayoutInline * @return $this */ public function setDebugLayoutInline($debugLayoutInline) { $this->debugLayoutInline = $debugLayoutInline; return $this; } /** * @return boolean */ public function getDebugLayoutInline() { return $this->debugLayoutInline; } /** * @param boolean $debugLayoutLines * @return $this */ public function setDebugLayoutLines($debugLayoutLines) { $this->debugLayoutLines = $debugLayoutLines; return $this; } /** * @return boolean */ public function getDebugLayoutLines() { return $this->debugLayoutLines; } /** * @param boolean $debugLayoutPaddingBox * @return $this */ public function setDebugLayoutPaddingBox($debugLayoutPaddingBox) { $this->debugLayoutPaddingBox = $debugLayoutPaddingBox; return $this; } /** * @return boolean */ public function getDebugLayoutPaddingBox() { return $this->debugLayoutPaddingBox; } /** * @param boolean $debugPng * @return $this */ public function setDebugPng($debugPng) { $this->debugPng = $debugPng; return $this; } /** * @return boolean */ public function getDebugPng() { return $this->debugPng; } /** * @param string $defaultFont * @return $this */ public function setDefaultFont($defaultFont) { if (!($defaultFont === null || trim($defaultFont) === "")) { $this->defaultFont = $defaultFont; } else { $this->defaultFont = "serif"; } return $this; } /** * @return string */ public function getDefaultFont() { return $this->defaultFont; } /** * @param string $defaultMediaType * @return $this */ public function setDefaultMediaType($defaultMediaType) { $this->defaultMediaType = $defaultMediaType; return $this; } /** * @return string */ public function getDefaultMediaType() { return $this->defaultMediaType; } /** * @param string|float[] $defaultPaperSize * @return $this */ public function setDefaultPaperSize($defaultPaperSize): self { $this->defaultPaperSize = $defaultPaperSize; return $this; } /** * @param string $defaultPaperOrientation * @return $this */ public function setDefaultPaperOrientation(string $defaultPaperOrientation): self { $this->defaultPaperOrientation = $defaultPaperOrientation; return $this; } /** * @return string|float[] */ public function getDefaultPaperSize() { return $this->defaultPaperSize; } /** * @return string */ public function getDefaultPaperOrientation(): string { return $this->defaultPaperOrientation; } /** * @param int $dpi * @return $this */ public function setDpi($dpi) { $this->dpi = $dpi; return $this; } /** * @return int */ public function getDpi() { return $this->dpi; } /** * @param string $fontCache * @return $this */ public function setFontCache($fontCache) { $this->fontCache = $fontCache; return $this; } /** * @return string */ public function getFontCache() { return $this->fontCache; } /** * @param string $fontDir * @return $this */ public function setFontDir($fontDir) { $this->fontDir = $fontDir; return $this; } /** * @return string */ public function getFontDir() { return $this->fontDir; } /** * @param float $fontHeightRatio * @return $this */ public function setFontHeightRatio($fontHeightRatio) { $this->fontHeightRatio = $fontHeightRatio; return $this; } /** * @return float */ public function getFontHeightRatio() { return $this->fontHeightRatio; } /** * @param boolean $isFontSubsettingEnabled * @return $this */ public function setIsFontSubsettingEnabled($isFontSubsettingEnabled) { $this->isFontSubsettingEnabled = $isFontSubsettingEnabled; return $this; } /** * @return boolean */ public function getIsFontSubsettingEnabled() { return $this->isFontSubsettingEnabled; } /** * @return boolean */ public function isFontSubsettingEnabled() { return $this->getIsFontSubsettingEnabled(); } /** * @deprecated * @param boolean $isHtml5ParserEnabled * @return $this */ public function setIsHtml5ParserEnabled($isHtml5ParserEnabled) { $this->isHtml5ParserEnabled = $isHtml5ParserEnabled; return $this; } /** * @deprecated * @return boolean */ public function getIsHtml5ParserEnabled() { return $this->isHtml5ParserEnabled; } /** * @deprecated * @return boolean */ public function isHtml5ParserEnabled() { return $this->getIsHtml5ParserEnabled(); } /** * @param boolean $isJavascriptEnabled * @return $this */ public function setIsJavascriptEnabled($isJavascriptEnabled) { $this->isJavascriptEnabled = $isJavascriptEnabled; return $this; } /** * @return boolean */ public function getIsJavascriptEnabled() { return $this->isJavascriptEnabled; } /** * @return boolean */ public function isJavascriptEnabled() { return $this->getIsJavascriptEnabled(); } /** * @param boolean $isPhpEnabled * @return $this */ public function setIsPhpEnabled($isPhpEnabled) { $this->isPhpEnabled = $isPhpEnabled; return $this; } /** * @return boolean */ public function getIsPhpEnabled() { return $this->isPhpEnabled; } /** * @return boolean */ public function isPhpEnabled() { return $this->getIsPhpEnabled(); } /** * @param boolean $isRemoteEnabled * @return $this */ public function setIsRemoteEnabled($isRemoteEnabled) { $this->isRemoteEnabled = $isRemoteEnabled; return $this; } /** * @return boolean */ public function getIsRemoteEnabled() { return $this->isRemoteEnabled; } /** * @return boolean */ public function isRemoteEnabled() { return $this->getIsRemoteEnabled(); } /** * @param string $logOutputFile * @return $this */ public function setLogOutputFile($logOutputFile) { $this->logOutputFile = $logOutputFile; return $this; } /** * @return string */ public function getLogOutputFile() { return $this->logOutputFile; } /** * @param string $tempDir * @return $this */ public function setTempDir($tempDir) { $this->tempDir = $tempDir; return $this; } /** * @return string */ public function getTempDir() { return $this->tempDir; } /** * @param string $rootDir * @return $this */ public function setRootDir($rootDir) { $this->rootDir = $rootDir; return $this; } /** * @return string */ public function getRootDir() { return $this->rootDir; } /** * Sets the HTTP context * * @param resource|array $httpContext * @return $this */ public function setHttpContext($httpContext) { $this->httpContext = is_array($httpContext) ? stream_context_create($httpContext) : $httpContext; return $this; } /** * Returns the HTTP context * * @return resource */ public function getHttpContext() { return $this->httpContext; } public function validateLocalUri(string $uri) { if ($uri === null || strlen($uri) === 0) { return [false, "The URI must not be empty."]; } $realfile = realpath(str_replace("file://", "", $uri)); $dirs = $this->chroot; $dirs[] = $this->rootDir; $chrootValid = false; foreach ($dirs as $chrootPath) { $chrootPath = realpath($chrootPath); if ($chrootPath !== false && strpos($realfile, $chrootPath) === 0) { $chrootValid = true; break; } } if ($chrootValid !== true) { return [false, "Permission denied. The file could not be found under the paths specified by Options::chroot."]; } if (!$realfile) { return [false, "File not found."]; } return [true, null]; } public function validatePharUri(string $uri) { if ($uri === null || strlen($uri) === 0) { return [false, "The URI must not be empty."]; } $file = substr(substr($uri, 0, strpos($uri, ".phar") + 5), 7); return $this->validateLocalUri($file); } public function validateRemoteUri(string $uri) { if ($uri === null || strlen($uri) === 0) { return [false, "The URI must not be empty."]; } if (!$this->isRemoteEnabled) { return [false, "Remote file requested, but remote file download is disabled."]; } return [true, null]; } } PK >�\ � � * dompdf/src/FrameReflower/TableRowGroup.phpnu �[��� <?php /** * @package dompdf * @link https://github.com/dompdf/dompdf * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License */ namespace Dompdf\FrameReflower; use Dompdf\FrameDecorator\Block as BlockFrameDecorator; use Dompdf\FrameDecorator\Table as TableFrameDecorator; use Dompdf\FrameDecorator\TableRowGroup as TableRowGroupFrameDecorator; /** * Reflows table row groups (e.g. tbody tags) * * @package dompdf */ class TableRowGroup extends AbstractFrameReflower { /** * TableRowGroup constructor. * @param TableRowGroupFrameDecorator $frame */ function __construct(TableRowGroupFrameDecorator $frame) { parent::__construct($frame); } /** * @param BlockFrameDecorator|null $block */ function reflow(BlockFrameDecorator $block = null) { /** @var TableRowGroupFrameDecorator */ $frame = $this->_frame; $page = $frame->get_root(); // Counters and generated content $this->_set_content(); $style = $frame->get_style(); $cb = $frame->get_containing_block(); foreach ($frame->get_children() as $child) { $child->set_containing_block($cb["x"], $cb["y"], $cb["w"], $cb["h"]); $child->reflow(); // Check if a split has occurred $page->check_page_break($child); if ($page->is_full()) { break; } } $table = TableFrameDecorator::find_parent_table($frame); $cellmap = $table->get_cellmap(); // Stop reflow if a page break has occurred before the frame, in which // case it is not part of its parent table's cell map yet if ($page->is_full() && !$cellmap->frame_exists_in_cellmap($frame)) { return; } $style->set_used("width", $cellmap->get_frame_width($frame)); $style->set_used("height", $cellmap->get_frame_height($frame)); $frame->set_position($cellmap->get_frame_position($frame)); } } PK >�\��� � '