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.4.1.2

apply_filters('wp_stateless_handle_root_dir') is found 6 times:

  • /lib/classes/class-bootstrap.php line 463
            $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 1018
              }
            }
    
            $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 1023
            /**
             * 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 1072
              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 1162
            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 1875
              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'])) {
    

See this hook used in plugins: