Changeset 395057
- Timestamp:
- 06/09/2011 11:45:33 AM (15 years ago)
- Location:
- presstest/trunk
- Files:
-
- 2 edited
-
PressTest.php (modified) (1 diff)
-
pt-core.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
presstest/trunk/PressTest.php
r395056 r395057 35 35 */ 36 36 37 /** 38 * Start your engines! 39 */ 37 /** The core plugin class */ 40 38 require "pt-core.php"; 41 39 42 new PT_Core(); 40 /** Start your engines! */ 41 PT_Core::init(); -
presstest/trunk/pt-core.php
r395056 r395057 20 20 /** 21 21 * Initialize the plugin for the first time; otherwise do nothing. 22 * @see init22 * @see __construct 23 23 */ 24 public function __construct () { 25 if( !isset( self::$instance ) ) 26 self::$instance = $this->init(); 24 public function init() { 25 if( !isset( self::$instance ) ) { 26 $c = __CLASS__; 27 self::$instance = new $c; 28 } 29 return self::$instance; 27 30 } 28 31 29 /** 30 * Initialize the plugin. 31 */ 32 public function init() { 33 /**#@+ 34 * Define universal constants. 35 */ 32 /** Initialize the plugin. */ 33 private function __construct() { 34 /**#@+ Define universal constants. */ 36 35 /** Plugin Directory */ 37 36 define( 'PT_DIR', WP_PLUGIN_DIR . '/presstest' ); … … 39 38 define( 'PT_URL', plugins_url( 'presstest' ) ); 40 39 /**#@-*/ 40 41 /** Add the admin menu page */ 42 add_action( ( is_multisite() )? 'network_admin_menu' : 'admin_menu', Array( $this, 'admin_page_menu' ) ); 43 } 44 45 /** Register the administrator menu page. */ 46 public function admin_page_menu() { 47 add_menu_page( 'PressTest', 'PressTest', 'administrator', 'presstest', Array( $this, 'admin_page_contents' ) ); 48 } 49 50 /** Generate the general administrator page contents. */ 51 public function admin_page_contents() { 41 52 } 42 53 }
Note: See TracChangeset
for help on using the changeset viewer.