From ac79474d4de2ae9b33792c422f1902f4343d2480 Mon Sep 17 00:00:00 2001
From: Tim Steiner <tsteiner2@unl.edu>
Date: Mon, 7 Jun 2010 15:51:22 +0000
Subject: [PATCH] Set up a file to be used by any UNL modules that need to load
 Zend Framework.

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x@95 20a16fea-79d4-4915-8869-1ea9d5ebf173
---
 sites/all/modules/unl/unl_cas.info   |  1 +
 sites/all/modules/unl/unl_cas.module |  8 ++------
 sites/all/modules/unl/unl_loader.php | 16 ++++++++++++++++
 3 files changed, 19 insertions(+), 6 deletions(-)
 create mode 100644 sites/all/modules/unl/unl_loader.php

diff --git a/sites/all/modules/unl/unl_cas.info b/sites/all/modules/unl/unl_cas.info
index 5209736d..5c307762 100644
--- a/sites/all/modules/unl/unl_cas.info
+++ b/sites/all/modules/unl/unl_cas.info
@@ -3,3 +3,4 @@ name = UNL CAS
 description = Enables UNL CAS authentication/registration of users.
 core = 7.x
 files[] = unl_cas.module
+files[] = unl_loader.php
diff --git a/sites/all/modules/unl/unl_cas.module b/sites/all/modules/unl/unl_cas.module
index bdd3804f..fd872855 100644
--- a/sites/all/modules/unl/unl_cas.module
+++ b/sites/all/modules/unl/unl_cas.module
@@ -7,12 +7,8 @@ function unl_cas_enable()
 
 function unl_cas_init()
 {
-	drupal_flush_all_caches();
-	
-	set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../../libraries' );
-	require_once 'Zend/Loader/Autoloader.php';
-	$autoloader = Zend_Loader_Autoloader::getInstance();
-	$autoloader->registerNamespace('Unl_');
+    require_once dirname(__FILE__) . '/unl_loader.php';
+    unl_load_zend_framework();
 	
 	$cas = unl_cas_get_adapter();
 	
diff --git a/sites/all/modules/unl/unl_loader.php b/sites/all/modules/unl/unl_loader.php
new file mode 100644
index 00000000..d4e4917b
--- /dev/null
+++ b/sites/all/modules/unl/unl_loader.php
@@ -0,0 +1,16 @@
+<?php
+
+function unl_load_zend_framework()
+{
+	static $isLoaded = FALSE;
+	
+	if ($isLoaded) {
+		return;
+	}
+	
+	set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../../libraries' );
+    require_once 'Zend/Loader/Autoloader.php';
+    $autoloader = Zend_Loader_Autoloader::getInstance();
+    $autoloader->registerNamespace('Unl_');
+    $isLoaded = TRUE;
+}
-- 
GitLab