Esempio n. 1
0
 public function __construct(Wordpress $wp, Options $options, Messages $messages, CartServiceInterface $cartService, CustomerServiceInterface $customerService, ShippingServiceInterface $shippingService, PaymentServiceInterface $paymentService, OrderServiceInterface $orderService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->messages = $messages;
     $this->cartService = $cartService;
     $this->customerService = $customerService;
     $this->shippingService = $shippingService;
     $this->paymentService = $paymentService;
     $this->orderService = $orderService;
     Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css');
     Styles::add('jigoshop.checkout', \JigoshopInit::getUrl() . '/assets/css/shop/checkout.css', array('jigoshop.shop', 'jigoshop.vendors.select2'));
     Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jquery'));
     Scripts::add('jigoshop.vendors.bs_tab_trans_tooltip_collapse', \JigoshopInit::getUrl() . '/assets/js/vendors/bs_tab_trans_tooltip_collapse.js', array('jquery'));
     Scripts::add('jigoshop.checkout', \JigoshopInit::getUrl() . '/assets/js/shop/checkout.js', array('jquery', 'jquery-blockui', 'jigoshop.helpers', 'jigoshop.vendors.select2', 'jigoshop.vendors.bs_tab_trans_tooltip_collapse'));
     Scripts::localize('jigoshop.checkout', 'jigoshop_checkout', array('assets' => \JigoshopInit::getUrl() . '/assets', 'i18n' => array('loading' => __('Loading...', 'jigoshop'))));
     if (!$wp->isSsl() && $options->get('shopping.force_ssl')) {
         $wp->addAction('template_redirect', array($this, 'redirectToSsl'), 100, 0);
     }
     $wp->addAction('wp_ajax_jigoshop_checkout_change_country', array($this, 'ajaxChangeCountry'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_checkout_change_country', array($this, 'ajaxChangeCountry'));
     $wp->addAction('wp_ajax_jigoshop_checkout_change_state', array($this, 'ajaxChangeState'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_checkout_change_state', array($this, 'ajaxChangeState'));
     $wp->addAction('wp_ajax_jigoshop_checkout_change_postcode', array($this, 'ajaxChangePostcode'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_checkout_change_postcode', array($this, 'ajaxChangePostcode'));
 }
Esempio n. 2
0
 public function __construct(Wordpress $wp, Options $options, $currentRange)
 {
     parent::__construct($wp, $options, $currentRange);
     if (isset($_GET['product_ids']) && is_array($_GET['product_ids'])) {
         $this->productIds = array_filter(array_map('absint', $_GET['product_ids']));
     } elseif (isset($_GET['product_ids'])) {
         $this->productIds = explode(',', $_GET['product_ids']);
         $this->productIds = array_filter(array_map('absint', $this->productIds));
     }
     // Prepare data for report
     $this->calculateCurrentRange();
     $this->getReportData();
     $this->getChartColours();
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if ($screen->base != 'jigoshop_page_' . Reports::NAME) {
             return;
         }
         Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.admin'));
         Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jigoshop.admin'), array('in_footer' => true));
         Scripts::add('jigoshop.admin.reports.widget.product_search', \JigoshopInit::getUrl() . '/assets/js/admin/reports/widget/product_search.js', array('jquery', 'jigoshop.vendors.select2', 'jigoshop.helpers.ajax_search'), array('in_footer' => true));
         Scripts::localize('jigoshop.reports.chart', 'chart_data', $this->getMainChart());
     });
 }
Esempio n. 3
0
 /**
  * @param Wordpress $wp
  * @param Options   $options
  * @param string    $currentRange
  */
 public function __construct(Wordpress $wp, Options $options, $currentRange)
 {
     parent::__construct($wp, $options, $currentRange);
     if (isset($_GET['show_categories'])) {
         if (in_array(-1, $_GET['show_categories'])) {
             $allCategories = get_terms('product_category', array('orderby' => 'name', 'hide_empty' => false));
             $this->showCategories = array_map(function ($category) {
                 return $category->term_id;
             }, $allCategories);
         } else {
             $this->showCategories = is_array($_GET['show_categories']) ? array_map('absint', $_GET['show_categories']) : array(absint($_GET['show_categories']));
         }
     } else {
         $this->showCategories = $this->getLastCategoryID();
     }
     $this->calculateCurrentRange();
     $this->getReportData();
     $this->getChartColours();
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if ($screen->base != 'jigoshop_page_' . Reports::NAME) {
             return;
         }
         Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.admin.reports'));
         Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jigoshop.admin.reports'), array('in_footer' => true));
         Scripts::localize('jigoshop.reports.chart', 'chart_data', $this->getMainChart());
     });
 }
Esempio n. 4
0
 public function __construct(Wordpress $wp, Options $options, Messages $messages)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->messages = $messages;
     $wp->addAction('current_screen', array($this, 'register'));
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if (!in_array($screen->base, array('jigoshop_page_' . Settings::NAME, 'options'))) {
             return;
         }
         Styles::add('jigoshop.admin.settings', \JigoshopInit::getUrl() . '/assets/css/admin/settings.css', array('jigoshop.admin'));
         Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.admin'));
         Styles::add('jigoshop.vendors.datepicker', \JigoshopInit::getUrl() . '/assets/css/vendors/datepicker.css', array('jigoshop.admin'));
         Styles::add('jigoshop.vendors.bs_switch', \JigoshopInit::getUrl() . '/assets/css/vendors/bs_switch.css', array('jigoshop.admin'));
         Scripts::add('jigoshop.admin.settings', \JigoshopInit::getUrl() . '/assets/js/admin/settings.js', array('jigoshop.admin'), array('page' => 'jigoshop_page_jigoshop_settings', 'in_footer' => true));
         Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jigoshop.admin.settings'), array('page' => 'jigoshop_page_jigoshop_settings', 'in_footer' => true));
         Scripts::add('jigoshop.vendors.bs_tab_trans_tooltip_collapse', \JigoshopInit::getUrl() . '/assets/js/vendors/bs_tab_trans_tooltip_collapse.js', array('jigoshop.admin.settings'), array('page' => 'jigoshop_page_jigoshop_settings', 'in_footer' => true));
         Scripts::add('jigoshop.vendors.bs_switch', \JigoshopInit::getUrl() . '/assets/js/vendors/bs_switch.js', array('jigoshop.admin.settings'), array('page' => 'jigoshop_page_jigoshop_settings', 'in_footer' => true));
     });
 }
