<commit_before><?php

/**
 * Frontend RSS class.
 *
 * @package		frontend
 * @subpackage	core
 *
 * @author		<NAME> <<EMAIL>>
 * @author		<NAME> <<EMAIL>>
 * @author		<NAME> <<EMAIL>>
 * @since		2.0
 */
class FrontendRSS extends SpoonFeedRSS
{
	/**
	 * The default constructor
	 *
	 * @return	void
	 * @param	string $title			The title off the feed.
	 * @param	string $link			The link of the feed.
	 * @param	string $description		The description of the feed.
	 * @param	array[optional] $items	An array with SpoonRSSItems.
	 */
	public function __construct($title, $link, $description, array $items = array())
	{
		// decode
		$title = SpoonFilter::htmlspecialcharsDecode($title);
		$description = SpoonFilter::htmlspecialcharsDecode($description);

		// add UTM-parameters
		$link = FrontendModel::addURLParameters($link, array('utm_source' => 'feed', 'utm_medium' => 'rss', 'utm_campaign' => SpoonFilter::urlise($title)));

		// call the parent
		parent::__construct($title, $link, $description, $items);

		// set feed properties
		$this->setLanguage(FRONTEND_LANGUAGE);
		$this->setCopyright(SpoonDate::getDate('Y') . ' ' . SpoonFilter::htmlspecialcharsDecode(FrontendModel::getModuleSetting('core', 'site_title_' . FRONTEND_LANGUAGE)));
		$this->setGenerator(SITE_RSS_GENERATOR);
		$this->setImage(SITE_URL . FRONTEND_CORE_URL . '/layout/images/rss_image.png', $title, $link);

		// theme was set
		if(FrontendModel::getModuleSetting('core', 'theme', null) != null)
		{
			// theme name
			$theme = FrontendModel::getModuleSetting('core', 'theme', null);

			// theme rss image exists
			if(SpoonFile::exists(PATH_WWW . '/frontend/themes/' . $theme . '/core/images/rss_image.png'))
			{
				// set rss image
				$this->setImage(SITE_URL . '/frontend/themes/' . $theme . '/core/images/rss_image.png', $title, $link);
			}
		}
	}
}


/**
 * FrontendRSSItem, this is our extended version of SpoonRSSItem
 *
 * @package		frontend
 * @subpackage	core
 *
 * @author		<NAME> <<EMAIL>>
 * @author		<NAME> <<EMAIL>>
 * @since		2.0
 */
class FrontendRSSItem extends SpoonFeedRSSItem
{
	/**
	 * Initial values for UTM-parameters
	 *
	 * @var	array
	 */
	private $utm = array('utm_source' => 'feed', 'utm_medium' => 'rss');


	/**
	 * Default constructor.
	 *
	 * @return	void
	 * @param	string $title			The title for the item.
	 * @param	string $link			The link for the item.
	 * @param	string $description		The content for the item.<commit_msg>Add UTM parameters to image link.<commit_after><?php

/**
 * Frontend RSS class.
 *
 * @package		frontend
 * @subpackage	core
 *
 * @author		<NAME> <<EMAIL>>
 * @author		<NAME> <<EMAIL>>
 * @author		<NAME> <<EMAIL>>
 * @since		2.0
 */
class FrontendRSS extends SpoonFeedRSS
{
	/**
	 * The default constructor
	 *
	 * @return	void
	 * @param	string $title			The title off the feed.
	 * @param	string $link			The link of the feed.
	 * @param	string $description		The description of the feed.
	 * @param	array[optional] $items	An array with SpoonRSSItems.
	 */
	public function __construct($title, $link, $description, array $items = array())
	{
		// decode
		$title = SpoonFilter::htmlspecialcharsDecode($title);
		$description = SpoonFilter::htmlspecialcharsDecode($description);

		// add UTM-parameters
		$link = FrontendModel::addURLParameters($link, array('utm_source' => 'feed', 'utm_medium' => 'rss', 'utm_campaign' => SpoonFilter::urlise($title)));

		// call the parent
		parent::__construct($title, $link, $description, $items);

		// set feed properties
		$this->setLanguage(FRONTEND_LANGUAGE);
		$this->setCopyright(SpoonDate::getDate('Y') . ' ' . SpoonFilter::htmlspecialcharsDecode(FrontendModel::getModuleSetting('core', 'site_title_' . FRONTEND_LANGUAGE)));
		$this->setGenerator(SITE_RSS_GENERATOR);
		$this->setImage(SITE_URL . FRONTEND_CORE_URL . '/layout/images/rss_image.png', $title, $link);

		// theme was set
		if(FrontendModel::getModuleSetting('core', 'theme', null) != null)
		{
			// theme name
			$theme = FrontendModel::getModuleSetting('core', 'theme', null);

			// theme rss image exists
			if(SpoonFile::exists(PATH_WWW . '/frontend/themes/' . $theme . '/core/images/rss_image.png'))
			{
				// set rss image
				$this->setImage(SITE_URL . '/frontend/themes/' . $theme . '/core/images/rss_image.png', $title, $link);
			}
		}
	}


	/**
	 * Set the image for the feed.
	 *
	 * @return	void
	 * @param	string $URL						URL of the image.
	 * @param	string $title					Title of the image.
	 * @param	string $link					Link of the image.
	 * @param	int[optional] $width			Width of the image.
	 * @param	int[optional] $height			Height of the image.
	 * @param	string[optional] $description	Description of the image.
	 */
	public function setImage($URL, $title, $link, $width = null, $height = null, $description = null)
	{
		// add UTM-parameters
		$link = FrontendModel::addURLParameters($link, array('utm_source' => 'feed', 'utm_medium' => 'rss', 'utm_campaign' => SpoonFilter::urlise($this->getTitle())));

		// call the parent
		parent::setImage($URL, $title, $link, $width, $height, $description);
	}
}


/**
 * FrontendRSSItem, this is our extended version of SpoonRSSItem
 *
 * @package		frontend
 * @subpackage	core
 *
 * @author		<NAME> <<EMAIL>>
 * @author		<NAME> <<EMAIL>>
 * @since		2.0
 */
class FrontendRSSItem extends SpoonFeedRSSItem
{
	/**
	 * Initial values for UTM-parameters
	 *
	 * @var	array
	 */
	private $utm = array('utm_source' => 'feed', 'utm_medium' => 'rss');


	/**
	 * Default constructor.
	 *
	 * @return	void
	 * @param	string $title			The title for the item.
	 * @param	string $link			The link for the item.
	 * @param	string $description		The content for the item.
{'fraction_non_alphanumeric': 0.15680734592971923, 'fraction_numerical': 0.0014126787921596327, 'mean_word_length': 3.808149405772496, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4769326', 'n_tokens_mistral': 2090, 'n_tokens_neox': 1925, 'n_words': 478}