2018-09-01 01:50:29 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Parses post markup in order to use specified spee.ch url for assets
|
|
|
|
*
|
|
|
|
* @package LBRYPress
|
|
|
|
*/
|
|
|
|
|
|
|
|
class LBRY_Speech_Parser
|
|
|
|
{
|
2018-10-24 20:49:46 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Relative url
|
|
|
|
* @param string $url a full url
|
|
|
|
* @return string protocol relative url
|
|
|
|
*/
|
|
|
|
protected function relative_url($url)
|
|
|
|
{
|
|
|
|
return substr($url, strpos($url, '//'));
|
|
|
|
}
|
|
|
|
|
2018-09-14 02:34:11 +02:00
|
|
|
public function rewrite($html)
|
2018-09-01 01:50:29 +02:00
|
|
|
{
|
2018-09-14 02:34:11 +02:00
|
|
|
// TODO: Completely fix this, as its super slow. Looking at cdn_enabler for ideas
|
|
|
|
$speech_url = get_option(LBRY_SETTINGS)[LBRY_SPEECH];
|
|
|
|
|
|
|
|
$html = str_replace(site_url(), $speech_url, $html);
|
|
|
|
|
|
|
|
return $html;
|
2018-09-01 01:50:29 +02:00
|
|
|
}
|
|
|
|
}
|