Esempio n. 5
0
 public function __construct(Wordpress $wp, Options $options, Messages $messages, CartServiceInterface $cartService, ProductServiceInterface $productService, CustomerServiceInterface $customerService, OrderServiceInterface $orderService, ShippingServiceInterface $shippingService, CouponServiceInterface $couponService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->messages = $messages;
     $this->cartService = $cartService;
     $this->productService = $productService;
     $this->customerService = $customerService;
     $this->shippingService = $shippingService;
     $this->orderService = $orderService;
     $this->couponService = $couponService;
     Styles::add('jigoshop.shop.cart', \JigoshopInit::getUrl() . '/assets/css/shop/cart.css', array('jigoshop.shop'));
     Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.shop'));
     Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jquery'));
     Scripts::add('jigoshop.vendors.bs_tab_trans_tooltip_collapse', \JigoshopInit::getUrl() . '/assets/js/vendors/bs_tab_trans_tooltip_collapse.js', array('jquery'));
     Scripts::add('jigoshop.shop.cart', \JigoshopInit::getUrl() . '/assets/js/shop/cart.js', array('jquery', 'jquery-blockui', 'jigoshop.shop', 'jigoshop.helpers', 'jigoshop.vendors.select2', 'jigoshop.vendors.bs_tab_trans_tooltip_collapse'));
     Scripts::localize('jigoshop.shop.cart', 'jigoshop_cart', array('assets' => \JigoshopInit::getUrl() . '/assets', 'i18n' => array('loading' => __('Loading...', 'jigoshop'))));
     $wp->addAction('wp_ajax_jigoshop_cart_update_item', array($this, 'ajaxUpdateItem'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_cart_update_item', array($this, 'ajaxUpdateItem'));
     $wp->addAction('wp_ajax_jigoshop_cart_select_shipping', array($this, 'ajaxSelectShipping'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_cart_select_shipping', array($this, 'ajaxSelectShipping'));
     $wp->addAction('wp_ajax_jigoshop_cart_update_discounts', array($this, 'ajaxUpdateDiscounts'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_cart_update_discounts', array($this, 'ajaxUpdateDiscounts'));
     $wp->addAction('wp_ajax_jigoshop_cart_change_country', array($this, 'ajaxChangeCountry'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_cart_change_country', array($this, 'ajaxChangeCountry'));
     $wp->addAction('wp_ajax_jigoshop_cart_change_state', array($this, 'ajaxChangeState'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_cart_change_state', array($this, 'ajaxChangeState'));
     $wp->addAction('wp_ajax_jigoshop_cart_change_postcode', array($this, 'ajaxChangePostcode'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_cart_change_postcode', array($this, 'ajaxChangePostcode'));
 }
Esempio n. 6
0
 public function __construct(Wordpress $wp, Options $options, TaxServiceInterface $taxService, Messages $messages)
 {
     $this->options = $options->get(self::SLUG);
     $this->taxService = $taxService;
     $options = $this->options;
     $wp->addAction('admin_enqueue_scripts', function () use($options) {
         if (!isset($_GET['tab']) || $_GET['tab'] != TaxesTab::SLUG) {
             return;
         }
         $classes = array();
         foreach ($options['classes'] as $class) {
             $classes[$class['class']] = $class['label'];
         }
         $states = array();
         foreach (Country::getAllStates() as $country => $stateList) {
             $states[$country] = array(array('id' => '', 'text' => _x('All states', 'admin_taxing', 'jigoshop')));
             foreach ($stateList as $code => $state) {
                 $states[$country][] = array('id' => $code, 'text' => $state);
             }
         }
         $countries = array_merge(array('' => __('All countries', 'jigoshop')), Country::getAll());
         Scripts::add('jigoshop.admin.settings.taxes', \JigoshopInit::getUrl() . '/assets/js/admin/settings/taxes.js', array('jquery'), array('page' => 'jigoshop_page_jigoshop_settings'));
         Scripts::localize('jigoshop.admin.settings.taxes', 'jigoshop_admin_taxes', array('new_class' => Render::get('admin/settings/tax/class', array('class' => array('label' => '', 'class' => ''))), 'new_rule' => Render::get('admin/settings/tax/rule', array('rule' => array('id' => '', 'label' => '', 'class' => '', 'is_compound' => false, 'rate' => '', 'country' => '', 'states' => array(), 'postcodes' => array()), 'classes' => $classes, 'countries' => $countries)), 'states' => $states));
     });
 }
Esempio n. 7
0
 public function __construct(Wordpress $wp, Options $options, Types\Product $type, ProductServiceInterface $productService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->productService = $productService;
     $this->type = $type;
     $wp->addAction('wp_ajax_jigoshop.admin.product.find', array($this, 'ajaxFindProduct'), 10, 0);
     $wp->addAction('wp_ajax_jigoshop.admin.product.save_attribute', array($this, 'ajaxSaveAttribute'), 10, 0);
     $wp->addAction('wp_ajax_jigoshop.admin.product.remove_attribute', array($this, 'ajaxRemoveAttribute'), 10, 0);
     $that = $this;
     $wp->addAction('add_meta_boxes_' . Types::PRODUCT, function () use($wp, $that) {
         $wp->addMetaBox('jigoshop-product-data', __('Product Data', 'jigoshop'), array($that, 'box'), Types::PRODUCT, 'normal', 'high');
         $wp->addMetaBox('jigoshop-product-attachments', __('Attachments', 'jigoshop'), array($that, 'attachmentsBox'), Types::PRODUCT, 'side', 'low');
         $wp->removeMetaBox('commentstatusdiv', null, 'normal');
     });
     $this->menu = $menu = $this->wp->applyFilters('jigoshop\\admin\\product\\menu', array('general' => array('label' => __('General', 'jigoshop'), 'visible' => true), 'advanced' => array('label' => __('Advanced', 'jigoshop'), 'visible' => array(Simple::TYPE, Virtual::TYPE)), 'attributes' => array('label' => __('Attributes', 'jigoshop'), 'visible' => true), 'stock' => array('label' => __('Stock', 'jigoshop'), 'visible' => array(Simple::TYPE, Virtual::TYPE)), 'sales' => array('label' => __('Sales', 'jigoshop'), 'visible' => array(Simple::TYPE, Virtual::TYPE))));
     $wp->addAction('admin_enqueue_scripts', function () use($wp, $menu, $that) {
         if ($wp->getPostType() == Types::PRODUCT) {
             Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.admin.product'));
             Styles::add('jigoshop.vendors.datepicker', \JigoshopInit::getUrl() . '/assets/css/vendors/datepicker.css', array('jigoshop.admin.product'));
             Styles::add('jigoshop.admin.product', \JigoshopInit::getUrl() . '/assets/css/admin/product.css');
             Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jquery', 'jigoshop.admin.product'));
             Scripts::add('jigoshop.vendors.bs_tab_trans_tooltip_collapse', \JigoshopInit::getUrl() . '/assets/js/vendors/bs_tab_trans_tooltip_collapse.js', array('jquery', 'jigoshop.admin.product'));
             Scripts::add('jigoshop.vendors.datepicker', \JigoshopInit::getUrl() . '/assets/js/vendors/datepicker.js', array('jquery', 'jigoshop.admin.product'));
             Scripts::add('jigoshop.admin.product', \JigoshopInit::getUrl() . '/assets/js/admin/product.js', array('jquery', 'jigoshop.helpers', 'jquery-ui-sortable'));
             Scripts::localize('jigoshop.admin.product', 'jigoshop_admin_product', array('i18n' => array('saved' => __('Changes saved.', 'jigoshop'), 'attribute_removed' => __('Attribute successfully removed.', 'jigoshop'), 'confirm_remove' => __('Are you sure?', 'jigoshop'), 'invalid_attribute' => __('Invalid attribute, please select another one.', 'jigoshop'), 'attribute_without_label' => __('Please provide attribute label.', 'jigoshop')), 'menu' => array_map(function ($item) {
                 return $item['visible'];
             }, $menu), 'attachments' => $that->getAttachments()));
             $wp->doAction('jigoshop\\admin\\product\\assets', $wp);
         }
     }, 5);
 }
Esempio n. 8
0
 public function __construct(Wordpress $wp, Options $options, ProductServiceInterface $productService, CartServiceInterface $cartService, Messages $messages)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->productService = $productService;
     $this->cartService = $cartService;
     $this->messages = $messages;
     Styles::add('jigoshop.vendors.colorbox', \JigoshopInit::getUrl() . '/assets/css/vendors/colorbox.css');
     Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css');
     Styles::add('jigoshop.shop.product', \JigoshopInit::getUrl() . '/assets/css/shop/product.css', array('jigoshop.shop', 'jigoshop.vendors.select2', 'jigoshop.vendors.colorbox'));
     if ($this->options->get('products.related')) {
         Styles::add('jigoshop.shop.related_products', \JigoshopInit::getUrl() . '/assets/css/shop/related_products.css', array('jigoshop.shop'));
     }
     Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jquery'));
     Scripts::add('jigoshop.vendors.colorbox', \JigoshopInit::getUrl() . '/assets/js/vendors/colorbox.js', array('jquery'));
     Scripts::add('jigoshop.vendors.bs_tab_trans_tooltip_collapse', \JigoshopInit::getUrl() . '/assets/js/vendors/bs_tab_trans_tooltip_collapse.js', array('jquery'));
     Scripts::add('jigoshop.shop.product', \JigoshopInit::getUrl() . '/assets/js/shop/product.js', array('jquery', 'jigoshop.shop', 'jigoshop.vendors.select2', 'jigoshop.vendors.colorbox', 'jigoshop.vendors.bs_tab_trans_tooltip_collapse'));
     $wp->addFilter('jigoshop\\cart\\add', function ($item) use($productService) {
         /** @var $item Item */
         if ($item instanceof Item) {
             $item->setKey($productService->generateItemKey($item));
         }
         return $item;
     });
     $wp->addAction('jigoshop\\template\\product\\before_summary', array($this, 'productImages'), 10, 1);
     $wp->addAction('jigoshop\\template\\product\\after_summary', array($this, 'productTabs'), 10, 1);
     if ($this->options->get('products.related')) {
         $wp->addAction('jigoshop\\template\\product\\after_summary', array($this, 'relatedProducts'), 20, 1);
     }
     $wp->addAction('jigoshop\\template\\product\\tab_panels', array($this, 'productDescription'), 10, 2);
     $wp->addAction('jigoshop\\template\\product\\tab_panels', array($this, 'productAttributes'), 15, 2);
     $wp->addAction('jigoshop\\template\\product\\tab_panels', array($this, 'productDownloads'), 20, 2);
     $wp->doAction('jigoshop\\product\\assets', $wp);
 }
Esempio n. 9
0
 public function assets()
 {
     // if price filter in use on front end, load jquery-ui slider (WP loads in footer)
     if (is_active_widget(false, false, self::ID) && !is_admin()) {
         wp_enqueue_script('jquery-ui-slider');
     }
     Styles::add('jigoshop.widget.price_filter', \JigoshopInit::getUrl() . '/assets/css/widget/price_filter.css');
 }
Esempio n. 10
0
 /**
  * Locates template based on available sources - current theme directory, stylesheet directory and Jigoshop templates directory.
  *
  * @param string $template Template to find.
  *
  * @return string Path to located file.
  */
 public static function locateTemplate($template)
 {
     $file = locate_template(array('jigoshop/' . $template . '.php'), false, false);
     if (empty($file)) {
         $file = \JigoshopInit::getDir() . '/templates/' . $template . '.php';
     }
     return $file;
 }
Esempio n. 11
0
 /**
  * Returns thumbnail data for selected category ID.
  *
  * @param int $id Category term ID.
  *
  * @return array `image` and `thumbnail_id` fields.
  */
 public static function getImage($id)
 {
     if (empty($id)) {
         return array('image' => \JigoshopInit::getUrl() . '/assets/images/placeholder.png', 'thumbnail_id' => false);
     }
     $thumbnail = get_metadata(Core::TERMS, $id, 'thumbnail_id', true);
     $image = $thumbnail ? wp_get_attachment_url($thumbnail) : \JigoshopInit::getUrl() . '/assets/images/placeholder.png';
     return array('image' => $image, 'thumbnail_id' => $thumbnail);
 }
Esempio n. 12
0
 public function __construct(Wordpress $wp, Options $options, CustomerServiceInterface $customerService, Messages $messages)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->customerService = $customerService;
     $this->messages = $messages;
     Styles::add('jigoshop.user.account', \JigoshopInit::getUrl() . '/assets/css/user/account.css');
     Styles::add('jigoshop.user.account.change_password', \JigoshopInit::getUrl() . '/assets/css/user/account/change_password.css', array('jigoshop.user.account'));
     $this->wp->doAction('jigoshop\\account\\assets', $wp);
 }
Esempio n. 13
0
 public function __construct(Wordpress $wp, Options $options, Messages $messages, OrderServiceInterface $orderService, PaymentServiceInterface $paymentService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->messages = $messages;
     $this->orderService = $orderService;
     $this->paymentService = $paymentService;
     Styles::add('jigoshop.checkout.pay', \JigoshopInit::getUrl() . '/assets/css/shop/checkout/pay.css', array('jigoshop.shop'));
     Scripts::add('jigoshop.checkout.pay', \JigoshopInit::getUrl() . '/assets/js/shop/checkout/pay.js', array('jquery', 'jigoshop.helpers.payment'));
     $wp->doAction('jigoshop\\checkout\\pay\\assets', $wp);
 }
Esempio n. 14
0
 public function __construct(Wordpress $wp, Options $options, CustomerServiceInterface $customerService, Messages $messages)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->customerService = $customerService;
     $this->messages = $messages;
     Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css');
     Styles::add('jigoshop.user.account', \JigoshopInit::getUrl() . '/assets/css/user/account.css', array('jigoshop.vendors.select2'));
     Styles::add('jigoshop.user.account.edit_address', \JigoshopInit::getUrl() . '/assets/css/user/account/edit_address.css', array('jigoshop.user.account'));
     Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jquery'));
     Scripts::add('jigoshop.vendors.bs_tab_trans_tooltip_collapse', \JigoshopInit::getUrl() . '/assets/js/vendors/bs_tab_trans_tooltip_collapse.js', array('jquery'));
     $this->wp->doAction('jigoshop\\account\\assets', $wp);
 }
Esempio n. 15
0
 public function __construct(Wordpress $wp, Options $options, Messages $messages, OrderServiceInterface $orderService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->messages = $messages;
     $this->orderService = $orderService;
     Styles::add('jigoshop.shop');
     Styles::add('jigoshop.user.account', \JigoshopInit::getUrl() . '/assets/css/user/account.css');
     Styles::add('jigoshop.user.account.orders', \JigoshopInit::getUrl() . '/assets/css/user/account/orders.css', array('jigoshop.user.account'));
     Styles::add('jigoshop.user.account.orders.single', \JigoshopInit::getUrl() . '/assets/css/user/account/orders/single.css', array('jigoshop.user.account.orders'));
     $wp->doAction('jigoshop\\checkout\\thank_you\\assets', $wp);
     $wp->addAction('wp_head', array($this, 'googleAnalyticsTracking'), 9999);
 }
Esempio n. 16
0
 public function __construct(Wordpress $wp, Dashboard $dashboard, Permalinks $permalinks)
 {
     $this->wp = $wp;
     $this->dashboard = $dashboard;
     $wp->addAction('admin_menu', array($this, 'beforeMenu'), 9);
     $wp->addAction('admin_menu', array($this, 'afterMenu'), 50);
     //TODO do wyrzucenia, przeniesienia do osobnych widokow
     Scripts::add('jigoshop.vendors.bs_tab_trans_tooltip_collapse', \JigoshopInit::getUrl() . '/assets/js/vendors/bs_tab_trans_tooltip_collapse.js', array('jquery'));
     Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css');
     Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jquery'));
     Styles::add('jigoshop.admin', \JigoshopInit::getUrl() . '/assets/css/admin.css');
     Scripts::add('jigoshop.admin', \JigoshopInit::getUrl() . '/assets/js/admin.js', array('jquery', 'jigoshop.helpers', 'jigoshop.vendors.bs_tab_trans_tooltip_collapse'));
     Scripts::add('jigoshop.vendors.bs_tab_trans_tooltip_collapse', \JigoshopInit::getUrl() . '/assets/js/vendors/bs_tab_trans_tooltip_collapse.js', array('jquery'), array('in_footer' => true));
 }
Esempio n. 17
0
 public function __construct(Wordpress $wp, Options $options, Messages $messages)
 {
     $this->options = $options->get(self::SLUG);
     $this->messages = $messages;
     $this->addToCartRedirectionOptions = $wp->applyFilters('jigoshop\\admin\\settings\\shopping\\add_to_cart_redirect', array('same_page' => __('Stay on the same page', 'jigoshop'), 'product' => __('Redirect to product page', 'jigoshop'), 'cart' => __('Redirect to cart', 'jigoshop'), 'checkout' => __('Redirect to checkout', 'jigoshop'), 'product_list' => __('Redirect to product list', 'jigoshop')));
     $this->backToShopRedirectionOptions = $wp->applyFilters('jigoshop\\admin\\settings\\shopping\\continue_shopping_redirect', array('product_list' => __('Product list', 'jigoshop'), 'my_account' => __('My account', 'jigoshop')));
     $this->catalogOrderBy = $wp->applyFilters('jigoshop\\admin\\settings\\shopping\\catalog_order_by', array('post_date' => __('Date', 'jigoshop'), 'post_title' => __('Product name', 'jigoshop'), 'menu_order' => __('Product post order', 'jigoshop')));
     $this->catalogOrder = $wp->applyFilters('jigoshop\\admin\\settings\\shopping\\catalog_order', array('ASC' => __('Ascending', 'jigoshop'), 'DESC' => __('Descending', 'jigoshop')));
     $this->productButtonType = $wp->applyFilters('jigoshop\\admin\\settings\\shopping\\catalog_product_button_type', array('add_to_cart' => __('Add to cart', 'jigoshop'), 'view_product' => __('View Product', 'jigoshop'), 'no_button' => __('No button', 'jigoshop')));
     $wp->addAction('admin_enqueue_scripts', function () {
         if (isset($_GET['tab']) && $_GET['tab'] == ShoppingTab::SLUG) {
             Scripts::add('jigoshop.admin.settings.shopping', \JigoshopInit::getUrl() . '/assets/js/admin/settings/shopping.js', array('jquery'), array('page' => 'jigoshop_page_jigoshop_settings'));
         }
     });
 }
Esempio n. 18
0
 public function __construct(Wordpress $wp)
 {
     $this->wp = $wp;
     $wp->addAction(sprintf('%s_add_form_fields', Types::PRODUCT_CATEGORY), array($this, 'showThumbnail'));
     $wp->addAction(sprintf('%s_edit_form_fields', Types::PRODUCT_CATEGORY), array($this, 'showThumbnail'));
     $wp->addAction('created_term', array($this, 'saveThumbnail'), 10, 3);
     $wp->addAction('edit_term', array($this, 'saveThumbnail'), 10, 3);
     $wp->addAction(sprintf('delete_%s', Types::PRODUCT_CATEGORY), array($this, 'delete'));
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         $wp->wpEnqueueMedia();
         Scripts::add('jigoshop.admin.product_categories', \JigoshopInit::getUrl() . '/assets/js/admin/product_categories.js', array('jquery', 'jigoshop.media'));
         Scripts::localize('jigoshop.admin.product_categories', 'jigoshop_admin_product_categories', array('category_name' => Types::PRODUCT_CATEGORY, 'placeholder' => \JigoshopInit::getUrl() . '/assets/images/placeholder.png'));
         $wp->doAction('jigoshop\\admin\\product_categories\\assets', $wp);
     });
 }
Esempio n. 19
0
 public function __construct(Wordpress $wp, Container $di, Options $options, Messages $messages)
 {
     $this->wp = $wp;
     $this->di = $di;
     $this->options = $options;
     $this->settings = $options->get(self::SLUG);
     $this->messages = $messages;
     $this->caches = array('simple' => _x('Simple', 'cache', 'jigoshop'), 'php_fast_cache' => _x('Php Fast Cache - Use this option only if your database is responding slowly. ', 'cache', 'jigoshop'));
     $this->sessionTypes = array('php' => __('Php session', 'jigoshop'), 'transient' => __('Wordpress transient', 'jigoshop'));
     $wp->addAction('admin_enqueue_scripts', function () use($options) {
         if (!isset($_GET['tab']) || $_GET['tab'] != AdvancedTab::SLUG) {
             return;
         }
         Scripts::add('jigoshop.admin.settings.taxes', \JigoshopInit::getUrl() . '/assets/js/admin/settings/advanced.js', array('jquery', 'wp-util'), array('page' => 'jigoshop_page_jigoshop_settings'));
     });
 }
Esempio n. 20
0
 public function __construct(Wordpress $wp, Options $options, ProductServiceInterface $productService, CartServiceInterface $cartService, Messages $messages)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->productService = $productService;
     $this->cartService = $cartService;
     $this->messages = $messages;
     $wp->addFilter('jigoshop\\cart\\add', function ($item) use($productService) {
         /** @var $item Item */
         $item->setKey($productService->generateItemKey($item));
         return $item;
     });
     Styles::add('jigoshop.shop.list', \JigoshopInit::getUrl() . '/assets/css/shop/list.css', array('jigoshop.shop'));
     Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.shop'));
     Scripts::add('jigoshop.shop');
 }
Esempio n. 21
0
 public function __construct(Wordpress $wp)
 {
     $this->wp = $wp;
     $wp->addAction('current_screen', array($this, 'register'));
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if (!in_array($screen->base, array('jigoshop_page_' . self::NAME))) {
             return;
         }
         Styles::add('jigoshop.admin.system_info', \JigoshopInit::getUrl() . '/assets/css/admin/system_info.css', array('jigoshop.admin'));
     });
 }
Esempio n. 22
0
 public function __construct(Wordpress $wp, Options $options, Messages $messages)
 {
     $this->options = $options->get(self::SLUG);
     $this->messages = $messages;
     $wp->addAction('admin_enqueue_scripts', function () {
         if (!isset($_GET['tab']) || $_GET['tab'] != GeneralTab::SLUG) {
             return;
         }
         $states = array();
         foreach (Country::getAllStates() as $country => $stateList) {
             foreach ($stateList as $code => $state) {
                 $states[$country][] = array('id' => $code, 'text' => $state);
             }
         }
         Scripts::add('jigoshop.admin.settings.general', \JigoshopInit::getUrl() . '/assets/js/admin/settings/general.js', array('jquery'), array('page' => 'jigoshop_page_jigoshop_settings'));
         Scripts::localize('jigoshop.admin.settings.general', 'jigoshop_admin_general', array('states' => $states));
     });
 }
Esempio n. 23
0
 public function __construct(Wordpress $wp, Options $options, Service $emailService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->emailService = $emailService;
     add_action('wp_ajax_jigoshop.admin.email.update_variable_list', array($this, 'ajaxVariables'));
     $that = $this;
     $wp->addAction('add_meta_boxes_' . Types::EMAIL, function () use($wp, $that) {
         $wp->addMetaBox('jigoshop-email-data', __('Email Data', 'jigoshop'), array($that, 'box'), Types::EMAIL, 'normal', 'default');
         $wp->addMetaBox('jigoshop-email-variable', __('Email Variables', 'jigoshop'), array($that, 'variablesBox'), Types::EMAIL, 'normal', 'default');
     });
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         if ($wp->getPostType() == Types::EMAIL) {
             Scripts::add('jigoshop.admin.email', \JigoshopInit::getUrl() . '/assets/js/admin/email.js', array('jquery', 'jigoshop.helpers'));
             $wp->doAction('jigoshop\\admin\\email\\assets', $wp);
         }
     });
 }
Esempio n. 24
0
 public function __construct(Wordpress $wp, Options $options, OrderServiceInterface $orderService, ProductServiceInterface $productService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->orderService = $orderService;
     $this->productService = $productService;
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if (!in_array($screen->base, array('toplevel_page_' . Dashboard::NAME, 'options'))) {
             return;
         }
         Styles::add('jigoshop.admin.dashboard', \JigoshopInit::getUrl() . '/assets/css/admin/dashboard.css');
         Scripts::add('jigoshop.vendors.flot', \JigoshopInit::getUrl() . '/assets/js/vendors/flot.js', array('jquery'));
     });
 }
