Commits

Michael Rog committed 9c45923

had to change the name due to conflicts with OmniLogger's internals. everything seems to work now.

Comments (0)

Files changed (9)

-RogEE "OmniLogger"
+RogEE "Template OmniLogger"
 a plugin for ExpressionEngine 2
 by Michael Rog
 
 http://rog.ee/omnilogger
 
+version 0.2.0
+
 Requires OmniLog (created by Stephen Lewis):
 http://experienceinternet.co.uk/software/omnilog/
 

system/expressionengine/third_party/omnilogger/config.php

-<?php
-
-/*
-=====================================================
-
-RogEE "OmniLogger"
-a plugin for ExpressionEngine 2
-by Michael Rog
-
-Contact Michael with questions, feedback, suggestions, bugs, etc.
->> http://rog.ee/omnilogger
->> http://devot-ee.com/add-ons/omnilogger
-
-This extension is compatible with NSM Addon Updater:
->> http://ee-garage.com/nsm-addon-updater
-
-Changelog:
->> http://rog.ee/versions/omnilogger
-
-=====================================================
-
-*/
-
-if (!defined('ROGEE_OMNILOGGER_NAME') OR !defined('ROGEE_OMNILOGGER_VER'))
-{
-	define('ROGEE_OMNILOGGER_NAME', 'OmniLogger [RogEE]');
-	define('ROGEE_OMNILOGGER_VER',  '0.1.0');
-	define('ROGEE_OMNILOGGER_AUTHOR', 'Michael Rog');
-	define('ROGEE_OMNILOGGER_AUTHOR_URL', 'http://rog.ee');
-	define('ROGEE_OMNILOGGER_DESC', 'Creates OmniLog entries from EE templates');
-	define('ROGEE_OMNILOGGER_DOCS', 'http://rog.ee/omnilogger');
-}
-
-// NSM Addon Updater
-$config['name'] = ROGEE_OMNILOGGER_NAME;
-$config['version'] = ROGEE_OMNILOGGER_VER;
-$config['nsm_addon_updater']['versions_xml'] = 'http://rog.ee/versions/omnilogger';
-
-/*
-End of file:	config.php
-File location:	system/expressionengine/third_party/omnilogger/config.php
-*/

system/expressionengine/third_party/omnilogger/helpers/rogee_helpers_model.php

-<?php
-
-if (!defined('APP_VER') || !defined('BASEPATH')) { exit('No direct script access allowed'); }
-
-/**
- * ==============================================
- * Rogee_helpers_model class
- * ==============================================
- *
- * Provides various helper methods
- *
- * @package RogEE
- * @author Michael Rog <michael@michaelrog.com>
- *
- */
-class Rogee_helpers_model extends CI_Model {
-
-
-	/**
-	* ==============================================
-	* Constructor
-	* ==============================================
-	*
-	* @access	public
-	* @return	void
-	*
-	*/
-	public function __construct()
-	{
-	
-		parent::__construct();
-		
-		$this->EE =& get_instance();
-	
-	} // END Constructor
-
-
-	/**
-	* ==============================================
-	* param()
-	* ==============================================
-	*
-	* Fetches a parameter
-	*
-	* @access	public
-	* @param
-	* @return	void
-	*
-	*/
-	private function param($param, $default = FALSE, $boolean = FALSE, $required = FALSE)
-	{
-	
-		$name = $param;
-		$param = $this->EE->TMPL->fetch_param($param);
-	
-		if(!$param && $required)
-		{
-			show_error('You must define a "'.$name.'" parameter in the '.__CLASS__.' tag.');
-		}
-	
-		if($param === FALSE && $default !== FALSE)
-		{
-			$param = $default;
-		}
-		
-		if($param !== FALSE && $boolean)
-		{				
-			$param = strtolower($param);
-			$param = ($param == 'true' || $param == 'yes' || $param == 'y' || $param == 'on' || $param == '1') ? TRUE : FALSE;
-		}
-	
-		return $param;
-		
-	} // END param()
-
-
-}
-
-
-/* End of file      : rogee_helpers_model.php */
-/* File location    : third_party/omnilog/models/rogee_helpers_model.php */

system/expressionengine/third_party/omnilogger/helpers/rogee_omnilog_model.php

