<commit_before><?php

// // Build out URI to reload from form dropdown
// // Need full url for this to work in Opera Mini
// $pageURL = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";

// if (isset($_POST['sg_uri']) && isset($_POST['sg_section_switcher'])) {
// 	$pageURL .= $_POST[sg_uri].$_POST[sg_section_switcher];
// 	$pageURL = htmlspecialchars( filter_var( $pageURL, FILTER_SANITIZE_URL ) );
// 	header("Location: $pageURL");
// }

function titleify($filename){
	$title = ucwords(preg_replace("/\-/i", " ", $filename));
	return $title;
}

function sgListOptions($type, $folder = 'components'){

	$files = array();
	$folder = $folder ? $folder . '/' : false;
	$handle = opendir($folder . $type);

	while (false !== ($file = readdir($handle))):

		if (stristr($file, '.php')):

			$files[] = $file;

		endif;

	endwhile;

	if( sizeof($files) < 1 ) return false;

	sort($files);

	$html .= "<li>\n";

		$html .= "\t<span>" . titleify($type) . "</span>\n";

		$html .= "\t<ul>\n";

		foreach ($files as $file):

			$filename = preg_replace("/\.php$/i", "", $file);

			$title = preg_replace("/\-/i", " ", $filename);

			$title = ucwords($title);

			$html .= "\t\t<li><a href=\"#sg-" . $filename . "\">" . $title . "</a></li>\n";

		endforeach;

		$html .= "</ul>\n";

	$html .= "</li>\n";

	echo $html;

}

// Display markup view & source
function sgContent($type, $folder = 'components', $showMarkup = true){

	$files = array();
	$folder = $folder ? $folder . '/' : false;
	$title_class = $folder ? 'h3' : 'h2';
	$handle = opendir($folder . $type);

	while (false !== ($file = readdir($handle))) :

		if(stristr($file, '.php')):

			$files[] = $file;

		endif;

	endwhile;

	if (sizeof($files) < 1) {
		$html = "<p><em>No files found in " . $folder . " directory.</em></p>";
	} else {
		$html = false;
	}

	sort($files);

	foreach ($files as $file) :

		$filename = preg_replace("/\.php$/i", "", $file);
		$documentation = 'usage/'.$type.'/'.$file;

		$html .= "<article class=\"sg-content\">\n";

			$html .= "\t<header class=\"sg-content__header\">\n";
				$html .= "\t\t<h1 class=\"" . $title_class . "\" id=\"sg-" . $filename . "\">" . titleify($filename) . "</h1>\n";
			$html .= "\t</header>\n\n";

			$html .= "\t<div class=\"sg-content__example\">\n";
				$html .= file_get_contents($folder . $type .'/' . $file);
			$html .= "\t</div>\n";

			if ($showMarkup ) :
				$html .= "\t<div class=\"sg-content__markup\">\n";

					$html .= "\t\t<button class=\"sg-content__markup__toggle button toggle-class\">View Source</button>\n";

					$html .= "\t\t<div class=\"sg-content__markup__source vh\">\n";
						$html .= "\t\t\t<pre>\n";
							// $html .= "\t\t\t\t<code>\n";
								$html .= htmlspecialchars(file_get_contents($folder . $type .'/' . $file));
							// $html .= "\t\t\t\t</code>\n";
						$html .= "\t\t\t</pre>\n";
					$html .= "\t\t</div>\n";

				$html .= "\t</div>\n";
			endif;

		$html .= "</article>\n\n";

	endforeach;

	echo $html;

}

?><commit_msg>Styleguide "View Source" now uses Reveal module.<commit_after><?php

// // Build out URI to reload from form dropdown
// // Need full url for this to work in Opera Mini
// $pageURL = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";

// if (isset($_POST['sg_uri']) && isset($_POST['sg_section_switcher'])) {
// 	$pageURL .= $_POST[sg_uri].$_POST[sg_section_switcher];
// 	$pageURL = htmlspecialchars( filter_var( $pageURL, FILTER_SANITIZE_URL ) );
// 	header("Location: $pageURL");
// }

function titleify($filename){
	$title = ucwords(preg_replace("/\-/i", " ", $filename));
	return $title;
}

function sgListOptions($type, $folder = 'components'){

	$files = array();
	$folder = $folder ? $folder . '/' : false;
	$handle = opendir($folder . $type);

	while (false !== ($file = readdir($handle))):

		if (stristr($file, '.php')):

			$files[] = $file;

		endif;

	endwhile;

	if( sizeof($files) < 1 ) return false;

	sort($files);

	$html .= "<li>\n";

		$html .= "\t<span>" . titleify($type) . "</span>\n";

		$html .= "\t<ul>\n";

		foreach ($files as $file):

			$filename = preg_replace("/\.php$/i", "", $file);

			$id =  $type . '-' . $filename;

			$title = preg_replace("/\-/i", " ", $filename);

			$title = ucwords($title);

			$html .= "\t\t<li><a href=\"#sg-" . $id . "\">" . $title . "</a></li>\n";

		endforeach;

		$html .= "</ul>\n";

	$html .= "</li>\n";

	echo $html;

}

// Display markup view & source
function sgContent($type, $folder = 'components', $showMarkup = true){

	$files = array();
	$folder = $folder ? $folder . '/' : false;
	$title_class = $folder ? 'h3' : 'h2';
	$handle = opendir($folder . $type);

	while (false !== ($file = readdir($handle))) :

		if(stristr($file, '.php')):

			$files[] = $file;

		endif;

	endwhile;

	if (sizeof($files) < 1) {
		$html = "<p><em>No files found in " . $folder . " directory.</em></p>";
	} else {
		$html = false;
	}

	sort($files);

	foreach ($files as $file) :

		$filename = preg_replace("/\.php$/i", "", $file);
		$documentation = 'usage/'.$type.'/'.$file;
		$id =  $type . '-' . $filename;

		echo 'xxx' . $id;

		$html .= "<article class=\"sg-content\">\n";

			$html .= "\t<header class=\"sg-content__header\">\n";
				$html .= "\t\t<h1 class=\"" . $title_class . "\" id=\"sg-" . $id . "\">" . titleify($filename) . "</h1>\n";
			$html .= "\t</header>\n\n";

			$html .= "\t<div class=\"sg-content__example\">\n";
				$html .= file_get_contents($folder . $type .'/' . $file);
			$html .= "\t</div>\n";

			if ($showMarkup ) :
				$html .= "\t<div class=\"sg-content__markup reveal\">\n";

					$html .= "\t\t<input class=\"vh reveal__toggle\" type=\"checkbox\" id=\"source-" . $id . "\" value=\"\" tabindex=\"-1\">\n";

					$html .= "\t\t<label class=\"button reveal__label\" for=\"source-" . $id . "\">View Source</label>\n";

					$html .= "\t\t<div class=\"sg-content__markup__source reveal__wrapper\">\n";
						$html .= "\t\t\t<pre>\n";
							$html .= htmlspecialchars(file_get_contents($folder . $type .'/' . $file));
						$html .= "\t\t\t</pre>\n";
					$html .= "\t\t</div>\n";

				$html .= "\t</div>\n";
			endif;

		$html .= "</article>\n\n";

	endforeach;

	echo $html;

}

?>
{'fraction_non_alphanumeric': 0.26572632944228275, 'fraction_numerical': 0.002107652399481193, 'mean_word_length': 2.8921135646687697, 'pattern_counts': {'":': 0, '<': 72, '<?xml version=': 0, '>': 68, 'https://': 2, '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': '4800253', 'n_tokens_mistral': 2596, 'n_tokens_neox': 2318, 'n_words': 471}