shortcode_parse_atts [ WordPress Function ]
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Retrieve all attributes from the shortcodes tag.
The attributes list has the attribute name as the key and the value of the attribute as the value in the key/value pair. This allows for easier retrieval of the attributes, since all attributes have to be known.
Source
<?php
function shortcode_parse_atts($text) {
$atts = array();
$pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';
$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]) and strlen($m[7]))
$atts[] = stripcslashes($m[7]);
elseif (isset($m[8]))
$atts[] = stripcslashes($m[8]);
}
} else {
$atts = ltrim($text);
}
return $atts;
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- Function Reference/shortcode parse atts « WordPress Codex
Description. The attributes list has the attribute name as the key and the value of the attribute as the value in the key/value pair. This allows for easier retrieval of ...
codex.wordpress.org - shortcode_parse_atts (WordPress Function) - WPSeek.com
WordPress lookup for shortcode_parse_atts, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - shortcodes.php
Jul 16, 2009 ... shortcode_parse_atts(), Retrieve all attributes from the shortcodes tag. strip_shortcodes(), Remove all shortcode tags from the given content ...
www.tig12.net - shortcode_parse_atts | A HitchHackers guide through WordPress
Feb 12, 2011 ... function shortcode_parse_atts($text) { $atts = array(); $pattern = '/(\w+)\s*=\s*"([^"] *)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?
hitchhackerguide.com