Created
February 11, 2012 17:12
-
-
Save Pross/1802536 to your computer and use it in GitHub Desktop.
Simple class plugin
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 | |
/* | |
Plugin Name: Demo | |
Plugin URI: http://www.xxxx | |
Author: Name... | |
Author URI: http://www.xxxx | |
Demo: http://www.xxxxx | |
External: http://www.xxxxx | |
Description: A simple demo | |
PageLines: true | |
Version: 1.0 | |
*/ | |
class DemoClassName { | |
/** | |
* Construct, always run when class is initiated | |
* | |
*/ | |
function __construct() { | |
$this->init(); | |
if ( !is_admin() ) | |
add_action( 'wp_footer', array( &$this, 'test_function' ) ); | |
} | |
function test_function() { | |
echo sprintf( '<p>Hello %s</p>', $this->val ); | |
} | |
function init() { | |
// this is being called from the contructor, so its gonna be run everywhere! | |
$this->val = 'World!'; | |
} | |
} // class end | |
// this starts the plugin code. | |
new DemoClassName; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment