Ticket #18604: 18604.diff

File 18604.diff, 1020 bytes (added by lightningspirit, 13 months ago)

New hook for paginate_links() "paginate_links_{$context}". Added $context variable for developers to be able to apply filters for paginate_links() in diferent contextes. Added $context = 'media-upload' for paginate_links() argument for developers to be able to hack the pagination result in the wp-admin/media-upload.php aka Media Library.

Line 
1Index: wp-includes/general-template.php
2===================================================================
3--- wp-includes/general-template.php    (revisão 20629)
4+++ wp-includes/general-template.php    (cópia de trabalho)
5@@ -1988,6 +1988,9 @@
6                $link .= $add_fragment;
7                $page_links[] = '<a class="next page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $next_text . '</a>';
8        endif;
9+       
10+       $page_links = apply_filters( "paginate_links_{$context}", $page_links );
11+       
12        switch ( $type ) :
13                case 'array' :
14                        return $page_links;
15Index: wp-admin/includes/media.php
16===================================================================
17--- wp-admin/includes/media.php (revisão 20629)
18+++ wp-admin/includes/media.php (cópia de trabalho)
19@@ -1861,7 +1861,8 @@
20        'prev_text' => __('&laquo;'),
21        'next_text' => __('&raquo;'),
22        'total' => ceil($wp_query->found_posts / 10),
23-       'current' => $_GET['paged']
24+       'current' => $_GET['paged'],
25+       'context' => 'media-upload'
26 ));
27 
28 if ( $page_links )