sm:item:cacheControl

sm:item:cacheControl

Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wp-stateless.4.1.2

apply_filters('sm:item:cacheControl') is found 8 times:

  • /lib/classes/class-dynamic-image-support.php line 78
     
            $client->add_media(apply_filters('sm:item:on_fly:before_add', array_filter(array(
              'name' => $file_path,
              'absolutePath' => wp_normalize_path($file),
              'cacheControl' => apply_filters('sm:item:cacheControl', ud_get_stateless_media()->get_default_cache_control(), $_metadata),
              'contentDisposition' => null,
              'mimeType' => $mimeType['type'],
              'metadata' => $_metadata
            ))));
    
            return $file;
    
  • /lib/classes/class-sync-non-media.php line 158
                 * @return media object
                 */
                try {
                  $mediaOptions = array(
                    'cacheControl' => apply_filters('sm:item:cacheControl', ud_get_stateless_media()->get_default_cache_control(), $absolutePath),
                    'contentDisposition' => apply_filters('sm:item:contentDisposition', null, $absolutePath)
                  );
    
                  if ( !defined('WP_STATELESS_SKIP_ACL_SET') || !WP_STATELESS_SKIP_ACL_SET) {
                    $mediaOptions['predefinedAcl'] = 'publicRead';
                  }
    
  • /lib/classes/class-sync-non-media.php line 176
                  'use_root' => $args['use_root'],
                  'name' => $name,
                  'force' => ($forced == 2),
                  'absolutePath' => $absolutePath,
                  'cacheControl' => apply_filters('sm:item:cacheControl', ud_get_stateless_media()->get_default_cache_control(), $absolutePath), //@todo use cacheControl from settings page.
                  'contentDisposition' => apply_filters('sm:item:contentDisposition', null, $absolutePath),
                  'mimeType' => $file_type,
                  'metadata' => array(
                    'child-of' => dirname($name),
                    'file-hash' => md5($name),
                    'source' => $args['source'] ?? '',
    
  • /lib/classes/class-utility.php line 128
           * @return string
           */
          public static function getCacheControl($attachment_id = null, $metadata = array(), $data = array()) {
            if (!$attachment_id) {
              return apply_filters('sm:item:cacheControl', 'private, no-cache, no-store', $attachment_id, array('attachment_id' => null, 'mime_type' => null, 'metadata' => $metadata, 'data' => $data));
            }
    
            $_mime_type = get_post_mime_type($attachment_id);
    
            // Treat images as public.
            if (strpos($_mime_type, 'image/') !== false) {
    
  • /lib/classes/class-utility.php line 135
            $_mime_type = get_post_mime_type($attachment_id);
    
            // Treat images as public.
            if (strpos($_mime_type, 'image/') !== false) {
              return apply_filters('sm:item:cacheControl', ud_get_stateless_media()->get_default_cache_control(), array('attachment_id' => $attachment_id, 'mime_type' => null, 'metadata' => $metadata, 'data' => $data));
            }
    
            // Treat images as public.
            if (strpos($_mime_type, 'sql') !== false) {
              return apply_filters('sm:item:cacheControl', 'private, no-cache, no-store', array('attachment_id' => $attachment_id, 'mime_type' => null, 'metadata' => $metadata, 'data' => $data));
            }
    
  • /lib/classes/class-utility.php line 140
            }
    
            // Treat images as public.
            if (strpos($_mime_type, 'sql') !== false) {
              return apply_filters('sm:item:cacheControl', 'private, no-cache, no-store', array('attachment_id' => $attachment_id, 'mime_type' => null, 'metadata' => $metadata, 'data' => $data));
            }
    
            return apply_filters('sm:item:cacheControl', 'public, max-age=30, no-store, must-revalidate', array('attachment_id' => $attachment_id, 'mime_type' => null, 'metadata' => $metadata, 'data' => $data));
          }
    
          /**
    
  • /lib/classes/class-utility.php line 143
            if (strpos($_mime_type, 'sql') !== false) {
              return apply_filters('sm:item:cacheControl', 'private, no-cache, no-store', array('attachment_id' => $attachment_id, 'mime_type' => null, 'metadata' => $metadata, 'data' => $data));
            }
    
            return apply_filters('sm:item:cacheControl', 'public, max-age=30, no-store, must-revalidate', array('attachment_id' => $attachment_id, 'mime_type' => null, 'metadata' => $metadata, 'data' => $data));
          }
    
          /**
           * Add/Update Media to Bucket
           * Fired for every action with image add or update
           *
    
  • /lib/classes/compatibility/woo-extra-product-options.php line 71
            $media = $client->add_media(apply_filters('sm:item:on_fly:before_add', array(
              'use_root' => false,
              'name' => $file_path,
              'absolutePath' => wp_normalize_path($file),
              'cacheControl' => apply_filters('sm:item:cacheControl', 'public, max-age=36000, must-revalidate', $_metadata),
              'contentDisposition' => null,
              'mimeType' => $type,
              'metadata' => $_metadata
            )));
    
            $upload['url'] = ud_get_stateless_media()->get_gs_host() . '/' . $file_path;
    

See this hook used in plugins: