Example #1
0
function wpsight_currency_converter_shortcode($atts)
{
    $defaults = array('id' => '', 'before' => '', 'after' => '', 'wrap' => 'div');
    extract(shortcode_atts($defaults, $atts));
    // Build shortcode location
    $location = !empty($id) ? $id : 'shortcode';
    // Get currency select
    $converter = new wpSight_Currency();
    $currency_select = $converter->wpsight_currency_selector($location);
    // Create shortcode output
    $output = sprintf('<%5$s class="currency-converter-%4$s">%1$s%3$s%2$s</%5$s>', $before, $after, $currency_select, $location, $wrap);
    return apply_filters('wpsight_currency_converter_shortcode', $output, $atts);
}
Example #2
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $title = isset($instance['title']) ? strip_tags($instance['title']) : false;
        $before = isset($instance['before']) ? wp_kses_post($instance['before']) : false;
        $after = isset($instance['after']) ? wp_kses_post($instance['after']) : false;
        $converter = new wpSight_Currency();
        $notitle = empty($title) ? ' no-title' : '';
        ?>
        
		<div id="<?php 
        echo wpcasa_dashes($widget_id);
        ?>
-wrap" class="widget-wrap widget-currency-converter-wrap<?php 
        echo $notitle;
        ?>
">
		
		    <div id="<?php 
        echo wpcasa_dashes($widget_id);
        ?>
" class="widget widget-currency-converter clearfix">
		    
		    	<div class="widget-inner"><?php 
        if (!empty($title)) {
            echo '<h3 class="title">' . $title . '</h3>';
        }
        $currency_select = '';
        if (!empty($before)) {
            $currency_select .= '<span class="select-currency-before">' . $before . '</span>';
        }
        $currency_select .= $converter->wpsight_currency_selector('widget');
        if (!empty($after)) {
            $currency_select .= '<span class="select-currency-after">' . $after . '</span>';
        }
        echo $currency_select;
        ?>
		
		    	</div><!-- .widget-inner -->
		    	
		    </div><!-- .widget -->
		    
		</div><!-- .widget-wrap --><?php 
    }