Skip to content

Commit

Permalink
__FILE and __DIR constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien committed Mar 27, 2014
1 parent e5cb515 commit 5ddce0c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/sbp/sbp.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,14 @@ static public function parse($content)
$content = preg_replace('#^(\s*<\?php)(\s)#', '$1 '.self::COMMENT.(is_null(static::$lastParsedFile) ? '' : '/*:'.static::$lastParsedFile.':*/').'$2', $content, 1, $count);
$content = preg_replace_callback('#'.self::COMMENTS.'|'.self::stringRegex().'|\?'.'>.*<\?php#sU', array(get_class(), 'replaceString'), $content);
//$validsubst = self::validSubst();
$__file = is_null(static::$lastParsedFile) ? null : realpath(static::$lastParsedFile);
if($__file === false)
{
$__file = static::$lastParsedFile;
}
$__dir = is_null($__file) ? null : dirname($__file);
$__file = var_export($__file, true);
$__dir = var_export($__dir, true);
$validComments = self::validSubst('(?:'.implode('|', $GLOBALS['commentStrings']).')');
if(!$count)
{
Expand Down Expand Up @@ -346,6 +354,16 @@ static public function parse($content)
=> array(get_class(), 'parseClass'),


/************************/
/* Constantes spéciales */
/************************/
'#(?!<[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff$]|::|->)__FILE(?![a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff])#'
=> $__file,

'#(?!<[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff$]|::|->)__DIR(?![a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff])#'
=> $__dir,


/**************/
/* Constantes */
/**************/
Expand Down

0 comments on commit 5ddce0c

Please sign in to comment.