$pdfDir = KALINS_PDF_DIR;
if ($handle = opendir($pdfDir)) {
    while (false !== ($file = readdir($handle))) {
        //loop to find all relevant files (stripos is not case sensitive so it finds .PDF, .HTML, .TXT)
        if ($file != "." && $file != ".." && (stripos($file, ".pdf") > 0 || stripos($file, ".html") > 0 || stripos($file, ".txt") > 0)) {
            $fileObj = new stdClass();
            $fileObj->fileName = $file;
            $fileObj->date = date("Y-m-d H:i:s", filemtime($pdfDir . $file));
            array_push($pdfList, $fileObj);
            //compile array of file information simply to pass to javascript
        }
    }
    closedir($handle);
}
//get our list of document templates from the database
$templateOptions = kalins_pdf_get_options(KALINS_PDF_TOOL_TEMPLATE_OPTIONS_NAME);
//get our help strings to populate the rollovers on the info icons
$toolStrings = file_get_contents(WP_PLUGIN_DIR . '/kalins-pdf-creation-station/help/toolStrings.json');
/*
 require_once 'ProgressBar.class.php';
 global $proBar;
 $proBar = new ProgressBar();
$proBar->setMessage('loading ...');
 $proBar->setAutohide(true);
 $proBar->setSleepOnFinish(1);
 //$proBar->setForegroundColor('#ff0000');

 $elements = 100; //total number of elements to process
*/
?>
 function form($instance)
 {
     echo '<div>';
     //create three lists of data for each text field
     $aTextFieldLabels = array("Title:", "Link text:", "Before link:", "After link:");
     $aTextFieldNames = array("title", "linkText", "beforeLink", "afterLink");
     $adminOptions = kalins_pdf_get_options(KALINS_PDF_ADMIN_OPTIONS_NAME);
     $aTextFieldDefaultValues = array("", $adminOptions->linkText, $adminOptions->beforeLink, $adminOptions->afterLink);
     //loop to add each of our four textfields to the widget form
     for ($i = 0; $i < 4; $i++) {
         $sFieldName = $aTextFieldNames[$i];
         $sFieldValue = $aTextFieldDefaultValues[$i];
         //if we have already saved a value, use it instead of the default
         if (isset($instance[$sFieldName])) {
             $sFieldValue = $instance[$sFieldName];
         }
         //apostrophes will mess everything up when echoed, so we escape them
         $sFieldValue = str_replace("'", "&#39;", $sFieldValue);
         //begin echoing content to admin-facing interface
         echo '<label for="' . $this->get_field_id($sFieldName) . '">' . $aTextFieldLabels[$i] . '</label>';
         echo '<input type="text" class="widefat" ';
         echo 'name="' . $this->get_field_name($sFieldName) . '" ';
         echo 'id="' . $this->get_field_id($sFieldName) . '" ';
         echo "value='" . $sFieldValue . "' /><br/><br/>";
     }
     echo '<br/><br/></div>';
 }
<?php

if (!function_exists('add_action')) {
    echo "Hi there!  I'm just a plugin, not much I can do when called directly.";
    exit;
}
kalinsPDF_createPDFDir();
$save_nonce = wp_create_nonce('kalins_pdf_admin_save');
$reset_nonce = wp_create_nonce('kalins_pdf_admin_reset');
$create_nonce = wp_create_nonce('kalins_pdf_create_all');
$adminOptions = kalins_pdf_get_options(KALINS_PDF_ADMIN_OPTIONS_NAME);
$adminStrings = file_get_contents(WP_PLUGIN_DIR . '/kalins-pdf-creation-station/help/adminStrings.json');
?>

<script type='text/javascript'>
"use strict";

var app = angular.module('kalinsPDFAdminPage', ['ui.bootstrap', 'kalinsUI']);

app.controller("InputController",["$scope", "$http", "kalinsToggles", "kalinsAlertManager", function($scope, $http, kalinsToggles, kalinsAlertManager) {

  //build our toggle manager for the accordion's toggle all button
  $scope.kalinsToggles = new kalinsToggles([true, true, true, true, true, true], "Close All", "Open All", "kalinsSettingsPageAccordionToggles" );

  //set up the alerts that show under the form buttons
  $scope.kalinsAlertManager = new kalinsAlertManager(4);

  $scope.oHelpStrings = <?php 
echo $adminStrings;
?>
;