%PDF- %PDF-
| Direktori : /home/casasdemontanacr/www/wp-content/themes/enigma-premium/core/shortcodes/ |
| Current File : /home/casasdemontanacr/www/wp-content/themes/enigma-premium/core/shortcodes/shortcodes.php |
<?php
//get shortcodes pop-up editor == in the dashboard only, would be silly to load on the front end
if(defined('WP_ADMIN') && WP_ADMIN ) { require_once('shortcode_popup.php'); }
/*--button--*/
function parse_shortcode_content( $content ) {
/* Parse nested shortcodes and add formatting. */
$content = trim( do_shortcode( shortcode_unautop( $content ) ) );
/* Remove '' from the start of the string. */
if ( substr( $content, 0, 4 ) == '' )
$content = substr( $content, 4 );
/* Remove '' from the end of the string. */
if ( substr( $content, -3, 3 ) == '' )
$content = substr( $content, 0, -3 );
/* Remove any instances of ''. */
$content = str_replace( array( '<p></p>' ), '', $content );
$content = str_replace( array( '<p> </p>' ), '', $content );
return $content;
}
/*--------------------------------------*/
/* Row
/*--------------------------------------*/
function wl_shortcode_row($params, $content = null) {
extract(shortcode_atts(array(
'class' => ''
), $params));
$result = '<div class="row">';
$content = str_replace("]<br />", ']', $content);
$content = str_replace("<br />\n[", '[', $content);
$result .= do_shortcode($content);
$result .= '</div>';
return $result;
}
add_shortcode('row', 'wl_shortcode_row');
/*--------------------------------------*/
/* Columns
/*--------------------------------------*/
function wl_column_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'offset' =>'',
'size' => 'col-md-6',
//'position' =>'first'
), $atts ) );
$atts = shortcode_atts( array( 'offset' => '','size' => 'col-md-6'), $atts );
$out = '<div class="'.$size.'"><p>' . do_shortcode($content). '</p></div>';
return $out;
}
add_shortcode('column', 'wl_column_shortcode');
function wl_button_shortcode( $atts,$content = null ){
$atts = shortcode_atts(
array( 'style' => '',
'size' => 'small',
'target'=> 'self',
'url' => '#',
'textdata' => 'Button'
), $atts );
$size = $atts['size'];
$style = $atts['style'];
$url = $atts['url'];
$target = $atts['target'];
$target = ($target == 'blank') ? ' target="_blank"' : '';
$style = ($style) ? ' '.$style : '';
$out = '<a' .$target. ' class="' .$style.' '. $size.' " href="' .$url. '" target="' .$target. '">' .do_shortcode($content). '</a>';
return $out;
}
add_shortcode('button', 'wl_button_shortcode');
/*-----------Alert short code-----------*/
function wl_alert_shortcode( $atts, $content = null )
{
$atts = shortcode_atts( array(
'alert_heading' => 'Please enter alert heading',
'alert_text' => 'Please enter text in alert text',
'alert_style'=>'',
),$atts
);
$alert_heading = $atts['alert_heading'];
$alert_text = $atts['alert_text'];
$alert_style = $atts ['alert_style'];
$out='<div class="'.$alert_style.'"><button type="button" class="close" data-dismiss="alert">X</button>
<strong>'.$alert_heading.'</strong> '.$alert_text. do_shortcode($content).'</div><div class="space-sep20"></div>';
return $out;
}
add_shortcode( 'alert', 'wl_alert_shortcode' );
/*-----------Dropcap-----------*/
function wl_dropcp_shortcode( $atts, $content = null ){
$atts = shortcode_atts(array(
'dropcp_style'=>'enigma_dropcape_simple',
'dropcp_text'=>'hasellus leo dolor, tempus non, auctor et, hendrerit quis, nisi. Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet Vix sumo ferri an. pfs adodio fugit delenit ut qu.',
'dropcp_first_letter' => 'P',
'echo'=>false,
),
$atts );
$dropcp_text = $atts['dropcp_text'];
$dropcp_style = $atts ['dropcp_style'];
$dropcp_first_letter = $atts ['dropcp_first_letter'];
$out='<p class="'.$dropcp_style.'"><span class="first">'.$dropcp_first_letter.'</span>'.$dropcp_text.'</p>';
return $out;
}
add_shortcode( 'dropcap', 'wl_dropcp_shortcode' );
/******* heading shortcode **********/
function wl_heading_function ($atts , $content = null)
{
$atts= shortcode_atts(array (
'heading_style' => 'h1',
'title' => 'Heading'
),$atts );
$heading_style = $atts['heading_style'];
$title = $atts['title'];
$out ='<div class="enigma_heading_section"><'.$heading_style.'>'.$title.'</'.$heading_style.'></div>';
return $out;
}
add_shortcode('heading','wl_heading_function');
/*--------------------------------------*/
/* Accordian
/*--------------------------------------*/
function wl_accordion_shortcode( $atts, $content = null ) {
$atts = shortcode_atts( array(
'fields'=>'1',
'accordian_title' => 'Accordions title',
'accordian_text'=>'Accordions Description',
'echo'=>false,
),$atts
);
$fields = $atts['fields'];
$accordian_title = $atts['accordian_title'];
$title = explode(',', $accordian_title);
$accordian_text = $atts ['accordian_text'];
$text = explode(',', $accordian_text);
$rand = rand(1, 100);
$out ='';
$out .='<div class="enigma_accordion_section"><div id="accordion'.$rand.'" class="panel-group">';
for($i=1; $i<=$fields; $i++)
{ //$title[$i] = preg_replace("/__/", ',', $title[$i]);
//$text[$i] = preg_replace("/__/", ',', $text[$i]);
$changetitle = preg_replace('~[^A-Za-z\d\s-]+~u', 'wr', $title[$i]);
$changetitle = str_replace(' ', 'tt', $changetitle);
if($i=='1')
{ $out .='<div class="panel panel-default">
<div class="panel-heading">
<a data-toggle="collapse" data-parent="#accordion'.$rand.'" href="#'.$changetitle.'">'.$title[$i].'</a>
</div>
<div id="'.$changetitle.'" class="panel-collapse collapse in">
<div class="panel-body">
<p class="accordian_content">'.$text[$i].'</p>
</div>
</div>
</div>';
}
else{
$out .='<div class="panel panel-default">
<div class="panel-heading">
<a data-toggle="collapse" data-parent="#accordion'.$rand.'" href="#'.$changetitle.'">'.$title[$i].'</a>
</div>
<div id="'.$changetitle.'" class="panel-collapse collapse">
<div class="panel-body">
<p class="accordian_content">'.$text[$i].'</p>
</div>
</div>
</div>';
}
}
$out .='</div></div>';
return $out;
}
add_shortcode('accordian', 'wl_accordion_shortcode');
/*-----------Tabs short code-----------*/
if (!function_exists('wl_tabgroup')) {
function wl_tabgroup( $atts, $content = null )
{ $atts = shortcode_atts(array('tabs_title' => 'This is tabs heading','echo'=>false), $atts );
$tabs_title1 = $atts['tabs_title'];
// Extract the tab titles for use in the tab shortcode
preg_match_all( '/tabs_title="([^\"]+)"/i', $content, $matches, PREG_OFFSET_CAPTURE );
$tab_titles = array(); $wl_tabs_title =array();
if( isset($matches[1]) ){ $tab_titles = $matches[1]; }
$output = '<div class="enigma_tabs_section" id="enigma_tabs_section">';
if( count($tab_titles) )
{ $output .= '<ul class="nav nav-tabs" id="myTab-'.preg_replace('~[^A-Za-z\d\s-]+~u', 'wr', $tabs_title1).'">';
$count=0;
foreach( $tab_titles as $tabs_title )
{ if($count==0){
$wl_tabs_title[0] = str_replace(' ', 'wem', $tabs_title[0]);
$output .= '<li class="active" ><a data-toggle="tab" href="#'.preg_replace('~[^A-Za-z\d\s-]+~u', 'wr', $wl_tabs_title[0]).'">'.$tabs_title[0].'</a></li>';
} else {
$wl_tabs_title[0] = str_replace(' ', 'wl', $tabs_title[0]);
$output .= '<li class="" ><a data-toggle="tab" href="#'.preg_replace('~[^A-Za-z\d\s-]+~u', 'wr', $wl_tabs_title[0]).'">'.$tabs_title[0].'</a></li>';
}
$count++;
}
$output .= '</ul><div id="myTabContent" class="tab-content">';
$output .= do_shortcode( $content );
}
$output .= '</div></div>';
return $output;
}
add_shortcode( 'tabgroup', 'wl_tabgroup' );
}
function wl_tabs_shortcode($atts, $content = null ){
$atts = shortcode_atts(array('tabs_title' => 'This is tabs heading','tabs_text' => 'Description','wrap'=>'yes','echo'=>false), $atts );
$tabs_title = $atts['tabs_title'];
$tabs_text = $atts['tabs_text'];
$wrap = $atts['wrap'];
$wl_tabs_title = str_replace(' ', 'wem', $tabs_title);
static $c=0;
$out ='';
if($c==0 || $wrap=="yes")
{
$out .='<div id="'.preg_replace('~[^A-Za-z\d\s-]+~u', 'wl', $wl_tabs_title).'" class="tab-pane fade active in">';
}
else{
$out .='<div id="'.preg_replace('~[^A-Za-z\d\s-]+~u', 'wl', $wl_tabs_title).'" class="tab-pane fade">';
}
$c++;
$out .='<p class="enigma_short_tabs_content">'.$tabs_text.'</p>'.do_shortcode( $content ).'</div>';
return $out;
}
add_shortcode( 'tabs', 'wl_tabs_shortcode' );
/*-----------Alert short code-----------*/
/*-----------panel short code-----------*/
function wl_panle_shortcode( $atts, $content = null )
{
$atts = shortcode_atts( array(
'panel_heading' => 'Please enter panel heading',
'panel_text' => 'Please enter text in panel text',
'panel_color'=>'panel-default',
),$atts
);
$panel_heading = $atts['panel_heading'];
$panel_text = $atts['panel_text'];
$panel_color = $atts ['panel_color'];
$out='<div class="panel '.$panel_color.'">
<div class="panel-heading">'.$panel_heading.'</div>
<div class="panel-body">'.$panel_text.' </div>
</div>';
return $out;
}
add_shortcode('panel', 'wl_panle_shortcode' );
/*-----------PROGRESS BARSt code-----------*/
function wl_progressbar_shortcode( $atts, $content = null )
{
$atts = shortcode_atts( array(
'progress_heading' => 'Please enter progress heading',
'progress_percentag' => '85',
),$atts
);
$progress_heading = $atts['progress_heading'];
$progress_percentag = $atts['progress_percentag'];
$out='<div class="enigma_process">
<p>'.$progress_heading .' '. $progress_percentag.'%</p>
<div class="progress progress-striped ">
<div class="progress-bar" role="progressbar" aria-valuenow="'.$progress_percentag.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$progress_percentag.'%">
</div>
</div>
</div>';
return $out;
}
add_shortcode('progressbar', 'wl_progressbar_shortcode' );
/*----------- tooltip code-----------*/
function wl_tooltip_shortcode( $atts, $content = null )
{
$atts = shortcode_atts( array(
'tooltip_text' => 'tool tip Text',
'tooltip_over_text' => 'tool tip title',
'tooltip_style' => 'top',
), $atts );
$tooltip_text = $atts['tooltip_text'];
$tooltip_over_text = $atts['tooltip_over_text'];
$tooltip_style = $atts['tooltip_style'];
$out='<a href="#" data-original-title="'.$tooltip_over_text .'" title="" data-placement="'.$tooltip_style .'" data-toggle="tooltip" class="enigma_btn_small enigma_btn_white">'.$tooltip_text.'</a>';
return $out;
}
add_shortcode('tooltip', 'wl_tooltip_shortcode' );
/*----------- POPOVERS shortcode code-----------*/
function wl_popover_shortcode( $atts, $content = null )
{
$atts = shortcode_atts( array(
'popover_text' => 'Popover on top',
'popover_over_text' => 'Popover on top',
'popover_style' => 'top',
),$atts
);
$popover_text = $atts['popover_text'];
$popover_over_text = $atts['popover_over_text'];
$popover_style = $atts['popover_style'];
$out='<button class="enigma_btn_small enigma_btn_white" data-toggle="popover" data-placement="'.$popover_style .'" title="" data-content="'.$popover_over_text .'" >'.$popover_text .'</button>';
return $out;
}
add_shortcode('popover', 'wl_popover_shortcode' );
?>