Esempio n. 25
0
 public function __construct(Wordpress $wp, Options $options, Types\Product $type, ProductServiceInterface $productService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->productService = $productService;
     $this->type = $type;
     $wp->addFilter(sprintf('manage_edit-%s_columns', Types::PRODUCT), array($this, 'columns'));
     $wp->addAction(sprintf('manage_%s_posts_custom_column', Types::PRODUCT), array($this, 'displayColumn'), 2);
     $wp->addAction('restrict_manage_posts', array($this, 'categoryFilter'));
     $wp->addAction('restrict_manage_posts', array($this, 'typeFilter'));
     $wp->addAction('pre_get_posts', array($this, 'setTypeFilter'));
     $wp->addAction('wp_ajax_jigoshop.admin.products.feature_product', array($this, 'ajaxFeatureProduct'));
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         if ($wp->getPostType() == Types::PRODUCT) {
             Scripts::add('jigoshop.admin.products', \JigoshopInit::getUrl() . '/assets/js/admin/products.js', array('jquery', 'jigoshop.helpers'));
             Styles::add('jigoshop.admin.products_list', \JigoshopInit::getUrl() . '/assets/css/admin/products_list.css', array('jigoshop.admin'));
             $wp->doAction('jigoshop\\admin\\products\\assets', $wp);
         }
     });
 }
