Esempio n. 1
0
function addQRCode($atts, $content = null)
{
    extract(Shortcodes::shortcodeAtts(array("size" => 150, "eclevel" => 'L', "margin" => '0', "url" => null), $atts));
    if (is_null($url)) {
        //$url = Core::curPageURL();
    }
    return '<img src="https://chart.googleapis.com/chart?chs=' . $size . 'x' . $size . '&cht=qr&chld=' . $eclevel . '|' . $margin . '&chl=' . $url . '" alt="QR code" width="' . $size . '" height="' . $size . '"/>';
}
Esempio n. 2
0
function yoast_rss_shortcode($atts)
{
    extract(Shortcodes::shortcodeAtts(array("feed" => '', "num" => '5', "excerpt" => true, "target" => '_self'), $atts));
    $content = file_get_contents($feed);
    $x = new SimpleXmlElement($content);
    $content = "<ul>";
    foreach ($x->channel->item as $entry) {
        $content .= "<li><a href='{$entry->link}' title='{$entry->title}'>" . $entry->title . "</a></li>";
    }
    $content .= "</ul>";
    return $content;
}
function chart_shortcode($atts)
{
    extract(Shortcodes::shortcodeAtts(array('data' => '', 'colors' => '', 'size' => '400x200', 'bg' => 'ffffff', 'title' => '', 'labels' => '', 'advanced' => '', 'type' => 'pie'), $atts));
    $string = '';
    switch ($type) {
        case 'line':
            $charttype = 'lc';
            break;
        case 'xyline':
            $charttype = 'lxy';
            break;
        case 'sparkline':
            $charttype = 'ls';
            break;
        case 'meter':
            $charttype = 'gom';
            break;
        case 'scatter':
            $charttype = 's';
            break;
        case 'venn':
            $charttype = 'v';
            break;
        case 'pie':
            $charttype = 'p3';
            break;
        case 'pie2d':
            $charttype = 'p';
            break;
        default:
            $charttype = $type;
            break;
    }
    if ($title) {
        $string .= '&chtt=' . $title . '';
    }
    if ($labels) {
        $string .= '&chl=' . $labels . '';
    }
    if ($colors) {
        $string .= '&chco=' . $colors . '';
    }
    $string .= '&chs=' . $size . '';
    $string .= '&chd=t:' . $data . '';
    $string .= '&chf=' . $bg . '';
    return '<img title="' . $title . '" src="http://chart.apis.google.com/chart?cht=' . $charttype . '' . $string . $advanced . '" alt="' . $title . '" />';
}
Esempio n. 4
0
function showFlickrGallery($atts)
{
    extract(Shortcodes::shortcodeAtts(array("name" => ''), $atts));
    $ch = @curl_init();
    @curl_setopt($ch, CURLOPT_URL, "http://api.flickr.com/services/feeds/photoset.gne?set=72157634215973638&nsid=97716697@N07&lang=en-us&format=json&nojsoncallback=1");
    @curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
    @curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    @curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    $response = @curl_exec($ch);
    $errno = @curl_errno($ch);
    $error = @curl_error($ch);
    if ($errno == CURLE_OK) {
        $pics = json_decode($response);
    }
    $ret = '';
    foreach ($pics->items as $item) {
        $ret .= "<img src='" . $item->media->m . "' alt='" . $item->title . "' />";
    }
    return $ret;
}
Esempio n. 5
0
function mapme($attr)
{
    global $numMaps;
    // default atts
    $attr = Shortcodes::shortcodeAtts(array('lat' => '0', 'lon' => '0', 'id' => 'map', 'z' => '1', 'w' => '400', 'h' => '300', 'maptype' => 'ROADMAP', 'address' => '', 'marker' => '', 'markerimage' => '', 'infowindow' => '', 'infowindowdefault' => 'yes', 'directions' => '', 'hidecontrols' => 'false', 'scale' => 'false', 'scrollwheel' => 'true'), $attr);
    $returnme = '
    <div id="' . $attr['id'] . '" style="width:' . $attr['w'] . 'px;height:' . $attr['h'] . 'px;"></div>
	';
    if ($numMaps == 0) {
        $returnme .= '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>';
        $numMaps++;
    }
    $returnme .= '
    

	
    <script type="text/javascript">

		var latlng = new google.maps.LatLng(' . $attr['lat'] . ', ' . $attr['lon'] . ');
		var myOptions = {
			zoom: ' . $attr['z'] . ',
			center: latlng,
			scrollwheel: ' . $attr['scrollwheel'] . ',
			scaleControl: ' . $attr['scale'] . ',
			disableDefaultUI: ' . $attr['hidecontrols'] . ',
			mapTypeId: google.maps.MapTypeId.' . $attr['maptype'] . '
		};
		var ' . $attr['id'] . ' = new google.maps.Map(document.getElementById("' . $attr['id'] . '"),
		myOptions);
		';
    //address
    if ($attr['address'] != '') {
        $returnme .= '
		    var geocoder_' . $attr['id'] . ' = new google.maps.Geocoder();
			var address = \'' . $attr['address'] . '\';
			geocoder_' . $attr['id'] . '.geocode( { \'address\': address}, function(results, status) {
				if (status == google.maps.GeocoderStatus.OK) {
					' . $attr['id'] . '.setCenter(results[0].geometry.location);
					';
        if ($attr['marker'] != '') {
            //add custom image
            if ($attr['markerimage'] != '') {
                $returnme .= 'var image = "' . $attr['markerimage'] . '";';
            }
            $returnme .= '
						var marker = new google.maps.Marker({
							map: ' . $attr['id'] . ', 
							';
            if ($attr['markerimage'] != '') {
                $returnme .= 'icon: image,';
            }
            $returnme .= '
							position: ' . $attr['id'] . '.getCenter()
						});
						';
            //infowindow
            if ($attr['infowindow'] != '') {
                //first convert and decode html chars
                $thiscontent = htmlspecialchars_decode($attr['infowindow']);
                $returnme .= '
							var contentString = \'' . $thiscontent . '\';
							var infowindow = new google.maps.InfoWindow({
								content: contentString
							});
										
							google.maps.event.addListener(marker, \'click\', function() {
							  infowindow.open(' . $attr['id'] . ',marker);
							});
							';
                //infowindow default
                if ($attr['infowindowdefault'] == 'yes') {
                    $returnme .= '
									infowindow.open(' . $attr['id'] . ',marker);
								';
                }
            }
        }
        $returnme .= '
				} else {
				alert("Geocode was not successful for the following reason: " + status);
			}
			});
			';
    }
    //marker: show if address is not specified
    if ($attr['marker'] != '' && $attr['address'] == '') {
        //add custom image
        if ($attr['markerimage'] != '') {
            $returnme .= 'var image = "' . $attr['markerimage'] . '";';
        }
        $returnme .= '
				var marker = new google.maps.Marker({
				map: ' . $attr['id'] . ', 
				';
        if ($attr['markerimage'] != '') {
            $returnme .= 'icon: image,';
        }
        $returnme .= '
				position: ' . $attr['id'] . '.getCenter()
			});
			';
        //infowindow
        if ($attr['infowindow'] != '') {
            $returnme .= '
				var contentString = \'' . $attr['infowindow'] . '\';
				var infowindow = new google.maps.InfoWindow({
					content: contentString
				});
							
				google.maps.event.addListener(marker, \'click\', function() {
				  infowindow.open(' . $attr['id'] . ',marker);
				});
				';
            //infowindow default
            if ($attr['infowindowdefault'] == 'yes') {
                $returnme .= '
						infowindow.open(' . $attr['id'] . ',marker);
					';
            }
        }
    }
    $returnme .= '</script>';
    return $returnme;
    ?>
    

	<?php 
}
Esempio n. 6
0
function showSection($atts, $content = null)
{
    extract(Shortcodes::shortcodeAtts(array("name" => '', "class" => ''), $atts));
    return "<div id='" . $name . "' class='" . $class . "'>" . Shortcodes::doShortcode($content) . "</div>";
}
Esempio n. 7
0
 public static function addCode($atts, $content = null)
 {
     extract(Shortcodes::shortcodeAtts(array("mode" => null), $atts));
     $mode = isset($mode) ? $mode : 'html';
     return '<pre data-language="' . $mode . '"><code>' . htmlspecialchars($content) . '</code></pre>';
 }
Esempio n. 8
0
function addYoutube($atts, $content = null)
{
    extract(Shortcodes::shortcodeAtts(array("id" => null, "width" => '400', "height" => '225'), $atts));
    return '<iframe width="' . $width . '" height="' . $height . '" src="http://www.youtube.com/embed/' . $id . '?autoplay=0" frameborder="0" allowfullscreen></iframe>';
}
Esempio n. 9
0
function addSoundcloud($atts, $content = null)
{
    extract(Shortcodes::shortcodeAtts(array("url" => null, "width" => '400', "height" => '225', "scrolling" => 'no', "frameborder" => 'no', "iframe" => 'true'), $atts));
    return '<iframe width="' . $width . '" height="' . $height . '" scrolling="' . $scrolling . '" frameborder="' . $frameborder . '" src="https://w.soundcloud.com/player/?url=' . $url . '"></iframe>';
}