Esempio n. 1
0
File: view.php Progetto: pwfir/klzm1
 static function text($config, $item, $readmore)
 {
     if ($config['news_content_text_pos'] == 'disabled') {
         return '';
     }
     //
     if ($item['text'] === '') {
         $item['text'] = $item['text_alt'];
     }
     //
     $item['text'] = NSP_GK5_Utils::cutText($item['text'], $config, 'news_limit');
     $item['text'] = static::textPlugins($item['text'], $config);
     $link = static::itemLink($item, $config);
     //
     if ($config['news_text_link'] == 1) {
         $item['text'] = '<a href="' . $link . '" target="' . $config['open_links_window'] . '">' . $item['text'] . '</a>';
     }
     $class = ' t' . $config['news_content_text_pos'] . ' f' . $config['news_content_text_float'];
     //
     $output_html = '<p class="nspText' . $class . '">';
     $output_html .= $item['text'];
     if ($config['news_content_readmore_pos'] == 'after') {
         $output_html .= ' ' . $readmore;
     }
     $output_html .= '</p>';
     return $output_html;
 }
Esempio n. 2
0
 function output()
 {
     // check if any article to display exists
     if (count($this->parent->content)) {
         // output the HTML code
         echo '<div class="gkNspPM gkNspPM-VideoGallery" data-autoanim="' . $this->parent->config['portal_mode_video_gallery_autoanimation'] . '">';
         if (trim($this->parent->config['nsp_pre_text'])) {
             echo $this->parent->config['nsp_pre_text'];
         }
         // render blocks
         for ($i = 0; $i < count($this->parent->content); $i++) {
             $title = NSP_GK5_Utils::cutText(strip_tags($this->parent->content[$i]['title']), $this->parent->config, 'portal_mode_video_gallery_title_limit', '&hellip;');
             $text = NSP_GK5_Utils::cutText(strip_tags($this->parent->content[$i]['text']), $this->parent->config, 'portal_mode_video_gallery_text_limit', '&hellip;');
             // generating big block content on the first slide
             if ($i == 0) {
                 echo '<div class="gkBigBlock active">';
                 echo '<img class="gkIsHelperImage" src="data:image/png;base64,' . $this->generateBlankImage($this->parent->config['img_width'], $this->parent->config['img_height']) . '" alt="" />';
                 echo '<figure class="gkItem' . ($this->get_video($i) != '#' ? ' video' : '') . '">';
                 echo '<span class="gkImageWrap"><img src="' . $this->get_image($i) . '" alt="' . htmlspecialchars(strip_tags($this->parent->content[$i]['title'])) . '" data-url="' . $this->get_video($i) . '" data-x="' . $this->parent->config['portal_mode_video_gallery_popup_x'] . '" data-y="' . $this->parent->config['portal_mode_video_gallery_popup_y'] . '" /></span>';
                 echo '<figcaption>';
                 echo '<strong>' . $this->parent->content[$i]['catname'] . '</strong>';
                 echo '<h3><a href="' . $this->get_link($i) . '" title="' . htmlspecialchars(strip_tags($this->parent->content[$i]['title'])) . '">' . $title . '</a></h3>';
                 echo '<p>' . $text . '</p>';
                 echo '<small>' . $this->parent->content[$i]['hits'] . '</small>';
                 echo '</figcaption>';
                 echo '</figure>';
                 echo '</div><div class="gkSmallBlock">';
             }
             //
             if ($i == 0) {
                 echo '<div class="gkItemsPage active">';
             }
             //
             echo '<figure class="gkItem' . ($this->get_video($i) != '#' ? ' video' : '') . '" data-num="' . $i . '">';
             echo '<span class="gkImageWrap"><img src="' . $this->get_image($i) . '" alt="' . htmlspecialchars(strip_tags($this->parent->content[$i]['title'])) . '" data-url="' . $this->get_video($i) . '" data-x="' . $this->parent->config['portal_mode_video_gallery_popup_x'] . '" data-y="' . $this->parent->config['portal_mode_video_gallery_popup_y'] . '" /></span>';
             echo '<figcaption>';
             echo '<strong>' . $this->parent->content[$i]['catname'] . '</strong>';
             echo '<h3><a href="' . $this->get_link($i) . '" title="' . htmlspecialchars(strip_tags($this->parent->content[$i]['title'])) . '">' . $title . '</a></h3>';
             echo '<p>' . $text . '</p>';
             echo '<small>' . $this->parent->content[$i]['hits'] . '</small>';
             echo '</figcaption>';
             echo '</figure>';
             if ($i > 0 && ($i + 1) % $this->parent->config['portal_mode_video_gallery_per_page'] == 0 && $i != count($this->parent->content) - 1 || $this->parent->config['portal_mode_video_gallery_per_page'] == 1 && $i != count($this->parent->content) - 1) {
                 echo '</div>';
                 echo '<div class="gkItemsPage">';
             } elseif ($i == count($this->parent->content) - 1) {
                 echo '</div>';
             }
         }
         echo '</div>';
         if (trim($this->parent->config['nsp_post_text'])) {
             echo $this->parent->config['nsp_post_text'];
         }
         echo '</div>';
     } else {
         echo '<strong>Error:</strong> No articles to display';
     }
 }
