mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 14:46:56 +02:00
TinyMce Image-insert and Auto-Image resizing (see admin->media-manager->preferences)
This commit is contained in:
@@ -226,15 +226,22 @@ class media_form_ui extends e_admin_form_ui
|
||||
// "featurebox-image" => "Featurebox Images",
|
||||
// "featurebox-bbcode" => "Featurebox [img] bbcode",
|
||||
);
|
||||
$text .= "<div>Experimental (maximum width and maximum height)</div>";
|
||||
|
||||
|
||||
foreach($options as $key=>$title)
|
||||
{
|
||||
$text .= "<input type='text' name='resize_dimensions[{$key}]' value='$val' size='7' title='hello' /> ".$title."<br />";
|
||||
$valW = $curval[$key]['w'];
|
||||
$valH = $curval[$key]['h'];
|
||||
|
||||
$text .= "<div style='margin-bottomp:8px;text-align:right;width:280px'>".$title.": ";
|
||||
$text .= "<input class='e-tip' placeholder='ex. 400' style='text-align:right' type='text' name='resize_dimensions[{$key}][w]' value='$valW' size='5' title='maximum width in pixels' /> X ";
|
||||
$text .= "<input class='e-tip' placeholder='ex. 400' style='text-align:right' type='text' name='resize_dimensions[{$key}][h]' value='$valH' size='5' title='maximum height in pixels' />";
|
||||
$text .= "</div>";
|
||||
// $text .= $frm->text("resize_dimensions[{$key}]",$val, 5, array('size'=>'5')).$title."<br />";
|
||||
}
|
||||
|
||||
$text .= "<div><br />Warning: This feature is experimental.</div>";
|
||||
|
||||
return $text;
|
||||
|
||||
|
||||
@@ -719,9 +726,9 @@ class media_admin_ui extends e_admin_ui
|
||||
|
||||
// TODO to eventually be hidden.
|
||||
$text .= "bbcode: <input type='text' readonly='readonly' style='border:0px; width:700px' id='bbcode_holder' name='bbcode_holder' value='' />
|
||||
<input title='html' type='hidden' style='width:800px' id='html_holder' name='html_holder' value='' />
|
||||
<input title='src' type='hidden' style='width:600px' id='src' name='src' value='' />
|
||||
<input title='path' type='hidden' style='width:600px' id='path' name='path' value='' />
|
||||
<input title='html' type='text' style='width:800px' id='html_holder' name='html_holder' value='' />
|
||||
<input title='src' type='text' style='width:600px' id='src' name='src' value='' />
|
||||
<input title='path' type='text' style='width:600px' id='path' name='path' value='' />
|
||||
";
|
||||
|
||||
}
|
||||
|
@@ -2185,7 +2185,7 @@ class admin_newspost
|
||||
<tr>
|
||||
<td class='label'>".NWSLAN_22.":</td>
|
||||
<td class='control'>
|
||||
".$frm->uc_select('news_userclass[]', $_POST['news_class'], 'nobody,public,guest,member,admin,classes,language', 'description=1&multiple=1')."
|
||||
".$frm->uc_select('news_userclass[]', vartrue($_POST['news_class'],0), 'nobody,public,guest,member,admin,classes,language', 'description=1&multiple=1')."
|
||||
<div class='field-help'>
|
||||
".NWSLAN_84."
|
||||
</div>
|
||||
|
170
e107_core/bbcodes/bb_img.php
Normal file
170
e107_core/bbcodes/bb_img.php
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
// $Id$
|
||||
|
||||
// General purpose image bbcode. As well as the obvious insertion of a picture:
|
||||
// a) if filname begins with 'th_' or 'thumb_', creates link to main image opening in new window
|
||||
// b) If filename contains '*', treats it as a wildcard, and displays a random image from all matching file names found
|
||||
//
|
||||
// Can use simple classes for float - e.g.:
|
||||
// .floatleft {clear: right; float: left; margin: 0px 5px 5px 0px; padding:2px; border: 0px;}
|
||||
// .floatright {clear: left; float: right; margin: 0px 0px 0px 5px; padding:2px; border: 0px;}
|
||||
// Currently defaults class to 'floatnone' - overridden by bbcode
|
||||
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
class bb_img extends e_bb_base
|
||||
{
|
||||
function toDB($code_text, $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 '[img='.eHelper::buildAttr($safe).']'.$code_text.'[/img]';
|
||||
}
|
||||
return '[img]'.$code_text.'[/img]';
|
||||
}
|
||||
|
||||
|
||||
function toHTML($code_text, $parm)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$pref = e107::getPref();
|
||||
|
||||
$class = e107::getBB()->getClass('img');
|
||||
|
||||
|
||||
|
||||
if (trim($code_text) == "") return ""; // Do nothing on empty file
|
||||
if (preg_match("#\.php\?.*#",$code_text)){return "";}
|
||||
|
||||
$addlink = FALSE;
|
||||
|
||||
|
||||
// Automatic Img Resizing --
|
||||
$w = e107::getBB()->resizeWidth(); // varies depending on the class set by external script. see admin->media-manager->prefs
|
||||
$h = e107::getBB()->resizeHeight();
|
||||
|
||||
|
||||
if(strpos($code_text,"://")==false && ($w || $h)) // local file.
|
||||
{
|
||||
$code_text = $tp->thumbUrl($code_text,'w='.$w.'&h='.$h);
|
||||
}
|
||||
// ------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
$search = array('"', '{E_IMAGE}', '{E_FILE}', '{e_IMAGE}', '{e_FILE}');
|
||||
$replace = array(''', e_IMAGE_ABS, e_FILE_ABS, e_IMAGE_ABS, e_FILE_ABS);
|
||||
$replaceInt = array(''', e_IMAGE, e_FILE, e_IMAGE, e_FILE);
|
||||
$intName = str_replace($search, $replaceInt, $code_text); // Server-relative file names
|
||||
unset($imgParms);
|
||||
$imgParms['class']="bbcode {$class}"; // This will be overridden if a new class is specified
|
||||
|
||||
$imgParms['alt']='';
|
||||
|
||||
$code_text = str_replace($search, $replace, $code_text);
|
||||
$code_text = $tp -> toAttribute($code_text);
|
||||
$img_file = pathinfo($code_text); // 'External' file name. N.B. - might still contain a constant such as e_IMAGE
|
||||
|
||||
if($parm)
|
||||
{
|
||||
$parm = preg_replace('#onerror *=#i','',$parm);
|
||||
$parm = str_replace("amp;", "&", $parm);
|
||||
parse_str($parm,$tmp);
|
||||
foreach($tmp as $p => $v)
|
||||
{
|
||||
$imgParms[$p]=$v;
|
||||
}
|
||||
}
|
||||
$parmStr="";
|
||||
foreach($imgParms as $k => $v)
|
||||
{
|
||||
$parmStr .= $tp -> toAttribute($k)."='".$tp -> toAttribute($v)."' ";
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Select a random file if required
|
||||
if (strpos($img_file['basename'],'*') !== FALSE)
|
||||
{
|
||||
$fileList = array();
|
||||
$intFile = pathinfo($intName); // N.B. - might still contain a constant such as e_IMAGE
|
||||
$matchString = '#'.str_replace('*','.*?',$intFile['basename']).'#';
|
||||
$dirName = $tp->replaceConstants($intFile['dirname'].'/'); // we want server-relative directory
|
||||
if (($h = opendir($dirName)) !== FALSE)
|
||||
{
|
||||
while (($f = readdir($h)) !== FALSE)
|
||||
{
|
||||
if (preg_match($matchString,$f))
|
||||
{
|
||||
$fileList[] = $f; // Just need to note file names
|
||||
}
|
||||
}
|
||||
closedir($h);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Error opening directory: {$dirName}<br />";
|
||||
return '';
|
||||
}
|
||||
if (count($fileList))
|
||||
{
|
||||
$img_file['basename'] = $fileList[mt_rand(0,count($fileList)-1)]; // Just change name of displayed file - no change on directory
|
||||
$code_text = $img_file['dirname']."/".$img_file['basename'];
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'No file: '.$code_text;
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check for whether we can display image down here - so we can show image name if appropriate
|
||||
if (!varsettrue($pref['image_post']) || !check_class($pref['image_post_class']))
|
||||
{
|
||||
switch ($pref['image_post_disabled_method'])
|
||||
{
|
||||
case '1' :
|
||||
return CORE_LAN17;
|
||||
case '2' :
|
||||
return '';
|
||||
}
|
||||
return CORE_LAN18.$code_text;
|
||||
}
|
||||
|
||||
|
||||
// Check for link to main image if required
|
||||
if (strpos($img_file['basename'],'th_') === 0)
|
||||
{
|
||||
$addlink = TRUE;
|
||||
$main_name = $img_file['dirname']."/".substr($img_file['basename'],3); // delete the 'th' prefix from file name
|
||||
}
|
||||
elseif (strpos($img_file['basename'],'thumb_') === 0)
|
||||
{
|
||||
$addlink = TRUE;
|
||||
$main_name = $img_file['dirname']."/".substr($img_file['basename'],6); // delete the 'thumb' prefix from file name
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($addlink)
|
||||
{
|
||||
return "<a href='".$main_name."' rel='external'><img src='".$code_text."' {$parmStr} /></a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<img src='".$code_text."' {$parmStr} />";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -1,122 +0,0 @@
|
||||
//<?
|
||||
$class = e107::getBB()->getClass('img');
|
||||
// $Id$
|
||||
|
||||
// General purpose image bbcode. As well as the obvious insertion of a picture:
|
||||
// a) if filname begins with 'th_' or 'thumb_', creates link to main image opening in new window
|
||||
// b) If filename contains '*', treats it as a wildcard, and displays a random image from all matching file names found
|
||||
//
|
||||
// Can use simple classes for float - e.g.:
|
||||
// .floatleft {clear: right; float: left; margin: 0px 5px 5px 0px; padding:2px; border: 0px;}
|
||||
// .floatright {clear: left; float: right; margin: 0px 0px 0px 5px; padding:2px; border: 0px;}
|
||||
// Currently defaults class to 'floatnone' - overridden by bbcode
|
||||
|
||||
if (trim($code_text) == "") return ""; // Do nothing on empty file
|
||||
if (preg_match("#\.php\?.*#",$code_text)){return "";}
|
||||
$addlink = FALSE;
|
||||
|
||||
global $pref;
|
||||
|
||||
|
||||
$search = array('"', '{E_IMAGE}', '{E_FILE}', '{e_IMAGE}', '{e_FILE}');
|
||||
$replace = array(''', e_IMAGE_ABS, e_FILE_ABS, e_IMAGE_ABS, e_FILE_ABS);
|
||||
$replaceInt = array(''', e_IMAGE, e_FILE, e_IMAGE, e_FILE);
|
||||
$intName = str_replace($search, $replaceInt, $code_text); // Server-relative file names
|
||||
unset($imgParms);
|
||||
$imgParms['class']="bbcode {$class}"; // This will be overridden if a new class is specified
|
||||
|
||||
$imgParms['alt']='';
|
||||
|
||||
$code_text = str_replace($search, $replace, $code_text);
|
||||
$code_text = $tp -> toAttribute($code_text);
|
||||
$img_file = pathinfo($code_text); // 'External' file name. N.B. - might still contain a constant such as e_IMAGE
|
||||
|
||||
if($parm)
|
||||
{
|
||||
$parm = preg_replace('#onerror *=#i','',$parm);
|
||||
$parm = str_replace("amp;", "&", $parm);
|
||||
parse_str($parm,$tmp);
|
||||
foreach($tmp as $p => $v)
|
||||
{
|
||||
$imgParms[$p]=$v;
|
||||
}
|
||||
}
|
||||
$parmStr="";
|
||||
foreach($imgParms as $k => $v)
|
||||
{
|
||||
$parmStr .= $tp -> toAttribute($k)."='".$tp -> toAttribute($v)."' ";
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Select a random file if required
|
||||
if (strpos($img_file['basename'],'*') !== FALSE)
|
||||
{
|
||||
$fileList = array();
|
||||
$intFile = pathinfo($intName); // N.B. - might still contain a constant such as e_IMAGE
|
||||
$matchString = '#'.str_replace('*','.*?',$intFile['basename']).'#';
|
||||
$dirName = $tp->replaceConstants($intFile['dirname'].'/'); // we want server-relative directory
|
||||
if (($h = opendir($dirName)) !== FALSE)
|
||||
{
|
||||
while (($f = readdir($h)) !== FALSE)
|
||||
{
|
||||
if (preg_match($matchString,$f))
|
||||
{
|
||||
$fileList[] = $f; // Just need to note file names
|
||||
}
|
||||
}
|
||||
closedir($h);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Error opening directory: {$dirName}<br />";
|
||||
return '';
|
||||
}
|
||||
if (count($fileList))
|
||||
{
|
||||
$img_file['basename'] = $fileList[mt_rand(0,count($fileList)-1)]; // Just change name of displayed file - no change on directory
|
||||
$code_text = $img_file['dirname']."/".$img_file['basename'];
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'No file: '.$code_text;
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check for whether we can display image down here - so we can show image name if appropriate
|
||||
if (!varsettrue($pref['image_post']) || !check_class($pref['image_post_class']))
|
||||
{
|
||||
switch ($pref['image_post_disabled_method'])
|
||||
{
|
||||
case '1' :
|
||||
return CORE_LAN17;
|
||||
case '2' :
|
||||
return '';
|
||||
}
|
||||
return CORE_LAN18.$code_text;
|
||||
}
|
||||
|
||||
|
||||
// Check for link to main image if required
|
||||
if (strpos($img_file['basename'],'th_') === 0)
|
||||
{
|
||||
$addlink = TRUE;
|
||||
$main_name = $img_file['dirname']."/".substr($img_file['basename'],3); // delete the 'th' prefix from file name
|
||||
}
|
||||
elseif (strpos($img_file['basename'],'thumb_') === 0)
|
||||
{
|
||||
$addlink = TRUE;
|
||||
$main_name = $img_file['dirname']."/".substr($img_file['basename'],6); // delete the 'thumb' prefix from file name
|
||||
}
|
||||
|
||||
|
||||
if ($addlink)
|
||||
{
|
||||
return "<a href='".$main_name."' rel='external'><img src='".$code_text."' {$parmStr} /></a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<img src='".$code_text."' {$parmStr} />";
|
||||
}
|
@@ -43,12 +43,13 @@ class news_shortcodes extends e_shortcode
|
||||
|
||||
function sc_newsbody($parm)
|
||||
{
|
||||
e107::getBB()->setClass("news");
|
||||
$news_body = $this->e107->tp->toHTML($this->news_item['news_body'], true, 'BODY, fromadmin', $this->news_item['news_author']);
|
||||
if($this->news_item['news_extended'] && (isset($_POST['preview']) || $this->param['current_action'] == 'extend') && $parm != 'noextend')
|
||||
{
|
||||
$news_body .= $this->e107->tp->toHTML($this->news_item['news_extended'], true, 'BODY, fromadmin', $this->news_item['news_author']);
|
||||
}
|
||||
|
||||
e107::getBB()->clearClass();
|
||||
return $news_body;
|
||||
}
|
||||
|
||||
@@ -316,9 +317,21 @@ class news_shortcodes extends e_shortcode
|
||||
{
|
||||
return '';
|
||||
}
|
||||
// We store SC path in DB now + BC
|
||||
$src = $this->news_item['news_thumbnail'][0] == '{' ? e107::getParser()->replaceConstants($this->news_item['news_thumbnail'], 'abs') : e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail'];
|
||||
|
||||
|
||||
$w = vartrue($pref['resize_dimensions']['news-image']['w']);
|
||||
$h = vartrue($pref['resize_dimensions']['news-image']['h']);
|
||||
|
||||
if($this->news_item['news_thumbnail'][0] == '{' && ($w || $h))
|
||||
{
|
||||
$src = $tp->thumbUrl($this->news_item['news_thumbnail'],"w={$w}&h={$h}");
|
||||
}
|
||||
else
|
||||
{
|
||||
// We store SC path in DB now + BC
|
||||
$src = $this->news_item['news_thumbnail'][0] == '{' ? e107::getParser()->replaceConstants($this->news_item['news_thumbnail'], 'abs') : e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail'];
|
||||
}
|
||||
|
||||
|
||||
switch($parm)
|
||||
{
|
||||
case 'src':
|
||||
|
@@ -113,6 +113,20 @@ $(document).ready(function()
|
||||
var preview = $(this).attr('data-preview');
|
||||
var src = $(this).attr('data-src');
|
||||
var bbcode = $(this).attr('data-bbcode');
|
||||
|
||||
// Create new offscreen image to test
|
||||
// var theImage = new Image();
|
||||
// theImage.src = $(this).attr('data-src');
|
||||
|
||||
// Get accurate measurements from that.
|
||||
// var imageWidth = theImage.width;
|
||||
// var imageHeight = theImage.height;
|
||||
|
||||
// $('#width').val(theImage.width);
|
||||
// $('#height').val(theImage.height);
|
||||
// alert('width='+imageWidth);
|
||||
|
||||
|
||||
|
||||
$(this).addClass("media-select-active");
|
||||
$(this).closest("img").addClass("active");
|
||||
|
@@ -427,6 +427,33 @@ class e_bbcode
|
||||
$this->class = $mode;
|
||||
}
|
||||
|
||||
// return the Mode used by the class. eg. news | page | user | {plugin-folder}
|
||||
function getMode()
|
||||
{
|
||||
return $this->class;
|
||||
}
|
||||
|
||||
|
||||
function resizeWidth()
|
||||
{
|
||||
$pref = e107::getPref();
|
||||
if($this->class && vartrue($pref['resize_dimensions'][$this->class.'-bbcode']['w']))
|
||||
{
|
||||
return $pref['resize_dimensions'][$this->class.'-bbcode']['w'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function resizeHeight()
|
||||
{
|
||||
$pref = e107::getPref();
|
||||
if($this->class && vartrue($pref['resize_dimensions'][$this->class.'-bbcode']['h']))
|
||||
{
|
||||
return $pref['resize_dimensions'][$this->class.'-bbcode']['h'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// return the class for a bbcode
|
||||
function getClass($type='')
|
||||
{
|
||||
@@ -509,6 +536,25 @@ class e_bbcode
|
||||
*/
|
||||
function htmltoBBcode($text)
|
||||
{
|
||||
|
||||
$text = preg_replace("/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/i","[link=$1]$2[/link]",$text);
|
||||
$text = preg_replace('/<div style="text-align: ([\w]*);">([\s\S]*)<\/div>/i',"[$1]$2[/$1]",$text); // verified
|
||||
$text = preg_replace('/<div class="bbcode-(?:[\w]*)" style="text-align: ([\w]*);">([\s\S]*)<\/div>/i',"[$1]$2[/$1]",$text); // left / right / center
|
||||
$text = preg_replace('/<img(?:\s*)?(?:style="([^"]*)")?\s?(?:src="([^"]*)")(?:\s*)?(?:alt="(\S*)")?(?:\s*)?(?:width="([\d]*)")?\s*(?:height="([\d]*)")?(?:\s*)?\/>/i',"[img style=width:$4px;height:$5px;$1]$2[/img]",$text );
|
||||
$text = preg_replace('/<img class="(?:[^"]*)"(?:\s*)?(?:style="([^"]*)")?\s?(?:src="([^"]*)")(?:\s*)?(?:alt="(\S*)")?(?:\s*)?(?:width="([\d]*)")?\s*(?:height="([\d]*)")?(?:\s*)?\/>/i',"[img style=width:$4px;height:$5px;$1]$2[/img]",$text );
|
||||
// $text = preg_replace('/<span (?:class="bbcode-color" )?style=\"color: ?(.*?);\">(.*?)<\/span>/i',"[color=$1]$2[/color]",$text);
|
||||
$text = preg_replace('/<span (?:class="bbcode underline bbcode-u" )?style="text-decoration: underline;">(.*?)<\/span>/i',"[u]$1[/u]",$text);
|
||||
// $text = preg_replace('/<table([^"]*)>/i', "[table $1]",$text);
|
||||
$text = preg_replace('/<table style="([^"]*)"([\w ="]*)?>/i', "[table style=$1]\n",$text);
|
||||
$text = preg_replace('/<table([\w :\-_;="]*)?>/i', "[table]\n",$text);
|
||||
$text = preg_replace('/<tbody([\w ="]*)?>/i', "[tbody]\n",$text);
|
||||
$text = preg_replace('/<code([\w :\-_;="]*)?>/i', "[code]\n",$text);
|
||||
|
||||
$ehttp = str_replace("/",'\/',e_HTTP);
|
||||
$text = preg_replace('/thumb.php\?src='.$ehttp.'([^&]*)([^\[]*)/i', "$1",$text);
|
||||
$text = preg_replace('/thumb.php\?src=([^&]*)([^\[]*)/i', "$1",$text);
|
||||
|
||||
|
||||
//return $text;
|
||||
$convert = array(
|
||||
array( "\n", '<br />'),
|
||||
@@ -548,31 +594,40 @@ class e_bbcode
|
||||
array( "[/td]", '</td>'),
|
||||
array( "[blockquote]", '<blockquote>'),
|
||||
array( "[blockquote]", '<blockquote class="indent bbcode-blockquote">'),
|
||||
array( "[/blockquote]",'</blockquote>')
|
||||
array( "[/blockquote]",'</blockquote>'),
|
||||
array( "]", ' style=]')
|
||||
|
||||
);
|
||||
|
||||
// thumb.php?src
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
foreach($convert as $arr)
|
||||
{
|
||||
$repl[] = $arr[0];
|
||||
$srch[] = $arr[1];
|
||||
}
|
||||
|
||||
$text = preg_replace("/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/i","[link=$1]$2[/link]",$text);
|
||||
$text = preg_replace('/<div style="text-align: ([\w]*);">([\s\S]*)<\/div>/i',"[$1]$2[/$1]",$text); // verified
|
||||
$text = preg_replace('/<div class="bbcode-(?:[\w]*)" style="text-align: ([\w]*);">([\s\S]*)<\/div>/i',"[$1]$2[/$1]",$text); // left / right / center
|
||||
$text = preg_replace('/<img(?:\s*)?(?:style="([^"]*)")?\s?(?:src="([^"]*)")(?:\s*)?(?:alt="(\S*)")?(?:\s*)?(?:width="([\d]*)")?\s*(?:height="([\d]*)")?(?:\s*)?\/>/i',"[img style=width:$4px;height:$5px;$1]$2[/img]",$text );
|
||||
$text = preg_replace('/<img class="bbcode bbcode-img"(?:\s*)?(?:style="([^"]*)")?\s?(?:src="([^"]*)")(?:\s*)?(?:alt="(\S*)")?(?:\s*)?(?:width="([\d]*)")?\s*(?:height="([\d]*)")?(?:\s*)?\/>/i',"[img style=width:$4px;height:$5px;$1]$2[/img]",$text );
|
||||
// $text = preg_replace('/<span (?:class="bbcode-color" )?style=\"color: ?(.*?);\">(.*?)<\/span>/i',"[color=$1]$2[/color]",$text);
|
||||
$text = preg_replace('/<span (?:class="bbcode underline bbcode-u" )?style="text-decoration: underline;">(.*?)<\/span>/i',"[u]$1[/u]",$text);
|
||||
// $text = preg_replace('/<table([^"]*)>/i', "[table $1]",$text);
|
||||
$text = preg_replace('/<table style="([^"]*)"([\w ="]*)?>/i', "[table style=$1]\n",$text);
|
||||
$text = preg_replace('/<table([\w :\-_;="]*)?>/i', "[table]\n",$text);
|
||||
$text = preg_replace('/<tbody([\w ="]*)?>/i', "[tbody]\n",$text);
|
||||
$text = preg_replace('/<code([\w :\-_;="]*)?>/i', "[code]\n",$text);
|
||||
|
||||
$paths = array(
|
||||
e107::getFolder('images'),
|
||||
e107::getFolder('plugins'),
|
||||
e107::getFolder('media_images'),
|
||||
e107::getFolder('media_files'),
|
||||
e107::getFolder('media_videos')
|
||||
);
|
||||
|
||||
$tp = e107::getParser();
|
||||
foreach($paths as $k=>$path)
|
||||
{
|
||||
$srch[] = $path;
|
||||
$repl[] = $tp->createConstants($path);
|
||||
}
|
||||
|
||||
|
||||
$blank = array('</li>','width:px;height:px;',"</p>","<p>");
|
||||
$text = str_replace($blank,"",$text); // Cleanup
|
||||
|
||||
|
@@ -485,12 +485,29 @@ class e_media
|
||||
|
||||
$srch = array("{MEDIA_URL}","{MEDIA_PATH}");
|
||||
|
||||
$w = false;
|
||||
$h = false;
|
||||
|
||||
if($bbcode)
|
||||
{
|
||||
e107::getBB()->setClass($category);
|
||||
$w = e107::getBB()->resizeWidth(); // resize the image according to prefs.
|
||||
$h = e107::getBB()->resizeHeight();
|
||||
e107::getBB()->clearclass();
|
||||
}
|
||||
|
||||
|
||||
|
||||
$tp = e107::getParser();
|
||||
// e107::getParser()
|
||||
|
||||
foreach($images as $im)
|
||||
{
|
||||
$class = ($category !='_icon') ? "media-select-image" : "media-select-icon";
|
||||
$media_path = e107::getParser()->replaceConstants($im['media_url'],'full');
|
||||
$realPath = e107::getParser()->thumbUrl($im['media_url'], $att);
|
||||
$diz = e107::getParser()->toAttribute($im['media_title']);
|
||||
$media_path = ($w || $h) ? $tp->thumbUrl($im['media_url'], "w={$w}&h={$h}") : $tp->replaceConstants($im['media_url'],'full'); // max-size
|
||||
|
||||
$realPath = $tp->thumbUrl($im['media_url'], $att);
|
||||
$diz = $tp->toAttribute($im['media_title']);
|
||||
$repl = array($im['media_url'],$media_path);
|
||||
|
||||
if($bbcode == null) // e107 Media Manager
|
||||
|
@@ -14,7 +14,9 @@ require_once("../../../../class2.php");
|
||||
|
||||
if($_POST['mode'] == 'tohtml')
|
||||
{
|
||||
echo $tp->toHtml($_POST['content'],true);
|
||||
e107::getBB()->setClass($_SESSION['media_category']);
|
||||
echo $tp->toHtml($_POST['content'],true);
|
||||
e107::getBB()->clearClass();
|
||||
}
|
||||
|
||||
if($_POST['mode'] == 'tobbcode')
|
||||
|
@@ -305,7 +305,7 @@ class wysiwyg
|
||||
|
||||
// if(!in_array('e107bbcode',$plug_array))
|
||||
{
|
||||
$this->config['cleanup_callback'] = 'tinymce_e107Paths';
|
||||
$this->config['cleanup_callback'] = 'tinymce_e107Paths';
|
||||
}
|
||||
|
||||
$paste_plugin = (strpos($config['tinymce_plugins'],'paste')!==FALSE) ? TRUE : FALSE;
|
||||
|
Reference in New Issue
Block a user