Making WordPress.org


Ignore:
Timestamp:
12/19/2017 04:22:37 PM (8 years ago)
Author:
obenland
Message:

PLugins: Clean up formatting with phpcbf

File:
1 edited

Legend:

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

    r6045 r6287  
    11<?php
    22namespace WordPressdotorg\Plugin_Directory\Shortcodes;
     3
    34use WordPressdotorg\Plugin_Directory\Readme\Parser;
    45use WordPressdotorg\Plugin_Directory\Plugin_Directory;
     
    4445     */
    4546    public function __construct() {
    46         require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    47         require_once( ABSPATH . 'wp-admin/includes/image.php' );
    48         require_once( ABSPATH . 'wp-admin/includes/file.php' );
    49         require_once( ABSPATH . 'wp-admin/includes/media.php' );
     47        require_once ABSPATH . 'wp-admin/includes/plugin.php';
     48        require_once ABSPATH . 'wp-admin/includes/image.php';
     49        require_once ABSPATH . 'wp-admin/includes/file.php';
     50        require_once ABSPATH . 'wp-admin/includes/media.php';
    5051    }
    5152
     
    5859     */
    5960    public function process_upload() {
    60         $zip_file = $_FILES['zip_file']['tmp_name'];
     61        $zip_file         = $_FILES['zip_file']['tmp_name'];
    6162        $this->plugin_dir = Filesystem::unzip( $zip_file );
    6263
     
    6566            $plugin_data = get_plugin_data( $plugin_file, false, false ); // No markup/translation needed.
    6667            if ( ! empty( $plugin_data['Name'] ) ) {
    67                 $this->plugin = $plugin_data;
     68                $this->plugin      = $plugin_data;
    6869                $this->plugin_root = dirname( $plugin_file );
    6970                break;
     
    104105        if ( $this->has_reserved_slug() ) {
    105106            $error = __( 'Error: The plugin has a reserved name.', 'wporg-plugins' );
    106            
     107
    107108            return new \WP_Error( 'reserved_name', $error . ' ' . sprintf(
    108109                /* translators: 1: plugin slug, 2: 'Plugin Name:' */
     
    118119        if ( $plugin_post && $plugin_post->post_author != get_current_user_id() ) {
    119120            $error = __( 'Error: The plugin already exists.', 'wporg-plugins' );
    120            
     121
    121122            return new \WP_Error( 'already_exists', $error . ' ' . sprintf(
    122123                /* translators: 1: plugin slug, 2: 'Plugin Name:' */
     
    130131        if ( $plugin_post ) {
    131132            $error = __( 'Error: The plugin has already been submitted.', 'wporg-plugins' );
    132            
     133
    133134            return new \WP_Error( 'already_submitted', $error . ' ' . sprintf(
    134135                /* translators: 1: plugin slug, 2: plugins@wordpress.org */
     
    163164        if ( preg_match( '|[^\d\.]|', $this->plugin['Version'] ) ) {
    164165            $error = __( 'Error: Plugin versions are expected to be numbers.', 'wporg-plugins' );
    165            
     166
    166167            return new \WP_Error( 'invalid_version', $error . ' ' . sprintf(
    167168                /* translators: %s: 'Version:' */
     
    174175        if ( ! empty( $this->plugin['PluginURI'] ) && ! empty( $this->plugin['AuthorURI'] ) && $this->plugin['PluginURI'] == $this->plugin['AuthorURI'] ) {
    175176            $error = __( 'Error: Your plugin and author URIs are the same.', 'wporg-plugins' );
    176            
    177             return new \WP_Error( 'plugin_author_uri', $error . ' ' .
     177
     178            return new \WP_Error(
     179                'plugin_author_uri', $error . ' ' .
    178180                __( 'A plugin URL is a page/site that provides details about this specific plugin. An author URL is a page/site that provides information about the author of the plugin. You are not required to provide both, so pick the one that best applies to your URL.', 'wporg-plugins' )
    179181            );
     
    183185        if ( empty( $readme ) ) {
    184186            $error = __( 'Error: The plugin has no readme.', 'wporg-plugins' );
    185            
     187
    186188            return new \WP_Error( 'no_readme', $error . ' ' . sprintf(
    187189                /* translators: 1: readme.txt, 2: readme.md */
     
    199201        if ( ! $result ) {
    200202            $error = __( 'Error: The plugin has failed the automated checks.', 'wporg-plugins' );
    201            
     203
    202204            return new \WP_Error( 'failed_checks', $error . ' ' . sprintf(
    203205                /* translators: 1: Plugin Check Plugin URL, 2: make.wordpress.org/plugins */
     
    210212        // Passed all tests!
    211213        // Let's save everything and get things wrapped up.
    212 
    213214        // Create a new post on first-time submissions.
    214215        if ( ! $plugin_post ) {
     
    225226                'post_content' => $content,
    226227                'post_excerpt' => $this->plugin['Description'],
    227             //  'tax_input'    => wp_unslash( $_POST['tax_input'] ), // for category selection
     228                // 'tax_input'    => wp_unslash( $_POST['tax_input'] ), // for category selection
    228229                'meta_input'   => array(
    229230                    'tested'                   => $readme->tested,
     
    277278
    278279        /* translators: 1: plugin name, 2: plugin slug, 3: plugins@wordpress.org */
    279         $message = sprintf( __( 'Thank you for uploading %1$s to the WordPress Plugin Directory. It has been given the initial plugin slug of %2$s, however that is subject to change based on the results of your code review.' ),
     280        $message = sprintf(
     281            __( 'Thank you for uploading %1$s to the WordPress Plugin Directory. It has been given the initial plugin slug of %2$s, however that is subject to change based on the results of your code review.' ),
    280282            esc_html( $this->plugin['Name'] ),
    281283            '<code>' . $this->plugin_slug . '</code>'
     
    283285
    284286        /* translators: 1: plugins@wordpress.org */
    285         $message .= sprintf( __( 'We&rsquo;ve sent you an email verifying this submission. Please make sure to whitelist our email address - <a href="mailto:%1$s">%1$s</a> - to ensure you receive all our communications.' ),
     287        $message .= sprintf(
     288            __( 'We&rsquo;ve sent you an email verifying this submission. Please make sure to whitelist our email address - <a href="mailto:%1$s">%1$s</a> - to ensure you receive all our communications.' ),
    286289            'plugins@wordpress.org'
    287290        ) . '</p><p>';
     
    394397
    395398        /* translators: %s: plugin name */
    396         $email_subject = sprintf( __( '[WordPress Plugin Directory] New Plugin - %s', 'wporg-plugins' ),
     399        $email_subject = sprintf(
     400            __( '[WordPress Plugin Directory] New Plugin - %s', 'wporg-plugins' ),
    397401            $this->plugin['Name']
    398402        );
    399403
    400404        /* translators: 1: plugin name, 2: plugin slug */
    401         $email_content = sprintf( __( 'Thank you for uploading %1$s to the WordPress Plugin Directory. We will review your submission as soon as possible and send you a follow up email with the results.
     405        $email_content = sprintf(
     406            __(
     407'Thank you for uploading %1$s to the WordPress Plugin Directory. We will review your submission as soon as possible and send you a follow up email with the results.
    402408
    403409Your plugin has been given the initial slug of %2$s, however this is subject to change based on the results of your review.
     
    411417--
    412418The WordPress Plugin Directory Team
    413 https://make.wordpress.org/plugins', 'wporg-plugins' ),
     419https://make.wordpress.org/plugins', 'wporg-plugins'
     420            ),
    414421            $this->plugin['Name'],
    415422            $this->plugin_slug
     
    422429
    423430    // Helper
    424 
    425431    /**
    426432     * Whitelist zip files to be allowed to be uploaded to the media library.
Note: See TracChangeset for help on using the changeset viewer.