Exemplo n.º 1
0
Arquivo: view.php Projeto: 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;
 }
Exemplo 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';
     }
 }
 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>';
 }
Exemplo n.º 4
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';
     }
 }
Exemplo n.º 5
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>';
     }
 }
Exemplo n.º 6
0
 static function text($config, $item, $readmore)
 {
     if ($config['news_content_text_pos'] != 'disabled') {
         //
         $item['text'] = NSP_GK5_Utils::cutText($item['text'], $config, 'news_limit');
         $link = $item['url'];
         //
         $item['text'] = $config['news_text_link'] == 1 ? '<a href="' . $link . '" target="' . $config['open_links_window'] . '">' . $item['text'] . '</a>' : $item['text'];
         $class = ' t' . $config['news_content_text_pos'] . ' f' . $config['news_content_text_float'];
         //
         if ($config['news_content_readmore_pos'] == 'after') {
             return '<p class="nspText' . $class . '">' . $item['text'] . ' ' . $readmore . '</p>';
         } else {
             return '<p class="nspText' . $class . '">' . $item['text'] . '</p>';
         }
     } else {
         return '';
     }
 }
Exemplo n.º 7
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>';
     }
 }
Exemplo n.º 8
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 '';
     }
 }
Exemplo n.º 10
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 '';
     }
 }
Exemplo n.º 11
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>';
    }
Exemplo n.º 12
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>';
 }
Exemplo n.º 13
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 '';
     }
 }
Exemplo 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 '';
     }
 }