WordPress.org

Make WordPress Core

Changeset 33198


Ignore:
Timestamp:
07/13/2015 05:50:41 PM (6 years ago)
Author:
DrewAPicture
Message:

Improving formatting for various pieces of inline documentation in the new WP_Site_Icon class added in 4.3.

See [32994]. See #32891.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-site-icon.php

    r33180 r33198  
    11<?php
    2 
    32/**
    4  * Class WP_Site_Icon.
     3 * Class for implementing site icon functionality.
    54 *
    65 * @since 4.3.0
     
    1211     *
    1312     * @since 4.3.0
    14      *
     13     * @access public
    1514     * @var int
    1615     */
     
    2120     *
    2221     * @since 4.3.0
    23      *
     22     * @access public
    2423     * @var int
    2524     */
     
    2726
    2827    /**
    29      *
    30      * @since 4.3.0
    31      *
     28     * List of site icon sizes.
     29     *
     30     * @since 4.3.0
     31     * @access public
    3232     * @var array
    3333     */
    3434    public $site_icon_sizes = array(
    35         /**
     35        /*
    3636         * Square, medium sized tiles for IE11+.
    3737         *
    38          * @link https://msdn.microsoft.com/library/dn455106(v=vs.85).aspx
     38         * See https://msdn.microsoft.com/library/dn455106(v=vs.85).aspx
    3939         */
    4040        270,
    4141
    42         /**
     42        /*
    4343         * App icons up to iPhone 6 Plus.
    4444         *
    45          * @link https://developer.apple.com/library/prerelease/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html
     45         * See https://developer.apple.com/library/prerelease/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html
    4646         */
    4747        180,
     
    5252
    5353    /**
    54      * Register our actions and filters.
    55      *
    56      * @since 4.3.0
     54     * Registers actions and filters.
     55     *
     56     * @since 4.3.0
     57     * @access public
    5758     */
    5859    public function __construct() {
     
    6970
    7071    /**
    71      * Add a hidden upload page.
     72     * Adds a hidden upload page.
    7273     *
    7374     * There is no need to access it directly.
    7475     *
    7576     * @since 4.3.0
     77     * @access public
    7678     */
    7779    public function admin_menu_upload_site_icon() {
     
    8486
    8587    /**
    86      * Add scripts to admin settings pages.
    87      *
    88      * @since 4.3.0
     88     * Adds scripts to admin settings pages.
     89     *
     90     * @since 4.3.0
     91     * @access public
    8992     */
    9093    public function enqueue_scripts() {
     
    9497
    9598    /**
    96      * Load on when the admin is initialized.
    97      *
    98      * @since 4.3.0
     99     * Loads the settings when the admin is initialized.
     100     *
     101     * @since 4.3.0
     102     * @access public
    99103     */
    100104    public function add_upload_settings() {
     
    106110
    107111    /**
    108      * Removes site icon.
    109      *
    110      * @since 4.3.0
     112     * Removes the site icon.
     113     *
     114     * @since 4.3.0
     115     * @access public
    111116     */
    112117    public function remove_site_icon() {
     
    119124
    120125    /**
     126     * Handle uploading a site icon.
     127     *
    121128     * Uploading a site_icon is a 3 step process
    122129     *
     
    126133     *
    127134     * @since 4.3.0
     135     * @access public
    128136     */
    129137    public function upload_site_icon_page() {
     
    149157     *
    150158     * @since 4.3.0
     159     * @access public
    151160     */
    152161    public function select_page() {
     
    161170
    162171    /**
    163      * Settings field for file upload.
    164      *
    165      * @since 4.3.0
     172     * Handles settings field for file upload.
     173     *
     174     * @since 4.3.0
     175     * @access public
    166176     */
    167177    public function upload_field() {
     
    192202
    193203    /**
    194      * Check if the image needs cropping.
     204     * Checks if the image needs cropping.
    195205     *
    196206     * If it doesn't need cropping, proceed to set the icon.
    197207     *
    198208     * @since 4.3.0
     209     * @access public
    199210     */
    200211    public function maybe_skip_cropping() {
     
    223234
    224235    /**
    225      * Crop a the image admin view.
    226      *
    227      * @since 4.3.0
     236     * Handles the image crop admin view.
     237     *
     238     * @since 4.3.0
     239     * @access public
    228240     */
    229241    public function crop_page() {
     
    315327
    316328    /**
    317      * Saves a new Site Icon.
    318      *
    319      * @since 4.3.0
     329     * Handles saving a new Site Icon.
     330     *
     331     * @since 4.3.0
     332     * @access public
    320333     */
    321334    public function set_site_icon() {
     
    325338        $create_new_attachement = ! empty( $_REQUEST['create-new-attachment'] );
    326339
    327         /*
    328          * If the current attachment as been set as site icon don't delete it.
    329          */
     340        // If the current attachment as been set as site icon don't delete it.
    330341        if ( get_option( 'site_icon' ) == $attachment_id ) {
    331342            // Get the file path.
     
    374385
    375386    /**
    376      * Upload the file to be cropped in the second step.
    377      *
    378      * @since 4.3.0
     387     * Handles uploading the file to be cropped in the second step.
     388     *
     389     * @since 4.3.0
     390     * @access public
    379391     */
    380392    public function handle_upload() {
     
    412424
    413425    /**
    414      * Create an attachment 'object'.
     426     * Creates an attachment 'object'.
    415427     *
    416428     * @since 4.3.0
     
    441453
    442454    /**
    443      * Insert an attachment.
    444      *
    445      * @since 4.3.0
     455     * Inserts an attachment.
     456     *
     457     * @since 4.3.0
     458     * @access public
    446459     *
    447460     * @param array  $object Attachment object.
     
    457470
    458471    /**
    459      * Update the metadata of an attachment.
     472     * Handles updating the metadata of an attachment.
    460473     *
    461474     * @since 4.3.0
     
    481494
    482495    /**
    483      * Add additional sizes to be made when creating the site_icon images.
    484      *
    485      * @since 4.3.0
    486      *
    487      * @param array $sizes
    488      * @return array
     496     * Adds additional sizes to be made when creating the site_icon images.
     497     *
     498     * @since 4.3.0
     499     * @access public
     500     *
     501     * @param array $sizes List of additional sizes.
     502     * @return array Additional image sizes.
    489503     */
    490504    public function additional_sizes( $sizes = array() ) {
     
    525539
    526540    /**
    527      * Add Site Icon sizes to the array of image sizes on demand.
    528      *
    529      * @since 4.3.0
    530      *
    531      * @param array $sizes
    532      * @return array
     541     * Adds Site Icon sizes to the array of image sizes on demand.
     542     *
     543     * @since 4.3.0
     544     * @access public
     545     *
     546     * @param array $sizes List of image sizes.
     547     * @return array List of intermediate image sizes.
    533548     */
    534549    public function intermediate_image_sizes( $sizes = array() ) {
     
    546561     *
    547562     * @since 4.3.0
    548      *
    549      * @return bool
     563     * @access public
     564     *
     565     * @return bool Whether the site icon was successfully deleted.
    550566     */
    551567    public function delete_site_icon() {
     
    562578     *
    563579     * @since 4.3.0
     580     * @access public
    564581     *
    565582     * @param int $post_id Attachment ID.
     
    577594     *
    578595     * @since 4.3.0
    579      *
    580      * @param null|array|string $value    The value get_metadata() should
    581      *                                    return - a single metadata value,
    582      *                                    or an array of values.
     596     * @access public
     597     *
     598     * @param null|array|string $value    The value get_metadata() should return a single metadata value, or an
     599     *                                    array of values.
    583600     * @param int               $post_id  Post ID.
    584601     * @param string            $meta_key Meta key.
    585602     * @param string|array      $single   Meta value, or an array of values.
    586      * @return array|null|string
     603     * @return array|null|string The attachment metadata value, array of values, or null.
    587604     */
    588605    public function get_post_metadata( $value, $post_id, $meta_key, $single ) {
     
    597614
    598615    /**
    599      * Get the data required to work with the uploaded image
    600      *
    601      * @since 4.3.0
     616     * Gets the data required to work with the uploaded image
     617     *
     618     * @since 4.3.0
     619     * @access private
    602620     *
    603621     * @return array containing the collected data
Note: See TracChangeset for help on using the changeset viewer.