Esempio n. 3
0
 function init($module, $params)
 {
     // getting module ID - automatically (from Joomla! database) or manually
     $this->module_id = $params->get('module_unique_id', '') == '' ? 'nsp-' . $module->id : $params->get('module_unique_id', '');
     $this->config = $params->toArray();
     $this->config['module_id'] = $this->module_id;
     $this->params = $params;
     // detect the data source
     $this->source = $this->config["source_name"];
     // if the user set engine mode to Mootools
     if ($this->config['engine_mode'] == 'mootools') {
         // load the MooTools framework to use with the module
         JHtml::_('behavior.framework', true);
     } else {
         if ($this->config['include_jquery'] == 1) {
             // if the user specify to include the jQuery framework - load newest jQuery 1.7.*
             $doc = JFactory::getDocument();
             // generate keys of script section
             $headData = $doc->getHeadData();
             $headData_keys = array_keys($headData["scripts"]);
             // set variable for false
             $engine_founded = false;
             // searching phrase mootools in scripts paths
             if (array_search('https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js', $headData_keys) > 0) {
                 $engine_founded = true;
             }
             //
             if (!$engine_founded) {
                 $doc->addScript('https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js');
             }
         }
     }
     // small validation
     if ($this->config['list_title_limit'] == 0 && $this->config['list_text_limit'] == 0) {
         $this->config['news_short_pages'] = 0;
     }
     if ($this->config['news_header_enabled'] == 0) {
         $this->config['news_content_header_pos'] = 'disabled';
     }
     if ($this->config['news_image_enabled'] == 0) {
         $this->config['news_content_image_pos'] = 'disabled';
     }
     if ($this->config['news_text_enabled'] == 0) {
         $this->config['news_content_text_pos'] = 'disabled';
     }
     if ($this->config['news_info_enabled'] == 0) {
         $this->config['news_content_info_pos'] = 'disabled';
     }
     if ($this->config['news_info2_enabled'] == 0) {
         $this->config['news_content_info2_pos'] = 'disabled';
     }
     if ($this->config['news_readmore_enabled'] == 0) {
         $this->config['news_content_readmore_pos'] = 'disabled';
     }
     // override old string-based rules with the more readable array structures
     $this->config['crop_rules'] = NSP_GK5_Utils::parseCropRules($this->config);
 }
 function output()
 {
     // main wrapper
     echo '<div class="gkNspPM gkNspPM-GridNews" data-cols="' . $this->parent->config['portal_mode_grid_news_cols'] . '">';
     // render images
     for ($i = 0; $i < count($this->parent->content); $i++) {
         $this->parent->content[$i]['title'] = explode('__', $this->parent->content[$i]['title']);
         $this->parent->content[$i]['title'] = $this->parent->content[$i]['title'][0];
         // calculate the inverse class
         $inverse_class = '';
         $rows = $this->parent->config['portal_mode_grid_news_cols'] * 2;
         //
         if ($i % $rows >= $this->parent->config['portal_mode_grid_news_cols']) {
             $inverse_class = ' class="inverse"';
         }
         // output the HTML code
         echo '<figure' . $inverse_class . '>';
         if ($this->get_image($i)) {
             echo '<a href="' . $this->get_link($i) . '" title="' . strip_tags($this->parent->content[$i]['title']) . '">';
             echo '<img src="' . strip_tags($this->get_image($i)) . '" alt="' . strip_tags($this->parent->content[$i]['title']) . '" />';
             echo '</a>';
         }
         echo '<figcaption>';
         echo '<div>';
         // Title
         if ($this->parent->config['portal_mode_grid_news_title_length'] > 0) {
             echo '<h3>';
             echo '<a href="' . $this->get_link($i) . '" title="' . strip_tags($this->parent->content[$i]['title']) . '">';
             echo NSP_GK5_Utils::cutText(strip_tags($this->parent->content[$i]['title']), $this->parent->config, 'portal_mode_grid_news_title_length', '&hellip;');
             echo '</a>';
             echo '</h3>';
         }
         // Date
         if ($this->parent->config['portal_mode_grid_news_date_format'] != '') {
             echo '<time datetime="' . JHTML::_('date', $this->parent->content[$i]['date'], DATE_W3C) . '">' . JHTML::_('date', $this->parent->content[$i]['date'], $this->parent->config['portal_mode_grid_news_date_format']) . '</time>';
         }
         // Separator under the title/date
         if ($this->parent->config['portal_mode_grid_news_title_length'] > 0 || $this->parent->config['portal_mode_grid_news_date_format'] != '') {
             echo '<hr class="separator" />';
         }
         // Text
         if ($this->parent->config['portal_mode_grid_news_text_length'] > 0) {
             echo '<p>' . NSP_GK5_Utils::cutText(strip_tags($this->parent->content[$i]['text']), $this->parent->config, 'portal_mode_grid_news_text_length', '&hellip;') . '</p>';
         }
         echo '</div>';
         echo '</figcaption>';
         echo '</figure>';
     }
     // Link at the end
     if ($this->parent->config['portal_mode_grid_news_url'] != '') {
         echo '<a href="' . $this->parent->config['portal_mode_grid_news_url'] . '">' . $this->parent->config['portal_mode_grid_news_link_text'] . '</a>';
     }
     // closing main wrapper
     echo '</div>';
 }
Esempio n. 5
0
 function output()
 {
     // check if any article to display exists
     if (count($this->parent->content)) {
         // output the HTML code
         echo '<div class="gkNspPM gkNspPM-VideoList">';
         echo '<div>';
         // render blocks
         for ($i = 0; $i < count($this->parent->content); $i++) {
             $title = NSP_GK5_Utils::cutText(strip_tags($this->parent->content[$i]['title']), $this->parent->config, 'portal_mode_video_list_title_limit', '&hellip;');
             //
             if ($i == 0) {
                 echo '<div class="gkItemsPage active" data-cols="' . $this->parent->config['portal_mode_video_list_per_page'] . '">';
             }
             $info_date = JHTML::_('date', $this->parent->content[$i]['date'], 'M j, Y');
             //
             echo '<figure class="gkItem' . ($this->get_video($i) != '#' ? ' video' : '') . ($i < $this->parent->config['portal_mode_video_list_per_page'] ? ' active' : '') . '">';
             echo '<span class="gkImageWrap"><img src="' . $this->get_image($i) . '" alt="' . htmlspecialchars(strip_tags($this->parent->content[$i]['title'])) . '" data-url="' . $this->get_video($i) . '" data-x="' . $this->parent->config['portal_mode_video_list_popup_x'] . '" data-y="' . $this->parent->config['portal_mode_video_list_popup_y'] . '" /></span>';
             echo '<figcaption>';
             if ($this->parent->config['portal_mode_video_list_title'] == 1) {
                 echo '<h3><a href="' . $this->get_link($i) . '" title="' . htmlspecialchars(strip_tags($this->parent->content[$i]['title'])) . '">' . $title . '</a></h3>';
             }
             if ($this->parent->config['portal_mode_video_list_date'] == 1) {
                 echo '<strong>' . $info_date . '</strong>';
             }
             echo '</figcaption>';
             echo '</figure>';
             if ($i > 0 && ($i + 1) % $this->parent->config['portal_mode_video_list_per_page'] == 0 && $i != count($this->parent->content) - 1 || $this->parent->config['portal_mode_video_list_per_page'] == 1 && $i != count($this->parent->content) - 1) {
                 echo '</div>';
                 echo '<div class="gkItemsPage" data-cols="' . $this->parent->config['portal_mode_video_list_per_page'] . '">';
             } elseif ($i == count($this->parent->content) - 1) {
                 echo '</div>';
             }
         }
         echo '</div>';
         // pagination
         if (count($this->parent->content) > $this->parent->config['portal_mode_video_list_per_page']) {
             echo '<div class="gkBottomNav">';
             echo '<a href="#" class="gkBottomNavPrev">&laquo;</a>';
             echo '<ul class="gkBottomNavPagination">';
             for ($i = 0; $i < ceil(count($this->parent->content) / $this->parent->config['portal_mode_video_list_per_page']); $i++) {
                 echo '<li' . ($i == 0 ? ' class="active"' : '') . '>' . ($i + 1) . '</li>';
             }
             echo '</ul>';
             echo '<a href="#" class="gkBottomNavNext">&raquo;</a>';
             echo '</div>';
         }
         echo '</div>';
     } else {
         echo '<strong>Error:</strong> No articles to display';
     }
 }
