• Resolved aberbenni

    (@aberbenni)


    My php log is full of:

    [12-Nov-2018 16:58:32 UTC] script not found:<script>
            COOKIES_ENABLER.init({
                scriptClass: 'ginger-script',
                iframeClass: 'ginger-iframe',
                acceptClass: 'ginger-accept',
                disableClass: 'ginger-disable',
                dismissClass: 'ginger-dismiss',
                bannerClass: 'ginger_banner-wrapper',
                bannerHTML:
                    document.getElementById('ginger-banner-html') !== null ?
                        document.getElementById('ginger-banner-html').innerHTML :
                        '<div class="ginger_banner bottom light ginger_container ginger_container--open">'
                                                                + '<a href="#" class="ginger_btn ginger-accept ginger_btn_accept_all">'
                        + 'Accept Cookies'
                        + '<\/a>'
                        + '<p class="ginger_message">'
                        + '... {{privacy_page}}'
                        + '</p>'
                                            + '<\/div>',
                                        cookieDuration: 365000,
                            eventScroll: false,
                scrollOffset: 20,
                clickOutside: false,
                cookieName: 'ginger-cookie',
                forceReload: true,
                iframesPlaceholder: true,
                iframesPlaceholderClass: 'ginger-iframe-placeholder',
                iframesPlaceholderHTML:
                    document.getElementById('ginger-iframePlaceholder-html') !== null ?
                        document.getElementById('ginger-iframePlaceholder-html').innerHTML :
                        '<p>This website uses cookies.'
                        + '<a href="#" class="ginger_btn ginger-accept">Accept Cookies</a>'
                        + '<\/p>'
            });
        </script>

    No alert in Admin dashbord nor Email.

    Output is from file ./wp-content/plugins/w3-total-cache/Minify_Plugin.php

    1489:			error_log( 'script not found:' . $script_tag );
    1491:				Minify_Core::log( 'script not found:' . $script_tag );

    Is there any way to get rid of this message?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter aberbenni

    (@aberbenni)

    The script is in file ./wp-content/plugins/ginger/front/gingerfront.utils.php:

    <?php
    /**
     * File per la gestione ed erigazione di script e style nella head e footer
     */
    
    /*
     * wp_head()
     */
    
    // Registro style di base
    add_action('wp_enqueue_scripts', 'ginger_style_script');
    function ginger_style_script()
    {
        $option_ginger_bar = get_option('ginger_banner');
        if (isset($_COOKIE['ginger-cookie']) && $_COOKIE['ginger-cookie'] == 'N' || $option_ginger_bar['ginger_banner_type'] == 'dialog'):
            wp_register_style('ginger-style-dialog', plugin_dir_url(__FILE__) . 'css/cookies-enabler-dialog.css');
            wp_enqueue_style('ginger-style-dialog');
        else:
            wp_register_style('ginger-style', plugin_dir_url(__FILE__) . 'css/cookies-enabler.css');
            wp_enqueue_style('ginger-style');
        endif;
        wp_enqueue_script('ginger-cookies-enabler', plugin_dir_url(__FILE__) . "js/cookies-enabler.min.js");
    }
    
    //Aggioungo i custom style
    add_action('wp_head', 'ginger_custom_style');
    function ginger_custom_style()
    {
        $option_ginger_general = get_option('ginger_general');
        $option_ginger_bar = get_option('ginger_banner');
        if ($option_ginger_general['enable_ginger'] != 1) return;
        //Recupero style custom
        if ($option_ginger_bar['background_color'] || $option_ginger_bar['text_color'] || $option_ginger_bar['link_color'] || $option_ginger_bar['ginger_css'] || $option_ginger_bar['button_color'] || $option_ginger_bar['button_text_color']): ?>
            <style>
                .ginger_container.<?php echo $option_ginger_bar['theme_ginger']; ?> {
                <?php if($option_ginger_bar['background_color']): ?> background-color: <?php echo $option_ginger_bar['background_color']; ?>;
                <?php endif; ?><?php if($option_ginger_bar['text_color']): ?> color: <?php echo $option_ginger_bar['text_color']; ?>;
                <?php endif; ?>
                }
    
                <?php if($option_ginger_bar['button_color']): ?>
                a.ginger_btn.ginger-accept, a.ginger_btn.ginger-disable, .ginger_btn {
                    background: <?php echo $option_ginger_bar['button_color']; ?> !important;
                }
    
                a.ginger_btn.ginger-accept:hover, a.ginger_btn.ginger-disable:hover, .ginger_btn {
                    background: <?php echo $option_ginger_bar['button_color']; ?> !important;
                }
    
                <?php endif; ?>
                <?php if($option_ginger_bar['button_text_color']): ?>
                a.ginger_btn {
                    color: <?php echo $option_ginger_bar['button_text_color']; ?> !important;
                }
    
                <?php endif; ?>
                <?php if($option_ginger_bar['link_color']): ?>
                .ginger_container.<?php echo $option_ginger_bar['theme_ginger']; ?> a {
                <?php if($option_ginger_bar['link_color']): ?> color: <?php echo $option_ginger_bar['link_color']; ?>;
                <?php endif; ?>
                }
    
                <?php endif;?>
                <?php if($option_ginger_bar['ginger_css']): ?>
                <?php echo $option_ginger_bar['ginger_css']; ?>
                <?php endif;?>
            </style>
        <?php endif;
    }
    
    /*
     * wp_footer()
     */
    
    add_action('wp_footer', 'ginger_script', 100);
    function ginger_script()
    { ?>
        <?php
        //Recupero le informazioni necessarie per stampare il banner
        $option_ginger_general = get_option('ginger_general');
        $option_ginger_policy = get_option('ginger_policy_disable_ginger');
    
        $id_privacy_policy = get_option('ginger_policy');
        $id_current = get_the_id();
    
        if ((isset($option_ginger_general['pagine_escluse'])) && (!empty($option_ginger_general['pagine_escluse']))):
    
            $pagine = array();
    
            foreach ($option_ginger_general['pagine_escluse'] as $array_pagine):
    
                $pagine[] = $array_pagine['select-input'];
                // $pagine=array_push($pagine, $array_pagine['select-input']);
            endforeach;
            if (in_array($id_current, $pagine)):
                return;
            endif;
    
        endif;
        if (isset($option_ginger_general['ginger_logged_users']) && $option_ginger_general['ginger_logged_users'] == '1' && is_user_logged_in()) return;
        $option_ginger_bar = get_option('ginger_banner');
        if ($option_ginger_general['enable_ginger'] != 1) return;
        //Verifoco la tipologia di accettazione dei cookie
        if (isset($option_ginger_general['ginger_scroll']) && $option_ginger_general['ginger_scroll'] == 1):
            $type_scroll = 'true';
        else:
            $type_scroll = 'false';
        endif;
        //Verifico se è abilitato il click sulla pagina
        if (isset($option_ginger_general['ginger_click_out']) && $option_ginger_general['ginger_click_out'] == 1):
            $click_outside = 'true';
        else:
            $click_outside = 'false';
        endif;
        if ($id_current == $id_privacy_policy && $option_ginger_policy == 1):
    
            $click_outside = 'false';
            $type_scroll = 'false';
        endif;
        //Verifico se è abilitato il forceReload
        if (isset($option_ginger_general['ginger_force_reload']) && $option_ginger_general['ginger_force_reload'] == 1):
            $ginger_force_reload = 'true';
        else:
            $ginger_force_reload = 'false';
        endif;
        //Recupero le impostazioni per il banner
        //Testo Banner
        $ginger_text = ginger_get_text_banner($option_ginger_bar);
    
        //Definisco se è bar modal top o bottom
        if ($option_ginger_bar['ginger_banner_position'] == 'top'):
            $banner_class = 'top';
        else:
            $banner_class = 'bottom';
        endif;
        if ($option_ginger_bar['ginger_banner_type'] == 'dialog'):
            $banner_class .= ' dialog';
        endif;
        if ($option_ginger_bar['theme_ginger'] == 'dark'):
            $banner_class .= ' dark';
        else:
            $banner_class .= ' light';
        endif;
        //Recupero Testo Iframe
    
        $ginger_iframe_text = ginger_get_text_iframe($option_ginger_bar);
        $label_accept_cookie = ginger_get_label_accept_cookie($option_ginger_bar);
        $label_disable_cookie = ginger_get_label_disable_cookie($option_ginger_bar);
    
        ?>
    
        <!-- Init the script -->
        <script>
            COOKIES_ENABLER.init({
                scriptClass: 'ginger-script',
                iframeClass: 'ginger-iframe',
                acceptClass: 'ginger-accept',
                disableClass: 'ginger-disable',
                dismissClass: 'ginger-dismiss',
                bannerClass: 'ginger_banner-wrapper',
                bannerHTML:
                    document.getElementById('ginger-banner-html') !== null ?
                        document.getElementById('ginger-banner-html').innerHTML :
                        '<div class="ginger_banner <?php echo $banner_class; ?> ginger_container ginger_container--open">'
                        <?php if($option_ginger_bar['ginger_banner_type'] == 'dialog'): ?>
                        + '<p class="ginger_message">'
                        + '<?php echo $ginger_text; ?>'
                        + '</p>'
                        + '<a href="#" class="ginger_btn ginger-accept ginger_btn_accept_all">'
                        + '<?php echo $label_accept_cookie; ?>'
                        + '<\/a>'
                        <?php if($option_ginger_bar['disable_cookie_button_status'] != 0 && $option_ginger_general['ginger_opt'] != 'out'): ?>
                        + '<a href="#" class="ginger_btn ginger-disable ginger_btn_accept_all">'
                        + '<?php echo $label_disable_cookie; ?>'
                        + '<\/a>'
                        <?php endif; ?>
                        <?php else: ?>
                        <?php if(isset($option_ginger_bar['disable_cookie_button_status']) && $option_ginger_bar['disable_cookie_button_status'] != 0 && $option_ginger_general['ginger_opt'] != 'out'): ?>
                        + '<a href="#" class="ginger_btn ginger-disable ginger_btn_accept_all">'
                        + '<?php echo $label_disable_cookie; ?>'
                        + '<\/a>'
                        <?php endif; ?>
                        + '<a href="#" class="ginger_btn ginger-accept ginger_btn_accept_all">'
                        + '<?php echo $label_accept_cookie; ?>'
                        + '<\/a>'
                        + '<p class="ginger_message">'
                        + '<?php echo $ginger_text; ?>'
                        + '</p>'
                        <?php endif; ?>
                        + '<\/div>',
                <?php if(isset($option_ginger_bar['disable_cookie_button_status']) && $option_ginger_bar['disable_cookie_button_status'] != 0 && $option_ginger_general['ginger_opt'] != 'out' && $option_ginger_general['ginger_keep_banner'] == 1): ?>
                forceEnable: true,
                forceBannerClass: 'ginger-banner bottom dialog force <?php echo $option_ginger_bar['theme_ginger']; ?> ginger_container',
                forceEnableText:
                '<p class="ginger_message">'
                + '<?php echo $ginger_text; ?>'
                + '</p>'
                + '<a href="#" class="ginger_btn ginger-accept ginger_btn_accept_all">'
                + '<?php echo $label_accept_cookie; ?>'
                + '<\/a>',
                <?php endif; ?>
                <?php if($option_ginger_general['ginger_cookie_duration']): ?>
                cookieDuration: <?php echo $option_ginger_general['ginger_cookie_duration']; ?>,
                <?php endif; ?>
                eventScroll: <?php echo $type_scroll; ?>,
                scrollOffset: 20,
                clickOutside: <?php echo $click_outside; ?>,
                cookieName: 'ginger-cookie',
                forceReload: <?php echo $ginger_force_reload; ?>,
                iframesPlaceholder: true,
                iframesPlaceholderClass: 'ginger-iframe-placeholder',
                iframesPlaceholderHTML:
                    document.getElementById('ginger-iframePlaceholder-html') !== null ?
                        document.getElementById('ginger-iframePlaceholder-html').innerHTML :
                        '<p><?php echo $ginger_iframe_text;  ?>'
                        + '<a href="#" class="ginger_btn ginger-accept"><?php echo $label_accept_cookie; ?></a>'
                        + '<\/p>'
            });
        </script>
        <!-- End Ginger Script -->
    
    <?php }
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,
    Are you using some plugin for cookies? It appears that you are also using auto minify.
    Please switch to Manual minify and add js files manually and in order to avoid js breaking.

    Thread Starter aberbenni

    (@aberbenni)

    Yes I’m using Ginger – EU Cookie Law (https://it.www.ads-software.com/plugins/ginger/).

    But js code for cookie banner is inserted via wp_footer hook (https://codex.www.ads-software.com/Plugin_API/Action_Reference/wp_footer) it’s not in a separate .js file.

    I have to say that js is not broken, I can see “unminified” js code ad bottom of html code, the only problem the log full of “script not found” errors.

    How can I get rid of this log message?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @aberbenni,

    You’ve selected inline javascript to be minified, so the minifier finds the script and tries to remove it from the page, minify the contents and add it to the minified file.

    The problem is that something happens between finding the script and removing it from the page, causing the minifier not to find the script to be removed anymore
    Try to turn minify off and check if that specific part can be found on the page twice.

    Thread Starter aberbenni

    (@aberbenni)

    Only once:

    <body>
      <div class="mtm-body-inner">
          <div id="page" itemscope="" itemtype="https://schema.org/WebPage">...</div>
      <!-- END .mtm-body-inner -->
      <script type="text/javascript">
        ...
      </script>
      ...
      <script type="text/javascript" src="/wp-includes/js/wp-embed.min.js?ver=78958d8ebc5214c9d2e7f48365bf17ef"></script>
      <!-- Init the script --><script>
              COOKIES_ENABLER.init({
                  scriptClass: 'ginger-script',
                  iframeClass: 'ginger-iframe',
                  acceptClass: 'ginger-accept',
                  disableClass: 'ginger-disable',
                  dismissClass: 'ginger-dismiss',
                  bannerClass: 'ginger_banner-wrapper',
                  bannerHTML:
                      document.getElementById('ginger-banner-html') !== null ?
                          document.getElementById('ginger-banner-html').innerHTML :
                          '<div class="ginger_banner bottom light ginger_container ginger_container--open">'
                                                                  + '<a href="#" class="ginger_btn ginger-accept ginger_btn_accept_all">'
                          + 'Accept Cookies'
                          + '<\/a>'
                          + '<p class="ginger_message">'
                          + '<!--googleoff: index-->...{{privacy_page}}<!--googleon: index-->'
                          + ''
                                              + '<\/div>',
                                          cookieDuration: 365000,
                              eventScroll: false,
                  scrollOffset: 20,
                  clickOutside: false,
                  cookieName: 'ginger-cookie',
                  forceReload: true,
                  iframesPlaceholder: true,
                  iframesPlaceholderClass: 'ginger-iframe-placeholder',
                  iframesPlaceholderHTML:
                      document.getElementById('ginger-iframePlaceholder-html') !== null ?
                          document.getElementById('ginger-iframePlaceholder-html').innerHTML :
                          '<p><!--googleoff: index-->This website uses cookies.<!--googleon: index-->'
                          + '<a href="#" class="ginger_btn ginger-accept">Accetpt Cookies'
                          + '<\/p>'
              });
          </script><!-- End Ginger Script -->
      </div>
      <div class="ginger_banner-wrapper">
        <div class="ginger_banner bottom light ginger_container ginger_container--open">
          <a href="#" class="ginger_btn ginger-accept ginger_btn_accept_all">Accept Cookies</a>
          <p class="ginger_message"><!--googleoff: index-->... {{privacy_page}}<!--googleon: index--></p>
        </div>
      </div>
    </body>
    Thread Starter aberbenni

    (@aberbenni)

    I think there are some compatibility issues between Ginger – EU Cookie Law and W3TC: https://www.ads-software.com/support/topic/compatibility-issues-with-ginger-eu-cookie-law/

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello
    Those errors will be moved in to debug log in the next release.
    As for the “issues between Ginger – EU Cookie Law and W3TC” Please contact their support

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Log full of “script not found” errors’ is closed to new replies.