Parent Directory
|
Revision Log
|
Revision Graph
- Patch #11218 by David_Rothstein, sun, quicksketch, duncf, awood456, dropcube, mgifford | pwolanin, dww, RobRoy, Crell, webchick, beginner, ray007, bjaspan, chx, Gábor Hojtsy, Steven, Dries, lutegrass, sym, guardian, matt2000, geerlingguy, SeanBannister, matt westgate, com2, praseodym: allow default text formats per role, and integrate text format permissions.
| 1 | <?php |
| 2 | // $Id: php.install,v 1.13 2009/09/18 00:04:23 webchick Exp $ |
| 3 | |
| 4 | /** |
| 5 | * @file |
| 6 | * Install, update and uninstall functions for the php module. |
| 7 | */ |
| 8 | |
| 9 | /** |
| 10 | * Implement hook_install(). |
| 11 | */ |
| 12 | function php_install() { |
| 13 | $format_exists = (bool) db_query_range('SELECT 1 FROM {filter_format} WHERE name = :name', 0, 1, array(':name' => 'PHP code'))->fetchField(); |
| 14 | // Add a PHP code text format, if it does not exist. Do this only for the |
| 15 | // first install (or if the format has been manually deleted) as there is no |
| 16 | // reliable method to identify the format in an uninstall hook or in |
| 17 | // subsequent clean installs. |
| 18 | if (!$format_exists) { |
| 19 | $format = db_insert('filter_format') |
| 20 | ->fields(array( |
| 21 | 'name' => 'PHP code', |
| 22 | 'cache' => 0, |
| 23 | )) |
| 24 | ->execute(); |
| 25 | |
| 26 | // Enable the PHP evaluator filter. |
| 27 | db_insert('filter') |
| 28 | ->fields(array( |
| 29 | 'format' => $format, |
| 30 | 'module' => 'php', |
| 31 | 'name' => 'php_code', |
| 32 | 'weight' => 0, |
| 33 | 'status' => 1, |
| 34 | )) |
| 35 | ->execute(); |
| 36 | |
| 37 | drupal_set_message(t('A !php-code text format has been created.', array('!php-code' => l('PHP code', 'admin/config/content/formats/' . $format)))); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Implement hook_disable(). |
| 43 | */ |
| 44 | function php_disable() { |
| 45 | drupal_set_message(t('The PHP module has been disabled. Please note that any existing content that was using the PHP filter will now be visible in plain text. This might pose a security risk by exposing sensitive information, if any, used in the PHP code.')); |
| 46 | } |
| ViewVC Help | |
| Powered by ViewVC 1.1.2 |