Projet

Général

Profil

Paste
Télécharger (4,15 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ckeditor / ckeditor.api.php @ 5136ce55

1
<?php
2

    
3
/**
4
 * CKEditor - The text editor for the Internet - http://ckeditor.com
5
 * Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
6
 *
7
 * == BEGIN LICENSE ==
8
 *
9
 * Licensed under the terms of any of the following licenses of your
10
 * choice:
11
 *
12
 *  - GNU General Public License Version 2 or later (the "GPL")
13
 *    http://www.gnu.org/licenses/gpl.html
14
 *
15
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
16
 *    http://www.gnu.org/licenses/lgpl.html
17
 *
18
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
19
 *    http://www.mozilla.org/MPL/MPL-1.1.html
20
 *
21
 * == END LICENSE ==
22
 *
23
 * @file
24
 * CKEditor Module for Drupal 7.x
25
 *
26
 * This module allows Drupal to replace textarea fields with CKEditor.
27
 *
28
 * CKEditor is an online rich text editor that can be embedded inside web pages.
29
 * It is a WYSIWYG (What You See Is What You Get) editor which means that the
30
 * text edited in it looks as similar as possible to the results end users will
31
 * see after the document gets published. It brings to the Web popular editing
32
 * features found in desktop word processors such as Microsoft Word and
33
 * OpenOffice.org Writer. CKEditor is truly lightweight and does not require any
34
 * kind of installation on the client computer.
35
 */
36

    
37
/**
38
 * Hook to register the CKEditor plugin - it would appear in the plugins list on the profile setting page.
39
 */
40
function hook_ckeditor_plugin() {
41
  return array(
42
    'plugin_name' => array(
43
      // Name of the plugin used to write it.
44
      'name' => 'plugin_name',
45
      // Description of the plugin - it would be displayed in the plugins management section of profile settings.
46
      'desc' => t('Plugin description'),
47
      // The full URL to the CKEditor plugins directory, with the trailing slash.
48
      'path' => base_path() . drupal_get_path('module', 'my_module') . '/plugin_dir/',
49
      'buttons' => array(
50
        'button_name' => array(
51
          // Path to an icon relative to the plugins folder.
52
          'icon' => 'icon/plugin_name.png',
53
          'label' => 'Button Label',
54
        )
55
      )
56
    )
57
  );
58
}
59

    
60
/**
61
 * Hook to extend/change CKEditor plugins.
62
 *
63
 * @param $plugins
64
 *   An associative array of plugins.
65
 */
66
function hook_ckeditor_plugin_alter(&$plugins) {
67
  // Remove a plugin button.
68
  unset($plugins['plugin_name']['buttons']['button']);
69
}
70

    
71
/**
72
 * Hook to register the CKEditor security filter - it would appear in the security filters list on the profile setting page.
73
 */
74
function hook_ckeditor_security_filter() {
75
  return array(
76
    'security_filter_name' => array(
77
      // Title of the security filter - it would be displayed in the security filters section of profile settings.
78
      'title' => t('Security filter title'),
79
      // Description of the security filter - it would be displayed in the security filters section of profile settings.
80
      'description' => t('Security filter description'),
81
    )
82
  );
83
}
84

    
85
/**
86
 * Hook to alter CKEditor security filters.
87
 */
88
function hook_ckeditor_security_filter_alter(&$security_filters) {
89
  // Modify a $security_filter.
90
}
91

    
92
/**
93
 * Hook to extend/change the ckeditor settings.
94
 *
95
 * This hook is invoked from ckeditor_profile_settings_compile(). The settings
96
 * may be customized or enhanced; typically with options that cannot be
97
 * controlled though the administrative UI from the ckeditor module.
98
 *
99
 * @param $settings
100
 *   An associative array of settings.
101
 * @param $conf
102
 *   An associative array with access to raw profile settings that might be helpful to alter the real $settings.
103
 */
104
function hook_ckeditor_settings_alter(&$settings, $conf) {
105
  // Change the ckeditor config path.
106
  $settings['customConfig'] = drupal_get_path('module', 'ckeditor') . '/ckeditor.config.js';
107
}
108

    
109
/**
110
 * Hook that allows to alter the user default settings.
111
 *
112
 * @param $settings
113
 *   An associative array of settings.
114
 */
115
function hook_ckeditor_default_settings_alter(&$settings) {
116
  $settings['show_toggle'] = 'f';
117
}
118

    
119
/**
120
 * Hook to extend CKEditor security allowed tags list.
121
 *
122
 * This hook is invoked from ckeditor_filter_xss() where text is filtered from potentially insecure tags.
123
 */
124
function hook_ckeditor_filter_xss_allowed_tags() {
125
  // Return an array of additional allowed tags
126
}