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('/^\[(.+?)\]:[ ]*+?(?:[ ]+["\'(](.+)["\')])?[ ]*+$/', $Line['text'], $matches) + if (\strpos($Line['text'], ']') !== false + && \preg_match('/^\[(.+?)\]:[ ]*+?(?:[ ]+["\'(](.+)["\')])?[ ]*+$/', $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', - ); + ]; }