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)); }); }
/** * SessionService constructor. * @param Wordpress $wp * @param Factory $factory */ public function __construct(Wordpress $wp, Options $options, Factory $factory) { $this->wp = $wp; $this->options = $options; $this->factory = $factory; $this->sessionsToSave = array(); $this->wp->addAction('shutdown', array($this, 'saveAllSessions')); }
public function __construct(Wordpress $wp, ProductFactory $factory) { $this->wp = $wp; $this->factory = $factory; $wp->addAction('save_post_' . Types\Product::NAME, array($this, 'savePost'), 10); $wp->addAction('jigoshop\\product\\sold', array($this, 'addSoldQuantity'), 10, 2); $wp->addAction('jigoshop\\product\\restore', array($this, 'restoreQuantity'), 10, 2); }
/** * Initializes product type. * * @param Wordpress $wp WordPress Abstraction Layer * @param array $enabledTypes List of all available types. */ public function initialize(Wordpress $wp, array $enabledTypes) { $wp->addFilter('jigoshop\\cart\\add', array($this, 'addToCart'), 10, 2); $wp->addFilter('jigoshop\\core\\types\\variable\\subtypes', array($this, 'addVariableSubtype'), 10, 1); $wp->addAction('jigoshop\\admin\\product\\assets', array($this, 'addAssets'), 10, 0); $wp->addFilter('jigoshop\\admin\\product\\menu', array($this, 'addProductMenu')); $wp->addFilter('jigoshop\\product\\tabs\\general', array($this, 'addToGeneralTab'), 10, 1); $wp->addAction('jigoshop\\admin\\variation', array($this, 'addVariationFields'), 10, 2); }
public function __construct(Wordpress $wp, Options $options, OrderServiceInterface $orderService, EmailServiceInterface $emailService) { $this->wp = $wp; $this->options = $options; $this->orderService = $orderService; $this->emailService = $emailService; $this->_scheduleEvents(); $wp->addAction('jigoshop\\cron\\pending_orders', array($this, 'updatePendingOrders')); $wp->addAction('jigoshop\\cron\\processing_orders', array($this, 'completeProcessingOrders')); }
/** * Initializes product type. * * @param Wordpress $wp WordPress Abstraction Layer * @param array $enabledTypes List of all available types. */ public function initialize(Wordpress $wp, array $enabledTypes) { $wp->addFilter('jigoshop\\cart\\add', array($this, 'addToCart'), 10, 2); $wp->addFilter('jigoshop\\emails\\order_item', array($this, 'emailLink'), 10, 3); $wp->addFilter('jigoshop\\core\\types\\variable\\subtypes', array($this, 'addVariableSubtype'), 10, 1); $wp->addAction('jigoshop\\order\\before\\' . Order\Status::PROCESSING, array($this, 'updateProcessingStatus')); $wp->addFilter('jigoshop\\product\\reduce_stock_status', array($this, 'reduceStockStatus'), 10, 2); $wp->addAction('jigoshop\\admin\\product\\assets', array($this, 'addAssets'), 10, 0); $wp->addFilter('jigoshop\\admin\\product\\menu', array($this, 'addProductMenu')); $wp->addFilter('jigoshop\\admin\\product\\tabs', array($this, 'addProductTab'), 10, 2); $wp->addAction('jigoshop\\admin\\variation', array($this, 'addVariationFields'), 10, 2); }
public function __construct(Wordpress $wp, Options $options, CouponServiceInterface $couponService) { $this->wp = $wp; $this->options = $options; $this->couponService = $couponService; $wp->addFilter(sprintf('manage_edit-%s_columns', Types::COUPON), array($this, 'columns')); $wp->addAction(sprintf('manage_%s_posts_custom_column', Types::COUPON), array($this, 'displayColumn'), 2); $wp->addAction('admin_enqueue_scripts', function () use($wp) { if ($wp->getPostType() == Types::COUPON) { $wp->doAction('jigoshop\\admin\\coupons\\assets', $wp); } }); }
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) { $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')); }); }
public function __construct(Wordpress $wp, Options $options) { $this->wp = $wp; $this->options = $options; $wp->addAction('init', array($this, 'initFix')); $wp->addFilter('rewrite_rules_array', array($this, 'fix')); }
public function __construct(Wordpress $wp, Options $options) { $this->wp = $wp; $this->options = $options; $wp->addAction('current_screen', array($this, 'init')); $this->save(); }
public function __construct(Container $di, Wordpress $wp, Options $options, ProductServiceInterface $productService) { $this->wp = $wp; $this->options = $options; $types = $options->getEnabledProductTypes(); foreach ($types as $typeClass) { /** @var Types\Product\Type $type */ $type = $di->get($typeClass); if (!$type instanceof Types\Product\Type) { if (WP_DEBUG) { throw new Exception(sprintf(__('Invalid type definition! Offending class: "%s".', 'jigoshop'), $typeClass)); } Registry::getInstance(JIGOSHOP_LOGGER)->addWarning(sprintf('Invalid type definition! Offending class: "%s".', $typeClass)); continue; } $this->enabledTypes[$type->getId()] = $type; $productService->addType($type->getId(), $type->getClass()); $wp->addAction('jigoshop\\product\\type\\init', array($type, 'initialize'), 10, 2); } $wp->doAction('jigoshop\\product\\type\\init', $wp, $this->enabledTypes); // Enable comments for all orders, disable pings $wp->addFilter('wp_insert_post_data', function ($data) { if ($data['post_type'] == Product::NAME) { $data['comment_status'] = 'open'; $data['ping_status'] = 'closed'; } return $data; }); }
/** * Initializes product type. * * @param Wordpress $wp WordPress Abstraction Layer * @param array $enabledTypes List of all available types. */ public function initialize(Wordpress $wp, array $enabledTypes) { $wp->addFilter('jigoshop\\cart\\add', array($this, 'addToCart'), 10, 2); $wp->addFilter('jigoshop\\core\\types\\variable\\subtypes', array($this, 'addVariableSubtype'), 10, 1); $wp->addFilter('jigoshop\\product\\get_stock', array($this, 'getStock'), 10, 2); $wp->addAction('jigoshop\\admin\\product\\assets', array($this, 'addAssets'), 10, 0); }
public function resolve(Container $container) { if (defined('DOING_AJAX') && DOING_AJAX) { // Instantiate page to install Ajax actions $this->getPage($container); } else { $that = $this; $this->wp->addAction('current_screen', function () use($container, $that) { $page = $that->wp->applyFilters('jigoshop.admin.page_resolver.page', null); if ($page == null || !$page instanceof PageInterface) { $page = $that->getPage($container); } $container->services->set('jigoshop.page.current', $page); }, 1); } }
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)); }); }
public function __construct(Wordpress $wp, \Jigoshop\Core\Options $options, TaxServiceInterface $taxService) { $this->wp = $wp; $this->options = $options; $this->taxService = $taxService; $wp->addAction('wp_ajax_jigoshop.admin.migration.options', array($this, 'ajaxMigrationOptions'), 10, 0); }
public function __construct(Wordpress $wp, Options $options, Factory $factory) { $this->wp = $wp; $this->options = $options; $this->factory = $factory; $wp->addAction('save_post_' . Types\Email::NAME, array($this, 'savePost'), 10); }
public function __construct(Wordpress $wp, ProductServiceInterface $productService) { $this->wp = $wp; $this->productService = $productService; $wp->addFilter('jigoshop\\find\\product', array($this, 'fetch')); $wp->addAction('jigoshop\\admin\\product_attribute\\add', array($this, 'addAttributes'), 10, 2); }
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')); }
public function init() { $wp = $this->wp; $di = $this->di; $widgets = $this->wp->applyFilters('jigoshop\\widget\\init', $this->getDefaultWidgets()); $this->wp->addAction('widgets_init', function () use($wp, $di, $widgets) { foreach ($widgets as $widget) { $class = $widget['class']; $wp->registerWidget($class); if (isset($widget['calls'])) { foreach ($widget['calls'] as $call) { list($method, $argument) = $call; $class::$method($di->get($argument)); } } } }); }
public function __construct(Wordpress $wp, Factory $factory, ProductServiceInterface $productService) { $this->wp = $wp; $this->factory = $factory; $this->productService = $productService; if (defined('DOING_AJAX') && DOING_AJAX) { $wp->addAction('jigoshop\\service\\product\\save', array($this, 'save')); } }
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); } }); }
public function __construct(Wordpress $wp, \Jigoshop\Core\Options $options, Messages $messages, OrderServiceInterface $orderService, ShippingServiceInterface $shippingService, PaymentServiceInterface $paymentService, ProductServiceInterface $productService) { $this->wp = $wp; $this->options = $options; $this->messages = $messages; $this->orderService = $orderService; $this->shippingService = $shippingService; $this->paymentService = $paymentService; $this->productService = $productService; $wp->addAction('wp_ajax_jigoshop.admin.migration.orders', array($this, 'ajaxMigrationOrders'), 10, 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); }
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, 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 __construct(Wordpress $wp, \Jigoshop\Core\Options $options, ProductServiceInterface $productService, TaxServiceInterface $taxService) { $this->wp = $wp; $this->options = $options; $this->productService = $productService; if ($this->options->get('tax.included')) { $address = new Customer\Address(); $address->setCountry($this->options->get('general.country')); $address->setState($this->options->get('general.state')); $this->taxes = $taxService->getDefinitions($address); } $wp->addAction('wp_ajax_jigoshop.admin.migration.products', array($this, 'ajaxMigrationProducts'), 10, 0); }
public function __construct(Wordpress $wp, SessionServiceInterface $sessionService) { $this->session = $sessionService->get($sessionService->getCurrentKey()); if ($this->session->getField(self::NOTICES)) { $this->notices = $this->session->getField(self::NOTICES); } if ($this->session->getField(self::WARNINGS)) { $this->warnings = $this->session->getField(self::WARNINGS); } if ($this->session->getField(self::ERRORS)) { $this->errors = $this->session->getField(self::ERRORS); } $wp->addAction('shutdown', array($this, 'preserveMessages'), 9); }
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); } }); }