| @@ 49-58 (lines=10) @@ | ||
| 46 | * @param string $content |
|
| 47 | * @return string |
|
| 48 | */ |
|
| 49 | public function parse($content) |
|
| 50 | { |
|
| 51 | if (empty($this->shortcodeTags) || ! is_array($this->shortcodeTags)) { |
|
| 52 | return $content; |
|
| 53 | } |
|
| 54 | ||
| 55 | $pattern = $this->getShortcodeRegex(); |
|
| 56 | ||
| 57 | return preg_replace_callback('/'.$pattern.'/s', [$this, 'doShortcodeTag'], $content); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Retrieve the shortcode regular expression for searching. |
|
| @@ 154-163 (lines=10) @@ | ||
| 151 | * @param string $content |
|
| 152 | * @return string |
|
| 153 | */ |
|
| 154 | public function stripShortcodes($content) |
|
| 155 | { |
|
| 156 | if (empty($this->shortcodeTags) || ! is_array($this->shortcodeTags)) { |
|
| 157 | return $content; |
|
| 158 | } |
|
| 159 | ||
| 160 | $pattern = $this->getShortcodeRegex(); |
|
| 161 | ||
| 162 | return preg_replace('/'.$pattern.'/s', ' ', $content); |
|
| 163 | } |
|
| 164 | ||
| 165 | /** |
|
| 166 | * Remove specified shortcode tag from the given content. |
|