PHP: Dynamic Shortcode Tag Parser.
<?php
/**
* Dynamic Shortcode Tag Parser.
* Replaces Shortcode Tag with Tag Matching $_GET Param Value.
*
* @author Syed I.R <https://github.com/irazasyed>
* @copyright Syed I.R 2014
*
* @param string $str String with Shortcode Tags. Ex: [name]
*
* @return string Parsed String.
*/
function parse_shortcodes($str) {
preg_match_all('~\[(.*?)\]~s', $str, $data);
$string = $str;
foreach($data[1] as $value){
$string = str_replace('[' . $value . ']', $_GET[$value], $string);
}
return str_replace(array('[',']'), '', $string);
}