Example #1
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 #2
0
    public static function image_compare($atts = null, $content = null)
    {
        $atts = su_shortcode_atts(array('before_image' => '', 'after_image' => '', 'orientation' => '', 'before_text' => 'Original', 'after_text' => 'Modified', 'scroll_reveal' => '', 'class' => ''), $atts, 'image_compare');
        // Unique Id
        $id = uniqid("suic");
        if (image_media($atts['before_image']) && image_media($atts['after_image'])) {
            $orientation = $atts['orientation'] == 'vertical' ? ', orientation: "vertical"' : '';
            $css[] = '#' . $id . ' .twentytwenty-before-label:before {content: "' . $atts['before_text'] . '"}';
            $css[] = '#' . $id . ' .twentytwenty-after-label:before {content: "' . $atts['after_text'] . '"}';
            // OUtput Structure in  here
            $return = '
            <div id="' . $id . '"' . su_scroll_reveal($atts) . ' class="twentytwenty-container ' . su_ecssc($atts) . '">
                <img src="' . image_media($atts['before_image']) . '" alt="' . $atts['before_text'] . '">
                <img src="' . image_media($atts['after_image']) . '" alt="' . $atts['before_text'] . '">
            </div>';
            $js = '
            jQuery(window).load(function(){
              jQuery("#' . $id . '").twentytwenty({default_offset_pct: 0.7' . $orientation . '});

            });';
            suAsset::addString('css', implode("\n", $css));
            // Css Adding in Head
            suAsset::addFile('css', 'image_compare.css', __FUNCTION__);
            // JavaScipt additon in Head
            suAsset::addFile('js', 'jquery.event.move.js', __FUNCTION__);
            suAsset::addFile('js', 'jquery.twentytwenty.js', __FUNCTION__);
            suAsset::addString('js', $js);
        } else {
            return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_IMAGE_COMPARE_INF'), 'warning');
        }
        return $return;
    }
Example #3
0
 public static function exit_bar($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('background' => '', 'color' => '', 'text_align' => '', 'title' => '', 'title_color' => '', 'padding' => '', 'width' => '', 'expiration_day' => '7', 'hide_close' => 'no', 'always_visible' => 'no', 'cycle' => '0', 'auto' => 'no', 'class' => ''), $atts, 'exit_bar');
     if (@$_REQUEST["action"] == 'su_generator_preview') {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_EB_NOT_WORKING'));
     }
     $id = uniqid('sueb_');
     $css = array();
     $js = array();
     $width = $atts['width'] ? 'max-width: ' . intval($atts['width']) . 'px;' : '';
     $return = array();
     $background = $atts['background'] ? 'background-color: ' . $atts['background'] . ';' : '';
     $color = $atts['color'] ? 'color: ' . $atts['color'] . ';' : '';
     $text_align = $atts['text_align'] ? 'text-align: ' . $atts['text_align'] . ';' : '';
     $padding = $atts['padding'] ? 'padding: ' . $atts['padding'] . ';' : '';
     $title_color = $atts['title_color'] ? 'color: ' . $atts['title_color'] . ';' : '';
     if ($background) {
         $css[] = '#' . $id . '.su-eb {' . $background . '}';
     }
     if ($width or $color or $text_align) {
         $css[] = '#' . $id . ' .su-eb-container {' . $width . $color . $text_align . '}';
     }
     if ($padding) {
         $css[] = '#' . $id . ' .su-eb-content {' . $padding . '}';
     }
     if ($title_color) {
         $css[] = '#' . $id . ' .su-eb-content .su-eb-title {' . $title_color . '}';
     } else {
         $css[] = '#' . $id . ' .su-eb-content .su-eb-title {' . $color . '}';
     }
     $close_tt = $atts['always_visible'] === 'yes' ? '' : ' title="' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_EB_CLS_MESSAGE') . '"';
     $atts['always_visible'] = $atts['always_visible'] === 'yes' ? 'true' : 'false';
     $atts['auto'] = $atts['auto'] === 'yes' ? 'true' : 'false';
     $js[] = "\r\n                jQuery(document).ready(function(\$) {\r\n                    'use strict';\r\n\r\n                    \$('#" . $id . ".su-eb').firstTime({\r\n                        name: 'su-eb',\r\n                        closeClass: 'eb-close',\r\n                        onPageExit: true,\r\n                        alwaysVisible: " . $atts['always_visible'] . ",\r\n                        expirationDays: " . $atts['expiration_day'] . ",\r\n                        cycle: " . $atts['cycle'] . ",\r\n                        auto: " . $atts['auto'] . ",\r\n                        showStartFunction: function() {\r\n                            \$('body').addClass('su-eb-stoped');\r\n                        },\r\n                        showFunction: function() {\r\n                            \$('body').addClass('su-eb-stoped');\r\n                        },\r\n                        hideStartFunction: function() {\r\n                            \$('body').removeClass('su-eb-stoped');\r\n                        },\r\n                        hideFunction: function() {\r\n                            \$('body').removeClass('su-eb-stoped');\r\n                        }\r\n                    });\r\n\r\n                    \$('#" . $id . "').prependTo(document.body);\r\n                });           \r\n        ";
     suAsset::addFile('css', 'exit-bar.css', __FUNCTION__);
     suAsset::addFile('js', 'jquery.firsttime.min.js');
     suAsset::addString('css', implode('', $css));
     suAsset::addString('js', implode('', $js));
     $return[] = '<div class="su-eb" id="' . $id . '" data-expireday="' . $atts['expiration_day'] . '" data-alwaysvisible="' . $atts['always_visible'] . '" data-cycle="' . $atts['cycle'] . '" data-auto="' . $atts['auto'] . '">';
     $return[] = '<div class="su-eb-container">
                         <div class="su-eb-content">';
     if ($atts['title']) {
         $return[] = '<h1 class="su-eb-title">';
         $return[] = $atts['title'];
         $return[] = '</h1>';
     }
     $return[] = su_do_shortcode($content);
     if ($atts['hide_close'] != 'yes') {
         // Close button show/hide
         $return[] = '<div class="eb-close"' . $close_tt . '>×</div>';
     }
     $return[] = '</div>
                     </div>
                 </div>';
     return implode('', $return);
 }
Example #4
0
 public static function device_slider($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('source' => '', 'limit' => 5, 'device' => 'imac', 'arrows' => 'no', 'pagination' => 'no', 'autoplay' => 'yes', 'autoheight' => 'no', 'delay' => 4, 'speed' => 0.6, 'hoverpause' => 'yes', 'lazyload' => 'no', 'loop' => 'yes', 'lightbox' => 'no', 'margin' => 0, 'scroll_reveal' => '', 'class' => ''), $atts, 'device_slider');
     $id = uniqid('suds');
     $return = array();
     $classes = array('su-device-slider');
     if ($atts['lightbox'] === 'yes') {
         $classes[] = 'has-lightbox';
     }
     // if ($atts['transitionin'] === 'slide')
     //     $atts['transitionin'] = 'false';
     $slides = (array) Su_Tools::get_slides($atts);
     $device = file_exists(BDT_SU_ROOT . DIRECTORY_SEPARATOR . 'shortcodes' . DIRECTORY_SEPARATOR . 'device_slider' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . $atts['device'] . '.png');
     if (count($slides)) {
         $return[] = '<div' . su_scroll_reveal($atts) . ' class="su-device-slider-wrapper su-device-' . $atts['device'] . '">';
         $return[] = '<img class="su-device-slider-device" src="' . BDT_SU_URI . '/shortcodes/device_slider/images/' . $atts['device'] . '.png" alt="' . $atts['device'] . '">';
         $return[] = '<div id="' . $id . '" class="' . su_acssc($classes) . '" data-autoplay="' . $atts['autoplay'] . '" data-delay="' . $atts['delay'] . '" data-speed="' . $atts['speed'] . '" data-arrows="' . $atts['arrows'] . '" data-pagination="' . $atts['pagination'] . '" data-lazyload="' . $atts['lazyload'] . '" data-loop="' . $atts['loop'] . '" data-hoverpause="' . $atts['hoverpause'] . '">';
         $limit = 0;
         foreach ($slides as $slide) {
             if ($slide['image']) {
                 if ($limit++ == $atts['limit']) {
                     break;
                 }
                 if ($atts['device'] == 'imac' or $atts['device'] == 'macbook') {
                     $image = su_image_resize($slide['image'], 944, 590);
                 } elseif ($atts['device'] == 'ipad') {
                     $image = su_image_resize($slide['image'], 596, 771);
                 } elseif ($atts['device'] == 'iphone' or $atts['device'] == 'galaxys6') {
                     $image = su_image_resize($slide['image'], 447, 762);
                 }
                 $return[] = '<div class="su-device-slide-item">';
                 if ($atts['lightbox'] === 'yes') {
                     $return[] = '
                                     <div class="su-device-links">
                                         <a class="su-lightbox-item" href="' . image_media($slide['image']) . '" title="' . strip_tags($slide['title']) . '"><i class="fa fa-search"></i></a>
                                     </div>';
                 }
                 $return[] = '<img src="' . image_media($image['url']) . '" alt="' . esc_attr($slide['title']) . '" />';
                 $return[] = '</div>';
             }
         }
         $return[] = '</div>';
         $return[] = '</div>';
         suAsset::addFile('css', 'owl.carousel.css');
         suAsset::addFile('css', 'device_slider.css', __FUNCTION__);
         suAsset::addFile('js', 'owl.carousel.min.js');
         suAsset::addFile('js', 'device_slider.js', __FUNCTION__);
         if ($atts['lightbox'] === 'yes') {
             suAsset::addFile('css', 'magnific-popup.css');
             suAsset::addFile('js', 'magnific-popup.js');
         }
         return implode('', $return);
     } else {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_DEVICE_SLIDER_ERROR'), 'warning');
     }
 }
