});
			';
        //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 
}
Shortcodes::addShortcode('googlemap', 'mapme', '[googlemap address="" z="" w="" h="" /]');
Example #2
0
<?php

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 . '"/>';
}
Shortcodes::addShortcode('qrcode', 'addQRCode', '[qrcode url="" size="150" eclevel="L" margin="0" /]');
Example #3
0
 /**
  * @covers Xoops\Core\Text\ShortCodes::addShortcode
  * @covers Xoops\Core\Text\ShortCodes::process
  * @covers Xoops\Core\Text\ShortCodes::processTag
  * @covers Xoops\Core\Text\ShortCodes::parseAttributes
  * @covers Xoops\Core\Text\ShortCodes::shortcodeRegex
  */
 public function testEscaping()
 {
     $shortcodes = new Shortcodes();
     $shortcodes->addShortcode('test', array($this, 'dummyFunction_test'));
     $content = 'Hello my name is [[test name="Sam"]]!';
     $expectation = 'Hello my name is [test name="Sam"]!';
     $this->assertEquals($expectation, $shortcodes->process($content));
 }
Example #4
0
<?php

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;
}
Shortcodes::addShortcode('rss', 'yoast_rss_shortcode', '[rss feed="" num="5" excerpt="true" target="_self" ]');
Example #5
0
<?php

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;
}
Shortcodes::addShortcode('flickr', 'showFlickrGallery', '[flickr name="" ][/flickr]');
Example #6
0
<?php

function showSection($atts, $content = null)
{
    extract(Shortcodes::shortcodeAtts(array("name" => '', "class" => ''), $atts));
    return "<div id='" . $name . "' class='" . $class . "'>" . Shortcodes::doShortcode($content) . "</div>";
}
Shortcodes::addShortcode('section', 'showSection', '[section name="" ][/section]');
        $result .= '</div>';
        return $result;
    }
    public static function addiCode($atts, $content = null)
    {
        extract(Shortcodes::shortcodeAtts(array("mode" => null), $atts));
        return '<code>' . $content . '</code>';
    }
    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>';
    }
}
Shortcodes::addShortcode('icode', 'Bootstrapcore::addiCode', '[icode mode=""]content[/icode]');
Shortcodes::addShortcode('code', 'Bootstrapcore::addCode', '[code mode=""]content[/code]');
Shortcodes::addShortcode('jumbotron', 'Bootstrapcore::bootstrap_jumbotron');
Shortcodes::addShortcode('label', 'Bootstrapcore::bootstrap_label');
Shortcodes::addShortcode('badge', 'Bootstrapcore::bootstrap_badge');
Shortcodes::addShortcode('lead', 'Bootstrapcore::bootstrap_lead');
Shortcodes::addShortcode('panel', 'Bootstrapcore::bootstrap_panel');
Shortcodes::addShortcode('tooltip', 'Bootstrapcore::bootstrap_tooltip');
Shortcodes::addShortcode('icon', 'Bootstrapcore::bootstrap_icons');
Shortcodes::addShortcode('row', 'Bootstrapcore::bootstraps_row');
Shortcodes::addShortcode('col', 'Bootstrapcore::bootstrap_span');
Shortcodes::addShortcode('collapse', 'Bootstrapcore::bootstrap_collapse');
Shortcodes::addShortcode('citem', 'Bootstrapcore::bootstrap_citem');
Shortcodes::addShortcode('button', 'Bootstrapcore::bootstrap_buttons');
Shortcodes::addShortcode('notification', 'Bootstrapcore::bootstrap_notice');
Example #8
0
<?php

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>';
}
Shortcodes::addShortcode('youtube', 'addYoutube', '[youtube id="" width="" height="" /]');
            $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 . '" />';
}
Shortcodes::addShortcode('chart', 'chart_shortcode', '[chart data="" colors="" size="" bg="" title="" labels="" advanced="" type="" /]');
<?php

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>';
}
Shortcodes::addShortcode('soundcloud', 'addSoundcloud', '[soundcloud url="" width="" height="" /]');