<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
	<id>yodaofdarkness:tagging</id>
	<version>1.0.2</version>

<file name="$sourcedir/Post.php">
	<operation>
		<search position="replace"><![CDATA[

		$ids = 0;

		// Was it by ajax?
		if(isset($_POST['ajax_tags']))
			foreach($_POST['ajax_tags'] as $tag)
				$raw_tags[] = $tag;
		else if(isset($_POST['tags']))
			$raw_tags = explode(',', $_REQUEST['tags']);

		foreach($raw_tags as $tag){
			$tag = preg_replace("([?!\"':;./\\|&%$#<>*\)\(\[\]{}+=@~`_]+)", "", strtolower($tag));

			$context['tags'][] = array(
				'name' => $tag,
				'last' => false
			);
		}

		if(!empty($context['tags']))
			$context['tags'][count($context['tags'])-1]['last'] = true;]]></search>
		<add><![CDATA[

		$ids = 0;
		$raw_tags = array();

		// Was it by ajax?
		if(isset($_POST['ajax_tags']))
			foreach($_POST['ajax_tags'] as $tag)
				$raw_tags[] = $tag;
		else if(isset($_POST['tags']))
			$raw_tags = explode(',', $_REQUEST['tags']);

		if (!empty($raw_tags)){
			foreach($raw_tags as $tag){
				$tag = preg_replace("([?!\"':;./\\|&%$#<>*\)\(\[\]{}+=@~`_]+)", "", strtolower($tag));

				$context['tags'][] = array(
					'name' => $tag,
					'last' => false
				);
			}

			if(!empty($context['tags']))
				$context['tags'][count($context['tags'])-1]['last'] = true;
		}]]></add>
</modification>
