多🌹444收拾收拾计算机视觉手机手机手机手机4大尺寸惆怅长岑长 ??????????????????????????С??????????????P??????????????????????????????????????????????????????^?????????? ????j?????????? ? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!PK†CW]â^p””src/CssToInlineStyles.phpnu„[µü¤cssConverter = new CssSelectorConverter(); } /** * Will inline the $css into the given $html * * Remark: if the html contains |isU', $htmlNoComments, $matches); if (!empty($matches[1])) { foreach ($matches[1] as $match) { $css .= trim($match) . "\n"; } } return $css; } /** * @param string $css * * @return string */ private function doCleanup($css) { // remove charset $css = preg_replace('/@charset "[^"]++";/', '', $css) ?? $css; // remove media queries $css = preg_replace('/@media [^{]*+{([^{}]++|{[^{}]*+})*+}/', '', $css) ?? $css; $css = str_replace(array("\r", "\n"), '', $css); $css = str_replace(array("\t"), ' ', $css); $css = str_replace('"', '\'', $css); $css = preg_replace('|/\*.*?\*/|', '', $css) ?? $css; $css = preg_replace('/\s\s++/', ' ', $css) ?? $css; $css = trim($css); return $css; } } PK†CW]!­¼¾>>src/Css/Property/Property.phpnu„[µü¤name = $name; $this->value = $value; $this->originalSpecificity = $specificity; } /** * Get name * * @return string */ public function getName() { return $this->name; } /** * Get value * * @return string */ public function getValue() { return $this->value; } /** * Get originalSpecificity * * @return Specificity|null */ public function getOriginalSpecificity() { return $this->originalSpecificity; } /** * Is this property important? * * @return bool */ public function isImportant() { return (stripos($this->value, '!important') !== false); } /** * Get the textual representation of the property * * @return string */ public function toString() { return sprintf( '%1$s: %2$s;', $this->name, $this->value ); } } PK†CW]�¨•— — src/Css/Property/Processor.phpnu„[µü¤cleanup($propertiesString); $properties = (array) explode(';', $propertiesString); $keysToRemove = array(); $numberOfProperties = count($properties); for ($i = 0; $i < $numberOfProperties; $i++) { $properties[$i] = trim($properties[$i]); // if the new property begins with base64 it is part of the current property if (isset($properties[$i + 1]) && strpos(trim($properties[$i + 1]), 'base64,') === 0) { $properties[$i] .= ';' . trim($properties[$i + 1]); $keysToRemove[] = $i + 1; } } if (!empty($keysToRemove)) { foreach ($keysToRemove as $key) { unset($properties[$key]); } } return array_values($properties); } /** * @param string $string * * @return string */ private function cleanup($string) { $string = str_replace(array("\r", "\n"), '', $string); $string = str_replace(array("\t"), ' ', $string); $string = str_replace('"', '\'', $string); $string = preg_replace('|/\*.*?\*/|', '', $string) ?? $string; $string = preg_replace('/\s\s+/', ' ', $string) ?? $string; $string = trim($string); $string = rtrim($string, ';'); return $string; } /** * Converts a property-string into an object * * @param string $property * * @return Property|null */ public function convertToObject($property, ?Specificity $specificity = null) { if (strpos($property, ':') === false) { return null; } list($name, $value) = explode(':', $property, 2); $name = trim($name); $value = trim($value); if ($value === '') { return null; } return new Property($name, $value, $specificity); } /** * Converts an array of property-strings into objects * * @param string[] $properties * * @return Property[] */ public function convertArrayToObjects(array $properties, ?Specificity $specificity = null) { $objects = array(); foreach ($properties as $property) { $object = $this->convertToObject($property, $specificity); if ($object === null) { continue; } $objects[] = $object; } return $objects; } /** * Build the property-string for multiple properties * * @param Property[] $properties * * @return string */ public function buildPropertiesString(array $properties) { $chunks = array(); foreach ($properties as $property) { $chunks[] = $property->toString(); } return implode(' ', $chunks); } } PK†CW]Ûíç0ÉÉsrc/Css/Rule/Rule.phpnu„[µü¤selector = $selector; $this->properties = $properties; $this->specificity = $specificity; $this->order = $order; } /** * Get selector * * @return string */ public function getSelector() { return $this->selector; } /** * Get properties * * @return Property[] */ public function getProperties() { return $this->properties; } /** * Get specificity * * @return Specificity */ public function getSpecificity() { return $this->specificity; } /** * Get order * * @return int */ public function getOrder() { return $this->order; } } PK†CW]@QÃŽŽsrc/Css/Rule/Processor.phpnu„[µü¤cleanup($rulesString); return (array) explode('}', $rulesString); } /** * @param string $string * * @return string */ private function cleanup($string) { $string = str_replace(array("\r", "\n"), '', $string); $string = str_replace(array("\t"), ' ', $string); $string = str_replace('"', '\'', $string); $string = preg_replace('|/\*.*?\*/|', '', $string) ?? $string; $string = preg_replace('/\s\s+/', ' ', $string) ?? $string; $string = trim($string); $string = rtrim($string, '}'); return $string; } /** * Converts a rule-string into an object * * @param string $rule * @param int $originalOrder * * @return Rule[] */ public function convertToObjects($rule, $originalOrder) { $rule = $this->cleanup($rule); $chunks = explode('{', $rule); if (!isset($chunks[1])) { return array(); } $propertiesProcessor = new PropertyProcessor(); $rules = array(); $selectors = (array) explode(',', trim($chunks[0])); $properties = $propertiesProcessor->splitIntoSeparateProperties($chunks[1]); foreach ($selectors as $selector) { $selector = trim($selector); $specificity = $this->calculateSpecificityBasedOnASelector($selector); $rules[] = new Rule( $selector, $propertiesProcessor->convertArrayToObjects($properties, $specificity), $specificity, $originalOrder ); } return $rules; } /** * Calculates the specificity based on a CSS Selector string, * Based on the patterns from premailer/css_parser by Alex Dunae * * @see https://github.com/premailer/css_parser/blob/master/lib/css_parser/regexps.rb * * @param string $selector * * @return Specificity */ public function calculateSpecificityBasedOnASelector($selector) { $idSelectorCount = preg_match_all("/ \#/ix", $selector, $matches); $classAttributesPseudoClassesSelectorsPattern = " (\.[\w]+) # classes | \[(\w+) # attributes | (\:( # pseudo classes link|visited|active |hover|focus |lang |target |enabled|disabled|checked|indeterminate |root |nth-child|nth-last-child|nth-of-type|nth-last-of-type |first-child|last-child|first-of-type|last-of-type |only-child|only-of-type |empty|contains ))"; $classAttributesPseudoClassesSelectorCount = preg_match_all("/{$classAttributesPseudoClassesSelectorsPattern}/ix", $selector, $matches); $typePseudoElementsSelectorPattern = " ((^|[\s\+\>\~]+)[\w]+ # elements | \:{1,2}( # pseudo-elements after|before |first-letter|first-line |selection ) )"; $typePseudoElementsSelectorCount = preg_match_all("/{$typePseudoElementsSelectorPattern}/ix", $selector, $matches); if ($idSelectorCount === false || $classAttributesPseudoClassesSelectorCount === false || $typePseudoElementsSelectorCount === false) { throw new \RuntimeException('Failed to calculate specificity based on selector.'); } return new Specificity( $idSelectorCount, $classAttributesPseudoClassesSelectorCount, $typePseudoElementsSelectorCount ); } /** * @param string[] $rules * @param Rule[] $objects * * @return Rule[] */ public function convertArrayToObjects(array $rules, array $objects = array()) { $order = 1; foreach ($rules as $rule) { $objects = array_merge($objects, $this->convertToObjects($rule, $order)); $order++; } return $objects; } /** * Sorts an array on the specificity element in an ascending way * Lower specificity will be sorted to the beginning of the array * * @param Rule $e1 The first element. * @param Rule $e2 The second element. * * @return int */ public static function sortOnSpecificity(Rule $e1, Rule $e2) { $e1Specificity = $e1->getSpecificity(); $value = $e1Specificity->compareTo($e2->getSpecificity()); // if the specificity is the same, use the order in which the element appeared if ($value === 0) { $value = $e1->getOrder() - $e2->getOrder(); } return $value; } } PK†CW]Ê”�ú composer.jsonnu„[µü¤{ "name": "tijsverkoyen/css-to-inline-styles", "type": "library", "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", "license": "BSD-3-Clause", "authors": [ { "name": "Tijs Verkoyen", "email": "css_to_inline_styles@verkoyen.eu", "role": "Developer" } ], "require": { "php": "^7.4 || ^8.0", "ext-dom": "*", "ext-libxml": "*", "symfony/css-selector": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { "phpunit/phpunit": "^8.5.21 || ^9.5.10", "phpstan/phpstan": "^2.0", "phpstan/phpstan-phpunit": "^2.0" }, "autoload": { "psr-4": { "TijsVerkoyen\\CssToInlineStyles\\": "src" } }, "autoload-dev": { "psr-4": { "TijsVerkoyen\\CssToInlineStyles\\Tests\\": "tests" } }, "extra": { "branch-alias": { "dev-master": "2.x-dev" } } } PK†CW]ºIë³ÓÓ LICENSE.mdnu„[µü¤Copyright (c) Tijs Verkoyen. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. 3. Neither the name of the copyright holder 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 HOLDER 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. PK†CW]â^p””src/CssToInlineStyles.phpnu„[µü¤PK†CW] æxxÝsrc/Css/Processor.phpnu„[µü¤PK†CW]!­¼¾>>š&src/Css/Property/Property.phpnu„[µü¤PK†CW]�¨•— — %-src/Css/Property/Processor.phpnu„[µü¤PK†CW]Ûíç0ÉÉ :src/Css/Rule/Rule.phpnu„[µü¤PK†CW]@QÃŽŽ@src/Css/Rule/Processor.phpnu„[µü¤PK†CW]Ê”�ú ðUcomposer.jsonnu„[µü¤PK†CW]ºIë³ÓÓ >ZLICENSE.mdnu„[µü¤PK¯K`