From 1587dc1989492e6495da94d4db13a2574e411ccd Mon Sep 17 00:00:00 2001 From: Oldperl <44996956+oldperl@users.noreply.github.com> Date: Tue, 15 Nov 2011 16:43:23 +0000 Subject: [PATCH] add: started with context help system --- includes/help/start.php | 45 ++++++++++++++++++++ includes/help/v32/sample.php | 14 ++++++ includes/help/v32/statz.tpl | 4 ++ includes/help/v33/sample.php | 82 ++++++++++++++++++++++++++++++++++++ 4 files changed, 145 insertions(+) create mode 100644 includes/help/start.php create mode 100644 includes/help/v32/sample.php create mode 100644 includes/help/v32/statz.tpl create mode 100644 includes/help/v33/sample.php diff --git a/includes/help/start.php b/includes/help/start.php new file mode 100644 index 0000000..0e7d0ac --- /dev/null +++ b/includes/help/start.php @@ -0,0 +1,45 @@ + +

You are using a beta-version of semmelstatzReloaded. + We will notify you for any newer version or a final release.

+ '; + } +} +add_filter('admin_notices', 'my_admin_notice'); + +/* +function check_current_screen() { + echo '
';
+    if( !is_admin() ) return;
+    global $current_screen;
+    print_r( $current_screen );
+    echo '
'; +} +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); +?> \ No newline at end of file diff --git a/includes/help/v32/sample.php b/includes/help/v32/sample.php new file mode 100644 index 0000000..63739a3 --- /dev/null +++ b/includes/help/v32/sample.php @@ -0,0 +1,14 @@ +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); +?> \ No newline at end of file diff --git a/includes/help/v32/statz.tpl b/includes/help/v32/statz.tpl new file mode 100644 index 0000000..389facd --- /dev/null +++ b/includes/help/v32/statz.tpl @@ -0,0 +1,4 @@ +
+

Semmelstatz Help

+

Here we have to write some context help for semmelstatzR. :)

+
\ No newline at end of file diff --git a/includes/help/v33/sample.php b/includes/help/v33/sample.php new file mode 100644 index 0000000..53d7416 --- /dev/null +++ b/includes/help/v33/sample.php @@ -0,0 +1,82 @@ +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(); ?> +

+

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.

+ +

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.

+ +

+

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.

+ +

+

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.

+ + +
+

+

This is out settings page content. Click the "Help" menu above to see the new help tabs.

+
+ \ No newline at end of file