| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * CKEditor - The text editor for the Internet - http://ckeditor.com 4 * Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. 5 * 6 * == BEGIN LICENSE == 7 * 8 * Licensed under the terms of any of the following licenses of your 9 * choice: 10 * 11 * - GNU General Public License Version 2 or later (the "GPL") 12 * http://www.gnu.org/licenses/gpl.html 13 * 14 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") 15 * http://www.gnu.org/licenses/lgpl.html 16 * 17 * - Mozilla Public License Version 1.1 or later (the "MPL") 18 * http://www.mozilla.org/MPL/MPL-1.1.html 19 * 20 * == END LICENSE == 21 * 22 * @file 23 * CKEditor Module for Drupal 6.x 24 * 25 * This module allows Drupal to replace textarea fields with CKEditor. 26 * 27 * CKEditor is an online rich text editor that can be embedded inside web pages. 28 * It is a WYSIWYG (What You See Is What You Get) editor which means that the 29 * text edited in it looks as similar as possible to the results end users will 30 * see after the document gets published. It brings to the Web popular editing 31 * features found in desktop word processors such as Microsoft Word and 32 * OpenOffice.org Writer. CKEditor is truly lightweight and does not require any 33 * kind of installation on the client computer. 34 */ 35 36 /* 37 * Implementation of hook_install(). 38 * 39 * This will automatically install the database tables for the CKEditor module for both MySQL and PostgreSQL databases. 40 * 41 * If you are using another database, you will have to install the tables manually, using the queries below as a reference. 42 * 43 * Note that the curly braces around table names are a Drupal-specific feature to allow for automatic database table prefixing, 44 * and will need to be removed. 45 */ 46 function ckeditor_install() { 47 module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); 48 drupal_install_schema('ckeditor'); 49 50 //migration 51 //checking fck editor schema version 52 $rs=db_query("SELECT schema_version FROM {system} WHERE name='fckeditor'"); 53 $f_sv=FALSE; 54 if ($row = db_fetch_array($rs)) { 55 $f_sv=(int)$row['schema_version']; 56 } 57 58 //searching ckeditor.js 59 $editor_path = _ckeditor_script_path(); 60 61 switch ($f_sv) { 62 case 6201: 63 case 6202: 64 db_query("INSERT INTO {ckeditor_role}(name, rid) SELECT name, rid FROM {fckeditor_role}"); 65 $rs=db_query("SELECT * FROM {fckeditor_settings}"); 66 while ($row=db_fetch_array($rs)) { 67 $nname=str_replace(array('FCKeditor', 'fckeditor'), array('CKEditor', 'ckeditor'), $row['name']); 68 $settings=unserialize($row['settings']); 69 if (array_key_exists('js_conf', $settings)) { 70 unset($settings['js_conf']); 71 } 72 foreach ($settings as $k => $v) { 73 if (FALSE!==strpos($k, 'fckeditor')) { 74 unset($settings[$k]); 75 $k=str_replace('fckeditor', 'ckeditor', $k); 76 } 77 if ((!is_array($v))&&(FALSE!==strpos($v, 'fckeditor'))) { 78 $v=str_replace('fckeditor', 'ckeditor', $v); 79 } 80 if ($k == 'skin' && $v != 'office2003') { 81 $v = 'kama'; 82 } 83 if ($k == 'css_style' && $v != 'default') { 84 $v = 'default'; 85 } 86 if ($k == 'styles_path' && strlen($v) > 0) { 87 $v=''; 88 } 89 if ($editor_path && $k == 'ckeditor_path') { 90 $v=$editor_path; 91 } 92 $settings[$k]=$v; 93 } 94 if (!array_key_exists('excl', $settings)) { 95 $settings['excl']=''; 96 } 97 if (!array_key_exists('simple_incl', $settings)) { 98 $settings['simple_incl']=''; 99 } 100 $settings=serialize($settings); 101 db_query("INSERT INTO {ckeditor_settings}(name, settings) VALUES('%s', '%s')", $nname, $settings); 102 } 103 break; 104 default: 105 //create two default roles based on previous settings 106 db_query("INSERT INTO {ckeditor_role} (name, rid) VALUES ('%s', %d)", 107 "Default", defined('DRUPAL_ANONYMOUS_RID') ? DRUPAL_ANONYMOUS_RID : 1); 108 db_query("INSERT INTO {ckeditor_role} (name, rid) VALUES ('%s', %d)", 109 "Advanced", defined('DRUPAL_AUTHENTICATED_RID') ? DRUPAL_AUTHENTICATED_RID : 2); 110 111 //insert settings for default role 112 $arr = array(); 113 $arr['allow_user_conf'] = "f"; 114 $arr['min_rows'] = variable_get('ckeditor_minimum_rows', 1); 115 $arr['excl_mode'] = variable_get('ckeditor_exclude_toggle', 0); 116 $arr['filebrowser'] = 'none'; 117 $arr['quickupload'] = 'f'; 118 $arr['excl']=''; 119 $arr['simple_incl']=''; 120 121 //security 122 $arr['ss'] = "2"; 123 $arr['filters']['filter/0'] = 1; 124 125 //appearance 126 $arr['default'] = "t"; 127 $arr['show_toggle'] = "t"; 128 $arr['popup'] = variable_get('ckeditor_popup', 0) ? "t" : "f"; 129 $arr['skin'] = "kama"; 130 $arr['toolbar'] = " 131 [ 132 [ 'Format', 'Bold', 'Italic', '-', 'NumberedList','BulletedList', '-', 'Link', 'Unlink', 'Image' ] 133 ] 134 "; 135 $arr['expand'] = variable_get('ckeditor_toolbar_start_expanded', 1) ? "t" : "f"; 136 $arr['width'] = variable_get("ckeditor_width", "100%"); 137 $arr['lang'] = "en"; 138 $arr['auto_lang'] = "t"; 139 $arr['language_direction'] = "default"; 140 141 //output 142 $arr['enter_mode'] = "p"; 143 $arr['shift_enter_mode'] = "br"; 144 $arr['font_format'] = 'p;div;pre;address;h1;h2;h3;h4;h5;h6'; 145 $arr['format_source'] = "t"; 146 $arr['format_output'] = "t"; 147 $arr['custom_formatting'] = "f"; 148 $arr['formatting']['custom_formatting_options'] = array('indent' => 'indent', 'breakBeforeOpen' => 'breakBeforeOpen', 'breakAfterOpen' => 'breakAfterOpen', 'breakAfterClose' => 'breakAfterClose'); 149 150 //css 151 $arr['css_mode'] = "theme"; 152 $arr['css_path'] = variable_get("ckeditor_stylesheet", ""); 153 154 //upload 155 //get permissions here like in _update_role_permissions 156 $arr['filebrowser'] = "none"; 157 $arr['user_choose'] = "f"; 158 $arr['show_fieldnamehint'] = "t"; 159 $arr['ckeditor_load_method'] = "ckeditor.js"; 160 $arr['ckeditor_load_time_out'] = 0; 161 $arr['scayt_autoStartup'] = "f"; 162 163 db_query("INSERT INTO {ckeditor_settings} (name, settings) VALUES ('%s', '%s')", "Default", serialize($arr)); 164 165 //insert settings for advanced role 166 $arr['toolbar'] = " 167 [ 168 ['Source'], 169 ['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'], 170 ['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'], 171 ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','Iframe'], 172 ['Maximize', 'ShowBlocks'], 173 '/', 174 ['Format'], 175 ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], 176 ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], 177 ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiRtl','BidiLtr'], 178 ['Link','Unlink','Anchor','Linkit','LinkToNode','LinkToMenu'], 179 ['DrupalBreak'] 180 ] 181 "; 182 183 db_query("INSERT INTO {ckeditor_settings} (name, settings) VALUES ('%s', '%s')", "Advanced", serialize($arr)); 184 185 $arr = array(); 186 187 //exclude by default some known textareas where HTML is not expected 188 //edit-recipients //contact module 189 //edit-reply //contact module 190 //edit-description //taxonomy module 191 //edit-synonyms //taxonomy module 192 //edit-img-assist-textareas //img assist module 193 $arr['excl_mode'] = 0; 194 $arr['excl'] = variable_get("ckeditor_exclude", 195 "admin/user/settings.edit-user-mail-*\n". 196 "*.edit-pages\n". 197 "*.edit-pathauto-ignore-words\n". 198 "*.edit-recipients\n". 199 "*.edit-reply\n". 200 "*.edit-description\n". 201 "*.edit-synonyms\n". 202 "*.edit-img-assist-textareas\n". 203 "*.edit-img-assist-paths\n". 204 "*.edit-nodewords-description\n". 205 "*.edit-nodewords-description-value\n". 206 "admin/content/nodewords/global*\n". 207 "*.edit-relatedlinks-fieldset-relatedlinks\n". 208 "*.edit-allowed-values-php\n". 209 "*.edit-allowed-values\n". 210 "*.edit-update-notify-emails\n". 211 "*.edit-googleanalytics-*\n". 212 "*.edit-piwik-*\n". 213 "*.edit-feedburner-useragents\n". 214 "*@*.edit-webform-*\n". 215 "webform@*.edit-extra-items\n". 216 "admin/*/logintoboggan\n". 217 "admin/settings/actions/configure/*\n". 218 "*.edit-target\n". 219 "*.edit-wysiwyg-filter-*\n". 220 "admin/build/views*\n" 221 ); 222 223 //force by default simple toolbar on selected textareas 224 $arr['simple_incl_mode'] = 1; 225 $arr['simple_incl'] = 226 "*.edit-signature\n". 227 "admin/settings/site-information.*\n". 228 "admin/settings/site-maintenance.*\n". 229 "*.edit-page-help\n". 230 "*.edit-user-registration-help\n". 231 "*.edit-user-picture-guidelines\n"; 232 if ($editor_path) { 233 $arr['ckeditor_path']=$editor_path; 234 } 235 236 db_query("INSERT INTO {ckeditor_settings} (name, settings) VALUES ('%s', '%s')", "CKEditor Global Profile", serialize($arr)); 237 } 238 module_load_include('inc', 'ckeditor', 'includes/ckeditor.admin'); 239 ckeditor_rebuild_selectors(); 240 } 241 242 /** 243 * Implementation of hook_schema(). 244 */ 245 function ckeditor_schema() { 246 $schema['ckeditor_settings'] = array( 247 'description' => 'Stores CKEditor profile settings', 248 'fields' => array( 249 'name' => array( 250 'type' => 'varchar', 251 'not null' => TRUE, 252 'default' => '', 253 'length' => 128, 254 'description' => 'Name of the CKEditor profile', 255 ), 256 'settings' => array( 257 'type' => 'text', 258 'description' => 'Profile settings', 259 ), 260 ), 261 'primary key' => array('name'), 262 ); 263 $schema['ckeditor_role'] = array( 264 'description' => 'Stores CKEditor profile assignments', 265 'fields' => array( 266 'name' => array( 267 'type' => 'varchar', 268 'not null' => TRUE, 269 'default' => '', 270 'length' => 128, 271 'description' => 'Name of the CKEditor role', 272 ), 273 'rid' => array( 274 'type' => 'int', 275 'not null' => TRUE, 276 'default' => 0, 277 'description' => 'Drupal role ID', 278 ), 279 ), 280 'primary key' => array('name', 'rid'), 281 ); 282 283 return $schema; 284 } 285 286 /** 287 * Implementation of hook_requirements(). 288 * 289 * This hook will issue warnings if: 290 * - The CKEditor source files are not found. 291 * - The CKEditor source files are out of date. 292 * - Quick upload and/or the built-in file browser are used and $cookie_domain is not set. 293 */ 294 function ckeditor_requirements($phase) { 295 $requirements = array(); 296 297 if ($phase == 'runtime') { 298 module_load_include('module', 'ckeditor'); 299 module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); 300 $requirements['ckeditor'] = array( 301 'title' => t('CKEditor'), 302 'value' => t('Unknown'), 303 ); 304 305 $requirements['ckeditor']['severity'] = REQUIREMENT_OK; 306 307 if (!_ckeditor_requirements_isinstalled()) { 308 $sourcepath = ckeditor_path(TRUE); 309 310 $requirements['ckeditor']['description'] = t('CKEditor was not found in <code>%sourcepath</code>.', array('%sourcepath' => $sourcepath)); 311 $requirements['ckeditor']['severity'] = REQUIREMENT_ERROR; 312 } 313 elseif (($installed_version = _ckeditor_requirements_getinstalledversion()) === NULL) { 314 $requirements['ckeditor']['description'] = t('CKEditor version could not be determined.'); 315 $requirements['ckeditor']['severity'] = REQUIREMENT_INFO; 316 } 317 else { 318 $profile_name = _ckeditor_requirements_ckfinder_filebrowser_enabled(); 319 if ($profile_name !== FALSE) { 320 if (!_ckeditor_requirements_cookiedomainset()) { 321 $requirements['ckeditor']['severity'] = REQUIREMENT_ERROR; 322 $requirements['ckeditor']['description'] = t('You are using a feature that requires <code>$cookie_domain</code> to be set, but it is not set in your <code>settings.php</code> file (CKFinder is enabled in the !profile profile).', array('!profile' => l($profile_name, 'admin/settings/ckeditor/edit/'. urlencode($profile_name)))); 323 } 324 elseif ($error = _ckeditor_requirements_ckfinder_config_check($profile_name)) { 325 $requirements['ckeditor']['severity'] = REQUIREMENT_ERROR; 326 $requirements['ckeditor']['description'] = $error; 327 } 328 } 329 } 330 if ((($installed_version = _ckeditor_requirements_getinstalledversion()) !== NULL) && (-1==version_compare($installed_version, '3.1 SVN'))) { 331 $requirements['ckeditor']['description'] = t('Some features are disabled because you are using an older version of CKEditor. Please upgrade the editor to CKEditor 3.1 (or higher).'); 332 $requirements['ckeditor']['severity'] = REQUIREMENT_INFO; 333 } 334 if (!empty($installed_version)) { 335 $requirements['ckeditor']['value'] = $installed_version; 336 } 337 } 338 339 return $requirements; 340 } 341 342 /** 343 * Fetches the version of the installed CKEditor sources. 344 * 345 * It tries to locate the version of the CKEditor sources in 346 * ckeditor.js. 347 * 348 * Releases have a version number such as "3.0.1". 349 * SVN nightly releases have a minor version number with SVN appended: "3.0 SVN". 350 * SVN checkouts have the string "[Development]". 351 * 352 * This function is used by ckeditor_requirements(). 353 * 354 * @return string Version number (eg. 3.0) of CKEditor. Null if not found in ckeditor_basic.js. 355 */ 356 function _ckeditor_requirements_getinstalledversion() { 357 module_load_include('module', 'ckeditor'); 358 $editor_path = ckeditor_path(TRUE, TRUE); 359 $jspath = $editor_path .'/ckeditor_basic.js'; 360 361 $configcontents = @file_get_contents($jspath); 362 if (!$configcontents) { 363 return NULL; 364 } 365 $matches = array(); 366 if (preg_match('#,version:\'(.*?)\',#', $configcontents, $matches)) { 367 return $matches[1]; 368 } 369 return NULL; 370 } 371 372 /** 373 * Executed when the built-in file browser is enabled. 374 * Returns FALSE if no errors are found in the config.php file, otherwise it returns an error message. 375 * 376 * @return string|boolean 377 */ 378 function _ckeditor_requirements_ckfinder_config_check($profile_name) { 379 module_load_include('module', 'ckeditor'); 380 $ckfinder_full_path = ckfinder_path(); 381 $config_path = $ckfinder_full_path . '/config.php'; 382 383 if (!file_exists($config_path)) { 384 return t('!ckfinder is not installed correctly: <code>!config</code> not found. Make sure that you uploaded all files and did not accidentally remove the configuration file.', array( 385 '!config' => $config_path, 386 '!ckfinder' => '<a href="http://ckfinder.com">CKFinder</a>' 387 )); 388 } 389 390 if (!is_readable($config_path)) { 391 return t('CKEditor needs read permission to the <code>!config</code> file.', array('!config' => $config_path)); 392 } 393 394 $config_contents = file($config_path); 395 396 //not a 100% valid check, but well... let's have at least some error checking 397 $require_once_found = FALSE; 398 $require_once_line = 0; 399 $userfiles_absolute_path_line = 0; 400 $force_single_extension_line = 0; 401 402 if ($config_contents) 403 foreach ($config_contents as $line_num => $line) { 404 //make sure it doesn't start with a comment, unfortunately we're not protected if code is commented with /* */ 405 if (!$require_once_found && strpos($line, "filemanager.config.php") !== FALSE && !preg_match(",^(?://|\#|\*|/\*),", trim($line))) { 406 $require_once_found = TRUE; 407 $require_once_line = $line_num; 408 } 409 /** 410 * @todo Finish this 411 */ 412 if (!$userfiles_absolute_path_line && strpos($line, '$Config[\'UserFilesAbsolutePath\']') !== FALSE && !preg_match(",^(?://|\#|\*|/\*),", trim($line))) { 413 $userfiles_absolute_path_line = $line_num; 414 } 415 if (!$force_single_extension_line && strpos($line, '$Config[\'ForceSingleExtension\']') !== FALSE && !preg_match(",^(?://|\#|\*|/\*),", trim($line))) { 416 $force_single_extension_line = $line_num; 417 } 418 } 419 420 if (!$require_once_found) { 421 return t('You are using a feature that requires manual integration in the <code>config.php</code> file. Please read the "Installing CKFinder" section in the <code>!readme</code> file carefully and add a <code>require_once ...</code> statement to the <code>%ckfconfig</code> file.', array('%ckfconfig' => $config_path, '!readme' => l(t('README.txt'), $base_url . '/' . drupal_get_path('module', 'ckeditor') . '/README.txt', array('absolute' => TRUE)))); 422 } 423 424 if ($userfiles_absolute_path_line && $force_single_extension_line && ( 425 $require_once_line < $userfiles_absolute_path_line || $require_once_line > $force_single_extension_line)) { 426 return t('You are using a feature that requires manual integration in the <code>config.php</code> file. You have added a <code>require_once ...</code> statement to the <code>%ckfconfig</code> file, but in the wrong line.', array('%ckfconfig' => $config_path)); 427 } 428 429 return FALSE; 430 } 431 432 /** 433 * Checks if any profile requires an explicit setting of $cookie_domain 434 * in settings.php. 435 * 436 * %cookie_domain is required when the internal file browser or quick upload is used. 437 * 438 * This function is used by ckeditor_requirements(). 439 * 440 * @return boolean True if any profile requires $cookie_domain. 441 */ 442 function _ckeditor_requirements_ckfinder_filebrowser_enabled() { 443 module_load_include('module', 'ckeditor'); 444 $profiles = ckeditor_profile_load(); 445 446 foreach ($profiles as $profile) { 447 if ((isset($profile->settings['filebrowser']) && $profile->settings['filebrowser'] == 'ckfinder')) { 448 return $profile->name; 449 } 450 } 451 452 return FALSE; 453 } 454 455 /** 456 * Checks if $cookie_domain was set. 457 * 458 * It has to include settings.php again because conf_init() sets 459 * $cookie_domain regardless of its presence in settings.php, so 460 * simply checking $GLOBALS['cookie_domain'] is not possible. 461 * 462 * This function is used by ckeditor_requirements(). 463 * 464 * @return boolean True iff $cookie_domain was set in settings.php. 465 */ 466 function _ckeditor_requirements_cookiedomainset() { 467 if (file_exists('./'. conf_path() .'/settings.php')) { 468 $settings = file_get_contents('./'. conf_path() .'/settings.php'); 469 470 if (preg_match('#^\s*\$cookie_domain#m', $settings)) { 471 return TRUE; 472 } 473 } 474 475 return FALSE; 476 } 477 478 /** 479 * Implementation of hook_update_N(). 480 * 481 * Deletes all plus signs from profile names. 482 */ 483 484 function ckeditor_update_6100() { 485 $ret = array(); 486 $ret[] = update_sql( "UPDATE {ckeditor_role} SET name = REPLACE(name,'+','')"); 487 $ret[] = update_sql( "UPDATE {ckeditor_role} SET name = REPLACE(name,'/','')"); 488 $ret[] = update_sql( "UPDATE {ckeditor_settings} SET name = REPLACE(name,'+','')"); 489 $ret[] = update_sql( "UPDATE {ckeditor_settings} SET name = REPLACE(name,'/','')"); 490 491 return $ret; 492 } 493 494 /** 495 * Implementation of hook_update_N(). 496 * 497 * Fixes static paths to plugin files. 498 */ 499 500 function ckeditor_update_6101() { 501 module_load_include('module', 'ckeditor'); 502 module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); 503 504 $render = array(); 505 $render["%base_path%"] = base_path(); 506 $render["%editor_path%"] = ckeditor_path(TRUE) . '/'; 507 $render["%ckeditor_path%"] = drupal_get_path('module', 'ckeditor') . '/'; 508 $render["%plugin_dir%"] = $render["%ckeditor_path%"] . 'plugins/'; 509 $render["%plugin_dir_extra%"] = ckeditor_plugins_path(TRUE) . '/'; 510 511 if ($render["%plugin_dir%"] == $render["%plugin_dir_extra%"]) { 512 unset($render["%plugin_dir_extra%"]); 513 } 514 515 $ret = array(); 516 517 $result = db_query("SELECT * FROM {ckeditor_settings} WHERE name <> 'CKEditor Global Profile'"); 518 519 while (($profile = db_fetch_object($result))) { 520 $name = $profile->name; 521 $settings = unserialize($profile->settings); 522 523 foreach ((array) $settings['loadPlugins'] as $i => $plugin) { 524 $settings['loadPlugins'][$i]['path'] = str_replace(array_values($render), array_keys($render), $plugin['path']); 525 } 526 527 $settings = serialize($settings); 528 529 $return = db_query( "UPDATE {ckeditor_settings} SET settings = '%s' WHERE name = '%s'", $settings, $name); 530 $ret[] = array('success' => $return !== FALSE, 'query' => "UPDATE PROFILE - {$name}"); 531 } 532 533 return $ret; 534 } 535 536 /** 537 * Implementation of hook_update_N(). 538 * 539 * Moves toolbar definition from the configuration file to the database - toolbar definition is now set in the CKEditor profile. 540 */ 541 542 function ckeditor_update_6102() { 543 module_load_include('module', 'ckeditor'); 544 module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); 545 546 $ret = array(); 547 548 $result = db_query("SELECT * FROM {ckeditor_settings} WHERE name <> 'CKEditor Global Profile'"); 549 550 while (($profile = db_fetch_object($result))) { 551 $name = $profile->name; 552 $settings = unserialize($profile->settings); 553 554 if ($settings['toolbar'] == 'DrupalBasic') { 555 $settings['toolbar'] = " 556 [ 557 [ 'Format', 'Bold', 'Italic', '-', 'NumberedList','BulletedList', '-', 'Link', 'Unlink', 'Image' ] 558 ] 559 "; 560 561 $settings = serialize($settings); 562 563 $return = db_query( "UPDATE {ckeditor_settings} SET settings = '%s' WHERE name = '%s'", $settings, $name); 564 $ret[] = array('success' => $return !== FALSE, 'query' => "UPDATE PROFILE - {$name}"); 565 } 566 elseif ($settings['toolbar'] == 'DrupalFiltered') { 567 $settings['toolbar'] = " 568 [ 569 ['Source'], 570 ['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'], 571 ['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'], 572 ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'], 573 ['Maximize', 'ShowBlocks'], 574 '/', 575 ['Format'], 576 ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], 577 ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], 578 ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiRtl','BidiLtr'], 579 ['Link','Unlink','Anchor','Linkit','LinkToNode','LinkToMenu'], 580 ['DrupalBreak', 'DrupalPageBreak'] 581 ] 582 "; 583 584 $settings = serialize($settings); 585 586 $return = db_query( "UPDATE {ckeditor_settings} SET settings = '%s' WHERE name = '%s'", $settings, $name); 587 $ret[] = array('success' => $return !== FALSE, 'query' => "UPDATE PROFILE - {$name}"); 588 } 589 elseif ($settings['toolbar'] == 'DrupalFull') { 590 $settings['toolbar'] = " 591 [ 592 ['Source'], 593 ['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'], 594 ['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'], 595 ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'], 596 '/', 597 ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], 598 ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], 599 ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiRtl','BidiLtr'], 600 ['Link','Unlink','Anchor','Linkit','LinkToNode', 'LinkToMenu'], 601 '/', 602 ['Format','Font','FontSize'], 603 ['TextColor','BGColor'], 604 ['Maximize', 'ShowBlocks'], 605 ['DrupalBreak', 'DrupalPageBreak'] 606 ] 607 "; 608 609 $settings = serialize($settings); 610 611 $return = db_query( "UPDATE {ckeditor_settings} SET settings = '%s' WHERE name = '%s'", $settings, $name); 612 $ret[] = array('success' => $return !== FALSE, 'query' => "UPDATE PROFILE - {$name}"); 613 } 614 else { 615 $settings['toolbar'] = ""; 616 $settings = serialize($settings); 617 618 $return = db_query( "UPDATE {ckeditor_settings} SET settings = '%s' WHERE name = '%s'", $settings, $name); 619 $ret[] = array('success' => $return !== FALSE, 'query' => "[!!] UPDATE PROFILE - {$name} - Custom toolbar cannot be converted, please set this toolbar manually in the CKEditor profile!"); 620 } 621 } 622 623 return $ret; 624 } 625 626 /** 627 * Implementation of hook_uninstall(). 628 */ 629 function ckeditor_uninstall() { 630 drupal_uninstall_schema('ckeditor'); 631 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |