3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Theme Name $themename = "Dance Floor"; //prefix $shortname = "theme_"; //Array $options = array ( array( "name" => "Videos urls", "id" => $shortname."_videosArray", "std" => "a:5:{s:10:\"url_video1\";a:3:{s:4:\"link\";s:1:\"#\";s:6:\"height\";i:250;s:5:\"width\";i:300;}s:10:\"url_video1\";a:3:{s:4:\"link\";s:1:\"#\";s:6:\"height\";i:250;s:5:\"width\";i:300;}s:10:\"url_video1\";a:3:{s:4:\"link\";s:1:\"#\";s:6:\"height\";i:250;s:5:\"width\";i:300;}s:10:\"url_video1\";a:3:{s:4:\"link\";s:1:\"#\";s:6:\"height\";i:250;s:5:\"width\";i:300;}s:10:\"url_video1\";a:3:{s:4:\"link\";s:1:\"#\";s:6:\"height\";i:250;s:5:\"width\";i:300;}}"), array( "name" => "Banners", "id" => $shortname."_bannersArray", "std" => "a:6:{s:13:\"theme_banner1\";a:5:{s:4:\"link\";s:1:\"#\";s:9:\"image_url\";s:0:\"\";s:6:\"height\";i:125;s:5:\"width\";i:125;s:6:\"status\";i:0;}s:13:\"theme_banner2\";a:5:{s:4:\"link\";s:1:\"#\";s:9:\"image_url\";s:0:\"\";s:6:\"height\";i:125;s:5:\"width\";i:125;s:6:\"status\";i:0;}s:13:\"theme_banner3\";a:5:{s:4:\"link\";s:1:\"#\";s:9:\"image_url\";s:0:\"\";s:6:\"height\";i:125;s:5:\"width\";i:125;s:6:\"status\";i:0;}s:13:\"theme_banner4\";a:5:{s:4:\"link\";s:1:\"#\";s:9:\"image_url\";s:0:\"\";s:6:\"height\";i:125;s:5:\"width\";i:125;s:6:\"status\";i:0;}s:13:\"theme_banner5\";a:6:{s:4:\"link\";s:1:\"#\";s:9:\"image_url\";s:0:\"\";s:6:\"height\";i:250;s:5:\"width\";i:300;s:6:\"status\";i:0;s:7:\"adsense\";s:0:\"\";}s:13:\"theme_banner6\";a:6:{s:4:\"link\";s:1:\"#\";s:9:\"image_url\";s:0:\"\";s:6:\"height\";i:60;s:5:\"width\";i:468;s:6:\"status\";i:0;s:7:\"adsense\";s:0:\"\";}}" ), array( "name" => "Styles", "id" => $shortname."_css", "std" => "style.css" ), array( "name" => "flickr", "id" => $shortname."_flickr", "std" => "a:4:{s:4:\"nsid\";s:0:\"\";s:7:\"display\";s:0:\"\";s:11:\"displayType\";s:0:\"\";s:4:\"tags\";s:0:\"\";}" ), array( "name" => "musicplayer", "id" => $shortname."_musicplayer", "std" => "a:2:{s:2:\"id\";s:0:\"\";s:3:\"num\";s:1:\"5\";}" ), array( "name" => "FeedbSumition", "id" => $shortname."_musicplayerSumition", "std" => "" ), array( "name" => "html5", "id" => $shortname."_html5", "std" => "" ), array( "name" => "BannersStatus", "id" => $shortname."_bannerStatus", "std" => "1" ), ); //Flickr display types $flickrDisplayType = Array("square", "thumbnail", "small"); //Existing CSS Files $cssFiles = get_availableCss(); function get_bannersSettings($bannerId, $index = FALSE){ global $themename, $shortname, $options; $theBanners = get_option($shortname."_bannersArray"); if(!is_array($theBanners)){ $theBanners = unserialize($options[1]["std"]); } $theActualBanner = $theBanners[$bannerId]; if($index != FALSE){ return $theActualBanner[$index]; }else{ return $theActualBanner; } } function get_videoSettings($videoId, $index){ global $themename, $shortname, $options; $theVideos = get_option($shortname."_videosArray"); if(!is_array($theVideos)){ $theVideos = unserialize($options[0]["std"]); } $theActualVideo = $theVideos[$videoId]; return $theActualVideo[$index]; } function get_flickrSettings($index){ global $themename, $shortname, $options; $theflickrSettings = get_option($shortname."_flickr"); if(!is_array($theflickrSettings)){ $theflickrSettings = unserialize($options[3]["std"]); } return $theflickrSettings[$index]; } function get_musicplayer($index){ global $themename, $shortname, $options; $themusicplayerSettings = get_option($shortname."_musicplayer"); if(!is_array($themusicplayerSettings)){ $themusicplayerSettings = unserialize($options[4]["std"]); } return $themusicplayerSettings[$index]; } /* Get Available CSS */ function get_availableCss(){ $result = array(); $dir = dir(TEMPLATEPATH."/"); while (false !== ($file = $dir->read())) { if(ereg("\.css", $file, $r)){ $result[] = $file; } } $dir->close(); return $result; } /* Reset or Update Theme Options */ function newThemeOptions_add_admin() { global $themename, $shortname, $options, $cssFiles; if ( $_GET['page'] == basename("__FILE__ not allowed" not allowed" not allowed" not allowed" not allowed") ) { if($_REQUEST['saveButton']){ while(list($videoId, $bannerInfo) = each($_REQUEST[$shortname."_video"])){ $videoInfo["width"] = get_videoSettings($videoId, "width"); $videoInfo["height"] = get_videoSettings($videoId, "height"); $videoInfo["link"] = $_REQUEST[$shortname."_video"][$videoId]["link"]; $allVideos[$videoId] = $bannerInfo; } update_option( $shortname."_videosArray", $allVideos); update_option( $shortname."_css", $_REQUEST[ $shortname."_css" ] ); while(list($bannerId, $bannerInfo) = each($_REQUEST[$shortname."_banner"])){ $bannerInfo["width"] = get_bannersSettings($bannerId, "width"); $bannerInfo["height"] = get_bannersSettings($bannerId, "height"); $bannerInfo["status"] = $_REQUEST[$shortname."_banner"][$bannerId]["status"]; if($_REQUEST[$shortname."_banner"][$bannerId]["adsense"]) $bannerInfo["adsense"] = ($_REQUEST[$shortname."_banner"][$bannerId]["adsense"]); $allBanners[$bannerId] = $bannerInfo; } update_option( $shortname."_bannersArray", $allBanners); update_option( $shortname."_flickr", $_REQUEST[$shortname."_flickr"]); update_option( $shortname."_musicplayer", $_REQUEST[$shortname."_musicplayer"]); update_option( $shortname."_musicplayerSumition", $_REQUEST[$shortname."_musicplayerSumition"]); update_option( $shortname."_html5", $_REQUEST[$shortname."_html5"]); update_option( $shortname."_bannerStatus", $_REQUEST[$shortname."_bannerStatus"]); header("Location: themes.php?page=functions.php&saved=true"); die; }else if($_REQUEST['resetButton']){ foreach ($options as $value) { delete_option( $value['id'] ); } header("Location: themes.php?page=functions.php&reset=true"); die; } } add_theme_page($themename." Options", "Theme Options", 'edit_themes', basename("""""__FILE__ not allowed" not allowed" not allowed" not allowed" not allowed"), 'newThemeOptions_admin'); } function newThemeOptions_admin() { global $themename, $shortname, $options, $cssFiles, $flickrDisplayType; if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings saved.</strong></p></div>'; if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings reset.</strong></p></div>'; echo "\n<style type='text/css'>"; echo "\ndiv.wrap dl{margin: 0; padding: 0;}"; echo "\ndiv.wrap dt{position: relative; left: 0; top: 1.1em; width: 8em; font-weight: bold;}"; echo "\ndiv.wrap dd{ margin: 0 0 0 10em; padding: 0 0 .5em .5em;}"; echo "\table#outer dl h3, table#outer td.right dl h4 { font-size: 10pt; font-weight: bold; margin:0; padding: 4px 10px 4px 10px; }"; echo "\n</style>"; echo "\n<script>"; echo "\n\tfunction markAll(selectStatus){"; echo "\n\t\tif(selectStatus){"; echo "\n\t\t\tdocument.getElementById('theme__banner[theme_banner1][status]').checked = true;"; echo "\n\t\t\tdocument.getElementById('theme__banner[theme_banner2][status]').checked = true;"; echo "\n\t\t\tdocument.getElementById('theme__banner[theme_banner3][status]').checked = true;"; echo "\n\t\t\tdocument.getElementById('theme__banner[theme_banner4][status]').checked = true;"; echo "\n\t\t\tdocument.getElementById('theme__banner[theme_banner5][status]').checked = true;"; echo "\n\t\t\tdocument.getElementById('theme__banner[theme_banner6][status]').checked = true;"; echo "\n\t\t}else{"; echo "\n\t\t\tdocument.getElementById('theme__banner[theme_banner1][status]').checked = false;"; echo "\n\t\t\tdocument.getElementById('theme__banner[theme_banner2][status]').checked = false;"; echo "\n\t\t\tdocument.getElementById('theme__banner[theme_banner3][status]').checked = false;"; echo "\n\t\t\tdocument.getElementById('theme__banner[theme_banner4][status]').checked = false;"; echo "\n\t\t\tdocument.getElementById('theme__banner[theme_banner5][status]').checked = false;"; echo "\n\t\t\tdocument.getElementById('theme__banner[theme_banner6][status]').checked = false;"; echo "\n\t\t}"; echo "\n\t}"; echo "\n</script>"; echo "\n<div class=\"wrap\">"; echo "\n<p id=\"icon-options-general\" class=\"icon32\"><h2>".$themename." _e("theme settings","language"); "</h2></p><br/>"; echo "\n<form method=\"post\">"; echo "\n<p class=\"submit\" style=\"border:0px;padding:0px;\">"; echo "\n\t<input class=\"button-primary\" type=\"submit\" name=\"saveButton\" value=\"" _e("Save settings","language"); echo "\" />"; echo "\n\t<input class=\"button\" name=\"resetButton\" type=\"submit\" value=\"" _e("Reset settings","language"); echo "\" /><br/>"; echo "\n</p>"; echo "\n<br><table class=\"widefat\"><thead><tr><th style='font-size:14px;font-weight:normal;font-style:normal;padding-left:10px;'>" _e("Theme Style","language"); "</th></tr></thead>"; echo "\n\t\t<tbody><tr><th >" _e("Select your Style","language"); ""; echo "\n\t\t\t<select name=\"".$shortname."_css\" id=\"".$shortname."_css\">";while(list(, $f) = each($cssFiles)){ echo "\n\t\t\t\t<option value=\"".$f."\" ".((get_option( $shortname."_css" )==$f)?"selected":"").">".$f."</option>";} echo "\n\t\t\t</select>"; echo "\n</td></th></tr></tbody></table>"; echo "\n<table class=\"form-table\">"; echo "\n\t<tr valign=\"top\">"; echo "\n\t\t<br><table class=\"widefat\"><thead><tr><th>" _e("Flickr Widget Setup","language"); "</th></tr></thead>"; echo "\n\t\t<tbody><tr><th>"; echo "\n<table class=\"form-table\">"; echo "\n\t<tr valign=\"top\">"; echo "\n\t\t<th scope=\"row\">User ID: </th>"; echo "\n\t\t<td>"; echo "\n\t\t\t<input name=\"".$shortname."_flickr[nsid]\" type=\"text\" id=\"".$shortname."_flickr[nsid]\" value=\"".get_flickrSettings('nsid')."\" size=\"20\" />"; echo "\n\t\t</td>"; echo "\n\t</tr>"; echo "\n\t\t<th>Display: </th>"; echo "\n\t\t<td>"; echo "\n\t\t\t<select name=\"".$shortname."_flickr[display]\" id=\"".$shortname."_flickr[display]\">"; for($x = 1; $x<= 10; $x++){ echo "\n\t\t\t\t<option value=\"".$x."\" ".((get_flickrSettings( "display" )==$x)?"selected":"").">".$x."</option>"; } echo "\n\t\t\t</select>"; echo "\n\t\t\t<select name=\"".$shortname."_flickr[displayType]\" id=\"".$shortname."_flickr[displayType]\">"; while(list(, $f) = each($flickrDisplayType)){ echo "\n\t\t\t\t<option value=\"".$f."\" ".((get_flickrSettings( "displayType" )==$f)?"selected":"").">".$f."</option>"; } echo "\n\t\t\t</select> Images "; echo "\n\t\t</td>"; echo "\n\t</tr>"; echo "\n</td></th></tr></tbody></table></table>"; echo "\n\t\t<br><table class=\"widefat\"><thead><tr><th>" _e("Music Player","language"); "</th></tr></thead>"; echo "\n\t\t<tbody><tr><th>"; echo "\n<table class=\"form-table\">"; echo "\n\t<tr valign=\"top\">"; echo "\n\t\t<th scope=\"row\">" _e("Enter your the URl of your song.","language"); "</th>"; echo "\n\t\t<td>"; echo "\n\t\t\t<input name=\"".$shortname."_musicplayerSumition\" type=\"text\" id=\"".$shortname."_musicplayerSumition\" value=\"".get_option($shortname.'_musicplayerSumition')."\" size=\"100\" />"; echo "\n\t\t</td>"; echo "\n\t</tr>"; echo "\n</td></th></tr></tbody></table></table>"; echo "\n\t\t<br><table class=\"widefat\"><thead><tr><th>" _e("Audio/Video Player Module","language"); "</th></tr></thead>"; echo "\n\t\t<tbody><tr><th>"; echo "\n<table class=\"form-table\">"; $videosArray = unserialize($options[0]["std"]); $x = 1; $bg = 'style="background: #f1f1f1;"'; while(list($videoIndex, $aVideo) = each($videosArray)){ $bg = ($bg == 'style="background: #f1f1f1;"') ? '' : 'style="background: #f1f1f1;"'; echo "\n\t<tr valign=\"top\" ".$bg.">"; echo "\n\t\t<td ".$bg.">"; echo "\n\t\t<dl>"; echo "\n\t\t\t<dt>" _e("Player Code","language"); "</dt>"; echo "\n\t\t\t<dd><textarea name=\"".$shortname."_video[".$videoIndex."][link]\" id=\"".$shortname."_video[".$videoIndex."][link]\" style=\"width: 550px; height: 120px;\">".stripslashes((get_videoSettings($videoIndex, "link")!="")?get_videoSettings($videoIndex, "link"):$aVideo[$videoIndex]["link"])."
Output for 5.4.0 - 5.4.36
Parse error: syntax error, unexpected 'not' (T_STRING) in /in/GIjVZ on line 114
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/GIjVZ on line 114
Process exited with code 255.

preferences:
195.87 ms | 1395 KiB | 73 Q