WordPress.org

Making WordPress.org


Ignore:
Timestamp:
12/03/2017 07:32:59 PM (2 years ago)
Author:
Otto42
Message:

Plugins: General code cleanup, migrate events that happen on transistions to single place, remove duplicated code, add auditing, simplify logic. props @joostdevalk See #2860

File:
1 edited

Legend:

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

    r6207 r6217  
    343343            'label_count'               => _n_noop( 'Rejected <span class="count">(%s)</span>', 'Rejected <span class="count">(%s)</span>', 'wporg-plugins' ),
    344344        ) );
    345 
    346         add_action( 'transition_post_status', array( $this, 'plugin_close_date' ), 10, 3 );
    347345
    348346        /**
     
    13421340    }
    13431341
    1344     /**
    1345      * Save the date a plugin was closed and delete that date when it's reopened.
    1346      *
    1347      * @param string  $new_status The new plugin status.
    1348      * @param string  $old_status The old plugin status.
    1349      * @param WP_Post $post Post data.
    1350      */
    1351     public function plugin_close_date( $new_status, $old_status, $post ) {
    1352         if ( in_array( $new_status, array( 'closed', 'disabled' ) ) ) {
    1353             update_post_meta( $post->ID, 'plugin_closed_date', current_time( 'mysql' ) );
    1354         }
    1355         if ( 'publish' === $new_status && in_array( $old_status, array( 'closed', 'disabled' ) ) ) {
    1356             delete_post_meta( $post->ID, 'plugin_closed_date' );
    1357         }
    1358     }
    13591342}
Note: See TracChangeset for help on using the changeset viewer.