brainstorm_get_all_products( bool $skip_plugins = false, bool $skip_themes = false, bool $skip_bundled = false )

Get BSF all products.


Description


Parameters

$skip_plugins

(bool) (Optional) Skip plugins.

Default value: false

$skip_themes

(bool) (Optional) Skip themes.

Default value: false

$skip_bundled

(bool) (Optional) Skip bundled.

Default value: false


Return

(array) All Products.


Source

File: admin/bsf-core/includes/helpers.php

	function brainstorm_get_all_products( $skip_plugins = false, $skip_themes = false, $skip_bundled = false ) {

		$brainstrom_products         = get_option( 'brainstrom_products', array() );
		$brainstrom_bundled_products = get_option( 'brainstrom_bundled_products', array() );
		$brainstorm_plugins          = isset( $brainstrom_products['plugins'] ) ? $brainstrom_products['plugins'] : array();
		$brainstorm_themes           = isset( $brainstrom_products['themes'] ) ? $brainstrom_products['themes'] : array();

		if ( true === $skip_plugins ) {
			$all_products = $brainstorm_themes;
		} elseif ( true === $skip_themes ) {
			$all_products = $brainstorm_plugins;
		} else {
			$all_products = $brainstorm_plugins + $brainstorm_themes;
		}

		if ( false === $skip_bundled ) {

			foreach ( $brainstrom_bundled_products as $parent_id => $parent ) {

				foreach ( $parent as $key => $product ) {

					if ( isset( $all_products[ $product->id ] ) ) {
						$all_products[ $product->id ] = array_merge( $all_products[ $product->id ], (array) $product );
					} else {
						$all_products[ $product->id ] = (array) $product;
					}
				}
			}
		}

		return $all_products;
	}


User Contributed Notes

You must log in before being able to contribute a note or feedback.