Shoora
1/20/2011 - 3:41 PM

Pinched from mariano/syrup/models/behaviors/sluggable.php for my own sluggable behaviour using CakePHP's core Inflector class to do the work

Pinched from mariano/syrup/models/behaviors/sluggable.php for my own sluggable behaviour using CakePHP's core Inflector class to do the work

		if (!empty($settings['ignore'])) {
			$words = array();
			foreach((array) $settings['ignore'] as $word) {
				$words[] = preg_quote($word);
			}
			$newString = preg_replace('/\b(\s*)(' . implode('|', $words) . ')(\s*)\b/i', '\\1\\3', $string);
			if (!empty($newString)) {
				$string = $newString;
			}
		}