Changeset 13308
- Timestamp:
- 03/12/2024 02:27:28 AM (9 months ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r13259 r13308 1834 1834 $slug = $args['post_name'] ?: sanitize_title( $title ); 1835 1835 1836 // Remove null items (date-related fields) to fallback to the defaults below. 1837 $args = array_filter( 1838 $args, 1839 function( $item ) { 1840 return ! is_null( $item ); 1841 } 1842 ); 1843 1836 1844 $post_date = current_time( 'mysql' ); 1837 1845 $post_date_gmt = current_time( 'mysql', 1 ); … … 1847 1855 ) ); 1848 1856 1849 $update = ! empty( $args['ID'] );1850 1857 $result = wp_insert_post( $args, true ); 1851 1858 1852 1859 if ( ! is_wp_error( $result ) ) { 1853 1860 wp_cache_set( $result, $slug, 'plugin-slugs' ); 1861 1854 1862 $result = get_post( $result ); 1855 1856 if ( ! $update ) {1857 $owner = get_userdata( $result->post_author );1858 Tools::audit_log( sprintf(1859 'Submitted by <a href="%s">%s</a>.',1860 esc_url( 'https://profiles.wordpress.org/' . $owner->user_nicename . '/' ),1861 $owner->user_login1862 ), $result->ID );1863 }1864 1863 } 1865 1864 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php
r13202 r13308 6 6 use WordPressdotorg\Plugin_Directory\Readme\Parser; 7 7 use WordPressdotorg\Plugin_Directory\Plugin_Directory; 8 use WordPressdotorg\Plugin_Directory\Tools; 8 9 use WordPressdotorg\Plugin_Directory\Tools\Filesystem; 9 10 use WordPressdotorg\Plugin_Directory\Admin\Tools\Upload_Token; … … 422 423 423 424 $post_args = array( 424 'ID' => $plugin_post->ID ?? 0, 425 'post_title' => $this->plugin['Name'], 426 'post_name' => $this->plugin_slug, 427 'post_status' => $plugin_post->post_status ?? 'new', 428 'post_content' => $content, 429 'post_excerpt' => $this->plugin['Description'], 425 'ID' => $plugin_post->ID ?? 0, 426 'post_title' => $this->plugin['Name'], 427 'post_name' => $this->plugin_slug, 428 'post_status' => $plugin_post->post_status ?? 'new', 429 'post_content' => $content, 430 'post_excerpt' => $this->plugin['Description'], 431 'post_date' => $plugin_post->post_date ?? null, 432 'post_date_gmt' => $plugin_post->post_date_gmt ?? null, 430 433 // 'tax_input' => wp_unslash( $_POST['tax_input'] ), // for category selection 431 434 'meta_input' => array( … … 466 469 467 470 // First time submission, track some additional metadata. 468 if ( ! $ plugin_post) {471 if ( ! $updating_existing ) { 469 472 $post_args['meta_input']['_author_ip'] = preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] ); 470 473 $post_args['meta_input']['_submitted_date'] = time(); … … 477 480 if ( is_wp_error( $plugin_post ) ) { 478 481 return $plugin_post; 482 } 483 484 // Record the submitter. 485 if ( ! $updating_existing ) { 486 Tools::audit_log( 487 sprintf( 488 'Submitted by <a href="%s">%s</a>.', 489 esc_url( 'https://profiles.wordpress.org/' . wp_get_current_user()->user_nicename . '/' ), 490 wp_get_current_user()->user_login 491 ), 492 $plugin_post->ID 493 ); 479 494 } 480 495
Note: See TracChangeset
for help on using the changeset viewer.