public function display_field($element = array(), $args = array()) { $tm_epo_global_datepicker_theme = !empty(TM_EPO()->tm_epo_global_datepicker_theme) ? TM_EPO()->tm_epo_global_datepicker_theme : (isset($element['theme']) ? $element['theme'] : "epo"); $tm_epo_global_datepicker_size = !empty(TM_EPO()->tm_epo_global_datepicker_size) ? TM_EPO()->tm_epo_global_datepicker_size : (isset($element['theme_size']) ? $element['theme_size'] : "medium"); $tm_epo_global_datepicker_position = !empty(TM_EPO()->tm_epo_global_datepicker_position) ? TM_EPO()->tm_epo_global_datepicker_position : (isset($element['theme_position']) ? $element['theme_position'] : "normal"); return array('textbeforeprice' => isset($element['text_before_price']) ? $element['text_before_price'] : "", 'textafterprice' => isset($element['text_after_price']) ? $element['text_after_price'] : "", 'hide_amount' => isset($element['hide_amount']) ? " " . $element['hide_amount'] : "", 'style' => isset($element['button_type']) ? $element['button_type'] : "", 'format' => !empty($element['format']) ? $element['format'] : 0, 'start_year' => !empty($element['start_year']) ? $element['start_year'] : "1900", 'end_year' => !empty($element['end_year']) ? $element['end_year'] : date("Y") + 10, 'min_date' => isset($element['min_date']) ? $element['min_date'] : "", 'max_date' => isset($element['max_date']) ? $element['max_date'] : "", 'disabled_dates' => !empty($element['disabled_dates']) ? $element['disabled_dates'] : "", 'enabled_only_dates' => !empty($element['enabled_only_dates']) ? $element['enabled_only_dates'] : "", 'disabled_weekdays' => isset($element['disabled_weekdays']) ? $element['disabled_weekdays'] : "", 'tranlation_day' => !empty($element['tranlation_day']) ? $element['tranlation_day'] : "", 'tranlation_month' => !empty($element['tranlation_month']) ? $element['tranlation_month'] : "", 'tranlation_year' => !empty($element['tranlation_year']) ? $element['tranlation_year'] : "", 'quantity' => isset($element['quantity']) ? $element['quantity'] : "", 'date_theme' => $tm_epo_global_datepicker_theme, 'date_theme_size' => $tm_epo_global_datepicker_size, 'date_theme_position' => $tm_epo_global_datepicker_position); }
public function add_cart_item_data_single() { if (!$this->is_setup()) { return false; } if (!empty($this->key)) { $_price = TM_EPO()->calculate_price($this->element, $this->key, $this->attribute, $this->per_product_pricing, $this->cpf_product_price, $this->variation_id); return array('mode' => 'builder', 'name' => esc_html($this->element['label']), 'value' => esc_html($this->key), 'price' => esc_attr($_price), 'section' => esc_html($this->element['uniqid']), 'section_label' => esc_html($this->element['label']), 'percentcurrenttotal' => isset($_POST[$this->attribute . '_hidden']) ? 1 : 0, 'quantity' => isset($_POST[$this->attribute . '_quantity']) ? $_POST[$this->attribute . '_quantity'] : 1); } return false; }
public function display_field($element = array(), $args = array()) { $this->_columns++; $this->grid_break = ""; $default_value = isset($element['default_value']) ? $element['default_value'] !== "" ? (int) $element['default_value'] == $this->_default_value_counter : false : false; if ((double) $this->_columns > (double) $this->items_per_row && $this->items_per_row > 0) { $this->grid_break = " cpf_clear"; $this->_columns = 1; } $hexclass = ""; $li_class = ""; $search_for_color = $args['label']; if (isset($element['color'])) { $search_for_color = $element['color']; if (empty($search_for_color)) { $search_for_color = 'transparent'; } } if ($search_for_color == 'transparent' || preg_match('/#([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?\\b/', $search_for_color)) { $tmhexcolor = 'tmhexcolor_' . $args['element_counter'] . "_" . $args['field_counter'] . "_" . $args['tabindex'] . $args['form_prefix']; $hexclass = $tmhexcolor; $this->css_string = "." . $tmhexcolor . " + label .tmhexcolorimage{background-color:" . $search_for_color . " !important;}"; if (!empty($element['item_width'])) { if (is_numeric($element['item_width'])) { $element['item_width'] .= "px"; } $this->css_string .= "." . $tmhexcolor . " + label img{display: inline-block !important;width:" . $element['item_width'] . " !important;min-width:" . $element['item_width'] . " !important;max-width:" . $element['item_width'] . " !important;}"; $this->css_string .= "." . $tmhexcolor . " + label span.tmhexcolorimage{display: inline-block !important;width:" . $element['item_width'] . " !important;min-width:" . $element['item_width'] . " !important;max-width:" . $element['item_width'] . " !important;}"; } if (!empty($element['item_height'])) { if (is_numeric($element['item_height'])) { $element['item_height'] .= "px"; } $this->css_string .= "." . $tmhexcolor . " + label img{display: inline-block !important;height:" . $element['item_height'] . " !important;min-height:" . $element['item_height'] . " !important;max-height:" . $element['item_height'] . " !important;}"; $this->css_string .= "." . $tmhexcolor . " + label span.tmhexcolorimage{display: inline-block !important;height:" . $element['item_height'] . " !important;min-height:" . $element['item_height'] . " !important;max-height:" . $element['item_height'] . " !important;}"; } if (!empty($element['item_width']) || !empty($element['item_height'])) { $this->css_string .= ".tmhexcolorimage-li.tm-li-unique-" . $args['element_counter'] . "-" . $args['field_counter'] . "-" . $args['tabindex'] . $args['form_prefix'] . "{display: inline-block;width:auto !important;oveflow:hidden;}"; $li_class .= "tmhexcolorimage-li tm-li-unique-" . $args['element_counter'] . "-" . $args['field_counter'] . "-" . $args['tabindex'] . $args['form_prefix']; } else { $li_class .= "tmhexcolorimage-li-nowh"; } $this->css_string = str_replace(array("\r", "\n"), "", $this->css_string); TM_EPO()->inline_styles = TM_EPO()->inline_styles . $this->css_string; } $display = array('li_class' => $li_class, 'class' => !empty($element['class']) ? $element['class'] . ' ' . $hexclass : "" . $hexclass, 'label' => wptexturize(apply_filters('woocommerce_tm_epo_option_name', $args['label'])), 'value' => esc_attr($args['value']), 'id' => 'tmcp_choice_' . $args['element_counter'] . "_" . $args['field_counter'] . "_" . $args['tabindex'] . $args['form_prefix'], 'textbeforeprice' => isset($element['text_before_price']) ? $element['text_before_price'] : "", 'textafterprice' => isset($element['text_after_price']) ? $element['text_after_price'] : "", 'hide_amount' => isset($element['hide_amount']) ? " " . $element['hide_amount'] : "", 'use_images' => $element['use_images'], 'use_lightbox' => isset($element['use_lightbox']) ? $element['use_lightbox'] : "", 'use_url' => $element['use_url'], 'grid_break' => $this->grid_break, 'items_per_row' => $this->items_per_row, 'percent' => $this->_percent, 'image' => isset($element['images'][$args['field_counter']]) ? $element['images'][$args['field_counter']] : "", 'imagep' => isset($element['imagesp'][$args['field_counter']]) ? $element['imagesp'][$args['field_counter']] : "", 'url' => isset($element['url'][$args['field_counter']]) ? $element['url'][$args['field_counter']] : "", 'limit' => empty($element['limit']) ? "" : $element['limit'], 'exactlimit' => empty($element['exactlimit']) ? "" : $element['exactlimit'], 'minimumlimit' => empty($element['minimumlimit']) ? "" : $element['minimumlimit'], 'swatchmode' => empty($element['swatchmode']) ? "" : $element['swatchmode'], 'clear_options' => empty($element['clear_options']) ? "" : $element['clear_options'], 'show_label' => empty($element['show_label']) ? "" : $element['show_label'], 'tm_epo_no_lazy_load' => TM_EPO()->tm_epo_no_lazy_load, 'changes_product_image' => empty($element['changes_product_image']) ? "" : $element['changes_product_image'], 'default_value' => $default_value, 'quantity' => isset($element['quantity']) ? $element['quantity'] : ""); if (isset($element['color'])) { $display["color"] = $element['color']; } $this->_default_value_counter++; return $display; }
public function add_cart_item_data_single() { $_price = TM_EPO()->calculate_price($this->element, $this->key, $this->attribute, $this->per_product_pricing, $this->cpf_product_price, $this->variation_id); if (empty($this->key)) { $_price = 0; } if (!empty($_FILES[$this->attribute]) && !empty($_FILES[$this->attribute]['name'])) { $upload = TM_EPO()->upload_file($_FILES[$this->attribute]); if (empty($upload['error']) && !empty($upload['file'])) { $value = wc_clean($upload['url']); wc_add_notice(__("Upload successful", TM_EPO_TRANSLATION), 'success'); return array('name' => esc_html($this->element['label']), 'value' => esc_html($value), 'display' => esc_html(TM_EPO()->tm_order_item_display_meta_value($value, 1)), 'price' => esc_attr($_price), 'section' => esc_html($this->element['uniqid']), 'section_label' => esc_html($this->element['label']), 'percentcurrenttotal' => isset($_POST[$this->attribute . '_hidden']) ? 1 : 0, 'quantity' => 1); } else { wc_add_notice($upload['error'], 'error'); } } return false; }
} if ($description_position == "icontooltipright") { echo '<i data-tm-tooltip-swatch="on" class="tm-tooltip tc-tooltip tcfa tcfa-question-circle"></i>'; } echo '</' . $title_size . '>'; } if (!empty($description) && (empty($description_position) || $description_position == "tooltip" || $description_position == "icontooltipright" | $description_position == "icontooltipleft")) { echo '<div'; if (!empty($description_color)) { echo ' style="color:' . $description_color . '"'; } echo ' class="tm-description' . ($description_position == "tooltip" || $description_position == "icontooltipright" || $description_position == "icontooltipleft" ? " tm-tip-html" : "") . '">' . do_shortcode($description) . '</div>'; } } echo $divider; if (!in_array($element, array('header', 'divider')) && empty(TM_EPO()->tm_builder_elements[$tm_element_settings['type']]["no_frontend_display"])) { ?> <div class="tm-extra-product-options-container"> <ul data-rules="<?php echo $rules; ?> " data-rulestype="<?php echo $rules_type; ?> " <?php if (!empty($tm_validation)) { ?> data-tm-validation="<?php echo $tm_validation;
} } ?> </td> <td class="product-subtotal"> <?php if (TM_EPO()->tm_epo_cart_field_display == "advanced") { if (TM_EPO()->tm_epo_hide_options_in_cart == "normal") { if (isset($cart_item['tm_epo_product_after_adjustment']) && TM_EPO()->tm_epo_dpd_enable == "no") { $price = $cart_item['tm_epo_product_after_adjustment']; } else { $price = TM_EPO()->get_RP_WCDPD(wc_get_product($cart_item['data']->id), $cart_item['tm_epo_product_original_price'], $cart_item_key); } $price = $price * $cart_item['quantity']; echo apply_filters('woocommerce_cart_item_subtotal', TM_EPO()->get_price_for_cart($price, $cart_item, ""), $cart_item, $cart_item_key); } else { echo apply_filters('woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal($_product, $cart_item['quantity']), $cart_item, $cart_item_key); } } else { echo apply_filters('woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal($original_product, $cart_item['quantity']), $cart_item, $cart_item_key); } ?> </td> <?php do_action('tm_woocommerce_cart_after_column', $cart_item_key, $cart_item, $_product, $product_id); ?> </tr> <?php do_action('tm_woocommerce_cart_after_row', $cart_item_key, $cart_item, $_product, $product_id); }
$element_data_attr_html = " " . implode(" ", $element_data_attr_html) . " "; } else { $element_data_attr_html = ""; } if (empty($image)) { $image = ''; } if (empty($imagep) || empty($changes_product_image)) { $imagep = ''; } $labelclass = ''; $labelclass_start = ''; $labelclass_end = ''; if (TM_EPO()->tm_epo_css_styles == "on" && empty($use_images)) { $labelclass = ' class="tm-epo-style ' . TM_EPO()->tm_epo_css_styles_style . '"'; $labelclass_start = '<span class="tm-epo-style-wrapper ' . TM_EPO()->tm_epo_css_styles_style . '">'; $labelclass_end = '</span>'; } ?> <li class="tmcp-field-wrap<?php echo $grid_break . $li_class; ?> "> <?php include '_quantity_start.php'; ?> <?php echo $labelclass_start; ?> <input class="<?php echo $fieldtype;
public function add_cart_item_data_cart_fees_multiple() { if (!$this->setup) { return false; } if (empty($this->key)) { return false; } /* select placeholder check */ if (isset($this->element['options'][esc_attr($this->key)])) { $_price = TM_EPO()->calculate_price($this->element, $this->key, $this->attribute, $this->per_product_pricing, $this->cpf_product_price, $this->variation_id); $use_images = !empty($this->element['use_images']) ? $this->element['use_images'] : ""; if ($use_images) { $_image_key = array_search($this->key, $this->element['option_values']); if ($_image_key === NULL || $_image_key === FALSE) { $_image_key = FALSE; } } else { $_image_key = FALSE; } return array('mode' => 'builder', 'cssclass' => esc_html($this->element['class']), 'name' => esc_html($this->element['label']), 'value' => esc_html($this->element['options'][esc_attr($this->key)]), 'price' => TM_EPO()->cacl_fee_price($_price, $this->product_id), 'section' => esc_html($this->element['uniqid']), 'section_label' => esc_html($this->element['label']), 'percentcurrenttotal' => 0, 'currencies' => isset($this->element['currencies']) ? $this->element['currencies'] : array(), 'price_per_currency' => $this->fill_currencies(), 'quantity' => isset($_POST[$this->attribute . '_quantity']) ? $_POST[$this->attribute . '_quantity'] : 1, 'cart_fees' => 'multiple', 'key' => esc_attr($this->key), 'use_images' => $use_images, 'changes_product_image' => !empty($this->element['changes_product_image']) ? $this->element['changes_product_image'] : "", 'images' => $_image_key !== FALSE && isset($this->element['images'][$_image_key]) ? $this->element['images'][$_image_key] : ""); } return false; }
private function _get_setting_upload($setting, $label) { $html = TM_EPO_HELPER()->file_manager(TM_EPO()->upload_dir, ''); $_upload_settings = array(array('type' => 'tm_title', 'id' => 'epo_page_options', 'title' => $label), array('title' => __('Upload folder', TM_EPO_TRANSLATION), 'desc' => '<span>' . __('Changing this will only affect future uploads.', TM_EPO_TRANSLATION) . '</span>', 'id' => 'tm_epo_upload_folder', 'default' => 'extra_product_options', 'type' => 'text', 'desc_tip' => false), array('type' => 'tm_html', 'id' => 'epo_page_options_html', 'title' => __('File manager', TM_EPO_TRANSLATION), 'html' => $html), array('type' => 'tm_sectionend', 'id' => 'epo_page_options')); return $_upload_settings; }
public function tm_mn_movetodir() { check_ajax_referer('settings-nonce', 'security'); $html = ''; if (isset($_POST["dir"])) { $html = TM_EPO_HELPER()->file_manager(TM_EPO()->upload_dir, $_POST["dir"]); } if ($html) { echo json_encode(array('result' => $html)); } else { echo json_encode(array('error' => 1, 'message' => __('File manager is not supported on your server.', TM_EPO_TRANSLATION))); } die; }
TM_EPO_ADMIN_GLOBAL()->init(); /* Load Admin Interface */ function TM_EPO_ADMIN() { return TM_EPO_Admin_base::instance(); } TM_EPO_ADMIN()->init(); } /** * Load main plugin interface */ function TM_EPO() { return TM_Extra_Product_Options::instance(); } TM_EPO()->init(); // Shortcode tc_epo_show // Used for echoing a custom action. function tc_epo_show_shortcode($atts, $content = null) { extract(shortcode_atts(array('action' => ''), $atts)); ob_start(); do_action($action); echo $action; $content = ob_get_contents(); ob_end_clean(); return $content; } add_shortcode('tc_epo_show', 'tc_epo_show_shortcode'); // Epo Widget // Used for for eachoing a custom action
public function tm_variation_css_check($echo = 0, $product_id = 0) { if (is_rtl()) { $this->float_direction = "right"; } $post_id = get_the_ID(); $cpf_price_array = TM_EPO()->get_product_tm_epos($post_id); if ($cpf_price_array) { $global_price_array = $cpf_price_array['global']; $local_price_array = $cpf_price_array['local']; if (empty($global_price_array)) { return; } $found = false; foreach ($global_price_array as $priority => $priorities) { foreach ($priorities as $pid => $field) { if (isset($field['sections']) && is_array($field['sections'])) { foreach ($field['sections'] as $section_id => $section) { if (isset($section['elements'])) { foreach ($section['elements'] as $elid => $el) { if (isset($el['builder'])) { if (isset($el['builder']['element_type'])) { foreach ($el['builder']['element_type'] as $bid => $b) { if (strtolower($b) == "variations") { $found = true; break 5; } } } } } } } } } } if ($found) { if ($product_id) { $css_string = "#product-" . $product_id . " form .variations,.post-" . $product_id . " form .variations {display:none;}"; } else { $css_string = "form .variations{display:none;}"; } $this->inline_styles_head = $this->inline_styles_head . $css_string; if ($echo) { $this->tm_variation_css_check_do(); } else { add_action('wp_head', array($this, 'tm_variation_css_check_do')); } } } }
$variations_builder_element_start_args["tm_product_id"] = isset($tm_product_id) ? $tm_product_id : 0; wc_get_template('tm-builder-element-start.php', $variations_builder_element_start_args, $tm__namespace, $tm_template_path); $v_field_counter = 0; $fake_element = array("default_value" => $default_value, "class" => $variations_class . " tm-epo-variation-element", "textbeforeprice" => "", "textafterprice" => "", "hide_amount" => "hidden", "use_images" => $variations_display_as == "image" || $variations_display_as == "color" ? "images" : "", "use_url" => "", "images" => $images, "imagesp" => $imagesp, "url" => array(), "limit" => "", "items_per_row" => $variations_items_per_row, "item_width" => $variations_item_width, "item_height" => $variations_item_height, "show_label" => $variations_show_name, "exactlimit" => "", "minimumlimit" => "", "swatchmode" => "", "changes_product_image" => $changes_product_image, "containter_css_id" => "variation-element-"); $element_display->display_field_pre($fake_element, array('element_counter' => $loop, 'tabindex' => $v_field_counter, 'form_prefix' => $form_prefix, 'field_counter' => $v_field_counter, 'product_id' => isset($tm_product_id) ? $tm_product_id : 0)); foreach ($options_array as $value => $label) { if (isset($color[$v_field_counter])) { $fake_element["color"] = $color[$v_field_counter]; } else { unset($fake_element["color"]); } $display = $element_display->display_field($fake_element, array('name_inc' => 'tm_attribute_' . $att_id . "_" . $loop . $form_prefix, 'value' => $value, 'label' => $label, 'element_counter' => $loop, 'tabindex' => $v_field_counter, 'form_prefix' => $form_prefix, 'field_counter' => $v_field_counter)); if (is_array($display)) { $field_args = array('tm_element_settings' => $fake_element, 'id' => 'tm_attribute_id_' . $att_id . "_" . $loop . "_" . $v_field_counter . "_" . intval($v_field_counter + $loop) . $form_prefix, 'name' => 'tm_attribute_' . $att_id . "_" . $loop . $form_prefix, 'class' => $variations_class . " tm-epo-variation-element", 'tabindex' => $v_field_counter, 'rules' => '', 'rules_type' => '', 'tabindex' => "", 'amount' => "", 'element_data_attr' => array("data-tm-for-variation" => $att_id), 'border_type' => TM_EPO()->tm_epo_css_selected_border); $field_args = array_merge($field_args, $display); wc_get_template('tm-radio.php', $field_args, $tm__namespace, $tm_template_path); } $v_field_counter++; } wc_get_template('tm-builder-element-end.php', $variations_builder_element_end_args, $tm__namespace, $tm_template_path); } break; } } if (sizeof($attributes) == $loop) { echo '<a class="reset_variations" href="#reset">' . (!empty(TM_EPO()->tm_epo_reset_variation_text) ? TM_EPO()->tm_epo_reset_variation_text : __('Reset options', TM_EPO_TRANSLATION)) . '</a>'; } } } } do_action('tm_after_styled_variations', $tm_product);
?> " data-haslogic="<?php echo $haslogic; ?> " class="cpf-section tm-row tm-cell <?php echo $column; ?> <?php echo $sections_class . $tm_product_id_class; ?> "> <?php if (isset($sections_type) && $sections_type == "popup") { $_popuplinkitle = !empty(TM_EPO()->tm_epo_additional_options_text) ? TM_EPO()->tm_epo_additional_options_text : __('Additional options', TM_EPO_TRANSLATION); if (!empty($title)) { $_popuplinkitle = $title; } $_popuplink = '<a class="tm-section-link" href="#" data-title="' . esc_attr($_popuplinkitle) . '" data-sectionid="' . $uniqid . '">' . $_popuplinkitle . '</a>'; echo $_popuplink . '<div class="tm-section-pop">'; } $icon = ''; $toggler = ''; if ($style == "box") { echo '<div class="tm-box">'; } if ($style == "collapse" || $style == "collapseclosed" || $style == "accordion") { echo '<div class="tm-collapse' . ($style == "accordion" ? ' tmaccordion' : '') . '">'; $icon = '<span class="tcfa tcfa-angle-down tm-arrow"></span>'; $toggler = ' tm-toggle';