HEX
Server: Apache/2.4.49 (FreeBSD) OpenSSL/1.0.2s-freebsd PHP/5.6.36
System: FreeBSD hosting.icon.bg 11.3-RELEASE-p13 FreeBSD 11.3-RELEASE-p13 #0: Tue Sep 1 06:56:51 UTC 2020 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
User: ftpuser (1002)
PHP: 5.6.36
Disabled: NONE
Upload Files
File: /hosting/kak.bg/web/wp-content/themes/Primero/shortcodes.php
<?php
//////////////////////////////////////////////////////////////////
// Raw Shortcode
//////////////////////////////////////////////////////////////////
function my_formatter($content) {
	$new_content = '';
	$pattern_full = '{(\[raw\].*?\[/raw\])}is';
	$pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
	$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);

	foreach ($pieces as $piece) {
		if (preg_match($pattern_contents, $piece, $matches)) {
			$new_content .= $matches[1];
		} else {
			$new_content .= wptexturize(wpautop($piece));
		}
	}

	return $new_content;
}

remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');

add_filter('the_content', 'my_formatter', 99);
	
//////////////////////////////////////////////////////////////////
// Button shortcode
//////////////////////////////////////////////////////////////////
add_shortcode('button', 'shortcode_button');
	function shortcode_button($atts, $content = null) {
		$atts = shortcode_atts(
			array(
				'color' => '',
				'link' => '#',
				'target' => '',
			), $atts);
			
			if($atts['color'] == 'light') {
				$class = 'button';
			} else {
				$class = 'big-button';
			}
		
			return '[raw]<span><a href="' . $atts['link'] . '" target="' . $atts['target'] . '" class="' . $class . '">' .do_shortcode($content). '</a></span>[/raw]';
	}
	
//////////////////////////////////////////////////////////////////
// Check list shortcode
//////////////////////////////////////////////////////////////////
add_shortcode('checklist', 'shortcode_checklist');
	function shortcode_checklist( $atts, $content = null ) {
	
	$content = str_replace('<ul>', '<ul class="checkmark">', do_shortcode($content));
	$content = str_replace('<li>', '<li>', do_shortcode($content));
	
	return $content;
	
}

//////////////////////////////////////////////////////////////////
// Arrow list shortcode
//////////////////////////////////////////////////////////////////
add_shortcode('arrowlist', 'shortcode_badlist');
	function shortcode_badlist( $atts, $content = null ) {
	
	$content = str_replace('<ul>', '<ul class="arrow">', do_shortcode($content));
	$content = str_replace('<li>', '<li>', do_shortcode($content));
	
	return $content;
	
}
	
//////////////////////////////////////////////////////////////////
// Column one_half shortcode
//////////////////////////////////////////////////////////////////
add_shortcode('one_half', 'shortcode_one_half');
	function shortcode_one_half($atts, $content = null) {
		$atts = shortcode_atts(
			array(
				'last' => 'no',
			), $atts);
			
			if($atts['last'] == 'yes') {
				return '<div class="grid2column lastcolumn">' .do_shortcode($content). '</div><div class="clearboth"></div>';
			} else {
				return '<div class="grid2column">' .do_shortcode($content). '</div>';
			}

	}
	
//////////////////////////////////////////////////////////////////
// Column one_third shortcode
//////////////////////////////////////////////////////////////////
add_shortcode('one_third', 'shortcode_one_third');
	function shortcode_one_third($atts, $content = null) {
		$atts = shortcode_atts(
			array(
				'last' => 'no',
			), $atts);
			
			if($atts['last'] == 'yes') {
				return '<div class="grid3column lastcolumn">' .do_shortcode($content). '</div><div class="clearboth"></div>';
			} else {
				return '<div class="grid3column">' .do_shortcode($content). '</div>';
			}

	}
	
//////////////////////////////////////////////////////////////////
// Column two_third shortcode
//////////////////////////////////////////////////////////////////
add_shortcode('two_third', 'shortcode_two_third');
	function shortcode_two_third($atts, $content = null) {
		$atts = shortcode_atts(
			array(
				'last' => 'no',
			), $atts);
			
			if($atts['last'] == 'yes') {
				return '<div class="grid3columnbigcolumn lastcolumn">' .do_shortcode($content). '</div><div class="clearboth"></div>';
			} else {
				return '<div class="grid3columnbigcolumn">' .do_shortcode($content). '</div>';
			}

	}
	
