wp_stateless_file_name

wp_stateless_file_name

Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wp-stateless.3.4.1

apply_filters('wp_stateless_file_name') is found 65 times:

  • /lib/classes/class-bootstrap.php line 1535
            /* 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();
              $_file = apply_filters('wp_stateless_file_name', $_file, false);
              $file_path_fix = $uploads['basedir'] . "/sites/$blog_id/$_file";
    
              if (file_exists($file_path_fix)) {
                return $file_path_fix;
              }
            } elseif (empty($sm_cloud) && $this->get('sm.mode') == 'stateless' && $_file) {
    
  • /lib/classes/class-bootstrap.php line 1797
                  $url = $uploads['baseurl'] . '/' . $_file;
                } else {
                  $uploads = wp_get_upload_dir();
                  $default_dir = false;
                  $_file = apply_filters('wp_stateless_file_name', $_file, false);
                  $blog_id = get_current_blog_id();
                  $file_path_fix = $uploads['basedir'] . "/sites/$blog_id/$_file";
    
                  if (file_exists($file_path_fix)) {
                    $url = $uploads['baseurl'] . "/sites/$blog_id/$_file";
                  }
    
  • /lib/classes/class-gs-client.php line 197
     
              $object_id = isset($args['metadata']['object-id']) ? $args['metadata']['object-id'] : (isset($args['metadata']['child-of']) ? $args['metadata']['child-of'] : "");
              $object_size = isset($args['metadata']['size']) ? $args['metadata']['size'] : "";
    
              $args['name'] = apply_filters('wp_stateless_file_name', $args['name'], $args['use_root'], $object_id, $object_size);
              $args = apply_filters('wp_stateless_add_media_args', $args);
              $name = $args['name'];
    
              // If media exists we just return it
              if (!$args['force'] && $media = $this->media_exists($name)) {
                if ($media->getCacheControl() != $args['cacheControl']) {
    
  • /lib/classes/class-gs-client.php line 388
           * @return bool
           */
          public function remove_media($name, $id = "", $use_root = true, $size = "", $is_webp = false) {
            try {
              $name = apply_filters('wp_stateless_file_name', $name, $use_root, $id, $size);
              if ($is_webp && substr($name, -4) !=  "webp") $name .= ".webp";
    
              $this->service->objects->delete($this->bucket, $name);
            } catch (Exception $e) {
              return new WP_Error('sm_error', $e->getMessage());
            }
    
  • /lib/classes/class-sync-non-media.php line 116
     
              if ($sm_mode == 'stateless' && !wp_doing_ajax()) {
                global $gs_client;
    
                $gs_name = apply_filters('wp_stateless_file_name', $name, true);
    
                //Bucket
                $bucket = ud_get_stateless_media()->get('sm.bucket');
    
                $bucket = $gs_client->bucket($bucket);
                $object = $bucket->object($gs_name);
    
  • /lib/classes/class-utility.php line 448
            $gs_name_path = array();
            $full_size_path = get_attached_file($attachment_id);
            $base_dir = dirname($full_size_path);
    
            $gs_name = apply_filters('wp_stateless_file_name', $full_size_path, true, $attachment_id, '');
            $gs_base_dir = dirname($gs_name) == '.' ? '' : trailingslashit(dirname($gs_name));
    
            if (!isset($metadata['width']) && file_exists($full_size_path)) {
              try {
                $_image_size = getimagesize($full_size_path);
                if ($_image_size !== false && is_array($_image_size)) {
    
  • /lib/classes/class-utility.php line 479
              foreach ($metadata['sizes'] as $image_size => $data) {
                if (empty($data['file'])) continue;
                $absolutePath = wp_normalize_path($base_dir . '/' . $data['file']);
                $gs_name = $gs_base_dir . $data['file'];
                $gs_name = apply_filters('wp_stateless_file_name', $gs_name, true, $attachment_id, $image_size);
    
                $gs_name_path[$image_size] = array(
                  'gs_name'   => $gs_name,
                  'path'      => $absolutePath,
                  'sm_meta'   => true,
                  'is_thumb'  => true,
    
  • /lib/classes/class-utility.php line 977
            // If no file found
            if (false === $fullsizepath || !file_exists($fullsizepath)) {
    
              // Try get it and save
              $result_code = ud_get_stateless_media()->get_client()->get_media(apply_filters('wp_stateless_file_name', $fullsizepath, true, "", ""), true, $fullsizepath);
    
              if ($result_code !== 200) {
                if (!Utility::sync_get_attachment_if_exist($image->ID, $fullsizepath)) {
                  throw new UnprocessableException(sprintf(__('Both local and remote files are missing. Unable to process. (%s)', ud_get_stateless_media()->domain), $image->guid));
                }
              }
    
  • /lib/classes/class-utility.php line 1034
     
            if (false === $fullsizepath || !$local_file_exists) {
    
              // Try get it and save
              $result_code = ud_get_stateless_media()->get_client()->get_media(apply_filters('wp_stateless_file_name', $fullsizepath, true, "", ""), true, $fullsizepath);
    
              if ($result_code !== 200) {
                if (!Utility::sync_get_attachment_if_exist($file->ID, $fullsizepath)) { // Save file to local from proxy.
                  throw new UnprocessableException(sprintf(__('File not found (%s)', ud_get_stateless_media()->domain), $file->guid));
                } else {
                  $local_file_exists = true;
    
  • /lib/classes/class-utility.php line 1049
            }
    
            if ($local_file_exists) {
    
              if (!ud_get_stateless_media()->get_client()->media_exists(apply_filters('wp_stateless_file_name', $fullsizepath, true, "", ""))) {
    
                if (!function_exists('wp_generate_attachment_metadata')) {
                  require_once ABSPATH . '/wp-admin/includes/media.php';
                  require_once ABSPATH . '/wp-admin/includes/image.php';
                }
                $metadata = wp_generate_attachment_metadata($file->ID, $fullsizepath);
    
  • /lib/classes/compatibility/buddypress.php line 58
            ));
    
            $wp_uploads_dir = wp_get_upload_dir();
    
            $full_avatar_path = $wp_uploads_dir['basedir'] . '/' . apply_filters('wp_stateless_file_name', $full_avatar, false);
            $full_avatar = apply_filters('wp_stateless_file_name', $full_avatar, 0);
    
            $thumb_avatar_path = $wp_uploads_dir['basedir'] . '/' . apply_filters('wp_stateless_file_name', $thumb_avatar, false);
            $thumb_avatar = apply_filters('wp_stateless_file_name', $thumb_avatar, 0);
    
            do_action('sm:sync::syncFile', $full_avatar, $full_avatar_path, true, array('ephemeral' => false));
    
  • /lib/classes/compatibility/buddypress.php line 59
     
            $wp_uploads_dir = wp_get_upload_dir();
    
            $full_avatar_path = $wp_uploads_dir['basedir'] . '/' . apply_filters('wp_stateless_file_name', $full_avatar, false);
            $full_avatar = apply_filters('wp_stateless_file_name', $full_avatar, 0);
    
            $thumb_avatar_path = $wp_uploads_dir['basedir'] . '/' . apply_filters('wp_stateless_file_name', $thumb_avatar, false);
            $thumb_avatar = apply_filters('wp_stateless_file_name', $thumb_avatar, 0);
    
            do_action('sm:sync::syncFile', $full_avatar, $full_avatar_path, true, array('ephemeral' => false));
            do_action('sm:sync::syncFile', $thumb_avatar, $thumb_avatar_path, true, array('ephemeral' => false));
    
  • /lib/classes/compatibility/buddypress.php line 61
     
            $full_avatar_path = $wp_uploads_dir['basedir'] . '/' . apply_filters('wp_stateless_file_name', $full_avatar, false);
            $full_avatar = apply_filters('wp_stateless_file_name', $full_avatar, 0);
    
            $thumb_avatar_path = $wp_uploads_dir['basedir'] . '/' . apply_filters('wp_stateless_file_name', $thumb_avatar, false);
            $thumb_avatar = apply_filters('wp_stateless_file_name', $thumb_avatar, 0);
    
            do_action('sm:sync::syncFile', $full_avatar, $full_avatar_path, true, array('ephemeral' => false));
            do_action('sm:sync::syncFile', $thumb_avatar, $thumb_avatar_path, true, array('ephemeral' => false));
          }
    
    
  • /lib/classes/compatibility/buddypress.php line 62
            $full_avatar_path = $wp_uploads_dir['basedir'] . '/' . apply_filters('wp_stateless_file_name', $full_avatar, false);
            $full_avatar = apply_filters('wp_stateless_file_name', $full_avatar, 0);
    
            $thumb_avatar_path = $wp_uploads_dir['basedir'] . '/' . apply_filters('wp_stateless_file_name', $thumb_avatar, false);
            $thumb_avatar = apply_filters('wp_stateless_file_name', $thumb_avatar, 0);
    
            do_action('sm:sync::syncFile', $full_avatar, $full_avatar_path, true, array('ephemeral' => false));
            do_action('sm:sync::syncFile', $thumb_avatar, $thumb_avatar_path, true, array('ephemeral' => false));
          }
    
          /**
    
  • /lib/classes/compatibility/buddypress.php line 95
           * @return void
           */
          public function bp_core_fetch_avatar_url($url) {
            $wp_uploads_dir = wp_get_upload_dir();
            $name = apply_filters('wp_stateless_file_name', $url, 0);
            $full_avatar_path = $wp_uploads_dir['basedir'] . '/' . $name;
    
    
            $root_dir = ud_get_stateless_media()->get('sm.root_dir');
            $root_dir = apply_filters("wp_stateless_handle_root_dir", $root_dir);
            $root_dir = trim($root_dir, '/ '); // Remove any forward slash and empty space.
    
  • /lib/classes/compatibility/buddypress.php line 107
            // @todo support photo in plugins directory.
    
            if (strpos($name, plugins_url()) === 0) {
              $name = str_replace(plugins_url() . '/', '', $name);
              $name = apply_filters('wp_stateless_file_name', $name, 0);
              $full_avatar_path = WP_PLUGIN_DIR . '/' . $name;
            }
    
            if (strpos($name, "$root_dir/http") !== 0 && strpos($name, "http") !== 0 && $root_dir !== $name) {
              do_action('sm:sync::syncFile', $name, $full_avatar_path, false, array('ephemeral' => false));
              $url = ud_get_stateless_media()->get_gs_host() . '/' . $name;
    
  • /lib/classes/compatibility/buddypress.php line 132
     
            $full_avatar = bp_core_fetch_avatar(array('object' => $args['object'], 'item_id' => $args['item_id'], 'html' => false, 'type' => 'full',));
            $thumb_avatar = bp_core_fetch_avatar(array('object' => $args['object'], 'item_id' => $args['item_id'], 'html' => false, 'type' => 'thumb',));
    
            do_action('sm:sync::deleteFile', apply_filters('wp_stateless_file_name', $full_avatar, 0));
            do_action('sm:sync::deleteFile', apply_filters('wp_stateless_file_name', $thumb_avatar, 0));
    
            if (ud_get_stateless_media()->get('sm.mode') === 'ephemeral') {
              $return = false;
            }
    
    
  • /lib/classes/compatibility/buddypress.php line 133
            $full_avatar = bp_core_fetch_avatar(array('object' => $args['object'], 'item_id' => $args['item_id'], 'html' => false, 'type' => 'full',));
            $thumb_avatar = bp_core_fetch_avatar(array('object' => $args['object'], 'item_id' => $args['item_id'], 'html' => false, 'type' => 'thumb',));
    
            do_action('sm:sync::deleteFile', apply_filters('wp_stateless_file_name', $full_avatar, 0));
            do_action('sm:sync::deleteFile', apply_filters('wp_stateless_file_name', $thumb_avatar, 0));
    
            if (ud_get_stateless_media()->get('sm.mode') === 'ephemeral') {
              $return = false;
            }
    
            return $return;
    
  • /lib/classes/compatibility/buddypress.php line 165
              if (!empty($debug_backtrace[3]['args'][0]) && $debug_backtrace[3]['args'][0] == 'url') {
                $r['recursive'] = true;
    
                $url = bp_attachments_get_attachment('url', $r);
                $name = apply_filters('wp_stateless_file_name', $url, 0);
    
                $root_dir = ud_get_stateless_media()->get('sm.root_dir');
                $root_dir = apply_filters("wp_stateless_handle_root_dir", $root_dir);
                $root_dir = trim($root_dir, '/ '); // Remove any forward slash and empty space.
    
                if (!empty($name) && $root_dir . "/" != $name) {
    
  • /lib/classes/compatibility/elementor.php line 53
                $wp_uploads_dir = wp_get_upload_dir();
                $name = str_replace($wp_uploads_dir['baseurl'] . '/', '', $url);
                if ($name != $url) {
                  $absolutePath = $wp_uploads_dir['basedir'] . '/' . $name;
                  $name = apply_filters('wp_stateless_file_name', $name, 0);
                  do_action('sm:sync::syncFile', $name, $absolutePath);
    
                  if (!in_array(ud_get_stateless_media()->get('sm.mode'), ['disabled', 'backup'])) {
                    $url = ud_get_stateless_media()->get_gs_host() . '/' . $name;
                  }
                }
    
  • /lib/classes/compatibility/elementor.php line 90
              $post_css = new \Elementor\Core\Files\CSS\Post($post_ID);
    
              //      elementor/               css/                           'post-' . $post_id . '.css'
              $name = $post_css::UPLOADS_DIR . $post_css::DEFAULT_FILES_DIR . $post_css->get_file_name();
              $name = apply_filters('wp_stateless_file_name', $name, 0);
              do_action('sm:sync::deleteFile', $name);
            }
          }
    
          /**
           * Delete elementor global css file when global style is updated on Elementor Editor.
    
  • /lib/classes/compatibility/elementor.php line 107
            try {
              $post_css = new \Elementor\Core\Files\CSS\Global_CSS('global.css');
              //      elementor/               css/                           'global.css'
              $name = $post_css::UPLOADS_DIR . $post_css::DEFAULT_FILES_DIR . $post_css->get_file_name();
              $name = apply_filters('wp_stateless_file_name', $name, 0);
              do_action('sm:sync::deleteFile', $name);
            } catch (\Exception $e) {
              // @todo maybe log the exception.
            }
            // We are in filter so need to return the passed value.
            return $success_response_data;
    
  • /lib/classes/compatibility/ewww.php line 39
           * @param $fullsize
           */
          public function pre_optimization( $file, $type, $fullsize ) {
            // wp_stateless_file_name filter will remove the basedir from the path and prepend with root dir.
            $name = apply_filters( 'wp_stateless_file_name', $file );
            do_action( 'sm:sync::syncFile', $name, $file, true, array( 'ephemeral' => false, 'download' => true, 'use_root' => true ) );
          }
    
          /**
           * If image size not exist then upload it to GS.
           *
    
  • /lib/classes/compatibility/ewww.php line 52
           * @param $fullsize
           */
          public function post_optimization( $file, $type, $fullsize ) {
            // wp_stateless_file_name filter will remove the basedir from the path and prepend with root dir.
            $name = apply_filters( 'wp_stateless_file_name', $file );
            do_action( 'sm:sync::syncFile', $name, $file, true, array( 'use_root' => true ) );
    
    
            // if($fullsize && file_exists($file . '.bak'))
            //     do_action( 'sm:sync::syncFile', $name . '.bak', $file . '.bak', true);
    
    
  • /lib/classes/compatibility/gravity-forms-signature.php line 56
              try {
                $folder = \GFSignature::get_signatures_folder();
                $file_path = $folder . $value;
    
                $name = apply_filters('wp_stateless_file_name', $file_path);
                do_action('sm:sync::syncFile', $name, $file_path, true);
              } catch (\Throwable $th) {
                //throw $th;
              }
            }
            return $value;
    
  • /lib/classes/compatibility/gravity-forms-signature.php line 79
                if ($value['function'] == 'get_signature_url' && rgar($value, 'class') == 'GFSignature') {
                  $folder = \GFSignature::get_signatures_folder();
                  $name = $value['args'][0];
                  $file_path = $folder . $name . '.png';
                  $name = apply_filters('wp_stateless_file_name', $file_path);
                  do_action('sm:sync::syncFile', $name, $file_path);
                  $url = ud_get_stateless_media()->get_gs_host() . '/' . $name;
                  break;
                }
              }
            } catch (\Throwable $th) {
    
  • /lib/classes/compatibility/gravity-forms-signature.php line 102
     
              $name = rgar($lead, $field_id);
              $file_path = $folder . $name;
    
              $name = apply_filters('wp_stateless_file_name', $file_path);
              do_action('sm:sync::deleteFile', $name);
            } catch (\Throwable $th) {
              //throw $th;
            }
            return $return;
          }
    
  • /lib/classes/compatibility/gravity-forms-signature.php line 127
            // Sync signature file
            try {
              $folder = \GFSignature::get_signatures_folder();
              $absolute_path = $folder . $filename . '.png';
              $name = apply_filters('wp_stateless_file_name', $absolute_path, false);
              do_action('sm:sync::syncFile', $name, $absolute_path);
    
              if ( $mode !== 'backup' ) {
                $url = ud_get_stateless_media()->get_gs_host() . '/' . $name;
              }
            } catch (\Throwable $th) {
    
  • /lib/classes/compatibility/gravity-forms.php line 75
     
                if ($position !== false) {
                  $name = substr($v, $position);
                  $absolutePath = $dir['basedir'] . '/' .  $name;
                  $name = apply_filters('wp_stateless_file_name', $name, 0);
                  // doing sync
                  do_action('sm:sync::syncFile', $name, $absolutePath);
                  $value[$k] = ud_get_stateless_media()->get_gs_host() . '/' . $name;
                  // Todo add filter.
                }
              }
    
  • /lib/classes/compatibility/gravity-forms.php line 104
                $name = rgar($arr_name, 0); // Removed |:| from end of the url.
    
                // doing sync
                $absolutePath = $dir['basedir'] . '/' .  $name;
                $name = apply_filters('wp_stateless_file_name', $name, 0);
                do_action('sm:sync::syncFile', $name, $absolutePath);
    
                $value = ud_get_stateless_media()->get_gs_host() . '/' . $name;
                // Todo add filter.
                if (version_compare($this->plugin_version, '2.3', '<')) { // older version
                  $result = $wpdb->update($lead_detail_table, array('value' => $value), array('lead_id' => $lead_detail_id, 'form_id' => $form['id'], 'field_number' => $field['id'],), array('%s'), array('%d'));
    
  • /lib/classes/compatibility/gravity-forms.php line 239
            // If the url is a GCS link then remove it from GCS.
            if ($is_stateless !== false) {
              $gs_name = substr($file_path, strpos($file_path, '/gravity_forms/'));
              $file_path = $dir['basedir'] . $gs_name;
              $gs_name = apply_filters('wp_stateless_file_name', $gs_name, 0);
    
              $client = ud_get_stateless_media()->get_client();
              if (!is_wp_error($client)) {
                $client->remove_media(trim($gs_name, '/'));
              }
            }
    
  • /lib/classes/compatibility/imagify.php line 146
            /**
             * Try to get all missing files from GCS
             */
            if (!file_exists($file)) {
              ud_get_stateless_media()->get_client()->get_media(apply_filters('wp_stateless_file_name', $meta_data['file']), true, $file);
            }
    
            if (!empty($meta_data['sizes']) && is_array($meta_data['sizes'])) {
              $upload_basedir = trailingslashit(dirname($file));
              foreach ($meta_data['sizes'] as $image) {
                if (!empty($image['gs_name']) && !file_exists($file = $upload_basedir . $image['file'])) {
    
  • /lib/classes/compatibility/imagify.php line 153
            if (!empty($meta_data['sizes']) && is_array($meta_data['sizes'])) {
              $upload_basedir = trailingslashit(dirname($file));
              foreach ($meta_data['sizes'] as $image) {
                if (!empty($image['gs_name']) && !file_exists($file = $upload_basedir . $image['file'])) {
                  ud_get_stateless_media()->get_client()->get_media(apply_filters('wp_stateless_file_name', $image['gs_name']), true, $file);
                }
              }
            }
          }
    
          /**
    
  • /lib/classes/compatibility/imagify.php line 198
              $backup_path = get_imagify_attachment_backup_path($file_path);
              if (file_exists($backup_path)) {
                $overwrite = apply_filters('imagify_backup_overwrite_backup', false, $file_path, $backup_path);
                // wp_stateless_file_name filter will remove the basedir from the path and prepend with root dir.
                $name = apply_filters('wp_stateless_file_name', $backup_path);
                do_action('sm:sync::syncFile', $name, $backup_path, $overwrite);
              }
            }
          }
    
          /**
    
  • /lib/classes/compatibility/imagify.php line 214
            $backup_path = get_imagify_attachment_backup_path($file_path);
            if (!file_exists($backup_path)) {
              $upload_dir = wp_upload_dir();
              $name = str_replace(trailingslashit($upload_dir['basedir']), '', $backup_path);
              $name = apply_filters('wp_stateless_file_name', $name);
              do_action('sm:sync::syncFile', $name, $backup_path, true);
            }
          }
    
          /**
           * Check if backup exists in GCS.
    
  • /lib/classes/compatibility/imagify.php line 227
           * @return bool
           */
          public function imagify_has_backup($return, $has_backup) {
            if (!$return && $has_backup) {
              $name = apply_filters('wp_stateless_file_name', $has_backup);
              $return = (bool) apply_filters('sm:sync::queue_is_exists', $name);
            }
            return $return;
          }
    
          /**
    
  • /lib/classes/compatibility/imagify.php line 245
            if ($wp_stateless_imagify_mode == 'ephemeral') {
              ud_get_stateless_media()->set('sm.mode', 'ephemeral');
            }
    
            $name = apply_filters('wp_stateless_file_name', basename($file));
    
            if (file_exists($file)) {
              add_filter('upload_mimes', array($this, 'add_webp_mime'), 10, 2);
              /**
               * Media already on GCS, so only replacing data on it. For webp format adding path and status to wp_sm_sync table
               */
    
  • /lib/classes/compatibility/imagify.php line 273
            try {
              $attachment_id = $this->getProperties($this->getProperties($this->getProperties($process)['data'])['media'])['id'];
    
              $full_size_path = $file->get_path();
              $name = apply_filters('wp_stateless_file_name', basename($full_size_path), true, $attachment_id);
              do_action('sm:sync::syncFile', $name, $full_size_path, true, ['download' => true]);
              // error_log("\n\ndo_action( 'sm:sync::syncFile', $name, $full_size_path, true, ['download' => true] );");
            } catch (\Throwable $th) {
              //throw $th;
            }
            return $return;
    
  • /lib/classes/compatibility/lite-speed-cache.php line 91
           *
           */
          public function sync_image($row_img, $local_file) {
            $rm_ori_bkup = apply_filters('litespeed_conf', 'img_optm-rm_bkup');
            $gs_name = apply_filters('wp_stateless_file_name', $row_img->src);
            $cloud_meta = get_post_meta($row_img->post_id, 'sm_cloud', true);
    
            if (empty($cloud_meta)) $cloud_meta = array();
    
            if (!$rm_ori_bkup) {
              $extension = pathinfo($gs_name, PATHINFO_EXTENSION);
    
  • /lib/classes/compatibility/lite-speed-cache.php line 117
           */
          public function sync_webp($row_img, $local_file) {
            $optm_webp = apply_filters('litespeed_conf', 'img_optm-webp');
            if ($optm_webp) {
              $gs_name = apply_filters('wp_stateless_file_name', $row_img->src . '.webp');
    
              $cloud_meta = get_post_meta($row_img->post_id, 'sm_cloud', true);
              $cloud_meta['fileMd5'][$gs_name] = md5_file($local_file);
              update_post_meta($row_img->post_id, 'sm_cloud', $cloud_meta);
    
              add_filter('upload_mimes', array($this, 'add_webp_mime'), 10, 2);
    
  • /lib/classes/compatibility/lite-speed-cache.php line 163
              $metadata = wp_get_attachment_metadata($post_id);
              $cloud_meta = get_post_meta($post_id, 'sm_cloud', true);
    
              if (!empty($metadata['gs_link'])) {
                $short_file_path = apply_filters('wp_stateless_file_name', $short_file_path);
                $url = ud_get_stateless_media()->get_gs_host() . '/' . $short_file_path;
                $md5 = !empty($cloud_meta['fileMd5'][$short_file_path]) ? $cloud_meta['fileMd5'][$short_file_path] : null;
    
                if ($metadata['file'] == $short_file_path) {
                  $url = $metadata['gs_link'];
                } else {
    
  • /lib/classes/compatibility/lite-speed-cache.php line 197
           * @param $short_file_path
           * @param $post_id
           */
          public function litespeed_media_del($short_file_path, $post_id) {
            $short_file_path = apply_filters('wp_stateless_file_name', $short_file_path);
            do_action('sm:sync::deleteFile', $short_file_path);
          }
    
          /**
           * Hooks into the rename function of the LS cache.
           * And move the file in GCS.
    
  • /lib/classes/compatibility/lite-speed-cache.php line 211
           * @param $short_file_path_new
           * @param $post_id
           */
          public function litespeed_media_rename($short_file_path, $short_file_path_new, $post_id) {
            $short_file_path = apply_filters('wp_stateless_file_name', $short_file_path);
            $short_file_path_new = apply_filters('wp_stateless_file_name', $short_file_path_new);
    
            // copy file to the new location and delete the old one.
            do_action('sm:sync::moveFile', $short_file_path, $short_file_path_new);
    
            $this->update_hash($post_id, $short_file_path_new, $short_file_path);
    
  • /lib/classes/compatibility/lite-speed-cache.php line 212
           * @param $post_id
           */
          public function litespeed_media_rename($short_file_path, $short_file_path_new, $post_id) {
            $short_file_path = apply_filters('wp_stateless_file_name', $short_file_path);
            $short_file_path_new = apply_filters('wp_stateless_file_name', $short_file_path_new);
    
            // copy file to the new location and delete the old one.
            do_action('sm:sync::moveFile', $short_file_path, $short_file_path_new);
    
            $this->update_hash($post_id, $short_file_path_new, $short_file_path);
          }
    
  • /lib/classes/compatibility/lite-speed-cache.php line 347
                  $extension = pathinfo($file_path, PATHINFO_EXTENSION);
                  $bk_file = substr($file_path, 0, -strlen($extension)) . 'bk.' . $extension;
                  $bk_file_optm = substr($file_path, 0, -strlen($extension)) . 'bk.optm.' . $extension;
                  if (file_exists($bk_file)) {
                    $gs_name = apply_filters('wp_stateless_file_name', $bk_file);
                    $cloud_meta['fileMd5'][$gs_name] = md5_file($bk_file);
                    do_action('sm:sync::syncFile', $gs_name, $bk_file);
                  } elseif (file_exists($bk_file_optm)) {
                    $gs_name = apply_filters('wp_stateless_file_name', $bk_file_optm);
                    $cloud_meta['fileMd5'][$gs_name] = md5_file($bk_file_optm);
                    do_action('sm:sync::syncFile', $gs_name, $bk_file_optm);
    
  • /lib/classes/compatibility/lite-speed-cache.php line 351
                    $gs_name = apply_filters('wp_stateless_file_name', $bk_file);
                    $cloud_meta['fileMd5'][$gs_name] = md5_file($bk_file);
                    do_action('sm:sync::syncFile', $gs_name, $bk_file);
                  } elseif (file_exists($bk_file_optm)) {
                    $gs_name = apply_filters('wp_stateless_file_name', $bk_file_optm);
                    $cloud_meta['fileMd5'][$gs_name] = md5_file($bk_file_optm);
                    do_action('sm:sync::syncFile', $gs_name, $bk_file_optm);
                  }
                }
    
                if ($optm_webp) {
    
  • /lib/classes/compatibility/lite-speed-cache.php line 361
                if ($optm_webp) {
                  $gs_name_webp = $file_path . '.webp';
                  $gs_name_webp_optm = $file_path . '.optm.webp';
                  if (file_exists($gs_name_webp)) {
                    $gs_name = apply_filters('wp_stateless_file_name', $gs_name_webp);
                    $cloud_meta['fileMd5'][$gs_name] = md5_file($gs_name_webp);
                    do_action('sm:sync::syncFile', $gs_name, $gs_name_webp);
                  } elseif (file_exists($gs_name_webp_optm)) {
                    $gs_name = apply_filters('wp_stateless_file_name', $gs_name_webp_optm);
                    $cloud_meta['fileMd5'][$gs_name] = md5_file($gs_name_webp_optm);
                    do_action('sm:sync::syncFile', $gs_name, $gs_name_webp_optm);
    
  • /lib/classes/compatibility/lite-speed-cache.php line 365
                    $gs_name = apply_filters('wp_stateless_file_name', $gs_name_webp);
                    $cloud_meta['fileMd5'][$gs_name] = md5_file($gs_name_webp);
                    do_action('sm:sync::syncFile', $gs_name, $gs_name_webp);
                  } elseif (file_exists($gs_name_webp_optm)) {
                    $gs_name = apply_filters('wp_stateless_file_name', $gs_name_webp_optm);
                    $cloud_meta['fileMd5'][$gs_name] = md5_file($gs_name_webp_optm);
                    do_action('sm:sync::syncFile', $gs_name, $gs_name_webp_optm);
                  }
                }
              }
            }
    
  • /lib/classes/compatibility/shortpixel.php line 133
                $wp_uploads_dir = wp_get_upload_dir();
                $gs_name = str_replace(trailingslashit($wp_uploads_dir['basedir']), '', $path);
                $gs_name = str_replace(trailingslashit($wp_uploads_dir['baseurl']), '', $gs_name);
                $gs_name = str_replace(trailingslashit(ud_get_stateless_media()->get_gs_host()), '', $gs_name);
                $gs_name = apply_filters('wp_stateless_file_name', $gs_name);
                if ($media = ud_get_stateless_media()->get_client()->media_exists($gs_name)) {
                  $return = true;
                }
              }
              set_transient($key, $return, 10 * MINUTE_IN_SECONDS);
            }
    
  • /lib/classes/compatibility/shortpixel.php line 161
            $backup_path = SHORTPIXEL_BACKUP_FOLDER . '/' . $fullSubDir;
    
            foreach ($paths as $key => $path) {
              // Removing backup
              $name = apply_filters('wp_stateless_file_name', SHORTPIXEL_BACKUP . '/' . $fullSubDir . basename($path));
              do_action('sm:sync::deleteFile', $name);
    
              // Removing WebP
              $backup_images = \WPShortPixelSettings::getOpt('wp-short-create-webp');
              if ($backup_images) {
                $name = str_replace($sp__uploads['basedir'], '', $path);
    
  • /lib/classes/compatibility/shortpixel.php line 168
              // Removing WebP
              $backup_images = \WPShortPixelSettings::getOpt('wp-short-create-webp');
              if ($backup_images) {
                $name = str_replace($sp__uploads['basedir'], '', $path);
                $name = apply_filters('wp_stateless_file_name', $name . '.webp');
                do_action('sm:sync::deleteFile', $name);
              }
            }
    
            if (ud_get_stateless_media()->get('sm.mode') == 'ephemeral') {
              return true;
    
  • /lib/classes/compatibility/shortpixel.php line 291
                $args = array('ephemeral' => false);
              }
    
              $absolutePath = trailingslashit($backup_path) . basename($metadata['file']);
              $name = apply_filters('wp_stateless_file_name', SHORTPIXEL_BACKUP . '/' . $fullSubDir . basename($metadata['file']));
              do_action('sm:sync::syncFile', $name, $absolutePath, $force, $args);
    
              foreach ((array) $metadata['sizes'] as $image_size => $data) {
                $absolutePath = trailingslashit($backup_path) . $data['file'];
                $name = apply_filters('wp_stateless_file_name', SHORTPIXEL_BACKUP . '/' . $fullSubDir . $data['file']);
    
    
  • /lib/classes/compatibility/shortpixel.php line 296
              do_action('sm:sync::syncFile', $name, $absolutePath, $force, $args);
    
              foreach ((array) $metadata['sizes'] as $image_size => $data) {
                $absolutePath = trailingslashit($backup_path) . $data['file'];
                $name = apply_filters('wp_stateless_file_name', SHORTPIXEL_BACKUP . '/' . $fullSubDir . $data['file']);
    
                do_action('sm:sync::syncFile', $name, $absolutePath, $force, $args);
              }
            }
          }
    
    
  • /lib/classes/compatibility/shortpixel.php line 387
              $_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);
    
                /* Add default image */
                $media = $client->add_media($_mediaOptions = array_filter(array('force' => true, 'name' => $file, 'absolutePath' => wp_normalize_path(get_attached_file($attachment_id)), 'cacheControl' => $_cacheControl, 'contentDisposition' => $_contentDisposition, 'mimeType' => get_post_mime_type($attachment_id), 'metadata' => $_metadata)));
    
                // ephemeral mode: we don't need the local version.
                if (ud_get_stateless_media()->get('sm.mode') === 'ephemeral') {
    
  • /lib/classes/compatibility/shortpixel.php line 402
              /* Now we go through all available image sizes and upload them to Google Storage */
              if (!empty($metadata['sizes']) && is_array($metadata['sizes'])) {
    
                $path = wp_normalize_path(dirname(get_attached_file($attachment_id)));
                $mediaPath = apply_filters('wp_stateless_file_name', trim(dirname($metadata['file']), '\/\\'));
    
                foreach ((array) $metadata['sizes'] as $image_size => $data) {
    
                  $absolutePath = wp_normalize_path($path . '/' . $data['file']);
    
                  if (!file_exists($absolutePath)) {
    
  • /lib/classes/compatibility/simple-local-avatars.php line 71
            // 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)) {
                  $value = trailingslashit($bucketLink) . apply_filters('wp_stateless_file_name', str_replace($upload['baseurl'], '', $value), true);
                }
              }
            }
    
            // Return filtered data back
            return $user_meta;
    
  • /lib/classes/compatibility/siteorigin-css.php line 39
           */
          public function action_admin_menu() {
            if (current_user_can('edit_theme_options') && isset($_POST['siteorigin_custom_css_save'])) {
              try {
                $prefix = apply_filters('wp_stateless_file_name', 'so-css', 0);
                do_action('sm:sync::deleteFiles', $prefix);
                // die();
                // $object_list = ud_get_stateless_media()->get_client()->list_objects("prefix=$prefix");
                // $files_array = $object_list->getItems();
                // foreach ($files_array as $file) {
                //     do_action( 'sm:sync::deleteFile', $file->name );
    
  • /lib/classes/compatibility/siteorigin-css.php line 66
              $upload_data = wp_upload_dir();
              $name = substr($url, $position);
              // We need to get the absolute path before adding the bucket dir to name.
              $absolutePath = $upload_data['basedir'] . '/' . $name;
              $name = apply_filters('wp_stateless_file_name', $name, 0);
              do_action('sm:sync::syncFile', $name, $absolutePath);
              // echo "do_action( 'sm:sync::syncFile', $name, $absolutePath);\n";
              $url = ud_get_stateless_media()->get_gs_host() . '/' . $name;
            }
            return $url;
          }
    
  • /lib/classes/compatibility/siteorigin-widget-bundle.php line 50
            if ($position !== false) {
              $upload_data = wp_upload_dir();
              $name = substr($url, $position);
              $absolutePath = $upload_data['basedir'] . '/' . $name;
              $name = apply_filters('wp_stateless_file_name', $name, 0);
              do_action('sm:sync::syncFile', $name, $absolutePath);
              $url = ud_get_stateless_media()->get_gs_host() . '/' . $name;
            }
            return $url;
          }
    
    
  • /lib/classes/compatibility/woo-extra-product-options.php line 54
            $type = $upload['type'];
    
            $client = ud_get_stateless_media()->get_client();
    
            $file_path = apply_filters('wp_stateless_file_name', $file, 0);
            $file_info = @getimagesize($file);
    
            if ($file_info) {
              $_metadata = array(
                'width'  => $file_info[0],
                'height' => $file_info[1],
    
  • /lib/classes/compatibility/wp-smush.php line 120
              $metadata = wp_get_attachment_metadata($attachment_id);
              if (!empty($metadata['gs_name'])) {
                $image_sizes = Utility::get_path_and_url($metadata, $attachment_id);
                foreach ($image_sizes as $size => $img) {
                  $client->get_media(apply_filters('wp_stateless_file_name', $img['gs_name']), true, $img['path']);
                }
    
                $gs_name = dirname($metadata['gs_name']) . '/' . basename($file_path);
                // We need to remove backup from GCS if it's a restore action
                // @todo revise this code
                if ($this->hook_from_restore_image()) {
    
  • /lib/classes/compatibility/wp-smush.php line 127
                $gs_name = dirname($metadata['gs_name']) . '/' . basename($file_path);
                // We need to remove backup from GCS if it's a restore action
                // @todo revise this code
                if ($this->hook_from_restore_image()) {
                  $client->remove_media(apply_filters('wp_stateless_file_name', $gs_name));
                }
              }
            }
          }
    
          /**
    
  • /lib/classes/compatibility/wp-smush.php line 152
              foreach ($backup_paths as $key => $data) {
                $gs_name = $gs_dir . '/' . basename($data['file']);
                // Path of backup image
                $backup_path = $base_dir . '/' . basename($data['file']);
                do_action('sm:sync::deleteFile', apply_filters('wp_stateless_file_name', $gs_name), $backup_path);
                delete_transient('sm-wp-smush-backup-exists-' . $attachment_id);
              }
            }
          }
    
          /**
    
  • /lib/classes/compatibility/wp-smush.php line 175
     
              $metadata = wp_get_attachment_metadata($attachment_id);
              if (!empty($metadata['gs_name'])) {
                $gs_name = dirname($metadata['gs_name']) . '/' . basename($backup_path);
                if (ud_get_stateless_media()->get_client()->media_exists(apply_filters('wp_stateless_file_name', $gs_name))) {
                  set_transient('sm-wp-smush-backup-exists-' . $attachment_id, true, HOUR_IN_SECONDS);
                  return true;
                }
              }
            }
    
    
  • /lib/classes/compatibility/wp-smush.php line 211
                $gs_name = $gs_dir . '/' . basename($data['file']);
                // Path of backup image
                $backup_path = $base_dir . '/' . basename($data['file']);
                // Sync backup image with GCS
                do_action('sm:sync::syncFile', apply_filters('wp_stateless_file_name', $gs_name), $backup_path);
                delete_transient('sm-wp-smush-backup-exists-' . $attachment_id);
              }
            }
          }
    
          /**
    

See this hook used in plugins: