浏览代码

Added before_parse_content & after_parse_content hooks. content_parsed
hook is depreciated. Updated get_protocol() method.

Gilbert Pellegrom 11 年之前
父节点
当前提交
022334ff13
共有 2 个文件被更改,包括 19 次插入8 次删除
  1. 9 3
      lib/pico.php
  2. 10 5
      plugins/pico_plugin.php

+ 9 - 3
lib/pico.php

@@ -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;
 	}
 	     
 	/**

+ 10 - 5
plugins/pico_plugin.php

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