'wunderkind_shortcodes_ajax_ionicons_autocomplete', 'access arguments' => array('administer nd visualshortcodes'), 'type' => MENU_CALLBACK, ); return $items; } /** * Implementation of hook_shortcode_info(). * Using the same formatting as hook_filter_info() */ function wunderkind_shortcodes_shortcode_info() { $shortcodes['html'] = array( 'title' => t('HTML'), 'description' => t('HTML code'), 'process callback' => 'wunderkind_shortcodes_shortcode_html', 'process backend callback' => 'nd_visualshortcodes_backend_nochilds', 'process settings callback' => 'nd_visualshortcodes_shortcode_html_settings', 'icon' => 'fa fa-code', 'description_field' => 'text', ); $shortcodes['quote'] = array( 'title' => t('Quote col'), 'description' => t('Replace the given text formatted like as a quote.'), 'process callback' => 'wunderkind_shortcodes_shortcode_quote', 'tips callback' => 'wunderkind_shortcodes_shortcode_quote_tip', 'process settings callback' => 'wunderkind_shortcodes_shortcode_quote_settings', 'icon' => 'fa fa-quote-right', 'child shortcode' => 'html', 'description_field' => 'author', ); $shortcodes['h'] = array( 'title' => t('Highlited text'), 'description' => t('Highlite the text.'), 'process callback' => 'wunderkind_shortcodes_shortcode_h', 'process backend callback' => 'nd_visualshortcodes_backend_nochilds', 'tips callback' => 'wunderkind_shortcodes_shortcode_h_tip', 'process settings callback' => 'wunderkind_shortcodes_shortcode_h_settings', 'icon' => 'fa fa-header', 'description_field' => 'text', ); $shortcodes['bgh'] = array( 'title' => t('Highlited Background'), 'description' => t('Highlite the background text.'), 'process backend callback' => 'nd_visualshortcodes_backend_nochilds', 'description_field' => 'text', 'process callback' => 'wunderkind_shortcodes_shortcode_bgh', 'icon' => 'fa fa-square', ); $shortcodes['bg'] = array( 'title' => t('Transparent Background'), 'description' => t('Highlite the content with Transparent Background.'), 'process callback' => 'wunderkind_shortcodes_shortcode_bg', 'process backend callback' => 'nd_visualshortcodes_backend_nochilds', 'description_field' => 'text', 'icon' => 'fa fa-square-o', ); $shortcodes['tooltip'] = array( 'title' => t('Tooltip'), 'description' => t('Text with tooltip hover effect.'), 'process callback' => 'wunderkind_shortcodes_shortcode_tooltip', 'process backend callback' => 'nd_visualshortcodes_backend_nochilds', 'description_field' => 'text', 'icon' => 'fa fa-paperclip', ); $shortcodes['progress'] = array( 'title' => t('Progress Line'), 'description' => t('Progress line with title and percents.'), 'process callback' => 'wunderkind_shortcodes_shortcode_progress', 'process backend callback' => 'nd_visualshortcodes_backend_nochilds', 'process settings callback' => 'wunderkind_shortcodes_shortcode_progress_settings', 'tips callback' => 'wunderkind_shortcodes_shortcode_progress_tip', 'icon' => 'fa fa-tasks', ); $shortcodes['spacer'] = array( 'title' => t('Spacer'), 'description' => t('Spacer without any content.'), 'process callback' => 'wunderkind_shortcodes_shortcode_spacer', 'process settings callback' => 'wunderkind_shortcodes_shortcode_spacer_settings', 'process backend callback' => 'nd_visualshortcodes_backend_nochilds', 'tips callback' => 'wunderkind_shortcodes_shortcode_spacer_tip', 'icon' => 'fa fa-circle-o', ); $shortcodes['container'] = array( 'title' => t('Container'), 'description' => t('Container for content.'), 'process callback' => 'wunderkind_shortcodes_shortcode_container', 'tips callback' => 'wunderkind_shortcodes_shortcode_container_tip', 'icon' => 'fa fa-hdd-o', ); $shortcodes['row'] = array( 'title' => t('Row container with cols'), 'description' => t('Container for cols.'), 'process callback' => 'wunderkind_shortcodes_shortcode_row', 'process backend callback' => 'nd_visualshortcodes_backend_row', 'icon' => 'fa fa-th-large', 'child shortcode' => 'col' ); $shortcodes['col'] = array( 'title' => t('Column'), 'description' => t('Column with size settings'), 'process callback' => 'wunderkind_shortcodes_shortcode_col', 'process backend callback' => 'nd_visualshortcodes_backend_col', 'process settings callback' => 'nd_visualshortcodes_shortcode_col_settings', 'icon' => 'fa fa-columns' ); $shortcodes['message'] = array( 'title' => t('Message'), 'description' => t('Dismissable Message.'), 'process callback' => 'wunderkind_shortcodes_shortcode_message', 'tips callback' => 'wunderkind_shortcodes_shortcode_message_tip', 'icon' => 'fa fa-info-circle', 'description_field' => 'color', ); $shortcodes['button'] = array( 'title' => t('Button link'), 'description' => t('Button linked to any page or content.'), 'process callback' => 'wunderkind_shortcodes_shortcode_button', 'tips callback' => 'wunderkind_shortcodes_shortcode_button_tip', 'icon' => 'fa fa-bold', 'description_field' => 'text', ); $shortcodes['call_to_action'] = array( 'title' => t('Call to Action'), 'description' => t('Text with button link'), 'process callback' => 'wunderkind_shortcodes_shortcode_calltoaction', 'tips callback' => 'wunderkind_shortcodes_shortcode_calltoaction_tip', 'icon' => 'fa fa-bullhorn', 'description_field' => 'header', ); $shortcodes['icon_box'] = array( 'title' => t('Icon Box'), 'description' => t('Icon box with text.'), 'process callback' => 'wunderkind_shortcodes_shortcode_iconbox', 'tips callback' => 'wunderkind_shortcodes_shortcode_iconbox_tip', 'icon' => 'fa fa-star', 'description_field' => 'icon', ); $shortcodes['social_box'] = array( 'title' => t('Social Icon Box'), 'description' => t('Social Icon Link with text.'), 'process callback' => 'wunderkind_shortcodes_shortcode_socialbox', 'tips callback' => 'wunderkind_shortcodes_shortcode_socialbox_tip', 'icon' => 'fa fa-comments-o', 'description_field' => 'icon', ); $shortcodes['pricing_table'] = array( 'title' => t('Pricing Table'), 'description' => t('Responsive Pricing Table.'), 'process callback' => 'wunderkind_shortcodes_shortcode_pricing_table', 'tips callback' => 'wunderkind_shortcodes_shortcode_pricing_table_tip', 'icon' => 'fa fa-usd', 'description_field' => 'title', ); $shortcodes['pricing_table_row'] = array( 'title' => t('Pricing Table Row'), 'description' => t('Pricing Table Row.'), 'process callback' => 'wunderkind_shortcodes_shortcode_pricing_table_row', 'icon' => 'fa fa-money', 'description_field' => 'text', ); $shortcodes['view'] = array( 'title' => t('View'), 'description' => t('Embed content - rendered View. To by dynamical should be used under '), 'process callback' => 'wunderkind_shortcodes_shortcode_view', 'process backend callback' => 'nd_visualshortcodes_backend_nochilds', 'process settings callback' => 'wunderkind_shortcodes_shortcode_view_settings', 'icon' => 'fa fa-sun-o', 'description_callback' => 'wunderkind_shortcodes_shortcode_view_description', 'tips callback' => 'wunderkind_shortcodes_shortcode_view_tip', ); $shortcodes['block'] = array( 'title' => t('Block'), 'description' => t('Render block.'), 'process callback' => 'wunderkind_shortcodes_shortcode_block', 'process backend callback' => 'nd_visualshortcodes_backend_nochilds', 'process settings callback' => 'wunderkind_shortcodes_shortcode_block_settings', 'icon' => 'fa fa-file', 'description_callback' => 'wunderkind_shortcodes_shortcode_block_description', 'tips callback' => 'wunderkind_shortcodes_shortcode_block_tip', ); $shortcodes['node'] = array( 'title' => t('Node'), 'description' => t('Render node.'), 'process callback' => 'wunderkind_shortcodes_shortcode_node', 'process backend callback' => 'nd_visualshortcodes_backend_nochilds', 'tips callback' => 'wunderkind_shortcodes_shortcode_node_tip', 'icon' => 'fa fa-file-o', 'description_callback' => 'wunderkind_shortcodes_shortcode_node_description', ); $shortcodes['video'] = array( 'title' => t('Video Iframe'), 'description' => t('Iframe adaptive video.'), 'process callback' => 'wunderkind_shortcodes_shortcode_video', 'process backend callback' => 'nd_visualshortcodes_backend_nochilds', 'icon' => 'fa fa-video-camera', 'description_field' => 'url', 'tips callback' => 'wunderkind_shortcodes_shortcode_video_tip', ); $shortcodes['contact'] = array( 'title' => t('Contact Form'), 'description' => t('Contact Form'), 'process callback' => 'wunderkind_shortcodes_shortcode_contact', 'icon' => 'fa fa-envelope-o', 'tips callback' => 'wunderkind_shortcodes_shortcode_contact_tip', ); $shortcodes['counter'] = array( 'title' => t('Counter with title'), 'description' => t('Animated Counter with Title'), 'process callback' => 'wunderkind_shortcodes_shortcode_counter', 'tips callback' => 'wunderkind_shortcodes_shortcode_counter_tip', 'icon' => 'fa fa-sort-numeric-asc', 'description_field' => 'title', ); $shortcodes['slider'] = array( 'title' => t('Slider'), 'description' => t('Slider for any content'), 'process callback' => 'wunderkind_shortcodes_shortcode_slider', 'tips callback' => 'wunderkind_shortcodes_shortcode_slider_tip', 'icon' => 'fa fa-arrows-h', ); return $shortcodes; } function _wunderkind_shortcodes_shortcode_attributes($attrs) { if(empty($attrs)) { return ''; } $allowed_attributes = array('class' => 'class', 'extra_classes' => 'class', 'href' => 'href', 'id' => 'id', 'animation' => 'data-appear-animation', 'animation_delay' => 'data-appear-animation-delay', 'style' => 'style', 'data-original-title' => 'data-original-title', 'data-placement' => 'data-placement', 'data-wow-delay' => 'data-wow-delay'); if (isset($attrs['link']) && $attrs['link'] == $_GET['q']) { $attrs['class'] = (isset($attrs['class']) ? $attrs['class'] : '') . ' active'; } if(isset($attrs['animation'])) { $attrs['class'] = (isset($attrs['class']) ? $attrs['class'] : '') . ' wow ' . $attrs['animation']; } if(isset($attrs['delay'])) { $attrs['data-wow-delay'] = $attrs['delay']; } $output = ''; $attrs_array = array(); foreach($attrs as $name => $value) { $value = trim($value); if(strpos($name, 'style_') === 0) { $value_style = str_replace(array('style_', '_'), array('', '-'), $name); if(strpos($value_style, 'border-radius') !== FALSE) { $value = strpos($value, '%') !== FALSE ? $value : (int)$value . 'px;'; $value = '-webkit-' . $value_style. ': ' . $value . '; -moz-' . $value_style. ': ' . $value . '; ' . $value_style. ': ' . $value . ';'; } elseif(strpos($name, 'margin') !== FALSE || strpos($name, 'padding') !== FALSE || strpos($name, 'width') !== FALSE || strpos($name, 'height') !== FALSE) { $value = strpos($value, '%') !== FALSE ? $value : (int)$value . 'px;'; $value = $value_style . ': ' . $value; } elseif(strpos($name, 'color') !== FALSE) { $value = $value_style . ': #' . trim($value, '#') . ';'; } elseif(strpos($value_style, 'image') !== FALSE) { $file = file_load($value); $filename = isset($file->uri) ? file_create_url($file->uri) : ''; $value = $value_style . ': url("' . $filename . '");'; } else { $value = $value_style . ': ' . $value . ';'; } $name = 'style'; } if(isset($allowed_attributes[$name])) { $name = $allowed_attributes[$name]; if ($value !== '') { $attrs_array[$name] = (isset($attrs_array[$name]) ? $attrs_array[$name] . ' ' : '') . $value; } } elseif(strpos($name, 'data-') === 0) { if ($value !== '') { $attrs_array[$name] = (isset($attrs_array[$name]) ? $attrs_array[$name] . ' ' : '') . $value; } } } if(isset($attrs['style_background_color']) && strtolower(trim($attrs['style_background_color'], '#')) == '000000') { $attrs_array['class'] = (isset($attrs_array['class']) ? $attrs_array['class'] : '') . ' text-white'; } if(isset($attrs['style_background_color']) && strtolower(trim($attrs['style_background_color'], '#')) == 'ffffff') { $attrs_array['class'] = (isset($attrs_array['class']) ? $attrs_array['class'] : '') . ' text-black'; } if(isset($attrs['text_align']) && $attrs['text_align']) { $attrs_array['style'] = (isset($attrs_array['style']) ? $attrs_array['style'] : '') . ' text-align:'. $attrs['text_align'] . ';'; } foreach($attrs_array as $name => $value) { $output .= " $name = '$value'"; } return $output; } function wunderkind_shortcodes_shortcode_spacer($attrs, $text) { $attrs['class'] = 'spacer ' . (isset($attrs['class']) ? $attrs['class'] : ''); $text = '
'; return $text; } function wunderkind_shortcodes_shortcode_spacer_tip($format, $long) { $output = array(); $output[] = 'Spacer:
[spacer][/spacer]';
$output[] = 'Available classes: xs - 10px sm - 20px md - 40px lg - 60px xlg - 80px
' . $text . '
Progress bar:
[progress percent = "90"]Design[/progress]';
return implode(' ', $output);
}
function wunderkind_shortcodes_shortcode_video($attrs, $text) {
$attrs['class'] = isset($attrs['class']) ? ' ' . $attrs['class'] : '';
$iframe_attrs = (isset($attrs['width']) ? 'width="' . $attrs['width'] .'"' : '') . (isset($attrs['height']) ? ' height ="' . $attrs['height'] . '"' : '');
if(!$iframe_attrs) {
$attrs['class'] .= ' video-holder';
}
if(strpos($text, 'vimeo') !== FALSE) {
preg_match('|/(\d+)|', $text, $matches);
$video_url = 'http://player.vimeo.com/video/' . $matches[1] . '?title=0&byline=0&portrait=0&color=FFFFFF';
}
else if(strpos($text, 'youtube') !== FALSE){
$id = substr($text, strpos($text, '?v=') + 3);
$video_url = 'http://www.youtube.com/embed/' . $id .'?theme=dark&color=white';
}
$text = '
';
return $text;
}
function wunderkind_shortcodes_shortcode_video_tip($format, $long) {
$output = array();
$output[] = '
Video iFrame:
[video]player.vimeo.com/video/7449107[/video]';
$output[] = 'Text - Embed URL of the video.
Contact Form:
[contact name = "Name field Title"][/contact]';
$output[] = 'Override default title for fields: name, subject, mail, message
' . $attrs['title'] . '
Counter:
[counter number = "10"]Projects[/counter]
Slider:
[slider]<div>Slide 1</div><div>Slide 2</div>[/slider]
'; } else { $attrs['class'] = (isset($attrs['class']) ? $attrs['class'] : '') . ' quote centered'; if(isset($attrs['image']) && $attrs['image']) { $img = $attrs['image']; } elseif(isset($attrs['image_fid']) && $attrs['image_fid']) { $img = file_load($attrs['image_fid'])->uri; } $h = isset($img) ? '4' : '2'; $img = isset($img) ? theme('image', array('path' => $img)) : ''; $output = '' . $text . '
' . ($attrs['author'] ? '' . $attrs['author'] . '' : '') . '
' . $attrs['author'] . '
All elements supports class, animation and delay attributes. Supports all animation.css values. Delay value in ms. '; $output[] = '
Quote:
[quote author = "Author Name" image = "/files/author.png" blockquote]text[/quote]';
$output[] = 'blockquote - Simple left aligned quote with author name, image - URL to the image.