Esempio n. 6
0
File: view.php Progetto: pwfir/klzm1
 static function info($config, $item, $num = 1)
 {
     // %AUTHOR %DATE %HITS %CATEGORY
     $news_info = '';
     //
     if ($num == 1) {
         if ($config['news_content_info_pos'] != 'disabled') {
             $class = 'nspInfo1 t' . $config['news_content_info_pos'] . ' f' . $config['news_content_info_float'];
         }
     } else {
         if ($config['news_content_info2_pos'] != 'disabled') {
             $class = 'nspInfo2 t' . $config['news_content_info2_pos'] . ' f' . $config['news_content_info2_float'];
         }
     }
     //
     if ($config['news_content_info_pos'] != 'disabled' && $num == 1 || $config['news_content_info2_pos'] != 'disabled' && $num == 2) {
         $news_info = '<p class="nspInfo ' . $class . '">' . $config['info' . ($num == 2 ? '2' : '') . '_format'] . '</p>';
         //
         $info_category = $config['category_link'] == 1 ? '<a href="' . $item["category_url"] . '" target="' . $config['open_links_window'] . '">' . $item['catname'] . '</a>' : $item['catname'];
         $info_author = $config['user_avatar'] == 1 ? '<span><img src="' . NSP_GK5_Utils::avatarURL($item['author_email'], $config['avatar_size']) . '" alt="' . htmlspecialchars($item['author']) . ' - avatar" class="nspAvatar" width="' . $config['avatar_size'] . '" height="' . $config['avatar_size'] . '" /> ' . $item['author'] . '</span>' : $item['author'];
         $info_date = JHTML::_('date', $item['date'], $config['date_format']);
         $info_hits = JText::_('MOD_NEWS_PRO_GK5_NHITS') . $item['hits'];
         // case when there is no rates
         if ($item['rating_count'] == 0) {
             $item['rating_count'] = 1;
         }
         $info_rate = $item['rating_count'] > 0 ? '<span class="nspRate">' . JText::_('MOD_NEWS_PRO_GK5_NSP_RATE') . ' ' . number_format($item['rating_sum'] / $item['rating_count'], 2) . '</span>' : '';
         $info_stars = '<span class="nsp-stars">';
         $stars_count = floor($item['rating_sum'] / $item['rating_count']);
         for ($i = 0; $i < 5; $i++) {
             $info_stars .= $i < $stars_count ? '<span class="nsp-star-1"></span>' : '<span class="nsp-star-0"></span>';
         }
         $info_stars .= '</span>';
         //
         $news_info = str_replace('%AUTHOR', $info_author, $news_info);
         $news_info = str_replace('%DATE', $info_date, $news_info);
         $news_info = str_replace('%HITS', $info_hits, $news_info);
         $news_info = str_replace('%CATEGORY', $info_category, $news_info);
         $news_info = str_replace('%RATE', $info_rate, $news_info);
         $news_info = str_replace('%STARS', $info_stars, $news_info);
     } else {
         return '';
     }
     //
     return $news_info;
 }
Esempio n. 7
0
 function output()
 {
     // output the HTML code
     echo '<ol class="gkNspPM gkNspPM-Highlights">';
     // render blocks
     for ($i = 0; $i < count($this->parent->content); $i++) {
         echo '<li>';
         echo '<h3><a href="' . $this->get_link($i) . '" title="' . htmlspecialchars(strip_tags($this->parent->content[$i]['title'])) . '">' . NSP_GK5_Utils::cutText(htmlspecialchars($this->parent->content[$i]['title']), $this->parent->config, 'portal_mode_highlights_title_limit', '&hellip;') . '</a></h3>';
         if ($this->parent->config['portal_mode_highlights_date_format'] != '') {
             echo '<p>' . JHTML::_('date', $this->parent->content[$i]['date'], $this->parent->config['portal_mode_highlights_date_format']) . '</p>';
         }
         echo '</li>';
     }
     echo '</ol>';
     if ($this->parent->config['portal_mode_highlights_readmore'] != '') {
         echo '<a href="' . $this->parent->config['portal_mode_highlights_readmore'] . '">' . JText::_('MOD_NEWS_PRO_GK5_PORTAL_MODE_HIGHLIGHTS_READMORE_VALUE') . '</a>';
     }
 }
