WordPress.org

Make WordPress Core

Changeset 39188


Ignore:
Timestamp:
11/09/2016 10:59:02 PM (4 years ago)
Author:
johnbillion
Message:

Docs: Improve the documentation for parameters which accept OBJECT, ARRAY_A, and ARRAY_N as parameters.

See #37770

Location:
trunk/src/wp-includes
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/bookmark.php

    r37586 r39188  
    1515 *
    1616 * @param int|stdClass $bookmark
    17  * @param string $output Optional. Either OBJECT, ARRAY_N, or ARRAY_A constant
     17 * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
     18 *                       an stdClass object, an associative array, or a numeric array, respectively. Default OBJECT.
    1819 * @param string $filter Optional, default is 'raw'.
    1920 * @return array|object|null Type returned depends on $output value.
     
    301302 * @since 2.3.0
    302303 *
    303  * @param object|array $bookmark Bookmark row
     304 * @param stdClass|array $bookmark Bookmark row
    304305 * @param string $context Optional, default is 'display'. How to filter the
    305306 *      fields
    306  * @return object|array Same type as $bookmark but with fields sanitized.
     307 * @return stdClass|array Same type as $bookmark but with fields sanitized.
    307308 */
    308309function sanitize_bookmark($bookmark, $context = 'display') {
  • trunk/src/wp-includes/category.php

    r37985 r39188  
    8383 *
    8484 * @param int|object $category Category ID or Category row object
    85  * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
     85 * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to a
     86 *                       WP_Term object, an associative array, or a numeric array, respectively. Default OBJECT.
    8687 * @param string $filter Optional. Default is raw or no WordPress defined filter will applied.
    8788 * @return object|array|WP_Error|null Category data in type defined by $output parameter.
     
    114115 *
    115116 * @param string $category_path URL containing category slugs.
    116  * @param bool $full_match Optional. Whether full path should be matched.
    117  * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
    118  * @return object|array|WP_Error|void Type is based on $output value.
     117 * @param bool   $full_match    Optional. Whether full path should be matched.
     118 * @param string $output        Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
     119 *                              a WP_Term object, an associative array, or a numeric array, respectively. Default OBJECT.
     120 * @return WP_Term|array|WP_Error|null Type is based on $output value.
    119121 */
    120122function get_category_by_path( $category_path, $full_match = true, $output = OBJECT ) {
     
    297299 * @since 2.3.0
    298300 *
    299  * @param int|object $tag
    300  * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
    301  * @param string $filter Optional. Default is raw or no WordPress defined filter will applied.
    302  * @return object|array|WP_Error|null Tag data in type defined by $output parameter. WP_Error if $tag is empty, null if it does not exist.
     301 * @param int|WP_Term|object $tag    A tag ID or object.
     302 * @param string             $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
     303 *                                   a WP_Term object, an associative array, or a numeric array, respectively. Default OBJECT.
     304 * @param string             $filter Optional. Default is raw or no WordPress defined filter will applied.
     305 * @return WP_Term|array|WP_Error|null Tag data in type defined by $output parameter. WP_Error if $tag is empty, null if it does not exist.
    303306 */
    304307function get_tag( $tag, $output = OBJECT, $filter = 'raw' ) {
  • trunk/src/wp-includes/comment.php

    r39101 r39188  
    171171 *
    172172 * @param WP_Comment|string|int $comment Comment to retrieve.
    173  * @param string $output Optional. OBJECT or ARRAY_A or ARRAY_N constants.
     173 * @param string                $output  Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
     174 *                                       a WP_Comment object, an associative array, or a numeric array, respectively. Default OBJECT.
    174175 * @return WP_Comment|array|null Depends on $output value.
    175176 */
  • trunk/src/wp-includes/post.php

    r39175 r39188  
    402402 *
    403403 * @param mixed  $args   Optional. User defined arguments for replacing the defaults. Default empty.
    404  * @param string $output Optional. Constant for return type. Accepts OBJECT, ARRAY_A, ARRAY_N.
    405  *                       Default OBJECT.
     404 * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
     405 *                       a WP_Post object, an associative array, or a numeric array, respectively. Default OBJECT.
    406406 * @return array Array of children, where the type of each element is determined by $output parameter.
    407407 *               Empty array on failure.
     
    506506 *
    507507 * @param int|WP_Post|null $post   Optional. Post ID or post object. Defaults to global $post.
    508  * @param string           $output Optional, default is Object. Accepts OBJECT, ARRAY_A, or ARRAY_N.
    509  *                                 Default OBJECT.
     508 * @param string           $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
     509 *                                 a WP_Post object, an associative array, or a numeric array, respectively. Default OBJECT.
    510510 * @param string           $filter Optional. Type of filter to apply. Accepts 'raw', 'edit', 'db',
    511511 *                                 or 'display'. Default 'raw'.
     
    28632863 * @see get_posts()
    28642864 *
    2865  * @param array  $args       Optional. Arguments to retrieve posts. Default empty array.
    2866  * @param string $output     Optional. Type of output. Accepts ARRAY_A or ''. Default ARRAY_A.
    2867  * @return array|false Associative array if $output equals ARRAY_A, array or false if no results.
     2865 * @param array  $args   Optional. Arguments to retrieve posts. Default empty array.
     2866 * @param string $output Optional. The required return type. One of OBJECT or ARRAY_A, which correspond to
     2867 *                       a WP_Post object or an associative array, respectively. Default ARRAY_A.
     2868 * @return array|false Array of recent posts, where the type of each element is determined by $output parameter.
     2869 *                     Empty array on failure.
    28682870 */
    28692871function wp_get_recent_posts( $args = array(), $output = ARRAY_A ) {
     
    41914193 *
    41924194 * @param mixed  $page   Page object or page ID. Passed by reference.
    4193  * @param string $output Optional. What to output. Accepts OBJECT, ARRAY_A, or ARRAY_N.
    4194  *                       Default OBJECT.
     4195 * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
     4196 *                       a WP_Post object, an associative array, or a numeric array, respectively. Default OBJECT.
    41954197 * @param string $filter Optional. How the return value should be filtered. Accepts 'raw',
    41964198 *                       'edit', 'db', 'display'. Default 'raw'.
    4197  * @return WP_Post|array|null WP_Post on success or null on failure.
     4199 * @return WP_Post|array|null WP_Post (or array) on success, or null on failure.
    41984200 */
    41994201function get_page( $page, $output = OBJECT, $filter = 'raw') {
     
    42094211 *
    42104212 * @param string       $page_path Page path.
    4211  * @param string       $output    Optional. Output type. Accepts OBJECT, ARRAY_N, or ARRAY_A.
    4212  *                                Default OBJECT.
     4213 * @param string       $output    Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
     4214 *                                a WP_Post object, an associative array, or a numeric array, respectively. Default OBJECT.
    42134215 * @param string|array $post_type Optional. Post type or array of post types. Default 'page'.
    4214  * @return WP_Post|array|void WP_Post on success.
     4216 * @return WP_Post|array|null WP_Post (or array) on success, or null on failure.
    42154217 */
    42164218function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
     
    43014303 *
    43024304 * @param string       $page_title Page title
    4303  * @param string       $output     Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A.
    4304  *                                 Default OBJECT.
     4305 * @param string       $output     Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
     4306 *                                 a WP_Post object, an associative array, or a numeric array, respectively. Default OBJECT.
    43054307 * @param string|array $post_type  Optional. Post type or array of post types. Default 'page'.
    4306  * @return WP_Post|array|void WP_Post on success or null on failure
     4308 * @return WP_Post|array|null WP_Post (or array) on success, or null on failure.
    43074309 */
    43084310function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) {
  • trunk/src/wp-includes/revision.php

    r38433 r39188  
    322322 *
    323323 * @param int|WP_Post $post   The post ID or object.
    324  * @param string      $output Optional. OBJECT, ARRAY_A, or ARRAY_N.
     324 * @param string      $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
     325 *                            a WP_Post object, an associative array, or a numeric array, respectively. Default OBJECT.
    325326 * @param string      $filter Optional sanitation filter. See sanitize_post().
    326  * @return WP_Post|array|null Null if error or post object if success.
     327 * @return WP_Post|array|null WP_Post (or array) on success, or null on failure.
    327328 */
    328329function wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
  • trunk/src/wp-includes/taxonomy.php

    r38832 r39188  
    710710 *                                 will return `$term`.
    711711 * @param string     $taxonomy Optional. Taxonomy name that $term is part of.
    712  * @param string     $output   Constant OBJECT, ARRAY_A, or ARRAY_N
     712 * @param string     $output   Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
     713 *                             a WP_Term object, an associative array, or a numeric array, respectively. Default OBJECT.
    713714 * @param string     $filter   Optional, default is raw or no WordPress defined filter will applied.
    714715 * @return array|WP_Term|WP_Error|null Object of the type specified by `$output` on success. When `$output` is 'OBJECT',
     
    817818 * @param string|int $value    Search for this term value
    818819 * @param string     $taxonomy Taxonomy name. Optional, if `$field` is 'term_taxonomy_id'.
    819  * @param string     $output   Constant OBJECT, ARRAY_A, or ARRAY_N
     820 * @param string     $output   Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
     821 *                             a WP_Term object, an associative array, or a numeric array, respectively. Default OBJECT.
    820822 * @param string     $filter   Optional, default is raw or no WordPress defined filter will applied.
    821  * @return WP_Term|bool WP_Term instance on success. Will return false if `$taxonomy` does not exist
    822  *                      or `$term` was not found.
     823 * @return WP_Term|array|false WP_Term instance (or array) on success. Will return false if `$taxonomy` does not exist
     824 *                             or `$term` was not found.
    823825 */
    824826function get_term_by( $field, $value, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) {
  • trunk/src/wp-includes/wp-db.php

    r38580 r39188  
    22952295     *
    22962296     * @param string|null $query  SQL query.
    2297      * @param string      $output Optional. one of ARRAY_A | ARRAY_N | OBJECT constants.
    2298      *                            Return an associative array (column => value, ...),
    2299      *                            a numerically indexed array (0 => value, ...) or
    2300      *                            an object ( ->column = value ), respectively.
     2297     * @param string      $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
     2298     *                            an stdClass object, an associative array, or a numeric array, respectively. Default OBJECT.
    23012299     * @param int         $y      Optional. Row to return. Indexed from 0.
    23022300     * @return array|object|null|void Database query result in format specified by $output or null on failure
Note: See TracChangeset for help on using the changeset viewer.