function widget($args, $instance) { global $yith_woocompare; /** * WPML Support */ $lang = defined('ICL_LANGUAGE_CODE') ? ICL_LANGUAGE_CODE : false; extract($args); yit_wpml_register_string('Widget', 'widget_yit_compare_title_text', $instance['title']); $localized_widget_title = yit_wpml_string_translate('Widget', 'widget_yit_compare_title_text', $instance['title']); echo $before_widget . $before_title . $localized_widget_title . $after_title; ?> <ul class="products-list" data-lang="<?php echo $lang; ?> "> <?php echo $yith_woocompare->obj->list_products_html(); ?> </ul> <a href="<?php echo $yith_woocompare->obj->remove_product_url('all'); ?> " data-product_id="all" class="clear-all"><?php _e('Clear all', 'yith-woocommerce-compare'); ?> </a> <a href="<?php echo add_query_arg(array('iframe' => 'true'), $yith_woocompare->obj->view_table_url()); ?> " class="compare button"><?php _e('Compare', 'yith-woocommerce-compare'); ?> </a> <?php echo $after_widget; }
function yit_woocommerce_add_tabs($tabs = array()) { global $post; $custom_tabs = yit_get_post_meta($post->ID, '_custom_tab'); if (!empty($custom_tabs)) { foreach ($custom_tabs as $tab) { yit_wpml_register_string('bishop-theme', 'custom_tab_' . sanitize_title($tab["name"]), $tab["name"]); $tab["name"] = yit_wpml_string_translate('bishop-theme', 'custom_tab_' . sanitize_title($tab["name"]), $tab["name"]); yit_wpml_register_string('bishop-theme', 'custom_tab_' . sanitize_title($tab["value"]), $tab["value"]); $tab["value"] = yit_wpml_string_translate('bishop-theme', 'custom_tab_' . sanitize_title($tab["value"]), $tab["value"]); $tabs['custom' . $tab["position"]] = array('title' => $tab["name"], 'priority' => 30, 'callback' => 'yit_woocommerce_add_custom_panel', 'custom_tab' => $tab); } } return $tabs; }
/** * Add a string to string translation list and return it translation * * @author Andrea Frascaspata <*****@*****.**> * * @param $context * @param $domain * @param $string * #param $name * * @return string | the string translation * @since 2.3.0 */ function yit_icl_translate( $context, $domain,$name, $string ) { global $sitepress; if ( isset( $sitepress ) ) { $name = "[" . $domain . "]" . $name; yit_wpml_register_string( $context, $name, $string ); return yit_wpml_string_translate( $context, $name, $string ); } else { return sprintf( __( '%s', $domain ), $string ); } }
function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = strip_tags( $new_instance['title'] ); $instance['image'] = $new_instance['image']; $instance['image_link'] = esc_url( $new_instance['image_link'] ); $instance['align'] = $new_instance['align']; $instance['text'] = $new_instance['text']; yit_wpml_register_string( 'Widgets', 'widget_text_' . sanitize_title( $instance['text'] ), $instance['text'] ); $instance['autop'] = $new_instance['autop']; return $instance; }
/** * Add the link to compare */ public function add_compare_link($product_id = false, $args = array()) { extract($args); if (!$product_id) { global $product; $product_id = isset($product->id) ? $product->id : 0; } // return if product doesn't exist if (empty($product_id) || apply_filters('yith_woocompare_remove_compare_link_by_cat', false, $product_id)) { return; } $is_button = !isset($button_or_link) || !$button_or_link ? get_option('yith_woocompare_is_button') : $button_or_link; if (!isset($button_text) || $button_text == 'default') { $button_text = get_option('yith_woocompare_button_text', __('Compare', 'yith-woocommerce-compare')); yit_wpml_register_string('Plugins', 'plugin_yit_compare_button_text', $button_text); $button_text = yit_wpml_string_translate('Plugins', 'plugin_yit_compare_button_text', $button_text); } printf('<a href="%s" class="%s" data-product_id="%d" rel="nofollow">%s</a>', $this->add_product_url($product_id), 'compare' . ($is_button == 'button' ? ' button' : ''), $product_id, $button_text); }
* @package YITH Woocommerce Compare * @version 1.1.4 */ // remove the style of woocommerce if (defined('WOOCOMMERCE_USE_CSS') && WOOCOMMERCE_USE_CSS) { wp_dequeue_style('woocommerce_frontend_styles'); } $is_iframe = (bool) (isset($_REQUEST['iframe']) && $_REQUEST['iframe']); wp_enqueue_script('jquery-fixedheadertable', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.dataTables.min.js', array('jquery'), '1.3', true); wp_enqueue_script('jquery-fixedcolumns', YITH_WOOCOMPARE_ASSETS_URL . '/js/FixedColumns.min.js', array('jquery', 'jquery-fixedheadertable'), '1.3', true); $widths = array(); foreach ($products as $product) { $widths[] = '{ "sWidth": "205px", resizeable:true }'; } $table_text = get_option('yith_woocompare_table_text'); yit_wpml_register_string('Plugins', 'plugin_yit_compare_table_text', $table_text); $localized_table_text = yit_wpml_string_translate('Plugins', 'plugin_yit_compare_table_text', $table_text); ?> <!DOCTYPE html> <!--[if IE 6]> <html id="ie6" class="ie"<?php language_attributes(); ?> > <![endif]--> <!--[if IE 7]> <html id="ie7" class="ie"<?php language_attributes(); ?> > <![endif]-->
function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = $new_instance['title']; $instance['link'] = $new_instance['link']; $instance['icon_img'] = $new_instance['icon_img']; $instance['img_url'] = $new_instance['img_url']; $instance['text'] = $new_instance['text']; yit_wpml_register_string( 'Widgets', 'widget_icon_text_' . sanitize_title( $instance['text'] ), $instance['text'] ); return $instance; }