Example #1
0
 public static function box($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('style' => 'default', 'title' => JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_BOX_TITLE_DEFAULT'), 'title_color' => '#FFFFFF', 'box_color' => '#333333', 'color' => null, 'radius' => '', 'scroll_reveal' => '', 'class' => ''), $atts, 'box');
     // Initioal Variables
     $id = uniqid('su_box_');
     $radius = '';
     $css = array();
     // Color Manage
     if ($atts['color'] !== null) {
         $atts['box_color'] = $atts['color'];
     }
     // Radius Manage
     if ($atts['radius']) {
         $radius = $atts['radius'] != '0' ? 'border-radius:' . $atts['radius'] . 'px;' : '';
     }
     // Get Css in $css variable
     $css[] = '#' . $id . '{' . $radius . 'border-color:' . $atts['box_color'] . ';} #' . $id . ' .su-box-title { background-color:' . $atts['box_color'] . ';color:' . $atts['title_color'] . ';}';
     // Add CSS in head
     suAsset::addString('css', implode("\n", $css));
     suAsset::addFile('css', 'box.css', __FUNCTION__);
     // Output HTML
     $return = '<div id="' . $id . '"' . su_scroll_reveal($atts) . ' class="su-box su-box-style-' . $atts['style'] . su_ecssc($atts) . '">
                 <div class="su-box-title">' . su_scattr($atts['title']) . '
                 </div>
                 <div class="su-box-content su-clearfix">' . has_child_shortcode($content, 'b') . '</div>
             </div>';
     return $return;
 }
Example #2
0
 public static function switcher($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('id' => uniqid('swt'), 'style' => 1, 'active' => 1, 'position' => 'top', 'align' => 'center', 'animation' => 'bounceLeft', 'scroll_reveal' => '', 'class' => ''), $atts, 'switcher');
     su_do_shortcode($content);
     $return = $panes = $css = $filter_item = array();
     if (is_array(self::$switcher)) {
         foreach (self::$switcher as $switcher_item) {
             $filter_data = su_title_class($switcher_item['title']);
             $filter_item[] = '<div data-filter=".' . $filter_data . '" class="cbp-filter-item ' . su_ecssc($switcher_item) . '"><div class="cbp-filter-item-inner">' . su_scattr($switcher_item['icon']) . '<span class="su-swt-title">' . su_scattr($switcher_item['title']) . '</span></div></div>';
             $panes[] = '<div class="' . $filter_data . ' cbp-item' . su_ecssc($switcher_item) . '">' . $switcher_item['content'] . '</div>';
         }
         $filters = '<div id="' . $atts['id'] . '_filter" class="su-swt-filter">' . implode('', $filter_item) . '</div>';
         if (is_int($atts['active']) && $atts['active'] > 0) {
             $active_tab = su_title_class(self::$switcher[$atts['active'] - 1]['title']);
         } else {
             $active_tab = su_title_class(self::$switcher[0]['title']);
         }
         $return[] = '<div id="' . $atts['id'] . '"' . su_scroll_reveal($atts) . ' data-animation="' . $atts['animation'] . '" class="su-switcher  su-switch-position-' . $atts['position'] . ' su-switch-align-' . $atts['align'] . ' su-switcher-style-' . $atts['style'] . su_ecssc($atts) . '" data-active_tab=".' . $active_tab . '" data-swtid="' . $atts['id'] . '">';
         $return[] = ($atts['position'] == 'top' or $atts['position'] == 'left') ? $filters : '';
         $return[] = '<div id="' . $atts['id'] . '_container" class="cbp cbp-l-grid-tabs">' . implode("\n", $panes) . '</div>';
         $return[] = ($atts['position'] == 'bottom' or $atts['position'] == 'right') ? $filters : '';
         $return[] = '<div class="su-clearfix"></div>';
         $return[] = '</div>';
     }
     self::$switcher = array();
     self::$switcher_item_count = 0;
     suAsset::addFile('css', 'cubeportfolio.min.css');
     suAsset::addFile('js', 'cubeportfolio.min.js');
     suAsset::addFile('css', 'switcher.css', __FUNCTION__);
     suAsset::addFile('js', 'switcher.js', __FUNCTION__);
     return implode("\n", $return);
 }
