ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
sspmod_oauth_Registry Class Reference
+ Collaboration diagram for sspmod_oauth_Registry:

Public Member Functions

 formToMeta ($request, $entry=array(), $override=NULL)
 
 checkForm ($request)
 
 metaToForm ($metadata)
 

Protected Member Functions

 getStandardField ($request, &$entry, $key)
 
 requireStandardField ($request, $key)
 
 header ($name)
 
 readonlyDateField ($metadata, $key, $name)
 
 readonlyField ($metadata, $key, $name)
 
 hiddenField ($key, $value)
 
 flattenLanguageField (&$metadata, $key)
 
 standardField ($metadata, $key, $name, $textarea=FALSE)
 

Detailed Description

Definition at line 9 of file Registry.php.

Member Function Documentation

◆ checkForm()

sspmod_oauth_Registry::checkForm (   $request)

Definition at line 44 of file Registry.php.

References requireStandardField().

44  {
45  $this->requireStandardField($request, 'name');
46  $this->requireStandardField($request, 'description');
47  $this->requireStandardField($request, 'key');
48  }
requireStandardField($request, $key)
Definition: Registry.php:37
+ Here is the call graph for this function:

◆ flattenLanguageField()

sspmod_oauth_Registry::flattenLanguageField ( $metadata,
  $key 
)
protected

Definition at line 80 of file Registry.php.

References $key, and $metadata.

80  {
81  if (array_key_exists($key, $metadata)) {
82  if (is_array($metadata[$key])) {
83  if (isset($metadata[$key]['en'])) {
84  $metadata[$key] = $metadata[$key]['en'];
85  } else {
86  unset($metadata[$key]);
87  }
88  }
89  }
90  }
$metadata['__DYNAMIC:1__']
$key
Definition: croninfo.php:18

◆ formToMeta()

sspmod_oauth_Registry::formToMeta (   $request,
  $entry = array(),
  $override = NULL 
)

Definition at line 20 of file Registry.php.

References $key, and getStandardField().

20  {
21  $this->getStandardField($request, $entry, 'name');
22  $this->getStandardField($request, $entry, 'description');
23  $this->getStandardField($request, $entry, 'key');
24  $this->getStandardField($request, $entry, 'secret');
25  $this->getStandardField($request, $entry, 'RSAcertificate');
26  $this->getStandardField($request, $entry, 'callback_url');
27 
28  if ($override) {
29  foreach($override AS $key => $value) {
30  $entry[$key] = $value;
31  }
32  }
33 
34  return $entry;
35  }
getStandardField($request, &$entry, $key)
Definition: Registry.php:12
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ getStandardField()

sspmod_oauth_Registry::getStandardField (   $request,
$entry,
  $key 
)
protected

Definition at line 12 of file Registry.php.

References $key.

Referenced by formToMeta().

12  {
13  if (array_key_exists('field_' . $key, $request)) {
14  $entry[$key] = $request['field_' . $key];
15  } else {
16  if (isset($entry[$key])) unset($entry[$key]);
17  }
18  }
$key
Definition: croninfo.php:18
+ Here is the caller graph for this function:

◆ header()

sspmod_oauth_Registry::header (   $name)
protected

Definition at line 51 of file Registry.php.

References $name.

51  {
52  return '<tr ><td>&nbsp;</td><td class="header">' . $name . '</td></tr>';
53 
54  }
if($format !==null) $name
Definition: metadata.php:146

◆ hiddenField()

sspmod_oauth_Registry::hiddenField (   $key,
  $value 
)
protected

Definition at line 76 of file Registry.php.

References $key.

Referenced by metaToForm().

76  {
77  return '<input type="hidden" name="' . $key . '" value="' . htmlspecialchars($value) . '" />';
78  }
$key
Definition: croninfo.php:18
+ Here is the caller graph for this function:

◆ metaToForm()

sspmod_oauth_Registry::metaToForm (   $metadata)

Definition at line 109 of file Registry.php.

References $metadata, hiddenField(), readonlyField(), and standardField().

