function drupal_basename

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 file.inc drupal_basename($uri, $suffix = NULL)
cle7 file.inc drupal_basename($uri, $suffix = NULL)
elmsmedia7 file.inc drupal_basename($uri, $suffix = NULL)
icor7 file.inc drupal_basename($uri, $suffix = NULL)
meedjum_blog7 file.inc drupal_basename($uri, $suffix = NULL)
mooc7 file.inc drupal_basename($uri, $suffix = NULL)

Gets the filename from a given path.

PHP's basename() does not properly support streams or filenames beginning with a non-US-ASCII character.

See also

http://bugs.php.net/bug.php?id=37738

basename()

Related topics

28 calls to drupal_basename()
color_scheme_form_submit in modules/color/color.module
Form submission handler for color_scheme_form().
DrupalLocalStreamWrapper::getLocalPath in includes/stream_wrappers.inc
Returns the canonical absolute path of the URI, if possible.
DrupalLocalStreamWrapper::getMimeType in includes/stream_wrappers.inc
Base implementation of getMimeType().
drupal_get_css in includes/common.inc
Returns a themed representation of all stylesheets to attach to the page.
drupal_tempnam in includes/file.inc
Creates a file with a unique filename in the specified directory.

... See full list

File

includes/file.inc, line 2317
API for handling file uploads and server file management.

Code

function drupal_basename($uri, $suffix = NULL) {
  $separators = '/';
  if (DIRECTORY_SEPARATOR != '/') {
    // For Windows OS add special separator.
    $separators .= DIRECTORY_SEPARATOR;
  }
  // Remove right-most slashes when $uri points to directory.
  $uri = rtrim($uri, $separators);
  // Returns the trailing part of the $uri starting after one of the directory
  // separators.
  $filename = preg_match('@[^' . preg_quote($separators, '@') . ']+$@', $uri, $matches) ? $matches[0] : '';
  // Cuts off a suffix from the filename.
  if ($suffix) {
    $filename = preg_replace('@' . preg_quote($suffix, '@') . '$@', '', $filename);
  }
  return $filename;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.