<?php
//echo "OK";

function my_admin_notice(){
    if(strstr(SEMMELSTATZR_VERSION, "Beta") !== false) {
        echo '<div class="updated">
            <p>You are using a beta-version of semmelstatzReloaded. 
            We will notify you for any newer version or a final release.</p>
            </div>'; 
    }
}
add_filter('admin_notices', 'my_admin_notice');

/*
function check_current_screen() {
    echo '<div class="updated"><pre>';
    if( !is_admin() ) return;
    global $current_screen;
    print_r( $current_screen );
    echo '</pre></div>';
}
add_filter('admin_notices', 'check_current_screen');
*/
function semmelstatzR_help($contextual_help, $screen_id, $screen) {
    global $semr_hook, $wp_version;
    $semrContextHelp = '';
    $sLang = (defined(WPLANG) && WPLANG != '')?WPLANG.DIRECTORY_SEPARATOR:'';
    $aScreenId = explode("-", $screen_id);
    if(is_array($semr_hook) && key_exists($aScreenId[1], $semr_hook)) {
        if(version_compare($wp_version, "3.3", "<")) {
            $sHelpPathDefault = SEMMELSTATZR_SRVPATH."includes/help/v32/default/".$aScreenId[1].".tpl";
            $sHelpPathLang = SEMMELSTATZR_SRVPATH."includes/help/v32/".$sLang.$aScreenId[1].".tpl";
            $sHelpFile = '';        
            if(file_exists($sHelpPathLang)) {
                $sHelpFile = $sHelpPathLang;
            } else if(file_exists($sHelpPathDefault)) {
                $sHelpFile = $sHelpPathDefault;
            }            
            if(!empty($sHelpFile)) $semrContextHelp = file_get_contents($sHelpFile);
        }
    }   
    return $semrContextHelp.$contextual_help;
}
add_filter('contextual_help', 'semmelstatzR_help', 10, 3);
?>