/** * Strips HTML tags and sanitizes the product title. * */ protected function sanitizeTitle($strTitle) { $strTitle = strip_tags($strTitle); // removes the heading numbering. e.g. #3: Product Name -> Product Name // Do not use "substr($strTitle, strpos($strTitle, ' '))" since some title contains double-quotes and they mess up html formats $strTitle = trim(preg_replace('/#\\d+?:\\s+?/i', '', $strTitle)); // Title character length if ($this->arrArgs['title_length'] == 0) { return ''; } if ($this->arrArgs['title_length'] > 0 && AmazonAutoLinks_Utilities::getStringLength($strTitle) > $this->arrArgs['title_length']) { $strTitle = AmazonAutoLinks_Utilities::getSubstring($strTitle, 0, $this->arrArgs['title_length']) . '...'; } // return $strTitle; return esc_attr($strTitle); }