-<?php
-
-if (!defined('APP_VER') || !defined('BASEPATH')) { exit('No direct script access allowed'); }
-
-/**
- * ==============================================
- * Rogee_omnilog_model class
- * ==============================================
- *
- * Provides methods for connecting to OmniLog and creating a log entry
- *
- * @package RogEE
- * @author Michael Rog <michael@michaelrog.com>
- *
- */
-class Rogee_omnilog_model extends CI_Model {
-
-
-	/**
-	* ==============================================
-	* Constructor
-	* ==============================================
-	*
-	* @access	public
-	* @return	void
-	*
-	*/
-	public function __construct()
-	{
-	
-		parent::__construct();
-		
-		// Load the OmniLogger class.
-		if (file_exists(PATH_THIRD.'omnilog/classes/omnilogger'.EXT))
-		{
-			include_once PATH_THIRD.'omnilog/classes/omnilogger'.EXT;
-		}
-	
-	} // END Constructor
-
-
-	/**
-	* ==============================================
-	* log_message()
-	* ==============================================
-	*
-	* Logs a message to OmniLog.
-	*
-	* @access	public
-	* @param	string $source: The source of the message.
-	* @param	string $message: The log entry message.
-	* @param	int $severity: The log entry 'level'.
-	* @param	boolean $notify: Whether to nofity the site admin
-	* @param	array $emails: An array of "admin" email addresses.
-	* @param	string $extended_data: Additional data.
-	* @return	void
-	*
-	*/
-	public function log_message(
-		$source,
-		$message,
-		$severity = 1,
-		$notify = FALSE,
-		Array $emails = array(),
-		$extended_data = ''
-	)
-	{
-		
-		if (class_exists('Omnilog_entry') && class_exists('Omnilogger'))
-		{
-		
-			switch ($severity)
-			{
-				case 3:
-				$type = Omnilog_entry::ERROR;
-				break;
-				
-				case 2:
-				$type = Omnilog_entry::WARNING;
-				break;
-				
-				case 1:
-				default:
-				$type = Omnilog_entry::NOTICE;
-				break;
-			}
-			
-			$omnilog_entry = new Omnilog_entry(array(
-				'addon_name'    => $source,
-				'admin_emails'  => $emails,
-				'date'          => time(),
-				'extended_data' => $extended_data,
-				'message'       => $message,
-				'notify_admin'  => $notify,
-				'type'          => $type
-			));
-			
-			Omnilogger::log($omnilog_entry);
-			
-		}
-		
-	} // END make_log_entry()
-
-
-}
-
-
-/* End of file      : rogee_omnilog_model.php */
-/* File location    : third_party/omnilog/models/rogee_omnilog_model.php */

system/expressionengine/third_party/omnilogger/pi.omnilogger.php