Esempio n. 8
0
 function output()
 {
     // render images
     for ($i = 0; $i < count($this->parent->content); $i++) {
         // operations on the text
         $title = NSP_GK5_Utils::cutText(htmlspecialchars(strip_tags($this->parent->content[$i]['title'])), $this->parent->config, 'portal_mode_centered_title_limit', '');
         $text = NSP_GK5_Utils::cutText(htmlspecialchars(strip_tags($this->parent->content[$i]['text'])), $this->parent->config, 'portal_mode_centered_text_limit', '');
         $text_styles = '';
         if (trim($this->parent->config['portal_mode_centered_title_overlay_text_bg']) != '') {
             $text_styles .= 'background: ' . $this->parent->config['portal_mode_centered_title_overlay_text_bg'] . ';';
         }
         if ($text_styles != '') {
             $text_styles = ' style="' . $text_styles . '"';
         }
         // output the HTML code - main wrapper
         echo '<figure class="gkNspPM gkNspPM-CenteredTitleOverlay">';
         if (trim($this->parent->config['nsp_pre_text'])) {
             echo $this->parent->config['nsp_pre_text'];
         }
         if ($this->get_image($i)) {
             echo '<a href="' . $this->get_link($i) . '"><img src="' . strip_tags($this->get_image($i)) . '" alt="' . htmlspecialchars(strip_tags($this->parent->content[$i]['title'])) . '" /></a>';
         }
         echo '<figcaption>';
         echo '<div><div>';
         if (trim($title) != '') {
             echo '<h3' . $text_styles . '>';
             echo '<a href="' . $this->get_link($i) . '" title="' . htmlspecialchars(strip_tags($this->parent->content[$i]['title'])) . '">' . $title . '</a>';
             echo '</h3>';
         }
         if (trim($text) != '') {
             echo '<p' . $text_styles . '>';
             echo '<a href="' . $this->get_link($i) . '" title="' . htmlspecialchars(strip_tags($this->parent->content[$i]['title'])) . '">' . $text . '</a>';
             echo '</p>';
         }
         echo '</div></div>';
         echo '</figcaption>';
         if (trim($this->parent->config['nsp_post_text'])) {
             echo $this->parent->config['nsp_post_text'];
         }
         echo '</figure>';
     }
 }
Esempio n. 9
0
    function output()
    {
        // main wrapper
        echo '<div 
		class="gkNspPM gkNspPM-PortfolioGrid' . ($this->parent->config['portal_mode_portfolio_grid_overlay'] ? ' with-overlay' : ' without-overlay') . '" 
		data-cols="' . $this->parent->config['portal_mode_portfolio_grid_cols'] . '"
		data-small-desktop-cols="' . $this->parent->config['portal_mode_portfolio_grid_cols_small_desktop'] . '"
		data-tablet-cols="' . $this->parent->config['portal_mode_portfolio_grid_cols_tablet'] . '"
		data-small-tablet-cols="' . $this->parent->config['portal_mode_portfolio_grid_cols_small_tablet'] . '"
		data-mobile-cols="' . $this->parent->config['portal_mode_portfolio_grid_cols_mobile'] . '"
		>';
        if (trim($this->parent->config['nsp_pre_text'])) {
            echo $this->parent->config['nsp_pre_text'];
        }
        // render images
        for ($i = 0; $i < count($this->parent->content); $i++) {
            if ($this->get_image($i)) {
                // output the HTML code
                echo '<div class="figure loading">';
                if ($this->parent->config['portal_mode_portfolio_grid_overlay'] == '0') {
                    echo '<div>';
                }
                $data_popup = 'false';
                $data_url = $this->get_link($i);
                if ($this->parent->config['portal_mode_portfolio_grid_popup'] != 0) {
                    $data_url = $this->get_image($i, true);
                    if (stripos($data_url, JUri::base()) === FALSE) {
                        $data_url = JUri::base() . '/' . $data_url;
                    }
                    $data_popup = 'true';
                }
                $data_attrs = ' data-popup="' . $data_popup . '" data-popup-url="' . $data_url . '"';
                $figcaption_data_attrs = $data_attrs;
                $link_data_attrs = '';
                if ($this->parent->config['portal_mode_portfolio_grid_overlay'] == '0') {
                    $figcaption_data_attrs = '';
                    $link_data_attrs = $data_attrs;
                }
                $img_url = $this->get_image($i);
                if (stripos($img_url, JUri::base()) === FALSE) {
                    $img_url = JUri::base() . '/' . $img_url;
                }
                echo '<a href="' . $this->get_link($i) . '" title="' . strip_tags($this->parent->content[$i]['title']) . '" data-url="' . strip_tags($img_url) . '" class="image-resource"' . $link_data_attrs . '><img class="helper-image" src="data:image/png;base64,' . $this->generateBlankImage($this->parent->config) . '" alt="" />
						</a>';
                echo '<div class="figcaption" ' . $figcaption_data_attrs . '>';
                echo '<div>';
                // Title
                if ($this->parent->config['portal_mode_portfolio_grid_title_length'] > 0) {
                    echo '<h3>';
                    if ($this->parent->config['portal_mode_portfolio_grid_title_link'] != 0) {
                        echo '<a href="' . $this->get_link($i) . '" title="' . strip_tags($this->parent->content[$i]['title']) . '">';
                    }
                    echo NSP_GK5_Utils::cutText(strip_tags($this->parent->content[$i]['title']), $this->parent->config, 'portal_mode_portfolio_grid_title_length', '&hellip;');
                    if ($this->parent->config['portal_mode_portfolio_grid_title_link'] != 0) {
                        echo '</a>';
                    }
                    echo '</h3>';
                }
                // Date & Author
                if ($this->parent->config['portal_mode_portfolio_grid_date_format'] != '' && $this->parent->config['portal_mode_portfolio_grid_author'] != 0) {
                    echo '<span>';
                    // Date
                    if ($this->parent->config['portal_mode_portfolio_grid_date_format'] != '') {
                        echo '<time datetime="' . JHTML::_('date', $this->parent->content[$i]['date'], DATE_W3C) . '">' . JHTML::_('date', $this->parent->content[$i]['date'], $this->parent->config['portal_mode_portfolio_grid_date_format']) . '</time>';
                    }
                    // Author
                    if ($this->parent->config['portal_mode_portfolio_grid_author'] != 0) {
                        echo '<span>' . $this->parent->content[$i]['author_username'] . '</span>';
                    }
                    echo '</span>';
                }
                echo '</div>';
                echo '</div>';
                if ($this->parent->config['portal_mode_portfolio_grid_overlay'] == '0') {
                    echo '</div>';
                }
                echo '</div>';
            }
        }
        if (trim($this->parent->config['nsp_post_text'])) {
            echo $this->parent->config['nsp_post_text'];
        }
        // closing main wrapper
        echo '</div>';
    }
