コード例 #1
0
 function __construct()
 {
     $this->plugin_path = untrailingslashit(plugin_dir_path(dirname(__FILE__)));
     $this->template_path = $this->plugin_path . '/templates/';
     $this->plugin_url = untrailingslashit(plugins_url('/', dirname(__FILE__)));
     $this->woo_subscriptions_check = tm_woocommerce_subscriptions_check();
     // element available sizes
     $this->element_available_sizes();
     // init section elements
     $this->init_section_elements();
     // init elements
     $this->init_elements();
 }
コード例 #2
0
 /**
  * Get settings array
  *
  * @return array
  */
 public function get_settings()
 {
     $_general_settings = array(array('type' => 'title', 'id' => 'epo_page_options'), array('title' => __('Enable for roles', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Select the roles that will have access to the extra options.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_roles_enabled', 'class' => 'chosen_select', 'css' => 'min-width:300px;', 'default' => '@everyone', 'type' => 'multiselect', 'options' => tm_get_roles(), 'desc_tip' => false), array('title' => __('Final total box', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Select when to show the final total box', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_final_total_box', 'class' => 'chosen_select', 'css' => 'min-width:300px;', 'default' => 'normal', 'type' => 'select', 'options' => array('normal' => __('Show Both Final and Options total box', TM_EPO_TRANSLATION), 'final' => __('Show only Final total', TM_EPO_TRANSLATION), 'hideoptionsifzero' => __('Show Final total and hide Options total if zero', TM_EPO_TRANSLATION), 'hideifoptionsiszero' => __('Hide Final total box if Options total is zero', TM_EPO_TRANSLATION), 'hide' => __('Hide Final total box', TM_EPO_TRANSLATION), 'pxq' => __('Always show only Final total (Price x Quantity)', TM_EPO_TRANSLATION)), 'desc_tip' => false), array('title' => __('Enable Final total box for all products', TM_EPO_TRANSLATION), 'desc' => __('Check to enable Final total box even when product has no extra options', TM_EPO_TRANSLATION), 'id' => 'tm_epo_enable_final_total_box_all', 'default' => 'no', 'type' => 'checkbox', 'desc_tip' => false), array('title' => __('Strip html from emails', TM_EPO_TRANSLATION), 'desc' => __('Check to strip the html tags from emails', TM_EPO_TRANSLATION), 'id' => 'tm_epo_strip_html_from_emails', 'default' => 'yes', 'type' => 'checkbox', 'desc_tip' => false), array('title' => __('Disable lazy load images', TM_EPO_TRANSLATION), 'desc' => __('Check to disable lazy loading images.', TM_EPO_TRANSLATION), 'id' => 'tm_epo_no_lazy_load', 'default' => 'yes', 'type' => 'checkbox', 'desc_tip' => false), array('title' => __('Enable plugin for WooCommerce shortcodes', TM_EPO_TRANSLATION), 'desc' => __('Enabling this will load the plugin files to all WordPress pages. Use with caution.', TM_EPO_TRANSLATION), 'id' => 'tm_epo_enable_shortcodes', 'default' => 'no', 'type' => 'checkbox', 'desc_tip' => false), array('type' => 'sectionend', 'id' => 'epo_page_options'));
     $_display_settings = array(array('type' => 'title', 'id' => 'epo_page_options'), array('title' => __('Display', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('This controls how your fields are displayed on the front-end.<br />If you choose "Show using action hooks" you have to manually write the code to your theme or plugin to display the fields and the placement settings below will not work. <br />If you use Composite Products extension you must leave this setting to "Normal" otherwise the extra options cannot be displayed on the composite product bundles.<br />See more at the documentation.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_display', 'class' => 'chosen_select', 'css' => 'min-width:300px;', 'default' => 'normal', 'type' => 'select', 'options' => array('normal' => __('Normal', TM_EPO_TRANSLATION), 'action' => __('Show using action hooks', TM_EPO_TRANSLATION)), 'desc_tip' => false), array('title' => __('Extra Options placement', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Select where you want the extra options to appear.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_options_placement', 'class' => 'chosen_select', 'css' => 'min-width:300px;', 'default' => 'woocommerce_before_add_to_cart_button', 'type' => 'select', 'options' => array('woocommerce_before_add_to_cart_button' => __('Before add to cart button', TM_EPO_TRANSLATION), 'woocommerce_after_add_to_cart_button' => __('After add to cart button', TM_EPO_TRANSLATION), 'woocommerce_before_add_to_cart_form' => __('Before cart form', TM_EPO_TRANSLATION), 'woocommerce_after_add_to_cart_form' => __('After cart form', TM_EPO_TRANSLATION), 'woocommerce_before_single_product' => __('Before product', TM_EPO_TRANSLATION), 'woocommerce_after_single_product' => __('After product', TM_EPO_TRANSLATION), 'woocommerce_before_single_product_summary' => __('Before product summary', TM_EPO_TRANSLATION), 'woocommerce_after_single_product_summary' => __('After product summary', TM_EPO_TRANSLATION), 'woocommerce_product_thumbnails' => __('After product image', TM_EPO_TRANSLATION), 'custom' => __('Custom hook', TM_EPO_TRANSLATION)), 'desc_tip' => false), array('title' => __('Extra Options placement custom hook', TM_EPO_TRANSLATION), 'desc' => '', 'id' => 'tm_epo_options_placement_custom_hook', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('title' => __('Totals box placement', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Select where you want the Totals box to appear.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_totals_box_placement', 'class' => 'chosen_select', 'css' => 'min-width:300px;', 'default' => 'woocommerce_before_add_to_cart_button', 'type' => 'select', 'options' => array('woocommerce_before_add_to_cart_button' => __('Before add to cart button', TM_EPO_TRANSLATION), 'woocommerce_after_add_to_cart_button' => __('After add to cart button', TM_EPO_TRANSLATION), 'woocommerce_before_add_to_cart_form' => __('Before cart form', TM_EPO_TRANSLATION), 'woocommerce_after_add_to_cart_form' => __('After cart form', TM_EPO_TRANSLATION), 'woocommerce_before_single_product' => __('Before product', TM_EPO_TRANSLATION), 'woocommerce_after_single_product' => __('After product', TM_EPO_TRANSLATION), 'woocommerce_before_single_product_summary' => __('Before product summary', TM_EPO_TRANSLATION), 'woocommerce_after_single_product_summary' => __('After product summary', TM_EPO_TRANSLATION), 'woocommerce_product_thumbnails' => __('After product image', TM_EPO_TRANSLATION), 'custom' => __('Custom hook', TM_EPO_TRANSLATION)), 'desc_tip' => false), array('title' => __('Totals box placement custom hook', TM_EPO_TRANSLATION), 'desc' => '', 'id' => 'tm_epo_totals_box_placement_custom_hook', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('title' => __('Floating Totals box', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('This will enable a floating box to display your totals box.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_floating_totals_box', 'class' => 'chosen_select', 'css' => 'min-width:300px;', 'default' => 'disable', 'type' => 'select', 'options' => array('disable' => __('Disable', TM_EPO_TRANSLATION), 'bottom right' => __('Bottom right', TM_EPO_TRANSLATION), 'bottom left' => __('Bottom left', TM_EPO_TRANSLATION), 'top right' => __('Top right', TM_EPO_TRANSLATION), 'top left' => __('Bottom left', TM_EPO_TRANSLATION)), 'desc_tip' => false), array('title' => __('Force Select Options', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('This changes the add to cart button to display select options when the product has extra product options.<br />Enabling this will remove the ajax functionality.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_force_select_options', 'class' => 'chosen_select', 'css' => 'min-width:300px;', 'default' => 'normal', 'type' => 'select', 'options' => array('normal' => __('Disable', TM_EPO_TRANSLATION), 'display' => __('Enable', TM_EPO_TRANSLATION)), 'desc_tip' => false), array('title' => __('Remove Free price label', TM_EPO_TRANSLATION), 'desc' => __('Check to remove Free price label when product has extra options', TM_EPO_TRANSLATION), 'id' => 'tm_epo_remove_free_price_label', 'default' => 'no', 'type' => 'checkbox', 'desc_tip' => false), array('title' => __('Hide uploaded file path', TM_EPO_TRANSLATION), 'desc' => __('Check to hide the uploaded file path from users.', TM_EPO_TRANSLATION), 'id' => 'tm_epo_hide_upload_file_path', 'default' => 'yes', 'type' => 'checkbox', 'desc_tip' => false), array('title' => __('Show quantity selector only for elements with a value', TM_EPO_TRANSLATION), 'desc' => __('Check show quantity selector only for elements with a value.', TM_EPO_TRANSLATION), 'id' => 'tm_epo_show_only_active_quantities', 'default' => 'yes', 'type' => 'checkbox', 'desc_tip' => false), array('title' => __('Hide add-to-cart button until an option is chosen', TM_EPO_TRANSLATION), 'desc' => __('Check this to show the add to cart button only when at least one option is filled.', TM_EPO_TRANSLATION), 'id' => 'tm_epo_hide_add_cart_button', 'default' => 'no', 'type' => 'checkbox', 'desc_tip' => false), array('type' => 'sectionend', 'id' => 'epo_page_options'));
     $_cart_settings = array(array('type' => 'title', 'id' => 'epo_page_options'), array('title' => __('Clear cart button', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Enables or disables the clear cart button', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_clear_cart_button', 'class' => 'chosen_select', 'css' => 'min-width:300px;', 'default' => 'normal', 'type' => 'select', 'options' => array('normal' => __('Hide', TM_EPO_TRANSLATION), 'show' => __('Show', TM_EPO_TRANSLATION)), 'desc_tip' => false), array('title' => __('Cart Field Display', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Select how to display your fields in the cart', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_cart_field_display', 'class' => 'chosen_select', 'css' => 'min-width:300px;', 'default' => 'normal', 'type' => 'select', 'options' => array('normal' => __('Normal display', TM_EPO_TRANSLATION), 'link' => __('Display a pop-up link', TM_EPO_TRANSLATION), 'advanced' => __('Advanced display', TM_EPO_TRANSLATION)), 'desc_tip' => false), array('title' => __('Hide extra options in cart', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Enables or disables the display of options in the cart.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_hide_options_in_cart', 'class' => 'chosen_select', 'css' => 'min-width:300px;', 'default' => 'normal', 'type' => 'select', 'options' => array('normal' => __('Show', TM_EPO_TRANSLATION), 'hide' => __('Hide', TM_EPO_TRANSLATION)), 'desc_tip' => false), array('title' => __('Hide extra options prices in cart', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Enables or disables the display of prices of options in the cart.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_hide_options_prices_in_cart', 'class' => 'chosen_select', 'css' => 'min-width:300px;', 'default' => 'normal', 'type' => 'select', 'options' => array('normal' => __('Show', TM_EPO_TRANSLATION), 'hide' => __('Hide', TM_EPO_TRANSLATION)), 'desc_tip' => false), version_compare(get_option('woocommerce_db_version'), '2.3', '<') ? array() : array('title' => __('Prevent negative priced products', TM_EPO_TRANSLATION), 'desc' => __('Prevent adding to the cart negative priced products.', TM_EPO_TRANSLATION), 'id' => 'tm_epo_no_negative_priced_products', 'default' => 'no', 'type' => 'checkbox', 'desc_tip' => false), array('type' => 'sectionend', 'id' => 'epo_page_options'));
     $_string_settings = array(array('type' => 'title', 'id' => 'epo_page_options'), array('title' => __('Final total text', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Select the Final total text or leave blank for default.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_final_total_text', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('title' => __('Options total text', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Select the Options total text or leave blank for default.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_options_total_text', 'default' => '', 'type' => 'text', 'desc_tip' => false), tm_woocommerce_subscriptions_check() ? array('title' => __('Subscription fee text', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Select the Subscription fee text or leave blank for default.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_subscription_fee_text', 'default' => '', 'type' => 'text', 'desc_tip' => false) : array(), array('title' => __('Free Price text replacement', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Enter a text to replace the Free price label when product has extra options.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_replacement_free_price_text', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('title' => __('Reset Options text replacement', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Enter a text to replace the Reset options text when using custom variations.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_reset_variation_text', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('type' => 'sectionend', 'id' => 'epo_page_options'));
     $_style_settings = array(array('type' => 'title', 'id' => 'epo_page_options'), array('title' => __('Enable checkbox and radio styles', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Enables or disables extra styling for checkboxes and radio buttons.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_css_styles', 'class' => 'chosen_select', 'css' => 'min-width:300px;', 'default' => '', 'type' => 'select', 'options' => array('' => __('Disable', TM_EPO_TRANSLATION), 'on' => __('Enable', TM_EPO_TRANSLATION)), 'desc_tip' => false), array('title' => __('Style', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Select a style.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_css_styles_style', 'class' => 'chosen_select', 'css' => 'min-width:300px;', 'default' => 'round', 'type' => 'select', 'options' => array('round' => __('Round', TM_EPO_TRANSLATION), 'square' => __('Square', TM_EPO_TRANSLATION)), 'desc_tip' => false), array('title' => __('Select item border type', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Select a style for the selected border when using image replacements or swatches.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_css_selected_border', 'class' => 'chosen_select', 'css' => 'min-width:300px;', 'default' => '', 'type' => 'select', 'options' => array('' => __('Default', TM_EPO_TRANSLATION), 'square' => __('Square', TM_EPO_TRANSLATION), 'round' => __('Round', TM_EPO_TRANSLATION), 'shadow' => __('Shadow', TM_EPO_TRANSLATION), 'thinline' => __('Thin line', TM_EPO_TRANSLATION)), 'desc_tip' => false), array('type' => 'sectionend', 'id' => 'epo_page_options'));
     $_license_settings = !defined('TM_DISABLE_LICENSE') ? array(array('type' => 'title', 'id' => 'epo_page_options'), array('title' => __('Username', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('Your Envato username.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_envato_username', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('title' => __('Envato API Key', TM_EPO_TRANSLATION), 'desc' => '<div>' . __('You can find your API key by visiting your Account page then clicking the My Settings tab. At the bottom of the page you’ll find your account’s API key and a button to regenerate it as needed.', TM_EPO_TRANSLATION) . '</div>', 'id' => 'tm_epo_envato_apikey', 'default' => '', 'type' => 'password', 'desc_tip' => false), array('title' => __('Purchase code', TM_EPO_TRANSLATION), 'desc' => '<div><p>' . __('Please enter your <strong>CodeCanyon WooCommerce Extra Product Options purchase code</strong>.', TM_EPO_TRANSLATION) . '</p><p>' . __('To access your Purchase Code for an item:', TM_EPO_TRANSLATION) . '</p>' . '<ol>' . '<li>' . __('Log into your Marketplace account', TM_EPO_TRANSLATION) . '</li>' . '<li>' . __('From your account dropdown links, select "Downloads"', TM_EPO_TRANSLATION) . '</li>' . '<li>' . __('Click the "Download" button that corresponds with your purchase', TM_EPO_TRANSLATION) . '</li>' . '<li>' . __('Select the "License certificate &amp; purchase code" download link. Your Purchase Code will be displayed within the License Certificate.', TM_EPO_TRANSLATION) . '</li>' . '</ol>' . '<p><img alt="Purchase Code Location" src="' . TM_PLUGIN_URL . '/assets/images/download_button.gif" title="Purchase Code Location" style="vertical-align: middle;"></p>' . '<div class="tm-license-button">' . '<a href="#" class="' . (TM_EPO_LICENSE()->get_license() ? "" : "tm-hidden ") . 'tm-button button button-primary button-large tm-deactivate-license" id="tm_deactivate_license">' . __('Deactivate License', TM_EPO_TRANSLATION) . '</a>' . '<a href="#" class="' . (TM_EPO_LICENSE()->get_license() ? "tm-hidden " : "") . 'tm-button button button-primary button-large tm-activate-license" id="tm_activate_license">' . __('Activate License', TM_EPO_TRANSLATION) . '</a>' . '</div>' . '<div class="tm-license-result">' . (TM_EPO_LICENSE()->get_license() ? "<div class='activated'><p>" . __("License activated.", TM_EPO_TRANSLATION) . "</p></div>" : "") . '</div>' . '</div>', 'id' => 'tm_epo_envato_purchasecode', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('type' => 'sectionend', 'id' => 'epo_page_options')) : array();
     return apply_filters('tm_' . $this->id . '_settings', array_merge(array(array('type' => 'tm_tabs_header')), $_general_settings, $_display_settings, $_cart_settings, $_string_settings, $_style_settings, $this->get_other_settings(), $_license_settings));
     // End pages settings
 }
コード例 #3
0
 private function _get_setting_string($setting, $label)
 {
     return array(array('type' => 'tm_title', 'id' => 'epo_page_options', 'title' => $label), array('title' => __('Final total text', TM_EPO_TRANSLATION), 'desc' => '<span>' . __('Select the Final total text or leave blank for default.', TM_EPO_TRANSLATION) . '</span>', 'id' => 'tm_epo_final_total_text', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('title' => __('Options total text', TM_EPO_TRANSLATION), 'desc' => '<span>' . __('Select the Options total text or leave blank for default.', TM_EPO_TRANSLATION) . '</span>', 'id' => 'tm_epo_options_total_text', 'default' => '', 'type' => 'text', 'desc_tip' => false), tm_woocommerce_subscriptions_check() ? array('title' => __('Subscription fee text', TM_EPO_TRANSLATION), 'desc' => '<span>' . __('Select the Subscription fee text or leave blank for default.', TM_EPO_TRANSLATION) . '</span>', 'id' => 'tm_epo_subscription_fee_text', 'default' => '', 'type' => 'text', 'desc_tip' => false) : array(), array('title' => __('Free Price text replacement', TM_EPO_TRANSLATION), 'desc' => '<span>' . __('Enter a text to replace the Free price label when product has extra options.', TM_EPO_TRANSLATION) . '</span>', 'id' => 'tm_epo_replacement_free_price_text', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('title' => __('Reset Options text replacement', TM_EPO_TRANSLATION), 'desc' => '<span>' . __('Enter a text to replace the Reset options text when using custom variations.', TM_EPO_TRANSLATION) . '</span>', 'id' => 'tm_epo_reset_variation_text', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('title' => __('Edit Options text replacement', TM_EPO_TRANSLATION), 'desc' => '<span>' . __('Enter a text to replace the Edit options text on the cart.', TM_EPO_TRANSLATION) . '</span>', 'id' => 'tm_epo_edit_options_text', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('title' => __('Additional Options text replacement', TM_EPO_TRANSLATION), 'desc' => '<span>' . __('Enter a text to replace the Additional options text when using the pop up setting on the cart.', TM_EPO_TRANSLATION) . '</span>', 'id' => 'tm_epo_additional_options_text', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('title' => __('Close button text replacement', TM_EPO_TRANSLATION), 'desc' => '<span>' . __('Enter a text to replace the Close button text when using the pop up setting on the cart.', TM_EPO_TRANSLATION) . '</span>', 'id' => 'tm_epo_close_button_text', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('title' => __('Calendar close button text replacement', TM_EPO_TRANSLATION), 'desc' => '<span>' . __('Enter a text to replace the Close button text on the calendar.', TM_EPO_TRANSLATION) . '</span>', 'id' => 'tm_epo_closetext', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('title' => __('Calendar today button text replacement', TM_EPO_TRANSLATION), 'desc' => '<span>' . __('Enter a text to replace the Today button text on the calendar.', TM_EPO_TRANSLATION) . '</span>', 'id' => 'tm_epo_currenttext', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('title' => __('Slider previous text', TM_EPO_TRANSLATION), 'desc' => '<span>' . __('Enter a text to replace the previous button text for slider.', TM_EPO_TRANSLATION) . '</span>', 'id' => 'tm_epo_slider_prev_text', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('title' => __('Slider next text', TM_EPO_TRANSLATION), 'desc' => '<span>' . __('Enter a text to replace the next button text for slider.', TM_EPO_TRANSLATION) . '</span>', 'id' => 'tm_epo_slider_next_text', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('title' => __('Force Select options text', TM_EPO_TRANSLATION), 'desc' => '<span>' . __('Enter a text to replace the add to cart button text when using the Force select option.', TM_EPO_TRANSLATION) . '</span>', 'id' => 'tm_epo_force_select_text', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('title' => __('Empty cart text', TM_EPO_TRANSLATION), 'desc' => '<span>' . __('Enter a text to replace the empty cart button text.', TM_EPO_TRANSLATION) . '</span>', 'id' => 'tm_epo_empty_cart_text', 'default' => '', 'type' => 'text', 'desc_tip' => false), array('type' => 'tm_sectionend', 'id' => 'epo_page_options'));
 }