diff -purN pathfilter/README.txt pathfilter-2.0-beta1-cws/README.txt --- pathfilter/README.txt 2009-09-27 09:07:48.000000000 -0700 +++ pathfilter-2.0-beta1-cws/README.txt 2009-09-28 11:16:09.000000000 -0700 @@ -43,6 +43,10 @@ if you change an alias for any pathfilte absolute URLs (default) paths (relative to the docuemnt root) on the input format filter configuration page. + In Addition, you may automatically have your URLs "internalized" as needed + by enablinging the "Enable automatic URL processing for attributes" option in + the same format filter configuration page. + ----------------------- USE WITH TINYMCE [3] ----------------------- @@ -88,4 +92,4 @@ to '' in the 'Insert/Edit link' p [2] The "empty cache" link provided by the Devel module (http://drupal.org/project/devel) is a convenient way to accomplish this. [3] http://drupal.org/project/tinymce -[4] http://drupal.org/project/fckeditor \ No newline at end of file +[4] http://drupal.org/project/fckeditor diff -purN pathfilter/pathfilter.module pathfilter-2.0-beta1-cws/pathfilter.module --- pathfilter/pathfilter.module 2009-09-27 09:07:48.000000000 -0700 +++ pathfilter-2.0-beta1-cws/pathfilter.module 2009-09-28 11:18:09.000000000 -0700 @@ -17,7 +17,13 @@ * Credits: * @author Ray Zimmerman (drupal.org user "RayZ") * @author Tom Kirkpatrick (drupal.org user "mrfelton"), www.kirkdesigns.co.uk + * @author George Montana Harkin (drupal.org user "harking") Auto internalization + * @author Shayne Huddleston (shayne.huddleston@oregonstate.edu) Fix to auto internailze all node fields */ +global $pathfilter_replacement_patterns; +$pathfilter_replacement_patterns = array(); +$pathfilter_replacement_patterns[] = '/(["\'])(internal):([^"#\?\']+)\??([^"#\']+)?#?([^"\']+)?\1/'; +$pathfilter_replacement_patterns[] = '/(["\'])(files):([^"\']+)\1/'; /** * Implementation of hook_filter_tips(). @@ -63,15 +69,11 @@ function pathfilter_filter($op, $delta = // The actual filtering is performed here. The supplied text should be // returned, once any necessary substitutions have taken place. case 'process': - $patterns = array(); - $replacement = array(); - $patterns[] = '/(["\'])(internal):([^"#\?\']+)\??([^"#\']+)?#?([^"\']+)?\1/'; - $patterns[] = '/(["\'])(files):([^"\']+)\1/'; - + global $pathfilter_replacement_patterns; // use the 'currying' technique to allow us to pass the format into // the callback function. $callback = _pathfilter_curry(_pathfilter_process, 2); - return preg_replace_callback($patterns, $callback($format), $text); + return preg_replace_callback($pathfilter_replacement_patterns, $callback($format), $text); // Filter settings for pathfilter. case 'settings': @@ -152,5 +154,172 @@ function _pathfilter_settings($format) { '#default_value' => variable_get('pathfilter_link_absolute_'. $format, 1), '#description' => t('Should internal paths be transformed to absolute URLs, such as %absolute_url or absolute paths, like %absolute_path. Note that your changes may not appear until the cache has been cleared.', array('%absolute_url' => 'http://www.example.com/my-page', '%absolute_path' => '/my-page')), ); + $form['pathfilter']['pathfilter_process_all'] = array( + '#type' => 'checkbox', + '#title' => t('Enable automatic url processing for attributes.'), + '#default_value' => variable_get('pathfilter_process_all', 1), + '#description' => t('When this option is enabled, all %element_list elements will automatically have the servername and base path of their src, href, and action urls replaced with %internal. On editing of these elements, all instances of %internal will be replaced with the site\'s base path (%current_base_path).', array('%element_list' => ', ,