ArticleData::TransformSubheads PHP Method

TransformSubheads() public static method

fn copyToExistingRecord
public static TransformSubheads ( $match )
    public static function TransformSubheads($match)
    {
        static $spanCounter = -1;
        // This matches '<span class="campsite_subhead">'
        if (preg_match("/<\\s*span[^>]*class\\s*=\\s*[\"']campsite_subhead[\"'][^>]*>/i", $match[0])) {
            $spanCounter = 1;
            return "<!** Title>";
        } elseif ($spanCounter >= 0 && preg_match("/<\\s*span/i", $match[0])) {
            $spanCounter += 1;
        } elseif ($spanCounter >= 0 && preg_match("/<\\s*\\/\\s*span\\s*>/i", $match[0])) {
            $spanCounter -= 1;
        }
        if ($spanCounter == 0) {
            $spanCounter = -1;
            return "<!** EndTitle>";
        }
        return $match[0];
    }