t('Path Alias'), 'description' => t('replace internal machine links with alias'), 'process callback' => 'filter_path_alias_callback', ); return $filters; } function filter_path_alias_callback($text, $filter, $format, $langcode, $cache, $cache_id){ // dsm($text, 'text'); // dsm($_SERVER, 'server'); if (preg_match_all('/href="([^"]+)"/', $text, $matches_code)) { // dsm($matches_code, 'matches_code'); foreach ($matches_code[1] as $i => $path) { $old_path = $path; $path = str_replace('http://', '', $path); $path = str_replace($_SERVER['SERVER_NAME'], '', $path); $path = preg_replace('/#.*$/', '', $path); $path = preg_replace('/\?.*$/', '', $path); $path = preg_replace('/^\//', '', $path); // dsm($path, 'path'); if($path != ""){ $alias = drupal_get_path_alias($path, $langcode); // dsm($alias, 'alias'); if($alias != $path){ $path_aliased = str_replace($old_path, $alias, $matches_code[0][$i]); $text = str_replace($matches_code[0][$i], $path_aliased, $text); } } } } return $text; }