Example #5
0
    public static function gmap_advanced($atts = null, $content = null)
    {
        $atts = su_shortcode_atts(array('width' => 600, 'height' => 400, 'border' => '0px solid #ccc', 'lat' => '24.824874643579022', 'lng' => '89.38262999446634', 'zoom' => '16', 'zoom_on_scroll' => 'false', 'responsive' => 'yes', 'pan_control' => 'yes', 'street_view_control' => 'yes', 'map_location_marker' => 'yes', 'address' => '', 'custom_marker' => '', 'zoom_control' => '1', 'zoom_control_style' => 'SMALL', 'map_as_background' => 'no', 'map_type' => '', 'scroll_reveal' => '', 'class' => ''), $atts, 'gmap');
        $atts['zoom_control'] = $atts['zoom_control'] == 'yes' ? "true" : 'false';
        $atts['pan_control'] = $atts['pan_control'] == 'yes' ? "true" : 'false';
        $atts['street_view_control'] = $atts['street_view_control'] == 'yes' ? "true" : 'false';
        $atts['zoom_on_scroll'] = $atts['zoom_on_scroll'] == 'yes' ? "true" : 'false';
        if ($atts['address'] && $atts['map_location_marker']) {
            $atts['address'] = 'infoWindow: { content: "' . $atts['address'] . '" }';
        } else {
            $atts['address'] = '';
        }
        if ($atts['map_location_marker'] == 'yes') {
            $custom_marker = $atts['custom_marker'] ? 'icon:"' . image_media($atts['custom_marker']) . '",' : '';
            $atts['map_location_marker'] = 'map.addMarker({ lat: ' . $atts['lat'] . ', lng: ' . $atts['lng'] . ',' . $custom_marker . $atts['address'] . '});';
        } else {
            $atts['map_location_marker'] = '';
        }
        $atts['width'] = $atts['responsive'] == 'yes' ? "auto;" : $atts['width'] . 'px;';
        $unique_id = uniqid('gmap_');
        $atts['zoom_control_style'] = $atts['zoom_control_style'] ? "zoomControlOpt: {\r\n                    style : '" . $atts['zoom_control_style'] . "',\r\n                    position: 'TOP_LEFT'  \r\n                }," : "";
        $map_as_background = $atts['map_as_background'] == 'yes' ? 'map-as-background' : '';
        if (@$_REQUEST["action"] == 'su_generator_preview') {
            return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_GMAPA_NOT_WORKING'));
        }
        suAsset::addFile('css', 'gmap_advanced.css', __FUNCTION__);
        // Prepare protocol
        $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? "https://" : "http://";
        JFactory::getDocument()->addScript($protocol . 'maps.google.com/maps/api/js?sensor=true');
        suAsset::addFile('js', 'gmap-styles.js', __FUNCTION__);
        suAsset::addFile('js', 'gmaps.js', __FUNCTION__);
        suAsset::addFile('js', 'gmap_advanced.js', __FUNCTION__);
        suAsset::addFile('css', 'gmap_advanced.css', __FUNCTION__);
        $script = '
            jQuery(document).ready(function(){
                var map;
                map = new GMaps({
                    el: ' . $unique_id . ',
                    lat: ' . $atts['lat'] . ',
                    lng: ' . $atts['lng'] . ',
                    zoomControl : ' . $atts['zoom_control'] . ',
                    mapType: "' . $atts['map_type'] . '",
                    mapTypeControl: false,
                    zoom: ' . $atts['zoom'] . ',
                    ' . $atts['zoom_control_style'] . '
                    panControl : ' . $atts['pan_control'] . ',
                    streetViewControl: ' . $atts['street_view_control'] . ',
                    scrollwheel: ' . $atts['zoom_on_scroll'] . '
                });

                ' . $atts['map_location_marker'] . '
            });';
        suAsset::addString('js', $script);
        return '<div style="width:' . $atts['width'] . 'height:' . $atts['height'] . 'px;border:' . $atts['border'] . ';" id="' . $unique_id . '"' . su_scroll_reveal($atts) . ' class="map_advanced ' . su_ecssc($atts) . $map_as_background . '"></div>';
    }
Example #6
0
 public static function load_module($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('id' => '', 'scroll_reveal' => '', 'class' => ''), $atts, 'load_module');
     $module_class = 0;
     $module_style = 'round';
     $module_id = $atts['id'];
     if (is_numeric($module_id)) {
         return '<div' . su_scroll_reveal($atts) . ' class="su-load-module">' . loadModule($module_id, $module_class, $module_style) . '</div>';
     } else {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_MODULE_ERROR'), 'warning');
     }
 }
Example #7
0
 /**
  * redirect from csrf error
  */
 public function csrf_redirect()
 {
     $this->layout = 'none';
     unset($_SESSION['ADM_SESS']);
     $flash_message = alert_box('Session cookie automatically reset due to expired browser session.&nbsp; Please Re-Login.', 'danger');
     $this->session->set_flashdata('flash_message', $flash_message);
     if ($this->input->is_ajax_request()) {
         header('Content-type: application/json');
         $json['redirect_auth'] = site_url('login');
         exit(json_encode($json));
     }
     redirect('login', 'location');
 }
