PHP Classes

How to Display the Latest PHP Classes on Any Site Managed by the Ascoos CMS using the Block Component PHP Classes Latest: Display the latest package from PHPClasses

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-10-14 (26 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 20 All time: 11,306 This week: 48Up
Version License PHP version Categories
phpclasses_latest 1.0.1Custom (specified...5.6PHP 5, Content management, Web services, B...
Description 

Author

This package can display the latest package from PHPClasses.

It provides a block component for the Ascoos CMS that can pull the list of the latest packages published on the PHP Classes site.

The block component can display the list of packages on a site page managed by the Ascoos CMS.

Through the cms management window, we can configure the block.

- Define the number of classes to display.

- Set a general access using the global username "bigfriend", or use the username that we declare for our login to phpclasses.org.

- Specify whether to display a column with the days that have passed since the class was posted.

- Finally, we will define the theme of the appearance of our block.

Innovation Award
PHP Programming Innovation award nominee
October 2024
Nominee
Vote
The PHP Classes site releases packages of many PHP developers contributed to the site regularly.

Developers who spread the packages published on the site can be credited for being great friends of the site.

The package makes it easy to spread the latest packages in the PHP Classes site on site that use the Ascoos CMS content management system.

Manuel Lemos
Picture of ASCOOS CMS
  Performance   Level  
Name: ASCOOS CMS <contact>
Classes: 18 packages by
Country: Greece Greece
Age: ???
All time rank: 393923 in Greece Greece
Week rank: 4 Up1 in Greece Greece Up
Innovation award
Innovation award
Nominee: 13x

Instructions

You can see a tutorial here.

Example

<?php
/**
 * __ _ ___ ___ ___ ___ ___ ____ _ __ ___ ___
 * / _` |/ / / __/ _ \ / _ \ / / / __/| '_ ` _ \ / /
 * | (_| |\ \| (_| (_) | (_) |\ \ | (__ | | | | | |\ \
 * \__,_|/__/ \___\___/ \___/ /__/ \___\|_| |_| |_|/__/
 *
 *
 ************************************************************************************
 * @ASCOOS-NAME : ASCOOS CMS 24' *
 * @ASCOOS-VERSION : 24.0.0 *
 * @ASCOOS-CATEGORY : Block (Frontend and Administrator Side) *
 * @ASCOOS-CREATOR : Drogidis Christos *
 * @ASCOOS-SITE : www.ascoos.com *
 * @ASCOOS-LICENSE : [Commercial] http://docs.ascoos.com/lics/ascoos/AGL.html *
 * @ASCOOS-COPYRIGHT : Copyright (c) 2007 - 2024, AlexSoft Software. *
 ************************************************************************************
 *
 * @package : Block Manager - Latest classes from PHPClasses.org
 * @subpackage : Main Frontend file
 * @source : /[BLOCKS PATH]/phpclasses_latest/index.php
 * @fileNo :
 * @version : 1.0.1
 * @created : 2024-10-10 07:00:00 UTC+3
 * @updated : 2024-10-14 07:00:00 UTC+3
 * @author : Drogidis Christos
 * @authorSite : www.alexsoft.gr
 * @license : AGL-F
 *
 * @since PHP 8.2.0
 */

defined ("ALEXSOFT_RUN_CMS") or die("Prohibition of Access.");

include_once (
__DIR__ . '/libs.php');


// Get Value Block Parameters
$method = $block->getParam('str', 'method', 'xml' ); // What feed method is used (XML or RSS)?
$count = $block->getParam('int', 'count', 10 ); // How many classes will be displayed.
$user = $block->getParam('str', 'username', 'bigfriend' ); // PHPClasses User
$show_summary = $block->getParam('bool', 'show_summary', false ); // Show Summary Description
$show_days = $block->getParam('bool', 'show_days', false ); // Show Days
$theme = $block->getParam('lstr', 'theme', 'default' ); // The Block theme

// load Block Theme
$block->loadTheme($theme);

$feeds = simplexml_load_file('https://'.$user.'.users.phpclasses.org/browse/latest/latest.'.$method);

$items= [];

switch (
$method) {
    case
'rss':
       
$ci = 0;

        foreach (
$feeds->channel->item as $feed) {
            if (
$ci >= $count) break;
           
$parts = explode("#", $feed->link);
           
$items[$ci]['link'] = $parts[0];
           
$items[$ci]['title'] = (string) $feed->title;
            if (
$show_summary) $items[$ci]['summary'] = getSummary($feed->description);
            if (
$show_days) $items[$ci]['days'] = diff_days($feed->pubDate);
           
           
$ci++;
            unset(
$parts);
        }
        unset(
$feeds);
        break;
       
    default:
       
$ci = 0;

        foreach (
$feeds->item as $feed) {
            if (
$ci >= $count) break;
           
$parts = explode("#", $feed->link);
           
$items[$ci]['link'] = $parts[0];
           
$items[$ci]['title'] = (string) $feed->title;
            if (
$show_summary) $items[$ci]['summary'] = getSummary($feed->description);
           
           
$ci++;
            unset(
$parts);
        }
        unset(
$feeds);
        break;
}


$text = '';
$text .= '<div class="block-phpclasses-latest-'.$theme.'">';
if (
$block->getVar('show_title')) {
   
$text .= '<div class="header"><h3>'.$block->getTitle().'</h3></div><div class="clear"></div>';
}
$text .= '<div class="text"><div class="table">';


foreach (
$items as $key => $feed)
{
   
$text .= '<div class="row">';
       
$text .= '<div class="cell"><a target="_blank" href="'.$feed['link'].'">'.$feed['title'].'</a>';
            if (
$show_summary) $text .= '<br>'.$feed['summary'];
       
$text .= '</div>';
   
       
// Only for RSS Feed
       
if ($show_days && $method !== 'xml') $text .= "<div class=\"cell right\">".$feed['days']."</div>";
   
   
$text .= '</div>'; // row
}
unset(
$items);

$text .= '</div></div>'; // table/text
$text .= '<div class="more"><a target="_blank" href="https://'.$user.'.users.phpclasses.org/browse/latest/latest.html"><strong>...'.$objLang->more.'</strong></a></div>';
$text .= '</div>'; // block
echo $text;
unset(
$text);

?>


Details

[1.0.1] - 2024-10-14

  • Added support for both two feed methods (XML or RSS)
  • Added support for description summary
  • Added support for show days that have passed since the package was published. ONLY RSS Feed.

[1.0.0] - 2024-10-10

  • Initial release

Screenshots (3)  
  • screenshot.png
  • screenshot2.png
  • screenshot3.png
  Files folder image Files (25)  
File Role Description
Files folder imagelanguages (7 files)
Files folder imagethemes (1 file, 2 directories)
Accessible without login Plain text file CHANGELOG.md Doc. Documentation
Accessible without login HTML file index.html Doc. Documentation
Accessible without login Plain text file index.php Example Frontend main script
Accessible without login Plain text file install.php Conf. Installation script
Plain text file libs.php Class Block library Functions script
Accessible without login Plain text file LICENSE_AGL-F.md Lic. License text
Accessible without login Plain text file params.json Data Parameters structure
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (25)  /  languages  
File Role Description
  Plain text file el-CY.php Class Class source
  Plain text file el-GR.php Class Class source
  Plain text file el.php Class Class source
  Plain text file en-GB.php Class Class source
  Plain text file en-US.php Class Class source
  Plain text file en.php Class Class source
  Accessible without login HTML file index.html Doc. Documentation

  Files folder image Files (25)  /  themes  
File Role Description
Files folder imagecleargray (3 files)
Files folder imagedefault (3 files)
  Accessible without login HTML file index.html Doc. Documentation

  Files folder image Files (25)  /  themes  /  cleargray  
File Role Description
  Accessible without login HTML file index.html Doc. Documentation
  Accessible without login Image file screenshot.png Icon Icon image
  Accessible without login Plain text file theme.css Data Auxiliary data

  Files folder image Files (25)  /  themes  /  default  
File Role Description
  Accessible without login HTML file index.html Doc. Documentation
  Accessible without login Image file screenshot.png Icon Icon image
  Accessible without login Plain text file theme.css Data Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
Downloadphpclasses_latest-2024-10-14.zip 279KB
Downloadphpclasses_latest-2024-10-14.tar.gz
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
PHP Backwards Compatibility Library Download .zip .tar.gz Included in Ascoos Cms Core Recommended
 Version Control Unique User Downloads Download Rankings  
 96%
Total:20
This week:0
All time:11,306
This week:48Up