header-xh-01 header-xh-02 header-xh-03 header-xh-04 header-xh-05 header-xh-06 header-xh-07 header-xh-08 header-xh-09 header-xh-10 header-xh-11 header-xh-12 header-xh-13 header-xh-14
Lembach's nichtkommerzielle Website rund um CMSimple_XH
Templates, Plugins, Tools, Programme
und Tips und Tricks die mir wichtig sind
Sie sind hier: Startseite > Plugins > SimplePlugins_XH Edition KRL > Function racently_changed_pure

Function racently_changed_pure

Useage : {{­{recently_changed_pure([$count])}}}
Example : {­{{recently_changed_pure(5)}}}

Die Funktion gibt eine Link-Liste (sortiert nach Datum) der n zuletzt geänderten Seiten im Aussehen einer 'unordered list' aus. Dabei ist n der der Funktion übergebene Parameter und legt die Anzahl der aufgelisteten Seiten fest. Der Default-Wert für n ist 5.

{{­{recently_changed_pure(5)}}} ⇒

 

Dateiname: ./plugins/simpleplugins_xh/simpleplugins_library/recently_changed_pure/index.php

<?php
/*****************************************************
* Plugin name : recently_changed_pure
* File name : index.php
* Summery : facilitates to display a list of pages that have most recently been changed.
* Only the page headings are listed as links to the respective page.
* Author : Christoph M. Becker / T.Uchiyama / Karl Richard Lembach
* License : GPLv3
*****************************************************
* Useage : {{{recently_changed_pure([$count]);}}}
* Example : {{{recently_changed_pure();}}}
******************************************************/
/*
* Prevent direct access.
*/
if (!defined('CMSIMPLE_XH_VERSION')) {
header('HTTP/1.0 403 Forbidden');
exit;
}

if (!function_exists('recently_changed_pure')) {

/**
* @copyright 2016 Christoph M. Becker
* minimal modifikations 2021 : Karl Richard Lembach https://lembach-cmsimple.de
* @license GPLv3
* @URL http://cmsimpleforum.com/viewtopic.php?f=12&t=10543
*/
function recently_changed_pure($count = 5)
{
global $pd_router;

$pageData = $pd_router->find_all();

$phpver = phpversion();
if( version_compare( $phpver, "5.3.0", ">=")) {
uasort($pageData, function ($a, $b) { // anonymous function >= PHP5.3
return $b['last_edit'] - $a['last_edit'];
});
}else{
uasort($pageData, recently_changed_func_pure($a, $b) );
}

$pages = array();
$i = 0;
foreach (array_keys($pageData) as $page) {
if ($i < $count) {
if (!hide($page)) {
$pages[] = $page;
$i++;
}
} else {
break;
}
}

global $sn, $h, $u;

$html = '<ul class="recently_changed_pure">';
foreach ($pages as $page) {
$html .= '<li><a href="' . "$sn?$u[$page]" . '">' . $h[$page] . '</a></li>';
}
$html .= '</ul>';
return $html;
}


function recently_changed_func_pure($a, $b) {
return $b['last_edit'] - $a['last_edit'];
}

}
?>

| Seitenanfang | |  - - - By CrazyStat - - -