Code Duplication    Length = 24-24 lines in 2 locations

qte.php 2 locations

@@ 250-273 (lines=24) @@
247
	*
248
	* @return	null
249
	*/
250
	public function attr_sort($forum_id = 0, $attribute_id = 0)
251
	{
252
		foreach ($this->_attr as $attr)
253
		{
254
			$forum_allowed = $this->auth->acl_getf('f_qte_attr_'.$attr['attr_id'], true);
255
256
			if (isset($forum_allowed[$forum_id]))
257
			{
258
				// parse the attribute name
259
				$attribute_name = str_replace(array('%mod%', '%date%'), array($this->user->lang['QTE_KEY_USERNAME'], $this->user->lang['QTE_KEY_DATE']), $this->user->lang($attr['attr_name']));
260
261
				$this->template->assign_block_vars('attributes', array(
262
					'QTE_ID'		=> $attr['attr_id'],
263
					'QTE_NAME'		=> $attribute_name,
264
					'QTE_DESC'		=> $this->user->lang($attr['attr_desc']),
265
					'QTE_COLOUR'	=> $this->attr_colour($attr['attr_name'], $attr['attr_colour']),
266
267
					'IS_SELECTED'	=> (!empty($attribute_id) && ($attr['attr_id'] == $attribute_id)) ? true : false,
268
269
					'S_QTE_DESC'	=> !empty($attr['attr_desc']) ? true : false,
270
				));
271
			}
272
		}
273
	}
274
275
	/**
276
	* Generate a default attribute list for a forum
@@ 283-306 (lines=24) @@
280
	*
281
	* @return	null
282
	*/
283
	public function attr_default($forum_id = 0, $attribute_id = 0)
284
	{
285
		foreach ($this->_attr as $attr)
286
		{
287
			$forum_allowed = $this->auth->acl_getf('f_qte_attr_'.$attr['attr_id'], true);
288
289
			if (isset($forum_allowed[$forum_id]))
290
			{
291
				// parse the attribute name
292
				$attribute_name = str_replace(array('%mod%', '%date%'), array($this->user->lang['QTE_KEY_USERNAME'], $this->user->lang['QTE_KEY_DATE']), $this->user->lang($attr['attr_name']));
293
294
				$this->template->assign_block_vars('attributes', array(
295
					'QTE_ID'		=> $attr['attr_id'],
296
					'QTE_NAME'		=> $attribute_name,
297
					'QTE_DESC'		=> $this->user->lang($attr['attr_desc']),
298
					'QTE_COLOUR'	=> $this->attr_colour($attr['attr_name'], $attr['attr_colour']),
299
300
					'IS_SELECTED'	=> (!empty($attribute_id) && ($attr['attr_id'] == $attribute_id)),
301
302
					'S_QTE_DESC'	=> !empty($attr['attr_desc']) ? true : false,
303
				));
304
			}
305
		}
306
	}
307
308
	/**
309
	* Generate attribute for topic title