Skip to content

Added option for secure urls parser #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions libraries/RSSParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class RSSParser {
var $cache_dir = './application/cache/'; // Cache directory
var $write_cache_flag = FALSE; // Flag to write to cache - defaulted to false
var $callback = FALSE; // Callback to read custom data
public $isSecure = FALSE;

function RSSParser($callback = FALSE)
{
Expand Down Expand Up @@ -156,7 +157,13 @@ function parse()
}

flock($fp, LOCK_EX);
fwrite($fp, $rawFeed);
if($this->isSecure){
fwrite($fp, str_replace("http://", "https://", $rawFeed));
}
else{
fwrite($fp, $rawFeed);
}

flock($fp, LOCK_UN);
fclose($fp);
}
Expand All @@ -179,6 +186,14 @@ function set_feed_url($url = NULL)
}

// --------------------------------------------------------------------

function set_secure_content($isSecure = FALSE)
{
$this->isSecure = $isSecure;
return $this;
}
// --------------------------------------------------------------------


/* Return the feeds one at a time: when there are no more feeds return false
* @param No of items to return from the feed
Expand Down Expand Up @@ -248,4 +263,4 @@ function clear()
}

/* End of file RSSParser.php */
/* Location: ./application/libraries/RSSParser.php */
/* Location: ./application/libraries/RSSParser.php */