View source
<?php
function pasteformat_perm() {
return array(
'use pasteformat',
);
}
function pasteformat_menu() {
$items = array(
'admin/settings/pasteformat' => array(
'title' => 'Paste Format',
'description' => 'Configure Paste Format settings.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'pasteformat_settings_form',
),
'access callback' => 'user_access',
'access arguments' => array(
'administer site configuration',
),
'file' => 'pasteformat.admin.inc',
'type' => MENU_NORMAL_ITEM,
),
'pasteformat/ajax/pasteformat_cleanup' => array(
'page callback' => 'pasteformat_cleanup',
'access callback' => 'user_access',
'access arguments' => array(
'use pasteformat',
),
'type' => MENU_CALLBACK,
),
);
return $items;
}
function pasteformat_cleanup() {
$output = array(
'text' => check_markup($_POST['html'], variable_get('pasteformat_cleanup_format', FILTER_FORMAT_DEFAULT), FALSE),
'alert' => variable_get('pasteformat_message_success', '') ? variable_get('pasteformat_message_success', '') : '',
);
drupal_json($output);
exit;
}
function pasteformat_ckeditor_plugin() {
return array(
'pasteformat' => array(
'name' => 'pasteformat',
'desc' => t('Paste Format: Plugin to cleanup pasted text'),
'path' => drupal_get_path('module', 'pasteformat') . '/plugins/pasteformat/',
),
);
}
function pasteformat_wysiwyg_plugin($editor, $version) {
if ($editor == 'ckeditor') {
return array(
'pasteformat' => array(
'url' => 'http://drupal.org/project/pasteformat',
'path' => drupal_get_path('module', 'pasteformat') . '/plugins/pasteformat/',
'file' => 'plugin.js',
'extensions' => array(
'pasteformat' => t('Paste Format'),
),
'load' => TRUE,
),
);
}
}