Plugin Directory

Changeset 395057


Ignore:
Timestamp:
06/09/2011 11:45:33 AM (15 years ago)
Author:
kunalb
Message:

Before adding the remote repository

Location:
presstest/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • presstest/trunk/PressTest.php

    r395056 r395057  
    3535 */
    3636
    37 /**
    38  * Start your engines!
    39  */
     37/** The core plugin class */
    4038require "pt-core.php";
    4139
    42 new PT_Core();
     40/** Start your engines! */
     41PT_Core::init();
  • presstest/trunk/pt-core.php

    r395056 r395057  
    2020    /**
    2121     * Initialize the plugin for the first time; otherwise do nothing.
    22      * @see init
     22     * @see __construct
    2323     */
    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;
    2730    }
    2831
    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. */
    3635        /** Plugin Directory */
    3736        define( 'PT_DIR', WP_PLUGIN_DIR . '/presstest' );
     
    3938        define( 'PT_URL', plugins_url( 'presstest' ) );
    4039        /**#@-*/
     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() {
    4152    }
    4253}
Note: See TracChangeset for help on using the changeset viewer.