File "RegexTrait.php"
Full path: /home/kosmetik/public_html/wp-content/plugins/wp-rocket/inc/Engine/Optimization/RegexTrait.php
File
size: 559 B
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php
declare(strict_types=1);
namespace WP_Rocket\Engine\Optimization;
trait RegexTrait {
/**
* Finds nodes matching the pattern in the HTML.
*
* @param string $pattern Pattern to match.
* @param string $html HTML content.
* @param string $modifiers Regex modifiers.
*
* @return array
*/
protected function find( string $pattern, string $html, string $modifiers = 'Umsi' ) {
preg_match_all( '/' . $pattern . '/' . $modifiers, $html, $matches, PREG_SET_ORDER );
if ( empty( $matches ) ) {
return [];
}
return $matches;
}
}