<commit_before><?php defined('SYSPATH') or die('No direct script access.');
/**
 * Sitemap generation class
 *
 * Copyright (C) 2009 <NAME>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 * @author <NAME> <<EMAIL>>
 */
abstract class Sitemap_Data {

	/**
	 * @return DOMElement Extra sitemap information
	 */
	abstract public function create();

	/**
	 * Allows concrete classes to change the document root (urlset) attributes
	 *
	 * @param DOMElement $root Document root
	 * @return DOMElement
	 */
	abstract public function root( DOMElement & $root );
	
	/**
	 * UTF8 encode a string
	 *
	 * @access public
	 * @param string $string
	 * @return string
	 */
	protected function encode($string)
	{
		$string = htmlspecialchars($string, ENT_QUOTES, 'UTF-8');

		// Convert &#039; to &apos;
		return str_replace('&#039;', '&apos;', $string);
	}

	/**
	 * Format a unix timestamp into W3C Datetime
	 *
	 * @access public
	 * @see http://www.w3.org/TR/NOTE-datetime
	 * @param string $unix Unixtimestamp
	 * @return string W3C Datetime
	 */
	protected function date_format($unix)
	{
		$date = new DateTime;

		// For unixtime stamps.
		$date->setTimestamp($unix);

		// Format to W3C standards
		return $date->format(DATE_W3C);
	}
}<commit_msg>Use date() for converting a unix timestamp into a W3C formatted time. Around 280% faster.<commit_after><?php defined('SYSPATH') or die('No direct script access.');
/**
 * Sitemap generation class
 *
 * Copyright (C) 2009 <NAME>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 * @author <NAME> <<EMAIL>>
 */
abstract class Sitemap_Data {

	/**
	 * @return DOMElement Extra sitemap information
	 */
	abstract public function create();

	/**
	 * Allows concrete classes to change the document root (urlset) attributes
	 *
	 * @param DOMElement $root Document root
	 * @return DOMElement
	 */
	abstract public function root( DOMElement & $root );
	
	/**
	 * UTF8 encode a string
	 *
	 * @access public
	 * @param string $string
	 * @return string
	 */
	protected function encode($string)
	{
		$string = htmlspecialchars($string, ENT_QUOTES, 'UTF-8');

		// Convert &#039; to &apos;
		return str_replace('&#039;', '&apos;', $string);
	}

	/**
	 * Format a unix timestamp into W3C Datetime
	 *
	 * @access public
	 * @see http://www.w3.org/TR/NOTE-datetime
	 * @param string $unix Unixtimestamp
	 * @return string W3C Datetime
	 */
	protected function date_format($unix)
	{
		return date('Y-m-d\TH:i:sP', $unix);
	}
}
{'fraction_non_alphanumeric': 0.11038251366120219, 'fraction_numerical': 0.010382513661202186, 'mean_word_length': 3.587719298245614, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6403500', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1052, 'n_words': 428}