Esempio n. 1
0
 /**
  * Form
  * Displays the form for the wordpress admin
  *
  * @param  array  instance
  *
  * @return void
  */
 public function form($instance)
 {
     // Get instance data
     $title_guest = isset($instance['title_guest']) ? esc_attr($instance['title_guest']) : null;
     $title_user = isset($instance['title_user']) ? esc_attr($instance['title_user']) : null;
     Render::output('widget/user_login/form', array('title_guest_id' => $this->get_field_id('title_guest'), 'title_guest_name' => $this->get_field_name('title_guest'), 'title_guest' => $title_guest, 'title_user_id' => $this->get_field_id('title_user'), 'title_user_name' => $this->get_field_name('title_user'), 'title_user' => $title_user));
 }
Esempio n. 2
0
 /**
  * Displays the form for the wordpress admin.
  *
  * @param array $instance Instance data.
  *
  * @return string|void
  */
 public function form($instance)
 {
     // Get instance data
     $title = isset($instance['title']) ? esc_attr($instance['title']) : null;
     $number = isset($instance['number']) ? absint($instance['number']) : 5;
     Render::output('widget/featured_products/form', array('title_id' => $this->get_field_id('title'), 'title_name' => $this->get_field_name('title'), 'title' => $title, 'number_id' => $this->get_field_id('number'), 'number_name' => $this->get_field_name('number'), 'number' => $number));
 }
Esempio n. 3
0
 /**
  * Displays the form for the WordPress admin.
  *
  * @param  array $instance The instance.
  *
  * @return string|void
  */
 public function form($instance)
 {
     // Get instance data
     $title = isset($instance['title']) ? esc_attr($instance['title']) : null;
     $view_cart_button = isset($instance['view_cart_button']) ? esc_attr($instance['view_cart_button']) : 'View Cart →';
     $checkout_button = isset($instance['checkout_button']) ? esc_attr($instance['checkout_button']) : 'Checkout →';
     Render::output('widget/cart/form', array('title_id' => $this->get_field_id('title'), 'title_name' => $this->get_field_name('title'), 'title' => $title, 'view_cart_button_id' => $this->get_field_id('view_cart_button'), 'view_cart_button_name' => $this->get_field_name('view_cart_button'), 'view_cart_button' => $view_cart_button, 'checkout_button_id' => $this->get_field_id('checkout_button'), 'checkout_button_name' => $this->get_field_name('checkout_button'), 'checkout_button' => $checkout_button));
 }
Esempio n. 4
0
 public function render()
 {
     if (!$this->wp->isUserLoggedIn()) {
         return Render::get('user/login', array());
     }
     $customer = $this->customerService->getCurrent();
     return Render::get('user/account/change_password', array('messages' => $this->messages, 'customer' => $customer, 'myAccountUrl' => $this->wp->getPermalink($this->options->getPageId(Pages::ACCOUNT))));
 }
Esempio n. 5
0
 public function displayRules()
 {
     $classes = array();
     foreach ($this->options['classes'] as $class) {
         $classes[$class['class']] = $class['label'];
     }
     $countries = array_merge(array('' => __('All countries', 'jigoshop')), Country::getAll());
     Render::output('admin/settings/tax/rules', array('rules' => $this->taxService->getRules(), 'classes' => $classes, 'countries' => $countries));
 }
Esempio n. 6
0
 public function start_el(&$output, $category, $depth = 0, $args = array(), $current_object_id = 0)
 {
     $name = $this->wp->applyFilters('list_product_cats', $category->name, $category);
     if (!isset($args['value'])) {
         $args['value'] = $category->taxonomy == Types::PRODUCT_CATEGORY ? 'slug' : 'id';
     }
     $value = $args['value'] == 'slug' ? $category->slug : $category->term_id;
     $output .= Render::get($this->template, array('depth' => $depth, 'term' => $category, 'value' => $value, 'name' => $name, 'selected' => $args['selected'], 'show_count' => $args['show_count'], 'count' => $category->count));
 }
