--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Billing Database
+ * GLM Billing Help
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersBillingDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @author Steve Sutton <steve@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release help.php
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Place Help Hooks and Filters here. If this file exists, it will be included
+ * by the Billing plugin script.
+ *
+ * Note that filter and hook callback functions must be included in-line as shown below...
+ *
+ * add_filter( 'filter_title', function( $parameter ) {
+ * // Function code
+ * });
+ *
+ */
+function loadHelpFile( $screen, $tab )
+{
+ $fileName = GLM_MEMBERS_BILLING_PLUGIN_SETUP_PATH . '/help/' . $tab['extra'] . '.html';
+ if ( is_file( $fileName ) ) {
+ echo file_get_contents( $fileName );
+ } else {
+ return false;
+ }
+}
+
+add_action( 'current_screen',
+ function () {
+ $screen = get_current_screen();
+ // var_dump($screen);
+ if ( !isset( $screen ) ) {
+ return false;
+ }
+ if ( $screen->base != 'glm-associate_page_glm-members-admin-menu-billing' ) {
+ return false;
+ }
+
+ $helpTabs = array(
+ array(
+ 'name' => 'dashboard',
+ 'title' => 'Dashboard',
+ ),
+ array(
+ 'name' => 'invoices',
+ 'title' => 'Invoices',
+ 'subs' => array(
+ array(
+ 'name' => 'add',
+ 'title' => 'Create Invoice',
+ ),
+ ),
+ ),
+ array(
+ 'name' => 'payments',
+ 'title' => 'Payments',
+ 'subs' => array(
+ array(
+ 'name' => 'add',
+ 'title' => 'Make a Payment',
+ ),
+ ),
+ ),
+ array(
+ 'name' => 'accounts',
+ 'title' => 'Accounts',
+ ),
+ array(
+ 'name' => 'invoicing',
+ 'title' => 'Invoicing',
+ 'subs' => array(
+ array(
+ 'name' => 'createInvoices',
+ 'title' => 'Create Invoices',
+ ),
+ array(
+ 'name' => 'printInvoices',
+ 'title' => 'Print Invoices',
+ ),
+ array(
+ 'name' => 'createLabels',
+ 'title' => 'Create Labels',
+ ),
+ array(
+ 'name' => 'sendEmails',
+ 'title' => 'Send Emails',
+ ),
+ ),
+ ),
+ array(
+ 'name' => 'reports',
+ 'title' => 'Reports',
+ 'subs' => array(
+ array(
+ 'name' => 'openAccounts',
+ 'title' => 'Open Accounts',
+ ),
+ array(
+ 'name' => 'closedAccounts',
+ 'title' => 'Closed Accounts',
+ ),
+ array(
+ 'name' => 'accountsByAge',
+ 'title' => 'Accounts By Age',
+ ),
+ array(
+ 'name' => 'reportGenerator',
+ 'title' => 'Report Generator',
+ ),
+ array(
+ 'name' => 'noAccounts',
+ 'title' => 'No Accounts',
+ ),
+ array(
+ 'name' => 'allAccounts',
+ 'title' => 'All Accounts',
+ ),
+ ),
+ ),
+ array(
+ 'name' => 'logs',
+ 'title' => 'Logs',
+ ),
+ );
+
+ foreach ( $helpTabs as $tab ) {
+ $glmAction = isset( $_REQUEST['glm_action'] ) ? filter_var( $_REQUEST['glm_action'] ) : 'dashboard';
+ if ( $glmAction === $tab['name'] ) {
+ if ( is_file( GLM_MEMBERS_BILLING_PLUGIN_SETUP_PATH . '/help/' . $tab['name'] . '.html' ) ) {
+ $screen->add_help_tab(
+ array(
+ 'id' => 'glm-member-db-billing-help-' . $tab['name'],
+ 'title' => __( $tab['title'] ),
+ 'content' => '',
+ 'callback' => 'loadHelpFile',
+ 'extra' => $tab['name'],
+ )
+ );
+ }
+ // Check for subs
+ if ( isset( $tab['subs'] ) && is_array( $tab['subs'] ) ) {
+ foreach ( $tab['subs'] as $sub ) {
+ $fileName = GLM_MEMBERS_BILLING_PLUGIN_SETUP_PATH . '/help/' . $glmAction . '-' . $sub['name'] . '.html';
+ if ( is_file( GLM_MEMBERS_BILLING_PLUGIN_SETUP_PATH . '/help/' . $glmAction . '-' . $sub['name'] . '.html' ) ) {
+ $screen->add_help_tab(
+ array(
+ 'id' => 'glm-member-db-billing-help-'. $glmAction . '-' . $sub['name'],
+ 'title' => __( $sub['title'] ),
+ 'content' => $fileContents,
+ 'callback' => 'loadHelpFile',
+ 'extra' => $glmAction . '-' . $sub['name'],
+ )
+ );
+ }
+ }
+ }
+ }
+ }
+
+ // Help sidebars
+ $screen->set_help_sidebar(
+ '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+ '<p><a href="https://www.gaslightmedia.com/wp-admin-guide/#GLM" target="_blank">' .
+ __( 'Help Guide' ) . '</a></p>'
+ );
+ }
+);