예제 #1
0
function _compo2_preview_show($params, $uid, $comments = true)
{
    $ce = compo2_entry_load($params["cid"], $uid);
    echo "<p>";
    echo "<a href='?action=preview'>Back to Browse Entries</a>";
    if (isset($params["uid"]) && $params["uid"]) {
        if (current_user_can('edit_others_posts')) {
            //			$ce = compo2_entry_load($params["cid"],intval($_REQUEST["uid"]));
            echo " | <strong><a href='?action=edit&uid=" . $ce["uid"] . "&admin=1'>ADMIN EDIT</a></strong>";
        }
        if (intval($params["uid"]) === intval($uid)) {
            // If the entry exists //
            if ($ce["id"]) {
                echo " | <a href='?action=edit'>Edit Entry</a>";
            }
        }
    }
    echo "</p>";
    if (!$ce["id"]) {
        echo "<p>Sorry, this person does not have an Entry.</p>";
        return;
    }
    $shots = unserialize($ce["shots"]);
    $settings = unserialize($ce["settings"]);
    $is_nsfw = $settings["NSFL"];
    $baseurl = get_bloginfo("url") . "/wp-content";
    $has_embed = isset($settings["EMBED"]["url"]) && $settings["EMBED"]["url"] !== "";
    if ($has_embed) {
        $url = $settings["EMBED"]["url"];
        $width = $settings["EMBED"]["width"];
        $height = $settings["EMBED"]["height"];
        $imagefile = array_values($shots)[0];
        $shot_url = c2_thumb($imagefile, 900, 500, false, true);
        $play_code = "<div id='embed' onclick='c2_play_game();' style='width:{$width}px;height:{$height}px'><img class='embed-icon' src='{$shot_url}'><div class='embed-overlay'></div><img class='embed-icon' src='/compo/wp-content/plugins/compo2/art/play.png' /></div>";
        ?>
		<script>
			function c2_toggle_fullscreen() {
				var elem = document.getElementById('embed');
					if (elem.requestFullscreen) {
						elem.requestFullscreen();
					} else if (elem.msRequestFullscreen) {
						elem.msRequestFullscreen();
					} else if (elem.mozRequestFullScreen) {
						elem.mozRequestFullScreen();
					} else if (elem.webkitRequestFullscreen) {
						elem.webkitRequestFullscreen();
				}
			}
			
			function c2_play_game() {
				var elm = document.getElementById('embed-frame');
				elm.innerHTML = "<?php 
        echo "<iframe id='embed' src='{$url}' width='{$width}' height='{$height}' frameborder='0' allowfullscreen></iframe>";
        ?>
";
			}
			
			function c2_exit_game() {
				var elm = document.getElementById('embed-frame');
				elm.innerHTML = "<?php 
        echo $play_code;
        ?>
";
				//"<div id='embed' onclick='c2_play_game();'><?php 
        echo "<img id='embed' src='{$shot_url}'>";
        ?>
</div>";
			}
		</script>
		<style>
			#embed {
				margin:10px auto;
				display:block;
				position:relative;
				text-align:center;
			}
			
			:-webkit-full-screen #embed {
				width: 100%;
				height: 100%;
			}
			#embed:-ms-fullscreen {
				position:absolute;
				left:0px;
				top:0px;
				width: 100%;
				height: 100%;
			}					
			
			.embed-overlay {
				position:absolute;
				background:url('/compo/wp-content/plugins/compo2/art/TiledBars.png');
				left:0;
				top:0;
				width:100%;
				height:100%;
			}
			.embed-icon {
				position:absolute;
				left:50%;
				top:50%;
				-ms-transform: translate(-50%,-50);
				-webkit-transform: translate(-50%,-50%);
				transform: translate(-50%,-50%);				
			}
			
			.embed-controls {
				text-align:center;
			}
			.embed-controls img {
				cursor:pointer;
				opacity:0.3;
			}
			.embed-controls img:hover {
				opacity:1.0;
			}
		</style>
