Plugin Directory

Changeset 2148127


Ignore:
Timestamp:
08/30/2019 12:26:35 AM (7 years ago)
Author:
2plus2is4
Message:
  • Instagram Blocker Integrated [premium]
  • TED Blocker Integrated [premium]
  • Stability enhanced
  • Size of plugin reduced
  • HTML code passed via <template>
  • embed_oembed_html filer used
Location:
simple-youtube-gdpr
Files:
218 added
1 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • simple-youtube-gdpr/trunk/README.txt

    r2144933 r2148127  
    22Contributors: 2plus2is4
    33Donate link: https://money.yandex.ru/to/41001417963743
    4 Tags: iframe, YouTube, GDPR, Vimeo, Flickr, Issuu, thumbnails, Consent, Compliance
     4Tags: iframe, YouTube, GDPR, Vimeo, Flickr, Issuu, Instagram, TED, thumbnails, Consent, Compliance
    55Requires at least: 5.0.1
    66Tested up to: 5.2.2
    7 Stable tag: 0.8
     7Stable tag: 1.0
    88Requires PHP: 5.2.4
    99License: GPLv2 or later
     
    2424*   Google gets NO cookies
    2525*   No content changes required
    26 *   Allows you to keep YouTube, Vimeo [premium] and more elements under GDPR law
     26*   Allows you to keep YouTube videos under GDPR law
    2727
    2828== Want more? ==
    29 If you enjoy blocking YouTube videos and you want your other content (Vimeo, Flickr, Issuu) to be safe, consider purchasing the [premium version](https://checkout.freemius.com/mode/dialog/plugin/4426/plan/7118/).
     29If you enjoy blocking YouTube videos and you want your other content (Vimeo, Flickr, Issuu and more) to be safe, consider purchasing the [premium version](https://checkout.freemius.com/mode/dialog/plugin/4426/plan/7118/).
    3030
    3131= Premium features =
     
    3434* Integrate Issuu content securely!
    3535* Integrate Flickr photos securely!
     36* Integrate Instagram securely!
     37* Integrate TED securely!
    3638
    3739== Installation ==
     
    4648= Does 'Local' mean my server downloads all the images? =
    4749
    48 Yes. Usually you can find a folder `/wp-content/uploads/simple-youtube-gdpr-thumbnails` with all the images inside
     50Yes. Usually you can find a folder `/wp-content/uploads/simple-youtube-gdpr-thumbnails` with all the images inside.
    4951
    50 = Does youtube send cookies? =
     52= What about no cookie youtube? =
    5153
    52 No. Plugin replaces the source of iframe with youtube-nocookie.com
     54Please replace `youtube.com` with `youtube-nocookie.com` when inserting a youtube link.
    5355
    5456= Why there are black line above and below? =
     
    6365
    6466Yes. Class:
    65 * `syg__box` - main wrapping `<div>` (`syg__box-%SERVICE%` where `%SERVICE%` can be youtube, vimeo, issuu, flickr)
     67* `syg__box` - main wrapping `<div>` (`syg__box-%SERVICE%` where `%SERVICE%` can be youtube, vimeo, issuu, ...)
    6668* `syg__box__img` - the thumbnail
    6769* `syg__box__text__btn` - thumbnail play button
    68 * `syg__box-youtube-iframe` - video `<iframe>` (where `%SERVICE%` can be youtube, vimeo, issuu)
     70* `syg__box__text` - Privacy Policy text
    6971
    70 = What are standard width and height of iframe? =
     72= What are sizes of preview image? =
    7173
    72 560 x 315
     74It is trying to reach 100% of your content. (imitates WP iframe styles)
    7375
    7476= How does this plugin work? =
     
    8789== Changelog ==
    8890
     91= 1.0 =
     92* HTML code passed via <template>
     93* `embed_oembed_html` filer used
     94
    8995= 0.8 =
    90 
     96* Issuu Blocker Integrated
     97* Flickr Blocker Integrated
    9198* CSS classes changed
    9299
    93100= 0.7 =
    94 
     101* Plans are added (Vimeo)
    95102* CSS classes were changed
    96103
     
    101108
    102109== Upgrade Notice ==
     110
     111= 1.0 =
     112* Instagram Blocker Integrated [premium]
     113* TED Blocker Integrated [premium]
     114* Stability enhanced
     115* Size of plugin reduced
    103116
    104117= 0.8 =
  • simple-youtube-gdpr/trunk/includes/class-simple-youtube-gdpr.php

    r2143715 r2148127  
    123123        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-simple-youtube-gdpr-public.php';
    124124
    125         /**
    126          * The file responsible for DOM search.
    127          */
    128         require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/simple_html_dom.php';
    129 
    130125        $this->loader = new Simple_Youtube_Gdpr_Loader();
    131126
     
    179174        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
    180175
    181         $this->loader->add_action( 'the_content', $plugin_public, 'filter_content' );
    182     }
     176        $this->loader->add_filter( 'embed_oembed_html', $plugin_public, 'syg_embed_oembed_html', PHP_INT_MAX, 4 );
     177    }
     178
    183179
    184180    /**
     
    195191     * WordPress and to define internationalization functionality.
    196192     *
     193     * @return    string    The name of the plugin.
    197194     * @since     0.6
    198      * @return    string    The name of the plugin.
    199195     */
    200196    public function get_plugin_name() {
     
    205201     * The reference to the class that orchestrates the hooks with the plugin.
    206202     *
     203     * @return    Simple_Youtube_Gdpr_Loader    Orchestrates the hooks of the plugin.
    207204     * @since     0.6
    208      * @return    Simple_Youtube_Gdpr_Loader    Orchestrates the hooks of the plugin.
    209205     */
    210206    public function get_loader() {
     
    215211     * Retrieve the version number of the plugin.
    216212     *
     213     * @return    string    The version number of the plugin.
    217214     * @since     0.6
    218      * @return    string    The version number of the plugin.
    219215     */
    220216    public function get_version() {
  • simple-youtube-gdpr/trunk/languages/simple-youtube-gdpr-de_DE.po

    r2144933 r2148127  
    22msgstr ""
    33"Project-Id-Version: Simple YouTube GDPR\n"
    4 "POT-Creation-Date: 2019-08-24 21:35+0300\n"
    5 "PO-Revision-Date: 2019-08-24 21:37+0300\n"
     4"POT-Creation-Date: 2019-08-30 03:11+0300\n"
     5"PO-Revision-Date: 2019-08-30 03:13+0300\n"
    66"Last-Translator: \n"
    77"Language-Team: \n"
     
    1717"X-Poedit-SourceCharset: UTF-8\n"
    1818"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
    19 "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;"
    20 "_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
     19"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
     20"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
    2121"X-Poedit-SearchPath-0: .\n"
    2222"X-Poedit-SearchPathExcluded-0: *.js\n"
    2323
    24 #: public/class-simple-youtube-gdpr-public.php:284
    25 msgid "Click to Play Video"
    26 msgstr "Anklicken um abzuspielen"
    27 
    28 #: public/class-simple-youtube-gdpr-public.php:285
    29 msgid "YouTube Video Thumbnail"
    30 msgstr "YouTube Video Miniaturansicht"
    31 
    32 #: public/class-simple-youtube-gdpr-public.php:288
    33 msgid "By loading the video, you agree to YouTube's privacy policy."
    34 msgstr ""
    35 "Durch das Laden des Videos stimmst du den Datenschutzbestimmungen von "
    36 "YouTube zu."
    37 
    38 #: public/class-simple-youtube-gdpr-public.php:290
    39 #, fuzzy
    40 #| msgid "https://policies.google.com/privacy?hl=en&amp;gl=en"
     24#: public/class-simple-youtube-gdpr-public.php:206
     25#: public/class-simple-youtube-gdpr-public.php:215
    4126msgid "https://policies.google.com/privacy?hl=en"
    4227msgstr "https://policies.google.com/privacy?hl=de"
    4328
    44 #: public/class-simple-youtube-gdpr-public.php:291
    45 #: public/class-simple-youtube-gdpr-public.php:319
    46 #: public/class-simple-youtube-gdpr-public.php:371
    47 msgid "Read policy"
    48 msgstr "Richtlinie lesen"
    49 
    50 #: public/class-simple-youtube-gdpr-public.php:294
    51 #: public/class-simple-youtube-gdpr-public.php:322
    52 msgid "Play video"
    53 msgstr "Video abspielen"
    54 
    55 #: public/class-simple-youtube-gdpr-public.php:316
    56 msgid "By loading the video, you agree to Vimeo's privacy policy."
    57 msgstr ""
    58 "Durch das Laden des Videos stimmen Sie den Datenschutzbestimmungen von "
    59 "Vimeo zu."
    60 
    61 #: public/class-simple-youtube-gdpr-public.php:318
     29#: public/class-simple-youtube-gdpr-public.php:217
    6230msgid "https://vimeo.com/privacy"
    6331msgstr "https://vimeo.com/privacy"
    6432
    65 #: public/class-simple-youtube-gdpr-public.php:368
    66 msgid "By loading the issuu element, you agree to its privacy policy."
     33#: public/class-simple-youtube-gdpr-public.php:219
     34msgid "https://www.flickr.com/help/privacy"
     35msgstr "https://www.flickr.com/help/privacy"
     36
     37#: public/class-simple-youtube-gdpr-public.php:221
     38msgid "https://issuu.com/legal/privacy"
     39msgstr "https://issuu.com/legal/privacy"
     40
     41#: public/class-simple-youtube-gdpr-public.php:223
     42msgid "https://www.instagram.com/legal/privacy/"
     43msgstr "https://www.instagram.com/legal/privacy/"
     44
     45#: public/class-simple-youtube-gdpr-public.php:225
     46msgid ""
     47"https://www.ted.com/about/our-organization/our-policies-terms/privacy-policy"
    6748msgstr ""
    68 "Durch das Laden des issuu-Elements stimmen Sie dessen "
    69 "Datenschutzbestimmungen zu."
     49"https://www.ted.com/about/our-organization/our-policies-terms/privacy-policy"
    7050
    71 #: public/class-simple-youtube-gdpr-public.php:370
    72 #, fuzzy
    73 #| msgid "https://policies.google.com/privacy?hl=en&amp;gl=en"
    74 msgid "https://issuu.com/legal/privacy"
    75 msgstr "https://policies.google.com/privacy?hl=de"
     51#: public/class-simple-youtube-gdpr-public.php:231
     52msgid "Load element"
     53msgstr "Element anzeigen"
    7654
    77 #: public/class-simple-youtube-gdpr-public.php:374
    78 msgid "Show element"
    79 msgstr "Element anzeigen"
     55#: public/class-simple-youtube-gdpr-public.php:234
     56#, php-format
     57msgid ""
     58"By loading this element, you agree to <a href=\"%s\" target=\"_blank\" rel="
     59"\"nofollow noreferrer noopener\" referrerpolicy=\"no-referrer\" title=\"%s\">"
     60"%s's privacy policy</a>."
     61msgstr ""
     62"Durch das Laden dieses Elements stimmen Sie <a href=\"%s\" target=\"_blank\" "
     63"rel=\"nofollow noreferrer noopener\" referrerpolicy=\"no-referrer\" title="
     64"\"%s\">den Datenschutzbestimmungen von %s zu</a>."
     65
     66#: public/class-simple-youtube-gdpr-public.php:236
     67msgid "Read Privacy Policy"
     68msgstr "Lesen die Datenschutzbestimmungen"
    8069
    8170#: simple-youtube-gdpr.php:101
     
    115104msgstr "https://alexeyvolkov.com/"
    116105
     106#~ msgid "Click to Play Video"
     107#~ msgstr "Anklicken um abzuspielen"
     108
     109#~ msgid "YouTube Video Thumbnail"
     110#~ msgstr "YouTube Video Miniaturansicht"
     111
     112#~ msgid "By loading the video, you agree to YouTube's privacy policy."
     113#~ msgstr ""
     114#~ "Durch das Laden des Videos stimmst du den Datenschutzbestimmungen von "
     115#~ "YouTube zu."
     116
     117#~ msgid "Play video"
     118#~ msgstr "Video abspielen"
     119
     120#~ msgid "By loading the video, you agree to Vimeo's privacy policy."
     121#~ msgstr ""
     122#~ "Durch das Laden des Videos stimmen Sie den Datenschutzbestimmungen von "
     123#~ "Vimeo zu."
     124
     125#~ msgid "By loading the issuu element, you agree to its privacy policy."
     126#~ msgstr ""
     127#~ "Durch das Laden des issuu-Elements stimmen Sie dessen "
     128#~ "Datenschutzbestimmungen zu."
     129
    117130#~ msgid "Learn more"
    118131#~ msgstr "Google-Datenschutzerklärung"
  • simple-youtube-gdpr/trunk/languages/simple-youtube-gdpr-fr_FR.po

    r2144933 r2148127  
    22msgstr ""
    33"Project-Id-Version: Simple YouTube GDPR\n"
    4 "POT-Creation-Date: 2019-08-24 21:32+0300\n"
    5 "PO-Revision-Date: 2019-08-24 21:34+0300\n"
     4"POT-Creation-Date: 2019-08-30 03:13+0300\n"
     5"PO-Revision-Date: 2019-08-30 03:15+0300\n"
    66"Last-Translator: \n"
    77"Language-Team: \n"
     
    1717"X-Poedit-SourceCharset: UTF-8\n"
    1818"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
    19 "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;"
    20 "_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
     19"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
     20"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
    2121"X-Poedit-SearchPath-0: .\n"
    2222"X-Poedit-SearchPathExcluded-0: *.js\n"
    2323
    24 #: public/class-simple-youtube-gdpr-public.php:284
    25 msgid "Click to Play Video"
    26 msgstr "Cliquez pour lire la vidéo"
    27 
    28 #: public/class-simple-youtube-gdpr-public.php:285
    29 msgid "YouTube Video Thumbnail"
    30 msgstr "Vignette de la vidéo YouTube"
    31 
    32 #: public/class-simple-youtube-gdpr-public.php:288
    33 msgid "By loading the video, you agree to YouTube's privacy policy."
    34 msgstr ""
    35 "En chargeant la vidéo, vous acceptez la politique de confidentialité de "
    36 "YouTube."
    37 
    38 #: public/class-simple-youtube-gdpr-public.php:290
     24#: public/class-simple-youtube-gdpr-public.php:206
     25#: public/class-simple-youtube-gdpr-public.php:215
    3926msgid "https://policies.google.com/privacy?hl=en"
    4027msgstr "https://policies.google.com/privacy?hl=fr"
    4128
    42 #: public/class-simple-youtube-gdpr-public.php:291
    43 #: public/class-simple-youtube-gdpr-public.php:319
    44 #: public/class-simple-youtube-gdpr-public.php:371
    45 msgid "Read policy"
    46 msgstr "Lire la politique"
    47 
    48 #: public/class-simple-youtube-gdpr-public.php:294
    49 #: public/class-simple-youtube-gdpr-public.php:322
    50 msgid "Play video"
    51 msgstr "Lire la vidéo"
    52 
    53 #: public/class-simple-youtube-gdpr-public.php:316
    54 msgid "By loading the video, you agree to Vimeo's privacy policy."
    55 msgstr ""
    56 "En chargeant la vidéo, vous acceptez la politique de confidentialité de "
    57 "Vimeo."
    58 
    59 #: public/class-simple-youtube-gdpr-public.php:318
     29#: public/class-simple-youtube-gdpr-public.php:217
    6030msgid "https://vimeo.com/privacy"
    6131msgstr "https://vimeo.com/privacy"
    6232
    63 #: public/class-simple-youtube-gdpr-public.php:368
    64 msgid "By loading the issuu element, you agree to its privacy policy."
    65 msgstr ""
    66 "En chargeant l'élément issuu, vous acceptez sa politique de "
    67 "confidentialité."
     33#: public/class-simple-youtube-gdpr-public.php:219
     34msgid "https://www.flickr.com/help/privacy"
     35msgstr "https://www.flickr.com/help/privacy"
    6836
    69 #: public/class-simple-youtube-gdpr-public.php:370
     37#: public/class-simple-youtube-gdpr-public.php:221
    7038msgid "https://issuu.com/legal/privacy"
    7139msgstr "https://issuu.com/legal/privacy"
    7240
    73 #: public/class-simple-youtube-gdpr-public.php:374
    74 msgid "Show element"
    75 msgstr "Afficher l'élément"
     41#: public/class-simple-youtube-gdpr-public.php:223
     42msgid "https://www.instagram.com/legal/privacy/"
     43msgstr "https://www.instagram.com/legal/privacy/"
     44
     45#: public/class-simple-youtube-gdpr-public.php:225
     46msgid ""
     47"https://www.ted.com/about/our-organization/our-policies-terms/privacy-policy"
     48msgstr ""
     49"https://www.ted.com/about/our-organization/our-policies-terms/privacy-policy"
     50
     51#: public/class-simple-youtube-gdpr-public.php:231
     52msgid "Load element"
     53msgstr "Élément de charge"
     54
     55#: public/class-simple-youtube-gdpr-public.php:234
     56#, php-format
     57msgid ""
     58"By loading this element, you agree to <a href=\"%s\" target=\"_blank\" rel="
     59"\"nofollow noreferrer noopener\" referrerpolicy=\"no-referrer\" title=\"%s\">"
     60"%s's privacy policy</a>."
     61msgstr ""
     62"En chargeant cet élément, vous acceptez <a href=\"%s\" target=\"_blank\" rel="
     63"\"nofollow noreferrer noopener\" referrerpolicy=\"no-referrer\" title=\"%s"
     64"\">la politique de confidentialité de %s</a>."
     65
     66#: public/class-simple-youtube-gdpr-public.php:236
     67msgid "Read Privacy Policy"
     68msgstr "Lire la politique de confidentialité"
    7669
    7770#: simple-youtube-gdpr.php:101
     
    7972msgstr "Cliquez pour mettre à niveau votre plan"
    8073
    81 #: simple-youtube-gdpr.php:101
     74#: simple-youtube-gdpr.php:102
    8275msgid "Block Vimeo and more!"
    8376msgstr "Bloquer Vimeo et plus!"
    8477
    85 #: simple-youtube-gdpr.php:113
     78#: simple-youtube-gdpr.php:114
    8679msgid "Payment in RUB - Russian Rubles"
    8780msgstr "Paiement en roubles russes"
    8881
    89 #: simple-youtube-gdpr.php:113
     82#: simple-youtube-gdpr.php:115
    9083msgid "Donate"
    9184msgstr "Faire un don"
     
    9386#. Plugin Name of the plugin/theme
    9487msgid "Simple YouTube GDPR"
    95 msgstr ""
    96 "WordPress YouTube, Vimeo et plusieurs autres plugin de sécurité (GDPR)"
     88msgstr "WordPress YouTube, Vimeo et plusieurs autres plugin de sécurité (GDPR)"
    9789
    9890#. Plugin URI of the plugin/theme
     
    112104msgstr "https://alexeyvolkov.com/"
    113105
     106#~ msgid "Click to Play Video"
     107#~ msgstr "Cliquez pour lire la vidéo"
     108
     109#~ msgid "YouTube Video Thumbnail"
     110#~ msgstr "Vignette de la vidéo YouTube"
     111
     112#~ msgid "By loading the video, you agree to YouTube's privacy policy."
     113#~ msgstr ""
     114#~ "En chargeant la vidéo, vous acceptez la politique de confidentialité de "
     115#~ "YouTube."
     116
     117#~ msgid "Play video"
     118#~ msgstr "Lire la vidéo"
     119
     120#~ msgid "By loading the video, you agree to Vimeo's privacy policy."
     121#~ msgstr ""
     122#~ "En chargeant la vidéo, vous acceptez la politique de confidentialité de "
     123#~ "Vimeo."
     124
     125#~ msgid "By loading the issuu element, you agree to its privacy policy."
     126#~ msgstr ""
     127#~ "En chargeant l'élément issuu, vous acceptez sa politique de "
     128#~ "confidentialité."
     129
    114130#~ msgid "Learn more"
    115131#~ msgstr "Apprendre encore plus"
  • simple-youtube-gdpr/trunk/languages/simple-youtube-gdpr-ru_RU.po

    r2144933 r2148127  
    22msgstr ""
    33"Project-Id-Version: Simple YouTube GDPR\n"
    4 "POT-Creation-Date: 2019-08-24 21:37+0300\n"
    5 "PO-Revision-Date: 2019-08-24 21:40+0300\n"
     4"POT-Creation-Date: 2019-08-30 03:08+0300\n"
     5"PO-Revision-Date: 2019-08-30 03:10+0300\n"
    66"Last-Translator: \n"
    77"Language-Team: \n"
     
    1818"X-Poedit-SourceCharset: UTF-8\n"
    1919"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
    20 "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;"
    21 "_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
     20"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
     21"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
    2222"X-Poedit-SearchPath-0: .\n"
    2323"X-Poedit-SearchPathExcluded-0: *.js\n"
    2424
    25 #: public/class-simple-youtube-gdpr-public.php:284
    26 msgid "Click to Play Video"
    27 msgstr "Нажмите для запуска видео"
    28 
    29 #: public/class-simple-youtube-gdpr-public.php:285
    30 msgid "YouTube Video Thumbnail"
    31 msgstr "Миниатюра YouTube видео"
    32 
    33 #: public/class-simple-youtube-gdpr-public.php:288
    34 msgid "By loading the video, you agree to YouTube's privacy policy."
    35 msgstr ""
    36 "Загружая видео, вы соглашаетесь с политикой конфиденциальности YouTube."
    37 
    38 #: public/class-simple-youtube-gdpr-public.php:290
    39 #, fuzzy
    40 #| msgid "https://policies.google.com/privacy?hl=en&amp;gl=en"
     25#: public/class-simple-youtube-gdpr-public.php:206
     26#: public/class-simple-youtube-gdpr-public.php:215
    4127msgid "https://policies.google.com/privacy?hl=en"
    4228msgstr "https://policies.google.com/privacy?hl=ru"
    4329
    44 #: public/class-simple-youtube-gdpr-public.php:291
    45 #: public/class-simple-youtube-gdpr-public.php:319
    46 #: public/class-simple-youtube-gdpr-public.php:371
    47 msgid "Read policy"
    48 msgstr "Прочитать политику конфиденциальности"
     30#: public/class-simple-youtube-gdpr-public.php:217
     31msgid "https://vimeo.com/privacy"
     32msgstr "https://vimeo.com/privacy"
    4933
    50 #: public/class-simple-youtube-gdpr-public.php:294
    51 #: public/class-simple-youtube-gdpr-public.php:322
    52 #, fuzzy
    53 #| msgid "Load video"
    54 msgid "Play video"
    55 msgstr "Запустить видео"
     34#: public/class-simple-youtube-gdpr-public.php:219
     35msgid "https://www.flickr.com/help/privacy"
     36msgstr "https://www.flickr.com/help/privacy"
    5637
    57 #: public/class-simple-youtube-gdpr-public.php:316
    58 msgid "By loading the video, you agree to Vimeo's privacy policy."
    59 msgstr ""
    60 "Загружая видео, вы соглашаетесь с политикой конфиденциальности Vimeo."
    61 
    62 #: public/class-simple-youtube-gdpr-public.php:318
    63 #, fuzzy
    64 #| msgid "https://policies.google.com/privacy?hl=en&amp;gl=en"
    65 msgid "https://vimeo.com/privacy"
    66 msgstr "https://policies.google.com/privacy?hl=ru"
    67 
    68 #: public/class-simple-youtube-gdpr-public.php:368
    69 msgid "By loading the issuu element, you agree to its privacy policy."
    70 msgstr ""
    71 "Загружая элемент Issue, вы соглашаетесь с его политикой конфиденциальности."
    72 
    73 #: public/class-simple-youtube-gdpr-public.php:370
     38#: public/class-simple-youtube-gdpr-public.php:221
    7439msgid "https://issuu.com/legal/privacy"
    7540msgstr "https://issuu.com/legal/privacy"
    7641
    77 #: public/class-simple-youtube-gdpr-public.php:374
    78 msgid "Show element"
     42#: public/class-simple-youtube-gdpr-public.php:223
     43msgid "https://www.instagram.com/legal/privacy/"
     44msgstr "https://www.instagram.com/legal/privacy/"
     45
     46#: public/class-simple-youtube-gdpr-public.php:225
     47msgid ""
     48"https://www.ted.com/about/our-organization/our-policies-terms/privacy-policy"
     49msgstr ""
     50"https://www.ted.com/about/our-organization/our-policies-terms/privacy-policy"
     51
     52#: public/class-simple-youtube-gdpr-public.php:231
     53msgid "Load element"
    7954msgstr "Показать элемент"
     55
     56#: public/class-simple-youtube-gdpr-public.php:234
     57#, php-format
     58msgid ""
     59"By loading this element, you agree to <a href=\"%s\" target=\"_blank\" rel="
     60"\"nofollow noreferrer noopener\" referrerpolicy=\"no-referrer\" title=\"%s\">"
     61"%s's privacy policy</a>."
     62msgstr ""
     63"Загружая этот элемент, вы соглашаетесь с <a href=\"%s\" target=\"_blank\" "
     64"rel=\"nofollow noreferrer noopener\" referrerpolicy=\"no-referrer\" title="
     65"\"%s\">политикой конфиденциальности %s</a>."
     66
     67#: public/class-simple-youtube-gdpr-public.php:236
     68msgid "Read Privacy Policy"
     69msgstr "Прочитать политику конфиденциальности"
    8070
    8171#: simple-youtube-gdpr.php:101
     
    115105msgstr "https://alexeyvolkov.com/"
    116106
     107#~ msgid "Click to Play Video"
     108#~ msgstr "Нажмите для запуска видео"
     109
     110#~ msgid "YouTube Video Thumbnail"
     111#~ msgstr "Миниатюра YouTube видео"
     112
     113#~ msgid "By loading the video, you agree to YouTube's privacy policy."
     114#~ msgstr ""
     115#~ "Загружая видео, вы соглашаетесь с политикой конфиденциальности YouTube."
     116
     117#, fuzzy
     118#~| msgid "Load video"
     119#~ msgid "Play video"
     120#~ msgstr "Запустить видео"
     121
     122#~ msgid "By loading the video, you agree to Vimeo's privacy policy."
     123#~ msgstr ""
     124#~ "Загружая видео, вы соглашаетесь с политикой конфиденциальности Vimeo."
     125
     126#~ msgid "By loading the issuu element, you agree to its privacy policy."
     127#~ msgstr ""
     128#~ "Загружая элемент Issue, вы соглашаетесь с его политикой "
     129#~ "конфиденциальности."
     130
    117131#~ msgid "Learn more"
    118132#~ msgstr "Политика конфиденциальности Google"
  • simple-youtube-gdpr/trunk/public/class-simple-youtube-gdpr-public.php

    r2144933 r2148127  
    9898         * class.
    9999         */
    100         wp_enqueue_script(
    101             $this->plugin_name,
    102             plugin_dir_url( __FILE__ ) . 'js/simple-youtube-gdpr-public.js',
    103             array( 'jquery' ),
    104             $this->version,
    105             false
     100        wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/simple-youtube-gdpr-public.js' );
     101    }
     102   
     103    /**
     104     * @param $cache
     105     * @param $url
     106     * @param $attr
     107     * @param $post_ID
     108     *
     109     * @return string
     110     */
     111    public function syg_embed_oembed_html(
     112        $cache,
     113        $url,
     114        $attr,
     115        $post_ID
     116    )
     117    {
     118        $type = 'nothing';
     119        if ( false !== strpos( $url, "youtube.com" ) || false !== strpos( $url, "://youtu.be" ) ) {
     120            $type = 'youtube';
     121        }
     122       
     123        if ( $type == 'nothing' ) {
     124            // nothing found
     125            return $cache;
     126        } else {
     127            return $this->getHtml( $cache, $url, $type );
     128        }
     129   
     130    }
     131   
     132    /**
     133     * Return HTML code of preview block
     134     *
     135     * @param $url (required) The URL to retrieve embedding information for.
     136     * @param string $type (optional) Provider code
     137     *
     138     * @return string
     139     */
     140    private function getHtml( $cache, $url, $type = 'youtube' )
     141    {
     142        // vars
     143        $type = filter_var( $type, FILTER_SANITIZE_STRING );
     144        $url = filter_var( $url, FILTER_SANITIZE_URL );
     145        $cache = str_replace( 'src', 'srcblockloading', $cache );
     146        // dont load scripts! You are <template>!!!!
     147        $api_endpoint = array(
     148            'youtube' => 'http://www.youtube.com/oembed?url=',
    106149        );
    107     }
    108    
    109     /**
    110      * Filter the Content of pages and posts
    111      * LazyLoad youtube videos
    112      *
    113      * @param string $content Original HTML.
    114      *
    115      * @return string $content
    116      */
    117     public function filter_content( $content )
    118     {
    119         $content = $this->lazyloadIframes( $content );
    120         return $content;
    121     }
    122    
    123     /**
    124      * Finds iframes in the HTML provided and call the methods to lazyload them
    125      *
    126      * @param string $html Original HTML.
    127      *
    128      * @return string
    129      */
    130     private function lazyloadIframes( $html, $container = 'figure.wp-block-embed-youtube' )
    131     {
    132         $html = str_get_html( $html );
    133         // get html dom from string
     150        // Download JSON
     151        $json_content = file_get_contents( filter_var( $api_endpoint[$type] . $url, FILTER_SANITIZE_URL ) );
     152        if ( !$json_content ) {
     153            return '';
     154        }
     155        // Decode JSON
     156        $json_content = json_decode( $json_content, true );
     157        /**
     158         * Response parameters
     159         *
     160         * @var $title (optional) A text title, describing the resource.
     161         * @var $provider_name (optional) The url of the resource provider.
     162         * @var $thumbnail_url (optional) A URL to a thumbnail image representing the resource.
     163         * @var $provider_privacy_url (required) A URL to a privacy policy.
     164         */
     165        $title = filter_var( $json_content['title'], FILTER_SANITIZE_STRING );
     166        $provider_name = filter_var( $json_content['provider_name'], FILTER_SANITIZE_STRING );
     167        $thumbnail_url = $this->get_thumbnail_url( filter_var( $json_content['thumbnail_url'], FILTER_SANITIZE_URL ) );
     168        $provider_privacy_url = array(
     169            'youtube' => __( 'https://policies.google.com/privacy?hl=en', 'simple-youtube-gdpr' ),
     170        );
     171        $template = '<div class="syg__box syg__box-' . $type . '" style="background-image: url(\'' . $thumbnail_url . '\');" data-syg-url="' . $api_endpoint[$type] . $url . '">' . '<button class="syg__box__text__btn" type="button" title="' . $title . '">' . esc_html( __( 'Load element', 'simple-youtube-gdpr' ) ) . '</button>' . '<div class="syg__box__text">' . '<p>' . sprintf(
     172            __( 'By loading this element, you agree to <a href="%s" target="_blank" rel="nofollow noreferrer noopener" referrerpolicy="no-referrer" title="%s">%s\'s privacy policy</a>.', 'simple-youtube-gdpr' ),
     173            $provider_privacy_url[$type],
     174            esc_html( __( 'Read Privacy Policy', 'simple-youtube-gdpr' ) ),
     175            $provider_name
     176        ) . '</p>' . '</div > ';
     177        //.syg__box__text
     178        $template .= '<template class="syg__box__html" data-type="' . $type . '">' . $cache . '</template>';
     179        $template .= '</div > ';
     180        // .syg__box
     181        return $template;
     182    }
     183   
     184    /**
     185     * Get URL of local image
     186     *
     187     * @param $url string Image form Web
     188     *
     189     * @return string URL of local Image
     190     */
     191    private function get_thumbnail_url( $url )
     192    {
     193        if ( '' === trim( $url ) ) {
     194            return false;
     195        }
     196        $url = filter_var( $url, FILTER_SANITIZE_URL );
     197        // https://live.stkr.com/3898/1c26_c.jpg?sfsf=sdfsdf -> 1c26_c.jpg
     198        $image_name = md5( $url ) . '.jpg';
     199        // Make it MD5 -> so all (_!@#$%^)(*&) symbols are sanitized and each one is unique
     200        $upload_dir = wp_upload_dir();
     201        // wp_upload_dir()[baseurl] => http://example.com/content/uploads
    134202       
    135         if ( empty($html) ) {
    136             return false;
    137             // there are no elements
    138         }
    139        
    140         /**
    141          * YouTube
    142          */
    143         foreach ( $html->find( $container ) as $figure ) {
    144             // find youtube embed blocks
    145             if ( '' === trim( $figure->innertext ) ) {
    146                 // if empty -> next item
    147                 continue;
     203        if ( !file_exists( $upload_dir['basedir'] . '/simple-youtube-gdpr-thumbnails/' . $image_name ) ) {
     204            $image_data = file_get_contents( $url );
     205            // download image from URL
     206            $upload_dir['path'] = $upload_dir['basedir'] . '/simple-youtube-gdpr-thumbnails/';
     207            // Set upload folder
     208            // Check folder permission and define file location
     209           
     210            if ( wp_mkdir_p( $upload_dir['path'] ) ) {
     211                $file = $upload_dir['path'] . '/' . $image_name;
     212            } else {
     213                $file = $upload_dir['basedir'] . '/' . $image_name;
    148214            }
    149215           
    150             if ( $figure->find( 'iframe' )[0] ) {
    151                 $iframe = $figure->find( 'iframe' )[0];
    152                 if ( '' === trim( $iframe->src ) ) {
    153                     // if empty -> next item
    154                     continue;
    155                 }
    156                 try {
    157                     $imgHTML = $this->getThumbnail( $iframe->outertext );
    158                     // send <iframe> and get <div.syg__box> <img> </div>
    159                     $imgDiv = str_get_html( $imgHTML );
    160                     // from raw HTML to Node Object
    161                     $imgDiv = $imgDiv->find( 'div.syg__box' )[0];
    162                     // Find the only one(first) div.syg__box
    163                 } catch ( Exception $e ) {
    164                     continue;
    165                 }
    166                 //              // Replace <figure> with <img>
    167                
    168                 if ( $figure->find( 'div.wp-block-embed__wrapper' )[0] ) {
    169                     $imgDiv->class .= ' ' . $figure->find( 'div.wp-block-embed__wrapper' )[0]->class;
    170                     $figure->find( 'div.wp-block-embed__wrapper' )[0]->outertext = $imgDiv->outertext;
    171                 }
    172            
     216            // Create the image  file on the server
     217            if ( !file_put_contents( $file, $image_data ) ) {
     218                return false;
    173219            }
     220        }
    174221       
    175         }
    176         // is__premium_only
    177         return $html->outertext;
    178     }
    179    
    180     /**
    181      * Replaces the iframe provided by the Youtube thumbnail
    182      *
    183      * @param array $iframe Array of matched elements.
    184      *
    185      * @return bool|string
    186      */
    187     private function getThumbnail( $contentHTML, $type = 'youtube' )
    188     {
    189         $contentHTML = str_get_html( $contentHTML );
    190        
    191         if ( $contentHTML->find( 'iframe' ) && $contentHTML->find( 'iframe' )[0] ) {
    192             $iframe = $contentHTML->find( 'iframe' )[0];
    193             // Find the only one(first) iframe
    194         }
    195        
    196         $upload_dir = wp_upload_dir();
    197         // wp_upload_dir()[baseurl] => http://example.com/content/uploads
    198         switch ( $type ) {
    199             case 'youtube':
    200                 $youtube_id = esc_html( $this->getIDFromURL( $iframe->src ) );
    201                 // get YouTube ID (fM6JWeQFnNk)
    202                 if ( !$youtube_id ) {
    203                     return false;
    204                 }
    205                 if ( !$this->isThumbnailExists( $youtube_id ) ) {
    206                     $this->save_local_thumbnail( $youtube_id );
    207                 }
    208                 $youtube_lazyload = '<div class="syg__box syg__box-youtube">' . '<img src="' . $upload_dir['baseurl'] . '/simple-youtube-gdpr-thumbnails/' . md5( $youtube_id ) . '.jpg" title="' . esc_html( __( 'Click to Play Video', 'simple-youtube-gdpr' ) ) . '" class="syg__box__img" id="' . $youtube_id . '" alt="' . esc_html( __( 'YouTube Video Thumbnail', 'simple-youtube-gdpr' ) ) . '" decoding="async" referrerpolicy="no-referrer">' . '<div class="syg__box__text">' . '<p> ' . esc_html( __( 'By loading the video, you agree to YouTube\'s privacy policy.', 'simple-youtube-gdpr' ) ) . '<br > ' . '<a href = "' . esc_html( __( 'https://policies.google.com/privacy?hl=en', 'simple-youtube-gdpr' ) ) . '" target="_blank" rel="noopener" > ' . esc_html( __( 'Read policy', 'simple-youtube-gdpr' ) ) . '</a > ' . '</p > ' . '<p ><a class="syg__box__text__btn" role = "button" > ' . esc_html( __( 'Play video', 'simple-youtube-gdpr' ) ) . '</a ></p > ' . '</div > ' . '</div > ';
    209                 // .syg__box
    210                 return $youtube_lazyload;
    211                 break;
    212             case 'vimeo':
    213                 break;
    214             case 'flickr':
    215                 break;
    216             case 'issuu':
    217                 break;
    218         }
    219         return false;
    220     }
    221    
    222     /**
    223      * Gets the Video ID from the URL provided
    224      *
    225      * @param string $url URL to search.
    226      *
    227      * @return bool|string
    228      */
    229     private function getIDFromURL( $url, $type = 'youtube' )
    230     {
    231         switch ( $type ) {
    232             case 'vimeo':
    233                 break;
    234             case 'flickr':
    235                 break;
    236             default:
    237                 $pattern = '#^(?:https?:)?(?://)?(?:www\\.)?(?:youtu\\.be|youtube\\.com|youtube-nocookie\\.com)/(?:embed/|v/|watch/?\\?v=)?([\\w-]{11})#iU';
    238                 break;
    239         }
    240         $result = preg_match( $pattern, $url, $matches );
    241         if ( !$result ) {
    242             return false;
    243         }
    244         switch ( $type ) {
    245             case 'vimeo':
    246                 break;
    247             default:
    248                 // exclude YouTube playlist.
    249                 if ( 'youtube' == $type && 'videoseries' === $matches[1] ) {
    250                     return false;
    251                 }
    252                 return $matches[1];
    253                 break;
    254         }
    255         return '';
    256         // never reach this point
    257     }
    258    
    259     /**
    260      * Checks if youtube video thumbnail already exists
    261      *
    262      * @param int $video_id Video ID.
    263      *
    264      * @return bool
    265      */
    266     private function isThumbnailExists( $content_id, $type = 'video' )
    267     {
    268         $content_id = esc_html( $content_id );
    269         $upload_dir = wp_upload_dir();
    270         switch ( $type ) {
    271             case 'video':
    272                 return file_exists( $upload_dir['basedir'] . '/simple-youtube-gdpr-thumbnails/' . md5( $content_id ) . '.jpg' );
    273                 break;
    274             case 'flickr':
    275                 return file_exists( $upload_dir['basedir'] . '/simple-youtube-gdpr-thumbnails/' . $content_id );
    276                 break;
    277         }
    278     }
    279    
    280     /**
    281      * Loads youtube video thumbnail from img.youtube.com
    282      *
    283      * First it tries to upload a SD quality -> HQ -> Default one
    284      *
    285      * @param int $video_id YouTube ID.
    286      *
    287      * @return void
    288      */
    289     private function save_local_thumbnail( $video_id, $type = 'youtube' )
    290     {
    291         switch ( $type ) {
    292             case 'vimeo':
    293                 break;
    294             case 'flickr':
    295                 break;
    296             default:
    297                 $video_id = esc_html( $video_id );
    298                 $image_url_sddefault = 'https://img.youtube.com/vi/' . $video_id . '/sddefault.jpg';
    299                 $image_url_hqdefault = 'https://img.youtube.com/vi/' . $video_id . '/hqdefault.jpg';
    300                 $image_url_default = 'https://img.youtube.com/vi/' . $video_id . '/default.jpg';
    301                 if ( !($image_data = file_get_contents( $image_url_sddefault )) ) {
    302                     if ( !($image_data = file_get_contents( $image_url_hqdefault )) ) {
    303                         $image_data = file_get_contents( $image_url_default );
    304                     }
    305                 }
    306                 break;
    307         }
    308         $upload_dir = wp_upload_dir();
    309         // wp_upload_dir()[baseurl] => http://example.com/content/uploads
    310         $upload_dir['path'] = $upload_dir['basedir'] . '/simple-youtube-gdpr-thumbnails/';
    311         // Set upload folder
    312         switch ( $type ) {
    313             case 'flickr':
    314                 break;
    315             default:
    316                 $image_name = md5( $video_id ) . '.jpg';
    317                 // Make it MD5 -> so all (_!@#$%^)(*&) symbols are sanitized
    318                 break;
    319         }
    320         $unique_file_name = wp_unique_filename( $upload_dir['path'], $image_name );
    321         // Generate unique name
    322         $filename = basename( $unique_file_name );
    323         // Create image file name.
    324         // Check folder permission and define file location
    325        
    326         if ( wp_mkdir_p( $upload_dir['path'] ) ) {
    327             $file = $upload_dir['path'] . '/' . $filename;
    328         } else {
    329             $file = $upload_dir['basedir'] . '/' . $filename;
    330         }
    331        
    332         // Create the image  file on the server
    333         file_put_contents( $file, $image_data );
     222        return $upload_dir['baseurl'] . '/simple-youtube-gdpr-thumbnails/' . $image_name;
     223        // return local url
    334224    }
    335225
  • simple-youtube-gdpr/trunk/public/css/simple-youtube-gdpr-public.css

    r2144933 r2148127  
     1.syg__box, .syg__box * {
     2    box-sizing: border-box;
     3    margin: 0;
     4    padding: 0;
     5}
     6
    17.syg__box {
    28    display: inline-block;
     
    814    min-height: 12em;
    915    background-color: #eaeaea;
     16
     17    background-size: cover;
     18    background-position: center center;
     19    background-repeat: no-repeat;
     20    background-clip: border-box;
    1021}
    1122
    12 .syg__box::before, .syg__box::after {
    13     display: none;
    14     padding: 0 !important;
    15 }
    16 
    17 .syg__box__img {
    18     display: block;
    19     margin: auto;
    20     max-width: 100%;
    21     border: none;
    22     -webkit-transition: .4s all;
    23     -moz-transition: .4s all;
    24     -o-transition: .4s all;
    25     transition: .4s all
    26 }
    27 
    28 .syg__box:hover .syg__box__img {
    29     -webkit-filter: brightness(75%);
    30     filter: brightness(75%);
    31 }
    32 
    33 .syg__box-flickr:hover .syg__box__img {
    34     -webkit-filter: brightness(100%);
    35     filter: brightness(100%);
     23.syg__box-youtube, .syg__box-vimeo, .syg__box-ted {
     24    position: absolute;
     25    top: 0;
     26    right: 0;
     27    bottom: 0;
     28    left: 0;
     29    width: 100%;
     30    height: 100%;
    3631}
    3732
     
    4136    width: 100%;
    4237    left: 0;
    43     top: 50%;
     38    bottom: 0;
    4439    text-align: center;
    45     -webkit-transform: translateY(-50%);
    46     -ms-transform: translateY(-50%);
    47     transform: translateY(-50%);
    4840
    49     background-color: rgba(0, 0, 0, 0.8);
    50     color: white;
     41    background-color: rgba(255, 255, 255, 0.9);
     42    color: black;
     43    font-size: small;
    5144}
    5245
    5346.syg__box__text p {
    54     margin: 2em 0;
     47    margin: .5em 0;
    5548}
    5649
    5750.syg__box__text__btn {
    58     background: red;
    59     color: #fff;
    60     display: inline-flex;
    61     -webkit-box-align: center;
    62     -ms-flex-align: center;
    63     align-items: center;
    64     -webkit-box-pack: center;
    65     -ms-flex-pack: center;
    66     justify-content: center;
    67     border-radius: .1em;
    68     padding: .5em 1em;
    69     text-decoration: none !important;
    70     -webkit-transition: background-color .125s linear;
    71     -o-transition: background-color .125s linear;
    72     transition: background-color .125s linear;
     51    position: absolute;
     52    left: 50%;
     53    top: 50%;
     54    padding: .8em .5em;
     55    transform: translate(-50%, -50%);
     56
     57    background-color: rgba(255, 0, 0, .8);
     58    color: #ffffff;
     59    font-family: unset;
     60    line-height: 1.1;
     61    letter-spacing: 0.06em;
     62    font-weight: lighter;
     63    font-style: normal;
     64}
     65
     66.syg__box__html {
     67    display: none;
    7368}
    7469
     
    7671/* Premium Code Stripped by Freemius */
    7772
    78 .syg__box__text__btn::before {
    79     background: url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0' y='0' width='78' height='78' viewBox='0, 0, 78, 78'%3E%3Cg id='Layer_1'%3E%3Cg%3E%3Cpath d='M7.5,71.5 L7.5,7.5 L55.5,37.828 L7.5,71.5' fill='%23ffffff'/%3E%3Cpath d='M7.5,71.5 L7.5,7.5 L55.5,37.828 L7.5,71.5' fill-opacity='0' stroke='%23ffffff' stroke-width='12' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") no-repeat center;
    80     background-size: auto;
    81     background-size: contain;
    82     content: " ";
    83     display: inline-block;
    84     margin-right: 4px;
    85     height: 1.1em;
    86     width: .8em;
    87 }
    8873
    8974.syg__box__text__btn:hover {
     
    9580
    9681/* Premium Code Stripped by Freemius */
    97 
    98 .syg__box__text__btn:hover::before {
    99     background: url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0' y='0' width='78' height='78' viewBox='0, 0, 78, 78'%3E%3Cg id='Layer_1'%3E%3Cg%3E%3Cpath d='M7.5,71.5 L7.5,7.5 L55.5,37.828 L7.5,71.5' fill='%23ff0000'/%3E%3Cpath d='M7.5,71.5 L7.5,7.5 L55.5,37.828 L7.5,71.5' fill-opacity='0' stroke='%23ff0000' stroke-width='12' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") no-repeat center;
    100     background-size: contain;
    101     content: " ";
    102 }
    103 
    104 
    105 /* Premium Code Stripped by Freemius */
  • simple-youtube-gdpr/trunk/public/js/simple-youtube-gdpr-public.js

    r2144933 r2148127  
    1 (function ($) {
    2     'use strict';
     1/**
     2 * Loops in all ```.syg__box```
     3 * Assign onClick for each item`s button
     4 */
     5function element_lazyload() {
     6    var elements = document.querySelectorAll(".syg__box");
    37
    4 
    5     $(window).load(function () {
    6         video_lazyload();
    7     });
    8 
    9     /**
    10      * Loops in all ```.syg__box```
    11      * Assign onClick for each item`s button
    12      */
    13     function video_lazyload() {
    14         var videos = document.querySelectorAll(".syg__box");
    15 
    16         // if we don't have videos -> return
    17         if (typeof (videos) === 'undefined' || videos === null || !videos) {
    18             console.warn('No Videos found');
    19             return;
    20         }
    21 
    22         for (var i = 0; i < videos.length; i++) {// loop in all videos boxes
    23             // Get Play Button
    24             var syg__box__text__btn = videos[i].getElementsByClassName('syg__box__text__btn')[0];
    25             // if we don't have videos play button -> return
    26             if (typeof (syg__box__text__btn) === 'undefined' || syg__box__text__btn === null || !syg__box__text__btn) {
    27                 console.warn('No YouTube Play Button found');
    28                 console.debug(videos[i]);
    29                 continue;
    30             }
    31             // Put click events on Play buttons
    32             syg__box__text__btn.addEventListener("click", function () {
    33                 var videoContainer__local = this.parentNode.parentNode.parentNode;
    34                 // Get Text
    35                 var syg__box__text = videoContainer__local.getElementsByClassName('syg__box__text')[0];
    36                 // if we don't have video text -> return
    37                 if (typeof (syg__box__text) === 'undefined' || syg__box__text === null || !syg__box__text) {
    38                     console.warn('No YouTube Text found');
    39                     return;
    40                 }
    41                 // Get Background Image - Preview Thumbnail
    42                 var videoImage = videoContainer__local.getElementsByClassName('syg__box__img')[0];
    43                 // if we don't have video image -> return
    44                 if (typeof (videoImage) != 'undefined' && videoImage != null && videoImage) {
    45                     // Change - Replace
    46                     if (videoContainer__local.classList.contains('syg__box-youtube')) {
    47                         videoContainer__local.classList.remove('syg__box');
    48                         videoContainer__local.replaceChild(getYouTubeIFrame(videoImage), videoImage);
    49                     }
    50                    
    51 /* Premium Code Stripped by Freemius */
    52 
    53                 }
    54                
    55 /* Premium Code Stripped by Freemius */
    56 
    57                 // Remove
    58                 if (videoContainer__local.getElementsByClassName('syg__box__text') && videoContainer__local.getElementsByClassName('syg__box__text')[0] && syg__box__text) {
    59                     videoContainer__local.removeChild(syg__box__text);
    60                 }
    61             });
    62         }// for youtube
     8    // if we don't have elements -> return
     9    if (typeof (elements) === 'undefined' || elements === null || !elements) {
     10        console.warn('No elements found');
     11        return;
    6312    }
    6413
    65     /**
    66      * Creates an iframe element
    67      *
    68      * @param element youtubeImg.
    69      *
    70      * @return element iframe
    71      */
    72     function getYouTubeIFrame(youtubeImg) {
    73         // if we don't have youtube image -> return
    74         if (typeof (youtubeImg) === 'undefined' || youtubeImg === null || !youtubeImg) {
    75             console.warn('No YouTube Image found');
    76             return;
     14    for (var i = 0; i < elements.length; i++) {// loop in all elements boxes
     15        // Get Play Button
     16        var syg__box__text__btn = elements[i].getElementsByClassName('syg__box__text__btn')[0];
     17        // if we don't have elements play button -> return
     18        if (typeof (syg__box__text__btn) === 'undefined' || syg__box__text__btn === null || !syg__box__text__btn) {
     19            console.warn('No Load Element Button found');
     20            continue;
    7721        }
     22        // Put click events on Play buttons
     23        syg__box__text__btn.addEventListener("click", function () {
     24            var syg__box = this.parentNode;
     25            var embed__wrapper = this.parentNode.parentNode;
     26            // Get Text
     27            var syg__box__text = syg__box.getElementsByClassName('syg__box__text')[0];
     28            // if we don't have video text -> return
     29            if (typeof (syg__box__text) === 'undefined' || syg__box__text === null || !syg__box__text) {
     30                console.warn('No Text found');
     31                return;
     32            }
     33            // Find HTML in hidden <template>
     34            var template = syg__box.querySelector('.syg__box__html');
     35            template.innerHTML = template.innerHTML.replace('srcblockloading', 'src');// now load scripts! You WERE <template>!!!!
    7836
    79         var iframe = document.createElement("iframe");
    80         iframe.setAttribute("frameborder", "0");
    81         iframe.setAttribute("allowfullscreen", "");
    82         iframe.setAttribute('allow', 'autoplay; encrypted-media');
    83         // set video source without any cookies
    84         iframe.setAttribute("src", "https://www.youtube-nocookie.com/embed/" + youtubeImg.getAttribute('id') + "?rel=0&showinfo=0&autoplay=1&modestbranding=1");
    85         // set width if an image had it
    86         iframe.setAttribute('width', (youtubeImg.getAttribute('width') > 0) ? (youtubeImg.getAttribute('width')) : '560');
    87         // set height if an image had it
    88         iframe.setAttribute('height', (youtubeImg.getAttribute('height') > 0) ? (youtubeImg.getAttribute('height')) : '315');
    89         iframe.setAttribute('class', 'syg__box-youtube-iframe');
    90         // The Referer header will not be sent.
    91         iframe.setAttribute('referrerpolicy', 'no-referrer');
     37            // Test to see if the browser supports the HTML template element by checking
     38            // for the presence of the template element's content attribute.
     39            if (template.content) {
     40                var clone = document.importNode(template.content, true);
     41                embed__wrapper.appendChild(clone);
     42            } else {
     43                // Find another way to add the rows to the table because
     44                // the HTML template element is not supported.
     45                var cloneDiv = document.createElement('div');
     46                cloneDiv.innerHTML = template.innerHTML.trim();
     47                embed__wrapper.appendChild(cloneDiv);
     48            }
     49            // Get element Type
     50            var type = template.getAttribute('data-type');
    9251
    93         return iframe;
    94     }// getIFrame
    95 
    96    
     52           
    9753/* Premium Code Stripped by Freemius */
    9854
    9955
    100 })(jQuery);
     56            // Remove .syg__box
     57            embed__wrapper.removeChild(syg__box);
     58
     59        });
     60    }// for youtube
     61}
     62
     63/**
     64 * Running code when the document is ready
     65 *
     66 * @author https://plainjs.com/javascript/events/running-code-when-the-document-is-ready-15/
     67 * @param callback
     68 */
     69function ready(callback) {
     70    // in case the document is already rendered
     71    if (document.readyState != 'loading') callback();
     72    // modern browsers
     73    else if (document.addEventListener) document.addEventListener('DOMContentLoaded', callback);
     74    // IE <= 8
     75    else document.attachEvent('onreadystatechange', function () {
     76            if (document.readyState == 'complete') callback();
     77        });
     78}
     79
     80// Running code when the document is ready
     81ready(function () {
     82    // do something
     83    element_lazyload();
     84});
  • simple-youtube-gdpr/trunk/simple-youtube-gdpr.php

    r2144933 r2148127  
    1717 * Plugin URI:        https://alexeyvolkov.com/blog/simple-youtube-gdpr
    1818 * Description:       Integrate YouTube and Vimeo videos securely!
    19  * Version:           0.8
     19 * Version:           1.0
    2020 * Author:            Alexey Volkov
    2121 * Author URI:        https://alexeyvolkov.com/
     
    119119     * Rename this for your plugin and update it as you release new versions.
    120120     */
    121     define( 'SIMPLE_YOUTUBE_GDPR_VERSION', '0.8' );
     121    define( 'SIMPLE_YOUTUBE_GDPR_VERSION', '1.0' );
    122122    /**
    123123     * The code that runs during plugin activation.
Note: See TracChangeset for help on using the changeset viewer.