wp/wp-admin/includes/class-wp-list-table.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
   205 	 * Make private properties checkable for backward compatibility.
   205 	 * Make private properties checkable for backward compatibility.
   206 	 *
   206 	 *
   207 	 * @since 4.0.0
   207 	 * @since 4.0.0
   208 	 *
   208 	 *
   209 	 * @param string $name Property to check if set.
   209 	 * @param string $name Property to check if set.
   210 	 * @return bool Whether the property is set.
   210 	 * @return bool Whether the property is a back-compat property and it is set.
   211 	 */
   211 	 */
   212 	public function __isset( $name ) {
   212 	public function __isset( $name ) {
   213 		if ( in_array( $name, $this->compat_fields, true ) ) {
   213 		if ( in_array( $name, $this->compat_fields, true ) ) {
   214 			return isset( $this->$name );
   214 			return isset( $this->$name );
   215 		}
   215 		}
       
   216 
       
   217 		return false;
   216 	}
   218 	}
   217 
   219 
   218 	/**
   220 	/**
   219 	 * Make private properties un-settable for backward compatibility.
   221 	 * Make private properties un-settable for backward compatibility.
   220 	 *
   222 	 *
   311 		}
   313 		}
   312 
   314 
   313 		if ( isset( $this->_pagination_args[ $key ] ) ) {
   315 		if ( isset( $this->_pagination_args[ $key ] ) ) {
   314 			return $this->_pagination_args[ $key ];
   316 			return $this->_pagination_args[ $key ];
   315 		}
   317 		}
       
   318 
       
   319 		return 0;
   316 	}
   320 	}
   317 
   321 
   318 	/**
   322 	/**
   319 	 * Whether the table has items to display or not
   323 	 * Whether the table has items to display or not
   320 	 *
   324 	 *
   817 	/**
   821 	/**
   818 	 * Gets the number of items to display on a single page.
   822 	 * Gets the number of items to display on a single page.
   819 	 *
   823 	 *
   820 	 * @since 3.1.0
   824 	 * @since 3.1.0
   821 	 *
   825 	 *
   822 	 * @param string $option
   826 	 * @param string $option        User option name.
   823 	 * @param int    $default
   827 	 * @param int    $default_value Optional. The number of items to display. Default 20.
   824 	 * @return int
   828 	 * @return int
   825 	 */
   829 	 */
   826 	protected function get_items_per_page( $option, $default = 20 ) {
   830 	protected function get_items_per_page( $option, $default_value = 20 ) {
   827 		$per_page = (int) get_user_option( $option );
   831 		$per_page = (int) get_user_option( $option );
   828 		if ( empty( $per_page ) || $per_page < 1 ) {
   832 		if ( empty( $per_page ) || $per_page < 1 ) {
   829 			$per_page = $default;
   833 			$per_page = $default_value;
   830 		}
   834 		}
   831 
   835 
   832 		/**
   836 		/**
   833 		 * Filters the number of items to be displayed on each page of the list table.
   837 		 * Filters the number of items to be displayed on each page of the list table.
   834 		 *
   838 		 *
   904 
   908 
   905 		if ( 1 == $current ) {
   909 		if ( 1 == $current ) {
   906 			$disable_first = true;
   910 			$disable_first = true;
   907 			$disable_prev  = true;
   911 			$disable_prev  = true;
   908 		}
   912 		}
   909 		if ( 2 == $current ) {
       
   910 			$disable_first = true;
       
   911 		}
       
   912 		if ( $total_pages == $current ) {
   913 		if ( $total_pages == $current ) {
   913 			$disable_last = true;
   914 			$disable_last = true;
   914 			$disable_next = true;
   915 			$disable_next = true;
   915 		}
       
   916 		if ( $total_pages - 1 == $current ) {
       
   917 			$disable_last = true;
       
   918 		}
   916 		}
   919 
   917 
   920 		if ( $disable_first ) {
   918 		if ( $disable_first ) {
   921 			$page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&laquo;</span>';
   919 			$page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&laquo;</span>';
   922 		} else {
   920 		} else {