wp_stateless_bucket_link

wp_stateless_bucket_link

Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wp-stateless.4.1.2

apply_filters('wp_stateless_bucket_link') is found 9 times:

  • /lib/classes/class-bootstrap.php line 1491
            if ($img_url) {
    
              //** we have the actual image size, but might need to further constrain it if content_width is narrower */
              list($width, $height) = image_constrain_size_for_editor($width, $height, $size);
              $img_url = apply_filters('wp_stateless_bucket_link', $img_url);
              return array($img_url, $width, $height, $is_intermediate);
            }
    
    
            /**
             * All other cases work as usually
    
  • /lib/classes/class-bootstrap.php line 1525
              $metadata = [];
            }
    
            if (is_array($metadata) && is_array($sm_cloud) && !empty($sm_cloud['fileLink'])) {
              $metadata['gs_link'] = apply_filters('wp_stateless_bucket_link', $sm_cloud['fileLink']);
              $metadata['gs_name'] = isset($sm_cloud['name']) ? $sm_cloud['name'] : false;
              $metadata['gs_bucket'] = isset($sm_cloud['bucket']) ? $sm_cloud['bucket'] : false;
              if (!empty($metadata['sizes']) && is_array($metadata['sizes'])) {
                foreach ($metadata['sizes'] as $k => $v) {
                  if (!empty($sm_cloud['sizes'][$k]['name'])) {
                    $metadata['sizes'][$k]['gs_name'] = $sm_cloud['sizes'][$k]['name'];
    
  • /lib/classes/class-bootstrap.php line 1532
              if (!empty($metadata['sizes']) && is_array($metadata['sizes'])) {
                foreach ($metadata['sizes'] as $k => $v) {
                  if (!empty($sm_cloud['sizes'][$k]['name'])) {
                    $metadata['sizes'][$k]['gs_name'] = $sm_cloud['sizes'][$k]['name'];
                    $metadata['sizes'][$k]['gs_link'] = apply_filters('wp_stateless_bucket_link', $sm_cloud['sizes'][$k]['fileLink']);
                  }
                }
              }
            }
            if (is_multisite() && !empty($metadata['file'])) {
              if ($this->get('sm.mode') == 'stateless') {
    
  • /lib/classes/class-bootstrap.php line 1802
            $sm_cloud = apply_filters('wp_stateless_get_file', [], $post_id);
            if (is_array($sm_cloud) && !empty($sm_cloud['fileLink'])) {
              $_url = parse_url($sm_cloud['fileLink']);
              $url = !isset($_url['scheme']) ? ('https:' . $sm_cloud['fileLink']) : $sm_cloud['fileLink'];
              $url = apply_filters('wp_stateless_bucket_link', $url);
            } elseif (is_multisite() && empty($sm_cloud)) {
              $_file = get_post_meta($post_id, '_wp_attached_file', true);
              if ($_file) {
                if ($this->get('sm.mode') == 'stateless') {
                  $default_dir = true;
                  $uploads = wp_get_upload_dir();
    
  • /lib/classes/class-db.php line 97
            $this->file_sizes = $this->wpdb->prefix . 'stateless_file_sizes';
            $this->file_meta = $this->wpdb->prefix . 'stateless_file_meta';
    
            $image_host = ud_get_stateless_media()->get_gs_host();
            $this->bucket_link = apply_filters('wp_stateless_bucket_link', $image_host);
    
            if ( is_multisite() ) {
              $this->cache_group = implode('_', [
                $this->cache_group,
                get_current_blog_id(),
              ]);
    
  • /lib/classes/class-utility.php line 203
     
            if ((!is_wp_error($client) || ($sm_mode == 'stateless' && !wp_doing_ajax())) && !$check) {
    
              $image_host          = ud_get_stateless_media()->get_gs_host();
              $bucketLink          = apply_filters('wp_stateless_bucket_link', $image_host);
              $fullsizepath        = wp_normalize_path(get_attached_file($attachment_id));
              $_cacheControl       = self::getCacheControl($attachment_id, $metadata, null);
              $_contentDisposition = self::getContentDisposition($attachment_id, $metadata, null);
    
              // Ensure image upload to GCS when attachment is updated,
              // by checking if the attachment metadata is changed.
    
  • /lib/classes/compatibility/shortpixel.php line 68
     
            wp_enqueue_script('stateless-short-pixel', ud_get_stateless_media()->path('lib/classes/compatibility/js/shortpixel.js', 'url'), array('shortpixel'), '', true);
    
            $image_host = ud_get_stateless_media()->get_gs_host();
            $bucketLink = apply_filters('wp_stateless_bucket_link', $image_host);
    
            wp_localize_script('stateless-short-pixel', '_stateless_short_pixel', array('baseurl' => $upload_dir['baseurl'], 'bucketLink' => $bucketLink,));
          }
    
          /**
           * Return Path of ShortPixel backup path.
    
  • /lib/classes/compatibility/shortpixel.php line 381
              }
    
              $file = wp_normalize_path($metadata['file']);
              $image_host = ud_get_stateless_media()->get_gs_host();
              $bucketLink = apply_filters('wp_stateless_bucket_link', $image_host);
              $_cacheControl = \wpCloud\StatelessMedia\Utility::getCacheControl($attachment_id, $metadata, null);
              $_contentDisposition = \wpCloud\StatelessMedia\Utility::getContentDisposition($attachment_id, $metadata, null);
              $_metadata = array("width" => isset($metadata['width']) ? $metadata['width'] : null, "height" => isset($metadata['height']) ? $metadata['height'] : null, 'object-id' => $attachment_id, 'source-id' => md5($attachment_id . ud_get_stateless_media()->get('sm.bucket')), 'file-hash' => md5($metadata['file']));
    
              if (file_exists($fullsizepath)) {
                $file = apply_filters('wp_stateless_file_name', $file);
    
  • /lib/classes/compatibility/simple-local-avatars.php line 64
            add_filter('get_user_metadata', array($this, 'get_user_metadata'), 10, 4);
    
            // Get GCS link and local upload url
            $image_host = ud_get_stateless_media()->get_gs_host();
            $bucketLink = apply_filters('wp_stateless_bucket_link', $image_host);
            $upload     = wp_get_upload_dir();
    
            // Replace local urls with corresponding GCS urls
            if (!empty($user_meta[0]) && is_array($user_meta[0])) {
              foreach ($user_meta[0] as $key => &$value) {
                if (is_numeric($key)) {
    

See this hook used in plugins: