Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
SimplePie_Exception example
else
{
return
false;
}
}
public
function
get_base
(
)
{
if
(
$this
->dom === null
)
{
throw
new
SimplePie_Exception
(
'DOMDocument not found, unable to use locator'
)
;
}
$this
->http_base =
$this
->file->url;
$this
->base =
$this
->http_base;
$elements
=
$this
->dom->
getElementsByTagName
(
'base'
)
;
foreach
(
$elements
as
$element
)
{
if
(
$element
->
hasAttribute
(
'href'
)
)
{
$base
=
$this
->registry->
call
(
'Misc', 'absolutize_url', array
(
trim
(
$element
->
getAttribute
(
'href'
)
)
,
$this
->http_base
)
)
;
if
(
$base
=== false
)
{
if
(
$type
& SIMPLEPIE_CONSTRUCT_BASE64
)
{
$data
=
base64_decode
(
$data
)
;
}
if
(
$type
&
(
SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML
)
)
{
if
(
!
class_exists
(
'DOMDocument'
)
)
{
throw
new
SimplePie_Exception
(
'DOMDocument not found, unable to use sanitizer'
)
;
}
$document
=
new
DOMDocument
(
)
;
$document
->encoding = 'UTF-8';
$data
=
$this
->
preprocess
(
$data
,
$type
)
;
set_error_handler
(
array
(
'SimplePie_Misc', 'silence_errors'
)
)
;
$document
->
loadHTML
(
$data
)
;
restore_error_handler
(
)
;
$xpath
=
new
DOMXPath
(
$document
)
;