Пример #1
0
 function test_arguments_cache_support()
 {
     $items = array('test' => array('hello'));
     $items2 = array('test2' => array('hello2'));
     add_theme_support('app-payments', array('items' => $items));
     $this->assertEquals(appthemes_payments_get_args('items'), $items);
     $this->assertEquals(appthemes_payments_get_args('items'), $items);
     add_theme_support('app-payments', array('items' => $items2));
     $this->assertEquals(appthemes_payments_get_args('items'), $items2);
 }
Пример #2
0
function appthemes_load_options()
{
    extract(appthemes_payments_get_args(), EXTR_SKIP);
    if (is_admin()) {
        APP_Connected_Post_Orders::add_post_type($items_post_types);
    }
    if ($options) {
        APP_Gateway_Registry::register_options($options);
    } else {
        $defaults = array('currency_code' => 'USD', 'currency_identifier' => 'symbol', 'currency_position' => 'left', 'thousands_separator' => ',', 'decimal_separator' => '.', 'tax_charge' => 0, 'gateways' => array('enabled' => array()));
        $options = new scbOptions('app_payments', false, $defaults);
        APP_Gateway_Registry::register_options($options);
    }
}
/**
 * Sets up the order system
 * @return void
 */
function appthemes_setup_orders()
{
    $args = array('labels' => array('name' => __('Orders', APP_TD), 'singular_name' => __('Order', APP_TD), 'add_new' => __('Add New', APP_TD), 'add_new_item' => __('Add New Order', APP_TD), 'edit_item' => __('Edit Order', APP_TD), 'new_item' => __('New Order', APP_TD), 'view_item' => __('View Order', APP_TD), 'search_items' => __('Search Orders', APP_TD), 'not_found' => __('No orders found', APP_TD), 'not_found_in_trash' => __('No orders found in Trash', APP_TD), 'parent_item_colon' => __('Parent Order:', APP_TD), 'menu_name' => __('Orders', APP_TD)), 'hierarchical' => false, 'supports' => array('author', 'custom-fields'), 'public' => true, 'show_ui' => true, 'show_in_menu' => 'app-payments', 'rewrite' => array('slug' => 'order'));
    register_post_type(APPTHEMES_ORDER_PTYPE, apply_filters('appthemes_order_ptype_args', $args));
    $statuses = array(APPTHEMES_ORDER_PENDING => _n_noop('Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>', APP_TD), APPTHEMES_ORDER_FAILED => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', APP_TD), APPTHEMES_ORDER_COMPLETED => _n_noop('Completed <span class="count">(%s)</span>', 'Completed <span class="count">(%s)</span>', APP_TD), APPTHEMES_ORDER_ACTIVATED => _n_noop('Activated <span class="count">(%s)</span>', 'Activated <span class="count">(%s)</span>', APP_TD));
    foreach ($statuses as $status => $translate_string) {
        register_post_status($status, array('public' => true, 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, 'label_count' => $translate_string));
    }
    $args = appthemes_payments_get_args();
    $initial_ptypes = $args['items_post_types'];
    if (!is_array($initial_ptypes)) {
        $initial_ptypes = array($initial_ptypes);
    }
    $post_types = apply_filters('appthemes_order_item_posts_types', $initial_ptypes);
    $post_types[] = APPTHEMES_ORDER_PTYPE;
    p2p_register_connection_type(array('name' => APPTHEMES_ORDER_CONNECTION, 'from' => APPTHEMES_ORDER_PTYPE, 'to' => $post_types, 'cardinality' => 'many-to-many', 'admin_box' => false, 'prevent_duplicates' => false, 'self_connections' => true));
    APP_Item_Registry::register('_regional-tax', __('Regional Taxes', APP_TD), array(), 99);
}
Пример #4
0
 /**
  * Processes a Bank Transfer Order to display
  * instructions to the user
  * @param  APP_Order $order   Order to display information for
  * @param  array $options     User entered options
  * @return void
  */
 public function process($order, $options)
 {
     $sent = get_post_meta($order->get_ID(), 'bt-sentemail', true);
     if (empty($sent)) {
         appthemes_bank_transfer_pending_email(get_post($order->get_ID()));
         update_post_meta($order->get_ID(), 'bt-sentemail', true);
     }
     $templates = appthemes_payments_get_args('templates');
     $template_name = $templates['bank-transfer'];
     $located = appthemes_locate_template($template_name);
     if ($located) {
         // load theme template
         $order = appthemes_get_order($order->get_ID());
         appthemes_load_template($template_name, array('order' => $order));
     } else {
         // load bundled template
         require_once dirname(__FILE__) . '/template/' . $template_name;
     }
 }
Пример #5
0
/**
 * Get the full URL for an image
 *
 * @param string $name The basename of the image
 * @return string
 */
function appthemes_payments_image($name)
{
    return appthemes_payments_get_args('images_url') . $name;
}
 function test_modified_payments_support()
 {
     $items = array('test' => array('hello'));
     add_theme_support('app-payments', array('items' => $items));
     $this->assertEquals(appthemes_payments_get_args('items'), $items);
 }
Пример #7
0
/**
 * Checks if escrow sub component is enabled.
 *
 * @return bool
 */
function appthemes_is_escrow_enabled()
{
    return (bool) appthemes_payments_get_args('escrow');
}