Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.233 diff -u -F^f -r1.233 bootstrap.inc --- includes/bootstrap.inc 12 Oct 2008 02:47:50 -0000 1.233 +++ includes/bootstrap.inc 12 Oct 2008 04:46:54 -0000 @@ -1123,7 +1123,7 @@ function _drupal_bootstrap($phase) { break; case DRUPAL_BOOTSTRAP_PATH: - require_once DRUPAL_ROOT . '/includes/path.inc'; + require_once DRUPAL_ROOT . '/' . variable_get('path_inc', 'includes/path.inc'); // Initialize $_GET['q'] prior to loading modules and invoking hook_init(). drupal_init_path(); break; Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.806 diff -u -F^f -r1.806 common.inc --- includes/common.inc 12 Oct 2008 04:30:05 -0000 1.806 +++ includes/common.inc 12 Oct 2008 04:46:56 -0000 @@ -3600,3 +3600,99 @@ function _drupal_flush_css_js() { } variable_set('css_js_query_string', $new_character . substr($string_history, 0, 19)); } +/** + * Return a component of the current Drupal path. + * + * When viewing a page at the path "admin/build/types", for example, arg(0) + * would return "admin", arg(1) would return "content", and arg(2) would return + * "types". + * + * Avoid use of this function where possible, as resulting code is hard to read. + * Instead, attempt to use named arguments in menu callback functions. See the + * explanation in menu.inc for how to construct callbacks that take arguments. + * + * @param $index + * The index of the component, where each component is separated by a '/' + * (forward-slash), and where the first component has an index of 0 (zero). + * + * @return + * The component specified by $index, or NULL if the specified component was + * not found. + */ +function arg($index = NULL, $path = NULL) { + static $arguments; + + if (!isset($path)) { + $path = $_GET['q']; + } + if (!isset($arguments[$path])) { + $arguments[$path] = explode('/', $path); + } + if (!isset($index)) { + return $arguments[$path]; + } + if (isset($arguments[$path][$index])) { + return $arguments[$path][$index]; + } +} + +/** + * Get the title of the current page, for display on the page and in the title bar. + * + * @return + * The current page's title. + */ +function drupal_get_title() { + $title = drupal_set_title(); + + // during a bootstrap, menu.inc is not included and thus we cannot provide a title + if (!isset($title) && function_exists('menu_get_active_title')) { + $title = check_plain(menu_get_active_title()); + } + + return $title; +} + +/** + * Set the title of the current page, for display on the page and in the title bar. + * + * @param $title + * Optional string value to assign to the page title; or if set to NULL + * (default), leaves the current title unchanged. + * @param $output + * Optional flag - normally should be left as CHECK_PLAIN. Only set to + * PASS_THROUGH if you have already removed any possibly dangerous code + * from $title using a function like check_plain() or filter_xss(). With this + * flag the string will be passed through unchanged. + * + * @return + * The updated title of the current page. + */ +function drupal_set_title($title = NULL, $output = CHECK_PLAIN) { + static $stored_title; + + if (isset($title)) { + $stored_title = ($output == PASS_THROUGH) ? $title : check_plain($title); + } + return $stored_title; +} + +/** + * Check if a path matches any pattern in a set of patterns. + * + * @param $path + * The path to match. + * @param $patterns + * String containing a set of patterns separated by \n, \r or \r\n. + * + * @return + * Boolean value: TRUE if the path matches a pattern, FALSE otherwise. + */ +function drupal_match_path($path, $patterns) { + static $regexps; + + if (!isset($regexps[$patterns])) { + $regexps[$patterns] = '/^(' . preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\($|\|)/'), array('|', '.*', '\1' . preg_quote(variable_get('site_frontpage', 'node'), '/') . '\2'), preg_quote($patterns, '/')) . ')$/'; + } + return (bool)preg_match($regexps[$patterns], $path); +} Index: includes/path.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/path.inc,v retrieving revision 1.25 diff -u -F^f -r1.25 path.inc --- includes/path.inc 11 Oct 2008 21:10:59 -0000 1.25 +++ includes/path.inc 12 Oct 2008 04:46:56 -0000 @@ -138,83 +138,6 @@ function drupal_get_normal_path($path, $ } /** - * Return a component of the current Drupal path. - * - * When viewing a page at the path "admin/build/types", for example, arg(0) - * would return "admin", arg(1) would return "content", and arg(2) would return - * "types". - * - * Avoid use of this function where possible, as resulting code is hard to read. - * Instead, attempt to use named arguments in menu callback functions. See the - * explanation in menu.inc for how to construct callbacks that take arguments. - * - * @param $index - * The index of the component, where each component is separated by a '/' - * (forward-slash), and where the first component has an index of 0 (zero). - * - * @return - * The component specified by $index, or NULL if the specified component was - * not found. - */ -function arg($index = NULL, $path = NULL) { - static $arguments; - - if (!isset($path)) { - $path = $_GET['q']; - } - if (!isset($arguments[$path])) { - $arguments[$path] = explode('/', $path); - } - if (!isset($index)) { - return $arguments[$path]; - } - if (isset($arguments[$path][$index])) { - return $arguments[$path][$index]; - } -} - -/** - * Get the title of the current page, for display on the page and in the title bar. - * - * @return - * The current page's title. - */ -function drupal_get_title() { - $title = drupal_set_title(); - - // during a bootstrap, menu.inc is not included and thus we cannot provide a title - if (!isset($title) && function_exists('menu_get_active_title')) { - $title = check_plain(menu_get_active_title()); - } - - return $title; -} - -/** - * Set the title of the current page, for display on the page and in the title bar. - * - * @param $title - * Optional string value to assign to the page title; or if set to NULL - * (default), leaves the current title unchanged. - * @param $output - * Optional flag - normally should be left as CHECK_PLAIN. Only set to - * PASS_THROUGH if you have already removed any possibly dangerous code - * from $title using a function like check_plain() or filter_xss(). With this - * flag the string will be passed through unchanged. - * - * @return - * The updated title of the current page. - */ -function drupal_set_title($title = NULL, $output = CHECK_PLAIN) { - static $stored_title; - - if (isset($title)) { - $stored_title = ($output == PASS_THROUGH) ? $title : check_plain($title); - } - return $stored_title; -} - -/** * Check if the current page is the front page. * * @return @@ -226,22 +149,3 @@ function drupal_is_front_page() { return $_GET['q'] == drupal_get_normal_path(variable_get('site_frontpage', 'node')); } -/** - * Check if a path matches any pattern in a set of patterns. - * - * @param $path - * The path to match. - * @param $patterns - * String containing a set of patterns separated by \n, \r or \r\n. - * - * @return - * Boolean value: TRUE if the path matches a pattern, FALSE otherwise. - */ -function drupal_match_path($path, $patterns) { - static $regexps; - - if (!isset($regexps[$patterns])) { - $regexps[$patterns] = '/^(' . preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\($|\|)/'), array('|', '.*', '\1' . preg_quote(variable_get('site_frontpage', 'node'), '/') . '\2'), preg_quote($patterns, '/')) . ')$/'; - } - return (bool)preg_match($regexps[$patterns], $path); -} Index: includes/theme.maintenance.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.maintenance.inc,v retrieving revision 1.19 diff -u -F^f -r1.19 theme.maintenance.inc --- includes/theme.maintenance.inc 1 Oct 2008 00:27:29 -0000 1.19 +++ includes/theme.maintenance.inc 12 Oct 2008 04:46:57 -0000 @@ -22,7 +22,7 @@ function _drupal_maintenance_theme() { return; } - require_once DRUPAL_ROOT . '/includes/path.inc'; + require_once DRUPAL_ROOT . '/' . variable_get('path_inc', 'includes/path.inc'); require_once DRUPAL_ROOT . '/includes/theme.inc'; require_once DRUPAL_ROOT . '/includes/common.inc'; require_once DRUPAL_ROOT . '/includes/unicode.inc';