first import

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-08 11:40:19 +02:00
commit 1bc61b12ad
8435 changed files with 1582817 additions and 0 deletions

View File

@@ -0,0 +1,445 @@
2012-12-22
New stable release 7.x-1.12
Bug fixes:
[#1871918] by matulis: Bug in checking if a file "contents.css" exists
[#1870270] by dczepierga: Disable plugins which not exists and are stored in ckeditor profiles
[#1864760] by dczepierga: Wrong path to plugins stored in database
[#1868416] by dczepierga: Move skin selection option to CKEditor Global Profile
[#1866654] by dczepierga: Remove "Skin" and "Toolbar state on startup" options from user profile
[#1865086] by dczepierga: Set default theme if selected not exists
2012-12-12
New stable release 7.x-1.11
New features:
[#1858840] by dczepierga: Add option to enable/disable aggregate ckeditor.js script
[#1847662] by dczepierga: Add support for CKEditor v4
[#1577518] by dczepierga: Remove unused/unsupported hook_user from code
[#1559700] by dczepierga: Disable HTML Entities conversion by default
[#1692666] by dczepierga: Unset Ckeditor-Plugin upon module disabling/uninstalling
Bug fixes:
[#1760506] by ceng: CKEditor features are not reverted or applied from the command line
[#1857910] by dczepierga: Using extraPlugins config option in Custom JavaScript (Advanced options) not working
[#1850626] by dczepierga: Wrong path to external plugins loaded by hook
[#1844390] by dczepierga: Undefined index: loadPlugins in ckeditor_modules_enabled()
[#1790082] by dczepierga: Order of filters calling in ckeditor filter XSS function
[#1728318] by dczepierga: Text format filters are not properly given $format; cannot look up their per-format settings
[#1698600] by azovsky: Undefined index: format in ckeditor_pre_render_text_format()
[#1651130] by lmeurs: Wrong variable substitution using t()
[#1637416] by michal_cksource: Fix description to "Custom JavaScript configuration" option
[#1595606] by kmcnamee: Wrong instructions for configuring CKFinder
[#1350998] by MegaChriz: CKEditor settings appear on all user profile edit pages
[#1567022] by dczepierga: Overlays of administration toolbar appears in CKEditor maximized mode
[#1557526] by dczepierga: CKEditor gets inserted multiple times on text format selection
[#1554840] by dczepierga: Missing argument - WYSIWYG Filter, HTML Purifier & HTMLawed
2012-04-18
New stable release 7.x-1.9
New features:
[#1489358] by dczepierga: Add support for the Stylesheet Parser plugin
[#1483402] by dczepierga: Change security filters policy
[#1489074] by acbramley: Change CKEditor XSS URL to be passed through url()
[#1473010] by michal_cksource: Set spellchecker to use the interface language
Bug fixes:
[#1537824] by dczepierga: External plugins do not work when the ckeditor_basic.js loading method is used
[#1507852] by dczepierga: 'drush ckeditor-download' fails if SVN is not installed
[#1432068] by kruser: Fix path to the sites/all/libraries/ckeditor/ckeditor.styles.js file
[#1504398] by ndeschildre: Importing CKEditor profile features fails, manual revert is needed
[#1508342] by dczepierga: WSOD on saving content from CKEditor using Ajax when the node edit form is embedded in the display of another node
[#1491210] by michal_cksource: CKEditor gets disabled/enabled on all AJAX calls
[#1512196] by dczepierga: Refactor code with titles and descriptions now available for translation
[#1496164] by michal_cksource: Buttons are too high when using the drag & drop feature in Firefox
[#1492344] by dczepierga: Portuguese language missing
2012-03-15
New stable release 7.x-1.8
Bug fixes:
[#1371660] by dczepierga: CKFinder requirement check needs fixing
2012-03-14
New stable release 7.x-1.7
New features:
[#1338044] by dczepierga: Add an option to disable the toolbar wizard
[#1349330] by dczepierga: Add a configuration option to set the CKFinder library path
Bug fixes:
[#1345738] by michal_cksource: Included JavaScript files for the toolbar drag & drop wizard should be minified
[#1361846] by mrsimonelliott: CKEditor does not load on a 'Long Text' CCK field
[#1371660] by dczepierga: CKFinder requirement check needs fixing
[#1043230] by KoCo: D7 administration toolbar overlays CKEditor in maximized mode
[#1357794] by dczepierga: Invalid attribute "disc-type" in ckeditor.css
[#1324990] by michal_cksource: Problems with access to private files (download)
[#1343310] by michal_cksource: Change settings for private download
[#1351470] by dczepierga: CKEditor plugins added with the "hook_ckeditor_plugin" button do not appear in the toolbar
[#1329980] by jherencia: Problem with CKEditor module update
[#1347682] by jherencia: D6 to D7 - error in update #7003 when running update.php
[#1350382] by michal_cksource: Improve regex pattern to find plugins for CKEditor
[#1349304] by michal_cksource: Change descriptions in CKEditor help page
[#1343310] by michal_cksource: Change settings for private download
[#1348196] by michal_cksource: Change of the default path for CKFinder settings
[#1346818] by michal_cksource: Change of Full toolbar buttons
[#1345658] by michal_cksource: Enable the Drupal Breaks plugin by default
2011-11-10
New stable relase 7.x-1.6
Bug fixes:
[#1337064] by michal_cksource: Fix Fatal error: Call to undefined function db_fetch_object()
2011-11-09
New stable relase 7.x-1.5
Bug fixes:
[#1334140] by michal_cksource: CKEditor is cut off in comments form
[#1331728] by michal_cksource: Remove unnecessary Drupal Page Break button if there is no module to support this feature
[#1331720] by michal_cksource: Fix broken link to Global Profile in CKEditor configuration main page
[#1331716] by michal_cksource: Fix missing version number in report status
[#1324554] by dczepierga: Fix adding custom plugin - change in ckeditor.api.php
[#1283918] by michal_cksource: Fix UTF-8 issues
[#1327540] by michal_cksource: Fix hook_file_download allows downloading of private files created by another module
[#1325412] by michal_cksource: Fix problem with list-style-type in ckeditor.css
2011-10-26
New stable release 7.x-1.4
-- 2011-10-24
- [#1319658] by michal_cksource: Correct language list in the CKEditor profile configuration
-- 2011-10-20
- [#1259510] by michal_cksource: Fix for setting a private files folder breaks CKEditor file uploads
-- 2011-10-17
- [#1310280] by dczepierga: Improve icons detection from CKEditor plugins (part 2)
- [#1298972] by michal_cksource: Correct messages and add language fixes
- [#1311928] by dczepierga: Add jquery_ui support to the Drag & Drop toolbar configuration
-- 2011-10-14
- [#1310280] by dczepierga: Improve icons detection from CKEditor plugins
- [#1295176] by dczepierga: Fix Notice: Undefined index: default in ckeditor_admin_profile_form() - when editing CKEditor profile
- [#1310198] by duozersk: Add plugin to count symbols and words inside CKEditor
-- 2011-10-04
- [#1298972] by michal_cksource: Correct messages and add language fixes
-- 2011-09-26
- [#1154264] by dczepierga: Fix for deleting profle - after deleting the Advanced profile, Full HTML profile doesn't load
-- 2011-09-23
- [#1288084] by dczepierga: Disable Media and IMCE module selection if these modules are not installed
-- 2011-09-20
- [#1283788] by dczepierga: Fix Notice: Undefined index: buttons in ckeditor_toolbar_buttons_all()
-- 2011-09-19
- [#1219348] by dczepierga: Fix for WYSIWYG filter - add missing argument
-- 2011-09-15
- [#1280298] by dczepierga: Add configuration option to disable text format filters in filter/xss request
- [#1270792] by dczepierga: Further improvements to the Drag & Drop toolbar configuration
-- 2011-09-13
- [#1173294] by dczepierga: Fix for incorrect file path for uploaded Images
-- 2011-09-12
- [#1270792] by michal_cksource: Improved Drag & Drop toolbar configuration - fixed css styles
- [#1270792] by michal_cksource: Improved Drag & Drop toolbar configuration - fixed errors (dragged item was to low in Firefox and validation failed when 'group' button was first in buttons row)
-- 2011-09-06
- [#1270792] by dczepierga: Add Drag & Drop toolbar configuration
-- 2011-08-31
- [#1264884] by dczepierga: Fix warning: is_dir(): open_basedir restriction in effect
-----------------------------
2011-08-29
Released CKEditor 7.x-1.3
-----------------------------
-- 2011-08-29
- [#1260892] by dczepierga: Add regex to work with new CKEditor toolbar format (toolbar groups compatible with WAI-ARIA)
- [#1258326] by dczepierga: Add configuration option for setting CKEditor plugins directory
-- 2011-08-25
- [#1257308] by dczepierga: Add loading sample toolbar to profile configuration
- [#1192622] by dczepierga: Replace static paths to plugins in the database with dynamic paths
-- 2011-08-16
- [#1250496] by dczepierga: 'CKEDITOR' is not defined - problem with ckeditor.styles.js
-- 2011-08-11
- [#1231130] by dczepierga: The "Use theme style" setting now always uses the "seven" theme (admin menu theme)
-- 2011-08-10
- [#1245306] by dczepierga: "Custom JavaScript configuration" field description is wrong
-- 2011-08-08
- [#1231338] by dczepierga: Features module support for Drupal 7 (exporting profiles)
-- 2011-08-02
- [#1235142] by madmanmax: README.TXT - Installing CKFinder - wrong permission name
-- 2011-07-12
- [#1216104] by dczepierga: Bug in custom JavaScript configuration - semicolon problem
- [#1215032] by dczepierga: Bad location of the configuration file in the description of CKEditor profile
-- 2011-07-04
- [#1190278] by dczepierga: CKEditor does not work with the Insert module
-- 2011-06-28
- [#1198068] by michal_cksource: Confusing behavior with IMCE button implementation
-- 2011-06-27
- [#1201180] by dczepierga: SCAYT spelling language does not match node language
-- 2011-06-22
- [#1196166] by dczepierga: Bug in custom JavaScript configuration - editor not showing in some cases
-- 2011-06-17
- [#1032120] by dczepierga: Formatting is lost when editing a node
-- 2011-06-14
- [#1187808] by RolandK: Not formatting text between code tags
-- 2011-06-13
- [#1186880] by dczepierga: Handling arrays in the "Custom JavaScript configuration"
-- 2011-06-09
- [#1183218] by neclimdul: Fix broken teasers for long paragraphs
-- 2011-06-06
- [#1179880] by dczepierga: Add hook to register a plugin
- [#1063646] by dczepierga: Fix calling Undefined index: "loadPlugins" in ckeditor_admin_values_to_settings()
-- 2011-06-02
- [#1176212] by dczepierga: Remove not supported linktomenu and linktonode plugins
- [#1176208] by dczepierga: Add plugins management in profile settings
-----------------------------
2011-05-30
Released CKEditor 7.x-1.2
-----------------------------
-- 2011-05-27
- [#1170612] by dczepierga: Add support for autogrow and tableresize plugin
-- 2011-05-26
- [#1169402] by dczepierga: Fix duplicated path in the error message displayed when CKEditor is not installed correctly
-- 2011-05-23
- [#1165864] by dczepierga: Improve manual selection of the user interface color
- [#1093038] by marhak: CKEDITOR is not defined when using ckeditor_basic.js - Editor is not loading
- [#1039810] by cwc: Fix to predefined styles path errors (fix typo)
- [#1164270] by TommyChris: Fix to work with ckeditor_link module (http://drupal.org/project/ckeditor_link)
-- 2011-05-16
- [#1158898] by dczepierga: Add Google PageSpeed and Drupal JS/CSS aggregation support
-- 2011-05-09
- [#1134252] by dczepierga: Add HTML Entities configurable option in each profile
-- 2011-05-04
- [#1022986] by dczepierga: Add integration with Media Module
-- 2011-05-02
- [#1142600] by taite11: Readme file edit - there is no core upload module in Drupal 7
-- 2011-04-28
- [#1022986] by dczepierga: Add integration with Media Module (http://drupal.org/project/media)
-- 2011-04-11
- [#1116516] by weboide: Fix to CKEditor and Profile2 - remove call to undefined function ckeditor_user_customize_form_validate() on uid=1
-- 2011-04-07
- [#1093028] by marhak: Text written in rich text editor (WYSIWYG) mode disappears when switching to plain text editor mode
- [#1102824] by dczepierga: CKEditor loses all text when uploading an image or file via field API
-- 2011-03-31
- [#1093038] by marhak: CKEDITOR is not defined when using ckeditor_basic.js - Editor is not loading
-- 2011-03-30
- [#1109366] by dczepierga: #1052604 Fix remove call to undefined function ckeditor_user_customize_form_validate
-- 2011-03-29
- [#1107882] by dczepierga: Add a warning message when the wysiwyg module is enabled in Drupal 7
-- 2011-03-28
- [#1107882] by dczepierga: Add a warning message when the wysiwyg module is enabled in Drupal 7
-- 2011-03-23
- [#1039810] by cwc: Fix to predefined styles path errors
-- 2011-03-17
- [#1095954] by dczepierga: Fix to prevent calling "Toggle rich text link" multiple times
-----------------------------
2011-03-10
Released CKEditor 7.x-1.1
-----------------------------
-- 2011-02-22
- [#960576] by dczepierga: Add loading ckeditor.css from theme.
- [#1069012] by dczepierga: CKEditor version could not be determined
-- 2011-02-21
- [#1068186] by dczepierga: Added support for CKEditor SWF (http://drupal.org/project/ckeditor_swf) and CKEditor Link (http://drupal.org/project/ckeditor_link) modules
-- 2011-02-17
- [#1064422] by dczepierga: All changes to the text are lost when input format is changed
-- 2011-02-14
- [#1053222] by dczepierga: Two editors appeared when JavaScript Aggregation was enabled
- [#1037390] by dczepierga: Cannot use CKEditor module to create header/footer in Views
- [#1052604] by dczepierga: Call to undefined function ckeditor_user_customize_form_validate
-- 2011-02-11
- [#1056068] by dczepierga: Fix Warning: file_get_contents(/drupal7/sites/all/libraries/ckeditor/ckeditor.js)
-- 2011-02-08
- [#1054414] by dczepierga: Added support for elFinder (http://drupal.org/project/elfinder) file manager
- [#1054606] by dczepierga: No detach method in Drupal.behaviors.ckeditor
-- 2011-02-07
- [#1037390] by dczepierga: Cannot use CKEditor module to create header/footer in Views
- [#1053358] by dczepierga: Removed option to "Use CKEditor in a popup window" in "My account" settings
-- 2011-02-04
- [#1050034] by dczepierga: Disabled editor gets enabled again after ajax calls
-- 2011-02-03
- [#1037390] by dczepierga: Cannot use CKEditor module to create header/footer in Views
-- 2011-02-01
- [#1037390] by dczepierga: Cannot use CKEditor module to create header/footer in Views
-- 2011-01-24
- [#1035544] by dczepierga: Remove double http:// in ckeditor.drush.inc
-- 2011-01-20
- [#1006770] by OnkelTem: Fix Notice: Undefined index: filtered_html in ckeditor_profile_load()
-----------------------------
2011-01-13
Released CKEditor 7.x-1.0
-----------------------------
-- 2011-01-13
- Added Upgrade.txt
- Fixed filters description (HTML should be allowed there)
- Link to CKEditor Global Profile was not displayed properly.
- [#1025472] by dczepierga: Starting slash in editor path result in Warnings
- [#1022562] by dczepierga: In IE8 break button icon doesn't appear
- [#1023546] by dczepierga: Useless ajax call when no security filters are checked
-- 2011-01-11
- [#1022666] by dczepierga: Teaser break doesn't work with filtered html input format.
- [#1022494] by dczepierga: CKEditor module - Compatibility with Drupal's coding standards
-- 2011-01-10
- [#1011112] by Oren_Held: Support RTL also when CSS is not in theme mode (self/none)
- [#1020612] by amateescu: Extra table borders added by the Seven theme
- [#1003462] by dczepierga: CKfinder path customization won't work
- [#1020820] by dczepierga: CKEditor does not work after enabling javascript aggregation
- [#1006230] by amateescu: Editor not loading for Full HTML
-- 2011-01-05
- [#1006770] by dczepierga: Notice: Undefined index: filtered_html in ckeditor_profile_load()
-- 2010-12-29
- [#1009816] by dczepierga: Access denied: ckeditor/xss
- [#1004822] by dczepierga: Switching text format to filtered html deletes all "p" tags
-- 2010-12-28
- [#1006124] by dczepierga: Registered user gets "Undefined index: popup" message
- [#1000330] by dczepierga: No Insert File button in IMCE
-- 2010-12-20
- [#1000838] by dczepierga: The Teaser button is absolutely necessary - important functionality has been deleted
-----------------------------
2010-12-15
Released CKEditor 7.x-1.0 RC
-----------------------------
-- 2010-12-15
- [#991380] by dczepierga: Language files (D7)
- Removed a link to delete the global profile
- [#999292] by dczepierga: Remove filter_html as default option in Full HTML text format (D7)
- Fixed a typo
- Updated comments, minor corrections
-- 2010-12-14
- [#997136] by dczepierga: CKFinder - thumbnails not available
- [#997124] by dczepierga: Invalid error message when CKFinder is enabled but not configured properly.
- [#997116] by dczepierga: D7 Custom formatting options not used
- [#997090] by dczepierga: XSS protection not working as expected
- [#997098] by dczepierga: Error when CKEditor (the editor) is not present in the ckeditor folder
-- 2010-12-13
- [#997074] by dczepierga: Corect the default order of Bidi buttons
-- 2010-12-10
- [#994372] by dczepierga: Update README.TXT (D7)
-- 2010-12-09
- [#993436] by dczepierga: Disable option of using CKEditor in a popup window (D7)
- [#993362] by dczepierga: CKEditor not work in popup window (D7)
- [#993330] by dczepierga: Change editor theme in profile edit form (D7)
- [#993272] by dczepierga: User Interface color change enabled only for Kama skin
-- 2010-12-07
- [#991380] by dczepierga: Language files (D7)
- [#984986] by dczepierga: Code syntax after Coder module validation
- [#984978] by dczepierga: Security filters not works (D7) - Security mode fix
- [#984968] by dczepierga: Make sure that the help information is correct (D7)
-- 2010-12-06
- [#990368] by dczepierga: Cleanup code - modules not ported to Drupal 7
- [#985006] by dczepierga: Review README.txt (D7)
-- 2010-12-04
- [#984978] by dczepierga: Security filters not works (D7)
-- 2010-12-03
- [#984976] by dczepierga: User Interface color not saved in D7
- [#985002] by dczepierga: Remove DrupalPageBreak button from toolbar
-- 2010-11-30
- [#984986] by dczepierga: Code syntax after Coder module validation
- Removed extra information that should be added by the packaging script
-- 2010-11-29
- [#984202] by dczepierga: Detecting of summary field in form
- [#966490] by dczepierga: Comment form after ckeditor install.
- [#966492] by dczepierga: CKEditor in edit summary/teaser mode
- [#984096] by dczepierga: Compatibility of DrupalBreaks Plugin
- [#984000] by dczepierga: CKeditor not works in node edit
-- 2010-11-25
- [#981624] by dczepierga: Compatibility with drupal 7.0-beta3
- [#966488] by dczepierga: CKEditor should respect input format changes
-- 2010-11-23
- [#976968] by dczepierga: Toolbar config validation in profile
-- 2010-11-19
- [#901502] by dczepierga: Multi toolbar configuration, and different settings for each
- [#975360] by dczepierga: Remove Minimum rows
- [#975456] by dczepierga: Remove visibility settings in Global profile in D7
- [#975458] by dczepierga: Selecting UI Color not working
-- 2010-11-09
- [#966598] by dczepierga: CKFinder compatibility
-- 2010-11-08
- [#965280] by dczepierga: Profiles after save lose all input formats
- [#965258] by dczepierga: Compatibility with drupal 7.0-beta2
-- 2010-10-26
- Created initial dev version of the CKEditor module for Drupal 7.x

View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -0,0 +1,359 @@
TABLE OF CONTENTS
-----------------
* Overview
* More Information and License
* Requirements
* Installation Paths
* Installation / Configuration
* Installation Troubleshooting
* Uploading Images and Files
* Installing CKFinder
* Managing Plugins
* Installing Additional Plugins
* Integrating a Plugin with the CKEditor Module (for Plugin Developers)
* Setting up Security Filters
* HTML Filters and Inline Styling
* Integrating a Custom Security Filter with the CKEditor Module (for Developers)
* Upgrading Instructions
* Help & Contribution
* Credits
Overview
--------
This module allows Drupal to replace textarea fields with CKEditor.
CKEditor is an online rich text editor that can be embedded inside web pages.
It is a WYSIWYG (What You See Is What You Get) editor which means that the
text edited in it looks as similar as possible to the results end users will
see after the document gets published. It brings to the Web popular editing
features found in desktop word processors such as Microsoft Word and
OpenOffice.org Writer. CKEditor is truly lightweight and does not require any
kind of installation on the client computer.
More Information and License
----------------------------
CKEditor - The text editor for the Internet
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
Licensed under the terms of the GNU Lesser General Public License:
http://www.opensource.org/licenses/lgpl-license.php
For further information visit:
http://ckeditor.com/
Requirements
------------
- Drupal 7.x,
- PHP 5.2 or greater,
- CKEditor 3.4 or greater.
You will need to download CKEditor from the official download site: http://ckeditor.com/download.
It is recommended to always use the latest CKEditor version available.
Installation Paths
------------------
It is recommended to install the CKEditor for Drupal module in the "sites/all/modules" directory.
When adding the files for standalone CKEditor and CKFinder, you can use one of the following directories:
- "sites/all/modules/ckeditor/"
- "sites/all/libraries/"
and create a "ckeditor" or "ckfinder" directory inside.
The CKEditor module will automatically recognize the proper path to the editor and the file browser.
All installation and configuration instructions in this README file assume that you use the first option and place the CKEditor and CKFinder files in the "sites/all/modules/ckeditor/" directory. If you want to use the "sites/all/libraries/" directory, you will need to adjust the paths given in the instructions accordingly.
Installation / Configuration
----------------------------
Note: these instructions assume that you install the CKEditor for Drupal module in the
"sites/all/modules" directory (recommended).
1. Unzip the module files to the "sites/all/modules" directory. It should now
contain a "ckeditor" directory.
2. Download standalone CKEditor from http://ckeditor.com/download. Unzip the
contents of the "ckeditor" directory from the installation package to the
"sites/all/modules/ckeditor/ckeditor" (or "sites/all/libraries/ckeditor") directory.
Note: you can skip uploading the "_samples" and "_source" folders.
3. Enable the module in the "Administration panel > Modules > User Interface" section.
4. Grant permissions for using CKEditor in the
"Administration panel > People > Permissions" section.
Note: In order to enable the file browser, refer to the
"Installing CKFinder" section.
5. Adjust CKEditor profiles in the
"Administration panel > Configuration > Content Authoring > CKEditor" section.
Profiles determine which options are available to users based on the input format system.
6. For the Rich Text Editing to work you also need to configure your filters
for the users that may access Rich Text Editing.
Either grant those users Full HTML access or use the following tags:
<a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr>
<br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong>
<del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code>
<cite> <embed> <object> <param> <strike> <caption> <tbody>
To make copying the list easier, below all tags were placed in one line:
<a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <embed> <object> <param> <strike> <caption> <tbody>
If you are going to use CKEditor with the Filtered HTML input format,
please refer to the "HTML Filters and Inline Styling" section.
7. To have better control over line breaks, you may disable the line break converter
for a given text format in the "Administration panel > Configuration > Content authoring > Text formats" section (recommended).
8. Modify the ckeditor.config.js file to adjust it to your needs (optional).
Configuration options are described here:
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html
Developer's documentation for CKEditor:
http://docs.cksource.com/CKEditor_3.x/Developers_Guide
WARNING: Remember to clear the browser cache after you have modified any of the JavaScript files.
If you skip this step, you may notice that the browser is ignoring your changes.
Installation Troubleshooting
----------------------------
If CKEditor does not appear on the page, check if all files were extracted correctly.
The "sites/all/modules/ckeditor/ckeditor/" directory should contain the following files:
ckeditor.js, config.js, contents.css
and directories: "skins", "themes", "lang", "images".
The correct directory structure is as follows:
modules <dir>
ckeditor <dir>
ckeditor.module
ckeditor.admin.inc
...
ckeditor <dir>
_source <dir>
images <dir>
lang <dir>
plugins <dir>
skins <dir>
themes <dir>
COPY_HERE.txt
ckeditor.js
...
As noted above, alternatively the "sites/all/libraries/ckeditor" directory can be used.
The "libraries" directory is the default path when drush is used to download the editor JavaScript code.
If you are still experiencing problems with your CKEditor installation, scroll down to the "Help & Contribution" section.
Uploading Images and Files
--------------------------
There are two methods for uploading files:
- by using a commercial file browser like CKFinder (http://ckfinder.com), an advanced Ajax file manager;
- by using modules like IMCE.
To select a preferred file browser, adjust CKEditor profiles in the
"Administration panel > Configuration > Content Authoring > CKEditor" section.
In the "File browser settings" section you can choose which file browser will be used for each profile.
Note: in order to choose an upload module other than CKFinder, you should install an appropriate Drupal module first.
Installing CKFinder
-------------------
CKFinder is an Ajax-based file manager created by CKEditor developers: http://ckfinder.com/.
1. Download CKFinder for PHP: http://ckfinder.com/download
2. Unpack CKFinder to the directory containing the CKEditor module and place it in the
"sites/all/modules/ckeditor/ckfinder" (or "sites/all/libraries/ckfinder") folder.
The correct directory structure is as follows:
modules <dir>
ckeditor <dir>
ckeditor.module
ckeditor.admin.inc
...
ckeditor <dir>
_source <dir>
images <dir>
ckeditor.js
...
ckfinder <dir>
core <dir>
ckfinder.php
config.php
...
3. Grant the "CKFinder access" permission in the "Administration panel > People > Permissions" section.
Note: if you do not see this permission, it means that CKEditor did not find CKFinder
and you have probably uploaded CKFinder into a wrong directory.
4. Open the CKFinder configuration file (ckfinder/config.php) and do the following:
I) Remove the CheckAuthentication() function:
(do not worry, this function is defined in filemanager.config.php, see below)
function CheckAuthentication() <- remove it
{ <- remove it
//WARNING : DO NOT simply... <- remove it
... <- remove it
return false; <- remove it
} <- remove it
II) Add:
- for CKFinder installed in the "sites/all/modules/ckeditor/ckfinder" directory:
require_once '../../../../includes/filemanager.config.php';
- for CKFinder installed in the "sites/all/libraries/ckfinder" directory:
require_once '../../../../../modules/ckeditor/includes/filemanager.config.php';
straight below the following line:
$baseDir = resolveUrl($baseUrl);
5. Open the Drupal settings file (sites/default/settings.php) and do the following:
I) Uncomment the $base_url variable and set the base URL of your website (without the trailing slash).
II) Uncomment the $cookie_domain variable and set the domain name of your website.
6. Select CKFinder as a preferred file browser in the
"Administration panel > Configuration > Content Authoring > CKEditor" section
(for a selected CKEditor profile scroll down to the "File browser settings" section).
In the "File browser settings" section you may also change destination folders for files uploaded with CKFinder.
Managing Plugins
----------------
If you want to manage CKEditor plugins for a profile, go to the "Administration panel > Configuration > Content Authoring > CKEditor" section. This section lets you choose plugins relevant for each CKEditor profile from a list.
In order to activate a plugin, go to the "Editor appearance > Plugins" section and select the checkbox next to a required plugin name.
If a plugin contains toolbar buttons, you will need to drag and drop them to an appropriate toolbar position by using the toolbar wizard. If this is the case, the button should be added to the CKEditor toolbar by using the method described below:
- Enter the "Editor appearance > Toolbar" section.
- Check whether the plugin button that you want to use is present in the "Used buttons" sections. If not, find it in the "All buttons" section and drag and drop to the toolbar configuration from the "Used buttons" section.
Alternatively, if you turned off the toolbar wizard and prefer to enter the toolbar configuration manually, you will need to add the plugin button by yourself by appending it to your toolbar definition code.
Please note that some plugins require installing additional modules to work correctly.
Installing Additional Plugins
-----------------------------
The installation process is based on placing the plugin folder in the "plugins" directory of the CKEditor module (usually "sites/all/modules/ckeditor").
The plugin folder should contain at least the plugin.js file that is responsible for the plugin logic.
The plugin description will be displayed in the "Administration panel" if it is added to the plugin.js file by using the following special comment:
/**
* @file Plugin description
*/
Hint: The "Administration panel" automatically detects the toolbar buttons available in the plugin and adds them to the toolbar wizard.
A plugin can be enabled by using the same method as described above - see the "Managing Plugins" section.
Integrating a Plugin with the CKEditor Module (for Plugin Developers)
---------------------------------------------------------------------
Integrating your application with the CKEditor module by adding a plugin works through a special hook.
An example of the hook is shown below:
function MODULENAME_ckeditor_plugin() {
return array(
'plugin_name' => array(
// Plugin name.
'name' => 'plugin_name',
// Plugin description - it will be displayed in the plugins management section of the profile settings.
'desc' => t('Plugin description'),
// The full path to the CKEditor plugin directory, trailing slash included.
'path' => drupal_get_path('module', 'my_module') . '/plugin_dir/',
// Plugin buttons definition (optional).
'buttons' => array(
'button_name' => array('label' => 'Button label', 'icon' => '/path/to/icon/image'),
'button_name' => array('label' => 'Button label', 'icon' => '/path/to/icon/image'),
...
)
)
);
}
Please note that MODULENAME in the code above is the name of the module.
After the hook is used the plugin will automatically appear on the plugin list for each CKEditor profile where you will be able to enable it as described in the "Managing Plugins" section.
Setting up Security Filters
---------------------------
The CKEditor security system protects you from executing malicious code that is already in your database. In plain textareas database content is harmless because it is not executed, but a WYSIWYG editor interprets HTML like a Web browser and thus the content needs to be filtered before it is loaded.
In order to configure the security filters, go to the "Administration panel > Configuration > Content Authoring > CKEditor" section. Enter the profile configuration and go to the "Security" section.
The "Security" section lists all the security filters that are currently supported by the CKEditor for Drupal module along with their status for each text format.
The CKEditor for Drupal module has built-in support for some popular security filter modules which you will need to download and install by yourself first. Visit the official websites for each module in order to get the files and find installation and configuration instructions.
When a filter module is installed, you will be able to configure its security filters and enable for a given text format. The list of active text formats is displayed in the "Security" section along with the links that will take you to the "Administration panel > Configuration > Content authoring > Text formats" section where you will be able to configure the filters for each of the text formats. The filters will then be run on the content during the filtering process.
The "Security Settings" option in the "Security" section lets you choose whether to always run the security filters on CKEditor content (recommended and default option) or run them only when CKEditor is set to start automatically. If you change this setting to only run the filters when CKEditor starts automatically, you will not be protected when toggling manually between a plain textarea and the WYSIWYG editor.
The following security filter modules are currently supported:
- HTML Purifier - http://drupal.org/project/htmlpurifier
- htmLawed - http://drupal.org/project/htmLawed
- Htmltidy - http://drupal.org/project/htmltidy
- WYSIWYG Filter - http://drupal.org/project/wysiwyg_filter
HTML Filters and Inline Styling
-------------------------------
In the "Administration panel > Configuration > Content Authoring > Text fromats" section, Filtered HTML is the default filter.
Due to security reasons enabling Full HTML is only an option for trusted users.
To take full advantage of using CKEditor you can extend the list of allowed tags in the HTML filter that is enabled in the Filtered HTML input format. If you do not do this, you may notice that a page created in CKEditor looks different after saving.
Unfortunately, even if you extend the list of allowed tags, one problem still remains: Filtered HTML not only strips disallowed tags, but also strips inline style definitions. It basically means that you are unable to apply a different font color, size or family, align images etc. using CKEditor out of the box.
You can solve this problem by creating another input format that will work in a similar way as Filtered HTML (will only allow specified tags), but in a much better way - i.e. it will not strip inline styles that CKEditor is using when
formatting text or images after the page is saved. To create such an input format, you will need an HTML filter. See the list of HTML filter modules that are supported by the CKEditor module in the "Setting up Security Filters" section above.
It is up to you to decide which one to use. Just make sure that you will only allow to use proper inline styles, tags, and attributes.
Integrating a Custom Security Filter with the CKEditor Module (for Developers)
------------------------------------------------------------------------------
Integrating your application with the CKEditor module by adding a security filter works through a special hook.
An example of the hook is shown below:
function MODULENAME_ckeditor_security_filter() {
return array(
'security_filter_name' => array(
// Security filter title - it would be displayed in the "Security > Security filters" section of profile settings.
'title' => t('Security filter title'),
// Security filter description - it would be displayed in the "Security > Security filters" section of profile settings.
'description' => t('Security filter description'),
)
);
}
Please note that MODULENAME in the code above is the name of the module.
After the hook is used the security filter will automatically appear on the filters list for each CKEditor profile where you will be able to enable it as described in the "Setting up Filters" section.
Upgrading Instructions
----------------------
This instruction assumes that you are upgrading the CKEditor module [M] and CKEditor (the editor) [E] at the same time.
Instructions specific for module upgrades are tagged with [M]. Steps that must be taken when upgrading CKEditor (the editor) are marked with [E].
1. [M] Download the latest version of the CKEditor module from http://drupal.org/project/ckeditor (it is advised to read the release notes before going further).
2. [E] Download the latest version of CKEditor from http://ckeditor.com/download (it is advised to read the "What's New" page before going further: http://ckeditor.com/whatsnew).
3. [M] Back up your database.
4. [EM] Place the site in the "Off-line" mode to let the database updates run without interruption and to avoid displaying errors to end users of the site.
5. [E] If you are using CKFinder, make sure you will not delete it, and move it to a safe place.
6. [E] If you introduced any changes (e.g. custom toolbar definitions etc.) in the sites/all/modules/ckeditor/ckeditor.config.js file (or sites/all/modules/ckeditor/ckeditor/config.js), write down your changes and add them again after uploading new files.
In general, try to avoid making any changes to CKEditor's config.js file and add everything to ckeditor.config.js.
7. Delete old files:
[EM]* Simply remove the "modules/ckeditor" directory if upgrading both the editor and the module.
[M] If you are upgrading the module only, remember to leave the "modules/ckeditor/ckeditor" directory untouched.
[E] When upgrading the editor, remove the contents of the "modules/ckeditor/ckeditor" directory only.
WARNING: If you do not remove old files and just rename the "ckeditor" directory instead (e.g. to "ckeditor_old"), Drupal may use the module from the renamed "ckeditor_old" directory.
8. [M] Upload the CKEditor module (extracted files and folders) to the "sites/all/modules" directory.
9. [E] Upload standalone CKEditor (extracted files and folders from the "ckeditor" directory) to the "sites/modules/ckeditor/ckeditor" directory (i.e. where the COPY HERE.txt file exists).
10. [E] Restore the CKFinder files from where you copied them (see step 5).
11. [E] Apply your modifications to default configuration in the ckeditor.config.js file (see step 6).
12. [M] Run update.php.
13. [EM] Put the site back online.
Help & Contribution
-------------------
If you are looking for more information, have any trouble with the configuration of the module
or if you found an issue, please visit the official project page:
http://drupal.org/project/ckeditor
Having problems? Take a look at the list of common problems when installing CKEditor:
http://docs.cksource.com/CKEditor_for_Drupal/Troubleshooting
Learn how to adjust CKEditor to your theme and configure the spellchecker:
http://docs.cksource.com/CKEditor_for_Drupal/Tricks
If you would like to help in the development of the module, we encourage you to join our team.
Any help will be greatly appreciated!
Credits
-------
- CKEditor for Drupal is currently maintained by the CKEditor team and Jorrit Schippers.
http://ckeditor.com/
- CKEditor - The text editor for the Internet
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
http://cksource.com/

View File

@@ -0,0 +1,215 @@
Note: the HTML version of this file (always up-to-date) is available online: http://drupal.ckeditor.com/troubleshooting
CONTENTS OF THIS FILE
---------------------
* CKEditor does not work in my theme
* Known module incompatibilities
* Images are not displayed when submitted
* I followed the instructions, but CKEditor does not show up (+ debugging instructions)
* Selected toolbar does not show for user 1
* The CKEditor component is not installed correctly
* CKEditor does not work after upgrading
* Text alignment does not work
* Line breaks removed when editing content previously authored without using CKEditor
* I successfully uploaded an image, but cannot see it in the file browser
* Quote symbols are being changed to quote entities
CKEditor does not work in my theme
----------------------------------
Your theme may be missing the following code:
<?php print $scripts; ?>
Add that line of code to the head section of your theme.
Another possibility is that the following code might be missing in your theme:
<?php print $closure; ?>
The solution is similar as above - you need to add that line to your theme at the end of its code.
Finally, you can also switch to a different theme.
Known module incompatibilities
------------------------------
At the moment CKEditor will not show up when the following modules are enabled:
* Theme developer (http://drupal.org/node/318941)
* Theme Builder (http://drupal.org/node/271032)
Images are not displayed when submitted
---------------------------------------
Most probably you need to properly configure the input format. Either set it to "Full HTML" or add the <img> tag to the "Filtered HTML" format.
The full list of tags that should be allowed is available in the README.txt file.
Make sure that you have read the "Setting up filters" section in the README.txt file or on this page: http://drupal.ckeditor.com/filters
I followed the instructions, but CKEditor does not show up
----------------------------------------------------------
First of all make sure that CKEditor is enabled on this specific page.
Take a look into the source code of your page and search for something similar to:
"ckeditor": { "module_path":
If you cannot find such code, it means that CKEditor is disabled on that page/field.
Make sure that you have the right permissions to use CKEditor and check your CKEditor profile (include/exclude settings, minimum rows value).
If CKEditor is enabled, but it does not show up, try the following steps:
1. Switch to the default theme (Garland). If CKEditor appears, read the "CKEditor does not work in xxx theme" instructions.
If your theme already contains the "closure" and "scripts" statements, read below.
2. Make sure that you are using a browser that is compatible with CKEditor.
3. On some occasions other installed modules may cause CKEditor not to show up (although if you look at page source, you will see the CKEditor code).
Instead of CKEditor you may see a very small textarea.
This mostly happens when some other module causes a JavaScript error and CKEditor cannot load because of this.
To check this:
- Write down the list of currently installed modules.
- Disable all additional modules.
- If CKEditor shows up, start enabling the modules that you disabled in the previous step and find out which module is incompatible with CKEditor.
Use the project's site to report a new bug and provide the following details:
* Drupal version,
* CKEditor module version,
* CKEditor version,
* The name and version of the incompatible module.
* If additional steps are required to reproduce this issue, like creating a new special content or configuring this additional module in a special way, provide a detailed list of steps to follow.
- If the step above did not help, disable all additional modules and switch to the Garland theme. Clear the browser cache.
If CKEditor still does not work, it means that it may be corrupted.
Upload CKEditor again using an FTP client that warns you when files are truncated or corrupted.
- If CKEditor works for the Garland theme with all modules enabled, but it does not work for your theme with all modules disabled, then your theme is a problem.
Use the project's site to report a new bug and provide the following details:
* Drupal version,
* CKEditor module version,
* CKEditor version,
* The name and version of the incompatible theme.
4. Finally, if nothing helped, to find out where exactly the error occurred, you may use Firefox with the Firebug extension.
Use the project's site to create a new support request providing as much information as possible, including the exact JavaScript error message that you got.
Selected toolbar does not show for user 1
-----------------------------------------
There are two reasons why you are seeing a different toolbar (or do not see CKEditor at all):
- If "Allow users to customize CKEditor appearance" is enabled, each user
may override the profile settings in the "Rich text editor settings" section of the admin/user/N/edit page
("My Account" -> "Edit")
- A different profile is used for user 1 than you expect.
User 1 must be assigned a system role that corresponds to the privileges required.
If no role is assigned to User 1, they will have the privileges of an "authenticated user"
(usually it is the "Advanced" profile).
The CKEditor component is not installed correctly
-------------------------------------------------
Please remember that installing the CKEditor module is a two-step process. You need to download and unpack:
- the CKEditor module that integrates CKEditor with Drupal;
- CKEditor, the rich text editor.
If your CKEditor does not show, you should check whether all files were extracted correctly.
The /modules/ckeditor/ckeditor/ directory should contain the following files:
ckeditor.js, config.js, contents.css as well as directories named "skins", "themes", "lang", "images".
The correct directory structure is as follows:
modules <dir>
ckeditor <dir>
ckeditor.module
ckeditor.admin.inc
...
ckeditor <dir>
_source <dir>
images <dir>
lang <dir>
plugins <dir>
skins <dir>
themes <dir>
COPY_HERE.txt
ckeditor.js
...
CKEditor does not work after upgrading
--------------------------------------
This may be caused by the browser cache. Clear your browser cache and restart the browser if clearing the cache did not help.
If you upgraded the CKEditor module, make sure that all roles with "access ckeditor" permissions are assigned to at least one CKEditor profile.
Text alignment does not work
----------------------------
In the ckeditor.config.js file (located in the CKEditor module directory), the following classes are defined to provide the text alignment functionality:
config.justifyClasses = [ 'rteleft', 'rtecenter', 'rteright', 'rtejustify' ];
Unfortunately, some themes may override these styles and text alignment may not work as expected.
If you are using the Full HTML input format, you may simply comment out this line:
//config.justifyClasses = [ 'rteleft', 'rtecenter', 'rteright', 'rtejustify' ];
CKEditor will then use inline styles instead: <p style="text-align: right;">sample text</p>.
The problem is that inline styles may only be used with the Full HTML format.
Filtered HTML will strip that code, so do not use this solution with this input format.
For Filtered HTML things are a bit more complicated. For example if your theme defines such CSS style:
.content p { text-align: left; }
the text-align property set in the .rteright class will not work.
To align the <p> tag, you will have to edit the modules/ckeditor/ckeditor.css file and create a style that will be applied to the <p> tag:
.content p.rteleft {
text-align: left;
}
.content p.rteright {
text-align: right;
}
.content p.rtecenter {
text-align: center;
}
.content p.rtejustify {
text-align: justify;
}
Use DOM inspector (in Firefox) to check why the alignment does not work and to correct your CSS styles.
There is no universal workaround for this situation.
Line breaks removed when editing content previously authored without using CKEditor
-----------------------------------------------------------------------------------
The problem lies in the way you configured your input filters.
Before you enabled CKEditor, you probably had the Line break converter enabled.
Now you are trying to edit the same content with the Line break converter disabled, thus the line breaks are removed.
Possible workarounds:
* Enable the Line break converter (not recommended).
* Create a new input format with the Line break converter enabled. Use it just for old articles (recommended).
* Start with CKEditor disabled by default, replace all new line characters manually with a <br> tag, then use toggle to switch to WYSIWYG mode.
If you are a PHP programmer, you may try the approach proposed by BakerQ in http://drupal.org/node/240633
Quote symbols are being changed to quote entities
-------------------------------------------------
Some modules like Typogrify or SmartyPants require special handling of HTML entities.
For example, by default CKEditor will convert a double quote character (") to &quot;.
To disable processing of HTML entities, add the following line to the modules/ckeditor/ckeditor.config.js file:
config.entities = false;
It is also possible to disable processing of HTML entities for a selected CKEditor profile by adding the following line in "Advanced Options" -> "Custom JavaScript configuration":
entities = false;
CKEditor toolbar does not show up
---------------------------------
If the CKEditor toolbar does not show up and the styles/themes seem to be corrupted, it is possible that you uploaded the files via FTP in the ASCII mode.
Make sure you are uploading the files in the binary mode.
CKEditor adds <p>&nbsp;</p>
---------------------------
Sometimes you may notice that when editing nodes, the spacing between paragraphs is being doubled.
This may be caused by the HTML Purifier module when the AutoParagraph option is enabled.
When you disable it, make sure you clear the HTML Purifier cache.

View File

@@ -0,0 +1,30 @@
## Upgrade vs. Update ##
Before you continue reading you need to understand the difference between "upgrading" and "updating".
"Upgrading" refers to moving from one major release to another.
E.g. you are moving from Drupal 6 to Drupal 7.
"Updating" typically refers to bringing the editor or CKEditor module up to the latest minor version (e.g 7.x-1.0 to 7.x-1.2).
Updating instructions are available in the README.txt file.
## Upgrading the CKEditor module from 6.x to 7.x ##
Due to differences between the CKEditor module for Drupal 6 and Drupal 7 there is no way (at least at the moment)
to upgrade without uninstalling the previous version of the module (and losing the configuration settings stored in the database).
# Upgrading #
1. Backup the "ckeditor_role" and "ckeditor_settings" tables
and write down your custom configuration settings stored in the CKEditor profiles.
2. Disable and uninstall the CKEditor 6.x module.
3. Make a backup of the "sites/all/modules/ckeditor" folder or at least make sure to make a copy of the "ckeditor.config.js" file.
4. Delete the contents of the "sites/all/modules/ckeditor" folder.
5. Follow the README.txt file to install the CKEditor module for Drupal 7.
6. Adjust CKEditor profiles to your needs.
7. If you made any changes to "ckeditor.config.js" in Drupal 6, check the default configuration file distributed with the module for Drupal 7 and re-apply the changes.
## Migrating from the FCKeditor module ##
Please refer to the "Upgrading the CKEditor module from 6.x to 7.x" section.

View File

@@ -0,0 +1,34 @@
/* Indent & Justify classes */
.rteindent1 {
margin-right: 40px;
margin-left: 0;
}
.rteindent2 {
margin-right: 80px;
margin-left: 0;
}
.rteindent3 {
margin-right: 120px;
margin-left: 0;
}
.rteindent4 {
margin-right: 160px;
margin-left: 0;
}
.rteindent1[dir=ltr] {
margin-left: 40px;
margin-right: 0;
}
.rteindent2[dir=ltr] {
margin-left: 80px;
margin-right: 0;
}
.rteindent3[dir=ltr] {
margin-left: 120px;
margin-right: 0;
}
.rteindent4[dir=ltr] {
margin-left: 160px;
margin-right: 0;
}

View File

@@ -0,0 +1,73 @@
<?php
/**
* CKEditor - The text editor for the Internet - http://ckeditor.com
* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses of your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* @file
* CKEditor Module for Drupal 7.x
*
* This module allows Drupal to replace textarea fields with CKEditor.
*
* CKEditor is an online rich text editor that can be embedded inside web pages.
* It is a WYSIWYG (What You See Is What You Get) editor which means that the
* text edited in it looks as similar as possible to the results end users will
* see after the document gets published. It brings to the Web popular editing
* features found in desktop word processors such as Microsoft Word and
* OpenOffice.org Writer. CKEditor is truly lightweight and does not require any
* kind of installation on the client computer.
*/
/**
* Hook to register the CKEditor plugin - it would appear in the plugins list on the profile setting page.
*/
function hook_ckeditor_plugin() {
return array(
'plugin_name' => array(
// Name of the plugin used to write it.
'name' => 'plugin_name',
// Description of the plugin - it would be displayed in the plugins management section of profile settings.
'desc' => t('Plugin description'),
// The full path to the CKEditor plugins directory, with the trailing slash.
'path' => drupal_get_path('module', 'my_module') . '/plugin_dir/',
'buttons' => array(
'button_name' => array(
'icon' => 'path to button icon',
'label' => 'Button Label',
)
)
)
);
}
/**
* Hook to register the CKEditor security filter - it would appear in the security filters list on the profile setting page.
*/
function hook_ckeditor_security_filter() {
return array(
'security_filter_name' => array(
// Title of the security filter - it would be displayed in the security filters section of profile settings.
'title' => t('Security filter title'),
// Description of the security filter - it would be displayed in the security filters section of profile settings.
'description' => t('Security filter description'),
)
);
}
?>

View File

@@ -0,0 +1,101 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/*
WARNING: clear browser's cache after you modify this file.
If you don't do this, you may notice that browser is ignoring all your changes.
*/
CKEDITOR.editorConfig = function(config) {
config.indentClasses = [ 'rteindent1', 'rteindent2', 'rteindent3', 'rteindent4' ];
// [ Left, Center, Right, Justified ]
config.justifyClasses = [ 'rteleft', 'rtecenter', 'rteright', 'rtejustify' ];
// The minimum editor width, in pixels, when resizing it with the resize handle.
config.resize_minWidth = 450;
// Protect PHP code tags (<?...?>) so CKEditor will not break them when
// switching from Source to WYSIWYG.
// Uncommenting this line doesn't mean the user will not be able to type PHP
// code in the source. This kind of prevention must be done in the server
// side
// (as does Drupal), so just leave this line as is.
config.protectedSource.push(/<\?[\s\S]*?\?>/g); // PHP Code
config.protectedSource.push(/<code>[\s\S]*?<\/code>/gi); // Code tags
config.extraPlugins = '';
/*
* Append here extra CSS rules that should be applied into the editing area.
* Example:
* config.extraCss = 'body {color:#FF0000;}';
*/
config.extraCss = '';
/**
* Sample extraCss code for the "marinelli" theme.
*/
if (Drupal.settings.ckeditor.theme == "marinelli") {
config.extraCss += "body{background:#FFF;text-align:left;font-size:0.8em;}";
config.extraCss += "#primary ol, #primary ul{margin:10px 0 10px 25px;}";
}
if (Drupal.settings.ckeditor.theme == "newsflash") {
config.extraCss = "body{min-width:400px}";
}
/**
* CKEditor's editing area body ID & class.
* See http://drupal.ckeditor.com/tricks
* This setting can be used if CKEditor does not work well with your theme by default.
*/
config.bodyClass = '';
config.bodyId = '';
/**
* Sample bodyClass and BodyId for the "marinelli" theme.
*/
if (Drupal.settings.ckeditor.theme == "marinelli") {
config.bodyClass = 'singlepage';
config.bodyId = 'primary';
}
}
/*
* Sample toolbars
*/
//Toolbar definition for basic buttons
Drupal.settings.cke_toolbar_DrupalBasic = [ [ 'Format', 'Bold', 'Italic', '-', 'NumberedList','BulletedList', '-', 'Link', 'Unlink', 'Image' ] ];
//Toolbar definition for Advanced buttons
Drupal.settings.cke_toolbar_DrupalAdvanced = [
['Source'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'],
['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'],
['Maximize', 'ShowBlocks'],
'/',
['Format'],
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiRtl','BidiLtr'],
['Link','Unlink','Anchor','Linkit','LinkToNode','LinkToMenu'],
['DrupalBreak', 'DrupalPageBreak']
];
// Toolbar definiton for all buttons
Drupal.settings.cke_toolbar_DrupalFull = [
['Source'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'],
['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','Iframe'],
'/',
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiRtl','BidiLtr'],
['Link','Unlink','Anchor','Linkit','LinkToNode', 'LinkToMenu'],
'/',
['Format','Font','FontSize'],
['TextColor','BGColor'],
['Maximize', 'ShowBlocks'],
['DrupalBreak', 'DrupalPageBreak']
];

View File

@@ -0,0 +1,167 @@
/* Indent & Justify classes */
.rteindent1 {
margin-left: 40px;
}
.rteindent2 {
margin-left: 80px;
}
.rteindent3 {
margin-left: 120px;
}
.rteindent4 {
margin-left: 160px;
}
.rteleft {
text-align: left;
}
.rteright {
text-align: right;
}
.rtecenter {
text-align: center;
}
.rtejustify {
text-align: justify;
}
.ibimage_left {
float: left;
}
.ibimage_right {
float: right;
}
/* CKEditor padding in IE */
table.cke_editor fieldset {
padding: 0 !important;
}
/* hack with ie and garland editing area size fix - [#733512] */
.cke_editor{
display: table !important;
}
.cke_editor,#ie#bug {
display: inline-table !important;
}
/* Fix table border for Drupal's Seven theme - [#1020612] */
.cke_dialog tr td:last-child {
border-right: 0;
}
/*toolbar Drag & Drop*/
form#ckeditor-admin-profile-form textarea#edit-toolbar {
display: none;
}
form#ckeditor-admin-profile-form #edit-toolbar + .grippie {
display: none;
}
div.sortableList {
cursor: n-resize;
}
div.widthMarker {
height: 20px;
border-top: 1px dashed #CCC;
margin: 10px 0px 0px 1px;
padding-left: 1px;
text-align: center;
}
div.sortableList.group {
margin: 20px 0px 0px 0px;
}
div.sortableList div.sortableListDiv {
height: 30px;
margin-bottom: 3px;
width: 900px;
}
div.sortableList div.sortableListDiv span.sortableListSpan {
background-color: #F0F0EE;
height: 30px;
border-right: 1px dashed #CCC;
display: block;
}
div.sortableList div.sortableListDiv span.sortableListSpan ul {
width: 900px;
white-space: nowrap;
border: 1px solid #CCC;
list-style: none;
margin:0px;
padding: 0px 0px 0px 1px;
height: 30px;
}
div.sortableList div.sortableListDiv span.sortableListSpan ul li {
list-style: none;
cursor: move;
height: 18px;
min-width: 18px;
padding: 2px;
}
div.sortableList div.sortableListDiv span.sortableListSpan ul li.group {
min-width: 5px;
padding-left: 2px;
}
div.sortableList div.sortableListDiv span.sortableListSpan ul li img {
border: 0;
padding: 0;
margin: 0
}
li.sortableItem {
position: relative;
float: left;
margin: 3px 1px 1px 0px;
border: 1px solid #CCC;
background-color: #F0F0EE;
z-index: 99;
}
#security-filters .filter-text-formats {
float: left;
clear: both;
width: 15%;
font-size: 11px;
font-weight: bold;
padding: 10px 0px;
}
#security-filters .filter-text-formats .filter-text-format-status {
float: left;
padding-right: 20px;
}
#security-filters .filter-text-formats .enabled {
background: url(images/tick.png) no-repeat right center;
}
#security-filters .filter-text-formats .disabled {
background: url(images/delete.png) no-repeat right center;
}
#security-filters .filter-info {
float: left;
width: 85%;
}
#security-filters .fieldset-legend {
background: none;
padding-left: 10px;
}
#security-filters .fieldset-legend a {
font-weight: normal;
font-size: 10px;
padding-left: 5px;
}
#security-filters .filter-wrapper {
clear: both;
float: left;
border-bottom: 1px solid #CCCCCC;
width: 100%;
}
/* Fix for fieldset for-edit-apperance in Firefox*/
fieldset#edit-appearance div#groupLayout, div#allButtons {
border: 0;
padding: 0 0 0 0;
margin: 1em 0;
overflow: auto;
}
/* end of toolbar Drag & Drop */

View File

@@ -0,0 +1,12 @@
name = CKEditor
description = "Enables CKEditor (WYSIWYG HTML editor) for use instead of plain text fields."
core = 7.x
package = User interface
configure = admin/config/content/ckeditor
files[] = includes/ckeditor.user.inc
; Information added by drupal.org packaging script on 2012-12-22
version = "7.x-1.12"
core = "7.x"
project = "ckeditor"
datestamp = "1356180966"

View File

@@ -0,0 +1,597 @@
<?php
/*
* CKEditor - The text editor for the Internet - http://ckeditor.com
* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses of your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* @file
* CKEditor Module for Drupal 7.x
*
* This module allows Drupal to replace textarea fields with CKEditor.
*
* CKEditor is an online rich text editor that can be embedded inside web pages.
* It is a WYSIWYG (What You See Is What You Get) editor which means that the
* text edited in it looks as similar as possible to the results end users will
* see after the document gets published. It brings to the Web popular editing
* features found in desktop word processors such as Microsoft Word and
* OpenOffice.org Writer. CKEditor is truly lightweight and does not require any
* kind of installation on the client computer.
*/
/*
* Implementation of hook_install().
*
* This will automatically install the database tables for the CKEditor module for both MySQL and PostgreSQL databases.
*
* If you are using another database, you will have to install the tables manually, using the queries below as a reference.
*
* Note that the curly braces around table names are a Drupal-specific feature to allow for automatic database table prefixing,
* and will need to be removed.
*/
function ckeditor_install() {
module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib');
//searching ckeditor.js
$editor_path = _ckeditor_script_path();
//insert default input formats to profiles
db_insert('ckeditor_input_format')->fields(array("name" => "Advanced", "format" => 'filtered_html'))->execute();
db_insert('ckeditor_input_format')->fields(array("name" => "Full", "format" => 'full_html'))->execute();
//insert settings for default role
$arr = array();
$arr['filebrowser'] = 'none';
$arr['quickupload'] = 'f';
//security
$arr['ss'] = "2";
$arr['filters']['filter_html'] = 1;
//appearance
$arr['default'] = "t";
$arr['show_toggle'] = "t";
$arr['popup'] = variable_get('ckeditor_popup', 0) ? "t" : "f";
$arr['toolbar'] = "
[
['Source'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'],
['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'],
['Image','Media','Flash','Table','HorizontalRule','Smiley','SpecialChar'],
['Maximize', 'ShowBlocks'],
'/',
['Format'],
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl'],
['Link','Unlink','Anchor', 'Linkit']
]
";
$arr['expand'] = variable_get('ckeditor_toolbar_start_expanded', 1) ? "t" : "f";
$arr['width'] = variable_get("ckeditor_width", "100%");
$arr['lang'] = "en";
$arr['auto_lang'] = "t";
$arr['language_direction'] = "default";
//output
$arr['enter_mode'] = "p";
$arr['shift_enter_mode'] = "br";
$arr['font_format'] = 'p;div;pre;address;h1;h2;h3;h4;h5;h6';
$arr['format_source'] = "t";
$arr['format_output'] = "t";
$arr['custom_formatting'] = "f";
$arr['formatting']['custom_formatting_options'] = array('indent' => 'indent', 'breakBeforeOpen' => 'breakBeforeOpen', 'breakAfterOpen' => 'breakAfterOpen', 'breakAfterClose' => 'breakAfterClose');
//css
$arr['css_mode'] = "none";
$arr['css_path'] = variable_get("ckeditor_stylesheet", "");
//upload
//get permissions here like in _update_role_permissions
$arr['filebrowser'] = "none";
$arr['user_choose'] = "f";
$arr['ckeditor_load_method'] = "ckeditor.js";
$arr['ckeditor_load_time_out'] = 0;
$arr['scayt_autoStartup'] = "f";
//advanced options
$arr['html_entities'] = "f";
db_insert('ckeditor_settings')->fields(array("name" => "Advanced", "settings" => serialize($arr)))->execute();
//insert settings for advanced role
$arr['toolbar'] = "
[
['Source'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'],
['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'],
['Image','Media','Flash','Table','HorizontalRule','Smiley','SpecialChar','Iframe'],
'/',
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl'],
['Link','Unlink','Anchor', 'Linkit'],
['DrupalBreak'],
'/',
['Format','Font','FontSize'],
['TextColor','BGColor'],
['Maximize', 'ShowBlocks']
]
";
$arr['filters'] = array();
db_insert('ckeditor_settings')->fields(array("name" => "Full", "settings" => serialize($arr)))->execute();
$arr = array();
if ($editor_path) {
$arr['ckeditor_path'] = $editor_path;
}
db_insert('ckeditor_settings')->fields(array("name" => "CKEditor Global Profile", "settings" => serialize($arr)))->execute();
module_load_include('inc', 'ckeditor', 'includes/ckeditor.admin');
}
/**
* Implementation of hook_schema().
*/
function ckeditor_schema() {
$schema['ckeditor_settings'] = array(
'description' => 'Stores CKEditor profile settings',
'fields' => array(
'name' => array(
'type' => 'varchar',
'not null' => TRUE,
'default' => '',
'length' => 128,
'description' => 'Name of the CKEditor profile',
),
'settings' => array(
'type' => 'text',
'description' => 'Profile settings',
),
),
'primary key' => array('name')
);
$schema['ckeditor_input_format'] = array(
'description' => 'Stores CKEditor input format assignments',
'fields' => array(
'name' => array(
'type' => 'varchar',
'not null' => TRUE,
'default' => '',
'length' => 128,
'description' => 'Name of the CKEditor role',
),
'format' => array(
'type' => 'varchar',
'not null' => TRUE,
'default' => '',
'length' => 128,
'description' => 'Drupal filter format ID',
)
),
'primary key' => array('name', 'format'),
);
return $schema;
}
/**
* Implementation of hook_requirements().
*
* This hook will issue warnings if:
* - The CKEditor source files are not found.
* - The CKEditor source files are out of date.
* - Quick upload and/or the built-in file browser are used and $cookie_domain is not set.
*/
function ckeditor_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
module_load_include('module', 'ckeditor');
module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib');
$requirements['ckeditor'] = array(
'title' => t('CKEditor'),
'value' => t('Unknown'),
);
$requirements['ckeditor']['severity'] = REQUIREMENT_OK;
if (!_ckeditor_requirements_isinstalled()) {
$sourcepath = ckeditor_path('local');
$requirements['ckeditor']['description'] = t('CKEditor was not found in <code>%sourcepath</code>.', array('%sourcepath' => $sourcepath));
$requirements['ckeditor']['severity'] = REQUIREMENT_ERROR;
}
elseif (($installed_version = _ckeditor_requirements_getinstalledversion()) === NULL) {
$requirements['ckeditor']['description'] = t('CKEditor version could not be determined.');
$requirements['ckeditor']['severity'] = REQUIREMENT_INFO;
}
else {
$profile_name = _ckeditor_requirements_ckfinder_filebrowser_enabled();
if ($profile_name !== FALSE) {
if (!_ckeditor_requirements_cookiedomainset()) {
$requirements['ckeditor']['severity'] = REQUIREMENT_ERROR;
$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/config/content/ckeditor/edit/' . urlencode($profile_name))));
}
elseif ($error = _ckeditor_requirements_ckfinder_config_check($profile_name)) {
$requirements['ckeditor']['severity'] = REQUIREMENT_ERROR;
$requirements['ckeditor']['description'] = $error;
}
}
}
if ((($installed_version = _ckeditor_requirements_getinstalledversion()) !== NULL) && (-1 == version_compare($installed_version, '3.1 SVN')) && $installed_version != '%VERSION%') {
$requirements['ckeditor']['description'] = t('Some features are disabled because you are using an older version of CKEditor. Please upgrade to CKEditor 3.1 (or higher).');
$requirements['ckeditor']['severity'] = REQUIREMENT_INFO;
}
if (!empty($installed_version)) {
if ($installed_version == '%VERSION%') {
$requirements['ckeditor']['value'] = 'GIT version';
}
else {
$requirements['ckeditor']['value'] = $installed_version;
}
}
else {
$requirements['ckeditor']['value'] = t('Not found');
}
}
return $requirements;
}
/**
* Fetches the version of the installed CKEditor sources.
*
* It tries to locate the version of the CKEditor sources in
* ckeditor.js.
*
* Releases have a version number such as "3.0.1".
* SVN nightly releases have a minor version number with SVN appended: "3.0 SVN".
* SVN checkouts have the string "[Development]".
*
* This function is used by ckeditor_requirements().
*
* @return string Version number (eg. 3.0) of CKEditor. Null if not found in ckeditor_basic.js.
*/
function _ckeditor_requirements_getinstalledversion() {
module_load_include('module', 'ckeditor');
$editor_path = ckeditor_path('local', TRUE);
$jspath = $editor_path . '/ckeditor.js';
$configcontents = @file_get_contents($jspath);
if (!$configcontents) {
return NULL;
}
$matches = array();
if (preg_match('#,version:[\'\"]{1}(.*?)[\'\"]{1},#', $configcontents, $matches)) {
return $matches[1];
}
return NULL;
}
/**
* Executed when the built-in file browser is enabled.
* Returns FALSE if no errors are found in the config.php file, otherwise it returns an error message.
*
* @return string|boolean
*/
function _ckeditor_requirements_ckfinder_config_check($profile_name) {
global $base_url;
module_load_include('module', 'ckeditor');
$config_path = ckfinder_path('local') . '/config.php';
if (!file_exists($config_path)) {
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(
'!config' => $config_path,
'!ckfinder' => '<a href="http://ckfinder.com">CKFinder</a>'
));
}
if (!is_readable($config_path)) {
return t('CKEditor needs read permission to the <code>!config</code> file.', array('!config' => $config_path));
}
$config_contents = file($config_path);
//not a 100% valid check, but well... let's have at least some error checking
$require_once_found = FALSE;
$require_once_line = 0;
$userfiles_absolute_path_line = 0;
$force_single_extension_line = 0;
if ($config_contents) {
foreach ($config_contents as $line_num => $line) {
//make sure it doesn't start with a comment, unfortunately we're not protected if code is commented with /* */
if (!$require_once_found && strpos($line, "filemanager.config.php") !== FALSE && !preg_match(",^(?://|\#|\*|/\*),", trim($line))) {
$require_once_found = TRUE;
$require_once_line = $line_num;
}
/**
* @todo Finish this
*/
if (!$userfiles_absolute_path_line && strpos($line, '$Config[\'UserFilesAbsolutePath\']') !== FALSE && !preg_match(",^(?://|\#|\*|/\*),", trim($line))) {
$userfiles_absolute_path_line = $line_num;
}
if (!$force_single_extension_line && strpos($line, '$Config[\'ForceSingleExtension\']') !== FALSE && !preg_match(",^(?://|\#|\*|/\*),", trim($line))) {
$force_single_extension_line = $line_num;
}
}
}
if (!$require_once_found) {
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))));
}
if ($userfiles_absolute_path_line && $force_single_extension_line && (
$require_once_line < $userfiles_absolute_path_line || $require_once_line > $force_single_extension_line)) {
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));
}
return FALSE;
}
/**
* Checks if any profile requires an explicit setting of $cookie_domain
* in settings.php.
*
* %cookie_domain is required when the internal file browser or quick upload is used.
*
* This function is used by ckeditor_requirements().
*
* @return boolean True if any profile requires $cookie_domain.
*/
function _ckeditor_requirements_ckfinder_filebrowser_enabled() {
module_load_include('module', 'ckeditor');
$profiles = ckeditor_profile_load();
foreach ($profiles as $profile) {
if ((isset($profile->settings['filebrowser']) && $profile->settings['filebrowser'] == 'ckfinder')) {
return $profile->name;
}
}
return FALSE;
}
/**
* Checks if $cookie_domain was set.
*
* It has to include settings.php again because conf_init() sets
* $cookie_domain regardless of its presence in settings.php, so
* simply checking $GLOBALS['cookie_domain'] is not possible.
*
* This function is used by ckeditor_requirements().
*
* @return boolean True if $cookie_domain was set in settings.php.
*/
function _ckeditor_requirements_cookiedomainset() {
if (file_exists('./' . conf_path() . '/settings.php')) {
$settings = file_get_contents('./' . conf_path() . '/settings.php');
if (preg_match('#^\s*\$cookie_domain#m', $settings)) {
return TRUE;
}
}
return FALSE;
}
/**
* Updates broken settings for the 'Full' profile. (Resets toolbar to default)
*/
function ckeditor_update_7000() {
_ckeditor_d6_to_d7_migration();
$result = db_query("SELECT settings FROM {ckeditor_settings} WHERE name = :name", array(':name' => 'Full'))->fetchField();
$settings = unserialize($result);
$settings['toolbar'] = "
[
['Source'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'],
['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'],
'/',
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl'],
['Link','Unlink','Anchor'],
['DrupalBreak'],
'/',
['Format','Font','FontSize'],
['TextColor','BGColor'],
['Maximize', 'ShowBlocks']
]
";
$settings = serialize($settings);
$update = db_update('ckeditor_settings')
->fields(array(
'settings' => $settings,
))
->condition('name', 'Full', '=')
->execute();
}
/**
* Removes the 'DrupalBreak' button from the 'Advanced' profile. (Resets toolbar to default)
*/
function ckeditor_update_7001() {
$result = db_query("SELECT settings FROM {ckeditor_settings} WHERE name = :name", array(':name' => 'Advanced'))->fetchField();
$settings = unserialize($result);
$settings['toolbar'] = "
[
['Source'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'],
['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'],
['Maximize', 'ShowBlocks'],
'/',
['Format'],
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl'],
['Link','Unlink','Anchor']
]
";
$settings = serialize($settings);
$update = db_update('ckeditor_settings')
->fields(array(
'settings' => $settings,
))
->condition('name', 'Advanced', '=')
->execute();
}
/**
* Rewrites 'Path to CKEditor' to new flags.
*/
function ckeditor_update_7002() {
$result = db_query("SELECT settings FROM {ckeditor_settings} WHERE name = :name", array(':name' => 'CKEditor Global Profile'))->fetchField();
$settings = unserialize($result);
if ($settings['ckeditor_path'] == '%b/sites/all/libraries/ckeditor') {
$settings['ckeditor_path'] = '%l/ckeditor';
}
else {
$settings['ckeditor_path'] = str_replace('%b/', '', $settings['ckeditor_path']);
$settings['ckeditor_path'] = str_replace('%b', '', $settings['ckeditor_path']);
}
$settings = serialize($settings);
$update = db_update('ckeditor_settings')
->fields(array(
'settings' => $settings,
))
->condition('name', 'CKEditor Global Profile', '=')
->execute();
}
/**
* Fixes static paths to plugin files.
*/
function ckeditor_update_7003() {
module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib');
module_load_include('module', 'ckeditor');
_ckeditor_d6_to_d7_migration();
$render = array();
$render["%base_path%"] = base_path();
$render["%editor_path%"] = ckeditor_path('relative') . '/';
$render["%ckeditor_path%"] = ckeditor_module_path('relative');
$render["%plugin_dir%"] = $render["%module_path%"] . '/plugins/';
$result = db_query("SELECT * FROM {ckeditor_settings} WHERE name <> :name", array(':name' => 'CKEditor Global Profile'))->fetchAllAssoc('name');
foreach ((array) $result as $profile) {
$name = $profile->name;
$settings = unserialize($profile->settings);
foreach ((array) $settings['loadPlugins'] as $i => $plugin) {
$settings['loadPlugins'][$i]['path'] = str_replace(array_values($render), array_keys($render), $plugin['path']);
}
$settings = serialize($settings);
$update = db_update('ckeditor_settings')
->fields(array(
'settings' => $settings,
))
->condition('name', $name, '=')
->execute();
}
}
/**
* Minor update for those who have run update.php with problems.
* @see http://drupal.org/node/1347682 for a better explanation.
*/
function ckeditor_update_7004() {
return _ckeditor_d6_to_d7_migration();
}
/**
* Fixes plugin paths stored in database.
* @see http://drupal.org/node/1864760 for more information
*/
function ckeditor_update_7005() {
$result = db_query("SELECT * FROM {ckeditor_settings} WHERE name <> :name", array(':name' => 'CKEditor Global Profile'))->fetchAllAssoc('name');
foreach ((array) $result as $profile) {
$name = $profile->name;
$settings = unserialize($profile->settings);
$replace = array(
"%base_path%%editor_path%" => "%editor_path%",
"%base_path%%module_path%" => "%module_path%",
"%base_path%%plugin_dir%" => "%plugin_dir%",
"%base_path%%plugin_dir_extra%" => "%plugin_dir_extra%"
);
foreach ((array) $settings['loadPlugins'] as $i => $plugin) {
$settings['loadPlugins'][$i]['path'] = str_replace(array_keys($replace), array_values($replace), $plugin['path']);
}
$settings = serialize($settings);
db_update('ckeditor_settings')
->fields(array(
'settings' => $settings,
))
->condition('name', $name, '=')
->execute();
}
}
/**
* Adapts D6 table structure to D7 schema.
*/
function _ckeditor_d6_to_d7_migration() {
if (db_table_exists('ckeditor_role')) {
db_drop_table('ckeditor_role');
}
if (!db_table_exists('ckeditor_input_format')) {
$ckeditor_input_format = array(
'description' => 'Stores CKEditor input format assignments',
'fields' => array(
'name' => array(
'type' => 'varchar',
'not null' => TRUE,
'default' => '',
'length' => 128,
'description' => 'Name of the CKEditor role',
),
'format' => array(
'type' => 'varchar',
'not null' => TRUE,
'default' => '',
'length' => 128,
'description' => 'Drupal filter format ID',
)
),
'primary key' => array('name', 'format'),
);
db_create_table('ckeditor_input_format', $ckeditor_input_format);
}
}

View File

@@ -0,0 +1,685 @@
<?php
/**
* CKEditor - The text editor for the Internet - http://ckeditor.com
* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses of your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* @file
* CKEditor Module for Drupal 7.x
*
* This module allows Drupal to replace textarea fields with CKEditor.
*
* CKEditor is an online rich text editor that can be embedded inside web pages.
* It is a WYSIWYG (What You See Is What You Get) editor which means that the
* text edited in it looks as similar as possible to the results end users will
* see after the document gets published. It brings to the Web popular editing
* features found in desktop word processors such as Microsoft Word and
* OpenOffice.org Writer. CKEditor is truly lightweight and does not require any
* kind of installation on the client computer.
*/
/**
* The name of the simplified toolbar that should be forced.
* Make sure that this toolbar is defined in ckeditor.config.js or fckconfig.js.
*/
define('CKEDITOR_FORCE_SIMPLE_TOOLBAR_NAME', 'DrupalBasic');
define('CKEDITOR_ENTERMODE_P', 1);
define('CKEDITOR_ENTERMODE_BR', 2);
define('CKEDITOR_ENTERMODE_DIV', 3);
global $_ckeditor_configuration;
global $_ckeditor_ids;
require_once('includes/ckeditor.user.inc');
$_ckeditor_configuration = array();
$_ckeditor_ids = array();
/**
* Implementation of hook_menu().
*/
function ckeditor_menu() {
$items = array();
$items['ckeditor/xss'] = array(
'title' => 'XSS Filter',
'description' => 'XSS Filter.',
'page callback' => 'ckeditor_filter_xss',
'file' => 'includes/ckeditor.page.inc',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['ckeditor/disable/wysiwyg/%'] = array(
'title' => 'Disable the WYSIWYG module',
'description' => 'Disable WYSIWYG module.',
'page callback' => 'ckeditor_disable_wysiwyg',
'page arguments' => array(3),
'file' => 'includes/ckeditor.admin.inc',
'access arguments' => array('administer ckeditor'),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['admin/config/content/ckeditor'] = array(
'title' => 'CKEditor',
'description' => 'Configure the rich text editor.',
'page callback' => 'ckeditor_admin_main',
'file' => 'includes/ckeditor.admin.inc',
'access arguments' => array('administer ckeditor'),
'type' => MENU_NORMAL_ITEM,
);
$items['admin/config/content/ckeditor/skinframe'] = array(
'title' => 'Change skin of CKEditor',
'description' => 'Configure skin for CKEditor.',
'page callback' => 'ckeditor_skinframe',
'file' => 'includes/ckeditor.admin.inc',
'access arguments' => array('administer ckeditor'),
'type' => MENU_CALLBACK,
);
$items['admin/config/content/ckeditor/add'] = array(
'title' => 'Add a new CKEditor profile',
'description' => 'Configure the rich text editor.',
'page callback' => 'drupal_get_form',
'page arguments' => array('ckeditor_admin_profile_form'),
'file' => 'includes/ckeditor.admin.inc',
'access arguments' => array('administer ckeditor'),
'type' => MENU_CALLBACK,
);
$items['admin/config/content/ckeditor/clone/%ckeditor_profile'] = array(
'title' => 'Clone the CKEditor profile',
'description' => 'Configure the rich text editor.',
'page callback' => 'drupal_get_form',
'page arguments' => array('ckeditor_admin_profile_clone_form', 5),
'file' => 'includes/ckeditor.admin.inc',
'access arguments' => array('administer ckeditor'),
'type' => MENU_CALLBACK,
);
$items['admin/config/content/ckeditor/edit/%ckeditor_profile'] = array(
'title' => 'Edit the CKEditor profile',
'description' => 'Configure the rich text editor.',
'page callback' => 'drupal_get_form',
'page arguments' => array('ckeditor_admin_profile_form', 5),
'file' => 'includes/ckeditor.admin.inc',
'access arguments' => array('administer ckeditor'),
'type' => MENU_CALLBACK,
);
$items['admin/config/content/ckeditor/delete/%ckeditor_profile'] = array(
'title' => 'Delete the CKEditor profile',
'description' => 'Configure the rich text editor.',
'page callback' => 'drupal_get_form',
'page arguments' => array('ckeditor_admin_profile_delete_form', 5),
'file' => 'includes/ckeditor.admin.inc',
'access arguments' => array('administer ckeditor'),
'type' => MENU_CALLBACK,
);
$items['admin/config/content/ckeditor/addg'] = array(
'title' => 'Add the CKEditor Global profile',
'description' => 'Configure the rich text editor.',
'page callback' => 'drupal_get_form',
'page arguments' => array('ckeditor_admin_global_profile_form', 'add'),
'file' => 'includes/ckeditor.admin.inc',
'access arguments' => array('administer ckeditor'),
'type' => MENU_CALLBACK,
);
$items['admin/config/content/ckeditor/editg'] = array(
'title' => 'Edit the CKEditor Global profile',
'description' => 'Configure the rich text editor.',
'page callback' => 'drupal_get_form',
'page arguments' => array('ckeditor_admin_global_profile_form', 'edit'),
'file' => 'includes/ckeditor.admin.inc',
'access arguments' => array('administer ckeditor'),
'type' => MENU_CALLBACK,
);
return $items;
}
/**
* Implementation of hook_permission().
*
* People -> Permissions
*/
function ckeditor_permission() {
$arr = array();
$arr['administer ckeditor'] = array(
'title' => t('Administer CKEditor access'),
'description' => t('Allow users to change CKEditor settings.')
);
$arr['customize ckeditor'] = array(
'title' => t('Customize CKEditor appearance'),
'description' => t('Allow users to customize CKEditor appearance.')
);
if (file_exists(ckfinder_path('local'))) {
$arr['allow CKFinder file uploads'] = array(
'title' => t('CKFinder access'),
'description' => t('Allow users to use CKFinder.')
);
}
return $arr;
}
/**
* Implementation of hook_help().
*
* This function delegates the execution to ckeditor_help_delegate() in includes/ckeditor.page.inc to
* lower the amount of code in ckeditor.module.
*/
function ckeditor_help($path, $arg) {
module_load_include('inc', 'ckeditor', 'includes/ckeditor.page');
return module_invoke('ckeditor', 'help_delegate', $path, $arg);
}
/**
* Check CKEditor version
*/
function ckeditor_get_version($main_version = FALSE) {
static $ckeditor_version = FALSE;
if ($ckeditor_version !== FALSE) {
if (!$main_version) {
return $ckeditor_version;
}
$version = explode('.', $ckeditor_version);
return trim($version[0]);
}
$editor_path = ckeditor_path('local', TRUE);
$jspath = $editor_path . '/ckeditor.js';
$configcontents = @file_get_contents($jspath);
if (!$configcontents) {
return $ckeditor_version = NULL;
}
$matches = array();
if (preg_match('#,version:[\'\"]{1}(.*?)[\'\"]{1},#', $configcontents, $matches)) {
$ckeditor_version = $matches[1];
if ($ckeditor_version == '%VERSION%') {
$ckeditor_version = '4.0.0';
}
if (!$main_version) {
return $ckeditor_version;
}
$version = explode('.', $ckeditor_version);
return trim($version[0]);
}
return $ckeditor_version = NULL;
}
/**
* Implementation of hook_init().
*/
function ckeditor_init() {
drupal_add_css(drupal_get_path('module', 'ckeditor') . '/ckeditor.css');
}
/**
* Implements hook_form_FORM_ID_alter() for user_profile_form().
*/
function ckeditor_form_user_profile_form_alter(&$form, &$form_state) {
if ($form['#user_category'] == 'account') {
module_load_include('inc', 'ckeditor', 'includes/ckeditor.user');
ckeditor_user_customize($form, $form_state, 'user_profile_form');
}
}
/**
* Implementation of hook_element_info_alter().
*
* Replace the textarea with CKEditor using a callback function (ckeditor_pre_render_text_format).
*/
function ckeditor_element_info_alter(&$types) {
$types['text_format']['#pre_render'][] = 'ckeditor_pre_render_text_format';
}
/**
* This function creates the HTML objects required for CKEditor.
*
* @param $element
* A fully populated form element to add the editor to.
* @return
* The same $element with extra CKEditor markup and initialization.
*/
function ckeditor_pre_render_text_format($element) {
static $init = FALSE;
if (!isset($element['#format'])) {
return $element;
}
module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib');
if ($init === FALSE) {
$input_formats = ckeditor_profiles_compile();
drupal_add_js(array('ckeditor' => array('input_formats' => $input_formats, 'plugins' => array())), 'setting');
$init = TRUE;
}
if (isset($element['value'])) {
if (!isset($element['format'])) {
return $element;
}
if (isset($element['summary'])) {
$element['value'] = ckeditor_load_by_field($element['value'], $element['format']['format'], TRUE, $element['summary']['#id']);
$element['summary'] = ckeditor_load_by_field($element['summary'], $element['format']['format'], FALSE);
}
else {
$element['value'] = ckeditor_load_by_field($element['value'], $element['format']['format']);
}
}
else {
$element = ckeditor_load_by_field($element, $element['#format']);
}
return $element;
}
/**
* Load all profiles. Just load one profile if $name is passed in.
*/
function ckeditor_profile_load($name = '', $clear = FALSE) {
static $profiles = array();
global $user;
if (empty($profiles) || $clear === TRUE) {
$result = db_select('ckeditor_settings', 's')->fields('s')->execute();
foreach ($result as $data) {
$data->settings = unserialize($data->settings);
$data->input_formats = array();
$profiles[$data->name] = $data;
}
$input_formats = filter_formats($user);
$result = db_select('ckeditor_input_format', 'f')->fields('f')->execute();
foreach ($result as $data) {
if (isset($input_formats[$data->format])) {
$profiles[$data->name]->input_formats[$data->format] = $input_formats[$data->format]->name;
}
}
}
return ($name ? (isset($profiles[urldecode($name)]) ? $profiles[urldecode($name)] : FALSE) : $profiles);
}
/**
* Generate base path of the Drupal installation.
*
* @return
* Path of the Drupal installation.
*/
function ckeditor_base_path($mode = 'relative') {
if ($mode == 'local') {
return $cke_base_local_path = '.';
}
return rtrim(base_path(), '/');
}
/**
* Generate module path of the CKEditor module.
*
* @return
* Path of CKEditor module.
*/
function ckeditor_module_path($mode = 'relative') {
switch ($mode) {
default:
case 'relative':
return ckeditor_base_path('relative') . '/' . drupal_get_path('module', 'ckeditor');
case 'local':
return ckeditor_base_path('local') . '/' . drupal_get_path('module', 'ckeditor');
case 'url':
return drupal_get_path('module', 'ckeditor');
}
}
/**
* Generate library path of the Drupal installation.
*
* @return
* Path of library in the Drupal installation.
*/
function ckeditor_library_path($mode = 'relative') {
switch ($mode) {
default:
case 'relative':
return ckeditor_base_path('relative') . '/sites/all/libraries';
case 'local':
return ckeditor_base_path('local') . '/sites/all/libraries';
case 'url':
return 'sites/all/libraries';
}
}
/**
* Read the CKEditor path from the Global profile.
*
* @return
* Path to CKEditor folder.
*/
function ckeditor_path($mode = 'relative', $refresh = FALSE) {
static $cke_static;
if (!isset($cke_static)) {
$cke_static = array();
}
if ($refresh || !isset($cke_static[$mode])) {
$global_profile = ckeditor_profile_load('CKEditor Global Profile', $refresh);
switch ($mode) {
default:
case 'relative':
if ($global_profile && isset($global_profile->settings['ckeditor_path'])) {
$cke_path = $global_profile->settings['ckeditor_path'];
$cke_path = strtr($cke_path, array("%b" => ckeditor_base_path('relative'), "%m" => ckeditor_module_path('relative'), "%l" => ckeditor_library_path('relative')));
$cke_path = str_replace('\\', '/', $cke_path);
$cke_path = str_replace('//', '/', $cke_path);
return $cke_static[$mode] = $cke_path;
}
return $cke_static[$mode] = ckeditor_module_path('relative') . '/ckeditor';
case 'local':
if ($global_profile) {
if (!empty($global_profile->settings['ckeditor_local_path'])) {
return $cke_static[$mode] = $global_profile->settings['ckeditor_local_path'];
}
if (isset($global_profile->settings['ckeditor_path'])) {
$cke_local_path = $global_profile->settings['ckeditor_path'];
$cke_local_path = strtr($cke_local_path, array("%b" => ckeditor_base_path('local'), "%m" => ckeditor_module_path('local'), "%l" => ckeditor_library_path('local')));
return $cke_static[$mode] = $cke_local_path;
}
}
return $cke_static[$mode] = ckeditor_module_path('local') . '/ckeditor';
case 'url':
if ($global_profile && isset($global_profile->settings['ckeditor_path'])) {
$cke_path = $global_profile->settings['ckeditor_path'];
$cke_path = strtr($cke_path, array("%m" => ckeditor_module_path('url'), "%l" => ckeditor_library_path('url')));
$cke_path = str_replace('\\', '/', $cke_path);
$cke_path = str_replace('//', '/', $cke_path);
//In D7 base path in URL mode is not needed, so we need to remove it with trailing slash (if exists)
$cke_path = str_replace(array("%b/", "%b"), '', $cke_path);
return $cke_static[$mode] = $cke_path;
}
return $cke_static[$mode] = ckeditor_module_path('url') . '/ckeditor';
}
}
return $cke_static[$mode];
}
/**
* Read the CKEditor plugins path from the Global profile.
*
* @return
* Path to CKEditor plugins folder.
*/
function ckeditor_plugins_path($mode = 'relative', $refresh = FALSE) {
static $cke_static;
if (!isset($cke_static)) {
$cke_static = array();
}
if ($refresh || !isset($cke_static[$mode])) {
$global_profile = ckeditor_profile_load('CKEditor Global Profile', $refresh);
switch ($mode) {
default:
case 'relative':
if ($global_profile && isset($global_profile->settings['ckeditor_plugins_path'])) {
$cke_plugins_path = $global_profile->settings['ckeditor_plugins_path'];
$cke_plugins_path = strtr($cke_plugins_path, array("%b" => ckeditor_base_path('relative'), "%m" => ckeditor_module_path('relative'), "%l" => ckeditor_library_path('relative')));
$cke_plugins_path = str_replace('\\', '/', $cke_plugins_path);
$cke_plugins_path = str_replace('//', '/', $cke_plugins_path);
$cke_plugins_path = rtrim($cke_plugins_path, ' \/');
return $cke_static[$mode] = $cke_plugins_path;
}
return $cke_static[$mode] = ckeditor_module_path('relative') . '/plugins';
case 'local':
if ($global_profile) {
if (!empty($global_profile->settings['ckeditor_plugins_local_path'])) {
return $cke_static[$mode] = $global_profile->settings['ckeditor_plugins_local_path'];
}
if (isset($global_profile->settings['ckeditor_plugins_path'])) {
$cke_plugins_local_path = $global_profile->settings['ckeditor_plugins_path'];
$cke_plugins_local_path = strtr($cke_plugins_local_path, array("%b" => ckeditor_base_path('local'), "%m" => ckeditor_module_path('local'), "%l" => ckeditor_library_path('local')));
return $cke_static[$mode] = $cke_plugins_local_path;
}
}
return $cke_static[$mode] = ckeditor_module_path('local') . '/plugins';
case 'url':
if ($global_profile && isset($global_profile->settings['ckeditor_plugins_path'])) {
$cke_plugins_path = $global_profile->settings['ckeditor_plugins_path'];
$cke_plugins_path = strtr($cke_plugins_path, array("%m" => ckeditor_module_path('url'), "%l" => ckeditor_library_path('url')));
$cke_plugins_path = str_replace('\\', '/', $cke_plugins_path);
$cke_plugins_path = str_replace('//', '/', $cke_plugins_path);
$cke_plugins_path = rtrim($cke_plugins_path, ' \/');
//In D7 base path in URL mode is not needed, so we need to remove it with trailing slash (if exists)
$cke_plugins_path = str_replace(array("%b/", "%b"), '', $cke_plugins_path);
return $cke_static[$mode] = $cke_plugins_path;
}
return $cke_static[$mode] = ckeditor_module_path('url') . '/plugins';
}
}
return $cke_static[$mode];
}
/**
* Read the CKFinder path from the Global profile.
*
* @return
* Path to CKFinder folder.
*/
function ckfinder_path($mode = 'relative', $refresh = FALSE) {
static $cke_static;
if (!isset($cke_static)) {
$cke_static = array();
}
if ($refresh || !isset($cke_static[$mode])) {
$global_profile = ckeditor_profile_load('CKEditor Global Profile', $refresh);
switch ($mode) {
default:
case 'relative':
if ($global_profile && isset($global_profile->settings['ckfinder_path'])) {
$ckfinder_path = $global_profile->settings['ckfinder_path'];
$ckfinder_path = strtr($ckfinder_path, array("%b" => ckeditor_base_path('relative'), "%m" => ckeditor_module_path('relative'), "%l" => ckeditor_library_path('relative')));
$ckfinder_path = str_replace('\\', '/', $ckfinder_path);
$ckfinder_path = str_replace('//', '/', $ckfinder_path);
return $cke_static[$mode] = $ckfinder_path;
}
return $cke_static[$mode] = ckeditor_module_path('relative') . '/ckfinder';
case 'local':
if ($global_profile) {
if (!empty($global_profile->settings['ckfinder_local_path'])) {
return $cke_static[$mode] = $global_profile->settings['ckfinder_local_path'];
}
if (isset($global_profile->settings['ckfinder_path'])) {
$ckfinder_path = $global_profile->settings['ckfinder_path'];
$ckfinder_path = strtr($ckfinder_path, array("%b" => ckeditor_base_path('local'), "%m" => ckeditor_module_path('local'), "%l" => ckeditor_library_path('local')));
return $cke_static[$mode] = $ckfinder_path;
}
}
return $cke_static[$mode] = ckeditor_module_path('local') . '/ckfinder';
case 'url':
if ($global_profile && isset($global_profile->settings['ckfinder_path'])) {
$ckfinder_path = $global_profile->settings['ckfinder_path'];
$ckfinder_path = strtr($ckfinder_path, array("%m" => ckeditor_module_path('url'), "%l" => ckeditor_library_path('url')));
$ckfinder_path = str_replace('\\', '/', $cke_plugins_path);
$ckfinder_path = str_replace('//', '/', $cke_plugins_path);
//In D7 base path in URL mode is not needed, so we need to remove it with trailing slash (if exists)
$ckfinder_path = str_replace(array("%b/", "%b"), '', $ckfinder_path);
return $cke_static[$mode] = $ckfinder_path;
}
return $cke_static[$mode] = ckeditor_module_path('url') . '/ckfinder';
}
}
return $cke_static[$mode];
}
/**
* Implementation of hook_features_api().
*
* Allow exporting of CKEditor profiles by the Features module.
*/
function ckeditor_features_api() {
return array(
'ckeditor_profile' => array(
'name' => t('CKEditor profiles'),
'default_hook' => 'ckeditor_profile_defaults',
'default_file' => FEATURES_DEFAULTS_INCLUDED,
'file' => drupal_get_path('module', 'ckeditor') . '/includes/ckeditor.features.inc',
)
);
}
/**
* Implementation of hook_file_download().
* Support for private downloads.
* CKEditor does not implement any kind of potection on private files.
*/
function ckeditor_file_download($uri) {
if ($path = file_create_url($uri)) {
$result = db_query("SELECT f.* FROM {file_managed} f WHERE uri = :uri", array(':uri' => $uri));
foreach ($result as $record) {
return NULL;
}
//No info in DB? Probably a file uploaded with FCKeditor / CKFinder
$global_profile = ckeditor_profile_load("CKEditor Global Profile");
//Assume that files inside of ckeditor directory belong to the CKEditor. If private directory is set, let the decision about protection to the user.
$private_dir_db = $private_dir = isset($global_profile->settings['private_dir']) ? trim($global_profile->settings['private_dir'], '\/') : '';
$private_dir_db = str_replace(array('\\%u', '\\%n'), array('', ''), $private_dir_db);
$private_dir = preg_quote($private_dir, '#');
$private_dir = strtr($private_dir, array('%u' => '(\d+)', '%n' => '([\x80-\xF7 \w@.-]+)')); // regex for %n taken from user_validate_name() in user.module
$private_dir = trim($private_dir, '\/');
$regex = '#^' . preg_quote('private://', '#') . $private_dir . '#';
if (!strstr($uri, 'private://') && !strstr($uri, 'public://')) {
$path = 'private://' . $uri;
}
else {
$path = $uri;
}
//check if CKEditor's "Enable access to files located in the private folder" option is disabled or enabled
$allow_download_private_files = FALSE;
if (isset($global_profile->settings['ckeditor_allow_download_private_files']) && $global_profile->settings['ckeditor_allow_download_private_files'] === 't') {
$allow_download_private_files = TRUE;
}
//denied access to file if private upload is set and CKEditor's "Enable access to files located in the private folder" option is disabled
if ($allow_download_private_files == FALSE)
return NULL;
//check if file can be served by comparing regex and path to file
if (preg_match($regex, $path)) {
$info = image_get_info($uri);
return array('Content-Type' => $info['mime_type']);
}
}
}
/**
* Implementation of hook_modules_enabled().
*
* Enable disabled plugins by hook_modules_disabled().
*/
function ckeditor_modules_enabled($modules) {
module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib');
$profiles_list = ckeditor_profile_input_formats();
$plugins_list = ckeditor_load_plugins();
foreach ($profiles_list AS $_profile => $_inputs) {
$changed = FALSE;
$profile = ckeditor_profile_load($_profile);
if (!isset($profile->settings['loadPlugins'])) continue;
foreach (array_keys((array) $profile->settings['loadPlugins']) as $plugin_name) {
if (isset($profile->settings['loadPlugins'][$plugin_name]['active']) && $profile->settings['loadPlugins'][$plugin_name]['active'] == 0 && array_key_exists($plugin_name, $plugins_list)) {
$profile->settings['loadPlugins'][$plugin_name]['active'] = 1;
$changed = TRUE;
}
}
if ($changed === TRUE) {
db_update('ckeditor_settings')
->fields(array(
'settings' => serialize($profile->settings)
))
->condition('name', $profile->name, '=')
->execute();
}
}
}
/**
* Implementation of hook_modules_disabled().
*
* Disable enabled plugins in CKEditor profiles added by disabled modules.
*/
function ckeditor_modules_disabled($modules) {
module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib');
$profiles_list = ckeditor_profile_input_formats();
$plugins_list = ckeditor_load_plugins();
foreach ($profiles_list AS $_profile => $_inputs) {
$changed = FALSE;
$profile = ckeditor_profile_load($_profile);
foreach (array_keys((array) $profile->settings['loadPlugins']) as $plugin_name) {
if (!array_key_exists($plugin_name, $plugins_list)) {
$profile->settings['loadPlugins'][$plugin_name]['active'] = 0;
$changed = TRUE;
}
}
if ($changed === TRUE) {
db_update('ckeditor_settings')
->fields(array(
'settings' => serialize($profile->settings)
))
->condition('name', $profile->name, '=')
->execute();
}
}
}
/**
* Implementation of hook_modules_uninstalled().
*
* Remove enabled plugins in CKEditor profiles added by uninstalled modules.
*/
function ckeditor_modules_uninstalled($modules) {
module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib');
$profiles_list = ckeditor_profile_input_formats();
$plugins_list = ckeditor_load_plugins();
foreach ($profiles_list AS $_profile => $_inputs) {
$changed = FALSE;
$profile = ckeditor_profile_load($_profile);
foreach (array_keys((array) $profile->settings['loadPlugins']) as $plugin_name) {
if (!array_key_exists($plugin_name, $plugins_list)) {
unset($profile->settings['loadPlugins'][$plugin_name]);
$changed = TRUE;
}
}
if ($changed === TRUE) {
db_update('ckeditor_settings')
->fields(array(
'settings' => serialize($profile->settings)
))
->condition('name', $profile->name, '=')
->execute();
}
}
}

View File

@@ -0,0 +1,91 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/*
* This file is used/requested by the 'Styles' button.
* The 'Styles' button is not enabled by default in DrupalFull and DrupalFiltered toolbars.
*/
if(typeof(CKEDITOR) !== 'undefined') {
CKEDITOR.addStylesSet( 'drupal',
[
/* Block Styles */
// These styles are already available in the "Format" drop-down list, so they are
// not needed here by default. You may enable them to avoid placing the
// "Format" drop-down list in the toolbar, maintaining the same features.
/*
{ name : 'Paragraph' , element : 'p' },
{ name : 'Heading 1' , element : 'h1' },
{ name : 'Heading 2' , element : 'h2' },
{ name : 'Heading 3' , element : 'h3' },
{ name : 'Heading 4' , element : 'h4' },
{ name : 'Heading 5' , element : 'h5' },
{ name : 'Heading 6' , element : 'h6' },
{ name : 'Preformatted Text', element : 'pre' },
{ name : 'Address' , element : 'address' },
*/
{ name : 'Blue Title' , element : 'h3', styles : { 'color' : 'Blue' } },
{ name : 'Red Title' , element : 'h3', styles : { 'color' : 'Red' } },
/* Inline Styles */
// These are core styles available as toolbar buttons. You may opt enabling
// some of them in the "Styles" drop-down list, removing them from the toolbar.
/*
{ name : 'Strong' , element : 'strong', overrides : 'b' },
{ name : 'Emphasis' , element : 'em' , overrides : 'i' },
{ name : 'Underline' , element : 'u' },
{ name : 'Strikethrough' , element : 'strike' },
{ name : 'Subscript' , element : 'sub' },
{ name : 'Superscript' , element : 'sup' },
*/
{ name : 'Marker: Yellow' , element : 'span', styles : { 'background-color' : 'Yellow' } },
{ name : 'Marker: Green' , element : 'span', styles : { 'background-color' : 'Lime' } },
{ name : 'Big' , element : 'big' },
{ name : 'Small' , element : 'small' },
{ name : 'Typewriter' , element : 'tt' },
{ name : 'Computer Code' , element : 'code' },
{ name : 'Keyboard Phrase' , element : 'kbd' },
{ name : 'Sample Text' , element : 'samp' },
{ name : 'Variable' , element : 'var' },
{ name : 'Deleted Text' , element : 'del' },
{ name : 'Inserted Text' , element : 'ins' },
{ name : 'Cited Work' , element : 'cite' },
{ name : 'Inline Quotation' , element : 'q' },
{ name : 'Language: RTL' , element : 'span', attributes : { 'dir' : 'rtl' } },
{ name : 'Language: LTR' , element : 'span', attributes : { 'dir' : 'ltr' } },
/* Object Styles */
{
name : 'Image on Left',
element : 'img',
attributes :
{
'style' : 'padding: 5px; margin-right: 5px',
'border' : '2',
'align' : 'left'
}
},
{
name : 'Image on Right',
element : 'img',
attributes :
{
'style' : 'padding: 5px; margin-left: 5px',
'border' : '2',
'align' : 'right'
}
}
]);
}

View File

@@ -0,0 +1,3 @@
Go to http://ckeditor.com and download the latest version. Then
uncompress the contents of the "ckeditor" directory of the downloaded file to
this folder (modules/ckeditor/ckeditor).

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 971 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 956 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,132 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function ($) {
Drupal.ckeditor_ver = false;
$(document).ready(function() {
if (typeof(CKEDITOR) == "undefined")
return;
$('#edit-uicolor-textarea').show();
Drupal.ckeditor_ver = Drupal.settings.ckeditor_version.split('.')[0];
Drupal.editSkinEditorInit = function() {
var skinframe_src = $('#skinframe').attr('src');
//skinframe_src = skinframe_src.replace(/skin=[^&]+/, 'skin='+$("#edit-skin").val());
var skin = skinframe_src.match(/skin=([^&]+)/)[1];
if ($('#edit-uicolor').val() == 'custom') {
skinframe_src = skinframe_src.replace(/uicolor=[^&]+/, 'uicolor='+$('input[name$="uicolor_user"]').val().replace('#', '') || 'D3D3D3');
}
else {
skinframe_src = skinframe_src.replace(/uicolor=[^&]+/, 'uicolor=D3D3D3');
}
$('#skinframe').attr('src', skinframe_src);
if (Drupal.ckeditor_ver == 3) {
if (skin == "kama") {
$("#edit-uicolor").removeAttr('disabled');
$("#edit-uicolor").parent().removeClass('form-disabled');
}
else {
$("#edit-uicolor").attr('disabled', 'disabled');
$("#edit-uicolor").parent().addClass('form-disabled');
}
}
else {
$("#edit-uicolor").removeAttr('disabled');
$("#edit-uicolor").parent().removeClass('form-disabled');
}
};
Drupal.editSkinEditorInit();
$("#edit-uicolor").bind("change", function() {
Drupal.editSkinEditorInit();
});
$("#input-formats :checkbox").change(function() {
$('#security-filters .filter-warning').hide();
$('#security-filters div.filter-text-formats[filter]').html('');
$('#security-filters ul.text-formats-config').html('');
$('#input-formats :checked').each(function() {
var format_name = $(this).val();
var format_label = $('label[for="' + $(this).attr('id') + '"]').html();
if (typeof(Drupal.settings.text_formats_config_links[format_name]) != 'undefined') {
var text = "<li>" + format_label + " - <a href=\"" + Drupal.settings.text_formats_config_links[format_name].config_url + "\">configure</a></li>";
var dataSel = $('#security-filters ul.text-formats-config');
var html = dataSel.html();
if (html == null || html.length == 0) {
dataSel.html(text);
}
else {
html += text;
dataSel.html(html);
}
}
$('#security-filters div.filter-text-formats[filter]').each(function() {
var filter_name = $(this).attr('filter');
var dataSel = $(this);
var html = dataSel.html();
var status = "enabled";
if (typeof Drupal.settings.text_format_filters[format_name][filter_name] == 'undefined') {
status = "disabled";
}
var text = "<span class=\"filter-text-format-status " + status + "\">" + format_label + ': </span><br/>';
if (html == null || html.length == 0) {
dataSel.html(text);
}
else {
html += text;
dataSel.html(html);
}
});
});
});
$("#input-formats :checkbox:eq(0)").trigger('change');
$(".cke_load_toolbar").click(function() {
var buttons = eval('Drupal.settings.'+$(this).attr("id"));
var text = "[\n";
for(i in buttons) {
if (typeof buttons[i] == 'string'){
text = text + " '/',\n";
}
else {
text = text + " [";
max = buttons[i].length - 1;
rows = buttons.length - 1;
for (j in buttons[i]) {
if (j < max){
text = text + "'" + buttons[i][j] + "',";
} else {
text = text + "'" + buttons[i][j] + "'";
}
}
if (i < rows){
text = text + "],\n";
} else {
text = text + "]\n";
}
}
}
text = text + "]";
text = text.replace(/\['\/'\]/g,"'/'");
$("#edit-toolbar").attr('value',text);
if (Drupal.settings.ckeditor_toolbar_wizard == 't'){
Drupal.ckeditorToolbarReload();
}
return false;
});
if (Drupal.settings.ckeditor_toolbar_wizard == 'f'){
$("form#ckeditor-admin-profile-form textarea#edit-toolbar, form#ckeditor-admin-profile-form #edit-toolbar + .grippie").show();
}
});
})(jQuery);

View File

@@ -0,0 +1,69 @@
<?php
/**
* CKEditor - The text editor for the Internet - http://ckeditor.com
* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses of your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* @file
* Drush integration for the CKEditor module.
*/
/**
* Implements hook_drush_command().
*/
function ckeditor_drush_command() {
$items['ckeditor-download'] = array(
'callback' => 'ckeditor_drush_download',
'description' => dt('Downloads the required CKEditor library from svn.ckeditor.com.'),
'arguments' => array(
'path' => dt('Optional. The path to the download folder. If omitted, Drush will use the default location (<code>sites/all/libraries/ckeditor</code>).'),
),
);
return $items;
}
/**
* Downloads
*/
function ckeditor_drush_download() {
$args = func_get_args();
if ($args[0]) {
$path = $args[0];
}
else {
$path = drush_get_context('DRUSH_DRUPAL_ROOT') . '/sites/all/libraries/ckeditor';
}
$svn_cmd = 'svn checkout http://svn.ckeditor.com/CKEditor/releases/stable/ ' . $path;
if (drush_shell_exec($svn_cmd)) {
drush_log(dt('CKEditor was downloaded to !path.', array('!path' => '<code>' . $path . '</code>')), 'success');
}
else {
drush_log(dt('Drush was unable to download CKEditor to !path.', array('!path' => '<code>' . $path . '</code>')) . '<br/>' . dt('Attempted command: !svn_cmd.', array('!svn_cmd' => '<code>' . $svn_cmd . '</code>')), 'error');
}
}
/**
* Implements drush_MODULE_post_COMMAND().
*/
function drush_ckeditor_post_enable() {
$modules = func_get_args();
if (in_array('ckeditor', $modules)) {
ckeditor_drush_download();
}
}

View File

@@ -0,0 +1,118 @@
<?php
/**
* CKEditor - The text editor for the Internet - http://ckeditor.com
* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses of your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* @file
* CKEditor Module for Drupal 7.x
*
* This module allows Drupal to replace textarea fields with CKEditor.
*
* CKEditor is an online rich text editor that can be embedded inside web pages.
* It is a WYSIWYG (What You See Is What You Get) editor which means that the
* text edited in it looks as similar as possible to the results end users will
* see after the document gets published. It brings to the Web popular editing
* features found in desktop word processors such as Microsoft Word and
* OpenOffice.org Writer. CKEditor is truly lightweight and does not require any
* kind of installation on the client computer.
*/
/**
* Implementation of hook_features_export_options()
*/
function ckeditor_profile_features_export_options() {
$options = array();
$profiles = (array) ckeditor_profile_load();
foreach ($profiles as $name => $profile) {
$options[$name] = $profile->name;
}
return $options;
}
/**
* Implementation of hook_features_export()
*/
function ckeditor_profile_features_export($data, &$export, $module_name = '') {
$pipe = array();
foreach ((array) $data as $name) {
$profile = ckeditor_profile_load($name);
if ($profile) {
$export['features']['ckeditor_profile'][$name] = $name;
// Write dependencies on all the roles referenced by this profile
foreach ((array) $profile->input_formats as $input_format => $input_format_name) {
$pipe['input_formats'][] = $input_format;
}
}
}
$export['dependencies'][] = 'ckeditor';
return $pipe;
}
/**
* Implementation of hook_features_export_render()
*/
function ckeditor_profile_features_export_render($module_name, $data) {
$profiles = array();
$roles = user_roles();
foreach ($data as $name) {
$profile = (array) ckeditor_profile_load($name);
$profiles[$name] = $profile;
}
$code = ' $data = ' . features_var_export($profiles, ' ') . ';' . PHP_EOL;
$code .= ' return $data;';
return array('ckeditor_profile_defaults' => $code);
}
/**
* Implementation of hook_features_rebuild()
*/
function ckeditor_profile_features_rebuild($module) {
ckeditor_profile_features_revert($module);
}
/**
* Implementation of hook_features_revert()
*/
function ckeditor_profile_features_revert($module) {
if ($data = features_get_default('ckeditor_profile', $module)) {
$input_formats = filter_formats();
foreach ($data as $name => $profile) {
// Restore the profile settings
db_query("DELETE FROM {ckeditor_settings} WHERE name = :name", array(':name' => $name));
db_query("INSERT INTO {ckeditor_settings} (name, settings) VALUES(:name, :settings)", array(':name' => $name, ':settings' => serialize($profile['settings'])));
// Restore the profile roles
foreach ($profile["input_formats"] as $input_format => $input_format_name) {
if (isset($input_formats[$input_format])) {
if (!db_query("SELECT name FROM {ckeditor_input_format} WHERE format = :format AND name = :name", array(':name' => $name, ':format' => $input_format))->fetchField()) {
db_query("INSERT INTO {ckeditor_input_format} (name, format) VALUES(:name, :format)", array(':name' => $name, ':format' => $input_format));
}
}
else {
// Make sure they don't have access
db_query("DELETE FROM {ckeditor_input_format} WHERE format = :format AND name = :name", array(':name' => $name, ':format' => $input_format));
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,227 @@
<?php
/**
* CKEditor - The text editor for the Internet - http://ckeditor.com
* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses of your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* @file
* CKEditor Module for Drupal 7.x
*
* This module allows Drupal to replace textarea fields with CKEditor.
*
* CKEditor is an online rich text editor that can be embedded inside web pages.
* It is a WYSIWYG (What You See Is What You Get) editor which means that the
* text edited in it looks as similar as possible to the results end users will
* see after the document gets published. It brings to the Web popular editing
* features found in desktop word processors such as Microsoft Word and
* OpenOffice.org Writer. CKEditor is truly lightweight and does not require any
* kind of installation on the client computer.
*/
function ckeditor_help_delegate($path, $arg) {
global $base_url;
switch ($path) {
case 'admin/config/content/help#description':
$output = t('Enables the use of CKEditor (a rich text WYSIWYG editor) instead of plain text fields.');
break;
case 'admin/config/content/ckeditor/edit/%':
case 'admin/config/content/ckeditor/add':
$output = '<p>' . t('CKEditor is highly configurable. The most commonly used features are listed below. You can also adjust CKEditor to your needs by changing the !ckeditor_module_config configuration file.', array(
'!ckeditor_module_config' => '<code>' . ckeditor_module_path('local') . '/ckeditor.config.js</code>',
)
) .
'</p><p>' .
t('It is recommended to not edit the !ckeditor_config_file (!ckeditor_config_path) configuration file that is distributed with CKEditor, because you may overwrite it accidentally when you update the editor.', array(
'!ckeditor_config_path' => '<code>' . ckeditor_path('local') . '/config.js</code>',
'!ckeditor_config_file' => '<code>config.js</code>',
)
) .
'</p>';
break;
case 'admin/config/content/ckeditor/editg':
case 'admin/config/content/ckeditor/add':
$output = '<p>' . t('The Global Profile allows you to define settings that are common for all profiles. Values defined in other profiles will be appended to the global configuration. This way you can avoid repeating some of the settings that are usually the same for each profile.') . '</p>';
break;
case 'admin/config/content/ckeditor':
$output =
'<div style="padding:10px;border:1px solid #BEBFB9;margin-bottom:10px;"><p>' .
t('The CKEditor module allows Drupal to replace textarea fields with CKEditor. CKEditor is an online rich text editor that can be embedded inside web pages. It is a !wysiwyg editor which means that the text edited in it looks as similar as possible to the results end users will see after the document gets published. It brings to the Web popular editing features found in desktop word processors such as Microsoft Word and OpenOffice.org Writer. CKEditor is truly lightweight and does not require any kind of installation on the client computer.', array(
'!wysiwyg' => '<acronym title="' . t('What You See Is What You Get') . '">' . t('WYSIWYG') . '</acronym>',
)
) .
'</p><p>' .
t('Useful links: !ckeditorlink | !devguidelink | !userguidelink.', array(
'!ckeditorlink' => l(t('CKEditor website'), 'http://ckeditor.com'),
'!devguidelink' => l(t('Developer\'s Guide'), 'http://docs.cksource.com/CKEditor_3.x/Developers_Guide'),
'!userguidelink' => l(t('User\'s Guide'), 'http://docs.cksource.com/CKEditor_3.x/Users_Guide')
)
) .
'</p></div><p>' .
t('Profiles are linked with input format types. A CKEditor profile defines which buttons are available in the editor, how the editor is displayed, and a few other editor functions. The Global Profile stores some general information about CKEditor.') . '</p>';
break;
case 'admin/help#ckeditor':
$output =
'<h3>' . t('Introduction') . '</h3>' .
'<p>' .
t('The CKEditor module allows Drupal to replace textarea fields with CKEditor. CKEditor is an online rich text editor that can be embedded inside web pages. It is a !wysiwyg editor which means that the text edited in it looks as similar as possible to the results end users will see after the document gets published. It brings to the Web popular editing features found in desktop word processors such as Microsoft Word and OpenOffice.org Writer. CKEditor is truly lightweight and does not require any kind of installation on the client computer.', array(
'!wysiwyg' => '<acronym title="' . t('What You See Is What You Get') . '">' . t('WYSIWYG') . '</acronym>',
)
) .
'</p>' .
'<p>' .
t('Useful links: !ckeditorlink | !devguidelink | !userguidelink.', array(
'!ckeditorlink' => l(t('CKEditor website'), 'http://ckeditor.com'),
'!devguidelink' => l(t('Developer\'s Guide'), 'http://docs.cksource.com/CKEditor_3.x/Developers_Guide'),
'!userguidelink' => l(t('User\'s Guide'), 'http://docs.cksource.com/CKEditor_3.x/Users_Guide')
)
) .
'</p>' .
'<h4>' .
t('Configuration') .
'</h4>' .
'<ol>' .
'<li>' .
t('CKEditor profiles can be configured in the !adminpath section. Profiles determine which options are available to users based on the input format system.', array(
'!adminpath' => '<strong>' . l(t('Administration panel') . ' > ' . t('Configuration') . ' > ' . t('Content Authoring') . ' > ' . t('CKEditor'), 'admin/config/content/ckeditor') . '</strong>'
)
) .
'</li>' .
'<li>' .
t('For the Rich Text Editing to work you also need to configure your !filterlink for the users that may access Rich Text Editing. Either grant those users <strong>Full HTML</strong> access or use the following list of tags in the HTML filter:', array(
'!filterlink' => l(t('filters'), 'admin/config/content/formats')
)
) .
'<br /><code>' .
htmlspecialchars('<a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tbody> <th> <tr> <td> <em> <b> <u> <i> <strong> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <embed> <object> <param> <strike> <caption> <iframe>') .
'</code><br />' .
t('<strong>Note:</strong> be careful when granting users access to create tags like %iframe.<br />If you are going to use CKEditor with the <strong>Filtered HTML</strong> input format, please read the "Setting up filters" section in the !readme file.', array(
'%iframe' => '<iframe>',
'!readme' => '<code>' . l(t('README.txt'), $base_url . '/' . drupal_get_path('module', 'ckeditor') . '/README.txt', array('absolute' => TRUE)) . '</code>'
)
) .
'</li>' .
'<li>' .
t('To have better control over line breaks, you should disable the <strong>%settingname</strong> setting in the chosen Text format (recommended).', array(
'%settingname' => t('Line break converter'),
)
) .
'</li>' .
'<li>' .
t('All configuration options described in the !apidocs that cannot be easily changed in the administration area can be set in the <strong>Advanced Options</strong> section in the CKEditor profile.', array(
'!apidocs' => l(t('API documentation'), 'http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html')
)
) .
'</li>' .
'</ol>' .
'<h3>' .
t('Troubleshooting') .
'</h3>' .
'<p>' .
t('Take a look at !listlink when installing CKEditor.', array(
'!listlink' => l(t('the list of common problems'), 'http://docs.cksource.com/CKEditor_for_Drupal/Troubleshooting')
)
) .
' ' .
t('If you are looking for more information, have any trouble with the configuration, or found an issue with the CKEditor module, please visit the !officiallink.', array(
'!officiallink' => l(t('official project page'), 'http://drupal.org/project/ckeditor')
)
) .
' ' .
t('More information about how to customize CKEditor for your theme can be found !herelink.', array(
'!herelink' => l(t('here'), 'http://drupal.ckeditor.com/tricks')
)
) .
'</p>' .
'<h3>' .
t('Uploading images and files') .
'</h3>' .
'<p>' .
t('There are three ways for uploading files:') .
'</p>' .
'<ol>' .
'<li>' .
t('By using !ckfinder (commercial), an advanced Ajax file manager.', array(
'!ckfinder' => l(t('CKFinder'), 'http://ckfinder.com'),
)
) .
'</li>' .
'<li>' .
t('By using a dedicated module like !imcelink.', array(
'!imcelink' => l(t('IMCE'), 'http://drupal.org/project/imce')
)
) .
'</li>' .
'<li>' .
t('By using the core upload module.') .
'</li>' .
'</ol>';
break;
}
return !empty($output) ? $output : '';
}
/**
* AJAX callback - XSS filter
*/
function ckeditor_filter_xss() {
header('Content-Type: text/html; charset=utf-8');
$GLOBALS['devel_shutdown'] = FALSE;
if (!isset($_POST['text']) || !is_string($_POST['text']) || !isset($_POST['input_format']) || !is_string($_POST['input_format']) || !isset($_POST['token']) || !drupal_valid_token($_POST['token'], 'ckeditorAjaxCall', TRUE)) {
exit;
}
$format = filter_format_load($_POST['input_format']);
if ($format == FALSE || !is_object($format) || !filter_access($format)) {
exit;
}
module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib');
$profile = ckeditor_get_profile($_POST['input_format']);
$text = $_POST['text'];
$filters = filter_get_filters();
$format_filters = filter_list_format($_POST['input_format']);
$security_filters = ckeditor_security_filters();
$cache_id = $_POST['input_format'] . ':' . '' . ':' . hash('sha256', $text);
foreach ((array) $format_filters as $name => $object) {
//If filter is not security filter, not exists, cannot be called or isn't enabled in selected text format then skip this filter
if (!isset($security_filters['filters'][$name]) || !isset($filters[$name]) || !isset($filters[$name]['process callback']) || $object->status == 0) {
continue;
}
//Call default CKEditor built-in filter
if ($name == 'filter_html' && $security_filters['filters']['filter_html'] == 1) {
preg_match_all("|</?([a-z][a-z0-9]*)(?:\b[^>]*)>|i", $text, $matches);
if ($matches[1]) {
$tags = array_unique($matches[1]);
$text = filter_xss($text, $tags);
}
continue;
}
$text = $filters[$name]['process callback']($text, $format_filters[$name], $format, '', TRUE, $cache_id);
}
echo $text;
}

View File

@@ -0,0 +1,135 @@
<?php
/**
* CKEditor - The text editor for the Internet - http://ckeditor.com
* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses of your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* @file
* CKEditor Module for Drupal 7.x
*
* This module allows Drupal to replace textarea fields with CKEditor.
*
* CKEditor is an online rich text editor that can be embedded inside web pages.
* It is a WYSIWYG (What You See Is What You Get) editor which means that the
* text edited in it looks as similar as possible to the results end users will
* see after the document gets published. It brings to the Web popular editing
* features found in desktop word processors such as Microsoft Word and
* OpenOffice.org Writer. CKEditor is truly lightweight and does not require any
* kind of installation on the client computer.
*/
function ckeditor_user_customize(&$form, &$form_state, $form_id) {
module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib');
$data = $form['#user']->data;
$default = ckeditor_user_get_setting_default();
$lang_options = ckeditor_load_lang_options();
// because the settings are saved as strings we need to test for the string 'true'
if (user_access('customize ckeditor')) {
$form['ckeditor'] = array(
'#type' => 'fieldset',
'#title' => t('Rich text editor settings'),
'#weight' => 10,
'#collapsible' => TRUE,
'#collapsed' => TRUE
);
$form['ckeditor']['ckeditor_default'] = array(
'#type' => 'radios',
'#title' => t('Default state'),
'#default_value' => isset($data['ckeditor_default']) ? $data['ckeditor_default'] : $default['default'],
'#options' => array(
't' => t('Enabled'),
'f' => t('Disabled')
),
'#description' => t('Should rich text editing be enabled or disabled by default in textarea fields? If disabled, the rich text editor may still be enabled by using toggle.'),
);
$form['ckeditor']['ckeditor_show_toggle'] = array(
'#type' => 'radios',
'#title' => t('Show the disable/enable rich text editor toggle'),
'#default_value' => isset($data['ckeditor_show_toggle']) ? $data['ckeditor_show_toggle'] : $default['show_toggle'],
'#options' => array(
't' => t('Yes'),
'f' => t('No')
),
'#description' => t('Whether or not to show the disable/enable rich text editor toggle below the textarea.'),
);
$form['ckeditor']['ckeditor_width'] = array(
'#type' => 'textfield',
'#title' => t('Editor width'),
'#default_value' => isset($data['ckeditor_width']) ? $data['ckeditor_width'] : $default['width'],
'#description' => t('Editor interface width in pixels or percent.') . ' ' . t('Examples') . ': 400 ' . t('or') . ' 100%.',
'#size' => 40,
'#maxlength' => 128,
);
$form['ckeditor']['ckeditor_lang'] = array(
'#type' => 'select',
'#title' => t('Language'),
'#default_value' => isset($data['ckeditor_lang']) ? $data['ckeditor_lang'] : $default['lang'],
'#options' => $lang_options,
'#description' => t('The language for the CKEditor interface.')
);
$form['ckeditor']['ckeditor_auto_lang'] = array(
'#type' => 'radios',
'#title' => t('Auto-detect language'),
'#default_value' => isset($data['ckeditor_auto_lang']) ? $data['ckeditor_auto_lang'] : $default['auto_lang'],
'#options' => array(
't' => t('Yes'),
'f' => t('No')
),
'#description' => t('Automatically detect the user language.')
);
$form['#validate'][] = 'ckeditor_user_customize_form_validate';
}
}
function ckeditor_user_customize_form_validate(&$form, &$form_state) {
/*
if (isset($form_state['values']['ckeditor_default'], $form_state['values']['ckeditor_popup']) && $form_state['values']['ckeditor_default'] == 't' && $form_state['values']['ckeditor_popup'] == 't') {
form_set_error('ckeditor_popup', t('If CKEditor is enabled by default, the popup window must be disabled.'));
}
if (isset($form_state['values']['ckeditor_show_toggle'], $form_state['values']['ckeditor_popup']) && $form_state['values']['ckeditor_show_toggle'] == 't' && $form_state['values']['ckeditor_popup'] == 't') {
form_set_error('ckeditor_popup', t('If toggle is enabled, the popup window must be disabled.'));
}
*/
if (isset($form_state['values']['ckeditor_width']) && !preg_match('/^\d+%?$/', $form_state['values']['ckeditor_width'])) {
form_set_error('ckeditor_width', t('Enter a valid width value.') . ' ' . t('Examples:') . ': 400 ' . t('or') . ' 100%.');
}
}
function ckeditor_user_presave(&$edit, $account, $category) {
if (user_access('customize ckeditor')) {
module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib');
$default = ckeditor_user_get_setting_default();
$edit['data']['ckeditor_default'] = isset($edit['ckeditor_default']) ? $edit['ckeditor_default'] : $default['default'];
$edit['data']['ckeditor_show_toggle'] = isset($edit['ckeditor_show_toggle']) ? $edit['ckeditor_show_toggle'] : $default['show_toggle'];
$edit['data']['ckeditor_width'] = isset($edit['ckeditor_width']) ? $edit['ckeditor_width'] : $default['width'];
$edit['data']['ckeditor_lang'] = isset($edit['ckeditor_lang']) ? $edit['ckeditor_lang'] : $default['lang'];
$edit['data']['ckeditor_auto_lang'] = isset($edit['ckeditor_auto_lang']) ? $edit['ckeditor_auto_lang'] : $default['auto_lang'];
}
}

View File

@@ -0,0 +1,344 @@
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
window.CKEDITOR_BASEPATH = Drupal.settings.ckeditor.editor_path;
(function ($) {
Drupal.ckeditor = (typeof(CKEDITOR) != 'undefined');
Drupal.ckeditor_ver = false;
Drupal.ckeditorToggle = function(textarea_ids, TextTextarea, TextRTE){
if (!CKEDITOR.env.isCompatible) {
return;
}
for (i=0; i<textarea_ids.length; i++){
if (typeof(CKEDITOR.instances) != 'undefined' && typeof(CKEDITOR.instances[textarea_ids[i]]) != 'undefined'){
Drupal.ckeditorOff(textarea_ids[i]);
$('#switch_' + textarea_ids[0]).text(TextRTE);
}
else {
Drupal.ckeditorOn(textarea_ids[i]);
$('#switch_' + textarea_ids[0]).text(TextTextarea);
}
}
};
/**
* CKEditor starting function
*
* @param string textarea_id
*/
Drupal.ckeditorInit = function(textarea_id) {
var ckeditor_obj = Drupal.settings.ckeditor;
$("#" + textarea_id).next(".grippie").css("display", "none");
$("#" + textarea_id).addClass("ckeditor-processed");
var textarea_settings = false;
ckeditor_obj.input_formats[ckeditor_obj.elements[textarea_id]].toolbar = eval(ckeditor_obj.input_formats[ckeditor_obj.elements[textarea_id]].toolbar);
textarea_settings = ckeditor_obj.input_formats[ckeditor_obj.elements[textarea_id]];
var drupalTopToolbar = $('#toolbar, #admin-menu', Drupal.overlayChild ? window.parent.document : document);
textarea_settings['on'] =
{
configLoaded : function(ev)
{
Drupal.ckeditor_ver = CKEDITOR.version.split('.')[0];
if (Drupal.ckeditor_ver == 3) {
ev.editor.addCss(ev.editor.config.extraCss);
}
else {
CKEDITOR.addCss(ev.editor.config.extraCss);
}
},
instanceReady : function(ev)
{
var body = $(ev.editor.document.$.body);
if (typeof(ev.editor.dataProcessor.writer.setRules) != 'undefined') {
ev.editor.dataProcessor.writer.setRules('p', {
breakAfterOpen: false
});
if (typeof(ckeditor_obj.input_formats[ckeditor_obj.elements[textarea_id]].custom_formatting) != 'undefined') {
var dtd = CKEDITOR.dtd;
for ( var e in CKEDITOR.tools.extend( {}, dtd.$block, dtd.$listItem, dtd.$tableContent ) ) {
ev.editor.dataProcessor.writer.setRules( e, ckeditor_obj.input_formats[ckeditor_obj.elements[textarea_id]].custom_formatting);
}
ev.editor.dataProcessor.writer.setRules( 'pre',
{
indent: ckeditor_obj.input_formats[ckeditor_obj.elements[textarea_id]].output_pre_indent
});
}
}
if (ev.editor.config.bodyClass)
body.addClass(ev.editor.config.bodyClass);
if (ev.editor.config.bodyId)
body.attr('id', ev.editor.config.bodyId);
if (typeof(Drupal.smileysAttach) != 'undefined' && typeof(ev.editor.dataProcessor.writer) != 'undefined')
ev.editor.dataProcessor.writer.indentationChars = ' ';
},
focus : function(ev)
{
Drupal.ckeditorInstance = ev.editor;
Drupal.ckeditorActiveId = ev.editor.name;
}
,
afterCommandExec: function(ev)
{
if (ev.data.name != 'maximize') {
return;
}
if (ev.data.command.state == CKEDITOR.TRISTATE_ON) {
drupalTopToolbar.hide();
} else {
drupalTopToolbar.show();
}
}
};
if (typeof Drupal.settings.ckeditor.scayt_language != 'undefined'){
textarea_settings['scayt_sLang'] = Drupal.settings.ckeditor.scayt_language;
}
if (typeof textarea_settings['js_conf'] != 'undefined'){
for (var add_conf in textarea_settings['js_conf']){
textarea_settings[add_conf] = eval(textarea_settings['js_conf'][add_conf]);
}
}
//remove width 100% from settings because this may cause problems with theme css
if (textarea_settings.width == '100%') textarea_settings.width = '';
if (CKEDITOR.loadFullCore) {
CKEDITOR.on('loaded', function() {
textarea_settings = Drupal.ckeditorLoadPlugins(textarea_settings);
Drupal.ckeditorInstance = CKEDITOR.replace(textarea_id, textarea_settings);
});
CKEDITOR.loadFullCore();
}
else {
textarea_settings = Drupal.ckeditorLoadPlugins(textarea_settings);
Drupal.ckeditorInstance = CKEDITOR.replace(textarea_id, textarea_settings);
}
}
Drupal.ckeditorOn = function(textarea_id, run_filter) {
run_filter = typeof(run_filter) != 'undefined' ? run_filter : true;
if (typeof(textarea_id) == 'undefined' || textarea_id.length == 0 || $("#" + textarea_id).length == 0) {
return;
}
if ((typeof(Drupal.settings.ckeditor.load_timeout) == 'undefined') && (typeof(CKEDITOR.instances[textarea_id]) != 'undefined')) {
return;
}
if (typeof(Drupal.settings.ckeditor.elements[textarea_id]) == 'undefined') {
return;
}
var ckeditor_obj = Drupal.settings.ckeditor;
if (!CKEDITOR.env.isCompatible) {
return;
}
if (run_filter && ($("#" + textarea_id).val().length > 0) && typeof(ckeditor_obj.input_formats[ckeditor_obj.elements[textarea_id]]) != 'undefined' && ((ckeditor_obj.input_formats[ckeditor_obj.elements[textarea_id]]['ss'] == 1 && typeof(Drupal.settings.ckeditor.autostart) != 'undefined' && typeof(Drupal.settings.ckeditor.autostart[textarea_id]) != 'undefined') || ckeditor_obj.input_formats[ckeditor_obj.elements[textarea_id]]['ss'] == 2)) {
$.ajax({
type: 'POST',
url: Drupal.settings.ckeditor.xss_url,
async: false,
data: {
text: $('#' + textarea_id).val(),
input_format: ckeditor_obj.textarea_default_format[textarea_id],
token: Drupal.settings.ckeditor.ajaxToken
},
success: function(text){
$("#" + textarea_id).val(text);
Drupal.ckeditorInit(textarea_id);
}
})
}
else {
Drupal.ckeditorInit(textarea_id);
}
};
/**
* CKEditor destroy function
*
* @param string textarea_id
*/
Drupal.ckeditorOff = function(textarea_id) {
if (!CKEDITOR.instances || typeof(CKEDITOR.instances[textarea_id]) == 'undefined') {
return;
}
if (!CKEDITOR.env.isCompatible) {
return;
}
if (Drupal.ckeditorInstance && Drupal.ckeditorInstance.name == textarea_id)
delete Drupal.ckeditorInstance;
$("#" + textarea_id).val(CKEDITOR.instances[textarea_id].getData());
CKEDITOR.instances[textarea_id].destroy(true);
$("#" + textarea_id).next(".grippie").css("display", "block");
};
/**
* Loading selected CKEditor plugins
*
* @param object textarea_settings
*/
Drupal.ckeditorLoadPlugins = function(textarea_settings) {
if (typeof(textarea_settings.extraPlugins) == 'undefined') {
textarea_settings.extraPlugins = '';
}
if (typeof CKEDITOR.plugins != 'undefined') {
for (var plugin in textarea_settings['loadPlugins']) {
if (typeof(textarea_settings['loadPlugins'][plugin]['active']) == 'undefined' || textarea_settings['loadPlugins'][plugin]['active'] == 1) {
textarea_settings.extraPlugins += (textarea_settings.extraPlugins) ? ',' + textarea_settings['loadPlugins'][plugin]['name'] : textarea_settings['loadPlugins'][plugin]['name'];
CKEDITOR.plugins.addExternal(textarea_settings['loadPlugins'][plugin]['name'], textarea_settings['loadPlugins'][plugin]['path']);
}
}
}
return textarea_settings;
}
/**
* Returns true if CKEDITOR.version >= version
*/
Drupal.ckeditorCompareVersion = function (version){
var ckver = CKEDITOR.version;
ckver = ckver.match(/(([\d]\.)+[\d]+)/i);
version = version.match(/((\d+\.)+[\d]+)/i);
ckver = ckver[0].split('.');
version = version[0].split('.');
for (var x in ckver) {
if (ckver[x]<version[x]) {
return false;
}
else if (ckver[x]>version[x]) {
return true;
}
}
return true;
};
Drupal.ckeditorInsertHtml = function(html) {
if (!Drupal.ckeditorInstance)
return false;
if (Drupal.ckeditorInstance.mode == 'wysiwyg') {
Drupal.ckeditorInstance.insertHtml(html);
return true;
}
else {
alert(Drupal.t('Content can only be inserted into CKEditor in the WYSIWYG mode.'));
return false;
}
};
/**
* Ajax support
*/
if (typeof(Drupal.Ajax) != 'undefined' && typeof(Drupal.Ajax.plugins) != 'undefined') {
Drupal.Ajax.plugins.CKEditor = function(hook, args) {
if (hook === 'submit' && typeof(CKEDITOR.instances) != 'undefined') {
for (var i in CKEDITOR.instances)
CKEDITOR.instances[i].updateElement();
}
return true;
};
}
//Support for Panels [#679976]
Drupal.ckeditorSubmitAjaxForm = function () {
if (typeof(CKEDITOR.instances) != 'undefined' && typeof(CKEDITOR.instances['edit-body']) != 'undefined') {
Drupal.ckeditorOff('edit-body');
}
};
/**
* Drupal behaviors
*/
Drupal.behaviors.ckeditor = {
attach:
function (context) {
if ((typeof(CKEDITOR) == 'undefined') || !CKEDITOR.env.isCompatible) {
return;
}
// make sure the textarea behavior is run first, to get a correctly sized grippie
if (Drupal.behaviors.textarea && Drupal.behaviors.textarea.attach) {
Drupal.behaviors.textarea.attach(context);
}
$(context).find("textarea.ckeditor-mod:not(.ckeditor-processed)").each(function () {
var ta_id=$(this).attr("id");
if (CKEDITOR.instances && typeof(CKEDITOR.instances[ta_id]) != 'undefined'){
Drupal.ckeditorOff(ta_id);
}
if ((typeof(Drupal.settings.ckeditor.autostart) != 'undefined') && (typeof(Drupal.settings.ckeditor.autostart[ta_id]) != 'undefined')) {
Drupal.ckeditorOn(ta_id);
}
if (typeof(Drupal.settings.ckeditor.input_formats[Drupal.settings.ckeditor.elements[ta_id]]) != 'undefined') {
$('.ckeditor_links').show();
}
var sel_format = $("#" + ta_id.substr(0, ta_id.lastIndexOf("-")) + "-format--2");
if (sel_format && sel_format.not('.ckeditor-processed')) {
sel_format.addClass('ckeditor-processed').change(function() {
Drupal.settings.ckeditor.elements[ta_id] = $(this).val();
if (CKEDITOR.instances && typeof(CKEDITOR.instances[ta_id]) != 'undefined') {
$('#'+ta_id).val(CKEDITOR.instances[ta_id].getData());
}
Drupal.ckeditorOff(ta_id);
if (typeof(Drupal.settings.ckeditor.input_formats[$(this).val()]) != 'undefined'){
if ($('#'+ta_id).hasClass('ckeditor-processed')) {
Drupal.ckeditorOn(ta_id, false);
}
else {
Drupal.ckeditorOn(ta_id);
}
$('#switch_'+ta_id).show();
}
else {
$('#switch_'+ta_id).hide();
}
});
}
});
},
detach:
function(context, settings, trigger){
$(context).find("textarea.ckeditor-mod.ckeditor-processed").each(function () {
var ta_id=$(this).attr("id");
if (CKEDITOR.instances[ta_id])
$('#'+ta_id).val(CKEDITOR.instances[ta_id].getData());
if(trigger != 'serialize') {
Drupal.ckeditorOff(ta_id);
$(this).removeClass('ckeditor-processed');
}
});
}
};
})(jQuery);
/**
* IMCE support
*/
var ckeditor_imceSendTo = function (file, win){
var cfunc = win.location.href.split('&');
for (var x in cfunc) {
if (cfunc[x].match(/^CKEditorFuncNum=\d+$/)) {
cfunc = cfunc[x].split('=');
break;
}
}
CKEDITOR.tools.callFunction(cfunc[1], file.url);
win.close();
}

View File

@@ -0,0 +1,98 @@
<?php
/**
* CKEditor - The text editor for the Internet - http://ckeditor.com
* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses of your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* @file
* CKEditor Module for Drupal 7.x
*
* This file is required by the CKEeditor module if you want to enable CKFinder,
* an advanced Ajax file browser.
*
*/
$GLOBALS['devel_shutdown'] = FALSE;
if (!function_exists('ob_list_handlers') || ob_list_handlers()) {
@ob_end_clean();
}
$ckfinder_user_files_path = '';
$ckfinder_user_files_absolute_path = '';
function CheckAuthentication() {
static $authenticated;
if (!isset($authenticated)) {
if (!empty($_SERVER['SCRIPT_FILENAME'])) {
$drupal_path = dirname(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))));
if (!file_exists($drupal_path . '/includes/bootstrap.inc')) {
$drupal_path = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
$depth = 2;
do {
$drupal_path = dirname($drupal_path);
$depth++;
} while (!($bootstrap_file_found = file_exists($drupal_path . '/includes/bootstrap.inc')) && $depth < 10);
}
}
if (!isset($bootstrap_file_found) || !$bootstrap_file_found) {
$drupal_path = '../../../../..';
if (!file_exists($drupal_path . '/includes/bootstrap.inc')) {
$drupal_path = '../..';
do {
$drupal_path .= '/..';
$depth = substr_count($drupal_path, '..');
} while (!($bootstrap_file_found = file_exists($drupal_path . '/includes/bootstrap.inc')) && $depth < 10);
}
}
if (!isset($bootstrap_file_found) || $bootstrap_file_found) {
$current_cwd = getcwd();
chdir($drupal_path);
if (!defined('DRUPAL_ROOT')) {
define('DRUPAL_ROOT', $drupal_path);
}
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$authenticated = user_access('allow CKFinder file uploads');
if (isset($_GET['id'], $_SESSION['ckeditor'][$_GET['id']]['UserFilesPath'], $_SESSION['ckeditor'][$_GET['id']]['UserFilesAbsolutePath'])) {
$_SESSION['ckeditor']['UserFilesPath'] = $_SESSION['ckeditor'][$_GET['id']]['UserFilesPath'];
$_SESSION['ckeditor']['UserFilesAbsolutePath'] = $_SESSION['ckeditor'][$_GET['id']]['UserFilesAbsolutePath'];
}
chdir($current_cwd);
}
}
return $authenticated;
}
CheckAuthentication();
if (isset($_SESSION['ckeditor']['UserFilesPath'], $_SESSION['ckeditor']['UserFilesAbsolutePath'])) {
$baseUrl = $_SESSION['ckeditor']['UserFilesPath'];
$baseDir = $_SESSION['ckeditor']['UserFilesAbsolutePath'];
}
else {
// Nothing in session? Shouldn't happen... anyway let's try to upload it in the (almost) right place
// Path to user files relative to the document root.
$baseUrl = strtr(base_path(), array(
'/modules/ckeditor/ckfinder/core/connector/php' => '',
)) . variable_get('file_private_path', conf_path() . '/files') . '/';
$baseDir = resolveUrl($baseUrl);
}

Some files were not shown because too many files have changed in this diff Show More