Hello Parsedown Extra!
-``` diff --git a/vendor/erusev/parsedown/LICENSE.txt b/vendor/erusev/parsedown/LICENSE.txt deleted file mode 100644 index baca86f5b..000000000 --- a/vendor/erusev/parsedown/LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 Emanuil Rusev, erusev.com - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/vendor/erusev/parsedown/Parsedown.php b/vendor/erusev/parsedown/Parsedown.php deleted file mode 100755 index f877c4871..000000000 --- a/vendor/erusev/parsedown/Parsedown.php +++ /dev/null @@ -1,1402 +0,0 @@ -Definitions = array(); - - # standardize line breaks - $text = str_replace("\r\n", "\n", $text); - $text = str_replace("\r", "\n", $text); - - # replace tabs with spaces - $text = str_replace("\t", ' ', $text); - - # remove surrounding line breaks - $text = trim($text, "\n"); - - # split text into lines - $lines = explode("\n", $text); - - # iterate through lines to identify blocks - $markup = $this->lines($lines); - - # trim line breaks - $markup = trim($markup, "\n"); - - return $markup; - } - - # - # Setters - # - - private $breaksEnabled; - - function setBreaksEnabled($breaksEnabled) - { - $this->breaksEnabled = $breaksEnabled; - - return $this; - } - - # - # Lines - # - - protected $BlockTypes = array( - '#' => array('Atx'), - '*' => array('Rule', 'List'), - '+' => array('List'), - '-' => array('Setext', 'Table', 'Rule', 'List'), - '0' => array('List'), - '1' => array('List'), - '2' => array('List'), - '3' => array('List'), - '4' => array('List'), - '5' => array('List'), - '6' => array('List'), - '7' => array('List'), - '8' => array('List'), - '9' => array('List'), - ':' => array('Table'), - '<' => array('Comment', 'Markup'), - '=' => array('Setext'), - '>' => array('Quote'), - '_' => array('Rule'), - '`' => array('FencedCode'), - '|' => array('Table'), - '~' => array('FencedCode'), - ); - - # ~ - - protected $DefinitionTypes = array( - '[' => array('Reference'), - ); - - # ~ - - protected $unmarkedBlockTypes = array( - 'CodeBlock', - ); - - # - # Blocks - # - - private function lines(array $lines) - { - $CurrentBlock = null; - - foreach ($lines as $line) - { - if (chop($line) === '') - { - if (isset($CurrentBlock)) - { - $CurrentBlock['interrupted'] = true; - } - - continue; - } - - $indent = 0; - - while (isset($line[$indent]) and $line[$indent] === ' ') - { - $indent ++; - } - - $text = $indent > 0 ? substr($line, $indent) : $line; - - # ~ - - $Line = array('body' => $line, 'indent' => $indent, 'text' => $text); - - # ~ - - if (isset($CurrentBlock['incomplete'])) - { - $Block = $this->{'addTo'.$CurrentBlock['type']}($Line, $CurrentBlock); - - if (isset($Block)) - { - $CurrentBlock = $Block; - - continue; - } - else - { - if (method_exists($this, 'complete'.$CurrentBlock['type'])) - { - $CurrentBlock = $this->{'complete'.$CurrentBlock['type']}($CurrentBlock); - } - - unset($CurrentBlock['incomplete']); - } - } - - # ~ - - $marker = $text[0]; - - if (isset($this->DefinitionTypes[$marker])) - { - foreach ($this->DefinitionTypes[$marker] as $definitionType) - { - $Definition = $this->{'identify'.$definitionType}($Line, $CurrentBlock); - - if (isset($Definition)) - { - $this->Definitions[$definitionType][$Definition['id']] = $Definition['data']; - - continue 2; - } - } - } - - # ~ - - $blockTypes = $this->unmarkedBlockTypes; - - if (isset($this->BlockTypes[$marker])) - { - foreach ($this->BlockTypes[$marker] as $blockType) - { - $blockTypes []= $blockType; - } - } - - # - # ~ - - foreach ($blockTypes as $blockType) - { - $Block = $this->{'identify'.$blockType}($Line, $CurrentBlock); - - if (isset($Block)) - { - $Block['type'] = $blockType; - - if ( ! isset($Block['identified'])) - { - $Elements []= $CurrentBlock['element']; - - $Block['identified'] = true; - } - - if (method_exists($this, 'addTo'.$blockType)) - { - $Block['incomplete'] = true; - } - - $CurrentBlock = $Block; - - continue 2; - } - } - - # ~ - - if (isset($CurrentBlock) and ! isset($CurrentBlock['type']) and ! isset($CurrentBlock['interrupted'])) - { - $CurrentBlock['element']['text'] .= "\n".$text; - } - else - { - $Elements []= $CurrentBlock['element']; - - $CurrentBlock = $this->buildParagraph($Line); - - $CurrentBlock['identified'] = true; - } - } - - # ~ - - if (isset($CurrentBlock['incomplete']) and method_exists($this, 'complete'.$CurrentBlock['type'])) - { - $CurrentBlock = $this->{'complete'.$CurrentBlock['type']}($CurrentBlock); - } - - # ~ - - $Elements []= $CurrentBlock['element']; - - unset($Elements[0]); - - # ~ - - $markup = $this->elements($Elements); - - # ~ - - return $markup; - } - - # - # Atx - - protected function identifyAtx($Line) - { - if (isset($Line['text'][1])) - { - $level = 1; - - while (isset($Line['text'][$level]) and $Line['text'][$level] === '#') - { - $level ++; - } - - $text = trim($Line['text'], '# '); - - $Block = array( - 'element' => array( - 'name' => 'h'.$level, - 'text' => $text, - 'handler' => 'line', - ), - ); - - return $Block; - } - } - - # - # Code - - protected function identifyCodeBlock($Line) - { - if ($Line['indent'] >= 4) - { - $text = substr($Line['body'], 4); - - $Block = array( - 'element' => array( - 'name' => 'pre', - 'handler' => 'element', - 'text' => array( - 'name' => 'code', - 'text' => $text, - ), - ), - ); - - return $Block; - } - } - - protected function addToCodeBlock($Line, $Block) - { - if ($Line['indent'] >= 4) - { - if (isset($Block['interrupted'])) - { - $Block['element']['text']['text'] .= "\n"; - - unset($Block['interrupted']); - } - - $Block['element']['text']['text'] .= "\n"; - - $text = substr($Line['body'], 4); - - $Block['element']['text']['text'] .= $text; - - return $Block; - } - } - - protected function completeCodeBlock($Block) - { - $text = $Block['element']['text']['text']; - - $text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8'); - - $Block['element']['text']['text'] = $text; - - return $Block; - } - - # - # Comment - - protected function identifyComment($Line) - { - if (isset($Line['text'][3]) and $Line['text'][3] === '-' and $Line['text'][2] === '-' and $Line['text'][1] === '!') - { - $Block = array( - 'element' => $Line['body'], - ); - - if (preg_match('/-->$/', $Line['text'])) - { - $Block['closed'] = true; - } - - return $Block; - } - } - - protected function addToComment($Line, array $Block) - { - if (isset($Block['closed'])) - { - return; - } - - $Block['element'] .= "\n" . $Line['body']; - - if (preg_match('/-->$/', $Line['text'])) - { - $Block['closed'] = true; - } - - return $Block; - } - - # - # Fenced Code - - protected function identifyFencedCode($Line) - { - if (preg_match('/^(['.$Line['text'][0].']{3,})[ ]*([\w-]+)?[ ]*$/', $Line['text'], $matches)) - { - $Element = array( - 'name' => 'code', - 'text' => '', - ); - - if (isset($matches[2])) - { - $class = 'language-'.$matches[2]; - - $Element['attributes'] = array( - 'class' => $class, - ); - } - - $Block = array( - 'char' => $Line['text'][0], - 'element' => array( - 'name' => 'pre', - 'handler' => 'element', - 'text' => $Element, - ), - ); - - return $Block; - } - } - - protected function addToFencedCode($Line, $Block) - { - if (isset($Block['complete'])) - { - return; - } - - if (isset($Block['interrupted'])) - { - $Block['element']['text']['text'] .= "\n"; - - unset($Block['interrupted']); - } - - if (preg_match('/^'.$Block['char'].'{3,}[ ]*$/', $Line['text'])) - { - $Block['element']['text']['text'] = substr($Block['element']['text']['text'], 1); - - $Block['complete'] = true; - - return $Block; - } - - $Block['element']['text']['text'] .= "\n".$Line['body'];; - - return $Block; - } - - protected function completeFencedCode($Block) - { - $text = $Block['element']['text']['text']; - - $text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8'); - - $Block['element']['text']['text'] = $text; - - return $Block; - } - - # - # List - - protected function identifyList($Line) - { - list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]+[.]'); - - if (preg_match('/^('.$pattern.'[ ]+)(.*)/', $Line['text'], $matches)) - { - $Block = array( - 'indent' => $Line['indent'], - 'pattern' => $pattern, - 'element' => array( - 'name' => $name, - 'handler' => 'elements', - ), - ); - - $Block['li'] = array( - 'name' => 'li', - 'handler' => 'li', - 'text' => array( - $matches[2], - ), - ); - - $Block['element']['text'] []= & $Block['li']; - - return $Block; - } - } - - protected function addToList($Line, array $Block) - { - if ($Block['indent'] === $Line['indent'] and preg_match('/^'.$Block['pattern'].'[ ]+(.*)/', $Line['text'], $matches)) - { - if (isset($Block['interrupted'])) - { - $Block['li']['text'] []= ''; - - unset($Block['interrupted']); - } - - unset($Block['li']); - - $Block['li'] = array( - 'name' => 'li', - 'handler' => 'li', - 'text' => array( - $matches[1], - ), - ); - - $Block['element']['text'] []= & $Block['li']; - - return $Block; - } - - if ( ! isset($Block['interrupted'])) - { - $text = preg_replace('/^[ ]{0,4}/', '', $Line['body']); - - $Block['li']['text'] []= $text; - - return $Block; - } - - if ($Line['indent'] > 0) - { - $Block['li']['text'] []= ''; - - $text = preg_replace('/^[ ]{0,4}/', '', $Line['body']); - - $Block['li']['text'] []= $text; - - unset($Block['interrupted']); - - return $Block; - } - } - - # - # Quote - - protected function identifyQuote($Line) - { - if (preg_match('/^>[ ]?(.*)/', $Line['text'], $matches)) - { - $Block = array( - 'element' => array( - 'name' => 'blockquote', - 'handler' => 'lines', - 'text' => (array) $matches[1], - ), - ); - - return $Block; - } - } - - protected function addToQuote($Line, array $Block) - { - if ($Line['text'][0] === '>' and preg_match('/^>[ ]?(.*)/', $Line['text'], $matches)) - { - if (isset($Block['interrupted'])) - { - $Block['element']['text'] []= ''; - - unset($Block['interrupted']); - } - - $Block['element']['text'] []= $matches[1]; - - return $Block; - } - - if ( ! isset($Block['interrupted'])) - { - $Block['element']['text'] []= $Line['text']; - - return $Block; - } - } - - # - # Rule - - protected function identifyRule($Line) - { - if (preg_match('/^(['.$Line['text'][0].'])([ ]{0,2}\1){2,}[ ]*$/', $Line['text'])) - { - $Block = array( - 'element' => array( - 'name' => 'hr' - ), - ); - - return $Block; - } - } - - # - # Setext - - protected function identifySetext($Line, array $Block = null) - { - if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted'])) - { - return; - } - - if (chop($Line['text'], $Line['text'][0]) === '') - { - $Block['element']['name'] = $Line['text'][0] === '=' ? 'h1' : 'h2'; - - return $Block; - } - } - - # - # Markup - - protected function identifyMarkup($Line) - { - if (preg_match('/^<(\w[\w\d]*)(?:[ ][^>\/]*)?(\/?)[ ]*>/', $Line['text'], $matches)) - { - if (in_array($matches[1], $this->textLevelElements)) - { - return; - } - - $Block = array( - 'element' => $Line['body'], - ); - - if ($matches[2] or $matches[1] === 'hr' or preg_match('/<\/'.$matches[1].'>[ ]*$/', $Line['text'])) - { - $Block['closed'] = true; - } - else - { - $Block['depth'] = 0; - $Block['name'] = $matches[1]; - } - - return $Block; - } - } - - protected function addToMarkup($Line, array $Block) - { - if (isset($Block['closed'])) - { - return; - } - - if (preg_match('/<'.$Block['name'].'([ ][^\/]+)?>/', $Line['text'])) # opening tag - { - $Block['depth'] ++; - } - - if (stripos($Line['text'], ''.$Block['name'].'>') !== false) # closing tag - { - if ($Block['depth'] > 0) - { - $Block['depth'] --; - } - else - { - $Block['closed'] = true; - } - } - - $Block['element'] .= "\n".$Line['body']; - - return $Block; - } - - # - # Table - - protected function identifyTable($Line, array $Block = null) - { - if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted'])) - { - return; - } - - if (strpos($Block['element']['text'], '|') !== false and chop($Line['text'], ' -:|') === '') - { - $alignments = array(); - - $divider = $Line['text']; - - $divider = trim($divider); - $divider = trim($divider, '|'); - - $dividerCells = explode('|', $divider); - - foreach ($dividerCells as $dividerCell) - { - $dividerCell = trim($dividerCell); - - if ($dividerCell === '') - { - continue; - } - - $alignment = null; - - if ($dividerCell[0] === ':') - { - $alignment = 'left'; - } - - if (substr($dividerCell, -1) === ':') - { - $alignment = $alignment === 'left' ? 'center' : 'right'; - } - - $alignments []= $alignment; - } - - # ~ - - $HeaderElements = array(); - - $header = $Block['element']['text']; - - $header = trim($header); - $header = trim($header, '|'); - - $headerCells = explode('|', $header); - - foreach ($headerCells as $index => $headerCell) - { - $headerCell = trim($headerCell); - - $HeaderElement = array( - 'name' => 'th', - 'text' => $headerCell, - 'handler' => 'line', - ); - - if (isset($alignments[$index])) - { - $alignment = $alignments[$index]; - - $HeaderElement['attributes'] = array( - 'align' => $alignment, - ); - } - - $HeaderElements []= $HeaderElement; - } - - # ~ - - $Block = array( - 'alignments' => $alignments, - 'identified' => true, - 'element' => array( - 'name' => 'table', - 'handler' => 'elements', - ), - ); - - $Block['element']['text'] []= array( - 'name' => 'thead', - 'handler' => 'elements', - ); - - $Block['element']['text'] []= array( - 'name' => 'tbody', - 'handler' => 'elements', - 'text' => array(), - ); - - $Block['element']['text'][0]['text'] []= array( - 'name' => 'tr', - 'handler' => 'elements', - 'text' => $HeaderElements, - ); - - return $Block; - } - } - - protected function addToTable($Line, array $Block) - { - if ($Line['text'][0] === '|' or strpos($Line['text'], '|')) - { - $Elements = array(); - - $row = $Line['text']; - - $row = trim($row); - $row = trim($row, '|'); - - $cells = explode('|', $row); - - foreach ($cells as $index => $cell) - { - $cell = trim($cell); - - $Element = array( - 'name' => 'td', - 'handler' => 'line', - 'text' => $cell, - ); - - if (isset($Block['alignments'][$index])) - { - $Element['attributes'] = array( - 'align' => $Block['alignments'][$index], - ); - } - - $Elements []= $Element; - } - - $Element = array( - 'name' => 'tr', - 'handler' => 'elements', - 'text' => $Elements, - ); - - $Block['element']['text'][1]['text'] []= $Element; - - return $Block; - } - } - - # - # Definitions - # - - protected function identifyReference($Line) - { - if (preg_match('/^\[(.+?)\]:[ ]*(\S+?)>?(?:[ ]+["\'(](.+)["\')])?[ ]*$/', $Line['text'], $matches)) - { - $Definition = array( - 'id' => strtolower($matches[1]), - 'data' => array( - 'url' => $matches[2], - ), - ); - - if (isset($matches[3])) - { - $Definition['data']['title'] = $matches[3]; - } - - return $Definition; - } - } - - # - # ~ - # - - protected function buildParagraph($Line) - { - $Block = array( - 'element' => array( - 'name' => 'p', - 'text' => $Line['text'], - 'handler' => 'line', - ), - ); - - return $Block; - } - - # - # ~ - # - - protected function element(array $Element) - { - $markup = '<'.$Element['name']; - - if (isset($Element['attributes'])) - { - foreach ($Element['attributes'] as $name => $value) - { - $markup .= ' '.$name.'="'.$value.'"'; - } - } - - if (isset($Element['text'])) - { - $markup .= '>'; - - if (isset($Element['handler'])) - { - $markup .= $this->$Element['handler']($Element['text']); - } - else - { - $markup .= $Element['text']; - } - - $markup .= ''.$Element['name'].'>'; - } - else - { - $markup .= ' />'; - } - - return $markup; - } - - protected function elements(array $Elements) - { - $markup = ''; - - foreach ($Elements as $Element) - { - if ($Element === null) - { - continue; - } - - $markup .= "\n"; - - if (is_string($Element)) # because of Markup - { - $markup .= $Element; - - continue; - } - - $markup .= $this->element($Element); - } - - $markup .= "\n"; - - return $markup; - } - - # - # Spans - # - - protected $SpanTypes = array( - '!' => array('Link'), # ? - '&' => array('Ampersand'), - '*' => array('Emphasis'), - '/' => array('Url'), - '<' => array('UrlTag', 'EmailTag', 'Tag', 'LessThan'), - '[' => array('Link'), - '_' => array('Emphasis'), - '`' => array('InlineCode'), - '~' => array('Strikethrough'), - '\\' => array('EscapeSequence'), - ); - - # ~ - - protected $spanMarkerList = '*_!&[`~\\'; - - # - # ~ - # - - public function line($text) - { - $markup = ''; - - $remainder = $text; - - $markerPosition = 0; - - while ($excerpt = strpbrk($remainder, $this->spanMarkerList)) - { - $marker = $excerpt[0]; - - $markerPosition += strpos($remainder, $marker); - - $Excerpt = array('text' => $excerpt, 'context' => $text); - - foreach ($this->SpanTypes[$marker] as $spanType) - { - $handler = 'identify'.$spanType; - - $Span = $this->$handler($Excerpt); - - if ( ! isset($Span)) - { - continue; - } - - # The identified span can be ahead of the marker. - - if (isset($Span['position']) and $Span['position'] > $markerPosition) - { - continue; - } - - # Spans that start at the position of their marker don't have to set a position. - - if ( ! isset($Span['position'])) - { - $Span['position'] = $markerPosition; - } - - $plainText = substr($text, 0, $Span['position']); - - $markup .= $this->readPlainText($plainText); - - $markup .= isset($Span['markup']) ? $Span['markup'] : $this->element($Span['element']); - - $text = substr($text, $Span['position'] + $Span['extent']); - - $remainder = $text; - - $markerPosition = 0; - - continue 2; - } - - $remainder = substr($excerpt, 1); - - $markerPosition ++; - } - - $markup .= $this->readPlainText($text); - - return $markup; - } - - # - # ~ - # - - protected function identifyUrl($Excerpt) - { - if ( ! isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '/') - { - return; - } - - if (preg_match('/\bhttps?:[\/]{2}[^\s<]+\b\/*/ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE)) - { - $url = str_replace(array('&', '<'), array('&', '<'), $matches[0][0]); - - return array( - 'extent' => strlen($matches[0][0]), - 'position' => $matches[0][1], - 'element' => array( - 'name' => 'a', - 'text' => $url, - 'attributes' => array( - 'href' => $url, - ), - ), - ); - } - } - - protected function identifyAmpersand($Excerpt) - { - if ( ! preg_match('/^?\w+;/', $Excerpt['text'])) - { - return array( - 'markup' => '&', - 'extent' => 1, - ); - } - } - - protected function identifyStrikethrough($Excerpt) - { - if ( ! isset($Excerpt['text'][1])) - { - return; - } - - if ($Excerpt['text'][1] === '~' and preg_match('/^~~(?=\S)(.+?)(?<=\S)~~/', $Excerpt['text'], $matches)) - { - return array( - 'extent' => strlen($matches[0]), - 'element' => array( - 'name' => 'del', - 'text' => $matches[1], - 'handler' => 'line', - ), - ); - } - } - - protected function identifyEscapeSequence($Excerpt) - { - if (isset($Excerpt['text'][1]) and in_array($Excerpt['text'][1], $this->specialCharacters)) - { - return array( - 'markup' => $Excerpt['text'][1], - 'extent' => 2, - ); - } - } - - protected function identifyLessThan() - { - return array( - 'markup' => '<', - 'extent' => 1, - ); - } - - protected function identifyUrlTag($Excerpt) - { - if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<(https?:[\/]{2}[^\s]+?)>/i', $Excerpt['text'], $matches)) - { - $url = str_replace(array('&', '<'), array('&', '<'), $matches[1]); - - return array( - 'extent' => strlen($matches[0]), - 'element' => array( - 'name' => 'a', - 'text' => $url, - 'attributes' => array( - 'href' => $url, - ), - ), - ); - } - } - - protected function identifyEmailTag($Excerpt) - { - if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<(\S+?@\S+?)>/', $Excerpt['text'], $matches)) - { - return array( - 'extent' => strlen($matches[0]), - 'element' => array( - 'name' => 'a', - 'text' => $matches[1], - 'attributes' => array( - 'href' => 'mailto:'.$matches[1], - ), - ), - ); - } - } - - protected function identifyTag($Excerpt) - { - if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<\/?\w.*?>/', $Excerpt['text'], $matches)) - { - return array( - 'markup' => $matches[0], - 'extent' => strlen($matches[0]), - ); - } - } - - protected function identifyInlineCode($Excerpt) - { - $marker = $Excerpt['text'][0]; - - if (preg_match('/^('.$marker.'+)[ ]*(.+?)[ ]*(? strlen($matches[0]), - 'element' => array( - 'name' => 'code', - 'text' => $text, - ), - ); - } - } - - protected function identifyLink($Excerpt) - { - $extent = $Excerpt['text'][0] === '!' ? 1 : 0; - - if (strpos($Excerpt['text'], ']') and preg_match('/\[((?:[^][]|(?R))*)\]/', $Excerpt['text'], $matches)) - { - $Link = array('text' => $matches[1], 'label' => strtolower($matches[1])); - - $extent += strlen($matches[0]); - - $substring = substr($Excerpt['text'], $extent); - - if (preg_match('/^\s*\[([^][]+)\]/', $substring, $matches)) - { - $Link['label'] = strtolower($matches[1]); - - if (isset($this->Definitions['Reference'][$Link['label']])) - { - $Link += $this->Definitions['Reference'][$Link['label']]; - - $extent += strlen($matches[0]); - } - else - { - return; - } - } - elseif (isset($this->Definitions['Reference'][$Link['label']])) - { - $Link += $this->Definitions['Reference'][$Link['label']]; - - if (preg_match('/^[ ]*\[\]/', $substring, $matches)) - { - $extent += strlen($matches[0]); - } - } - elseif (preg_match('/^\([ ]*(.*?)(?:[ ]+[\'"](.+?)[\'"])?[ ]*\)/', $substring, $matches)) - { - $Link['url'] = $matches[1]; - - if (isset($matches[2])) - { - $Link['title'] = $matches[2]; - } - - $extent += strlen($matches[0]); - } - else - { - return; - } - } - else - { - return; - } - - $url = str_replace(array('&', '<'), array('&', '<'), $Link['url']); - - if ($Excerpt['text'][0] === '!') - { - $Element = array( - 'name' => 'img', - 'attributes' => array( - 'alt' => $Link['text'], - 'src' => $url, - ), - ); - } - else - { - $Element = array( - 'name' => 'a', - 'handler' => 'line', - 'text' => $Link['text'], - 'attributes' => array( - 'href' => $url, - ), - ); - } - - if (isset($Link['title'])) - { - $Element['attributes']['title'] = $Link['title']; - } - - return array( - 'extent' => $extent, - 'element' => $Element, - ); - } - - protected function identifyEmphasis($Excerpt) - { - if ( ! isset($Excerpt['text'][1])) - { - return; - } - - $marker = $Excerpt['text'][0]; - - if ($Excerpt['text'][1] === $marker and preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches)) - { - $emphasis = 'strong'; - } - elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) - { - $emphasis = 'em'; - } - else - { - return; - } - - return array( - 'extent' => strlen($matches[0]), - 'element' => array( - 'name' => $emphasis, - 'handler' => 'line', - 'text' => $matches[1], - ), - ); - } - - # - # ~ - - protected function readPlainText($text) - { - $breakMarker = $this->breaksEnabled ? "\n" : " \n"; - - $text = str_replace($breakMarker, "') - { - $markup = $trimmedMarkup; - $markup = substr($markup, 3); - - $position = strpos($markup, "
"); - - $markup = substr_replace($markup, '', $position, 4); - } - - return $markup; - } - - # - # Multiton - # - - static function instance($name = 'default') - { - if (isset(self::$instances[$name])) - { - return self::$instances[$name]; - } - - $instance = new self(); - - self::$instances[$name] = $instance; - - return $instance; - } - - private static $instances = array(); - - # - # Deprecated Methods - # - - /** - * @deprecated in favor of "text" - */ - function parse($text) - { - $markup = $this->text($text); - - return $markup; - } - - # - # Fields - # - - protected $Definitions; - - # - # Read-only - - protected $specialCharacters = array( - '\\', '`', '*', '_', '{', '}', '[', ']', '(', ')', '>', '#', '+', '-', '.', '!', - ); - - protected $StrongRegex = array( - '*' => '/^[*]{2}((?:[^*]|[*][^*]*[*])+?)[*]{2}(?![*])/s', - '_' => '/^__((?:[^_]|_[^_]*_)+?)__(?!_)/us', - ); - - protected $EmRegex = array( - '*' => '/^[*]((?:[^*]|[*][*][^*]+?[*][*])+?)[*](?![*])/s', - '_' => '/^_((?:[^_]|__[^_]*__)+?)_(?!_)\b/us', - ); - - protected $textLevelElements = array( - 'a', 'br', 'bdo', 'abbr', 'blink', 'nextid', 'acronym', 'basefont', - 'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing', - 'i', 'rp', 'del', 'code', 'strike', 'marquee', - 'q', 'rt', 'ins', 'font', 'strong', - 's', 'tt', 'sub', 'mark', - 'u', 'xm', 'sup', 'nobr', - 'var', 'ruby', - 'wbr', 'span', - 'time', - ); -} diff --git a/vendor/erusev/parsedown/README.md b/vendor/erusev/parsedown/README.md deleted file mode 100644 index a67b3ec9e..000000000 --- a/vendor/erusev/parsedown/README.md +++ /dev/null @@ -1,40 +0,0 @@ -## Parsedown - -Better [Markdown](http://en.wikipedia.org/wiki/Markdown) parser for PHP. - -* [Demo](http://parsedown.org/demo) -* [Test Suite](http://parsedown.org/tests/) - -### Features - -* [Fast](http://parsedown.org/speed) -* [Consistent](http://parsedown.org/consistency) -* [GitHub Flavored](https://help.github.com/articles/github-flavored-markdown) -* [Tested](https://travis-ci.org/erusev/parsedown) in PHP 5.2, 5.3, 5.4, 5.5, 5.6 and [hhvm](http://www.hhvm.com/) -* Extensible -* [Markdown Extra extension](https://github.com/erusev/parsedown-extra) new - -### Installation - -Include `Parsedown.php` or install [the composer package](https://packagist.org/packages/erusev/parsedown). - -### Example - -``` php -$Parsedown = new Parsedown(); - -echo $Parsedown->text('Hello _Parsedown_!'); # prints:Hello Parsedown!
-``` - -More examples in [the wiki](https://github.com/erusev/parsedown/wiki/Usage). - -### Questions - -**How does Parsedown work?**HTTP digest authentication can be used with the URI router. - * HTTP digest is much more recommended over the use of HTTP Basic auth which doesn't provide any encryption. - * If you are running PHP on Apache in CGI/FastCGI mode, you would need to - * add the following line to your .htaccess for digest auth to work correctly.
- *RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
- *
- * This class is tested under Apache 2.2 and Cherokee web server. It should work in both mod_php and cgi mode.
- * - * @author Leng Sheng HongHTTP Digest Authentication doesn't work with PHP in CGI mode,
- * you have to add this into your .htaccess RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
- * HTTP_ConditionalGet::check($updateTime, true); // exits if client has cache
- * echo $content;
- *
- *
- * E.g. Content from DB with no update time:
- *
- * $content = getContentFromDB();
- * $cg = new HTTP_ConditionalGet(array(
- * 'contentHash' => md5($content)
- * ));
- * $cg->sendHeaders();
- * if ($cg->cacheIsValid) {
- * exit();
- * }
- * echo $content;
- *
- *
- * E.g. Static content with some static includes:
- *
- * // before content
- * $cg = new HTTP_ConditionalGet(array(
- * 'lastUpdateTime' => max(
- * filemtime(__FILE__)
- * ,filemtime('/path/to/header.inc')
- * ,filemtime('/path/to/footer.inc')
- * )
- * ));
- * $cg->sendHeaders();
- * if ($cg->cacheIsValid) {
- * exit();
- * }
- *
- * @package Minify
- * @subpackage HTTP
- * @author Stephen Clay
- * array(
- * 'Cache-Control' => 'max-age=0, public'
- * ,'ETag' => '"foobar"'
- * )
- *
- *
- * @return array
- */
- public function getHeaders()
- {
- return $this->_headers;
- }
-
- /**
- * Set the Content-Length header in bytes
- *
- * With most PHP configs, as long as you don't flush() output, this method
- * is not needed and PHP will buffer all output and set Content-Length for
- * you. Otherwise you'll want to call this to let the client know up front.
- *
- * @param int $bytes
- *
- * @return int copy of input $bytes
- */
- public function setContentLength($bytes)
- {
- return $this->_headers['Content-Length'] = $bytes;
- }
-
- /**
- * Send headers
- *
- * @see getHeaders()
- *
- * Note this doesn't "clear" the headers. Calling sendHeaders() will
- * call header() again (but probably have not effect) and getHeaders() will
- * still return the headers.
- *
- * @return null
- */
- public function sendHeaders()
- {
- $headers = $this->_headers;
- if (array_key_exists('_responseCode', $headers)) {
- // FastCGI environments require 3rd arg to header() to be set
- list(, $code) = explode(' ', $headers['_responseCode'], 3);
- header($headers['_responseCode'], true, $code);
- unset($headers['_responseCode']);
- }
- foreach ($headers as $name => $val) {
- header($name . ': ' . $val);
- }
- }
-
- /**
- * Exit if the client's cache is valid for this resource
- *
- * This is a convenience method for common use of the class
- *
- * @param int $lastModifiedTime if given, both ETag AND Last-Modified headers
- * will be sent with content. This is recommended.
- *
- * @param bool $isPublic (default false) if true, the Cache-Control header
- * will contain "public", allowing proxies to cache the content. Otherwise
- * "private" will be sent, allowing only browser caching.
- *
- * @param array $options (default empty) additional options for constructor
- */
- public static function check($lastModifiedTime = null, $isPublic = false, $options = array())
- {
- if (null !== $lastModifiedTime) {
- $options['lastModifiedTime'] = (int)$lastModifiedTime;
- }
- $options['isPublic'] = (bool)$isPublic;
- $cg = new HTTP_ConditionalGet($options);
- $cg->sendHeaders();
- if ($cg->cacheIsValid) {
- exit();
- }
- }
-
-
- /**
- * Get a GMT formatted date for use in HTTP headers
- *
- *
- * header('Expires: ' . HTTP_ConditionalGet::gmtdate($time));
- *
- *
- * @param int $time unix timestamp
- *
- * @return string
- */
- public static function gmtDate($time)
- {
- return gmdate('D, d M Y H:i:s \G\M\T', $time);
- }
-
- protected $_headers = array();
- protected $_lmTime = null;
- protected $_etag = null;
- protected $_stripEtag = false;
-
- /**
- * @param string $hash
- *
- * @param string $scope
- */
- protected function _setEtag($hash, $scope)
- {
- $this->_etag = '"' . substr($scope, 0, 3) . $hash . '"';
- $this->_headers['ETag'] = $this->_etag;
- }
-
- /**
- * @param int $time
- */
- protected function _setLastModified($time)
- {
- $this->_lmTime = (int)$time;
- $this->_headers['Last-Modified'] = self::gmtDate($time);
- }
-
- /**
- * Determine validity of client cache and queue 304 header if valid
- *
- * @return bool
- */
- protected function _isCacheValid()
- {
- if (null === $this->_etag) {
- // lmTime is copied to ETag, so this condition implies that the
- // server sent neither ETag nor Last-Modified, so the client can't
- // possibly has a valid cache.
- return false;
- }
- $isValid = ($this->resourceMatchedEtag() || $this->resourceNotModified());
- if ($isValid) {
- $this->_headers['_responseCode'] = 'HTTP/1.0 304 Not Modified';
- }
- return $isValid;
- }
-
- /**
- * @return bool
- */
- protected function resourceMatchedEtag()
- {
- if (!isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
- return false;
- }
- $clientEtagList = get_magic_quotes_gpc()
- ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])
- : $_SERVER['HTTP_IF_NONE_MATCH'];
- $clientEtags = explode(',', $clientEtagList);
-
- $compareTo = $this->normalizeEtag($this->_etag);
- foreach ($clientEtags as $clientEtag) {
- if ($this->normalizeEtag($clientEtag) === $compareTo) {
- // respond with the client's matched ETag, even if it's not what
- // we would've sent by default
- $this->_headers['ETag'] = trim($clientEtag);
- return true;
- }
- }
- return false;
- }
-
- /**
- * @param string $etag
- *
- * @return string
- */
- protected function normalizeEtag($etag) {
- $etag = trim($etag);
- return $this->_stripEtag
- ? preg_replace('/;\\w\\w"$/', '"', $etag)
- : $etag;
- }
-
- /**
- * @return bool
- */
- protected function resourceNotModified()
- {
- if (!isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
- return false;
- }
- // strip off IE's extra data (semicolon)
- list($ifModifiedSince) = explode(';', $_SERVER['HTTP_IF_MODIFIED_SINCE'], 2);
- if (strtotime($ifModifiedSince) >= $this->_lmTime) {
- // Apache 2.2's behavior. If there was no ETag match, send the
- // non-encoded version of the ETag value.
- $this->_headers['ETag'] = $this->normalizeEtag($this->_etag);
- return true;
- }
- return false;
- }
-}
diff --git a/vendor/mrclay/minify/min/lib/HTTP/Encoder.php b/vendor/mrclay/minify/min/lib/HTTP/Encoder.php
deleted file mode 100644
index 8f347793c..000000000
--- a/vendor/mrclay/minify/min/lib/HTTP/Encoder.php
+++ /dev/null
@@ -1,335 +0,0 @@
-
- * // Send a CSS file, compressed if possible
- * $he = new HTTP_Encoder(array(
- * 'content' => file_get_contents($cssFile)
- * ,'type' => 'text/css'
- * ));
- * $he->encode();
- * $he->sendAll();
- *
- *
- *
- * // Shortcut to encoding output
- * header('Content-Type: text/css'); // needed if not HTML
- * HTTP_Encoder::output($css);
- *
- *
- *
- * // Just sniff for the accepted encoding
- * $encoding = HTTP_Encoder::getAcceptedEncoding();
- *
- *
- * For more control over headers, use getHeaders() and getData() and send your
- * own output.
- *
- * Note: If you don't need header mgmt, use PHP's native gzencode, gzdeflate,
- * and gzcompress functions for gzip, deflate, and compress-encoding
- * respectively.
- *
- * @package Minify
- * @subpackage HTTP
- * @author Stephen Clay
- * array(
- * 'Content-Length' => '615'
- * ,'Content-Encoding' => 'x-gzip'
- * ,'Vary' => 'Accept-Encoding'
- * )
- *
- *
- * @return array
- */
- public function getHeaders()
- {
- return $this->_headers;
- }
-
- /**
- * Send output headers
- *
- * You must call this before headers are sent and it probably cannot be
- * used in conjunction with zlib output buffering / mod_gzip. Errors are
- * not handled purposefully.
- *
- * @see getHeaders()
- */
- public function sendHeaders()
- {
- foreach ($this->_headers as $name => $val) {
- header($name . ': ' . $val);
- }
- }
-
- /**
- * Send output headers and content
- *
- * A shortcut for sendHeaders() and echo getContent()
- *
- * You must call this before headers are sent and it probably cannot be
- * used in conjunction with zlib output buffering / mod_gzip. Errors are
- * not handled purposefully.
- */
- public function sendAll()
- {
- $this->sendHeaders();
- echo $this->_content;
- }
-
- /**
- * Determine the client's best encoding method from the HTTP Accept-Encoding
- * header.
- *
- * If no Accept-Encoding header is set, or the browser is IE before v6 SP2,
- * this will return ('', ''), the "identity" encoding.
- *
- * A syntax-aware scan is done of the Accept-Encoding, so the method must
- * be non 0. The methods are favored in order of gzip, deflate, then
- * compress. Deflate is always smallest and generally faster, but is
- * rarely sent by servers, so client support could be buggier.
- *
- * @param bool $allowCompress allow the older compress encoding
- *
- * @param bool $allowDeflate allow the more recent deflate encoding
- *
- * @return array two values, 1st is the actual encoding method, 2nd is the
- * alias of that method to use in the Content-Encoding header (some browsers
- * call gzip "x-gzip" etc.)
- */
- public static function getAcceptedEncoding($allowCompress = true, $allowDeflate = true)
- {
- // @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
-
- if (! isset($_SERVER['HTTP_ACCEPT_ENCODING'])
- || self::isBuggyIe())
- {
- return array('', '');
- }
- $ae = $_SERVER['HTTP_ACCEPT_ENCODING'];
- // gzip checks (quick)
- if (0 === strpos($ae, 'gzip,') // most browsers
- || 0 === strpos($ae, 'deflate, gzip,') // opera
- ) {
- return array('gzip', 'gzip');
- }
- // gzip checks (slow)
- if (preg_match(
- '@(?:^|,)\\s*((?:x-)?gzip)\\s*(?:$|,|;\\s*q=(?:0\\.|1))@'
- ,$ae
- ,$m)) {
- return array('gzip', $m[1]);
- }
- if ($allowDeflate) {
- // deflate checks
- $aeRev = strrev($ae);
- if (0 === strpos($aeRev, 'etalfed ,') // ie, webkit
- || 0 === strpos($aeRev, 'etalfed,') // gecko
- || 0 === strpos($ae, 'deflate,') // opera
- // slow parsing
- || preg_match(
- '@(?:^|,)\\s*deflate\\s*(?:$|,|;\\s*q=(?:0\\.|1))@', $ae)) {
- return array('deflate', 'deflate');
- }
- }
- if ($allowCompress && preg_match(
- '@(?:^|,)\\s*((?:x-)?compress)\\s*(?:$|,|;\\s*q=(?:0\\.|1))@'
- ,$ae
- ,$m)) {
- return array('compress', $m[1]);
- }
- return array('', '');
- }
-
- /**
- * Encode (compress) the content
- *
- * If the encode method is '' (none) or compression level is 0, or the 'zlib'
- * extension isn't loaded, we return false.
- *
- * Then the appropriate gz_* function is called to compress the content. If
- * this fails, false is returned.
- *
- * The header "Vary: Accept-Encoding" is added. If encoding is successful,
- * the Content-Length header is updated, and Content-Encoding is also added.
- *
- * @param int $compressionLevel given to zlib functions. If not given, the
- * class default will be used.
- *
- * @return bool success true if the content was actually compressed
- */
- public function encode($compressionLevel = null)
- {
- if (! self::isBuggyIe()) {
- $this->_headers['Vary'] = 'Accept-Encoding';
- }
- if (null === $compressionLevel) {
- $compressionLevel = self::$compressionLevel;
- }
- if ('' === $this->_encodeMethod[0]
- || ($compressionLevel == 0)
- || !extension_loaded('zlib'))
- {
- return false;
- }
- if ($this->_encodeMethod[0] === 'deflate') {
- $encoded = gzdeflate($this->_content, $compressionLevel);
- } elseif ($this->_encodeMethod[0] === 'gzip') {
- $encoded = gzencode($this->_content, $compressionLevel);
- } else {
- $encoded = gzcompress($this->_content, $compressionLevel);
- }
- if (false === $encoded) {
- return false;
- }
- $this->_headers['Content-Length'] = $this->_useMbStrlen
- ? (string)mb_strlen($encoded, '8bit')
- : (string)strlen($encoded);
- $this->_headers['Content-Encoding'] = $this->_encodeMethod[1];
- $this->_content = $encoded;
- return true;
- }
-
- /**
- * Encode and send appropriate headers and content
- *
- * This is a convenience method for common use of the class
- *
- * @param string $content
- *
- * @param int $compressionLevel given to zlib functions. If not given, the
- * class default will be used.
- *
- * @return bool success true if the content was actually compressed
- */
- public static function output($content, $compressionLevel = null)
- {
- if (null === $compressionLevel) {
- $compressionLevel = self::$compressionLevel;
- }
- $he = new HTTP_Encoder(array('content' => $content));
- $ret = $he->encode($compressionLevel);
- $he->sendAll();
- return $ret;
- }
-
- /**
- * Is the browser an IE version earlier than 6 SP2?
- *
- * @return bool
- */
- public static function isBuggyIe()
- {
- if (empty($_SERVER['HTTP_USER_AGENT'])) {
- return false;
- }
- $ua = $_SERVER['HTTP_USER_AGENT'];
- // quick escape for non-IEs
- if (0 !== strpos($ua, 'Mozilla/4.0 (compatible; MSIE ')
- || false !== strpos($ua, 'Opera')) {
- return false;
- }
- // no regex = faaast
- $version = (float)substr($ua, 30);
- return self::$encodeToIe6
- ? ($version < 6 || ($version == 6 && false === strpos($ua, 'SV1')))
- : ($version < 7);
- }
-
- protected $_content = '';
- protected $_headers = array();
- protected $_encodeMethod = array('', '');
- protected $_useMbStrlen = false;
-}
diff --git a/vendor/mrclay/minify/min/lib/JSMin.php b/vendor/mrclay/minify/min/lib/JSMin.php
deleted file mode 100644
index 9840d8b33..000000000
--- a/vendor/mrclay/minify/min/lib/JSMin.php
+++ /dev/null
@@ -1,449 +0,0 @@
-
- * $minifiedJs = JSMin::minify($js);
- *
- *
- * This is a modified port of jsmin.c. Improvements:
- *
- * Does not choke on some regexp literals containing quote characters. E.g. /'/
- *
- * Spaces are preserved after some add/sub operators, so they are not mistakenly
- * converted to post-inc/dec. E.g. a + ++b -> a+ ++b
- *
- * Preserves multi-line comments that begin with /*!
- *
- * PHP 5 or higher is required.
- *
- * Permission is hereby granted to use this version of the library under the
- * same terms as jsmin.c, which has the following license:
- *
- * --
- * Copyright (c) 2002 Douglas Crockford (www.crockford.com)
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is furnished to do
- * so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * The Software shall be used for Good, not Evil.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- * --
- *
- * @package JSMin
- * @author Ryan Grove
- * echo $b->uri('/site.js');
- * // outputs "/site.js?1678242"
- *
- * echo $b->uri('/scriptaculous.js?load=effects');
- * // outputs "/scriptaculous.js?load=effects&1678242"
- *
- *
- * @param string $uri
- * @param boolean $forceAmpersand (default = false) Force the use of ampersand to
- * append the timestamp to the URI.
- * @return string
- */
- public function uri($uri, $forceAmpersand = false) {
- $sep = ($forceAmpersand || strpos($uri, '?') !== false)
- ? self::$ampersand
- : '?';
- return "{$uri}{$sep}{$this->lastModified}";
- }
-
- /**
- * Create a build object
- *
- * @param array $sources array of Minify_Source objects and/or file paths
- *
- * @return null
- */
- public function __construct($sources)
- {
- $max = 0;
- foreach ((array)$sources as $source) {
- if ($source instanceof Minify_Source) {
- $max = max($max, $source->lastModified);
- } elseif (is_string($source)) {
- if (0 === strpos($source, '//')) {
- $source = $_SERVER['DOCUMENT_ROOT'] . substr($source, 1);
- }
- if (is_file($source)) {
- $max = max($max, filemtime($source));
- }
- }
- }
- $this->lastModified = $max;
- }
-}
diff --git a/vendor/mrclay/minify/min/lib/Minify/CSS.php b/vendor/mrclay/minify/min/lib/Minify/CSS.php
deleted file mode 100644
index 32414551d..000000000
--- a/vendor/mrclay/minify/min/lib/Minify/CSS.php
+++ /dev/null
@@ -1,99 +0,0 @@
-
- * @author http://code.google.com/u/1stvamp/ (Issue 64 patch)
- */
-class Minify_CSS {
-
- /**
- * Minify a CSS string
- *
- * @param string $css
- *
- * @param array $options available options:
- *
- * 'preserveComments': (default true) multi-line comments that begin
- * with "/*!" will be preserved with newlines before and after to
- * enhance readability.
- *
- * 'removeCharsets': (default true) remove all @charset at-rules
- *
- * 'prependRelativePath': (default null) if given, this string will be
- * prepended to all relative URIs in import/url declarations
- *
- * 'currentDir': (default null) if given, this is assumed to be the
- * directory of the current CSS file. Using this, minify will rewrite
- * all relative URIs in import/url declarations to correctly point to
- * the desired files. For this to work, the files *must* exist and be
- * visible by the PHP process.
- *
- * 'symlinks': (default = array()) If the CSS file is stored in
- * a symlink-ed directory, provide an array of link paths to
- * target paths, where the link paths are within the document root. Because
- * paths need to be normalized for this to work, use "//" to substitute
- * the doc root in the link paths (the array keys). E.g.:
- *
- * array('//symlink' => '/real/target/path') // unix
- * array('//static' => 'D:\\staticStorage') // Windows
- *
- *
- * 'docRoot': (default = $_SERVER['DOCUMENT_ROOT'])
- * see Minify_CSS_UriRewriter::rewrite
- *
- * @return string
- */
- public static function minify($css, $options = array())
- {
- $options = array_merge(array(
- 'compress' => true,
- 'removeCharsets' => true,
- 'preserveComments' => true,
- 'currentDir' => null,
- 'docRoot' => $_SERVER['DOCUMENT_ROOT'],
- 'prependRelativePath' => null,
- 'symlinks' => array(),
- ), $options);
-
- if ($options['removeCharsets']) {
- $css = preg_replace('/@charset[^;]+;\\s*/', '', $css);
- }
- if ($options['compress']) {
- if (! $options['preserveComments']) {
- $css = Minify_CSS_Compressor::process($css, $options);
- } else {
- $css = Minify_CommentPreserver::process(
- $css
- ,array('Minify_CSS_Compressor', 'process')
- ,array($options)
- );
- }
- }
- if (! $options['currentDir'] && ! $options['prependRelativePath']) {
- return $css;
- }
- if ($options['currentDir']) {
- return Minify_CSS_UriRewriter::rewrite(
- $css
- ,$options['currentDir']
- ,$options['docRoot']
- ,$options['symlinks']
- );
- } else {
- return Minify_CSS_UriRewriter::prepend(
- $css
- ,$options['prependRelativePath']
- );
- }
- }
-}
diff --git a/vendor/mrclay/minify/min/lib/Minify/CSS/Compressor.php b/vendor/mrclay/minify/min/lib/Minify/CSS/Compressor.php
deleted file mode 100644
index c6cdd8b7a..000000000
--- a/vendor/mrclay/minify/min/lib/Minify/CSS/Compressor.php
+++ /dev/null
@@ -1,249 +0,0 @@
-
- * @author http://code.google.com/u/1stvamp/ (Issue 64 patch)
- */
-class Minify_CSS_Compressor {
-
- /**
- * Minify a CSS string
- *
- * @param string $css
- *
- * @param array $options (currently ignored)
- *
- * @return string
- */
- public static function process($css, $options = array())
- {
- $obj = new Minify_CSS_Compressor($options);
- return $obj->_process($css);
- }
-
- /**
- * @var array
- */
- protected $_options = null;
-
- /**
- * Are we "in" a hack? I.e. are some browsers targetted until the next comment?
- *
- * @var bool
- */
- protected $_inHack = false;
-
-
- /**
- * Constructor
- *
- * @param array $options (currently ignored)
- */
- private function __construct($options) {
- $this->_options = $options;
- }
-
- /**
- * Minify a CSS string
- *
- * @param string $css
- *
- * @return string
- */
- protected function _process($css)
- {
- $css = str_replace("\r\n", "\n", $css);
-
- // preserve empty comment after '>'
- // http://www.webdevout.net/css-hacks#in_css-selectors
- $css = preg_replace('@>/\\*\\s*\\*/@', '>/*keep*/', $css);
-
- // preserve empty comment between property and value
- // http://css-discuss.incutio.com/?page=BoxModelHack
- $css = preg_replace('@/\\*\\s*\\*/\\s*:@', '/*keep*/:', $css);
- $css = preg_replace('@:\\s*/\\*\\s*\\*/@', ':/*keep*/', $css);
-
- // apply callback to all valid comments (and strip out surrounding ws
- $css = preg_replace_callback('@\\s*/\\*([\\s\\S]*?)\\*/\\s*@'
- ,array($this, '_commentCB'), $css);
-
- // remove ws around { } and last semicolon in declaration block
- $css = preg_replace('/\\s*{\\s*/', '{', $css);
- $css = preg_replace('/;?\\s*}\\s*/', '}', $css);
-
- // remove ws surrounding semicolons
- $css = preg_replace('/\\s*;\\s*/', ';', $css);
-
- // remove ws around urls
- $css = preg_replace('/
- url\\( # url(
- \\s*
- ([^\\)]+?) # 1 = the URL (really just a bunch of non right parenthesis)
- \\s*
- \\) # )
- /x', 'url($1)', $css);
-
- // remove ws between rules and colons
- $css = preg_replace('/
- \\s*
- ([{;]) # 1 = beginning of block or rule separator
- \\s*
- ([\\*_]?[\\w\\-]+) # 2 = property (and maybe IE filter)
- \\s*
- :
- \\s*
- (\\b|[#\'"-]) # 3 = first character of a value
- /x', '$1$2:$3', $css);
-
- // remove ws in selectors
- $css = preg_replace_callback('/
- (?: # non-capture
- \\s*
- [^~>+,\\s]+ # selector part
- \\s*
- [,>+~] # combinators
- )+
- \\s*
- [^~>+,\\s]+ # selector part
- { # open declaration block
- /x'
- ,array($this, '_selectorsCB'), $css);
-
- // minimize hex colors
- $css = preg_replace('/([^=])#([a-f\\d])\\2([a-f\\d])\\3([a-f\\d])\\4([\\s;\\}])/i'
- , '$1#$2$3$4$5', $css);
-
- // remove spaces between font families
- $css = preg_replace_callback('/font-family:([^;}]+)([;}])/'
- ,array($this, '_fontFamilyCB'), $css);
-
- $css = preg_replace('/@import\\s+url/', '@import url', $css);
-
- // replace any ws involving newlines with a single newline
- $css = preg_replace('/[ \\t]*\\n+\\s*/', "\n", $css);
-
- // separate common descendent selectors w/ newlines (to limit line lengths)
- $css = preg_replace('/([\\w#\\.\\*]+)\\s+([\\w#\\.\\*]+){/', "$1\n$2{", $css);
-
- // Use newline after 1st numeric value (to limit line lengths).
- $css = preg_replace('/
- ((?:padding|margin|border|outline):\\d+(?:px|em)?) # 1 = prop : 1st numeric value
- \\s+
- /x'
- ,"$1\n", $css);
-
- // prevent triggering IE6 bug: http://www.crankygeek.com/ie6pebug/
- $css = preg_replace('/:first-l(etter|ine)\\{/', ':first-l$1 {', $css);
-
- return trim($css);
- }
-
- /**
- * Replace what looks like a set of selectors
- *
- * @param array $m regex matches
- *
- * @return string
- */
- protected function _selectorsCB($m)
- {
- // remove ws around the combinators
- return preg_replace('/\\s*([,>+~])\\s*/', '$1', $m[0]);
- }
-
- /**
- * Process a comment and return a replacement
- *
- * @param array $m regex matches
- *
- * @return string
- */
- protected function _commentCB($m)
- {
- $hasSurroundingWs = (trim($m[0]) !== $m[1]);
- $m = $m[1];
- // $m is the comment content w/o the surrounding tokens,
- // but the return value will replace the entire comment.
- if ($m === 'keep') {
- return '/**/';
- }
- if ($m === '" "') {
- // component of http://tantek.com/CSS/Examples/midpass.html
- return '/*" "*/';
- }
- if (preg_match('@";\\}\\s*\\}/\\*\\s+@', $m)) {
- // component of http://tantek.com/CSS/Examples/midpass.html
- return '/*";}}/* */';
- }
- if ($this->_inHack) {
- // inversion: feeding only to one browser
- if (preg_match('@
- ^/ # comment started like /*/
- \\s*
- (\\S[\\s\\S]+?) # has at least some non-ws content
- \\s*
- /\\* # ends like /*/ or /**/
- @x', $m, $n)) {
- // end hack mode after this comment, but preserve the hack and comment content
- $this->_inHack = false;
- return "/*/{$n[1]}/**/";
- }
- }
- if (substr($m, -1) === '\\') { // comment ends like \*/
- // begin hack mode and preserve hack
- $this->_inHack = true;
- return '/*\\*/';
- }
- if ($m !== '' && $m[0] === '/') { // comment looks like /*/ foo */
- // begin hack mode and preserve hack
- $this->_inHack = true;
- return '/*/*/';
- }
- if ($this->_inHack) {
- // a regular comment ends hack mode but should be preserved
- $this->_inHack = false;
- return '/**/';
- }
- // Issue 107: if there's any surrounding whitespace, it may be important, so
- // replace the comment with a single space
- return $hasSurroundingWs // remove all other comments
- ? ' '
- : '';
- }
-
- /**
- * Process a font-family listing and return a replacement
- *
- * @param array $m regex matches
- *
- * @return string
- */
- protected function _fontFamilyCB($m)
- {
- // Issue 210: must not eliminate WS between words in unquoted families
- $pieces = preg_split('/(\'[^\']+\'|"[^"]+")/', $m[1], null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
- $out = 'font-family:';
- while (null !== ($piece = array_shift($pieces))) {
- if ($piece[0] !== '"' && $piece[0] !== "'") {
- $piece = preg_replace('/\\s+/', ' ', $piece);
- $piece = preg_replace('/\\s?,\\s?/', ',', $piece);
- }
- $out .= $piece;
- }
- return $out . $m[2];
- }
-}
diff --git a/vendor/mrclay/minify/min/lib/Minify/CSS/UriRewriter.php b/vendor/mrclay/minify/min/lib/Minify/CSS/UriRewriter.php
deleted file mode 100644
index 43cc2548b..000000000
--- a/vendor/mrclay/minify/min/lib/Minify/CSS/UriRewriter.php
+++ /dev/null
@@ -1,307 +0,0 @@
-
- */
-class Minify_CSS_UriRewriter {
-
- /**
- * rewrite() and rewriteRelative() append debugging information here
- *
- * @var string
- */
- public static $debugText = '';
-
- /**
- * In CSS content, rewrite file relative URIs as root relative
- *
- * @param string $css
- *
- * @param string $currentDir The directory of the current CSS file.
- *
- * @param string $docRoot The document root of the web site in which
- * the CSS file resides (default = $_SERVER['DOCUMENT_ROOT']).
- *
- * @param array $symlinks (default = array()) If the CSS file is stored in
- * a symlink-ed directory, provide an array of link paths to
- * target paths, where the link paths are within the document root. Because
- * paths need to be normalized for this to work, use "//" to substitute
- * the doc root in the link paths (the array keys). E.g.:
- *
- * array('//symlink' => '/real/target/path') // unix
- * array('//static' => 'D:\\staticStorage') // Windows
- *
- *
- * @return string
- */
- public static function rewrite($css, $currentDir, $docRoot = null, $symlinks = array())
- {
- self::$_docRoot = self::_realpath(
- $docRoot ? $docRoot : $_SERVER['DOCUMENT_ROOT']
- );
- self::$_currentDir = self::_realpath($currentDir);
- self::$_symlinks = array();
-
- // normalize symlinks
- foreach ($symlinks as $link => $target) {
- $link = ($link === '//')
- ? self::$_docRoot
- : str_replace('//', self::$_docRoot . '/', $link);
- $link = strtr($link, '/', DIRECTORY_SEPARATOR);
- self::$_symlinks[$link] = self::_realpath($target);
- }
-
- self::$debugText .= "docRoot : " . self::$_docRoot . "\n"
- . "currentDir : " . self::$_currentDir . "\n";
- if (self::$_symlinks) {
- self::$debugText .= "symlinks : " . var_export(self::$_symlinks, 1) . "\n";
- }
- self::$debugText .= "\n";
-
- $css = self::_trimUrls($css);
-
- // rewrite
- $css = preg_replace_callback('/@import\\s+([\'"])(.*?)[\'"]/'
- ,array(self::$className, '_processUriCB'), $css);
- $css = preg_replace_callback('/url\\(\\s*([\'"](.*?)[\'"]|[^\\)\\s]+)\\s*\\)/'
- ,array(self::$className, '_processUriCB'), $css);
-
- return $css;
- }
-
- /**
- * In CSS content, prepend a path to relative URIs
- *
- * @param string $css
- *
- * @param string $path The path to prepend.
- *
- * @return string
- */
- public static function prepend($css, $path)
- {
- self::$_prependPath = $path;
-
- $css = self::_trimUrls($css);
-
- // append
- $css = preg_replace_callback('/@import\\s+([\'"])(.*?)[\'"]/'
- ,array(self::$className, '_processUriCB'), $css);
- $css = preg_replace_callback('/url\\(\\s*([\'"](.*?)[\'"]|[^\\)\\s]+)\\s*\\)/'
- ,array(self::$className, '_processUriCB'), $css);
-
- self::$_prependPath = null;
- return $css;
- }
-
- /**
- * Get a root relative URI from a file relative URI
- *
- *
- * Minify_CSS_UriRewriter::rewriteRelative(
- * '../img/hello.gif'
- * , '/home/user/www/css' // path of CSS file
- * , '/home/user/www' // doc root
- * );
- * // returns '/img/hello.gif'
- *
- * // example where static files are stored in a symlinked directory
- * Minify_CSS_UriRewriter::rewriteRelative(
- * 'hello.gif'
- * , '/var/staticFiles/theme'
- * , '/home/user/www'
- * , array('/home/user/www/static' => '/var/staticFiles')
- * );
- * // returns '/static/theme/hello.gif'
- *
- *
- * @param string $uri file relative URI
- *
- * @param string $realCurrentDir realpath of the current file's directory.
- *
- * @param string $realDocRoot realpath of the site document root.
- *
- * @param array $symlinks (default = array()) If the file is stored in
- * a symlink-ed directory, provide an array of link paths to
- * real target paths, where the link paths "appear" to be within the document
- * root. E.g.:
- *
- * array('/home/foo/www/not/real/path' => '/real/target/path') // unix
- * array('C:\\htdocs\\not\\real' => 'D:\\real\\target\\path') // Windows
- *
- *
- * @return string
- */
- public static function rewriteRelative($uri, $realCurrentDir, $realDocRoot, $symlinks = array())
- {
- // prepend path with current dir separator (OS-independent)
- $path = strtr($realCurrentDir, '/', DIRECTORY_SEPARATOR)
- . DIRECTORY_SEPARATOR . strtr($uri, '/', DIRECTORY_SEPARATOR);
-
- self::$debugText .= "file-relative URI : {$uri}\n"
- . "path prepended : {$path}\n";
-
- // "unresolve" a symlink back to doc root
- foreach ($symlinks as $link => $target) {
- if (0 === strpos($path, $target)) {
- // replace $target with $link
- $path = $link . substr($path, strlen($target));
-
- self::$debugText .= "symlink unresolved : {$path}\n";
-
- break;
- }
- }
- // strip doc root
- $path = substr($path, strlen($realDocRoot));
-
- self::$debugText .= "docroot stripped : {$path}\n";
-
- // fix to root-relative URI
- $uri = strtr($path, '/\\', '//');
- $uri = self::removeDots($uri);
-
- self::$debugText .= "traversals removed : {$uri}\n\n";
-
- return $uri;
- }
-
- /**
- * Remove instances of "./" and "../" where possible from a root-relative URI
- *
- * @param string $uri
- *
- * @return string
- */
- public static function removeDots($uri)
- {
- $uri = str_replace('/./', '/', $uri);
- // inspired by patch from Oleg Cherniy
- do {
- $uri = preg_replace('@/[^/]+/\\.\\./@', '/', $uri, 1, $changed);
- } while ($changed);
- return $uri;
- }
-
- /**
- * Defines which class to call as part of callbacks, change this
- * if you extend Minify_CSS_UriRewriter
- *
- * @var string
- */
- protected static $className = 'Minify_CSS_UriRewriter';
-
- /**
- * Get realpath with any trailing slash removed. If realpath() fails,
- * just remove the trailing slash.
- *
- * @param string $path
- *
- * @return mixed path with no trailing slash
- */
- protected static function _realpath($path)
- {
- $realPath = realpath($path);
- if ($realPath !== false) {
- $path = $realPath;
- }
- return rtrim($path, '/\\');
- }
-
- /**
- * Directory of this stylesheet
- *
- * @var string
- */
- private static $_currentDir = '';
-
- /**
- * DOC_ROOT
- *
- * @var string
- */
- private static $_docRoot = '';
-
- /**
- * directory replacements to map symlink targets back to their
- * source (within the document root) E.g. '/var/www/symlink' => '/var/realpath'
- *
- * @var array
- */
- private static $_symlinks = array();
-
- /**
- * Path to prepend
- *
- * @var string
- */
- private static $_prependPath = null;
-
- /**
- * @param string $css
- *
- * @return string
- */
- private static function _trimUrls($css)
- {
- return preg_replace('/
- url\\( # url(
- \\s*
- ([^\\)]+?) # 1 = URI (assuming does not contain ")")
- \\s*
- \\) # )
- /x', 'url($1)', $css);
- }
-
- /**
- * @param array $m
- *
- * @return string
- */
- private static function _processUriCB($m)
- {
- // $m matched either '/@import\\s+([\'"])(.*?)[\'"]/' or '/url\\(\\s*([^\\)\\s]+)\\s*\\)/'
- $isImport = ($m[0][0] === '@');
- // determine URI and the quote character (if any)
- if ($isImport) {
- $quoteChar = $m[1];
- $uri = $m[2];
- } else {
- // $m[1] is either quoted or not
- $quoteChar = ($m[1][0] === "'" || $m[1][0] === '"')
- ? $m[1][0]
- : '';
- $uri = ($quoteChar === '')
- ? $m[1]
- : substr($m[1], 1, strlen($m[1]) - 2);
- }
- // if not root/scheme relative and not starts with scheme
- if (!preg_match('~^(/|[a-z]+\:)~', $uri)) {
- // URI is file-relative: rewrite depending on options
- if (self::$_prependPath === null) {
- $uri = self::rewriteRelative($uri, self::$_currentDir, self::$_docRoot, self::$_symlinks);
- } else {
- $uri = self::$_prependPath . $uri;
- if ($uri[0] === '/') {
- $root = '';
- $rootRelative = $uri;
- $uri = $root . self::removeDots($rootRelative);
- } elseif (preg_match('@^((https?\:)?//([^/]+))/@', $uri, $m) && (false !== strpos($m[3], '.'))) {
- $root = $m[1];
- $rootRelative = substr($uri, strlen($root));
- $uri = $root . self::removeDots($rootRelative);
- }
- }
- }
- return $isImport
- ? "@import {$quoteChar}{$uri}{$quoteChar}"
- : "url({$quoteChar}{$uri}{$quoteChar})";
- }
-}
diff --git a/vendor/mrclay/minify/min/lib/Minify/CSSmin.php b/vendor/mrclay/minify/min/lib/Minify/CSSmin.php
deleted file mode 100644
index 440338387..000000000
--- a/vendor/mrclay/minify/min/lib/Minify/CSSmin.php
+++ /dev/null
@@ -1,85 +0,0 @@
-
- */
-class Minify_CSSmin {
-
- /**
- * Minify a CSS string
- *
- * @param string $css
- *
- * @param array $options available options:
- *
- * 'removeCharsets': (default true) remove all @charset at-rules
- *
- * 'prependRelativePath': (default null) if given, this string will be
- * prepended to all relative URIs in import/url declarations
- *
- * 'currentDir': (default null) if given, this is assumed to be the
- * directory of the current CSS file. Using this, minify will rewrite
- * all relative URIs in import/url declarations to correctly point to
- * the desired files. For this to work, the files *must* exist and be
- * visible by the PHP process.
- *
- * 'symlinks': (default = array()) If the CSS file is stored in
- * a symlink-ed directory, provide an array of link paths to
- * target paths, where the link paths are within the document root. Because
- * paths need to be normalized for this to work, use "//" to substitute
- * the doc root in the link paths (the array keys). E.g.:
- *
- * array('//symlink' => '/real/target/path') // unix
- * array('//static' => 'D:\\staticStorage') // Windows
- *
- *
- * 'docRoot': (default = $_SERVER['DOCUMENT_ROOT'])
- * see Minify_CSS_UriRewriter::rewrite
- *
- * @return string
- */
- public static function minify($css, $options = array())
- {
- $options = array_merge(array(
- 'compress' => true,
- 'removeCharsets' => true,
- 'currentDir' => null,
- 'docRoot' => $_SERVER['DOCUMENT_ROOT'],
- 'prependRelativePath' => null,
- 'symlinks' => array(),
- ), $options);
-
- if ($options['removeCharsets']) {
- $css = preg_replace('/@charset[^;]+;\\s*/', '', $css);
- }
- if ($options['compress']) {
- $obj = new CSSmin();
- $css = $obj->run($css);
- }
- if (! $options['currentDir'] && ! $options['prependRelativePath']) {
- return $css;
- }
- if ($options['currentDir']) {
- return Minify_CSS_UriRewriter::rewrite(
- $css
- ,$options['currentDir']
- ,$options['docRoot']
- ,$options['symlinks']
- );
- } else {
- return Minify_CSS_UriRewriter::prepend(
- $css
- ,$options['prependRelativePath']
- );
- }
- }
-}
diff --git a/vendor/mrclay/minify/min/lib/Minify/Cache/APC.php b/vendor/mrclay/minify/min/lib/Minify/Cache/APC.php
deleted file mode 100644
index 24ab04620..000000000
--- a/vendor/mrclay/minify/min/lib/Minify/Cache/APC.php
+++ /dev/null
@@ -1,133 +0,0 @@
-
- * Minify::setCache(new Minify_Cache_APC());
- *
- *
- * @package Minify
- * @author Chris Edwards
- **/
-class Minify_Cache_APC {
-
- /**
- * Create a Minify_Cache_APC object, to be passed to
- * Minify::setCache().
- *
- *
- * @param int $expire seconds until expiration (default = 0
- * meaning the item will not get an expiration date)
- *
- * @return null
- */
- public function __construct($expire = 0)
- {
- $this->_exp = $expire;
- }
-
- /**
- * Write data to cache.
- *
- * @param string $id cache id
- *
- * @param string $data
- *
- * @return bool success
- */
- public function store($id, $data)
- {
- return apc_store($id, "{$_SERVER['REQUEST_TIME']}|{$data}", $this->_exp);
- }
-
- /**
- * Get the size of a cache entry
- *
- * @param string $id cache id
- *
- * @return int size in bytes
- */
- public function getSize($id)
- {
- if (! $this->_fetch($id)) {
- return false;
- }
- return (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2))
- ? mb_strlen($this->_data, '8bit')
- : strlen($this->_data);
- }
-
- /**
- * Does a valid cache entry exist?
- *
- * @param string $id cache id
- *
- * @param int $srcMtime mtime of the original source file(s)
- *
- * @return bool exists
- */
- public function isValid($id, $srcMtime)
- {
- return ($this->_fetch($id) && ($this->_lm >= $srcMtime));
- }
-
- /**
- * Send the cached content to output
- *
- * @param string $id cache id
- */
- public function display($id)
- {
- echo $this->_fetch($id)
- ? $this->_data
- : '';
- }
-
- /**
- * Fetch the cached content
- *
- * @param string $id cache id
- *
- * @return string
- */
- public function fetch($id)
- {
- return $this->_fetch($id)
- ? $this->_data
- : '';
- }
-
- private $_exp = null;
-
- // cache of most recently fetched id
- private $_lm = null;
- private $_data = null;
- private $_id = null;
-
- /**
- * Fetch data and timestamp from apc, store in instance
- *
- * @param string $id
- *
- * @return bool success
- */
- private function _fetch($id)
- {
- if ($this->_id === $id) {
- return true;
- }
- $ret = apc_fetch($id);
- if (false === $ret) {
- $this->_id = null;
- return false;
- }
- list($this->_lm, $this->_data) = explode('|', $ret, 2);
- $this->_id = $id;
- return true;
- }
-}
diff --git a/vendor/mrclay/minify/min/lib/Minify/Cache/File.php b/vendor/mrclay/minify/min/lib/Minify/Cache/File.php
deleted file mode 100644
index c228eb2b2..000000000
--- a/vendor/mrclay/minify/min/lib/Minify/Cache/File.php
+++ /dev/null
@@ -1,197 +0,0 @@
-_locking = $fileLocking;
- $this->_path = $path;
- }
-
- /**
- * Write data to cache.
- *
- * @param string $id cache id (e.g. a filename)
- *
- * @param string $data
- *
- * @return bool success
- */
- public function store($id, $data)
- {
- $flag = $this->_locking
- ? LOCK_EX
- : null;
- $file = $this->_path . '/' . $id;
- if (! @file_put_contents($file, $data, $flag)) {
- $this->_log("Minify_Cache_File: Write failed to '$file'");
- }
- // write control
- if ($data !== $this->fetch($id)) {
- @unlink($file);
- $this->_log("Minify_Cache_File: Post-write read failed for '$file'");
- return false;
- }
- return true;
- }
-
- /**
- * Get the size of a cache entry
- *
- * @param string $id cache id (e.g. a filename)
- *
- * @return int size in bytes
- */
- public function getSize($id)
- {
- return filesize($this->_path . '/' . $id);
- }
-
- /**
- * Does a valid cache entry exist?
- *
- * @param string $id cache id (e.g. a filename)
- *
- * @param int $srcMtime mtime of the original source file(s)
- *
- * @return bool exists
- */
- public function isValid($id, $srcMtime)
- {
- $file = $this->_path . '/' . $id;
- return (is_file($file) && (filemtime($file) >= $srcMtime));
- }
-
- /**
- * Send the cached content to output
- *
- * @param string $id cache id (e.g. a filename)
- */
- public function display($id)
- {
- if ($this->_locking) {
- $fp = fopen($this->_path . '/' . $id, 'rb');
- flock($fp, LOCK_SH);
- fpassthru($fp);
- flock($fp, LOCK_UN);
- fclose($fp);
- } else {
- readfile($this->_path . '/' . $id);
- }
- }
-
- /**
- * Fetch the cached content
- *
- * @param string $id cache id (e.g. a filename)
- *
- * @return string
- */
- public function fetch($id)
- {
- if ($this->_locking) {
- $fp = fopen($this->_path . '/' . $id, 'rb');
- if (!$fp) {
- return false;
- }
- flock($fp, LOCK_SH);
- $ret = stream_get_contents($fp);
- flock($fp, LOCK_UN);
- fclose($fp);
- return $ret;
- } else {
- return file_get_contents($this->_path . '/' . $id);
- }
- }
-
- /**
- * Fetch the cache path used
- *
- * @return string
- */
- public function getPath()
- {
- return $this->_path;
- }
-
- /**
- * Get a usable temp directory
- *
- * Adapted from Solar/Dir.php
- * @author Paul M. Jones _reservePlace("getMessage(), ENT_IGNORE) ?> getMessage())) ?>" id="tracyBsSearch" rel="noreferrer">search►
-getMessage(), ENT_IGNORE) ?>
-File: getFile(), $ex->getLine()) ?>
- getFile())): ?>getFile(), $ex->getLine(), 15, $ex instanceof \ErrorException && isset($ex->context) ? $ex->context : NULL) ?> -- - - - - inner-code - - - " class="tracy-toggle">source - - " ?> - - ' ?> - - - (" class="tracy-toggle tracy-collapsed">arguments) -
- - -| ', htmlspecialchars(isset($params[$k]) ? '$' . $params[$k]->name : "#$k"), ' | '; - echo Dumper::toHtml($v); - echo " |
|---|
| $', htmlspecialchars($k), ' | ', Dumper::toHtml($v), " |
|---|
| ', htmlspecialchars($k), ' | ', Dumper::toHtml($v), " |
|---|
empty
- -| ', htmlspecialchars($k), ' | ', $k === '__NF' ? 'Nette Session' : Dumper::toHtml($v), " |
|---|
| ', htmlspecialchars($k), ' | ', Dumper::toHtml($v), " |
|---|
| ', htmlspecialchars($k), ' | '; - echo '', Dumper::toHtml($v), " |
|---|
| ', htmlspecialchars($v, ENT_IGNORE), " | \n"; - } - ?> -
| ', htmlspecialchars($k), ' | ', htmlspecialchars($v), " |
|---|
empty
- -| ', htmlspecialchars($k), ' | ', Dumper::toHtml($v), " |
|---|
'; - ?>- -
no headers
- -