add('name', PLUGIN_EVENT_HTMLVALIDATOR_NAME); $propbag->add('description', PLUGIN_EVENT_HTMLVALIDATOR_DESC); $propbag->add('stackable', false); $propbag->add('author', 'Garvin Hicking'); $propbag->add('version', '1.3'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', 'php' => '4.1.0' )); $propbag->add('event_hooks', array( 'backend_preview' => true, 'backend_display' => true, )); $propbag->add('configuration', array('charset', 'doctype', 'default_validate')); $propbag->add('groups', array('BACKEND_EDITOR')); } function introspect_config_item($name, &$propbag) { switch($name) { case 'default_validate': $propbag->add('type', 'boolean'); $propbag->add('name', PLUGIN_EVENT_HTMLVALIDATOR_VALIDATE); $propbag->add('description', PLUGIN_EVENT_HTMLVALIDATOR_VALIDATE); $propbag->add('default', 'false'); break; case 'charset': $propbag->add('type', 'select'); $propbag->add('name', PLUGIN_EVENT_HTMLVALIDATOR_CHARSET); $propbag->add('description', PLUGIN_EVENT_HTMLVALIDATOR_CHARSETDESC); $propbag->add('default', '(detect automatically)'); $propbag->add('select_values', array( '(detect automatically)' => '(detect automatically)', 'utf-8 (Unicode, worldwide)' => 'utf-8 (Unicode, worldwide)', 'utf-16 (Unicode, worldwide)' => 'utf-16 (Unicode, worldwide)', 'iso-8859-1 (Western Europe)' => 'iso-8859-1 (Western Europe)', 'iso-8859-2 (Central Europe)' => 'iso-8859-2 (Central Europe)', 'iso-8859-3 (Southern Europe)' => 'iso-8859-3 (Southern Europe)', 'iso-8859-4 (Baltic Rim)' => 'iso-8859-4 (Baltic Rim)', 'iso-8859-5 (Cyrillic)' => 'iso-8859-5 (Cyrillic)', 'iso-8859-6-i (Arabic)' => 'iso-8859-6-i (Arabic)', 'iso-8859-7 (Greek)' => 'iso-8859-7 (Greek)', 'iso-8859-8-i (Hebrew)' => 'so-8859-8-i (Hebrew)', 'iso-8859-9 (Turkish)' => 'iso-8859-9 (Turkish)', 'iso-8859-10 (Latin 6)' => 'iso-8859-10 (Latin 6)', 'iso-8859-13 (Latin 7)' => 'iso-8859-13 (Latin 7)', 'iso-8859-14 (Celtic)' => 'iso-8859-14 (Celtic)', 'iso-8859-15 (Latin 9)' => 'iso-8859-15 (Latin 9)', 'us-ascii (basic English)' => 'us-ascii (basic English)', 'euc-jp (Japanese, Unix)' => 'euc-jp (Japanese, Unix)', 'shift_jis (Japanese, Win/Mac)' => 'shift_jis (Japanese, Win/Mac)', 'iso-2022-jp (Japanese, email)' => 'iso-2022-jp (Japanese, email)', 'euc-kr (Korean)' => 'euc-kr (Korean)', 'gb2312 (Chinese, simplified)' => 'gb2312 (Chinese, simplified)', 'gb18030 (Chinese, simplified)' => 'gb18030 (Chinese, simplified)', 'big5 (Chinese, traditional)' => 'big5 (Chinese, traditional)', 'tis-620 (Thai)' => 'tis-620 (Thai)', 'koi8-r (Russian)' => 'koi8-r (Russian)', 'koi8-u (Ukrainian)' => 'koi8-u (Ukrainian)', 'macintosh (MacRoman)' => 'macintosh (MacRoman)', 'windows-1250 (Central Europe)' => 'windows-1250 (Central Europe)', 'windows-1251 (Cyrillic)' => 'windows-1251 (Cyrillic)', 'windows-1252 (Western Europe)' => 'windows-1252 (Western Europe)', 'windows-1253 (Greek)' => 'windows-1253 (Greek)', 'windows-1254 (Turkish)' => 'windows-1254 (Turkish)', 'windows-1255 (Hebrew)' => 'windows-1255 (Hebrew)', 'windows-1256 (Arabic)' => 'windows-1256 (Arabic)', 'windows-1257 (Baltic Rim)' => 'windows-1257 (Baltic Rim)' )); break; case 'doctype': $propbag->add('type', 'select'); $propbag->add('name', PLUGIN_EVENT_HTMLVALIDATOR_DOCTYPE); $propbag->add('description', PLUGIN_EVENT_HTMLVALIDATOR_DOCTYPEDESC); $propbag->add('default', 'Inline'); $propbag->add('select_values', array( 'Inline' => '(detect automatically)', 'XHTML 1.1' => 'XHTML 1.1', 'XHTML Basic 1.0' => 'XHTML Basic 1.0', 'XHTML 1.0 Strict' => 'XHTML 1.0 Strict', 'XHTML 1.0 Transitional' => 'XHTML 1.0 Transitional', 'XHTML 1.0 Frameset' => 'XHTML 1.0 Frameset', 'HTML 4.01 Strict' => 'HTML 4.01 Strict', 'HTML 4.01 Transitional' => 'HTML 4.01 Transitional', 'HTML 4.01 Frameset' => 'HTML 4.01 Frameset', 'HTML 3.2' => 'HTML 3.2', 'HTML 2.0' => 'HTML 2.0' )); break; default: return false; } return true; } function generate_content(&$title) { $title = $this->title; } function event_hook($event, &$bag, &$eventData) { global $serendipity; $hooks = &$bag->get('event_hooks'); if (isset($hooks[$event])) { switch($event) { case 'backend_display': ?>
get_config('doctype'); $charset = $this->get_config('charset'); if (empty($doctype)) { $doctype = 'XHTML 1.1'; } if (empty($charset)) { $charset = 'iso-8859-1 (Western Europe)'; } $data = '