Part 1
Firstly, we need to set the font for the editor. You'll need to create a style sheet (.css) file. Just put this code into it (or whatever style you want):
body {
font-family: verdana;
font-size: 10pt;
}Then open up /admin/includes/classes/class.editor.php and find:
$myDE = new devedit;
and on a new line after that, put:
$myDE->SetSnippetStyleSheet("http://www.site.com/path/to/mystyle.css");
Put the URL of the style sheet file you created just before.
Part 2
Then the next part we strip out any other fonts the user may have put in. So open up /admin/includes/classes/class.engine.php and find:
if($k != "wysiwyg" && $k != "filedata" && gettype($_POST[$k]) == "string"){
$_POST[$k] = htmlspecialchars_utf8($v);
}then after that (but before the next } ) place this code:
if($k == "wysiwyg"){
$patterns[0] = '/\<font([^>])*face\="([^"]*)"/i';
$patterns[1] = '/\<([\w]+) style="([^"]*)font-family\:[^;"]*[;]?([^"]*)"/i';
$patterns[2] = '/\<([\w]+) style=" "/i';
$replacements[0] = '<font $1';
$replacements[1] = '<$1 style="$2 $3"';
$replacements[2] = '<$1';
$v = preg_replace($patterns, $replacements, $v);
$_POST[$k] = $v;
}That strips out all fonts used. Although when using the editor they CAN select different fonts, that will be removed in this code after submission.
If you want to impose the same font limitation for authors who submit through the public-area login, open up /includes/classes/class.sanatize.php and find:
if(isset($_POST['wysiwyg_html'])){
$_POST['wysiwyg'] = $_POST['wysiwyg_html'];
}and add this code after it:
$patterns[0] = '/\<font([^>])*face\="([^"]*)"/i'; $patterns[1] = '/\<([\w]+) style="([^"]*)font-family\:[^;"]*[;]?([^"]*)"/i'; $patterns[2] = '/\<([\w]+) style=" "/i'; $replacements[0] = '<font $1'; $replacements[1] = '<$1 style="$2 $3"'; $replacements[2] = '<$1'; $_POST['wysiwyg'] = preg_replace($patterns, $replacements, $_POST['wysiwyg']);
Now you can go to your style file for the public area and change the font to verdana. E.g. open up /templates/{your-template}/Styles/styles.css and find all the "font-family:" sections and change the relevant ones to Verdana.
Also, because you've set the fonts in the style sheets, and not hard coded it into every submission (we're actually removing the fonts from them), should you ever want to change fonts, its just a matter of editing the style sheets and everything will display how you want.
