diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ae24cca --- /dev/null +++ b/.gitignore @@ -0,0 +1,90 @@ +# Created by .ignore support plugin (hsz.mobi) +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests +### macOS template +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + diff --git a/README.md b/README.md index 6075ea7..305143d 100755 --- a/README.md +++ b/README.md @@ -5,6 +5,10 @@ Advanced Joomla! content module. ## Latest changes +### v.1.9.3.9 + +* Added custom readmore text from article to string parser. + ### v.1.9.3.8 * Fixed issue with the RSS feed as a data source diff --git a/mod_news_pro_gk5/data_sources/com_content/model.php b/mod_news_pro_gk5/data_sources/com_content/model.php index c29a2a5..c3f228b 100644 --- a/mod_news_pro_gk5/data_sources/com_content/model.php +++ b/mod_news_pro_gk5/data_sources/com_content/model.php @@ -26,7 +26,7 @@ static function getSources($config) { $where2 = ''; $tag_join= ''; $tag_where = ''; - + // if($config['data_source'] == 'com_content_tags' ) { $tag_join = ' LEFT JOIN #__contentitem_tag_map AS tag_map ON content.id = tag_map.content_item_id LEFT JOIN #__tags AS tag ON tag.id = tag_map.tag_id '; @@ -41,20 +41,20 @@ static function getSources($config) { } else if($config['data_source'] == 'com_content_tags'){ $source = strpos($config['com_content_tags'],',') !== false ? explode(',', $config['com_content_tags']) : $config['com_content_tags']; $where1 = ' tag.id = '; - $where2 = ' OR tag.id = '; + $where2 = ' OR tag.id = '; } else { $source = strpos($config['com_content_articles'],',') !== false ? explode(',', $config['com_content_articles']) : $config['com_content_articles']; $where1 = ' content.id = '; - $where2 = ' OR content.id = '; - } - // + $where2 = ' OR content.id = '; + } + // $where = ''; // initialize WHERE condition // generating WHERE condition for($i = 0;$i < count($source);$i++){ if(count($source) == 1) $where .= (is_array($source)) ? $where1.$source[0] : $where1.$source; - else $where .= ($i == 0) ? $where1.$source[$i] : $where2.$source[$i]; + else $where .= ($i == 0) ? $where1.$source[$i] : $where2.$source[$i]; } - + if($where != '') { $where = ' AND (' . $where . ') '; } @@ -77,14 +77,14 @@ static function getSources($config) { $tag_where. ' AND c.published = 1 - '; - + '; + // Executing SQL Query $db->setQuery($query_name); // check if some categories was detected if($categories = $db->loadObjectList()) { $categories_array = array(); - // iterate through all items + // iterate through all items foreach($categories as $item) { if(!in_array($item->CID, $categories_array)) { array_push($categories_array, $item->CID); @@ -100,19 +100,19 @@ static function getSources($config) { return null; } } - // Method to get articles in standard mode - static function getArticles($categories, $config, $amount) { + // Method to get articles in standard mode + static function getArticles($categories, $config, $amount) { // $sql_where = ''; $tag_join = ''; $tag_where = ''; $db = JFactory::getDBO(); // - if($categories) { + if($categories) { // getting categories ItemIDs for($j = 0; $j < count($categories); $j++) { $sql_where .= ($j != 0) ? ' OR content.catid = ' . $categories[$j] : ' content.catid = '. $categories[$j]; - } + } } // Overwrite SQL query when user set IDs manually if($config['data_source'] == 'com_content_articles' && $config['com_content_articles'] != ''){ @@ -120,7 +120,7 @@ static function getArticles($categories, $config, $amount) { $sql_where = ''; $ids = explode(',', $config['com_content_articles']); // - for($i = 0; $i < count($ids); $i++ ){ + for($i = 0; $i < count($ids); $i++ ){ // linking string with content IDs $sql_where .= ($i != 0) ? ' OR content.id = '.$ids[$i] : ' content.id = '.$ids[$i]; } @@ -135,21 +135,21 @@ static function getArticles($categories, $config, $amount) { // $ids = explode(',', $config['com_content_tags']); // - for($i = 0; $i < count($ids); $i++ ){ + for($i = 0; $i < count($ids); $i++ ){ // linking string with content IDs $sql_where .= ($i != 0) ? ' OR tag.id = '.$ids[$i] : ' tag.id = '.$ids[$i]; } - - + + } - + // Arrays for content $content = array(); $news_amount = 0; // Initializing standard Joomla classes and SQL necessary variables $access_con = ''; - - $user = JFactory::getUser(); + + $user = JFactory::getUser(); if($config['news_unauthorized'] == '0') { $access_con = ' AND content.access IN ('. implode(',', $user->getAuthorisedViewLevels()) .') '; } @@ -165,7 +165,7 @@ static function getArticles($categories, $config, $amount) { // when showing only frontpage articles is disabled $frontpage_con = ''; $featured_join = ''; - + if($config['only_featured'] == 0 && $config['news_featured'] == 0) { $frontpage_con = ' AND content.featured = 0 '; $featured_join = ''; // get featured ordering @@ -173,7 +173,7 @@ static function getArticles($categories, $config, $amount) { $frontpage_con = ' AND content.featured = 1'; $featured_join = 'LEFT JOIN #__content_frontpage as content_frontpage ON id = content_id'; // get featured ordering } - + $since_con = ''; if($config['news_since'] !== '') { $since_con = ' AND content.created >= ' . $db->Quote($config['news_since']); @@ -182,12 +182,12 @@ static function getArticles($categories, $config, $amount) { if($config['news_since'] == '' && $config['news_in'] != '') { $since_con = ' AND content.created >= ' . $db->Quote(strftime('%Y-%m-%d 00:00:00', time() - ($config['news_in'] * 24 * 60 * 60))); } - + // current article hiding $current_con = ''; - + if( - $config['hide_current_com_content_article'] == '1' && + $config['hide_current_com_content_article'] == '1' && JRequest::getCmd('option') == 'com_content' && JRequest::getCmd('view') == 'article' && JRequest::getVar('id') != '' @@ -201,16 +201,16 @@ static function getArticles($categories, $config, $amount) { // create the condition $current_con = ' AND (content.id != '.$id.') '; } - + // Ordering string $order_options = ''; $rating_join = ''; // When sort value is random if( - $config['news_sort_value'] == 'random'|| + $config['news_sort_value'] == 'random'|| $config['news_sort_value'] == 'user' ) { - $order_options = ' RAND() '; + $order_options = ' RAND() '; } else if($config['news_sort_value'] == 'rating') { $order_options = ' (content_rating.rating_sum / content_rating.rating_count) '.$config['news_sort_order']; $rating_join = 'LEFT JOIN #__content_rating AS content_rating ON content_rating.content_id = content.id'; @@ -222,20 +222,20 @@ static function getArticles($categories, $config, $amount) { if (JFactory::getApplication()->getLanguageFilter()) { $lang_filter = ' AND content.language in ('.$db->quote(JFactory::getLanguage()->getTag()).','.$db->quote('*').') '; } - + if($config['data_source'] != 'com_content_all' && $sql_where != '') { $sql_where = ' AND ( ' . $sql_where . ' ) '; } - + // one article per page - helper variables $article_id_query = 'content.id AS iid'; $one_article_query = ''; - + if($config['one_article_per_category']) { $article_id_query = 'MAX(content.id) AS iid, content.catid AS cid'; $one_article_query = ' GROUP BY content.catid '; } - // creating SQL query + // creating SQL query $query_news = ' SELECT '.$article_id_query.' @@ -265,9 +265,9 @@ static function getArticles($categories, $config, $amount) { // run SQL query $db->setQuery($query_news); // when exist some results - if($news = $db->loadAssocList()) { + if($news = $db->loadAssocList()) { // generating tables of news data - foreach($news as $item) { + foreach($news as $item) { $content[] = $item; // store item in array $news_amount++; // news amount } @@ -280,7 +280,7 @@ static function getArticles($categories, $config, $amount) { if($second_sql_where != '') { $second_sql_where = ' AND ('.$second_sql_where.')'; } - + // second SQL query to get rest of the data and avoid the DISTINCT $second_query_news = ' SELECT @@ -293,6 +293,7 @@ static function getArticles($categories, $config, $amount) { content.images AS images, content.featured AS frontpage, content.access AS access, + content.attribs AS attribs, content.language AS lang, categories.title AS catname, users.email AS author_email, @@ -332,13 +333,13 @@ static function getArticles($categories, $config, $amount) { if($news2 = $db->loadAssocList()) { // load URL overrides $url_overrides = false; - + if(isset($config['url_overrides']) && $config['url_overrides'] == '1') { $override_file = JPATH_SITE . '/modules/mod_news_pro_gk5/url_overrides.json'; - + if(JFile::exists($override_file)) { $override_content = file_get_contents($override_file); - + if($override_content && $override_content != '') { $url_overrides = json_decode($override_content, true); } @@ -351,20 +352,20 @@ static function getArticles($categories, $config, $amount) { array_push($content_iid, $item['iid']); } // generating tables of news data - foreach($news2 as $item) { + foreach($news2 as $item) { $pos = array_search($item['iid'], $content_iid); - + if( - $url_overrides && + $url_overrides && is_array($url_overrides) && - count($url_overrides) > 0 && + count($url_overrides) > 0 && isset($url_overrides['com_content']) ) { if(isset($url_overrides['com_content'][$item['iid']])) { $item['overrided_url'] = $url_overrides['com_content'][$item['iid']]; } } - + if( $item['lang'] == '*' ){ $lang = JFactory::getLanguage(); $item['lang'] = $lang->getTag(); @@ -374,8 +375,8 @@ static function getArticles($categories, $config, $amount) { $access = JComponentHelper::getParams('com_content')->get('show_noauth'); // set the IDs to 0 if the unauthorized items are displayed if($config['news_unauthorized'] == '1') { - if (!($access || in_array($item['access'], $authorised))) { - $item['id'] = 0; + if (!($access || in_array($item['access'], $authorised))) { + $item['id'] = 0; } } // merge the new data to the array of items data @@ -394,46 +395,46 @@ static function getArticles($categories, $config, $amount) { // Reorder items if necessary if( $config['news_sort_value'] == 'user' && - $config['data_source'] == 'com_content_articles' && + $config['data_source'] == 'com_content_articles' && $config['com_content_articles'] != '' ) { $new_content = array(); $ids = explode(',', $config['com_content_articles']); $query_ids = array(); - + if(count($content)) { foreach($content as $key => $item) { $query_ids[$item['iid']] = $key; } - + foreach($ids as $id) { if(isset($query_ids[$id])) { array_push($new_content, $content[$query_ids[$id]]); } } - + $content = $new_content; } } // the content array - return $content; + return $content; } - + // static function getTags($content, $config) { - // + // $db = JFactory::getDBO(); $counters_tab = array(); - // + // if(count($content) > 0) { // initializing variables $sql_where = ''; // - for($i = 0; $i < count($content); $i++ ) { + for($i = 0; $i < count($content); $i++ ) { // linking string with content IDs $sql_where .= ($i != 0) ? ' OR content.id = '.$content[$i]['iid'] : ' content.id = '.$content[$i]['iid']; } - + if($sql_where != '') { $sql_where = ' AND (' . $sql_where . ') '; } @@ -462,8 +463,8 @@ static function getTags($content, $config) { // when exist some results if($counters = $db->loadObjectList()) { // generating tables of news data - foreach($counters as $item) { - if(isset($counters_tab[$item->id])) { + foreach($counters as $item) { + if(isset($counters_tab[$item->id])) { $counters_tab[$item->id][$item->tag] = $item->tag_id; } else { $counters_tab[$item->id] = array($item->tag => $item->tag_id); @@ -472,32 +473,32 @@ static function getTags($content, $config) { } } // - for($i = 0; $i < count($content); $i++ ) { + for($i = 0; $i < count($content); $i++ ) { if(isset($counters_tab[$content[$i]['iid']])) { $content[$i]['tags'] = $counters_tab[$content[$i]['iid']]; } } - - - + + + return $content; } // method to get comments amount static function getComments($content, $config) { - // + // $db = JFactory::getDBO(); $counters_tab = array(); - // + // if(count($content) > 0 && $config['com_content_comments_source'] != 'none') { // initializing variables $sql_where = ''; // - for($i = 0; $i < count($content); $i++ ) { + for($i = 0; $i < count($content); $i++ ) { // linking string with content IDs $sql_where .= ($i != 0) ? ' OR content.id = '.$content[$i]['iid'] : ' content.id = '.$content[$i]['iid']; } - + if($sql_where != '') { $sql_where = ' AND (' . $sql_where . ') '; } @@ -546,18 +547,18 @@ static function getComments($content, $config) { // when exist some results if($counters = $db->loadObjectList()) { // generating tables of news data - foreach($counters as $item) { + foreach($counters as $item) { $counters_tab[$item->id] = $item->count; } } } // - for($i = 0; $i < count($content); $i++ ) { + for($i = 0; $i < count($content); $i++ ) { if(isset($counters_tab[$content[$i]['iid']])) { $content[$i]['comments'] = $counters_tab[$content[$i]['iid']]; } } - + return $content; } diff --git a/mod_news_pro_gk5/helpers/gk.format.parser.php b/mod_news_pro_gk5/helpers/gk.format.parser.php index a4d48e9..e11ee8c 100644 --- a/mod_news_pro_gk5/helpers/gk.format.parser.php +++ b/mod_news_pro_gk5/helpers/gk.format.parser.php @@ -32,6 +32,7 @@ static function generateLayout($config, $data) { {HITS} - article hits {DATE} - article date (gets format from the information block settings) {RATING} - article rating + {READMORE_TEXT} - custom article read more text K2 specific variables: @@ -89,6 +90,15 @@ static function generateLayout($config, $data) { $date = JHTML::_('date', $data['date'], $config['date_format']); $rating = $data['rating_count'] > 0 ? number_format($data['rating_sum'] / $data['rating_count'], 2) : 0; + // convert the attribs JSON to an array + $attribs = json_decode($data['attribs'], true); + // get the "alternative_readmore" parameter from the attribs array + $readmore_text = $attribs['alternative_readmore']; + if (!$readmore_text) { + // if no "alternative_readmore" is set, use the default language string: COM_CONTENT_READ_MORE_TITLE + $readmore_text = JText::_('COM_CONTENT_READ_MORE_TITLE'); + } + // // Get the layout text // @@ -123,6 +133,7 @@ static function generateLayout($config, $data) { '{HITS}', '{DATE}', '{RATING}', + '{READMORE_TEXT}', '{AVATAR_URL}' ); // values for the replacement @@ -139,6 +150,7 @@ static function generateLayout($config, $data) { $hits, $date, $rating, + $readmore_text, $avatar ); // replace values in the format file diff --git a/mod_news_pro_gk5/mod_news_pro_gk5.xml b/mod_news_pro_gk5/mod_news_pro_gk5.xml index 15ed261..6a31bde 100644 --- a/mod_news_pro_gk5/mod_news_pro_gk5.xml +++ b/mod_news_pro_gk5/mod_news_pro_gk5.xml @@ -7,15 +7,15 @@ http://www.gnu.org/copyleft/gpl.html GNU/GPL info@gavick.com www.gavick.com - 1.9.3.8 + 1.9.3.9 - span.readonly { padding: 10px; font-family: Arial; font-size:13px !important; font-weight: normal !important; text-align: justify; color: #4d4d4d; line-height: 24px; } - span.readonly h1 { clear:both; font-family: Georgia, sans-serif; font-size:38px; margin:30px 20px 23px; padding:0px 0px 24px 10px; color:#333; border-bottom: 1px solid #eee; font-weight: normal; } - span.readonly p { margin: 0 26px 10px } - span.readonly p a { color: #ef6b09 } - span.readonly p.homepage { margin-top: 30px } + span.readonly { padding: 10px; font-family: Arial; font-size:13px !important; font-weight: normal !important; text-align: justify; color: #4d4d4d; line-height: 24px; } + span.readonly h1 { clear:both; font-family: Georgia, sans-serif; font-size:38px; margin:30px 20px 23px; padding:0px 0px 24px 10px; color:#333; border-bottom: 1px solid #eee; font-weight: normal; } + span.readonly p { margin: 0 26px 10px } + span.readonly p a { color: #ef6b09 } + span.readonly p.homepage { margin-top: 30px } span.readonly p.license { border-top: 1px solid #eee; font-size: 11px; margin: 30px 26px 0; padding: 6px 0; } span.tooltip-content { display: none; } .tip-text span.readonly { display: none; } @@ -24,7 +24,7 @@

