回答編集履歴
3
ミスがあったため修正。
test
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
```PHP
|
2
2
|
|
3
|
+
if ( !function_exists( 'h' ) ) {
|
4
|
+
|
3
|
-
function h( $str ) { return htmlspecialchars( $str, ENT_QUOTES, 'UTF-8' ); }
|
5
|
+
function h( $str ) { return htmlspecialchars( $str, ENT_QUOTES, 'UTF-8' ); }
|
6
|
+
|
7
|
+
}
|
4
8
|
|
5
9
|
|
6
10
|
|
2
ミスがあったため修正。
test
CHANGED
@@ -54,11 +54,7 @@
|
|
54
54
|
|
55
55
|
```PHP
|
56
56
|
|
57
|
-
function h( $str ) { return htmlspecialchars( $str, ENT_QUOTES, 'UTF-8' ); }
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
function change
|
57
|
+
function changeX( $text ){
|
62
58
|
|
63
59
|
$text = preg_replace( "/(http|https):\/\/[-\w\.]+(:\d+)?(\/[^\s]*)?/", "<a href='$0' target='_blank' style='font-size:0.9em;'>$0</a>", $text );
|
64
60
|
|
@@ -68,7 +64,7 @@
|
|
68
64
|
|
69
65
|
}
|
70
66
|
|
71
|
-
$mes2_2 = change
|
67
|
+
$mes2_2 = changeX( $mojiretu2_2 );
|
72
68
|
|
73
69
|
```
|
74
70
|
|
1
補足の追加。
test
CHANGED
@@ -49,3 +49,29 @@
|
|
49
49
|
|
50
50
|
|
51
51
|
こうするとかでどうでしょうか。(すいませんが未テストです)
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
```PHP
|
56
|
+
|
57
|
+
function h( $str ) { return htmlspecialchars( $str, ENT_QUOTES, 'UTF-8' ); }
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
function change2( $text ){
|
62
|
+
|
63
|
+
$text = preg_replace( "/(http|https):\/\/[-\w\.]+(:\d+)?(\/[^\s]*)?/", "<a href='$0' target='_blank' style='font-size:0.9em;'>$0</a>", $text );
|
64
|
+
|
65
|
+
$text = preg_replace( "/>.*さん/", "<span style='font-weight:bold;'>$0</span>", $text );
|
66
|
+
|
67
|
+
return $text;
|
68
|
+
|
69
|
+
}
|
70
|
+
|
71
|
+
$mes2_2 = change2( $mojiretu2_2 );
|
72
|
+
|
73
|
+
```
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
こうするとか。(未テストです)
|