2011-11-15 16:43:23 +00:00
|
|
|
<?php
|
2011-11-15 16:54:13 +00:00
|
|
|
/**
|
|
|
|
* File: start.php
|
|
|
|
*
|
|
|
|
* Startfile for help system, uses contextual help tab in admin area
|
|
|
|
* @todo write help tpl-files for default and german translation
|
|
|
|
*
|
|
|
|
* @package SemmelstatzR
|
|
|
|
* @version $Rev$
|
|
|
|
* @since 1.0.0 Beta
|
|
|
|
* @author SEM-Team
|
|
|
|
* @copyright (c)2011 SEM-Team
|
|
|
|
* @link http://sourceforge.net/projects/semmelstatz/
|
|
|
|
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* gives a hint for admins in admin area
|
|
|
|
*
|
|
|
|
* @author Ortwin Pinke
|
|
|
|
* @since 1.0.1 Beta
|
|
|
|
* @uses wp add_filter()
|
|
|
|
*/
|
|
|
|
function semr_admin_notice(){
|
2011-12-19 17:48:13 +00:00
|
|
|
if(!strstr($_GET['page'], "semmelstatzR")) return;
|
|
|
|
global $current_user ;
|
|
|
|
$user_id = $current_user->ID;
|
|
|
|
if(get_user_meta($user_id, 'semr_ignore_notice')) return;
|
2011-11-15 16:43:23 +00:00
|
|
|
if(strstr(SEMMELSTATZR_VERSION, "Beta") !== false) {
|
2011-12-19 17:48:13 +00:00
|
|
|
printf('<div class="updated">
|
2011-11-15 16:43:23 +00:00
|
|
|
<p>You are using a beta-version of semmelstatzReloaded.
|
|
|
|
We will notify you for any newer version or a final release.</p>
|
2011-12-19 17:48:13 +00:00
|
|
|
<a href="%1$s">Hide Notice</a>
|
|
|
|
</div>', '?page='.$_GET['page'].'&semr_ignore_notice=0');
|
|
|
|
} else if(strstr(SEMMELSTATZR_VERSION, "RC") !== false) {
|
|
|
|
echo '<div class="updated">
|
|
|
|
<p>You are using a rc-version of semmelstatzReloaded.
|
|
|
|
We will notify you for any newer version or a final release.</p>
|
2011-11-15 16:43:23 +00:00
|
|
|
</div>';
|
|
|
|
}
|
|
|
|
}
|
2011-12-19 17:48:13 +00:00
|
|
|
|
2011-11-15 16:54:13 +00:00
|
|
|
add_filter('admin_notices', 'semr_admin_notice');
|
2011-11-15 16:43:23 +00:00
|
|
|
|
2011-12-19 17:48:13 +00:00
|
|
|
|
|
|
|
function semr_ignore_notice() {
|
|
|
|
global $current_user;
|
|
|
|
/* If user clicks to ignore the notice, add that to their user meta */
|
|
|
|
if ( isset($_GET['semr_ignore_notice']) && '0' == $_GET['semr_ignore_notice'] ) {
|
|
|
|
add_user_meta($current_user->ID, 'semr_ignore_notice', 'true', true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
add_action('admin_init', 'semr_ignore_notice');
|
|
|
|
|
|
|
|
function semr_show_notice() {
|
|
|
|
global $current_user;
|
|
|
|
/* If user clicks to ignore the notice, add that to their user meta */
|
|
|
|
if ( isset($_GET['semr_ignore_notice']) && '1' == $_GET['semr_ignore_notice'] ) {
|
|
|
|
//add_user_meta($current_user->ID, 'semr_ignore_notice', 'false', true);
|
|
|
|
delete_user_meta($current_user->ID, 'semr_ignore_notice');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
add_action('admin_init', 'semr_show_notice');
|
|
|
|
|
|
|
|
|
2011-11-15 16:43:23 +00:00
|
|
|
/*
|
2011-11-15 16:54:13 +00:00
|
|
|
// just for debugging on local machines
|
2011-11-15 16:43:23 +00:00
|
|
|
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');
|
|
|
|
*/
|
2011-11-15 16:54:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* bind the help files with contextual help area of wp
|
|
|
|
*
|
|
|
|
* @author Ortwin Pinke
|
2011-12-19 17:48:13 +00:00
|
|
|
* @since 1.0.0
|
2011-11-15 16:54:13 +00:00
|
|
|
* @uses wp add_filter()
|
|
|
|
*
|
|
|
|
* @global array $semr_hook
|
|
|
|
* @global string $wp_version
|
|
|
|
* @param string $contextual_help
|
|
|
|
* @param string $screen_id
|
|
|
|
* @param array $screen
|
|
|
|
* @return string
|
|
|
|
*/
|
2011-11-15 16:43:23 +00:00
|
|
|
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);
|
2012-05-21 18:30:41 +00:00
|
|
|
} else {
|
|
|
|
include_once SEMMELSTATZR_SRVPATH."includes/help/v33/test.php";
|
|
|
|
return;
|
2011-11-15 16:43:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return $semrContextHelp.$contextual_help;
|
|
|
|
}
|
|
|
|
add_filter('contextual_help', 'semmelstatzR_help', 10, 3);
|
|
|
|
?>
|