function wysiwyg_update_5201 in Wysiwyg 5.2
Update enabled font plugin buttons to default plugin in TinyMCE profiles.
File
- ./
wysiwyg.install, line 193
Code
function wysiwyg_update_5201() {
$ret = array();
$results = db_query("SELECT format, settings FROM {wysiwyg} WHERE editor = 'tinymce'");
while ($profile = db_fetch_object($results)) {
$settings = unserialize($profile->settings);
// Move enabled 'font' buttons into 'default' plugin buttons.
$changed = FALSE;
foreach (array(
'formatselect',
'fontselect',
'fontsizeselect',
'styleselect',
) as $button) {
if (isset($settings['buttons']['font'][$button])) {
$settings['buttons']['default'][$button] = $settings['buttons']['font'][$button];
unset($settings['buttons']['font'][$button]);
$changed = TRUE;
}
}
if ($changed) {
// We can't use update_sql() here because of curly braces in serialized
// array.
db_query("UPDATE {wysiwyg} SET settings='%s' WHERE format = '%s'", array(
serialize($settings),
$profile->format,
));
}
}
$ret[] = array(
'success' => TRUE,
'query' => 'TinyMCE profiles have been updated.',
);
return $ret;
}