Example #3
0
 public static function tabs($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('active' => 1, 'vertical' => 'no', 'align' => 'left', 'style' => 'default', 'scroll_reveal' => '', 'class' => ''), $atts, 'tabs');
     if ($atts['style'] === '3') {
         $atts['vertical'] = 'yes';
     }
     if (self::$tab_count = -1) {
         self::$tab_count = 0;
     }
     su_do_shortcode($content);
     $return = '';
     $tabs = $panes = array();
     if (is_array(self::$tabs)) {
         if (self::$tab_count < $atts['active']) {
             $atts['active'] = self::$tab_count;
         }
         foreach (self::$tabs as $tab) {
             $tabs[] = '<span class="' . su_ecssc($tab) . $tab['disabled'] . '"' . $tab['anchor'] . $tab['url'] . $tab['target'] . '>' . su_scattr($tab['icon']) . su_scattr($tab['title']) . '</span>';
             $panes[] = '<div class="su-tabs-pane su-clearfix' . su_ecssc($tab) . '">' . $tab['content'] . '</div>';
         }
         $atts['vertical'] = $atts['vertical'] === 'yes' ? ' su-tabs-vertical' : '';
         $return = '<div' . su_scroll_reveal($atts) . ' class="su-tabs  su-tabs-align-' . $atts['align'] . ' su-tabs-style-' . $atts['style'] . $atts['vertical'] . su_ecssc($atts) . '" data-active="' . (string) $atts['active'] . '"><div class="su-tabs-nav">' . implode('', $tabs) . '</div><div class="su-tabs-panes">' . implode("\n", $panes) . '</div></div>';
     }
     self::$tabs = array();
     self::$tab_count = 0;
     suAsset::addFile('css', 'tabs.css', __FUNCTION__);
     suAsset::addFile('js', 'tabs.js', __FUNCTION__);
     return $return;
 }
Example #4
0
 public static function youtube_advanced($atts = null, $content = null)
 {
     $return = array();
     $params = array();
     $atts = su_shortcode_atts(array('url' => false, 'playlist' => '', 'width' => 600, 'height' => 400, 'responsive' => 'yes', 'autohide' => 'alt', 'autoplay' => 'no', 'controls' => 'yes', 'loop' => 'no', 'fs' => 'yes', 'modestbranding' => 'no', 'rel' => 'yes', 'theme' => 'dark', 'wmode' => '', 'showinfo' => 'yes', 'scroll_reveal' => '', 'class' => ''), $atts, 'youtube_advanced');
     if (!$atts['url']) {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_YOUTUBE_CU'), 'warning');
     }
     $atts['url'] = su_scattr($atts['url']);
     $id = preg_match('%(?:youtube(?:-nocookie)?\\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\\.be/)([^"&?/ ]{11})%i', $atts['url'], $match) ? $match[1] : false;
     if (!$id) {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_YOUTUBE_CI'), 'warning');
     }
     // Prepare params
     foreach (array('autohide', 'autoplay', 'controls', 'fs', 'loop', 'modestbranding', 'playlist', 'rel', 'showinfo', 'theme', 'wmode') as $param) {
         $params[$param] = str_replace(array('no', 'yes', 'alt'), array('0', '1', '2'), $atts[$param]);
     }
     // Correct loop
     if ($params['loop'] === '1' && $params['playlist'] === '') {
         $params['playlist'] = $id;
     }
     // Prepare protocol
     $protocol = preg_match('/^(https?:\\/\\/)/i', $atts['url'], $match) ? $match[1] : "http://";
     // Prepare player parameters
     $params = http_build_query($params);
     // Create player
     $return[] = '<div' . su_scroll_reveal($atts) . ' class="su-youtube su-responsive-media-' . $atts['responsive'] . su_ecssc($atts) . '">';
     $return[] = '<iframe width="' . $atts['width'] . '" height="' . $atts['height'] . '" src="' . $protocol . 'www.youtube.com/embed/' . $id . '?' . $params . '" allowfullscreen></iframe>';
     $return[] = '</div>';
     suAsset::addFile('css', 'youtube_advanced.css', __FUNCTION__);
     return implode('', $return);
 }
