1<?php
2
3
4// must be run within Dokuwiki
5if(!defined('DOKU_INC')) die();
6
7
8class helper_plugin_bugzillaint_render extends DokuWiki_Plugin {
9
10
11	public function renderAttributes( $dataAttrs ) {
12
13		$attrs = array(
14			'bugzilla_baseurl' 						=> $this->getConf('bugzilla_baseurl'),
15			'severity_threshold_red' 				=> $this->getConf('severity_threshold_red'),
16			'severity_threshold_orange' 			=> $this->getConf('severity_threshold_orange'),
17			'priority_threshold_red' 				=> $this->getConf('priority_threshold_red'),
18			'priority_threshold_orange' 			=> $this->getConf('priority_threshold_orange'),
19			'deadline_threshold_days_red'			=> $this->getConf('deadline_threshold_days_red'),
20			'deadline_threshold_days_orange'		=> $this->getConf('deadline_threshold_days_orange'),
21			'extra_depends_on' 						=> $this->getLang('extra_depends_on'),
22			'extra_blocks' 							=> $this->getLang('extra_blocks'),
23			'color_new' 							=> $this->getConf('color_new'),
24			'color_assigned' 						=> $this->getConf('color_assigned'),
25			'color_reopened' 						=> $this->getConf('color_reopened'),
26			'color_resolved_fixed' 					=> $this->getConf('color_resolved_fixed'),
27			'color_resolved_invalid' 				=> $this->getConf('color_resolved_invalid'),
28			'color_resolved_wontfix' 				=> $this->getConf('color_resolved_wontfix'),
29			'color_resolved_duplicate' 				=> $this->getConf('color_resolved_duplicate'),
30			'color_resolved_worksforme' 			=> $this->getConf('color_resolved_worksforme'),
31			'color_resolved_moved' 					=> $this->getConf('color_resolved_moved')
32		);
33
34		return $this->makeAttributes( $dataAttrs, $attrs );
35	}
36
37
38	private function makeAttributes( $data, $attrs ) {
39		$a = array();
40		foreach ($data as $k => $v) {
41			if ( $v === false ) continue;
42			$a[] = 'data-' . $k . '="' . htmlspecialchars($v) . '"';
43		}
44		foreach ($attrs as $k => $v) {
45			if ( $v === false ) continue;
46			$a[] = '' . $k . '="' . htmlspecialchars($v) . '"';
47		}
48		return join(' ', $a);
49	}
50
51
52
53
54}