summaryrefslogtreecommitdiff
path: root/lib/coderay/scanners/php.rb
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2011-07-26 23:19:24 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2011-07-26 23:19:24 +0200
commit162d21e3c32abdd3250c2a2772524e1f9219d9ac (patch)
tree4a661c5c71cbab9e8ab111dd0cdd1eb447885e62 /lib/coderay/scanners/php.rb
parent79da2fc27f1273a4da02c9684457662023ee7822 (diff)
downloadcoderay-162d21e3c32abdd3250c2a2772524e1f9219d9ac.tar.gz
PHP scanner should not scan the whole document for HTML/PHP indicators
Diffstat (limited to 'lib/coderay/scanners/php.rb')
-rw-r--r--lib/coderay/scanners/php.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/coderay/scanners/php.rb b/lib/coderay/scanners/php.rb
index 8ec1196..c290dab 100644
--- a/lib/coderay/scanners/php.rb
+++ b/lib/coderay/scanners/php.rb
@@ -234,8 +234,8 @@ module Scanners
def scan_tokens encoder, options
if check(RE::PHP_START) || # starts with <?
- (match?(/\s*<\S/) && exist?(RE::PHP_START)) || # starts with tag and contains <?
- exist?(RE::HTML_INDICATOR) ||
+ (match?(/\s*<\S/) && check(/.{1,100}#{RE::PHP_START}/om)) || # starts with tag and contains <?
+ check(/.{1,100}#{RE::HTML_INDICATOR}/om) ||
check(/.{1,100}#{RE::PHP_START}/om) # PHP start after max 100 chars
# is HTML with embedded PHP, so start with HTML
states = [:initial]