<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[TinyMCE Forum - Url encoding and php tag fix details here]]></title>
		<link>http://www.tinymce.com/forum/viewtopic.php?id=3460</link>
		<description><![CDATA[The most recent posts in Url encoding and php tag fix details here.]]></description>
		<lastBuildDate>Sat, 13 May 2006 17:08:14 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Url encoding and php tag fix details here]]></title>
			<link>http://www.tinymce.com/forum/viewtopic.php?pid=11596#p11596</link>
			<description><![CDATA[<p>Thanks!&nbsp; This might fix the exact problem I am having here:</p><p><a href="http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=11415#p11415">http://tinymce.moxiecode.com/punbb/view &#133; 415#p11415</a></p><p><img src="http://www.tinymce.com/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (hstraf)]]></author>
			<pubDate>Sat, 13 May 2006 17:08:14 +0000</pubDate>
			<guid>http://www.tinymce.com/forum/viewtopic.php?pid=11596#p11596</guid>
		</item>
		<item>
			<title><![CDATA[Url encoding and php tag fix details here]]></title>
			<link>http://www.tinymce.com/forum/viewtopic.php?pid=11586#p11586</link>
			<description><![CDATA[<p>Okay, I like many others on here wanted a fix to stop TinyMCE from encoding the URL&#039;s and the encoding of &lt;? code tags in URL&#039;s. </p><p>Here&#039;s how....</p><p>In code protect pluggin directory (codeprotect) open the file editor_plugin.js and paste the code below over the top of the existing</p><div class="codebox"><pre><code>/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack(&#039;codeprotect&#039;, &#039;en&#039;); // &lt;- Add a comma separated list of all supported languages

/****
 * 
 * I&#039;m not even gonna copyright this, that&#039;s just silly.
 *
 * Feel free to improve on this code and re-upload it.
 * 
 * Tijmen Schep, Holland, 9-10-2005
 * 
 * 
 ****/



/**
 * Gets executed when contents is inserted / retrived.
 */
function TinyMCE_codeprotect_cleanup(type, content) {
    switch (type) {
        case &quot;get_from_editor&quot;:

content = content.replace(/&lt;!--CODE/gi, &quot;&lt;?&quot;);
content = content.replace(/CODE--&gt;/gi, &quot;?&gt;&quot;);
//code protect html source fix
content = content.replace(/&lt;!--CODE/gi, &quot;&lt;?&quot;);
content = content.replace(/CODE--&gt;/gi, &quot;?&gt;&quot;);
content = content.replace(/&lt;\?/gi, &quot;&lt;?&quot;);
content = content.replace(/\?&gt;/gi, &quot;?&gt;&quot;);
//firefox javascript mceNonEditable insert fix
content = content.replace(/&amp;quot;mceNonEditable&amp;quot;/gi, &quot;mceNonEditable&quot;);
//url encoding fix
content = content.replace(/&#039;/gi, &quot;&#039;&quot;);
content = content.replace(/&quot;/gi, &#039;&quot;&#039;);

            break;

        case &quot;insert_to_editor&quot;:
            
content = content.replace(/&lt;\?/gi, &quot;&lt;!--CODE&quot;);
content = content.replace(/\?&gt;/gi, &quot;CODE--&gt;&quot;);
//code protect html source fix
content = content.replace(/&lt;\?/gi, &quot;&lt;!--CODE&quot;);
content = content.replace(/\?&gt;/gi, &quot;CODE--&gt;&quot;);
//firefox fix
content = content.replace(/&amp;quot;mceNonEditable&amp;quot;/gi, &quot;mceNonEditable&quot;);
//url encoding fix
content = content.replace(/&#039;/gi, &quot;&#039;&quot;);
content = content.replace(/&quot;/gi, &#039;&quot;&#039;);


            break;

        case &quot;get_from_editor_dom&quot;:

            // Do custom cleanup code here. THIS PLUGIN DOESN&#039;T USE THIS

            break;

        case &quot;insert_to_editor_dom&quot;:

            // Do custom cleanup code here. BUT I LEFT IT IN ANYWAY..

            break;
    }

    return content;
}</code></pre></div><p>This will fix the php code protect problem in the source code within urls e.g. link.php?id=&quot;&lt;!--CODE echo &#039;something&#039;; CODE--&gt;&quot; to link.php?id=&lt;?php echo &#039;something&#039;; ?&gt;</p><p>It will also fix the encoding of URL&#039;s e.g. link.php?id=&lt;?php echo &quot;something&quot;; ?&gt; to link.php?id=&lt;?php echo &#039;something&#039;; ?&gt;</p><p>And fix encoding of javascript within a link e.g. javascript:function(&quot;hello&quot;,1); to javascript:function(&#039;hello&#039;,1);</p><p>Yes, I know links can be encoded and are suppose to be encoded with the new XML format. But if you are using php and javascript then it becomes a bug! The only value that should be encoded within URL&#039;s are &amp; and possible &quot;.</p><p>If you still want to enforce the encoding of URL&#039;s but want the code protect to work. Then add this to your init:</p><p>tinyMCE.init({<br />&nbsp; &nbsp; ...<br />&nbsp; &nbsp; encoding : &quot;xml&quot;<br />});</p><p>The above will encode any XML string escaping characters such as &lt; &gt; &quot; &amp; to &lt; &gt; &quot; &amp;.</p><p>INPORTANT NOTE: The bulletin changes (&amp; # 39; minus the spaces to &#039;) so in the code above content = content.replace(/&#039;/gi, &quot;&#039;&quot;); it should be content = content.replace(/&amp; # 39/gi, &quot;&#039;&quot;); minus the spaces</p>]]></description>
			<author><![CDATA[dummy@example.com (phantomkiwi)]]></author>
			<pubDate>Sat, 13 May 2006 05:22:12 +0000</pubDate>
			<guid>http://www.tinymce.com/forum/viewtopic.php?pid=11586#p11586</guid>
		</item>
	</channel>
</rss>
