| Current Path : /home/digilove/public_html/plugins/content/aimyindexnow/helpers/ |
| Current File : /home/digilove/public_html/plugins/content/aimyindexnow/helpers/ExcludePatternHelper.php |
<?php
/*
* Copyright (c) 2022-2024 Aimy Extensions, Netzum Sorglos Software GmbH
*
* https://www.aimy-extensions.com/
*
* License: GNU GPLv2, see LICENSE.txt within distribution and/or
* https://www.aimy-extensions.com/software-license.html
*/
namespace Aimy\IndexNow\Helpers; defined( '_JEXEC' ) or die(); abstract class ExcludePatternHelper { static public function matches( $patterns, $url ) { foreach ( $patterns as $pattern ) { $pattern = trim( $pattern ); if ( self::match( $pattern, $url ) ) { return $pattern; } } return false; } static private function match( $pat, $s ) { $pps = explode( '*', $pat ); foreach ( $pps as $i => $p ) { $pps[ $i ] = preg_quote( $p, '/' ); } $re = '/^' . implode( '.*?', $pps ) . '$/'; return ( preg_match( $re, $s ) === 1 ); } }