### Install via command line Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/masterminds/html5/README.md Use the composer executable to install the library. ```bash composer require masterminds/html5 ``` -------------------------------- ### Install Composer Dependencies Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/strauss.md Initial command to install all project dependencies defined in composer.json. ```sh composer install ``` -------------------------------- ### Run unit tests Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md Commands to install dependencies and execute the test suite. ```bash composer install ./vendor/bin/phpunit ``` -------------------------------- ### Plugin installation path Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/composer.md The directory where the plugin is installed after running Composer commands. ```text wp-content/plugins/woocommerce-pdf-invoices-packing-slips ``` -------------------------------- ### Install via composer.json Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/masterminds/html5/README.md Add the dependency to your project's composer.json file. ```json { "require" : { "masterminds/html5": "^2.0" }, } ``` -------------------------------- ### Install dependencies via Composer CLI Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/composer.md Commands to install the defined dependencies in a new or existing project. ```bash composer install ``` ```bash composer require composer/installers:^2.0 composer require wpovernight/woocommerce-pdf-invoices-packing-slips:^5.9 ``` -------------------------------- ### Install Dompdf via Git Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/dompdf/dompdf/README.md Commands to clone the repository and its required dependencies manually. ```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 ``` -------------------------------- ### Configure composer.json for WordPress plugin installation Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/composer.md Defines the project requirements and sets the installer path to the WordPress plugins directory. ```json { "name": "alex/my-project", "require": { "composer/installers": "^2.0", "wpovernight/woocommerce-pdf-invoices-packing-slips": "^5.9" }, "extra": { "installer-paths": { "wp-content/plugins/{$name}/": [ "type:wordpress-plugin" ] } }, "config": { "allow-plugins": { "composer/installers": true } } } ``` -------------------------------- ### Example composer.json Configuration Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/strauss.md Configuration structure for Strauss within the composer.json file, defining target directories, prefixes, and package overrides. ```json { "name": "wpovernight/woocommerce-pdf-invoices-packing-slips", "description": "PDF Invoices & Packing Slips for WooCommerce", "autoload": { "psr-4": { "WPO\\IPS\\": "includes/", "WPO\\IPS\\EDI\\": "edi/" } }, "require": { "dompdf/dompdf": "^3.1", "symfony/polyfill-mbstring": "^1.31", "symfony/polyfill-iconv": "^1.31", "sabre/xml": "^4.0" }, "extra": { "strauss": { "target_directory": "vendor/strauss", "namespace_prefix": "WPO\\IPS\\Vendor\\", "classmap_prefix": "WPO_IPS_Vendor_", "constant_prefix": "WPO_IPS_VENDOR_", "packages": [ "dompdf/dompdf", "sabberworm/php-css-parser", "sabre/xml", "sabre/uri", "masterminds/html5" ], "update_call_sites": true, "override_autoload": { "dompdf/dompdf": { "classmap": ["."] }, "dompdf/php-font-lib": { "classmap": ["."] }, "dompdf/php-svg-lib": { "classmap": ["."] }, "masterminds/html5": { "classmap": ["."] }, "sabberworm/php-css-parser": { "classmap": ["."] }, "sabre/uri": { "classmap": ["."] }, "sabre/xml": { "classmap": ["."] } }, "exclude_from_copy": { "packages": [ "symfony/polyfill-mbstring", "symfony/polyfill-iconv" ], "namespaces": [], "file_patterns": [ "/^psr.*$/" ] }, "exclude_from_prefix": { "packages": [ "symfony/polyfill-mbstring", "symfony/polyfill-iconv" ], "namespaces": [], "file_patterns": [] }, "namespace_replacement_patterns": {}, "delete_vendor_packages": true, "delete_vendor_files": true } }, "config": { "platform-check": false } } ``` -------------------------------- ### CSS Input Example Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md A sample CSS snippet containing @charset, @font-face, standard selectors, and @keyframes. ```css @charset "utf-8"; @font-face { font-family: "CrassRoots"; src: url("../media/cr.ttf"); } html, body { font-size: 1.6em; } @keyframes mymove { from { top: 0px; } to { top: 200px; } } ``` -------------------------------- ### Load Packaged Release Autoloader Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/dompdf/dompdf/README.md Use this autoloader when installing via a downloaded packaged archive. ```php // include autoloader require_once 'dompdf/autoload.inc.php'; ``` -------------------------------- ### CSS Parser Example Input and Output Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md Shows the raw CSS input and the resulting minified output after processing with the parser. ```css #header { margin: 10px 2em 1cm 2%; font-family: Verdana, Helvetica, "Gill Sans", sans-serif; color: red !important; } ``` ```css #header {margin: 10px 2em 1cm 2%;font-family: Verdana,Helvetica,"Gill Sans",sans-serif;color: red !important;} ``` -------------------------------- ### Install PHP CSS Parser via Composer Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md Use Composer to add the library to your project dependencies. ```bash composer require sabberworm/php-css-parser ``` -------------------------------- ### CSS Render Output Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md Example of CSS code generated by the render() method. ```css @charset "utf-8"; @font-face {font-family: "CrassRoots";src: url("../media/cr.ttf");} html, body {font-size: 1.6em;} @keyframes mymove {from {top: 0px;} to {top: 200px;}} ``` -------------------------------- ### Install Dompdf via Composer Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/dompdf/dompdf/README.md Use this command to add the Dompdf package to your project dependencies. ```bash composer require dompdf/dompdf ``` -------------------------------- ### Compare HTML5 API usage before and after 2.x upgrade Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/masterminds/html5/UPGRADING.md Shows the transition from static method calls to instantiating the HTML5 class. ```php $dom = \HTML5::loadHTML('....'); \HTML5::saveHTML($dom); ``` ```php use WPO\IPS\Vendor\Masterminds\HTML5; $html5 = new HTML5(); $dom = $html5->loadHTML('....'); echo $html5->saveHTML($dom); ``` -------------------------------- ### Configure HTML5 options Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/masterminds/html5/README.md Pass an associative array of configuration options to the HTML5 constructor. ```php // An associative array of options $options = array( 'option_name' => 'option_value', ); // Provide the options to the constructor $html5 = new HTML5($options); $dom = $html5->loadHTML($html); ``` -------------------------------- ### Initialize the CSS Parser Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md Create a new instance of the parser by passing the CSS content string. ```php new \WPO\IPS\Vendor\Sabberworm\CSS\Parser($css); ``` -------------------------------- ### Render HTML to PDF Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/dompdf/dompdf/README.md Basic workflow to instantiate Dompdf, load HTML content, set paper orientation, and stream the output to the browser. ```php // reference the Dompdf namespace use WPO\ IPS\\Vendor\\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(); ``` -------------------------------- ### Configure Dompdf Options Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/dompdf/dompdf/README.md Methods for setting configuration options either during class instantiation or dynamically at runtime. ```php use WPO\\IPS\\Vendor\\Dompdf\\Dompdf; use WPO\\IPS\\Vendor\\Dompdf\\Options; $options = new Options(); $options->set('defaultFont', 'Courier'); $dompdf = new Dompdf($options); ``` ```php use WPO\\IPS\\Vendor\\Dompdf\\Dompdf; $dompdf = new Dompdf(); $options = $dompdf->getOptions(); $options->setDefaultFont('Courier'); $dompdf->setOptions($options); ``` -------------------------------- ### Render CSS document output Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md Demonstrates basic rendering of a parsed CSS document to a string. ```php $parser = new \WPO\IPS\Vendor\Sabberworm\CSS\Parser(file_get_contents('somefile.css')); $cssDocument = $parser->parse(); print $cssDocument->render(); ``` -------------------------------- ### Enable XML Namespaces in HTML5 Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/masterminds/html5/README.md Configure the HTML5 instance to support XML-style namespaces by setting the xmlNamespaces option to true. ```php use WPO\IPS\Vendor\Masterminds\HTML5; $html = new HTML5(array( "xmlNamespaces" => true )); $dom = $html->loadHTML(''); $dom->documentElement->namespaceURI; // http://www.example.com ``` -------------------------------- ### Create a Font Subset Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/dompdf/php-font-lib/README.md Reduce a font file to include only a specific set of characters and save the result. ```php $font = WPO\IPS\Vendor\FontLib\Font::load('fontfile.ttf'); $font->parse(); $font->setSubset("abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ.:,;' (!?)+-*/== 1234567890"); // characters to include $font->reduce(); touch('fontfile.subset.ttf'); $font->open('fontfile.subset.ttf', WPO\IPS\Vendor\FontLib\BinaryStream::modeReadWrite); $font->encode(array("OS/2")); $font->close(); ``` -------------------------------- ### Apply Strauss Class Prefixing Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/strauss.md Executes the Strauss PHAR to apply namespace and class prefixing based on the configuration. ```sh php strauss.phar ``` -------------------------------- ### Generate Adobe Font Metrics Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/dompdf/php-font-lib/README.md Create an Adobe Font Metrics (AFM) file from a loaded font file. ```php $font = WPO\IPS\Vendor\FontLib\Font::load('fontfile.ttf'); $font->parse(); $font->saveAdobeFontMetrics('fontfile.ufm'); ``` -------------------------------- ### Load Composer Autoloader Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/dompdf/dompdf/README.md Include the Composer autoloader early in your project to ensure all dependencies are 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'; ``` -------------------------------- ### Enable Strict Parsing Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md Configure the parser to throw exceptions on invalid or unknown CSS constructs. ```php $parser = new \WPO\IPS\Vendor\Sabberworm\CSS\Parser( file_get_contents('somefile.css'), \WPO\IPS\Vendor\Sabberworm\CSS\Settings::create()->beStrict() ); ``` -------------------------------- ### Parse a CSS File Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md Read a CSS file from the filesystem and parse it into a document structure. ```php $parser = new \WPO\IPS\Vendor\Sabberworm\CSS\Parser(file_get_contents('somefile.css')); $cssDocument = $parser->parse(); ``` -------------------------------- ### Define Implicit Namespaces Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/masterminds/html5/README.md Register default prefixes that do not require explicit namespace declarations in the source HTML. ```php use WPO\IPS\Vendor\Masterminds\HTML5; $html = new HTML5(array( "implicitNamespaces"=>array( "t"=>"http://www.example.com" ) )); $dom = $html->loadHTML(''); $dom->documentElement->namespaceURI; // http://www.example.com ``` -------------------------------- ### Format CSS output Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md Customizes the output format using OutputFormat instances or predefined presets. ```php $format = \WPO\IPS\Vendor\Sabberworm\CSS\OutputFormat::create() ->indentWithSpaces(4)->setSpaceBetweenRules("\n"); print $cssDocument->render($format); ``` ```php print $cssDocument->render(WPO\IPS\Vendor\Sabberworm\CSS\OutputFormat::createPretty()); print $cssDocument->render(WPO\IPS\Vendor\Sabberworm\CSS\OutputFormat::createCompact()); ``` -------------------------------- ### Parse and save HTML5 Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/masterminds/html5/README.md Use the HTML5 class to load an HTML string into a DOMDocument and output or save the result. ```php TEST

