Code Duplication    Length = 24-24 lines in 2 locations

qte.php 2 locations

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