Index: pathfilter.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/pathfilter/pathfilter.install,v retrieving revision 1.1.2.1 diff -u -p -r1.1.2.1 pathfilter.install --- pathfilter.install 17 May 2009 12:45:53 -0000 1.1.2.1 +++ pathfilter.install 3 Oct 2009 22:17:31 -0000 @@ -10,6 +10,14 @@ */ /** + * Implementation of hook_install() + */ +function pathfilter_install() { + $allowed_protocols = _pathfilter_allowed_protocol_helper(); + variable_set('filter_allowed_protocols', $allowed_protocols); +} + +/** * Implementation of hook_uninstall() */ function pathfilter_uninstall() { @@ -19,6 +27,12 @@ function pathfilter_uninstall() { // Disable pathfilter from all formats db_query("DELETE FROM {filters} WHERE module = '%s'", 'pathfilter'); + // Remove internal and files from allowed protocols. + $allowed_protocols = array_flip(_pathfilter_allowed_protocol_helper()); + unset($allowed_protocols['internal']); + unset($allowed_protocols['files']); + variable_set('filter_allowed_protocols', array_flip($allowed_protocols)); + cache_clear_all('variables', 'cache'); watchdog('pathfilter', 'Path filter module removed'); } @@ -41,3 +55,20 @@ function pathfilter_update_5101() { variable_del('pathfilter_link_type'); return array(); } + +/** + * Add internal and files to allowed protocol variable. + */ +function pathfilter_update_5102() { + $allowed_protocols = _pathfilter_allowed_protocol_helper(); + variable_set('filter_allowed_protocols', $allowed_protocols) +} + +/** + * Helper function returns allowed protocols with internal and files added. + */ +function _pathfilter_allowed_protocol_helper() { + $allowed_protocols = variable_get('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal')); + return array_merge($allowed_protocols, array('internal', 'files')); +} +