//////////////////////////////////////////////////////////////////
// Column one_fourth shortcode
//////////////////////////////////////////////////////////////////
add_shortcode('one_fourth', 'shortcode_one_fourth');
	function shortcode_one_fourth($atts, $content = null) {
		$atts = shortcode_atts(
			array(
				'last' => 'no',
			), $atts);
			
			if($atts['last'] == 'yes') {
				return '<div class="grid4column lastcolumn">' .do_shortcode($content). '</div><div class="clearboth"></div>';
			} else {
				return '<div class="grid4column">' .do_shortcode($content). '</div>';
			}

	}
	
//////////////////////////////////////////////////////////////////
// Column three_fourth shortcode
//////////////////////////////////////////////////////////////////
add_shortcode('three_fourth', 'shortcode_three_fourth');
	function shortcode_three_fourth($atts, $content = null) {
		$atts = shortcode_atts(
			array(
				'last' => 'no',
			), $atts);
			
			if($atts['last'] == 'yes') {
				return '<div class="grid4columnbig lastcolumn">' .do_shortcode($content). '</div><div class="clearboth"></div>';
			} else {
				return '<div class="grid4columnbig">' .do_shortcode($content). '</div>';
			}

	}
	
//////////////////////////////////////////////////////////////////
// Slider shortcode
//////////////////////////////////////////////////////////////////
add_shortcode('slider', 'shortcode_slider');
	function shortcode_slider($atts, $content = null) {
		$html .= '<div id="slider-inside-wrapper">';
		$html .= '<div id="slider-inside" class="nivoSlider">';
		$html .= do_shortcode($content);
		$html .= '</div>';
		$html .= '</div>';
		$html .= "
			<script type='text/javascript'>
			jQuery(window).load(function() {
			    jQuery('#slider-inside').nivoSlider({
			        effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
			        animSpeed:500, //Slide transition speed
			        pauseTime:".$atts['pausetime'].",
			        startSlide:0, //Set starting Slide (0 index)
			        directionNav:".$atts['directionnav'].", //Next & Prev
			        directionNavHide:true, //Only show on hover
			        controlNav:".$atts['controlthumbnails'].", //1,2,3...
			        controlNavThumbs:false, //Use thumbnails for Control Nav
			        controlNavThumbsFromRel:false, //Use image rel for thumbs
			        controlNavThumbsSearch: '.jpg', //Replace this with...
			        controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
			        keyboardNav:true, //Use left & right arrows
			        pauseOnHover:true, //Stop animation while hovering
			        manualAdvance:".$atts['manualplay'].", //Force manual transitions
			        captionOpacity:0.8, //Universal caption opacity
			        beforeChange: function(){},
			        afterChange: function(){},
			        slideshowEnd: function(){}, //Triggers after all slides have been shown
			        lastSlide: function(){}, //Triggers when last slide is shown
			        afterLoad: function(){} //Triggers when slider has loaded
			    });
			});
			</script>
		";
		return $html;
	}
	
add_shortcode('slide', 'shortcode_slide');
	function shortcode_slide($atts, $content = null) {
		$html .= '<img src="'.$atts['img'].'" alt="'.$atts['caption'].'" title="'.$atts['caption'].'" />';
		
		return $html;
	}
	
	
add_shortcode('slide2', 'shortcode_slider2');
	function shortcode_slider2($atts, $content = null) {
		$html .= '<ul id="slider">';
		$html .= '<li>';
		$html .= do_shortcode($content);
		$html .= '</li>';
		$html .= '</ul>';
		$html .= "
			<script type='text/javascript'>
		jQuery(document).ready(function($) {
			$('#slider').anythingSlider({
				delay               : 3000,      // How long between slideshow transitions in AutoPlay mode (in milliseconds)
				animationTime       : 400,       // How long the slideshow transition takes (in milliseconds)
				buildArrows         : false,      // If true, builds the forwards and backwards buttons
				buildNavigation     : true,      // If true, buildsa list of anchor links to link to each panel
				autoPlay            : false,      // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
				hashTags            : false,      // Should links change the hashtag in the URL?
				resizeContents      : false,
				addWmodeToObject    : 'transparent',
				startStopped        : false,     // If autoPlay is on, this can force it to start stopped
				pauseOnHover        : true,      // If true & the slideshow is active, the slideshow will pause on hover
				resumeOnVideoEnd    : true      // If true & the slideshow is active & a youtube video is playing, it will pause the autoplay until the video has completed
			});
		});
		</script>
		";
		return $html;
	}
	
