ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Auth_Yadis_Service Class Reference
+ Collaboration diagram for Auth_Yadis_Service:

Public Member Functions

 Auth_Yadis_Service ()
 Creates an empty service object. More...
 
 getTypes ()
 Return the URIs in the "Type" elements, if any, of this Service element. More...
 
 matchTypes ($type_uris)
 
 getURIs ()
 Return the URIs in the "URI" elements, if any, of this Service element. More...
 
 getPriority ()
 Returns the "priority" attribute value of this <Service> element, if the attribute is present. More...
 
 getElements ($name)
 Used to get XML elements from this object's <Service> element. More...
 

Detailed Description

Definition at line 83 of file XRDS.php.

Member Function Documentation

◆ Auth_Yadis_Service()

Auth_Yadis_Service::Auth_Yadis_Service ( )

Creates an empty service object.

Definition at line 88 of file XRDS.php.

89 {
90 $this->element = null;
91 $this->parser = null;
92 }

◆ getElements()

Auth_Yadis_Service::getElements (   $name)

Used to get XML elements from this object's <Service> element.

This is what you should use to get all custom information out of this element. This is used by service filter functions to determine whether a service element contains specific tags, etc. NOTE: this only considers elements which are direct children of the <Service> element for this object.

Parameters
string$nameThe name of the element to look for
Returns
array $list An array of elements with the specified name which are direct children of the <Service> element. The nodes returned by this function can be passed to $this->parser methods (see Auth_Yadis_XMLParser).

Definition at line 201 of file XRDS.php.

202 {
203 return $this->parser->evalXPath($name, $this->element);
204 }

Referenced by getTypes(), and getURIs().

+ Here is the caller graph for this function:

◆ getPriority()

Auth_Yadis_Service::getPriority ( )

Returns the "priority" attribute value of this <Service> element, if the attribute is present.

Returns null if not.

Returns
mixed $result Null or integer, depending on whether this Service element has a 'priority' attribute.

Definition at line 175 of file XRDS.php.

176 {
177 $attributes = $this->parser->attributes($this->element);
178
179 if (array_key_exists('priority', $attributes)) {
180 return intval($attributes['priority']);
181 }
182
183 return null;
184 }

◆ getTypes()

Auth_Yadis_Service::getTypes ( )

Return the URIs in the "Type" elements, if any, of this Service element.

Returns
array $type_uris An array of Type URI strings.

Definition at line 100 of file XRDS.php.

101 {
102 $t = array();
103 foreach ($this->getElements('xrd:Type') as $elem) {
104 $c = $this->parser->content($elem);
105 if ($c) {
106 $t[] = $c;
107 }
108 }
109 return $t;
110 }
getElements($name)
Used to get XML elements from this object's <Service> element.
Definition: XRDS.php:201

References $t, and getElements().

Referenced by matchTypes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getURIs()

Auth_Yadis_Service::getURIs ( )

Return the URIs in the "URI" elements, if any, of this Service element.

The URIs are returned sorted in priority order.

Returns
array $uris An array of URI strings.

Definition at line 131 of file XRDS.php.

132 {
133 $uris = array();
134 $last = array();
135
136 foreach ($this->getElements('xrd:URI') as $elem) {
137 $uri_string = $this->parser->content($elem);
138 $attrs = $this->parser->attributes($elem);
139 if ($attrs &&
140 array_key_exists('priority', $attrs)) {
141 $priority = intval($attrs['priority']);
142 if (!array_key_exists($priority, $uris)) {
143 $uris[$priority] = array();
144 }
145
146 $uris[$priority][] = $uri_string;
147 } else {
148 $last[] = $uri_string;
149 }
150 }
151
152 $keys = array_keys($uris);
153 sort($keys);
154
155 // Rebuild array of URIs.
156 $result = array();
157 foreach ($keys as $k) {
158 $new_uris = Auth_Yadis_array_scramble($uris[$k]);
159 $result = array_merge($result, $new_uris);
160 }
161
162 $result = array_merge($result,
164
165 return $result;
166 }
$result
Auth_Yadis_array_scramble($arr)
@access private
Definition: XRDS.php:58

References $result, Auth_Yadis_array_scramble(), and getElements().

+ Here is the call graph for this function:

◆ matchTypes()

Auth_Yadis_Service::matchTypes (   $type_uris)

Definition at line 112 of file XRDS.php.

113 {
114 $result = array();
115
116 foreach ($this->getTypes() as $typ) {
117 if (in_array($typ, $type_uris)) {
118 $result[] = $typ;
119 }
120 }
121
122 return $result;
123 }
getTypes()
Return the URIs in the "Type" elements, if any, of this Service element.
Definition: XRDS.php:100

References $result, and getTypes().

+ Here is the call graph for this function:

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