Auth_OpenID_KVForm Klassenreferenz


Öffentliche, statische Methoden

 toArray ($kvs, $strict=false)
 fromArray ($values)

Ausführliche Beschreibung

Container for key-value/comma-newline OpenID format and parsing

Definiert in Zeile 21 der Datei KVForm.php.


Dokumentation der Elementfunktionen

fromArray ( values  )  [static]

Convert an array into an OpenID colon/newline separated string

private

Definiert in Zeile 81 der Datei KVForm.php.

00082     {
00083         if ($values === null) {
00084             return null;
00085         }
00086 
00087         ksort($values);
00088 
00089         $serialized = '';
00090         foreach ($values as $key => $value) {
00091             if (is_array($value)) {
00092                 list($key, $value) = array($value[0], $value[1]);
00093             }
00094 
00095             if (strpos($key, ':') !== false) {
00096                 return null;
00097             }
00098 
00099             if (strpos($key, "\n") !== false) {
00100                 return null;
00101             }
00102 
00103             if (strpos($value, "\n") !== false) {
00104                 return null;
00105             }
00106             $serialized .= "$key:$value\n";
00107         }
00108         return $serialized;
00109     }

toArray ( kvs,
strict = false 
) [static]

Convert an OpenID colon/newline separated string into an associative array

private

Definiert in Zeile 29 der Datei KVForm.php.

00030     {
00031         $lines = explode("\n", $kvs);
00032 
00033         $last = array_pop($lines);
00034         if ($last !== '') {
00035             array_push($lines, $last);
00036             if ($strict) {
00037                 return false;
00038             }
00039         }
00040 
00041         $values = array();
00042 
00043         for ($lineno = 0; $lineno < count($lines); $lineno++) {
00044             $line = $lines[$lineno];
00045             $kv = explode(':', $line, 2);
00046             if (count($kv) != 2) {
00047                 if ($strict) {
00048                     return false;
00049                 }
00050                 continue;
00051             }
00052 
00053             $key = $kv[0];
00054             $tkey = trim($key);
00055             if ($tkey != $key) {
00056                 if ($strict) {
00057                     return false;
00058                 }
00059             }
00060 
00061             $value = $kv[1];
00062             $tval = trim($value);
00063             if ($tval != $value) {
00064                 if ($strict) {
00065                     return false;
00066                 }
00067             }
00068 
00069             $values[$tkey] = $tval;
00070         }
00071 
00072         return $values;
00073     }


Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei:
Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved.
MyOOS [Shopsystem] is Free Software released under the GNU/GPL License.

Webmaster: info@r23.de (Impressum)
doxygen