Skip to content

Commit

Permalink
Bring back old open_OPML method for adding, instead of subscribing to…
Browse files Browse the repository at this point in the history
… OPML files.
  • Loading branch information
AramZS committed Jul 25, 2015
1 parent c84e992 commit 363dcfd
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions includes/opml/reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,35 @@ public function get_opml_properties( $simple_xml_obj ) {
return $array;
}

function open_OPML($file) {
pf_log('open_OPML invoked.');
if(1 == ini_get('allow_url_fopen')){
pf_log('Using simplexml_load_file to load OPML.');
$file = simplexml_load_file($file);
} else {
pf_log('Using cURL to load OPML file.');
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $file);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
$file = simplexml_load_string($data);
}
#echo '<pre>'; var_dump($data); #die();
if (empty($file)) {
pf_log('Received an empty file.');
return false;
} else {
pf_log('Received:');
pf_log($file);
$opml_data = $file;
return $opml_data;
}
}


# Pass the URL and if you want to return an array of objects or of urls.
# @todo remove this function
function get_OPML_data($url, $is_array = true){
Expand Down

0 comments on commit 363dcfd

Please sign in to comment.