Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 3 commits
  • 9 files changed
  • 0 commit comments
  • 2 contributors
View
4 Lib/MarkdownifyLib.php
@@ -27,7 +27,7 @@ public function __construct($settings = array()) {
}
public function parseString($html, $options = array()) {
- if ($this->settings['engine'] == 'extra') {
+ if ($this->settings['engine'] === 'extra') {
$Parser = new Markdownify_Extra();
} else {
$Parser = new Markdownify();
@@ -35,4 +35,4 @@ public function parseString($html, $options = array()) {
return $Parser->parseString($html);
}
-}
+}
View
20 Lib/Parser/BbcodeParser.php
@@ -291,18 +291,18 @@ protected function _addParaTag($string) {
}
protected function _allowed($out, $in) {
- if (!$out || ($this->_tags[$out]['allowed'] == 'all')) {
+ if (!$out || ($this->_tags[$out]['allowed'] === 'all')) {
return true;
}
- if ($this->_tags[$out]['allowed'] == 'none') {
+ if ($this->_tags[$out]['allowed'] === 'none') {
return false;
}
$ar = explode('^', $this->_tags[$out]['allowed']);
$tags = explode(',', $ar[1]);
- if ($ar[0] == 'none' && in_array($in, $tags)) {
+ if ($ar[0] === 'none' && in_array($in, $tags)) {
return true;
}
- if ($ar[0] == 'all' && in_array($in, $tags)) {
+ if ($ar[0] === 'all' && in_array($in, $tags)) {
return false;
}
return false;
@@ -335,7 +335,7 @@ protected function _buildOutput() {
}
foreach ($tag['attributes'] as $key => $value) {
$value = preg_replace('#(activex|applet|about|chrome|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base):#is', "\\1:", $value);
- if (($this->quote == 'nothing') || (($this->quote == 'strings') && is_numeric($v))) {
+ if (($this->quote === 'nothing') || (($this->quote === 'strings') && is_numeric($v))) {
$this->_parsed .= ' ' . sprintf($this->_tags[$tag['tag']]['attributes'][$key], $value, '');
} else {
$this->_parsed .= ' ' . sprintf($this->_tags[$tag['tag']]['attributes'][$key], $value, $quote);
@@ -357,7 +357,7 @@ protected function _buildOutput() {
protected function _buildTag($string) {
$tag = array('text' => $string, 'attributes' => array());
- if (substr($string, 1, 1) == '/') {
+ if (substr($string, 1, 1) === '/') {
$tag['tag'] = strtolower(substr($string, 2, strlen($string) - 3));
if (!in_array($tag['tag'], array_keys($this->_tags))) {
return false;
@@ -551,7 +551,7 @@ protected function _child($out, $in) {
}
$ar = explode('^', $this->_tags[$out]['child']);
$tags = explode(',', $ar[1]);
- if ($ar[0] == 'none') {
+ if ($ar[0] === 'none') {
if ($in && in_array($in, $tags)) {
return false;
}
@@ -735,18 +735,18 @@ protected function _list() {
}
protected function _parent($out, $in) {
- if (!isset($this->_tags[$in]['parent']) || ($this->_tags[$in]['parent'] == 'all')) {
+ if (!isset($this->_tags[$in]['parent']) || ($this->_tags[$in]['parent'] === 'all')) {
return false;
}
$ar = explode('^', $this->_tags[$in]['parent']);
$tags = explode(',', $ar[1]);
- if ($ar[0] == 'none') {
+ if ($ar[0] === 'none') {
if ($out && in_array($out, $tags)) {
return false;
}
return $this->_buildTag('[' . $tags[0] . ']');
}
- if ($ar[0] == 'all' && $out && !in_array($out, $tags)) {
+ if ($ar[0] === 'all' && $out && !in_array($out, $tags)) {
return false;
}
View
8 Lib/Parser/MarkdownParser.php
@@ -115,18 +115,18 @@ public function parse($text, $options = array()) {
$defaults = array(
'engine' => 'default',
);
- $options = am($defaults, $options);
+ $options = array_merge($defaults, $options);
if (!empty($options['stripHtml'])) {
$text = strip_tags($text);
}
- if ($options['engine'] == 'markdown_extra') {
+ if ($options['engine'] === 'markdown_extra') {
App::import('Vendor', 'MarkupParsers.markdown/markdown');
$Markdown = new MarkdownExtra_Parser;
return trim($Markdown->transform($text));
- } elseif ($options['engine'] == 'markdown') {
+ } elseif ($options['engine'] === 'markdown') {
App::import('Vendor', 'MarkupParsers.markdown/markdown');
$Markdown = new Markdown_Parser;
return trim($Markdown->transform($text));
@@ -549,4 +549,4 @@ protected function _makePlaceHolder($text) {
return $marker;
}
-}
+}
View
2  Lib/ParserInterface.php
@@ -26,4 +26,4 @@
*/
public function parse($text, $options = array());
-}
+}
View
10 Lib/ParserRegistry.php
@@ -54,10 +54,10 @@ protected static function _init() {
'html' => array(
'name' => 'Html',
'className' => 'MarkupParsers.Html'),
- 'textile' => array(
- 'name' => 'Textile',
- 'className' => 'MarkupParsers.Textile'
- )
+ 'textile' => array(
+ 'name' => 'Textile',
+ 'className' => 'MarkupParsers.Textile'
+ )
);
if (empty(self::$_availableParsers)) {
@@ -106,4 +106,4 @@ public static function getParser($parser = '') {
return self::$_parsers[$parser];
}
-}
+}
View
1  Test/Case/Lib/Parser/BbcodeParserTest.php
@@ -94,4 +94,3 @@ public function testParseNotClosedTags() {
}
}
-
View
2  Test/Case/Lib/Parser/HtmlParserTest.php
@@ -90,4 +90,4 @@ public function testParseCode() {
$this->assertTextEquals($expected, $result);
}
-}
+}
View
1  Test/Case/Lib/Parser/MarkdownParserTest.php
@@ -842,4 +842,3 @@ public function testParseWithOtherEngines() {
}
-
View
4 Test/Case/View/Helper/ParserHelperTest.php
@@ -70,7 +70,7 @@ public function testParse() {
$result = $this->Parser->parse($string, 'markdown');
$this->assertEquals(array('<h1>Foobar</h1>'), $result);
- $string = 'h1. Foobar';
+ $string = 'h1. Foobar';
$result = $this->Parser->parse($string, 'textile');
$this->assertEquals(array('<h1>Foobar</h1>'), $result);
@@ -84,4 +84,4 @@ public function testParse() {
$this->assertEquals(array('<b>Foobar</b>', '<b>Barfoo</b>'), $result);
}
-}
+}

No commit comments for this range

Something went wrong with that request. Please try again.