options = WPSEO_Options::get_all(); $items = $this->get_items( $paged ); $return['items'] = $this->parse_items( $items ); $return['total_items'] = count( $items ); if ( $return['total_items'] >= $this->items_per_page ) { $return['next_page'] = ( $paged + 1 ); } return $return; } /** * Parse the posts|terms with the value we need * * @param array $items The items to parse. * * @return array */ protected function parse_items( array $items ) { $return = array(); foreach ( $items as $item ) { $response = $this->item_to_response( $item ); if ( ! empty( $response ) ) { $return[] = $response; } } return $return; } /** * Get default from the options for given field * * @param string $field The field for which to get the default options. * @param string $suffix The post type. * * @return bool|string */ protected function default_from_options( $field, $suffix ) { $target_option_field = $field . '-' . $suffix; if ( ! empty( $this->options[ $target_option_field ] ) ) { return $this->options[ $target_option_field ]; } return false; } }