Ejemplo n.º 1
0
 /**
  * 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);
         }
     }
 }
Ejemplo n.º 2
0
 public function isMigrationPage()
 {
     $screen = $this->wp->getCurrentScreen();
     if (!empty($_POST) && isset($_POST['option_page']) && $_POST['option_page'] == Migration::NAME) {
         return true;
     }
     if ($screen !== null && $screen->id == Dashboard::NAME . '_page_' . Migration::NAME) {
         return true;
     }
     return defined('DOING_AJAX') && DOING_AJAX && isset($_POST['action']) && strpos($_POST['action'], 'admin.migration') !== false;
 }
Ejemplo n.º 3
0
 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');
     });
 }
Ejemplo n.º 4
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'));
     });
 }
Ejemplo n.º 5
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));
     });
 }
Ejemplo n.º 6
0
 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());
     });
 }
Ejemplo n.º 7
0
 /**
  * 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']);
         }
     });
 }
Ejemplo n.º 8
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'))));
     });
 }
Ejemplo n.º 9
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'));
     });
 }
Ejemplo n.º 10
0
 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'));
 }
Ejemplo n.º 11
0
 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'));
     });
 }