<commit_before><?php

// Gog.com Parser for OneBox

if(isset($onebox)) {

	$match = preg_match('/^https?:\\/\\/www\\.gog\\.com\\/.+$/', $onebox->data['url']);

	if($match) {
		$onebox->addClass("onebox-gog");
		$data = get_gog_data($onebox->data['url']);
		$onebox->update($data);
	}
}


function get_gog_data($url) {

	$data=array();

	$query = parse_url($url, PHP_URL_QUERY);
	if($query) {
	    $data['displayurl']=$url.'&pp=ec7f1f65067126f3b2bd1037de8a18d0db2ec84b';
	} else {
	    $data['displayurl']=$url.'?pp=ec7f1f65067126f3b2bd1037de8a18d0db2ec84b';
	}

	preg_match('#/(game|gamecard)/(\w+)/?\??#', $url, $regex);
	$ID = $regex[2];

	if($ID) {
		require_once("lib/html5lib/library/HTML5/Parser.php");

		$file = file_get_contents($url);
		$doc = HTML5_Parser::parse($file);
		$finder = new DomXPath($doc);

		//$img = $finder->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' game_top ')]/img");
		//$data['image']= $img->item(0)->getAttribute("src");

		$additional = array();
		@$genrelist = $finder->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' game_top ')]/ul[contains(concat(' ', normalize-space(@class), ' '), ' details ')]/li[1]/a");
		if(count($genrelist)) {
			$genres = array();
			foreach($genrelist as $genre) {
				$genres[]=$genre->nodeValue;
			}
			$additional[]= __('Genre: ', "onebox").implode(", ", $genres);<commit_msg>use absolute path for includes<commit_after><?php

// Gog.com Parser for OneBox

if(isset($onebox)) {

	$match = preg_match('/^https?:\\/\\/www\\.gog\\.com\\/.+$/', $onebox->data['url']);

	if($match) {
		$onebox->addClass("onebox-gog");
		$data = get_gog_data($onebox->data['url']);
		$onebox->update($data);
	}
}


function get_gog_data($url) {

	$data=array();

	$query = parse_url($url, PHP_URL_QUERY);
	if($query) {
	    $data['displayurl']=$url.'&pp=ec7f1f65067126f3b2bd1037de8a18d0db2ec84b';
	} else {
	    $data['displayurl']=$url.'?pp=ec7f1f65067126f3b2bd1037de8a18d0db2ec84b';
	}

	preg_match('#/(game|gamecard)/(\w+)/?\??#', $url, $regex);
	$ID = $regex[2];

	if($ID) {
		require_once(WP_PLUGIN_DIR.'/onebox/lib/html5lib/library/HTML5/Parser.php');

		$file = file_get_contents($url);
		$doc = HTML5_Parser::parse($file);
		$finder = new DomXPath($doc);

		//$img = $finder->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' game_top ')]/img");
		//$data['image']= $img->item(0)->getAttribute("src");

		$additional = array();
		@$genrelist = $finder->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' game_top ')]/ul[contains(concat(' ', normalize-space(@class), ' '), ' details ')]/li[1]/a");
		if(count($genrelist)) {
			$genres = array();
			foreach($genrelist as $genre) {
				$genres[]=$genre->nodeValue;
			}
			$additional[]= __('Genre: ', "onebox").implode(", ", $genres);
{'fraction_non_alphanumeric': 0.25989304812834224, 'fraction_numerical': 0.037076648841354726, 'mean_word_length': 4.821576763485477, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '755687', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1148, 'n_words': 135}