本文整理汇总了PHP中WCJ_Module类的典型用法代码示例。如果您正苦于以下问题:PHP WCJ_Module类的具体用法?PHP WCJ_Module怎么用?PHP WCJ_Module使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WCJ_Module类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Constructor.
*
* @version 2.3.0
*/
function __construct()
{
$this->id = 'checkout_custom_fields';
$this->short_desc = __('Checkout Custom Fields', 'woocommerce-jetpack');
$this->desc = __('Add custom fields to WooCommerce checkout page.', 'woocommerce-jetpack');
parent::__construct();
if ($this->is_enabled()) {
add_filter('woocommerce_checkout_fields', array($this, 'add_custom_checkout_fields'), PHP_INT_MAX);
add_action('woocommerce_admin_billing_fields', array($this, 'add_custom_billing_fields_to_admin_order_display'), PHP_INT_MAX);
add_action('woocommerce_admin_shipping_fields', array($this, 'add_custom_shipping_fields_to_admin_order_display'), PHP_INT_MAX);
add_action('woocommerce_admin_shipping_fields', array($this, 'add_custom_order_and_account_fields_to_admin_order_display'), PHP_INT_MAX);
add_action('woocommerce_order_details_after_order_table', array($this, 'add_custom_fields_to_order_display'), PHP_INT_MAX);
add_action('woocommerce_email_after_order_table', array($this, 'add_custom_fields_to_emails'), PHP_INT_MAX, 2);
add_filter('woo_ce_order_fields', array($this, 'add_custom_fields_to_store_exporter'));
add_filter('woo_ce_order', array($this, 'add_custom_fields_to_store_exporter_order'), PHP_INT_MAX, 2);
add_action('woocommerce_checkout_update_order_meta', array($this, 'update_custom_checkout_fields_order_meta'));
/* add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
// add_action( 'wp_head', array( $this, 'add_datepicker_script' ) );
add_action( 'init', array( $this, 'register_script' ) );
*/
// add_action( 'woocommerce_order_formatted_shipping_address', array( $this, 'add_custom_shipping_fields_to_formatted_address' ), PHP_INT_MAX, 2 );
// add_filter( 'woocommerce_form_field_' . 'number', array( $this, 'woocommerce_form_field_type_number' ), PHP_INT_MAX, 4 );
add_filter('woocommerce_form_field_' . 'text', array($this, 'woocommerce_form_field_type_number'), PHP_INT_MAX, 4);
}
}
示例2: __construct
/**
* Constructor.
*
* @version 2.3.9
*/
public function __construct()
{
$this->id = 'price_by_country';
$this->short_desc = __('Prices and Currencies by Country', 'woocommerce-jetpack');
$this->desc = __('Change WooCommerce product price and currency automatically by customer\'s country.', 'woocommerce-jetpack');
parent::__construct();
global $wcj_notice;
$wcj_notice = '';
if ($this->is_enabled()) {
if (!is_admin()) {
// || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
// Frontend
include_once 'price-by-country/class-wcj-price-by-country-core.php';
}
if (is_admin()) {
// Backend
include_once 'price-by-country/class-wcj-price-by-country-reports.php';
if ('yes' === get_option('wcj_price_by_country_local_enabled')) {
include_once 'price-by-country/class-wcj-price-by-country-local.php';
}
}
}
if (is_admin()) {
include_once 'price-by-country/class-wcj-price-by-country-group-generator.php';
}
}
示例3: Pricing
/**
* Constructor.
*
* @version 2.5.0
* @since 2.4.8
*/
function __construct()
{
$this->id = 'product_open_pricing';
$this->short_desc = __('Product Open Pricing (Name Your Price)', 'woocommerce-jetpack');
$this->desc = __('Let your WooCommerce store customers enter price for the product manually.', 'woocommerce-jetpack');
$this->link = 'http://booster.io/features/woocommerce-product-open-pricing-name-your-price/';
parent::__construct();
if ($this->is_enabled()) {
add_action('add_meta_boxes', array($this, 'add_meta_box'));
add_action('save_post_product', array($this, 'save_meta_box'), PHP_INT_MAX, 2);
add_filter('woocommerce_get_price', array($this, 'get_open_price'), PHP_INT_MAX, 2);
add_filter('woocommerce_get_price_html', array($this, 'hide_original_price'), PHP_INT_MAX, 2);
add_filter('woocommerce_get_variation_price_html', array($this, 'hide_original_price'), PHP_INT_MAX, 2);
add_filter('woocommerce_is_sold_individually', array($this, 'hide_quantity_input_field'), PHP_INT_MAX, 2);
add_filter('woocommerce_is_purchasable', array($this, 'is_purchasable'), PHP_INT_MAX, 2);
add_filter('woocommerce_product_supports', array($this, 'disable_add_to_cart_ajax'), PHP_INT_MAX, 3);
add_filter('woocommerce_product_add_to_cart_url', array($this, 'add_to_cart_url'), PHP_INT_MAX, 2);
add_filter('woocommerce_product_add_to_cart_text', array($this, 'add_to_cart_text'), PHP_INT_MAX, 2);
add_action('woocommerce_before_add_to_cart_button', array($this, 'add_open_price_input_field_to_frontend'), PHP_INT_MAX);
add_filter('woocommerce_add_to_cart_validation', array($this, 'validate_open_price_on_add_to_cart'), PHP_INT_MAX, 2);
add_filter('woocommerce_add_cart_item_data', array($this, 'add_open_price_to_cart_item_data'), PHP_INT_MAX, 3);
add_filter('woocommerce_add_cart_item', array($this, 'add_open_price_to_cart_item'), PHP_INT_MAX, 2);
add_filter('woocommerce_get_cart_item_from_session', array($this, 'get_cart_item_open_price_from_session'), PHP_INT_MAX, 3);
add_filter('wcj_save_meta_box_value', array($this, 'save_meta_box_value'), PHP_INT_MAX, 3);
add_action('admin_notices', array($this, 'admin_notices'));
}
}
示例4: __construct
/**
* Constructor.
*
* @version 2.5.0
*/
public function __construct()
{
$this->id = 'price_labels';
$this->short_desc = __('Custom Price Labels', 'woocommerce-jetpack');
$this->desc = __('Create any custom price label for any WooCommerce product.', 'woocommerce-jetpack');
$this->link = 'http://booster.io/features/woocommerce-custom-price-labels/';
parent::__construct();
$this->add_tools(array('migrate_from_custom_price_labels' => array('title' => __('Migrate from Custom Price Labels (Pro)', 'woocommerce-jetpack'), 'desc' => __('Tool lets you copy all the data (that is labels) from Custom Price labels (Pro) plugin to Booster.', 'woocommerce-jetpack'), 'deprecated' => true)), array('tools_dashboard_hook_priority' => PHP_INT_MAX));
// Custom Price Labels - fields array
$this->custom_tab_group_name = 'wcj_price_labels';
// for compatibility with Custom Price Label Pro plugin should use 'simple_is_custom_pricing_label'
$this->custom_tab_sections = array('_instead', '_before', '_between', '_after');
$this->custom_tab_sections_titles = array('_instead' => __('Instead of the price', 'woocommerce-jetpack'), '_before' => __('Before the price', 'woocommerce-jetpack'), '_between' => __('Between regular and sale prices', 'woocommerce-jetpack'), '_after' => __('After the price', 'woocommerce-jetpack'));
$this->custom_tab_section_variations = array('_text', '_enabled', '_home', '_products', '_single', '_page', '_cart', '_variable', '_variation');
$this->custom_tab_section_variations_titles = array('_text' => '', '_enabled' => __('Enable', 'woocommerce-jetpack'), '_home' => __('Hide on home page', 'woocommerce-jetpack'), '_products' => __('Hide on products page', 'woocommerce-jetpack'), '_single' => __('Hide on single', 'woocommerce-jetpack'), '_page' => __('Hide on all pages', 'woocommerce-jetpack'), '_cart' => __('Hide on cart page only', 'woocommerce-jetpack'), '_variable' => __('Hide for main price', 'woocommerce-jetpack'), '_variation' => __('Hide for all variations', 'woocommerce-jetpack'));
add_action('init', array($this, 'add_settings_hook'));
if ($this->is_enabled()) {
if ('yes' === get_option('wcj_local_price_labels_enabled', 'yes')) {
// Meta box (admin)
add_action('add_meta_boxes', array($this, 'add_price_label_meta_box'));
add_action('save_post_product', array($this, 'save_custom_price_labels'), 999, 2);
}
// Prices Hooks
$this->prices_filters = array('woocommerce_cart_item_price', 'woocommerce_composite_sale_price_html', 'woocommerce_composite_price_html', 'woocommerce_composite_empty_price_html', 'woocommerce_composite_free_sale_price_html', 'woocommerce_composite_free_price_html', 'woocommerce_get_price_html', 'woocommerce_empty_price_html', 'woocommerce_free_price_html', 'woocommerce_free_sale_price_html', 'woocommerce_price_html', 'woocommerce_sale_price_html', 'woocommerce_grouped_price_html', 'woocommerce_variable_empty_price_html', 'woocommerce_variable_free_price_html', 'woocommerce_variable_free_sale_price_html', 'woocommerce_variable_price_html', 'woocommerce_variable_sale_price_html', 'woocommerce_variation_empty_price_html', 'woocommerce_variation_free_price_html', 'woocommerce_variation_price_html', 'woocommerce_variation_sale_price_html', 'woocommerce_subscriptions_product_price_string', 'woocommerce_variable_subscription_price_html');
foreach ($this->prices_filters as $the_filter) {
add_filter($the_filter, array($this, 'custom_price'), 100, 2);
}
}
}
示例5: array
/**
* Constructor.
*
* @version 2.5.2
* @since 2.4.8
*/
function __construct()
{
$this->id = 'multicurrency_base_price';
$this->short_desc = __('Multicurrency Product Base Price', 'woocommerce-jetpack');
$this->desc = __('Enter prices for WooCommerce products in different currencies.', 'woocommerce-jetpack');
$this->link = 'http://booster.io/features/woocommerce-multicurrency-product-base-price/';
parent::__construct();
add_action('init', array($this, 'add_settings_hook'));
if ($this->is_enabled()) {
add_action('add_meta_boxes', array($this, 'add_meta_box'));
add_action('save_post_product', array($this, 'save_meta_box'), PHP_INT_MAX, 2);
add_filter('woocommerce_currency_symbol', array($this, 'change_currency_symbol_on_product_edit'), PHP_INT_MAX, 2);
if (!is_admin() || defined('DOING_AJAX') && DOING_AJAX) {
// Prices
add_filter('woocommerce_get_price', array($this, 'change_price_by_currency'), PHP_INT_MAX - 10, 2);
add_filter('woocommerce_get_sale_price', array($this, 'change_price_by_currency'), PHP_INT_MAX - 10, 2);
add_filter('woocommerce_get_regular_price', array($this, 'change_price_by_currency'), PHP_INT_MAX - 10, 2);
// Variations
add_filter('woocommerce_variation_prices_price', array($this, 'change_price_by_currency'), PHP_INT_MAX - 10, 2);
add_filter('woocommerce_variation_prices_regular_price', array($this, 'change_price_by_currency'), PHP_INT_MAX - 10, 2);
add_filter('woocommerce_variation_prices_sale_price', array($this, 'change_price_by_currency'), PHP_INT_MAX - 10, 2);
add_filter('woocommerce_get_variation_prices_hash', array($this, 'get_variation_prices_hash'), PHP_INT_MAX - 10, 3);
// Grouped products
add_filter('woocommerce_get_price_including_tax', array($this, 'change_price_by_currency_grouped'), PHP_INT_MAX - 10, 3);
add_filter('woocommerce_get_price_excluding_tax', array($this, 'change_price_by_currency_grouped'), PHP_INT_MAX - 10, 3);
}
/* if ( is_admin() ) {
include_once( 'reports/class-wcj-currency-reports.php' );
} */
}
}
开发者ID:algoritmika,项目名称:woocommerce-jetpack,代码行数:37,代码来源:class-wcj-multicurrency-product-base-price.php
示例6: __construct
/**
* Constructor.
*
* @version 2.5.2
*/
public function __construct()
{
$this->id = 'pdf_invoicing_numbering';
$this->parent_id = 'pdf_invoicing';
$this->short_desc = __('Numbering', 'woocommerce-jetpack');
parent::__construct('submodule');
}
示例7: array
/**
* Constructor.
*
* @version 2.3.10
*/
function __construct()
{
$this->id = 'eu_vat_number';
$this->short_desc = __('EU VAT Number', 'woocommerce-jetpack');
$this->desc = __('Collect and validate EU VAT numbers on WooCommerce checkout. Automatically disable VAT for valid numbers.', 'woocommerce-jetpack');
parent::__construct();
$this->add_tools(array('eu_countries_vat_rates' => array('title' => __('EU Countries VAT Rates', 'woocommerce-jetpack'), 'desc' => __('Add all EU countries VAT standard rates to WooCommerce.', 'woocommerce-jetpack'))));
if ($this->is_enabled()) {
/* if ( ! session_id() ) {
session_start();
} */
// add_action( 'init', 'session_start' );
add_action('init', array($this, 'start_session'));
add_filter('woocommerce_checkout_fields', array($this, 'add_eu_vat_number_checkout_field_to_frontend'), PHP_INT_MAX);
add_filter('woocommerce_admin_billing_fields', array($this, 'add_billing_eu_vat_number_field_to_admin_order_display'), PHP_INT_MAX);
add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
// add_filter( 'woocommerce_form_field_text', array( $this, 'add_eu_vat_verify_button' ), PHP_INT_MAX, 4 );
add_action('init', array($this, 'wcj_validate_eu_vat_number'));
add_filter('woocommerce_matched_rates', array($this, 'maybe_exclude_vat'), PHP_INT_MAX, 2);
add_action('woocommerce_after_checkout_validation', array($this, 'checkout_validate_vat'), PHP_INT_MAX);
add_action('woocommerce_checkout_update_order_meta', array($this, 'update_eu_vat_number_checkout_field_order_meta'));
add_filter('woocommerce_customer_meta_fields', array($this, 'add_eu_vat_number_customer_meta_field'));
add_filter('default_checkout_billing_eu_vat_number', array($this, 'add_default_checkout_billing_eu_vat_number'), PHP_INT_MAX, 2);
$this->eu_countries_vat_rates_tool = (include_once 'tools/class-wcj-eu-countries-vat-rates-tool.php');
}
}
示例8: array
/**
* Constructor.
*
* @version 2.2.6
*/
function __construct()
{
$this->id = 'product_images';
$this->short_desc = __('Product Images', 'woocommerce-jetpack');
$this->desc = __('Customize WooCommerce products images, thumbnails and sale flashes.', 'woocommerce-jetpack');
parent::__construct();
if ($this->is_enabled()) {
// Product Image & Thumbnails
if ('yes' === get_option('wcj_product_images_and_thumbnails_enabled', 'no')) {
// Single
if ('yes' === get_option('wcj_product_images_and_thumbnails_hide_on_single', 'no')) {
add_action('init', array($this, 'product_images_and_thumbnails_hide_on_single'), PHP_INT_MAX);
} else {
add_filter('woocommerce_single_product_image_html', array($this, 'customize_single_product_image_html'), PHP_INT_MAX, 2);
add_filter('woocommerce_single_product_image_thumbnail_html', array($this, 'customize_single_product_image_thumbnail_html'));
}
// Archives
add_action('woocommerce_before_shop_loop_item', array($this, 'product_images_hide_on_archive'));
add_action('woocommerce_before_shop_loop_item_title', array($this, 'customize_archive_product_image_html'), 10);
// Single Product Thumbnails Columns Number
add_filter('woocommerce_product_thumbnails_columns', array($this, 'change_product_thumbnails_columns_number'));
}
add_action('add_meta_boxes', array($this, 'add_meta_box'));
add_action('save_post_product', array($this, 'save_meta_box'), PHP_INT_MAX, 2);
// Sale flash
if ('yes' === get_option('wcj_product_images_sale_flash_enabled', 'no')) {
add_filter('woocommerce_sale_flash', array($this, 'customize_sale_flash'), PHP_INT_MAX, 3);
}
}
}
示例9: foreach
/**
* Constructor.
*
* @version 2.4.0
*/
function __construct()
{
$this->id = 'currency';
$this->short_desc = __('Currencies', 'woocommerce-jetpack');
$this->desc = __('Add all world currencies to your WooCommerce store; change currency symbol.', 'woocommerce-jetpack');
parent::__construct();
$currencies = (include 'currencies/wcj-currencies.php');
foreach ($currencies as $data) {
$this->currency_symbols[$data['code']] = $data['symbol'];
$this->currency_names[$data['code']] = $data['name'];
}
$custom_currency_total_number = apply_filters('wcj_get_option_filter', 1, get_option('wcj_currency_custom_currency_total_number', 1));
for ($i = 1; $i <= $custom_currency_total_number; $i++) {
$custom_currency_code = get_option('wcj_currency_custom_currency_code_' . $i);
$custom_currency_name = get_option('wcj_currency_custom_currency_name_' . $i);
$custom_currency_symbol = get_option('wcj_currency_custom_currency_symbol_' . $i);
if ('' != $custom_currency_code && '' != $custom_currency_name && '' != $custom_currency_symbol) {
$this->currency_names[$custom_currency_code] = $custom_currency_name;
$this->currency_symbols[$custom_currency_code] = $custom_currency_symbol;
}
}
if ($this->is_enabled()) {
add_filter('woocommerce_currencies', array($this, 'add_all_currencies'), 100);
add_filter('woocommerce_currency_symbol', array($this, 'add_currency_symbol'), 100, 2);
add_filter('woocommerce_general_settings', array($this, 'add_edit_currency_symbol_field'), 100);
}
}
示例10: __construct
/**
* Constructor.
*
* @version 2.5.7
*/
public function __construct()
{
$this->id = 'pdf_invoicing';
$this->short_desc = __('PDF Invoicing', 'woocommerce-jetpack');
$this->section_title = __('General', 'woocommerce-jetpack');
$this->desc = __('WooCommerce Invoices, Proforma Invoices, Credit Notes and Packing Slips.', 'woocommerce-jetpack');
$this->link = 'http://booster.io/features/woocommerce-pdf-invoicing-and-packing-slips/';
parent::__construct();
$this->add_tools(array('renumerate_invoices' => array('title' => __('Invoices Renumerate', 'woocommerce-jetpack'), 'desc' => __('Tool renumerates all invoices, proforma invoices, credit notes and packing slips.', 'woocommerce-jetpack')), 'invoices_report' => array('title' => __('Invoices Report', 'woocommerce-jetpack'), 'desc' => __('Invoices Monthly Reports.', 'woocommerce-jetpack'))));
if ($this->is_enabled()) {
add_action('init', array($this, 'catch_args'));
add_action('init', array($this, 'generate_pdf_on_init'));
// Bulk actions
add_action('admin_footer-edit.php', array($this, 'bulk_actions_pdfs_admin_footer'));
add_action('load-edit.php', array($this, 'bulk_actions_pdfs'));
add_action('admin_notices', array($this, 'bulk_actions_pdfs_notices'));
$this->the_pdf_invoicing_report_tool = (include_once 'pdf-invoices/class-wcj-pdf-invoicing-report-tool.php');
$invoice_types = wcj_get_enabled_invoice_types();
foreach ($invoice_types as $invoice_type) {
$the_hook = get_option('wcj_invoicing_' . $invoice_type['id'] . '_create_on', 'woocommerce_new_order');
if ('disabled' != $the_hook && 'manual' != $the_hook && '' != $the_hook) {
add_action($the_hook, array($this, 'create_' . $invoice_type['id']));
if ('woocommerce_new_order' === $the_hook) {
add_action('woocommerce_api_create_order', array($this, 'create_' . $invoice_type['id']));
add_action('woocommerce_cli_create_order', array($this, 'create_' . $invoice_type['id']));
add_action('kco_before_confirm_order', array($this, 'create_' . $invoice_type['id']));
add_action('woocommerce_checkout_order_processed', array($this, 'create_' . $invoice_type['id']));
}
}
}
}
}
示例11: __construct
/**
* Constructor.
*
* @version 2.5.5
* @todo products per page - position priority for every hook; post or get.
*/
public function __construct()
{
$this->id = 'product_listings';
$this->short_desc = __('Product Listings', 'woocommerce-jetpack');
$this->desc = __('Change WooCommerce display options for shop and category pages: show/hide categories count, exclude categories, show/hide empty categories. Add "products per page" selector.', 'woocommerce-jetpack');
$this->link = 'http://booster.io/features/woocommerce-product-listings/';
parent::__construct();
add_action('init', array($this, 'add_settings_hook'));
if ($this->is_enabled()) {
// Exclude and Hide Empty
add_filter('woocommerce_product_subcategories_args', array($this, 'filter_subcategories'), 100);
add_filter('woocommerce_product_subcategories_hide_empty', array($this, 'filter_subcategories_show_empty'), 100);
// Hide Count
if ('yes' === get_option('wcj_product_listings_hide_cats_count_on_shop') || 'yes' === get_option('wcj_product_listings_hide_cats_count_on_archive')) {
add_filter('woocommerce_subcategory_count_html', array($this, 'remove_subcategory_count'), 100);
}
// Products per Page
if ('yes' === get_option('wcj_products_per_page_enabled', 'no')) {
add_filter('loop_shop_per_page', array($this, 'set_products_per_page_number'), PHP_INT_MAX);
$position_hooks = get_option('wcj_products_per_page_position', array('woocommerce_before_shop_loop'));
foreach ($position_hooks as $position_hook) {
add_action($position_hook, array($this, 'add_products_per_page_form'), get_option('wcj_products_per_page_position_priority', 40));
}
}
// Settings to "WooCommerce > Settings > Products > Product Listings"
// add_filter( 'woocommerce_product_settings', array( $this, 'add_fields_to_woocommerce_settings' ), 100 );
// Tax Incl./Excl. by product/category
add_filter('option_woocommerce_tax_display_shop', array($this, 'tax_display'), PHP_INT_MAX);
}
}
示例12: array
/**
* Constructor.
*
* @version 2.5.2
* @since 2.5.2
*/
function __construct()
{
$this->id = 'currency_per_product';
$this->short_desc = __('Currency per Product', 'woocommerce-jetpack');
$this->desc = __('Display prices for WooCommerce products in different currencies.', 'woocommerce-jetpack');
$this->link = 'http://booster.io/features/woocommerce-currency-per-product/';
parent::__construct();
add_action('init', array($this, 'add_settings_hook'));
if ($this->is_enabled()) {
add_action('add_meta_boxes', array($this, 'add_meta_box'));
add_action('save_post_product', array($this, 'save_meta_box'), PHP_INT_MAX, 2);
//if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
// Currency code and symbol
add_filter('woocommerce_currency_symbol', array($this, 'change_currency_symbol'), PHP_INT_MAX, 2);
add_filter('woocommerce_currency', array($this, 'change_currency_code'), PHP_INT_MAX);
// Add to cart
add_filter('woocommerce_add_cart_item_data', array($this, 'add_cart_item_data'), PHP_INT_MAX, 3);
add_filter('woocommerce_add_cart_item', array($this, 'add_cart_item'), PHP_INT_MAX, 2);
add_filter('woocommerce_get_cart_item_from_session', array($this, 'get_cart_item_from_session'), PHP_INT_MAX, 3);
// Price
add_filter('woocommerce_get_price', array($this, 'change_price'), PHP_INT_MAX, 2);
// Grouped
add_filter('woocommerce_grouped_price_html', array($this, 'grouped_price_html'), PHP_INT_MAX, 2);
//}
}
}
示例13: on
/**
* Constructor.
*
* @version 2.5.5
* @since 2.4.5
*/
function __construct()
{
$this->id = 'checkout_files_upload';
$this->short_desc = __('Checkout Files Upload', 'woocommerce-jetpack');
$this->desc = __('Let customers upload files on (or after) WooCommerce checkout.', 'woocommerce-jetpack');
$this->link = 'http://booster.io/features/woocommerce-checkout-files-upload/';
parent::__construct();
if ($this->is_enabled()) {
add_action('add_meta_boxes', array($this, 'add_file_admin_order_meta_box'));
add_action('init', array($this, 'process_checkout_files_upload'));
$total_number = apply_filters('booster_get_option', 1, get_option('wcj_checkout_files_upload_total_number', 1));
for ($i = 1; $i <= $total_number; $i++) {
if ('disable' != ($the_hook = get_option('wcj_checkout_files_upload_hook_' . $i, 'woocommerce_before_checkout_form'))) {
add_action($the_hook, array($this, 'add_files_upload_form_to_checkout_frontend'), get_option('wcj_checkout_files_upload_hook_priority_' . $i, 10));
}
if ('yes' === get_option('wcj_checkout_files_upload_add_to_thankyou_' . $i, 'no')) {
add_action('woocommerce_thankyou', array($this, 'add_files_upload_form_to_thankyou_and_myaccount_page'), PHP_INT_MAX, 1);
}
if ('yes' === get_option('wcj_checkout_files_upload_add_to_myaccount_' . $i, 'no')) {
add_action('woocommerce_view_order', array($this, 'add_files_upload_form_to_thankyou_and_myaccount_page'), PHP_INT_MAX, 1);
}
}
add_action('woocommerce_checkout_order_processed', array($this, 'add_files_to_order'), PHP_INT_MAX, 2);
add_action('woocommerce_after_checkout_validation', array($this, 'validate_on_checkout'));
add_action('woocommerce_order_details_after_order_table', array($this, 'add_files_to_order_display'), PHP_INT_MAX);
add_action('woocommerce_email_after_order_table', array($this, 'add_files_to_order_display'), PHP_INT_MAX);
add_filter('woocommerce_email_attachments', array($this, 'add_files_to_email_attachments'), PHP_INT_MAX, 3);
}
}
示例14: __construct
/**
* Constructor.
*
* @version 2.5.8
*/
public function __construct()
{
$this->id = 'admin_tools';
$this->short_desc = __('Admin Tools', 'woocommerce-jetpack');
$this->desc = __('Booster for WooCommerce debug and log tools.', 'woocommerce-jetpack');
$this->link = 'http://booster.io/features/woocommerce-booster-admin-tools/';
parent::__construct();
$this->add_tools(array('admin_tools' => array('title' => __('Admin Tools', 'woocommerce-jetpack'), 'desc' => __('Log.', 'woocommerce-jetpack'), 'tab_title' => __('Log', 'woocommerce-jetpack'))));
$this->current_php_memory_limit = '';
if ($this->is_enabled()) {
// PHP Memory Limit
if (0 != ($php_memory_limit = get_option('wcj_admin_tools_php_memory_limit', 0))) {
ini_set('memory_limit', $php_memory_limit . 'M');
}
$this->current_php_memory_limit = sprintf(' ' . __('Current PHP memory limit: %s.', 'woocommerce-jetpack'), ini_get('memory_limit'));
// Order Meta
if ('yes' === get_option('wcj_admin_tools_show_order_meta_enabled', 'no')) {
add_action('add_meta_boxes', array($this, 'add_order_meta_meta_box'));
}
// Product Meta
if ('yes' === get_option('wcj_admin_tools_show_product_meta_enabled', 'no')) {
add_action('add_meta_boxes', array($this, 'add_product_meta_meta_box'));
}
}
}
示例15: __construct
/**
* Constructor.
*
* @version 2.5.8
*/
public function __construct()
{
$this->id = 'general';
$this->short_desc = __('General', 'woocommerce-jetpack');
$this->desc = __('Separate custom CSS for front and back end. Shortcodes in WordPress text widgets. Custom roles tool.', 'woocommerce-jetpack');
$this->link = 'http://booster.io/features/woocommerce-booster-general-tools/';
parent::__construct();
$this->add_tools(array('products_atts' => array('title' => __('Products Atts', 'woocommerce-jetpack'), 'desc' => __('All Products and All Attributes.', 'woocommerce-jetpack')), 'custom_roles' => array('title' => __('Add/Manage Custom Roles', 'woocommerce-jetpack'), 'tab_title' => __('Custom Roles', 'woocommerce-jetpack'), 'desc' => __('Manage Custom Roles.', 'woocommerce-jetpack'))));
if ($this->is_enabled()) {
if ('yes' === get_option('wcj_product_revisions_enabled', 'no')) {
add_filter('woocommerce_register_post_type_product', array($this, 'enable_product_revisions'));
}
if ('yes' === get_option('wcj_general_shortcodes_in_text_widgets_enabled')) {
add_filter('widget_text', 'do_shortcode');
}
if ('' != get_option('wcj_general_custom_css')) {
add_action('wp_head', array($this, 'hook_custom_css'));
}
if ('' != get_option('wcj_general_custom_admin_css')) {
add_action('admin_head', array($this, 'hook_custom_admin_css'));
}
if ('yes' === get_option('wcj_paypal_email_per_product_enabled', 'no')) {
add_action('add_meta_boxes', array($this, 'add_meta_box'));
add_action('save_post_product', array($this, 'save_meta_box'), PHP_INT_MAX, 2);
add_filter('woocommerce_payment_gateways', array($this, 'maybe_change_paypal_email'));
}
if ('yes' === get_option('wcj_session_expiration_section_enabled', 'no')) {
add_filter('wc_session_expiring', array($this, 'change_session_expiring'), PHP_INT_MAX);
add_filter('wc_session_expiration', array($this, 'change_session_expiration'), PHP_INT_MAX);
}
}
}