Example #5
0
 public static function gmap($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('width' => 600, 'height' => 400, 'responsive' => 'yes', 'address' => '', 'scroll_reveal' => '', 'class' => ''), $atts, 'gmap');
     suAsset::addFile('css', 'gmap.css', __FUNCTION__);
     // Prepare protocol
     $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? "https://" : "http://";
     return '<div' . su_scroll_reveal($atts) . ' class="su-gmap su-responsive-media-' . $atts['responsive'] . su_ecssc($atts) . '"><iframe width="' . $atts['width'] . '" height="' . $atts['height'] . '" src="' . $protocol . 'maps.google.com/maps?q=' . urlencode(su_scattr($atts['address'])) . '&amp;output=embed"></iframe></div>';
 }
Example #6
0
 public static function user_content($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('message' => JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_USER_CONTENT_DEFAULT_MESSAGE'), 'color' => '#ffcc00', 'login_text' => JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_LOGIN'), 'login_url' => JRoute::_('index.php?option=com_users&view=login'), 'scroll_reveal' => '', 'class' => ''), $atts, 'user_content');
     $user = JFactory::getUser();
     if ($user->guest) {
         suAsset::addFile('css', 'user_content.css', __FUNCTION__);
         $login = '******' . esc_attr($atts['login_url']) . '">' . $atts['login_text'] . '</a>';
         return '<div' . su_scroll_reveal($atts) . ' class="su-user_content' . su_ecssc($atts) . '" style="background-color:' . su_color::lighten($atts['color']) . ';border-color:' . su_color::darken($atts['color'], '10%') . ';color:' . su_color::darken($atts['color'], '40%') . '">' . str_replace('%login%', $login, su_scattr($atts['message'])) . '</div>';
     } else {
         return su_do_shortcode($content);
     }
 }
Example #7
0
 public static function blockquote($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('font' => 'default', 'cite' => false, 'url' => false, 'align' => 'default', 'pull' => 'no', 'italic' => 'no', 'scroll_reveal' => '', 'class' => ''), $atts, 'blockquote');
     $cite_link = $atts['url'] && $atts['cite'] ? '<a href="' . $atts['url'] . '" target="_blank">' . $atts['cite'] . '</a>' : $atts['cite'];
     $cite = $atts['cite'] ? '<span class="su-blockquote-cite">' . $cite_link . '</span>' : '';
     $classes = array('su-blockquote', 'su-blockquote-align-' . $atts['align'], 'su-blockquote-font-' . $atts['font'], su_ecssc($atts));
     $classes[] = $atts['cite'] ? 'su-blockquote-has-cite' : '';
     $classes[] = $atts['pull'] === 'yes' ? 'su-blockquote-pull' : '';
     $classes[] = $atts['italic'] === 'yes' ? 'su-blockquote-italic' : '';
     suAsset::addFile('css', 'blockquote.css', __FUNCTION__);
     return '<div class="' . su_acssc($classes) . '"' . su_scroll_reveal($atts) . '><div class="su-blockquote-inner su-clearfix">' . su_do_shortcode($content) . '</div> ' . su_scattr($cite) . ' </div>';
 }
Example #8
0
 public static function spoiler($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('title' => JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SPOILER_TITLE_DEFAULT'), 'open' => 'no', 'style' => 'default', 'icon' => 'plus', 'align' => 'left', 'anchor' => '', 'scroll_reveal' => '', 'class' => ''), $atts, 'spoiler');
     //$atts['style'] = str_replace(array('1', '2'), array('default', 'fancy'), $atts['style']);
     $atts['anchor'] = $atts['anchor'] ? ' data-anchor="' . str_replace(' ', '', trim(sanitize_text_field($atts['anchor']))) . '"' : '';
     if ($atts['open'] !== 'yes') {
         $atts['class'] .= ' su-spoiler-closed';
     } else {
         $atts['class'] .= ' su-spoiler-open';
     }
     suAsset::addFile('css', 'spoiler.css', __FUNCTION__);
     suAsset::addFile('js', 'spoiler.js', __FUNCTION__);
     return '<div' . su_scroll_reveal($atts) . ' class="su-spoiler su-spoiler-style-' . $atts['style'] . ' su-spoiler-icon-' . $atts['icon'] . su_ecssc($atts) . ' su-spoiler-' . $atts['align'] . '"' . $atts['anchor'] . ' ><div class="su-spoiler-title"><span class="su-spoiler-icon"></span>' . su_scattr($atts['title']) . '</div><div class="su-spoiler-content su-clearfix">' . has_child_shortcode($content, 's') . '</div></div>';
 }
Example #9
0
 public static function lightbox($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('src' => false, 'type' => 'iframe', 'class' => ''), $atts, 'lightbox');
     if (!$atts['src']) {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_LIGHTBOX_CORRECT_SOURCE'), 'warning');
     }
     // elseif (@$_REQUEST["action"] == 'su_generator_preview') {
     //     return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_NOT_WORK_IN_GENERATOR'), 'warning');
     // }
     suAsset::addFile('css', 'magnific-popup.css');
     suAsset::addFile('js', 'magnific-popup.js');
     suAsset::addFile('js', 'lightbox.js', __FUNCTION__);
     $lightbox_src = $atts['type'] != 'inline' ? image_media(su_scattr($atts['src'])) : su_scattr($atts['src']);
     return '<div class="su-lightbox' . su_ecssc($atts) . '" data-mfp-src="' . $lightbox_src . '" data-mfp-type="' . $atts['type'] . '">' . su_do_shortcode($content) . '</div>';
 }
Example #10
0
 public static function video($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('style' => 'dark', 'url' => false, 'poster' => false, 'title' => '', 'width' => 600, 'height' => 300, 'controls' => 'yes', 'autoplay' => 'no', 'volume' => 50, 'loop' => 'no', 'scroll_reveal' => '', 'class' => ''), $atts, 'video');
     $atts['url'] = su_scattr($atts['url']);
     $id = uniqid('su_video_player_');
     if (!$atts['url']) {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_VIDEO_CU'), 'warning');
     }
     $classes = array('su-video', 'jPlayer-' . $atts['style'], 'su-video-controls-' . $atts['controls'], su_ecssc($atts), 'jPlayer');
     $title = $atts['title'] ? '<div class="jplayer-title">' . $atts['title'] . '</div>' : '';
     suAsset::addFile('css', 'jplayer.skin.css');
     suAsset::addFile('js', 'jplayer.js');
     suAsset::addFile('js', 'video.js', __FUNCTION__);
     return '<div id="' . $id . '_container"' . su_scroll_reveal($atts) . ' class="' . su_acssc($classes) . '" data-id="' . $id . '" data-video="' . image_media($atts['url']) . '" data-poster="' . image_media($atts['poster']) . '" data-volume="' . $atts['volume'] . '" data-title="' . $atts['title'] . '" data-swf="' . (BDT_SU_URI . '/other/jplayer.swf') . '" data-autoplay="' . $atts['autoplay'] . '" data-loop="' . $atts['loop'] . '">
                 <div class="playerScreen">
                     <div id="' . $id . '" class="jPlayer-container"></div>' . $title . '
                     <a tabindex="1" href="#" class="video-play"><div class="play-icon"><i class="fa fa-play-circle-o"></i></div></a>
                 </div>
                 <div class="controls">
                     <div class="controlset left">
                         <a tabindex="1" href="#" class="play smooth"><i class="fa fa-play"></i></a>
                         <a tabindex="1" href="#" class="pause smooth"><i class="fa fa-pause"></i></a>
                     </div>
                     <div class="controlset right-volume">
                         <a tabindex="1" href="#" class="mute smooth"><i class="fa fa-volume-up"></i></a>
                         <a tabindex="1" href="#" class="unmute smooth"><i class="fa fa-volume-off"></i></a>
                     </div>
                     <div class="volumeblock">
                         <div class="volume-control"><div class="volume-value"></div></div>
                     </div>
                     <div class="controlset right">
                         <a href="#" tabindex="1" class="fullscreen smooth"><i class="fa fa-expand"></i></a>
                         <a href="#" tabindex="1" class="smallscreen smooth"><i class="fa fa-compress"></i></a>
                     </div>
                     <div class="jpprogress-block">
                         <div class="timer current"></div>
                         <div class="timer duration"></div>
                         <div class="jpprogress">
                             <div class="seekBar">
                                 <div class="playBar"></div>
                             </div>
                         </div>
                     </div>
  
                 </div>
             </div>';
 }