Esempio n. 26
0
 public function __construct(Wordpress $wp, Messages $messages)
 {
     $this->wp = $wp;
     $this->messages = $messages;
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if ($screen->base != 'jigoshop_page_' . Reports::NAME) {
             return;
         }
         Styles::add('jigoshop.admin.reports', \JigoshopInit::getUrl() . '/assets/css/admin/reports.css', array('jigoshop.admin'));
         Styles::add('jigoshop.vendors.datepicker', \JigoshopInit::getUrl() . '/assets/css/vendors/datepicker.css', array('jigoshop.admin.reports'));
         Scripts::add('jigoshop.admin.reports', \JigoshopInit::getUrl() . '/assets/js/admin/reports.js', array('jigoshop.admin', 'jigoshop.vendors.datepicker'));
         Scripts::add('jigoshop.vendors.datepicker', \JigoshopInit::getUrl() . '/assets/js/vendors/datepicker.js', array('jquery'));
         Scripts::add('jigoshop.vendors.bs_tab_trans_tooltip_collapse', \JigoshopInit::getUrl() . '/assets/js/vendors/bs_tab_trans_tooltip_collapse.js', array('jigoshop.admin.reports'), array('in_footer' => true));
     });
 }
Esempio n. 27
0
 public function __construct(Wordpress $wp, Options $options, Messages $messages)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->messages = $messages;
     $wp->addAction('current_screen', array($this, 'action'));
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if ($screen->base != 'jigoshop_page_' . Migration::NAME) {
             return;
         }
         Styles::add('jigoshop.admin.migration', \JigoshopInit::getUrl() . '/assets/css/admin/migration.css');
         Scripts::add('jigoshop.admin.migration', \JigoshopInit::getUrl() . '/assets/js/admin/migration.js');
         $migration_title = __('Jigoshop » Migration Tool » ', 'jigoshop');
         Scripts::localize('jigoshop.admin.migration', 'jigoshop_admin_migration', array('i18n' => array('migration_complete' => __('migration complete', 'jigoshop'), 'migration_error' => __('migration error', 'jigoshop'), 'alert_msg' => __('A communication error has occured, please reload the page and continue with the migration.', 'jigoshop'), 'processing' => __('Processing...', 'jigoshop'), 'jigoshop.admin.migration.products' => $migration_title . __('Products', 'jigoshop'), 'jigoshop.admin.migration.coupons' => $migration_title . __('Coupons', 'jigoshop'), 'jigoshop.admin.migration.emails' => $migration_title . __('Emails', 'jigoshop'), 'jigoshop.admin.migration.options' => $migration_title . __('Options', 'jigoshop'), 'jigoshop.admin.migration.orders' => $migration_title . __('Orders', 'jigoshop'))));
     });
 }
