Projet

Général

Profil

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

root / drupal7 / sites / all / modules / ckeditor / ckeditor.api.php @ 2e0f6994

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 the button icon. Relative to the plugin directory 'path' unless 'icon_path' is specified.
52
          'icon' => 'icon/plugin_name.png',
53
          // Optional full path to the directory the icon is located in.
54
          'icon_path' => base_path() . drupal_get_path('theme', 'my_theme') . '/icon_dir/',
55
          'label' => 'Button Label',
56
        )
57
      )
58
    )
59
  );
60
}
61

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

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

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

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

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

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