Subdomain Posts
None | 11 hours ago
None | 15 hours ago
PHP | 16 hours ago
PHP | 16 hours ago
None | 16 hours ago
None | 16 hours ago
None | 16 hours ago
None | 16 hours ago
Recent Posts
Java 5 | 29 sec ago
None | 46 sec ago
None | 53 sec ago
None | 1 min ago
C++ | 1 min ago
None | 1 min ago
C++ | 2 min ago
None | 2 min ago
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Domain Reports
By an_archi on the 10th of Jan 2010 03:37:14 AM
Download |
Raw |
Embed |
Report
// sanitize a title to make it match HTML specs
// http://www.w3.org/TR/html4/types.html#h-6.2
function cleanText($texte,$label='section') {
// strips all HTML tags
$texte = supprimer_tags($texte);
// replace all non valid characters (non alpha-numeric, ., -, _ and :)
$texte = preg_replace('#([^a-z0-9:-_]|[!"#$%&'()*+,/;<=>?
@[\\\
]^`
{|}~
])#i', '_', $texte);
// strips all empty characters at the beginning of the text
// the ID or NAME should start with a letter
// If there's no more latin character, then we return nothing
if($count<1) { return false; }
return $texte;
}
function balise_VALID_ID_dist($p) {
// If no alternate label is provided, we just use 'label'
if (!$label = interprete_argument_balise(1,$p)) {$label = "'label'";}
// gets the id of the current object
$_id_objet = $p->boucles[$p->id_boucle]->primary;
$_id = champ_sql($_id_objet, $p);
// gets the title
$_titre = champ_sql('titre', $p);
// Use the clean title or an alternate version if no suitable title
$p->code = "((\$a = cleanText($_titre)) ? \$a : $label.'_'.$_id)";
return $p;
}
Submit a correction or amendment below.
[ previous version ] | [ difference ] | Make A New Post