Example #11
0
 public static function screenr($atts = null, $content = null)
 {
     $return = array();
     $atts = su_shortcode_atts(array('url' => false, 'width' => 600, 'height' => 400, 'responsive' => 'yes', 'scroll_reveal' => '', 'class' => ''), $atts, 'screenr');
     if (!$atts['url']) {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SCREENR_CU'), 'warning');
     }
     $atts['url'] = su_scattr($atts['url']);
     $id = preg_match('~(?:<iframe [^>]*src=")?(?:https?:\\/\\/(?:[\\w]+\\.)*screenr\\.com(?:[\\/\\w]*\\/videos?)?\\/([a-zA-Z0-9]+)[^\\s]*)"?(?:[^>]*></iframe>)?(?:<p>.*</p>)?~ix', $atts['url'], $match) ? $match[1] : false;
     if (!$id) {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SCREENR_CI'), 'warning');
     }
     $return[] = '<div' . su_scroll_reveal($atts) . ' class="su-screenr su-responsive-media-' . $atts['responsive'] . su_ecssc($atts) . '">';
     $return[] = '<iframe width="' . $atts['width'] . '" height="' . $atts['height'] . '" src="http://screenr.com/embed/' . $id . '" allowfullscreen></iframe>';
     $return[] = '</div>';
     suAsset::addFile('css', 'screenr.css', __FUNCTION__);
     return implode('', $return);
 }