Esempio n. 7
0
 /**
  * @return array List of items to display.
  */
 public function getSections()
 {
     if (empty($this->sections)) {
         $this->sections = array(array('title' => __('Get System Information', 'jigoshop'), 'id' => 'get-system-information', 'description' => __('Please copy and paste this information in your ticket when contacting support', 'jigoshop'), 'fields' => array(array('id' => 'debug_report', 'title' => '', 'generate_button_id' => 'generate-report', 'debug_textarea_id' => 'report-for-support', 'generate_button_label' => __('Generate Report', 'jigoshop'), 'type' => 'user_defined', 'display' => function ($field) {
             return Render::output('admin/system_info/debug_report', $field);
         }))), array('title' => __('WordPress Environment', 'jigoshop'), 'id' => 'wordpress-environment', 'fields' => array(array('id' => 'home-url', 'name' => 'home-url', 'title' => __('Home URL', 'jigoshop'), 'tip' => __('The URL of your site\'s homepage.', 'jigoshop'), 'type' => 'constant', 'value' => home_url()), array('id' => 'site-url', 'name' => 'site-url', 'title' => __('Site URL', 'jigoshop'), 'tip' => __('The root URL of your site.', 'jigoshop'), 'type' => 'constant', 'value' => site_url()), array('id' => 'jigoshop-version', 'name' => 'jigoshop-version', 'title' => __('Jigoshop Version', 'jigoshop'), 'tip' => __('The version of Jigoshop installed on your site.', 'jigoshop'), 'type' => 'constant', 'value' => Core::VERSION), array('id' => 'jigoshop-database-version', 'name' => 'jigoshop-database-version', 'title' => __('Jigoshop Database Version', 'jigoshop'), 'tip' => __('The version of jigoshop that the database is formatted for. This should be the same as your jigoshop Version.', 'jigoshop'), 'type' => 'constant', 'value' => $this->wp->getOption('jigoshop-database-version')), array('id' => 'log-directory-writable', 'name' => 'log-directory-writable', 'title' => __('Log Directory Writable', 'jigoshop'), 'tip' => __('Several Jigoshop extensions can write logs which makes debugging problems easier. The directory must be writable for this to happen.', 'jigoshop'), 'description' => sprintf(__('To allow logging, make <code>%s</code> writable or define a custom <code>JIGOSHOP_LOG_DIR</code>.', 'jigoshop'), JIGOSHOP_LOG_DIR), 'type' => 'constant', 'value' => $this->checkLogDirectory() ? $this->yes : $this->no), array('id' => 'wp-version', 'name' => 'wp-version', 'title' => __('WP Version', 'jigoshop'), 'tip' => __('The version of WordPress installed on your site.', 'jigoshop'), 'type' => 'constant', 'value' => get_bloginfo('version')), array('id' => 'wp-multisite', 'name' => 'wp-multisite', 'title' => __('WP Multisite', 'jigoshop'), 'tip' => __('The maximum amount of memory (RAM) that your site can use at one time.', 'jigoshop'), 'type' => 'constant', 'value' => is_multisite() ? $this->yes : $this->no), array('id' => 'wp-memory-limit', 'name' => 'wp-memory-limit', 'title' => __('WP Memory Limit', 'jigoshop'), 'tip' => __('The maximum amount of memory (RAM) that your site can use at one time.', 'jigoshop'), 'type' => 'constant', 'value' => $this->checkMemoryLimit(WP_MEMORY_LIMIT, JIGOSHOP_REQUIRED_WP_MEMORY)), array('id' => 'wp-debug-mode', 'name' => 'wp-debug-mode', 'title' => __('WP Debug Mode', 'jigoshop'), 'tip' => __('Displays whether or not WordPress is in Debug Mode.', 'jigoshop'), 'type' => 'constant', 'value' => defined('WP_DEBUG') && WP_DEBUG ? $this->yes : $this->no), array('id' => 'language', 'name' => 'language', 'title' => __('Language', 'jigoshop'), 'tip' => __('The current language used by WordPress. Default = English.', 'jigoshop'), 'type' => 'constant', 'value' => get_locale()))), array('title' => __('Server Environment', 'jigoshop'), 'id' => 'srever-environment', 'fields' => array(array('id' => 'server-info', 'name' => 'server-info', 'title' => __('Server Info', 'jigoshop'), 'tip' => __('Information about the web server that is currently hosting your site.', 'jigoshop'), 'type' => 'constant', 'value' => esc_html($_SERVER['SERVER_SOFTWARE'])), array('id' => 'php-version', 'name' => 'php-version', 'title' => __('PHP Version', 'jigoshop'), 'tip' => __('The version of PHP installed on your hosting server.', 'jigoshop'), 'type' => 'constant', 'value' => $this->checkPhpVersion(PHP_VERSION, JIGOSHOP_PHP_VERSION)), array('id' => 'php-post-max-size', 'name' => 'php-post-max-size', 'title' => __('PHP Post Max Size', 'jigoshop'), 'tip' => __('The largest filesize that can be contained in one post.', 'jigoshop'), 'type' => 'constant', 'value' => size_format($this->letterToNumber($this->iniGet('post_max_size')))), array('id' => 'php-time-limit', 'name' => 'php-time-limit', 'title' => __('PHP Time Limit', 'jigoshop'), 'tip' => __('The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'jigoshop'), 'type' => 'constant', 'value' => size_format($this->letterToNumber($this->iniGet('post_max_size')))), array('id' => 'php-time-limit', 'name' => 'php-time-limit', 'title' => __('PHP Max Input Vars', 'jigoshop'), 'tip' => __('The maximum number of variables your server can use for a single function to avoid overloads.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('max_input_vars')), array('id' => 'suhosin-installed', 'name' => 'suhosin-installed', 'title' => __('SUHOSIN Installed', 'jigoshop'), 'tip' => __('Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'jigoshop'), 'type' => 'constant', 'value' => extension_loaded('suhosin') ? $this->yes : $this->no), array('id' => 'eaccelerator', 'name' => 'eaccelerator', 'title' => __('eAccelerator', 'jigoshop'), 'classes' => array('system-data'), 'tip' => __('eAccelerator is deprecated and causes problems with Jigoshop.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('eaccelerator.enable') == 1 ? $this->yes : $this->no), array('id' => 'apc', 'name' => 'apc', 'title' => __('APC', 'jigoshop'), 'tip' => __('APC is deprecated and causes problems with Jigoshop.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('apc.enable') == 1 ? $this->yes : $this->no), array('id' => 'apc', 'name' => 'apc', 'title' => __('OpCache', 'jigoshop'), 'tip' => __('OpCache is new PHP optimizer and it is recommended to use with Jigoshop.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('opcache.enable') == 1 ? $this->yes : $this->no), array('id' => 'short-open-tag', 'name' => 'short-open-tag', 'title' => __('Short Open Tag', 'jigoshop'), 'tip' => __('Whether short tags are enabled, they are used by some older extensions.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('short-open-tag') != '' ? $this->yes : $this->no), array('id' => 'allow-url-fopen', 'name' => 'allow-url-fopen', 'title' => __('Allow URL fopen', 'jigoshop'), 'tip' => __('Whether fetching remote files is allowed. This option is used by many Jigoshop extensions.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('allow_url_fopen') != '' ? $this->yes : $this->no), array('id' => 'session', 'name' => 'session', 'title' => __('Session', 'jigoshop'), 'tip' => __('Whether fetching remote files is allowed. This option is used by many Jigoshop extensions.', 'jigoshop'), 'type' => 'constant', 'value' => session_id() != null && isset($_SESSION) ? $this->yes : $this->no), array('id' => 'cookie-path', 'name' => 'cookie-path', 'title' => __('Cookie Path', 'jigoshop'), 'tip' => __('Path for which cookies are saved. This is important for sessions and session security.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('session.cookie_path')), array('id' => 'save-path', 'name' => 'save-path', 'title' => __('Save Path', 'jigoshop'), 'tip' => __('Path where sessions are stored on the server. This is sometimes cause of login/logout problems.', 'jigoshop'), 'type' => 'constant', 'value' => esc_html($this->iniGet('session.save_path'))), array('id' => 'use-cookies', 'name' => 'use-cookies', 'title' => __('Use Cookies', 'jigoshop'), 'tip' => __('Whether cookies are used to store PHP session on user\'s computer. Recommended.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('session.use_cookies') != '' ? $this->yes : $this->no), array('id' => 'use-only-cookies', 'name' => 'use-only-cookies', 'title' => __('Use Only Cookies', 'jigoshop'), 'tip' => __('Whether PHP uses only cookies to handle user sessions. This is important for security reasons.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('session.use_only_cookies') != '' ? $this->yes : $this->no), array('id' => 'max-upload-size', 'name' => 'max-upload-size', 'title' => __('Max Upload Size', 'jigoshop'), 'tip' => __('The largest filesize that can be uploaded to your WordPress installation.', 'jigoshop'), 'type' => 'constant', 'value' => size_format(wp_max_upload_size())), array('id' => 'default-timezone', 'name' => 'default-timezone', 'title' => __('Default Timezone', 'jigoshop'), 'tip' => __('The default timezone for your server. We recommend to set it as UTC.', 'jigoshop'), 'type' => 'constant', 'value' => date_default_timezone_get()), array('id' => 'fsockopen-curl', 'name' => 'fsockopen-curl', 'title' => __('fsockopen/cURL', 'jigoshop'), 'tip' => __('Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'jigoshop'), 'type' => 'constant', 'value' => function_exists('fsockopen') || function_exists('curl_init') ? $this->yes : $this->no), array('id' => 'soap-client', 'name' => 'soap-client', 'title' => __('SoapClient', 'jigoshop'), 'tip' => __('Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'jigoshop'), 'type' => 'constant', 'value' => class_exists('SoapClient') ? $this->yes : $this->no), array('id' => 'wp-remote-post', 'name' => 'wp-remote-post', 'title' => __('Remote Post', 'jigoshop'), 'tip' => __('PayPal uses this method of communicating when sending back transaction information.', 'jigoshop'), 'type' => 'constant', 'value' => $this->checkRemoteRequest('post') ? $this->yes : $this->no), array('id' => 'wp-remote-get', 'name' => 'wp-remote-get', 'title' => __('Remote Get', 'jigoshop'), 'tip' => __('PayJigoshop plugins may use this method of communication when checking for plugin updates.', 'jigoshop'), 'type' => 'constant', 'value' => $this->checkRemoteRequest('get') ? $this->yes : $this->no))), array('title' => __('Server Locale', 'jigoshop'), 'id' => 'srever-locale', 'fields' => array(array('id' => 'decimal-point', 'name' => 'decimal-point', 'title' => __('Decimal Point', 'jigoshop'), 'tip' => __('The character used for decimal points.', 'jigoshop'), 'type' => 'constant', 'value' => $this->getServerLocale('decimal_point') ? $this->getServerLocale('decimal_point') : $this->no), array('id' => 'thousands-sep', 'name' => 'thousands-sep', 'title' => __('Thousands Separator', 'jigoshop'), 'tip' => __('The character used for a thousands separator.', 'jigoshop'), 'type' => 'constant', 'value' => $this->getServerLocale('thousands_sep') ? $this->getServerLocale('thousands_sep') : $this->no), array('id' => 'mon-decimal-point', 'name' => 'mon-decimal-point', 'title' => __('Monetary Decimal Point', 'jigoshop'), 'tip' => __('The character used for decimal points in monetary values.', 'jigoshop'), 'type' => 'constant', 'value' => $this->getServerLocale('mon_decimal_point') ? $this->getServerLocale('mon_decimal_point') : $this->no), array('id' => 'mon-thousands-sep', 'name' => 'mon-thousands-sep', 'title' => __('Monetary Thousands Separator', 'jigoshop'), 'tip' => __('The character used for a thousands separator in monetary values.', 'jigoshop'), 'type' => 'constant', 'value' => $this->getServerLocale('mon_thousands_sep') ? $this->getServerLocale('mon_thousands_sep') : $this->no))), array('title' => sprintf(__('Active Plugins (%s)', 'jigoshop'), count((array) $this->wp->getOption('active_plugins'))), 'id' => 'active-plugins', 'fields' => $this->getActivePlugins()), array('title' => __('Settings', 'jigoshop'), 'id' => 'settings', 'fields' => array(array('id' => 'force-ssl', 'name' => 'force-ssl', 'title' => __('Force SSL', 'jigoshop'), 'tip' => __('Does your site force a SSL Certificate for transactions?', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('shopping.force_ssl') ? $this->yes : $this->no), array('id' => 'shipping-enabled', 'name' => 'shipping-enabled', 'title' => __('Shipping Enabled', 'jigoshop'), 'tip' => __('Does your site have shipping enabled?', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('shipping.enabled') ? $this->yes : $this->no), array('id' => 'currency', 'name' => 'currency', 'title' => __('Shipping Enabled', 'jigoshop'), 'tip' => __('What currency prices are listed at in the catalog and which currency gateways will take payments in?', 'jigoshop'), 'type' => 'constant', 'value' => Currency::code() . '(' . Currency::symbol() . ')'), array('id' => 'currency-position', 'name' => 'currency-position', 'title' => __('Currency Position', 'jigoshop'), 'tip' => __('The position of the currency symbol.', 'jigoshop'), 'type' => 'constant', 'value' => $this->getCurrencyPosition()), array('id' => 'thousand-separator', 'name' => 'thousand-separator', 'title' => __('Thousand Separator', 'jigoshop'), 'tip' => __('The thousand separator of displayed prices.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('general.currency_thousand_separator')), array('id' => 'decimal-separator', 'name' => 'decimal-separator', 'title' => __('Decimal Separator', 'jigoshop'), 'tip' => __('The decimal separator of displayed prices.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('general.currency_decimal_separator')), array('id' => 'number-of-decimals', 'name' => 'number-of-decimals', 'title' => __('Number of Decimals', 'jigoshop'), 'tip' => __('The number of decimal points shown in displayed prices.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('general.currency_decimals')))), array('title' => __('Jigoshop Pages', 'jigoshop'), 'id' => 'jigoshop-pages', 'fields' => array(array('id' => 'shop-base', 'name' => 'shop-base', 'title' => __('Shop Base', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s homepage.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.shop') ? '#' . $this->options->get('advanced.pages.shop') : $this->no), array('id' => 'cart', 'name' => 'cart', 'title' => __('Cart', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s cart page.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.cart') ? '#' . $this->options->get('advanced.pages.cart') : $this->no), array('id' => 'checkout', 'name' => 'checkout', 'title' => __('Checkout', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s checkout page.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.checkout') ? '#' . $this->options->get('advanced.pages.checkout') : $this->no), array('id' => 'thank-you', 'name' => 'thank-you', 'title' => __('Thank You', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s thank you page.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.checkout_thank_you') ? '#' . $this->options->get('advanced.pages.checkout_thank_you') : $this->no), array('id' => 'my-account', 'name' => 'my-account', 'title' => __('My account', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s my account page.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.account') ? '#' . $this->options->get('advanced.pages.account') : $this->no), array('id' => 'terms', 'name' => 'terms', 'title' => __('Terms', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s terms page.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.terms') ? '#' . $this->options->get('advanced.pages.terms') : $this->no))), array('title' => __('Theme', 'jigoshop'), 'id' => 'theme', 'fields' => array(array('id' => 'name', 'name' => 'name', 'title' => __('Name', 'jigoshop'), 'tip' => __('The name of the current active theme.', 'jigoshop'), 'type' => 'constant', 'value' => $this->wp->wpGetTheme()->display('Name')), array('id' => 'version', 'name' => 'version', 'title' => __('Version', 'jigoshop'), 'tip' => __('The installed version of the current active theme.', 'jigoshop'), 'type' => 'constant', 'value' => $this->wp->wpGetTheme()->display('Version')), array('id' => 'author-url', 'name' => 'author-url', 'title' => __('Author URL', 'jigoshop'), 'tip' => __('The theme developers URL.', 'jigoshop'), 'type' => 'constant', 'value' => $this->wp->wpGetTheme()->display('AuthorURI')), array('id' => 'child-theme', 'name' => 'child-theme', 'title' => __('Child Theme', 'jigoshop'), 'tip' => __('Displays whether or not the current theme is a child theme', 'jigoshop'), 'description' => sprintf(__('If you\'re modifying Jigoshop or a parent theme you didn\'t build personally we recommend using a child theme. See: <a href="%s" target="-blank">How to create a child theme</a>', 'jigoshop'), 'https://codex.wordpress.org/Child_Themes'), 'type' => 'constant', 'value' => is_child_theme() ? $this->yes : $this->no), array('id' => 'parent-theme-name', 'name' => 'parent-theme-name', 'title' => __('Parent Theme Name', 'jigoshop'), 'tip' => __('The name of the parent theme.', 'jigoshop'), 'type' => 'constant', 'value' => is_child_theme() ? wp_get_theme($this->wp->wpGetTheme()->display('Template'))->display('Name') : $this->no), array('id' => 'parent-theme-version', 'name' => 'parent-theme-version', 'title' => __('Parent Theme Version', 'jigoshop'), 'tip' => __('The installed version of the parent theme.', 'jigoshop'), 'type' => 'constant', 'value' => is_child_theme() ? wp_get_theme($this->wp->wpGetTheme()->display('Template'))->display('Version') : $this->no), array('id' => 'parent-theme-author-url', 'name' => 'parent-theme-author-url', 'title' => __('Parent Theme Author URL', 'jigoshop'), 'tip' => __('The installed version of the parent theme.', 'jigoshop'), 'type' => 'constant', 'value' => is_child_theme() ? wp_get_theme($this->wp->wpGetTheme()->display('Template'))->display('AuthorURI') : $this->no))), array('title' => __('Templates', 'jigoshop'), 'id' => 'templates', 'description' => __('This section shows any files that are overriding the default jigoshop template pages', 'jigoshop'), 'fields' => $this->getOverrides()));
     }
     return $this->sections;
 }
Esempio n. 8
0
 public function showThumbnail($term)
 {
     $termId = 0;
     if (is_object($term)) {
         $termId = $term->term_id;
     }
     $image = ProductCategory::getImage($termId);
     Render::output('admin/product_categories/thumbnail', array('image' => $image));
 }
Esempio n. 9
0
 /**
  * Shows migration tool in Migration tab.
  */
 public function display()
 {
     $countAll = 93;
     $countRemain = 93;
     if (($itemsFromBase = $this->wp->getOption('jigoshop_options_migrate_id')) !== false) {
         if ($itemsFromBase === '1') {
             $countRemain = 0;
         }
     }
     Render::output('admin/migration/options', array('countAll' => $countAll, 'countDone' => $countAll - $countRemain));
 }
Esempio n. 10
0
 /**
  * Shows migration tool in Migration tab.
  */
 public function display()
 {
     $wpdb = $this->wp->getWPDB();
     $countAll = count($wpdb->get_results($wpdb->prepare("\n\t\t\tSELECT DISTINCT p.ID FROM {$wpdb->posts} p\n\t\t\tLEFT JOIN {$wpdb->postmeta} pm ON pm.post_id = p.ID\n\t\t\t\tWHERE p.post_type IN (%s) AND p.post_status <> %s\n\t\t\tGROUP BY p.ID", array('shop_email', 'auto-draft'))));
     $countRemain = 0;
     $countDone = 0;
     if (($itemsFromBase = $this->wp->getOption('jigoshop_emails_migrate_id')) !== false) {
         $countRemain = count(unserialize($itemsFromBase));
         $countDone = $countAll - $countRemain;
     }
     Render::output('admin/migration/emails', array('countAll' => $countAll, 'countDone' => $countDone));
 }
Esempio n. 11
0
 /**
  * Shows migration tool in Migration tab.
  */
 public function display()
 {
     $wpdb = $this->wp->getWPDB();
     $countAll = count($wpdb->get_results($wpdb->prepare("\n\t\t\tSELECT ID FROM {$wpdb->posts}\n\t\t\t\tWHERE post_type IN (%s, %s) AND post_status <> %s", 'product', 'product_variation', 'auto-draft')));
     $countRemain = 0;
     $countDone = 0;
     if (($itemsFromBase = $this->wp->getOption('jigoshop_products_migrate_id')) !== false) {
         $countRemain = count(unserialize($itemsFromBase));
         $countDone = $countAll - $countRemain;
     }
     Render::output('admin/migration/products', array('countAll' => $countAll, 'countDone' => $countDone));
 }
Esempio n. 12
0
    /**
     * @return array List of items to display.
     */
    public function getSections()
    {
        $pages = $this->_getPages();
        $termsPages = $pages;
        $termsPages[0] = __('None', 'jigoshop');
        return array(array('title' => __('Cron jobs', 'jigoshop'), 'id' => 'cron', 'fields' => array(array('name' => '[automatic_complete]', 'title' => __('Complete processing orders', 'jigoshop'), 'description' => __("Change all 'Processing' orders older than one month to 'Completed'", 'jigoshop'), 'tip' => __("For orders that have been completed but the status is still set to 'processing'.  This will move them to a 'completed' status without sending an email out to all the customers.", 'jigoshop'), 'type' => 'checkbox', 'checked' => $this->settings['automatic_complete'], 'classes' => array('switch-medium')), array('name' => '[automatic_reset]', 'title' => __('Reset pending orders', 'jigoshop'), 'description' => __("Change all 'Pending' orders older than one month to 'On Hold'", 'jigoshop'), 'tip' => __("For customers that have not completed the Checkout process or haven't paid for an order after a period of time, this will reset the Order to On Hold allowing the Shop owner to take action.  WARNING: For the first use on an existing Shop this setting <em>can</em> generate a <strong>lot</strong> of email!", 'jigoshop'), 'type' => 'checkbox', 'checked' => $this->settings['automatic_reset'], 'classes' => array('switch-medium')))), array('title' => __('Integration', 'jigoshop'), 'id' => 'integration', 'fields' => array(array('name' => '[integration][google_analytics]', 'title' => __('Google Analytics ID', 'jigoshop'), 'description' => __('Log into your Google Analytics account to find your ID. e.g. <code>UA-XXXXXXX-X</code>', 'jigoshop'), 'type' => 'text', 'value' => $this->settings['integration']['google_analytics']))), array('title' => __('Products list', 'jigoshop'), 'id' => 'products_list', 'fields' => array(array('name' => '[products_list][variations_sku_stock]', 'title' => __('Show variation\'s SKU and stock', 'jigoshop'), 'description' => __("Show all variation's SKU and stock on admin products list page.", 'jigoshop'), 'type' => 'checkbox', 'checked' => $this->settings['products_list']['variations_sku_stock'], 'classes' => array('switch-medium')))), array('title' => __('Others', 'jigoshop'), 'id' => 'others', 'fields' => array(array('name' => '[cache]', 'title' => __('Caching mechanism', 'jigoshop'), 'description' => __('Decides which mechanism for caching is used on the page.', 'jigoshop'), 'type' => 'select', 'value' => $this->settings['cache'], 'options' => $this->caches), array('name' => '[session]', 'title' => __('Session mechanism', 'jigoshop'), 'description' => __('Decides which mechanism for session is used on the page.', 'jigoshop'), 'type' => 'select', 'value' => $this->settings['session'], 'options' => $this->sessionTypes), array('name' => '[ignore_meta_queries]', 'title' => __('Ignore meta queries on product list', 'jigoshop'), 'description' => __('Ignores products\' visibility to enhance the loading time.
Warning : This will result in showing "out of stock" products on the catalog page, as well as making all products visible in the catalog and search pages.', 'jigoshop'), 'type' => 'checkbox', 'checked' => $this->settings['ignore_meta_queries'], 'classes' => array('switch-medium')), array('name' => '[install_emails]', 'title' => __('Create default emails', 'jigoshop'), 'description' => __('Creates default emails for Jigoshop email system.', 'jigoshop'), 'type' => 'user_defined', 'display' => function () {
            Render::output('admin/settings/create_emails', array());
        }))), array('title' => __('API', 'jigoshop'), 'id' => 'api', 'description' => __('API DESC', 'jigoshop'), 'fields' => array(array('name' => '[api][keys]', 'title' => __('Keys', 'jigoshop'), 'type' => 'user_defined', 'value' => $this->settings['api']['keys'], 'description' => __('Logged users don\'t need to use api keys, guest can see products and manage their carts', 'jigoshop'), 'display' => function ($field) {
            Render::output('admin/settings/api_keys', array('name' => $field['name'], 'values' => $field['value'], 'description' => $field['description'], 'availablePermissions' => Permission::getPermisions()));
        }))), array('title' => __('Pages', 'jigoshop'), 'id' => 'pages', 'description' => __('This section allows you to change content source page for each part of Jigoshop. It will not change the main behaviour though.', 'jigoshop'), 'fields' => array(array('name' => '[pages][shop]', 'title' => __('Shop page', 'jigoshop'), 'type' => 'select', 'value' => $this->settings['pages']['shop'], 'options' => $pages), array('name' => '[pages][cart]', 'title' => __('Cart page', 'jigoshop'), 'type' => 'select', 'value' => $this->settings['pages']['cart'], 'options' => $pages), array('name' => '[pages][checkout]', 'title' => __('Checkout page', 'jigoshop'), 'type' => 'select', 'value' => $this->settings['pages']['checkout'], 'options' => $pages), array('name' => '[pages][checkout_thank_you]', 'title' => __('Thanks page', 'jigoshop'), 'type' => 'select', 'value' => $this->settings['pages']['checkout_thank_you'], 'options' => $pages), array('name' => '[pages][account]', 'title' => __('My account page', 'jigoshop'), 'type' => 'select', 'value' => $this->settings['pages']['account'], 'options' => $pages), array('name' => '[pages][terms]', 'title' => __('Terms page', 'jigoshop'), 'type' => 'select', 'value' => $this->settings['pages']['terms'], 'options' => $termsPages))));
    }
Esempio n. 13
0
 /**
  * Show the settings
  */
 public function settings()
 {
     echo '<p>' . __('These settings control the permalinks used for products. These settings only apply when <strong>not using "default" permalinks above</strong>.', 'jigoshop') . '</p>';
     $helpers = $this->wp->getHelpers();
     $permalink = $helpers->trailingslashit($this->options->get('permalinks.product'));
     // Get shop page
     $shopPageId = $this->options->getPageId(FrontendPages::SHOP);
     $base = urldecode($shopPageId > 0 && $this->wp->getPost($shopPageId) ? $this->wp->getPageUri($shopPageId) : _x('shop', 'default-slug', 'jigoshop'));
     $productBase = _x('product', 'default-slug', 'jigoshop');
     $structures = array(0 => '', 1 => '/' . $helpers->trailingslashit($productBase), 2 => '/' . $helpers->trailingslashit($base), 3 => '/' . $helpers->trailingslashit($base) . '%' . Types::PRODUCT_CATEGORY . '%');
     Render::output('admin/permalinks', array('permalink' => $permalink, 'structures' => $structures, 'shopPageId' => $shopPageId, 'base' => $base, 'productBase' => $productBase, 'homeUrl' => $this->wp->getHomeUrl()));
 }
Esempio n. 14
0
 public function render()
 {
     if (!$this->wp->isUserLoggedIn()) {
         return Render::get('user/login', array());
     }
     $content = $this->wp->getPostField('post_content', $this->options->getPageId(Pages::ACCOUNT));
     $content = do_shortcode($content);
     $customer = $this->customerService->getCurrent();
     $query = new \WP_Query(array('post_type' => Types::ORDER, 'post_status' => array(Status::PENDING, Status::ON_HOLD), 'posts_per_page' => $this->options->get('shopping.unpaid_orders_number'), 'meta_query' => array(array('key' => 'customer_id', 'value' => $this->wp->getCurrentUserId(), 'compare' => '='))));
     $orders = $this->orderService->findByQuery($query);
     $permalink = get_permalink();
     return Render::get('user/account', array('content' => $content, 'messages' => $this->messages, 'customer' => $customer, 'unpaidOrders' => $orders, 'editBillingAddressUrl' => Api::getEndpointUrl('edit-address', 'billing', $permalink), 'editShippingAddressUrl' => Api::getEndpointUrl('edit-address', 'shipping', $permalink), 'changePasswordUrl' => Api::getEndpointUrl('change-password', '', $permalink), 'myOrdersUrl' => Api::getEndpointUrl('orders', '', $permalink)));
 }
Esempio n. 15
0
 public function render()
 {
     if (!$this->wp->isUserLoggedIn()) {
         return Render::get('user/login', array());
     }
     $order = $this->wp->getQueryParameter('orders');
     $accountUrl = $this->wp->getPermalink($this->options->getPageId(Pages::ACCOUNT));
     if (!empty($order) && is_numeric($order)) {
         $order = $this->orderService->find($order);
         /** @var Entity $order */
         return Render::get('user/account/orders/single', array('messages' => $this->messages, 'order' => $order, 'myAccountUrl' => $accountUrl, 'listUrl' => Api::getEndpointUrl('orders', '', $accountUrl), 'showWithTax' => $this->options->get('tax.price_tax') == 'with_tax', 'getTaxLabel' => function ($taxClass) use($order) {
             return Tax::getLabel($taxClass, $order);
         }));
     }
     $customer = $this->customerService->getCurrent();
     $orders = $this->orderService->findForUser($customer->getId());
     return Render::get('user/account/orders', array('messages' => $this->messages, 'customer' => $customer, 'orders' => $orders, 'myAccountUrl' => $accountUrl));
 }
Esempio n. 16
0
 /**
  * Loads proper template based on current page.
  *
  * @param $template string Template chain.
  *
  * @return string Template to load.
  */
 public function process($template)
 {
     if (!Pages::isJigoshop()) {
         return $template;
     }
     if ($this->page === null) {
         if (WP_DEBUG) {
             throw new Exception('Page object should already be set for Jigoshop pages, but none found.');
         }
         Registry::getInstance(JIGOSHOP_LOGGER)->addCritical('Page object should already be set for Jigoshop pages, but none found.');
         return false;
     }
     $content = $this->page->render();
     $template = $this->wp->getOption('template');
     $theme = $this->wp->wpGetTheme();
     if ($theme->get('Author') === 'WooThemes') {
         $template = 'woothemes';
     }
     if (!file_exists(\JigoshopInit::getDir() . '/templates/layout/' . $template . '.php')) {
         $template = 'default';
     }
     Render::output('layout/' . $template, array('content' => $content));
     return false;
 }
Esempio n. 17
0
        foreach ($item['items'] as $subvalue => $subitem) {
            $subitem['disabled'] = isset($subitem['disabled']) && $subitem['disabled'] ? true : false;
            ?>
                                        <?php 
            Render::output('admin/forms/select/option', array('label' => $subitem['label'], 'disabled' => $subitem['disabled'], 'value' => $subvalue, 'current' => $value));
            ?>
                                    <?php 
        }
        ?>
                                </optgroup>
                            <?php 
    } else {
        $item['disabled'] = isset($item['disabled']) && $item['disabled'] ? true : false;
        ?>
                                <?php 
        Render::output('admin/forms/select/option', array('label' => $item['label'], 'disabled' => $item['disabled'], 'value' => $option, 'current' => $value));
        ?>
                            <?php 
    }
    ?>
                        <?php 
}
?>
                    </select>
                    <?php 
if (!empty($description)) {
    ?>
                        <span class="help-block"><?php 
    echo $description;
    ?>
</span>
Esempio n. 18
0
 /**
  * @return array List of items to display.
  */
 public function getSections()
 {
     return array(array('title' => __('Available Tools', 'jigoshop'), 'id' => 'available-tools', 'fields' => array(array('id' => 'clear-logs', 'name' => 'clear-logs', 'title' => __('Clear Logs', 'jigoshop'), 'description' => __('Clears jigoshop.log and jigoshop.debug.log', 'jigoshop'), 'tip' => '', 'classes' => array(), 'type' => 'user_defined', 'display' => function ($field) {
         return Render::output('admin/system_info/tool', $field);
     }))));
 }
Esempio n. 19
0
    ?>
" data-toggle="tab"><?php 
    echo $name;
    ?>
</a>
            </li>
            <?php 
}
?>
        </ul>
        <div class="tab-content">
            <?php 
foreach ($menu as $id => $name) {
    ?>
            <div class="tab-pane<?php 
    echo $id == 'gallery' ? ' active' : '';
    ?>
" id="<?php 
    echo $id;
    ?>
">
                <?php 
    Render::output('admin/product/attachments/' . $id, array());
    ?>
            </div>
            <?php 
}
?>
        </div>
    </div>
</div>
Esempio n. 20
0
 /**
  * Displays the page.
  */
 public function display()
 {
     Render::output('admin/settings', array('tabs' => $this->tabs, 'current_tab' => $this->getCurrentTab(), 'messages' => $this->messages));
 }
Esempio n. 21
0
 public function render()
 {
     $cart = $this->cartService->getCurrent();
     $content = $this->wp->getPostField('post_content', $this->options->getPageId(Pages::CART));
     $content = do_shortcode($content);
     $termsUrl = '';
     $termsPage = $this->options->get('advanced.pages.terms');
     if ($termsPage > 0) {
         $termsUrl = $this->wp->getPermalink($termsPage);
     }
     return Render::get('shop/cart', array('content' => $content, 'cart' => $cart, 'messages' => $this->messages, 'productService' => $this->productService, 'customer' => $this->customerService->getCurrent(), 'shippingMethods' => $this->shippingService->getEnabled(), 'shopUrl' => $this->wp->getPermalink($this->options->getPageId(Pages::SHOP)), 'showWithTax' => $this->options->get('tax.price_tax') == 'with_tax', 'showShippingCalculator' => $this->options->get('shipping.calculator'), 'termsUrl' => $termsUrl));
 }
Esempio n. 22
0
 public function render()
 {
     $query = $this->wp->getQuery();
     $products = $this->productService->findByQuery($query);
     $content = do_shortcode($this->getContent());
     return Render::get('shop', array('content' => $content, 'products' => $products, 'product_count' => $query->max_num_pages, 'messages' => $this->messages, 'title' => $this->getTitle()));
 }
Esempio n. 23
0
<?php

/**
 * @var $email \Jigoshop\Entity\Email The email.
 * @var $emails array List of registered emails.
 */
?>
<div class="jigoshop">
	<?php 
\Jigoshop\Helper\Render::output('admin/email/variables', array('email' => $email, 'emails' => $emails));
?>
</div>
Esempio n. 24
0
 public function displayColumn($column)
 {
     $post = $this->wp->getGlobalPost();
     if ($post === null) {
         return;
     }
     /** @var Entity $order */
     $order = $this->orderService->findForPost($post);
     switch ($column) {
         case 'status':
             OrderHelper::renderStatus($order);
             break;
         case 'customer':
             echo OrderHelper::getUserLink($order->getCustomer());
             break;
         case 'billing_address':
             Render::output('admin/orders/billingAddress', array('order' => $order));
             break;
         case 'shipping_address':
             Render::output('admin/orders/shippingAddress', array('order' => $order));
             break;
         case 'shipping_payment':
             Render::output('admin/orders/shippingPayment', array('order' => $order));
             break;
         case 'total':
             Render::output('admin/orders/totals', array('order' => $order, 'getTaxLabel' => function ($taxClass) use($order) {
                 return Tax::getLabel($taxClass, $order);
             }));
             break;
         case 'products':
             $wpdb = $this->wp->getWPDB();
             $products = $wpdb->get_results("SELECT product_id, title FROM " . $wpdb->prefix . "jigoshop_order_item WHERE order_id = " . $order->getId());
             Render::output('admin/orders/products', array('products' => $products));
             break;
     }
 }
Esempio n. 25
0
<?php

/**
 * @var array $products List of related products.
 */
if (count($products) > 0) {
    ?>
    <h4><?php 
    _e('Related products', 'jigoshop');
    ?>
</h4>
    <ul id="related_products" class="list-inline">
        <?php 
    foreach ($products as $product) {
        ?>
            <?php 
        \Jigoshop\Helper\Render::output('shop/list/product', array('product' => $product));
        ?>
        <?php 
    }
    ?>
    </ul>
<?php 
}
Esempio n. 26
0
_e('Postcodes', 'jigoshop');
?>
								<span data-toggle="tooltip" class="badge" data-placement="top" title="<?php 
_e('Enter list of postcodes, separating with comma.', 'jigoshop');
?>
">?</span>
							</th>
							<th scope="col"></th>
						</tr>
						</thead>
						<tbody>
						<?php 
foreach ($rules as $rule) {
    ?>
							<?php 
    Render::output('admin/settings/tax/rule', array('rule' => $rule, 'classes' => $classes, 'countries' => $countries));
    ?>
						<?php 
}
?>
						</tbody>
						<tfoot>
						<tr>
							<td colspan="6" class="pull-text-left">
								<button type="button" class="btn btn-default text-left" id="add-tax-rule"><span class="glyphicon glyphicon-plus"></span> <?php 
_e('Add', 'jigoshop');
?>
</button>
							</td>
						</tr>
						</tfoot>
Esempio n. 27
0
 /**
  * Outputs simple static (constant) field.
  *
  * Available parameters (with defaults):
  *   * id (null) - HTML id for the tag
  *   * name (null) - HTML name for the tag
  *   * label (null) - label for the tag
  *   * value (false) - HTML value of the tag
  *   * placeholder ('') - placeholder of the tag
  *   * classes (array()) - list of HTML classes for the tag
  *   * description (false) - description of the tag
  *   * tip (false) - tip for the tag
  *   * hidden (false) - whether to hide element by default
  *   * size (12) - default size of the element (Bootstrap column size 12)
  *
  * Field's name is required.
  *
  * @param $field array Field parameters.
  *
  * @throws \Jigoshop\Exception
  */
 public static function constant($field)
 {
     $defaults = array('id' => null, 'name' => null, 'label' => null, 'value' => false, 'placeholder' => '', 'classes' => array(), 'description' => false, 'tip' => false, 'hidden' => false, 'size' => 11, 'startDate' => false, 'endDate' => false);
     $field = wp_parse_args($field, $defaults);
     if (empty($field['name'])) {
         if (WP_DEBUG) {
             throw new Exception(sprintf('Field "%s" must have a name!', serialize($field)));
         }
         Registry::getInstance(JIGOSHOP_LOGGER)->addCritical('Field must have a name!', array('field' => $field));
         return;
     }
     if (empty($field['id'])) {
         $field['id'] = self::prepareIdFromName($field['name']);
     }
     Render::output(static::$constantTemplate, $field);
 }
Esempio n. 28
0
 /**
  * Displays the form for the wordpress admin.
  *
  * @param array $instance Instance data.
  *
  * @return string|void
  */
 public function form($instance)
 {
     $title = isset($instance['title']) ? esc_attr($instance['title']) : null;
     $attribute = isset($instance['attribute']) ? esc_attr($instance['attribute']) : null;
     $attributes = self::$productService->findAllAttributes();
     Render::output('widget/layered_nav/form', array('title_id' => $this->get_field_id('title'), 'title_name' => $this->get_field_name('title'), 'title' => $title, 'attribute_id' => $this->get_field_id('attribute'), 'attribute_name' => $this->get_field_name('attribute'), 'attribute' => $attribute, 'attributes' => $attributes));
 }
Esempio n. 29
0
 public function render()
 {
     $content = $this->wp->getPostField('post_content', $this->options->getPageId(Pages::THANK_YOU));
     /** @var Order $order */
     $order = $this->orderService->find((int) $_REQUEST['order']);
     if ($order->getKey() != $_REQUEST['key']) {
         $this->messages->addError(__('Invalid security key. The order was processed.', 'jigoshop'));
         $this->wp->redirectTo($this->options->getPageId(Pages::SHOP));
     }
     return Render::get('shop/checkout/thanks', array('content' => $content, 'messages' => $this->messages, 'order' => $order, 'showWithTax' => $this->options->get('tax.price_tax') == 'with_tax', 'shopUrl' => $this->wp->getPermalink($this->options->getPageId(Pages::SHOP)), 'cancelUrl' => \Jigoshop\Helper\Order::getCancelLink($order), 'getTaxLabel' => function ($taxClass) use($order) {
         return Tax::getLabel($taxClass, $order);
     }));
 }
Esempio n. 30
0
 /**
  * Renders page template.
  *
  * @return string Page template.
  */
 public function render()
 {
     $content = $this->wp->getPostField('post_content', $this->options->getPageId(Pages::CHECKOUT));
     $content = do_shortcode($content);
     $cart = $this->cartService->getCurrent();
     $billingFields = $this->getBillingFields($cart->getCustomer()->getBillingAddress());
     $shippingFields = $this->getShippingFields($cart->getCustomer()->getShippingAddress());
     $termsUrl = '';
     $termsPage = $this->options->get('advanced.pages.terms');
     if ($termsPage > 0) {
         $termsUrl = $this->wp->getPageLink($termsPage);
     }
     $verificationMessage = $this->options->get('shopping.enable_verification_message') ? $this->options->get('shopping.verification_message') : '';
     return Render::get('shop/checkout', array('cartUrl' => $this->wp->getPermalink($this->options->getPageId(Pages::CART)), 'content' => $content, 'cart' => $cart, 'messages' => $this->messages, 'shippingMethods' => $this->shippingService->getEnabled(), 'paymentMethods' => $this->paymentService->getEnabled(), 'billingFields' => $billingFields, 'shippingFields' => $shippingFields, 'showWithTax' => $this->options->get('tax.price_tax') == 'with_tax', 'showLoginForm' => $this->options->get('shopping.show_login_form') && !$this->wp->isUserLoggedIn(), 'allowRegistration' => $this->options->get('shopping.allow_registration') && !$this->wp->isUserLoggedIn(), 'showRegistrationForm' => $this->options->get('shopping.allow_registration') && !$this->options->get('shopping.guest_purchases') && !$this->wp->isUserLoggedIn(), 'alwaysShowShipping' => $this->options->get('shipping.always_show_shipping'), 'verificationMessage' => $verificationMessage, 'differentShipping' => isset($_POST['jigoshop_order']) ? $_POST['jigoshop_order']['different_shipping_address'] == 'on' : false, 'termsUrl' => $termsUrl, 'defaultGateway' => $this->options->get('payment.default_gateway')));
 }