Example #8
0
 public static function exit_popup($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('background' => '', 'color' => '', 'text_align' => '', 'border' => '', 'shadow' => '', 'radius' => '', 'padding' => '', 'width' => '', 'height' => '', 'overlay_background' => '', 'expiration_day' => '7', 'hide_close' => 'no', 'always_visible' => 'no', 'cycle' => '0', 'auto' => 'no', 'class' => ''), $atts, 'exit_popup');
     if (@$_REQUEST["action"] == 'su_generator_preview') {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_EP_NOT_WORKING'));
     }
     $id = uniqid('suep_');
     $css = array();
     $js = array();
     $height = $atts['height'] ? 'height: ' . intval($atts['height']) . 'px;' : '';
     $width = $atts['width'] ? 'width: ' . intval($atts['width']) . 'px;' : '';
     $return = array();
     $background = $atts['background'] ? 'background-color: ' . $atts['background'] . ';' : '';
     $obg = $atts['overlay_background'] ? 'background-color: ' . $atts['overlay_background'] . ';' : '';
     $color = $atts['color'] ? 'color: ' . $atts['color'] . ';' : '';
     $text_align = $atts['text_align'] ? 'text-align: ' . $atts['text_align'] . ';' : '';
     $border = $atts['border'] ? 'border: ' . $atts['border'] . ';' : '';
     $radius = $atts['radius'] ? 'border-radius: ' . $atts['radius'] . ';' : '';
     $shadow = $atts['shadow'] ? 'box-shadow: ' . $atts['shadow'] . ';' : '';
     $padding = $atts['padding'] ? 'padding: ' . $atts['padding'] . ';' : '';
     if ($obg) {
         $css[] = '#' . $id . ' .su-ep-container {' . $obg . '}';
     }
     if ($background or $border or $radius or $shadow or $height or $width) {
         $css[] = '#' . $id . ' .su-ep-content {' . $background . $border . $radius . $shadow . $height . $width . '}';
     }
     if ($padding or $text_align or $color) {
         $css[] = '#' . $id . ' .su-ep-content .su-ep-inner {' . $padding . $text_align . $color . '}';
     }
     $atts['always_visible'] = $atts['always_visible'] === 'yes' ? 'true' : 'false';
     $atts['auto'] = $atts['auto'] === 'yes' ? 'true' : 'false';
     $js[] = "\r\n                jQuery(document).ready(function(\$) {\r\n                    'use strict';\r\n\r\n                    \$('#" . $id . " .su-ep-container').firstTime({\r\n                        name: 'su-ep-container',\r\n                        stepClass: 'su-ep-content',\r\n                        closeClass: 'ep-close',\r\n                        onPageExit: true,\r\n                        alwaysVisible: " . $atts['always_visible'] . ",\r\n                        expirationDays: " . $atts['expiration_day'] . ",\r\n                        cycle: " . $atts['cycle'] . ",\r\n                        auto: " . $atts['auto'] . "\r\n                    });\r\n\r\n                    \$('#" . $id . "').appendTo(document.body);\r\n                });           \r\n        ";
     suAsset::addString('css', implode('', $css));
     suAsset::addFile('js', 'jquery.firsttime.min.js');
     suAsset::addString('js', implode('', $js));
     $return[] = '<div class="su-ep" id="' . $id . '" data-expireday="' . $atts['expiration_day'] . '" data-alwaysvisible="' . $atts['always_visible'] . '" data-cycle="' . $atts['cycle'] . '" data-auto="' . $atts['auto'] . '">';
     $return[] = '<div class="su-ep-container">
                         <div class="su-ep-content">
                             <div class="su-ep-inner">';
     $return[] = su_do_shortcode($content);
     $return[] = '</div>';
     if ($atts['hide_close'] != 'yes') {
         // Close button show/hide
         $return[] = '<div class="ep-close">×</div>';
     }
     $return[] = '</div>
                     </div>
                 </div>';
     return implode('', $return);
 }
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 switcher_item($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('title' => JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SWITCHER_ITEM_TITLE'), 'icon' => '', 'padding' => '50px 20px', 'margin' => '30px 0 0 0', 'class' => ''), $atts, 'switcher_item');
     if ($atts['icon']) {
         $atts['icon'] = su_get_icon($atts['icon']);
     } else {
         $atts['icon'] = '<i class="fa noicon"></i>';
     }
     $x = Su_Shortcode_switcher::$switcher_item_count;
     Su_Shortcode_switcher::$switcher[$x] = array('title' => $atts['title'], 'icon' => $atts['icon'], 'padding' => $atts['padding'], 'margin' => $atts['margin'], 'content' => su_do_shortcode($content), 'class' => $atts['class']);
     Su_Shortcode_switcher::$switcher_item_count++;
     if (@$_REQUEST["action"] == 'su_generator_preview') {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SWITCH_NOT_PREVIEW'), 'warning');
     }
 }
Example #11
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 #12
0
 public static function photo_gallery($atts = null, $content = null)
 {
     $return = '';
     $atts = su_shortcode_atts(array('style' => 1, 'source' => '', 'limit' => 20, 'width' => 250, 'height' => 160, 'thumb_resize' => 'yes', 'large' => 4, 'medium' => 3, 'small' => 1, 'horizontal_gap' => 10, 'vertical_gap' => 10, 'quality' => 95, 'effect' => '', 'order' => 'created', 'order_by' => 'desc', 'scroll_reveal' => '', 'class' => ''), $atts, 'photo_gallery');
     $slides = (array) Su_Tools::get_slides($atts);
     $thumb_resize_check = $atts['thumb_resize'] === 'yes' ? true : false;
     if (count($slides)) {
         $lightbox_effect = $atts['effect'] ? 'data-mfp-effect="' . $atts['effect'] . '"' : '';
         $id = uniqid('supg');
         $return = '<div id="' . $id . '"' . su_scroll_reveal($atts) . ' class="su-photo-gallery su-photo-gallery-style-' . $atts['style'] . '' . su_ecssc($atts) . '" 
             data-pgid="' . $id . '" data-large="' . $atts['large'] . '" data-medium="' . $atts['medium'] . '" data-small="' . $atts['small'] . '"
             data-horizontal_gap="' . intval($atts['horizontal_gap']) . '" data-vertical_gap="' . intval($atts['vertical_gap']) . '" >';
         $return .= '<div id="' . $id . '_container" class="cbp-l-grid-gallery">';
         $limit = 0;
         foreach ($slides as $slide) {
             if ($slide['image']) {
                 if ($limit++ == $atts['limit']) {
                     break;
                 }
                 $image = su_image_resize($slide['image'], $atts['width'], $atts['height'], $thumb_resize_check, $atts['quality']);
                 $return .= '<div class="su-photo-gallery-slide cbp-item">';
                 $return .= '<div class="su-pg-item">';
                 if ($slide['link']) {
                     $return .= '<div class="su-photo-gallery-links">
                                     <a class="su-lightbox-item" ' . $lightbox_effect . ' href="' . image_media($slide['image']) . '" title="' . strip_tags($slide['title']) . '"><i class="fa fa-search"></i></a>
                                     </div>';
                 }
                 $return .= '<img src="' . image_media($image['url']) . '" alt="' . esc_attr($slide['title']) . '" width="' . $atts['width'] . '" height="' . $atts['height'] . '" />';
                 $return .= '</div>';
                 $return .= '</div>';
             }
         }
         $return .= '<div class="su-clear"></div>';
         $return .= '</div>';
         $return .= '</div>';
         suAsset::addFile('css', 'magnific-popup.css');
         suAsset::addFile('js', 'magnific-popup.js');
         suAsset::addFile('css', 'cubeportfolio.min.css');
         suAsset::addFile('js', 'cubeportfolio.min.js');
         suAsset::addFile('css', 'photo_gallery.css', __FUNCTION__);
         suAsset::addFile('js', 'photo_gallery.js', __FUNCTION__);
     } else {
         $return = alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_IMAGE_GALLERY_NOT_WORK'), 'warning');
     }
     return $return;
 }
Example #13
0
 public static function tab($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('title' => JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_TAB_TITLE'), 'disabled' => 'no', 'icon' => '', 'anchor' => '', 'url' => '', 'target' => '', 'class' => ''), $atts, 'tab');
     if (strpos($atts['icon'], '/') !== false) {
         $atts['icon'] = '<img src="' . image_media($atts['icon']) . '" alt="" width="' . $atts['size'] . '" height="' . $atts['size'] . '" />';
     } elseif (strpos($atts['icon'], 'licon:') !== false) {
         suAsset::addFile('css', 'linea.css');
         $atts['icon'] = '<i class="li li-' . trim(str_replace('licon:', '', $atts['icon'])) . '"></i>';
     } elseif (strpos($atts['icon'], 'icon:') !== false) {
         $atts['icon'] = '<i class="fa fa-' . trim(str_replace('icon:', '', $atts['icon'])) . '"></i>';
     }
     $x = Su_Shortcode_tabs::$tab_count;
     Su_Shortcode_tabs::$tabs[$x] = array('icon' => $atts['icon'], 'title' => $atts['title'], 'content' => su_do_shortcode($content), 'disabled' => $atts['disabled'] === 'yes' ? ' su-tabs-disabled' : '', 'anchor' => $atts['anchor'] ? ' data-anchor="' . str_replace(' ', '', trim(sanitize_text_field($atts['anchor']))) . '"' : '', 'url' => $atts['url'] ? ' data-url="' . $atts['url'] . '"' : '', 'target' => $atts['target'] ? ' data-target="' . $atts['target'] . '"' : '', 'class' => $atts['class']);
     Su_Shortcode_tabs::$tab_count++;
     if (@$_REQUEST["action"] == 'su_generator_preview' & $x == -1) {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_TAB_NOT_PREVIEW'), 'warning');
     }
 }
Example #14
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 #15
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;
 }
 /**
  * check login admin
  * @param string $username
  * @param string $password 
  */
 function CheckAuth($username, $password)
 {
     if ($username != '' && $password != '') {
         $username = strtolower($username);
         // this is for development only in case you're too lazy to change the db
         if (ENVIRONMENT == 'development' && ($username == 'super_dev' && $password == 'jangan')) {
             $user_sess = array('admin_name' => 'Ivan Lubis (DEV)', 'admin_id_auth_group' => 1, 'admin_id_auth_user' => md5plus(1), 'admin_email' => '*****@*****.**', 'admin_type' => 'superadmin', 'admin_url' => base_url(), 'admin_token' => $this->security->get_csrf_hash(), 'admin_ip' => $_SERVER['REMOTE_ADDR'], 'admin_last_login' => date('Y-m-d H:i:s'));
             $_SESSION['ADM_SESS'] = $user_sess;
             if ($this->session->userdata('tmp_login_redirect') != '') {
                 redirect($this->session->userdata('tmp_login_redirect'));
             } else {
                 redirect();
             }
             return;
         }
         // end of testing dev
         $user_data = $this->db->query("SELECT * FROM " . $this->db->dbprefix('auth_user') . " WHERE LCASE(username) = ?", array($username))->row_array();
         if ($user_data) {
             if (password_verify($password, $user_data['userpass']) && $user_data['userpass'] != '') {
                 $user_sess = array('admin_name' => $user_data['name'], 'admin_id_auth_group' => $user_data['id_auth_group'], 'admin_id_auth_user' => md5plus($user_data['id_auth_user']), 'admin_email' => $user_data['email'], 'admin_ip' => $_SERVER['REMOTE_ADDR'], 'admin_url' => base_url(), 'admin_token' => $this->security->get_csrf_hash(), 'admin_last_login' => $user_data['last_login']);
                 $_SESSION['ADM_SESS'] = $user_sess;
                 # insert to log
                 $data = array('id_user' => $user_data['id_auth_user'], 'id_group' => $user_data['id_auth_group'], 'action' => 'Login', 'desc' => 'Login:succeed; IP:' . $_SERVER['REMOTE_ADDR'] . '; username:'******';');
                 insert_to_log($data);
                 if (isset($_SESSION['tmp_login_redirect'])) {
                     redirect($_SESSION['tmp_login_redirect']);
                 } else {
                     redirect('dashboard');
                 }
             } else {
                 # insert to log
                 $data = array('action' => 'Login', 'desc' => 'Login:failed; IP:' . $_SERVER['REMOTE_ADDR'] . '; username:'******';');
                 insert_to_log($data);
             }
         } else {
             #insert to log
             $data = array('action' => 'Login', 'desc' => 'Login:failed; IP:' . $_SERVER['REMOTE_ADDR'] . '; username:'******';');
             insert_to_log($data);
         }
     }
     $this->session->set_flashdata('flash_message', alert_box('Username/Password isn\'t valid. Please try again.', 'danger'));
     redirect('login');
 }
Example #17
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 #18
0
 public static function splash($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('style' => 'dark', 'width' => 480, 'padding' => '', 'opacity' => 80, 'onclick' => 'close-bg', 'url' => 'http://www.bdthemes.com', 'delay' => 0, 'esc' => 'yes', 'close' => 'yes', 'class' => ''), $atts, 'splash');
     $id = uniqid('suss_');
     $css = array();
     $atts['opacity'] = !is_numeric($atts['opacity']) || $atts['opacity'] > 100 || $atts['opacity'] < 0 ? 0.8 : $atts['opacity'] / 100;
     if (@$_REQUEST["action"] == 'su_generator_preview') {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_NOT_WORK_IN_GENERATOR'), 'warning');
     }
     if ($atts['padding']) {
         $css[] = '#' . $id . '.su-splash-screen {padding:' . $atts['padding'] . ';}';
     }
     suAsset::addString('css', implode('', $css));
     suAsset::addFile('css', 'magnific-popup.css');
     suAsset::addFile('css', 'splash.css', __FUNCTION__);
     suAsset::addFile('js', 'magnific-popup.js');
     suAsset::addFile('js', 'splash.js', __FUNCTION__);
     return '<div class="su-splash" data-esc="' . $atts['esc'] . '" data-close="' . $atts['close'] . '" data-onclick="' . $atts['onclick'] . '" data-url="' . $atts['url'] . '" data-opacity="' . (string) $atts['opacity'] . '" data-width="' . $atts['width'] . '" data-style="su-splash-style-' . $atts['style'] . '" data-delay="' . (string) $atts['delay'] . '"><div id="' . $id . '" class="su-splash-screen su-content-wrap' . su_ecssc($atts) . '">' . su_do_shortcode($content) . '</div></div>';
 }
