mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 01:19:44 +01:00
Issue #4471
This commit is contained in:
parent
920a881898
commit
2862e18db9
@ -1666,15 +1666,29 @@ class media_admin_ui extends e_admin_ui
|
||||
|
||||
private function mediaManagerPlaceholders()
|
||||
{
|
||||
$type = (E107_DEBUG_LEVEL > 0) ? 'text' : 'hidden';
|
||||
$br = (E107_DEBUG_LEVEL > 0) ? "<br style='clear:both' />" : '';
|
||||
$type = (E107_DEBUG_LEVEL > 0) ? 'text' : 'hidden';
|
||||
|
||||
|
||||
$valueHolders = [
|
||||
'bbcode_holder' => 'bbcode',
|
||||
'html_holder' => 'html/wysiwyg',
|
||||
'src' => '(preview) src',
|
||||
'path' => 'path (save to db)'
|
||||
];
|
||||
|
||||
$text = '';
|
||||
foreach($valueHolders as $name => $label)
|
||||
{
|
||||
$text .= (E107_DEBUG_LEVEL > 0) ? "<br /><span style='margin-left:20px;display:inline-block;width:150px'>".$label." </span>" : '';
|
||||
$text .= "<input title='".$label."' type='{$type}' readonly style='width:800px' class='' id='".$name."' name='".$name."' value='' />\n";
|
||||
|
||||
}
|
||||
|
||||
if(E107_DEBUG_LEVEL > 0)
|
||||
{
|
||||
$text .= "<br /><span style='margin-left:20px;display:inline-block;width:150px'>FontAwesome</span>".e107::getTheme()->getFontAwesome();
|
||||
}
|
||||
|
||||
$text = '
|
||||
' .$br."<input title='bbcode' type='{$type}' style=readonly='readonly' class='span11 col-md-11' id='bbcode_holder' name='bbcode_holder' value='' />
|
||||
".$br."<input title='html/wysiwyg' type='{$type}' class='span11 col-md-11' readonly='readonly' id='html_holder' name='html_holder' value='' />
|
||||
".$br."<input title='(preview) src' type='{$type}' class='span11 col-md-11' readonly='readonly' id='src' name='src' value='' />
|
||||
".$br."<input title='path (saved to db)' type='{$type}' class='span11 col-md-11' readonly='readonly' id='path' name='path' value='' />
|
||||
";
|
||||
|
||||
return $text;
|
||||
}
|
||||
@ -2117,21 +2131,24 @@ class media_admin_ui extends e_admin_ui
|
||||
|
||||
}
|
||||
|
||||
$fa4 = e107::getMedia()->getGlyphs('fa4');
|
||||
|
||||
foreach($fa4 as $val)
|
||||
if($this->fontawesome === 4)
|
||||
{
|
||||
$items[] = array(
|
||||
'previewHtml' => $md->previewTag('fa-'.$val,array('type'=>'glyph')),
|
||||
'previewUrl' => 'fa fa-'.$val,
|
||||
'saveValue' => 'fa-'.$val.'.glyph',
|
||||
'thumbUrl' => 'fa-'.$val,
|
||||
'title' => 'FA4 '.$val,
|
||||
'slideCaption' => 'Font-Awesome 4',
|
||||
'slideCategory' => 'font-awesome'
|
||||
);
|
||||
}
|
||||
e107::getParser()->setFontAwesome(4);;
|
||||
$fa4 = e107::getMedia()->getGlyphs('fa4');
|
||||
|
||||
foreach($fa4 as $val)
|
||||
{
|
||||
$items[] = array(
|
||||
'previewHtml' => $md->previewTag('fa-'.$val, array('type'=>'glyph')),
|
||||
'previewUrl' => 'fa fa-'.$val,
|
||||
'saveValue' => 'fa-'.$val.'.glyph',
|
||||
'thumbUrl' => 'fa-'.$val,
|
||||
'title' => 'FA4 '.$val,
|
||||
'slideCaption' => 'Font-Awesome 4',
|
||||
'slideCategory' => 'font-awesome'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if($this->fontawesome === false || ($this->fontawesome < 4))
|
||||
{
|
||||
|
@ -1103,6 +1103,15 @@ class e_theme
|
||||
|
||||
unset($vars['libraries']);
|
||||
}
|
||||
else // detect defined constants in legacy theme.php file.
|
||||
{
|
||||
if($data = self::getLegacyBSFA($path))
|
||||
{
|
||||
$vars['library'] = $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(!empty($vars['stylesheets']['css']))
|
||||
{
|
||||
@ -1158,6 +1167,37 @@ class e_theme
|
||||
return $vars;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read legacy bootstrap/fontawesome constants from theme.php
|
||||
* @param string $path theme directory
|
||||
*/
|
||||
public static function getLegacyBSFA($path)
|
||||
{
|
||||
if(!$content = file_get_contents(e_THEME.$path.'/theme.php'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$ret = [];
|
||||
|
||||
if(preg_match('/define[ ]*?\([\'|"]BOOTSTRAP[\'|"],[ \t]*(\d)\);/', $content, $m))
|
||||
{
|
||||
$ret[] = array('name' => 'bootstrap',
|
||||
'version' => $m[1],
|
||||
'scope' => 'front,wysiwyg',
|
||||
);
|
||||
}
|
||||
|
||||
if(preg_match('/define[ ]*?\([\'|"]FONTAWESOME[\'|"],[ \t]*(\d)\);/', $content, $m))
|
||||
{
|
||||
$ret[] = array('name' => 'fontawesome',
|
||||
'version' => $m[1],
|
||||
'scope' => 'front,wysiwyg',
|
||||
);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate and return the name of the categories.
|
||||
|
@ -114,7 +114,9 @@ TEMPL;
|
||||
public function toHTML($content)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
// XXX @Cam possible fix - convert to BB first, see news admin AJAX request/response values for reference why
|
||||
$fa = e107::getTheme()->getFontAwesome(); // get the frontend theme's fontawesome version.
|
||||
$tp->setFontAwesome($fa);
|
||||
|
||||
$content = stripslashes($content);
|
||||
|
||||
// $content = e107::getBB()->htmltoBBcode($content); //XXX This breaks inserted images from media-manager. :/
|
||||
|
@ -943,12 +943,12 @@ class wysiwyg
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getEditorCSS()
|
||||
public function getEditorCSS($theme = 'front')
|
||||
{
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
$libraries = e107::getTheme('admin')->getThemeFiles('library', 'wysiwyg');
|
||||
$libraries = e107::getTheme($theme)->getThemeFiles('library', 'wysiwyg');
|
||||
|
||||
$ret = [];
|
||||
|
||||
@ -967,7 +967,7 @@ class wysiwyg
|
||||
|
||||
if($useThemeStyle)
|
||||
{
|
||||
$theme = e107::getTheme()->getThemeFiles('css', 'wysiwyg');
|
||||
$theme = e107::getTheme($theme)->getThemeFiles('css', 'wysiwyg');
|
||||
if(!empty($theme['css']))
|
||||
{
|
||||
foreach($theme['css'] as $path)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,83 +1,107 @@
|
||||
<?php
|
||||
|
||||
|
||||
class wysiwygTest extends \Codeception\Test\Unit
|
||||
class wysiwygTest extends \Codeception\Test\Unit
|
||||
{
|
||||
|
||||
/** @var wysiwyg */
|
||||
protected $tm;
|
||||
|
||||
protected function _before()
|
||||
{
|
||||
|
||||
/** @var wysiwyg */
|
||||
protected $tm;
|
||||
|
||||
protected function _before()
|
||||
require_once(e_PLUGIN . "tinymce4/wysiwyg_class.php");
|
||||
try
|
||||
{
|
||||
require_once(e_PLUGIN."tinymce4/wysiwyg_class.php");
|
||||
try
|
||||
$this->tm = $this->make('wysiwyg');
|
||||
}
|
||||
|
||||
catch(Exception $e)
|
||||
{
|
||||
$this->assertTrue(false, $e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function testGetExternalPlugins()
|
||||
{
|
||||
$this->tm = $this->make('wysiwyg');
|
||||
|
||||
}
|
||||
|
||||
catch(Exception $e)
|
||||
public function testConvertBoolean()
|
||||
{
|
||||
$this->assertTrue(false, $e->getMessage());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
public function testGetExternalPlugins()
|
||||
public function test__construct()
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
public function testGetEditorCSS()
|
||||
{
|
||||
|
||||
$tests = array(
|
||||
'bootstrap3' => array(
|
||||
0 => '/e107_web/lib/bootstrap/3/css/bootstrap.min.css',
|
||||
1 => '/e107_web/lib/font-awesome/5/css/all.min.css',
|
||||
2 => '/e107_web/lib/font-awesome/5/css/v4-shims.min.css',
|
||||
3 => '/e107_web/lib/animate.css/animate.min.css',
|
||||
4 => '/e107_plugins/tinymce4/editor.css',
|
||||
),
|
||||
'voux' => array (
|
||||
0 => '/e107_web/lib/bootstrap/3/css/bootstrap.min.css',
|
||||
1 => '/e107_web/lib/font-awesome/4.7.0/css/font-awesome.min.css',
|
||||
2 => '/e107_web/lib/animate.css/animate.min.css',
|
||||
3 => '/e107_plugins/tinymce4/editor.css',
|
||||
)
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
||||
foreach($tests as $themedir => $expected)
|
||||
{
|
||||
$result = $this->tm->getEditorCSS($themedir);
|
||||
|
||||
}
|
||||
if(empty($expected))
|
||||
{
|
||||
var_export($result);
|
||||
continue;
|
||||
}
|
||||
|
||||
public function testConvertBoolean()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function test__construct()
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
public function testGetEditorCSS()
|
||||
{
|
||||
$expected = array (
|
||||
0 => '/e107_web/lib/bootstrap/3/css/bootstrap.min.css',
|
||||
1 => '/e107_web/lib/font-awesome/5/css/all.min.css',
|
||||
2 => '/e107_web/lib/font-awesome/5/css/v4-shims.min.css',
|
||||
3 => '/e107_web/lib/animate.css/animate.min.css',
|
||||
4 => '/e107_plugins/tinymce4/editor.css',
|
||||
);
|
||||
|
||||
$result = $this->tm->getEditorCSS();
|
||||
$this->assertSame($expected, $result);
|
||||
|
||||
}
|
||||
/*
|
||||
public function testGetTemplates()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testFilter_plugins()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderConfig()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testTinymce_lang()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGetConfig()
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
public function testGetTemplates()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testFilter_plugins()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderConfig()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testTinymce_lang()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testGetConfig()
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user