ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
Auth_OpenID_KVForm Class Reference

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

+ Collaboration diagram for Auth_OpenID_KVForm:

Static Public Member Functions

static toArray ($kvs, $strict=false)
 Convert an OpenID colon/newline separated string into an associative array.
static fromArray ($values)
 Convert an array into an OpenID colon/newline separated string.

Detailed Description

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

Definition at line 21 of file KVForm.php.

Member Function Documentation

static Auth_OpenID_KVForm::fromArray (   $values)
static

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

private

Definition at line 81 of file KVForm.php.

Referenced by Auth_OpenID_ServerError\encodeToKVForm(), Auth_OpenID_Association\serialize(), Auth_OpenID_Association\sign(), and Auth_OpenID_Message\toKVForm().

{
if ($values === null) {
return null;
}
ksort($values);
$serialized = '';
foreach ($values as $key => $value) {
if (is_array($value)) {
list($key, $value) = array($value[0], $value[1]);
}
if (strpos($key, ':') !== false) {
return null;
}
if (strpos($key, "\n") !== false) {
return null;
}
if (strpos($value, "\n") !== false) {
return null;
}
$serialized .= "$key:$value\n";
}
return $serialized;
}

+ Here is the caller graph for this function:

static Auth_OpenID_KVForm::toArray (   $kvs,
  $strict = false 
)
static

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

private

Definition at line 29 of file KVForm.php.

Referenced by Auth_OpenID_Association\deserialize(), and Auth_OpenID_Message\fromKVForm().

{
$lines = explode("\n", $kvs);
$last = array_pop($lines);
if ($last !== '') {
array_push($lines, $last);
if ($strict) {
return false;
}
}
$values = array();
for ($lineno = 0; $lineno < count($lines); $lineno++) {
$line = $lines[$lineno];
$kv = explode(':', $line, 2);
if (count($kv) != 2) {
if ($strict) {
return false;
}
continue;
}
$key = $kv[0];
$tkey = trim($key);
if ($tkey != $key) {
if ($strict) {
return false;
}
}
$value = $kv[1];
$tval = trim($value);
if ($tval != $value) {
if ($strict) {
return false;
}
}
$values[$tkey] = $tval;
}
return $values;
}

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: