Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 344 → Rev 345

/trunk/api/text/wiki_papyrus/Parse/Plan.php
New file
0,0 → 1,51
<?php
// $Id: Plan.php,v 1.1 2005-04-18 16:42:02 jpm Exp $
 
 
/**
*
* This class implements a Text_Wiki_Parse to find source text marked as
* an Interwiki link. See the regex for a detailed explanation of the
* text matching procedure; e.g., "InterWikiName:PageName".
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @package Text_Wiki
*
*/
class Text_Wiki_Parse_Plan extends Text_Wiki_Parse {
var $regex = '/\{\{Plan site="((?i:[,-]|\w|\s)+)"(?: permalien="(oui|non)"|)\}\}/';
/**
*
* Remplace l'action par une liste des dernières pages modifiées
* Les options sont:
*
* 'site' => le code alphanumérique du ou des sites que l'on veut afficher
*
* @access public
*
* @param array &$matches The array of matches from parse().
*
* @return A delimited token to be used as a placeholder in
* the source text, plus any text priot to the match.
*
*/
function process(&$matches)
{
if ($matches[2] == 'oui') {
$matches[2] = true;
} else {
$matches[2] = false;
}
$options = array(
'site' => $matches[1],
'permalien' => $matches[2]
);
return $this->wiki->addToken($this->rule, $options);
}
}
?>
/trunk/api/text/wiki_papyrus/Parse/Syndication.php
New file
0,0 → 1,45
<?php
// $Id: Syndication.php,v 1.1 2005-04-18 16:42:02 jpm Exp $
 
 
/**
*
* This class implements a Text_Wiki_Parse to find source text marked as
* an Interwiki link. See the regex for a detailed explanation of the
* text matching procedure; e.g., "InterWikiName:PageName".
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @package Text_Wiki
*
*/
class Text_Wiki_Parse_Syndication extends Text_Wiki_Parse {
var $regex = '/\{\{Syndication url="((?i:[,:\/.-]|\w|\s)+)"\}\}/';
/**
*
* Remplace l'action par une liste des dernières pages modifiées
* Les options sont:
*
* 'site' => le code alphanumérique du ou des sites que l'on veut afficher
*
* @access public
*
* @param array &$matches The array of matches from parse().
*
* @return A delimited token to be used as a placeholder in
* the source text, plus any text priot to the match.
*
*/
function process(&$matches)
{
$options = array(
'url' => $matches[1]
);
return $this->wiki->addToken($this->rule, $options);
}
}
?>
/trunk/api/text/wiki_papyrus/Papyrus.class.php
21,7 → 21,7
// | along with Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: Papyrus.class.php,v 1.5 2005-04-14 16:35:42 jpm Exp $
// CVS : $Id: Papyrus.class.php,v 1.6 2005-04-18 16:41:53 jpm Exp $
/**
* Classe configurant le formatage pour Papyrus.
*
36,7 → 36,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.5 $ $Date: 2005-04-14 16:35:42 $
*@version $Revision: 1.6 $ $Date: 2005-04-18 16:41:53 $
// +------------------------------------------------------------------------------------------------------+
*/
 
75,7 → 75,9
'Inclure', // Action Inclure
'Motcles', // Action Motcles
'Categorie', // Action Categorie
'Nouveaute' // Action Nouveaute
'Nouveaute', // Action Nouveaute
'Plan', // Action Plan
'Syndication', // Action Syndication
);
/**
281,6 → 283,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.5 2005/04/14 16:35:42 jpm
* Ajout de nouvelles actions pour Papyrus XHTML.
*
* Revision 1.4 2005/01/20 19:39:39 jpm
* Correction bogue du à la fonction file_exists qui renvoie false pour les fichiers présent dans le dossier Pear /usr/local/lib/php/.
*
/trunk/api/text/wiki_papyrus/Render/Xhtml/Plan.php
New file
0,0 → 1,77
<?php
 
class Text_Wiki_Render_Xhtml_Plan extends Text_Wiki_Render {
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
// Initialisation des variables
$sortie = '';
$sites = $options['site'];
// Récupération de l'affichage ou pas des raccourcis
if (isset($options['permalien'])) {
$permalien = $options['permalien'];
}
$tab_site = array_map('trim', explode(',', $sites));
$sortie .= '<ul class="plan_site_'.$site.'" >'."\n";
foreach ($tab_site as $cle => $site) {
$aso_menus = GEN_retournerTableauMenusSiteCodeAlpha($GLOBALS['_GEN_commun']['pear_db'], $site);
$sortie .= $this->parserTableauMenus($aso_menus, $permalien);
}
$sortie .= '</ul>'."\n";
return $sortie;
}
function parserTableauMenus($aso_menus, $permalien)
{
$sortie = '';
// Création de l'url
foreach ($aso_menus as $menu_id => $menu_valeur) {
$sortie .= '<li>';
// Création de l'url
$une_url =& new Pap_URL();
$une_url->setId($menu_id);
// Construction de l'attribut title
$title = '';
if (!empty($menu_valeur['gm_titre'])) {
$title = ' title="'.$menu_valeur['gm_titre'].'"';
} elseif (!empty($menu_valeur['gm_titre_alternatif'])) {
$title = ' title="'.$menu_valeur['gm_titre_alternatif'].'"';
}
// Construction du lien
$sortie .= '<a href="'.$une_url->getURL().'"'.$title.'>'.$menu_valeur['gm_nom'].'</a>';
// Nous affichons ou pas le permalien
if ($permalien) {
$une_url->setPermalien(true);
$sortie .= ' <span class="plan_permalien">'.'('.$une_url->getURL().')'.'</span>';
$une_url->setPermalien(false);
}
// Nous ajoutons les sous-menus s'il y en a.
$retour = $this->parserTableauMenus($menu_valeur['sous_menus'], $permalien);
if ($retour != '') {
$sortie .= "\n".'<ul>'."\n".$retour."\n".'</ul>'."\n";
}
$sortie .= '</li>'."\n";
}
return $sortie;
}
}
?>
/trunk/api/text/wiki_papyrus/Render/Xhtml/Syndication.php
New file
0,0 → 1,44
<?php
require_once PAP_CHEMIN_API_PEAR.'XML/RSS.php';
 
class Text_Wiki_Render_Xhtml_Syndication extends Text_Wiki_Render {
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
// Initialisation des variables
$sortie = '';
$urls = $options['url'];
$tab_url = array_map('trim', explode(',', $urls));
if (ini_get('allow_url_fopen') != 0) {
ini_set('allow_url_fopen', 1);
}
if (ini_get('allow_url_fopen') != 0) {
foreach ($tab_url as $cle => $url) {
$rss =& new XML_RSS($url);
$rss->parse();
$aso_info_rss = $rss->getChannelInfo();
$sortie .= '<h2>'.$aso_info_rss['title'].'</h2>';
$sortie .= '<ul class="plan_site_'.$site.'" >'."\n";
foreach ($rss->getItems() as $item) {
$sortie .= '<li><a href="'.$item['link'].'">'.$item['title'].'</a></li>'."\n";
}
$sortie .= '</ul>'."\n";
}
}
return $sortie;
}
}
?>