/**
 * Callback for creating the plugin header.
 *
 * @param unknown $args
 */
function ibm_sbtk_header($args = array())
{
    $settings = new SBTSettings();
    $store = SBTCredentialStore::getInstance();
    $endpoints = $settings->getEndpoints();
    if ($endpoints == null || empty($endpoints)) {
        return;
    }
    foreach ($endpoints as $endpoint) {
        if (($settings->getAuthenticationMethod($endpoint['name']) == 'oauth1' || $settings->getAuthenticationMethod($endpoint['name']) == 'oauth2') && $store->getOAuthAccessToken($endpoint['name']) == null && (!isset($_COOKIE['IBMSBTKOAuthLogin']) || $_COOKIE['IBMSBTKOAuthLogin'] != 'yes')) {
            $deploy_url = $settings->getSDKDeployURL($endpoint['name']);
            $authentication_method = $settings->getAuthenticationMethod($endpoint['name']);
            $js_library = $settings->getJSLibrary($endpoint['name']);
            $url = $settings->getURL($endpoint['name']);
            $name = $settings->getName($endpoint['name']);
            $api_version = $settings->getAPIVersion($endpoint['name']);
            $type = $settings->getServerType($endpoint['name']);
            $allow_client_access = $settings->allowClientAccess($endpoint['name']);
            $endpoints = $settings->getEndpoints();
            // Load the header view
            require BASE_PATH . '/views/includes/header.php';
            return;
        }
    }
    $plugin = new SBTPlugin($endpoints[0]['name']);
    $plugin->createHeader();
}
 /**
  * Creates the header for the SBTK plugin.
  */
 public function createHeader()
 {
     $this->loadModel('SBTSettings');
     $settings = new SBTSettings();
     $viewData['deploy_url'] = $settings->getSDKDeployURL($this->endpointName);
     $viewData['authentication_method'] = $settings->getAuthenticationMethod($this->endpointName);
     $viewData['js_library'] = $settings->getJSLibrary($this->endpointName);
     $viewData['url'] = $settings->getURL($this->endpointName);
     $viewData['name'] = $settings->getName($this->endpointName);
     $viewData['api_version'] = $settings->getAPIVersion($this->endpointName);
     $viewData['type'] = $settings->getServerType($this->endpointName);
     $viewData['allow_client_access'] = $settings->allowClientAccess($this->endpointName);
     $viewData['endpoints'] = $settings->getEndpoints();
     // Load the header view
     return $this->loadView('includes/header', $viewData);
 }