*/ class DeviantArtBBCode implements BBCode { protected $code = ''; protected $width=450, $height=450; /** * @see BBCode::getParsedTag() */ public function getParsedTag($openingTag, $content, $closingTag, BBCodeParser $parser) { if(is_numeric($content)) { // id as input $id = intval($content); } else if(strpos($content, 'http://') == 0){ // url as input preg_match('/-(\d+)$/', $content, $hits); $id = intval($hits[1]); } else if(strpos($content, '.+value\="id\=(\d+)"/', $content, $hits); $width = intval($hits[1]); $height = intval($hits[2]); $id = intval($hits[3]); } else { return; } $width = isset($width) ? $width : $this->width; $height = isset($height) ? $height : $this->height; $code = sprintf($this->code, $width, $height, $id, $width, $height, $id); if ($parser->getOutputType() == 'text/html') { return $code; } else if ($parser->getOutputType() == 'text/plain') { return $content; } } } ?>