true ]; $tags['script'] = [ 'id' => true, 'src' => true ]; $tags['link'] = [ 'rel' => true, 'id' => true, 'href' => true, 'media' => true, ]; return $tags; } /** * Ignore src escaping because `wp_kses` strips `data:` from image placeholder source in PHP 8.0+ * * @param array $uriAttributes * * @return array $uriAttributes */ public static function skipSrcEscapeTemporary( $uriAttributes ) { if ( ( $key = array_search( 'src', $uriAttributes ) ) !== false) { unset( $uriAttributes[ $key ] ); } return $uriAttributes; } /** * Modify allowed css attributes * * @param $properties * * @return mixed */ public static function modifyAllowedCssAttributes( $properties ) { $properties = array_merge( $properties, [ 'fill', 'opacity', 'stroke', 'stroke-width', 'stroke-opacity', 'fill-opacity', 'stop-color', 'transform', 'fill-rule', 'clip-rule', 'stroke-linejoin', 'stroke-miterlimit' ]); return $properties; } /** * Check for allowed css values * * @param $allowed * @param $css_test_string * * @return bool */ public static function checkAllowedCssValue( $allowed, $css_test_string ): bool{ $allowedCssValues = [ 'rotate', 'scale', 'evenodd', 'round' ]; foreach( $allowedCssValues as $value ) { if ( ! $allowed && str_contains( $css_test_string, $value ) ) { return true; } } return $allowed; } }