sm:item:cacheControl

sm:item:cacheControl

Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wp-stateless.3.4.1

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', 'public, max-age=36000, must-revalidate', $_metadata),
              'contentDisposition' => null,
              'mimeType' => $mimeType['type'],
              'metadata' => $_metadata
            ))));
    
            return $file;
    
  • /lib/classes/class-sync-non-media.php line 144
                 */
                try {
                  $media = $object->update(array('metadata' => $args['metadata']) +
                    array(
                      'cacheControl' => apply_filters('sm:item:cacheControl', 'public, max-age=36000, must-revalidate', $absolutePath),
                      'predefinedAcl' => 'publicRead',
                      'contentDisposition' => apply_filters('sm:item:contentDisposition', null, $absolutePath)
                    ));
                } catch (\Throwable $th) {
                  //throw $th;
                }
    
  • /lib/classes/class-sync-non-media.php line 157
                  'use_root' => $args['use_root'],
                  'name' => $name,
                  'force' => ($forced == 2),
                  'absolutePath' => $absolutePath,
                  'cacheControl' => apply_filters('sm:item:cacheControl', 'public, max-age=36000, must-revalidate', $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),
                  ),
    
  • /lib/classes/class-utility.php line 137
           * @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 144
            $_mime_type = get_post_mime_type($attachment_id);
    
            // Treat images as public.
            if (strpos($_mime_type, 'image/') !== false) {
              return apply_filters('sm:item:cacheControl', 'public, max-age=36000, must-revalidate', 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 149
            }
    
            // 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 152
            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: