Ejemplo n.º 1
0
 /**
  * Setup constructor
  *
  * @return voidtax
  * @author Jonathan Davis
  **/
 public function __construct()
 {
     parent::__construct();
     switch ($this->pagename) {
         case 'pages':
             shopp_enqueue_script('jquery-tmpl');
             shopp_enqueue_script('pageset');
             $this->pages_ui();
             break;
         case 'images':
             shopp_enqueue_script('jquery-tmpl');
             shopp_enqueue_script('imageset');
             shopp_localize_script('imageset', '$is', array('confirm' => __('Are you sure you want to remove this image preset?', 'Shopp')));
             $this->images_ui();
             break;
         case 'management':
             shopp_enqueue_script('jquery-tmpl');
             shopp_enqueue_script('labelset');
             shopp_localize_script('labelset', '$sl', array('prompt' => __('Are you sure you want to remove this order status label?', 'Shopp')));
             break;
         case 'core':
         case 'setup':
             shopp_enqueue_script('setup');
             break;
     }
 }
Ejemplo n.º 2
0
 public function assets()
 {
     shopp_enqueue_script('jquery-tmpl');
     shopp_enqueue_script('shiprates');
     shopp_localize_script('shiprates', '$ps', array('confirm' => __('Are you sure you want to remove this shipping rate?', 'Shopp')));
     $this->nonce($this->request('page'));
 }
Ejemplo n.º 3
0
 public function assets()
 {
     shopp_enqueue_script('setup');
     shopp_localize_script('setup', '$ss', array('loading' => Shopp::__('Loading…'), 'prompt' => Shopp::__('Select your %s…', '%s')));
     shopp_enqueue_script('selectize');
     $this->nonce($this->request('page'));
 }
Ejemplo n.º 4
0
 public function assets()
 {
     shopp_enqueue_script('ocupload');
     shopp_enqueue_script('jquery-tmpl');
     shopp_enqueue_script('taxrates');
     shopp_enqueue_script('suggest');
     shopp_localize_script('taxrates', '$tr', array('confirm' => __('Are you sure you want to remove this tax rate?', 'Shopp')));
 }
Ejemplo n.º 5
0
 /**
  * Setup constructor
  *
  * @return voidtax
  * @author Jonathan Davis
  **/
 public function __construct()
 {
     parent::__construct();
     switch ($this->pagename) {
         case 'taxes':
             shopp_enqueue_script('ocupload');
             shopp_enqueue_script('jquery-tmpl');
             shopp_enqueue_script('taxrates');
             shopp_enqueue_script('suggest');
             shopp_localize_script('taxrates', '$tr', array('confirm' => __('Are you sure you want to remove this tax rate?', 'Shopp')));
             $this->subscreens = array('rates' => __('Rates', 'Shopp'), 'settings' => __('Settings', 'Shopp'));
             if (isset($_GET['sub'])) {
                 $this->url = add_query_arg(array('sub' => esc_attr($_GET['sub'])), $this->url);
             } else {
                 $_GET['sub'] = shopp_setting_enabled('taxes') ? 'rates' : 'settings';
             }
             if (shopp_setting_enabled('taxes')) {
                 $this->taxrate_ui();
             }
             break;
         case 'advanced':
             shopp_enqueue_script('colorbox');
             shopp_enqueue_script('system');
             shopp_localize_script('system', '$sys', array('indexing' => __('Product Indexing', 'Shopp'), 'indexurl' => wp_nonce_url(add_query_arg('action', 'shopp_rebuild_search_index', admin_url('admin-ajax.php')), 'wp_ajax_shopp_rebuild_search_index')));
             break;
         case 'storage':
             shopp_enqueue_script('jquery-tmpl');
             shopp_enqueue_script('storage');
             break;
         case 'shipping':
             shopp_enqueue_script('jquery-tmpl');
             shopp_enqueue_script('shiprates');
             shopp_localize_script('shiprates', '$ps', array('confirm' => __('Are you sure you want to remove this shipping rate?', 'Shopp')));
             $this->subscreens = array('rates' => __('Rates', 'Shopp'), 'settings' => __('Settings', 'Shopp'));
             if (isset($_GET['sub'])) {
                 $this->url = add_query_arg(array('sub' => esc_attr($_GET['sub'])), $this->url);
             } else {
                 $_GET['sub'] = shopp_setting_enabled('taxes') ? 'rates' : 'settings';
             }
             if (shopp_setting_enabled('shipping')) {
                 $this->shipping_ui();
             }
             break;
         case 'payments':
         default:
             shopp_enqueue_script('jquery-tmpl');
             shopp_enqueue_script('payments');
             shopp_localize_script('payments', '$ps', array('confirm' => __('Are you sure you want to remove this payment system?', 'Shopp')));
             add_action("load-{$this->screen}", array($this, 'payments_help'), 20);
             $this->payments_ui();
             break;
     }
 }
