Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
get_shortcode_atts_regex example
function
shortcode_parse_atts
(
$text
)
{
$atts
= array
(
)
;
$pattern
=
get_shortcode_atts_regex
(
)
;
$text
=
preg_replace
(
"/[\x{00a0}\x{200b}]+/u", ' ',
$text
)
;
if
(
preg_match_all
(
$pattern
,
$text
,
$match
, PREG_SET_ORDER
)
)
{
foreach
(
$match
as
$m
)
{
if
(
!
empty
(
$m
[
1
]
)
)
{
$atts
[
strtolower
(
$m
[
1
]
)
]
=
stripcslashes
(
$m
[
2
]
)
;
}
elseif
(
!
empty
(
$m
[
3
]
)
)
{
$atts
[
strtolower
(
$m
[
3
]
)
]
=
stripcslashes
(
$m
[
4
]
)
;
}
elseif
(
!
empty
(
$m
[
5
]
)
)
{
$atts
[
strtolower
(
$m
[
5
]
)
]
=
stripcslashes
(
$m
[
6
]
)
;
}
elseif
(
isset
(
$m
[
7
]
)
&&
strlen
(
$m
[
7
]
)
)
{
$atts
[
]
=
stripcslashes
(
$m
[
7
]
)
;
}