/** * Registers setting item. */ public function register() { // Weed out all admin pages except the Jigoshop Settings page hits if (!in_array($this->wp->getPageNow(), array('admin.php', 'options.php'))) { return; } $screen = $this->wp->getCurrentScreen(); if (!in_array($screen->base, array('jigoshop_page_' . self::NAME, 'options'))) { return; } $this->wp->registerSetting(self::NAME, Options::NAME, array($this, 'validate')); $tab = $this->getCurrentTab(); $tab = $this->tabs[$tab]; // Workaround for PHP pre-5.4 $that = $this; /** @var TabInterface $tab */ $sections = $this->wp->applyFilters('jigoshop/admin/settings/tab/' . $tab->getSlug(), $tab->getSections(), $tab); foreach ($sections as $section) { $this->wp->addSettingsSection($section['id'], $section['title'], function () use($tab, $section, $that) { $that->displaySection($tab, $section); }, self::NAME); foreach ($section['fields'] as $field) { $field = $this->validateField($field); $this->wp->addSettingsField($field['id'], $field['title'], array($this, 'displayField'), self::NAME, $section['id'], $field); } } }
private function getContent() { if (!in_array($this->wp->getPageNow(), array('admin.php', 'options.php'))) { return null; } if (!isset($_GET['page']) || $_GET['page'] != Reports::NAME) { return null; } if (!isset($_GET['tab']) || $_GET['tab'] != self::SLUG) { return null; } switch ($this->getCurrentType()) { case 'low_in_stock': return new Table\LowInStock($this->wp, $this->options); case 'out_of_stock': return new Table\OutOfStock($this->wp, $this->options); case 'most_stocked': return new Table\MostStocked($this->wp, $this->options); default: return $this->wp->applyFilters('jigoshop\\admin\\reports\\stock\\custom', null, $this->getCurrentType()); } }
private function getChart() { if (!in_array($this->wp->getPageNow(), array('admin.php', 'options.php'))) { return null; } if (!isset($_GET['page']) || $_GET['page'] != Reports::NAME) { return null; } if (isset($_GET['tab']) && $_GET['tab'] != self::SLUG) { return null; } switch ($this->getCurrentType()) { case 'by_date': return new Chart\ByDate($this->wp, $this->options, $this->getCurrentRange()); case 'by_product': return new Chart\ByProduct($this->wp, $this->options, $this->getCurrentRange()); case 'by_category': return new Chart\ByCategory($this->wp, $this->options, $this->getCurrentRange()); case 'discount_summary': return new Chart\DiscountSummary($this->wp, $this->options, $this->getCurrentRange()); default: return $this->wp->applyFilters('jigoshop\\admin\\reports\\sales\\custom', null, $this->getCurrentType()); } }
public function __construct(Wordpress $wp, Options $options, Messages $messages) { $this->wp = $wp; $this->options = $options; $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_' . Licences::NAME) { return; } // Styles::add('jigoshop.admin.licences', \Jigoshop::getUrl().'/assets/css/admin/settings.css'); }); }
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')); }); }
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) { $this->wp = $wp; $this->options = $options; $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; } if (isset($_REQUEST['tab']) && $_REQUEST['tab'] != self::SLUG) { return; } $screen = $wp->getCurrentScreen(); if (!in_array($screen->base, array('jigoshop_page_' . SystemInfo::NAME))) { return; } Scripts::add('jigoshop.admin.system_info.system_status', \JigoshopInit::getUrl() . '/assets/js/admin/system_info/system_status.js', array('jquery')); Scripts::localize('jigoshop.admin.system_info.system_status', 'system_data', $this->getSystemData()); }); }
/** * ToolsTab constructor. * * @param Wordpress $wp * @param Options $options */ public function __construct(Wordpress $wp, Options $options) { $this->wp = $wp; $this->options = $options; $wp->addAction('current_screen', function () use($wp) { // Weed out all admin pages except the Jigoshop Settings page hits if (!in_array($wp->getPageNow(), array('admin.php'))) { return; } if (isset($_REQUEST['tab']) && $_REQUEST['tab'] != self::SLUG) { return; } $screen = $wp->getCurrentScreen(); if (!in_array($screen->base, array('jigoshop_page_' . SystemInfo::NAME))) { return; } if (isset($_REQUEST['request'])) { $this->processRequest($_REQUEST['request']); } }); }
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, 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')); }); }
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, $currentRange) { $this->wp = $wp; $this->options = $options; $this->currentRange = $currentRange; $this->orderStatus = isset($_GET['order_status']) && !empty($_GET['order_status']) ? $_GET['order_status'] : array('jigoshop-completed', 'jigoshop-processing'); $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; } Scripts::add('jigoshop.vendors.flot', \JigoshopInit::getUrl() . '/assets/js/vendors/flot.js', array('jquery')); /*Scripts::add('jigoshop.vendors.flot', \Jigoshop::getUrl().'/assets/js/flot/jquery.flot.min.js', array('jquery')); Scripts::add('jigoshop.vendors.flot2', \Jigoshop::getUrl().'/assets/js/flot/jquery.flot.stack.min.js', array('jquery')); Scripts::add('jigoshop.vendors.flot3', \Jigoshop::getUrl().'/assets/js/flot/jquery.flot.pie.min.js', array('jquery')); Scripts::add('jigoshop.vendors.flot4', \Jigoshop::getUrl().'/assets/js/flot/jquery.flot.resize.min.js', array('jquery')); Scripts::add('jigoshop.vendors.flot5', \Jigoshop::getUrl().'/assets/js/flot/jquery.flot.time.min.js', array('jquery'));*/ Scripts::add('jigoshop.reports.chart', \JigoshopInit::getUrl() . '/assets/js/admin/reports/chart.js', array('jquery', 'jigoshop.vendors.flot')); }); }
private function isAdminProductList($request) { return $this->wp->getPageNow() == 'edit.php' && isset($request['post_type']) && $request['post_type'] == Types::PRODUCT; }