mirror of
https://github.com/e107inc/e107.git
synced 2025-08-13 10:04:35 +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:
62
e107_core/bbcodes/bb_block.php
Normal file
62
e107_core/bbcodes/bb_block.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id$
|
||||
*
|
||||
* DIV block bbcode
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
/**
|
||||
* Div HTML blocks handling
|
||||
*
|
||||
* [block=class=xxx&style=xxx&id=xxx]$content[/block]
|
||||
* [block=xxx]$content[/block] equals to [block=class=xxx]$content[/block]
|
||||
* If $content is missing, HTML comment will be used - '<!-- -->'
|
||||
*/
|
||||
class bb_block extends e_bb_base
|
||||
{
|
||||
/**
|
||||
* Called prior to save
|
||||
*
|
||||
*/
|
||||
function toDB($code_text, $parm)
|
||||
{
|
||||
// just for now
|
||||
if(!ADMIN) return $code_text; // TODO - pref
|
||||
|
||||
// transform to class, equal sign at 0 position is not well formed parm string
|
||||
if($parm && !strpos($parm, '=')) $parm = 'class='.$parm;
|
||||
$parms = eHelper::scParams($parm);
|
||||
$safe = array();
|
||||
|
||||
if(varsettrue($parms['class'])) $safe['class'] = eHelper::secureClassAttr($parms['class']);
|
||||
if(varsettrue($parms['id'])) $safe['id'] = eHelper::secureIdAttr($parms['id']);
|
||||
if(varsettrue($parms['style'])) $safe['style'] = eHelper::secureStyleAttr($parms['style']);
|
||||
if($safe)
|
||||
{
|
||||
return '[block='.eHelper::buildAttr($safe).']'.$code_text.'[/block]';
|
||||
}
|
||||
return '[block]'.$code_text.'[/block]';
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate youtube bbcode into the appropriate HTML
|
||||
*/
|
||||
function toHTML($code_text, $parm)
|
||||
{
|
||||
// transform to class, equal sign at 0 position is not well formed parm string
|
||||
if($parm && !strpos($parm, '=')) $parm = 'class='.$parm;
|
||||
$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']).'"' : '';
|
||||
|
||||
if(empty($code_text)) $code_text = '<!-- -->';
|
||||
return '<div'.$id.$class.$style.'>'.$code_text.'</div>';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user