Перейти к содержимому

Rich-text formatting in PHP: HTML, Markdown, rich-text editors like TinyMCE and doing it securely

Dave Hollingworth

0:00 / 0:00

Rich-text formatting in PHP: HTML, Markdown, rich-text editors like TinyMCE and doing it securely

12 693 просмотра · 5 лет назад
Dave Hollingworth
36 тыс. подписчиков
12 693 просмотра · 5 лет назад
PHP for Beginners course: ➤ https://davehollingworth.com/courses/ PHP MVC course: ► https://davehollingworth.com/courses/ CodeIgniter 4 course: ► https://davehollingworth.com/courses/ In an HTML form, a textarea element is used to collect a sizeable amount of text. You can enter more text than a regular text input, but it's still just plain text. In this video we'll look at how to allow the user of a form to add formatting to the content. We'll also learn how to do it securely to avoid code injection. We'll look at using HTML directly, using a plain-text markup language like Markdown, and using a rich-text editor in the browser like TinyMCE. Resources: https://daringfireball.net/projects/m... https://packagist.org/packages/erusev... https://www.tiny.cloud/ https://www.php.net/manual/en/functio... http://htmlpurifier.org/ Code shown in the video: https://gist.github.com/daveh/b93ca07... 00:00 Intro 01:13 Allowing HTML 02:38 Markdown 05:52 Rich-text editors 10:28 Using strip_tags 12:46 Using HTMLPurifier 16:29 Summary