File "securi.php"

Full path: /home/kosmetik/public_html/wp-content/plugins/shortpixel-image-optimiser/class/external/securi.php
File size: 757 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php
namespace ShortPixel;
use ShortPixel\ShortPixelLogger\ShortPixelLogger as Log;

if (defined("SHORTPIXEL_EXPERIMENTAL_SECURICACHE"))
{
   $v = new securiVersion();
}

class securiVersion
{
  public function __construct()
  {
    add_filter('shortpixel_image_urls', array($this, 'timestamp_cache'), 10, 2 );
  }

  public function timestamp_cache($urls, $id)
  {

    //$urls = add_filter('shortpixel_image_urls', );
    // https://developer.wordpress.org/reference/functions/get_post_modified_time/
    $time = get_post_modified_time('U', false, $id );
    foreach($urls as $index => $url)
    {
      $urls[$index] = add_query_arg('ver', $time, $url);
    }

    Log::addDebug('SecuriVersion - URLS being versioned', $urls);
    return $urls;
  }


}