Example #12
0
 public static function audio($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('id' => uniqid('suap'), 'style' => 'dark', 'url' => false, 'width' => '100%', 'title' => '', 'autoplay' => 'no', 'volume' => 50, 'loop' => 'no', 'scroll_reveal' => '', 'class' => ''), $atts, 'audio');
     // Audio URL check
     if (!$atts['url']) {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_AUDIO_CU'), 'warning');
     }
     $atts['url'] = su_scattr($atts['url']);
     $width = $atts['width'] !== 'auto' ? 'max-width:' . $atts['width'] : '';
     // Add CSS file in head
     suAsset::addFile('css', 'jplayer.skin.css');
     suAsset::addFile('js', 'jplayer.js');
     suAsset::addFile('js', 'audio.js', __FUNCTION__);
     // Output HTML
     $output = '<div id="' . $atts['id'] . '_container"' . su_scroll_reveal($atts) . ' class="su-audio' . su_ecssc($atts) . ' jPlayer audioPlayer jPlayer-' . $atts['style'] . '" data-id="' . $atts['id'] . '" data-audio="' . image_media($atts['url']) . '" data-swf="' . BDT_SU_URI . '/other/jplayer.swf' . '" data-title="' . $atts['title'] . '" data-autoplay="' . $atts['autoplay'] . '" data-volume="' . $atts['volume'] . '" data-loop="' . $atts['loop'] . '">
                     <div class="playerScreen">
                         <div id="' . $atts['id'] . '" class="jPlayer-container"></div>
                     </div>
                     <div class="controls">
                         <div class="controlset left">
                             <a tabindex="1" href="#" class="play smooth"><i class="fa fa-play"></i></a>
                             <a tabindex="1" href="#" class="pause smooth"><i class="fa fa-pause"></i></a>
                         </div>
                         <div class="controlset right-volume">
                             <a tabindex="1" href="#" class="mute smooth"><i class="fa fa-volume-up"></i></a>
                             <a tabindex="1" href="#" class="unmute smooth"><i class="fa fa-volume-off"></i></a>
                         </div>
                         <div class="volumeblock">
                             <div class="volume-control"><div class="volume-value"></div></div>
                         </div>
                         <div class="jpprogress-block">
                             <div class="timer current"></div>
                             <div class="timer duration"></div>
                             <div class="jpprogress">
                                 <div class="seekBar">
                                     <div class="playBar"></div>
                                 </div>
                             </div>
                         </div>
      
                     </div>
                 </div>';
     return $output;
 }
Example #13
0
 public static function vimeo($atts = null, $content = null)
 {
     $return = array();
     $atts = su_shortcode_atts(array('url' => false, 'width' => 600, 'height' => 400, 'autoplay' => 'no', 'responsive' => 'yes', 'scroll_reveal' => '', 'class' => ''), $atts, 'vimeo');
     if (!$atts['url']) {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_VIMEO_CU'), 'warning');
     }
     $atts['url'] = su_scattr($atts['url']);
     $id = preg_match('~(?:<iframe [^>]*src=")?(?:https?:\\/\\/(?:[\\w]+\\.)*vimeo\\.com(?:[\\/\\w]*\\/videos?)?\\/([0-9]+)[^\\s]*)"?(?:[^>]*></iframe>)?(?:<p>.*</p>)?~ix', $atts['url'], $match) ? $match[1] : false;
     if (!$id) {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_VIMEO_CI'), 'warning');
     }
     $autoplay = $atts['autoplay'] === 'yes' ? '&amp;autoplay=1' : '';
     $return[] = '<div' . su_scroll_reveal($atts) . ' class="su-vimeo su-responsive-media-' . $atts['responsive'] . su_ecssc($atts) . '">';
     $return[] = '<iframe width="' . $atts['width'] . '" height="' . $atts['height'] . '" src="//player.vimeo.com/video/' . $id . '?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff' . $autoplay . '" allowfullscreen></iframe>';
     $return[] = '</div>';
     suAsset::addFile('css', 'vimeo.css', __FUNCTION__);
     return implode('', $return);
 }
Example #14
0
 public static function youtube($atts = null, $content = null)
 {
     $return = array();
     $atts = su_shortcode_atts(array('url' => false, 'width' => 600, 'height' => 400, 'autoplay' => 'no', 'responsive' => 'yes', 'scroll_reveal' => '', 'class' => ''), $atts, 'youtube');
     if (!$atts['url']) {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_YOUTUBE_CU'), 'warning');
     }
     $atts['url'] = su_scattr($atts['url']);
     $id = preg_match('%(?:youtube(?:-nocookie)?\\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\\.be/)([^"&?/ ]{11})%i', $atts['url'], $match) ? $match[1] : false;
     if (!$id) {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_YOUTUBE_CI'), 'warning');
     }
     // Prepare protocol
     $protocol = preg_match('/^(https?:\\/\\/)/i', $atts['url'], $match) ? $match[1] : "http://";
     $autoplay = $atts['autoplay'] === 'yes' ? '?autoplay=1' : '';
     $return[] = '<div' . su_scroll_reveal($atts) . ' class="su-youtube su-responsive-media-' . $atts['responsive'] . su_ecssc($atts) . '">';
     $return[] = '<iframe width="' . $atts['width'] . '" height="' . $atts['height'] . '" src="' . $protocol . 'www.youtube.com/embed/' . $id . $autoplay . '" allowfullscreen></iframe>';
     $return[] = '</div>';
     suAsset::addFile('css', 'youtube.css', __FUNCTION__);
     return implode('', $return);
 }
