toDriverCharset() needs to be public, rename it as such.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Mon, 19 Jul 2010 16:41:30 +0000 (12:41 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Mon, 19 Jul 2010 16:41:30 +0000 (12:41 -0400)
Share objects need to be able to call this method.

framework/Share/lib/Horde/Share.php
framework/Share/lib/Horde/Share/Object/Sql.php
framework/Share/lib/Horde/Share/Sql.php
framework/Share/lib/Horde/Share/Sql/Hierarchical.php

index 74e4886..16aa12b 100644 (file)
@@ -416,6 +416,17 @@ class Horde_Share
     }
 
     /**
+     * Convert TO the storage driver's charset. Individual share objects should
+     * implement this method if needed.
+     *
+     * @param array $data  Data to be converted.
+     */
+    public function toDriverCharset($data)
+    {
+        // noop
+    }
+    
+    /**
      * Utility function to be used with uasort() for sorting arrays of
      * Horde_Share objects.
      *
index 6301af0..5b648ad 100644 (file)
@@ -107,7 +107,7 @@ class Horde_Share_Object_Sql extends Horde_Share_Object
         $fields = array();
         $params = array();
 
-        foreach ($this->_shareOb->_toDriverCharset($this->data) as $key => $value) {
+        foreach ($this->_shareOb->toDriverCharset($this->data) as $key => $value) {
             if ($key != 'share_id' && $key != 'perm' && $key != 'share_flags') {
                 $fields[] = $key;
                 $params[] = $value;
index 0c10c14..52a6a5c 100644 (file)
@@ -749,7 +749,7 @@ class Horde_Share_Sql extends Horde_Share
         }
 
         $attributes = $this->_toDriverKeys($attributes);
-        $attributes = $this->_toDriverCharset($attributes);
+        $attributes = $this->toDriverCharset($attributes);
 
         if (is_array($attributes)) {
             // Build attribute/key filter.
@@ -896,10 +896,9 @@ class Horde_Share_Sql extends Horde_Share
     /**
      * Utility function to convert TO the SQL server's charset.
      *
-     * @TODO: This needs to be public since it's called by the share object.
-     * Look at making this outright public or maybe moving it to the object.
+     * @see Horde_Share#toDriverCharset
      */
-    public function _toDriverCharset($data)
+    public function toDriverCharset($data)
     {
         if (!is_array($data)) {
             return $data;
index 08fd380..05c2717 100644 (file)
@@ -236,7 +236,7 @@ class Horde_Share_Sql_Hierarchical extends Horde_Share_Sql
         $attributes = $this->_toDriverKeys($attributes);
 
         /* ...and to driver charset */
-        $attributes = $this->_toDriverCharset($attributes);
+        $attributes = $this->toDriverCharset($attributes);
 
         if (is_array($attributes)) {
             // Build attribute/key filter.