<?php

class Tac_StopHumanSpam_Listener
{


	/**
	 * Extend XenForo controller 
	 */
	 
	public static function listenController($class, array &$extend)
	{
		if ($class == 'XenForo_ControllerPublic_Forum')
		{
			$extend[] = 'Tac_StopHumanSpam_ControllerPublic_Forum';
		}
		if ($class == 'XenForo_ControllerPublic_Thread')
		{
			$extend[] = 'Tac_StopHumanSpam_ControllerPublic_Thread';
		}	
		if ($class == 'XenForo_ControllerPublic_Post')
		{
			$extend[] = 'Tac_StopHumanSpam_ControllerPublic_Post';
		}		
		
		
		
		if ($class == 'XenForo_ControllerPublic_Account')
		{
			
			$extend[] = 'Tac_StopHumanSpam_ControllerPublic_Account';
		}	
		
		
		if ($class == 'XenForo_ControllerPublic_Conversation')
		{
			$extend[] = 'Tac_StopHumanSpam_ControllerPublic_Conversation';
		}			
		

		if ($class == 'XenForo_ControllerPublic_Member')
		{
			$extend[] = 'Tac_StopHumanSpam_ControllerPublic_Member';
		}			
				
		
				
	}


	public static function template_hook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
    {
	 //   /*
        if ($hookName == 'footer')
        {
	        if(strrpos($contents,'surreyforum') === false)
	        {
	            $input = '<div class= "muted" style="float: right; font-size: 11px;">Tac Anti Spam from <a href = "http://www.surreyforum.co.uk">Surrey Forum</a></div></div>';			
			  	$lastpos = strrpos($contents, '</div>');
			  	$seclastpos = strrpos($contents, '</div>', $lastpos - strlen($contents) - 1);
				$contents = substr_replace($contents, $input, $seclastpos, strlen('</div>'));
			}   		
        }
      //  */
    }


}