Created
June 16, 2011 22:17
-
-
Save erikreagan/1030428 to your computer and use it in GitHub Desktop.
Sample plugin for Focus Lab, LLC blog article: http://focuslabllc.com/blog/utilizing-the-template-debugger-in-expressionengine-add-ons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
$plugin_info = array( | |
'pi_name' => 'Log Me', | |
'pi_version' => '1.0.0', | |
'pi_author' => 'Erik Reagan', | |
'pi_author_url' => 'http://focuslabllc.com', | |
'pi_description' => 'Sample template logging', | |
'pi_usage' => '' | |
); | |
class Log_me { | |
public $return_data = ""; | |
// Support for pre 2.1.3 builds | |
public function Log_me() { $this->__construct(); } | |
/** | |
* Constructor | |
* | |
* Default function when a plugin doesn't have | |
* a third parameter in the tag | |
*/ | |
public function __construct() | |
{ | |
$this->EE =& get_instance(); | |
$this->_log_item('Log Me: See! This was easy!'); | |
$this->_log_item('Look, ma! I\'m indented.', 2); | |
$this->return_data = 'Done.'; | |
} | |
// End function __construct() | |
/** | |
* Write items to template debugging log | |
* | |
* @param string String to log | |
* @param int Tab indention | |
* @access private | |
* @return void | |
*/ | |
private function _log_item($string = FALSE, $indent = 1) | |
{ | |
if ($string) | |
{ | |
$tab = str_repeat(' ', 7 * $indent); | |
$this->EE->TMPL->log_item($tab . '- ' . $string); | |
} | |
} | |
// End function _log_item() | |
} | |
// End class Log_me | |
/* End of file pi.log_me.php */ | |
/* Location: ./system/expressionengine/third_party/log_me/pi.log_me.php */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment