php_filter

Versions
6
php_filter($op, $delta = 0, $format = -1, $text = '')

Implementation of hook_filter(). Contains a basic PHP evaluator.

Executes PHP code. Use with care.

Code

modules/php/php.module, line 71

<?php
function php_filter($op, $delta = 0, $format = -1, $text = '') {
  switch ($op) {
    case 'list':
      return array(0 => t('PHP evaluator'));
    case 'no cache':
      // No caching for the PHP evaluator.
      return $delta == 0;
    case 'description':
      return t('Executes a piece of PHP code. The usage of this filter should be restricted to administrators only!');
    case 'process':
      return drupal_eval($text);
    default:
      return $text;
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.