Make WordPress Core


Ignore:
Timestamp:
09/27/2011 02:30:56 PM (13 years ago)
Author:
ryan
Message:

First pass of WP_Screen phpdoc. see #18690

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/screen.php

    r18784 r18793  
    597597}
    598598
     599/**
     600 * A class representing the current admin screen.
     601 *
     602 * @since 3.3.0
     603 * @access public
     604 */
    599605final class WP_Screen {
     606    /**
     607     * Any action associated with the screen.  'add' for *-add.php and *-new.php screens.  Empty otherwise.
     608     *
     609     * @since 3.3.0
     610     * @var string
     611     * @access private
     612     */
    600613    public $action = '';
     614
     615    /**
     616     * The base type of the screen.  This is typically the same as $id but with any post types and taxonomies stripped.
     617     * For example, for an $id of 'edit-post' the base is 'edit'.
     618     *
     619     * @since 3.3.0
     620     * @var string
     621     * @access private
     622     */
    601623    public $base;
     624
     625    /**
     626     * The unique ID of the screen.
     627     *
     628     * @since 3.3.0
     629     * @var string
     630     * @access private
     631     */
    602632    public $id;
     633
     634    /**
     635     * Whether the screen is in the network admin.
     636     *
     637     * @since 3.3.0
     638     * @var bool
     639     * @access private
     640     */
    603641    public $is_network;
     642
     643    /**
     644     * Whether the screen is in the user admin.
     645     *
     646     * @since 3.3.0
     647     * @var bool
     648     * @access private
     649     */
    604650    public $is_user;
     651
     652    /**
     653     * The base menu parent.
     654     * This is derived from $parent_file by removing the query string and any .php extension.
     655     * $parent_file values of 'edit.php?post_type=page' and 'edit.php?post_type=post' have a $parent_base of 'edit'.
     656     *
     657     * @since 3.3.0
     658     * @var string
     659     * @access private
     660     */
    605661    public $parent_base;
     662
     663    /**
     664     * The parent_file for the screen per the admin menu system.
     665     * Some $parent_file values are 'edit.php?post_type=page', 'edit.php', and 'options-general.php'.
     666     *
     667     * @since 3.3.0
     668     * @var string
     669     * @access private
     670     */
    606671    public $parent_file;
     672
     673    /**
     674     * The post type associated with the screen, if any.
     675     * The 'edit.php?post_type=page' screen has a post type of 'page'.
     676     *
     677     * @since 3.3.0
     678     * @var string
     679     * @access private
     680     */
    607681    public $post_type;
     682
     683    /**
     684     * The taxonomy associated with the screen, if any.
     685     * The 'edit-tags.php?taxonomy=category' screen has a taxonomy of 'category'.
     686     * @since 3.3.0
     687     * @var string
     688     * @access private
     689     */
    608690    public $taxonomy;
    609691
     692    /**
     693     * Constructor
     694     *
     695     * @since 3.3.0
     696     *
     697     * @param string $id A screen id.  If empty, the $hook_suffix global is used to derive the ID.
     698     */
    610699    public function __construct( $id = '' ) {
    611700        global $hook_suffix, $typenow, $taxnow;
     
    646735                $typenow = 'post';
    647736            $this->id .= '-' . $typenow;
    648             $this->post_type = $typenow;
    649737        } elseif ( 'post' == $this->id ) {
    650738            if ( empty($typenow) )
     
    671759    }
    672760
     761    /**
     762     * Set the parent information for the screen.
     763     * This is called in admin-header.php after the menu parent for the screen has been determined.
     764     *
     765     * @since 3.3.0
     766     *
     767     * @param string $parent_file The parent file of the screen.  Typically the $parent_file global.
     768     */
    673769    function set_parentage( $parent_file ) {
    674770        $this->parent_file = $parent_file;
     
    677773    }
    678774
     775    /**
     776     * Adds an option for the screen.
     777     * Call this in template files after admin.php is loaded and before admin-header.php is loaded to add screen options.
     778     *
     779     * @since 3.3.0
     780     *
     781     * @param string $option Option ID
     782     * @param array $args Associative array of arguments particular to the given $option.
     783     */
    679784    public function add_option( $option, $args = array() ) {
    680785        return add_screen_option( $option, $args );
    681786    }
    682787
     788    /**
     789     * Add a help tab to the contextual help for the screen.
     790     * Call this in template files after admin.php is loaded and before admin-header.php is loaded to add contextual help tabs.
     791     *
     792     * @since 3.3.0
     793     *
     794     * @param string $id Tab ID
     795     * @param string $title Title for the tab
     796     * @param string $content Help tab content in plain text or HTML.
     797     */
    683798    public function add_help_tab( $id, $title, $content) {
    684799        global $_wp_contextual_help;
     
    687802    }
    688803
     804    /**
     805     * Add a sidebar to the contextual help for the screen.
     806     * Call this in template files after admin.php is loaded and before admin-header.php is loaded to add a sidebar to the contextual help.
     807     *
     808     * @since 3.3.0
     809     *
     810     * @param string $content Sidebar content in plain text or HTML.
     811     */
    689812    public function add_help_sidebar( $content ) {
    690813        global $_wp_contextual_help;
Note: See TracChangeset for help on using the changeset viewer.