Esempio n. 10
0
 static function lists($config, $item, $num)
 {
     $odd = $num % 2;
     if ($config['news_short_pages'] > 0) {
         $text = '';
         $title = '';
         $image = '';
         $readmore = '';
         $link = static::itemLink($item, $config);
         if ($config['list_text_limit'] > 0) {
             $item['text'] = static::textPlugins($item['text'], $config);
             $text = NSP_GK5_Utils::cutText(strip_tags($item['text']), $config, 'list_text_limit', '&hellip;');
             if (JString::strlen($text) > 0) {
                 $text = '<p>' . $text . '</p>';
             }
         }
         if ($config['list_title_limit'] > 0) {
             $title = htmlspecialchars($item['title']);
             $title = NSP_GK5_Utils::cutText($title, $config, 'list_title_limit', '&hellip;');
             $title = str_replace('"', "&quot;", $title);
             if (JString::strlen($title) > 0) {
                 $title = '<h4><a href="' . $link . '" title="' . htmlspecialchars($item['title']) . '" target="' . $config['open_links_window'] . '">' . $title . '</a></h4>';
             }
         }
         if ($config['links_image'] == 1) {
             $image = static::image($config, $item, false, false, true);
         }
         if ($config['links_readmore'] == 1) {
             $readmore = '<a class="readon" href="' . $link . '" target="' . $config['open_links_window'] . '">' . (trim($config['readmore_text']) != '' ? $config['readmore_text'] : JText::_('MOD_NEWS_PRO_GK5_NSP_READMORE')) . '</a>';
         }
         // creating rest news list
         return '<li class="' . ($odd == 1 ? 'odd' : 'even') . '">' . $image . ($image != '' ? '<div>' . $title . $text . $readmore . '</div>' : $title . $text . $readmore) . '</li>';
     } else {
         return '';
     }
 }
 function generateLayout($config, $data)
 {
     /*
     	Available variables:
     	{TITLE} - article title
     			{TEXT} - article text
     			{URL} - article URL
     			{IMAGE_SRC} - article image URL
     			{AUTHOR_EMAIL} - article autor e-mail 
     			{AUTHOR_NAME} - article author name
     			{CATEGORY} - article category name
     			{CATEGORY_URL} - article category URL
     			{HITS} - article hits
     			{DATE} - article date (gets format from the information block settings)
     			{RATING} - article rating
     	K2 specific variables:
     	{TAGS} - article tag lists
     			{VIDEO_HTML} - HTML of the article video
     			{CATEGORY_IMAGE_SRC} - article category image URL
     */
     //
     // Get the values
     //
     // Image
     $viewClass = 'NSP_GK5_' . $config['source_name'] . '_View';
     // Basic data
     $title = NSP_GK5_Utils::cutText($data['title'], $config, 'title_limit');
     $text = NSP_GK5_Utils::cutText($data['text'], $config, 'news_limit');
     // URL
     $url = '';
     if (isset($data['url'])) {
         $url = $data['url'];
     } else {
         $url = call_user_func(array($viewClass, 'itemLink'), $data, $config);
     }
     // PHP 5.3:
     //$image_src = $viewClass::image($config, $data, true);
     $image_src = call_user_func(array($viewClass, 'image'), $config, $data, true);
     // Author data
     $author_email = $data['author_email'];
     $author_name = $data['author'];
     // Category data
     $category = $data['catname'];
     $category_url = '';
     if (isset($data['caturl'])) {
         $category_url = $data['caturl'];
     } else {
         $category_url = call_user_func(array($viewClass, 'categoryLink'), $data);
     }
     // Other data
     $hits = $data['hits'];
     $date = JHTML::_('date', $data['date'], $config['date_format']);
     $rating = $data['rating_count'] > 0 ? number_format($data['rating_sum'] / $data['rating_count'], 2) : 0;
     //
     // Get the layout text
     //
     if (is_file(JPATH_ROOT . DS . 'modules' . DS . 'mod_news_pro_gk5' . DS . 'article_formats' . DS . $config['article_format'])) {
         // read the format file
         $format_file = file_get_contents(JPATH_ROOT . DS . 'modules' . DS . 'mod_news_pro_gk5' . DS . 'article_formats' . DS . $config['article_format']);
         // replace values
         $to_replace = array('{TITLE}', '{TEXT}', '{URL}', '{IMAGE_SRC}', '{AUTHOR_EMAIL}', '{AUTHOR_NAME}', '{CATEGORY}', '{CATEGORY_URL}', '{HITS}', '{DATE}', '{RATING}');
         // values for the replacement
         $replacement = array($title, $text, $url, $image_src, $author_email, $author_name, $category, $category_url, $hits, $date, $rating);
         // replace values in the format file
         $format_file = str_replace($to_replace, $replacement, $format_file);
         // replacements only for K2
         if (stripos($config['data_source'], 'k2_') !== FALSE) {
             // tags list value
             $tags = '';
             // if tags exists
             if (isset($data['tags']) && count($data['tags']) > 0) {
                 $i = 0;
                 foreach ($data['tags'] as $tag) {
                     $link = urldecode(JRoute::_(K2HelperRoute::getTagRoute($tag)));
                     if ($i == 0) {
                         $tags .= '<a href="' . $link . '">' . $tag . '</a>';
                     } else {
                         $tags .= ', <a href="' . $link . '">' . $tag . '</a>';
                     }
                     //
                     $i++;
                 }
             }
             // video HTML value
             $video_html = $data['video'];
             // category image URL value
             $category_image_src = '';
             // if the category image exists
             if ($data['cat_image'] != '') {
                 $category_image_src = JURI::root() . 'media/k2/categories/' . $data['cat_image'];
             }
             // replace values
             $to_replace = array('{TAGS}', '{VIDEO_HTML}', '{CATEGORY_IMAGE_SRC}');
             // values for the replacement
             $replacement = array($tags, $video_html, $category_image_src);
             // replace values in the format file
             $format_file = str_replace($to_replace, $replacement, $format_file);
         }
         // parse lang rules
         $matches = array();
         preg_match_all('@{{.*?}}@', $format_file, $matches);
         if (count($matches) > 0) {
             for ($i = 0; $i < count($matches); $i++) {
                 $phrase = $matches[$i][0];
                 $phrase = JText::_(str_replace(array('{{', '}}'), '', $phrase));
                 $format_file = str_replace($matches[$i][0], $phrase, $format_file);
             }
         }
         // PARSING PLUGINS
         if ($config['parse_plugins'] == TRUE) {
             $format_file = JHtml::_('content.prepare', $format_file);
         }
         // CLEANING PLUGINS
         if ($config['clean_plugins'] == TRUE) {
             $format_file = preg_replace("/(\\{.+?\\}.+?\\{.+?})|(\\{.+?\\})/", "", $format_file);
         }
         return $format_file;
     } else {
         return '';
     }
 }