add_shortcode('slide2', 'shortcode_slide2');
	function shortcode_slide2($atts, $content = null) {
		$html .= '<img src="'.$atts['img'].'" alt="'.$atts['caption'].'" title="'.$atts['caption'].'" />';
		
		return $html;
	}	
	
//////////////////////////////////////////////////////////////////
// Add Tabs shortcode
//////////////////////////////////////////////////////////////////	
	
add_shortcode( 'tabgroup', 'jqtools_tab_group' );
function jqtools_tab_group( $atts, $content ){
	$GLOBALS['tab_count'] = 0;

	do_shortcode( $content );

	if( is_array( $GLOBALS['tabs'] ) ){
		$counter=1;
		foreach( $GLOBALS['tabs'] as $tab ){
			$tabs[] = '<li><a href="#tab'.$counter.'">'.$tab['title'].'</a></li>';
			$panes[] = '<div id="tab'.$counter.'">'.$tab['content'].'</div>';
			$counter++;
		}
		$return = "".'<div class="tabs"><ul class="tabNavigation">'.implode( "\n", $tabs ).'<div class="clearfix"></div></ul>'."\n".implode( "\n", $panes ).''."\n</div>".'<div class="clearfix"></div>';
	}
	return $return;
}

add_shortcode( 'tab', 'jqtools_tab' );
function jqtools_tab( $atts, $content ){
	extract(shortcode_atts(array(
	'title' => 'Tab %d'
	), $atts));

	$x = $GLOBALS['tab_count'];
	$GLOBALS['tabs'][$x] = array( 'title' => sprintf( $title, $GLOBALS['tab_count'] ), 'content' =>  $content );

	$GLOBALS['tab_count']++;
}


//////////////////////////////////////////////////////////////////
// Divider shortcode
//////////////////////////////////////////////////////////////////

add_shortcode('divider', 'shortcode_divider');
	function shortcode_divider($atts, $html = null) {
		$html .= '<hr>';

		return $html;
	}


		//////////////////////////////////////////////////////////////////
		// Person shortcode
		//////////////////////////////////////////////////////////////////
add_shortcode('person', 'shortcode_person');
	function shortcode_person($atts, $content = null) {
$html = <<<EOF
		<div class="team-member">
					<img src="{$atts['image']}" alt="" width="120" height="120" class="alignleft" />
					<h5>{$atts['name']}</h5>
					<h6>{$atts['title']}</h6>
					<p>{$content}</p>
				</div>
EOF;
		return $html;
	}
	
//////////////////////////////////////////////////////////////////
// Add buttons to tinyMCE
//////////////////////////////////////////////////////////////////
add_action('init', 'add_button');

function add_button() {  
   if ( current_user_can('edit_posts') &&  current_user_can('edit_pages') )  
   {  
     add_filter('mce_external_plugins', 'add_plugin');  
     add_filter('mce_buttons_3', 'register_button');  
   }  
}  

function register_button($buttons) {  
   array_push($buttons, "button", "checklist", "arrowlist", "one_half", "one_third", "two_third", "one_fourth", "three_fourth", "slider", "tabs", "person", "divider");  
   return $buttons;  
}  

function add_plugin($plugin_array) {  
   $plugin_array['button'] = get_template_directory_uri().'/tinymce/customcodes.js';
   $plugin_array['checklist'] = get_template_directory_uri().'/tinymce/customcodes.js';
   $plugin_array['arrowlist'] = get_template_directory_uri().'/tinymce/customcodes.js';
   $plugin_array['one_half'] = get_template_directory_uri().'/tinymce/customcodes.js';
   $plugin_array['one_third'] = get_template_directory_uri().'//tinymce/customcodes.js';
   $plugin_array['two_third'] = get_template_directory_uri().'/tinymce/customcodes.js';
   $plugin_array['one_fourth'] = get_template_directory_uri().'/tinymce/customcodes.js';
   $plugin_array['three_fourth'] = get_template_directory_uri().'/tinymce/customcodes.js';
   $plugin_array['slider'] = get_template_directory_uri().'/tinymce/customcodes.js';
    $plugin_array['tabs'] = get_template_directory_uri().'/tinymce/customcodes.js';
	$plugin_array['divider'] = get_template_directory_uri().'/tinymce/customcodes.js';
	$plugin_array['person'] = get_template_directory_uri().'/tinymce/customcodes.js';
   
   return $plugin_array;  
}