mirror of
https://github.com/e107inc/e107.git
synced 2025-08-19 04:41:53 +02:00
- Custom Pages: new fields for SEF string and meta data, admin validation and data control, front-end SEO (meta data), additional 'safe' URL config (for migrated installs); some new useful helper methods;
- More typography and layout control: new class based paragraph, heading, nobr, br and block bbcodes (awaiting new icons) - Overall improvements and stability fixes
This commit is contained in:
71
e107_core/bbcodes/bb_p.php
Normal file
71
e107_core/bbcodes/bb_p.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id$
|
||||
*
|
||||
* Paragraph bbcode
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
/**
|
||||
* Basic usage [p=CSS-className]text[/p]
|
||||
* Advanced usage [p=class=className&id=element-id&style=some: style; and: moresStyle]text[/p]
|
||||
* 'class' defaults to 'bbcode' (if left empty)
|
||||
*/
|
||||
class bb_p extends e_bb_base
|
||||
{
|
||||
/**
|
||||
* Called prior to save
|
||||
* Sanitize and re-assemble the bbcode
|
||||
*/
|
||||
function toDB($code_text, $parm)
|
||||
{
|
||||
$code_text = trim($code_text);
|
||||
if(empty($code_text)) return '';
|
||||
|
||||
if($parm && !strpos($parm, '=')) $parm = 'class='.$parm;
|
||||
|
||||
$parms = eHelper::scParams($parm);
|
||||
$safe = array();
|
||||
|
||||
if(vartrue($parms['class']))
|
||||
{
|
||||
$safe['class'] = eHelper::secureClassAttr($parms['class']);
|
||||
}
|
||||
if(vartrue($parms['id']))
|
||||
{
|
||||
$safe['id'] = eHelper::secureIdAttr($parms['id']);
|
||||
}
|
||||
if(vartrue($parms['style']))
|
||||
{
|
||||
$safe['style'] = eHelper::secureStyleAttr($parms['style']);
|
||||
}
|
||||
if($safe)
|
||||
{
|
||||
return '[p='.eHelper::buildAttr($safe).']'.$code_text.'[/p]';
|
||||
}
|
||||
return '[p]'.$code_text.'[/p]';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Translate to <p> tag
|
||||
*/
|
||||
function toHTML($code_text, $parm)
|
||||
{
|
||||
if($parm && !strpos($parm, '=')) $parm = 'class='.$parm;
|
||||
$code_text = trim($code_text);
|
||||
|
||||
$parms = eHelper::scParams($parm);
|
||||
|
||||
$class = varsettrue($parms['class']) ? ' class="'.eHelper::secureClassAttr($parms['class']).'"' : '';
|
||||
if(!$class) $class = ' class="bbcode"';
|
||||
|
||||
$id = varsettrue($parms['id']) ? ' id="'.eHelper::secureIdAttr($parms['id']).'"' : '';
|
||||
$style = varsettrue($parms['style']) ? ' style="'.eHelper::secureStyleAttr($parms['style']).'"' : '';
|
||||
|
||||
return "<p{$id}{$class}{$style}>".$code_text.'</p>';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user