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 widget( $args, $instance ) { extract( $args ); $title = apply_filters('widget_title', $instance['title'] ); echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; if( $instance['autop'] ) { $instance['text'] = wpautop( $instance['text'] ); } $text = '<div class="text-image" style="text-align:'. $instance['align'] .'">'; if (isset($instance['image']) && $instance['image'] != '') : if( isset($instance['image_link']) && $instance['image_link'] != '' ) { $text.= '<a href="' . $instance['image_link'] . '">'; } $image_id = yit_get_attachment_id( $instance['image'] ); $image_meta = get_post_meta( $image_id, '_wp_attachment_image_alt', true ); $size = yit_getimagesize($instance['image']); $size = ( !empty($size) && isset($size[3] ) ) ? $size[3] : ''; $text .= '<img src="' . $instance['image'] . '" alt="' . $image_meta . '" '. $size . ' />'; if( isset($instance['image_link']) && $instance['image_link'] != '' ) { $text.= '</a>'; } endif; //string translation fix $clear_text = apply_filters( 'widget_text', yit_wpml_string_translate( 'Widgets', 'widget_text_' . sanitize_title( $instance['text'] ), $instance['text'] ), $instance ); $text .= '</div>' .$clear_text; echo $text; echo $after_widget; }
/** * 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); }
* @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]--> <!--[if IE 8]>
function widget( $args, $instance ) { extract( $args ); $title = apply_filters( 'widget_title', $instance['title'] ); if ( strpos( $before_widget, 'widget-wrap' ) === false ) { if ( $title != '' ){ $before_widget .= '<div class="clearfix widget-wrap">'; } else{ $before_widget .= '<div class="clearfix widget-wrap" style="margin-bottom: 20px;">'; } $after_widget .= '</div>'; } echo $before_widget; if ( $title ) { echo $before_title . $title . $after_title; } echo '<div>'; if ( $instance['autop'] ) { $instance['text'] = wpautop( apply_filters( 'widget_text', $instance['text'] ) ); } $text = '<div class="clearfix widget_image ' . $instance['align'] . '">'; if( isset( $instance[ 'link' ] ) && $instance['link'] != '' ) { $text .= '<a href ="' . $instance['link'] . '">'; } if ( isset( $instance['icon'] ) && ( $instance['image'] == '' || ! isset( $instance['image'] ) ) ) { $text .= '<i class="fa fa-' . $instance['icon'] . '" ></i>'; } elseif ( isset( $instance['image'] ) && $instance['image'] != '' ) { $text .= yit_image( "echo=no&src=". $instance['image'] ."&getimagesize=1&alt=" . $instance['title'] ); } if( isset( $instance[ 'link' ] ) && $instance['link'] != '' ) { $text .= '</a>'; } $localized_text = yit_wpml_string_translate( 'Widgets' , 'widget_text_yit_text_image' . sanitize_title( $instance['text'] ) , $instance['text'] ) ; $text .= '</div><div class="widget_text left">' . $localized_text; echo do_shortcode( $text ); echo '</div></div>'; echo $after_widget; }
function widget( $args, $instance ) { extract( $args ); $title = apply_filters('widget_title', $instance['title'] ); $title = str_replace( '[', '<span>', $title ); $title = str_replace( ']', '</span>', $title ); //string translation fix $clear_text = apply_filters( 'widget_text', yit_wpml_string_translate( 'Widgets', 'widget_icon_text_' . sanitize_title( $instance['text'] ), $instance['text'] ), $instance ); if ( preg_match( '/<span>/', $title ) ) $reverse_icon = true; else $reverse_icon = false; $icon = ''; if ( ! empty( $instance['img_url'] ) ) { $icon = "<img class=\"imgicon\" src=\"$instance[img_url]\" alt=\"\" />"; } else if ( ! empty( $instance['icon_img'] ) ) { $icon = "<i class=\"$instance[icon_img]"; if ( $reverse_icon ) $icon .= " reverse"; $icon .= "\"></i>"; } echo $before_widget; if( !empty( $instance['link'] ) ) echo '<a href="' . $instance['link'] . '" title="">' ?> <?php echo $icon; ?> <?php echo $before_title; echo $title; echo $after_title; ?> <p><?php echo do_shortcode( $clear_text ) ?></p> <?php if( !empty( $instance['link'] ) ) echo '</a>'; echo $after_widget; }