wp_stateless_handle_root_dir

wp_stateless_handle_root_dir

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_handle_root_dir') is found 12 times:

  • /lib/classes/class-bootstrap.php line 450
            $bucket = $this->get('sm.bucket');
    
            //Bucket folder path
            $root_dir = $this->get('sm.root_dir');
            $root_dir = apply_filters("wp_stateless_handle_root_dir", $root_dir);
    
            /**
             * Subdir not uses on Stateless mode
             */
            $uploads['subdir'] = '';
    
    
  • /lib/classes/class-bootstrap.php line 969
              }
            }
    
            $root_dir = $this->get('sm.root_dir');
            $root_dir_regex = '~^' . apply_filters("wp_stateless_handle_root_dir", $root_dir, true) . '/~';
            /**
             * Retrieve Y/M and other tags from current path
             */
            $path_elements = apply_filters('wp_stateless_unhandle_root_dir', $current_path);
            $root_dir = apply_filters("wp_stateless_handle_root_dir", $root_dir, false, $path_elements);
    
    
  • /lib/classes/class-bootstrap.php line 974
            /**
             * Retrieve Y/M and other tags from current path
             */
            $path_elements = apply_filters('wp_stateless_unhandle_root_dir', $current_path);
            $root_dir = apply_filters("wp_stateless_handle_root_dir", $root_dir, false, $path_elements);
    
            $upload_dir = wp_upload_dir();
            $current_path = str_replace(wp_normalize_path(trailingslashit($upload_dir['basedir'])), '', wp_normalize_path($current_path));
            $current_path = str_replace(wp_normalize_path(trailingslashit($upload_dir['baseurl'])), '', wp_normalize_path($current_path));
            $current_path = str_replace(trailingslashit($this->get_gs_host()), '', $current_path);
    
    
  • /lib/classes/class-bootstrap.php line 1023
              if (!empty($upload_data['url']) && !empty($content)) {
                $url = preg_replace('/https?:\/\//', '', $upload_data['url']);
    
                $root_dir = trim($this->get('sm.root_dir'), '/ '); // Remove any forward slash and empty space.
                $root_dir = apply_filters("wp_stateless_handle_root_dir", $root_dir);
                $root_dir = !empty($root_dir) ? $root_dir . '/' : false;
                $image_host = $this->get_gs_host();
                $file_ext = $this->replaceable_file_types();
                $content = preg_replace(
                  '/(href|src)=(\'|")(https?:\/\/' . str_replace('/', '\/', $url) . ')\/(.+?)(' . $file_ext . ')(\'|")/i',
                  '$1=$2' . $image_host . '/' . ($root_dir ? $root_dir : '') . '$4$5$6',
    
  • /lib/classes/class-bootstrap.php line 1113
            if ($meta && $upload_data = wp_upload_dir()) {
              if (!empty($upload_data['url']) && !empty($meta)) {
                $url = preg_replace('/https?:\/\//', '', $upload_data['url']);
                $root_dir = trim($this->get('sm.root_dir'), '/ '); // Remove any forward slash and empty space.
                $root_dir = apply_filters("wp_stateless_handle_root_dir", $root_dir);
                $root_dir = !empty($root_dir) ? $root_dir . '/' : false;
                $image_host = $this->get_gs_host() . '/' . ($root_dir ? $root_dir : '');
                $file_ext = $this->replaceable_file_types();
                $updated = $this->_convert_to_gs_link($meta, $image_host, $url, $file_ext);
              }
            }
    
  • /lib/classes/class-bootstrap.php line 1851
              if (empty($post_id)) {
                $gs_base_url =  $this->get_gs_host();
                $root_dir = $this->get('sm.root_dir');
                $path_elements = apply_filters('wp_stateless_unhandle_root_dir', $url);
                $root_dir = apply_filters("wp_stateless_handle_root_dir", $root_dir, false, $path_elements);
                $gs_url =  $this->get_gs_host() . '/' . $root_dir;
                $site_url = parse_url($gs_url);
                $image_path = parse_url($url);
    
                //force the protocols to match if needed
                if (isset($image_path['scheme']) && ($image_path['scheme'] !== $site_url['scheme'])) {
    
  • /lib/classes/compatibility/buddypress.php line 100
            $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.
            // Making sure that we only modify url for uploads dir.
            // @todo support photo in plugins directory.
    
            if (strpos($name, plugins_url()) === 0) {
              $name = str_replace(plugins_url() . '/', '', $name);
    
  • /lib/classes/compatibility/buddypress.php line 168
                $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) {
                  $full_path = bp_attachments_get_attachment(false, $r);
                  do_action('sm:sync::syncFile', $name, $full_path, false, array('ephemeral' => false));
                  $return = ud_get_stateless_media()->get_gs_host() . '/' . $name;
    
  • /lib/classes/compatibility/easy-digital-downloads.php line 114
           */
          public function upload_dir($data) {
            if ($this->hook_from_fes()) {
              $root_dir = ud_get_stateless_media()->get('sm.root_dir');
              $root_dir = apply_filters("wp_stateless_handle_root_dir", $root_dir);
              $data['baseurl'] = ud_get_stateless_media()->get_gs_host() . '/' . $root_dir;
            }
            return $data;
          }
    
          /**
    
  • /lib/classes/compatibility/elementor.php line 128
     
                if (!empty($upload_data['baseurl']) && !empty($content)) {
                  $baseurl = preg_replace('/https?:\/\//', '', $upload_data['baseurl']);
                  $root_dir = trim(ud_get_stateless_media()->get('sm.root_dir'), '/ '); // Remove any forward slash and empty space.
                  $root_dir = apply_filters("wp_stateless_handle_root_dir", $root_dir);
                  $root_dir = !empty($root_dir) ? $root_dir . '/' : '';
                  $image_host = ud_get_stateless_media()->get_gs_host() . $root_dir;
                  $file_ext = ud_get_stateless_media()->replaceable_file_types();
    
                  preg_match_all('/(https?:\/\/' . str_replace('/', '\/', $baseurl) . ')\/(.+?)(' . $file_ext . ')/i', $content, $matches);
                  if (!empty($matches)) {
    
  • /lib/classes/compatibility/gravity-forms.php line 133
            $position = strpos($file_path, 'gravity_forms/');
            $is_index = strpos($file_path, 'index.html');
            $is_htaccess = strpos($file_path, '.htaccess');
            $root_dir = ud_get_stateless_media()->get('sm.root_dir');
            $root_dir = apply_filters("wp_stateless_handle_root_dir", $root_dir);
    
            if (empty($this->plugin_version) && class_exists('GFForms')) {
              $this->plugin_version = \GFForms::$version;
            }
    
            $gf_val_column = 'meta_value';
    
  • /lib/classes/compatibility/lite-speed-cache.php line 299
            if (!empty($cloud_meta['fileMd5'])) {
              $upload_dir = wp_upload_dir();
              $fileMd5 = $cloud_meta['fileMd5'];
              $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.
    
              foreach ($fileMd5 as $gs_name => $value) {
                $_gs_name = str_replace($root_dir, '', $gs_name);
                $local_file = $upload_dir['basedir'] . '/' . trim($_gs_name, '/');
    
    

See this hook used in plugins: