mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-23 01:55:27 +03:00
core: split and rename BridgeAbstract::file_get_html
We need to have one method to get the data, potentially using the proxy if defined, and one method to get the Simple DOM HTML object from these data, with a more informative name Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
d71674d2ba
commit
f43bbda83e
1 changed files with 17 additions and 4 deletions
|
@ -105,7 +105,7 @@ abstract class BridgeAbstract implements BridgeInterface{
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function file_get_html($url, $use_include_path = false, $context=null, $offset = -1, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT){
|
protected function getContents($url,$use_include_path=false,$context=null,$offset=0,$maxlen=null){
|
||||||
$contextOptions = array(
|
$contextOptions = array(
|
||||||
'http' => array(
|
'http' => array(
|
||||||
'user_agent'=>ini_get('user_agent')
|
'user_agent'=>ini_get('user_agent')
|
||||||
|
@ -125,9 +125,22 @@ abstract class BridgeAbstract implements BridgeInterface{
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return file_get_html($url,$use_include_path,$context,$offset,$maxLen,
|
|
||||||
$lowercase,$forceTagsClosed,$target_charset,$stripRN,$defaultBRText,
|
if(is_null($maxlen)){
|
||||||
$defaultSpanText);
|
$content=@file_get_contents($url, $use_include_path, $context, $offset);
|
||||||
|
}else{
|
||||||
|
$content=@file_get_contents($url, $use_include_path, $context, $offset,$maxlen);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($content===false){
|
||||||
|
$this->message('Cant\'t download '.$url );
|
||||||
|
}
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getSimpleHTMLDOM($url, $use_include_path = false, $context=null, $offset = 0, $maxLen=null, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT){
|
||||||
|
$content=$this->getContents($url,$use_include_path,$context,$offset,$maxLen);
|
||||||
|
return str_get_html($content,$lowercase,$forceTagsClosed,$target_charset,$stripRN,$defaultBRText,$defaultSpanText);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue