You are here

static function RealisticDummyContentEnvironment::AttributeName in Realistic Dummy Content 7

Returns the attribute of a filename if one exists

If >2 periods are present in the file name, then what is between the last and next to last period is kept, for example:

a.b.c => b a.b.c.d => c a.b => NULL a => NULL

Parameters

$filename: A filename string, for example 'a.b.txt'

Return value

Null if there is attribute to extract; otherwise the attribute name, for example "b".

Throws

Exception

File

api/includes/RealisticDummyContentEnvironment.inc, line 315
Define RealisticDummyContentLiveEnvironment autoload class.

Class

RealisticDummyContentEnvironment
The abstract base environment.

Code

static function AttributeName($filename) {
  $replaced = self::Replace($filename, '\\2');
  if ($replaced != $filename) {
    return $replaced;
  }
  else {
    return NULL;
  }
}