diff --git a/Utils/Parser/Markdown/Markdown.php b/Utils/Parser/Markdown/Markdown.php
index c674791c5..6bfb61982 100755
--- a/Utils/Parser/Markdown/Markdown.php
+++ b/Utils/Parser/Markdown/Markdown.php
@@ -27,7 +27,7 @@ class Markdown
{
# ~
- const version = '1.8.0-beta-7';
+ public const version = '1.8.0-beta-7';
private array $options = [];
@@ -127,7 +127,7 @@ class Markdown
$state = $this->options['math'] ?? false;
if ($state !== false) {
$this->BlockTypes['\\'][] = 'Math';
- $this->BlockTypes['$'][] = 'Math';
+ $this->BlockTypes['$'][] = 'Math';
}
// Task
@@ -137,7 +137,7 @@ class Markdown
}
}
- function textParent($text)
+ public function textParent($text)
{
$Elements = $this->textElements($text);
@@ -145,11 +145,11 @@ class Markdown
$markup = $this->elements($Elements);
# trim line breaks
- $markup = trim($markup, "\n");
+ $markup = \trim($markup, "\n");
# merge consecutive dl elements
- $markup = preg_replace('/<\/dl>\s+
\s+/', '', $markup);
+ $markup = \preg_replace('/<\/dl>\s+\s+/', '', $markup);
# add footnotes
@@ -167,7 +167,7 @@ class Markdown
* Parses the given markdown string to an HTML string but it leaves the ToC
* tag as is. It's an alias of the parent method "\DynamicParent::text()".
*/
- public function body($text): string
+ public function body($text) : string
{
$text = $this->encodeTagToHash($text); // Escapes ToC tag temporary
$html = $this->textParent($text); // Parses the markdown text
@@ -186,22 +186,22 @@ class Markdown
// method.
$html = $this->body($text);
- if (isset($this->options['toc']) && false == $this->options['toc']) {
+ if (isset($this->options['toc']) && $this->options['toc'] == false) {
return $html;
}
$tagOrigin = $this->getTagToC();
- if (strpos($text, $tagOrigin) === false) {
+ if (\strpos($text, $tagOrigin) === false) {
return $html;
}
$tocData = $this->contentsList();
- $tocId = $this->getIdAttributeToC();
- $needle = ''.$tagOrigin.'
';
+ $tocId = $this->getIdAttributeToC();
+ $needle = ''.$tagOrigin.'
';
$replace = "{$tocData}
";
- return str_replace($needle, $replace, $html);
+ return \str_replace($needle, $replace, $html);
}
/**
@@ -213,7 +213,7 @@ class Markdown
*/
public function contentsList($typeReturn = 'html')
{
- if ('html' === strtolower($typeReturn)) {
+ if (\strtolower($typeReturn) === 'html') {
$result = '';
if (!empty($this->contentsListString)) {
// Parses the ToC list in markdown to HTML
@@ -223,12 +223,12 @@ class Markdown
return $result;
}
- if ('json' === strtolower($typeReturn)) {
- return json_encode($this->contentsListArray);
+ if (\strtolower($typeReturn) === 'json') {
+ return \json_encode($this->contentsListArray);
}
// Forces to return ToC as "html"
- error_log(
+ \error_log(
'Unknown return type given while parsing ToC.'
.' At: '.__FUNCTION__.'() '
.' in Line:'.__LINE__.' (Using default type)'
@@ -247,9 +247,9 @@ class Markdown
protected function inlineCode($excerpt)
{
$codeSnippets = $this->options['code']['inline'] ?? true;
- $codeMain = $this->options['code'] ?? true;
+ $codeMain = $this->options['code'] ?? true;
- if ($codeSnippets === true and $codeMain === true) {
+ if ($codeSnippets === true && $codeMain === true) {
return $this->inlineCodeParent($excerpt);
}
}
@@ -257,9 +257,9 @@ class Markdown
protected function inlineEmailTag($excerpt)
{
$mainState = $this->options['links'] ?? true;
- $state = $this->options['links']['email_links'] ?? true;
+ $state = $this->options['links']['email_links'] ?? true;
- if ($mainState and $state) {
+ if ($mainState && $state) {
return $this->inlineEmailTagParent($excerpt);
}
}
@@ -323,228 +323,228 @@ class Markdown
protected function inlineEmojis($excerpt)
{
$emojiMap = [
- ':smile:' => '๐', ':laughing:' => '๐', ':blush:' => '๐', ':smiley:' => '๐',
- ':relaxed:' => 'โบ๏ธ', ':smirk:' => '๐', ':heart_eyes:' => '๐', ':kissing_heart:' => '๐',
- ':kissing_closed_eyes:' => '๐', ':flushed:' => '๐ณ', ':relieved:' => '๐', ':satisfied:' => '๐',
- ':grin:' => '๐', ':wink:' => '๐', ':stuck_out_tongue_winking_eye:' => '๐', ':stuck_out_tongue_closed_eyes:' => '๐',
- ':grinning:' => '๐', ':kissing:' => '๐', ':kissing_smiling_eyes:' => '๐', ':stuck_out_tongue:' => '๐',
- ':sleeping:' => '๐ด', ':worried:' => '๐', ':frowning:' => '๐ฆ', ':anguished:' => '๐ง',
- ':open_mouth:' => '๐ฎ', ':grimacing:' => '๐ฌ', ':confused:' => '๐', ':hushed:' => '๐ฏ',
- ':expressionless:' => '๐', ':unamused:' => '๐', ':sweat_smile:' => '๐
', ':sweat:' => '๐',
- ':disappointed_relieved:' => '๐ฅ', ':weary:' => '๐ฉ', ':pensive:' => '๐', ':disappointed:' => '๐',
- ':confounded:' => '๐', ':fearful:' => '๐จ', ':cold_sweat:' => '๐ฐ', ':persevere:' => '๐ฃ',
- ':cry:' => '๐ข', ':sob:' => '๐ญ', ':joy:' => '๐', ':astonished:' => '๐ฒ',
- ':scream:' => '๐ฑ', ':tired_face:' => '๐ซ', ':angry:' => '๐ ', ':rage:' => '๐ก',
- ':triumph:' => '๐ค', ':sleepy:' => '๐ช', ':yum:' => '๐', ':mask:' => '๐ท',
- ':sunglasses:' => '๐', ':dizzy_face:' => '๐ต', ':imp:' => '๐ฟ', ':smiling_imp:' => '๐',
- ':neutral_face:' => '๐', ':no_mouth:' => '๐ถ', ':innocent:' => '๐', ':alien:' => '๐ฝ',
- ':yellow_heart:' => '๐', ':blue_heart:' => '๐', ':purple_heart:' => '๐', ':heart:' => 'โค๏ธ',
- ':green_heart:' => '๐', ':broken_heart:' => '๐', ':heartbeat:' => '๐', ':heartpulse:' => '๐',
- ':two_hearts:' => '๐', ':revolving_hearts:' => '๐', ':cupid:' => '๐', ':sparkling_heart:' => '๐',
- ':sparkles:' => 'โจ', ':star:' => 'โญ๏ธ', ':star2:' => '๐', ':dizzy:' => '๐ซ',
- ':boom:' => '๐ฅ', ':collision:' => '๐ฅ', ':anger:' => '๐ข', ':exclamation:' => 'โ๏ธ',
- ':question:' => 'โ', ':grey_exclamation:' => 'โ', ':grey_question:' => 'โ', ':zzz:' => '๐ค',
- ':dash:' => '๐จ', ':sweat_drops:' => '๐ฆ', ':notes:' => '๐ถ', ':musical_note:' => '๐ต',
- ':fire:' => '๐ฅ', ':hankey:' => '๐ฉ', ':poop:' => '๐ฉ', ':shit:' => '๐ฉ',
- ':+1:' => '๐', ':thumbsup:' => '๐', ':-1:' => '๐', ':thumbsdown:' => '๐',
- ':ok_hand:' => '๐', ':punch:' => '๐', ':facepunch:' => '๐', ':fist:' => 'โ',
- ':v:' => 'โ๏ธ', ':wave:' => '๐', ':hand:' => 'โ', ':raised_hand:' => 'โ',
- ':open_hands:' => '๐', ':point_up:' => 'โ๏ธ', ':point_down:' => '๐', ':point_left:' => '๐',
- ':point_right:' => '๐', ':raised_hands:' => '๐', ':pray:' => '๐', ':point_up_2:' => '๐',
- ':clap:' => '๐', ':muscle:' => '๐ช', ':metal:' => '๐ค', ':fu:' => '๐',
- ':walking:' => '๐ถ', ':runner:' => '๐', ':running:' => '๐', ':couple:' => '๐ซ',
- ':family:' => '๐ช', ':two_men_holding_hands:' => '๐ฌ', ':two_women_holding_hands:' => '๐ญ', ':dancer:' => '๐',
- ':dancers:' => '๐ฏ', ':ok_woman:' => '๐', ':no_good:' => '๐
', ':information_desk_person:' => '๐',
- ':raising_hand:' => '๐', ':bride_with_veil:' => '๐ฐ', ':person_with_pouting_face:' => '๐', ':person_frowning:' => '๐',
- ':bow:' => '๐', ':couple_with_heart:' => '๐', ':massage:' => '๐', ':haircut:' => '๐',
- ':nail_care:' => '๐
', ':boy:' => '๐ฆ', ':girl:' => '๐ง', ':woman:' => '๐ฉ',
- ':man:' => '๐จ', ':baby:' => '๐ถ', ':older_woman:' => '๐ต', ':older_man:' => '๐ด',
- ':person_with_blond_hair:' => '๐ฑ', ':man_with_gua_pi_mao:' => '๐ฒ', ':man_with_turban:' => '๐ณ', ':construction_worker:' => '๐ท',
- ':cop:' => '๐ฎ', ':angel:' => '๐ผ', ':princess:' => '๐ธ', ':smiley_cat:' => '๐บ',
- ':smile_cat:' => '๐ธ', ':heart_eyes_cat:' => '๐ป', ':kissing_cat:' => '๐ฝ', ':smirk_cat:' => '๐ผ',
- ':scream_cat:' => '๐', ':crying_cat_face:' => '๐ฟ', ':joy_cat:' => '๐น', ':pouting_cat:' => '๐พ',
- ':japanese_ogre:' => '๐น', ':japanese_goblin:' => '๐บ', ':see_no_evil:' => '๐', ':hear_no_evil:' => '๐',
- ':speak_no_evil:' => '๐', ':guardsman:' => '๐', ':skull:' => '๐', ':feet:' => '๐พ',
- ':lips:' => '๐', ':kiss:' => '๐', ':droplet:' => '๐ง', ':ear:' => '๐',
- ':eyes:' => '๐', ':nose:' => '๐', ':tongue:' => '๐
', ':love_letter:' => '๐',
- ':bust_in_silhouette:' => '๐ค', ':busts_in_silhouette:' => '๐ฅ', ':speech_balloon:' => '๐ฌ', ':thought_balloon:' => '๐ญ',
- ':sunny:' => 'โ๏ธ', ':umbrella:' => 'โ๏ธ', ':cloud:' => 'โ๏ธ', ':snowflake:' => 'โ๏ธ',
- ':snowman:' => 'โ๏ธ', ':zap:' => 'โก๏ธ', ':cyclone:' => '๐', ':foggy:' => '๐',
- ':ocean:' => '๐', ':cat:' => '๐ฑ', ':dog:' => '๐ถ', ':mouse:' => '๐ญ',
- ':hamster:' => '๐น', ':rabbit:' => '๐ฐ', ':wolf:' => '๐บ', ':frog:' => '๐ธ',
- ':tiger:' => '๐ฏ', ':koala:' => '๐จ', ':bear:' => '๐ป', ':pig:' => '๐ท',
- ':pig_nose:' => '๐ฝ', ':cow:' => '๐ฎ', ':boar:' => '๐', ':monkey_face:' => '๐ต',
- ':monkey:' => '๐', ':horse:' => '๐ด', ':racehorse:' => '๐', ':camel:' => '๐ซ',
- ':sheep:' => '๐', ':elephant:' => '๐', ':panda_face:' => '๐ผ', ':snake:' => '๐',
- ':bird:' => '๐ฆ', ':baby_chick:' => '๐ค', ':hatched_chick:' => '๐ฅ', ':hatching_chick:' => '๐ฃ',
- ':chicken:' => '๐', ':penguin:' => '๐ง', ':turtle:' => '๐ข', ':bug:' => '๐',
- ':honeybee:' => '๐', ':ant:' => '๐', ':beetle:' => '๐', ':snail:' => '๐',
- ':octopus:' => '๐', ':tropical_fish:' => '๐ ', ':fish:' => '๐', ':whale:' => '๐ณ',
- ':whale2:' => '๐', ':dolphin:' => '๐ฌ', ':cow2:' => '๐', ':ram:' => '๐',
- ':rat:' => '๐', ':water_buffalo:' => '๐', ':tiger2:' => '๐
', ':rabbit2:' => '๐',
- ':dragon:' => '๐', ':goat:' => '๐', ':rooster:' => '๐', ':dog2:' => '๐',
- ':pig2:' => '๐', ':mouse2:' => '๐', ':ox:' => '๐', ':dragon_face:' => '๐ฒ',
- ':blowfish:' => '๐ก', ':crocodile:' => '๐', ':dromedary_camel:' => '๐ช', ':leopard:' => '๐',
- ':cat2:' => '๐', ':poodle:' => '๐ฉ', ':crab' => '๐ฆ', ':paw_prints:' => '๐พ', ':bouquet:' => '๐',
- ':cherry_blossom:' => '๐ธ', ':tulip:' => '๐ท', ':four_leaf_clover:' => '๐', ':rose:' => '๐น',
- ':sunflower:' => '๐ป', ':hibiscus:' => '๐บ', ':maple_leaf:' => '๐', ':leaves:' => '๐',
- ':fallen_leaf:' => '๐', ':herb:' => '๐ฟ', ':mushroom:' => '๐', ':cactus:' => '๐ต',
- ':palm_tree:' => '๐ด', ':evergreen_tree:' => '๐ฒ', ':deciduous_tree:' => '๐ณ', ':chestnut:' => '๐ฐ',
- ':seedling:' => '๐ฑ', ':blossom:' => '๐ผ', ':ear_of_rice:' => '๐พ', ':shell:' => '๐',
- ':globe_with_meridians:' => '๐', ':sun_with_face:' => '๐', ':full_moon_with_face:' => '๐', ':new_moon_with_face:' => '๐',
- ':new_moon:' => '๐', ':waxing_crescent_moon:' => '๐', ':first_quarter_moon:' => '๐', ':waxing_gibbous_moon:' => '๐',
- ':full_moon:' => '๐', ':waning_gibbous_moon:' => '๐', ':last_quarter_moon:' => '๐', ':waning_crescent_moon:' => '๐',
- ':last_quarter_moon_with_face:' => '๐', ':first_quarter_moon_with_face:' => '๐', ':moon:' => '๐', ':earth_africa:' => '๐',
- ':earth_americas:' => '๐', ':earth_asia:' => '๐', ':volcano:' => '๐', ':milky_way:' => '๐',
- ':partly_sunny:' => 'โ
๏ธ', ':bamboo:' => '๐', ':gift_heart:' => '๐', ':dolls:' => '๐',
- ':school_satchel:' => '๐', ':mortar_board:' => '๐', ':flags:' => '๐', ':fireworks:' => '๐',
- ':sparkler:' => '๐', ':wind_chime:' => '๐', ':rice_scene:' => '๐', ':jack_o_lantern:' => '๐',
- ':ghost:' => '๐ป', ':santa:' => '๐
', ':christmas_tree:' => '๐', ':gift:' => '๐',
- ':bell:' => '๐', ':no_bell:' => '๐', ':tanabata_tree:' => '๐', ':tada:' => '๐',
- ':confetti_ball:' => '๐', ':balloon:' => '๐', ':crystal_ball:' => '๐ฎ', ':cd:' => '๐ฟ',
- ':dvd:' => '๐', ':floppy_disk:' => '๐พ', ':camera:' => '๐ท', ':video_camera:' => '๐น',
- ':movie_camera:' => '๐ฅ', ':computer:' => '๐ป', ':tv:' => '๐บ', ':iphone:' => '๐ฑ',
- ':phone:' => 'โ๏ธ', ':telephone:' => 'โ๏ธ', ':telephone_receiver:' => '๐', ':pager:' => '๐',
- ':fax:' => '๐ ', ':minidisc:' => '๐ฝ', ':vhs:' => '๐ผ', ':sound:' => '๐',
- ':speaker:' => '๐', ':mute:' => '๐', ':loudspeaker:' => '๐ข', ':mega:' => '๐ฃ',
- ':hourglass:' => 'โ๏ธ', ':hourglass_flowing_sand:' => 'โณ', ':alarm_clock:' => 'โฐ', ':watch:' => 'โ๏ธ',
- ':radio:' => '๐ป', ':satellite:' => '๐ก', ':loop:' => 'โฟ', ':mag:' => '๐',
- ':mag_right:' => '๐', ':unlock:' => '๐', ':lock:' => '๐', ':lock_with_ink_pen:' => '๐',
- ':closed_lock_with_key:' => '๐', ':key:' => '๐', ':bulb:' => '๐ก', ':flashlight:' => '๐ฆ',
- ':high_brightness:' => '๐', ':low_brightness:' => '๐
', ':electric_plug:' => '๐', ':battery:' => '๐',
- ':calling:' => '๐ฒ', ':email:' => 'โ๏ธ', ':mailbox:' => '๐ซ', ':postbox:' => '๐ฎ',
- ':bath:' => '๐', ':bathtub:' => '๐', ':shower:' => '๐ฟ', ':toilet:' => '๐ฝ',
- ':wrench:' => '๐ง', ':nut_and_bolt:' => '๐ฉ', ':hammer:' => '๐จ', ':seat:' => '๐บ',
- ':moneybag:' => '๐ฐ', ':yen:' => '๐ด', ':dollar:' => '๐ต', ':pound:' => '๐ท',
- ':euro:' => '๐ถ', ':credit_card:' => '๐ณ', ':money_with_wings:' => '๐ธ', ':e-mail:' => '๐ง',
- ':inbox_tray:' => '๐ฅ', ':outbox_tray:' => '๐ค', ':envelope:' => 'โ๏ธ', ':incoming_envelope:' => '๐จ',
- ':postal_horn:' => '๐ฏ', ':mailbox_closed:' => '๐ช', ':mailbox_with_mail:' => '๐ฌ', ':mailbox_with_no_mail:' => '๐ญ',
- ':door:' => '๐ช', ':smoking:' => '๐ฌ', ':bomb:' => '๐ฃ', ':gun:' => '๐ซ',
- ':hocho:' => '๐ช', ':pill:' => '๐', ':syringe:' => '๐', ':page_facing_up:' => '๐',
- ':page_with_curl:' => '๐', ':bookmark_tabs:' => '๐', ':bar_chart:' => '๐', ':chart_with_upwards_trend:' => '๐',
- ':chart_with_downwards_trend:' => '๐', ':scroll:' => '๐', ':clipboard:' => '๐', ':calendar:' => '๐',
- ':date:' => '๐
', ':card_index:' => '๐', ':file_folder:' => '๐', ':open_file_folder:' => '๐',
- ':scissors:' => 'โ๏ธ', ':pushpin:' => '๐', ':paperclip:' => '๐', ':black_nib:' => 'โ๏ธ',
- ':pencil2:' => 'โ๏ธ', ':straight_ruler:' => '๐', ':triangular_ruler:' => '๐', ':closed_book:' => '๐',
- ':green_book:' => '๐', ':blue_book:' => '๐', ':orange_book:' => '๐', ':notebook:' => '๐',
- ':notebook_with_decorative_cover:' => '๐', ':ledger:' => '๐', ':books:' => '๐', ':bookmark:' => '๐',
- ':name_badge:' => '๐', ':microscope:' => '๐ฌ', ':telescope:' => '๐ญ', ':newspaper:' => '๐ฐ',
- ':football:' => '๐', ':basketball:' => '๐', ':soccer:' => 'โฝ๏ธ', ':baseball:' => 'โพ๏ธ',
- ':tennis:' => '๐พ', ':8ball:' => '๐ฑ', ':rugby_football:' => '๐', ':bowling:' => '๐ณ',
- ':golf:' => 'โณ๏ธ', ':mountain_bicyclist:' => '๐ต', ':bicyclist:' => '๐ด', ':horse_racing:' => '๐',
- ':snowboarder:' => '๐', ':swimmer:' => '๐', ':surfer:' => '๐', ':ski:' => '๐ฟ',
- ':spades:' => 'โ ๏ธ', ':hearts:' => 'โฅ๏ธ', ':clubs:' => 'โฃ๏ธ', ':diamonds:' => 'โฆ๏ธ',
- ':gem:' => '๐', ':ring:' => '๐', ':trophy:' => '๐', ':musical_score:' => '๐ผ',
- ':musical_keyboard:' => '๐น', ':violin:' => '๐ป', ':space_invader:' => '๐พ', ':video_game:' => '๐ฎ',
- ':black_joker:' => '๐', ':flower_playing_cards:' => '๐ด', ':game_die:' => '๐ฒ', ':dart:' => '๐ฏ',
- ':mahjong:' => '๐๏ธ', ':clapper:' => '๐ฌ', ':memo:' => '๐', ':pencil:' => '๐',
- ':book:' => '๐', ':art:' => '๐จ', ':microphone:' => '๐ค', ':headphones:' => '๐ง',
- ':trumpet:' => '๐บ', ':saxophone:' => '๐ท', ':guitar:' => '๐ธ', ':shoe:' => '๐',
- ':sandal:' => '๐ก', ':high_heel:' => '๐ ', ':lipstick:' => '๐', ':boot:' => '๐ข',
- ':shirt:' => '๐', ':tshirt:' => '๐', ':necktie:' => '๐', ':womans_clothes:' => '๐',
- ':dress:' => '๐', ':running_shirt_with_sash:' => '๐ฝ', ':jeans:' => '๐', ':kimono:' => '๐',
- ':bikini:' => '๐', ':ribbon:' => '๐', ':tophat:' => '๐ฉ', ':crown:' => '๐',
- ':womans_hat:' => '๐', ':mans_shoe:' => '๐', ':closed_umbrella:' => '๐', ':briefcase:' => '๐ผ',
- ':handbag:' => '๐', ':pouch:' => '๐', ':purse:' => '๐', ':eyeglasses:' => '๐',
- ':fishing_pole_and_fish:' => '๐ฃ', ':coffee:' => 'โ๏ธ', ':tea:' => '๐ต', ':sake:' => '๐ถ',
- ':baby_bottle:' => '๐ผ', ':beer:' => '๐บ', ':beers:' => '๐ป', ':cocktail:' => '๐ธ',
- ':tropical_drink:' => '๐น', ':wine_glass:' => '๐ท', ':fork_and_knife:' => '๐ด', ':pizza:' => '๐',
- ':hamburger:' => '๐', ':fries:' => '๐', ':poultry_leg:' => '๐', ':meat_on_bone:' => '๐',
- ':spaghetti:' => '๐', ':curry:' => '๐', ':fried_shrimp:' => '๐ค', ':bento:' => '๐ฑ',
- ':sushi:' => '๐ฃ', ':fish_cake:' => '๐ฅ', ':rice_ball:' => '๐', ':rice_cracker:' => '๐',
- ':rice:' => '๐', ':ramen:' => '๐', ':stew:' => '๐ฒ', ':oden:' => '๐ข',
- ':dango:' => '๐ก', ':egg:' => '๐ฅ', ':bread:' => '๐', ':doughnut:' => '๐ฉ',
- ':custard:' => '๐ฎ', ':icecream:' => '๐ฆ', ':ice_cream:' => '๐จ', ':shaved_ice:' => '๐ง',
- ':birthday:' => '๐', ':cake:' => '๐ฐ', ':cookie:' => '๐ช', ':chocolate_bar:' => '๐ซ',
- ':candy:' => '๐ฌ', ':lollipop:' => '๐ญ', ':honey_pot:' => '๐ฏ', ':apple:' => '๐',
- ':green_apple:' => '๐', ':tangerine:' => '๐', ':lemon:' => '๐', ':cherries:' => '๐',
- ':grapes:' => '๐', ':watermelon:' => '๐', ':strawberry:' => '๐', ':peach:' => '๐',
- ':melon:' => '๐', ':banana:' => '๐', ':pear:' => '๐', ':pineapple:' => '๐',
- ':sweet_potato:' => '๐ ', ':eggplant:' => '๐', ':tomato:' => '๐
', ':corn:' => '๐ฝ',
- ':house:' => '๐ ', ':house_with_garden:' => '๐ก', ':school:' => '๐ซ', ':office:' => '๐ข',
- ':post_office:' => '๐ฃ', ':hospital:' => '๐ฅ', ':bank:' => '๐ฆ', ':convenience_store:' => '๐ช',
- ':love_hotel:' => '๐ฉ', ':hotel:' => '๐จ', ':wedding:' => '๐', ':church:' => 'โช๏ธ',
- ':department_store:' => '๐ฌ', ':european_post_office:' => '๐ค', ':city_sunrise:' => '๐', ':city_sunset:' => '๐',
- ':japanese_castle:' => '๐ฏ', ':european_castle:' => '๐ฐ', ':tent:' => 'โบ๏ธ', ':factory:' => '๐ญ',
- ':tokyo_tower:' => '๐ผ', ':japan:' => '๐พ', ':mount_fuji:' => '๐ป', ':sunrise_over_mountains:' => '๐',
- ':sunrise:' => '๐
', ':stars:' => '๐ ', ':statue_of_liberty:' => '๐ฝ', ':bridge_at_night:' => '๐',
- ':carousel_horse:' => '๐ ', ':rainbow:' => '๐', ':ferris_wheel:' => '๐ก', ':fountain:' => 'โฒ๏ธ',
- ':roller_coaster:' => '๐ข', ':ship:' => '๐ข', ':speedboat:' => '๐ค', ':boat:' => 'โต๏ธ',
- ':sailboat:' => 'โต๏ธ', ':rowboat:' => '๐ฃ', ':anchor:' => 'โ๏ธ', ':rocket:' => '๐',
- ':airplane:' => 'โ๏ธ', ':helicopter:' => '๐', ':steam_locomotive:' => '๐', ':tram:' => '๐',
- ':mountain_railway:' => '๐', ':bike:' => '๐ฒ', ':aerial_tramway:' => '๐ก', ':suspension_railway:' => '๐',
- ':mountain_cableway:' => '๐ ', ':tractor:' => '๐', ':blue_car:' => '๐', ':oncoming_automobile:' => '๐',
- ':car:' => '๐', ':red_car:' => '๐', ':taxi:' => '๐', ':oncoming_taxi:' => '๐',
- ':articulated_lorry:' => '๐', ':bus:' => '๐', ':oncoming_bus:' => '๐', ':rotating_light:' => '๐จ',
- ':police_car:' => '๐', ':oncoming_police_car:' => '๐', ':fire_engine:' => '๐', ':ambulance:' => '๐',
- ':minibus:' => '๐', ':truck:' => '๐', ':train:' => '๐', ':station:' => '๐',
- ':train2:' => '๐', ':bullettrain_front:' => '๐
', ':bullettrain_side:' => '๐', ':light_rail:' => '๐',
- ':monorail:' => '๐', ':railway_car:' => '๐', ':trolleybus:' => '๐', ':ticket:' => '๐ซ',
- ':fuelpump:' => 'โฝ๏ธ', ':vertical_traffic_light:' => '๐ฆ', ':traffic_light:' => '๐ฅ', ':warning:' => 'โ ๏ธ',
- ':construction:' => '๐ง', ':beginner:' => '๐ฐ', ':atm:' => '๐ง', ':slot_machine:' => '๐ฐ',
- ':busstop:' => '๐', ':barber:' => '๐', ':hotsprings:' => 'โจ๏ธ', ':checkered_flag:' => '๐',
- ':crossed_flags:' => '๐', ':izakaya_lantern:' => '๐ฎ', ':moyai:' => '๐ฟ', ':circus_tent:' => '๐ช',
- ':performing_arts:' => '๐ญ', ':round_pushpin:' => '๐', ':triangular_flag_on_post:' => '๐ฉ', ':jp:' => '๐ฏ๐ต',
- ':kr:' => '๐ฐ๐ท', ':cn:' => '๐จ๐ณ', ':us:' => '๐บ๐ธ', ':fr:' => '๐ซ๐ท',
- ':es:' => '๐ช๐ธ', ':it:' => '๐ฎ๐น', ':ru:' => '๐ท๐บ', ':gb:' => '๐ฌ๐ง',
- ':uk:' => '๐ฌ๐ง', ':de:' => '๐ฉ๐ช', ':one:' => '1๏ธโฃ', ':two:' => '2๏ธโฃ',
- ':three:' => '3๏ธโฃ', ':four:' => '4๏ธโฃ', ':five:' => '5๏ธโฃ', ':six:' => '6๏ธโฃ',
- ':seven:' => '7๏ธโฃ', ':eight:' => '8๏ธโฃ', ':nine:' => '9๏ธโฃ', ':keycap_ten:' => '๐',
- ':1234:' => '๐ข', ':zero:' => '0๏ธโฃ', ':hash:' => '#๏ธโฃ', ':symbols:' => '๐ฃ',
- ':arrow_backward:' => 'โ๏ธ', ':arrow_down:' => 'โฌ๏ธ', ':arrow_forward:' => 'โถ๏ธ', ':arrow_left:' => 'โฌ
๏ธ',
- ':capital_abcd:' => '๐ ', ':abcd:' => '๐ก', ':abc:' => '๐ค', ':arrow_lower_left:' => 'โ๏ธ',
- ':arrow_lower_right:' => 'โ๏ธ', ':arrow_right:' => 'โก๏ธ', ':arrow_up:' => 'โฌ๏ธ', ':arrow_upper_left:' => 'โ๏ธ',
- ':arrow_upper_right:' => 'โ๏ธ', ':arrow_double_down:' => 'โฌ', ':arrow_double_up:' => 'โซ', ':arrow_down_small:' => '๐ฝ',
- ':arrow_heading_down:' => 'โคต๏ธ', ':arrow_heading_up:' => 'โคด๏ธ', ':leftwards_arrow_with_hook:' => 'โฉ๏ธ', ':arrow_right_hook:' => 'โช๏ธ',
- ':left_right_arrow:' => 'โ๏ธ', ':arrow_up_down:' => 'โ๏ธ', ':arrow_up_small:' => '๐ผ', ':arrows_clockwise:' => '๐',
- ':arrows_counterclockwise:' => '๐', ':rewind:' => 'โช', ':fast_forward:' => 'โฉ', ':information_source:' => 'โน๏ธ',
- ':ok:' => '๐', ':twisted_rightwards_arrows:' => '๐', ':repeat:' => '๐', ':repeat_one:' => '๐',
- ':new:' => '๐', ':top:' => '๐', ':up:' => '๐', ':cool:' => '๐',
- ':free:' => '๐', ':ng:' => '๐', ':cinema:' => '๐ฆ', ':koko:' => '๐',
- ':signal_strength:' => '๐ถ', ':u5272:' => '๐น', ':u5408:' => '๐ด', ':u55b6:' => '๐บ',
- ':u6307:' => '๐ฏ๏ธ', ':u6708:' => '๐ท๏ธ', ':u6709:' => '๐ถ', ':u6e80:' => '๐ต',
- ':u7121:' => '๐๏ธ', ':u7533:' => '๐ธ', ':u7a7a:' => '๐ณ', ':u7981:' => '๐ฒ',
- ':sa:' => '๐๏ธ', ':restroom:' => '๐ป', ':mens:' => '๐น', ':womens:' => '๐บ',
- ':baby_symbol:' => '๐ผ', ':no_smoking:' => '๐ญ', ':parking:' => '๐
ฟ๏ธ', ':wheelchair:' => 'โฟ๏ธ',
- ':metro:' => '๐', ':baggage_claim:' => '๐', ':accept:' => '๐', ':wc:' => '๐พ',
- ':potable_water:' => '๐ฐ', ':put_litter_in_its_place:' => '๐ฎ', ':secret:' => 'ใ๏ธ', ':congratulations:' => 'ใ๏ธ',
- ':m:' => 'โ๏ธ', ':passport_control:' => '๐', ':left_luggage:' => '๐
', ':customs:' => '๐',
- ':ideograph_advantage:' => '๐', ':cl:' => '๐', ':sos:' => '๐', ':id:' => '๐',
- ':no_entry_sign:' => '๐ซ', ':underage:' => '๐', ':no_mobile_phones:' => '๐ต', ':do_not_litter:' => '๐ฏ',
- ':non-potable_water:' => '๐ฑ', ':no_bicycles:' => '๐ณ', ':no_pedestrians:' => '๐ท', ':children_crossing:' => '๐ธ',
- ':no_entry:' => 'โ๏ธ', ':eight_spoked_asterisk:' => 'โณ๏ธ', ':eight_pointed_black_star:' => 'โด๏ธ', ':heart_decoration:' => '๐',
- ':vs:' => '๐', ':vibration_mode:' => '๐ณ', ':mobile_phone_off:' => '๐ด', ':chart:' => '๐น',
- ':currency_exchange:' => '๐ฑ', ':aries:' => 'โ๏ธ', ':taurus:' => 'โ๏ธ', ':gemini:' => 'โ๏ธ',
- ':cancer:' => 'โ๏ธ', ':leo:' => 'โ๏ธ', ':virgo:' => 'โ๏ธ', ':libra:' => 'โ๏ธ',
- ':scorpius:' => 'โ๏ธ', ':sagittarius:' => 'โ๏ธ', ':capricorn:' => 'โ๏ธ', ':aquarius:' => 'โ๏ธ',
- ':pisces:' => 'โ๏ธ', ':ophiuchus:' => 'โ', ':six_pointed_star:' => '๐ฏ', ':negative_squared_cross_mark:' => 'โ',
- ':a:' => '๐
ฐ๏ธ', ':b:' => '๐
ฑ๏ธ', ':ab:' => '๐', ':o2:' => '๐
พ๏ธ',
+ ':smile:' => '๐', ':laughing:' => '๐', ':blush:' => '๐', ':smiley:' => '๐',
+ ':relaxed:' => 'โบ๏ธ', ':smirk:' => '๐', ':heart_eyes:' => '๐', ':kissing_heart:' => '๐',
+ ':kissing_closed_eyes:' => '๐', ':flushed:' => '๐ณ', ':relieved:' => '๐', ':satisfied:' => '๐',
+ ':grin:' => '๐', ':wink:' => '๐', ':stuck_out_tongue_winking_eye:' => '๐', ':stuck_out_tongue_closed_eyes:' => '๐',
+ ':grinning:' => '๐', ':kissing:' => '๐', ':kissing_smiling_eyes:' => '๐', ':stuck_out_tongue:' => '๐',
+ ':sleeping:' => '๐ด', ':worried:' => '๐', ':frowning:' => '๐ฆ', ':anguished:' => '๐ง',
+ ':open_mouth:' => '๐ฎ', ':grimacing:' => '๐ฌ', ':confused:' => '๐', ':hushed:' => '๐ฏ',
+ ':expressionless:' => '๐', ':unamused:' => '๐', ':sweat_smile:' => '๐
', ':sweat:' => '๐',
+ ':disappointed_relieved:' => '๐ฅ', ':weary:' => '๐ฉ', ':pensive:' => '๐', ':disappointed:' => '๐',
+ ':confounded:' => '๐', ':fearful:' => '๐จ', ':cold_sweat:' => '๐ฐ', ':persevere:' => '๐ฃ',
+ ':cry:' => '๐ข', ':sob:' => '๐ญ', ':joy:' => '๐', ':astonished:' => '๐ฒ',
+ ':scream:' => '๐ฑ', ':tired_face:' => '๐ซ', ':angry:' => '๐ ', ':rage:' => '๐ก',
+ ':triumph:' => '๐ค', ':sleepy:' => '๐ช', ':yum:' => '๐', ':mask:' => '๐ท',
+ ':sunglasses:' => '๐', ':dizzy_face:' => '๐ต', ':imp:' => '๐ฟ', ':smiling_imp:' => '๐',
+ ':neutral_face:' => '๐', ':no_mouth:' => '๐ถ', ':innocent:' => '๐', ':alien:' => '๐ฝ',
+ ':yellow_heart:' => '๐', ':blue_heart:' => '๐', ':purple_heart:' => '๐', ':heart:' => 'โค๏ธ',
+ ':green_heart:' => '๐', ':broken_heart:' => '๐', ':heartbeat:' => '๐', ':heartpulse:' => '๐',
+ ':two_hearts:' => '๐', ':revolving_hearts:' => '๐', ':cupid:' => '๐', ':sparkling_heart:' => '๐',
+ ':sparkles:' => 'โจ', ':star:' => 'โญ๏ธ', ':star2:' => '๐', ':dizzy:' => '๐ซ',
+ ':boom:' => '๐ฅ', ':collision:' => '๐ฅ', ':anger:' => '๐ข', ':exclamation:' => 'โ๏ธ',
+ ':question:' => 'โ', ':grey_exclamation:' => 'โ', ':grey_question:' => 'โ', ':zzz:' => '๐ค',
+ ':dash:' => '๐จ', ':sweat_drops:' => '๐ฆ', ':notes:' => '๐ถ', ':musical_note:' => '๐ต',
+ ':fire:' => '๐ฅ', ':hankey:' => '๐ฉ', ':poop:' => '๐ฉ', ':shit:' => '๐ฉ',
+ ':+1:' => '๐', ':thumbsup:' => '๐', ':-1:' => '๐', ':thumbsdown:' => '๐',
+ ':ok_hand:' => '๐', ':punch:' => '๐', ':facepunch:' => '๐', ':fist:' => 'โ',
+ ':v:' => 'โ๏ธ', ':wave:' => '๐', ':hand:' => 'โ', ':raised_hand:' => 'โ',
+ ':open_hands:' => '๐', ':point_up:' => 'โ๏ธ', ':point_down:' => '๐', ':point_left:' => '๐',
+ ':point_right:' => '๐', ':raised_hands:' => '๐', ':pray:' => '๐', ':point_up_2:' => '๐',
+ ':clap:' => '๐', ':muscle:' => '๐ช', ':metal:' => '๐ค', ':fu:' => '๐',
+ ':walking:' => '๐ถ', ':runner:' => '๐', ':running:' => '๐', ':couple:' => '๐ซ',
+ ':family:' => '๐ช', ':two_men_holding_hands:' => '๐ฌ', ':two_women_holding_hands:' => '๐ญ', ':dancer:' => '๐',
+ ':dancers:' => '๐ฏ', ':ok_woman:' => '๐', ':no_good:' => '๐
', ':information_desk_person:' => '๐',
+ ':raising_hand:' => '๐', ':bride_with_veil:' => '๐ฐ', ':person_with_pouting_face:' => '๐', ':person_frowning:' => '๐',
+ ':bow:' => '๐', ':couple_with_heart:' => '๐', ':massage:' => '๐', ':haircut:' => '๐',
+ ':nail_care:' => '๐
', ':boy:' => '๐ฆ', ':girl:' => '๐ง', ':woman:' => '๐ฉ',
+ ':man:' => '๐จ', ':baby:' => '๐ถ', ':older_woman:' => '๐ต', ':older_man:' => '๐ด',
+ ':person_with_blond_hair:' => '๐ฑ', ':man_with_gua_pi_mao:' => '๐ฒ', ':man_with_turban:' => '๐ณ', ':construction_worker:' => '๐ท',
+ ':cop:' => '๐ฎ', ':angel:' => '๐ผ', ':princess:' => '๐ธ', ':smiley_cat:' => '๐บ',
+ ':smile_cat:' => '๐ธ', ':heart_eyes_cat:' => '๐ป', ':kissing_cat:' => '๐ฝ', ':smirk_cat:' => '๐ผ',
+ ':scream_cat:' => '๐', ':crying_cat_face:' => '๐ฟ', ':joy_cat:' => '๐น', ':pouting_cat:' => '๐พ',
+ ':japanese_ogre:' => '๐น', ':japanese_goblin:' => '๐บ', ':see_no_evil:' => '๐', ':hear_no_evil:' => '๐',
+ ':speak_no_evil:' => '๐', ':guardsman:' => '๐', ':skull:' => '๐', ':feet:' => '๐พ',
+ ':lips:' => '๐', ':kiss:' => '๐', ':droplet:' => '๐ง', ':ear:' => '๐',
+ ':eyes:' => '๐', ':nose:' => '๐', ':tongue:' => '๐
', ':love_letter:' => '๐',
+ ':bust_in_silhouette:' => '๐ค', ':busts_in_silhouette:' => '๐ฅ', ':speech_balloon:' => '๐ฌ', ':thought_balloon:' => '๐ญ',
+ ':sunny:' => 'โ๏ธ', ':umbrella:' => 'โ๏ธ', ':cloud:' => 'โ๏ธ', ':snowflake:' => 'โ๏ธ',
+ ':snowman:' => 'โ๏ธ', ':zap:' => 'โก๏ธ', ':cyclone:' => '๐', ':foggy:' => '๐',
+ ':ocean:' => '๐', ':cat:' => '๐ฑ', ':dog:' => '๐ถ', ':mouse:' => '๐ญ',
+ ':hamster:' => '๐น', ':rabbit:' => '๐ฐ', ':wolf:' => '๐บ', ':frog:' => '๐ธ',
+ ':tiger:' => '๐ฏ', ':koala:' => '๐จ', ':bear:' => '๐ป', ':pig:' => '๐ท',
+ ':pig_nose:' => '๐ฝ', ':cow:' => '๐ฎ', ':boar:' => '๐', ':monkey_face:' => '๐ต',
+ ':monkey:' => '๐', ':horse:' => '๐ด', ':racehorse:' => '๐', ':camel:' => '๐ซ',
+ ':sheep:' => '๐', ':elephant:' => '๐', ':panda_face:' => '๐ผ', ':snake:' => '๐',
+ ':bird:' => '๐ฆ', ':baby_chick:' => '๐ค', ':hatched_chick:' => '๐ฅ', ':hatching_chick:' => '๐ฃ',
+ ':chicken:' => '๐', ':penguin:' => '๐ง', ':turtle:' => '๐ข', ':bug:' => '๐',
+ ':honeybee:' => '๐', ':ant:' => '๐', ':beetle:' => '๐', ':snail:' => '๐',
+ ':octopus:' => '๐', ':tropical_fish:' => '๐ ', ':fish:' => '๐', ':whale:' => '๐ณ',
+ ':whale2:' => '๐', ':dolphin:' => '๐ฌ', ':cow2:' => '๐', ':ram:' => '๐',
+ ':rat:' => '๐', ':water_buffalo:' => '๐', ':tiger2:' => '๐
', ':rabbit2:' => '๐',
+ ':dragon:' => '๐', ':goat:' => '๐', ':rooster:' => '๐', ':dog2:' => '๐',
+ ':pig2:' => '๐', ':mouse2:' => '๐', ':ox:' => '๐', ':dragon_face:' => '๐ฒ',
+ ':blowfish:' => '๐ก', ':crocodile:' => '๐', ':dromedary_camel:' => '๐ช', ':leopard:' => '๐',
+ ':cat2:' => '๐', ':poodle:' => '๐ฉ', ':crab' => '๐ฆ', ':paw_prints:' => '๐พ', ':bouquet:' => '๐',
+ ':cherry_blossom:' => '๐ธ', ':tulip:' => '๐ท', ':four_leaf_clover:' => '๐', ':rose:' => '๐น',
+ ':sunflower:' => '๐ป', ':hibiscus:' => '๐บ', ':maple_leaf:' => '๐', ':leaves:' => '๐',
+ ':fallen_leaf:' => '๐', ':herb:' => '๐ฟ', ':mushroom:' => '๐', ':cactus:' => '๐ต',
+ ':palm_tree:' => '๐ด', ':evergreen_tree:' => '๐ฒ', ':deciduous_tree:' => '๐ณ', ':chestnut:' => '๐ฐ',
+ ':seedling:' => '๐ฑ', ':blossom:' => '๐ผ', ':ear_of_rice:' => '๐พ', ':shell:' => '๐',
+ ':globe_with_meridians:' => '๐', ':sun_with_face:' => '๐', ':full_moon_with_face:' => '๐', ':new_moon_with_face:' => '๐',
+ ':new_moon:' => '๐', ':waxing_crescent_moon:' => '๐', ':first_quarter_moon:' => '๐', ':waxing_gibbous_moon:' => '๐',
+ ':full_moon:' => '๐', ':waning_gibbous_moon:' => '๐', ':last_quarter_moon:' => '๐', ':waning_crescent_moon:' => '๐',
+ ':last_quarter_moon_with_face:' => '๐', ':first_quarter_moon_with_face:' => '๐', ':moon:' => '๐', ':earth_africa:' => '๐',
+ ':earth_americas:' => '๐', ':earth_asia:' => '๐', ':volcano:' => '๐', ':milky_way:' => '๐',
+ ':partly_sunny:' => 'โ
๏ธ', ':bamboo:' => '๐', ':gift_heart:' => '๐', ':dolls:' => '๐',
+ ':school_satchel:' => '๐', ':mortar_board:' => '๐', ':flags:' => '๐', ':fireworks:' => '๐',
+ ':sparkler:' => '๐', ':wind_chime:' => '๐', ':rice_scene:' => '๐', ':jack_o_lantern:' => '๐',
+ ':ghost:' => '๐ป', ':santa:' => '๐
', ':christmas_tree:' => '๐', ':gift:' => '๐',
+ ':bell:' => '๐', ':no_bell:' => '๐', ':tanabata_tree:' => '๐', ':tada:' => '๐',
+ ':confetti_ball:' => '๐', ':balloon:' => '๐', ':crystal_ball:' => '๐ฎ', ':cd:' => '๐ฟ',
+ ':dvd:' => '๐', ':floppy_disk:' => '๐พ', ':camera:' => '๐ท', ':video_camera:' => '๐น',
+ ':movie_camera:' => '๐ฅ', ':computer:' => '๐ป', ':tv:' => '๐บ', ':iphone:' => '๐ฑ',
+ ':phone:' => 'โ๏ธ', ':telephone:' => 'โ๏ธ', ':telephone_receiver:' => '๐', ':pager:' => '๐',
+ ':fax:' => '๐ ', ':minidisc:' => '๐ฝ', ':vhs:' => '๐ผ', ':sound:' => '๐',
+ ':speaker:' => '๐', ':mute:' => '๐', ':loudspeaker:' => '๐ข', ':mega:' => '๐ฃ',
+ ':hourglass:' => 'โ๏ธ', ':hourglass_flowing_sand:' => 'โณ', ':alarm_clock:' => 'โฐ', ':watch:' => 'โ๏ธ',
+ ':radio:' => '๐ป', ':satellite:' => '๐ก', ':loop:' => 'โฟ', ':mag:' => '๐',
+ ':mag_right:' => '๐', ':unlock:' => '๐', ':lock:' => '๐', ':lock_with_ink_pen:' => '๐',
+ ':closed_lock_with_key:' => '๐', ':key:' => '๐', ':bulb:' => '๐ก', ':flashlight:' => '๐ฆ',
+ ':high_brightness:' => '๐', ':low_brightness:' => '๐
', ':electric_plug:' => '๐', ':battery:' => '๐',
+ ':calling:' => '๐ฒ', ':email:' => 'โ๏ธ', ':mailbox:' => '๐ซ', ':postbox:' => '๐ฎ',
+ ':bath:' => '๐', ':bathtub:' => '๐', ':shower:' => '๐ฟ', ':toilet:' => '๐ฝ',
+ ':wrench:' => '๐ง', ':nut_and_bolt:' => '๐ฉ', ':hammer:' => '๐จ', ':seat:' => '๐บ',
+ ':moneybag:' => '๐ฐ', ':yen:' => '๐ด', ':dollar:' => '๐ต', ':pound:' => '๐ท',
+ ':euro:' => '๐ถ', ':credit_card:' => '๐ณ', ':money_with_wings:' => '๐ธ', ':e-mail:' => '๐ง',
+ ':inbox_tray:' => '๐ฅ', ':outbox_tray:' => '๐ค', ':envelope:' => 'โ๏ธ', ':incoming_envelope:' => '๐จ',
+ ':postal_horn:' => '๐ฏ', ':mailbox_closed:' => '๐ช', ':mailbox_with_mail:' => '๐ฌ', ':mailbox_with_no_mail:' => '๐ญ',
+ ':door:' => '๐ช', ':smoking:' => '๐ฌ', ':bomb:' => '๐ฃ', ':gun:' => '๐ซ',
+ ':hocho:' => '๐ช', ':pill:' => '๐', ':syringe:' => '๐', ':page_facing_up:' => '๐',
+ ':page_with_curl:' => '๐', ':bookmark_tabs:' => '๐', ':bar_chart:' => '๐', ':chart_with_upwards_trend:' => '๐',
+ ':chart_with_downwards_trend:' => '๐', ':scroll:' => '๐', ':clipboard:' => '๐', ':calendar:' => '๐',
+ ':date:' => '๐
', ':card_index:' => '๐', ':file_folder:' => '๐', ':open_file_folder:' => '๐',
+ ':scissors:' => 'โ๏ธ', ':pushpin:' => '๐', ':paperclip:' => '๐', ':black_nib:' => 'โ๏ธ',
+ ':pencil2:' => 'โ๏ธ', ':straight_ruler:' => '๐', ':triangular_ruler:' => '๐', ':closed_book:' => '๐',
+ ':green_book:' => '๐', ':blue_book:' => '๐', ':orange_book:' => '๐', ':notebook:' => '๐',
+ ':notebook_with_decorative_cover:' => '๐', ':ledger:' => '๐', ':books:' => '๐', ':bookmark:' => '๐',
+ ':name_badge:' => '๐', ':microscope:' => '๐ฌ', ':telescope:' => '๐ญ', ':newspaper:' => '๐ฐ',
+ ':football:' => '๐', ':basketball:' => '๐', ':soccer:' => 'โฝ๏ธ', ':baseball:' => 'โพ๏ธ',
+ ':tennis:' => '๐พ', ':8ball:' => '๐ฑ', ':rugby_football:' => '๐', ':bowling:' => '๐ณ',
+ ':golf:' => 'โณ๏ธ', ':mountain_bicyclist:' => '๐ต', ':bicyclist:' => '๐ด', ':horse_racing:' => '๐',
+ ':snowboarder:' => '๐', ':swimmer:' => '๐', ':surfer:' => '๐', ':ski:' => '๐ฟ',
+ ':spades:' => 'โ ๏ธ', ':hearts:' => 'โฅ๏ธ', ':clubs:' => 'โฃ๏ธ', ':diamonds:' => 'โฆ๏ธ',
+ ':gem:' => '๐', ':ring:' => '๐', ':trophy:' => '๐', ':musical_score:' => '๐ผ',
+ ':musical_keyboard:' => '๐น', ':violin:' => '๐ป', ':space_invader:' => '๐พ', ':video_game:' => '๐ฎ',
+ ':black_joker:' => '๐', ':flower_playing_cards:' => '๐ด', ':game_die:' => '๐ฒ', ':dart:' => '๐ฏ',
+ ':mahjong:' => '๐๏ธ', ':clapper:' => '๐ฌ', ':memo:' => '๐', ':pencil:' => '๐',
+ ':book:' => '๐', ':art:' => '๐จ', ':microphone:' => '๐ค', ':headphones:' => '๐ง',
+ ':trumpet:' => '๐บ', ':saxophone:' => '๐ท', ':guitar:' => '๐ธ', ':shoe:' => '๐',
+ ':sandal:' => '๐ก', ':high_heel:' => '๐ ', ':lipstick:' => '๐', ':boot:' => '๐ข',
+ ':shirt:' => '๐', ':tshirt:' => '๐', ':necktie:' => '๐', ':womans_clothes:' => '๐',
+ ':dress:' => '๐', ':running_shirt_with_sash:' => '๐ฝ', ':jeans:' => '๐', ':kimono:' => '๐',
+ ':bikini:' => '๐', ':ribbon:' => '๐', ':tophat:' => '๐ฉ', ':crown:' => '๐',
+ ':womans_hat:' => '๐', ':mans_shoe:' => '๐', ':closed_umbrella:' => '๐', ':briefcase:' => '๐ผ',
+ ':handbag:' => '๐', ':pouch:' => '๐', ':purse:' => '๐', ':eyeglasses:' => '๐',
+ ':fishing_pole_and_fish:' => '๐ฃ', ':coffee:' => 'โ๏ธ', ':tea:' => '๐ต', ':sake:' => '๐ถ',
+ ':baby_bottle:' => '๐ผ', ':beer:' => '๐บ', ':beers:' => '๐ป', ':cocktail:' => '๐ธ',
+ ':tropical_drink:' => '๐น', ':wine_glass:' => '๐ท', ':fork_and_knife:' => '๐ด', ':pizza:' => '๐',
+ ':hamburger:' => '๐', ':fries:' => '๐', ':poultry_leg:' => '๐', ':meat_on_bone:' => '๐',
+ ':spaghetti:' => '๐', ':curry:' => '๐', ':fried_shrimp:' => '๐ค', ':bento:' => '๐ฑ',
+ ':sushi:' => '๐ฃ', ':fish_cake:' => '๐ฅ', ':rice_ball:' => '๐', ':rice_cracker:' => '๐',
+ ':rice:' => '๐', ':ramen:' => '๐', ':stew:' => '๐ฒ', ':oden:' => '๐ข',
+ ':dango:' => '๐ก', ':egg:' => '๐ฅ', ':bread:' => '๐', ':doughnut:' => '๐ฉ',
+ ':custard:' => '๐ฎ', ':icecream:' => '๐ฆ', ':ice_cream:' => '๐จ', ':shaved_ice:' => '๐ง',
+ ':birthday:' => '๐', ':cake:' => '๐ฐ', ':cookie:' => '๐ช', ':chocolate_bar:' => '๐ซ',
+ ':candy:' => '๐ฌ', ':lollipop:' => '๐ญ', ':honey_pot:' => '๐ฏ', ':apple:' => '๐',
+ ':green_apple:' => '๐', ':tangerine:' => '๐', ':lemon:' => '๐', ':cherries:' => '๐',
+ ':grapes:' => '๐', ':watermelon:' => '๐', ':strawberry:' => '๐', ':peach:' => '๐',
+ ':melon:' => '๐', ':banana:' => '๐', ':pear:' => '๐', ':pineapple:' => '๐',
+ ':sweet_potato:' => '๐ ', ':eggplant:' => '๐', ':tomato:' => '๐
', ':corn:' => '๐ฝ',
+ ':house:' => '๐ ', ':house_with_garden:' => '๐ก', ':school:' => '๐ซ', ':office:' => '๐ข',
+ ':post_office:' => '๐ฃ', ':hospital:' => '๐ฅ', ':bank:' => '๐ฆ', ':convenience_store:' => '๐ช',
+ ':love_hotel:' => '๐ฉ', ':hotel:' => '๐จ', ':wedding:' => '๐', ':church:' => 'โช๏ธ',
+ ':department_store:' => '๐ฌ', ':european_post_office:' => '๐ค', ':city_sunrise:' => '๐', ':city_sunset:' => '๐',
+ ':japanese_castle:' => '๐ฏ', ':european_castle:' => '๐ฐ', ':tent:' => 'โบ๏ธ', ':factory:' => '๐ญ',
+ ':tokyo_tower:' => '๐ผ', ':japan:' => '๐พ', ':mount_fuji:' => '๐ป', ':sunrise_over_mountains:' => '๐',
+ ':sunrise:' => '๐
', ':stars:' => '๐ ', ':statue_of_liberty:' => '๐ฝ', ':bridge_at_night:' => '๐',
+ ':carousel_horse:' => '๐ ', ':rainbow:' => '๐', ':ferris_wheel:' => '๐ก', ':fountain:' => 'โฒ๏ธ',
+ ':roller_coaster:' => '๐ข', ':ship:' => '๐ข', ':speedboat:' => '๐ค', ':boat:' => 'โต๏ธ',
+ ':sailboat:' => 'โต๏ธ', ':rowboat:' => '๐ฃ', ':anchor:' => 'โ๏ธ', ':rocket:' => '๐',
+ ':airplane:' => 'โ๏ธ', ':helicopter:' => '๐', ':steam_locomotive:' => '๐', ':tram:' => '๐',
+ ':mountain_railway:' => '๐', ':bike:' => '๐ฒ', ':aerial_tramway:' => '๐ก', ':suspension_railway:' => '๐',
+ ':mountain_cableway:' => '๐ ', ':tractor:' => '๐', ':blue_car:' => '๐', ':oncoming_automobile:' => '๐',
+ ':car:' => '๐', ':red_car:' => '๐', ':taxi:' => '๐', ':oncoming_taxi:' => '๐',
+ ':articulated_lorry:' => '๐', ':bus:' => '๐', ':oncoming_bus:' => '๐', ':rotating_light:' => '๐จ',
+ ':police_car:' => '๐', ':oncoming_police_car:' => '๐', ':fire_engine:' => '๐', ':ambulance:' => '๐',
+ ':minibus:' => '๐', ':truck:' => '๐', ':train:' => '๐', ':station:' => '๐',
+ ':train2:' => '๐', ':bullettrain_front:' => '๐
', ':bullettrain_side:' => '๐', ':light_rail:' => '๐',
+ ':monorail:' => '๐', ':railway_car:' => '๐', ':trolleybus:' => '๐', ':ticket:' => '๐ซ',
+ ':fuelpump:' => 'โฝ๏ธ', ':vertical_traffic_light:' => '๐ฆ', ':traffic_light:' => '๐ฅ', ':warning:' => 'โ ๏ธ',
+ ':construction:' => '๐ง', ':beginner:' => '๐ฐ', ':atm:' => '๐ง', ':slot_machine:' => '๐ฐ',
+ ':busstop:' => '๐', ':barber:' => '๐', ':hotsprings:' => 'โจ๏ธ', ':checkered_flag:' => '๐',
+ ':crossed_flags:' => '๐', ':izakaya_lantern:' => '๐ฎ', ':moyai:' => '๐ฟ', ':circus_tent:' => '๐ช',
+ ':performing_arts:' => '๐ญ', ':round_pushpin:' => '๐', ':triangular_flag_on_post:' => '๐ฉ', ':jp:' => '๐ฏ๐ต',
+ ':kr:' => '๐ฐ๐ท', ':cn:' => '๐จ๐ณ', ':us:' => '๐บ๐ธ', ':fr:' => '๐ซ๐ท',
+ ':es:' => '๐ช๐ธ', ':it:' => '๐ฎ๐น', ':ru:' => '๐ท๐บ', ':gb:' => '๐ฌ๐ง',
+ ':uk:' => '๐ฌ๐ง', ':de:' => '๐ฉ๐ช', ':one:' => '1๏ธโฃ', ':two:' => '2๏ธโฃ',
+ ':three:' => '3๏ธโฃ', ':four:' => '4๏ธโฃ', ':five:' => '5๏ธโฃ', ':six:' => '6๏ธโฃ',
+ ':seven:' => '7๏ธโฃ', ':eight:' => '8๏ธโฃ', ':nine:' => '9๏ธโฃ', ':keycap_ten:' => '๐',
+ ':1234:' => '๐ข', ':zero:' => '0๏ธโฃ', ':hash:' => '#๏ธโฃ', ':symbols:' => '๐ฃ',
+ ':arrow_backward:' => 'โ๏ธ', ':arrow_down:' => 'โฌ๏ธ', ':arrow_forward:' => 'โถ๏ธ', ':arrow_left:' => 'โฌ
๏ธ',
+ ':capital_abcd:' => '๐ ', ':abcd:' => '๐ก', ':abc:' => '๐ค', ':arrow_lower_left:' => 'โ๏ธ',
+ ':arrow_lower_right:' => 'โ๏ธ', ':arrow_right:' => 'โก๏ธ', ':arrow_up:' => 'โฌ๏ธ', ':arrow_upper_left:' => 'โ๏ธ',
+ ':arrow_upper_right:' => 'โ๏ธ', ':arrow_double_down:' => 'โฌ', ':arrow_double_up:' => 'โซ', ':arrow_down_small:' => '๐ฝ',
+ ':arrow_heading_down:' => 'โคต๏ธ', ':arrow_heading_up:' => 'โคด๏ธ', ':leftwards_arrow_with_hook:' => 'โฉ๏ธ', ':arrow_right_hook:' => 'โช๏ธ',
+ ':left_right_arrow:' => 'โ๏ธ', ':arrow_up_down:' => 'โ๏ธ', ':arrow_up_small:' => '๐ผ', ':arrows_clockwise:' => '๐',
+ ':arrows_counterclockwise:' => '๐', ':rewind:' => 'โช', ':fast_forward:' => 'โฉ', ':information_source:' => 'โน๏ธ',
+ ':ok:' => '๐', ':twisted_rightwards_arrows:' => '๐', ':repeat:' => '๐', ':repeat_one:' => '๐',
+ ':new:' => '๐', ':top:' => '๐', ':up:' => '๐', ':cool:' => '๐',
+ ':free:' => '๐', ':ng:' => '๐', ':cinema:' => '๐ฆ', ':koko:' => '๐',
+ ':signal_strength:' => '๐ถ', ':u5272:' => '๐น', ':u5408:' => '๐ด', ':u55b6:' => '๐บ',
+ ':u6307:' => '๐ฏ๏ธ', ':u6708:' => '๐ท๏ธ', ':u6709:' => '๐ถ', ':u6e80:' => '๐ต',
+ ':u7121:' => '๐๏ธ', ':u7533:' => '๐ธ', ':u7a7a:' => '๐ณ', ':u7981:' => '๐ฒ',
+ ':sa:' => '๐๏ธ', ':restroom:' => '๐ป', ':mens:' => '๐น', ':womens:' => '๐บ',
+ ':baby_symbol:' => '๐ผ', ':no_smoking:' => '๐ญ', ':parking:' => '๐
ฟ๏ธ', ':wheelchair:' => 'โฟ๏ธ',
+ ':metro:' => '๐', ':baggage_claim:' => '๐', ':accept:' => '๐', ':wc:' => '๐พ',
+ ':potable_water:' => '๐ฐ', ':put_litter_in_its_place:' => '๐ฎ', ':secret:' => 'ใ๏ธ', ':congratulations:' => 'ใ๏ธ',
+ ':m:' => 'โ๏ธ', ':passport_control:' => '๐', ':left_luggage:' => '๐
', ':customs:' => '๐',
+ ':ideograph_advantage:' => '๐', ':cl:' => '๐', ':sos:' => '๐', ':id:' => '๐',
+ ':no_entry_sign:' => '๐ซ', ':underage:' => '๐', ':no_mobile_phones:' => '๐ต', ':do_not_litter:' => '๐ฏ',
+ ':non-potable_water:' => '๐ฑ', ':no_bicycles:' => '๐ณ', ':no_pedestrians:' => '๐ท', ':children_crossing:' => '๐ธ',
+ ':no_entry:' => 'โ๏ธ', ':eight_spoked_asterisk:' => 'โณ๏ธ', ':eight_pointed_black_star:' => 'โด๏ธ', ':heart_decoration:' => '๐',
+ ':vs:' => '๐', ':vibration_mode:' => '๐ณ', ':mobile_phone_off:' => '๐ด', ':chart:' => '๐น',
+ ':currency_exchange:' => '๐ฑ', ':aries:' => 'โ๏ธ', ':taurus:' => 'โ๏ธ', ':gemini:' => 'โ๏ธ',
+ ':cancer:' => 'โ๏ธ', ':leo:' => 'โ๏ธ', ':virgo:' => 'โ๏ธ', ':libra:' => 'โ๏ธ',
+ ':scorpius:' => 'โ๏ธ', ':sagittarius:' => 'โ๏ธ', ':capricorn:' => 'โ๏ธ', ':aquarius:' => 'โ๏ธ',
+ ':pisces:' => 'โ๏ธ', ':ophiuchus:' => 'โ', ':six_pointed_star:' => '๐ฏ', ':negative_squared_cross_mark:' => 'โ',
+ ':a:' => '๐
ฐ๏ธ', ':b:' => '๐
ฑ๏ธ', ':ab:' => '๐', ':o2:' => '๐
พ๏ธ',
':diamond_shape_with_a_dot_inside:' => '๐ ', ':recycle:' => 'โป๏ธ', ':end:' => '๐', ':on:' => '๐',
- ':soon:' => '๐', ':clock1:' => '๐', ':clock130:' => '๐', ':clock10:' => '๐',
- ':clock1030:' => '๐ฅ', ':clock11:' => '๐', ':clock1130:' => '๐ฆ', ':clock12:' => '๐',
- ':clock1230:' => '๐ง', ':clock2:' => '๐', ':clock230:' => '๐', ':clock3:' => '๐',
- ':clock330:' => '๐', ':clock4:' => '๐', ':clock430:' => '๐', ':clock5:' => '๐',
- ':clock530:' => '๐ ', ':clock6:' => '๐', ':clock630:' => '๐ก', ':clock7:' => '๐',
- ':clock730:' => '๐ข', ':clock8:' => '๐', ':clock830:' => '๐ฃ', ':clock9:' => '๐',
- ':clock930:' => '๐ค', ':heavy_dollar_sign:' => '๐ฒ', ':copyright:' => 'ยฉ๏ธ', ':registered:' => 'ยฎ๏ธ',
- ':tm:' => 'โข๏ธ', ':x:' => 'โ', ':heavy_exclamation_mark:' => 'โ๏ธ', ':bangbang:' => 'โผ๏ธ',
- ':interrobang:' => 'โ๏ธ', ':o:' => 'โญ๏ธ', ':heavy_multiplication_x:' => 'โ๏ธ', ':heavy_plus_sign:' => 'โ',
- ':heavy_minus_sign:' => 'โ', ':heavy_division_sign:' => 'โ', ':white_flower:' => '๐ฎ', ':100:' => '๐ฏ',
- ':heavy_check_mark:' => 'โ๏ธ', ':ballot_box_with_check:' => 'โ๏ธ', ':radio_button:' => '๐', ':link:' => '๐',
- ':curly_loop:' => 'โฐ', ':wavy_dash:' => 'ใฐ๏ธ', ':part_alternation_mark:' => 'ใฝ๏ธ', ':trident:' => '๐ฑ',
- ':white_check_mark:' => 'โ
', ':black_square_button:' => '๐ฒ', ':white_square_button:' => '๐ณ', ':black_circle:' => 'โซ๏ธ',
- ':white_circle:' => 'โช๏ธ', ':red_circle:' => '๐ด', ':large_blue_circle:' => '๐ต', ':large_blue_diamond:' => '๐ท',
- ':large_orange_diamond:' => '๐ถ', ':small_blue_diamond:' => '๐น', ':small_orange_diamond:' => '๐ธ', ':small_red_triangle:' => '๐บ',
- ':small_red_triangle_down:' => '๐ป', ':black_small_square:' => 'โช๏ธ', ':black_medium_small_square:' => 'โพ', ':black_medium_square:' => 'โผ๏ธ',
- ':black_large_square:' => 'โฌ', ':white_small_square:' => 'โซ๏ธ', ':white_medium_small_square:' => 'โฝ', ':white_medium_square:' => 'โป๏ธ',
- ':white_large_square:' => 'โฌ',
+ ':soon:' => '๐', ':clock1:' => '๐', ':clock130:' => '๐', ':clock10:' => '๐',
+ ':clock1030:' => '๐ฅ', ':clock11:' => '๐', ':clock1130:' => '๐ฆ', ':clock12:' => '๐',
+ ':clock1230:' => '๐ง', ':clock2:' => '๐', ':clock230:' => '๐', ':clock3:' => '๐',
+ ':clock330:' => '๐', ':clock4:' => '๐', ':clock430:' => '๐', ':clock5:' => '๐',
+ ':clock530:' => '๐ ', ':clock6:' => '๐', ':clock630:' => '๐ก', ':clock7:' => '๐',
+ ':clock730:' => '๐ข', ':clock8:' => '๐', ':clock830:' => '๐ฃ', ':clock9:' => '๐',
+ ':clock930:' => '๐ค', ':heavy_dollar_sign:' => '๐ฒ', ':copyright:' => 'ยฉ๏ธ', ':registered:' => 'ยฎ๏ธ',
+ ':tm:' => 'โข๏ธ', ':x:' => 'โ', ':heavy_exclamation_mark:' => 'โ๏ธ', ':bangbang:' => 'โผ๏ธ',
+ ':interrobang:' => 'โ๏ธ', ':o:' => 'โญ๏ธ', ':heavy_multiplication_x:' => 'โ๏ธ', ':heavy_plus_sign:' => 'โ',
+ ':heavy_minus_sign:' => 'โ', ':heavy_division_sign:' => 'โ', ':white_flower:' => '๐ฎ', ':100:' => '๐ฏ',
+ ':heavy_check_mark:' => 'โ๏ธ', ':ballot_box_with_check:' => 'โ๏ธ', ':radio_button:' => '๐', ':link:' => '๐',
+ ':curly_loop:' => 'โฐ', ':wavy_dash:' => 'ใฐ๏ธ', ':part_alternation_mark:' => 'ใฝ๏ธ', ':trident:' => '๐ฑ',
+ ':white_check_mark:' => 'โ
', ':black_square_button:' => '๐ฒ', ':white_square_button:' => '๐ณ', ':black_circle:' => 'โซ๏ธ',
+ ':white_circle:' => 'โช๏ธ', ':red_circle:' => '๐ด', ':large_blue_circle:' => '๐ต', ':large_blue_diamond:' => '๐ท',
+ ':large_orange_diamond:' => '๐ถ', ':small_blue_diamond:' => '๐น', ':small_orange_diamond:' => '๐ธ', ':small_red_triangle:' => '๐บ',
+ ':small_red_triangle_down:' => '๐ป', ':black_small_square:' => 'โช๏ธ', ':black_medium_small_square:' => 'โพ', ':black_medium_square:' => 'โผ๏ธ',
+ ':black_large_square:' => 'โฌ', ':white_small_square:' => 'โซ๏ธ', ':white_medium_small_square:' => 'โฝ', ':white_medium_square:' => 'โป๏ธ',
+ ':white_large_square:' => 'โฌ',
];
- if (preg_match('/^(:)([^: ]*?)(:)/', $excerpt['text'], $matches)) {
+ if (\preg_match('/^(:)([^: ]*?)(:)/', $excerpt['text'], $matches)) {
return [
- 'extent' => strlen($matches[0]),
+ 'extent' => \strlen($matches[0]),
'element' => [
- 'text' => str_replace(array_keys($emojiMap), $emojiMap, $matches[0]),
+ 'text' => \str_replace(\array_keys($emojiMap), $emojiMap, $matches[0]),
],
];
}
@@ -554,9 +554,9 @@ class Markdown
protected function inlineMark($excerpt)
{
- if (preg_match('/^(==)([^=]*?)(==)/', $excerpt['text'], $matches)) {
+ if (\preg_match('/^(==)([^=]*?)(==)/', $excerpt['text'], $matches)) {
return [
- 'extent' => strlen($matches[0]),
+ 'extent' => \strlen($matches[0]),
'element' => [
'name' => 'mark',
'text' => $matches[2],
@@ -569,9 +569,9 @@ class Markdown
protected function inlineKeystrokes($excerpt)
{
- if (preg_match('/^(? strlen($matches[0]),
+ 'extent' => \strlen($matches[0]),
'element' => [
'name' => 'kbd',
'text' => $matches[1],
@@ -584,12 +584,12 @@ class Markdown
protected function inlineSuperscript($excerpt)
{
- if (preg_match('/(?:\^(?!\^)([^\^ ]*)\^(?!\^))/', $excerpt['text'], $matches)) {
+ if (\preg_match('/(?:\^(?!\^)([^\^ ]*)\^(?!\^))/', $excerpt['text'], $matches)) {
return [
- 'extent' => strlen($matches[0]),
+ 'extent' => \strlen($matches[0]),
'element' => [
- 'name' => 'sup',
- 'text' => $matches[1],
+ 'name' => 'sup',
+ 'text' => $matches[1],
'function' => 'lineElements',
],
];
@@ -600,12 +600,12 @@ class Markdown
protected function inlineSubscript($excerpt)
{
- if (preg_match('/(?:~(?!~)([^~ ]*)~(?!~))/', $excerpt['text'], $matches)) {
+ if (\preg_match('/(?:~(?!~)([^~ ]*)~(?!~))/', $excerpt['text'], $matches)) {
return [
- 'extent' => strlen($matches[0]),
+ 'extent' => \strlen($matches[0]),
'element' => [
- 'name' => 'sub',
- 'text' => $matches[1],
+ 'name' => 'sub',
+ 'text' => $matches[1],
'function' => 'lineElements',
],
];
@@ -617,21 +617,21 @@ class Markdown
protected function inlineTypographer($excerpt)
{
$substitutions = [
- '/\(c\)/i' => '©',
- '/\(r\)/i' => '®',
- '/\(tm\)/i' => '™',
- '/\(p\)/i' => '¶',
- '/\+-/i' => '±',
+ '/\(c\)/i' => '©',
+ '/\(r\)/i' => '®',
+ '/\(tm\)/i' => '™',
+ '/\(p\)/i' => '¶',
+ '/\+-/i' => '±',
'/\.{4,}|\.{2}/i' => '...',
- '/\!\.{3,}/i' => '!..',
- '/\?\.{3,}/i' => '?..',
+ '/\!\.{3,}/i' => '!..',
+ '/\?\.{3,}/i' => '?..',
];
- if (preg_match('/\+-|\(p\)|\(tm\)|\(r\)|\(c\)|\.{2,}|\!\.{3,}|\?\.{3,}/i', $excerpt['text'], $matches)) {
+ if (\preg_match('/\+-|\(p\)|\(tm\)|\(r\)|\(c\)|\.{2,}|\!\.{3,}|\?\.{3,}/i', $excerpt['text'], $matches)) {
return [
- 'extent' => strlen($matches[0]),
+ 'extent' => \strlen($matches[0]),
'element' => [
- 'rawHtml' => preg_replace(array_keys($substitutions), array_values($substitutions), $matches[0]),
+ 'rawHtml' => \preg_replace(\array_keys($substitutions), \array_values($substitutions), $matches[0]),
],
];
}
@@ -642,34 +642,34 @@ class Markdown
protected function inlineSmartypants($excerpt)
{
// Substitutions
- $backtickDoublequoteOpen = $this->options['smarty']['substitutions']['left-double-quote'] ?? '“';
+ $backtickDoublequoteOpen = $this->options['smarty']['substitutions']['left-double-quote'] ?? '“';
$backtickDoublequoteClose = $this->options['smarty']['substitutions']['right-double-quote'] ?? '”';
- $smartDoublequoteOpen = $this->options['smarty']['substitutions']['left-double-quote'] ?? '“';
+ $smartDoublequoteOpen = $this->options['smarty']['substitutions']['left-double-quote'] ?? '“';
$smartDoublequoteClose = $this->options['smarty']['substitutions']['right-double-quote'] ?? '”';
- $smartSinglequoteOpen = $this->options['smarty']['substitutions']['left-single-quote'] ?? '‘';
+ $smartSinglequoteOpen = $this->options['smarty']['substitutions']['left-single-quote'] ?? '‘';
$smartSinglequoteClose = $this->options['smarty']['substitutions']['right-single-quote'] ?? '’';
- $leftAngleQuote = $this->options['smarty']['substitutions']['left-angle-quote'] ?? '«';
+ $leftAngleQuote = $this->options['smarty']['substitutions']['left-angle-quote'] ?? '«';
$rightAngleQuote = $this->options['smarty']['substitutions']['right-angle-quote'] ?? '»';
- if (preg_match('/(``)(?!\s)([^"\'`]{1,})(\'\')|(\")(?!\s)([^\"]{1,})(\")|(\')(?!\s)([^\']{1,})(\')|(<{2})(?!\s)([^<>]{1,})(>{2})|(\.{3})|(-{3})|(-{2})/i', $excerpt['text'], $matches)) {
- $matches = array_values(array_filter($matches));
+ if (\preg_match('/(``)(?!\s)([^"\'`]{1,})(\'\')|(\")(?!\s)([^\"]{1,})(\")|(\')(?!\s)([^\']{1,})(\')|(<{2})(?!\s)([^<>]{1,})(>{2})|(\.{3})|(-{3})|(-{2})/i', $excerpt['text'], $matches)) {
+ $matches = \array_values(\array_filter($matches));
// Smart backticks
$smartBackticks = $this->options['smarty']['smart_backticks'] ?? false;
if ($smartBackticks) {
- if ('``' === $matches[1]) {
- $length = strlen(trim($excerpt['before']));
+ if ($matches[1] === '``') {
+ $length = \strlen(\trim($excerpt['before']));
if ($length > 0) {
return;
}
return [
- 'extent' => strlen($matches[0]),
+ 'extent' => \strlen($matches[0]),
'element' => [
- 'text' => html_entity_decode($backtickDoublequoteOpen).$matches[2].html_entity_decode($backtickDoublequoteClose),
+ 'text' => \html_entity_decode($backtickDoublequoteOpen).$matches[2].\html_entity_decode($backtickDoublequoteClose),
],
];
}
@@ -679,30 +679,30 @@ class Markdown
$smartQuotes = $this->options['smarty']['smart_quotes'] ?? true;
if ($smartQuotes) {
- if ("'" === $matches[1]) {
- $length = strlen(trim($excerpt['before']));
+ if ($matches[1] === "'") {
+ $length = \strlen(\trim($excerpt['before']));
if ($length > 0) {
return;
}
return [
- 'extent' => strlen($matches[0]),
+ 'extent' => \strlen($matches[0]),
'element' => [
- 'text' => html_entity_decode($smartSinglequoteOpen).$matches[2].html_entity_decode($smartSinglequoteClose),
+ 'text' => \html_entity_decode($smartSinglequoteOpen).$matches[2].\html_entity_decode($smartSinglequoteClose),
],
];
}
- if ('"' === $matches[1]) {
- $length = strlen(trim($excerpt['before']));
+ if ($matches[1] === '"') {
+ $length = \strlen(\trim($excerpt['before']));
if ($length > 0) {
return;
}
return [
- 'extent' => strlen($matches[0]),
+ 'extent' => \strlen($matches[0]),
'element' => [
- 'text' => html_entity_decode($smartDoublequoteOpen).$matches[2].html_entity_decode($smartDoublequoteClose),
+ 'text' => \html_entity_decode($smartDoublequoteOpen).$matches[2].\html_entity_decode($smartDoublequoteClose),
],
];
}
@@ -712,16 +712,16 @@ class Markdown
$smartAngledQuotes = $this->options['smarty']['smart_angled_quotes'] ?? true;
if ($smartAngledQuotes) {
- if ('<<' === $matches[1]) {
- $length = strlen(trim($excerpt['before']));
+ if ($matches[1] === '<<') {
+ $length = \strlen(\trim($excerpt['before']));
if ($length > 0) {
return;
}
return [
- 'extent' => strlen($matches[0]),
+ 'extent' => \strlen($matches[0]),
'element' => [
- 'text' => html_entity_decode($leftAngleQuote).$matches[2].html_entity_decode($rightAngleQuote),
+ 'text' => \html_entity_decode($leftAngleQuote).$matches[2].\html_entity_decode($rightAngleQuote),
],
];
}
@@ -731,18 +731,18 @@ class Markdown
$smartDashes = $this->options['smarty']['smart_dashes'] ?? true;
if ($smartDashes) {
- if ('---' === $matches[1]) {
+ if ($matches[1] === '---') {
return [
- 'extent' => strlen($matches[0]),
+ 'extent' => \strlen($matches[0]),
'element' => [
'rawHtml' => $this->options['smarty']['substitutions']['mdash'] ?? '—',
],
];
}
- if ('--' === $matches[1]) {
+ if ($matches[1] === '--') {
return [
- 'extent' => strlen($matches[0]),
+ 'extent' => \strlen($matches[0]),
'element' => [
'rawHtml' => $this->options['smarty']['substitutions']['ndash'] ?? '–',
],
@@ -754,9 +754,9 @@ class Markdown
$smartEllipses = $this->options['smarty']['smart_ellipses'] ?? true;
if ($smartEllipses) {
- if ('...' === $matches[1]) {
+ if ($matches[1] === '...') {
return [
- 'extent' => strlen($matches[0]),
+ 'extent' => \strlen($matches[0]),
'element' => [
'rawHtml' => $this->options['smarty']['substitutions']['ellipses'] ?? '…',
],
@@ -774,18 +774,18 @@ class Markdown
// Inline Matches
if ($matchSingleDollar) {
// Match single dollar - experimental
- if (preg_match('/^(? strlen($mathMatch),
+ 'extent' => \strlen($mathMatch),
'element' => [
'text' => $mathMatch,
],
@@ -805,11 +805,11 @@ class Markdown
$state = $this->options['math'] ?? false;
if ($state) {
- if (isset($excerpt['text'][1]) && in_array($excerpt['text'][1], $this->specialCharacters) && !preg_match('/^(?specialCharacters) && !\preg_match('/^(?specialCharacters)) {
+ if (isset($excerpt['text'][1]) && \in_array($excerpt['text'][1], $this->specialCharacters)) {
return $element;
}
}
@@ -839,8 +839,8 @@ class Markdown
protected function blockCode($line, $block = null)
{
$codeBlock = $this->options['code']['blocks'] ?? true;
- $codeMain = $this->options['code'] ?? true;
- if ($codeBlock === true and $codeMain === true) {
+ $codeMain = $this->options['code'] ?? true;
+ if ($codeBlock === true && $codeMain === true) {
return $this->blockCodeBase($line, $block);
}
}
@@ -871,7 +871,7 @@ class Markdown
$level = $block['element']['name'];
$headersAllowed = $this->options['headings']['allowed'] ?? ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
- if (!in_array($level, $headersAllowed)) {
+ if (!\in_array($level, $headersAllowed)) {
return;
}
@@ -891,11 +891,11 @@ class Markdown
$tocHeaders = $this->options['toc']['headings'] ?? ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
// Check if level are defined as a heading
- if (in_array($level, $tocHeaders)) {
+ if (\in_array($level, $tocHeaders)) {
// Add/stores the heading element info to the ToC list
$this->setContentsList([
- 'text' => $text,
- 'id' => $id,
+ 'text' => $text,
+ 'id' => $id,
'level' => $level,
]);
}
@@ -945,7 +945,7 @@ class Markdown
$level = $block['element']['name'];
$headersAllowed = $this->options['headings']['allowed'] ?? ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
- if (!in_array($level, $headersAllowed)) {
+ if (!\in_array($level, $headersAllowed)) {
return;
}
@@ -966,11 +966,11 @@ class Markdown
$headersAllowed = $this->options['headings']['allowed'] ?? ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
// Check if level are defined as a heading
- if (in_array($level, $headersAllowed)) {
+ if (\in_array($level, $headersAllowed)) {
// Add/stores the heading element info to the ToC list
$this->setContentsList([
- 'text' => $text,
- 'id' => $id,
+ 'text' => $text,
+ 'id' => $id,
'level' => $level,
]);
}
@@ -1033,12 +1033,12 @@ class Markdown
],
];
- if (preg_match('/^(?options['code']['blocks'] ?? true;
- $codeMain = $this->options['code'] ?? true;
- if ($codeBlock === false or $codeMain === false) {
+ $codeMain = $this->options['code'] ?? true;
+ if ($codeBlock === false || $codeMain === false) {
return;
}
$block = $this->blockFencedCodeBase($line);
- $marker = $line['text'][0];
- $openerLength = strspn($line['text'], $marker);
- $language = trim(
- preg_replace('/^`{3}([^\s]+)(.+)?/s', '$1', $line['text'])
+ $marker = $line['text'][0];
+ $openerLength = \strspn($line['text'], $marker);
+ $language = \trim(
+ \preg_replace('/^`{3}([^\s]+)(.+)?/s', '$1', $line['text'])
);
$state = $this->options['diagrams'] ?? true;
if ($state) {
// Mermaid.js https://mermaidjs.github.io
- if ('mermaid' == strtolower($language)) {
+ if (\strtolower($language) == 'mermaid') {
$element = [
'text' => '',
];
return [
- 'char' => $marker,
+ 'char' => $marker,
'openerLength' => $openerLength,
- 'element' => [
- 'element' => $element,
- 'name' => 'div',
+ 'element' => [
+ 'element' => $element,
+ 'name' => 'div',
'attributes' => [
'class' => 'mermaid',
],
@@ -1131,17 +1131,17 @@ class Markdown
}
// Chart.js https://www.chartjs.org/
- if ('chart' == strtolower($language)) {
+ if (\strtolower($language) == 'chart') {
$element = [
'text' => '',
];
return [
- 'char' => $marker,
+ 'char' => $marker,
'openerLength' => $openerLength,
- 'element' => [
- 'element' => $element,
- 'name' => 'canvas',
+ 'element' => [
+ 'element' => $element,
+ 'name' => 'canvas',
'attributes' => [
'class' => 'chartjs',
],
@@ -1167,13 +1167,13 @@ class Markdown
$HeaderElements = &$block['element']['elements'][0]['elements'][0]['elements'];
- for ($index = count($HeaderElements) - 1; $index >= 0; --$index) {
- $colspan = 1;
+ for ($index = \count($HeaderElements) - 1; $index >= 0; --$index) {
+ $colspan = 1;
$HeaderElement = &$HeaderElements[$index];
- while ($index && '>' === $HeaderElements[$index - 1]['handler']['argument']) {
+ while ($index && $HeaderElements[$index - 1]['handler']['argument'] === '>') {
++$colspan;
- $PreviousHeaderElement = &$HeaderElements[--$index];
+ $PreviousHeaderElement = &$HeaderElements[--$index];
$PreviousHeaderElement['merged'] = true;
if (isset($PreviousHeaderElement['attributes'])) {
$HeaderElement['attributes'] = $PreviousHeaderElement['attributes'];
@@ -1188,9 +1188,9 @@ class Markdown
}
}
- for ($index = count($HeaderElements) - 1; $index >= 0; --$index) {
+ for ($index = \count($HeaderElements) - 1; $index >= 0; --$index) {
if (isset($HeaderElements[$index]['merged'])) {
- array_splice($HeaderElements, $index, 1);
+ \array_splice($HeaderElements, $index, 1);
}
}
@@ -1199,13 +1199,13 @@ class Markdown
foreach ($rows as $rowNo => &$row) {
$elements = &$row['elements'];
- for ($index = count($elements) - 1; $index >= 0; --$index) {
+ for ($index = \count($elements) - 1; $index >= 0; --$index) {
$colspan = 1;
$element = &$elements[$index];
- while ($index && '>' === $elements[$index - 1]['handler']['argument']) {
+ while ($index && $elements[$index - 1]['handler']['argument'] === '>') {
++$colspan;
- $PreviousElement = &$elements[--$index];
+ $PreviousElement = &$elements[--$index];
$PreviousElement['merged'] = true;
if (isset($PreviousElement['attributes'])) {
$element['attributes'] = $PreviousElement['attributes'];
@@ -1231,7 +1231,7 @@ class Markdown
continue;
}
- while ($rowNo + $rowspan < count($rows) && $index < count($rows[$rowNo + $rowspan]['elements']) && '^' === $rows[$rowNo + $rowspan]['elements'][$index]['handler']['argument'] && (@$element['attributes']['colspan'] ?: null) === (@$rows[$rowNo + $rowspan]['elements'][$index]['attributes']['colspan'] ?: null)) {
+ while ($rowNo + $rowspan < \count($rows) && $index < \count($rows[$rowNo + $rowspan]['elements']) && $rows[$rowNo + $rowspan]['elements'][$index]['handler']['argument'] === '^' && (@$element['attributes']['colspan'] ?: null) === (@$rows[$rowNo + $rowspan]['elements'][$index]['attributes']['colspan'] ?: null)) {
$rows[$rowNo + $rowspan]['elements'][$index]['merged'] = true;
++$rowspan;
}
@@ -1248,9 +1248,9 @@ class Markdown
foreach ($rows as $rowNo => &$row) {
$elements = &$row['elements'];
- for ($index = count($elements) - 1; $index >= 0; --$index) {
+ for ($index = \count($elements) - 1; $index >= 0; --$index) {
if (isset($elements[$index]['merged'])) {
- array_splice($elements, $index, 1);
+ \array_splice($elements, $index, 1);
}
}
}
@@ -1264,24 +1264,24 @@ class Markdown
*/
protected function blockCheckbox($line)
{
- $text = trim($line['text']);
- $beginLine = substr($text, 0, 4);
- if ('[ ] ' === $beginLine) {
+ $text = \trim($line['text']);
+ $beginLine = \substr($text, 0, 4);
+ if ($beginLine === '[ ] ') {
return [
'handler' => 'checkboxUnchecked',
- 'text' => substr(trim($text), 4),
+ 'text' => \substr(\trim($text), 4),
];
}
- if ('[x] ' === $beginLine) {
+ if ($beginLine === '[x] ') {
return [
'handler' => 'checkboxChecked',
- 'text' => substr(trim($text), 4),
+ 'text' => \substr(\trim($text), 4),
];
}
}
- protected function blockCheckboxContinue(array $block)
+ protected function blockCheckboxContinue(array $block) : void
{
// This is here because Parsedown require it.
}
@@ -1289,7 +1289,7 @@ class Markdown
protected function blockCheckboxComplete(array $block)
{
$block['element'] = [
- 'rawHtml' => $this->{$block['handler']}($block['text']),
+ 'rawHtml' => $this->{$block['handler']}($block['text']),
'allowRawHtmlInSafeMode' => true,
];
@@ -1327,7 +1327,7 @@ class Markdown
{
// backup settings
$markupEscaped = $this->markupEscaped;
- $safeMode = $this->safeMode;
+ $safeMode = $this->safeMode;
// disable rules to prevent double escaping.
$this->setMarkupEscaped(false);
@@ -1362,16 +1362,16 @@ class Markdown
*/
protected function encodeTagToHash($text)
{
- $salt = $this->getSalt();
+ $salt = $this->getSalt();
$tagOrigin = $this->getTagToC();
- if (strpos($text, $tagOrigin) === false) {
+ if (\strpos($text, $tagOrigin) === false) {
return $text;
}
- $tagHashed = hash('sha256', $salt.$tagOrigin);
+ $tagHashed = \hash('sha256', $salt.$tagOrigin);
- return str_replace($tagOrigin, $tagHashed, $text);
+ return \str_replace($tagOrigin, $tagHashed, $text);
}
/**
@@ -1383,15 +1383,15 @@ class Markdown
*/
protected function decodeTagFromHash($text)
{
- $salt = $this->getSalt();
+ $salt = $this->getSalt();
$tagOrigin = $this->getTagToC();
- $tagHashed = hash('sha256', $salt.$tagOrigin);
+ $tagHashed = \hash('sha256', $salt.$tagOrigin);
- if (strpos($text, $tagHashed) === false) {
+ if (\strpos($text, $tagHashed) === false) {
return $text;
}
- return str_replace($tagHashed, $tagOrigin, $text);
+ return \str_replace($tagHashed, $tagOrigin, $text);
}
/**
@@ -1404,7 +1404,7 @@ class Markdown
return $salt;
}
- $salt = hash('md5', (string) \time());
+ $salt = \hash('md5', (string) \time());
return $salt;
}
@@ -1433,14 +1433,14 @@ class Markdown
* Generates an anchor text that are link-able even if the heading is not in
* ASCII.
*/
- protected function createAnchorID($str): string
+ protected function createAnchorID($str) : string
{
$optionUrlEncode = $this->options['toc']['urlencode'] ?? false;
if ($optionUrlEncode) {
// Check AnchorID is unique
$str = $this->incrementAnchorId($str);
- return urlencode($str);
+ return \urlencode($str);
}
$charMap = [
@@ -1511,25 +1511,25 @@ class Markdown
// Transliterate characters to ASCII
$optionTransliterate = $this->options['toc']['transliterate'] ?? false;
if ($optionTransliterate) {
- $str = str_replace(array_keys($charMap), $charMap, $str);
+ $str = \str_replace(\array_keys($charMap), $charMap, $str);
}
// Replace non-alphanumeric characters with our delimiter
$optionDelimiter = $this->options['toc']['delimiter'] ?? '-';
- $str = preg_replace('/[^\p{L}\p{Nd}]+/u', $optionDelimiter, $str);
+ $str = \preg_replace('/[^\p{L}\p{Nd}]+/u', $optionDelimiter, $str);
// Remove duplicate delimiters
- $str = preg_replace('/('.preg_quote($optionDelimiter, '/').'){2,}/', '$1', $str);
+ $str = \preg_replace('/('.\preg_quote($optionDelimiter, '/').'){2,}/', '$1', $str);
// Truncate slug to max. characters
- $optionLimit = $this->options['toc']['limit'] ?? mb_strlen($str, 'UTF-8');
- $str = mb_substr($str, 0, $optionLimit, 'UTF-8');
+ $optionLimit = $this->options['toc']['limit'] ?? \mb_strlen($str, 'UTF-8');
+ $str = \mb_substr($str, 0, $optionLimit, 'UTF-8');
// Remove delimiter from ends
- $str = trim($str, $optionDelimiter);
+ $str = \trim($str, $optionDelimiter);
$urlLowercase = $this->options['toc']['lowercase'] ?? true;
- $str = $urlLowercase ? mb_strtolower($str, 'UTF-8') : $str;
+ $str = $urlLowercase ? \mb_strtolower($str, 'UTF-8') : $str;
return $this->incrementAnchorId($str);
}
@@ -1540,13 +1540,13 @@ class Markdown
*/
protected function fetchText($text)
{
- return trim(strip_tags($this->line($text)));
+ return \trim(\strip_tags($this->line($text)));
}
/**
* Set/stores the heading block to ToC list in a string and array format.
*/
- protected function setContentsList(array $Content)
+ protected function setContentsList(array $Content) : void
{
// Stores as an array
$this->setContentsListAsArray($Content);
@@ -1557,7 +1557,7 @@ class Markdown
/**
* Sets/stores the heading block info as an array.
*/
- protected function setContentsListAsArray(array $Content)
+ protected function setContentsListAsArray(array $Content) : void
{
$this->contentsListArray[] = $Content;
}
@@ -1565,14 +1565,14 @@ class Markdown
/**
* Sets/stores the heading block info as a list in markdown format.
*/
- protected function setContentsListAsString(array $Content)
+ protected function setContentsListAsString(array $Content) : void
{
- $text = $this->fetchText($Content['text']);
- $id = $Content['id'];
- $level = (int) trim($Content['level'], 'h');
- $link = "[{$text}](#{$id})";
+ $text = $this->fetchText($Content['text']);
+ $id = $Content['id'];
+ $level = (int) \trim($Content['level'], 'h');
+ $link = "[{$text}](#{$id})";
- if (0 === $this->firstHeadLevel) {
+ if ($this->firstHeadLevel === 0) {
$this->firstHeadLevel = $level;
}
$cutIndent = $this->firstHeadLevel - 1;
@@ -1582,7 +1582,7 @@ class Markdown
$level = $level - $cutIndent;
}
- $indent = str_repeat(' ', $level);
+ $indent = \str_repeat(' ', $level);
// Stores in markdown list format as below:
// - [Header1](#Header1)
@@ -1590,7 +1590,7 @@ class Markdown
// - [Header3](#Header3)
// - [Header2-2](#Header2-2)
// ...
- $this->contentsListString .= "{$indent}- {$link}".PHP_EOL;
+ $this->contentsListString .= "{$indent}- {$link}".\PHP_EOL;
}
/**
@@ -1625,15 +1625,15 @@ class Markdown
/**
* Add blacklisted ids to anchor list.
*/
- protected function initBlacklist()
+ protected function initBlacklist() : void
{
if ($this->isBlacklistInitialized) {
return;
}
- if (!empty($this->options['headings']['blacklist']) && is_array($this->options['headings']['blacklist'])) {
+ if (!empty($this->options['headings']['blacklist']) && \is_array($this->options['headings']['blacklist'])) {
foreach ($this->options['headings']['blacklist'] as $v) {
- if (is_string($v)) {
+ if (\is_string($v)) {
$this->anchorDuplicates[$v] = 0;
}
}
@@ -1649,15 +1649,15 @@ class Markdown
$nonNestables = (
empty($nonNestables)
? []
- : array_combine($nonNestables, $nonNestables)
+ : \array_combine($nonNestables, $nonNestables)
);
// $excerpt is based on the first occurrence of a marker
- while ($excerpt = strpbrk($text, $this->inlineMarkerList)) {
+ while ($excerpt = \strpbrk($text, $this->inlineMarkerList)) {
$marker = $excerpt[0];
- $markerPosition = strlen($text) - strlen($excerpt);
+ $markerPosition = \strlen($text) - \strlen($excerpt);
// Get the first char before the marker
$beforeMarkerPosition = $markerPosition - 1;
@@ -1684,7 +1684,7 @@ class Markdown
// makes sure that the inline belongs to "our" marker
- if (isset($Inline['position']) and $Inline['position'] > $markerPosition) {
+ if (isset($Inline['position']) && $Inline['position'] > $markerPosition) {
continue;
}
@@ -1697,12 +1697,12 @@ class Markdown
// cause the new element to 'inherit' our non nestables
$Inline['element']['nonNestables'] = isset($Inline['element']['nonNestables'])
- ? array_merge($Inline['element']['nonNestables'], $nonNestables)
+ ? \array_merge($Inline['element']['nonNestables'], $nonNestables)
: $nonNestables
;
// the text that comes before the inline
- $unmarkedText = substr($text, 0, $Inline['position']);
+ $unmarkedText = \substr($text, 0, $Inline['position']);
// compile the unmarked text
$InlineText = $this->inlineText($unmarkedText);
@@ -1712,19 +1712,19 @@ class Markdown
$Elements[] = $this->extractElement($Inline);
// remove the examined text
- $text = substr($text, $Inline['position'] + $Inline['extent']);
+ $text = \substr($text, $Inline['position'] + $Inline['extent']);
continue 2;
}
// the marker does not belong to an inline
- $unmarkedText = substr($text, 0, $markerPosition + 1);
+ $unmarkedText = \substr($text, 0, $markerPosition + 1);
$InlineText = $this->inlineText($unmarkedText);
$Elements[] = $InlineText['element'];
- $text = substr($text, $markerPosition + 1);
+ $text = \substr($text, $markerPosition + 1);
}
$InlineText = $this->inlineText($text);
@@ -1741,7 +1741,7 @@ class Markdown
private function pregReplaceAssoc(array $replace, $subject)
{
- return preg_replace(array_keys($replace), array_values($replace), $subject);
+ return \preg_replace(\array_keys($replace), \array_values($replace), $subject);
}
#
@@ -1753,13 +1753,13 @@ class Markdown
protected function blockAbbreviationBase($Line)
{
- if (preg_match('/^\*\[(.+?)\]:[ ]*(.+?)[ ]*$/', $Line['text'], $matches))
+ if (\preg_match('/^\*\[(.+?)\]:[ ]*(.+?)[ ]*$/', $Line['text'], $matches))
{
$this->DefinitionData['Abbreviation'][$matches[1]] = $matches[2];
- $Block = array(
+ $Block = [
'hidden' => true,
- );
+ ];
return $Block;
}
@@ -1770,13 +1770,13 @@ class Markdown
protected function blockFootnoteBase($Line)
{
- if (preg_match('/^\[\^(.+?)\]:[ ]?(.*)$/', $Line['text'], $matches))
+ if (\preg_match('/^\[\^(.+?)\]:[ ]?(.*)$/', $Line['text'], $matches))
{
- $Block = array(
- 'label' => $matches[1],
- 'text' => $matches[2],
+ $Block = [
+ 'label' => $matches[1],
+ 'text' => $matches[2],
'hidden' => true,
- );
+ ];
return $Block;
}
@@ -1784,7 +1784,7 @@ class Markdown
protected function blockFootnoteContinue($Line, $Block)
{
- if ($Line['text'][0] === '[' and preg_match('/^\[\^(.+?)\]:/', $Line['text']))
+ if ($Line['text'][0] === '[' && \preg_match('/^\[\^(.+?)\]:/', $Line['text']))
{
return;
}
@@ -1808,11 +1808,11 @@ class Markdown
protected function blockFootnoteComplete($Block)
{
- $this->DefinitionData['Footnote'][$Block['label']] = array(
- 'text' => $Block['text'],
- 'count' => null,
+ $this->DefinitionData['Footnote'][$Block['label']] = [
+ 'text' => $Block['text'],
+ 'count' => null,
'number' => null,
- );
+ ];
return $Block;
}
@@ -1822,28 +1822,28 @@ class Markdown
protected function blockDefinitionListBase($Line, $Block)
{
- if ( ! isset($Block) or $Block['type'] !== 'Paragraph')
+ if (! isset($Block) || $Block['type'] !== 'Paragraph')
{
return;
}
- $Element = array(
- 'name' => 'dl',
- 'elements' => array(),
- );
+ $Element = [
+ 'name' => 'dl',
+ 'elements' => [],
+ ];
- $terms = explode("\n", $Block['element']['handler']['argument']);
+ $terms = \explode("\n", $Block['element']['handler']['argument']);
foreach ($terms as $term)
{
- $Element['elements'] []= array(
- 'name' => 'dt',
- 'handler' => array(
- 'function' => 'lineElements',
- 'argument' => $term,
- 'destination' => 'elements'
- ),
- );
+ $Element['elements'] []= [
+ 'name' => 'dt',
+ 'handler' => [
+ 'function' => 'lineElements',
+ 'argument' => $term,
+ 'destination' => 'elements',
+ ],
+ ];
}
$Block['element'] = $Element;
@@ -1863,7 +1863,7 @@ class Markdown
}
else
{
- if (isset($Block['interrupted']) and $Line['indent'] === 0)
+ if (isset($Block['interrupted']) && $Line['indent'] === 0)
{
return;
}
@@ -1878,7 +1878,7 @@ class Markdown
unset($Block['interrupted']);
}
- $text = substr($Line['body'], min($Line['indent'], 4));
+ $text = \substr($Line['body'], \min($Line['indent'], 4));
$Block['dd']['handler']['argument'] .= "\n" . $text;
@@ -1893,13 +1893,13 @@ class Markdown
{
$Block = $this->blockHeaderParent($Line);
- if ($Block !== null && preg_match('/[ #]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['handler']['argument'], $matches, PREG_OFFSET_CAPTURE))
+ if ($Block !== null && \preg_match('/[ #]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['handler']['argument'], $matches, \PREG_OFFSET_CAPTURE))
{
$attributeString = $matches[1][0];
$Block['element']['attributes'] = $this->parseAttributeData($attributeString);
- $Block['element']['handler']['argument'] = substr($Block['element']['handler']['argument'], 0, $matches[0][1]);
+ $Block['element']['handler']['argument'] = \substr($Block['element']['handler']['argument'], 0, $matches[0][1]);
}
return $Block;
@@ -1910,47 +1910,47 @@ class Markdown
protected function blockMarkupBase($Line)
{
- if ($this->markupEscaped or $this->safeMode)
+ if ($this->markupEscaped || $this->safeMode)
{
return;
}
- if (preg_match('/^<(\w[\w-]*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches))
+ if (\preg_match('/^<(\w[\w-]*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches))
{
- $element = strtolower($matches[1]);
+ $element = \strtolower($matches[1]);
- if (in_array($element, $this->textLevelElements))
+ if (\in_array($element, $this->textLevelElements))
{
return;
}
- $Block = array(
- 'name' => $matches[1],
- 'depth' => 0,
- 'element' => array(
- 'rawHtml' => $Line['text'],
+ $Block = [
+ 'name' => $matches[1],
+ 'depth' => 0,
+ 'element' => [
+ 'rawHtml' => $Line['text'],
'autobreak' => true,
- ),
- );
+ ],
+ ];
- $length = strlen($matches[0]);
- $remainder = substr($Line['text'], $length);
+ $length = \strlen($matches[0]);
+ $remainder = \substr($Line['text'], $length);
- if (trim($remainder) === '')
+ if (\trim($remainder) === '')
{
- if (isset($matches[2]) or in_array($matches[1], $this->voidElements))
+ if (isset($matches[2]) || \in_array($matches[1], $this->voidElements))
{
$Block['closed'] = true;
- $Block['void'] = true;
+ $Block['void'] = true;
}
}
else
{
- if (isset($matches[2]) or in_array($matches[1], $this->voidElements))
+ if (isset($matches[2]) || \in_array($matches[1], $this->voidElements))
{
return;
}
- if (preg_match('/<\/'.$matches[1].'>[ ]*$/i', $remainder))
+ if (\preg_match('/<\/'.$matches[1].'>[ ]*$/i', $remainder))
{
$Block['closed'] = true;
}
@@ -1967,16 +1967,16 @@ class Markdown
return;
}
- if (preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) # open
+ if (\preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) # open
{
- $Block['depth'] ++;
+ ++$Block['depth'];
}
- if (preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) # close
+ if (\preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) # close
{
if ($Block['depth'] > 0)
{
- $Block['depth'] --;
+ --$Block['depth'];
}
else
{
@@ -1997,7 +1997,7 @@ class Markdown
protected function blockMarkupComplete($Block)
{
- if ( ! isset($Block['void']))
+ if (! isset($Block['void']))
{
$Block['element']['rawHtml'] = $this->processTag($Block['element']['rawHtml']);
}
@@ -2012,13 +2012,13 @@ class Markdown
{
$Block = $this->blockSetextHeaderParent($Line, $Block);
- if ($Block !== null && preg_match('/[ ]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['handler']['argument'], $matches, PREG_OFFSET_CAPTURE))
+ if ($Block !== null && \preg_match('/[ ]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['handler']['argument'], $matches, \PREG_OFFSET_CAPTURE))
{
$attributeString = $matches[1][0];
$Block['element']['attributes'] = $this->parseAttributeData($attributeString);
- $Block['element']['handler']['argument'] = substr($Block['element']['handler']['argument'], 0, $matches[0][1]);
+ $Block['element']['handler']['argument'] = \substr($Block['element']['handler']['argument'], 0, $matches[0][1]);
}
return $Block;
@@ -2033,36 +2033,36 @@ class Markdown
protected function inlineFootnoteMarker($Excerpt)
{
- if (preg_match('/^\[\^(.+?)\]/', $Excerpt['text'], $matches))
+ if (\preg_match('/^\[\^(.+?)\]/', $Excerpt['text'], $matches))
{
$name = $matches[1];
- if ( ! isset($this->DefinitionData['Footnote'][$name]))
+ if (! isset($this->DefinitionData['Footnote'][$name]))
{
return;
}
- $this->DefinitionData['Footnote'][$name]['count'] ++;
+ ++$this->DefinitionData['Footnote'][$name]['count'];
- if ( ! isset($this->DefinitionData['Footnote'][$name]['number']))
+ if (! isset($this->DefinitionData['Footnote'][$name]['number']))
{
$this->DefinitionData['Footnote'][$name]['number'] = ++ $this->footnoteCount; # ยป &
}
- $Element = array(
- 'name' => 'sup',
- 'attributes' => array('id' => 'fnref'.$this->DefinitionData['Footnote'][$name]['count'].':'.$name),
- 'element' => array(
- 'name' => 'a',
- 'attributes' => array('href' => '#fn:'.$name, 'class' => 'footnote-ref'),
- 'text' => $this->DefinitionData['Footnote'][$name]['number'],
- ),
- );
+ $Element = [
+ 'name' => 'sup',
+ 'attributes' => ['id' => 'fnref'.$this->DefinitionData['Footnote'][$name]['count'].':'.$name],
+ 'element' => [
+ 'name' => 'a',
+ 'attributes' => ['href' => '#fn:'.$name, 'class' => 'footnote-ref'],
+ 'text' => $this->DefinitionData['Footnote'][$name]['number'],
+ ],
+ ];
- return array(
- 'extent' => strlen($matches[0]),
+ return [
+ 'extent' => \strlen($matches[0]),
'element' => $Element,
- );
+ ];
}
}
@@ -2075,13 +2075,13 @@ class Markdown
{
$Link = $this->inlineLinkParent($Excerpt);
- $remainder = $Link !== null ? substr($Excerpt['text'], $Link['extent']) : '';
+ $remainder = $Link !== null ? \substr($Excerpt['text'], $Link['extent']) : '';
- if (preg_match('/^[ ]*{('.$this->regexAttribute.'+)}/', $remainder, $matches))
+ if (\preg_match('/^[ ]*{('.$this->regexAttribute.'+)}/', $remainder, $matches))
{
$Link['element']['attributes'] += $this->parseAttributeData($matches[1]);
- $Link['extent'] += strlen($matches[0]);
+ $Link['extent'] += \strlen($matches[0]);
}
return $Link;
@@ -2092,6 +2092,7 @@ class Markdown
#
private $currentAbreviation;
+
private $currentMeaning;
protected function insertAbreviation(array $Element)
@@ -2099,16 +2100,16 @@ class Markdown
if (isset($Element['text']))
{
$Element['elements'] = self::pregReplaceElements(
- '/\b'.preg_quote($this->currentAbreviation, '/').'\b/',
- array(
- array(
- 'name' => 'abbr',
- 'attributes' => array(
+ '/\b'.\preg_quote($this->currentAbreviation, '/').'\b/',
+ [
+ [
+ 'name' => 'abbr',
+ 'attributes' => [
'title' => $this->currentMeaning,
- ),
+ ],
'text' => $this->currentAbreviation,
- )
- ),
+ ],
+ ],
$Element['text']
);
@@ -2127,10 +2128,10 @@ class Markdown
foreach ($this->DefinitionData['Abbreviation'] as $abbreviation => $meaning)
{
$this->currentAbreviation = $abbreviation;
- $this->currentMeaning = $meaning;
+ $this->currentMeaning = $meaning;
$Inline['element'] = $this->elementApplyRecursiveDepthFirst(
- array($this, 'insertAbreviation'),
+ [$this, 'insertAbreviation'],
$Inline['element']
);
}
@@ -2145,19 +2146,19 @@ class Markdown
protected function addDdElement(array $Line, array $Block)
{
- $text = substr($Line['text'], 1);
- $text = trim($text);
+ $text = \substr($Line['text'], 1);
+ $text = \trim($text);
unset($Block['dd']);
- $Block['dd'] = array(
- 'name' => 'dd',
- 'handler' => array(
- 'function' => 'lineElements',
- 'argument' => $text,
- 'destination' => 'elements'
- ),
- );
+ $Block['dd'] = [
+ 'name' => 'dd',
+ 'handler' => [
+ 'function' => 'lineElements',
+ 'argument' => $text,
+ 'destination' => 'elements',
+ ],
+ ];
if (isset($Block['interrupted']))
{
@@ -2173,23 +2174,23 @@ class Markdown
protected function buildFootnoteElement()
{
- $Element = array(
- 'name' => 'div',
- 'attributes' => array('class' => 'footnotes'),
- 'elements' => array(
- array('name' => 'hr'),
- array(
- 'name' => 'ol',
- 'elements' => array(),
- ),
- ),
- );
+ $Element = [
+ 'name' => 'div',
+ 'attributes' => ['class' => 'footnotes'],
+ 'elements' => [
+ ['name' => 'hr'],
+ [
+ 'name' => 'ol',
+ 'elements' => [],
+ ],
+ ],
+ ];
- uasort($this->DefinitionData['Footnote'], 'self::sortFootnotes');
+ \uasort($this->DefinitionData['Footnote'], 'self::sortFootnotes');
foreach ($this->DefinitionData['Footnote'] as $definitionId => $DefinitionData)
{
- if ( ! isset($DefinitionData['number']))
+ if (! isset($DefinitionData['number']))
{
continue;
}
@@ -2198,67 +2199,67 @@ class Markdown
$textElements = $this->textElements($text);
- $numbers = range(1, $DefinitionData['count']);
+ $numbers = \range(1, $DefinitionData['count']);
- $backLinkElements = array();
+ $backLinkElements = [];
foreach ($numbers as $number)
{
- $backLinkElements[] = array('text' => ' ');
- $backLinkElements[] = array(
- 'name' => 'a',
- 'attributes' => array(
- 'href' => "#fnref$number:$definitionId",
- 'rev' => 'footnote',
+ $backLinkElements[] = ['text' => ' '];
+ $backLinkElements[] = [
+ 'name' => 'a',
+ 'attributes' => [
+ 'href' => "#fnref{$number}:{$definitionId}",
+ 'rev' => 'footnote',
'class' => 'footnote-backref',
- ),
- 'rawHtml' => '↩',
+ ],
+ 'rawHtml' => '↩',
'allowRawHtmlInSafeMode' => true,
- 'autobreak' => false,
- );
+ 'autobreak' => false,
+ ];
}
unset($backLinkElements[0]);
- $n = count($textElements) -1;
+ $n = \count($textElements) - 1;
if ($textElements[$n]['name'] === 'p')
{
- $backLinkElements = array_merge(
- array(
- array(
- 'rawHtml' => ' ',
+ $backLinkElements = \array_merge(
+ [
+ [
+ 'rawHtml' => ' ',
'allowRawHtmlInSafeMode' => true,
- ),
- ),
+ ],
+ ],
$backLinkElements
);
unset($textElements[$n]['name']);
- $textElements[$n] = array(
- 'name' => 'p',
- 'elements' => array_merge(
- array($textElements[$n]),
+ $textElements[$n] = [
+ 'name' => 'p',
+ 'elements' => \array_merge(
+ [$textElements[$n]],
$backLinkElements
),
- );
+ ];
}
else
{
- $textElements[] = array(
- 'name' => 'p',
- 'elements' => $backLinkElements
- );
+ $textElements[] = [
+ 'name' => 'p',
+ 'elements' => $backLinkElements,
+ ];
}
- $Element['elements'][1]['elements'] []= array(
- 'name' => 'li',
- 'attributes' => array('id' => 'fn:'.$definitionId),
- 'elements' => array_merge(
+ $Element['elements'][1]['elements'] []= [
+ 'name' => 'li',
+ 'attributes' => ['id' => 'fn:'.$definitionId],
+ 'elements' => \array_merge(
$textElements
),
- );
+ ];
}
return $Element;
@@ -2268,25 +2269,25 @@ class Markdown
protected function parseAttributeDataBase($attributeString)
{
- $Data = array();
+ $Data = [];
- $attributes = preg_split('/[ ]+/', $attributeString, - 1, PREG_SPLIT_NO_EMPTY);
+ $attributes = \preg_split('/[ ]+/', $attributeString, - 1, \PREG_SPLIT_NO_EMPTY);
foreach ($attributes as $attribute)
{
if ($attribute[0] === '#')
{
- $Data['id'] = substr($attribute, 1);
+ $Data['id'] = \substr($attribute, 1);
}
else # "."
{
- $classes []= substr($attribute, 1);
+ $classes []= \substr($attribute, 1);
}
}
if (isset($classes))
{
- $Data['class'] = implode(' ', $classes);
+ $Data['class'] = \implode(' ', $classes);
}
return $Data;
@@ -2297,12 +2298,12 @@ class Markdown
protected function processTag($elementMarkup) # recursive
{
# http://stackoverflow.com/q/1148928/200145
- libxml_use_internal_errors(true);
+ \libxml_use_internal_errors(true);
- $DOMDocument = new \DOMDocument;
+ $DOMDocument = new \DOMDocument();
# http://stackoverflow.com/q/11309194/200145
- $elementMarkup = mb_convert_encoding($elementMarkup, 'HTML-ENTITIES', 'UTF-8');
+ $elementMarkup = \mb_convert_encoding($elementMarkup, 'HTML-ENTITIES', 'UTF-8');
# http://stackoverflow.com/q/4879946/200145
$DOMDocument->loadHTML($elementMarkup);
@@ -2328,7 +2329,7 @@ class Markdown
{
$nodeMarkup = $DOMDocument->saveHTML($Node);
- if ($Node instanceof \DOMElement and ! in_array($Node->nodeName, $this->textLevelElements))
+ if ($Node instanceof \DOMElement && ! \in_array($Node->nodeName, $this->textLevelElements))
{
$elementText .= $this->processTag($nodeMarkup);
}
@@ -2343,7 +2344,7 @@ class Markdown
$DOMDocument->documentElement->nodeValue = 'placeholder\x1A';
$markup = $DOMDocument->saveHTML($DOMDocument->documentElement);
- $markup = str_replace('placeholder\x1A', $elementText, $markup);
+ $markup = \str_replace('placeholder\x1A', $elementText, $markup);
return $markup;
}
@@ -2364,16 +2365,16 @@ class Markdown
protected function textElements($text)
{
# make sure no definitions are set
- $this->DefinitionData = array();
+ $this->DefinitionData = [];
# standardize line breaks
- $text = str_replace(array("\r\n", "\r"), "\n", $text);
+ $text = \str_replace(["\r\n", "\r"], "\n", $text);
# remove surrounding line breaks
- $text = trim($text, "\n");
+ $text = \trim($text, "\n");
# split text into lines
- $lines = explode("\n", $text);
+ $lines = \explode("\n", $text);
# iterate through lines to identify blocks
return $this->linesElements($lines);
@@ -2383,7 +2384,7 @@ class Markdown
# Setters
#
- function setBreaksEnabled($breaksEnabled)
+ public function setBreaksEnabled($breaksEnabled)
{
$this->breaksEnabled = $breaksEnabled;
@@ -2392,7 +2393,7 @@ class Markdown
protected $breaksEnabled;
- function setMarkupEscaped($markupEscaped)
+ public function setMarkupEscaped($markupEscaped)
{
$this->markupEscaped = $markupEscaped;
@@ -2401,7 +2402,7 @@ class Markdown
protected $markupEscaped;
- function setUrlsLinked($urlsLinked)
+ public function setUrlsLinked($urlsLinked)
{
$this->urlsLinked = $urlsLinked;
@@ -2410,7 +2411,7 @@ class Markdown
protected $urlsLinked = true;
- function setSafeMode($safeMode)
+ public function setSafeMode($safeMode)
{
$this->safeMode = (bool) $safeMode;
@@ -2419,7 +2420,7 @@ class Markdown
protected $safeMode;
- function setStrictMode($strictMode)
+ public function setStrictMode($strictMode)
{
$this->strictMode = (bool) $strictMode;
@@ -2428,7 +2429,7 @@ class Markdown
protected $strictMode;
- protected $safeLinksWhitelist = array(
+ protected $safeLinksWhitelist = [
'http://',
'https://',
'ftp://',
@@ -2444,43 +2445,43 @@ class Markdown
'ssh:',
'news:',
'steam:',
- );
+ ];
#
# Lines
#
- protected $BlockTypes = array(
- '#' => array('Header'),
- '*' => array('Rule', 'List', 'Abbreviation'),
- '+' => array('List'),
- '-' => array('SetextHeader', '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', 'DefinitionList'),
- '<' => array('Comment', 'Markup'),
- '=' => array('SetextHeader'),
- '>' => array('Quote'),
- '[' => array('Footnote', 'Reference'),
- '_' => array('Rule'),
- '`' => array('FencedCode'),
- '|' => array('Table'),
- '~' => array('FencedCode'),
- );
+ protected $BlockTypes = [
+ '#' => ['Header'],
+ '*' => ['Rule', 'List', 'Abbreviation'],
+ '+' => ['List'],
+ '-' => ['SetextHeader', 'Table', 'Rule', 'List'],
+ '0' => ['List'],
+ '1' => ['List'],
+ '2' => ['List'],
+ '3' => ['List'],
+ '4' => ['List'],
+ '5' => ['List'],
+ '6' => ['List'],
+ '7' => ['List'],
+ '8' => ['List'],
+ '9' => ['List'],
+ ':' => ['Table', 'DefinitionList'],
+ '<' => ['Comment', 'Markup'],
+ '=' => ['SetextHeader'],
+ '>' => ['Quote'],
+ '[' => ['Footnote', 'Reference'],
+ '_' => ['Rule'],
+ '`' => ['FencedCode'],
+ '|' => ['Table'],
+ '~' => ['FencedCode'],
+ ];
# ~
- protected $unmarkedBlockTypes = array(
+ protected $unmarkedBlockTypes = [
'Code',
- );
+ ];
#
# Blocks
@@ -2493,12 +2494,12 @@ class Markdown
protected function linesElements(array $lines)
{
- $Elements = array();
+ $Elements = [];
$CurrentBlock = null;
foreach ($lines as $line)
{
- if (chop($line) === '')
+ if (\rtrim($line) === '')
{
if (isset($CurrentBlock))
{
@@ -2510,30 +2511,30 @@ class Markdown
continue;
}
- while (($beforeTab = strstr($line, "\t", true)) !== false)
+ while (($beforeTab = \strstr($line, "\t", true)) !== false)
{
- $shortage = 4 - mb_strlen($beforeTab, 'utf-8') % 4;
+ $shortage = 4 - \mb_strlen($beforeTab, 'utf-8') % 4;
$line = $beforeTab
- . str_repeat(' ', $shortage)
- . substr($line, strlen($beforeTab) + 1)
+ . \str_repeat(' ', $shortage)
+ . \substr($line, \strlen($beforeTab) + 1)
;
}
- $indent = strspn($line, ' ');
+ $indent = \strspn($line, ' ');
- $text = $indent > 0 ? substr($line, $indent) : $line;
+ $text = $indent > 0 ? \substr($line, $indent) : $line;
# ~
- $Line = array('body' => $line, 'indent' => $indent, 'text' => $text);
+ $Line = ['body' => $line, 'indent' => $indent, 'text' => $text];
# ~
if (isset($CurrentBlock['continuable']))
{
$methodName = 'block' . $CurrentBlock['type'] . 'Continue';
- $Block = $this->$methodName($Line, $CurrentBlock);
+ $Block = $this->{$methodName}($Line, $CurrentBlock);
if (isset($Block))
{
@@ -2545,8 +2546,8 @@ class Markdown
{
if ($this->isBlockCompletable($CurrentBlock['type']))
{
- $methodName = 'block' . $CurrentBlock['type'] . 'Complete';
- $CurrentBlock = $this->$methodName($CurrentBlock);
+ $methodName = 'block' . $CurrentBlock['type'] . 'Complete';
+ $CurrentBlock = $this->{$methodName}($CurrentBlock);
}
}
}
@@ -2572,13 +2573,13 @@ class Markdown
foreach ($blockTypes as $blockType)
{
- $Block = $this->{"block$blockType"}($Line, $CurrentBlock);
+ $Block = $this->{"block{$blockType}"}($Line, $CurrentBlock);
if (isset($Block))
{
$Block['type'] = $blockType;
- if ( ! isset($Block['identified']))
+ if (! isset($Block['identified']))
{
if (isset($CurrentBlock))
{
@@ -2601,7 +2602,7 @@ class Markdown
# ~
- if (isset($CurrentBlock) and $CurrentBlock['type'] === 'Paragraph')
+ if (isset($CurrentBlock) && $CurrentBlock['type'] === 'Paragraph')
{
$Block = $this->paragraphContinue($Line, $CurrentBlock);
}
@@ -2625,10 +2626,10 @@ class Markdown
# ~
- if (isset($CurrentBlock['continuable']) and $this->isBlockCompletable($CurrentBlock['type']))
+ if (isset($CurrentBlock['continuable']) && $this->isBlockCompletable($CurrentBlock['type']))
{
- $methodName = 'block' . $CurrentBlock['type'] . 'Complete';
- $CurrentBlock = $this->$methodName($CurrentBlock);
+ $methodName = 'block' . $CurrentBlock['type'] . 'Complete';
+ $CurrentBlock = $this->{$methodName}($CurrentBlock);
}
# ~
@@ -2645,15 +2646,15 @@ class Markdown
protected function extractElement(array $Component)
{
- if ( ! isset($Component['element']))
+ if (! isset($Component['element']))
{
if (isset($Component['markup']))
{
- $Component['element'] = array('rawHtml' => $Component['markup']);
+ $Component['element'] = ['rawHtml' => $Component['markup']];
}
elseif (isset($Component['hidden']))
{
- $Component['element'] = array();
+ $Component['element'] = [];
}
}
@@ -2662,12 +2663,12 @@ class Markdown
protected function isBlockContinuable($Type)
{
- return method_exists($this, 'block' . $Type . 'Continue');
+ return \method_exists($this, 'block' . $Type . 'Continue');
}
protected function isBlockCompletable($Type)
{
- return method_exists($this, 'block' . $Type . 'Complete');
+ return \method_exists($this, 'block' . $Type . 'Complete');
}
#
@@ -2675,24 +2676,24 @@ class Markdown
protected function blockCodeBase($Line, $Block = null)
{
- if (isset($Block) and $Block['type'] === 'Paragraph' and ! isset($Block['interrupted']))
+ if (isset($Block) && $Block['type'] === 'Paragraph' && ! isset($Block['interrupted']))
{
return;
}
if ($Line['indent'] >= 4)
{
- $text = substr($Line['body'], 4);
+ $text = \substr($Line['body'], 4);
- $Block = array(
- 'element' => array(
- 'name' => 'pre',
- 'element' => array(
+ $Block = [
+ 'element' => [
+ 'name' => 'pre',
+ 'element' => [
'name' => 'code',
'text' => $text,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $Block;
}
@@ -2704,14 +2705,14 @@ class Markdown
{
if (isset($Block['interrupted']))
{
- $Block['element']['element']['text'] .= str_repeat("\n", $Block['interrupted']);
+ $Block['element']['element']['text'] .= \str_repeat("\n", $Block['interrupted']);
unset($Block['interrupted']);
}
$Block['element']['element']['text'] .= "\n";
- $text = substr($Line['body'], 4);
+ $text = \substr($Line['body'], 4);
$Block['element']['element']['text'] .= $text;
@@ -2729,21 +2730,21 @@ class Markdown
protected function blockCommentBase($Line)
{
- if ($this->markupEscaped or $this->safeMode)
+ if ($this->markupEscaped || $this->safeMode)
{
return;
}
- if (strpos($Line['text'], '') !== false)
+ if (\strpos($Line['text'], '-->') !== false)
{
$Block['closed'] = true;
}
@@ -2761,7 +2762,7 @@ class Markdown
$Block['element']['rawHtml'] .= "\n" . $Line['body'];
- if (strpos($Line['text'], '-->') !== false)
+ if (\strpos($Line['text'], '-->') !== false)
{
$Block['closed'] = true;
}
@@ -2776,24 +2777,24 @@ class Markdown
{
$marker = $Line['text'][0];
- $openerLength = strspn($Line['text'], $marker);
+ $openerLength = \strspn($Line['text'], $marker);
if ($openerLength < 3)
{
return;
}
- $infostring = trim(substr($Line['text'], $openerLength), "\t ");
+ $infostring = \trim(\substr($Line['text'], $openerLength), "\t ");
- if (strpos($infostring, '`') !== false)
+ if (\strpos($infostring, '`') !== false)
{
return;
}
- $Element = array(
+ $Element = [
'name' => 'code',
'text' => '',
- );
+ ];
if ($infostring !== '')
{
@@ -2809,19 +2810,19 @@ class Markdown
* U+000A LINE FEED (LF), U+000C FORM FEED (FF), and
* U+000D CARRIAGE RETURN (CR).
*/
- $language = substr($infostring, 0, strcspn($infostring, " \t\n\f\r"));
+ $language = \substr($infostring, 0, \strcspn($infostring, " \t\n\f\r"));
- $Element['attributes'] = array('class' => "language-$language");
+ $Element['attributes'] = ['class' => "language-{$language}"];
}
- $Block = array(
- 'char' => $marker,
+ $Block = [
+ 'char' => $marker,
'openerLength' => $openerLength,
- 'element' => array(
- 'name' => 'pre',
+ 'element' => [
+ 'name' => 'pre',
'element' => $Element,
- ),
- );
+ ],
+ ];
return $Block;
}
@@ -2835,15 +2836,15 @@ class Markdown
if (isset($Block['interrupted']))
{
- $Block['element']['element']['text'] .= str_repeat("\n", $Block['interrupted']);
+ $Block['element']['element']['text'] .= \str_repeat("\n", $Block['interrupted']);
unset($Block['interrupted']);
}
- if (($len = strspn($Line['text'], $Block['char'])) >= $Block['openerLength']
- and chop(substr($Line['text'], $len), ' ') === ''
+ if (($len = \strspn($Line['text'], $Block['char'])) >= $Block['openerLength']
+ && \rtrim(\substr($Line['text'], $len), ' ') === ''
) {
- $Block['element']['element']['text'] = substr($Block['element']['element']['text'], 1);
+ $Block['element']['element']['text'] = \substr($Block['element']['element']['text'], 1);
$Block['complete'] = true;
@@ -2865,32 +2866,32 @@ class Markdown
protected function blockHeaderParent($Line)
{
- $level = strspn($Line['text'], '#');
+ $level = \strspn($Line['text'], '#');
if ($level > 6)
{
return;
}
- $text = trim($Line['text'], '#');
+ $text = \trim($Line['text'], '#');
- if ($this->strictMode and isset($text[0]) and $text[0] !== ' ')
+ if ($this->strictMode && isset($text[0]) && $text[0] !== ' ')
{
return;
}
- $text = trim($text, ' ');
+ $text = \trim($text, ' ');
- $Block = array(
- 'element' => array(
- 'name' => 'h' . $level,
- 'handler' => array(
- 'function' => 'lineElements',
- 'argument' => $text,
+ $Block = [
+ 'element' => [
+ 'name' => 'h' . $level,
+ 'handler' => [
+ 'function' => 'lineElements',
+ 'argument' => $text,
'destination' => 'elements',
- )
- ),
- );
+ ],
+ ],
+ ];
return $Block;
}
@@ -2900,66 +2901,66 @@ class Markdown
protected function blockListBase($Line, array $CurrentBlock = null)
{
- list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]{1,9}+[.\)]');
+ list($name, $pattern) = $Line['text'][0] <= '-' ? ['ul', '[*+-]'] : ['ol', '[0-9]{1,9}+[.\)]'];
- if (preg_match('/^('.$pattern.'([ ]++|$))(.*+)/', $Line['text'], $matches))
+ if (\preg_match('/^('.$pattern.'([ ]++|$))(.*+)/', $Line['text'], $matches))
{
- $contentIndent = strlen($matches[2]);
+ $contentIndent = \strlen($matches[2]);
if ($contentIndent >= 5)
{
- $contentIndent -= 1;
- $matches[1] = substr($matches[1], 0, -$contentIndent);
- $matches[3] = str_repeat(' ', $contentIndent) . $matches[3];
+ --$contentIndent;
+ $matches[1] = \substr($matches[1], 0, -$contentIndent);
+ $matches[3] = \str_repeat(' ', $contentIndent) . $matches[3];
}
elseif ($contentIndent === 0)
{
$matches[1] .= ' ';
}
- $markerWithoutWhitespace = strstr($matches[1], ' ', true);
+ $markerWithoutWhitespace = \strstr($matches[1], ' ', true);
- $Block = array(
- 'indent' => $Line['indent'],
+ $Block = [
+ 'indent' => $Line['indent'],
'pattern' => $pattern,
- 'data' => array(
- 'type' => $name,
- 'marker' => $matches[1],
- 'markerType' => ($name === 'ul' ? $markerWithoutWhitespace : substr($markerWithoutWhitespace, -1)),
- ),
- 'element' => array(
- 'name' => $name,
- 'elements' => array(),
- ),
- );
- $Block['data']['markerTypeRegex'] = preg_quote($Block['data']['markerType'], '/');
+ 'data' => [
+ 'type' => $name,
+ 'marker' => $matches[1],
+ 'markerType' => ($name === 'ul' ? $markerWithoutWhitespace : \substr($markerWithoutWhitespace, -1)),
+ ],
+ 'element' => [
+ 'name' => $name,
+ 'elements' => [],
+ ],
+ ];
+ $Block['data']['markerTypeRegex'] = \preg_quote($Block['data']['markerType'], '/');
if ($name === 'ol')
{
- $listStart = ltrim(strstr($matches[1], $Block['data']['markerType'], true), '0') ?: '0';
+ $listStart = \ltrim(\strstr($matches[1], $Block['data']['markerType'], true), '0') ?: '0';
if ($listStart !== '1')
{
if (
isset($CurrentBlock)
- and $CurrentBlock['type'] === 'Paragraph'
- and ! isset($CurrentBlock['interrupted'])
+ && $CurrentBlock['type'] === 'Paragraph'
+ && ! isset($CurrentBlock['interrupted'])
) {
return;
}
- $Block['element']['attributes'] = array('start' => $listStart);
+ $Block['element']['attributes'] = ['start' => $listStart];
}
}
- $Block['li'] = array(
- 'name' => 'li',
- 'handler' => array(
- 'function' => 'li',
- 'argument' => !empty($matches[3]) ? array($matches[3]) : array(),
- 'destination' => 'elements'
- )
- );
+ $Block['li'] = [
+ 'name' => 'li',
+ 'handler' => [
+ 'function' => 'li',
+ 'argument' => !empty($matches[3]) ? [$matches[3]] : [],
+ 'destination' => 'elements',
+ ],
+ ];
$Block['element']['elements'] []= & $Block['li'];
@@ -2969,21 +2970,21 @@ class Markdown
protected function blockListContinue($Line, array $Block)
{
- if (isset($Block['interrupted']) and empty($Block['li']['handler']['argument']))
+ if (isset($Block['interrupted']) && empty($Block['li']['handler']['argument']))
{
return null;
}
- $requiredIndent = ($Block['indent'] + strlen($Block['data']['marker']));
+ $requiredIndent = ($Block['indent'] + \strlen($Block['data']['marker']));
if ($Line['indent'] < $requiredIndent
- and (
+ && (
(
$Block['data']['type'] === 'ol'
- and preg_match('/^[0-9]++'.$Block['data']['markerTypeRegex'].'(?:[ ]++(.*)|$)/', $Line['text'], $matches)
- ) or (
+ && \preg_match('/^[0-9]++'.$Block['data']['markerTypeRegex'].'(?:[ ]++(.*)|$)/', $Line['text'], $matches)
+ ) || (
$Block['data']['type'] === 'ul'
- and preg_match('/^'.$Block['data']['markerTypeRegex'].'(?:[ ]++(.*)|$)/', $Line['text'], $matches)
+ && \preg_match('/^'.$Block['data']['markerTypeRegex'].'(?:[ ]++(.*)|$)/', $Line['text'], $matches)
)
)
) {
@@ -3002,25 +3003,25 @@ class Markdown
$Block['indent'] = $Line['indent'];
- $Block['li'] = array(
- 'name' => 'li',
- 'handler' => array(
- 'function' => 'li',
- 'argument' => array($text),
- 'destination' => 'elements'
- )
- );
+ $Block['li'] = [
+ 'name' => 'li',
+ 'handler' => [
+ 'function' => 'li',
+ 'argument' => [$text],
+ 'destination' => 'elements',
+ ],
+ ];
$Block['element']['elements'] []= & $Block['li'];
return $Block;
}
- elseif ($Line['indent'] < $requiredIndent and $this->blockList($Line))
+ elseif ($Line['indent'] < $requiredIndent && $this->blockList($Line))
{
return null;
}
- if ($Line['text'][0] === '[' and $this->blockReference($Line))
+ if ($Line['text'][0] === '[' && $this->blockReference($Line))
{
return $Block;
}
@@ -3036,16 +3037,16 @@ class Markdown
unset($Block['interrupted']);
}
- $text = substr($Line['body'], $requiredIndent);
+ $text = \substr($Line['body'], $requiredIndent);
$Block['li']['handler']['argument'] []= $text;
return $Block;
}
- if ( ! isset($Block['interrupted']))
+ if (! isset($Block['interrupted']))
{
- $text = preg_replace('/^[ ]{0,'.$requiredIndent.'}+/', '', $Line['body']);
+ $text = \preg_replace('/^[ ]{0,'.$requiredIndent.'}+/', '', $Line['body']);
$Block['li']['handler']['argument'] []= $text;
@@ -3059,7 +3060,7 @@ class Markdown
{
foreach ($Block['element']['elements'] as &$li)
{
- if (end($li['handler']['argument']) !== '')
+ if (\end($li['handler']['argument']) !== '')
{
$li['handler']['argument'] []= '';
}
@@ -3074,18 +3075,18 @@ class Markdown
protected function blockQuoteBase($Line)
{
- if (preg_match('/^>[ ]?+(.*+)/', $Line['text'], $matches))
+ if (\preg_match('/^>[ ]?+(.*+)/', $Line['text'], $matches))
{
- $Block = array(
- 'element' => array(
- 'name' => 'blockquote',
- 'handler' => array(
- 'function' => 'linesElements',
- 'argument' => (array) $matches[1],
+ $Block = [
+ 'element' => [
+ 'name' => 'blockquote',
+ 'handler' => [
+ 'function' => 'linesElements',
+ 'argument' => (array) $matches[1],
'destination' => 'elements',
- )
- ),
- );
+ ],
+ ],
+ ];
return $Block;
}
@@ -3098,14 +3099,14 @@ class Markdown
return;
}
- if ($Line['text'][0] === '>' and preg_match('/^>[ ]?+(.*+)/', $Line['text'], $matches))
+ if ($Line['text'][0] === '>' && \preg_match('/^>[ ]?+(.*+)/', $Line['text'], $matches))
{
$Block['element']['handler']['argument'] []= $matches[1];
return $Block;
}
- if ( ! isset($Block['interrupted']))
+ if (! isset($Block['interrupted']))
{
$Block['element']['handler']['argument'] []= $Line['text'];
@@ -3120,13 +3121,13 @@ class Markdown
{
$marker = $Line['text'][0];
- if (substr_count($Line['text'], $marker) >= 3 and chop($Line['text'], " $marker") === '')
+ if (\substr_count($Line['text'], $marker) >= 3 && \rtrim($Line['text'], " {$marker}") === '')
{
- $Block = array(
- 'element' => array(
+ $Block = [
+ 'element' => [
'name' => 'hr',
- ),
- );
+ ],
+ ];
return $Block;
}
@@ -3137,12 +3138,12 @@ class Markdown
protected function blockSetextHeaderParent($Line, array $Block = null)
{
- if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted']))
+ if (! isset($Block) || $Block['type'] !== 'Paragraph' || isset($Block['interrupted']))
{
return;
}
- if ($Line['indent'] < 4 and chop(chop($Line['text'], ' '), $Line['text'][0]) === '')
+ if ($Line['indent'] < 4 && \rtrim(\rtrim($Line['text'], ' '), $Line['text'][0]) === '')
{
$Block['element']['name'] = $Line['text'][0] === '=' ? 'h1' : 'h2';
@@ -3155,21 +3156,21 @@ class Markdown
protected function blockReferenceBase($Line)
{
- if (strpos($Line['text'], ']') !== false
- and preg_match('/^\[(.+?)\]:[ ]*+(\S+?)>?(?:[ ]+["\'(](.+)["\')])?[ ]*+$/', $Line['text'], $matches)
+ if (\strpos($Line['text'], ']') !== false
+ && \preg_match('/^\[(.+?)\]:[ ]*+(\S+?)>?(?:[ ]+["\'(](.+)["\')])?[ ]*+$/', $Line['text'], $matches)
) {
- $id = strtolower($matches[1]);
+ $id = \strtolower($matches[1]);
- $Data = array(
- 'url' => UriFactory::build($matches[2]),
+ $Data = [
+ 'url' => UriFactory::build($matches[2]),
'title' => isset($matches[3]) ? $matches[3] : null,
- );
+ ];
$this->DefinitionData['Reference'][$id] = $Data;
- $Block = array(
- 'element' => array(),
- );
+ $Block = [
+ 'element' => [],
+ ];
return $Block;
}
@@ -3180,37 +3181,37 @@ class Markdown
protected function blockTableBase($Line, array $Block = null)
{
- if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted']))
+ if (! isset($Block) || $Block['type'] !== 'Paragraph' || isset($Block['interrupted']))
{
return;
}
if (
- strpos($Block['element']['handler']['argument'], '|') === false
- and strpos($Line['text'], '|') === false
- and strpos($Line['text'], ':') === false
- or strpos($Block['element']['handler']['argument'], "\n") !== false
+ \strpos($Block['element']['handler']['argument'], '|') === false
+ && \strpos($Line['text'], '|') === false
+ && \strpos($Line['text'], ':') === false
+ || \strpos($Block['element']['handler']['argument'], "\n") !== false
) {
return;
}
- if (chop($Line['text'], ' -:|') !== '')
+ if (\rtrim($Line['text'], ' -:|') !== '')
{
return;
}
- $alignments = array();
+ $alignments = [];
$divider = $Line['text'];
- $divider = trim($divider);
- $divider = trim($divider, '|');
+ $divider = \trim($divider);
+ $divider = \trim($divider, '|');
- $dividerCells = explode('|', $divider);
+ $dividerCells = \explode('|', $divider);
foreach ($dividerCells as $dividerCell)
{
- $dividerCell = trim($dividerCell);
+ $dividerCell = \trim($dividerCell);
if ($dividerCell === '')
{
@@ -3224,7 +3225,7 @@ class Markdown
$alignment = 'left';
}
- if (substr($dividerCell, - 1) === ':')
+ if (\substr($dividerCell, - 1) === ':')
{
$alignment = $alignment === 'left' ? 'center' : 'right';
}
@@ -3234,40 +3235,40 @@ class Markdown
# ~
- $HeaderElements = array();
+ $HeaderElements = [];
$header = $Block['element']['handler']['argument'];
- $header = trim($header);
- $header = trim($header, '|');
+ $header = \trim($header);
+ $header = \trim($header, '|');
- $headerCells = explode('|', $header);
+ $headerCells = \explode('|', $header);
- if (count($headerCells) !== count($alignments))
+ if (\count($headerCells) !== \count($alignments))
{
return;
}
foreach ($headerCells as $index => $headerCell)
{
- $headerCell = trim($headerCell);
+ $headerCell = \trim($headerCell);
- $HeaderElement = array(
- 'name' => 'th',
- 'handler' => array(
- 'function' => 'lineElements',
- 'argument' => $headerCell,
+ $HeaderElement = [
+ 'name' => 'th',
+ 'handler' => [
+ 'function' => 'lineElements',
+ 'argument' => $headerCell,
'destination' => 'elements',
- )
- );
+ ],
+ ];
if (isset($alignments[$index]))
{
$alignment = $alignments[$index];
- $HeaderElement['attributes'] = array(
- 'style' => "text-align: $alignment;",
- );
+ $HeaderElement['attributes'] = [
+ 'style' => "text-align: {$alignment};",
+ ];
}
$HeaderElements []= $HeaderElement;
@@ -3275,28 +3276,28 @@ class Markdown
# ~
- $Block = array(
+ $Block = [
'alignments' => $alignments,
'identified' => true,
- 'element' => array(
- 'name' => 'table',
- 'elements' => array(),
- ),
- );
+ 'element' => [
+ 'name' => 'table',
+ 'elements' => [],
+ ],
+ ];
- $Block['element']['elements'] []= array(
+ $Block['element']['elements'] []= [
'name' => 'thead',
- );
+ ];
- $Block['element']['elements'] []= array(
- 'name' => 'tbody',
- 'elements' => array(),
- );
+ $Block['element']['elements'] []= [
+ 'name' => 'tbody',
+ 'elements' => [],
+ ];
- $Block['element']['elements'][0]['elements'] []= array(
- 'name' => 'tr',
+ $Block['element']['elements'][0]['elements'] []= [
+ 'name' => 'tr',
'elements' => $HeaderElements,
- );
+ ];
return $Block;
}
@@ -3308,46 +3309,46 @@ class Markdown
return;
}
- if (count($Block['alignments']) === 1 or $Line['text'][0] === '|' or strpos($Line['text'], '|'))
+ if (\count($Block['alignments']) === 1 || $Line['text'][0] === '|' || \strpos($Line['text'], '|'))
{
- $Elements = array();
+ $Elements = [];
$row = $Line['text'];
- $row = trim($row);
- $row = trim($row, '|');
+ $row = \trim($row);
+ $row = \trim($row, '|');
- preg_match_all('/(?:(\\\\[|])|[^|`]|`[^`]++`|`)++/', $row, $matches);
+ \preg_match_all('/(?:(\\\\[|])|[^|`]|`[^`]++`|`)++/', $row, $matches);
- $cells = array_slice($matches[0], 0, count($Block['alignments']));
+ $cells = \array_slice($matches[0], 0, \count($Block['alignments']));
foreach ($cells as $index => $cell)
{
- $cell = trim($cell);
+ $cell = \trim($cell);
- $Element = array(
- 'name' => 'td',
- 'handler' => array(
- 'function' => 'lineElements',
- 'argument' => $cell,
+ $Element = [
+ 'name' => 'td',
+ 'handler' => [
+ 'function' => 'lineElements',
+ 'argument' => $cell,
'destination' => 'elements',
- )
- );
+ ],
+ ];
if (isset($Block['alignments'][$index]))
{
- $Element['attributes'] = array(
+ $Element['attributes'] = [
'style' => 'text-align: ' . $Block['alignments'][$index] . ';',
- );
+ ];
}
$Elements []= $Element;
}
- $Element = array(
- 'name' => 'tr',
+ $Element = [
+ 'name' => 'tr',
'elements' => $Elements,
- );
+ ];
$Block['element']['elements'][1]['elements'] []= $Element;
@@ -3361,17 +3362,17 @@ class Markdown
protected function paragraph($Line)
{
- return array(
- 'type' => 'Paragraph',
- 'element' => array(
- 'name' => 'p',
- 'handler' => array(
- 'function' => 'lineElements',
- 'argument' => $Line['text'],
+ return [
+ 'type' => 'Paragraph',
+ 'element' => [
+ 'name' => 'p',
+ 'handler' => [
+ 'function' => 'lineElements',
+ 'argument' => $Line['text'],
'destination' => 'elements',
- ),
- ),
- );
+ ],
+ ],
+ ];
}
protected function paragraphContinue($Line, array $Block)
@@ -3390,18 +3391,18 @@ class Markdown
# Inline Elements
#
- protected $InlineTypes = array(
- '!' => array('Image'),
- '&' => array('SpecialCharacter'),
- '*' => array('Emphasis'),
- ':' => array('Url'),
- '<' => array('UrlTag', 'EmailTag', 'Markup'),
- '[' => array('FootnoteMarker', 'Link'),
- '_' => array('Emphasis'),
- '`' => array('Code'),
- '~' => array('Strikethrough'),
- '\\' => array('EscapeSequence'),
- );
+ protected $InlineTypes = [
+ '!' => ['Image'],
+ '&' => ['SpecialCharacter'],
+ '*' => ['Emphasis'],
+ ':' => ['Url'],
+ '<' => ['UrlTag', 'EmailTag', 'Markup'],
+ '[' => ['FootnoteMarker', 'Link'],
+ '_' => ['Emphasis'],
+ '`' => ['Code'],
+ '~' => ['Strikethrough'],
+ '\\' => ['EscapeSequence'],
+ ];
# ~
@@ -3411,7 +3412,7 @@ class Markdown
# ~
#
- public function line($text, $nonNestables = array())
+ public function line($text, $nonNestables = [])
{
return $this->elements($this->lineElements($text, $nonNestables));
}
@@ -3524,17 +3525,17 @@ class Markdown
protected function inlineTextParent($text)
{
- $Inline = array(
- 'extent' => strlen($text),
- 'element' => array(),
- );
+ $Inline = [
+ 'extent' => \strlen($text),
+ 'element' => [],
+ ];
$Inline['element']['elements'] = self::pregReplaceElements(
$this->breaksEnabled ? '/[ ]*+\n/' : '/(?:[ ]*+\\\\|[ ]{2,}+)\n/',
- array(
- array('name' => 'br'),
- array('text' => "\n"),
- ),
+ [
+ ['name' => 'br'],
+ ['text' => "\n"],
+ ],
$text
);
@@ -3545,18 +3546,18 @@ class Markdown
{
$marker = $Excerpt['text'][0];
- if (preg_match('/^(['.$marker.']++)[ ]*+(.+?)[ ]*+(? strlen($matches[0]),
- 'element' => array(
+ return [
+ 'extent' => \strlen($matches[0]),
+ 'element' => [
'name' => 'code',
'text' => $text,
- ),
- );
+ ],
+ ];
}
}
@@ -3567,47 +3568,47 @@ class Markdown
$commonMarkEmail = '[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]++@'
. $hostnameLabel . '(?:\.' . $hostnameLabel . ')*';
- if (strpos($Excerpt['text'], '>') !== false
- and preg_match("/^<((mailto:)?$commonMarkEmail)>/i", $Excerpt['text'], $matches)
+ if (\strpos($Excerpt['text'], '>') !== false
+ && \preg_match("/^<((mailto:)?{$commonMarkEmail})>/i", $Excerpt['text'], $matches)
){
$url = $matches[1];
- if ( ! isset($matches[2]))
+ if (! isset($matches[2]))
{
- $url = "mailto:$url";
+ $url = "mailto:{$url}";
}
- return array(
- 'extent' => strlen($matches[0]),
- 'element' => array(
- 'name' => 'a',
- 'text' => $matches[1],
- 'attributes' => array(
+ return [
+ 'extent' => \strlen($matches[0]),
+ 'element' => [
+ 'name' => 'a',
+ 'text' => $matches[1],
+ 'attributes' => [
'href' => $url,
- ),
- ),
- );
+ ],
+ ],
+ ];
}
}
protected function inlineEmphasisParent($Excerpt)
{
- if ( ! isset($Excerpt['text'][1]))
+ if (! isset($Excerpt['text'][1]))
{
return;
}
$marker = $Excerpt['text'][0];
- if ($Excerpt['text'][1] === $marker && isset($this->StrongRegex[$marker]) and preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches))
+ if ($Excerpt['text'][1] === $marker && isset($this->StrongRegex[$marker]) && \preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches))
{
$emphasis = 'strong';
}
- elseif ($Excerpt['text'][1] === $marker && isset($this->UnderlineRegex[$marker]) and preg_match($this->UnderlineRegex[$marker], $Excerpt['text'], $matches))
+ elseif ($Excerpt['text'][1] === $marker && isset($this->UnderlineRegex[$marker]) && \preg_match($this->UnderlineRegex[$marker], $Excerpt['text'], $matches))
{
$emphasis = 'u';
}
- elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches))
+ elseif (\preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches))
{
$emphasis = 'em';
}
@@ -3616,17 +3617,17 @@ class Markdown
return;
}
- return array(
- 'extent' => strlen($matches[0]),
- 'element' => array(
- 'name' => $emphasis,
- 'handler' => array(
- 'function' => 'lineElements',
- 'argument' => $matches[1],
+ return [
+ 'extent' => \strlen($matches[0]),
+ 'element' => [
+ 'name' => $emphasis,
+ 'handler' => [
+ 'function' => 'lineElements',
+ 'argument' => $matches[1],
'destination' => 'elements',
- )
- ),
- );
+ ],
+ ],
+ ];
}
/*
@@ -3644,12 +3645,12 @@ class Markdown
protected function inlineImageParent($Excerpt)
{
- if ( ! isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[')
+ if (! isset($Excerpt['text'][1]) || $Excerpt['text'][1] !== '[')
{
return;
}
- $Excerpt['text']= substr($Excerpt['text'], 1);
+ $Excerpt['text']= \substr($Excerpt['text'], 1);
$Link = $this->inlineLink($Excerpt);
@@ -3658,17 +3659,17 @@ class Markdown
return;
}
- $Inline = array(
- 'extent' => $Link['extent'] + 1,
- 'element' => array(
- 'name' => 'img',
- 'attributes' => array(
+ $Inline = [
+ 'extent' => $Link['extent'] + 1,
+ 'element' => [
+ 'name' => 'img',
+ 'attributes' => [
'src' => $Link['element']['attributes']['href'],
'alt' => $Link['element']['handler']['argument'],
- ),
+ ],
'autobreak' => true,
- ),
- );
+ ],
+ ];
$Inline['element']['attributes'] += $Link['element']['attributes'];
@@ -3679,171 +3680,169 @@ class Markdown
protected function inlineLinkParent($Excerpt)
{
- $Element = array(
- 'name' => 'a',
- 'handler' => array(
- 'function' => 'lineElements',
- 'argument' => null,
+ $Element = [
+ 'name' => 'a',
+ 'handler' => [
+ 'function' => 'lineElements',
+ 'argument' => null,
'destination' => 'elements',
- ),
- 'nonNestables' => array('Url', 'Link'),
- 'attributes' => array(
- 'href' => null,
+ ],
+ 'nonNestables' => ['Url', 'Link'],
+ 'attributes' => [
+ 'href' => null,
'title' => null,
- ),
- );
+ ],
+ ];
$extent = 0;
$remainder = $Excerpt['text'];
- if (preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches))
+ if (\preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches))
{
$Element['handler']['argument'] = $matches[1];
- $extent += strlen($matches[0]);
+ $extent += \strlen($matches[0]);
- $remainder = substr($remainder, $extent);
+ $remainder = \substr($remainder, $extent);
}
else
{
return;
}
- if (preg_match('/^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*+"|\'[^\']*+\'))?\s*+[)]/', $remainder, $matches))
+ if (\preg_match('/^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*+"|\'[^\']*+\'))?\s*+[)]/', $remainder, $matches))
{
$Element['attributes']['href'] = $matches[1];
if (isset($matches[2]))
{
- $Element['attributes']['title'] = substr($matches[2], 1, - 1);
+ $Element['attributes']['title'] = \substr($matches[2], 1, - 1);
}
- $extent += strlen($matches[0]);
+ $extent += \strlen($matches[0]);
}
else
{
- if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches))
+ if (\preg_match('/^\s*\[(.*?)\]/', $remainder, $matches))
{
- $definition = strlen($matches[1]) ? $matches[1] : $Element['handler']['argument'];
- $definition = strtolower($definition);
+ $definition = \strlen($matches[1]) ? $matches[1] : $Element['handler']['argument'];
+ $definition = \strtolower($definition);
- $extent += strlen($matches[0]);
+ $extent += \strlen($matches[0]);
}
else
{
- $definition = strtolower($Element['handler']['argument']);
+ $definition = \strtolower($Element['handler']['argument']);
}
- if ( ! isset($this->DefinitionData['Reference'][$definition]))
+ if (! isset($this->DefinitionData['Reference'][$definition]))
{
return;
}
$Definition = $this->DefinitionData['Reference'][$definition];
- $Element['attributes']['href'] = $Definition['url'];
+ $Element['attributes']['href'] = $Definition['url'];
$Element['attributes']['title'] = $Definition['title'];
}
- return array(
- 'extent' => $extent,
+ return [
+ 'extent' => $extent,
'element' => $Element,
- );
+ ];
}
protected function inlineMarkupBase($Excerpt)
{
- if ($this->markupEscaped or $this->safeMode or strpos($Excerpt['text'], '>') === false)
+ if ($this->markupEscaped || $this->safeMode || \strpos($Excerpt['text'], '>') === false)
{
return;
}
- if ($Excerpt['text'][1] === '/' and preg_match('/^<\/\w[\w-]*+[ ]*+>/s', $Excerpt['text'], $matches))
+ if ($Excerpt['text'][1] === '/' && \preg_match('/^<\/\w[\w-]*+[ ]*+>/s', $Excerpt['text'], $matches))
{
- return array(
- 'element' => array('rawHtml' => $matches[0]),
- 'extent' => strlen($matches[0]),
- );
+ return [
+ 'element' => ['rawHtml' => $matches[0]],
+ 'extent' => \strlen($matches[0]),
+ ];
}
- if ($Excerpt['text'][1] === '!' and preg_match('/^/s', $Excerpt['text'], $matches))
+ if ($Excerpt['text'][1] === '!' && \preg_match('/^/s', $Excerpt['text'], $matches))
{
- return array(
- 'element' => array('rawHtml' => $matches[0]),
- 'extent' => strlen($matches[0]),
- );
+ return [
+ 'element' => ['rawHtml' => $matches[0]],
+ 'extent' => \strlen($matches[0]),
+ ];
}
- if ($Excerpt['text'][1] !== ' ' and preg_match('/^<\w[\w-]*+(?:[ ]*+'.$this->regexHtmlAttribute.')*+[ ]*+\/?>/s', $Excerpt['text'], $matches))
+ if ($Excerpt['text'][1] !== ' ' && \preg_match('/^<\w[\w-]*+(?:[ ]*+'.$this->regexHtmlAttribute.')*+[ ]*+\/?>/s', $Excerpt['text'], $matches))
{
- return array(
- 'element' => array('rawHtml' => $matches[0]),
- 'extent' => strlen($matches[0]),
- );
+ return [
+ 'element' => ['rawHtml' => $matches[0]],
+ 'extent' => \strlen($matches[0]),
+ ];
}
}
protected function inlineSpecialCharacter($Excerpt)
{
- if (substr($Excerpt['text'], 1, 1) !== ' ' and strpos($Excerpt['text'], ';') !== false
- and preg_match('/^&(#?+[0-9a-zA-Z]++);/', $Excerpt['text'], $matches)
+ if (\substr($Excerpt['text'], 1, 1) !== ' ' && \strpos($Excerpt['text'], ';') !== false
+ && \preg_match('/^&(#?+[0-9a-zA-Z]++);/', $Excerpt['text'], $matches)
) {
- return array(
- 'element' => array('rawHtml' => '&' . $matches[1] . ';'),
- 'extent' => strlen($matches[0]),
- );
+ return [
+ 'element' => ['rawHtml' => '&' . $matches[1] . ';'],
+ 'extent' => \strlen($matches[0]),
+ ];
}
-
- return;
}
protected function inlineStrikethroughBase($Excerpt)
{
- if ( ! isset($Excerpt['text'][1]))
+ if (! isset($Excerpt['text'][1]))
{
return;
}
- if ($Excerpt['text'][1] === '~' and preg_match('/^~~(?=\S)(.+?)(?<=\S)~~/', $Excerpt['text'], $matches))
+ if ($Excerpt['text'][1] === '~' && \preg_match('/^~~(?=\S)(.+?)(?<=\S)~~/', $Excerpt['text'], $matches))
{
- return array(
- 'extent' => strlen($matches[0]),
- 'element' => array(
- 'name' => 'del',
- 'handler' => array(
- 'function' => 'lineElements',
- 'argument' => $matches[1],
+ return [
+ 'extent' => \strlen($matches[0]),
+ 'element' => [
+ 'name' => 'del',
+ 'handler' => [
+ 'function' => 'lineElements',
+ 'argument' => $matches[1],
'destination' => 'elements',
- )
- ),
- );
+ ],
+ ],
+ ];
}
}
protected function inlineUrlBase($Excerpt)
{
- if ($this->urlsLinked !== true or ! isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/')
+ if ($this->urlsLinked !== true || ! isset($Excerpt['text'][2]) || $Excerpt['text'][2] !== '/')
{
return;
}
- if (strpos($Excerpt['context'], 'http') !== false
- and preg_match('/\bhttps?+:[\/]{2}[^\s<]+\b\/*+/ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE)
+ if (\strpos($Excerpt['context'], 'http') !== false
+ && \preg_match('/\bhttps?+:[\/]{2}[^\s<]+\b\/*+/ui', $Excerpt['context'], $matches, \PREG_OFFSET_CAPTURE)
) {
$url = $matches[0][0];
- $Inline = array(
- 'extent' => strlen($matches[0][0]),
+ $Inline = [
+ 'extent' => \strlen($matches[0][0]),
'position' => $matches[0][1],
- 'element' => array(
- 'name' => 'a',
- 'text' => $url,
- 'attributes' => array(
+ 'element' => [
+ 'name' => 'a',
+ 'text' => $url,
+ 'attributes' => [
'href' => $url,
- ),
- ),
- );
+ ],
+ ],
+ ];
return $Inline;
}
@@ -3851,20 +3850,20 @@ class Markdown
protected function inlineUrlTagBase($Excerpt)
{
- if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<(\w++:\/{2}[^ >]++)>/i', $Excerpt['text'], $matches))
+ if (\strpos($Excerpt['text'], '>') !== false && \preg_match('/^<(\w++:\/{2}[^ >]++)>/i', $Excerpt['text'], $matches))
{
$url = $matches[1];
- return array(
- 'extent' => strlen($matches[0]),
- 'element' => array(
- 'name' => 'a',
- 'text' => $url,
- 'attributes' => array(
+ return [
+ 'extent' => \strlen($matches[0]),
+ 'element' => [
+ 'name' => 'a',
+ 'text' => $url,
+ 'attributes' => [
'href' => $url,
- ),
- ),
- );
+ ],
+ ],
+ ];
}
}
@@ -3886,10 +3885,10 @@ class Markdown
{
if (!isset($Element['nonNestables']))
{
- $Element['nonNestables'] = array();
+ $Element['nonNestables'] = [];
}
- if (is_string($Element['handler']))
+ if (\is_string($Element['handler']))
{
$function = $Element['handler'];
$argument = $Element['text'];
@@ -3898,8 +3897,8 @@ class Markdown
}
else
{
- $function = $Element['handler']['function'];
- $argument = $Element['handler']['argument'];
+ $function = $Element['handler']['function'];
+ $argument = $Element['handler']['argument'];
$destination = $Element['handler']['destination'];
}
@@ -3918,17 +3917,17 @@ class Markdown
protected function handleElementRecursive(array $Element)
{
- return $this->elementApplyRecursive(array($this, 'handle'), $Element);
+ return $this->elementApplyRecursive([$this, 'handle'], $Element);
}
protected function handleElementsRecursive(array $Elements)
{
- return $this->elementsApplyRecursive(array($this, 'handle'), $Elements);
+ return $this->elementsApplyRecursive([$this, 'handle'], $Elements);
}
protected function elementApplyRecursive($closure, array $Element)
{
- $Element = call_user_func($closure, $Element);
+ $Element = \call_user_func($closure, $Element);
if (isset($Element['elements']))
{
@@ -3953,7 +3952,7 @@ class Markdown
$Element['element'] = $this->elementsApplyRecursiveDepthFirst($closure, $Element['element']);
}
- $Element = call_user_func($closure, $Element);
+ $Element = \call_user_func($closure, $Element);
return $Element;
}
@@ -4005,7 +4004,7 @@ class Markdown
continue;
}
- $markup .= " $name=\"".self::escape($value).'"';
+ $markup .= " {$name}=\"".self::escape($value).'"';
}
}
}
@@ -4023,7 +4022,7 @@ class Markdown
$text = $Element['rawHtml'];
$allowRawHtmlInSafeMode = isset($Element['allowRawHtmlInSafeMode']) && $Element['allowRawHtmlInSafeMode'];
- $permitRawHtml = !$this->safeMode || $allowRawHtmlInSafeMode;
+ $permitRawHtml = !$this->safeMode || $allowRawHtmlInSafeMode;
}
$hasContent = isset($text) || isset($Element['element']) || isset($Element['elements']);
@@ -4096,9 +4095,9 @@ class Markdown
{
$Elements = $this->linesElements($lines);
- if ( ! in_array('', $lines)
- and isset($Elements[0]) and isset($Elements[0]['name'])
- and $Elements[0]['name'] === 'p'
+ if (! \in_array('', $lines)
+ && isset($Elements[0]) && isset($Elements[0]['name'])
+ && $Elements[0]['name'] === 'p'
) {
unset($Elements[0]['name']);
}
@@ -4116,15 +4115,15 @@ class Markdown
*/
protected static function pregReplaceElements($regexp, $Elements, $text)
{
- $newElements = array();
+ $newElements = [];
- while (preg_match($regexp, $text, $matches, PREG_OFFSET_CAPTURE))
+ while (\preg_match($regexp, $text, $matches, \PREG_OFFSET_CAPTURE))
{
$offset = $matches[0][1];
- $before = substr($text, 0, $offset);
- $after = substr($text, $offset + strlen($matches[0][0]));
+ $before = \substr($text, 0, $offset);
+ $after = \substr($text, $offset + \strlen($matches[0][0]));
- $newElements[] = array('text' => $before);
+ $newElements[] = ['text' => $before];
foreach ($Elements as $Element)
{
@@ -4134,7 +4133,7 @@ class Markdown
$text = $after;
}
- $newElements[] = array('text' => $text);
+ $newElements[] = ['text' => $text];
return $newElements;
}
@@ -4152,13 +4151,13 @@ class Markdown
protected function sanitiseElement(array $Element)
{
- static $goodAttribute = '/^[a-zA-Z0-9][a-zA-Z0-9-_]*+$/';
- static $safeUrlNameToAtt = array(
+ static $goodAttribute = '/^[a-zA-Z0-9][a-zA-Z0-9-_]*+$/';
+ static $safeUrlNameToAtt = [
'a' => 'href',
'img' => 'src',
- );
+ ];
- if ( ! isset($Element['name']))
+ if (! isset($Element['name']))
{
unset($Element['attributes']);
return $Element;
@@ -4169,12 +4168,12 @@ class Markdown
$Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]);
}
- if ( ! empty($Element['attributes']))
+ if (! empty($Element['attributes']))
{
foreach ($Element['attributes'] as $att => $val)
{
# filter out badly parsed attribute
- if ( ! preg_match($goodAttribute, $att))
+ if (! \preg_match($goodAttribute, $att))
{
unset($Element['attributes'][$att]);
}
@@ -4199,7 +4198,7 @@ class Markdown
}
}
- $Element['attributes'][$attribute] = str_replace(':', '%3A', $Element['attributes'][$attribute]);
+ $Element['attributes'][$attribute] = \str_replace(':', '%3A', $Element['attributes'][$attribute]);
return $Element;
}
@@ -4210,24 +4209,24 @@ class Markdown
protected static function escape(string $text, bool $allowQuotes = false)
{
- return \htmlspecialchars($text, $allowQuotes ? ENT_NOQUOTES : ENT_QUOTES, 'UTF-8');
+ return \htmlspecialchars($text, $allowQuotes ? \ENT_NOQUOTES : \ENT_QUOTES, 'UTF-8');
}
protected static function striAtStart($string, $needle)
{
- $len = strlen($needle);
+ $len = \strlen($needle);
- if ($len > strlen($string))
+ if ($len > \strlen($string))
{
return false;
}
else
{
- return strtolower(substr($string, 0, $len)) === strtolower($needle);
+ return \strtolower(\substr($string, 0, $len)) === \strtolower($needle);
}
}
- static function instance($name = 'default')
+ public static function instance($name = 'default')
{
if (isset(self::$instances[$name]))
{
@@ -4241,7 +4240,7 @@ class Markdown
return $instance;
}
- private static $instances = array();
+ private static $instances = [];
#
# Fields
@@ -4250,42 +4249,46 @@ class Markdown
protected $DefinitionData;
public const ID_ATTRIBUTE_DEFAULT = 'toc';
+
protected $tagToc = '[toc]';
protected $contentsListArray = [];
+
protected $contentsListString = '';
+
protected $firstHeadLevel = 0;
protected $isBlacklistInitialized = false;
+
protected $anchorDuplicates = [];
#
# Read-Only
- protected $specialCharacters = array(
+ protected $specialCharacters = [
'\\', '`', '*', '_', '{', '}', '[', ']', '(', ')', '>', '#', '+', '-', '.', '!', '|', '?', '"', "'", '<',
- );
+ ];
- protected $StrongRegex = array(
+ protected $StrongRegex = [
'*' => '/^[*]{2}((?:\\\\\*|[^*]|[*][^*]*+[*])+?)[*]{2}(?![*])/s',
- );
+ ];
- protected $UnderlineRegex = array(
+ protected $UnderlineRegex = [
'_' => '/^__((?:\\\\_|[^_]|_[^_]*+_)+?)__(?!_)/us',
- );
+ ];
- protected $EmRegex = array(
+ protected $EmRegex = [
'*' => '/^[*]((?:\\\\\*|[^*]|[*][*][^*]+?[*][*])+?)[*](?![*])/s',
'_' => '/^_((?:\\\\_|[^_]|__[^_]*__)+?)_(?!_)\b/us',
- );
+ ];
protected $regexHtmlAttribute = '[a-zA-Z_:][\w:.-]*+(?:\s*+=\s*+(?:[^"\'=<>`\s]+|"[^"]*+"|\'[^\']*+\'))?+';
- protected $voidElements = array(
+ protected $voidElements = [
'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source',
- );
+ ];
- protected $textLevelElements = array(
+ protected $textLevelElements = [
'a', 'br', 'bdo', 'abbr', 'blink', 'nextid', 'acronym', 'basefont',
'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing',
'i', 'rp', 'del', 'code', 'strike', 'marquee',
@@ -4295,5 +4298,5 @@ class Markdown
'sup', 'ruby',
'var', 'span',
'wbr', 'time',
- );
+ ];
}