/** * change_labels. * * @version 2.5.7 * @since 2.5.7 */ function change_labels() { if (function_exists('is_cart') && is_cart()) { wp_enqueue_style('wcj-shipping-calculator', wcj_plugin_url() . '/includes/css/wcj-shipping-calculator.css', array(), WCJ()->version); wp_enqueue_script('wcj-shipping-calculator-js', wcj_plugin_url() . '/includes/js/wcj-shipping-calculator.js', array('jquery'), WCJ()->version, true); wp_localize_script('wcj-shipping-calculator-js', 'alg_object', array('calculate_shipping_label' => get_option('wcj_shipping_calculator_label_calculate_shipping', ''), 'update_totals_label' => get_option('wcj_shipping_calculator_label_update_totals', ''))); } }
/** * Add Invoices Report tool to WooCommerce menu (the content). * * @version 2.5.7 */ function create_invoices_report_tool() { $result_message = ''; $result_message .= $this->notice; $the_year = !empty($_POST['report_year']) ? $_POST['report_year'] : ''; $the_month = !empty($_POST['report_month']) ? $_POST['report_month'] : ''; $the_invoice_type = !empty($_POST['invoice_type']) ? $_POST['invoice_type'] : 'invoice'; if (isset($_POST['get_invoices_report'])) { if (!empty($the_year) && !empty($the_month) && !empty($the_invoice_type)) { $result_message = $this->get_invoices_report($the_year, $the_month, $the_invoice_type); } else { $result_message = '<div class="error"><p><strong>' . __('Please fill year and month values.', 'woocommerce-jetpack') . '</strong></p></div>'; } } ?> <div> <?php echo WCJ()->modules['pdf_invoicing']->get_tool_header_html('invoices_report'); ?> <?php echo $result_message; ?> <p><form method="post" action=""><?php // Type $invoice_type_select_html = '<select name="invoice_type">'; $invoice_types = wcj_get_enabled_invoice_types(); foreach ($invoice_types as $invoice_type) { $invoice_type_select_html .= '<option value="' . $invoice_type['id'] . '" ' . selected($invoice_type['id'], $the_invoice_type, false) . '>' . $invoice_type['title'] . '</option>'; } $invoice_type_select_html .= '</select>'; $data = array(array(__('Year', 'woocommerce-jetpack'), '<input class="input-text" type="number" min="2000" max="2100" step="1" name="report_year" value="' . $the_year . '">'), array(__('Month', 'woocommerce-jetpack'), '<input class="input-text" type="number" min="1" max="12" step="1" name="report_month" value="' . $the_month . '">'), array(__('Document Type', 'woocommerce-jetpack'), $invoice_type_select_html), array('', '<input class="button-primary" type="submit" name="get_invoices_report" value="' . __('Display monthly documents table', 'woocommerce-jetpack') . '">'), array('', '<input class="button-primary" type="submit" name="get_invoices_report_zip" value="' . __('Download all monthly documents PDFs in single ZIP file', 'woocommerce-jetpack') . '">'), array('', '<input class="button-primary" type="submit" name="get_invoices_report_csv" value="' . __('Download monthly documents CSV', 'woocommerce-jetpack') . '">')); // Print all echo wcj_get_table_html($data, array('table_heading_type' => 'vertical')); ?> </form></p> </div><?php }
/** * register_script. */ public function register_scripts() { wp_register_script('wcj-product-input-fields', WCJ()->plugin_url() . '/includes/js/product-input-fields.js', array('jquery'), false, true); }
/** * Get the plugin url. * * @return string */ public function plugin_url() { return untrailingslashit(plugin_dir_url(__FILE__)); } /** * Get the plugin path. * * @return string */ public function plugin_path() { return untrailingslashit(plugin_dir_path(__FILE__)); } } } /** * Returns the main instance of WC_Jetpack to prevent the need to use globals. * * @return WC_Jetpack */ function WCJ() { return WC_Jetpack::instance(); } WCJ();
/** * register_script. * * @version 2.3.0 */ public function register_script() { if (isset($_GET['section']) && in_array($_GET['section'], array('price_by_country', 'payment_gateways_currency', 'currency_exchange_rates'))) { wp_register_script('wcj-exchange-rates', trailingslashit(WCJ()->plugin_url()) . 'includes/js/exchange_rates.js', array('jquery'), false, true); } }
/** * register_script. */ public function register_script() { if (isset($_GET['section']) && 'price_by_country' === $_GET['section']) { wp_register_script('wcj-exchange-rates', trailingslashit(WCJ()->plugin_url()) . 'includes/js/exchange_rates.js', array('jquery'), false, true); } }
/** * wcj_add_files_upload_form_to_checkout_frontend. * * @version 2.5.2 * @since 2.5.2 */ function wcj_add_files_upload_form_to_checkout_frontend() { WCJ()->modules['checkout_files_upload']->add_files_upload_form_to_checkout_frontend_all(true); }
/** * Output the settings. * * @version 2.5.3 */ function output() { global $current_section, $wcj_notice; if ('' != $wcj_notice) { echo '<div id="wcj_message" class="updated"><p><strong>' . $wcj_notice . '</strong></p></div>'; } $is_dashboard = '' != $current_section && 'alphabetically' != $current_section && 'by_category' != $current_section && 'active' != $current_section && 'manager' != $current_section ? false : true; // Deprecated message $deprecated_modules_and_links = array('product_info' => '<a href="' . admin_url('admin.php?page=wc-settings&tab=jetpack&wcj-cat=products§ion=product_custom_info') . '">' . __('Product Info', 'woocommerce-jetpack') . '</a>'); if (array_key_exists($current_section, $deprecated_modules_and_links)) { echo '<div id="wcj_message" class="error">'; echo '<p>'; echo '<strong>'; echo sprintf(__('Please note that current <em>%s</em> module is deprecated and will be removed in future updates. Please use <em>%s</em> module instead.', 'woocommerce-jetpack'), WCJ()->modules[$current_section]->short_desc, $deprecated_modules_and_links[$current_section]); echo '</strong>'; echo '</p>'; echo '</div>'; } // Multicurrency message /* $multicurrency_modules_enabled = 0; $multicurrency_modules_titles = array(); $multicurrency_modules = array( 'price_by_country', 'multicurrency', 'payment_gateways_currency' ); foreach ( $multicurrency_modules as $multicurrency_module ) { if ( wcj_is_module_enabled( $multicurrency_module ) ) { $multicurrency_modules_enabled++; $multicurrency_modules_titles[] = WCJ()->modules[ $multicurrency_module ]->short_desc; } } if ( $multicurrency_modules_enabled > 1 ) { echo '<div id="wcj_message" class="error">'; echo '<p>'; echo '<strong>'; echo sprintf( __( 'Please note that only single multicurrency module can be enabled simultaneously. You have <em>%s</em> modules enabled, please choose one of them.', 'woocommerce-jetpack' ), implode( ', ', $multicurrency_modules_titles ) ); echo '</strong>'; echo '</p>'; echo '</div>'; } */ // Caching message /* $known_caching_plugins = array( 'w3-total-cache/w3-total-cache.php' ); $no_caching_modules = array(); // $no_caching_modules = array_merge( $no_caching_modules, $multicurrency_modules ); $caching_plugin_is_active = false; foreach ( $known_caching_plugins as $caching_plugin ) { // Check if caching_plugin is active if ( in_array( $caching_plugin, apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) ) ) || ( is_multisite() && array_key_exists( $caching_plugin, get_site_option( 'active_sitewide_plugins', array() ) ) ) ) { $caching_plugin_is_active = true; break; } } $no_caching_module_is_active = false; $no_caching_modules_titles = array(); foreach ( $no_caching_modules as $no_caching_module ) { if ( wcj_is_module_enabled( $no_caching_module ) ) { $no_caching_module_is_active = true; $no_caching_modules_titles[] = WCJ()->modules[ $no_caching_module ]->short_desc; //break; } } if ( $caching_plugin_is_active && $no_caching_module_is_active ) { echo '<div id="wcj_message" class="error">'; echo '<p>'; echo '<strong>'; echo sprintf( __( 'Please note that <em>%s</em> modules require caching to be turned off.', 'woocommerce-jetpack' ), implode( ', ', $no_caching_modules_titles ) ); echo '</strong>'; echo '</p>'; echo '</div>'; } */ if ('yes' === get_option('wcj_admin_tools_enabled') && 'yes' === get_option('wcj_debuging_enabled', 'no')) { // Breadcrumbs $breadcrumbs_html = ''; $breadcrumbs_html .= '<p>'; $breadcrumbs_html .= '<code>'; $breadcrumbs_html .= __('WooCommerce', 'woocommerce-jetpack'); $breadcrumbs_html .= ' > '; $breadcrumbs_html .= __('Settings', 'woocommerce-jetpack'); $breadcrumbs_html .= ' > '; $breadcrumbs_html .= __('Booster', 'woocommerce-jetpack'); $breadcrumbs_html .= ' > '; foreach ($this->cats as $id => $label_info) { if ($this->get_cat_by_section($current_section) === $id) { $breadcrumbs_html .= $label_info['label']; break; } } //$breadcrumbs_html .= $settings[0]['title']; if (!$is_dashboard) { $breadcrumbs_html .= ' > '; $sections = $this->get_sections(); $breadcrumbs_html .= $sections[$current_section]; } $breadcrumbs_html .= '</code>'; $breadcrumbs_html .= '</p>'; echo $breadcrumbs_html; } $settings = $this->get_settings($current_section); if (!$is_dashboard) { WC_Admin_Settings::output_fields($settings); } else { $this->output_dashboard($current_section); } }