public function onWpLoaded()
    {
        if ($this->c::isCli()) {
            return; // Not applicable.
        }
        $WP_Rewrite = $GLOBALS['wp_rewrite'];

        if (!empty($_REQUEST[$this->var])) {
            $transient_hash = (string) $_REQUEST[$this->var];
        } elseif (mb_stripos($_SERVER['REQUEST_URI'] ?? '', '/'.$this->slug.'/') !== false && $WP_Rewrite->using_mod_rewrite_permalinks()) {
            $base_path = $this->c::mbRTrim((string) $this->c::parseUrl(home_url('/'), PHP_URL_PATH), '/');
            $path      = $base_path ? mb_substr($this->c::currentPath(), mb_strlen($base_path)) : $this->c::currentPath();

            if ($path && preg_match('/^\/'.$this->c::escRegex($this->slug).'\/(?<transient_hash>[^\/]+)(?:\/|$)/ui', $path, $_m)) {
                $transient_hash = $_m['transient_hash'];
            } else {
                return; // Not appplicable; i.e., unable to find transient hash in path.
            }
        } else {
            return; // Not applicable.
        }
        if (!($long_url = $this->s::getTransient('', $transient_hash))) {
            $this->s::dieInvalid(__('Sorry, link expired.', 'wp-sharks-core'));
        }
        wp_redirect($long_url, 301).exit(); // Stop on redirection.
    }
public function onWpLoaded()
    {
        if ($this->c::isCli()) {
            return; // Not applicable.
        }
        $WP_Rewrite = $GLOBALS['wp_rewrite'];

        if (!empty($_REQUEST[$this->var])) {
            $transient_hash = (string) $_REQUEST[$this->var];
        } elseif (mb_stripos($_SERVER['REQUEST_URI'] ?? '', '/'.$this->slug.'/') !== false && $WP_Rewrite->using_mod_rewrite_permalinks()) {
            $base_path = $this->c::mbRTrim((string) $this->c::parseUrl(home_url('/'), PHP_URL_PATH), '/');
            $path      = $base_path ? mb_substr($this->c::currentPath(), mb_strlen($base_path)) : $this->c::currentPath();

            if ($path && preg_match('/^\/'.$this->c::escRegex($this->slug).'\/(?<transient_hash>[^\/]+)(?:\/|$)/ui', $path, $_m)) {
                $transient_hash = $_m['transient_hash'];
            } else {
                return; // Not appplicable; i.e., unable to find transient hash in path.
            }
        } else {
            return; // Not applicable.
        }
        if (!($long_url = $this->s::getTransient('', $transient_hash))) {
            $this->s::dieInvalid(__('Sorry, link expired.', 'wp-sharks-core'));
        }
        wp_redirect($long_url, 301).exit(); // Stop on redirection.
    }
public function onWpLoaded ( ) { if ( $ this -> c :: isCli ( ) ) { return ; // Not applicable. } $ WP_Rewrite = $ GLOBALS [ 'wp_rewrite' ] ; if ( ! empty ( $ _REQUEST [ $ this -> var ] ) ) { $ transient_hash = ( string ) $ _REQUEST [ $ this -> var ] ; } elseif ( mb_stripos ( $ _SERVER [ 'REQUEST_URI' ] ?? '' , '/' . $ this -> slug . '/' ) !== false && $ WP_Rewrite -> using_mod_rewrite_permalinks ( ) ) { $ base_path = $ this -> c :: mbRTrim ( ( string ) $ this -> c :: parseUrl ( home_url ( '/' ) , PHP_URL_PATH ) , '/' ) ; $ path = $ base_path ? mb_substr ( $ this -> c :: currentPath ( ) , mb_strlen ( $ base_path ) ) : $ this -> c :: currentPath ( ) ; if ( $ path && preg_match ( '/^\/' . $ this -> c :: escRegex ( $ this -> slug ) . '\/(?<transient_hash>[^\/]+)(?:\/|$)/ui' , $ path , $ _m ) ) { $ transient_hash = $ _m [ 'transient_hash' ] ; } else { return ; // Not appplicable; i.e., unable to find transient hash in path. } } else { return ; // Not applicable. } if ( ! ( $ long_url = $ this -> s :: getTransient ( '' , $ transient_hash ) ) ) { $ this -> s :: dieInvalid ( __ ( 'Sorry, link expired.' , 'wp-sharks-core' ) ) ; } wp_redirect ( $ long_url , 301 ) . exit ( ) ; // Stop on redirection. }
Transient redirects.

@since 160704 Transient utils.
Transient redirects .