Example #15
0
 public static function gmap($atts = null, $content = null)
 {
     $atts = shortcode_atts(array('width' => 600, 'height' => 400, 'responsive' => 'yes', 'address' => 'New York', 'class' => ''), $atts, 'gmap');
     su_query_asset('css', 'su-media-shortcodes');
     return '<div class="su-gmap su-responsive-media-' . $atts['responsive'] . su_ecssc($atts) . '"><iframe width="' . $atts['width'] . '" height="' . $atts['height'] . '" src="http://maps.google.com/maps?q=' . urlencode(su_scattr($atts['address'])) . '&amp;output=embed"></iframe></div>';
 }
Example #16
0
 public static function button($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('style' => 'default', 'url' => '#', 'target' => 'self', 'color' => '#FFFFFF', 'background' => '#2D89EF', 'background_hover' => '', 'size' => 3, 'wide' => 'no', 'center' => 'no', 'radius' => '3px', 'icon' => false, 'icon_color' => '#FFFFFF', 'desc' => '', 'onclick' => '', 'rel' => '', 'title' => '', 'padding' => '', 'margin' => '', 'scroll_reveal' => '', 'class' => ''), $atts, 'button');
     // Initioal Variables
     $id = uniqid('subtn_');
     $css = array();
     $js = array();
     $borderBtn = '';
     $borderBtnHover = '';
     // Prepare vars
     $before = $after = '';
     // Common styles for button
     $btn_size = round(($atts['size'] + 7) * 1.25);
     // Background hover check
     if ($atts['background_hover']) {
         $bg_hover = $atts['background_hover'];
     } elseif ($atts['background'] != 'transparent') {
         $bg_hover = su_color::lighten($atts['background']);
     } else {
         $bg_hover = '';
     }
     $lineheight = $atts['icon'] ? 'line-height:' . round($btn_size * 1.5) . 'px;' : 'line-height:' . round($btn_size * 2) . 'px;';
     if ($atts['padding']) {
         $padding = 'padding: ' . $atts['padding'] . ';';
     } else {
         $padding = $atts['icon'] ? 'padding: ' . round($atts['size'] / 2 + 4) . 'px ' . round($atts['size'] * 2 + 10) . 'px;' : 'padding: ' . '4px ' . round($atts['size'] * 2 + 10) . 'px;';
     }
     $radius = $atts['radius'] ? '-webkit-border-radius: ' . $atts['radius'] . '; border-radius: ' . $atts['radius'] . ';' : '';
     $margin = $atts['margin'] ? 'margin: ' . $atts['margin'] . ';' : '';
     if ($atts['style'] === 'border') {
         $borderBtn = 'border-color: ' . $atts['color'] . ';';
         $borderBtnHover = 'border-color: ' . su_color::lighten($atts['color']) . ';';
     }
     // CSS rules for <a> tag
     $css[] = 'a#' . $id . ' { color: ' . $atts['color'] . '; background-color: ' . $atts['background'] . ';' . $radius . $borderBtn . $margin . '}';
     $css[] = 'a#' . $id . ' span { font-size: ' . $btn_size . 'px;' . $radius . $lineheight . $padding . '}';
     if ($bg_hover) {
         $css[] = 'a#' . $id . ':hover { background-color: ' . $bg_hover . ';}';
     } elseif ($atts['style'] === 'border') {
         $css[] = 'a#' . $id . ':hover {' . $borderBtnHover . '}';
     }
     if ($atts['desc']) {
         $css[] = 'a#' . $id . ' small {padding-bottom:' . round($atts['size'] / 2 + 4) . 'px;color: ' . $atts['color'] . ';}';
     }
     if ($atts['style'] === '3d') {
         $css[] = 'a#' . $id . '.su-button-style-3d { box-shadow: 0 ' . round($atts['size']) . 'px 0 ' . su_color::darken($atts['background'], '6%') . '; }';
         $css[] = 'a#' . $id . '.su-button-style-3d:active { box-shadow: 0 1px 0 ' . su_color::darken($atts['background'], '8%') . '; top: ' . round($atts['size'] - 1) . 'px }';
     }
     // Prepare button classes
     $classes = array('su-button', 'su-button-style-' . $atts['style']);
     // Additional classes
     if ($atts['class']) {
         $classes[] = $atts['class'];
     }
     // Wide class
     if ($atts['wide'] === 'yes') {
         $classes[] = 'su-button-wide';
     }
     // Prepare icon
     if ($atts['icon']) {
         if (strpos($atts['icon'], 'licon:') !== false) {
             suAsset::addFile('css', 'linea.css');
             $icon = '<i class="li li-' . trim(str_replace('licon:', '', $atts['icon'])) . '"></i>';
             $css[] = 'a#' . $id . ' i {font-size:' . $btn_size . 'px; color:' . $atts['icon_color'] . '}';
         } elseif (strpos($atts['icon'], 'icon:') !== false) {
             $icon = '<i class="fa fa-' . trim(str_replace('icon:', '', $atts['icon'])) . '"></i>';
             $css[] = 'a#' . $id . ' i {font-size:' . $btn_size . 'px; color:' . $atts['icon_color'] . '}';
         } else {
             $icon = '<img src="' . image_media($atts['icon']) . '" alt="' . esc_attr($content) . '"/>';
             $css[] = 'a#' . $id . ' img {width:' . round($btn_size * 1.5) . 'px; height:' . round($btn_size * 1.5) . 'px;}';
         }
     } else {
         $icon = '';
     }
     // Prepare <small> with description
     $desc = $atts['desc'] ? '<small>' . su_scattr($atts['desc']) . '</small>' : '';
     // Wrap with div if button centered
     if ($atts['center'] === 'yes') {
         $before .= '<div class="su-button-center">';
         $after .= '</div>';
     }
     // Replace icon marker in content,
     // add float-icon class to rearrange margins
     if (strpos($content, '%icon%') !== false) {
         $content = str_replace('%icon%', $icon, $content);
         $classes[] = 'su-button-float-icon';
     } else {
         $content = $icon . ' ' . $content;
     }
     // Prepare onclick action
     $atts['onclick'] = $atts['onclick'] ? ' onClick="' . $atts['onclick'] . '"' : '';
     // Prepare rel attribute
     $atts['rel'] = $atts['rel'] ? ' rel="' . $atts['rel'] . '"' : '';
     // Prepare title attribute
     $atts['title'] = $atts['title'] ? ' title="' . $atts['title'] . '"' : '';
     // put css in head
     suAsset::addFile('css', 'button.css', __FUNCTION__);
     suAsset::addString('css', implode("\n", $css));
     return $before . '<a id="' . $id . '" href="' . su_scattr($atts['url']) . '"' . su_scroll_reveal($atts) . ' class="' . su_acssc($classes) . '" target="_' . $atts['target'] . '"' . $atts['onclick'] . $atts['rel'] . $atts['title'] . '><span>' . su_do_shortcode(stripcslashes($content)) . $desc . '</span></a>' . $after;
 }