Esempio n. 28
0
 public function __construct(Wordpress $wp, Options $options, OrderServiceInterface $orderService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->orderService = $orderService;
     $wp->addFilter('request', array($this, 'request'));
     $wp->addFilter('the_title', array($this, 'replaceTitle'));
     $wp->addFilter('post_row_actions', array($this, 'displayTitle'));
     $wp->addFilter(sprintf('bulk_actions-edit-%s', Types::ORDER), array($this, 'bulkActions'));
     $wp->addFilter(sprintf('views_edit-%s', Types::ORDER), array($this, 'statusFilters'));
     $wp->addFilter(sprintf('manage_edit-%s_columns', Types::ORDER), array($this, 'columns'));
     $wp->addAction(sprintf('manage_%s_posts_custom_column', Types::ORDER), array($this, 'displayColumn'), 2);
     $wp->addAction(sprintf('manage_edit-%s_sortable_columns', Types::ORDER), array($this, 'disableSorting'));
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         if ($wp->getPostType() == Types::ORDER) {
             Styles::add('jigoshop.admin.orders', \JigoshopInit::getUrl() . '/assets/css/admin/orders.css');
         }
     });
     Scripts::add('jigoshop.admin.page.orders_list', \JigoshopInit::getUrl() . '/assets/js/admin/orders.js', array('jquery-blockui'));
     $wp->addAction('wp_ajax_jigoshop.admin.orders.change_status', array($this, 'ajaxChangeStatus'), 10, 0);
 }
