You appear to be a bot. Output may be restricted
Description
Parse the tag into separate fieldsThe expected format of the tag is:
@tagname type name description
with white space willy nilly.
I'm sure a regex would be perfect for this… One day perhaps. Meanwhile something to improve on the original explode logic which didn't cater for whitespace
Usage
$array = oikai_explode_tag( $tag );
Parameters
- $tag
- ( string ) required – expected format @tagname type name description
Returns
array consisting of tagname, type, name, descriptionSource
File name: oik-shortcodes/shortcodes/oik-api-importer.phpLines:
1 to 18 of 18
function oikai_explode_tag( $tag ) { $parts = explode( " ", $tag ); $list = array( null, null, null, null ); $index = 0; foreach ( $parts as $part ) { $part = trim( $part ); if ( $part != '' ) { $list[ $index ] = $list[ $index ] . $part; if ( $index <= 2 ) { $index++; } else { $list[ $index ] .= " "; } } } return( $list ); }View on GitHub