• Resolved diablodale

    (@diablodale)


    Hello. Thanks for the plugin. I discovered that your php and js code has a var cli_flush_cache that can be optimized. This will result in less HTML being sent to customers on every page.

    cli_flush_cache is only in two files….

    class-cookie-law-info-public.php lines after 468===========
    You set cli_flush_cache to 1 or 2
    And then always write out this var and its value as HTML script code on every response from the server

    However….

    cookie-law-info-public.js line 539=============
    You test if cli_flush_cache is defined && ==1
    do a function
    else…
    do plain reload

    Therefore you write out this cli_flush_cache=2 javascript in class-cookie-law-info-public.php line 504-506 when cli_flush_cache=2. This is unneeded. Because if you don’t write any js in every page’s HTML, then the cli_flush_cache will be undefined. Therefore your code in cookie-law-info-public.js line 539 will correctly run the else clause

    I could: remove_action(‘wp_head’,array($this,’other_plugin_clear_cache’));
    But a reference to the currently instantiated class is not readily available, so I would need to write/run yet more code just to remove_action

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘feedback: optimize cli_flush_cache js var’ is closed to new replies.