ここの情報は古いです。ご理解頂いた上でお取り扱いください。

source: OpenPNE/trunk/webapp/lib/smarty_plugins/modifier.t_url2a.php @ 267

Last change on this file since 267 was 267, checked in by ogawa, 16 years ago

fixed regexp for URL(added "(", ")" )

File size: 688 bytes
Line 
1<?php
2/**
3 * @copyright 2005-2006 OpenPNE Project
4 * @license   http://www.php.net/license/3_01.txt PHP License 3.01
5 */
6
7/**
8 * Smarty t_url2a modifier plugin
9 *
10 * @param  string $string
11 * @return string
12 */
13function smarty_modifier_t_url2a($string)
14{
15    // "(&quot;) と '(&#039;) を元に戻す
16    $search = array('&quot;', '&#039;');
17    $replace = array('"', "'");
18    $string = str_replace($search, $replace, $string);
19
20    $url_pattern = '/https?:\/\/[\w\-.,:;\~\^\/?\@&=+\$%#!()]+/';
21    return preg_replace_callback($url_pattern, 'smarty_modifier_t_url2a_callback', $string);
22}
23
24function smarty_modifier_t_url2a_callback($matches)
25{
26    return pne_url2a($matches[0]);
27}
28
29?>
Note: See TracBrowser for help on using the repository browser.