Esempio n. 12
0
	static function cutText($text, $config, $field, $at_end = FALSE) {
		$limit_value = $config[$field];
		$limit_type = $config[$field . '_type'];
		//
		if($at_end === FALSE) {
			$at_end = $config['more_text_value'];
		}
		// solved problem from: https://www.gavick.com/support/forums/47/12309.html?p=57464#p57464
		$cck_path = JPATH_BASE . DS . 'components' . DS . 'com_cck';
		if (file_exists($cck_path)) {
			if(JComponentHelper::isEnabled('com_cck', true)){
				// Force parsing plugin if SEBLOD is used
				if($config['parse_plugins'] == FALSE) {
					 $text = JHtml::_('content.prepare', $text);
				}
				$text = trim(substr(strip_tags( $text,"<br /><br><strong></strong><p></p><i></i><b></b><span></span><ul></ul><li></li><blockquote></blockquote>"),0));
			}
		}
		if($config['clean_xhtml'] == 1) {
			$allowed_html = '';
			
			if(strlen(trim($config['allowed_tags'])) > 0) {
				$allowed_html = explode(',', $config['allowed_tags']);		
				$allowed_len = count($allowed_html);
				
				for($i = 0; $i < $allowed_len; $i++) {
					$allowed_html[$i] = '<' . $allowed_html[$i] . '>';
				}
				
				$allowed_html = implode('', $allowed_html);
			}
			
			if($limit_type == 'words' && $limit_value > 0){			
				$temp = explode(' ', strip_tags($text, $allowed_html));
			
				if(count($temp) > $limit_value){
					for($i=0; $i<$limit_value; $i++) {
						$cutted[$i] = $temp[$i];
					}
					$cutted = implode(' ', $cutted);
					$cutted = rtrim($cutted, '\'"!,.');
					$text = $cutted . $at_end;
				} else {
					$text = strip_tags($text, $allowed_html);
				}
			} elseif($limit_type == 'words' && $limit_value == 0) {
				return '';
			} else {
				if(JString::strlen($text) > $limit_value){
					$cutted = JString::substr(strip_tags($text, $allowed_html), 0, $limit_value);
					$cutted = rtrim($cutted, '\'"!,.');
					$text = $cutted . $at_end;
				} else {
					$text = strip_tags($text, $allowed_html);
				}
			}
		} else {
			if($limit_type == 'words' && $limit_value > 0) {
				$temp = explode(' ', strip_tags($text));
			
				if(count($temp) > $limit_value){
					$text = NSP_GK5_Utils::cutHTML(str_replace(array('<p>', '</p>'), '', $text), $limit_value, $limit_type);
					$text .= $at_end;
				}
			} elseif ($limit_type == 'words' && $limit_value == 0) {
				return '';
			} else {
				if(JString::strlen(strip_tags($text)) > $limit_value) {
					$text = NSP_GK5_Utils::cutHTML(str_replace(array('<p>', '</p>'), '', $text), $limit_value, $limit_type);
					$text .= $at_end;
				}
			}
		}
		// replace unnecessary entities at end of the cutted text
		$toReplace = array('&&', '&a&', '&am&', '&amp&', '&q&', '&qu&', '&quo&', '&quot&', '&ap&', '&apo&', '&apos&');
		$text = str_replace($toReplace, '&', $text);
		//
		return $text;
	}
Esempio n. 13
0
 static function lists($config, $item, $num)
 {
     $odd = $num % 2;
     if ($config['news_short_pages'] > 0) {
         $text = '';
         $title = '';
         if ($config['list_text_limit'] > 0) {
             $text = NSP_GK5_Utils::cutText(strip_tags(preg_replace("/\\{.+?\\}/", "", $item['text'])), $config, 'list_text_limit', '&hellip;');
             $text = preg_replace("/\\{.+?\\}/", "", $text);
             if (JString::strlen($text) > 0) {
                 $text = '<p>' . $text . '</p>';
             }
         }
         if ($config['list_title_limit'] > 0) {
             $title = htmlspecialchars($item['title']);
             $title = NSP_GK5_Utils::cutText($title, $config, 'list_title_limit', '&hellip;');
             $title = str_replace('"', "&quot;", $title);
             $link = NSP_GK5_com_k2_View::itemLink($item);
             if (JString::strlen($title) > 0) {
                 $title = '<h4><a href="' . $link . '" title="' . htmlspecialchars($item['title']) . '">' . $title . '</a></h4>';
             }
         }
         // creating rest news list
         return '<li class="' . ($odd == 1 ? 'odd' : 'even') . '">' . $title . $text . '</li>';
     } else {
         return '';
     }
 }
Esempio n. 14
0
 function generateLayout($config, $data)
 {
     /*
     	Available variables
     	
     	{TITLE} - article title
     	{TEXT} - article text
     	{URL} - article URL
     	{IMAGE_SRC} - article image URL
     	{AUTHOR_EMAIL} - article autor e-mail 
     	{AUTHOR_NAME} - article author name
     	{CATEGORY} - article category name
     	{CATEGORY_URL} - article category URL
     	{HITS} - article hits
     	{DATE} - article date
     	{RATING} - article rating
     */
     //
     // Get the values
     //
     // Basic data
     $title = NSP_GK5_Utils::cutText($data['title'], $config, 'title_limit');
     $text = NSP_GK5_Utils::cutText($data['text'], $config, 'news_limit');
     // URL
     $url = '';
     if (isset($data['url'])) {
         $url = $data['url'];
     } else {
         $url = call_user_func(array($viewClass, 'itemLink'), $data, $config);
     }
     // Image
     $viewClass = 'NSP_GK5_' . $config['source_name'] . '_View';
     // PHP 5.3:
     //$image_src = $viewClass::image($config, $data, true);
     $image_src = call_user_func(array($viewClass, 'image'), $config, $data, true);
     // Author data
     $author_email = $data['author_email'];
     $author_name = $data['author'];
     // Category data
     $category = $data['catname'];
     $category_url = '';
     if (isset($data['caturl'])) {
         $category_url = $data['caturl'];
     } else {
         $url = call_user_func(array($viewClass, 'categoryLink'), $data);
     }
     // Other data
     $hits = $data['hits'];
     $date = $data['date'];
     $rating = $item['rating_count'] > 0 ? number_format($data['rating_sum'] / $data['rating_count'], 2) : 0;
     //
     // Get the layout text
     //
     if (is_file(JPATH_ROOT . DS . 'modules' . DS . 'mod_news_pro_gk5' . DS . 'article_formats' . DS . $config['article_format'])) {
         // read the format file
         $format_file = file_get_contents(JPATH_ROOT . DS . 'modules' . DS . 'mod_news_pro_gk5' . DS . 'article_formats' . DS . $config['article_format']);
         // replace values
         $to_replace = array('{TITLE}', '{TEXT}', '{URL}', '{IMAGE_SRC}', '{AUTHOR_EMAIL}', '{AUTHOR_NAME}', '{CATEGORY}', '{CATEGORY_URL}', '{HITS}', '{DATE}', '{RATING}');
         // values for the replacement
         $replacement = array($title, $text, $url, $image_src, $author_email, $author_name, $category, $category_url, $hits, $date, $rating);
         // replace values in the format file
         $format_file = str_replace($to_replace, $replacement, $format_file);
         // parse lang rules
         $matches = array();
         preg_match_all('@{{.*?}}@', $format_file, $matches);
         if (count($matches) > 0) {
             for ($i = 0; $i < count($matches); $i++) {
                 $phrase = $matches[$i][0];
                 $phrase = JText::_(str_replace(array('{{', '}}'), '', $phrase));
                 $format_file = str_replace($matches[$i][0], $phrase, $format_file);
             }
         }
         // PARSING PLUGINS
         if ($config['parse_plugins'] == TRUE) {
             $format_file = JHtml::_('content.prepare', $format_file);
         }
         // CLEANING PLUGINS
         if ($config['clean_plugins'] == TRUE) {
             $format_file = preg_replace("/(\\{.+?\\}.+?\\{.+?})|(\\{.+?\\})/", "", $format_file);
         }
         return $format_file;
     } else {
         return '';
     }
 }
