Changeset 2001
- Timestamp:
- 10/20/2015 09:47:41 AM (9 years ago)
- Location:
- sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/class-translation-editors-list-table.php
r1792 r2001 67 67 */ 68 68 public function prepare_items() { 69 $search = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';70 $per_page = 10;71 $paged = $this->get_pagenum();69 $search = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : ''; 70 $per_page = $this->get_items_per_page( 'translation_editors_per_page', 10 ); 71 $paged = $this->get_pagenum(); 72 72 73 73 $args = array( -
sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/rosetta-roles.php
r1944 r2001 47 47 add_action( 'admin_menu', array( $this, 'register_translation_editors_page' ) ); 48 48 add_filter( 'user_row_actions', array( $this, 'promote_user_to_translation_editor' ), 10, 2 ); 49 add_filter( 'set-screen-option', array( $this, 'save_custom_screen_options' ), 10, 3 ); 49 50 } 50 51 … … 210 211 211 212 add_action( 'load-' . $this->translation_editors_page, array( $this, 'load_translation_editors_page' ) ); 213 add_action( 'load-' . $this->translation_editors_page, array( $this, 'register_screen_options' ) ); 212 214 add_action( 'admin_print_scripts-' . $this->translation_editors_page, array( $this, 'enqueue_scripts' ) ); 213 215 add_action( 'admin_footer-' . $this->translation_editors_page, array( $this, 'print_js_templates' ) ); … … 258 260 259 261 /** 262 * Registers a 'per_page' screen option for the list table. 263 */ 264 public function register_screen_options() { 265 $option = 'per_page'; 266 $args = array( 267 'default' => 10, 268 'option' => 'translation_editors_per_page' 269 ); 270 add_screen_option( $option, $args ); 271 } 272 273 /** 274 * Adds the 'per_page' screen option to the whitelist so it gets saved. 275 * 276 * @param bool|int $new_value Screen option value. Default false to skip. 277 * @param string $option The option name. 278 * @param int $value The number of rows to use. 279 * @return bool|int New screen option value. 280 */ 281 public function save_custom_screen_options( $new_value, $option, $value ) { 282 if ( 'translation_editors_per_page' !== $option ) { 283 return $new_value; 284 } 285 286 $value = (int) $value; 287 if ( $value < 1 || $value > 999 ) { 288 return $new_value; 289 } 290 291 return $value; 292 } 293 294 /** 260 295 * Loads either the overview or the edit handler. 261 296 */
Note: See TracChangeset
for help on using the changeset viewer.