Ejemplo n.º 6
0
 /**
  * Store constructor
  *
  * @author Jonathan Davis
  * @since 1.1
  * @version 1.2
  *
  * @return void
  **/
 public function __construct()
 {
     parent::__construct();
     Shopping::restore('worklist', $this->worklist);
     if ('off' == shopp_setting('inventory')) {
         array_splice($this->views, 4, 1);
     }
     if (isset($_GET['view']) && in_array($_GET['view'], $this->views)) {
         $this->view = $_GET['view'];
     }
     if (get_current_screen()) {
         get_current_screen()->post_type = ShoppProduct::$posttype;
     }
     if (!empty($_GET['id'])) {
         wp_enqueue_script('jquery-ui-draggable');
         wp_enqueue_script('postbox');
         wp_enqueue_script('wp-lists');
         if (user_can_richedit()) {
             wp_enqueue_script('editor');
             wp_enqueue_script('quicktags');
             add_action('admin_print_footer_scripts', 'wp_tiny_mce', 20);
         }
         shopp_enqueue_script('colorbox');
         shopp_enqueue_script('editors');
         shopp_enqueue_script('scalecrop');
         shopp_enqueue_script('calendar');
         shopp_enqueue_script('product-editor');
         shopp_enqueue_script('priceline');
         shopp_enqueue_script('ocupload');
         shopp_enqueue_script('swfupload');
         shopp_enqueue_script('jquery-tmpl');
         shopp_enqueue_script('suggest');
         shopp_enqueue_script('search-select');
         do_action('shopp_product_editor_scripts');
         add_action('admin_head', array(&$this, 'layout'));
     } else {
         add_action('load-' . $this->screen, array($this, 'loader'));
         add_action('admin_print_scripts', array($this, 'columns'));
     }
     if ('inventory' == $this->view && shopp_setting_enabled('inventory')) {
         do_action('shopp_inventory_manager_scripts');
     }
     add_action('load-' . $this->screen, array($this, 'workflow'));
     do_action('shopp_product_admin_scripts');
     new ContentParser();
     add_action('shopp_product_saved', array($this, 'index'), 99, 1);
 }
Ejemplo n.º 7
0
 /**
  * Promote constructor
  *
  * @return void
  * @author Jonathan Davis
  **/
 public function __construct()
 {
     parent::__construct();
     $this->save();
     if (!empty($_GET['id'])) {
         wp_enqueue_script('postbox');
         shopp_enqueue_script('colorbox');
         shopp_enqueue_script('calendar');
         shopp_enqueue_script('suggest');
         do_action('shopp_promo_editor_scripts');
         add_action('admin_head', array($this, 'layout'));
     } else {
         add_action('admin_print_scripts', array($this, 'columns'));
     }
     do_action('shopp_promo_admin_scripts');
     // @deprecated
     do_action('shopp_admin_discount_scripts');
     $defaults = array('page' => false, 'action' => false, 'selected' => array());
     $args = array_merge($defaults, $_GET);
     extract($args, EXTR_SKIP);
     if (!is_array($selected)) {
         $selected = array($selected);
     }
     $url = add_query_arg(array_merge($_GET, array('page' => $this->page)), admin_url('admin.php'));
     $f = array('action', 'selected', 's');
     if ($this->page == $page && !empty($action)) {
         switch ($action) {
             case 'enable':
                 ShoppPromo::enableset($selected);
                 break;
             case 'disable':
                 ShoppPromo::disableset($selected);
                 break;
             case 'delete':
                 ShoppPromo::deleteset($selected);
                 break;
             case 'duplicate':
                 $P = new ShoppPromo($selected[0]);
                 $P->duplicate();
                 break;
         }
         $url = remove_query_arg($f, $url);
         wp_redirect($url);
         exit;
     }
 }
