Skip to content

Instantly share code, notes, and snippets.

@pupi1985
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pupi1985/9e971c24320a026e5900 to your computer and use it in GitHub Desktop.
Save pupi1985/9e971c24320a026e5900 to your computer and use it in GitHub Desktop.
function stripAnchors($text) {
return preg_replace("/<a.*?>(.*?)?<\/a>/im", "$1", $text);
}
function post_meta($post, $class, $prefix=null, $separator='<br/>') {
$this->output('<span class="'.$class.'-meta">');
if (isset($prefix))
$this->output($prefix);
$order=explode('^', @$post['meta_order']);
foreach ($order as $element)
switch ($element) {
case 'what':
if (isset($post['what']['data'])) {
$post['what']['data'] = $this->stripAnchors($post['what']['data']);
unset($post['what_url']);
}
$this->post_meta_what($post, $class);
break;
case 'when':
$this->post_meta_when($post, $class);
break;
case 'where':
$this->post_meta_where($post, $class);
break;
case 'who':
if (isset($post['who']['data'])) {
$post['who']['data'] = $this->stripAnchors($post['who']['data']);
}
$this->post_meta_who($post, $class);
break;
}
$this->post_meta_flags($post, $class);
if (!empty($post['what_2'])) {
$this->output($separator);
foreach ($order as $element)
switch ($element) {
case 'what':
if (isset($post['what_2']['data'])) {
$post['what_2']['data'] = $this->stripAnchors($post['what_2']['data']);
}
$this->output('<span class="'.$class.'-what">'.$post['what_2'].'</span>');
break;
case 'when':
$this->output_split(@$post['when_2'], $class.'-when');
break;
case 'who':
if (isset($post['who_2']['data'])) {
$post['who_2']['data'] = $this->stripAnchors($post['who_2']['data']);
}
$this->output_split(@$post['who_2'], $class.'-who');
break;
}
}
$this->output('</span>');
}
function post_avatar($post, $class, $prefix=null) {
if (isset($post['avatar'])) {
$post['avatar'] = $this->stripAnchors($post['avatar']);
}
qa_html_theme_base::post_avatar($post, $class, $prefix);
}
function ranking_label($item, $class) {
if ($this->template === 'users' && isset($item['label'])) {
$item['label'] = $this->stripAnchors($item['label']);
}
qa_html_theme_base::ranking_label($item, $class);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment