private function _addOptions() { $task = new Installer_Task_Options(); $task->setOptions(array('administrator_email' => $this->_getValue('administrator_email'), 'copyright' => $this->_getValue('copyright'), 'site_title' => $this->_getValue('site_title'), 'author' => $this->_getValue('author'), 'description' => $this->_getValue('description'), 'thumbnail_constraint' => $this->_getValue('thumbnail_constraint'), 'square_thumbnail_constraint' => $this->_getValue('square_thumbnail_constraint'), 'fullsize_constraint' => $this->_getValue('fullsize_constraint'), 'per_page_admin' => $this->_getValue('per_page_admin'), 'per_page_public' => $this->_getValue('per_page_public'), 'show_empty_elements' => $this->_getValue('show_empty_elements'), 'path_to_convert' => $this->_getValue('path_to_convert'), Theme::ADMIN_THEME_OPTION => Installer_Default::DEFAULT_ADMIN_THEME, Theme::PUBLIC_THEME_OPTION => Installer_Default::DEFAULT_PUBLIC_THEME, Omeka_Validate_File_Extension::WHITELIST_OPTION => Omeka_Validate_File_Extension::DEFAULT_WHITELIST, Omeka_Validate_File_MimeType::WHITELIST_OPTION => Omeka_Validate_File_MimeType::DEFAULT_WHITELIST, File::DISABLE_DEFAULT_VALIDATION_OPTION => (string) (!extension_loaded('fileinfo')), Omeka_Db_Migration_Manager::VERSION_OPTION_NAME => OMEKA_VERSION, 'display_system_info' => true, 'html_purifier_is_enabled' => 1, 'html_purifier_allowed_html_elements' => implode(',', Omeka_Filter_HtmlPurifier::getDefaultAllowedHtmlElements()), 'html_purifier_allowed_html_attributes' => implode(',', Omeka_Filter_HtmlPurifier::getDefaultAllowedHtmlAttributes()), 'tag_delimiter' => ',', Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME => Omeka_Navigation::getNavigationOptionValueForInstall(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME), 'search_record_types' => serialize(get_search_record_types()), 'api_enable' => false, 'api_per_page' => 50, 'show_element_set_headings' => 1)); $task->install($this->_db); }
protected function _setupHtmlPurifierOptions() { if (get_option('html_purifier_is_enabled') === null) { set_option('html_purifier_is_enabled', '1'); } if (get_option('html_purifier_allowed_html_elements') === null) { set_option('html_purifier_allowed_html_elements', implode(',', Omeka_Filter_HtmlPurifier::getDefaultAllowedHtmlElements())); } if (get_option('html_purifier_allowed_html_attributes') === null) { set_option('html_purifier_allowed_html_attributes', implode(',', Omeka_Filter_HtmlPurifier::getDefaultAllowedHtmlAttributes())); } }
public function testHtmlPurifyCollectionFormWithAllowedAndUnallowedElementsAndAttributesInDescription() { $this->assertTrue(in_array('strong', Omeka_Filter_HtmlPurifier::getDefaultAllowedHtmlElements())); $this->assertTrue(in_array('p', Omeka_Filter_HtmlPurifier::getDefaultAllowedHtmlElements())); $this->assertFalse(in_array('j', Omeka_Filter_HtmlPurifier::getDefaultAllowedHtmlElements())); $this->assertTrue(in_array('*.class', Omeka_Filter_HtmlPurifier::getDefaultAllowedHtmlAttributes())); $this->assertFalse(in_array('*.id', Omeka_Filter_HtmlPurifier::getDefaultAllowedHtmlAttributes())); $dirtyHtml = '<p class="person" id="person">Bob is bad <j>and mean<j> and <strong id="trait">fun</strong>.</p>'; $cleanHtml = '<p class="person">Bob is bad and mean and <strong>fun</strong>.</p>'; $post = $this->_addElementTextWithDirtyHtmlToPost($dirtyHtml, 'Dublin Core', 'Title'); $this->getRequest()->setMethod('POST'); $this->getRequest()->setPost($post); $this->dispatch('/collections/edit/' . $this->collection->id); $collectionAfter = $this->db->getTable('Collection')->find($this->collection->id); $this->assertEquals($cleanHtml, metadata($collectionAfter, array('Dublin Core', 'Title'))); }
public function getHtmlPurifierAllowedHtmlElementsAction() { $this->_helper->viewRenderer->setNoRender(true); if ($this->_getParam('default')) { $body = implode(',', Omeka_Filter_HtmlPurifier::getDefaultAllowedHtmlElements()); } else { $body = get_option('html_purifier_allowed_html_elements'); } $this->getResponse()->setBody($body); }
public function testFilterUnallowedScriptElement() { $this->assertTrue(in_array('p', Omeka_Filter_HtmlPurifier::getDefaultAllowedHtmlElements())); $this->assertFalse(in_array('script', Omeka_Filter_HtmlPurifier::getDefaultAllowedHtmlElements())); $dirtyHtml = '<p>Bob is <script>bad</script></p>'; $cleanHtml = '<p>Bob is </p>'; $htmlPurifierFilter = new Omeka_Filter_HtmlPurifier(); $filteredHtml = $htmlPurifierFilter->filter($dirtyHtml); $this->assertEquals($cleanHtml, $filteredHtml); }