Ejemplo n.º 8
0
 /**
  * Categorize constructor
  *
  * @return void
  * @author Jonathan Davis
  **/
 public function __construct()
 {
     parent::__construct();
     Shopping::restore('worklist', $this->worklist);
     if ('shopp-tags' == $_GET['page']) {
         wp_redirect(add_query_arg(array('taxonomy' => ProductTag::$taxon), admin_url('edit-tags.php')));
         return;
     }
     if (!empty($_GET['id']) && !isset($_GET['a'])) {
         wp_enqueue_script('postbox');
         wp_enqueue_script('swfupload-all');
         if (user_can_richedit()) {
             wp_enqueue_script('editor');
             wp_enqueue_script('quicktags');
             add_action('admin_print_footer_scripts', 'wp_tiny_mce', 20);
         }
         shopp_enqueue_script('colorbox');
         shopp_enqueue_script('editors');
         shopp_enqueue_script('category-editor');
         shopp_enqueue_script('priceline');
         shopp_enqueue_script('ocupload');
         shopp_enqueue_script('swfupload');
         shopp_enqueue_script('shopp-swfupload-queue');
         do_action('shopp_category_editor_scripts');
         add_action('admin_head', array($this, 'layout'));
     } elseif (!empty($_GET['a']) && $_GET['a'] == 'arrange') {
         shopp_enqueue_script('category-arrange');
         do_action('shopp_category_arrange_scripts');
         add_action('admin_print_scripts', array($this, 'arrange_cols'));
     } elseif (!empty($_GET['a']) && $_GET['a'] == 'products') {
         shopp_enqueue_script('products-arrange');
         do_action('shopp_category_products_arrange_scripts');
         add_action('admin_print_scripts', array($this, 'products_cols'));
     } else {
         add_action('admin_print_scripts', array($this, 'columns'));
     }
     do_action('shopp_category_admin_scripts');
     add_action('load-' . $this->screen, array($this, 'workflow'));
 }
Ejemplo n.º 9
0
 /**
  * Constructor
  *
  * Includes the client-side libraries needed for rendering the chart
  *
  * @author Jonathan Davis
  * @since 1.3
  *
  * @return void
  **/
 public function __construct()
 {
     shopp_enqueue_script('flot');
     shopp_enqueue_script('flot-time');
     shopp_enqueue_script('flot-grow');
 }
Ejemplo n.º 10
0
 public function assets()
 {
     shopp_enqueue_script('colorbox');
     shopp_enqueue_script('system');
     shopp_localize_script('system', '$sys', array('indexing' => __('Product Indexing', 'Shopp'), 'indexurl' => wp_nonce_url(add_query_arg('action', 'shopp_rebuild_search_index', admin_url('admin-ajax.php')), 'wp_ajax_shopp_rebuild_search_index')));
 }
