cart->cart_contents as $cart_item ) { if ( $cart_item['product_id'] == $product_id ) return true; } } return false; } /** * Retrieves the price for a specific edition. * @param string $edition The constant that describes the edition desired; if not provided, queries BPQ_EDITION * @return integer The price */ public static function price( $edition = null ) { if ( $edition == null ) $edition = BPQ_EDITION; switch ( $edition ) { case 1: return 0; case 2: return 69; case 3: return 99; } return 0; } /** * Retrieves the ID of the desired product. * @param string $edition The constant that describes the edition desired; if not provided, queries BPQ_EDITION * @return integer The ID as defined with WC in the WP database */ public static function product_id( $edition = null ) { if ( $edition == null ) $edition = BPQ_EDITION; switch ( $edition ) { case 1: return 1648; case 2: return 1649; case 3: return 1650; } die( 'Unknown edition - does not have a product ID' ); } /** * Retrieves the public address that places the given edition in * the current visitor's cart and checks them out through PayPal. * @param string $edition The constant that describes the edition desired; if not provided, queries BPQ_EDITION * @return string The URL */ public static function url_buy( $edition = null ) { if ( $edition == null ) $edition = BPQ_EDITION; return welcome::url().'/?add-to-cart='.self::product_id( $edition ); } /** * Retrieves the public address to the BluePrint-Q Cart page. */ public static function url_cart() { if ( array_key_exists( 'woocommerce', $GLOBALS ) ) { global $woocommerce; return $woocommerce->cart->get_cart_url(); } return ''; } /** * Retrieves the public address to the BluePrint-Q Checkout page. * @return string The URL */ public static function url_checkout() { if ( array_key_exists( 'woocommerce', $GLOBALS ) ) { global $woocommerce; return $woocommerce->cart->get_checkout_url(); } return ''; } /* PRIVATE */ /** * Only use this class as a utility. */ private function __construct() { // Intentionally blank.. } } /** * Class that represents shortcuts around BluePrint-Q's Services page. */ class services { /* PUBLIC */ /** * Retrieves the public address to the BluePrint-Q Services page. * @return string The URL */ public static function url() { return 'http://www.blueprintq.com/services'; } /** * Retrieves the public address to the Services page Custom Consulting stripe. * @return string The URL */ public static function url_custom() { return self::url().'/#custom'; } /** * Retrieves the public address to the Services page Emerald stripe. * @return string The URL */ public static function url_emerald() { return self::url().'/#emerald'; } /** * Retrieves the public address to the Services page Premium stripe. * @return string The URL */ public static function url_premium() { return self::url().'/#premium'; } /** * Retrieves the public address to the Services page Ruby stripe. * @return string The URL */ public static function url_ruby() { return self::url().'/#ruby'; } /** * Retrieves the public address to the Services page Sapphire stripe. * @return string The URL */ public static function url_sapphire() { return self::url().'/#sapphire'; } /* PRIVATE */ /** * Only use this class as a utility. */ private function __construct() { // Intentionally blank.. } } /** * Class that represents shortcuts around BluePrint-Q's Welcome page. */ class welcome { /* PUBLIC */ /** * Retrieves the public address to the BluePrint-Q Welcome page. * @return string The URL */ public static function url() { return 'http://www.blueprintq.com'; } /** * Retrieves the public address to the Welcome page Decision stripe. * @return string The URL */ public static function url_decision() { return self::url().'/#decision'; } /** * Retrieves the public address to the Welcome page Framework stripe. * @return string The URL */ public static function url_framework() { return self::url().'/#framework'; } /** * Retrieves the public address to the Welcome page Service stripe. * @return string The URL */ public static function url_service() { return self::url().'/#service'; } /* PRIVATE */ /** * Only use this class as a utility. */ private function __construct() { // Intentionally blank.. } } ?>