-<?php
-
-/*
-=====================================================
-
-RogEE "OmniLogger"
-an plugin for ExpressionEngine 2
-by Michael Rog
-
-Contact Michael with questions, feedback, suggestions, bugs, etc.
->> http://rog.ee/omnilogger
-
-=====================================================
-*/
-
-if (!defined('APP_VER') || !defined('BASEPATH')) { exit('No direct script access allowed'); }
-
-// -----------------------------------------
-//	Here goes nothin...
-// -----------------------------------------
-
-require_once PATH_THIRD.'omnilogger/config.php';
-
-$plugin_info = array(
-	'pi_name'		=> ROGEE_OMNILOGGER_NAME,
-	'pi_version'	=> ROGEE_OMNILOGGER_VERSION,
-	'pi_author'		=> ROGEE_OMNILOGGER_AUTHOR,
-	'pi_author_url'	=> ROGEE_OMNILOGGER_AUTHOR_URL,
-	'pi_description'=> 'Creates OmniLog entries from your templates',
-	'pi_usage'		=> Omnilogger::usage()
-);
-
-/**
- * ==============================================
- * OmniLogger class, for ExpressionEngine 2
- * ==============================================
- *
- * @package OmniLogger
- * @author Michael Rog <michael@michaelrog.com>
- * @copyright 2012 Michael Rog
- * @see http://rog.ee/omnilogger
- *
- */
-class Omnilogger {
-
-	public $return_data;
-    
-	/**
-	* ==============================================
-	* Constructor
-	* ==============================================
-	*
-	* @access  public
-	* @return  void
-	*
-	*/
-	public function __construct()
-	{
-	
-		$this->EE =& get_instance();
-		
-		$this->return_data = $this->EE->TMPL->tagdata;
-		
-		// Load the RogEE helpers model
-		$this->EE->load->model('rogee_helpers_model');
-		$this->$H = $this->EE->rogee_helpers_model;
-	
-	} // END Constructor
-
-
-	/**
-	* ==============================================
-	* make_log_entry()
-	* ==============================================
-	*
-	* The magic happens here.
-	*
-	* @access private
-	* @return void
-	*
-	*/
-	private function make_log_entry()
-	{	
-		
-		// Fetch params from template
-		// params for param() method: $param, $default, $boolean, $required
-		
-		$l_source = $this->$H->param('source', '[Template]');
-
-		$l_message = $this->$H->param('message', '');
-		
-		switch ($this->$H->param('type', 'notice'))
-		{
-		
-			case "error":
-			$l_severity = 3;
-			break;
-			
-			case "warning":
-			$l_severity = 2;
-			break;
-			
-			case "notice":
-			default:
-			$l_severity = 1;
-			break;
-			
-		}
-
-		$l_notify = $this->$H->param('notify_admin', FALSE, TRUE);
-
-		$l_emails = explode(",", preg_replace('/\s+/', '', $this->$H->param('admin_emails', '')));
-
-		$l_extended_data = $this->EE->TMPL->tagdata;
-	
-		// Load the RogEE OmniLog model
-		$this->EE->load->model('rogee_omnilog_model');
-		$L = $this->EE->rogee_omnilog_model;
-		
-		// Log the message in OmniLog
-		// params for log_message() method: $source, $message, $severity, $notify, $emails, $extended_data
-		$L->log_message($l_source, $l_message, $l_severity, $l_notify, $l_emails, $l_extended_data);
-		
-	} // END make_log_entry()
-
-	
-	/**
-	* ==============================================
-	* usage()
-	* ==============================================
-	*
-	* Provides usage information for display in the control panel
-	*
-	* @return string
-	*
-	*/
-	public static function usage()
-	{
-		ob_start();
-		?>
-
-		<?php
-		$buffer = ob_get_contents();
-		ob_end_clean();
-		return $buffer;
-	} // END usage()
-	
-	
-}
-
-/*
-End of file:	pi.omnilogger.php
-File location:	system/expressionengine/third_party/omnilogger/pi.omnilogger.php
-*/

system/expressionengine/third_party/template_omnilogger/config.php

+<?php
+
+/*
+=====================================================
+
+RogEE "Template OmniLogger"
+a plugin for ExpressionEngine 2
+by Michael Rog
+
+Contact Michael with questions, feedback, suggestions, bugs, etc.
+>> http://rog.ee/template_omnilogger
+
+=====================================================
+
+*/
+
+if (!defined('ROGEE_TEMPLATE_OMNILOGGER_NAME'))
+{
+	define('ROGEE_TEMPLATE_OMNILOGGER_NAME', 'Template OmniLogger [RogEE]');
+	define('ROGEE_TEMPLATE_OMNILOGGER_VERSION',  '0.2.0');
+	define('ROGEE_TEMPLATE_OMNILOGGER_AUTHOR', 'Michael Rog');
+	define('ROGEE_TEMPLATE_OMNILOGGER_AUTHOR_URL', 'http://rog.ee');
+	define('ROGEE_TEMPLATE_OMNILOGGER_DESC', 'Creates OmniLog entries from EE templates');
+	define('ROGEE_TEMPLATE_OMNILOGGER_DOCS', 'http://rog.ee/template_omnilogger');
+}
+
+// NSM Addon Updater
+$config['name'] = ROGEE_TEMPLATE_OMNILOGGER_NAME;
+$config['version'] = ROGEE_TEMPLATE_OMNILOGGER_VERSION;
+$config['nsm_addon_updater']['versions_xml'] = 'http://rog.ee/versions/template_omnilogger';
+
+/*
+End of file:	config.php
+File location:	system/expressionengine/third_party/template_omnilogger/config.php
+*/

system/expressionengine/third_party/template_omnilogger/models/rogee_helpers_model.php

