@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | protected $urlsLinked = true; |
| 80 | 80 | |
| 81 | 81 | function setSafeMode( $safeMode ) { |
| 82 | - $this->safeMode = (bool) $safeMode; |
|
| 82 | + $this->safeMode = ( bool ) $safeMode; |
|
| 83 | 83 | |
| 84 | 84 | return $this; |
| 85 | 85 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | protected $safeMode; |
| 88 | 88 | |
| 89 | 89 | function setStrictMode( $strictMode ) { |
| 90 | - $this->strictMode = (bool) $strictMode; |
|
| 90 | + $this->strictMode = ( bool ) $strictMode; |
|
| 91 | 91 | |
| 92 | 92 | return $this; |
| 93 | 93 | } |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | $blockTypes = $this->unmarkedBlockTypes; |
| 217 | 217 | |
| 218 | - if ( isset( $this->BlockTypes[ $marker ] ) ) { |
|
| 219 | - foreach ( $this->BlockTypes[ $marker ] as $blockType ) { |
|
| 218 | + if ( isset( $this->BlockTypes[$marker] ) ) { |
|
| 219 | + foreach ( $this->BlockTypes[$marker] as $blockType ) { |
|
| 220 | 220 | $blockTypes [] = $blockType; |
| 221 | 221 | } |
| 222 | 222 | } |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | // List |
| 510 | 510 | |
| 511 | 511 | protected function blockList( $Line, ?array $CurrentBlock = null ) { |
| 512 | - list($name, $pattern) = $Line['text'][0] <= '-' ? array( 'ul', '[*+-]' ) : array( 'ol', '[0-9]{1,9}+[.\)]' ); |
|
| 512 | + list( $name, $pattern ) = $Line['text'][0] <= '-' ? array( 'ul', '[*+-]' ) : array( 'ol', '[0-9]{1,9}+[.\)]' ); |
|
| 513 | 513 | |
| 514 | 514 | if ( preg_match( '/^(' . $pattern . '([ ]++|$))(.*+)/', $Line['text'], $matches ) ) { |
| 515 | 515 | $contentIndent = strlen( $matches[2] ); |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | |
| 525 | 525 | $markerWithoutWhitespace = strstr( $matches[1], ' ', true ); |
| 526 | 526 | |
| 527 | - $Block = array( |
|
| 527 | + $Block = array( |
|
| 528 | 528 | 'indent' => $Line['indent'], |
| 529 | 529 | 'pattern' => $pattern, |
| 530 | 530 | 'data' => array( |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | 'name' => 'blockquote', |
| 670 | 670 | 'handler' => array( |
| 671 | 671 | 'function' => 'linesElements', |
| 672 | - 'argument' => (array) $matches[1], |
|
| 672 | + 'argument' => ( array ) $matches[1], |
|
| 673 | 673 | 'destination' => 'elements', |
| 674 | 674 | ), |
| 675 | 675 | ), |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | 'title' => isset( $matches[3] ) ? $matches[3] : null, |
| 781 | 781 | ); |
| 782 | 782 | |
| 783 | - $this->DefinitionData['Reference'][ $id ] = $Data; |
|
| 783 | + $this->DefinitionData['Reference'][$id] = $Data; |
|
| 784 | 784 | |
| 785 | 785 | $Block = array( |
| 786 | 786 | 'element' => array(), |
@@ -867,8 +867,8 @@ discard block |
||
| 867 | 867 | ), |
| 868 | 868 | ); |
| 869 | 869 | |
| 870 | - if ( isset( $alignments[ $index ] ) ) { |
|
| 871 | - $alignment = $alignments[ $index ]; |
|
| 870 | + if ( isset( $alignments[$index] ) ) { |
|
| 871 | + $alignment = $alignments[$index]; |
|
| 872 | 872 | |
| 873 | 873 | $HeaderElement['attributes'] = array( |
| 874 | 874 | 'style' => "text-align: $alignment;", |
@@ -935,9 +935,9 @@ discard block |
||
| 935 | 935 | ), |
| 936 | 936 | ); |
| 937 | 937 | |
| 938 | - if ( isset( $Block['alignments'][ $index ] ) ) { |
|
| 938 | + if ( isset( $Block['alignments'][$index] ) ) { |
|
| 939 | 939 | $Element['attributes'] = array( |
| 940 | - 'style' => 'text-align: ' . $Block['alignments'][ $index ] . ';', |
|
| 940 | + 'style' => 'text-align: ' . $Block['alignments'][$index] . ';', |
|
| 941 | 941 | ); |
| 942 | 942 | } |
| 943 | 943 | |
@@ -1035,10 +1035,10 @@ discard block |
||
| 1035 | 1035 | 'context' => $text, |
| 1036 | 1036 | ); |
| 1037 | 1037 | |
| 1038 | - foreach ( $this->InlineTypes[ $marker ] as $inlineType ) { |
|
| 1038 | + foreach ( $this->InlineTypes[$marker] as $inlineType ) { |
|
| 1039 | 1039 | // check to see if the current inline type is nestable in the current context |
| 1040 | 1040 | |
| 1041 | - if ( isset( $nonNestables[ $inlineType ] ) ) { |
|
| 1041 | + if ( isset( $nonNestables[$inlineType] ) ) { |
|
| 1042 | 1042 | continue; |
| 1043 | 1043 | } |
| 1044 | 1044 | |
@@ -1178,9 +1178,9 @@ discard block |
||
| 1178 | 1178 | |
| 1179 | 1179 | $marker = $Excerpt['text'][0]; |
| 1180 | 1180 | |
| 1181 | - if ( $Excerpt['text'][1] === $marker and preg_match( $this->StrongRegex[ $marker ], $Excerpt['text'], $matches ) ) { |
|
| 1181 | + if ( $Excerpt['text'][1] === $marker and preg_match( $this->StrongRegex[$marker], $Excerpt['text'], $matches ) ) { |
|
| 1182 | 1182 | $emphasis = 'strong'; |
| 1183 | - } elseif ( preg_match( $this->EmRegex[ $marker ], $Excerpt['text'], $matches ) ) { |
|
| 1183 | + } elseif ( preg_match( $this->EmRegex[$marker], $Excerpt['text'], $matches ) ) { |
|
| 1184 | 1184 | $emphasis = 'em'; |
| 1185 | 1185 | } else { |
| 1186 | 1186 | return; |
@@ -1287,11 +1287,11 @@ discard block |
||
| 1287 | 1287 | $definition = strtolower( $Element['handler']['argument'] ); |
| 1288 | 1288 | } |
| 1289 | 1289 | |
| 1290 | - if ( ! isset( $this->DefinitionData['Reference'][ $definition ] ) ) { |
|
| 1290 | + if ( ! isset( $this->DefinitionData['Reference'][$definition] ) ) { |
|
| 1291 | 1291 | return; |
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | - $Definition = $this->DefinitionData['Reference'][ $definition ]; |
|
| 1294 | + $Definition = $this->DefinitionData['Reference'][$definition]; |
|
| 1295 | 1295 | |
| 1296 | 1296 | $Element['attributes']['href'] = $Definition['url']; |
| 1297 | 1297 | $Element['attributes']['title'] = $Definition['title']; |
@@ -1434,7 +1434,7 @@ discard block |
||
| 1434 | 1434 | $destination = $Element['handler']['destination']; |
| 1435 | 1435 | } |
| 1436 | 1436 | |
| 1437 | - $Element[ $destination ] = $this->{$function}( $argument, $Element['nonNestables'] ); |
|
| 1437 | + $Element[$destination] = $this->{$function}( $argument, $Element['nonNestables'] ); |
|
| 1438 | 1438 | |
| 1439 | 1439 | if ( $destination === 'handler' ) { |
| 1440 | 1440 | $Element = $this->handle( $Element ); |
@@ -1649,19 +1649,19 @@ discard block |
||
| 1649 | 1649 | return $Element; |
| 1650 | 1650 | } |
| 1651 | 1651 | |
| 1652 | - if ( isset( $safeUrlNameToAtt[ $Element['name'] ] ) ) { |
|
| 1653 | - $Element = $this->filterUnsafeUrlInAttribute( $Element, $safeUrlNameToAtt[ $Element['name'] ] ); |
|
| 1652 | + if ( isset( $safeUrlNameToAtt[$Element['name']] ) ) { |
|
| 1653 | + $Element = $this->filterUnsafeUrlInAttribute( $Element, $safeUrlNameToAtt[$Element['name']] ); |
|
| 1654 | 1654 | } |
| 1655 | 1655 | |
| 1656 | 1656 | if ( ! empty( $Element['attributes'] ) ) { |
| 1657 | 1657 | foreach ( $Element['attributes'] as $att => $val ) { |
| 1658 | 1658 | // filter out badly parsed attribute |
| 1659 | 1659 | if ( ! preg_match( $goodAttribute, $att ) ) { |
| 1660 | - unset( $Element['attributes'][ $att ] ); |
|
| 1660 | + unset( $Element['attributes'][$att] ); |
|
| 1661 | 1661 | } |
| 1662 | 1662 | // dump onevent attribute |
| 1663 | 1663 | elseif ( self::striAtStart( $att, 'on' ) ) { |
| 1664 | - unset( $Element['attributes'][ $att ] ); |
|
| 1664 | + unset( $Element['attributes'][$att] ); |
|
| 1665 | 1665 | } |
| 1666 | 1666 | } |
| 1667 | 1667 | } |
@@ -1671,12 +1671,12 @@ discard block |
||
| 1671 | 1671 | |
| 1672 | 1672 | protected function filterUnsafeUrlInAttribute( array $Element, $attribute ) { |
| 1673 | 1673 | foreach ( $this->safeLinksWhitelist as $scheme ) { |
| 1674 | - if ( self::striAtStart( $Element['attributes'][ $attribute ], $scheme ) ) { |
|
| 1674 | + if ( self::striAtStart( $Element['attributes'][$attribute], $scheme ) ) { |
|
| 1675 | 1675 | return $Element; |
| 1676 | 1676 | } |
| 1677 | 1677 | } |
| 1678 | 1678 | |
| 1679 | - $Element['attributes'][ $attribute ] = str_replace( ':', '%3A', $Element['attributes'][ $attribute ] ); |
|
| 1679 | + $Element['attributes'][$attribute] = str_replace( ':', '%3A', $Element['attributes'][$attribute] ); |
|
| 1680 | 1680 | |
| 1681 | 1681 | return $Element; |
| 1682 | 1682 | } |
@@ -1700,13 +1700,13 @@ discard block |
||
| 1700 | 1700 | } |
| 1701 | 1701 | |
| 1702 | 1702 | static function instance( $name = 'default' ) { |
| 1703 | - if ( isset( self::$instances[ $name ] ) ) { |
|
| 1704 | - return self::$instances[ $name ]; |
|
| 1703 | + if ( isset( self::$instances[$name] ) ) { |
|
| 1704 | + return self::$instances[$name]; |
|
| 1705 | 1705 | } |
| 1706 | 1706 | |
| 1707 | 1707 | $instance = new static(); |
| 1708 | 1708 | |
| 1709 | - self::$instances[ $name ] = $instance; |
|
| 1709 | + self::$instances[$name] = $instance; |
|
| 1710 | 1710 | |
| 1711 | 1711 | return $instance; |
| 1712 | 1712 | } |