Witam
Głowię się już parę dni i nie wiem jak to naprawić.
Najlepiej pokażę na przykładzie:

Trzeba wejść na poniższą stronę:
Strona z FCK edytorem
Kliknąć "źródło dokumentu" i wkleić przykładowy kod:
Kod
<p>jakiś tekst</p>
<p></p>

Teraz kiedy ponownie klikniemy dwa razy "źródło dokumentu" zobaczymy, że edytor dodał spację &nbsp;

Pytałem na różnych forach Joomli i nikt nie potrafi mi pomóc.
Jak pomysłowy dobromił przypomniałem sobie, ze mam przecież kolegów z Forum PHP guitar.gif

Grzebałem w plikach JS i usunąłem wszystkie spację, ale problem nie ustąpił.
Może coś w pliku PHP trzeba coś zmajstrować czego nie udało mi się zauważyć.
Będę naprawdę wdzięczny za pomoc.

  1. <?php
  2. /*
  3.  * joomlafck2
  4.  *
  5.  * Copyright (C) 2007 Nick Miles - Database Developments Ltd
  6.  *
  7.  * == BEGIN LICENSE ==
  8.  *
  9.  * Licensed under the terms of any of the following licenses:
  10.  *
  11.  * - GNU General Public License Version 2 or later (the "GPL")
  12.  * <a href=\"http://www.gnu.org/licenses/gpl.html\" target=\"_blank\">http://www.gnu.org/licenses/gpl.html</a>
  13.  *
  14.  * == END LICENSE ==
  15. */
  16.  
  17. defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  18.  
  19. $_MAMBOTS->registerFunction( 'onInitEditor', 'botInitEditor' );
  20. $_MAMBOTS->registerFunction( 'onEditorArea', 'botEditorArea' );
  21. $_MAMBOTS->registerFunction( 'onGetEditorContents', 'botGetEditorContents' );
  22.  
  23. function botInitEditor() {
  24. global $mosConfig_live_site;
  25. return <<<EOD
  26. <script type="text/javascript" src="$mosConfig_live_site/mambots/editors/joomlafck2/fckeditor.js">
  27. </script>
  28. EOD;
  29. }
  30.  
  31. function botEditorArea( $name, $content, $hiddenField, $width, $height, $col, $row ) {
  32. global $mosConfig_live_site, $database, $option, $_MAMBOTS, $mosConfig_absolute_path;
  33.  
  34. $content = str_replace("&lt;", "<", $content);
  35. $content = str_replace("&gt;", ">", $content);
  36. $content = str_replace("&amp;", "&", $content);
  37. $content = str_replace("&nbsp;", " ", $content);
  38. $content = str_replace("&quot;", "\"", $content);
  39.  
  40.  
  41. $mainframe = new mosMainFrame( $database, $option, '.' );
  42.  
  43. $query = "SELECT id FROM #__mambots WHERE element = 'joomlafck2' AND folder = 'editors'";
  44. $database->setQuery( $query );
  45. $id = $database->loadResult();
  46. $mambot = new mosMambot( $database );
  47. $mambot->load( $id );
  48. $params =& new mosParameters( $mambot->params );
  49.  
  50. $toolbar = $params->get( 'toolbar', 'Default' );
  51. $wwidth = $params->get( 'wwidth', '100%' );
  52. $hheight = $params->get( 'hheight', '400' );
  53. $content_css = $params->get( 'content_css', 0 );
  54. $content_css_custom = $params->get( 'content_css_custom', '' );
  55.  
  56. if ( strpos( $width, '%' ) === false )
  57. $WidthCSS = $width . 'px' ;
  58. else
  59. $WidthCSS = $width ;
  60.  
  61. if ( strpos( $height, '%' ) === false )
  62. $HeightCSS = $height . 'px' ;
  63. else
  64. $HeightCSS = $height ;
  65.  
  66. if ( $content_css ) {
  67. $template = $mainframe->getTemplate(); // Can't be in the javascript generator, needs to be here
  68.  
  69. $file = $mosConfig_absolute_path ."/templates/". $template ."/css/editor_content.css";
  70. if ( file_exists( $file ) ) {
  71. $content_css = 'templates/'.$template.'/css/editor_content.css';
  72. } else {
  73. $content_css = 'templates/'.$template.'/css/template_css.css';
  74. }
  75. } else {
  76. if ( $content_css_custom ) {
  77. $content_css = $content_css_custom;
  78. } else {
  79. $content_css = 'mambots/editors/joomlafck2/editor/css/fck_editorarea.css';
  80. }
  81. }
  82.  
  83. $results = $_MAMBOTS->trigger( 'onCustomEditorButton' );
  84. $buttons = array();
  85. foreach ($results as $result) {
  86. if ( $result[0] ) {
  87. $buttons[] = '<img src="'.$mosConfig_live_site.'/mambots/editors-xtd/'.$result[0].'" onclick="InsertHTML(''.$hiddenField.'',''.$result[1].'')" />';
  88. }
  89. }
  90. $buttons = implode("", $buttons);
  91.  
  92. return <<<EOD
  93. <textarea name="$hiddenField" id="$hiddenField" cols="$col" rows="$row" style="width:{$WidthCSS}; height:{$HeightCSS};">$content</textarea>
  94.  
  95. <script type="text/javascript">
  96.  
  97. var oFCKeditor = new FCKeditor('$hiddenField');
  98.  
  99. oFCKeditor.BasePath = '$mosConfig_live_site/mambots/editors/joomlafck2/' ;
  100. oFCKeditor.Width = '$wwidth' ;
  101. oFCKeditor.Height = '$hheight' ;
  102. oFCKeditor.ToolbarSet = '$toolbar' ;
  103.  
  104. oFCKeditor.Config['EditorAreaCSS'] = '$mosConfig_live_site/$content_css';
  105. oFCKeditor.Config['StylesXmlPath']= '$mosConfig_live_site/mambots/editors/joomlafck2styles.xml.php?css_filename=$content_css' ;
  106. oFCKeditor.Config['CustomConfigurationsPath'] = '$mosConfig_live_site/mambots/editors/joomlafck2.js.php' ;
  107.  
  108. oFCKeditor.ReplaceTextarea() ;
  109.  
  110. function InsertHTML(field, value) {
  111. // Get the editor instance that we want to interact with.
  112. var oEditor = FCKeditorAPI.GetInstance(field) ;
  113.  
  114. // Check the active editing mode.
  115. if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )
  116. {
  117. // Insert the desired HTML.
  118. oEditor.InsertHtml( value ) ;
  119. }
  120. else
  121. alert( 'Please switch to WYSIWYG mode.' ) ;
  122. }
  123. </script>
  124. <br />
  125. <p>$buttons</p>
  126. EOD;
  127. }
  128.  
  129. function botGetEditorContents($editorArea, $hiddenField) {
  130.  
  131. }
  132. ?>