<?php 
        echo "<div id='embed-view'>";
        echo "<div id='embed-frame'>";
        echo $play_code;
        echo "</div>";
        echo "<div class='embed-controls'>";
        if ($settings["EMBED"]["fullscreen"]) {
            echo "<img src='{$baseurl}/plugins/compo2/art/Maximize.png' onclick='c2_toggle_fullscreen();'>";
        }
        echo "<img src='{$baseurl}/plugins/compo2/art/Power.png' onclick='if (confirm(\"Are you sure you want to Shutdown the game? All progress will be lost!\")) { c2_exit_game(); }'>";
        echo "</div>";
        echo "</div>";
    }
    echo "\n\t\t<style>\n\t\t\t#shotview {\n\t\t\t\ttext-align:center;\n\t\t\t\tmargin-bottom:10px;\n\t\t\t}\n\t\t\t#shotview img {\n\t\t\t\tmax-width:900px;\n\t\t\t}\n\t\t</style>\n\t";
    // Screenshot Viewer //
    echo "<div id='shotview' class='" . ($has_embed ? "hidden" : "") . "'>";
    $imagefile = array_values($shots)[0];
    $link = $baseurl . '/compo2/' . $imagefile;
    $preview = c2_thumb($imagefile, 900, 500, false, true);
    echo "<a id='shotview_link' href='{$link}' target='_blank'><img id='shotview_img' src='{$preview}'></a>";
    echo "</div>";
    // Game Name and Developer //
    echo "<div style='overflow:auto;'>";
    echo "<div style='float:right;'>";
    $user = unserialize($ce["get_user"]);
    echo get_avatar($user['user_email'], '56');
    echo "</div>";
    echo "<h2 style='font-size:28px'>" . htmlentities($ce["title"]) . "</h2>";
    echo "by <a href=\"../author/{$user['user_nicename']}/\" target='_blank'><strong>{$user['display_name']}</strong></a>";
    $div = $ce["etype"];
    echo " - <i>{$params["{$div}_title"]} Entry</i>";
    echo "</div>";
    ?>
	<style>
		.shot-nav {
			text-align:center;
			width:940px;
			left:-20px;
			position:relative;
			margin-top:10px;
		}
		
		.shot-nav .sn-item {
			display:inline-block;
			opacity:0.4;
			padding:3px;
			position:relative;
		}
		.shot-nav .sn-item:hover {
			opacity:1.0;
		}

		.shot-nav .sn-item .sn-img {
			border-radius:7px;
			cursor:pointer;
		}
		
		.shot-nav .sn-item .sn-overlay {
			border-radius:7px;
			position:absolute;
			background:url('/compo/wp-content/plugins/compo2/art/TiledBars.png');
			left:0;
			top:0;
			width:100%;
			height:100%;
		}
		
		.shot-nav .sn-item .sn-icon {
			position:absolute;
			left:50%;
			top:50%;
			-ms-transform: translate(-50%,-50);
			-webkit-transform: translate(-50%,-50%);
			transform: translate(-50%,-50%);
		}
		
		.shot-nav .sn-selected {
			opacity:0.8;
			border:3px solid #000;
			background:#000;
			border-radius:10px;
			padding:0;
		}
		
		.links {
			margin:0;
		}
		
		.links ul {
			list-style:none;
			margin:0;
		}
		.links ul li:before {
			content:'';
		}
		
		#compo-nsfw {
			cursor:pointer;
			background:#900;
			border-radius:10px;
			padding:20px;
			color:#FF0;
			text-align:center;
		}
		
		#compo-nsfw h2 {
			text-align:center;
			font-size:40px;
			color:#F80;
		}
		
	</style>
	
	<script>
		function c2_addclass( el, className ) {
			if ( el ) {
				if (el.classList)
					el.classList.add(className);
				else
					el.className += ' ' + className;
			}
		}
		function c2_removeclass( el, className ) {
			if ( el ) {
				if (el.classList)
					el.classList.remove(className);
				else
					el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
			}
		}

		// Global Variable //
		window.c2_ShotIndex = 0;
		
		function c2_show_embed() {
			c2_removeclass( document.getElementById('embed-view'), 'hidden');
		}
		function c2_hide_embed() {
			c2_addclass( document.getElementById('embed-view'), 'hidden');
		}
		
		function c2_show_image( _img, _link ) {
			c2_removeclass( document.getElementById('shotview'), 'hidden');
			document.getElementById('shotview_img').setAttribute('src', _img);
			document.getElementById('shotview_link').setAttribute('href', _link);
		}
		function c2_hide_image() {
			c2_addclass( document.getElementById('shotview'), 'hidden');
		}
		
		function c2_highlight_nav( id ) {
			c2_removeclass( document.getElementById('shot-nav-'+window.c2_ShotIndex), 'sn-selected');
			c2_addclass( document.getElementById('shot-nav-'+id), 'sn-selected');
			
			window.c2_ShotIndex = id;		
		}

		function c2_select_embed( id ) {
			c2_hide_image();
			
			c2_highlight_nav(id);
			
			c2_show_embed();
		}
		function c2_select_image( id, _img, _link ) {
			c2_hide_embed();
		
			c2_highlight_nav(id);

			c2_show_image( _img, _link );
		}
	</script>

