b48903dfff5489ca2d2554762358c21c.resolve.whicheditor.resolver 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * TinyMCE MODx Integration
  4. *
  5. * Copyright 2010 by Shaun McCormick <shaun@modxcms.com>
  6. *
  7. * TinyMCE MODx Integration is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the Free
  9. * Software Foundation; either version 2 of the License, or (at your option) any
  10. * later version.
  11. *
  12. * TinyMCE MODx Integration is distributed in the hope that it will be useful, but WITHOUT ANY
  13. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  14. * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along with
  17. * TinyMCE MODx Integration; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
  18. * Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. * @package tinymce
  21. */
  22. /**
  23. * Resolver to set which_editor to CKEditor
  24. *
  25. * @package tinymce
  26. * @subpackage build
  27. */
  28. $success= true;
  29. if ($pluginid= $object->get('id')) {
  30. switch ($options[xPDOTransport::PACKAGE_ACTION]) {
  31. case xPDOTransport::ACTION_INSTALL:
  32. case xPDOTransport::ACTION_UPGRADE:
  33. $object->xpdo->log(xPDO::LOG_LEVEL_INFO,'Attempting to set which_editor setting to TinyMCE.');
  34. $setting = $object->xpdo->getObject('modSystemSetting',array('key' => 'which_editor'));
  35. if ($setting) {
  36. $setting->set('value','TinyMCE');
  37. $setting->save();
  38. }
  39. unset($setting);
  40. $object->xpdo->log(xPDO::LOG_LEVEL_INFO,'Attempting to set use_editor setting to on.');
  41. $setting = $object->xpdo->getObject('modSystemSetting',array('key' => 'use_editor'));
  42. if ($setting) {
  43. $setting->set('value',1);
  44. $setting->save();
  45. }
  46. unset($setting);
  47. break;
  48. case xPDOTransport::ACTION_UNINSTALL:
  49. $success= true;
  50. break;
  51. }
  52. }
  53. return $success;