wp_stateless_get_file

wp_stateless_get_file

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_get_file') is found 9 times:

  • /lib/classes/class-bootstrap.php line 731
          public function add_custom_row_actions($actions, $post, $detached) {
    
            if (!current_user_can('upload_files')) return $actions;
    
            $sm_cloud = apply_filters('wp_stateless_get_file', [], $post->ID);
    
    
            $sm_mode = $this->get('sm.mode');
            if (!empty($sm_cloud) && $sm_mode === 'stateless') return $actions;
    
            if ($post && 'attachment' == $post->post_type && 'image/' == substr($post->post_mime_type, 0, 6)) {
    
  • /lib/classes/class-bootstrap.php line 865
           * @return array
           */
          private function _prepare_data_for_metabox($meta_boxes, $post_id) {
            $post     = get_post($post_id);
            $sm_cloud = apply_filters('wp_stateless_get_file', [], $post_id, true);
            $sm_mode  = $this->get('sm.mode');
    
            if (empty($post)) {
              return $meta_boxes;
            }
    
    
  • /lib/classes/class-bootstrap.php line 1394
           * @return mixed
           */
          public function wp_get_attachment_image_attributes($attr, $attachment, $size = null) {
    
            $sm_cloud = apply_filters('wp_stateless_get_file', [], $attachment->ID);
            if (is_array($sm_cloud) && !empty($sm_cloud['name'])) {
              $attr['class'] = $attr['class'] . ' wp-stateless-item';
              $attr['data-image-size'] = is_array($size) ? implode('x', $size) : $size;
              $attr['data-stateless-media-bucket'] = isset($sm_cloud['bucket']) ? $sm_cloud['bucket'] : false;
              $attr['data-stateless-media-name'] = $sm_cloud['name'];
            }
    
  • /lib/classes/class-bootstrap.php line 1464
             * this case may happen when no local files
             * @author korotkov@ud
             */
            if (!$width && !$height) {
              $sm_cloud = apply_filters('wp_stateless_get_file', [], $id, true);
              if (is_string($size) && !empty($sm_cloud['sizes']) && !empty($sm_cloud['sizes'][$size])) {
                global $_wp_additional_image_sizes;
    
                $img_url = !empty($sm_cloud['sizes'][$size]['fileLink']) ? $sm_cloud['sizes'][$size]['fileLink'] : $img_url;
    
                if (!empty($_wp_additional_image_sizes[$size])) {
    
  • /lib/classes/class-bootstrap.php line 1514
          public function wp_get_attachment_metadata($metadata, $attachment_id) {
            global $default_dir;
            $default_dir = false;
            /* Determine if the media file has GS data at all. */
            $sm_cloud = apply_filters('wp_stateless_get_file', [], $attachment_id, true);
            // If metadata not passed the get metadata from post meta.
            if (empty($metadata)) {
              $metadata = get_post_meta($attachment_id, '_wp_attachment_metadata', true);
            }
    
            if (empty($metadata)) {
    
  • /lib/classes/class-bootstrap.php line 1578
           */
          public function get_attached_file($file, $attachment_id) {
            global $default_dir;
    
            $sm_cloud = apply_filters('wp_stateless_get_file', [], $attachment_id);
            $_file = get_post_meta($attachment_id, '_wp_attached_file', true);
    
            /* Determine if the media file has GS data at all. */
            if (is_multisite() && $_file) {
              $blog_id = get_current_blog_id();
              $uploads = wp_get_upload_dir();
    
  • /lib/classes/class-bootstrap.php line 1798
           * @return mixed|null|string
           */
          public function wp_get_attachment_url($url = '', $post_id = '') {
            global $default_dir;
            $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);
    
  • /lib/classes/class-utility.php line 248
                  $metadata["file"] = $file;
                }
              }
    
              $cloud_meta = apply_filters('wp_stateless_get_file', [], $attachment_id, true);
    
              $cloud_meta = wp_parse_args($cloud_meta, array(
                'name'               => '',
                'bucket'             => ud_get_stateless_media()->get('sm.bucket'),
                'fileLink'           => '',
                'mediaLink'          => '',
    
  • /lib/classes/compatibility/polylang-pro.php line 75
     
            $data = [];
    
            foreach ($ids as $id) {
              $file =  apply_filters( 'wp_stateless_get_file', [], $id );
    
              if ( !empty($file) && !empty($file['name']) ) {
                $data['file'] = $file;
    
                break;
              }
    

See this hook used in plugins: