Changeset 3331
- Timestamp:
- 06/11/2016 08:21:45 PM (9 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php
r3327 r3331 173 173 if ( empty( $query->query['post_status'] ) ) { 174 174 $query->query_vars['post_status'] = array( 'publish', 'future', 'draft', 'pending', 'disabled', 'closed', 'rejected', 'approved' ); 175 } 176 177 // Make it possible to search for plugins that were submitted from a specific IP. 178 if ( current_user_can( 'plugin_review' ) && ! empty( $query->query['s'] ) && filter_var( $query->query['s'], FILTER_VALIDATE_IP ) ) { 179 $query->query_vars['meta_key'] = '_author_ip'; 180 $query->query_vars['meta_value'] = $query->query_vars['s']; 181 unset( $query->query_vars['s'] ); 182 183 add_filter( 'get_search_query', function() use ( $query ) { 184 return esc_html( $query->query_vars['meta_value'] ); 185 } ); 175 186 } 176 187 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-author-card.php
r3174 r3331 79 79 } 80 80 81 $user_ips = array();// $wpdb->get_col( $wpdb->prepare( 'SELECT DISTINCT poster_ip FROM plugin_2_posts WHERE poster_id = %s', $author->ID ) ); 82 $user_ips = array_filter( $user_ips, 'strlen' ); 81 $post_ids = get_posts( array( 82 'fields' => 'ids', 83 'post_type' => 'plugin', 84 'author' => $author->ID, 85 'meta_key' => '_author_ip', 86 'posts_per_page' => -1, 87 ) ); 88 89 $user_ips = array_unique( array_map( function( $post_id ) { 90 return get_post_meta( $post_id, '_author_ip', true ); 91 }, $post_ids ) ); 92 83 93 if ( $user_ips ) : 84 94 sort( $user_ips, SORT_NUMERIC ); 85 95 86 $user_ips = array_map( array( 'Author_Card', 'link_ip' ), $user_ips ); 87 88 echo '<p>IPs : ' . implode( ', ', $user_ips ) . '</p>'; 96 printf( '<p>IPs : %s</p>', implode( ', ', array_map( array( __NAMESPACE__ . '\Author_Card', 'link_ip' ), $user_ips ) ) ); 89 97 endif; 90 98 … … 191 199 do_action( 'wporg_plugins_author_card', $post, $author, $all_plugins ); 192 200 } 201 202 /** 203 * Builds a link to a list of plugins submitted from a given IP. 204 * 205 * @param string $ip IP address of the plugin author. 206 * @return string 207 */ 208 protected static function link_ip( $ip ) { 209 return sprintf( '<a href="%1$s">%2$s</a>', esc_url( add_query_arg( array( 210 'post_type' => 'plugin', 211 's' => $ip, 212 ), admin_url( 'edit.php' ) ) ), $ip ); 213 } 193 214 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r3326 r3331 661 661 * @type string $content The long description of the plugin. 662 662 * @type array $tags The tags associated with the plugin. 663 * @type array $ tagsThe meta information of the plugin.663 * @type array $meta The meta information of the plugin. 664 664 * } 665 665 * @return \WP_Post|\WP_Error -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
r3328 r3331 80 80 81 81 if ( ! $plugin ) { 82 $author_ip = $wpdb->get_var( $wpdb->prepare( 'SELECT poster_ip FROM ' . PLUGINS_TABLE_PREFIX . 'posts WHERE topic_id = %s', $topic->topic_id ) ); 83 82 84 $plugin = Plugin_Directory::create_plugin_post( array( 83 85 'slug' => $plugin_slug, … … 89 91 'post_modified' => $topic->topic_time, 90 92 'post_modified_gmt' => $topic->topic_time, 93 'meta' => array( 94 '_author_ip' => $author_ip, 95 ), 91 96 ) ); 92 97 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php
r3250 r3331 204 204 'support_threads' => 0, 205 205 'support_threads_resolved' => 0, 206 '_author_ip' => preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] ), 206 207 ), 207 208 ) );
Note: See TracChangeset
for help on using the changeset viewer.