Esempio n. 29
0
 public function __construct(Wordpress $wp, Options $options, $currentRange)
 {
     parent::__construct($wp, $options, $currentRange);
     // Prepare data for report
     $this->calculateCurrentRange();
     $this->getReportData();
     $this->getChartColours();
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if ($screen->base != 'jigoshop_page_' . Reports::NAME) {
             return;
         }
         Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.admin.reports'));
         Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jigoshop.admin.reports'), array('in_footer' => true));
         Scripts::localize('jigoshop.reports.chart', 'chart_data', $this->getMainChart());
     });
 }
Esempio n. 30
0
 public function __construct(Wordpress $wp, Options $options, CartServiceInterface $cartService, Messages $messages)
 {
     $this->wp = $wp;
     $this->options = $options->get('shipping.' . self::NAME);
     $this->cartService = $cartService;
     $this->messages = $messages;
     $this->availability = array('all' => __('All allowed countries', 'jigoshop'), 'specific' => __('Selected countries', 'jigoshop'));
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if (!in_array($screen->base, array('jigoshop_page_' . Settings::NAME, 'options'))) {
             return;
         }
         if (!isset($_GET['tab']) || $_GET['tab'] !== 'shipping') {
             return;
         }
         Scripts::add('jigoshop.admin.shipping.free_shipping', \JigoshopInit::getUrl() . '/assets/js/admin/shipping/free_shipping.js', array('jquery', 'jigoshop.admin'));
     });
 }