Make WordPress Core

Changeset 32013


Ignore:
Timestamp:
04/04/2015 06:22:30 PM (10 years ago)
Author:
DrewAPicture
Message:

Add missing DocBlocks for the _limit_array(), _limit_string(), _limit_url(), _limit_img(), _limit_embed(), and _process_meta_entry() utility methods in WP_Press_This.

See [31609]. See #31888.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-press-this.php

    r31992 r32013  
    99
    1010/**
    11  * Press This class
     11 * Press This class.
    1212 *
    1313 * @since 4.2.0
     
    3939    public function site_settings() {
    4040        return array(
    41             // Used to trigger the bookmarklet update notice.
    42             // Needs to be set here and in get_shortcut_link() in wp-includes/link-template.php.
     41            /*
     42             * Used to trigger the bookmarklet update notice. Needs to be set here and in
     43             * get_shortcut_link() in wp-includes/link-template.php.
     44             */
    4345            'version' => '8',
    4446
     
    252254
    253255        if ( ! is_wp_error( $source_tmp_file ) && file_exists( $source_tmp_file ) ) {
     256
    254257            // Get the content of the source page from the tmp file..
    255 
    256258            $source_content = wp_kses(
    257259                @file_get_contents( $source_tmp_file ),
     
    290292    }
    291293
     294    /**
     295     * Utility method to limit an array to 50 values.
     296     *
     297     * @ignore
     298     * @since 4.2.0
     299     *
     300     * @param array $value Array to limit.
     301     * @return array Original array if fewer than 50 values, limited array, empty array otherwise.
     302     */
    292303    private function _limit_array( $value ) {
    293304        if ( is_array( $value ) ) {
     
    302313    }
    303314
     315    /**
     316     * Utility method to limit the length of a given string to 5,000 characters.
     317     *
     318     * @ignore
     319     * @since 4.2.0
     320     *
     321     * @param string $value String to limit.
     322     * @return bool|int|string If boolean or integer, that value. If a string, the original value
     323     *                         if fewer than 5,000 characters, a truncated version, otherwise an
     324     *                         empty string.
     325     */
    304326    private function _limit_string( $value ) {
    305327        $return = '';
     
    321343    }
    322344
     345    /**
     346     * Utility method to limit a given URL to 2,048 characters.
     347     *
     348     * @ignore
     349     * @since 4.2.0
     350     *
     351     * @param string $url URL to check for length and validity.
     352     * @return string Escaped URL if of valid length (< 2048) and makeup. Empty string otherwise.
     353     */
    323354    private function _limit_url( $url ) {
    324355        if ( ! is_string( $url ) ) {
     
    349380    }
    350381
     382    /**
     383     * Utility method to limit image source URLs.
     384     *
     385     * Excluded URLs include share-this type buttons, loaders, spinners, spacers, WP interface images,
     386     * tiny buttons or thumbs, mathtag.com or quantserve.com images, or the WP stats gif.
     387     *
     388     * @ignore
     389     * @since 4.2.0
     390     *
     391     * @param string $src Image source URL.
     392     * @return string If not matched an excluded URL type, the original URL, empty string otherwise.
     393     */
    351394    private function _limit_img( $src ) {
    352395        $src = $this->_limit_url( $src );
     
    384427    }
    385428
     429    /**
     430     * Limit embed source URLs to specific providers.
     431     *
     432     * Not all core oEmbed providers are supported. Supported providers include YouTube, Vimeo,
     433     * Vine, Daily Motion, SoundCloud, and Twitter.
     434     *
     435     * @ignore
     436     * @since 4.2.0
     437     *
     438     * @param string $src Embed source URL.
     439     * @return string If not from a supported provider, an empty string. Otherwise, a reformattd embed URL.
     440     */
    386441    private function _limit_embed( $src ) {
    387442        $src = $this->_limit_url( $src );
     
    415470    }
    416471
     472    /**
     473     * Process a meta data entry from the source.
     474     *
     475     * @ignore
     476     * @since 4.2.0
     477     *
     478     * @param string $meta_name  Meta key name.
     479     * @param mixed  $meta_value Meta value.
     480     * @param array  $data       Associative array of source data.
     481     * @return array Processed data array.
     482     */
    417483    private function _process_meta_entry( $meta_name, $meta_value, $data ) {
    418484        if ( preg_match( '/:?(title|description|keywords|site_name)$/', $meta_name ) ) {
     
    544610        }
    545611
    546         // Fetch and gather <link> data
     612        // Fetch and gather <link> data.
    547613        if ( empty( $data['_links'] ) ) {
    548614            $data['_links'] = array();
Note: See TracChangeset for help on using the changeset viewer.