News Show Pro GK5 ver. 1.9.3.8

GK5 is new generation of our extensions dedicated to Joomla 3+.

-

Basing on experiences gathered, we created probably the best tool to present articles for Joomla! Huge amount of options and possibilities of formatting causes News Show Pro GK5 is a complex tool in making www pages content attractive. News Show Pro is appropriate while preparing simple structures with an individual article, the same as, complex arrangements including few articles and a list of links.

+

Basing on experiences gathered, we created probably the best tool to present articles for Joomla! Huge amount of options and possibilities of formatting causes News Show Pro GK5 is a complex tool in making www pages content attractive. News Show Pro is appropriate while preparing simple structures with an individual article, the same as, complex arrangements including few articles and a list of links.

Learn more at the NSP GK5 project website.

News Show Pro GK5 is released under the GNU/GPL v2 license.

@@ -38,12 +38,12 @@ url_overrides.json admin article_formats - cache - config + cache + config data_sources external_data helpers - interface + interface tmpl @@ -60,131 +60,131 @@
- + - + - + - + - + - + - + - + - + - + - - - + + +
- +
- + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - + - + @@ -211,26 +211,26 @@ - +
- - - + + + - +
- + - + @@ -240,17 +240,17 @@ - +
- +
- + - + @@ -259,8 +259,8 @@ - - + + @@ -269,7 +269,7 @@ - + @@ -277,56 +277,56 @@
- +
- - + + - +
- +
- +
- + - + - +
- +
- + - + - + - + @@ -335,92 +335,92 @@ - + - + - + - + - +
- + - + - +
- + - + - + - +
- +
- + - + - + - +
- +
- + - +
- -
+ +
- + @@ -434,8 +434,8 @@
- -
+ +
@@ -447,31 +447,31 @@
- +
- + - + - +
- +
- + - + @@ -485,23 +485,23 @@
- +
- + - + - +
- +
@@ -509,7 +509,7 @@ - + @@ -524,39 +524,39 @@
-
+
- + - +
- +
- + - + - + - + @@ -564,75 +564,75 @@
- -
+ +
- + - + - + - +
- -
+ +
- + - + - + - + - - + + - + - + - + - +
- -
+ +
- + - + - + - + - + - + - + @@ -642,10 +642,10 @@ - +
- +
@@ -653,7 +653,7 @@ - + @@ -667,20 +667,20 @@
- +
- + - + - +
- +
@@ -688,7 +688,7 @@ - + @@ -701,31 +701,31 @@ - + - + - + - + - + - + - +
- +
- + @@ -738,7 +738,7 @@ - + @@ -751,7 +751,7 @@ - + @@ -762,7 +762,7 @@ - + @@ -771,84 +771,84 @@ - + - + - + - + - + - + - + - +
- +
- + - + - + - + - + - + - + - +
- +
- + - +
- +
@@ -856,48 +856,48 @@
- -
+ +
- -
+ +
- +
- -
+ +
- + - + - + - + - + - + - +
- +
@@ -912,7 +912,7 @@
- +
@@ -926,23 +926,23 @@ - + - + - + - + - +
- + - +
@@ -954,7 +954,7 @@ - + @@ -964,11 +964,11 @@ - + - + - + @@ -1010,18 +1010,18 @@ - + - + - - + + @@ -1054,12 +1054,12 @@ - + - + @@ -1089,22 +1089,22 @@ - + - + - + - + @@ -1221,23 +1221,23 @@ - + - + -
+
-
+
- + - + - + @@ -1270,23 +1270,23 @@ - - + + - - + + - + - + @@ -1294,27 +1294,27 @@ - + - + - + - + - + - +
@@ -1322,13 +1322,13 @@ - + - - - + + + @@ -1364,43 +1364,43 @@ - +
- +
- + - - + + - + - +
- +
- +
- +
- +