Esempio n. 15
0
 static function lists($config, $item, $num)
 {
     $odd = $num % 2;
     if ($config['news_short_pages'] > 0) {
         $text = '';
         $title = '';
         $image = '';
         $readmore = '';
         $link = NSP_GK5_jomsocial_View::itemLink($item);
         if ($config['list_text_limit'] > 0) {
             $text = NSP_GK5_Utils::cutText(strip_tags(preg_replace("/\\{.+?\\}/", "", $item['text'])), $config, 'list_text_limit', '&hellip;');
             $text = preg_replace("/\\{.+?\\}/", "", $text);
             if (JString::strlen($text) > 0) {
                 $text = '<p>' . $text . '</p>';
             }
         }
         if ($config['links_readmore'] == 1) {
             $readmore = '<a class="readon" href="' . $link . '">' . (trim($config['readmore_text']) != '' ? $config['readmore_text'] : JText::_('MOD_NEWS_PRO_GK5_NSP_READMORE')) . '</a>';
         }
         // creating rest news list
         return '<li class="' . ($odd == 1 ? 'odd' : 'even') . '">' . $text . $readmore . '</li>';
     } else {
         return '';
     }
 }
Esempio n. 16
0
 function output()
 {
     if (count($this->parent->content) < 5) {
         echo 'This module needs at least 5 articles to display.';
         return;
     }
     // main wrapper
     echo '<div class="gkNspPM gkNspPM-NewsSlider" data-autoanim="' . $this->parent->config['portal_mode_news_slider_autoanimation_time'] . '" style="min-height: ' . intval($this->parent->config['img_height'] + 200.0) . 'px;">';
     if (trim($this->parent->config['nsp_pre_text'])) {
         echo $this->parent->config['nsp_pre_text'];
     }
     if ($this->parent->config['portal_mode_news_slider_label'] != '') {
         echo '<h2>' . $this->parent->config['portal_mode_news_slider_label'] . '</h2>';
     }
     // render images
     for ($i = 0; $i < count($this->parent->content); $i++) {
         $title = $this->parent->content[$i]['title'];
         $text = $this->parent->content[$i]['text'];
         $element_classname = '';
         switch ($i) {
             case 0:
                 $element_classname = ' class="gk-prev-2"';
                 break;
             case 1:
                 $element_classname = ' class="gk-prev-1"';
                 break;
             case 2:
                 $element_classname = ' class="gk-active"';
                 break;
             case 3:
                 $element_classname = ' class="gk-next-1"';
                 break;
             case 4:
                 $element_classname = ' class="gk-next-2"';
                 break;
             case 5:
                 $element_classname = ' class="gk-to-hide"';
                 break;
             case 6:
                 $element_classname = ' class="gk-to-show"';
                 break;
             default:
                 $element_classname = ' class="gk-hide"';
                 break;
         }
         $element_sr = '';
         if ($i == 0) {
             $element_sr = ' data-sr="enter right and move 200px and wait .6s"';
         }
         if ($i == 1) {
             $element_sr = ' data-sr="enter right and move 100px and wait .4s"';
         }
         if ($i == 2) {
             $element_sr = ' data-sr="enter bottom and move 100px"';
         }
         if ($i == 3) {
             $element_sr = ' data-sr="enter left and move 100px and wait .4s"';
         }
         if ($i == 4) {
             $element_sr = ' data-sr="enter left and move 200px and wait .6s"';
         }
         // output the HTML code
         echo '<figure' . $element_classname . $element_sr . ' data-cat="' . $this->get_category_link($i) . '">';
         if ($this->get_image($i)) {
             echo '<a href="' . $this->get_link($i) . '" title="' . strip_tags($this->parent->content[$i]['title']) . '" class="gk-image-wrap">';
             echo '<img src="' . strip_tags($this->get_image($i)) . '" style="margin: ' . $this->parent->config['portal_mode_news_slider_image_margin'] . ';" alt="' . strip_tags($this->parent->content[$i]['title']) . '" />';
             echo '</a>';
         }
         echo '<figcaption>';
         if ($this->parent->config['portal_mode_news_slider_date_format'] != '') {
             echo '<small>' . JHTML::_('date', $this->parent->content[$i]['date'], $this->parent->config['portal_mode_news_slider_date_format']) . '</small>';
         }
         echo '<h3>';
         echo '<a href="' . $this->get_link($i) . '" title="' . strip_tags($this->parent->content[$i]['title']) . '">';
         echo $title;
         echo '</a>';
         echo '</h3>';
         echo '<p>' . NSP_GK5_Utils::cutText($text, $this->parent->config, 'news_limit') . '</p>';
         echo '</figcaption>';
         echo '</figure>';
     }
     $to_hide_link = '';
     if ($this->parent->config['portal_mode_news_slider_category_label'] == '') {
         $to_hide_link = ' style="display: none;"';
     }
     echo '<a href="#" class="gk-data-category-link"' . $to_hide_link . '>' . $this->parent->config['portal_mode_news_slider_category_label'] . '</a>';
     if (trim($this->parent->config['nsp_post_text'])) {
         echo $this->parent->config['nsp_post_text'];
     }
     // closing main wrapper
     echo '</div>';
 }