Ejemplo n.º 11
0
 /**
  * Enqueue the scripts
  *
  * @since 1.4
  *
  * @return void
  **/
 public function assets()
 {
     wp_enqueue_script('postbox');
     shopp_enqueue_script('colorbox');
     shopp_enqueue_script('jquery-tmpl');
     shopp_enqueue_script('selectize');
     shopp_enqueue_script('orders');
     shopp_custom_script('orders', 'var address = [], carriers = ' . json_encode($this->shipcarriers()) . ';');
     shopp_localize_script('orders', '$om', array('co' => Shopp::__('Cancel Order'), 'mr' => Shopp::__('Mark Refunded'), 'pr' => Shopp::__('Process Refund'), 'dnc' => Shopp::__('Do Not Cancel'), 'ro' => Shopp::__('Refund Order'), 'cancel' => Shopp::__('Cancel'), 'rr' => Shopp::__('Reason for refund'), 'rc' => Shopp::__('Reason for cancellation'), 'mc' => Shopp::__('Mark Cancelled'), 'stg' => Shopp::__('Send to gateway')));
     shopp_enqueue_script('address');
     shopp_custom_script('address', 'var regions = ' . json_encode(ShoppLookup::country_zones()) . ';');
     do_action('shopp_order_management_scripts');
 }
Ejemplo n.º 12
0
 public function assets()
 {
     wp_enqueue_script('postbox');
     shopp_enqueue_script('colorbox');
     shopp_enqueue_script('calendar');
     shopp_enqueue_script('suggest');
     do_action('shopp_promo_editor_scripts');
 }
Ejemplo n.º 13
0
 /**
  * Registers the column headers for the orders list interface
  *
  * Uses the WordPress 2.7 function register_column_headers to provide
  * customizable columns that can be toggled to show or hide
  *
  * @author Jonathan Davis
  * @return void
  **/
 public function columns()
 {
     shopp_enqueue_script('calendar');
     shopp_enqueue_script('daterange');
     register_column_headers($this->screen, array('cb' => '<input type="checkbox" />', 'order' => __('Order', 'Shopp'), 'name' => __('Name', 'Shopp'), 'destination' => __('Destination', 'Shopp'), 'txn' => __('Transaction', 'Shopp'), 'date' => __('Date', 'Shopp'), 'total' => __('Total', 'Shopp')));
 }
Ejemplo n.º 14
0
 /**
  * Registers the column headers for the customer list screen
  *
  * @author Jonathan Davis
  * @return void
  **/
 public function columns()
 {
     shopp_enqueue_script('calendar');
     shopp_enqueue_script('daterange');
     register_column_headers($this->screen, array('cb' => '<input type="checkbox" />', 'customer-name' => __('Name', 'Shopp'), 'customer-login' => __('Login', 'Shopp'), 'email' => __('Email', 'Shopp'), 'customer-location' => __('Location', 'Shopp'), 'customer-orders' => __('Orders', 'Shopp'), 'customer-joined' => __('Joined', 'Shopp')));
 }
Ejemplo n.º 15
0
 /**
  * Dynamically includes necessary JavaScript and stylesheets for the admin
  *
  * @author Jonathan Davis
  * @since 1.0
  *
  * @return void
  **/
 public function behaviors()
 {
     global $wp_version, $hook_suffix;
     if (!in_array($hook_suffix, $this->menus)) {
         return;
     }
     $this->styles();
     shopp_enqueue_script('shopp');
     $settings = array_filter(array_keys($this->pages), array($this, 'get_settings_pages'));
     if (in_array($this->Page->page, $settings)) {
         shopp_enqueue_script('settings');
     }
 }
Ejemplo n.º 16
0
 public function assets()
 {
     wp_enqueue_script('postbox');
     wp_enqueue_script('password-strength-meter');
     shopp_enqueue_script('suggest');
     shopp_enqueue_script('colorbox');
     shopp_enqueue_script('jquery-tmpl');
     shopp_enqueue_script('selectize');
     shopp_enqueue_script('address');
     shopp_enqueue_script('customers');
     do_action('shopp_customer_editor_scripts');
 }
Ejemplo n.º 17
0
 public function assets()
 {
     shopp_enqueue_script('jquery-tmpl');
     shopp_enqueue_script('labelset');
     shopp_localize_script('labelset', '$sl', array('prompt' => __('Are you sure you want to remove this order status label?', 'Shopp')));
 }
