Rozumiem, pomysł ale nie radze sobie z implementacją, próbowałem tak to rozwiązać:
function parseTagsRecursive($input)
{
$regex['cpp'] = '#\[cpp]((?:[^[]|\[(?!/?cpp])|(?R))+)\[/cpp]#';
$regex['css'] = '#\[css]((?:[^[]|\[(?!/?css])|(?R))+)\[/css]#';
foreach($regex as $key => $value)
{
$geshi = new GeSHi($input[1], $key);
$input[1] = $geshi->parse_code();
$input[1
] = str_replace('<','',$input[1
]); // usuwa < $input[1
] = str_replace('br','',$input[1
]); // usuwa br $input[1
] = str_replace('>','',$input[1
]); // usuwa > $input[1
] = str_replace('&nbsp;','',$input[1
]); // usuwa zbedne spacje $input = '<div style="margin-left: 10px">'.$input[1].'</div>';
}
}
}
ale ten return trochę wadzi, co musiałbym zmodyfikować? Czy w zupełnie zły sposób do tego podchodzę?