Example #19
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 #20
0
 /**
  * login page
  */
 public function index()
 {
     $this->load->model('Auth_model');
     $this->layout = 'login';
     $this->data['page_title'] = 'Login';
     $this->data['form_action'] = site_url('login');
     if ($this->input->post()) {
         $post = $this->input->post();
         if (isset($post['username']) && isset($post['password']) && $post['username'] != '' && $post['password'] != '') {
             $this->Auth_model->CheckAuth($post['username'], $post['password']);
         } else {
             $error_login = alert_box('Username/Password isn\'t valid. Please try again.', 'danger');
         }
     }
     if (isset($error_login)) {
         $this->data['error_login'] = $error_login;
     }
     if ($this->session->flashdata('flash_message')) {
         $this->data['error_login'] = $this->session->flashdata('flash_message');
     }
 }
Example #21
0
 if (mysql_error()) {
     alert_box(mysql_error(), 'alert');
     $write = false;
 }
 /* -- FILES -- */
 mysql_query("DROP TABLE {$t_user_logs}");
 mysql_query("CREATE TABLE IF NOT EXISTS `{$t_user_logs}` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `date` datetime NOT NULL,\n  `type` varchar(20) COLLATE utf8_turkish_ci NOT NULL,\n  `user_id` int(11) NOT NULL,\n  `other_id` varchar(30) COLLATE utf8_turkish_ci NOT NULL,\n  `title` varchar(100) COLLATE utf8_turkish_ci NOT NULL,\n  `description` varchar(250) COLLATE utf8_turkish_ci NOT NULL,\n  `product_id` int(11) NOT NULL,\n  `invoice_id` int(11) NOT NULL,\n  `account_id` int(11) NOT NULL,\n  `ip` varchar(15) COLLATE utf8_turkish_ci NOT NULL,\n  `browser` varchar(50) COLLATE utf8_turkish_ci NOT NULL,\n  `platform` varchar(50) COLLATE utf8_turkish_ci NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci AUTO_INCREMENT=1321 ;\n\t\t");
 if (mysql_error()) {
     alert_box(mysql_error(), 'alert');
     $write = false;
 }
 /* -- FILES -- */
 mysql_query("DROP TABLE {$t_user_mess}");
 mysql_query("CREATE TABLE IF NOT EXISTS `{$t_user_mess}` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `status` int(1) NOT NULL DEFAULT '1',\n  `date` datetime NOT NULL,\n  `type` varchar(20) COLLATE utf8_turkish_ci NOT NULL,\n  `sender_id` int(11) NOT NULL,\n  `receiver_id` int(11) NOT NULL,\n  `top_id` int(11) NOT NULL,\n  `title` varchar(50) COLLATE utf8_turkish_ci NOT NULL,\n  `content` text COLLATE utf8_turkish_ci NOT NULL,\n  `read` varchar(20) COLLATE utf8_turkish_ci NOT NULL DEFAULT '0',\n  `read_date` datetime NOT NULL,\n  `inbox_view` int(1) NOT NULL DEFAULT '1',\n  `recent_activity` datetime NOT NULL,\n  `start_date` datetime NOT NULL,\n  `finish_date` datetime NOT NULL,\n  `task_status` varchar(20) COLLATE utf8_turkish_ci NOT NULL DEFAULT 'open',\n  PRIMARY KEY (`id`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci AUTO_INCREMENT=239 ;\n\t\t");
 if (mysql_error()) {
     alert_box(mysql_error(), 'alert');
     $write = false;
 }
 $admin_pass = md5($admin_pass);
 mysql_query("INSERT INTO {$t_users} (email, name, surname, password, role) VALUES ('{$admin_email}', 'ADMIN', 'ADMIN', '{$admin_pass}', '1')");
 if ($write) {
     $file_config = "config.php";
     if (!file_exists("{$file_config}")) {
         touch($file_config);
     }
     $file_conntect = @fopen("{$file_config}", 'w');
     if (!$file_conntect) {
         alertbox('alert-danger', 'config.php dosyası açılmadı.');
     }
     if (@fputs($file_conntect, $config_text)) {
         echo '<script>document.location.reload(true);</script>';
 /**
  * validate change password form
  * @return boolean
  */
 private function validatePassword()
 {
     $this->load->model('Admin_model');
     $id = id_auth_user();
     $post = $this->input->post();
     $err = '';
     $detail = $this->Admin_model->getAdmin($id);
     if ($post['old_password'] == '') {
         $err .= 'Please insert Old Password.<br/>';
     } else {
         if (!password_verify($post['old_password'], $detail['userpass']) && $detail['userpass'] != '') {
             $err .= 'Your Old Password is incorrect.<br/>';
         }
     }
     if ($post['new_password'] == '') {
         $err .= 'Please input your New Password.<br/>';
     } else {
         if (strlen($post['new_password']) <= 6) {
             $err .= 'Please input New Password more than 6 characters.<br/>';
         } else {
             if ($post['conf_password'] != $post['new_password']) {
                 $err .= 'Your Confirmation Password is not same with Your New Password.<br/>';
             }
         }
     }
     if ($err) {
         $this->error = alert_box($err, 'danger');
         return false;
     } else {
         return true;
     }
 }
Example #23
0
 /**
  * validate form
  * @param int $id
  * @return boolean
  */
 private function validateForm($id = 0)
 {
     $config = array(array('field' => 'site_name', 'label' => 'Site Name', 'rules' => 'required'), array('field' => 'site_url', 'label' => 'Site URL', 'rules' => 'required'));
     $this->form_validation->set_rules($config);
     if ($this->form_validation->run() === FALSE) {
         $this->error = alert_box(validation_errors(), 'danger');
         return FALSE;
     } else {
         $post_image = $_FILES;
         if (!empty($post_image['site_logo']['tmp_name'])) {
             $check_picture = validatePicture('site_logo');
             if (!empty($check_picture)) {
                 $this->error = alert_box($check_picture, 'danger');
                 return FALSE;
             }
         }
         return TRUE;
     }
 }
Example #24
0
 /**
  * validate form
  * @param int $id
  * @return boolean
  */
 private function validateForm($id = 0)
 {
     $post = $this->input->post();
     $config = array(array('field' => 'username', 'label' => 'Username', 'rules' => 'required|min_length[3]|max_length[32]|alpha_dash|callback_check_username_exists[' . $id . ']'), array('field' => 'id_auth_group', 'label' => 'Group', 'rules' => 'required|is_natural_no_zero'), array('field' => 'name', 'label' => 'Name', 'rules' => 'required|alpha_numeric_spaces'), array('field' => 'email', 'label' => 'Email', 'rules' => 'required|valid_email|callback_check_email_exists[' . $id . ']'), array('field' => 'id_auth_group', 'label' => 'Group', 'rules' => 'required|is_natural_no_zero'));
     $this->form_validation->set_rules($config);
     if ($this->form_validation->run() === FALSE) {
         $this->error = alert_box(validation_errors(), 'danger');
         return FALSE;
     } else {
         $post_image = $_FILES;
         if (!$id) {
             if ($post['password'] == '') {
                 $this->error = 'Please insert Password.<br/>';
             } else {
                 if (strlen($post['password']) <= 6) {
                     $this->error = 'Please input Password more than 6 characters.<br/>';
                 } else {
                     if ($post['conf_password'] != $post['password']) {
                         $this->error = 'Your Confirmation Password is not same with Your Password.<br/>';
                     }
                 }
             }
         } else {
             if (strlen($post['password']) > 0) {
                 if (strlen($post['password']) <= 6) {
                     $this->error = 'Please input Password more than 6 characters.<br/>';
                 } else {
                     if ($post['conf_password'] != $post['password']) {
                         $this->error = 'Your Confirmation Password is not same with Your Password.<br/>';
                     }
                 }
             }
         }
         if (!$this->error) {
             if (!empty($post_image['image']['tmp_name'])) {
                 $check_picture = validatePicture('image');
                 if (!empty($check_picture)) {
                     $this->error = alert_box($check_picture, 'danger');
                     return FALSE;
                 }
             }
             return TRUE;
         } else {
             $this->error = alert_box($this->error, 'danger');
             return FALSE;
         }
     }
 }
Example #25
0
 public static function timeline($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('source' => '', 'limit' => 20, 'image' => 'yes', 'title' => 'yes', 'link_title' => 'yes', 'intro_text' => 'yes', 'date' => 'yes', 'time' => 'yes', 'read_more' => 'no', 'order' => 'created', 'order_by' => 'desc', 'highlight_year' => 'yes', 'icon_bg' => '', 'before_text' => '', 'after_text' => '', 'scroll_reveal' => '', 'class' => ''), $atts, 'timeline');
     $slides = (array) Su_Tools::get_slides($atts);
     $return = '';
     if ($atts['before_text']) {
         $return .= '<div class="su-timeline-before-text"><span>' . $atts['before_text'] . '</span></div>';
     }
     $date = date('Y');
     $return .= '<div' . su_scroll_reveal($atts) . ' class="su-timeline animated ' . su_ecssc($atts) . '">';
     if (count($slides)) {
         $limit = 1;
         foreach ($slides as $slide) {
             $title = $slide['title'];
             $icon = $title ? explode('|| fa-', $title) : array();
             if (count($icon) == 2) {
                 $title = trim($icon[0]);
                 $icon = '<i class="fa fa-' . trim($icon[1]) . '"></i>';
             } else {
                 $title = $slide['title'];
                 $icon = '<i class="fa fa-circle"></i>';
             }
             $has_icon = '';
             if (isset($icon[1])) {
                 $has_icon = 'has-ta-icon';
             }
             $icon_bg = $atts['icon_bg'] ? 'style="background-color:' . $atts['icon_bg'] . ';"' : '';
             if ($date != JHTML::_('date', $slide['created'], "Y") && $atts['highlight_year'] == 'yes') {
                 $return .= '<div class="su-timeline-row su-timeline-has-year">' . "\n";
                 $date = JHTML::_('date', $slide['created'], "Y");
                 $return .= '<div class="su-timeline-year"><span>' . "\n";
                 $return .= $date . "\n";
                 $return .= '</span></div>' . "\n";
             } else {
                 $return .= '<div class="su-timeline-row">' . "\n";
             }
             $return .= '<div class="su-timeline-icon ' . $has_icon . '"><div class="bg-primary" ' . $icon_bg . '>' . $icon . '</div></div>';
             $return .= '<div class="su-timeline-time">';
             if ($atts['date'] == 'yes') {
                 $return .= '<small>' . JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')) . '</small>';
             }
             if ($atts['time'] == 'yes') {
                 $return .= JHTML::_('date', $slide['created'], "g:i A");
             }
             $return .= '</div>';
             $return .= '<div class="su-timeline-content">' . "\n";
             $return .= '<div class="su-timeline-content-body">' . "\n";
             if ($atts['title'] === 'yes' and isset($slide['title'])) {
                 $return .= '<h3 class="su-timeline-item-title">';
                 if ($atts['link_title'] === 'yes') {
                     $return .= '<a href="' . image_media($slide['link']) . '">';
                 }
                 $return .= $title;
                 if ($atts['link_title'] === 'yes') {
                     $return .= '</a>';
                 }
                 $return .= '</h3>';
             }
             if ($slide['image'] and $atts['image'] === 'yes') {
                 $return .= '<div class="su-timeline-item-image"><img src="' . image_media($slide['image']) . '" alt="" /></div>';
             }
             if ($atts['intro_text'] === 'yes' and isset($slide['introtext'])) {
                 $return .= '<div class="su-timeline-item-text">' . su_do_shortcode($slide['introtext']) . '</div>';
             }
             if ($atts['read_more'] === 'yes') {
                 $return .= '<a class="su-timeline-readmore readon" href="' . image_media($slide['link']) . '">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_READMORE') . '</a>';
             }
             $return .= '</div>' . "\n";
             $return .= '</div>' . "\n";
             $return .= '</div>' . "\n";
             if ($limit++ == $atts['limit']) {
                 break;
             }
         }
         $return .= '</div>';
         if ($atts['after_text']) {
             $return .= '<div class="su-timeline-after-text"><span>' . $atts['after_text'] . '</span></div>';
         }
         suAsset::addFile('css', 'timeline.css', __FUNCTION__);
         suAsset::addFile('js', 'timeline.js', __FUNCTION__);
     } else {
         $return .= alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_TIMELINE_NOT_WORK'), 'warning');
     }
     return $return;
 }
