428872 PHP function: replace Word-trouble and format
N/A
Terminado
Publicado hace casi 14 años
N/A
Pagado a la entrega
I've a TinyMCE textarea with the next buttons:
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,forecolor,backcolor,|,undo,redo,|,bullist,|,outdent,indent,|,cut,copy,paste,|,charmap,|,spellchecker"
Now I'm searching for a PHP-function that (when a user will save the content in the textarea) strips the font-family, font-size, font-size-adjust, and other trouble after a copy-paste from Word.
Only the format behind the menubuttons (bold, ul, li, em, ....) are allowed.
As example:
This is my input:
<p><span style="font-size: small;"><span style="font-family: "Times New Roman","serif";">sdf<span style="color: #ff6600;">sdfdsf</span></span><span style="font-family: "Neuropol","sans-serif"; color: #ff6600; mso-bidi-font-family: 'Times New Roman';">as</span><span style="font-family: "Neuropol","sans-serif"; mso-bidi-font-family: 'Times New Roman';">dasdasd</span></span></p>
<p><span style="font-family: "Neuropol","sans-serif"; mso-bidi-font-family: 'Times New Roman';"><span style="font-size: small;"> </span></span></p>
<p><span style="font-family: "Neuropol","sans-serif"; mso-bidi-font-family: 'Times New Roman';"><span style="font-size: small;">sdfsdf<span style="color: #b8cce4; mso-themecolor: accent1; mso-themetint: 102;">sdfsdfsdf</span></span></span></p>
<ul>
<li>
<div><span style="font-family: "Arial","sans-serif"; color: #b8cce4; mso-themecolor: accent1; mso-themetint: 102;"><span style="font-size: small;">sadfsdfsdf</span></span></div>
</li>
<li>
<div><span style="font-family: "Arial","sans-serif"; color: #b8cce4; mso-themecolor: accent1; mso-themetint: 102;"><span style="font-size: small;">sdfsdfsdf</span></span></div>
</li>
<li>
<div><span style="font-family: "Arial","sans-serif"; color: #b8cce4; mso-themecolor: accent1; mso-themetint: 102;"><span style="font-size: small;"></span></span></div>
</li>
</ul>
This must be:
<p>sdf<span style="color: #ff6600;">sdfdsfas</span>dasdasd</p>
<p> </p>
<p>sdfsdf<span style="color: #b8cce4;">sdfsdfsdf</span></p>
<ul>
<li>
<div><span style="color: #b8cce4;">sadfsdfsdf</span></div>
</li>
<li>
<div><span style="color: #b8cce4;">sdfsdfsdf</span></div>
</li>
<li>
<div> </div>
</li>
</ul>
</body>
</html>