1
maxima
TinyEditor 1.0 problems
  • 2006/9/8 14:26

  • maxima

  • Not too shy to talk

  • Posts: 152

  • Since: 2006/3/4 4


TinyEditor is working great as block editor with 2.0.15 but the HTML source editor tool it has corrupts PHP codes and JavaScript so it doesn't work on the page it's assigned.

This
if (@include('/home/u1/icecream/html/banners/phpadsnew.inc.php')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ('', 4, '', '', '0', $phpAds_context); echo $phpAds_raw['html']; }

Which is supposed to deliver an ad banner become this

Resized Image

and does not display.

Is there a way to get the editor to properly process these scripts?

2
frankblack
Re: TinyEditor 1.0 problems
  • 2006/9/8 14:35

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Quote:
Is there a way to get the editor to properly process these scripts?


Not yet! There IS a php-plugin out there, but I have to try this first.

The tinyMCE-engine has its own kind of sanitizer that cleans all "doubtful" tags so this is the reason why PHP breaks.

Secondly you have the problem that the block will be save per-default as a html-block. I wonder if it is working to make it a php-block.

Link to the plugin

But this may help you too much atm, because adding "unknown" plugins is quite tricky atm, but I am working on that.

3
maxima
Re: TinyEditor 1.0 problems
  • 2006/9/8 16:21

  • maxima

  • Not too shy to talk

  • Posts: 152

  • Since: 2006/3/4 4


Thanks for the response frankblack. I have downloaded but not finding the file with tinymce.init to edit the plugin line. Please advise.

Quote:

Add the php plugin to the plugins line in your tinyMCE.init

At this time there is one configurable option which is the url
to the list of pre-programmed "snipets" of php code which you wish
to have appear in the php popup dialog. The path shown is to the
example I have included with this distribution.

tinyMCE.init({
plugins : "php",
php_external_list_url : "./tinymce/jscripts/tiny_mce/plugins/php/examples/example_php_list.js",
});

4
frankblack
Re: TinyEditor 1.0 problems
  • 2006/9/8 17:50

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Have a look at tinyeditor / include / initcode.php, but I would not advise to place it there, because then every group will have the php-plugin. Better use phpMyAdmin (backup first) to edit the toolset table of tinyeditor.

Example for webmaster group, plugin will appear in first row (tinyed_gid where value is 1):
Type in the word php in field tinyedrow1 and type in the word php in field activeplugs. <- hope this works!

Next version will recognize automatically the plugins in the plugin folder, but for now...

5
maxima
Re: TinyEditor 1.0 problems
  • 2006/9/8 20:25

  • maxima

  • Not too shy to talk

  • Posts: 152

  • Since: 2006/3/4 4


That datbase adjustment displayed the plugin and it does execute, but now it adds a path before the code and again causing it to not display on the page. Note the path before the code:
Quote:

/modules/system/if (@include('/home/u1/icecream/html/banners/phpadsnew.inc.php')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ('', 5, '', '', '0', $phpAds_context); echo $phpAds_raw['html']; }

6
frankblack
Re: TinyEditor 1.0 problems
  • 2006/9/9 13:26

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Have a look at THIS!

Just write a javascript-regex-replace when it comes to saving. Only problem you cannot use save_callback when relative urls are enabled, because only ONE save_callback can be executed at a time.

HTH

P.S.: save_callback must be in initcode.php inside the javascript init. Just look where the save_callback for relative urls is placed.

7
maxima
Re: TinyEditor 1.0 problems
  • 2006/9/9 15:13

  • maxima

  • Not too shy to talk

  • Posts: 152

  • Since: 2006/3/4 4


The snippet sample is logical but I don't know what to do with it.

I found the save_callback in initcode.php on line 238 which looks like this
Quote:

if ($moduleConfig['tinyedrelurls'] == '1') {
echo 'setupcontent_callback : "plugin_regexrep_setup",';
echo 'save_callback : "plugin_regexrep_save",';
}


but what do I do with this to save PHP
Quote:

function myCustomSaveContent(element_id, html, body) {
// Do some custom HTML cleanup
html = html.replace(/a/g,'b');

return html;
}

tinyMCE.init({
...
save_callback : "myCustomSaveContent"
});


I am not a programmer but I do follow specific instructions well... something I picked up from the military... so if you layout the steps to implement this I'll be fine.
Thanks

8
frankblack
Re: TinyEditor 1.0 problems
  • 2006/9/9 16:46

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


I am not a master at regexp, so forgive if this not working, but it is worth a try!

The function should look like this:

echo "function myCustomSaveContent(element_id, html, body) {";
echo 
"html = html.replace(/modules/system/,'');";
echo 
"return html;";
echo 
"}";

echo 
'save_callback : "myCustomSaveContent",';


Just place it under this code:
if ($moduleConfig['tinyedrelurls'] == '1') {
echo 
'setupcontent_callback : "plugin_regexrep_setup",';
echo 
'save_callback : "plugin_regexrep_save",';
}


Hope this works for you!

9
maxima
Re: TinyEditor 1.0 problems
  • 2006/9/9 22:07

  • maxima

  • Not too shy to talk

  • Posts: 152

  • Since: 2006/3/4 4


The path still appear. I placed the snippet before the close bracket and the path showed then I placed it after the close bracket and the editor buttons went away, only the textarea displayed.
if ($moduleConfig['tinyedrelurls'] == '1') {
            echo 
'setupcontent_callback : "plugin_regexrep_setup",';
            echo 
'save_callback : "plugin_regexrep_save",';

        echo 
"function myCustomSaveContent(element_id, html, body) {";
        echo 
"html = html.replace(/modules/system/,'');";
        echo 
"return html;";
        echo 
"}";

        echo 
'save_callback : "myCustomSaveContent",';
        }

10
frankblack
Re: TinyEditor 1.0 problems
  • 2006/9/10 11:49

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Oops, wrong thinking, sorry!

The code should like this in initcode:

echo '.XOOPS_URL.'/modules/tinyeditor/editor/'.$tinyededitor_load.'">';
[
color=33FF33]echo "function myCustomSaveContent(element_id, html, body) {";
echo 
"html = html.replace(/modules/system/,'');";
echo 
"return html;";
echo 
"}";[/color]


AND:

echo '';
echo 
'tinyMCE.init({';
echo 
'mode : "textareas",';
echo 
'editor_selector : "mceEditor",';
echo 
'theme : "advanced",';
echo 
'language : "'.$moduleConfig['tinyedlang'].'",';
[
color=33FF33]echo 'save_callback : "myCustomSaveContent",';[/color]

Login

Who's Online

411 user(s) are online (72 user(s) are browsing Support Forums)


Members: 0


Guests: 411


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits