Making WordPress.org


Ignore:
Timestamp:
04/19/2016 08:09:35 PM (9 years ago)
Author:
obenland
Message:

Plugin Directory: Add meta data on plugin submission.

Adds readme meta data to the plugin post after uploading a new plugin.

See #1570, #1571.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r2976 r2983  
    467467     *     @type int    $author      The ID of the plugin author.
    468468     *     @type string $description The short description of the plugin.
     469     *     @type string $content     The long description of the plugin.
     470     *     @type array  $tags        The tags associated with the plugin.
     471     *     @type array  $tags        The meta information of the plugin.
    469472     * }
    470473     * @return \WP_Post|\WP_Error
    471474     */
    472475    static public function create_plugin_post( array $plugin_info ) {
    473         $title  = !empty( $plugin_info['title'] )       ? $plugin_info['title']       : '';
    474         $slug   = !empty( $plugin_info['slug'] )        ? $plugin_info['slug']        : sanitize_title( $title );
    475         $status = !empty( $plugin_info['status'] )      ? $plugin_info['status']      : 'pending';
    476         $author = !empty( $plugin_info['author'] )      ? $plugin_info['author']      : 0;
    477         $desc   = !empty( $plugin_info['description'] ) ? $plugin_info['description'] : '';
     476        $title   = ! empty( $plugin_info['title'] )       ? $plugin_info['title']       : '';
     477        $slug    = ! empty( $plugin_info['slug'] )        ? $plugin_info['slug']        : sanitize_title( $title );
     478        $status  = ! empty( $plugin_info['status'] )      ? $plugin_info['status']      : 'pending';
     479        $author  = ! empty( $plugin_info['author'] )      ? $plugin_info['author']      : 0;
     480        $desc    = ! empty( $plugin_info['description'] ) ? $plugin_info['description'] : '';
     481        $content = ! empty( $plugin_info['content'] )     ? $plugin_info['content']     : '';
     482        $tags    = ! empty( $plugin_info['tags'] )        ? $plugin_info['tags']        : array();
     483        $meta    = ! empty( $plugin_info['meta'] )        ? $plugin_info['meta']        : array();
    478484
    479485        $id = wp_insert_post( array(
     
    483489            'post_title'   => $title ?: $slug,
    484490            'post_author'  => $author,
    485             'post_content' => '',
     491            'post_content' => $content,
    486492            'post_excerpt' => $desc,
     493            'tags_input'   => $tags,
     494            'meta_input'   => $meta,
    487495        ), true );
    488496
Note: See TracChangeset for help on using the changeset viewer.