Rename proxy functions
This commit is contained in:
parent
a1e4432881
commit
72a7d43b0f
@ -65,13 +65,13 @@ Router\get_action('show', function() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$image_proxy = Model\Config\get('image_proxy');
|
$image_proxy = (bool) Model\Config\get('image_proxy');
|
||||||
|
|
||||||
// add the image proxy if requested and required
|
// add the image proxy if requested and required
|
||||||
$item['content'] = Model\Proxy\addProxyToTags($item['content'], $item['url'], $image_proxy, $feed['cloak_referrer']);
|
$item['content'] = Model\Proxy\rewrite_html($item['content'], $item['url'], $image_proxy, $feed['cloak_referrer']);
|
||||||
|
|
||||||
if ($image_proxy && strpos($item['enclosure_type'], 'image') === 0) {
|
if ($image_proxy && strpos($item['enclosure_type'], 'image') === 0) {
|
||||||
$item['enclosure'] = Model\Proxy\addProxyToLink($item['enclosure']);
|
$item['enclosure'] = Model\Proxy\rewrite_link($item['enclosure']);
|
||||||
}
|
}
|
||||||
|
|
||||||
Response\html(Template\layout('show_item', array(
|
Response\html(Template\layout('show_item', array(
|
||||||
@ -120,7 +120,7 @@ Router\post_action('download-item', function() {
|
|||||||
$feed = Model\Feed\get($item['feed_id']);
|
$feed = Model\Feed\get($item['feed_id']);
|
||||||
|
|
||||||
$download = Model\Item\download_content_id($id);
|
$download = Model\Item\download_content_id($id);
|
||||||
$download['content'] = Model\Proxy\addProxyToTags($download['content'], $item['url'], Model\Config\get('image_proxy'), $feed['cloak_referrer']);
|
$download['content'] = Model\Proxy\rewrite_html($download['content'], $item['url'], Model\Config\get('image_proxy'), $feed['cloak_referrer']);
|
||||||
|
|
||||||
Response\json($download);
|
Response\json($download);
|
||||||
});
|
});
|
||||||
|
@ -9,7 +9,7 @@ use PicoFeed\Filter\Filter;
|
|||||||
use PicoFeed\Client\Client;
|
use PicoFeed\Client\Client;
|
||||||
use PicoFeed\Logging\Logger;
|
use PicoFeed\Logging\Logger;
|
||||||
|
|
||||||
function addProxyToLink($link)
|
function rewrite_link($link)
|
||||||
{
|
{
|
||||||
if (Helper\is_secure_connection() && strpos($link, 'http:') === 0) {
|
if (Helper\is_secure_connection() && strpos($link, 'http:') === 0) {
|
||||||
$link = '?action=proxy&url='.rawurlencode($link);
|
$link = '?action=proxy&url='.rawurlencode($link);
|
||||||
@ -18,7 +18,7 @@ function addProxyToLink($link)
|
|||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addProxyToTags($html, $website, $proxy_images, $cloak_referrer)
|
function rewrite_html($html, $website, $proxy_images, $cloak_referrer)
|
||||||
{
|
{
|
||||||
if ($html === '' // no content, no proxy
|
if ($html === '' // no content, no proxy
|
||||||
|| (! $cloak_referrer && ! $proxy_images) // neither cloaking nor proxing enabled
|
|| (! $cloak_referrer && ! $proxy_images) // neither cloaking nor proxing enabled
|
||||||
|
Loading…
Reference in New Issue
Block a user