Added before_parse_content & after_parse_content hooks. content_parsed

hook is depreciated. Updated get_protocol() method.
This commit is contained in:
Gilbert Pellegrom 2013-10-23 10:19:24 +01:00
parent 9616d902e0
commit 022334ff13
2 changed files with 20 additions and 9 deletions

View file

@ -58,8 +58,11 @@ class Pico {
$meta = $this->read_file_meta($content);
$this->run_hooks('file_meta', array(&$meta));
$this->run_hooks('before_parse_content', array(&$content));
$content = $this->parse_content($content);
$this->run_hooks('content_parsed', array(&$content));
$this->run_hooks('after_parse_content', array(&$content));
$this->run_hooks('content_parsed', array(&$content)); // Depreciated @ v0.8
// Get all the pages
$pages = $this->get_pages($settings['base_url'], $settings['pages_order_by'], $settings['pages_order'], $settings['excerpt_length']);
@ -302,8 +305,11 @@ class Pico {
*/
private function get_protocol()
{
preg_match("|^HTTP[S]?|is",$_SERVER['SERVER_PROTOCOL'],$m);
return strtolower($m[0]);
$protocol = 'http';
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'){
$protocol = 'https';
}
return $protocol;
}
/**

View file

@ -12,6 +12,11 @@ class Pico_Plugin {
public function plugins_loaded()
{
}
public function config_loaded(&$settings)
{
}
public function request_url(&$url)
@ -39,11 +44,6 @@ class Pico_Plugin {
}
public function config_loaded(&$settings)
{
}
public function before_read_file_meta(&$headers)
{
@ -52,9 +52,14 @@ class Pico_Plugin {
public function file_meta(&$meta)
{
}
public function before_parse_content(&$content)
{
}
public function content_parsed(&$content)
public function after_parse_content(&$content)
{
}