Example #26
0
<div class="well bs-component col-md-6">

	<?php 
echo alert_box();
?>
	
	<?php 
echo form_open();
?>
	

		<?php 
echo form_group_input('email');
?>

		<?php 
echo form_group_password();
?>

		<div class="row">
			<div class="col-sm-6">
				<?php 
echo form_checkbox('remember', 'Remember Me');
?>
			</div>
			<div class="col-sm-6 text-right">
				<a href="<?php 
echo site_url('account/forgot_password');
?>
">Forgot password?</a>
Example #27
0
    public static function faq($atts = null, $content = null)
    {
        $atts = su_shortcode_atts(array('id' => uniqid('suf'), 'source' => '', 'limit' => 20, 'order' => 'created', 'order_by' => 'desc', 'loading_animation' => 'default', 'filter_animation' => 'sequentially', 'display_speed' => 200, 'scroll_reveal' => '', 'class' => ''), $atts, 'faq');
        $slides = (array) Su_Tools::get_slides($atts);
        $intro_text = '';
        $title = '';
        $return = '';
        if (count($slides)) {
            $return[] = '
            <div' . su_scroll_reveal($atts) . ' id="' . $atts['id'] . '" class="su-faq ' . su_ecssc($atts) . '" 
                data-scid="' . $atts['id'] . '" 
                data-loading_animation="' . $atts['loading_animation'] . '" 
                data-filter_animation="' . $atts['filter_animation'] . '" data-display_speed="' . $atts['display_speed'] . '">

                <div id="' . $atts['id'] . '_filter" class="cbp-l-filters-underline">                   
                    <div data-filter="*" class="cbp-filter-item-active cbp-filter-item">
                        ' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_ALL') . '
                    </div>';
            $category = array();
            foreach ((array) $slides as $slide) {
                if (in_array($slide['category'], $category)) {
                    continue;
                }
                $category[] = $slide['category'];
                $return[] = '<div class="cbp-filter-item" data-filter=".' . str_replace(' ', '-', strtolower($slide['category'])) . '">' . $slide['category'] . '</div>';
            }
            // if ($atts['show_search'] === 'yes') {
            //     $return[] ='<div class="cbp-search cbp-l-filters-right">
            //                     <input id="'.$atts['id']. '_search" type="text" placeholder="'.JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_FAQ_SEARCH').'" data-search="" class="cbp-search-input">
            //                     <div class="cbp-search-icon"></div>
            //                 </div>';
            // }
            $return[] = '</div>
                    <div id="' . $atts['id'] . '_container" class="cbp cbp-l-grid-faq">';
            $limit = 1;
            foreach ((array) $slides as $slide) {
                // Title condition
                $title = $slide['title'];
                $icon = $title ? explode('|| fa-', $title) : array();
                if (count($icon) == 2) {
                    $title = trim($icon[0]);
                    $icon = '<i class="fa fa-' . trim($icon[1]) . '"></i>';
                } else {
                    $title = $slide['title'];
                    $icon = '<i class="fa fa-question-circle"></i>';
                }
                $isReadmore = $slide['fulltext'] ? '<div class="su-readmore"><a href="' . $slide['link'] . '">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_READMORE') . '</a></div>' : '';
                $category = str_replace(' ', '-', strtolower($slide['category']));
                $return[] = '
                    <div class="cbp-item ' . $category . '">
                        <div class="cbp-caption">
                            <div class="cbp-caption-defaultWrap">
                                ' . $icon . $title . '
                            </div>
                            <div class="cbp-caption-activeWrap">
                                <div class="cbp-l-caption-body">
                                    ' . su_do_shortcode($slide['introtext']) . $isReadmore . '
                                </div>
                            </div>
                        </div>

                    </div>';
                if ($limit++ == $atts['limit']) {
                    break;
                }
            }
            $return[] = '<div class="clearfix"></div></div></div>';
            suAsset::addFile('css', 'cubeportfolio.min.css');
            suAsset::addFile('js', 'cubeportfolio.min.js');
            suAsset::addFile('css', 'faq.css', __FUNCTION__);
            suAsset::addFile('js', 'faq.js', __FUNCTION__);
            return implode('', $return);
        } else {
            return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_FAQ_ERROR'), 'warning');
        }
    }
