Пример #1
0
/**
 * get the global checkout object, will create it
 *
 * @return wpsc_checkout       the global checkout object
 */
function wpsc_core_get_checkout()
{
    global $wpsc_checkout;
    if (empty($wpsc_checkout) || !is_a($wpsc_checkout, 'wpsc_checkout')) {
        $wpsc_checkout = new wpsc_checkout();
    }
    $wpsc_checkout->rewind_checkout_items();
    return $wpsc_checkout;
}
/**
 *	Create an array of item name and active status
 * @access public
 *
 * @since 3.8.14
 * @return (boolean)
 */
function _wpsc_create_checkout_item_required_map()
{
    global $wpsc_checkout;
    if (empty($wpsc_checkout)) {
        $wpsc_checkout = new wpsc_checkout();
    }
    $checkout_item_map = array();
    while (wpsc_have_checkout_items()) {
        $checkout_item = wpsc_the_checkout_item();
        if (!empty($checkout_item->unique_name)) {
            $checkout_item_map[$wpsc_checkout->form_item_unique_name()] = $wpsc_checkout->form_name_is_required();
        }
    }
    $wpsc_checkout->rewind_checkout_items();
    return $checkout_item_map;
}