Ejemplo n.º 18
0
 /**
  * Queues Shopp storefront javascript and styles as needed
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 public function behaviors()
 {
     $Shopp = Shopp::object();
     if (is_ssl()) {
         $urls = array('option_siteurl', 'option_home', 'option_url', 'option_wpurl', 'option_stylesheet_url', 'option_template_url', 'script_loader_src');
         foreach ($urls as $filter) {
             add_filter($filter, 'force_ssl');
         }
     }
     // Replace the WordPress canonical link
     remove_action('wp_head', 'rel_canonical');
     add_action('wp_head', array($this, 'header'));
     add_action('wp_footer', array($this, 'footer'));
     wp_enqueue_style('shopp.catalog', SHOPP_ADMIN_URI . '/styles/catalog.css', array(), 20110511, 'screen');
     wp_enqueue_style('shopp.icons', SHOPP_ADMIN_URI . '/styles/icons.css', array(), 20110511, 'screen');
     wp_enqueue_style('shopp', Shopp::template_url('shopp.css'), array(), 20110511, 'screen');
     wp_enqueue_style('shopp.colorbox', SHOPP_ADMIN_URI . '/styles/colorbox.css', array(), 20110511, 'screen');
     $orderhistory = is_account_page() && isset($_GET['id']) && !empty($_GET['id']);
     if (is_thanks_page() || $orderhistory) {
         wp_enqueue_style('shopp.printable', SHOPP_ADMIN_URI . '/styles/printable.css', array(), 20110511, 'print');
     }
     $loading = shopp_setting('script_loading');
     if (!$loading || 'global' == $loading || !empty($page)) {
         shopp_enqueue_script('colorbox');
         shopp_enqueue_script('shopp');
         shopp_enqueue_script('catalog');
         shopp_enqueue_script('cart');
         if (is_catalog_page()) {
             shopp_custom_script('catalog', "var pricetags = {};\n");
         }
     }
     if (is_checkout_page()) {
         shopp_enqueue_script('address');
         shopp_enqueue_script('checkout');
     }
     if (is_confirm_page()) {
         shopp_enqueue_script('checkout');
     }
     if (is_account_page()) {
         shopp_enqueue_script('address');
         $regions = Lookup::country_zones();
         $js = 'var regions=' . json_encode($regions);
         add_storefrontjs($js, true);
     }
 }
Ejemplo n.º 19
0
 /**
  * Registers the column headers for the customer list screen
  *
  * @author Jonathan Davis
  * @return void
  **/
 function columns()
 {
     shopp_enqueue_script('calendar');
     register_column_headers('shopp_page_shopp-memberships', array('cb' => '<input type="checkbox" />', 'name' => __('Name', 'Shopp'), 'type' => __('Type', 'Shopp'), 'products' => __('Products', 'Shopp'), 'members' => __('Members', 'Shopp')));
 }
Ejemplo n.º 20
0
 public function assets()
 {
     wp_enqueue_script('jquery-ui-draggable');
     wp_enqueue_script('postbox');
     wp_enqueue_script('wp-lists');
     if (user_can_richedit()) {
         wp_enqueue_script('editor');
         wp_enqueue_script('quicktags');
         add_action('admin_print_footer_scripts', 'wp_tiny_mce', 20);
     }
     shopp_enqueue_script('colorbox');
     shopp_enqueue_script('editors');
     shopp_enqueue_script('scalecrop');
     shopp_enqueue_script('calendar');
     shopp_enqueue_script('product-editor');
     shopp_enqueue_script('priceline');
     shopp_enqueue_script('ocupload');
     shopp_enqueue_script('swfupload');
     shopp_enqueue_script('jquery-tmpl');
     shopp_enqueue_script('suggest');
     shopp_enqueue_script('search-select');
     shopp_enqueue_script('shopp-swfupload-queue');
     do_action('shopp_product_editor_scripts');
 }
