diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-05-07 15:29:08 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-05-07 15:29:08 +0000 |
commit | 0f08d97b2151b8baab95f92d46808d250191b2f1 (patch) | |
tree | 19c5465da97f13a42dae43f59cec8982999465bb /includes/common.inc | |
parent | 8550540b511967961c095fc085c8cc8062c424f3 (diff) | |
download | brdo-0f08d97b2151b8baab95f92d46808d250191b2f1.tar.gz brdo-0f08d97b2151b8baab95f92d46808d250191b2f1.tar.bz2 |
#124158 by nedjo, jcnventura: Pull all PHP handling into PHP module.
Diffstat (limited to 'includes/common.inc')
-rw-r--r-- | includes/common.inc | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/includes/common.inc b/includes/common.inc index d79b78ccb..c2c7d5481 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -1909,50 +1909,6 @@ function drupal_map_assoc($array, $function = NULL) { } /** - * Evaluate a string of PHP code. - * - * This is a wrapper around PHP's eval(). It uses output buffering to capture both - * returned and printed text. Unlike eval(), we require code to be surrounded by - * <?php ?> tags; in other words, we evaluate the code as if it were a stand-alone - * PHP file. - * - * Using this wrapper also ensures that the PHP code which is evaluated can not - * overwrite any variables in the calling code, unlike a regular eval() call. - * - * @param $code - * The code to evaluate. - * @return - * A string containing the printed output of the code, followed by the returned - * output of the code. - */ -function drupal_eval($code) { - global $theme_path, $theme_info, $conf; - - // Store current theme path. - $old_theme_path = $theme_path; - - // Restore theme_path to the theme, as long as drupal_eval() executes, - // so code evaluated will not see the caller module as the current theme. - // If theme info is not initialized get the path from theme_default. - if (!isset($theme_info)) { - $theme_path = drupal_get_path('theme', $conf['theme_default']); - } - else { - $theme_path = dirname($theme_info->filename); - } - - ob_start(); - print eval('?>' . $code); - $output = ob_get_contents(); - ob_end_clean(); - - // Recover original theme path. - $theme_path = $old_theme_path; - - return $output; -} - -/** * Returns the path to a system item (module, theme, etc.). * * @param $type |