Source for file Tagger.php
Documentation is available at Tagger.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | MCMS: a PHP Content Management System for creating accessible sites. |
// | Copyright (C) 2005 Silvio Moioli |
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
// +----------------------------------------------------------------------+
// | Authors: Silvio Moioli <silvio at moioli dot net> www.moioli.net |
// +----------------------------------------------------------------------+
* Raccolta di funzioni per l'input semplificato di codice XML.
* @author Silvio Moioli <silvio at moioli dot net>
function tag($tag, $string = "", $attributes = array()){
if (empty($attributes) == false){
foreach ($attributes as $key => $value){
$attributesString.= $key. "=\"". $value. "\" ";
$result = "<". $tag. $attributesString. " />";
$result = "<". $tag. $attributesString. ">". $string. "</". $tag. ">";
return tag("strong",$string,array());
return tag("p",$string,array());
function h1($string, $id = ''){
return tag("h1",$string,$attributes);
function h2($string, $id = ''){
return tag("h2",$string,$attributes);
function h3($string, $id = ''){
return tag("h3",$string,$attributes);
return tag("ul",$string,array());
return tag("ol",$string,array());
return tag("li",$string,array());
foreach ($elements as $i){
return ul($elementsString);
function a($where,$anchor){
return tag("a",$anchor,array("href" => $where));
function form($action, $method, $string){
$attribs["action"]= $action;
$attribs["method"]= $method;
return tag("form", $string, $attribs);
function input($type, $name, $value= ""){
$attribs["value"]= $value;
return tag("input","",$attribs);
function submit($label = "Invia"){
return tag("input","",array("type" => "submit", "value" => $label));
$attribs["type"]= "checkbox";
$attribs["checked"]= "checked";
return tag("input","",$attribs);
function option($value, $selected, $string){
$attribs["value"]= $value;
$attribs["selected"]= "selected";
return tag("option", $string, $attribs);
function select($name, $string){
return tag("select", $string, $attribs);
* Aggiunge ai contenuti della pagina un componente per l'editing dell'HTML.
* Puņ essere FCKEditor o, se richiesto, una semplice input HTML.
* @param $contentsValue string i contenuti della pagina
if ($javascript == true){
$oFCKeditor = new FCKeditor('contents') ;
$oFCKeditor->BasePath = "/admin/include/fckeditor/";
if ($oFCKeditor->IsCompatible()== false){
$result .= b("Il tuo browser non è supportato da FCKEditor.");
$oFCKeditor->Value = $contentsValue;
$oFCKeditor->Height = '500' ;
$result .= $oFCKeditor->CreateHtml() ;
$result .= '<p><a href="'. $_SERVER['PHP_SELF']. '?javascript=off&';
//Ricopia le variabili GET se presenti
foreach ($_GET as $key => $value) {
if ($key != "javascript"){
$result .= "$key=$value&";
$result .= '">Versione senza javascript</a></p>';
//Piccolo hack per l'input dell'HTML direttamente
$result .= '<p><textarea cols="80" rows="100"
ENT_QUOTES). '</textarea></p>';
$result .= '<p><a href="'. $_SERVER['PHP_SELF']. '?javascript=on&';
//Ricopia le variabili GET se presenti
foreach ($_GET as $key => $value) {
if ($key != "javascript"){
$result .= "$key=$value&";
$result .= '">Versione con javascript</a></p>';
* Ritorna una stringa XHTML con la "firma"
* dell'autore. Se non è specificato l'autore,
* si tenterà di recuperarlo dall'autore corrente.
* @param $author Author l'autore di cui si cerca la firma
$name = $author->getName();
$nick = $author->getNick();
$surname = $author->getSurname();
$email = $author->getEmail();
if ($name != null && $name != ""){
if ($surname != null && $surname != ""){
if ($email != null && $email != ""){
if ($nick != null && $nick != ""){
$result .= "<em>"". $nick. ""</em>, ";
|