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')); }
/** * @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()); }); }
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')); }
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()); }); }
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); }
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)); }); }
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); }
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'); }
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); }
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); }
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); }
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); }
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)); }
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'); }
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')); }); }
/** Displays the page. */ public function display() { $this->wp->wpEnqueueScript('common'); $this->wp->wpEnqueueScript('wp-lists'); $this->wp->wpEnqueueScript('postbox'); Styles::add('wp-jquery-ui'); $this->wp->addMetaBox('jigoshop_dashboard_right_now', __('<span>Shop</span> Content', 'jigoshop'), array($this, 'rightNow'), 'jigoshop', 'side', 'core'); $this->wp->addMetaBox('jigoshop_dashboard_recent_orders', __('<span>Recent</span> Orders', 'jigoshop'), array($this, 'recentOrders'), 'jigoshop', 'side', 'core'); if ($this->options->get('products.manage_stock')) { $this->wp->addMetaBox('jigoshop_dashboard_stock_report', __('<span>Stock</span> Report', 'jigoshop'), array($this, 'stockReport'), 'jigoshop', 'side', 'core'); } $this->wp->addMetaBox('jigoshop_dashboard_monthly_report', __('<span>Monthly</span> Report', 'jigoshop'), array($this, 'monthlyReport'), 'jigoshop', 'normal', 'core'); $this->wp->addMetaBox('jigoshop_dashboard_recent_reviews', __('<span>Recent</span> Reviews', 'jigoshop'), array($this, 'recentReviews'), 'jigoshop', 'normal', 'core'); $this->wp->addMetaBox('jigoshop_dashboard_latest_news', __('<span>Latest</span> News', 'jigoshop'), array($this, 'latestNews'), 'jigoshop', 'normal', 'core'); $this->wp->addMetaBox('jigoshop_dashboard_useful_links', __('<span>Useful</span> Links', 'jigoshop'), array($this, 'usefulLinks'), 'jigoshop', 'normal', 'core'); $submenu = $this->wp->getSubmenu(); Render::output('admin/dashboard', array('submenu' => $submenu)); }
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)); }); }
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); } }); }
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')))); }); }
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()); }); }
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); }
public function __construct(Wordpress $wp, Options $options, OrderServiceInterface $orderService, ProductServiceInterface $productService, CustomerServiceInterface $customerService, ShippingServiceInterface $shippingService) { $this->wp = $wp; $this->options = $options; $this->orderService = $orderService; $this->productService = $productService; $this->customerService = $customerService; $this->shippingService = $shippingService; $wp->addAction('admin_enqueue_scripts', function () use($wp, $options) { if ($wp->getPostType() == Types::ORDER) { Styles::add('jigoshop.admin.order', \JigoshopInit::getUrl() . '/assets/css/admin/order.css'); Scripts::add('jigoshop.admin.order', \JigoshopInit::getUrl() . '/assets/js/admin/order.js', array('jquery', 'jigoshop.helpers')); Styles::add('jigoshop.vendors.datetimepicker', \JigoshopInit::getUrl() . '/assets/css/vendors/datetimepicker.css'); Scripts::add('jigoshop.vendors.datetimepicker', \JigoshopInit::getUrl() . '/assets/js/vendors/datetimepicker.js'); Scripts::localize('jigoshop.admin.order', 'jigoshop_admin_order', array('tax_shipping' => $options->get('tax.shipping'), 'ship_to_billing' => $options->get('shipping.only_to_billing'))); } }); $wp->addAction('wp_ajax_jigoshop.admin.order.add_product', array($this, 'ajaxAddProduct'), 10, 0); $wp->addAction('wp_ajax_jigoshop.admin.order.update_product', array($this, 'ajaxUpdateProduct'), 10, 0); $wp->addAction('wp_ajax_jigoshop.admin.order.remove_product', array($this, 'ajaxRemoveProduct'), 10, 0); $wp->addAction('wp_ajax_jigoshop.admin.order.change_country', array($this, 'ajaxChangeCountry'), 10, 0); $wp->addAction('wp_ajax_jigoshop.admin.order.change_state', array($this, 'ajaxChangeState'), 10, 0); $wp->addAction('wp_ajax_jigoshop.admin.order.change_postcode', array($this, 'ajaxChangePostcode'), 10, 0); $wp->addAction('wp_ajax_jigoshop.admin.order.change_shipping_method', array($this, 'ajaxChangeShippingMethod'), 10, 0); $that = $this; $wp->addAction('add_meta_boxes_' . Types::ORDER, function () use($wp, $orderService, $that) { $post = $wp->getGlobalPost(); /** @var \Jigoshop\Entity\Order $order */ $order = $orderService->findForPost($post); $wp->addMetaBox('jigoshop-order-data', $order->getTitle(), array($that, 'dataBox'), Types::ORDER, 'normal', 'high'); $wp->addMetaBox('jigoshop-order-items', __('Order Items', 'jigoshop'), array($that, 'itemsBox'), Types::ORDER, 'normal', 'high'); $wp->addMetaBox('jigoshop-order-totals', __('Order Totals', 'jigoshop'), array($that, 'totalsBox'), Types::ORDER, 'normal', 'high'); $wp->removeMetaBox('commentstatusdiv', null, 'normal'); $wp->removeMetaBox('submitdiv', Types::ORDER, 'side'); $wp->addMetaBox('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core'); $wp->addMetaBox('submitdiv', __('Order Actions', 'jigoshop'), array($that, 'actionsBox'), Types::ORDER, 'side', 'default'); }); }
public function __construct(Wordpress $wp, Messages $messages, ProductServiceInterface $productService) { $this->wp = $wp; $this->messages = $messages; $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('edit.php'))) { return; } $screen = $wp->getCurrentScreen(); if (!in_array($screen->base, array('product_page_' . Attributes::NAME))) { return; } Styles::add('jigoshop.admin.product_attributes', \JigoshopInit::getUrl() . '/assets/css/admin/product_attributes.css'); Scripts::add('jigoshop.admin.product_attributes', \JigoshopInit::getUrl() . '/assets/js/admin/product_attributes.js', array('jquery', 'jigoshop.helpers')); Scripts::localize('jigoshop.admin.product_attributes', 'jigoshop_admin_product_attributes', array('i18n' => array('saved' => __('Changes saved.', 'jigoshop'), 'removed' => __('Attribute has been successfully removed.', 'jigoshop'), 'option_removed' => __('Attribute option has been successfully removed.', 'jigoshop'), 'confirm_remove' => __('Are you sure?', 'jigoshop')))); }); $wp->addAction('wp_ajax_jigoshop.admin.product_attributes.save', array($this, 'ajaxSaveAttribute')); $wp->addAction('wp_ajax_jigoshop.admin.product_attributes.remove', array($this, 'ajaxRemoveAttribute')); $wp->addAction('wp_ajax_jigoshop.admin.product_attributes.save_option', array($this, 'ajaxSaveAttributeOption')); $wp->addAction('wp_ajax_jigoshop.admin.product_attributes.remove_option', array($this, 'ajaxRemoveAttributeOption')); }
public function __construct(Wordpress $wp, Options $options, Service $couponService, PaymentServiceInterface $paymentService) { $this->wp = $wp; $this->options = $options; $this->couponService = $couponService; $this->paymentService = $paymentService; $that = $this; $wp->addAction('wp_ajax_jigoshop.admin.coupon.find_category', array($this, 'ajaxFindCategory'), 10, 0); $wp->addAction('add_meta_boxes_' . Types::COUPON, function () use($wp, $that) { $wp->addMetaBox('jigoshop-coupon-data', __('Coupon Data', 'jigoshop'), array($that, 'box'), Types::COUPON, 'normal', 'default'); }); $wp->addAction('admin_enqueue_scripts', function () use($wp) { if ($wp->getPostType() == Types::COUPON) { Styles::add('jigoshop.admin.coupon', \JigoshopInit::getUrl() . '/assets/css/admin/coupon.css', array('jigoshop.admin')); Scripts::add('jigoshop.admin.coupon', \JigoshopInit::getUrl() . '/assets/js/admin/coupon.js', array('jquery', 'jigoshop.admin', 'jigoshop.helpers.ajax_search')); Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.admin.coupon')); Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jigoshop.admin.coupon'), array('in_footer' => true)); Styles::add('jigoshop.vendors.datepicker', \JigoshopInit::getUrl() . '/assets/css/vendors/datepicker.css', array('jigoshop.admin.coupon')); Scripts::add('jigoshop.vendors.datepicker', \JigoshopInit::getUrl() . '/assets/js/vendors/datepicker.js', array('jquery', 'jigoshop.admin.coupon')); $wp->doAction('jigoshop\\admin\\coupon\\assets', $wp); } }); }
/** * @param Wordpress $wp */ public function addFrontendAssets(Wordpress $wp) { $post = $wp->getGlobalPost(); $product = $this->productService->findForPost($post); if ($product instanceof Product\Variable) { $variations = array(); foreach ($product->getVariations() as $variation) { /** @var $variation Product\Variable\Variation */ $variations[$variation->getId()] = array('price' => $variation->getProduct()->getPrice(), 'html' => array('price' => \Jigoshop\Helper\Product::formatPrice($variation->getProduct()->getPrice())), 'attributes' => array()); foreach ($variation->getAttributes() as $attribute) { /** @var $attribute Product\Variable\Attribute */ $variations[$variation->getId()]['attributes'][$attribute->getAttribute()->getId()] = $attribute->getValue(); } } Styles::add('jigoshop.product.variable', \JigoshopInit::getUrl() . '/assets/css/shop/product/variable.css'); Scripts::add('jigoshop.product.variable', \JigoshopInit::getUrl() . '/assets/js/shop/product/variable.js', array('jquery')); Scripts::localize('jigoshop.product.variable', 'jigoshop_product_variable', array('variations' => $variations)); } }
public function assets() { Styles::add('jigoshop.widget.layered_nav', \JigoshopInit::getUrl() . '/assets/css/widget/layered_nav.css'); }