<commit_before><?php defined('SYSPATH') or die('No direct access allowed.');
/**
 * Event view class for day list.
 *
 * @package    Events
 * @author     <NAME>
 * @copyright  (c) 2011-2012 <NAME>
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 */
class View_Event_Day extends View_Article {

	/**
	 * @var  string  Article class
	 */
	public $class = 'event';

	/**
	 * @var  Model_Event
	 */
	public $event;

	/**
	 * @var  boolean  Prefix content
	 */
	public $prefixed = true;


	/**
	 * Create new view.
	 *
	 * @param  Model_Event  $event
	 */
	public function __construct(Model_Event $event) {
		parent::__construct();

		$this->event = $event;

		$this->id    = 'event-' . $event->id;
		$this->title = HTML::anchor(Route::model($event), $event->name) . ' <small>' . HTML::chars($event->city_name) . '</small>';

		// Flyer
		if ($image = $event->flyer_front()) {
			$icon = $image->get_url($image::SIZE_ICON);
		} else if ($image = $event->flyer_back()) {
			$icon = $image->get_url($image::SIZE_ICON);
		} else if (count($flyers = $event->flyers())) {
			$image = $flyers[0]->image();
			$icon  = $image->get_url($image::SIZE_ICON);
		} else {
			$icon = null;
		}
		if ($icon) {
			$this->prefix = HTML::anchor(Route::model($event), HTML::image($icon, array('alt' => __('Flyer'))), array('class' => 'avatar'));
		}


		// Meta
		if ($tags = $event->tags()) {
			$this->meta = implode(', ', $tags);
		} else if ($event->music) {
			$this->meta = $event->music;
		}

	}


	/**
	 * Render content.
	 *
	 * @return  string
	 */
	public function content() {

		// Venue
		if ($this->event->venue_hidden) {
			$venue = __('Underground');
		} else if ($venue  = $this->event->venue()) {
			$venue = HTML::anchor(Route::model($venue), $venue->name);
		} else {
			$venue = HTML::chars($this->event->venue_name);
		}

		// Price
		$price = $this->event->price !== null && $this->event->price == 0 ?
			__('Free!') :
			($this->event->price > 0 ? Num::format($this->event->price, 2, true) . '€' : '');

		ob_start();

?>

	<p class="details"><?php echo $price, ' ', $venue ?></p>
	<p class="djs"><?php echo HTML::chars($this->event->dj) ?></p>

<?php

		return ob_get_clean();
	}

}<commit_msg>Fix some XSS<commit_after><?php defined('SYSPATH') or die('No direct access allowed.');
/**
 * Event view class for day list.
 *
 * @package    Events
 * @author     <NAME>
 * @copyright  (c) 2011-2012 <NAME>
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 */
class View_Event_Day extends View_Article {

	/**
	 * @var  string  Article class
	 */
	public $class = 'event';

	/**
	 * @var  Model_Event
	 */
	public $event;

	/**
	 * @var  boolean  Prefix content
	 */
	public $prefixed = true;


	/**
	 * Create new view.
	 *
	 * @param  Model_Event  $event
	 */
	public function __construct(Model_Event $event) {
		parent::__construct();

		$this->event = $event;

		$this->id    = 'event-' . $event->id;
		$this->title = HTML::anchor(Route::model($event), HTML::chars($event->name)) . ' <small>' . HTML::chars($event->city_name) . '</small>';

		// Flyer
		if ($image = $event->flyer_front()) {
			$icon = $image->get_url($image::SIZE_ICON);
		} else if ($image = $event->flyer_back()) {
			$icon = $image->get_url($image::SIZE_ICON);
		} else if (count($flyers = $event->flyers())) {
			$image = $flyers[0]->image();
			$icon  = $image->get_url($image::SIZE_ICON);
		} else {
			$icon = null;
		}
		if ($icon) {
			$this->prefix = HTML::anchor(Route::model($event), HTML::image($icon, array('alt' => __('Flyer'))), array('class' => 'avatar'));
		}


		// Meta
		if ($tags = $event->tags()) {
			$this->meta = implode(', ', $tags);
		} else if ($event->music) {
			$this->meta = $event->music;
		}

	}


	/**
	 * Render content.
	 *
	 * @return  string
	 */
	public function content() {

		// Venue
		if ($this->event->venue_hidden) {
			$venue = __('Underground');
		} else if ($venue  = $this->event->venue()) {
			$venue = HTML::anchor(Route::model($venue), HTML::chars($venue->name));
		} else {
			$venue = HTML::chars($this->event->venue_name);
		}

		// Price
		$price = $this->event->price !== null && $this->event->price == 0 ?
			__('Free!') :
			($this->event->price > 0 ? Num::format($this->event->price, 2, true) . '€' : '');

		ob_start();

?>

	<p class="details"><?php echo $price, ' ', $venue ?></p>
	<p class="djs"><?php echo HTML::chars($this->event->dj) ?></p>

<?php

		return ob_get_clean();
	}

}
{'fraction_non_alphanumeric': 0.227831136922046, 'fraction_numerical': 0.005360732633459906, 'mean_word_length': 3.26882745471878, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 103, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5418098', 'n_tokens_mistral': 1786, 'n_tokens_neox': 1600, 'n_words': 328}