<?php if(!defined('master_script')) die();

/**
 * Default data
 *
 * @category   Module (source-code)
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2010-01-15
 */
	
	$modules['source-code']['version'] = '1.1';
	$modules['source-code']['author'] = 'Nico Wenig';
	$modules['source-code']['support'] = 'mailto:nico.wenig@yellowgreen.de';
	$modules['source-code']['pagemap version'] = '0.4';
	$modules['source-code']['for'] = 'all';
	$modules['source-code']['key'] = 'source-code';
	$modules['source-code']['path'] = $system_data['folder']['modules'] . $modules['source-code']['key'] . '/';
	$modules['source-code']['languages'] = $system_data['folder']['modules'] . $modules['source-code']['key'] . '/languages/';
	$modules['source-code']['protected'] = 0;
	$modules['source-code']['preview'] = 0;
	
	include_txt($modules['source-code']['key'], $modules['source-code']['languages']);

	$system_data['backend']['header'] .= '
		<script src="' . $system_data['folder']['plugins'] . 'code-mirror/js/codemirror.js" type="text/javascript"></script>
		<link rel="stylesheet" type="text/css" href="' . $system_data['folder']['plugins'] . 'code-mirror/custom-line-numbers.css">
	';

/**
 * Save module to page
 *
 * @category   Module (source-code)
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-04-21
 */

	if(isset($_POST['save_source_code'])) {
		// Parse data
		$_POST['codefield'] = strip_custom_tags($_POST['codefield'], true, false, true, false, false);
		
		// Create module section
		$module_content_to_save = '
			<!-- MODULE: source-code -->
			
			<?php
				$module_settings["source-code"] = array(
					"language" => "' . clean_string($_POST['language'], true) . '",
					"margin top" => ' . intval($_POST['margin_top']) . ',
					"margin left" => ' . intval($_POST['margin_left']) . ',
					"css class" => "' . clean_string($_POST['css_class'], true) . '",
					"css id" => "' . clean_string($_POST['css_id'], true) . '",
					
					"content" => "
						' . $_POST['codefield'] . '
					"
				);

				' . connector('source-code backend save') . '
				include_module("source-code");
			?>
		';
	}

?>