Hello World

This is a test of the HTML5 parser.

HERE; // Parse the document. $dom is a DOMDocument. $html5 = new HTML5(); $dom = $html5->loadHTML($html); // Render it as HTML5: print $html5->saveHTML($dom); // Or save it to a file: $html5->save($dom, 'out.html'); ``` -------------------------------- ### HTML5::loadHTML Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/masterminds/html5/README.md Parses an HTML5 string into a DOMDocument object. ```APIDOC ## HTML5::loadHTML ### Description Parses an HTML5 string and returns a DOMDocument object. ### Signature `public DOMDocument loadHTML(string $html)` ### Parameters - **$html** (string) - Required - The HTML5 string to parse. ``` -------------------------------- ### Retrieve Base Font Information Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/dompdf/php-font-lib/README.md Load a font file and extract metadata such as name, subfamily, and weight. The parse() method must be called before accessing specific font properties. ```php $font = \WPO\IPS\Vendor\FontLib\Font::load('fontfile.ttf'); $font->parse(); // for getFontWeight() to work this call must be done first! echo $font->getFontName() .'
'; echo $font->getFontSubfamily() .'
'; echo $font->getFontSubfamilyID() .'
'; echo $font->getFontFullName() .'
'; echo $font->getFontVersion() .'
'; echo $font->getFontWeight() .'
'; echo $font->getFontPostscriptName() .'
'; $font->close(); ``` -------------------------------- ### Configure Default Charset Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md Set a default charset for the parser to use if no @charset declaration is present in the CSS. ```php $settings = \WPO\IPS\Vendor\Sabberworm\CSS\Settings::create() ->withDefaultCharset('windows-1252'); $parser = new \WPO\IPS\Vendor\Sabberworm\CSS\Parser($css, $settings); ``` -------------------------------- ### Prepend an ID to all CSS selectors Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md Iterates through all declaration blocks and prepends a specific ID to every selector. ```php $myId = "#my_id"; $parser = new \WPO\IPS\Vendor\Sabberworm\CSS\Parser($css); $cssDocument = $parser->parse(); foreach ($cssDocument->getAllDeclarationBlocks() as $block) { foreach ($block->getSelectors() as $selector) { // Loop over all selector parts (the comma-separated strings in a // selector) and prepend the ID. $selector->setSelector($myId.' '.$selector->getSelector()); } } ``` -------------------------------- ### HTML5::save Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/masterminds/html5/README.md Serializes a DOMDocument object and saves it to a file. ```APIDOC ## HTML5::save ### Description Serializes a DOMDocument object and writes the output to a specified file path. ### Signature `public void save(DOMDocument $dom, string $filename)` ### Parameters - **$dom** (DOMDocument) - Required - The DOMDocument object to serialize. - **$filename** (string) - Required - The path to the file where the HTML5 will be saved. ``` -------------------------------- ### Update Composer Dependencies Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/strauss.md Updates project dependencies to their latest versions before running Strauss. ```sh composer update ``` -------------------------------- ### Disable Multibyte Functions Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md Improve parsing speed by disabling mb_* functions, though this is not recommended for untrusted input. ```php $settings = \WPO\IPS\Vendor\Sabberworm\CSS\Settings::create()->withMultibyteSupport(false); $parser = new \WPO\IPS\Vendor\Sabberworm\CSS\Parser($css, $settings); ``` -------------------------------- ### Embed SVG using DataURI Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/dompdf/dompdf/README.md Use this workaround to embed SVG content when direct raw SVG tags are not rendered correctly. ```php $html = ''; ``` -------------------------------- ### HTML5::saveHTML Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/masterminds/html5/README.md Serializes a DOMDocument object into an HTML5 string. ```APIDOC ## HTML5::saveHTML ### Description Serializes a DOMDocument object into an HTML5 string. ### Signature `public string saveHTML(DOMDocument $dom)` ### Parameters - **$dom** (DOMDocument) - Required - The DOMDocument object to serialize. ``` -------------------------------- ### CSS Parser Internal Structure Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md Displays the internal object representation of the parsed CSS using var_dump(). ```php class Sabberworm\CSS\CSSList\Document#4 (2) { protected $aContents => array(1) { [0] => class Sabberworm\CSS\RuleSet\DeclarationBlock#5 (3) { private $aSelectors => array(1) { [0] => class Sabberworm\CSS\Property\Selector#6 (2) { private $sSelector => string(7) "#header" private $iSpecificity => NULL } } private $aRules => array(3) { 'margin' => array(1) { [0] => class Sabberworm\CSS\Rule\Rule#7 (4) { private $sRule => string(6) "margin" private $mValue => class Sabberworm\CSS\Value\RuleValueList#12 (3) { protected $aComponents => array(4) { [0] => class Sabberworm\CSS\Value\Size#8 (4) { private $fSize => double(10) private $sUnit => string(2) "px" private $bIsColorComponent => bool(false) protected $iLineNo => int(2) } [1] => class Sabberworm\CSS\Value\Size#9 (4) { private $fSize => double(2) private $sUnit => string(2) "em" private $bIsColorComponent => bool(false) protected $iLineNo => int(2) } [2] => class Sabberworm\CSS\Value\Size#10 (4) { private $fSize => double(1) private $sUnit => string(2) "cm" private $bIsColorComponent => bool(false) protected $iLineNo => int(2) } [3] => class Sabberworm\CSS\Value\Size#11 (4) { private $fSize => double(2) private $sUnit => string(1) "%" private $bIsColorComponent => bool(false) protected $iLineNo => int(2) } } protected $sSeparator => string(1) " " protected $iLineNo => int(2) } private $bIsImportant => bool(false) protected $iLineNo => int(2) } } 'font-family' => array(1) { [0] => class Sabberworm\CSS\Rule\Rule#13 (4) { private $sRule => string(11) "font-family" private $mValue => class Sabberworm\CSS\Value\RuleValueList#15 (3) { protected $aComponents => array(4) { [0] => string(7) "Verdana" [1] => string(9) "Helvetica" [2] => class Sabberworm\CSS\Value\CSSString#14 (2) { private $sString => string(9) "Gill Sans" protected $iLineNo => int(3) } [3] => string(10) "sans-serif" } protected $sSeparator => string(1) "," protected $iLineNo => int(3) } private $bIsImportant => bool(false) protected $iLineNo => int(3) } } 'color' => array(1) { [0] => class Sabberworm\CSS\Rule\Rule#16 (4) { private $sRule => string(5) "color" private $mValue => string(3) "red" private $bIsImportant => bool(true) protected $iLineNo => int(4) } } } protected $iLineNo => int(1) } } protected $iLineNo => int(1) } ``` -------------------------------- ### Regenerate Autoloader Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/strauss.md Updates the autoloader to reflect changes made by Strauss to the dependency structure. ```sh composer dump-autoload -o ``` -------------------------------- ### Parsed CSS Structure Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md The internal PHP object structure of the parsed CSS, represented via var_dump(). ```php class Sabberworm\CSS\CSSList\Document#4 (2) { protected $aContents => array(4) { [0] => class Sabberworm\CSS\Property\Charset#6 (2) { private $sCharset => class Sabberworm\CSS\Value\CSSString#5 (2) { private $sString => string(5) "utf-8" protected $iLineNo => int(1) } protected $iLineNo => int(1) } [1] => class Sabberworm\CSS\RuleSet\AtRuleSet#7 (4) { private $sType => string(9) "font-face" private $sArgs => string(0) "" private $aRules => array(2) { 'font-family' => array(1) { [0] => class Sabberworm\CSS\Rule\Rule#8 (4) { private $sRule => string(11) "font-family" private $mValue => class Sabberworm\CSS\Value\CSSString#9 (2) { private $sString => string(10) "CrassRoots" protected $iLineNo => int(4) } private $bIsImportant => bool(false) protected $iLineNo => int(4) } } 'src' => array(1) { [0] => class Sabberworm\CSS\Rule\Rule#10 (4) { private $sRule => string(3) "src" private $mValue => class Sabberworm\CSS\Value\URL#11 (2) { private $oURL => class Sabberworm\CSS\Value\CSSString#12 (2) { private $sString => string(15) "../media/cr.ttf" protected $iLineNo => int(5) } protected $iLineNo => int(5) } private $bIsImportant => bool(false) protected $iLineNo => int(5) } } } protected $iLineNo => int(3) } [2] => class Sabberworm\CSS\RuleSet\DeclarationBlock#13 (3) { private $aSelectors => array(2) { [0] => class Sabberworm\CSS\Property\Selector#14 (2) { private $sSelector => string(4) "html" private $iSpecificity => NULL } [1] => class Sabberworm\CSS\Property\Selector#15 (2) { private $sSelector => string(4) "body" private $iSpecificity => NULL } } private $aRules => array(1) { 'font-size' => array(1) { [0] => class Sabberworm\CSS\Rule\Rule#16 (4) { private $sRule => string(9) "font-size" private $mValue => class Sabberworm\CSS\Value\Size#17 (4) { private $fSize => double(1.6) private $sUnit => string(2) "em" private $bIsColorComponent => bool(false) protected $iLineNo => int(9) } private $bIsImportant => bool(false) protected $iLineNo => int(9) } } } protected $iLineNo => int(8) } [3] => class Sabberworm\CSS\CSSList\KeyFrame#18 (4) { private $vendorKeyFrame => string(9) "keyframes" private $animationName => string(6) "mymove" protected $aContents => array(2) { [0] => class Sabberworm\CSS\RuleSet\DeclarationBlock#19 (3) { private $aSelectors => array(1) { [0] => class Sabberworm\CSS\Property\Selector#20 (2) { private $sSelector => string(4) "from" private $iSpecificity => NULL } } private $aRules => array(1) { 'top' => array(1) { [0] => class Sabberworm\CSS\Rule\Rule#21 (4) { private $sRule => string(3) "top" private $mValue => class Sabberworm\CSS\Value\Size#22 (4) { private $fSize => double(0) private $sUnit => string(2) "px" private $bIsColorComponent => bool(false) protected $iLineNo => int(13) } private $bIsImportant => bool(false) protected $iLineNo => int(13) } } } protected $iLineNo => int(13) } [1] => class Sabberworm\CSS\RuleSet\DeclarationBlock#23 (3) { ``` -------------------------------- ### Internal CSS Object Structure Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md Represents the internal class structure of a parsed CSS rule set. ```php private $aSelectors => array(1) { [0] => class Sabberworm\CSS\Property\Selector#24 (2) { private $sSelector => string(2) "to" private $iSpecificity => NULL } } private $aRules => array(1) { 'top' => array(1) { [0] => class Sabberworm\CSS\Rule\Rule#25 (4) { private $sRule => string(3) "top" private $mValue => class Sabberworm\CSS\Value\Size#26 (4) { private $fSize => double(200) private $sUnit => string(2) "px" private $bIsColorComponent => bool(false) protected $iLineNo => int(14) } private $bIsImportant => bool(false) protected $iLineNo => int(14) } } } protected $iLineNo => int(14) } } protected $iLineNo => int(12) } } protected $iLineNo => int(1) } ``` -------------------------------- ### Shrink absolute CSS sizes Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md Modifies all non-relative CSS size values by dividing them by two. ```php $parser = new \WPO\IPS\Vendor\Sabberworm\CSS\Parser($css); $cssDocument = $parser->parse(); foreach ($cssDocument->getAllValues() as $value) { if ($value instanceof CSSSize && !$value->isRelative()) { $value->setSize($value->getSize() / 2); } } ``` -------------------------------- ### Remove unwanted CSS rules Source: https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/blob/main/vendor/strauss/sabberworm/php-css-parser/README.md Removes specific rules from all rule sets, supporting partial matches like prefixes. ```php $parser = new \WPO\IPS\Vendor\Sabberworm\CSS\Parser($css); $cssDocument = $parser->parse(); foreach($cssDocument->getAllRuleSets() as $oRuleSet) { // Note that the added dash will make this remove all rules starting with // `font-` (like `font-size`, `font-weight`, etc.) as well as a potential // `font` rule. $oRuleSet->removeRule('font-'); $oRuleSet->removeRule('cursor'); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.