_dictionary = $dictionary; $this->prepare_dictionary(); } protected function prepare_dictionary() { //convert to array if (empty($this->_dictionary)) return false; $this->_dictionary = explode(PHP_EOL, $this->_dictionary); } public function parse($content) { $num_lines = count($this->_dictionary); $i = 0; while($i <= $num_lines ){ $phrase = explode(',', $this->_dictionary[$i]); $this->_current_keyword = stripslashes($phrase[0]); $this->_current_url = $phrase[1]; if (!empty($phrase[0]) AND !empty($phrase[1])) { $this->_current_keyword = preg_quote($this->_current_keyword); //$pattern = "~{$this->_current_keyword}(s|es|ies)*\b(?!(.(?_current_keyword}\b(?!(.(?wrap_shortcode($matches[0]); } protected function wrap_shortcode($string) { return "[az url='".trim($this->_current_url)."']{$string}[/az]"; } }