Enhanced [video] element accepts video URLs from YouTube, Vimeo and Facebook. Originally suggested by vodka on the support forum: https://forum.flatpress.org/viewtopic.php?f=2&t=15#p50 - thx!
TO BE DONE: Does not support uploaded videos (like "attachs/video.mp4") yet. Also: Source code formatting.
This commit is contained in:
parent
2bc7aef693
commit
e949c087d5
@ -1,13 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
Plugin Name: BBCode
|
* Plugin Name: BBCode
|
||||||
Version: 1.5
|
* Version: 1.5
|
||||||
Plugin URI: http://flatpress.sf.net
|
* Plugin URI: http://flatpress.sf.net
|
||||||
Description: Allows using <a href="http://www.phpbb.com/phpBB/faq.php?mode=bbcode">BBCode</a> markup; provides automatic integration with lightbox.
|
* Description: Allows using <a href="http://www.phpbb.com/phpBB/faq.php?mode=bbcode">BBCode</a> markup; provides automatic integration with lightbox.
|
||||||
Author: Hydra, NoWhereMan
|
* Author: Hydra, NoWhereMan
|
||||||
Author URI: http://flatpress.sf.net
|
* Author URI: http://flatpress.sf.net
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require (plugin_getdir('bbcode') . '/inc/stringparser_bbcode.class.php');
|
require (plugin_getdir('bbcode') . '/inc/stringparser_bbcode.class.php');
|
||||||
require (plugin_getdir('bbcode') . '/panels/admin.plugin.panel.bbcode.php');
|
require (plugin_getdir('bbcode') . '/panels/admin.plugin.panel.bbcode.php');
|
||||||
|
|
||||||
@ -19,22 +18,10 @@ function plugin_bbcode_startup() {
|
|||||||
// load options
|
// load options
|
||||||
$bbconf = plugin_getoptions('bbcode');
|
$bbconf = plugin_getoptions('bbcode');
|
||||||
// get defaults if not configured
|
// get defaults if not configured
|
||||||
define('BBCODE_ALLOW_HTML', isset($bbconf['escape-html'])
|
define('BBCODE_ALLOW_HTML', isset($bbconf ['escape-html']) ? $bbconf ['escape-html'] : true);
|
||||||
? $bbconf['escape-html']
|
define('BBCODE_ENABLE_COMMENTS', isset($bbconf ['comments']) ? $bbconf ['comments'] : false);
|
||||||
: true
|
define('BBCODE_USE_EDITOR', isset($bbconf ['editor']) ? $bbconf ['editor'] : true);
|
||||||
);
|
define('BBCODE_URL_MAXLEN', isset($bbconf ['url-maxlen']) ? $bbconf ['url-maxlen'] : 40);
|
||||||
define('BBCODE_ENABLE_COMMENTS', isset($bbconf['comments'])
|
|
||||||
? $bbconf['comments']
|
|
||||||
: false
|
|
||||||
);
|
|
||||||
define('BBCODE_USE_EDITOR', isset($bbconf['editor'])
|
|
||||||
? $bbconf['editor']
|
|
||||||
: true
|
|
||||||
);
|
|
||||||
define('BBCODE_URL_MAXLEN', isset($bbconf['url-maxlen'])
|
|
||||||
? $bbconf['url-maxlen']
|
|
||||||
: 40
|
|
||||||
);
|
|
||||||
if (!file_exists('getfile.php')) {
|
if (!file_exists('getfile.php')) {
|
||||||
define('BBCODE_USE_WRAPPER', false);
|
define('BBCODE_USE_WRAPPER', false);
|
||||||
} else {
|
} else {
|
||||||
@ -47,7 +34,7 @@ function plugin_bbcode_startup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// filter part
|
// filter part
|
||||||
#add_filter('comment_text', 'plugin_bbcode_comment');
|
// add_filter('comment_text', 'plugin_bbcode_comment');
|
||||||
add_filter('title_save_pre', 'wp_specialchars', 1);
|
add_filter('title_save_pre', 'wp_specialchars', 1);
|
||||||
if (!BBCODE_ALLOW_HTML) {
|
if (!BBCODE_ALLOW_HTML) {
|
||||||
add_filter('content_save_pre', 'wp_specialchars', 1);
|
add_filter('content_save_pre', 'wp_specialchars', 1);
|
||||||
@ -68,7 +55,6 @@ plugin_bbcode_startup();
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds special stlye definitions into the HTML head.
|
* Adds special stlye definitions into the HTML head.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function plugin_bbcode_style() {
|
function plugin_bbcode_style() {
|
||||||
echo " <!-- bbcode plugin -->\n";
|
echo " <!-- bbcode plugin -->\n";
|
||||||
@ -87,31 +73,26 @@ function bbcode_remap_url(&$d) {
|
|||||||
// NWM: "attachs/" is interpreted as a keyword, and it is translated to the actual path of ATTACHS_DIR
|
// NWM: "attachs/" is interpreted as a keyword, and it is translated to the actual path of ATTACHS_DIR
|
||||||
// CHANGE! we use the getfile.php script to mask the actual path of the attachs dir!
|
// CHANGE! we use the getfile.php script to mask the actual path of the attachs dir!
|
||||||
// DMKE: I got an idea about an integer-id based download/media manager... work-in-progress
|
// DMKE: I got an idea about an integer-id based download/media manager... work-in-progress
|
||||||
|
|
||||||
if (strpos($d, ':') === false) {
|
if (strpos($d, ':') === false) {
|
||||||
// if is relative url
|
// if is relative url
|
||||||
// absolute path, relative to this server
|
// absolute path, relative to this server
|
||||||
if ($d [0] == '/') {
|
if ($d [0] == '/') {
|
||||||
/*
|
/*
|
||||||
BLOG_BASEURL contains a trailing slash in the end. If
|
* BLOG_BASEURL contains a trailing slash in the end. If
|
||||||
$d begins with a slash, we first strip it otherwise
|
* $d begins with a slash, we first strip it otherwise
|
||||||
the string would look like
|
* the string would look like
|
||||||
http://mysite.com/flatpress//path/you/entered
|
* http://mysite.com/flatpress//path/you/entered
|
||||||
^^ ugly double slash :P
|
* ^^ ugly double slash :P
|
||||||
*/
|
*/
|
||||||
$d = BLOG_BASEURL . substr($d, 1);
|
$d = BLOG_BASEURL . substr($d, 1);
|
||||||
}
|
}
|
||||||
if (substr($d, 0, 8) == 'attachs/') {
|
if (substr($d, 0, 8) == 'attachs/') {
|
||||||
$d = BBCODE_USE_WRAPPER
|
$d = BBCODE_USE_WRAPPER ? 'getfile.php?f=' . basename($d) . '&dl=true' : substr_replace($d, ATTACHS_DIR, 0, 8);
|
||||||
? 'getfile.php?f='. basename($d) .'&dl=true'
|
|
||||||
: substr_replace ($d, ATTACHS_DIR, 0, 8 );
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (substr($d, 0, 7) == 'images/') {
|
if (substr($d, 0, 7) == 'images/') {
|
||||||
$d = substr_replace($d, IMAGES_DIR, 0, 7);
|
$d = substr_replace($d, IMAGES_DIR, 0, 7);
|
||||||
$d = BBCODE_USE_WRAPPER
|
$d = BBCODE_USE_WRAPPER ? 'getfile.php?f=' . basename($d) : $d;
|
||||||
? 'getfile.php?f='. basename($d)
|
|
||||||
: $d;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -127,8 +108,10 @@ function bbcode_remap_url(&$d) {
|
|||||||
* @param string $action
|
* @param string $action
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param mixed $params Not used
|
* @param mixed $params
|
||||||
* @param mixed $node_object Not used
|
* Not used
|
||||||
|
* @param mixed $node_object
|
||||||
|
* Not used
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function do_bbcode_url($action, $attributes, $content, $params, $node_object) {
|
function do_bbcode_url($action, $attributes, $content, $params, $node_object) {
|
||||||
@ -148,17 +131,11 @@ function do_bbcode_url ($action, $attributes, $content, $params, $node_object) {
|
|||||||
$url = $attributes ['default'];
|
$url = $attributes ['default'];
|
||||||
}
|
}
|
||||||
$local = bbcode_remap_url($url);
|
$local = bbcode_remap_url($url);
|
||||||
$the_url = $local
|
$the_url = $local ? (BLOG_BASEURL . $url) : $url;
|
||||||
? (BLOG_BASEURL . $url)
|
|
||||||
: $url;
|
|
||||||
// DMKE: uh?
|
// DMKE: uh?
|
||||||
$content = $content;
|
$content = $content;
|
||||||
$rel = isset($attributes['rel'])
|
$rel = isset($attributes ['rel']) ? ' rel="' . $attributes ['rel'] . '"' : '';
|
||||||
? ' rel="' . $attributes['rel'] . '"'
|
$extern = !$local ? ' class="externlink" title="Go to ' . $the_url . '"' : '';
|
||||||
: '';
|
|
||||||
$extern = !$local
|
|
||||||
? ' class="externlink" title="Go to '.$the_url.'"'
|
|
||||||
: '';
|
|
||||||
return '<a' . $extern . ' href="' . $the_url . '"' . $rel . '>' . $content . '</a>';
|
return '<a' . $extern . ' href="' . $the_url . '"' . $rel . '>' . $content . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,8 +145,10 @@ function do_bbcode_url ($action, $attributes, $content, $params, $node_object) {
|
|||||||
* @param string $action
|
* @param string $action
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param mixed $params Not used
|
* @param mixed $params
|
||||||
* @param mixed $node_object Not used
|
* Not used
|
||||||
|
* @param mixed $node_object
|
||||||
|
* Not used
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function do_bbcode_img($action, $attributes, $content, $params, $node_object) {
|
function do_bbcode_img($action, $attributes, $content, $params, $node_object) {
|
||||||
@ -199,8 +178,6 @@ function do_bbcode_img($action, $attributes, $content, $params, $node_object) {
|
|||||||
$useimageinfo = false;
|
$useimageinfo = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$img_size = array();
|
$img_size = array();
|
||||||
// let's disable socket functions for remote files
|
// let's disable socket functions for remote files
|
||||||
// slow remote servers may otherwise lockup the system
|
// slow remote servers may otherwise lockup the system
|
||||||
@ -218,23 +195,18 @@ function do_bbcode_img($action, $attributes, $content, $params, $node_object) {
|
|||||||
$title = @$iptc ["2#005"] [0] ? wp_specialchars($iptc ["2#005"] [0]) : $title;
|
$title = @$iptc ["2#005"] [0] ? wp_specialchars($iptc ["2#005"] [0]) : $title;
|
||||||
$alt = isset($iptc ["2#120"] [0]) ? wp_specialchars($iptc ["2#120"] [0], 1) : $title;
|
$alt = isset($iptc ["2#120"] [0]) ? wp_specialchars($iptc ["2#120"] [0], 1) : $title;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$orig_w = $width = isset($img_size[0])
|
$orig_w = $width = isset($img_size [0]) ? $img_size [0] : 0;
|
||||||
? $img_size[0]
|
$orig_h = $height = isset($img_size [1]) ? $img_size [1] : 0;
|
||||||
: 0;
|
|
||||||
$orig_h = $height = isset($img_size[1])
|
|
||||||
? $img_size[1]
|
|
||||||
: 0;
|
|
||||||
$thumbpath = null;
|
$thumbpath = null;
|
||||||
// default: resize to 0, which means leaving it as it is, as width and hight will be ignored ;)
|
// default: resize to 0, which means leaving it as it is, as width and hight will be ignored ;)
|
||||||
$scalefact = 0;
|
$scalefact = 0;
|
||||||
/*
|
/*
|
||||||
scale attribute has priority over width and height if scale is
|
* scale attribute has priority over width and height if scale is
|
||||||
set popup is set to true automatically, unless it is explicitly
|
* set popup is set to true automatically, unless it is explicitly
|
||||||
set to false
|
* set to false
|
||||||
*/
|
*/
|
||||||
if (isset($attributes ['scale'])) {
|
if (isset($attributes ['scale'])) {
|
||||||
if (substr($attributes ['scale'], -1, 1) == '%') {
|
if (substr($attributes ['scale'], -1, 1) == '%') {
|
||||||
@ -265,58 +237,32 @@ function do_bbcode_img($action, $attributes, $content, $params, $node_object) {
|
|||||||
$attributes ['popup'] = true;
|
$attributes ['popup'] = true;
|
||||||
}
|
}
|
||||||
if ($height != $orig_h) {
|
if ($height != $orig_h) {
|
||||||
#bbcode_img_scale_filter($actualpath, $img_props, $newsize)
|
// bbcode_img_scale_filter($actualpath, $img_props, $newsize)
|
||||||
$thumbpath = apply_filters(
|
$thumbpath = apply_filters('bbcode_img_scale', $actualpath, $img_size, array(
|
||||||
'bbcode_img_scale',
|
$width,
|
||||||
$actualpath,
|
$height
|
||||||
$img_size,
|
));
|
||||||
array($width, $height)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (isset($attributes ['popup']) && ($attributes ['popup'])) {
|
if (isset($attributes ['popup']) && ($attributes ['popup'])) {
|
||||||
$pop_width = $orig_w
|
$pop_width = $orig_w ? $orig_w : 800;
|
||||||
? $orig_w
|
$pop_height = $orig_h ? $orig_h : 600;
|
||||||
: 800;
|
$popup = ' onclick="Popup=window.open("' . $absolutepath . '","Popup","toolbar=no,location=no,status=no,"' . '"menubar=no,scrollbars=yes,resizable=yes,width=' . $pop_width . ',height=' . $pop_height . '"); return false;"';
|
||||||
$pop_height = $orig_h
|
|
||||||
? $orig_h
|
|
||||||
: 600;
|
|
||||||
$popup = ' onclick="Popup=window.open("'. $absolutepath
|
|
||||||
.'","Popup","toolbar=no,location=no,status=no,"'
|
|
||||||
.'"menubar=no,scrollbars=yes,resizable=yes,width='
|
|
||||||
. $pop_width .',height='. $pop_height .'"); return false;"';
|
|
||||||
|
|
||||||
// Plugin hook, here lightbox attachs
|
// Plugin hook, here lightbox attachs
|
||||||
$popup = apply_filters('bbcode_img_popup', $popup, $absolutepath);
|
$popup = apply_filters('bbcode_img_popup', $popup, $absolutepath);
|
||||||
$popup_start = $attributes['popup'] == 'true'
|
$popup_start = $attributes ['popup'] == 'true' ? '<a title="' . $title . '" href="'. /* BLOG_BASEURL . $actualpath.*/
|
||||||
? '<a title="'. $title .'" href="'. /* BLOG_BASEURL . $actualpath.*/
|
$absolutepath . '"' . $popup . '>' : '';
|
||||||
$absolutepath .'"'. $popup .'>'
|
$popup_end = $attributes ['popup'] == 'true' ? '</a>' : '';
|
||||||
: '';
|
|
||||||
$popup_end = $attributes['popup'] == 'true'
|
|
||||||
? '</a>'
|
|
||||||
: '';
|
|
||||||
}
|
}
|
||||||
$img_width = $width
|
$img_width = $width ? ' width="' . $width . '"' : '';
|
||||||
? ' width="'.$width.'"'
|
$img_height = $height ? ' height="' . $height . '"' : '';
|
||||||
: '';
|
|
||||||
$img_height = $height
|
|
||||||
? ' height="'.$height.'"'
|
|
||||||
: '' ;
|
|
||||||
if (isset($attributes ['float'])) {
|
if (isset($attributes ['float'])) {
|
||||||
$float = ($attributes['float'] == 'left' || $attributes['float'] == 'right')
|
$float = ($attributes ['float'] == 'left' || $attributes ['float'] == 'right') ? ' class="float' . $attributes ['float'] . '"' : ' class="center"';
|
||||||
? ' class="float'. $attributes['float'] .'"'
|
|
||||||
: ' class="center"';
|
|
||||||
}
|
}
|
||||||
$src = $thumbpath
|
$src = $thumbpath ? (BLOG_BASEURL . $thumbpath) : $absolutepath; // $attributes['default'])
|
||||||
? (BLOG_BASEURL . $thumbpath)
|
$pop = $popup_start ? '' : ' title="' . $title . '" ';
|
||||||
: $absolutepath; // $attributes['default'])
|
return $popup_start . '<img src="' . $src . '" alt="' . $alt . '" ' . $pop . $float . $img_width . $img_height . ' />' . $popup_end;
|
||||||
$pop = $popup_start
|
|
||||||
? ''
|
|
||||||
: ' title="'.$title.'" ';
|
|
||||||
return $popup_start .'<img src="'. $src .'" alt="'. $alt. '" '.
|
|
||||||
$pop.$float.$img_width.$img_height .' />'. $popup_end;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -325,14 +271,17 @@ function do_bbcode_img($action, $attributes, $content, $params, $node_object) {
|
|||||||
* @param string $action
|
* @param string $action
|
||||||
* @param array $attr
|
* @param array $attr
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param mixed $params Not used
|
* @param mixed $params
|
||||||
* @param mixed $node_object Not used
|
* Not used
|
||||||
|
* @param mixed $node_object
|
||||||
|
* Not used
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function do_bbcode_video($action, $attr, $content, $params, $node_object) {
|
function do_bbcode_video($action, $attr, $content, $params, $node_object) {
|
||||||
if ($action == 'validate') {
|
if ($action == 'validate') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$vurl = parse_url($attr ['default']);
|
$vurl = parse_url($attr ['default']);
|
||||||
if (isset($attr ['type'])) {
|
if (isset($attr ['type'])) {
|
||||||
$type = $attr ['type'];
|
$type = $attr ['type'];
|
||||||
@ -340,33 +289,46 @@ function do_bbcode_video($action, $attr, $content, $params, $node_object) {
|
|||||||
// is it http://www.MYSITE.com or http://MYSITE.com ?
|
// is it http://www.MYSITE.com or http://MYSITE.com ?
|
||||||
$web = explode('.', $vurl ['host']);
|
$web = explode('.', $vurl ['host']);
|
||||||
array_pop($web);
|
array_pop($web);
|
||||||
$type = isset($web[1])
|
$type = isset($web [1]) ? $web [1] : $web [0];
|
||||||
? $web[1]
|
|
||||||
: $web[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check the [video] element's attributes width, height and float
|
||||||
|
$width = isset($attr ['width']) ? $attr ['width'] : '560';
|
||||||
|
$height = isset($attr ['height']) ? $attr ['height'] : '315';
|
||||||
|
$float = isset($attr ['float']) ? 'align="' . $attr ['float'] . '" ' : 'style="margin: 0 auto; display:block;" ';
|
||||||
|
|
||||||
$query = utils_kexplode($vurl ['query'], '=&');
|
$query = utils_kexplode($vurl ['query'], '=&');
|
||||||
$the_url = null;
|
$output = null;
|
||||||
$others = '';
|
|
||||||
|
// We recognize different video providers by the given video URL.
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
// YouTube
|
||||||
case 'youtube':
|
case 'youtube':
|
||||||
$the_url = "https://www.youtube.com/embed/{$query['v']}";
|
$output = '<iframe class="bbcode_video bbcode_video_youtube" src="https://www.youtube.com/embed/' . $query ['v'] . '" width="' . $width . '" height="' . $height . '" frameborder="0" allow="accelerometer; autoplay; fullscreen; encrypted-media; gyroscope; picture-in-picture" ' . $float . '></iframe>';
|
||||||
break;
|
break;
|
||||||
case 'default':
|
// Vimeo
|
||||||
|
case 'vimeo':
|
||||||
|
$vid = isset($query ['sec']) ? $query ['sec'] : str_replace('/', '', $vurl ['path']);
|
||||||
|
$output = '<iframe class="bbcode_video bbcode_video_vimeo" src="https://player.vimeo.com/video/' . $vid . '?color=' . $vid . '&title=0&byline=0&portrait=0" width="' . $width . '" height="' . $height . '" frameborder="0" allow="autoplay; fullscreen;" allowfullscreen ' . $float . '></iframe>';
|
||||||
|
break;
|
||||||
|
// Facebook
|
||||||
|
case 'facebook':
|
||||||
|
$vid = isset($query ['sec']) ? $query ['sec'] : str_replace('/video/', '', $vurl ['path']);
|
||||||
|
$output = '<div id="fb-root" ' . $float . '></div>
|
||||||
|
<script async defer src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2"></script>
|
||||||
|
<div class="fb-video bbcode_video bbcode_video_facebook" " data-href="' . $vid . '" data-allowfullscreen="true" data-width="' . $width . '" ' . $float . '></div>';
|
||||||
|
break;
|
||||||
|
// Any video file that can be played with HTML5 <video> element
|
||||||
|
// FIXME: support of uploaded video files ($attr ['default'] is like "attachs/video.mp4") still to be implemented!
|
||||||
|
case 'html5':
|
||||||
default:
|
default:
|
||||||
$the_url = $attr['default'];
|
$output = '<video class="bbcode_video bbcode_video_html5" width="' . $width . '" height="' . $height . '" controls ' . $float . '><source src="' . $attr ['default'] . '">Your browser does not support the video tag</video>';
|
||||||
|
break;
|
||||||
|
$output = null;
|
||||||
}
|
}
|
||||||
if ($the_url) {
|
|
||||||
$width = isset($attr['width'])
|
if (isset($output)) {
|
||||||
? $attr['width']
|
return $output;
|
||||||
: '400';
|
|
||||||
$height = isset($attr['height'])
|
|
||||||
? $attr['height']
|
|
||||||
: '326';
|
|
||||||
$float = isset($attr['float'])
|
|
||||||
? "style=\"float: {$attr['float']}\" "
|
|
||||||
: '';
|
|
||||||
$videoHtml = '<iframe border="0" style="border:none;" width="'.$width.'" height="'.$height.'" '. $float . ' src="' . $the_url . '" ' . $others . '></iframe>';
|
|
||||||
return $videoHtml;
|
|
||||||
}
|
}
|
||||||
return '[unsupported video]';
|
return '[unsupported video]';
|
||||||
}
|
}
|
||||||
@ -377,8 +339,10 @@ function do_bbcode_video($action, $attr, $content, $params, $node_object) {
|
|||||||
* @param string $action
|
* @param string $action
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param mixed $params Not used
|
* @param mixed $params
|
||||||
* @param mixed $node_object Not used
|
* Not used
|
||||||
|
* @param mixed $node_object
|
||||||
|
* Not used
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function do_bbcode_code($action, $attributes, $content, $params, $node_object) {
|
function do_bbcode_code($action, $attributes, $content, $params, $node_object) {
|
||||||
@ -412,8 +376,10 @@ function do_bbcode_code ($action, $attributes, $content, $params, $node_object)
|
|||||||
* @param string $action
|
* @param string $action
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param mixed $params Not used
|
* @param mixed $params
|
||||||
* @param mixed $node_object Not used
|
* Not used
|
||||||
|
* @param mixed $node_object
|
||||||
|
* Not used
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function do_bbcode_html($action, $attributes, $content, $params, $node_object) {
|
function do_bbcode_html($action, $attributes, $content, $params, $node_object) {
|
||||||
@ -437,8 +403,10 @@ function do_bbcode_html ($action, $attributes, $content, $params, $node_object)
|
|||||||
* @param string $action
|
* @param string $action
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param mixed $params Not used
|
* @param mixed $params
|
||||||
* @param mixed $node_object Not used
|
* Not used
|
||||||
|
* @param mixed $node_object
|
||||||
|
* Not used
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function do_bbcode_color($action, $attributes, $content, $params, $node_object) {
|
function do_bbcode_color($action, $attributes, $content, $params, $node_object) {
|
||||||
@ -454,8 +422,10 @@ function do_bbcode_color ($action, $attributes, $content, $params, $node_object)
|
|||||||
* @param string $action
|
* @param string $action
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param mixed $params Not used
|
* @param mixed $params
|
||||||
* @param mixed $node_object Not used
|
* Not used
|
||||||
|
* @param mixed $node_object
|
||||||
|
* Not used
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function do_bbcode_size($action, $attributes, $content, $params, $node_object) {
|
function do_bbcode_size($action, $attributes, $content, $params, $node_object) {
|
||||||
@ -471,8 +441,10 @@ function do_bbcode_size ($action, $attributes, $content, $params, $node_object)
|
|||||||
* @param string $action
|
* @param string $action
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param mixed $params Not used
|
* @param mixed $params
|
||||||
* @param mixed $node_object Not used
|
* Not used
|
||||||
|
* @param mixed $node_object
|
||||||
|
* Not used
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function do_bbcode_align($action, $attr, $content, $params, $node_object) {
|
function do_bbcode_align($action, $attr, $content, $params, $node_object) {
|
||||||
@ -485,16 +457,17 @@ function do_bbcode_align($action, $attr, $content, $params, $node_object) {
|
|||||||
* @param string $action
|
* @param string $action
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @param mixed $params Not used
|
* @param mixed $params
|
||||||
* @param mixed $node_object Not used
|
* Not used
|
||||||
|
* @param mixed $node_object
|
||||||
|
* Not used
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function do_bbcode_list($action, $attributes, $content, $params, $node_object) {
|
function do_bbcode_list($action, $attributes, $content, $params, $node_object) {
|
||||||
if ($action == 'validate') {
|
if ($action == 'validate') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (isset($attributes['default']) && $attributes['default'] == '#'
|
if (isset($attributes ['default']) && $attributes ['default'] == '#') {
|
||||||
) {
|
|
||||||
$list = 'ol';
|
$list = 'ol';
|
||||||
} else {
|
} else {
|
||||||
$list = 'ul';
|
$list = 'ul';
|
||||||
@ -523,7 +496,12 @@ function &plugin_bbcode_init() {
|
|||||||
'em',
|
'em',
|
||||||
'ins',
|
'ins',
|
||||||
'del',
|
'del',
|
||||||
'hr','h2','h3','h4','h5','h6'
|
'hr',
|
||||||
|
'h2',
|
||||||
|
'h3',
|
||||||
|
'h4',
|
||||||
|
'h5',
|
||||||
|
'h6'
|
||||||
// u for underlined: see below
|
// u for underlined: see below
|
||||||
);
|
);
|
||||||
foreach ($BBCODE_TAGS_SIMPLE as $key => $val) {
|
foreach ($BBCODE_TAGS_SIMPLE as $key => $val) {
|
||||||
@ -533,178 +511,136 @@ function &plugin_bbcode_init() {
|
|||||||
} else {
|
} else {
|
||||||
$htmltag = $bbtag = $val;
|
$htmltag = $bbtag = $val;
|
||||||
}
|
}
|
||||||
$bbcode->addCode (
|
$bbcode->addCode($bbtag, 'simple_replace', null, array(
|
||||||
$bbtag,
|
|
||||||
'simple_replace',
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'start_tag' => "<$htmltag>",
|
'start_tag' => "<$htmltag>",
|
||||||
'end_tag' => "</$htmltag>"
|
'end_tag' => "</$htmltag>"
|
||||||
),
|
), 'inline', array(
|
||||||
|
'listitem',
|
||||||
|
'block',
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
|
||||||
array()
|
|
||||||
);
|
|
||||||
$bbcode->setCodeFlag($bbtag, 'closetag', BBCODE_CLOSETAG_MUSTEXIST);
|
$bbcode->setCodeFlag($bbtag, 'closetag', BBCODE_CLOSETAG_MUSTEXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* other tags */
|
/* other tags */
|
||||||
$bbcode->addCode(
|
$bbcode->addCode('u', 'simple_replace', null, array(
|
||||||
'u',
|
|
||||||
'simple_replace',
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'start_tag' => '<span style="text-decoration: underline">',
|
'start_tag' => '<span style="text-decoration: underline">',
|
||||||
'end_tag' => '</span>'
|
'end_tag' => '</span>'
|
||||||
),
|
), 'inline', array(
|
||||||
|
'listitem',
|
||||||
|
'block',
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'),
|
), array());
|
||||||
array()
|
$bbcode->addCode('color', 'callback_replace', 'do_bbcode_color', array(
|
||||||
);
|
'usecontent_param' => array(
|
||||||
$bbcode->addCode(
|
'default'
|
||||||
'color',
|
)
|
||||||
'callback_replace',
|
), 'inline', array(
|
||||||
'do_bbcode_color',
|
'listitem',
|
||||||
array(
|
'block',
|
||||||
'usecontent_param' => array('default')
|
|
||||||
),
|
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
|
||||||
array()
|
|
||||||
);
|
|
||||||
$bbcode->setCodeFlag('color', 'closetag', BBCODE_CLOSETAG_MUSTEXIST);
|
$bbcode->setCodeFlag('color', 'closetag', BBCODE_CLOSETAG_MUSTEXIST);
|
||||||
$bbcode->addCode(
|
$bbcode->addCode('size', 'callback_replace', 'do_bbcode_size', array(
|
||||||
'size',
|
'usecontent_param' => array(
|
||||||
'callback_replace',
|
'default'
|
||||||
'do_bbcode_size',
|
)
|
||||||
array(
|
), 'inline', array(
|
||||||
'usecontent_param' => array('default')
|
'listitem',
|
||||||
),
|
'block',
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
|
||||||
array()
|
|
||||||
);
|
|
||||||
$bbcode->setCodeFlag('color', 'closetag', BBCODE_CLOSETAG_MUSTEXIST);
|
$bbcode->setCodeFlag('color', 'closetag', BBCODE_CLOSETAG_MUSTEXIST);
|
||||||
$bbcode->addCode(
|
$bbcode->addCode('code', 'usecontent', 'do_bbcode_code', array(), 'inline', array(
|
||||||
'code',
|
'listitem',
|
||||||
'usecontent',
|
'block',
|
||||||
'do_bbcode_code',
|
|
||||||
array(),
|
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
|
||||||
array()
|
|
||||||
);
|
|
||||||
$bbcode->setCodeFlag('code', 'closetag', BBCODE_CLOSETAG_MUSTEXIST);
|
$bbcode->setCodeFlag('code', 'closetag', BBCODE_CLOSETAG_MUSTEXIST);
|
||||||
$bbcode->addCode(
|
$bbcode->addCode('html', 'usecontent', 'do_bbcode_html', array(), 'inline', array(
|
||||||
'html',
|
'listitem',
|
||||||
'usecontent',
|
'block',
|
||||||
'do_bbcode_html',
|
|
||||||
array(),
|
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
|
||||||
array()
|
|
||||||
);
|
|
||||||
$bbcode->setCodeFlag('html', 'closetag', BBCODE_CLOSETAG_MUSTEXIST);
|
$bbcode->setCodeFlag('html', 'closetag', BBCODE_CLOSETAG_MUSTEXIST);
|
||||||
$bbcode->addCode(
|
$bbcode->addCode('url', 'callback_replace', 'do_bbcode_url', array(
|
||||||
'url',
|
|
||||||
'callback_replace',
|
|
||||||
'do_bbcode_url',
|
|
||||||
array(
|
|
||||||
'usecontent_param' => array('default', 'new')
|
|
||||||
),
|
|
||||||
'link',
|
|
||||||
array(
|
|
||||||
'listitem', 'block', 'inline'
|
|
||||||
),
|
|
||||||
array('link')
|
|
||||||
);
|
|
||||||
$bbcode->addCode(
|
|
||||||
'img',
|
|
||||||
'callback_replace_single',
|
|
||||||
'do_bbcode_img',
|
|
||||||
array(
|
|
||||||
'usecontent_param' => array(
|
'usecontent_param' => array(
|
||||||
'default', 'float', 'alt', 'popup', 'width', 'height', 'title'
|
'default',
|
||||||
|
'new'
|
||||||
)
|
)
|
||||||
),
|
), 'link', array(
|
||||||
'image',
|
'listitem',
|
||||||
array(
|
'block',
|
||||||
'listitem', 'block', 'inline', 'link'
|
'inline'
|
||||||
),
|
), array(
|
||||||
array());
|
'link'
|
||||||
|
));
|
||||||
|
$bbcode->addCode('img', 'callback_replace_single', 'do_bbcode_img', array(
|
||||||
|
'usecontent_param' => array(
|
||||||
|
'default',
|
||||||
|
'float',
|
||||||
|
'alt',
|
||||||
|
'popup',
|
||||||
|
'width',
|
||||||
|
'height',
|
||||||
|
'title'
|
||||||
|
)
|
||||||
|
), 'image', array(
|
||||||
|
'listitem',
|
||||||
|
'block',
|
||||||
|
'inline',
|
||||||
|
'link'
|
||||||
|
), array());
|
||||||
$bbcode->setCodeFlag('img', 'closetag', 'BBCODE_CLOSETAG_FORBIDDEN');
|
$bbcode->setCodeFlag('img', 'closetag', 'BBCODE_CLOSETAG_FORBIDDEN');
|
||||||
$bbcode->addCode(
|
$bbcode->addCode('video', 'callback_replace_single', 'do_bbcode_video', array(
|
||||||
'video',
|
|
||||||
'callback_replace_single',
|
|
||||||
'do_bbcode_video',
|
|
||||||
array(
|
|
||||||
'usecontent_param' => array(
|
'usecontent_param' => array(
|
||||||
'default', 'float', 'width', 'height'
|
'default',
|
||||||
|
'float',
|
||||||
|
'width',
|
||||||
|
'height'
|
||||||
)
|
)
|
||||||
),
|
), 'image', array(
|
||||||
'image',
|
'listitem',
|
||||||
array(
|
'block',
|
||||||
'listitem', 'block', 'inline', 'link'
|
'inline',
|
||||||
),
|
'link'
|
||||||
array()
|
), array());
|
||||||
);
|
|
||||||
$bbcode->setCodeFlag('video', 'closetag', 'BBCODE_CLOSETAG_FORBIDDEN');
|
$bbcode->setCodeFlag('video', 'closetag', 'BBCODE_CLOSETAG_FORBIDDEN');
|
||||||
$bbcode->addCode (
|
$bbcode->addCode('list', 'callback_replace', 'do_bbcode_list', array(
|
||||||
'list',
|
|
||||||
'callback_replace',
|
|
||||||
'do_bbcode_list',
|
|
||||||
array(
|
|
||||||
'start_tag' => '<ul>',
|
'start_tag' => '<ul>',
|
||||||
'end_tag' => '</ul>'
|
'end_tag' => '</ul>'
|
||||||
),
|
), 'list', array(
|
||||||
'list',
|
'block',
|
||||||
array(
|
'listitem'
|
||||||
'block', 'listitem'
|
), array());
|
||||||
),
|
|
||||||
array()
|
|
||||||
);
|
|
||||||
$bbcode->setCodeFlag('list', 'closetag', BBCODE_CLOSETAG_MUSTEXIST);
|
$bbcode->setCodeFlag('list', 'closetag', BBCODE_CLOSETAG_MUSTEXIST);
|
||||||
$bbcode->setCodeFlag('list', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT);
|
$bbcode->setCodeFlag('list', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT);
|
||||||
$bbcode->setCodeFlag('list', 'opentag.before.newline', BBCODE_NEWLINE_DROP);
|
$bbcode->setCodeFlag('list', 'opentag.before.newline', BBCODE_NEWLINE_DROP);
|
||||||
$bbcode->setCodeFlag('list', 'closetag.before.newline', BBCODE_NEWLINE_DROP);
|
$bbcode->setCodeFlag('list', 'closetag.before.newline', BBCODE_NEWLINE_DROP);
|
||||||
$bbcode->addCode(
|
$bbcode->addCode('*', 'simple_replace', null, array(
|
||||||
'*',
|
|
||||||
'simple_replace',
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'start_tag' => '<li>',
|
'start_tag' => '<li>',
|
||||||
'end_tag' => '</li>'
|
'end_tag' => '</li>'
|
||||||
),
|
), 'listitem', array(
|
||||||
'listitem',
|
'list'
|
||||||
array('list'),
|
), array());
|
||||||
array()
|
|
||||||
);
|
|
||||||
$bbcode->setCodeFlag('*', 'closetag', BBCODE_CLOSETAG_OPTIONAL);
|
$bbcode->setCodeFlag('*', 'closetag', BBCODE_CLOSETAG_OPTIONAL);
|
||||||
$bbcode->setCodeFlag('*', 'paragraphs', false);
|
$bbcode->setCodeFlag('*', 'paragraphs', false);
|
||||||
$bbcode->addCode(
|
$bbcode->addCode('align', 'callback_replace', 'do_bbcode_align', array(
|
||||||
'align',
|
'usecontent_param' => array(
|
||||||
'callback_replace',
|
'default'
|
||||||
'do_bbcode_align',
|
)
|
||||||
array(
|
), 'block', array(
|
||||||
'usecontent_param' => array('default')
|
'listitem',
|
||||||
),
|
|
||||||
'block',
|
'block',
|
||||||
array(
|
'inline',
|
||||||
'listitem', 'block', 'inline', 'link'
|
'link'
|
||||||
),
|
), array());
|
||||||
array()
|
|
||||||
);
|
|
||||||
define('BBCODE_INIT_DONE', true);
|
define('BBCODE_INIT_DONE', true);
|
||||||
// DMKE: there's no bbcode_init filter defined
|
// DMKE: there's no bbcode_init filter defined
|
||||||
$bbcode = apply_filters('bbcode_init', $bbcode);
|
$bbcode = apply_filters('bbcode_init', $bbcode);
|
||||||
@ -741,8 +677,8 @@ function plugin_bbcode_toolbar() {
|
|||||||
array_unshift($attachslist, '--');
|
array_unshift($attachslist, '--');
|
||||||
$_FP_SMARTY->assign('attachs_list', $attachslist);
|
$_FP_SMARTY->assign('attachs_list', $attachslist);
|
||||||
// DMKE: does not work
|
// DMKE: does not work
|
||||||
#$bblang = lang_load('plugin:bbcode');
|
// $bblang = lang_load('plugin:bbcode');
|
||||||
#$_FP_SMARTY->assign('bblang', $bblang);
|
// $_FP_SMARTY->assign('bblang', $bblang);
|
||||||
echo "<!-- bbcode plugin -->\n";
|
echo "<!-- bbcode plugin -->\n";
|
||||||
echo '<script type="text/javascript" src="' . plugin_geturl('bbcode') . 'res/editor.js"></script>' . "\n";
|
echo '<script type="text/javascript" src="' . plugin_geturl('bbcode') . 'res/editor.js"></script>' . "\n";
|
||||||
echo $_FP_SMARTY->fetch('plugin:bbcode/toolbar');
|
echo $_FP_SMARTY->fetch('plugin:bbcode/toolbar');
|
||||||
@ -760,166 +696,111 @@ function plugin_bbcode_comment($text) {
|
|||||||
// If you set it to false the case-sensitive will be ignored for all codes
|
// If you set it to false the case-sensitive will be ignored for all codes
|
||||||
$bbcode->setGlobalCaseSensitive(false);
|
$bbcode->setGlobalCaseSensitive(false);
|
||||||
$bbcode->setMixedAttributeTypes(true);
|
$bbcode->setMixedAttributeTypes(true);
|
||||||
$bbcode->addCode(
|
$bbcode->addCode('b', 'simple_replace', null, array(
|
||||||
'b',
|
|
||||||
'simple_replace',
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'start_tag' => '<strong>',
|
'start_tag' => '<strong>',
|
||||||
'end_tag' => '</strong>'
|
'end_tag' => '</strong>'
|
||||||
),
|
), 'inline', array(
|
||||||
|
'listitem',
|
||||||
|
'block',
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
$bbcode->addCode('strong', 'simple_replace', null, array(
|
||||||
array()
|
|
||||||
);
|
|
||||||
$bbcode->addCode(
|
|
||||||
'strong',
|
|
||||||
'simple_replace',
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'start_tag' => '<strong>',
|
'start_tag' => '<strong>',
|
||||||
'end_tag' => '</strong>'
|
'end_tag' => '</strong>'
|
||||||
),
|
), 'inline', array(
|
||||||
|
'listitem',
|
||||||
|
'block',
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
$bbcode->addCode('i', 'simple_replace', null, array(
|
||||||
array()
|
|
||||||
);
|
|
||||||
$bbcode->addCode(
|
|
||||||
'i',
|
|
||||||
'simple_replace',
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'start_tag' => '<em>',
|
'start_tag' => '<em>',
|
||||||
'end_tag' => '</em>'
|
'end_tag' => '</em>'
|
||||||
),
|
), 'inline', array(
|
||||||
|
'listitem',
|
||||||
|
'block',
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
$bbcode->addCode('em', 'simple_replace', null, array(
|
||||||
array()
|
|
||||||
);
|
|
||||||
$bbcode->addCode(
|
|
||||||
'em',
|
|
||||||
'simple_replace',
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'start_tag' => '<em>',
|
'start_tag' => '<em>',
|
||||||
'end_tag' => '</em>'
|
'end_tag' => '</em>'
|
||||||
),
|
), 'inline', array(
|
||||||
|
'listitem',
|
||||||
|
'block',
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
$bbcode->addCode('ins', 'simple_replace', null, array(
|
||||||
array()
|
|
||||||
);
|
|
||||||
$bbcode->addCode(
|
|
||||||
'ins',
|
|
||||||
'simple_replace',
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'start_tag' => '<ins>',
|
'start_tag' => '<ins>',
|
||||||
'end_tag' => '</ins>'
|
'end_tag' => '</ins>'
|
||||||
),
|
), 'inline', array(
|
||||||
|
'listitem',
|
||||||
|
'block',
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
$bbcode->addCode('u', 'simple_replace', null, array(
|
||||||
array());
|
|
||||||
$bbcode->addCode(
|
|
||||||
'u',
|
|
||||||
'simple_replace',
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'start_tag' => '<ins>',
|
'start_tag' => '<ins>',
|
||||||
'end_tag' => '</ins>'
|
'end_tag' => '</ins>'
|
||||||
),
|
), 'inline', array(
|
||||||
|
'listitem',
|
||||||
|
'block',
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
$bbcode->addCode('del', 'simple_replace', null, array(
|
||||||
array());
|
|
||||||
$bbcode->addCode(
|
|
||||||
'del',
|
|
||||||
'simple_replace',
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'start_tag' => '<del>',
|
'start_tag' => '<del>',
|
||||||
'end_tag' => '</del>'
|
'end_tag' => '</del>'
|
||||||
),
|
), 'inline', array(
|
||||||
|
'listitem',
|
||||||
|
'block',
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
$bbcode->addCode('strike', 'simple_replace', null, array(
|
||||||
array());
|
|
||||||
$bbcode->addCode(
|
|
||||||
'strike',
|
|
||||||
'simple_replace',
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'start_tag' => '<del>',
|
'start_tag' => '<del>',
|
||||||
'end_tag' => '</del>'
|
'end_tag' => '</del>'
|
||||||
),
|
), 'inline', array(
|
||||||
|
'listitem',
|
||||||
|
'block',
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
$bbcode->addCode('blockquote', 'simple_replace', null, array(
|
||||||
array());
|
|
||||||
$bbcode->addCode(
|
|
||||||
'blockquote',
|
|
||||||
'simple_replace',
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'start_tag' => '<blockquote><p>',
|
'start_tag' => '<blockquote><p>',
|
||||||
'end_tag' => '</p></blockquote>'
|
'end_tag' => '</p></blockquote>'
|
||||||
),
|
), 'inline', array(
|
||||||
|
'listitem',
|
||||||
|
'block',
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
$bbcode->addCode('quote', 'simple_replace', null, array(
|
||||||
array()
|
|
||||||
);
|
|
||||||
$bbcode->addCode(
|
|
||||||
'quote',
|
|
||||||
'simple_replace',
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'start_tag' => '<blockquote><p>',
|
'start_tag' => '<blockquote><p>',
|
||||||
'end_tag' => '</p></blockquote>'
|
'end_tag' => '</p></blockquote>'
|
||||||
),
|
), 'inline', array(
|
||||||
|
'listitem',
|
||||||
|
'block',
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
$bbcode->addCode('pre', 'simple_replace', null, array(
|
||||||
array()
|
|
||||||
);
|
|
||||||
$bbcode->addCode(
|
|
||||||
'pre',
|
|
||||||
'simple_replace',
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'start_tag' => '<pre>',
|
'start_tag' => '<pre>',
|
||||||
'end_tag' => '</pre>'
|
'end_tag' => '</pre>'
|
||||||
),
|
), 'inline', array(
|
||||||
|
'listitem',
|
||||||
|
'block',
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
$bbcode->addCode('code', 'usecontent', 'do_bbcode_code', array(), 'inline', array(
|
||||||
array());
|
'listitem',
|
||||||
$bbcode->addCode(
|
'block',
|
||||||
'code',
|
|
||||||
'usecontent',
|
|
||||||
'do_bbcode_code',
|
|
||||||
array(),
|
|
||||||
'inline',
|
'inline',
|
||||||
array(
|
'link'
|
||||||
'listitem', 'block', 'inline', 'link'
|
), array());
|
||||||
),
|
|
||||||
array()
|
|
||||||
);
|
|
||||||
return $bbcode->parse($text);
|
return $bbcode->parse($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -941,7 +822,7 @@ function plugin_bbcode_undoHtmlCallback($match) {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function plugin_bbcode_undoHtml($text) {
|
function plugin_bbcode_undoHtml($text) {
|
||||||
#return preg_replace_callback('|<!-- BEGOFHTML -->(.*)<!-- EOFHTML -->|sU', 'plugin_bbcode_undoHtmlCallback', $text);
|
// return preg_replace_callback('|<!-- BEGOFHTML -->(.*)<!-- EOFHTML -->|sU', 'plugin_bbcode_undoHtmlCallback', $text);
|
||||||
if (isset($GLOBALS ['BBCODE_TEMP_HTML'])) {
|
if (isset($GLOBALS ['BBCODE_TEMP_HTML'])) {
|
||||||
foreach ($GLOBALS ['BBCODE_TEMP_HTML'] as $n => $content) {
|
foreach ($GLOBALS ['BBCODE_TEMP_HTML'] as $n => $content) {
|
||||||
// html_entity_decode($content)
|
// html_entity_decode($content)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user