2014-11-02 14:14:46 +01:00
< ? php
// Exit if accessed directly
if ( ! defined ( 'ABSPATH' ) ) {
exit ;
}
2014-12-08 17:04:48 +01:00
// custom fonts
2014-11-02 14:14:46 +01:00
function add_custom_font () {
2014-11-13 21:33:23 +01:00
$url = get_stylesheet_directory_uri () . '/fonts/comfortaa-regular/stylesheet.css' ;
2014-11-02 14:14:46 +01:00
wp_register_style ( 'comfortaaregular' , $url );
wp_enqueue_style ( 'comfortaaregular' );
wp_register_style ( 'comfortaalight' , $url );
wp_enqueue_style ( 'comfortaalight' );
wp_register_style ( 'comfortaabold' , $url );
wp_enqueue_style ( 'comfortaabold' );
}
2014-12-08 17:04:48 +01:00
add_action ( 'wp_print_styles' , 'add_custom_font' );
2014-11-02 14:14:46 +01:00
// openmamba downloads pages
2014-12-08 17:04:48 +01:00
function openmamba_download_link ( $milestone , $medium , $currarch , $ext , $mlword , $lang ) {
2014-11-02 14:14:46 +01:00
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 ];
echo " <table style='border:0;margin:0;margin-bottom:5px;'><tr><td style='vertical-align:middle;padding:4px;border:0;margin:0;width:20px;align:center;'><img src=/wp-content/themes/openmamba/download.png /></td> " ;
echo " <td style='border:0;margin:0;padding:4px;'><h5 style='margin:1px;'><a href= \" /media/ $milestone / $medium / $lang /openmamba- $medium - $lang - $currreleasetag . $currarch $ext\ " > " ;
2014-12-08 17:04:48 +01:00
echo " openmamba $displaymilestone $medium " ;
echo _e ( 'for' , 'responsive' ) . " $currarch ( $mlword )</a> </h5> " ;
2014-11-02 14:14:46 +01:00
echo " <i> " ;
2014-12-08 17:04:48 +01:00
echo _e ( 'File size:' , 'responsive' ) . ' ' . $sizeMedium [ $medium . '-' . $currreleasetag . '-' . $lang . '-' . $currarch ] . 'B; ' ;
echo _e ( 'Date' , 'responsive' ) . ': ' . substr ( $builddateMedium [ $medium . '-' . $currreleasetag . '-' . $lang . '-' . $currarch ],
2014-11-02 14:14:46 +01:00
0 , strpos ( $builddateMedium [ $medium . '-' . $currreleasetag . '-' . $lang . '-' . $currarch ], ' ' ));
echo " ; Md5: " . $md5Medium [ $medium . '-' . $currreleasetag . '-' . $lang . '-' . $currarch ];
echo " </i></td></tr></table> " ;
}
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 " ;
$forword = " for " ;
$mlword = " multilanguage " ;
} else {
$forword = " per " ;
$mlword = " multilingue " ;
}
print " <h3>openmamba $medium $displaymilestone </h3> " ;
if ( file_exists ( " $mediaprefix / $milestone / $medium /info/description. $outputlang .html.inc " )) {
$script_file = " $mediaprefix / $milestone / $medium /info/description. $outputlang .html.inc " ;
} else if ( file_exists ( " $mediaprefix / $fallbackmilestone / $medium /info/description. $outputlang .html.inc " )) {
$script_file = " $mediaprefix / $fallbackmilestone / $medium /info/description. $outputlang .html.inc " ;
}
if ( $script_file ) {
$file = fopen ( $script_file , " r " );
while ( ! feof ( $file )) {
$b = fread ( $file , 1024 );
print $b ;
}
fclose ( $file );
}
reset ( $archname );
while ( list (, $currarch ) = each ( $archname )) {
if ( strpos ( " ; " . $a [ 'archs' ] . " ; " , $currarch ) == false ) continue ;
if ( $a [ 'multilang' ]) {
openmamba_download_link ( $milestone , $medium , $currarch , $ext , $mlword , " en " );
} else {
openmamba_download_link ( $milestone , $medium , $currarch , $ext , " italiano " , " it " );
openmamba_download_link ( $milestone , $medium , $currarch , $ext , " english " , " en " );
openmamba_download_link ( $milestone , $medium , $currarch , $ext , " español " , " es " );
}
}
echo " <hr> " ;
return ;
}
add_shortcode ( 'openmamba_download' , 'openmamba_download_func' );
2014-11-13 21:33:23 +01:00
function openmamba_webbuild_func ( $atts ) {
2014-12-08 17:04:48 +01:00
$urlargspos = strpos ( $_SERVER [ REQUEST_URI ], '?' );
if ( $urlargspos > 0 ) {
$urlargs = substr ( $_SERVER [ REQUEST_URI ], $urlargspos );
}
2014-11-13 21:33:23 +01:00
$a = shortcode_atts ( array (
2014-11-23 18:16:02 +01:00
'host' => 'buildvm01'
2014-11-13 21:33:23 +01:00
), $atts );
print '<script>host="' . $a [ 'host' ] . '"</script>' ;
$file = fopen ( get_stylesheet_directory () . '/webbuild.html.inc' , " r " );
print fread ( $file , 20000 );
flush ();
fclose ( $file );
2014-12-08 17:04:48 +01:00
print " <script>ajax_getvalues( \" " . $urlargs . " \" , \" \" ); " ;
print " ajax_getvalues_refresh( \" \" ,user,user_email,encodeURIComponent(secret));</script> " ;
2014-11-13 21:33:23 +01:00
}
add_shortcode ( 'openmamba_webbuild' , 'openmamba_webbuild_func' );
2014-11-23 18:16:02 +01:00
function openmamba_webbuild_status_func () {
$urlargspos = strpos ( $_SERVER [ REQUEST_URI ], '?' );
if ( $urlargspos > 0 ) {
$urlargs = substr ( $_SERVER [ REQUEST_URI ], $urlargspos );
}
// print "<table width=\"100%\" style=\"border:0;\"><tr><td>";
print " <div id= \" noajax_msg \" ><p>Il supporto per AJAX non è abilitato nel tuo browser. L'aggiornamento live non sarà disponibile, premi Ricarica per aggiornare la pagina.</p></div> " ;
print " <span class=webbuild id= \" output \" >Caricamento in corso, attendere...</span> " ;
print " <script>webbuild_status_getvalues( \" " . $urlargs . " \" );</script> " ; //</td></tr></table>";
}
add_shortcode ( 'openmamba_webbuild_status' , 'openmamba_webbuild_status_func' );
2014-11-02 14:14:46 +01:00
// 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 ;
}