Ejemplo n.º 21
0
 /**
  * Dynamically includes necessary JavaScript and stylesheets for the admin
  *
  * @since 1.4
  *
  * @return void
  **/
 public function assets()
 {
     // Global scripts
     shopp_enqueue_script('shopp');
     // Global styles
     shopp_enqueue_style('colorbox');
     shopp_enqueue_style('admin');
     shopp_enqueue_style('icons');
     shopp_enqueue_style('selectize');
     if ('rtl' == get_bloginfo('text_direction')) {
         shopp_enqueue_style('admin-rtl');
     }
     // Screen assets (scripts & styles)
     $this->Screen->assets();
     do_action('shopp_' . $this->Screen->slug() . '_admin_scripts');
 }
Ejemplo n.º 22
0
 public function assets()
 {
     wp_enqueue_script('postbox');
     if (user_can_richedit()) {
         wp_enqueue_script('editor');
         wp_enqueue_script('quicktags');
         add_action('admin_print_footer_scripts', 'wp_tiny_mce', 20);
     }
     shopp_enqueue_script('colorbox');
     shopp_enqueue_script('editors');
     shopp_enqueue_script('category-editor');
     shopp_enqueue_script('priceline');
     shopp_enqueue_script('ocupload');
     shopp_enqueue_script('swfupload');
     shopp_enqueue_script('shopp-swfupload-queue');
     do_action('shopp_category_editor_scripts');
 }
Ejemplo n.º 23
0
 /**
  * Provides the registration form action URL
  *
  * @api `shopp('customer.registration-form')`
  * @since 1.2
  *
  * @param string        $result  The output
  * @param array         $options The options
  * @param ShoppCustomer $O       The working object
  * @return string The registration form URL
  **/
 public static function registration_form($result, $options, $O)
 {
     $regions = Lookup::country_zones();
     add_storefrontjs('var regions = ' . json_encode($regions) . ';', true);
     shopp_enqueue_script('address');
     return Shopp::raw_request_url();
 }
Ejemplo n.º 24
0
/**
 * Handle Shopp script dependencies in the WP script queue
 *
 * @api
 * @since 1.1
 *
 * @global ShoppScripts $ShoppScripts The ShoppScripts controller object for adding scripts to a page.
 * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
 *
 * @return void
 **/
function shopp_dependencies()
{
    global $ShoppScripts, $wp_scripts;
    if (!is_a($ShoppScripts, 'ShoppScripts')) {
        $ShoppScripts = new ShoppScripts();
    }
    foreach ($wp_scripts->queue as $handle) {
        $deps = $wp_scripts->registered[$handle]->deps;
        $shoppdeps = array_intersect($deps, array_keys($ShoppScripts->registered));
        foreach ($shoppdeps as $key => $s_handle) {
            shopp_enqueue_script($s_handle);
            array_splice($deps, $key, 1);
        }
        $wp_scripts->registered[$handle]->deps = $deps;
    }
}
Ejemplo n.º 25
0
 public function assets()
 {
     shopp_enqueue_script('jquery-tmpl');
     shopp_enqueue_script('pageset');
 }
Ejemplo n.º 26
0
 function setup()
 {
     shopp_enqueue_script('jvectormap');
     shopp_enqueue_script('worldmap');
 }
Ejemplo n.º 27
0
 public function assets()
 {
     shopp_enqueue_script('jquery-tmpl');
     shopp_enqueue_script('imageset');
     shopp_localize_script('imageset', '$is', array('confirm' => __('Are you sure you want to remove this image preset?', 'Shopp')));
 }
Ejemplo n.º 28
0
 public function assets()
 {
     shopp_enqueue_script('jquery-tmpl');
     shopp_enqueue_script('payments');
     shopp_localize_script('payments', '$ps', array('confirm' => __('Are you sure you want to remove this payment system?', 'Shopp')));
 }