WPSEO_MyYoast_Proxy::render_proxy_page
Renders the requested proxy page.
This is separated from the exits to be able to test it.
Метод класса: WPSEO_MyYoast_Proxy{}
Хуков нет.
Возвращает
void. Ничего (null).
Использование
$WPSEO_MyYoast_Proxy = new WPSEO_MyYoast_Proxy(); $WPSEO_MyYoast_Proxy->render_proxy_page();
Код WPSEO_MyYoast_Proxy::render_proxy_page() WPSEO MyYoast Proxy::render proxy page Yoast 28.4
public function render_proxy_page() {
$proxy_options = $this->determine_proxy_options();
if ( $proxy_options === [] ) {
// Do not accept any other file than implemented.
$this->set_header( 'HTTP/1.0 501 Requested file not implemented' );
return;
}
// Set the headers before serving the remote file.
$this->set_header( 'Content-Type: ' . $proxy_options['content_type'] );
$this->set_header( 'Cache-Control: max-age=' . self::CACHE_CONTROL_MAX_AGE );
try {
echo $this->get_remote_url_body( $proxy_options['url'] );
} catch ( Exception $e ) {
/*
* Reset the file headers because the loading failed.
*
* Note: Due to supporting PHP 5.2 `header_remove` can not be used here.
* Overwrite the headers instead.
*/
$this->set_header( 'Content-Type: text/plain' );
$this->set_header( 'Cache-Control: max-age=0' );
$this->set_header( 'HTTP/1.0 500 ' . $e->getMessage() );
}
}