From 10be18676abd86edb5af70fdeb88c0486df39f75 Mon Sep 17 00:00:00 2001
From: Chris Leppanen <chris.leppanen@gmail.com>
Date: Fri, 29 Jun 2012 17:56:28 -0700
Subject: [PATCH] Allow setting a variable for the library path.

---
 feeds.module | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/feeds.module b/feeds.module
index 2743bcce..361cfc2b 100644
--- a/feeds.module
+++ b/feeds.module
@@ -952,18 +952,24 @@ function feeds_plugin($plugin, $id) {
 function feeds_include_library($file, $library) {
   static $included = array();
   static $ignore_deprecated = array('simplepie');
+
   if (!isset($included[$file])) {
     // Disable deprecated warning for libraries known for throwing them
     if (in_array($library, $ignore_deprecated)) {
        $level = error_reporting();
        // We can safely use E_DEPRECATED since Drupal 7 requires PHP 5.3+
-       error_reporting($level & ~E_DEPRECATED);
+       error_reporting($level ^ E_DEPRECATED ^ E_STRICT);
     }
     // Try first whether libraries module is present and load the file from
     // there. If this fails, require the library from the local path.
+    $library_dir = variable_get('feeds_library_dir', FALSE);
+
     if (module_exists('libraries') && file_exists(libraries_get_path($library) . "/$file")) {
       require libraries_get_path($library) . "/$file";
     }
+    elseif ($library_dir && file_exists("$library_dir/$library/$file")) {
+      require "$library_dir/$library/$file";
+    }
     else {
       // @todo: Throws "Deprecated function: Assigning the return value of new
       // by reference is deprecated."
@@ -988,12 +994,21 @@ function feeds_include_library($file, $library) {
  *   libraries module.
  */
 function feeds_library_exists($file, $library) {
+
   if (module_exists('libraries') && file_exists(libraries_get_path($library) . "/$file")) {
     return TRUE;
   }
+
   elseif (file_exists(DRUPAL_ROOT . '/' . drupal_get_path('module', 'feeds') . "/libraries/$file")) {
     return TRUE;
   }
+
+  elseif ($library_dir = variable_get('feeds_library_dir', FALSE)) {
+    if (file_exists("$library_dir/$library/$file")) {
+      return TRUE;
+    }
+  }
+
   return FALSE;
 }
 
-- 
GitLab