Issues (76)

inc/youtubeNoCookieEmbed.php (1 issue)

Severity
1
<?php
2
3
/**
4
 * Changes oEmbed YouTube URLs from youtube.com to youtube-nocookie.com in favor of GDPR.
5
 */
6
7
namespace Flynt\YoutubeNoCookieEmbed;
8
9
use Flynt\Utils\Oembed;
10
11
add_action('oembed_result', 'Flynt\YoutubeNoCookieEmbed\setNoCookieDomain', 10, 2);
12
add_filter('embed_oembed_html', 'Flynt\YoutubeNoCookieEmbed\setNoCookieDomain', 10, 2);
13
14
function setNoCookieDomain($searchString, $url)
0 ignored issues
show
The parameter $url is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

14
function setNoCookieDomain($searchString, /** @scrutinizer ignore-unused */ $url)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
15
{
16
    if (preg_match('#https?://(www\.)?youtube\.com#i', $searchString)) {
17
        $searchString = preg_replace(
18
            '#(https?:)?//(www\.)?youtube\.com#i',
19
            '$1//$2youtube-nocookie.com',
20
            $searchString
21
        );
22
    }
23
24
    return $searchString;
25
}
26