/** Invoice lookup function If return is passed as true, function is returned. */ function wp_invoice_lookup($args = '') { global $wpi_settings; $defaults = array ( 'message' => __('Enter Invoice ID', WPI), 'button' => __('Lookup', WPI), 'return' => false ); extract(wp_parse_args($args, $defaults), EXTR_SKIP); ob_start(); if(WPI_Functions::wpi_use_custom_template('invoice_lookup.php')) include($wpi_settings['frontend_template_path'] . 'invoice_lookup.php'); else include($wpi_settings['default_template_path'] . 'invoice_lookup.php'); $result .= ob_get_contents(); ob_end_clean(); if($return) return $result; echo $result; }
function the_content_shortcode() { global $post, $invoice, $invoice_id, $wpi_settings, $wpi_invoice_object; $invoice = $wpi_invoice_object->data; include_once 'wpi_template_functions.php'; ob_start(); if (WPI_Functions::wpi_use_custom_template('invoice_page.php')) { include $wpi_settings['frontend_template_path'] . 'invoice_page.php'; } else { include $wpi_settings['default_template_path'] . 'invoice_page.php'; } $result .= ob_get_contents(); ob_end_clean(); return $result; }
/** * Invoice lookup function * If return is passed as true, function is returned. * * @global type $wpi_settings * * @param type $args * * @return type */ function wp_invoice_lookup($args = '') { global $wpi_settings, $current_user; $result = ''; $defaults = array('message' => __('Enter Invoice ID', WPI), 'button' => __('Lookup', WPI), 'return' => true); extract(wp_parse_args($args, $defaults), EXTR_SKIP); if (!$current_user->ID) { return; } ob_start(); if (WPI_Functions::wpi_use_custom_template('invoice_lookup.php')) { include $wpi_settings['frontend_template_path'] . 'invoice_lookup.php'; } else { include $wpi_settings['default_template_path'] . 'invoice_lookup.php'; } $result .= ob_get_clean(); if ($return) { return $result; } echo $result; }