lib/trails.php
function extract_action_and_args($string) {

    if ('' === $string) {
      return array('index', array(), NULL);
    }

    // find optional file extension
    $format = NULL;
    if (preg_match('/^(.*[^\/.])\.(\w+)$/', $string, $matches)) {
      list($_, $string, $format) = $matches;
    }

    // TODO this should possibly remove empty tokens
    $args = explode('/', $string);
    $action = array_shift($args);
    return array($action, $args, $format);
  }
function extract_action_and_args($string) {

    if ('' === $string) {
      return array('index', array(), NULL);
    }

    // find optional file extension
    $format = NULL;
    if (preg_match('/^(.*[^\/.])\.(\w+)$/', $string, $matches)) {
      list($_, $string, $format) = $matches;
    }

    // TODO this should possibly remove empty tokens
    $args = explode('/', $string);
    $action = array_shift($args);
    return array($action, $args, $format);
  }
function extract_action_and_args ( $ string ) { if ( '' === $ string ) { return array ( 'index' , array ( ) , NULL ) ; } // find optional file extension $ format = NULL ; if ( preg_match ( '/^(.*[^\/.])\.(\w+)$/' , $ string , $ matches ) ) { list ( $ _ , $ string , $ format ) = $ matches ; } // TODO this should possibly remove empty tokens $ args = explode ( '/' , $ string ) ; $ action = array_shift ( $ args ) ; return array ( $ action , $ args , $ format ) ; }
Extracts action and args from a string.

@param  string       the processed string

@return array        an array with two elements - a string containing the
action and an array of strings representing the args
Extracts action and args from a string .