| @@ 94-105 (lines=12) @@ | ||
| 91 | /** |
|
| 92 | * @brief Replaces BBCode bold. |
|
| 93 | */ |
|
| 94 | protected function replaceBold() |
|
| 95 | { |
|
| 96 | ||
| 97 | $this->text = preg_replace_callback('%\[b\]([\W\D\w\s]*?)\[/b\]%iu', |
|
| 98 | ||
| 99 | function ($matches) { |
|
| 100 | return "**" . trim($matches[1], " ") . "**"; |
|
| 101 | }, |
|
| 102 | ||
| 103 | $this->text |
|
| 104 | ); |
|
| 105 | ||
| 106 | } |
|
| 107 | ||
| 108 | ||
| @@ 112-123 (lines=12) @@ | ||
| 109 | /** |
|
| 110 | * @brief Replaces BBCode italic. |
|
| 111 | */ |
|
| 112 | protected function replaceItalic() |
|
| 113 | { |
|
| 114 | ||
| 115 | $this->text = preg_replace_callback('%\[i\]([\W\D\w\s]*?)\[/i\]%iu', |
|
| 116 | ||
| 117 | function ($matches) { |
|
| 118 | return "*" . trim($matches[1], " ") . "*"; |
|
| 119 | }, |
|
| 120 | ||
| 121 | $this->text |
|
| 122 | ); |
|
| 123 | ||
| 124 | } |
|
| 125 | ||
| 126 | ||
| @@ 130-141 (lines=12) @@ | ||
| 127 | /** |
|
| 128 | * @brief Replaces BBCode underline. Hoedown support underline. |
|
| 129 | */ |
|
| 130 | protected function replaceUnderline() |
|
| 131 | { |
|
| 132 | ||
| 133 | $this->text = preg_replace_callback('%\[u\]([\W\D\w\s]*?)\[/u\]%iu', |
|
| 134 | ||
| 135 | function ($matches) { |
|
| 136 | return "_" . trim($matches[1], " ") . "_"; |
|
| 137 | }, |
|
| 138 | ||
| 139 | $this->text |
|
| 140 | ); |
|
| 141 | ||
| 142 | } |
|
| 143 | ||
| 144 | ||
| @@ 148-159 (lines=12) @@ | ||
| 145 | /** |
|
| 146 | * @brief Replaces BBCode strikethrough. |
|
| 147 | */ |
|
| 148 | protected function replaceStrikethrough() |
|
| 149 | { |
|
| 150 | ||
| 151 | $this->text = preg_replace_callback('%\[s\]([\W\D\w\s]*?)\[/s\]%iu', |
|
| 152 | ||
| 153 | function ($matches) { |
|
| 154 | return "~~" . trim($matches[1], " ") . "~~"; |
|
| 155 | }, |
|
| 156 | ||
| 157 | $this->text |
|
| 158 | ); |
|
| 159 | ||
| 160 | } |
|
| 161 | ||
| 162 | ||