Example #28
0
 public static function showcase($atts = null, $content = null)
 {
     $atts = su_shortcode_atts(array('source' => '', 'limit' => 12, 'show_more' => 'no', 'layout' => 'grid', 'show_more_item' => 4, 'show_more_action' => 'click', 'item_link' => 'inline', 'order' => 'created', 'order_by' => 'desc', 'loading_animation' => 'default', 'filter_animation' => 'rotateSides', 'caption_style' => 'overlayBottomPush', 'horizontal_gap' => 10, 'vertical_gap' => 10, 'filter' => 'yes', 'filter_style' => 1, 'filter_deeplink' => 'no', 'filter_align' => '', 'filter_counter' => 'yes', 'page_deeplink' => 'no', 'popup_position' => 'below', 'popup_category' => 'yes', 'popup_date' => 'yes', 'popup_image' => 'yes', 'include_article_image' => 'no', 'large' => 4, 'medium' => 3, 'small' => 1, 'thumb_resize' => 'yes', 'thumb_width' => 640, 'thumb_height' => 480, 'scroll_reveal' => '', 'class' => ''), $atts, 'showcase');
     $slides = (array) Su_Tools::get_slides($atts);
     $id = uniqid('susc');
     $intro_text = '';
     $title = '';
     $return = array();
     $atts['filter_deeplink'] = $atts['filter_deeplink'] === 'yes' ? 'true' : 'false';
     $atts['page_deeplink'] = $atts['page_deeplink'] === 'yes' ? 'true' : 'false';
     $lang = JFactory::getLanguage();
     $filter_align = $atts['filter_align'] ? 'su-showcase-filter-align-' . $atts['filter_align'] : '';
     $filter_counter = '';
     if ($atts['layout'] === 'mosaic') {
         $layout = ' data-layout="mosaic"';
     } elseif ($atts['layout'] === 'slider') {
         $layout = ' data-layout="slider"';
     } else {
         $layout = ' data-layout="grid"';
     }
     if ($atts['item_link'] === 'inline') {
         $item_link_class = 'cbp-singlePageInline';
         $page = 'data-url="' . JRoute::_('index.php?option=com_bdthemes_shortcodes&amp;view=item&amp;layout=inline') . '"';
     } elseif ($atts['item_link'] === 'single') {
         $item_link_class = 'cbp-singlePage';
         $page = 'data-url="' . JRoute::_('index.php?option=com_bdthemes_shortcodes&amp;view=item&amp;layout=single') . '"';
     } elseif ($atts['item_link'] === 'link') {
         $item_link_class = 'cbp-linkPage';
         $page = '';
     } else {
         $item_link_class = 'cbp-linkNoPage';
         $page = '';
     }
     $thumb_resize_check = ($atts['thumb_resize'] === 'yes' and $atts['layout'] != 'mosaic') ? true : false;
     if ($atts['filter_counter'] == 'yes') {
         if ($atts['filter_style'] == 1) {
             $filter_counter = ' (<div class="cbp-filter-counter"></div> ' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_ITEMS') . ')';
         } elseif ($atts['filter_style'] == 3 or $atts['filter_style'] == 8) {
             $filter_counter = ' (<div class="cbp-filter-counter"></div>)';
         } else {
             $filter_counter = '<div class="cbp-filter-counter"></div>';
         }
     }
     if (preg_match('/k2-category/', $atts['source'])) {
         $source = 'k2';
     } else {
         $source = 'article';
     }
     if (count($slides)) {
         suAsset::addFile('css', 'cubeportfolio.min.css');
         suAsset::addFile('js', 'cubeportfolio.min.js');
         $return[] = '<div id="' . $id . '"' . su_scroll_reveal($atts) . ' class="su-showcase ' . su_ecssc($atts) . $filter_align . '" data-scid="' . $id . '"' . $layout . ' data-loading_animation="' . $atts['loading_animation'] . '" data-filter_animation="' . $atts['filter_animation'] . '" data-caption_style="' . $atts['caption_style'] . '" data-horizontal_gap="' . intval($atts['horizontal_gap']) . '" data-vertical_gap="' . intval($atts['vertical_gap']) . '" data-popup_position="' . $atts['popup_position'] . '" data-large="' . $atts['large'] . '" data-medium="' . $atts['medium'] . '" data-small="' . $atts['small'] . '" data-filter_deeplink="' . $atts['filter_deeplink'] . '" data-page_deeplink="' . $atts['page_deeplink'] . '" data-loadmoreaction="' . $atts['show_more_action'] . '" >';
         if ($atts['filter'] !== 'no' and $atts['filter_style'] == 1 and $atts['layout'] != 'slider') {
             $return[] = '<div id="' . $id . '_filter" class="cbp-l-filters-dropdown">
                         <div class="cbp-l-filters-dropdownWrap">
                             <div class="cbp-l-filters-dropdownHeader">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_SORT') . '</div>
                             <div class="cbp-l-filters-dropdownList">
                                 <div data-filter="*" class="cbp-filter-item-active cbp-filter-item">
                                     ' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_ALL') . $filter_counter . '
                                 </div>';
             $category = array();
             foreach ((array) $slides as $slide) {
                 if (in_array($slide['category'], $category)) {
                     continue;
                 }
                 $category[] = $slide['category'];
                 $return[] = '<div class="cbp-filter-item" data-filter=".' . su_title_class($slide['category']) . '">' . $slide['category'] . ' (<div class="cbp-filter-counter"></div> ' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_ITEMS') . ')</div>';
             }
             $return[] = '</div>
                         </div>
                     </div>';
         }
         if ($atts['filter'] !== 'no' and $atts['filter_style'] != 1 and $atts['layout'] != 'slider') {
             if ($atts['filter_style'] == 2) {
                 $filter_style = 'cbp-l-filters-button';
             } elseif ($atts['filter_style'] == 3) {
                 $filter_style = 'cbp-l-filters-alignLeft';
             } elseif ($atts['filter_style'] == 4) {
                 $filter_style = 'cbp-l-filters-alignCenter';
             } elseif ($atts['filter_style'] == 5) {
                 $filter_style = 'cbp-l-filters-alignRight';
             } elseif ($atts['filter_style'] == 6) {
                 $filter_style = 'cbp-l-filters-buttonCenter';
             } elseif ($atts['filter_style'] == 7) {
                 $filter_style = 'cbp-l-filters-work';
             } elseif ($atts['filter_style'] == 8) {
                 $filter_style = 'cbp-l-filters-list';
             } elseif ($atts['filter_style'] == 9) {
                 $filter_style = 'cbp-l-filters-text new_filter';
             }
             $return[] = '<div id="' . $id . '_filter" class="' . $filter_style . '">
                             <div data-filter="*" class="cbp-filter-item-active cbp-filter-item">
                                 ' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_ALL') . $filter_counter . '
                             </div>';
             $category = array();
             foreach ((array) $slides as $slide) {
                 if (in_array($slide['category'], $category)) {
                     continue;
                 }
                 $category[] = $slide['category'];
                 $return[] = '<div class="cbp-filter-item" data-filter=".' . su_title_class($slide['category']) . '">' . $slide['category'] . $filter_counter . '</div>';
             }
             $return[] = '
                     </div>';
         }
         $return[] = '<div id="' . $id . '_container" class="cbp-l-grid-gallery">';
         $limit = 1;
         foreach ((array) $slides as $slide) {
             $thumb_url = su_image_resize($slide['image'], $atts['thumb_width'], $atts['thumb_height'], $thumb_resize_check, 95);
             // Title condition
             if ($slide['title']) {
                 $title = stripslashes($slide['title']);
             }
             $category = su_title_class($slide['category']);
             $item_link = $atts['item_link'] != 'no' ? JRoute::_($slide['link']) : 'javascript:void(0);';
             $return[] = '
                 <div class="cbp-item ' . $category . '">
                      <a data-id="' . $slide['id'] . '" data-source = "' . $source . '" data-include_article_image = "' . $atts['include_article_image'] . '" data-popup_image = "' . $atts['popup_image'] . '" data-popup_category = "' . $atts['popup_category'] . '" data-popup_date = "' . $atts['popup_date'] . '" href="' . $item_link . '" ' . $page . ' class="cbp-caption ' . $item_link_class . '" data-title="' . $title . ' // ' . $slide['category'] . '">
                         <div class="cbp-caption-defaultWrap">';
             if (isset($thumb_url['url'])) {
                 $return[] = '<img src="' . image_media($thumb_url['url']) . '" alt="' . $title . '">';
             } else {
                 $return[] = '<img src="' . image_media(BDT_SU_IMG . 'no-image.svg') . '" alt="' . $title . '">';
             }
             $return[] = '</div>
                         <div class="cbp-caption-activeWrap">
                             <div class="cbp-l-caption-alignLeft">
                                 <div class="cbp-l-caption-body">
                                     <div class="cbp-l-caption-title">' . $title . '</div>
                                     <div class="cbp-l-caption-desc">' . $slide['category'] . '</div>
                                 </div>
                             </div>
                         </div>
                     </a>
                 </div>';
             if ($limit++ == $atts['limit']) {
                 break;
             }
         }
         $return[] = '</div><div class="clearfix"></div>';
         if ($atts['show_more'] === 'yes' and $atts['layout'] != 'slider') {
             $return[] = '<div id="' . $id . '_btn" class="cbp-l-loadMore-button">
                             <a data-id="' . $id . '" href="' . JRoute::_('index.php?option=com_bdthemes_shortcodes&amp;view=item&amp;layout=default') . '" class="cbp-l-loadMore-link" rel="nofollow">
                                 <span class="cbp-l-loadMore-defaultText">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_LOAD_MORE') . '</span>
                                 <span class="cbp-l-loadMore-loadingText">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_LOADING') . '</span>
                                 <span class="cbp-l-loadMore-noMoreLoading">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_NO_MORE') . '</span>
                             </a>
                             <script type="text/javascript">
                                var tdata = tdata || [];
                                 tdata["' . $id . '"] = ' . json_encode($atts) . ';
                                 tdata["' . $id . '"]["offset"] =' . $atts["limit"] . '  
                                 
                             </script>
                         </div>';
             suAsset::addFile('js', 'cbploadmore.js');
         }
         $return[] = '</div>';
         suAsset::addFile('css', 'showcase.css', __FUNCTION__);
         suAsset::addFile('js', 'showcase.js', __FUNCTION__);
         return implode('', $return);
     } else {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_ERROR'), 'warning');
     }
 }
