| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* E2pdf Shortcode Helper |
| 5 |
* |
| 6 |
* @copyright Copyright 2017 https://e2pdf.com |
| 7 |
* @license GPL v2 |
| 8 |
* @version 1 |
| 9 |
* @link https://e2pdf.com |
| 10 |
* @since 1.07.02 |
| 11 |
*/ |
| 12 |
if (!defined('ABSPATH')) { |
| 13 |
die('Access denied.'); |
| 14 |
} |
| 15 |
|
| 16 |
class Helper_E2pdf_Shortcode { |
| 17 |
|
| 18 |
public function get_shortcode_regex($tagnames = null) { |
| 19 |
if (version_compare(get_bloginfo('version'), '4.4.0', '<')) { |
| 20 |
global $shortcode_tags; |
| 21 |
|
| 22 |
if (empty($tagnames)) { |
| 23 |
$tagnames = array_keys($shortcode_tags); |
| 24 |
} |
| 25 |
$tagregexp = join('|', array_map('preg_quote', $tagnames)); |
| 26 |
|
| 27 |
return |
| 28 |
'\\[' |
| 29 |
. '(\\[?)' |
| 30 |
. "($tagregexp)" |
| 31 |
. '(?![\\w-])' |
| 32 |
. '(' |
| 33 |
. '[^\\]\\/]*' |
| 34 |
. '(?:' |
| 35 |
. '\\/(?!\\])' |
| 36 |
. '[^\\]\\/]*' |
| 37 |
. ')*?' |
| 38 |
. ')' |
| 39 |
. '(?:' |
| 40 |
. '(\\/)' |
| 41 |
. '\\]' |
| 42 |
. '|' |
| 43 |
. '\\]' |
| 44 |
. '(?:' |
| 45 |
. '(' |
| 46 |
. '[^\\[]*+' |
| 47 |
. '(?:' |
| 48 |
. '\\[(?!\\/\\2\\])' |
| 49 |
. '[^\\[]*+' |
| 50 |
. ')*+' |
| 51 |
. ')' |
| 52 |
. '\\[\\/\\2\\]' |
| 53 |
. ')?' |
| 54 |
. ')' |
| 55 |
. '(\\]?)'; |
| 56 |
} else { |
| 57 |
return get_shortcode_regex($tagnames); |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
} |
| 62 |
|