Author: mcantelon
Date: Thu Feb 16 10:46:00 2012
New Revision: 10915

Log:
Added overridable utility logic for processing data before it enters Qubit.

Modified:
   trunk/lib/QubitFlatfileImport.class.php

Modified: trunk/lib/QubitFlatfileImport.class.php
==============================================================================
--- trunk/lib/QubitFlatfileImport.class.php     Thu Feb 16 10:29:52 2012        
(r10914)
+++ trunk/lib/QubitFlatfileImport.class.php     Thu Feb 16 10:46:00 2012        
(r10915)
@@ -53,8 +53,17 @@
   public $postSaveLogic; // Optional post-save logic
   public $completeLogic; // Optional cleanup, etc. logic for after import
 
+  // Replaceable logic to filter content before entering Qubit
+  public $contentFilterLogic;
+
   public function __construct($options)
   {
+    // Replaceable logic to filter content before entering Qubit
+    $this->contentLogic = function($text)
+    {
+      return $text;
+    };
+
     $this->setPropertiesFromArray($this, $options, TRUE);
 
     // initialize bookkeeping of rows processed
@@ -104,6 +113,22 @@
     }
   }
 
+  /*
+   * Utility function to filter data, with a function that can be optionally
+   * overridden, before it enters Qubit
+   *
+   * @param string $text  Text to process
+   */
+  public function content($text)
+  {
+    if ($this->contentFilterLogic)
+    {
+      return executeClosurePropertyIfSet('');
+    } else {
+      return $text;
+    }
+  }
+
   /**
    * Attempt to parse date from non-machine-readable text,
    * returning FALSE upon failure and logging failures.

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to