Exemple #1
0
function al_alert($atts, $content)
{
    extract(shortcode_atts(array('type' => ''), al_normalize_atts($atts)));
    if ($type == '') {
        $type = 'notice';
    }
    $html = sprintf('<div class="alert-box %s">%s <a class="close">x</a></div>', $type, do_shortcode($content));
    return $html;
}
function al_spaceless($atts, $content)
{
    extract(shortcode_atts(array('shortcodes' => ''), al_normalize_atts($atts)));
    $array = array('<p>[' => '[', ']</p>' => ']', ']<br />' => ']');
    $spaceless = strtr($content, $array);
    $html = do_shortcode($spaceless);
    if (!$shortcodes) {
        $html = al_clean_out_spaces($html);
    }
    return $html;
}
/**
 * @param $class
 * @param $atts
 * @param $content
 *
 * @return string
 */
function al_columns($class, $atts, $content)
{
    extract(shortcode_atts(array('last' => ''), al_normalize_atts($atts)));
    if ($class == 'span_12') {
        $last = 1;
    }
    if (!$last) {
        $html = '<div class="col ' . $class . '">' . do_shortcode($content) . '</div>';
    } else {
        $html = '<div class="col ' . $class . ' last">' . do_shortcode($content) . '</div><div class="clear"></div>';
    }
    return $html;
}
function al_button($atts, $content = null)
{
    extract(shortcode_atts(array('inline' => '', 'border' => '', 'size' => '', 'link' => ''), al_normalize_atts($atts)));
    $classes = $border ? ' border' : '';
    $classes .= $size != '' ? ' ' . $size : '';
    $classes .= $inline ? ' button-inline' : '';
    if ($link == '') {
        $html = sprintf('<span class="button%s">%s</span>', $classes, $content);
    } else {
        $html = sprintf('<a class="button%s" href="%s">%s</a>', $classes, $link, $content);
    }
    if (!$inline) {
        $html = '<div class="block">' . $html . '</div>';
    }
    return $html;
}
Exemple #5
0
function al_fact($atts)
{
    extract(shortcode_atts(array('title' => '', 'icon' => '', 'count' => ''), al_normalize_atts($atts)));
    $html = sprintf('
	<!-- START FACTS -->
	<div class="facts">
		<div class="icon-number">
			<i class="fa fa-%s"></i>
			<span class="number">%d</span>
		</div>
		<div class="text">
		%s
		</div>
	</div><!-- END FACTS -->
	', $icon, $count, $title);
    return $html;
}
function al_price_box($atts, $content = null)
{
    extract(shortcode_atts(array('title' => '', 'price' => '', 'highlighted' => false), al_normalize_atts($atts)));
    $title = $title == '' ? '' : '<h3>' . $title . '</h3>';
    $price = $price == '' ? '' : '<span class="price">' . $price . '</span>';
    $highlighted = $highlighted ? ' best-price' : '';
    $html = sprintf('
	<div class="pricing-table%s">
		<div class="header">
			%s %s
		</div>
		<div class="content">
			%s
		</div>
	</div>
	', $highlighted, $title, $price, do_shortcode($content));
    return $html;
}
function al_fa($atts, $content = null)
{
    extract(shortcode_atts(array('icon' => '', 'size' => '', 'color' => '', 'link' => '', 'circle' => ''), al_normalize_atts($atts)));
    $icon_class = ' fa-' . $icon;
    $icon_style = ' style="';
    $icon_style .= (isset($size) and $size != '') ? 'font-size:' . $size . 'em;' : '';
    $icon_style .= (isset($color) and $color != '') ? 'color:' . $color . ';' : '';
    $icon_style = $icon_style == ' style="' ? '' : $icon_style . '"';
    $icon_data_color = (isset($color) and $color != '') ? ' data-color="' . $color . '"' : '';
    $icon_data_size = (isset($size) and $size != '') ? ' data-size="' . $size . '"' : '';
    $icon_html = '<i class="al-sc-fa fa' . $icon_class . '"' . $icon_style . $icon_data_color . $icon_data_size . '></i>';
    $circle_class = $circle ? ' class="al-fa-circle"' : '';
    if ($link == '') {
        $html = sprintf('<span%s>%s</span>', $circle_class, $icon_html);
    } else {
        $html = sprintf('<a href="%s"%s>%s</a>', $link, $circle_class, $icon_html);
    }
    return $html;
}
Exemple #8
0
function al_box($atts, $content)
{
    extract(shortcode_atts(array('width' => '', 'position' => '', 'text_align' => '', 'last' => ''), al_normalize_atts($atts)));
    $style = '';
    $style .= $width ? 'width: 100%; max-width:' . $width . ';' : '';
    switch ($position) {
        case 'left':
        case 'right':
            $style .= 'float:' . $position . ';';
            break;
        case 'center':
            $style .= 'margin:0 auto;';
    }
    $style .= $text_align ? 'text-align:' . $text_align . ';' : '';
    $html = sprintf('<div style="%s">%s</div>', $style, do_shortcode($content));
    if ($last) {
        $html .= '<div class="clear"></div>';
    }
    return $html;
}
function al_spacer($atts)
{
    extract(shortcode_atts(array('line' => false, 'height' => '2', 'top' => '', 'bottom' => ''), al_normalize_atts($atts)));
    if ($top or $bottom) {
        $top = $top ? $top : 0;
        $bottom = $bottom ? $bottom : 0;
        $margin = $top . 'px 0 ' . $bottom . 'px 0';
    } else {
        $height = ceil(intval($height) / 2);
        $margin = $height . 'px 0';
    }
    $class = $line ? ' line' : '';
    if ($line !== true and $line == 'fullwidth') {
        // close row
        $html = '</div>';
        $html .= '<div class="spacer line" style="margin: ' . $margin . ';"></div>';
        $html .= '<div class="row gutters">';
    } else {
        $html = '<div class="spacer' . $class . '" style="margin: ' . $margin . ';"></div>';
    }
    return $html;
}
function al_google_maps_api($atts, $content = null)
{
    global $al_theme_options;
    extract(shortcode_atts(array('width' => '100%', 'height' => '500px'), al_normalize_atts($atts)));
    $error = false;
    if ($al_theme_options->existHandlerMethod('googleMapsApi')) {
        if ($al_theme_options->googleMapsApi()) {
            $script = $al_theme_options->scriptGoogleMapsApi();
            $style = ' style="width:' . $width . ';height:' . $height . ';"';
            $html = '<div class="al-google-maps-api" id="al-gmaps-' . $al_theme_options->identicator . '"' . $style . '></div>' . $script;
            $al_theme_options->identicator++;
        } else {
            $error = "Map configuration invalid. Please check <i>\"Location Latitude, Longitude Coordinates\"</i> value. " . $al_theme_options->contact_us;
        }
    } else {
        $error = "Please activate <i>\"artless Maps\"</i>-Plugin to use artless <i>[google_maps_api]</i>-Shortcode. " . $al_theme_options->contact_us;
    }
    if ($error) {
        $html = '<div class="alert-box error">' . $error . ' <a class="close">x</a></div>';
    }
    return $html;
}
Exemple #11
0
function al_video($atts, $content)
{
    extract(shortcode_atts(array('id' => false, 'autoplay' => false, 'provider' => false, 'type' => false, 'width' => '500px', 'height' => '500px'), al_normalize_atts($atts)));
    if (!$provider) {
        $provider = $type;
    }
    $autoplay = $autoplay ? 'autoplay=1&amp;' : '';
    $id = ($id and !empty($id)) ? $id : false;
    $provider = ($provider == 'youtube' or $provider == 'vimeo') ? $provider : false;
    if ($id and $provider) {
        switch ($provider) {
            case 'youtube':
                $src = 'http://www.youtube.com/embed/' . $id . '?HD=1;rel=0;showinfo=0';
                break;
            case 'vimeo':
                $src = 'http://player.vimeo.com/video/' . $id . '?' . $autoplay . 'byline=0&amp;portrait=0&amp;title=0';
                break;
        }
        $html = '<iframe class="al-video" data-sc-after-preload-src="' . $src . '" width="' . $width . '" height="' . $height . '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
    } else {
        $html = '';
    }
    return $html;
}
function al_tab_content_box($tab_atts, $content)
{
    global $al_theme_options;
    extract(shortcode_atts(array('tabs_position' => ''), al_normalize_atts($tab_atts)));
    $content = do_shortcode($content);
    $pattern = '#\\[(\\[?)(tab_content)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)#';
    preg_match_all($pattern, $content, $results, PREG_SET_ORDER);
    $tabs = array();
    foreach ($results as $result) {
        $result = array_filter($result, 'strlen');
        $result = array_filter($result);
        $result = array_values($result);
        $tab = array();
        $tab_atts = array();
        if (isset($result[2])) {
            $result[2] = str_replace('&#8221;', '"', $result[2]);
            $result[2] = str_replace('&#187;', '"', $result[2]);
            preg_match_all('#([A-z]{1,15})\\=[\\"\'”]{1}([^\\"]{0,200})[\\"\'”]{1}#', $result[2], $atts, PREG_SET_ORDER);
            foreach ($atts as $att) {
                $tab_atts[$att[1]] = $att[2];
            }
        }
        $tab['atts'] = $tab_atts;
        if (isset($tab['atts']['title'])) {
            $tab['content'] = isset($result[3]) ? $result[3] : '';
        } else {
            $tab['atts']['title'] = '';
            $tab['content'] = isset($result[2]) ? $result[2] : '';
        }
        $tabs[] = $tab;
    }
    // Navigation
    $tabs_navigation = '<ul class="tab-content-navi">';
    $x = isset($al_theme_options->identicator) ? $al_theme_options->identicator . 0 : 0;
    foreach ($tabs as $tab) {
        $x++;
        $tabs_navigation .= '<li><a open-content="tab-content-' . $x . '">' . $tab['atts']['title'] . '</a></li>';
    }
    $tabs_navigation .= '</ul>';
    // Content
    $content = '';
    $x = isset($al_theme_options->identicator) ? $al_theme_options->identicator . 0 : 0;
    foreach ($tabs as $tab) {
        $x++;
        $content .= '<div class="tab-content" id="tab-content-' . $x . '">';
        $content .= do_shortcode($tab['content']);
        $content .= '</div>';
    }
    if (isset($al_theme_options->identicator)) {
        $al_theme_options->identicator++;
    }
    $tabs_position = isset($tabs_position) ? $tabs_position : 'left';
    switch ($tabs_position) {
        case 'right':
            $html = '<div class="col span_8 last">';
            $html .= $content;
            $html .= '</div>';
            $html .= '<div class="col span_4">';
            $html .= $tabs_navigation;
            $html .= '</div>';
            break;
        case 'top':
            $html = $tabs_navigation;
            $html .= $content;
            break;
        case 'bottom':
            $html = $content;
            $html .= $tabs_navigation;
            break;
        default:
            // left
            $html = '<div class="col span_4">';
            $html .= $tabs_navigation;
            $html .= '</div>';
            $html .= '<div class="col span_8 last">';
            $html .= $content;
            $html .= '</div>';
            break;
    }
    $html = '<div class="row">' . $html . '</div>';
    return $html;
}