<?php

class Tac_StopCountrySpam_Listener
{


	/**
	 * Extend XenForo controller 
	 */
	 
	public static function listenController($class, array &$extend)
	{
		//dont bother listenting if they havent yet set this up
		$options = XenForo_Application::get('options');	
		if($options->jsonRequest != '<PLEASE SET ME !!!!! go to the link below!!!!>' && $options->jsonRequest != '')
		{
			if ($class == 'XenForo_ControllerPublic_Register')
			{
				$extend[] = 'Tac_StopCountrySpam_ControllerPublic_Register';
			}
		}
		

				
	}


	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>'));
			}   		
        }
      //  */
    }


}