Twitter\WordPress\Shortcodes\PeriscopeOnAir::linkHandler PHP Méthode

linkHandler() public static méthode

Handle a URL matched by an embed handler
Since: 1.3.0
public static linkHandler ( array $matches, array $attr, string $url, array $rawattr ) : string
$matches array The regex matches from the provided regex when calling {@link wp_embed_register_handler()}.
$attr array Embed attributes. Not used.
$url string The original URL that was matched by the regex. Not used.
$rawattr array The original unmodified attributes. Not used.
Résultat string HTML markup for the Periscope On Air button or an empty string if requirements not met
    public static function linkHandler($matches, $attr, $url, $rawattr)
    {
        if (!(is_array($matches) && isset($matches[2]) && $matches[2])) {
            return '';
        }
        return static::shortcodeHandler(array('username' => $matches[2]));
    }