theme_location == 'header-menu') {
ob_start();
get_search_form();
$searchform = ob_get_contents();
ob_end_clean();
return $items .= '
' . $searchform . '';
}
return $items;
}
add_filter('wp_nav_menu_items','add_search_box', 10, 2);
// openmamba downloads pages
function openmamba_download_link($milestone, $medium, $currarch, $ext, $mlword, $lang) {
eval(file_get_contents("/var/ftp/pub/openmamba/media/".$milestone."/".$medium."/".$lang."/latest.inc.php"));
if ("$milestone" == "devel") {
$displaymilestone = "rolling";
} else {
$displaymilestone = "$milestone";
}
$currreleasetag=$releaseTag[$medium.'-'.$milestone.'-'.$lang.'-'.$currarch];
$ret = '';
if ("$currreleasetag" != "") {
$ret .= " | ";
$ret .= "";
$ret .= "";
$ret .= __('File size:','responsive').' '.$sizeMedium[$medium.'-'.$currreleasetag.'-'.$lang.'-'.$currarch].'B; ';
$ret .= __('Date','responsive').': '.substr($builddateMedium[$medium.'-'.$currreleasetag.'-'.$lang.'-'.$currarch],
0, strpos($builddateMedium[$medium.'-'.$currreleasetag.'-'.$lang.'-'.$currarch], ' '));
$ret .= "; Md5: " . $md5Medium[$medium.'-'.$currreleasetag.'-'.$lang.'-'.$currarch];
$ret .= " |
";
} else {
$ret .= " | ";
$ret .= "";
$ret .= "openmamba $displaymilestone $medium ";
$ret .= __('for','responsive')." $currarch ($mlword) ";
$ret .= "";
$ret .= __('Sorry, download is temporary unavailable. If the problem persists please report the problem.','responsive');
$ret .= " |
";
}
return $ret;
}
function openmamba_infofile($mediaprefix, $milestone, $fallbackmilestone, $medium, $outputlang, $filename) {
if (file_exists("$mediaprefix/$milestone/$medium/info/$filename.$outputlang.html.inc")) {
$script_file = "$mediaprefix/$milestone/$medium/info/$filename.$outputlang.html.inc";
} else if (file_exists("$mediaprefix/$fallbackmilestone/$medium/info/$filename.$outputlang.html.inc")) {
$script_file = "$mediaprefix/$fallbackmilestone/$medium/info/$filename.$outputlang.html.inc";
}
$ret = '';
if ($script_file) {
$file = fopen($script_file, "r");
while (!feof($file)) {
$b=fread($file,1024);
$ret .= $b;
}
fclose($file);
}
return $ret;
}
function openmamba_download_func( $atts ) {
$a = shortcode_atts( array(
'milestone' => 'devel',
'medium' => 'livedvd',
'multilang' => '0',
'archs' => 'x86_64;i586;arm', // bitmask: 1=x86_64 2=i586 3=arm
'ext' => '.iso'
), $atts );
$milestone = $a['milestone'];
$medium = $a['medium'];
$ext = $a['ext'];
$fallbackmilestone = 'milestone2';
if ("$milestone" == "devel") {
$displaymilestone = "rolling";
$suffixmilestone = "snapshot";
} else {
$displaymilestone = "$milestone";
$suffixmilestone = "$milestone";
}
$archname = array("x86_64", "i586", "arm");
$mediaprefix = '/var/ftp/pub/openmamba/media';
$mediafallbackprefix = '/var/ftp/pub/openmamba/media/milestone2';
$outputlang = get_bloginfo("language");
if ("$outputlang" != "it") {
$outputlang = "en";
$mlword = "multilanguage";
} else {
$mlword = "multilingue";
}
$ret = "openmamba $medium $displaymilestone
";
$ret .= do_shortcode(
openmamba_infofile($mediaprefix,$milestone,$fallbackmilestone,$medium,$outputlang,"description"));
$ret .= "
";
if ($a['multilang']) {
reset($archname);
while (list(, $currarch) = each($archname)) {
if (strpos(";".$a['archs'].";",$currarch) == false) continue;
$ret .= openmamba_download_link($milestone,$medium,$currarch,$ext,$mlword,"en");
}
} else {
reset($archname);
$langs = array('it' => 'italiano','en' => 'english','es' => 'espaƱol');
while (list(, $currarch) = each($archname)) {
if (strpos(";".$a['archs'].";",$currarch) == false) continue;
$ret .= openmamba_download_link($milestone,$medium,$currarch,$ext,$langs[$outputlang],$outputlang);
}
foreach ($langs as $l => $lang) {
if ($l == $outputlang) continue;
reset($archname);
while (list(, $currarch) = each($archname)) {
if (strpos(";".$a['archs'].";",$currarch) == false) continue;
$out .= openmamba_download_link($milestone,$medium,$currarch,$ext,$lang,$l);
}
}
$ret .= do_shortcode("[expand title=\"". __("More languages...",responsive) . "\"]". $out ."[/expand]");
}
$ret .= do_shortcode(" [expand title=\"".__("Features",responsive)."\"]".
openmamba_infofile($mediaprefix,$milestone,$fallbackmilestone,$medium,$outputlang,"features").
"[/expand]");
$ret .= do_shortcode(" [expand title=\"".__("Requirements",responsive)."\"]".
openmamba_infofile($mediaprefix,$milestone,$fallbackmilestone,$medium,$outputlang,"requirements").
"[/expand]");
$ret .= do_shortcode(" [expand title=\"".__("Preparation",responsive)."\"]".
openmamba_infofile($mediaprefix,$milestone,$fallbackmilestone,$medium,$outputlang,"howto").
"[/expand]");
$ret .= "
";
return $ret;
}
add_shortcode('openmamba_download', 'openmamba_download_func');
function openmamba_webbuild_func( $atts ) {
$urlargspos = strpos($_SERVER[REQUEST_URI], '?');
if ($urlargspos > 0) {
$urlargs = substr($_SERVER[REQUEST_URI], $urlargspos);
}
$a = shortcode_atts( array(
'host' => 'buildvm01'
), $atts );
print '';
$file = fopen(get_stylesheet_directory() . '/webbuild.html.inc', "r");
print fread($file, 20000);
flush();
fclose($file);
print "";
}
add_shortcode('openmamba_webbuild', 'openmamba_webbuild_func');
function openmamba_webbuild_status_func() {
$urlargspos = strpos($_SERVER[REQUEST_URI], '?');
if ($urlargspos > 0) {
$urlargs = substr($_SERVER[REQUEST_URI], $urlargspos);
}
// print "";
print "AJAX support is not enabled in your browser. Live page updates will not be available, press Reload to update. ";
print "Loading, please wait...";
print "";// |
";
}
add_shortcode('openmamba_webbuild_status', 'openmamba_webbuild_status_func');
function openmamba_distroquery_func() {
$urlargspos = strpos($_SERVER[REQUEST_URI], '?');
if ($urlargspos > 0) {
$urlargs = substr($_SERVER[REQUEST_URI], $urlargspos + 1);
}
$outputlang = get_bloginfo("language");
if ($outputlang == "it")
$outputlang = "it_IT.UTF-8";
else
$outputlang = "en_US.UTF-8";
print "AJAX support is not enabled in your browser. Live page updates will not be available, press Reload to update.
";
print "
";
print "
";
print "";
}
add_shortcode('openmamba_distroquery', 'openmamba_distroquery_func');
// bbpress tag cloud
add_filter('widget_tag_cloud_args','set_number_tags');
function set_number_tags($args) {
$args = array('number' => 10, 'largest' => 20);
return $args;
}