protected function viaWordPress(string $string): string
    {
        if (!$this->c::isWordPress()
            || !$this->c::canCallFunc('wp_oembed_get')
            || !$this->c::canCallFunc('wp_embed_defaults')) {
            throw $this->c::issue('Unable to oEmbed via WordPress.');
        }
        $oembed_args = array_merge(wp_embed_defaults(), ['discover' => false]);
        $string      = preg_replace_callback('/^\s*(https?:\/\/[^\s"]+)\s*$/uim', function ($m) use ($oembed_args) {
            $oembed = wp_oembed_get($m[1], $oembed_args);
            return $oembed ? $oembed : $m[0];
        }, $string);

        return $string;
    }
protected function viaWordPress(string $string): string
    {
        if (!$this->c::isWordPress()
            || !$this->c::canCallFunc('wp_oembed_get')
            || !$this->c::canCallFunc('wp_embed_defaults')) {
            throw $this->c::issue('Unable to oEmbed via WordPress.');
        }
        $oembed_args = array_merge(wp_embed_defaults(), ['discover' => false]);
        $string      = preg_replace_callback('/^\s*(https?:\/\/[^\s"]+)\s*$/uim', function ($m) use ($oembed_args) {
            $oembed = wp_oembed_get($m[1], $oembed_args);
            return $oembed ? $oembed : $m[0];
        }, $string);

        return $string;
    }
protected function viaWordPress ( string $ string ) : string { if ( ! $ this -> c :: isWordPress ( ) || ! $ this -> c :: canCallFunc ( 'wp_oembed_get' ) || ! $ this -> c :: canCallFunc ( 'wp_embed_defaults' ) ) { throw $ this -> c :: issue ( 'Unable to oEmbed via WordPress.' ) ; } $ oembed_args = array_merge ( wp_embed_defaults ( ) , [ 'discover' => false ] ) ; $ string = preg_replace_callback ( '/^\s*(https?:\/\/[^\s"]+)\s*$/uim' , function ( $ m ) use ( $ oembed_args ) { $ oembed = wp_oembed_get ( $ m [ 1 ] , $ oembed_args ) ; return $ oembed ? $ oembed : $ m [ 0 ] ; } , $ string ) ; return $ string ; }
Via WordPress.

@since 151125 OEmbed utilities.

@param string $string String to parse.
Via WordPress .