Ejemplo n.º 1
0
function compare_button_func($atts, $content)
{
    extract(shortcode_atts(array('text' => '', 'link' => '', 'target' => '', 'bg_color' => '', 'bg_color_hvr' => '', 'border_radius' => '', 'icon' => '', 'font_color' => '', 'font_color_hvr' => '', 'size' => 'normal', 'align' => '', 'btn_width' => 'normal', 'inline' => 'no', 'margin' => ''), $atts));
    $rnd = compare_random_string();
    $style_css = '
	<style>
		a.' . $rnd . ', a.' . $rnd . ':active, a.' . $rnd . ':visited, a.' . $rnd . ':focus{
			display: ' . ($btn_width == 'normal' ? 'inline-block' : 'block') . ';
			' . (!empty($bg_color) ? 'background-color: ' . $bg_color . ';' : '') . '
			' . (!empty($font_color) ? 'color: ' . $font_color . ';' : '') . '
			' . (!empty($border_radius) ? 'border-radius: ' . $border_radius : '') . '
		}
		a.' . $rnd . ':hover{
			display: ' . ($btn_width == 'normal' ? 'inline-block' : 'block') . ';
			' . (!empty($bg_color_hvr) ? 'background-color: ' . $bg_color_hvr . ';' : '') . '
			' . (!empty($font_color_hvr) ? 'color: ' . $font_color_hvr . ';' : '') . '
		}		
	</style>
	';
    return compare_shortcode_style($style_css) . '
	<div class="btn-wrap" style="margin: ' . esc_attr($margin) . '; text-align: ' . $align . '; ' . ($inline == 'yes' ? 'display: inline-block;' : '') . ' ' . ($inline == 'yes' && $align == 'right' ? 'float: right;' : '') . '">
		<a href="' . esc_url($link) . '" class="btn btn-default ' . $size . ' ' . $rnd . ' ' . ($link != '#' && $link[0] == '#' ? 'slideTo' : '') . '" target="' . esc_attr($target) . '">
			' . ($icon != 'No Icon' && $icon != '' ? '<i class="fa fa-' . $icon . ' ' . (empty($text) ? 'no-margin' : '') . '"></i>' : '') . '
			' . $text . '
		</a>
	</div>';
}
Ejemplo n.º 2
0
function compare_tabs_func($atts, $content)
{
    extract(shortcode_atts(array('titles' => '', 'contents' => ''), $atts));
    $titles = explode("/n/", $titles);
    $contents = explode("/n/", $contents);
    $titles_html = '';
    $contents_html = '';
    $random = compare_random_string();
    if (!empty($titles)) {
        for ($i = 0; $i < sizeof($titles); $i++) {
            $titles_html .= '<li role="presentation" class="' . ($i == 0 ? 'active' : '') . '"><a href="#tab_' . $i . '_' . $random . '" role="tab" data-toggle="tab">' . $titles[$i] . '</a></li>';
            $contents_html .= '<div role="tabpanel" class="tab-pane fade ' . ($i == 0 ? 'in active' : '') . '" id="tab_' . $i . '_' . $random . '">' . (!empty($contents[$i]) ? apply_filters('the_content', $contents[$i]) : '') . '</div>';
        }
    }
    return '
	<!-- Nav tabs -->
	<ul class="nav nav-tabs shortcode" role="tablist">
	  ' . $titles_html . '
	</ul>

	<!-- Tab panes -->
	<div class="tab-content shortcode">
	  ' . $contents_html . '
	</div>';
}
Ejemplo n.º 3
0
function compare_iframe_func($atts, $content)
{
    extract(shortcode_atts(array('link' => '', 'proportion' => ''), $atts));
    $random = compare_random_string();
    return '
		<div class="embed-responsive embed-responsive-' . $proportion . '">
		  <iframe class="embed-responsive-item" src="' . esc_url($link) . '"></iframe>
		</div>';
}
Ejemplo n.º 4
0
function compare_alert_func($atts, $content)
{
    extract(shortcode_atts(array('text' => '', 'border_color' => '', 'bg_color' => '', 'font_color' => '', 'icon' => '', 'closeable' => 'no', 'close_icon_color' => '', 'close_icon_color_hvr' => ''), $atts));
    $rnd = compare_random_string();
    $style_css = '
		<style>
			.' . $rnd . '.alert .close{
				color: ' . $close_icon_color . ';
			}
			.' . $rnd . '.alert .close:hover{
				color: ' . $close_icon_color_hvr . ';
			}
		</style>
	';
    return compare_shortcode_style($style_css) . '
	<div class="alert ' . $rnd . ' alert-default ' . ($closeable == 'yes' ? 'alert-dismissible' : '') . '" role="alert" style=" color: ' . $font_color . '; border-color: ' . $border_color . '; background-color: ' . $bg_color . ';">
		' . (!empty($icon) && $icon !== 'No Icon' ? '<i class="fa fa-' . $icon . '"></i>' : '') . '
		' . $text . '
		' . ($closeable == 'yes' ? '<button type="button" class="close" data-dismiss="alert"> <span aria-hidden="true">×</span> <span class="sr-only">' . __('Close', 'compare') . '</span> </button>' : '') . '
	</div>';
}
Ejemplo n.º 5
0
function compare_toggle_func($atts, $content)
{
    extract(shortcode_atts(array('title' => '', 'toggle_content' => '', 'state' => ''), $atts));
    $rnd = compare_random_string();
    return '
		<div class="panel-group shortcode" id="accordion_' . $rnd . '" role="tablist" aria-multiselectable="true">
		  <div class="panel panel-default">
		    <div class="panel-heading" role="tab" id="heading_' . $rnd . '">
		      <div class="panel-title">
		        <a class="' . ($state == 'in' ? '' : 'collapsed') . '" data-toggle="collapse" data-parent="#accordion_' . $rnd . '" href="#coll_' . $rnd . '" aria-expanded="true" aria-controls="coll_' . $rnd . '">
		        	' . $title . '
		        	<i class="fa fa-chevron-circle-down animation"></i>
		        </a>
		      </div>
		    </div>
		    <div id="coll_' . $rnd . '" class="panel-collapse collapse ' . $state . '" role="tabpanel" aria-labelledby="heading_' . $rnd . '">
		      <div class="panel-body">
		        ' . apply_filters('the_content', $toggle_content) . '
		      </div>
		    </div>
		  </div>
		</div>';
}
Ejemplo n.º 6
0
function compare_accordion_func($atts, $content)
{
    extract(shortcode_atts(array('titles' => '', 'contents' => ''), $atts));
    $titles = explode("/n/", $titles);
    $contents = explode("/n/", $contents);
    $titles_html = '';
    $contents_html = '';
    $rnd = compare_random_string();
    $html = '';
    if (!empty($titles)) {
        for ($i = 0; $i < sizeof($titles); $i++) {
            if (!empty($titles[$i])) {
                $html .= '
				  <div class="panel panel-default">
				    <div class="panel-heading" role="tab" id="heading_' . $i . '">
				      <div class="panel-title">
				        <a class="' . ($i !== 0 ? 'collapsed' : '') . '" data-toggle="collapse" data-parent="#accordion_' . $rnd . '" href="#coll_' . $i . '_' . $rnd . '" aria-expanded="true" aria-controls="coll_' . $i . '_' . $rnd . '">
				        	' . $titles[$i] . '
				        	<i class="fa fa-chevron-circle-down animation"></i>
				        </a>
				      </div>
				    </div>
				    <div id="coll_' . $i . '_' . $rnd . '" class="panel-collapse collapse ' . ($i == 0 ? 'in' : '') . '" role="tabpanel" aria-labelledby="heading_' . $i . '">
				      <div class="panel-body">
				        ' . (!empty($contents[$i]) ? apply_filters('the_content', $contents[$i]) : '') . '
				      </div>
				    </div>
				  </div>
				';
            }
        }
    }
    return '
		<div class="panel-group shortcode" id="accordion_' . $rnd . '" role="tablist" aria-multiselectable="true">
		' . $html . '
		</div>';
}
Ejemplo n.º 7
0
function compare_progressbar_func($atts, $content)
{
    extract(shortcode_atts(array('label' => '', 'value' => '', 'color' => '', 'bgcolor' => '', 'label_color' => '', 'height' => '', 'font_size' => '', 'icon' => '', 'border_radius' => '', 'style' => ''), $atts));
    $rnd = compare_random_string();
    $style_css = '
	<style>
		.' . $rnd . '{
			' . (!empty($label_color) ? 'color: ' . $label_color . ';' : '') . '
			' . (!empty($border_radius) ? 'border-radius: ' . $border_radius . ';' : '') . '
			' . (!empty($height) ? 'height: ' . $height . ';' : '') . '
			' . (!empty($bgcolor) ? 'background-color: ' . $bgcolor . ';' : '') . '
		}

		.' . $rnd . ' .progress-bar{
			' . (!empty($font_size) ? 'font-size: ' . $font_size . ';' : '') . '
			' . (!empty($height) ? 'line-height: ' . $height . ';' : '') . '
			' . (!empty($color) ? 'background-color: ' . $color . ';' : '') . '
		}

		.' . $rnd . ' .progress-bar-value{
			' . (!empty($color) ? 'background-color: ' . $color . ';' : '') . '
			' . (!empty($label_color) ? 'color: ' . $label_color . ';' : '') . '
		}

		.' . $rnd . ' .progress-bar-value:after{
			' . (!empty($color) ? 'border-color: ' . $color . ' transparent;' : '') . '
		}
	</style>
	';
    return compare_shortcode_style($style_css) . '
	<div class="progress ' . $rnd . '">
	  <div class="progress-bar ' . $style . '" style="width: ' . esc_attr($value) . '%" role="progressbar" aria-valuenow="' . $value . '" aria-valuemin="0" aria-valuemax="100">
	  		<div class="progress-bar-value">' . $value . '%</div>
	  		' . (!empty($icon) ? '<i class="fa fa-' . $icon . '"></i>' : '') . '' . $label . '
	  </div>
	</div>';
}
Ejemplo n.º 8
0
    public function widget($args, $instance)
    {
        extract($args);
        $title = empty($instance['title']) ? '' : $instance['title'];
        $menu = empty($instance['menu']) ? '' : $instance['menu'];
        $columns = empty($instance['columns']) ? '' : $instance['columns'];
        $rnd = compare_random_string();
        $menu = wp_get_nav_menu_items($menu);
        echo $before_widget . $before_title . $title . $after_title . '<div class="white-block-content">';
        if (!empty($menu)) {
            $style = '<style>
			.list_' . $rnd . '{
				columns: ' . $columns . ';
				-moz-columns: ' . $columns . ';
				-webkit-columns: ' . $columns . ';
				-ms-columns: ' . $columns . ';
				-o-columns: ' . $columns . ';
			}
			</style>';
            echo compare_shortcode_style($style) . '<ul class="list-unstyled list_' . $rnd . '">';
            foreach ($menu as $menu_item) {
                ?>
				<li>
					<a href="<?php 
                echo esc_url($menu_item->url);
                ?>
">
						<?php 
                echo esc_html($menu_item->title);
                ?>
					</a>
				</li>
				<?php 
            }
            echo '</ul>';
        }
        echo '</div>' . $after_widget;
    }