Projet

Général

Profil

Révision 6fd71452

Ajouté par Julien Enselme il y a environ 10 ans

Update CKEditor

Voir les différences:

drupal7/sites/all/modules/ckeditor/ckeditor.module
98 98
    'title' => 'Add a new CKEditor profile',
99 99
    'description' => 'Configure the rich text editor.',
100 100
    'page callback' => 'drupal_get_form',
101
    'page arguments' => array('ckeditor_admin_profile_form'),
101
    'page arguments' => array('ckeditor_admin_profile_form', 'add'),
102 102
    'file' => 'includes/ckeditor.admin.inc',
103 103
    'access arguments' => array('administer ckeditor'),
104 104
    'type' => MENU_CALLBACK,
......
108 108
    'title' => 'Clone the CKEditor profile',
109 109
    'description' => 'Configure the rich text editor.',
110 110
    'page callback' => 'drupal_get_form',
111
    'page arguments' => array('ckeditor_admin_profile_clone_form', 5),
111
    'page arguments' => array('ckeditor_admin_profile_clone_form', 'clone', 5),
112 112
    'file' => 'includes/ckeditor.admin.inc',
113 113
    'access arguments' => array('administer ckeditor'),
114 114
    'type' => MENU_CALLBACK,
......
118 118
    'title' => 'Edit the CKEditor profile',
119 119
    'description' => 'Configure the rich text editor.',
120 120
    'page callback' => 'drupal_get_form',
121
    'page arguments' => array('ckeditor_admin_profile_form', 5),
121
    'page arguments' => array('ckeditor_admin_profile_form', 'edit', 5),
122 122
    'file' => 'includes/ckeditor.admin.inc',
123 123
    'access arguments' => array('administer ckeditor'),
124 124
    'type' => MENU_CALLBACK,
......
209 209
  }
210 210

  
211 211
  $editor_path = ckeditor_path('local', TRUE);
212
  if ($editor_path == '<URL>') {
213
    $url = ckeditor_path('url', TRUE);
214
    $matches = array();
215
    if (preg_match("|cdn.ckeditor.com/(\d(\.\d+)+.*)/|i", $url, $matches)) {
216
      $ckeditor_version = $matches[1];
217
      return $matches[1];
218
    }
219
    return $ckeditor_version = NULL;
220
  }
221

  
212 222
  $jspath = $editor_path . '/ckeditor.js';
213 223

  
214 224
  $configcontents = @file_get_contents($jspath);
......
231 241
}
232 242

  
233 243
/**
234
 * Implementation of hook_init().
244
 * Implements hook_page_build().
235 245
 */
236
function ckeditor_init() {
237
  drupal_add_css(drupal_get_path('module', 'ckeditor') . '/ckeditor.css');
246
function ckeditor_page_build(&$page) {
247
  // Add our CSS file that adds common needed classes, such as align-left,
248
  // align-right, underline, indent, etc.
249
  $page['page_bottom']['ckeditor']['#attached']['css'] = array(
250
    drupal_get_path('module', 'ckeditor') . '/css/ckeditor.css' => array(
251
      'every_page' => TRUE,
252
    ),
253
  );
238 254
}
239 255

  
240 256
/**
......
404 420
      default:
405 421
      case 'relative':
406 422
        if ($global_profile && isset($global_profile->settings['ckeditor_path'])) {
423
          // http:// OR https:// OR //
424
          if (preg_match("|^(http(s)?:)?//|i", $global_profile->settings['ckeditor_path'])) {
425
            return '<URL>';
426
          }
407 427
          $cke_path = $global_profile->settings['ckeditor_path'];
408 428
          $cke_path = strtr($cke_path, array("%b" => ckeditor_base_path('relative'), "%m" => ckeditor_module_path('relative'), "%l" => ckeditor_library_path('relative')));
409 429
          $cke_path = str_replace('\\', '/', $cke_path);
......
417 437
            return $cke_static[$mode] = $global_profile->settings['ckeditor_local_path'];
418 438
          }
419 439
          if (isset($global_profile->settings['ckeditor_path'])) {
440
            // http:// OR https:// OR //
441
            if (preg_match("|^(http(s)?:)?//|i", $global_profile->settings['ckeditor_path'])) {
442
              return '<URL>';
443
            }
420 444
            $cke_local_path = $global_profile->settings['ckeditor_path'];
421 445
            $cke_local_path = strtr($cke_local_path, array("%b" => ckeditor_base_path('local'), "%m" => ckeditor_module_path('local'), "%l" => ckeditor_library_path('local')));
422 446
            return $cke_static[$mode] = $cke_local_path;
......
425 449
        return $cke_static[$mode] = ckeditor_module_path('local') . '/ckeditor';
426 450
      case 'url':
427 451
        if ($global_profile && isset($global_profile->settings['ckeditor_path'])) {
428
          $cke_path = $global_profile->settings['ckeditor_path'];
429
          $cke_path = strtr($cke_path, array("%m" => ckeditor_module_path('url'), "%l" => ckeditor_library_path('url')));
430
          $cke_path = str_replace('\\', '/', $cke_path);
431
          $cke_path = str_replace('//', '/', $cke_path);
432
          //In D7 base path in URL mode is not needed, so we need to remove it with trailing slash (if exists)
433
          $cke_path = str_replace(array("%b/", "%b"), '', $cke_path);
452
          // http:// OR https:// OR //
453
          if (preg_match("|^(http(s)?:)?//|i", $global_profile->settings['ckeditor_path'])) {
454
            $cke_path = $global_profile->settings['ckeditor_path'];
455
          }
456
          else {
457
            $cke_path = $global_profile->settings['ckeditor_path'];
458
            $cke_path = strtr($cke_path, array("%m" => ckeditor_module_path('url'), "%l" => ckeditor_library_path('url')));
459
            $cke_path = str_replace('\\', '/', $cke_path);
460
            $cke_path = str_replace('//', '/', $cke_path);
461
            //In D7 base path in URL mode is not needed, so we need to remove it with trailing slash (if exists)
462
            $cke_path = str_replace(array("%b/", "%b"), '', $cke_path);
463
          }
434 464
          return $cke_static[$mode] = $cke_path;
435 465
        }
436 466
        return $cke_static[$mode] = ckeditor_module_path('url') . '/ckeditor';

Formats disponibles : Unified diff