1
0
Fork 0

add: started with context help system

Dieser Commit ist enthalten in:
oldperl 2011-11-15 16:43:23 +00:00
Ursprung f73fccd78d
Commit 8913b0be76
4 geänderte Dateien mit 145 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,45 @@
<?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);
?>

Datei anzeigen

@ -0,0 +1,14 @@
<?php
function semmelstatzR_contextual_help($contextual_help, $screen_id, $screen) {
// replace edit with the base of the page you're adding the help info to
if (strcmp($screen->base, 'semmelstatzR/semmelstatzR-statz') == 0 ) {
$customized_help = $contextual_help . 'Here is some very useful information...';
return $customized_help;
}
// Let the default WP Dashboard help stuff through on other Admin pages
return $contextual_help;
}
add_action('contextual_help', 'semmelstatzR_contextual_help', 10, 3);
?>

Datei anzeigen

@ -0,0 +1,4 @@
<div>
<h3>Semmelstatz Help</h3>
<p>Here we have to write some context help for semmelstatzR. :)</p>
</div>

Datei anzeigen

@ -0,0 +1,82 @@
<?php
/*
Plugin Name: Sample 3.3 Help Tabs Plugins
Plugin URI: http://pippinsplugins.com/
Description: Put custom functions in this plugin
Author: Pippin Williamson
Author URI: http://pippinsplugins.com
Version: 1.0
*/
add_action('admin_menu', 'pippin_admin_add_page');
function pippin_admin_add_page() {
global $pippin_options_page;
$pippin_options_page = add_options_page(__('Sample Help Tabs', 'pippin'), __('Sample help Tabs', 'pippin'), 'manage_options', 'options-test', 'pippin_options_page');
add_action("load-$pippin_options_page", 'pippin_plugin_help_tabs');
}
function pippin_plugin_help_tabs() {
global $pippin_options_page;
$screen = get_current_screen();
if($screen->id != $pippin_options_page)
return;
$screen->add_help_tab(array(
'id' => 'pippins-usage',
'title' => __('Using the Plugin', 'pippin'),
'content' => pippin_help_tab_content('pippin-usage')
));
$screen->add_help_tab(array(
'id' => 'pippins-settings',
'title' => __('Plugin Settings', 'pippin'),
'content' => pippin_help_tab_content('pippin-settings')
));
$screen->add_help_tab(array(
'id' => 'pippins-css',
'title' => __('Custom CSS', 'pippin'),
'content' => pippin_help_tab_content('pippin-css')
));
}
function pippin_help_tab_content($tab = 'pippin-usage') {
if($tab == 'pippin-usage') {
ob_start(); ?>
<h3><?php _e('Using the plugin', 'pippin'); ?></h3>
<p>In scelerisque, placerat nec urna in pulvinar rhoncus vut dolor tincidunt dapibus in ac massa sit tristique egestas? Non, integer dis massa egestas eros! Elementum vel rhoncus! Et lorem sed lundium nascetur amet! Et scelerisque sit. Egestas tincidunt, quis enim urna arcu mattis rhoncus nisi nec enim tincidunt! Augue magnis.</p>
<p>In scelerisque, placerat nec urna in pulvinar rhoncus vut dolor tincidunt dapibus in ac massa sit tristique egestas? Non, integer dis massa egestas eros! Elementum vel rhoncus! Et lorem sed lundium nascetur amet! Et scelerisque sit. Egestas tincidunt, quis enim urna arcu mattis rhoncus nisi nec enim tincidunt! Augue magnis.</p>
<?php
return ob_get_clean();
} elseif ($tab == 'pippin-settings') {
ob_start(); ?>
<h3><?php _e('Plugin Settings', 'pippin'); ?></h3>
<p>In scelerisque, placerat nec urna in pulvinar rhoncus vut dolor tincidunt dapibus in ac massa sit tristique egestas? Non, integer dis massa egestas eros! Elementum vel rhoncus! Et lorem sed lundium nascetur amet! Et scelerisque sit. Egestas tincidunt, quis enim urna arcu mattis rhoncus nisi nec enim tincidunt! Augue magnis.</p>
<?php
return ob_get_clean();
} elseif ($tab == 'pippin-css') {
ob_start(); ?>
<h3><?php _e('Custom CSS', 'pippin'); ?></h3>
<p>In scelerisque, placerat nec urna in pulvinar rhoncus vut dolor tincidunt dapibus in ac massa sit tristique egestas? Non, integer dis massa egestas eros! Elementum vel rhoncus! Et lorem sed lundium nascetur amet! Et scelerisque sit. Egestas tincidunt, quis enim urna arcu mattis rhoncus nisi nec enim tincidunt! Augue magnis.</p>
<ul>
<li>List Item Sample</li>
<li>List Item Sample</li>
<li>List Item Sample</li>
<li>List Item Sample</li>
</ul>
<?php
return ob_get_clean();
}
}
function pippin_options_page() {
ob_start(); ?>
<div class="wrap">
<h2><?php _e('Sample Help Tab', 'pippin'); ?></h2>
<p>This is out settings page content. Click the "Help" menu above to see the new help tabs.</p>
</div>
<?php
echo ob_get_clean();
}
?>