static function getBookContents() {

		global $blog_id;

		// -----------------------------------------------------------------------------
		// Is cached?
		// -----------------------------------------------------------------------------

		$cache_id = "book-cnt-$blog_id";
		if ( static::useCache() ) {
			$book_contents = wp_cache_get( $cache_id, 'pb' );
			if ( $book_contents ) {
				return $book_contents;
			}
		}

		// -----------------------------------------------------------------------------
		// Using + to merge arrays...
		// Precedence when using the + operator to merge arrays is from left to right
		// -----------------------------------------------------------------------------

		$book_contents = static::getBookStructure();

		foreach ( $book_contents as $type => $struct ) {

			if ( preg_match( '/^__/', $type ) ) {
				continue; // Skip __magic keys
			}

			if ( 'part' === $type ) {
				foreach ( $struct as $i => $part ) {
					$book_contents[ $type ][ $i ] = $part + get_post( $part['ID'], ARRAY_A );
					foreach ( $part['chapters'] as $j => $chapter ) {
						$book_contents[ $type ][ $i ]['chapters'][ $j ] = $chapter + get_post( $chapter['ID'], ARRAY_A );
					}
				}
			} else {
				foreach ( $struct as $i => $val ) {
					$book_contents[ $type ][ $i ] = $val + get_post( $val['ID'], ARRAY_A );
				}
			}
		}

		// -----------------------------------------------------------------------------
		// Cache & Return
		// -----------------------------------------------------------------------------

		if ( static::useCache() ) {
			wp_cache_set( $cache_id, $book_contents, 'pb', DAY_IN_SECONDS );
		}

		return $book_contents;
	}
static function getBookContents() {

		global $blog_id;

		// -----------------------------------------------------------------------------
		// Is cached?
		// -----------------------------------------------------------------------------

		$cache_id = "book-cnt-$blog_id";
		if ( static::useCache() ) {
			$book_contents = wp_cache_get( $cache_id, 'pb' );
			if ( $book_contents ) {
				return $book_contents;
			}
		}

		// -----------------------------------------------------------------------------
		// Using + to merge arrays...
		// Precedence when using the + operator to merge arrays is from left to right
		// -----------------------------------------------------------------------------

		$book_contents = static::getBookStructure();

		foreach ( $book_contents as $type => $struct ) {

			if ( preg_match( '/^__/', $type ) ) {
				continue; // Skip __magic keys
			}

			if ( 'part' === $type ) {
				foreach ( $struct as $i => $part ) {
					$book_contents[ $type ][ $i ] = $part + get_post( $part['ID'], ARRAY_A );
					foreach ( $part['chapters'] as $j => $chapter ) {
						$book_contents[ $type ][ $i ]['chapters'][ $j ] = $chapter + get_post( $chapter['ID'], ARRAY_A );
					}
				}
			} else {
				foreach ( $struct as $i => $val ) {
					$book_contents[ $type ][ $i ] = $val + get_post( $val['ID'], ARRAY_A );
				}
			}
		}

		// -----------------------------------------------------------------------------
		// Cache & Return
		// -----------------------------------------------------------------------------

		if ( static::useCache() ) {
			wp_cache_set( $cache_id, $book_contents, 'pb', DAY_IN_SECONDS );
		}

		return $book_contents;
	}
static function getBookContents ( ) { global $ blog_id ; // ----------------------------------------------------------------------------- // Is cached? // ----------------------------------------------------------------------------- $ cache_id = "book-cnt-$blog_id" ; if ( static :: useCache ( ) ) { $ book_contents = wp_cache_get ( $ cache_id , 'pb' ) ; if ( $ book_contents ) { return $ book_contents ; } } // ----------------------------------------------------------------------------- // Using + to merge arrays... // Precedence when using the + operator to merge arrays is from left to right // ----------------------------------------------------------------------------- $ book_contents = static :: getBookStructure ( ) ; foreach ( $ book_contents as $ type => $ struct ) { if ( preg_match ( '/^__/' , $ type ) ) { continue ; // Skip __magic keys } if ( 'part' === $ type ) { foreach ( $ struct as $ i => $ part ) { $ book_contents [ $ type ] [ $ i ] = $ part + get_post ( $ part [ 'ID' ] , ARRAY_A ) ; foreach ( $ part [ 'chapters' ] as $ j => $ chapter ) { $ book_contents [ $ type ] [ $ i ] [ 'chapters' ] [ $ j ] = $ chapter + get_post ( $ chapter [ 'ID' ] , ARRAY_A ) ; } } } else { foreach ( $ struct as $ i => $ val ) { $ book_contents [ $ type ] [ $ i ] = $ val + get_post ( $ val [ 'ID' ] , ARRAY_A ) ; } } } // ----------------------------------------------------------------------------- // Cache & Return // ----------------------------------------------------------------------------- if ( static :: useCache ( ) ) { wp_cache_set ( $ cache_id , $ book_contents , 'pb' , DAY_IN_SECONDS ) ; } return $ book_contents ; }
Returns an array representing the entire structure of a book, in correct order,
with a maximum amount of fields. Data is raw and must be post-processed.

@see bottom of this file for more info
@return array
Returns an array representing the entire structure of a book in correct order with a maximum amount of fields . Data is raw and must be post - processed .