1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- require_once 'HTML/QuickForm/Rule.php';
- require_once api_get_path(SYS_PATH).'main/inc/lib/kses-0.2.2/kses.php';
- class HTML_QuickForm_Rule_HTML extends HTML_QuickForm_Rule
- {
-
- function validate($html, $mode = NO_HTML)
- {
- $allowed_tags = self::get_allowed_tags ($mode, $fullpage);
- $cleaned_html = kses($html, $allowed_tags);
- return $html == $cleaned_html;
- }
-
- static function get_allowed_tags($mode)
- {
-
-
- global $allowed_tags_student, $allowed_tags_student_full_page, $allowed_tags_teacher, $allowed_tags_teacher_full_page;
- switch($mode)
- {
- case NO_HTML:
- return array();
- break;
- case STUDENT_HTML:
- return $allowed_tags_student;
- break;
- case STUDENT_HTML_FULLPAGE:
- return array_merge($allowed_tags_student, $allowed_tags_student_full_page);
- break;
- case TEACHER_HTML:
- return $allowed_tags_teacher;
- break;
- case TEACHER_HTML_FULLPAGE:
- return array_merge($allowed_tags_teacher, $allowed_tags_teacher_full_page);
- break;
- default:
- return array();
- break;
- }
- }
- }
|