+<?php
+
+if (!defined('APP_VER') || !defined('BASEPATH')) { exit('No direct script access allowed'); }
+
+/**
+ * ==============================================
+ * Rogee_helpers_model class
+ * ==============================================
+ *
+ * Provides various helper methods
+ *
+ * @package RogEE
+ * @author Michael Rog <michael@michaelrog.com>
+ *
+ */
+class Rogee_helpers_model extends CI_Model {
+
+	private $EE;
+
+	/**
+	* ==============================================
+	* Constructor
+	* ==============================================
+	*
+	* @access	public
+	* @return	void
+	*
+	*/
+	public function __construct()
+	{
+	
+		parent::__construct();
+		
+		$this->EE =& get_instance();
+	
+	} // END Constructor
+
+
+	/**
+	* ==============================================
+	* param()
+	* ==============================================
+	*
+	* Fetches a parameter
+	*
+	* @access	public
+	* @param
+	* @return	void
+	*
+	*/
+	public function param($param, $default = FALSE, $boolean = FALSE, $required = FALSE)
+	{
+	
+		$name = $param;
+		$param = $this->EE->TMPL->fetch_param($param);
+	
+		if(!$param && $required)
+		{
+			show_error('You must define a "'.$name.'" parameter in the '.__CLASS__.' tag.');
+		}
+	
+		if($param === FALSE && $default !== FALSE)
+		{
+			$param = $default;
+		}
+		
+		if($param !== FALSE && $boolean)
+		{				
+			$param = strtolower($param);
+			$param = ($param == 'true' || $param == 'yes' || $param == 'y' || $param == 'on' || $param == '1') ? TRUE : FALSE;
+		}
+	
+		return $param;
+		
+	} // END param()
+
+
+}
+
+
+/* End of file      : rogee_helpers_model.php */
+/* File location    : third_party/omnilog/models/rogee_helpers_model.php */

system/expressionengine/third_party/template_omnilogger/models/rogee_omnilog_model.php

+<?php
+
+if (!defined('APP_VER') || !defined('BASEPATH')) { exit('No direct script access allowed'); }
+
+/**
+ * ==============================================
+ * Rogee_omnilog_model class
+ * ==============================================
+ *
+ * Provides methods for connecting to OmniLog and creating a log entry
+ *
+ * @package RogEE
+ * @author Michael Rog <michael@michaelrog.com>
+ *
+ */
+class Rogee_omnilog_model extends CI_Model {
+
+
+	/**
+	* ==============================================
+	* Constructor
+	* ==============================================
+	*
+	* @access	public
+	* @return	void
+	*
+	*/
+	public function __construct()
+	{
+	
+		parent::__construct();
+		
+		// Load the OmniLogger class.
+		if (file_exists(PATH_THIRD.'omnilog/classes/omnilogger'.EXT))
+		{
+			include_once PATH_THIRD.'omnilog/classes/omnilogger'.EXT;
+		}
+	
+	} // END Constructor
+
+
+	/**
+	* ==============================================
+	* log_message()
+	* ==============================================
+	*
+	* Logs a message to OmniLog.
+	*
+	* @access	public
+	* @param	string $source: The source of the message.
+	* @param	string $message: The log entry message.
+	* @param	int $severity: The log entry 'level'.
+	* @param	boolean $notify: Whether to nofity the site admin
+	* @param	array $emails: An array of "admin" email addresses.
+	* @param	string $extended_data: Additional data.
+	* @return	void
+	*
+	*/
+	public function log_message(
+		$source,
+		$message,
+		$severity = 1,
+		$notify = FALSE,
+		Array $emails = array(),
+		$extended_data = ''
+	)
+	{
+		
+		if (class_exists('Omnilog_entry') && class_exists('Omnilogger'))
+		{
+		
+			switch ($severity)
+			{
+				case 3:
+				$type = Omnilog_entry::ERROR;
+				break;
+				
+				case 2:
+				$type = Omnilog_entry::WARNING;
+				break;
+				
+				case 1:
+				default:
+				$type = Omnilog_entry::NOTICE;
+				break;
+			}
+			
+			$omnilog_entry = new Omnilog_entry(array(
+				'addon_name'    => $source,
+				'admin_emails'  => $emails,
+				'date'          => time(),
+				'extended_data' => $extended_data,
+				'message'       => $message,
+				'notify_admin'  => $notify,
+				'type'          => $type
+			));
+			
+			Omnilogger::log($omnilog_entry);
+			
+		}
+		
+	} // END make_log_entry()
+
+
+}
+
+
+/* End of file      : rogee_omnilog_model.php */
+/* File location    : third_party/omnilog/models/rogee_omnilog_model.php */

system/expressionengine/third_party/template_omnilogger/pi.template_omnilogger.php