Esempio n. 17
0
 static function info($config, $item, $num = 1)
 {
     // %AUTHOR %DATE %HITS %CATEGORY
     $news_info = '';
     //
     if ($num == 1) {
         if ($config['news_content_info_pos'] != 'disabled') {
             $class = 'nspInfo1 t' . $config['news_content_info_pos'] . ' f' . $config['news_content_info_float'];
         }
     } else {
         if ($config['news_content_info2_pos'] != 'disabled') {
             $class = 'nspInfo2 t' . $config['news_content_info2_pos'] . ' f' . $config['news_content_info2_float'];
         }
     }
     //
     if ($config['news_content_info_pos'] != 'disabled' && $num == 1 || $config['news_content_info2_pos'] != 'disabled' && $num == 2) {
         $news_info = '<p class="nspInfo ' . $class . '">' . $config['info' . ($num == 2 ? '2' : '') . '_format'] . '</p>';
         //
         $info_category = $config['category_link'] == 1 ? '<a href="' . static::categoryLink($item) . '" target="' . $config['open_links_window'] . '">' . $item['catname'] . '</a>' : $item['catname'];
         //
         $author = trim(htmlspecialchars($item['author_alias'])) != '' ? htmlspecialchars($item['author_alias']) : htmlspecialchars($item['author_username']);
         $info_author = $config['user_avatar'] == 1 ? '<span><img src="' . NSP_GK5_Utils::avatarURL($item['author_email'], $config['avatar_size']) . '" alt="' . $author . ' - avatar" class="nspAvatar" width="' . $config['avatar_size'] . '" height="' . $config['avatar_size'] . '" /> ' . $author . '</span>' : $author;
         $info_date = JHTML::_('date', $item['date'], $config['date_format']);
         $info_hits = JText::_('MOD_NEWS_PRO_GK5_NHITS') . $item['hits'];
         // case when there is no rates
         if ($item['rating_count'] == 0) {
             $item['rating_count'] = 1;
         }
         $info_rate = $item['rating_count'] > 0 ? '<span class="nspRate">' . JText::_('MOD_NEWS_PRO_GK5_NSP_RATE') . ' ' . number_format($item['rating_sum'] / $item['rating_count'], 2) . '</span>' : '';
         $info_stars = '<span class="nsp-stars">';
         $stars_count = floor($item['rating_sum'] / $item['rating_count']);
         for ($i = 0; $i < 5; $i++) {
             $info_stars .= $i < $stars_count ? '<span class="nsp-star-1"></span>' : '<span class="nsp-star-0"></span>';
         }
         $info_stars .= '</span>';
         $info_comments = '';
         if ($config['com_content_comments_source'] != 'none') {
             $link = static::itemLink($item);
             $info_comments = JText::_('MOD_NEWS_PRO_GK5_NO_COMMENTS');
             //
             if (isset($item['comments'])) {
                 if ($item['comments'] == 1) {
                     $info_comments = JText::_('MOD_NEWS_PRO_GK5_1COMMENT');
                 } else {
                     if ($item['comments'] > 1 && $item['comments'] < 5) {
                         $info_comments = $item['comments'] . ' ' . JText::_('MOD_NEWS_PRO_GK5_MORECOMMENTS');
                     } else {
                         if ($item['comments'] >= 5) {
                             $info_comments = $item['comments'] . ' ' . JText::_('MOD_NEWS_PRO_GK5_MUCHMORECOMMENTS');
                         }
                     }
                 }
             }
             $info_comments = '<a href="' . $link . '" target="' . $config['open_links_window'] . '">' . $info_comments . '</a>';
         }
         //
         $info_comments_short = '';
         if ($config['com_content_comments_source'] != 'none') {
             $link = static::itemLink($item);
             $info_comments_short = 0;
             //
             if (isset($item['comments'])) {
                 $info_comments_short = $item['comments'];
             }
             $info_comments_short = '<a href="' . $link . '" target="' . $config['open_links_window'] . '">' . $info_comments_short . '</a>';
         }
         // Featured label
         $info_featured = '';
         if (stripos($news_info, '%FEATURED') !== FALSE && $item['frontpage'] == '1') {
             $info_featured = '<strong class="is-featured">' . JText::_('MOD_NEWS_PRO_GK5_FEATURED') . '</strong>';
         }
         // Tags
         $info_tags = '';
         if (isset($item['tags']) && count($item['tags']) > 0) {
             $i = 0;
             foreach ($item['tags'] as $tag_name => $tag_id) {
                 $link = urldecode(JRoute::_(TagsHelperRoute::getTagRoute($tag_id)));
                 if ($i == 0) {
                     $info_tags .= '<a href="' . $link . '" target="' . $config['open_links_window'] . '">' . $tag_name . '</a>';
                 } else {
                     $info_tags .= ', <a href="' . $link . '" target="' . $config['open_links_window'] . '">' . $tag_name . '</a>';
                 }
                 //
                 $i++;
             }
         }
         //
         $news_info = str_replace('%AUTHOR', $info_author, $news_info);
         $news_info = str_replace('%DATE', $info_date, $news_info);
         $news_info = str_replace('%HITS', $info_hits, $news_info);
         $news_info = str_replace('%CATEGORY', $info_category, $news_info);
         $news_info = str_replace('%STARS', $info_stars, $news_info);
         $news_info = str_replace('%RATE', $info_rate, $news_info);
         $news_info = str_replace('%TAGS', $info_tags, $news_info);
         $news_info = str_replace('%FEATURED', $info_featured, $news_info);
         // only if comments used
         if ($config['com_content_comments_source'] != 'none') {
             $news_info = str_replace('%COMMENTS_SHORT', $info_comments_short, $news_info);
             $news_info = str_replace('%COMMENTS', $info_comments, $news_info);
         }
     } else {
         return '';
     }
     //
     return $news_info;
 }