You are here

static function crumbs_Util::routeFromMethodSuffix in Crumbs, the Breadcrumbs suite 7.2

Parameters

string $method_suffix:

Return value

string

2 calls to crumbs_Util::routeFromMethodSuffix()
crumbs_InjectedAPI_Collection_PluginCollection::analyzePluginMethods in lib/InjectedAPI/Collection/PluginCollection.php
crumbs_Util::buildMethodSuffix in lib/Util.php
This function has exactly one possible input value for each possible return value, except the return value FALSE.

File

lib/Util.php, line 65

Class

crumbs_Util
Static methods that don't fit elsewhere. Ideally these are all stateless and do not depend on anything. But at least one of them is not..

Code

static function routeFromMethodSuffix($method_suffix) {
  $route = strtr($method_suffix, array(
    '_' => '/',
  ));
  $route = preg_replace(array(
    '#/x/#',
    '#/x$#',
  ), array(
    '/%/',
    '/%',
  ), $route);

  // we need to do this two time to catch things like "/x/x/x/x".
  $route = strtr($route, array(
    '/x/' => '/%/',
  ));
  return $route;
}