<?php 
    //echo "NSFW Test:".(($is_nsfw=='1')?"YES":"nope");
    //<script>window.compo_game_nsfw = true;</script>
    if ($is_nsfw == '1') {
        echo "<script>window.compo_game_nsfw = true;</script>";
    }
    // Screenshots //
    echo "<div class='shot-nav'><span>";
    $idx = 0;
    if ($has_embed) {
        $imagefile = array_values($shots)[0];
        $link = $baseurl . '/compo2"/' . $imagefile;
        $thumb = c2_thumb($imagefile, 180, 140);
        $selected = $idx === 0 ? "sn-selected" : "";
        //		echo "<div class='sn-item {$selected}' id='shot-nav-{$idx}'><a href='' target='_blank'><img src='{$thumb}' width='180' height='140'></a></div>";
        echo "<div class='sn-item {$selected}' id='shot-nav-{$idx}' onclick='c2_select_embed({$idx});'>\n\t\t\t<img class='sn-img' src='{$thumb}' width='180' height='140'>\n\t\t\t<div class='sn-overlay'></div>\n\t\t\t<img class='sn-icon' id='embed-mode' src='/compo/wp-content/plugins/compo2/art/play-sm.png' />\n\t\t</div>";
        $idx++;
    }
    foreach ($shots as $imagefile) {
        if ($idx === 5) {
            break;
        }
        $link = $baseurl . '/compo2/' . $imagefile;
        $thumb = c2_thumb($imagefile, 180, 140);
        $preview = c2_thumb($imagefile, 900, 500, false, true);
        $selected = $idx === 0 ? "sn-selected" : "";
        //		echo "<div class='sn-item {$selected}' id='shot-nav-{$idx}'><a href='{$link}' target='_blank'><img src='{$thumb}' width='180' height='140'></a></div>";
        echo "<div class='sn-item {$selected}' id='shot-nav-{$idx}'><img class='sn-img' src='{$thumb}' width='180' height='140' onclick='c2_select_image({$idx},\"{$preview}\",\"{$link}\");'></div>";
        $idx++;
    }
    echo "</span></div>";
    // Description //
    echo "<p>" . str_replace("\n", "<br/>", htmlentities($ce["notes"])) . "</p>";
    // Links and Downloads //
    echo "<h2>Downloads and Links</h2>";
    echo "<div class='links'>";
    _compo2_preview_show_links($ce);
    echo "</div>";
    echo "<br />";
    echo '<meta name="twitter:card" content="summary" />';
    echo '<meta name="twitter:site" content="@ludumdare" />';
    $twitter = get_the_author_meta('twitter', (string) $uid);
    //get_the_author_meta('twitter', $user["ID"]);
    if ($twitter != null && $twitter != '') {
        echo '<meta name="twitter:creator" content="@' . $twitter . '" />';
    }
    echo '<meta name="twitter:title" content="' . substr(htmlentities($ce["title"]), 0, 70) . '" />';
    echo '<meta name="twitter:description" content="' . substr(htmlentities($ce["notes"]), 0, 200) . '" />';
    if ($firstshot != null && $firstshot != '') {
        echo '<meta name="twitter:image" content="' . get_bloginfo("url") . '/wp-content/compo2/' . htmlentities($firstshot) . '" />';
    }
    echo '<script>';
    echo 'var Elm = document.getElementsByTagName("title")[0];';
    echo 'Elm.innerHTML = "' . htmlentities($ce["title"]) . ' by ' . $user["display_name"] . ' | " + Elm.innerHTML;';
    echo '</script>';
    // Rating Results //
    if ($params["state"] == "results" || $params["state"] == "admin") {
        if (!isset($params["{$div}_judged"]) || $params["{$div}_judged"] !== "0") {
            _compo2_results_ratings($params, $uid);
        }
    }
    // Comments ?? //
    if ($comments) {
        _compo2_preview_comments($params, $uid, true);
    }
}
예제 #2
0
function c2_navigation($slug, $name, $name_url)
{
    $user_id = get_current_user_id();
    $event_id = 0;
    $underscore_slug = str_replace('-', '_', $slug);
    if (function_exists('apcu_fetch') && !isset($_GET["cache"])) {
        $event_id = apcu_fetch('c2_slug_cache_' . $underscore_slug);
    }
    if (!$event_id) {
        $page = get_posts(array('name' => $slug, 'post_type' => 'page'))[0];
        //print_r($page);
        $event_id = $page->ID;
        if (function_exists('apcu_store')) {
            apcu_store('c2_slug_cache_' . $underscore_slug, $event_id);
        }
    }
    $game = c2_get_game($event_id, $user_id);
    //		if ( current_user_can('edit_others_posts') ) {
    //			// TODO: Check for thumbnail (i.e. named thumb)
    //			// If no thumbnain, use first shot, resized //
    //
    //			echo '<img src="'.c2_thumb( $game['shots']['shot0'], 180, 140 ).'" width="180" heigh="140" />';
    ////			// MK: END NIGHT
    ////			var_dump($game);
    ////			/*
    ////			echo "<br/><br/>";
    ////			c2_set_game($event_id,$user_id,$game);
    ////			*/
    ////
    ////			//echo $event_id . " vs " . $user_id;
    //		}
    ?>
	<style>
		.event .e-info {
			font-size:12px;
			/*text-align:right;*/
			overflow:auto;
		}
		.event .e-gap {
			margin-top:10px
		}
		.event .e-big {
			font-size:15px;
		}
		
		.event .e-thumb {
			float:left;
			border-radius:7px;
			overflow:auto;
			margin-right:20px;
		}
	</style>
	<div class="event">
		<div class="info">
			<div class="navigation" style="">
<?php 
    if (is_user_logged_in()) {
        if ($game) {
            ?>
						<a href="/compo/<?php 
            echo $slug;
            ?>
/"><strong>Play and Rate Games</strong></a> | 
						<a href="/compo/<?php 
            echo $slug;
            ?>
/?action=edit">Edit</a> | 
<?php 
        } else {
            ?>
						<a style="font-size:15px" href="/compo/<?php 
            echo $slug;
            ?>
/?action=edit"><strong>SUBMIT NOW</strong></a> |
<?php 
        }
    }
    ?>
				<a href="/compo/<?php 
    echo $slug;
    ?>
/?action=preview">View All</a>
			</div>
			<div class="name">On Now: <strong><a href="<?php 
    echo $name_url;
    ?>
"><?php 
    echo $name;
    ?>
</a></strong></div>
<?php 
    if (is_user_logged_in()) {
        if ($game) {
            ?>
					<div class="e-info">
<?php 
            //if ( current_user_can('edit_others_posts') ) {
            // TODO: Check for thumbnail (i.e. named thumb)
            // If no thumbnain, use first shot, resized //
            $width = 180;
            $height = 140;
            echo '<div class="e-thumb e-gap"><a href="/compo/' . $slug . '/?action=preview&uid=' . $game['uid'] . '"><img src="' . c2_thumb($game['shots']['shot0'], $width, $height) . '" width="' . $width . '" height="' . $height . '" /></a></div>';
            ?>

						<div class="e-gap e-big"><strong><a href="/compo/<?php 
            echo $slug;
            ?>
/?action=preview&uid=<?php 
            echo $game['uid'];
            ?>
"><?php 
            echo $game['title'];
            ?>
</a></strong></div>
						<div>by <strong><?php 
            echo $game['get_user']['display_name'];
            ?>
</strong><!-- (<?php 
            echo $game['etype'];
            ?>
)--></div>
						<div class="e-gap">Coolness: <strong><?php 
            echo $game['rate_out'];
            ?>
</strong> (How many Entries you have rated)<!-- Bonus: <strong>?</strong>--></div>
						<?php 
            if ($game['etype'] !== "guest") {
                ?>
						<div>Votes: <strong><?php 
                echo $game['rate_in'];
                ?>
</strong></div>
						<?php 
            }
            ?>
						
						<!--<div>Comments: <strong>?</strong></div>-->
						<div style="display:none">Game Love: <strong><?php 
            echo $game['love'];
            ?>
</strong> Comment Love: <strong>?</strong></strong></div>

<?php 
            if (isset($game['settings']['OPTOUT'][$game['etype']])) {
                $total_cat = 8 - count($game['settings']['OPTOUT'][$game['etype']]);
                ?>
						<div>You are being judged in <strong><?php 
                echo $total_cat;
                ?>
</strong> categories</div>
<?php 
                foreach ($game['settings']['OPTOUT'][$game['etype']] as $cat => $val) {
                    if (strpos($cat, "Overall") === 0) {
                        ?>
								<div class="e-gap e-big"><strong>WARNING</strong>: You have opted-out of Overall<br />Is this correct? <a href="/compo/<?php 
                        echo $slug;
                        ?>
/?action=edit">Edit Submission</a></div>
<?php 
                        break;
                    }
                }
            }
            ?>
					
<?php 
            if (intval($game['active']) === 0) {
                ?>
						<div class="e-gap e-big"><strong>WARNING</strong>: Your game is currently Inactive<br />Make sure you have all required data. <a href="/compo/<?php 
                echo $slug;
                ?>
/?action=edit">Edit</a></div>
<?php 
            }
            ?>
					
<?php 
            if ($game['rate_in'] < 20) {
                ?>
						<div class="e-gap e-big"><strong>You need more votes!</strong> Rate more games!</div>
<?php 
            }
            ?>
					</div>
<?php 
        }
    }
    ?>
		</div>
	</div>
<?php 
}
예제 #3
0
function _compo2_active_form($params, $uid = "", $is_admin = 0)
{
    if (!$uid) {
        $uid = $params["uid"];
    }
    $ce = compo2_entry_load($params["cid"], $uid);
    /*
    	if ( current_user_can('edit_others_posts') ) {
    		echo "Hey team. Just ignore this for now. Only you can see it. Thanks!<br /><br />";
    		var_dump( $ce );
    	}
    */
    if (isset($params["locked"]) && !isset($ce["id"]) && !$is_admin) {
        echo "<p class='warning'>This competition is locked.  No new entries are being accepted.</p>";
        return;
    }
    // TODO: Make just one (which means make code to iterate, add "add new" button)
    $links = unserialize($ce["links"]);
    if (!$ce["id"]) {
        $links = array(0 => array("title" => "Web", "url" => ""), 1 => array("title" => "Windows", "url" => ""), 2 => array("title" => "OS/X", "url" => ""), 3 => array("title" => "Linux", "url" => ""), 4 => array("title" => "Source", "url" => ""));
    }
    $settings = unserialize($ce["settings"]);
    if (!$is_admin) {
        echo "<p><a href='?action=preview'>Browse entries.</a></p>";
    }
    $star = "<span style='color:#f00;font-weight:bold;'>*</span>";
    echo "<h3>Edit Entry</h3>";
    echo "\n\t<style>\n\t\t.edit form {\n\t\t\ttext-align:left;\n\t\t}\n\t\t.edit h2 {\n\t\t\tmargin-top:10px;\n\t\t\tmargin-bottom:0;\n\t\t}\n\t\t\n\t\t.edit .hidden {\n\t\t\tdisplay:none;\n\t\t}\n\t\t\n\t\t.edit .button {\n\t\t\tfont-size:24px;\n\t\t\tfont-weight:bold;\n\t\t}\n\t</style>\n\t";
    echo "<div class='edit'>";
    if ($ce["disabled"]) {
        echo "<div class='warning'>This Entry is disabled.</div>";
    } else {
        if ($ce["id"] != "" && !$ce["active"]) {
            echo "<div class='warning'>Entry is not complete.</div>";
        }
    }
    $link = "?action=save";
    if ($is_admin) {
        $link .= "&admin=1&uid={$uid}";
    }
    // TIPS //
    echo "<div>" . $params["tips"] . "</div>";
    echo "<form method='post' action='{$link}' enctype='multipart/form-data'>";
    echo "<input type='hidden' name='formdata' value='1'>";
    echo "<h2>Name {$star}</h2>";
    echo "<input type='text' name='title' value=\"" . htmlentities($ce["title"]) . "\" size=60>";
    ////////////////////////////////////////////////////////////////////////////
    // Handle the entry type.
    ////////////////////////////////////////////////////////////////////////////
    /*
    @$etype = $ce["etype"];
    $opts = false; $default = "";
    if ($params["gamejam"] == 1 || $params["init"] != 0) { // if we're in a gamejam
    	if ($params["state"] == "active") { // and we're active, show the options
    		$opts = true;
    	} else { // but if we're not active, the default is gamejam
    		$default = "gamejam";
    	}
    } else { // non-gamejam, we're always compo
    	$default = "compo";
    }
    if ($is_admin) { $opts = true; }
    if (!strlen($etype)) { $etype = $default; } // set the default
    */
    $opts = true;
    $divs = $params["opendivs"];
    // Since parsing can be a little wonky, lets make sure there are no blank events //
    foreach ($divs as $key => $val) {
        if ($val === "") {
            unset($divs[$key]);
        }
    }
    array_values($divs);
    @($etype = $ce["etype"]);
    if (strlen($etype)) {
        if (!in_array($etype, $divs)) {
            array_unshift($divs, $etype);
        }
    }
    if ($is_admin) {
        $divs = $params["divs"];
    }
    ?>
	<script>
		function c2_addclass( el, className ) {
			if (el.classList)
				el.classList.add(className);
			else
				el.className += " " + className;
		}
		
		function c2_removeclass( el, className ) {
			if (el.classList)
				el.classList.remove(className);
			else
				el.className = el.className.replace(new RegExp("(^|\\b)" + className.split(" ").join("|") + "(\\b|$)", "gi"), " ");
		}
	
		// Toggles the disabled property of an id by checkboxes with same basename //
		function c2_edit_typechange( name ) {
			var target = document.getElementById("etype_"+name);
			var requirement = document.querySelectorAll("." + name + "_REQ");
			
			var disable = false;
			
			for ( var idx = 0; idx < requirement.length; idx++ ) {
				if ( !requirement[idx].checked ) {
					disable = true;
					break;
				}
			}
			
			target.disabled = disable;
		}
		
		// Returns which radio button is set, matching a class //
		function c2_which_radio( classname ) {
			var radio = document.querySelectorAll("." + classname);
			
			for ( var idx = 0; idx < radio.length; idx++ ) {
				if ( radio[idx].checked ) {
					return radio[idx];
				}
			}
			return null;
		}
		
		function c2_on_submission_type_changed( e ) {
			c2_show_optouts( e.getAttribute("value") );
			c2_toggle_options( e.getAttribute("value") );
		}
		
		function c2_show_optouts( etype ) {
			var radio = document.querySelectorAll(".optout-type");
			for ( var idx = 0; idx < radio.length; idx++ ) {
				c2_addclass( radio[idx], "hidden" );
			}
			
			var el;
			if ( etype ) {
				el = document.getElementById(etype+"-submission-type");
			}
			else {
				el = document.getElementById("no-submission-type");
			}

			if ( el ) {
				c2_removeclass( el, "hidden" );
			}
		}

		var c2_params = {
<?php 
    function substr_count_array($haystack, $needles)
    {
        $count = 0;
        foreach ($needles as $substring) {
            $count += substr_count($haystack, $substring);
        }
        return $count;
    }
    $to_share = ["title", "judged", "rating", "settings"];
    foreach ($params as $key => $val) {
        if (substr_count_array($key, $to_share) > 0) {
            echo "\"{$key}\":\"{$val}\",";
        }
    }
    ?>
		};
		
		function c2_toggle_options( etype ) {
			var option = document.querySelectorAll(".entry-option");
			for ( var idx = 0; idx < option.length; idx++ ) {
				c2_removeclass( option[idx], "hidden" );
			}
			
			//var etype = c2_which_radio("etype").getAttribute("value");
			
			if ( c2_params[etype+"_judged"] === "0") {
				c2_addclass(document.getElementById("show-judged"),"hidden");
			}
			if ( c2_params[etype+"_rating"] === "0") {
				c2_addclass(document.getElementById("show-rating"),"hidden");
			}
			if ( c2_params[etype+"_settings"] === "0") {
				c2_addclass(document.getElementById("show-settings"),"hidden");
			}
		}
	</script>
<?php 
    if ($opts) {
        echo "<h2>Submission Type {$star}</h2>";
        foreach ($divs as $div) {
            $requirement = [];
            if ($params[$div . "_req"]) {
                $requirement = explode(";", $params[$div . "_req"]);
            }
            $selected = strcmp($etype, $div) == 0 ? "checked" : "";
            $disabled = count($requirement) > 0 && $selected === "" ? "disabled" : "";
            // Radio Button //
            echo "<input type='radio' name='etype' id='etype_{$div}' class='etype' value='{$div}' onchange='c2_on_submission_type_changed(this);' {$selected} {$disabled} /> " . $params["{$div}_title"] . "</input>";
            // Summary //
            echo "<div><i>" . $params["{$div}_summary"] . "</i></div>";
            $idx = 0;
            foreach ($requirement as $req) {
                echo "<input type='checkbox' class='{$div}_REQ' name='REQ[{$div}][{$idx}]' value='1' onchange='c2_edit_typechange(\"{$div}\");' " . ($selected !== "" ? "checked" : "") . ">{$req}</input><br />";
                $idx++;
            }
            if ($idx > 0) {
                echo "<div style='margin-top:10px;margin-bottom:10px;color:#F00'><strong>IMPORTANT:</strong> You must click all checkboxes.</div>";
            } else {
                echo "<br />";
            }
        }
        $hidden = "";
        //echo $etype."_judged: ".$params[$etype."_judged"];
        if (isset($params[$etype . "_judged"]) && $params[$etype . "_judged"] === "0") {
            $hidden = "hidden";
        }
        echo "<div id='show-judged' class='entry-option {$hidden}'>";
        echo "<h2>I would like to be judged in these categories</h2>";
        echo "If you feel the game doesn't deserve to be judged in a category, deselect it.<br /><br />";
        //echo "<span style='color:#F0F;'><strong>*WORK IN PROGRESS*</strong></span> This feature is unfinished. Come back later to set these.<br />";
        //echo "You will <strong>not</strong> be rated in these categories.<br /><br />";
        //echo "Opting out is <strong>NOT</strong> required. Do it <strong>*ONLY*</strong> if you don't want to be rated in a category.<br /><br />";
        $hidden = $etype ? "hidden" : "";
        echo "<div id='no-submission-type' class='optout-type {$hidden}'>Please select a Submission Type</div>";
        foreach ($divs as $div) {
            $hidden = strcmp($etype, $div) == 0 ? "" : "hidden";
            echo "<div id='{$div}-submission-type' class='optout-type {$hidden}'>";
            foreach ($params["{$div}_cats"] as $catname) {
                $checked = isset($settings["OPTOUT"][$div][$catname]) ? "" : "checked";
                echo "<input type='checkbox' class='' name='OPTOUT[{$div}][{$catname}]' value='1' {$checked}>" . $catname . "</input><br />";
            }
            echo "</div>";
        }
        echo "</div>";
        $hidden = "";
        if (isset($params[$etype . "_rating"]) && $params[$etype . "_rating"] === "0") {
            $hidden = "hidden";
        }
        echo "<div id='show-rating' class='entry-option {$hidden}'>";
        echo "<h2>Content Rating</h2>";
        //echo "<span style='color:#F0F;'><strong>*WORK IN PROGRESS*</strong></span> This feature is unfinished. Come back later to set these.<br />";
        echo "<input type='checkbox' class='' name='SETTING[NSFW]' value='1' " . ($settings["NSFW"] ? "checked" : "") . ">This Entry may not be suitable for kids.</input><br />";
        echo "<input type='checkbox' class='' name='SETTING[NSFL]' value='1' " . ($settings["NSFL"] ? "checked" : "") . ">This Entry contains material or subject matter that may be offensive.</input>";
        echo "<div style='margin-top:10px;margin-bottom:10px'><strong>NOTE:</strong> We may enable these if we get complaints about an Entry.<br />The first lets people omit kid-unfriendly games, and the 2nd brings up a warning.</div>";
        echo "</div>";
        $hidden = "";
        if (isset($params[$etype . "_settings"]) && $params[$etype . "_settings"] === "0") {
            $hidden = "hidden";
        }
        echo "<div id='show-settings' class='entry-option {$hidden}'>";
        echo "<h2>Settings</h2>";
        //echo "<span style='color:#F0F;'><strong>*WORK IN PROGRESS*</strong></span> This feature is unfinished. Come back later to set these.<br />";
        echo "<input type='checkbox' class='' name='SETTING[ANONYMOUS]' value='1' " . ($settings["ANONYMOUS"] ? "checked" : "") . ">I would like to allow anonymous feedback. I understand this means my Entry will be criticized more harshly, and I can take it.</input>";
        echo "</div>";
        echo "<br />";
    } else {
        echo "<input type='hidden' name='etype' value='{$etype}'>";
    }
    ////////////////////////////////////////////////////////////////////////////
    // Description //
    echo "<h2>Description {$star}</h2>";
    echo "<textarea name='notes' rows=12 cols=80>" . htmlentities($ce["notes"]) . "</textarea>";
    // Screenshots //
    echo "<h2>Screenshot(s) {$star}</h2>";
    echo "You must include <i>at least</i> one screenshot in <strong>PNG</strong>, <strong>JPEG</strong> or <strong>GIF</strong> formats.<br />";
    echo "Images larger than 900x500 pixels will be resized. GIFs wont animate. Images <strong>MUST</strong> be less than <strong>4096x2160</strong> pixels.<br />";
    echo "<br />";
    $shots = unserialize($ce["shots"]);
    $shot_count = count($shots);
    if ($shot_count < 4) {
        $shot_count = 4;
    }
    $baseurl = get_bloginfo("url") . "/wp-content/compo2/";
    echo "<table>";
    for ($i = 0; $i < $shot_count; $i++) {
        $k = "shot{$i}";
        echo "<tr>";
        echo "<td>" . ($i + 1) . ".</td>";
        echo "<td><input type='file' name='{$k}'></td>";
        echo "</tr>";
        if (isset($shots[$k])) {
            echo "<tr><td></td><td align=left><a href=" . $baseurl . $shots[$k] . " target='_blank'><img src='" . c2_thumb($shots[$k], 180, 140) . "' width='180' height='140'></a></td></tr>";
        }
    }
    echo "</table>";
    // Thumbnail //
    echo "<!--<h2>Customize Thumbnail</h2>";
    echo "Game thumbnails are <strong>180x140</strong> pixels (9:7). Images will be scaled and cropped to 180x140 pixels.<br />";
    echo "If you don't set a thumbnail, Screenshot #1 will be used instead.<br />";
    echo "<strong>TIP</strong>: If you use an exactly <strong>180x140 GIF</strong>, it will animate on hover. Max file size <strong>1 MB</strong>.<br />";
    echo "<span style='color:#F0F;'><strong>*WORK IN PROGRESS*</strong></span> This feature is unfinished. Come back later to set these.<br />";
    echo "<br />-->";
    echo "<!--<table>";
    echo "<tr><td><input type='file' name='SETTING[thumb]'></td></tr>";
    if (isset($settings['thumb'])) {
        echo "<tr><td align=left><img src='" . c2_thumb($settings['thumb'], 180, 140) . "' width='180' height='140'></tr></tr>";
    }
    echo "</table>-->";
    echo "<br />";
    // Downloads //
    echo "<h2>Downloads and Links {$star}</h2>";
    echo "You must host downloads elsewhere. Need a host? <a href='http://ludumdare.com/compo/faq/' target='_blank'>See the <strong>FAQ</strong></a>.<br />";
    echo "<strong>TIP:</strong> Hosting on a Gaming website? <strong>DON'T FORGET</strong> to link to your Ludum Dare page! Fellow LD'ers can't rate you if they can't find you!<br />";
    echo "<br />";
    $links_count = count($links);
    if ($links_count < 5) {
        $links_count = 5;
    }
    echo "<table>";
    echo "<tr><th><th>Link Name<th><th>URL (don't forget the http://)";
    for ($i = 0; $i < $links_count; $i++) {
        echo "<tr><td>";
        echo "<td><input type='text' name='links[{$i}][title]' size=15 value=\"" . htmlentities($links[$i]["title"]) . "\">";
        echo "<td>";
        echo "<td><input type='text' name='links[{$i}][link]' size=45 value=\"" . htmlentities($links[$i]["link"]) . "\">";
    }
    echo "</table>";
    echo "<h2>Embed URL</h2>";
    //echo "<span style='color:#F0F;'><strong>*WORK IN PROGRESS*</strong></span> This feature is unfinished. Come back later to set these.<br />";
    echo "For web games, we can embed the game in an HTML iframe for play right on the Entry page.<br />";
    echo "<br />";
    $embed_url = "";
    $embed_width = 800;
    $embed_height = 450;
    if (isset($settings["EMBED"]["url"])) {
        $embed_url = $settings["EMBED"]["url"];
    }
    if (isset($settings["EMBED"]["width"])) {
        $embed_width = $settings["EMBED"]["width"];
    }
    if (isset($settings["EMBED"]["height"])) {
        $embed_height = $settings["EMBED"]["height"];
    }
    echo "<table>";
    echo "<tr><th><th>URL (don't forget the http://)<th><th>Width<th><th>Height";
    echo "<tr><td>";
    echo "<td><input type='text' name='SETTING[EMBED][url]' size=45 value=\"" . $embed_url . "\">";
    echo "<td>";
    echo "<td><input type='text' name='SETTING[EMBED][width]' size=5 value=\"" . $embed_width . "\">";
    echo "<td>";
    echo "<td><input type='text' name='SETTING[EMBED][height]' size=5 value=\"" . $embed_height . "\">";
    echo "<tr><td>";
    echo "<td>";
    echo "<td>";
    echo "<td>Max: 900";
    echo "<td>";
    echo "<td>Max: 600";
    echo "<td>";
    echo "</table>";
    echo "<input type='checkbox' class='' name='SETTING[EMBED][fullscreen]' value='1' " . ($settings['EMBED']['fullscreen'] ? "checked" : "") . ">Enable Fullscreen Button.<br/>People have a variety of screen sizes, so games running Fullscreen should be able to support a variety of 16:9, 16:10, and 4:3 resolutions.</input><br />";
    //	echo "<input type='checkbox' class='' name='SETTING[EMBED][nocontrols]' value='1' ".($settings['EMBED']['nocontrols']?"checked":"").">Disable all Controls. No more Reset, Power, or other helper buttons. Just a Raw Embed.</input><br />";
    /*    echo "<br />";*/
    /*
    	echo "<h2>Automatic Embed</h2>";
    	echo "<span style='color:#F0F;'><strong>*WORK IN PROGRESS*</strong></span> This feature is unfinished. Come back later to set these.<br />";
    	echo "YouTube video? ";
    	echo "Alternatively, we can embed a YouTube video. <strong>NOTE:</strong> If you set an Embed URL, we will use that instead.<br />";
    	echo "<br />";
    
    	echo "<table>";
    	echo "<tr><th><th>URL (don't forget the http://)";
    	echo "<tr><td>";
    	echo "<td><input type='text' name='SETTING[EMBED][youtube]' size=45 value=\"".""."\">";
    	echo "</table>";
    */
    echo "<br />";
    /*    echo "<h2>Extra Stuff</h2>";
    	// this is non-functional
    	echo "<table>";
    	echo "<tr><td><input type='checkbox' name='data[pov_toggle]'>";
    	echo "<td>Checkbox that PoV wanted for reasons unbeknownst to us.";
    	echo "</table>";*/
    if ($is_admin) {
        echo "<table>";
        echo "<tr><td>Disabled";
        echo "<td>";
        compo2_select("disabled", array("0" => "No", "1" => "Yes"), $ce["disabled"]);
        echo "</table>";
    }
    echo "<p>";
    echo "<input type='submit' class='button' value='Save Changes'>";
    echo "</p>";
    echo "</form>";
    echo "<p>{$star} - required field</p>";
    echo "</div>";
}