ACC SHELL

Path : /srv/www/vhosts/rozzo/wp-content/themes/amplius/shortcodes/
File Upload :
Current File : //srv/www/vhosts/rozzo/wp-content/themes/amplius/shortcodes/shortcodes.php

<?php

	add_filter("the_content", "coffee_shortcodes_filter");
	function coffee_shortcodes_filter($content) {
	
		$block = join("|",array("coffee_shortcode_feature", "coffee_shortcode_button", "coffee_shortcode_bar", "coffee_shortcode_pricing", "coffee_shortcode_pricing_tab", "coffee_shortcode_heading", "coffee_shortcode_list", "coffee_shortcode_column", "coffee_shortcode_accordion", "coffee_shortcode_accordion_section", "coffee_shortcode_toggle", "coffee_shortcode_toggle_section", "coffee_shortcode_tabs", "coffee_shortcode_tab"));
		$rep = preg_replace("/(<p>)?\[($block)(\s[^\]]+)?\](<\/p>|<br \/>)?/","[$2$3]",$content);		
		$rep = preg_replace("/(<p>)?\[\/($block)](<\/p>|<br \/>)?/","[/$2]",$rep);
		return $rep; 
		
	}
	
	if (!function_exists('coffee_shortcode_column')) {
		
		function coffee_shortcode_column( $atts, $content = null ) {
			extract(
				shortcode_atts(
					array(
						'column' => 'one-one',
						'last_column' => 'false',
					), $atts
				)
			);
			$after_shortcode = '';
			if ($last_column == 'true' || $column == 'one-one') { $after_shortcode ="<div class='coffee-shortcode coffee-shortcode-clearfix'></div>"; }
			if ($last_column == 'true') { $last_column =' coffee-column-last'; } else { $last_column=''; }
			return 
			'<div class="coffee-column coffee-column-'.$column.$last_column.' clearfix">'.do_shortcode($content).'</div>'.$after_shortcode;			
		}
		add_shortcode('coffee_shortcode_column', 'coffee_shortcode_column');
		
	}

	if (!function_exists('coffee_shortcode_feature')) {
		
		function coffee_shortcode_feature( $atts, $content = null ) {
			extract(
				shortcode_atts(
					array(
						'column' => 'one-one',	
						'last_column' => 'false',
						'icon' => 'icon-star-empty',
						'title' => 'Sample Title',
						'colour' => 'turquoise'
					), $atts
				)
			);
			$after_shortcode = '';
			if ($last_column == 'true' || $column == 'one-one') { $after_shortcode ="<div class='coffee-shortcode coffee-shortcode-clearfix'></div>"; }
			if ($last_column == 'true') { $last_column =' coffee-column-last'; } else { $last_column=''; }
			return 
			'<div class="coffee-column coffee-column-'.$column.$last_column.' clearfix">
				<div class="coffee-shortcode coffee-shortcode-feature clearfix '.$colour.'">
					<div class="feature-icon">
						<i class="'.$icon.'"></i>
					</div>
					<div class="feature-title heading-font">'.$title.'</div>
					<div class="feature-content">'.do_shortcode($content).'</div>
				</div>
			</div>'.$after_shortcode;			
		}
		add_shortcode('coffee_shortcode_feature', 'coffee_shortcode_feature');
		
	}
	
	if (!function_exists('coffee_shortcode_button')) {
		
		function coffee_shortcode_button( $atts, $content = null ) {
			extract(
				shortcode_atts(
					array(
						'title' => 'Sample Button',
						'link' => '#',
						'target' => '_blank',
						'icon' => 'icon-heart',
						'colour' => 'turquoise'
					), $atts
				)
			);
			return '<a class="coffee-shortcode coffee-shortcode-button heading-font '.$colour.'" target="'.$target.'" href="'.$link.'" title="'.$title.'"><i class="'.$icon.'"></i>'.do_shortcode($content).'</a>';			
		}
		add_shortcode('coffee_shortcode_button', 'coffee_shortcode_button');
		
	}
	
	if (!function_exists('coffee_shortcode_bar')) {
		
		function coffee_shortcode_bar( $atts, $content = null ) {
			extract(
				shortcode_atts(
					array(
						'title' => 'Sample Bar',
						'percentage' => '50',
						'colour' => 'turquoise'
					), $atts
				)
			);
			return '<div class="coffee-shortcode coffee-shortcode-bar heading-font clearfix"><div class="bar-inner '.$colour.'" style="width: '.$percentage.'%;"><span class="bar-title">'.$title.'</span><span class="bar-percentage">'.$percentage.'%</span></div></div>';			
		}
		add_shortcode('coffee_shortcode_bar', 'coffee_shortcode_bar');
		
	}
	
	if (!function_exists('coffee_shortcode_pricing')) {
		
		function coffee_shortcode_pricing( $atts, $content = null ) {
			extract(
				shortcode_atts(
					array(
						'column' => 'one-one',	
						'last_column' => 'false',
						'title' => 'Sample Title',
						'price' => '50$',
						'price_per' => 'Per Month',
						'colour' => 'turquoise',
						'featured' => 'clear'
					), $atts
				)
			);
			$after_shortcode = '';
			if ($last_column == 'true'|| $column == 'one-one') { $after_shortcode ="<div class='coffee-shortcode coffee-shortcode-clearfix'></div>"; }
			if ($last_column == 'true') { $last_column =' coffee-column-last'; } else { $last_column=''; }
			if ($featured == 'clear') {$featured = '';} elseif ($featured == 'true') { $featured =' featured'; } elseif ($featured == 'false'){ $featured=' no-featured'; } 
			return 
			'<div class="coffee-column coffee-column-'.$column.$last_column.' clearfix">
				<div class="coffee-shortcode coffee-shortcode-pricing clearfix'.$featured.'">
					<div class="pricing-header heading-font">
						<div class="pricing-header-title '.$colour.'">'.$title.'</div>
						<div class="pricing-header-price"><span class="price">'.$price.'</span><span class="price_per">'.$price_per.'</span></div>
					</div>					
					<ul class="pricing-list">'.do_shortcode($content).'</ul>
				</div>
			</div>'.$after_shortcode;			
		}
		add_shortcode('coffee_shortcode_pricing', 'coffee_shortcode_pricing');
		
	}

	if (!function_exists('coffee_shortcode_pricing_tab')) {
		
		function coffee_shortcode_pricing_tab( $atts, $content = null ) {
			return '<li class="pricing-tab clearfix">'. do_shortcode($content) .'</li>';
		}
		add_shortcode('coffee_shortcode_pricing_tab', 'coffee_shortcode_pricing_tab');
		
	}

	if (!function_exists('coffee_shortcode_heading')) {
		
		function coffee_shortcode_heading( $atts, $content = null ) {
			extract(
				shortcode_atts(
					array(
						'heading' => 'h1'
					), $atts
				)
			);
			return '<div class="coffee-shortcode coffee-shortcode-heading"><'.$heading.'>'.do_shortcode($content).'</'.$heading.'></div>';			
		}
		add_shortcode('coffee_shortcode_heading', 'coffee_shortcode_heading');
		
	}

	if (!function_exists('coffee_shortcode_list')) {
		
		function coffee_shortcode_list( $atts, $content = null ) {
			extract(
				shortcode_atts(
					array(
						'icon' => 'icon-heart',
						'colour' => 'turquoise'						
					), $atts
				)
			);
			$items_array = array();
			$items_str = '';
  			preg_match_all ("/\\[coffee_shortcode_list_item\\](.*?)\\[\\/coffee_shortcode_list_item\\]/is", $content, $items_array);
						
			foreach($items_array[1] as &$item){
				$items_str .= '<li><i class="'.$icon.'"></i><p>'.$item.'</p></li>';
			}
			
			return '<ul class="coffee-shortcode coffee-shortcode-list '.$colour.'">'.$items_str.'</ul>';			
		}
		add_shortcode('coffee_shortcode_list', 'coffee_shortcode_list');		
		
	}
	
	if (!function_exists('coffee_shortcode_accordion')) {
		
		function coffee_shortcode_accordion( $atts, $content = null ) {
			extract(
				shortcode_atts(
					array(
						'column' => 'one-one',	
						'last_column' => 'false'					
					), $atts
				)
			);
			$after_shortcode = '';
			if ($last_column == 'true' || $column == 'one-one') { $after_shortcode ="<div class='coffee-shortcode coffee-shortcode-clearfix'></div>"; }
			if ($last_column == 'true') { $last_column =' coffee-column-last'; } else { $last_column=''; }
						
			return '
			<div class="coffee-column coffee-column-'.$column.$last_column.' clearfix">
				<div class="coffee-shortcode coffee-shortcode-accordion">'.do_shortcode($content).'</div>
			</div>'.$after_shortcode;	
		}
		add_shortcode('coffee_shortcode_accordion', 'coffee_shortcode_accordion');		
		
	}
	
	if (!function_exists('coffee_shortcode_accordion_section')) {
		
		function coffee_shortcode_accordion_section( $atts, $content = null ) {
			extract(
				shortcode_atts(
					array(
						'title' => 'Sample Title',		
					), $atts
				)
			);
			
			return '<div class="coffee-accordion-title heading-font"><a href="#"><i class="icon-plus-sign"></i><i class="icon-minus-sign"></i>'. $title .'</a></div><div class="ui-accordion-content">' . do_shortcode($content) . '</div>';

		}
		add_shortcode('coffee_shortcode_accordion_section', 'coffee_shortcode_accordion_section');		
		
	}	
	
	if (!function_exists('coffee_shortcode_toggle')) {
		
		function coffee_shortcode_toggle( $atts, $content = null ) {
			extract(
				shortcode_atts(
					array(
						'column' => 'one-one',	
						'last_column' => 'false	'				
					), $atts
				)
			);
			$after_shortcode = '';
			if ($last_column == 'true' || $column == 'one-one') { $after_shortcode ="<div class='coffee-shortcode coffee-shortcode-clearfix'></div>"; }
			if ($last_column == 'true') { $last_column =' coffee-column-last'; } else { $last_column=''; }
						
			return '	<div class="coffee-column coffee-column-'.$column.$last_column.' clearfix"><div class="coffee-shortcode coffee-shortcode-toggle">'.do_shortcode($content).'</div></div>'.$after_shortcode;	
		}
		add_shortcode('coffee_shortcode_toggle', 'coffee_shortcode_toggle');		
		
	}
	
	if (!function_exists('coffee_shortcode_toggle_section')) {
		
		function coffee_shortcode_toggle_section( $atts, $content = null ) {
			extract(
				shortcode_atts(
					array(
						'title' => 'Sample Title',	
						'state' => 'closed'	
					), $atts
				)
			);
			$style = '';
			if ($state == 'closed'){$style = 'style="display: none;"'; }
			return '<div data-id="'.$state.'" class="coffee-shortcode-toggle-section"><div class="coffee-toggle-title heading-font"><a href="#"><i class="icon-plus-sign"></i><i class="icon-minus-sign"></i>'. $title .'</a></div><div class="ui-accordion-content" '.$style.'>' . do_shortcode($content) . '</div></div>';

		}
		add_shortcode('coffee_shortcode_toggle_section', 'coffee_shortcode_toggle_section');		
		
	}	
	
	if (!function_exists('coffee_shortcode_tabs')) {
		
		function coffee_shortcode_tabs( $atts, $content = null ) {
			extract(
				shortcode_atts(
					array(
						'column' => 'one-one',	
						'last_column' => 'false	'				
					), $atts
				)
			);
			
			$after_shortcode = '';
			if ($last_column == 'true' || $column == 'one-one') { $after_shortcode ="<div class='coffee-shortcode coffee-shortcode-clearfix'></div>"; }
			if ($last_column == 'true') { $last_column =' coffee-column-last'; } else { $last_column=''; }			
			
			$titles = '';
			$list = array_filter(explode('[coffee_shortcode_tab title="', $content));
			foreach($list as &$title){
				$title = substr($title, 0, strpos($title, '"]'));
				if($title){
					$titles .= '<li class="heading-font"><a href="#coffee-tab-'.sanitize_title($title).'">'.$title.'</a></li>';
				}
			}
			return '	
			
			<div class="coffee-column coffee-column-'.$column.$last_column.' clearfix">
				<div class="coffee-shortcode coffee-shortcode-tabs">
					<ul class="tabs-nav">'.$titles.'</ul><div class="tabs-content">'
					.do_shortcode($content).
				'</div></div>
			</div>'.$after_shortcode;	
			
		}
		add_shortcode('coffee_shortcode_tabs', 'coffee_shortcode_tabs');		
		
	}
	
	if (!function_exists('coffee_shortcode_tab')) {
		
		function coffee_shortcode_tab( $atts, $content = null ) {
			extract(
				shortcode_atts(
					array(
						'title' => 'Sample Title',				
					), $atts
				)
			);
			return '	
			
			<div id="coffee-tab-'. sanitize_title( $title ) .'" class="tab-content clearfix">'.do_shortcode($content).'</div>';	
			
		}
		add_shortcode('coffee_shortcode_tab', 'coffee_shortcode_tab');		
		
	}
		
?>

ACC SHELL 2018