+<?php
+
+/*
+=====================================================
+
+RogEE "Template OmniLogger"
+a plugin for ExpressionEngine 2
+by Michael Rog
+
+Contact Michael with questions, feedback, suggestions, bugs, etc.
+>> http://rog.ee/template_omnilogger
+
+=====================================================
+*/
+
+if (!defined('APP_VER') || !defined('BASEPATH')) { exit('No direct script access allowed'); }
+
+// -----------------------------------------
+//	Here goes nothin...
+// -----------------------------------------
+
+require_once PATH_THIRD.'template_omnilogger/config.php';
+
+$plugin_info = array(
+	'pi_name'		=> ROGEE_TEMPLATE_OMNILOGGER_NAME,
+	'pi_version'	=> ROGEE_TEMPLATE_OMNILOGGER_VERSION,
+	'pi_author'		=> ROGEE_TEMPLATE_OMNILOGGER_AUTHOR,
+	'pi_author_url'	=> ROGEE_TEMPLATE_OMNILOGGER_AUTHOR_URL,
+	'pi_description'=> 'Creates OmniLog entries from your templates',
+	'pi_usage'		=> Template_omnilogger::usage()
+);
+
+/**
+ * ==============================================
+ * Template OmniLogger class, for ExpressionEngine 2
+ * ==============================================
+ *
+ * @package Template_omniLogger
+ * @author Michael Rog <michael@michaelrog.com>
+ * @copyright 2012 Michael Rog
+ * @see http://rog.ee/template_omnilogger
+ *
+ */
+class Template_omnilogger {
+
+	private $EE;
+	private $H;
+
+	public $return_data;
+    
+	/**
+	* ==============================================
+	* Constructor
+	* ==============================================
+	*
+	* @access  public
+	* @return  void
+	*
+	*/
+	public function __construct()
+	{
+	
+		$this->EE =& get_instance();
+		
+		// Load the RogEE helpers model
+		$this->EE->load->model('rogee_helpers_model');
+		$this->H = $this->EE->rogee_helpers_model;
+		
+		// Create the appropriate log entry
+		$this->make_log_entry();
+		
+		// If echo is on, pass the tag data to the template
+		$this->return_data = ($this->H->param('echo', 'off', TRUE)) ? $this->EE->TMPL->tagdata : "";
+	
+	} // END Constructor
+
+
+	/**
+	* ==============================================
+	* make_log_entry()
+	* ==============================================
+	*
+	* The magic happens here.
+	*
+	* @access private
+	* @return void
+	*
+	*/
+	private function make_log_entry()
+	{	
+		
+		// Fetch params from template
+		// params for param() method: $param, $default, $boolean, $required
+		
+		$l_source = $this->H->param('source', '[Template]');
+
+		$l_message = $this->H->param('message', '');
+		
+		switch ($this->H->param('type', 'notice'))
+		{
+		
+			case "error":
+			$l_severity = 3;
+			break;
+			
+			case "warning":
+			$l_severity = 2;
+			break;
+			
+			case "notice":
+			default:
+			$l_severity = 1;
+			break;
+			
+		}
+
+		$l_notify = $this->H->param('notify_admin', FALSE, TRUE);
+
+		$l_emails = explode(",", preg_replace('/\s+/', '', $this->H->param('admin_emails', '')));
+
+		$l_extended_data = $this->EE->TMPL->tagdata;
+	
+		// Load the RogEE OmniLog model
+		$this->EE->load->model('rogee_omnilog_model');
+		$L = $this->EE->rogee_omnilog_model;
+		
+		// Log the message in OmniLog
+		// params for log_message() method: $source, $message, $severity, $notify, $emails, $extended_data
+		$L->log_message($l_source, $l_message, $l_severity, $l_notify, $l_emails, $l_extended_data);
+		
+	} // END make_log_entry()
+
+	
+	/**
+	* ==============================================
+	* usage()
+	* ==============================================
+	*
+	* Provides usage information for display in the control panel
+	*
+	* @return string
+	*
+	*/
+	public static function usage()
+	{
+		ob_start();
+		?>
+
+		<?php
+		$buffer = ob_get_contents();
+		ob_end_clean();
+		return $buffer;
+	} // END usage()
+	
+	
+}
+
+/*
+End of file:	pi.template_omnilogger.php
+File location:	system/expressionengine/third_party/template_omnilogger/pi.template_omnilogger.php
+*/