109  {
110  return '<form action="registry.edit.php" method="post">' .
111  '<div id="tabdiv">' .
112  '<ul>' .
113  '<li><a href="#basic">Name and descrition</a></li>' .
114  '</ul>' .
115  '<div id="basic"><table class="formtable">' .
116  $this->standardField($metadata, 'name', 'Name of client') .
117  $this->standardField($metadata, 'description', 'Description of client', TRUE) .
118  $this->readonlyField($metadata, 'owner', 'Owner') .
119  $this->standardField($metadata, 'key', 'Consumer Key') .
120  $this->readonlyField($metadata, 'secret', 'Consumer Secret<br/>(Used for HMAC_SHA1 signatures)') .
121  $this->standardField($metadata, 'RSAcertificate', 'RSA certificate (PEM)<br/>(Used for RSA_SHA1 signatures)', TRUE) .
122  $this->standardField($metadata, 'callback_url', 'Static/enforcing callback-url') .
123  $this->hiddenField('field_secret', $metadata['secret']) .
124 
125  '</table></div>' .
126  '</div>' .
127  '<input type="submit" name="submit" value="Save" style="margin-top: 5px" />' .
128  '</form>';
129  }
$metadata['__DYNAMIC:1__']
standardField($metadata, $key, $name, $textarea=FALSE)
Definition: Registry.php:92
hiddenField($key, $value)
Definition: Registry.php:76
readonlyField($metadata, $key, $name)
Definition: Registry.php:66
+ Here is the call graph for this function:

◆ readonlyDateField()

sspmod_oauth_Registry::readonlyDateField (   $metadata,
  $key,
  $name 
)
protected

Definition at line 56 of file Registry.php.

References $key, $metadata, $name, and date.

56  {
57  $value = '<span style="color: #aaa">Not set</a>';
58  if (array_key_exists($key, $metadata))
59  $value = date('j. F Y, G:i', $metadata[$key]);
60  return '<tr>
61  <td class="name">' . $name . '</td>
62  <td class="data">' . $value . '</td></tr>';
63 
64  }
$metadata['__DYNAMIC:1__']
if($format !==null) $name
Definition: metadata.php:146
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
$key
Definition: croninfo.php:18

◆ readonlyField()

sspmod_oauth_Registry::readonlyField (   $metadata,
  $key,
  $name 
)
protected

Definition at line 66 of file Registry.php.

References $key, $metadata, and $name.

Referenced by metaToForm().

66  {
67  $value = '';
68  if (array_key_exists($key, $metadata))
69  $value = $metadata[$key];
70  return '<tr>
71  <td class="name">' . $name . '</td>
72  <td class="data">' . htmlspecialchars($value) . '</td></tr>';
73 
74  }
$metadata['__DYNAMIC:1__']
if($format !==null) $name
Definition: metadata.php:146
$key
Definition: croninfo.php:18
+ Here is the caller graph for this function:

◆ requireStandardField()

sspmod_oauth_Registry::requireStandardField (   $request,
  $key 
)
protected

Definition at line 37 of file Registry.php.

References $key.

Referenced by checkForm().

37  {
38  if (!array_key_exists('field_' . $key, $request))
39  throw new Exception('Required field [' . $key . '] was missing.');
40  if (empty($request['field_' . $key]))
41  throw new Exception('Required field [' . $key . '] was empty.');
42  }
$key
Definition: croninfo.php:18
+ Here is the caller graph for this function:

◆ standardField()

sspmod_oauth_Registry::standardField (   $metadata,
  $key,
  $name,
  $textarea = FALSE 
)
protected

Definition at line 92 of file Registry.php.

References $key, $metadata, and $name.

Referenced by metaToForm().

92  {
93  $value = '';
94  if (array_key_exists($key, $metadata)) {
95  $value = htmlspecialchars($metadata[$key]);
96  }
97 
98  if ($textarea) {
99  return '<tr><td class="name">' . $name . '</td><td class="data">
100  <textarea name="field_' . $key . '" rows="5" cols="50">' . $value . '</textarea></td></tr>';
101 
102  } else {
103  return '<tr><td class="name">' . $name . '</td><td class="data">
104  <input type="text" size="60" name="field_' . $key . '" value="' . $value . '" /></td></tr>';
105 
106  }
107  }
$metadata['__DYNAMIC:1__']
if($format !==null) $name
Definition: metadata.php:146
$key
Definition: croninfo.php:18
+ Here is the caller graph for this function:

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