Example #29
0
    public static function file_download($atts = null, $content = null)
    {
        $atts = su_shortcode_atts(array('id' => '', 'url' => '', 'custom_title' => '', 'save_as' => '', 'show_title' => 'yes', 'color' => '#999999', 'background' => '#f9f9f9', 'radius' => '3px', 'padding' => '25px', 'margin' => '0', 'icon' => 'icon: download', 'show_count' => 'yes', 'show_download_count' => 'yes', 'show_like_count' => 'yes', 'resumable' => 'yes', 'download_speed' => 500, 'show_file_size' => 'yes', 'button_text' => 'Download Now', 'button_color' => '#f5f5f5', 'button_hover_color' => '#ffffff', 'button_background' => '#ff6a56', 'button_hover_background' => '#ff543d', 'button_class' => '', 'scroll_reveal' => '', 'class' => ''), $atts, 'file_download');
        $uniqid = uniqid('sufd_');
        $css[] = '';
        $js[] = '';
        $return = array();
        $id = $atts['id'] ? $atts['id'] : md5($atts['url']);
        $id = substr($id, 0, 30);
        //get saved data
        $sdata = Su_FileManager::getFileInfo($id, JPATH_SITE . DIRECTORY_SEPARATOR . $atts['url']);
        $file = JPATH_SITE . DIRECTORY_SEPARATOR . $atts['url'];
        $file_title = $atts["custom_title"] ? $atts["custom_title"] : basename($atts['url']);
        $ldata = json_decode($sdata->liked_ip);
        if (!$ldata || !is_array($ldata)) {
            $ldata = array();
        }
        $ip = Su_FileManager::getIp();
        $liked = 0;
        if (in_array($ip, $ldata)) {
            $liked = 1;
        }
        if (strpos($atts['icon'], '/') !== false) {
            $atts['icon'] = '<img src="' . image_media($atts['icon']) . '" alt="" width="' . $atts['size'] . '" height="' . $atts['size'] . '" />';
        } elseif (strpos($atts['icon'], 'licon:') !== false) {
            suAsset::addFile('css', 'linea.css');
            $atts['icon'] = '<i class="li li-' . trim(str_replace('licon:', '', $atts['icon'])) . '"></i>';
        } elseif (strpos($atts['icon'], 'icon:') !== false) {
            $atts['icon'] = '<i class="fa fa-' . trim(str_replace('icon:', '', $atts['icon'])) . '"></i>';
        }
        $liked_style = $liked ? 'su-fd-like' : '';
        $liked = (int) $sdata->liked;
        $downloaded = (int) $sdata->downloaded;
        $button_class = $atts["button_class"] ? $atts['button_class'] : '';
        // internal javascript
        $js[] = 'jQuery(document).ready(function() {
            jQuery("#like' . $id . '").click(function() {
                jQuery.ajax({
                    method: "POST",
                    url: "' . JRoute::_('index.php?option=com_bdthemes_shortcodes&view=like') . '",
                    data: {id: "' . $id . '"},
                    dataType: "json"
                })
                .done(function(data) {
                    if (data) {
                        var nlike = data.nlike;
                        jQuery("#nlike' . $id . '").html(nlike);
                        if (data.like == 1) {
                            jQuery("#like' . $id . '").addClass("su-fd-like");
                        } else {
                            jQuery("#like' . $id . '").removeClass("su-fd-like");
                        }
                    }
                })
            });
        });';
        // CSS prepare
        $css[] = '#' . $uniqid . ' {color: ' . $atts['color'] . ';background: ' . $atts['background'] . ';padding: ' . $atts['padding'] . ';margin: ' . $atts['margin'] . ';border-radius: ' . $atts['radius'] . ';}';
        if (!$button_class) {
            $css[] = '#' . $uniqid . ' .su-download-btn {color: ' . $atts['button_color'] . ';background: ' . $atts['button_background'] . ';}';
            $css[] = '#' . $uniqid . ' .su-download-btn:hover {color: ' . $atts['button_hover_color'] . ';background: ' . $atts['button_hover_background'] . ';}';
        }
        // Asset added
        suAsset::addFile('css', 'file_download.css', __FUNCTION__);
        suAsset::addString('css', implode("\n", $css));
        suAsset::addString('js', implode("\n", $js));
        // Output HTML
        if ($atts['url'] && file_exists($file)) {
            $return[] = '<div' . su_scroll_reveal($atts) . ' id="' . $uniqid . '" class="su-download' . su_ecssc($atts) . '">

                <input type="hidden" name="id" value="' . $id . '" />

                <a class="su-download-btn ' . $button_class . '"  href="' . JRoute::_('index.php?option=com_bdthemes_shortcodes&amp;view=download&amp;id=' . $id) . '" >' . $atts['icon'] . ' ' . $atts['button_text'] . '</a>';
            $return[] = $atts['show_title'] == 'yes' ? '<h4 class="su-file-name"><b>' . JTEXT::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_FILE_NAME') . ' </b>' . $file_title . '</h4>' : '';
            @($sdata->see = $sdata->see ? $sdata->see : 0);
            $sdata->see += 1;
            $params = new stdClass();
            $params->download_speed = $atts["download_speed"];
            $params->save_as = rawurlencode($atts["save_as"]);
            $params->resumable = $atts["resumable"];
            $sdata->params = json_encode($params);
            Su_FileManager::updateFileInfo($sdata);
            $return[] = '<div class="su-download-counter">';
            $return[] = $atts['show_count'] == 'yes' ? '<span class="see"><i class="fa fa-eye"></i>' . $sdata->see . '</span>' : '';
            $return[] = $atts['show_download_count'] == 'yes' ? '<span class="downloaded"><i class="fa fa-download"></i>' . $downloaded . '</span>' : '';
            $return[] = $atts['show_like_count'] == 'yes' ? '<span class="like"><span class="su-dwn-like ' . $liked_style . '" id="like' . $id . '" ><i class="fa fa-thumbs-up"></i></span><span class="like-number" id="nlike' . $id . '">' . $liked . '</span></span>' : '';
            $return[] = $atts['show_file_size'] == 'yes' ? '<span class="like"><i class="fa fa-folder"></i>' . self::human_filesize(filesize($file), 2) . '</span>' : '';
            $return[] = '</div>' . su_do_shortcode($content) . '</div>';
            return implode("\n", $return);
        } else {
            return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_FILE_DOWNLOAD_ERROR'), 'warning');
        }
    }
Example #30
0
 public static function carousel($atts = null, $content = null)
 {
     $return = '';
     $atts = su_shortcode_atts(array('style' => '1', 'source' => '', 'limit' => 5, 'order' => 'created', 'order_by' => 'desc', 'items' => 4, 'large' => 4, 'medium' => 3, 'small' => 1, 'image' => 'yes', 'quality' => 95, 'title' => 'yes', 'title_link' => 'yes', 'title_limit' => '', 'intro_text' => 'yes', 'intro_text_limit' => '60', 'background' => '', 'color' => '', 'title_color' => '', 'date' => 'no', 'category' => 'no', 'image_width' => 360, 'image_height' => 320, 'thumb_resize' => 'yes', 'margin' => 10, 'scroll' => 1, 'arrows' => 'no', 'arrow_position' => 'default', 'pagination' => 'yes', 'autoplay' => 'yes', 'delay' => 4, 'speed' => 0.35, 'hoverpause' => 'no', 'lazyload' => 'no', 'loop' => 'yes', 'scroll_reveal' => '', 'class' => ''), $atts, 'carousel');
     $id = uniqid('suc');
     $title = "";
     $image = "";
     $intro_text = '';
     $css[] = '';
     $background = '';
     $color = '';
     $date = '';
     $category = '';
     $lang = JFactory::getLanguage();
     $lang = $lang->isRTL() ? 'true' : 'false';
     $slides = (array) Su_Tools::get_slides($atts);
     $atts['items'] = $atts['large'] != 4 ? $atts['large'] : $atts['items'];
     $css[] = '#' . $id . '.su-carousel-style-3 .su-carousel-caption:after {border-bottom-color: ' . $atts['background'] . ';}';
     if ($atts['background'] or $atts['color']) {
         $background = $atts['background'] ? 'background-color:' . $atts['background'] . ';' : '';
         $color = $atts['color'] ? 'color:' . $atts['color'] . ';' : '';
         $css[] = '#' . $id . ' .su-carousel-slide {' . $background . $color . '}';
     }
     $thumb_resize_check = $atts['thumb_resize'] === 'yes' ? true : false;
     if ($atts['title_color']) {
         $css[] = '#' . $id . ' .su-carousel-slide .su-carousel-slide-title a {color: ' . $atts['title_color'] . ';}';
         $css[] = '#' . $id . ' .su-carousel-slide .su-carousel-slide-title a:hover {color: ' . su_color::lighten($atts['title_color'], '10%') . ';}';
     }
     if (count($slides) and ($atts['title'] == 'yes' or $atts['image'] == 'yes' or $atts['intro_text'] === 'yes')) {
         $source = substr($atts['source'], 0, 5);
         if ($source == 'media') {
             $atts['class'] .= ' su-carousel-media';
         }
         $return[] = '<div id="' . $id . '"' . su_scroll_reveal($atts) . ' class="su-carousel su-carousel-style-' . $atts['style'] . ' su-carousel-title-' . $atts['title'] . ' arrow-' . $atts['arrow_position'] . ' ' . su_ecssc($atts) . '" data-autoplay="' . $atts['autoplay'] . '" data-delay="' . $atts['delay'] . '" data-speed="' . $atts['speed'] . '" data-arrows="' . $atts['arrows'] . '" data-pagination="' . $atts['pagination'] . '" data-lazyload="' . $atts['lazyload'] . '" data-hoverpause="' . $atts['hoverpause'] . '" data-items="' . $atts['items'] . '" data-medium="' . $atts['medium'] . '" data-small="' . $atts['small'] . '" data-margin="' . $atts['margin'] . '" data-scroll="' . $atts['scroll'] . '" data-loop="' . $atts['loop'] . '" data-rtl="' . $lang . '" ><div class="su-carousel-slides">';
         $limit = 1;
         foreach ((array) $slides as $slide) {
             $image_url = su_image_resize($slide['image'], $atts['image_width'], $atts['image_height'], $thumb_resize_check, $atts['quality']);
             if ($atts['title'] == 'yes' && $slide['title']) {
                 $title = stripslashes($slide['title']);
                 if ($atts['title_limit']) {
                     $title = su_char_limit($title, $atts['title_limit']);
                 }
                 if ($atts['title_link'] == "yes") {
                     $title = '<a href="' . $slide['link'] . '">' . $title . '</a>';
                 }
                 $title = '<h3 class="su-carousel-slide-title">' . $title . '</h3>';
             }
             if ($atts['date'] === 'yes') {
                 $date = JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3'));
                 $date = '<div class="su-cdate">' . $date . '</div>';
             }
             if ($atts['category'] === 'yes') {
                 $category = '<div class="su-ccategory">' . $slide['category'] . '</div>';
             }
             if ($atts['intro_text'] === 'yes' and isset($slide['introtext'])) {
                 $intro_text = $slide['introtext'];
                 if ($atts['intro_text_limit']) {
                     $intro_text = su_char_limit($intro_text, $atts['intro_text_limit']);
                 }
                 $intro_text = '<div class="su-carousel-item-text">' . su_do_shortcode($intro_text) . '</div>';
             }
             $return[] = '<div class="su-carousel-slide">';
             if (isset($image_url) && $atts['image'] == 'yes') {
                 $return[] = '<div class="su-carousel-image">';
                 if (isset($image_url)) {
                     $return[] = '<div class="su-carousel-links">
                                 <a class="su-lightbox-item" href="' . image_media($slide['image']) . '" title="' . strip_tags($title) . '">
                                     <i class="fa fa-search"></i>
                                 </a>';
                     if ($source != 'media') {
                         $return[] = '<a class="su-carousel-link" href="' . $slide['link'] . '" title="' . strip_tags($title) . '">
                                         <i class="fa fa-link"></i>
                                     </a>';
                     }
                     $return[] = '</div>';
                 }
                 $return[] = '<img src="' . image_media($image_url['url']) . '" alt="' . strip_tags($title) . '" />';
                 $return[] = '</div>';
             }
             if ($title or $intro_text) {
                 $return[] = '<div class="su-carousel-caption">' . $title . '<div class="su-cmeta">' . $date . $category . '</div>' . $intro_text . '</div>';
             }
             $return[] = '</div>';
             if ($limit++ == $atts['limit']) {
                 break;
             }
         }
         $return[] = '</div>';
         $return[] = '</div>';
         suAsset::addString('css', implode("\n", $css));
         suAsset::addFile('css', 'magnific-popup.css');
         suAsset::addFile('js', 'magnific-popup.js');
         suAsset::addFile('css', 'owl.carousel.css');
         suAsset::addFile('js', 'owl.carousel.min.js');
         suAsset::addFile('css', 'carousel.css', __FUNCTION__);
         suAsset::addFile('js', 'carousel.js', __FUNCTION__);
     } else {
         return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_CAROUSEL_INF'), 'warning');
     }
     return implode("", $return);
 }