@@ -44,167 +44,167 @@ |
||
44 | 44 | |
45 | 45 | class PGTStorage |
46 | 46 | { |
47 | - /** |
|
48 | - * @addtogroup internalPGTStorage |
|
49 | - * @{ |
|
50 | - */ |
|
51 | - |
|
52 | - // ######################################################################## |
|
53 | - // CONSTRUCTOR |
|
54 | - // ######################################################################## |
|
47 | + /** |
|
48 | + * @addtogroup internalPGTStorage |
|
49 | + * @{ |
|
50 | + */ |
|
51 | + |
|
52 | + // ######################################################################## |
|
53 | + // CONSTRUCTOR |
|
54 | + // ######################################################################## |
|
55 | 55 | |
56 | - /** |
|
57 | - * The constructor of the class, should be called only by inherited classes. |
|
58 | - * |
|
59 | - * @param $cas_parent the CASclient instance that creates the current object. |
|
60 | - * |
|
61 | - * @protected |
|
62 | - */ |
|
63 | - function PGTStorage($cas_parent) |
|
56 | + /** |
|
57 | + * The constructor of the class, should be called only by inherited classes. |
|
58 | + * |
|
59 | + * @param $cas_parent the CASclient instance that creates the current object. |
|
60 | + * |
|
61 | + * @protected |
|
62 | + */ |
|
63 | + function PGTStorage($cas_parent) |
|
64 | 64 | { |
65 | - phpCAS::traceBegin(); |
|
66 | - if ( !$cas_parent->isProxy() ) { |
|
67 | - phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy'); |
|
68 | - } |
|
69 | - phpCAS::traceEnd(); |
|
65 | + phpCAS::traceBegin(); |
|
66 | + if ( !$cas_parent->isProxy() ) { |
|
67 | + phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy'); |
|
68 | + } |
|
69 | + phpCAS::traceEnd(); |
|
70 | 70 | } |
71 | 71 | |
72 | - // ######################################################################## |
|
73 | - // DEBUGGING |
|
74 | - // ######################################################################## |
|
72 | + // ######################################################################## |
|
73 | + // DEBUGGING |
|
74 | + // ######################################################################## |
|
75 | 75 | |
76 | - /** |
|
77 | - * This virtual method returns an informational string giving the type of storage |
|
78 | - * used by the object (used for debugging purposes). |
|
79 | - * |
|
80 | - * @public |
|
81 | - */ |
|
82 | - function getStorageType() |
|
76 | + /** |
|
77 | + * This virtual method returns an informational string giving the type of storage |
|
78 | + * used by the object (used for debugging purposes). |
|
79 | + * |
|
80 | + * @public |
|
81 | + */ |
|
82 | + function getStorageType() |
|
83 | 83 | { |
84 | - phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
|
84 | + phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
|
85 | 85 | } |
86 | 86 | |
87 | - /** |
|
88 | - * This virtual method returns an informational string giving informations on the |
|
89 | - * parameters of the storage.(used for debugging purposes). |
|
90 | - * |
|
91 | - * @public |
|
92 | - */ |
|
93 | - function getStorageInfo() |
|
87 | + /** |
|
88 | + * This virtual method returns an informational string giving informations on the |
|
89 | + * parameters of the storage.(used for debugging purposes). |
|
90 | + * |
|
91 | + * @public |
|
92 | + */ |
|
93 | + function getStorageInfo() |
|
94 | 94 | { |
95 | - phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
|
95 | + phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
|
96 | 96 | } |
97 | 97 | |
98 | - // ######################################################################## |
|
99 | - // ERROR HANDLING |
|
100 | - // ######################################################################## |
|
98 | + // ######################################################################## |
|
99 | + // ERROR HANDLING |
|
100 | + // ######################################################################## |
|
101 | 101 | |
102 | - /** |
|
103 | - * string used to store an error message. Written by PGTStorage::setErrorMessage(), |
|
104 | - * read by PGTStorage::getErrorMessage(). |
|
105 | - * |
|
106 | - * @hideinitializer |
|
107 | - * @private |
|
108 | - * @deprecated not used. |
|
109 | - */ |
|
110 | - var $_error_message=FALSE; |
|
111 | - |
|
112 | - /** |
|
113 | - * This method sets en error message, which can be read later by |
|
114 | - * PGTStorage::getErrorMessage(). |
|
115 | - * |
|
116 | - * @param $error_message an error message |
|
117 | - * |
|
118 | - * @protected |
|
119 | - * @deprecated not used. |
|
120 | - */ |
|
121 | - function setErrorMessage($error_message) |
|
102 | + /** |
|
103 | + * string used to store an error message. Written by PGTStorage::setErrorMessage(), |
|
104 | + * read by PGTStorage::getErrorMessage(). |
|
105 | + * |
|
106 | + * @hideinitializer |
|
107 | + * @private |
|
108 | + * @deprecated not used. |
|
109 | + */ |
|
110 | + var $_error_message=FALSE; |
|
111 | + |
|
112 | + /** |
|
113 | + * This method sets en error message, which can be read later by |
|
114 | + * PGTStorage::getErrorMessage(). |
|
115 | + * |
|
116 | + * @param $error_message an error message |
|
117 | + * |
|
118 | + * @protected |
|
119 | + * @deprecated not used. |
|
120 | + */ |
|
121 | + function setErrorMessage($error_message) |
|
122 | 122 | { |
123 | - $this->_error_message = $error_message; |
|
123 | + $this->_error_message = $error_message; |
|
124 | 124 | } |
125 | 125 | |
126 | - /** |
|
127 | - * This method returns an error message set by PGTStorage::setErrorMessage(). |
|
128 | - * |
|
129 | - * @return an error message when set by PGTStorage::setErrorMessage(), FALSE |
|
130 | - * otherwise. |
|
131 | - * |
|
132 | - * @public |
|
133 | - * @deprecated not used. |
|
134 | - */ |
|
135 | - function getErrorMessage() |
|
126 | + /** |
|
127 | + * This method returns an error message set by PGTStorage::setErrorMessage(). |
|
128 | + * |
|
129 | + * @return an error message when set by PGTStorage::setErrorMessage(), FALSE |
|
130 | + * otherwise. |
|
131 | + * |
|
132 | + * @public |
|
133 | + * @deprecated not used. |
|
134 | + */ |
|
135 | + function getErrorMessage() |
|
136 | 136 | { |
137 | - return $this->_error_message; |
|
137 | + return $this->_error_message; |
|
138 | 138 | } |
139 | 139 | |
140 | - // ######################################################################## |
|
141 | - // INITIALIZATION |
|
142 | - // ######################################################################## |
|
143 | - |
|
144 | - /** |
|
145 | - * a boolean telling if the storage has already been initialized. Written by |
|
146 | - * PGTStorage::init(), read by PGTStorage::isInitialized(). |
|
147 | - * |
|
148 | - * @hideinitializer |
|
149 | - * @private |
|
150 | - */ |
|
151 | - var $_initialized = FALSE; |
|
152 | - |
|
153 | - /** |
|
154 | - * This method tells if the storage has already been intialized. |
|
155 | - * |
|
156 | - * @return a boolean |
|
157 | - * |
|
158 | - * @protected |
|
159 | - */ |
|
160 | - function isInitialized() |
|
140 | + // ######################################################################## |
|
141 | + // INITIALIZATION |
|
142 | + // ######################################################################## |
|
143 | + |
|
144 | + /** |
|
145 | + * a boolean telling if the storage has already been initialized. Written by |
|
146 | + * PGTStorage::init(), read by PGTStorage::isInitialized(). |
|
147 | + * |
|
148 | + * @hideinitializer |
|
149 | + * @private |
|
150 | + */ |
|
151 | + var $_initialized = FALSE; |
|
152 | + |
|
153 | + /** |
|
154 | + * This method tells if the storage has already been intialized. |
|
155 | + * |
|
156 | + * @return a boolean |
|
157 | + * |
|
158 | + * @protected |
|
159 | + */ |
|
160 | + function isInitialized() |
|
161 | 161 | { |
162 | - return $this->_initialized; |
|
162 | + return $this->_initialized; |
|
163 | 163 | } |
164 | 164 | |
165 | - /** |
|
166 | - * This virtual method initializes the object. |
|
167 | - * |
|
168 | - * @protected |
|
169 | - */ |
|
170 | - function init() |
|
165 | + /** |
|
166 | + * This virtual method initializes the object. |
|
167 | + * |
|
168 | + * @protected |
|
169 | + */ |
|
170 | + function init() |
|
171 | 171 | { |
172 | - $this->_initialized = TRUE; |
|
172 | + $this->_initialized = TRUE; |
|
173 | 173 | } |
174 | 174 | |
175 | - // ######################################################################## |
|
176 | - // PGT I/O |
|
177 | - // ######################################################################## |
|
178 | - |
|
179 | - /** |
|
180 | - * This virtual method stores a PGT and its corresponding PGT Iuo. |
|
181 | - * @note Should never be called. |
|
182 | - * |
|
183 | - * @param $pgt the PGT |
|
184 | - * @param $pgt_iou the PGT iou |
|
185 | - * |
|
186 | - * @protected |
|
187 | - */ |
|
188 | - function write($pgt,$pgt_iou) |
|
175 | + // ######################################################################## |
|
176 | + // PGT I/O |
|
177 | + // ######################################################################## |
|
178 | + |
|
179 | + /** |
|
180 | + * This virtual method stores a PGT and its corresponding PGT Iuo. |
|
181 | + * @note Should never be called. |
|
182 | + * |
|
183 | + * @param $pgt the PGT |
|
184 | + * @param $pgt_iou the PGT iou |
|
185 | + * |
|
186 | + * @protected |
|
187 | + */ |
|
188 | + function write($pgt,$pgt_iou) |
|
189 | 189 | { |
190 | - phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
|
190 | + phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
|
191 | 191 | } |
192 | 192 | |
193 | - /** |
|
194 | - * This virtual method reads a PGT corresponding to a PGT Iou and deletes |
|
195 | - * the corresponding storage entry. |
|
196 | - * @note Should never be called. |
|
197 | - * |
|
198 | - * @param $pgt_iou the PGT iou |
|
199 | - * |
|
200 | - * @protected |
|
201 | - */ |
|
202 | - function read($pgt_iou) |
|
193 | + /** |
|
194 | + * This virtual method reads a PGT corresponding to a PGT Iou and deletes |
|
195 | + * the corresponding storage entry. |
|
196 | + * @note Should never be called. |
|
197 | + * |
|
198 | + * @param $pgt_iou the PGT iou |
|
199 | + * |
|
200 | + * @protected |
|
201 | + */ |
|
202 | + function read($pgt_iou) |
|
203 | 203 | { |
204 | - phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
|
204 | + phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
|
205 | 205 | } |
206 | 206 | |
207 | - /** @} */ |
|
207 | + /** @} */ |
|
208 | 208 | |
209 | 209 | } |
210 | 210 |
@@ -8,20 +8,20 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | $this->_strings = array( |
11 | - CAS_STR_USING_SERVER |
|
12 | - => 'via Server', |
|
13 | - CAS_STR_AUTHENTICATION_WANTED |
|
14 | - => 'CAS Authentifizierung erforderlich!', |
|
15 | - CAS_STR_LOGOUT |
|
16 | - => 'CAS Abmeldung!', |
|
17 | - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | - => 'eigentlich häten Sie zum CAS Server weitergeleitet werden sollen. Drücken Sie <a href="%s">hier</a> um fortzufahren.', |
|
19 | - CAS_STR_AUTHENTICATION_FAILED |
|
20 | - => 'CAS Anmeldung fehlgeschlagen!', |
|
21 | - CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | - => '<p>Sie wurden nicht angemeldet.</p><p>Um es erneut zu versuchen klicken Sie <a href="%s">hier</a>.</p><p>Wenn das Problem bestehen bleibt, kontkatieren Sie den <a href="mailto:%s">Administrator</a> dieser Seite.</p>', |
|
23 | - CAS_STR_SERVICE_UNAVAILABLE |
|
24 | - => 'Der Dienst `<b>%s</b>\' ist nicht verfügbar (<b>%s</b>).' |
|
11 | + CAS_STR_USING_SERVER |
|
12 | + => 'via Server', |
|
13 | + CAS_STR_AUTHENTICATION_WANTED |
|
14 | + => 'CAS Authentifizierung erforderlich!', |
|
15 | + CAS_STR_LOGOUT |
|
16 | + => 'CAS Abmeldung!', |
|
17 | + CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | + => 'eigentlich häten Sie zum CAS Server weitergeleitet werden sollen. Drücken Sie <a href="%s">hier</a> um fortzufahren.', |
|
19 | + CAS_STR_AUTHENTICATION_FAILED |
|
20 | + => 'CAS Anmeldung fehlgeschlagen!', |
|
21 | + CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | + => '<p>Sie wurden nicht angemeldet.</p><p>Um es erneut zu versuchen klicken Sie <a href="%s">hier</a>.</p><p>Wenn das Problem bestehen bleibt, kontkatieren Sie den <a href="mailto:%s">Administrator</a> dieser Seite.</p>', |
|
23 | + CAS_STR_SERVICE_UNAVAILABLE |
|
24 | + => 'Der Dienst `<b>%s</b>\' ist nicht verfügbar (<b>%s</b>).' |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | ?> |
28 | 28 | \ No newline at end of file |
@@ -8,20 +8,20 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | $this->_strings = array( |
11 | - CAS_STR_USING_SERVER |
|
12 | - => 'usant servidor', |
|
13 | - CAS_STR_AUTHENTICATION_WANTED |
|
14 | - => 'Autentificació CAS necessària!', |
|
15 | - CAS_STR_LOGOUT |
|
16 | - => 'Sortida de CAS necessària!', |
|
17 | - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | - => 'Ja hauria d\ haver estat redireccionat al servidor CAS. Feu click <a href="%s">aquí</a> per a continuar.', |
|
19 | - CAS_STR_AUTHENTICATION_FAILED |
|
20 | - => 'Autentificació CAS fallida!', |
|
21 | - CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | - => '<p>No estàs autentificat.</p><p>Pots tornar a intentar-ho fent click <a href="%s">aquí</a>.</p><p>Si el problema persisteix hauría de contactar amb l\'<a href="mailto:%s">administrador d\'aquest llocc</a>.</p>', |
|
23 | - CAS_STR_SERVICE_UNAVAILABLE |
|
24 | - => 'El servei `<b>%s</b>\' no està disponible (<b>%s</b>).' |
|
11 | + CAS_STR_USING_SERVER |
|
12 | + => 'usant servidor', |
|
13 | + CAS_STR_AUTHENTICATION_WANTED |
|
14 | + => 'Autentificació CAS necessària!', |
|
15 | + CAS_STR_LOGOUT |
|
16 | + => 'Sortida de CAS necessària!', |
|
17 | + CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | + => 'Ja hauria d\ haver estat redireccionat al servidor CAS. Feu click <a href="%s">aquí</a> per a continuar.', |
|
19 | + CAS_STR_AUTHENTICATION_FAILED |
|
20 | + => 'Autentificació CAS fallida!', |
|
21 | + CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | + => '<p>No estàs autentificat.</p><p>Pots tornar a intentar-ho fent click <a href="%s">aquí</a>.</p><p>Si el problema persisteix hauría de contactar amb l\'<a href="mailto:%s">administrador d\'aquest llocc</a>.</p>', |
|
23 | + CAS_STR_SERVICE_UNAVAILABLE |
|
24 | + => 'El servei `<b>%s</b>\' no està disponible (<b>%s</b>).' |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | ?> |
@@ -8,20 +8,20 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | $this->_strings = array( |
11 | - CAS_STR_USING_SERVER |
|
12 | - => 'using server', |
|
13 | - CAS_STR_AUTHENTICATION_WANTED |
|
14 | - => 'CAS Authentication wanted!', |
|
15 | - CAS_STR_LOGOUT |
|
16 | - => 'CAS logout wanted!', |
|
17 | - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | - => 'You should already have been redirected to the CAS server. Click <a href="%s">here</a> to continue.', |
|
19 | - CAS_STR_AUTHENTICATION_FAILED |
|
20 | - => 'CAS Authentication failed!', |
|
21 | - CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | - => '<p>You were not authenticated.</p><p>You may submit your request again by clicking <a href="%s">here</a>.</p><p>If the problem persists, you may contact <a href="mailto:%s">the administrator of this site</a>.</p>', |
|
23 | - CAS_STR_SERVICE_UNAVAILABLE |
|
24 | - => 'The service `<b>%s</b>\' is not available (<b>%s</b>).' |
|
11 | + CAS_STR_USING_SERVER |
|
12 | + => 'using server', |
|
13 | + CAS_STR_AUTHENTICATION_WANTED |
|
14 | + => 'CAS Authentication wanted!', |
|
15 | + CAS_STR_LOGOUT |
|
16 | + => 'CAS logout wanted!', |
|
17 | + CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | + => 'You should already have been redirected to the CAS server. Click <a href="%s">here</a> to continue.', |
|
19 | + CAS_STR_AUTHENTICATION_FAILED |
|
20 | + => 'CAS Authentication failed!', |
|
21 | + CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | + => '<p>You were not authenticated.</p><p>You may submit your request again by clicking <a href="%s">here</a>.</p><p>If the problem persists, you may contact <a href="mailto:%s">the administrator of this site</a>.</p>', |
|
23 | + CAS_STR_SERVICE_UNAVAILABLE |
|
24 | + => 'The service `<b>%s</b>\' is not available (<b>%s</b>).' |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | ?> |
28 | 28 | \ No newline at end of file |
@@ -8,20 +8,20 @@ |
||
8 | 8 | **/ |
9 | 9 | |
10 | 10 | $this->_strings = array( |
11 | - CAS_STR_USING_SERVER |
|
12 | - => 'using server', |
|
13 | - CAS_STR_AUTHENTICATION_WANTED |
|
14 | - => 'CAS�ˤ��ǧ�ڤ�Ԥ��ޤ�', |
|
15 | - CAS_STR_LOGOUT |
|
16 | - => 'CAS����?�����Ȥ��ޤ�!', |
|
17 | - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | - => 'CAS�����Ф˹Ԥ�ɬ�פ�����ޤ�����ưŪ��ž������ʤ����� <a href="%s">������</a> � |
@@ -8,20 +8,20 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | $this->_strings = array( |
11 | - CAS_STR_USING_SERVER |
|
12 | - => '��������������� � ������������', |
|
13 | - CAS_STR_AUTHENTICATION_WANTED |
|
14 | - => '���������� � ����������� CAS!', |
|
15 | - CAS_STR_LOGOUT |
|
16 | - => '���������� � ���������� ��� CAS!', |
|
17 | - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | - => '�� ������ �� ������ �������������� ���� ����������� CAS. ����� ���� <a href="%s">���</a> ��� �� ����������.', |
|
19 | - CAS_STR_AUTHENTICATION_FAILED |
|
20 | - => '� ����������� CAS �������!', |
|
21 | - CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | - => '<p>��� ���������������.</p><p>�������� �� ����������������, �������� ���� <a href="%s">���</a>.</p><p>��� �� �������� ���������, ����� �� ����� �� ��� <a href="mailto:%s">�����������</a>.</p>', |
|
23 | - CAS_STR_SERVICE_UNAVAILABLE |
|
24 | - => '� �������� `<b>%s</b>\' ��� ����� ��������� (<b>%s</b>).' |
|
11 | + CAS_STR_USING_SERVER |
|
12 | + => '��������������� � ������������', |
|
13 | + CAS_STR_AUTHENTICATION_WANTED |
|
14 | + => '���������� � ����������� CAS!', |
|
15 | + CAS_STR_LOGOUT |
|
16 | + => '���������� � ���������� ��� CAS!', |
|
17 | + CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | + => '�� ������ �� ������ �������������� ���� ����������� CAS. ����� ���� <a href="%s">���</a> ��� �� ����������.', |
|
19 | + CAS_STR_AUTHENTICATION_FAILED |
|
20 | + => '� ����������� CAS �������!', |
|
21 | + CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | + => '<p>��� ���������������.</p><p>�������� �� ����������������, �������� ���� <a href="%s">���</a>.</p><p>��� �� �������� ���������, ����� �� ����� �� ��� <a href="mailto:%s">�����������</a>.</p>', |
|
23 | + CAS_STR_SERVICE_UNAVAILABLE |
|
24 | + => '� �������� `<b>%s</b>\' ��� ����� ��������� (<b>%s</b>).' |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | ?> |
28 | 28 | \ No newline at end of file |
@@ -8,20 +8,20 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | $this->_strings = array( |
11 | - CAS_STR_USING_SERVER |
|
12 | - => 'utilisant le serveur', |
|
13 | - CAS_STR_AUTHENTICATION_WANTED |
|
14 | - => 'Authentication CAS n�cessaire !', |
|
15 | - CAS_STR_LOGOUT |
|
16 | - => 'D�connexion demand�e !', |
|
17 | - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | - => 'Vous auriez du etre redirig�(e) vers le serveur CAS. Cliquez <a href="%s">ici</a> pour continuer.', |
|
19 | - CAS_STR_AUTHENTICATION_FAILED |
|
20 | - => 'Authentification CAS infructueuse !', |
|
21 | - CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | - => '<p>Vous n\'avez pas �t� authentifi�(e).</p><p>Vous pouvez soumettre votre requete � nouveau en cliquant <a href="%s">ici</a>.</p><p>Si le probl�me persiste, vous pouvez contacter <a href="mailto:%s">l\'administrateur de ce site</a>.</p>', |
|
23 | - CAS_STR_SERVICE_UNAVAILABLE |
|
24 | - => 'Le service `<b>%s</b>\' est indisponible (<b>%s</b>)' |
|
11 | + CAS_STR_USING_SERVER |
|
12 | + => 'utilisant le serveur', |
|
13 | + CAS_STR_AUTHENTICATION_WANTED |
|
14 | + => 'Authentication CAS n�cessaire !', |
|
15 | + CAS_STR_LOGOUT |
|
16 | + => 'D�connexion demand�e !', |
|
17 | + CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | + => 'Vous auriez du etre redirig�(e) vers le serveur CAS. Cliquez <a href="%s">ici</a> pour continuer.', |
|
19 | + CAS_STR_AUTHENTICATION_FAILED |
|
20 | + => 'Authentification CAS infructueuse !', |
|
21 | + CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | + => '<p>Vous n\'avez pas �t� authentifi�(e).</p><p>Vous pouvez soumettre votre requete � nouveau en cliquant <a href="%s">ici</a>.</p><p>Si le probl�me persiste, vous pouvez contacter <a href="mailto:%s">l\'administrateur de ce site</a>.</p>', |
|
23 | + CAS_STR_SERVICE_UNAVAILABLE |
|
24 | + => 'Le service `<b>%s</b>\' est indisponible (<b>%s</b>)' |
|
25 | 25 | |
26 | 26 | ); |
27 | 27 |
@@ -8,20 +8,20 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | $this->_strings = array( |
11 | - CAS_STR_USING_SERVER |
|
12 | - => 'usando servidor', |
|
13 | - CAS_STR_AUTHENTICATION_WANTED |
|
14 | - => '¡Autentificación CAS necesaria!', |
|
15 | - CAS_STR_LOGOUT |
|
16 | - => '¡Salida CAS necesaria!', |
|
17 | - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | - => 'Ya debería haber sido redireccionado al servidor CAS. Haga click <a href="%s">aquí</a> para continuar.', |
|
19 | - CAS_STR_AUTHENTICATION_FAILED |
|
20 | - => '¡Autentificación CAS fallida!', |
|
21 | - CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | - => '<p>No estás autentificado.</p><p>Puedes volver a intentarlo haciendo click <a href="%s">aquí</a>.</p><p>Si el problema persiste debería contactar con el <a href="mailto:%s">administrador de este sitio</a>.</p>', |
|
23 | - CAS_STR_SERVICE_UNAVAILABLE |
|
24 | - => 'El servicio `<b>%s</b>\' no está disponible (<b>%s</b>).' |
|
11 | + CAS_STR_USING_SERVER |
|
12 | + => 'usando servidor', |
|
13 | + CAS_STR_AUTHENTICATION_WANTED |
|
14 | + => '¡Autentificación CAS necesaria!', |
|
15 | + CAS_STR_LOGOUT |
|
16 | + => '¡Salida CAS necesaria!', |
|
17 | + CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED |
|
18 | + => 'Ya debería haber sido redireccionado al servidor CAS. Haga click <a href="%s">aquí</a> para continuar.', |
|
19 | + CAS_STR_AUTHENTICATION_FAILED |
|
20 | + => '¡Autentificación CAS fallida!', |
|
21 | + CAS_STR_YOU_WERE_NOT_AUTHENTICATED |
|
22 | + => '<p>No estás autentificado.</p><p>Puedes volver a intentarlo haciendo click <a href="%s">aquí</a>.</p><p>Si el problema persiste debería contactar con el <a href="mailto:%s">administrador de este sitio</a>.</p>', |
|
23 | + CAS_STR_SERVICE_UNAVAILABLE |
|
24 | + => 'El servicio `<b>%s</b>\' no está disponible (<b>%s</b>).' |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | ?> |
@@ -53,36 +53,36 @@ discard block |
||
53 | 53 | function domxml_new_xmldoc($version) {return new php4DOMDocument();} |
54 | 54 | function domxml_open_file($filename,$mode=DOMXML_LOAD_PARSING,&$error=null) |
55 | 55 | { |
56 | - $dom=new php4DOMDocument($mode); |
|
57 | - $errorMode=(func_num_args()>2)&&defined('LIBXML_VERSION'); |
|
58 | - if ($errorMode) libxml_use_internal_errors(true); |
|
59 | - if (!$dom->myDOMNode->load($filename)) $dom=null; |
|
60 | - if ($errorMode) |
|
61 | - { |
|
62 | - $error=array_map('_error_report',libxml_get_errors()); |
|
63 | - libxml_clear_errors(); |
|
64 | - } |
|
65 | - return $dom; |
|
56 | + $dom=new php4DOMDocument($mode); |
|
57 | + $errorMode=(func_num_args()>2)&&defined('LIBXML_VERSION'); |
|
58 | + if ($errorMode) libxml_use_internal_errors(true); |
|
59 | + if (!$dom->myDOMNode->load($filename)) $dom=null; |
|
60 | + if ($errorMode) |
|
61 | + { |
|
62 | + $error=array_map('_error_report',libxml_get_errors()); |
|
63 | + libxml_clear_errors(); |
|
64 | + } |
|
65 | + return $dom; |
|
66 | 66 | } |
67 | 67 | function domxml_open_mem($str,$mode=DOMXML_LOAD_PARSING,&$error=null) |
68 | 68 | { |
69 | - $dom=new php4DOMDocument($mode); |
|
70 | - $errorMode=(func_num_args()>2)&&defined('LIBXML_VERSION'); |
|
71 | - if ($errorMode) libxml_use_internal_errors(true); |
|
72 | - if (!$dom->myDOMNode->loadXML($str)) $dom=null; |
|
73 | - if ($errorMode) |
|
74 | - { |
|
75 | - $error=array_map('_error_report',libxml_get_errors()); |
|
76 | - libxml_clear_errors(); |
|
77 | - } |
|
78 | - return $dom; |
|
69 | + $dom=new php4DOMDocument($mode); |
|
70 | + $errorMode=(func_num_args()>2)&&defined('LIBXML_VERSION'); |
|
71 | + if ($errorMode) libxml_use_internal_errors(true); |
|
72 | + if (!$dom->myDOMNode->loadXML($str)) $dom=null; |
|
73 | + if ($errorMode) |
|
74 | + { |
|
75 | + $error=array_map('_error_report',libxml_get_errors()); |
|
76 | + libxml_clear_errors(); |
|
77 | + } |
|
78 | + return $dom; |
|
79 | 79 | } |
80 | 80 | function html_doc($html_doc,$from_file=false) |
81 | 81 | { |
82 | - $dom=new php4DOMDocument(); |
|
83 | - if ($from_file) $result=$dom->myDOMNode->loadHTMLFile($html_doc); |
|
84 | - else $result=$dom->myDOMNode->loadHTML($html_doc); |
|
85 | - return $result ? $dom : null; |
|
82 | + $dom=new php4DOMDocument(); |
|
83 | + if ($from_file) $result=$dom->myDOMNode->loadHTMLFile($html_doc); |
|
84 | + else $result=$dom->myDOMNode->loadHTML($html_doc); |
|
85 | + return $result ? $dom : null; |
|
86 | 86 | } |
87 | 87 | function html_doc_file($filename) {return html_doc($filename,true);} |
88 | 88 | function xmldoc($str) {return domxml_open_mem($str);} |
@@ -95,314 +95,314 @@ discard block |
||
95 | 95 | |
96 | 96 | class php4DOMAttr extends php4DOMNode |
97 | 97 | { |
98 | - function __get($name) |
|
99 | - { |
|
100 | - if ($name==='name') return $this->myDOMNode->name; |
|
101 | - else return parent::__get($name); |
|
102 | - } |
|
103 | - function name() {return $this->myDOMNode->name;} |
|
104 | - function set_content($text) {} |
|
105 | - //function set_value($content) {return $this->myDOMNode->value=htmlspecialchars($content,ENT_QUOTES);} |
|
106 | - function specified() {return $this->myDOMNode->specified;} |
|
107 | - function value() {return $this->myDOMNode->value;} |
|
98 | + function __get($name) |
|
99 | + { |
|
100 | + if ($name==='name') return $this->myDOMNode->name; |
|
101 | + else return parent::__get($name); |
|
102 | + } |
|
103 | + function name() {return $this->myDOMNode->name;} |
|
104 | + function set_content($text) {} |
|
105 | + //function set_value($content) {return $this->myDOMNode->value=htmlspecialchars($content,ENT_QUOTES);} |
|
106 | + function specified() {return $this->myDOMNode->specified;} |
|
107 | + function value() {return $this->myDOMNode->value;} |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | class php4DOMDocument extends php4DOMNode |
111 | 111 | { |
112 | - function php4DOMDocument($mode=DOMXML_LOAD_PARSING) |
|
113 | - { |
|
114 | - $this->myDOMNode=new DOMDocument(); |
|
115 | - $this->myOwnerDocument=$this; |
|
116 | - if ($mode & DOMXML_LOAD_VALIDATING) $this->myDOMNode->validateOnParse=true; |
|
117 | - if ($mode & DOMXML_LOAD_RECOVERING) $this->myDOMNode->recover=true; |
|
118 | - if ($mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES) $this->myDOMNode->substituteEntities=true; |
|
119 | - if ($mode & DOMXML_LOAD_DONT_KEEP_BLANKS) $this->myDOMNode->preserveWhiteSpace=false; |
|
120 | - } |
|
121 | - function add_root($name) |
|
122 | - { |
|
123 | - if ($this->myDOMNode->hasChildNodes()) $this->myDOMNode->removeChild($this->myDOMNode->firstChild); |
|
124 | - return new php4DOMElement($this->myDOMNode->appendChild($this->myDOMNode->createElement($name)),$this->myOwnerDocument); |
|
125 | - } |
|
126 | - function create_attribute($name,$value) |
|
127 | - { |
|
128 | - $myAttr=$this->myDOMNode->createAttribute($name); |
|
129 | - $myAttr->value=htmlspecialchars($value,ENT_QUOTES); |
|
130 | - return new php4DOMAttr($myAttr,$this); |
|
131 | - } |
|
132 | - function create_cdata_section($content) {return new php4DOMNode($this->myDOMNode->createCDATASection($content),$this);} |
|
133 | - function create_comment($data) {return new php4DOMNode($this->myDOMNode->createComment($data),$this);} |
|
134 | - function create_element($name) {return new php4DOMElement($this->myDOMNode->createElement($name),$this);} |
|
135 | - function create_element_ns($uri,$name,$prefix=null) |
|
136 | - { |
|
137 | - if ($prefix==null) $prefix=$this->myDOMNode->lookupPrefix($uri); |
|
138 | - if (($prefix==null)&&(($this->myDOMNode->documentElement==null)||(!$this->myDOMNode->documentElement->isDefaultNamespace($uri)))) $prefix='a'.sprintf('%u',crc32($uri)); |
|
139 | - return new php4DOMElement($this->myDOMNode->createElementNS($uri,$prefix==null ? $name : $prefix.':'.$name),$this); |
|
140 | - } |
|
141 | - function create_entity_reference($content) {return new php4DOMNode($this->myDOMNode->createEntityReference($content),$this);} //By Walter Ebert 2007-01-22 |
|
142 | - function create_processing_instruction($target,$data=''){return new php4DomProcessingInstruction($this->myDOMNode->createProcessingInstruction($target,$data),$this);} |
|
143 | - function create_text_node($content) {return new php4DOMText($this->myDOMNode->createTextNode($content),$this);} |
|
144 | - function document_element() {return parent::_newDOMElement($this->myDOMNode->documentElement,$this);} |
|
145 | - function dump_file($filename,$compressionmode=false,$format=false) |
|
146 | - { |
|
147 | - $format0=$this->myDOMNode->formatOutput; |
|
148 | - $this->myDOMNode->formatOutput=$format; |
|
149 | - $res=$this->myDOMNode->save($filename); |
|
150 | - $this->myDOMNode->formatOutput=$format0; |
|
151 | - return $res; |
|
152 | - } |
|
153 | - function dump_mem($format=false,$encoding=false) |
|
154 | - { |
|
155 | - $format0=$this->myDOMNode->formatOutput; |
|
156 | - $this->myDOMNode->formatOutput=$format; |
|
157 | - $encoding0=$this->myDOMNode->encoding; |
|
158 | - if ($encoding) $this->myDOMNode->encoding=$encoding; |
|
159 | - $dump=$this->myDOMNode->saveXML(); |
|
160 | - $this->myDOMNode->formatOutput=$format0; |
|
161 | - if ($encoding) $this->myDOMNode->encoding= $encoding0=='' ? 'UTF-8' : $encoding0; //UTF-8 is XML default encoding |
|
162 | - return $dump; |
|
163 | - } |
|
164 | - function free() |
|
165 | - { |
|
166 | - if ($this->myDOMNode->hasChildNodes()) $this->myDOMNode->removeChild($this->myDOMNode->firstChild); |
|
167 | - $this->myDOMNode=null; |
|
168 | - $this->myOwnerDocument=null; |
|
169 | - } |
|
170 | - function get_element_by_id($id) {return parent::_newDOMElement($this->myDOMNode->getElementById($id),$this);} |
|
171 | - function get_elements_by_tagname($name) |
|
172 | - { |
|
173 | - $myDOMNodeList=$this->myDOMNode->getElementsByTagName($name); |
|
174 | - $nodeSet=array(); |
|
175 | - $i=0; |
|
176 | - if (isset($myDOMNodeList)) |
|
177 | - while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this); |
|
178 | - return $nodeSet; |
|
179 | - } |
|
180 | - function html_dump_mem() {return $this->myDOMNode->saveHTML();} |
|
181 | - function root() {return parent::_newDOMElement($this->myDOMNode->documentElement,$this);} |
|
182 | - function xinclude() {return $this->myDOMNode->xinclude();} |
|
183 | - function xpath_new_context() {return new php4DOMXPath($this);} |
|
112 | + function php4DOMDocument($mode=DOMXML_LOAD_PARSING) |
|
113 | + { |
|
114 | + $this->myDOMNode=new DOMDocument(); |
|
115 | + $this->myOwnerDocument=$this; |
|
116 | + if ($mode & DOMXML_LOAD_VALIDATING) $this->myDOMNode->validateOnParse=true; |
|
117 | + if ($mode & DOMXML_LOAD_RECOVERING) $this->myDOMNode->recover=true; |
|
118 | + if ($mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES) $this->myDOMNode->substituteEntities=true; |
|
119 | + if ($mode & DOMXML_LOAD_DONT_KEEP_BLANKS) $this->myDOMNode->preserveWhiteSpace=false; |
|
120 | + } |
|
121 | + function add_root($name) |
|
122 | + { |
|
123 | + if ($this->myDOMNode->hasChildNodes()) $this->myDOMNode->removeChild($this->myDOMNode->firstChild); |
|
124 | + return new php4DOMElement($this->myDOMNode->appendChild($this->myDOMNode->createElement($name)),$this->myOwnerDocument); |
|
125 | + } |
|
126 | + function create_attribute($name,$value) |
|
127 | + { |
|
128 | + $myAttr=$this->myDOMNode->createAttribute($name); |
|
129 | + $myAttr->value=htmlspecialchars($value,ENT_QUOTES); |
|
130 | + return new php4DOMAttr($myAttr,$this); |
|
131 | + } |
|
132 | + function create_cdata_section($content) {return new php4DOMNode($this->myDOMNode->createCDATASection($content),$this);} |
|
133 | + function create_comment($data) {return new php4DOMNode($this->myDOMNode->createComment($data),$this);} |
|
134 | + function create_element($name) {return new php4DOMElement($this->myDOMNode->createElement($name),$this);} |
|
135 | + function create_element_ns($uri,$name,$prefix=null) |
|
136 | + { |
|
137 | + if ($prefix==null) $prefix=$this->myDOMNode->lookupPrefix($uri); |
|
138 | + if (($prefix==null)&&(($this->myDOMNode->documentElement==null)||(!$this->myDOMNode->documentElement->isDefaultNamespace($uri)))) $prefix='a'.sprintf('%u',crc32($uri)); |
|
139 | + return new php4DOMElement($this->myDOMNode->createElementNS($uri,$prefix==null ? $name : $prefix.':'.$name),$this); |
|
140 | + } |
|
141 | + function create_entity_reference($content) {return new php4DOMNode($this->myDOMNode->createEntityReference($content),$this);} //By Walter Ebert 2007-01-22 |
|
142 | + function create_processing_instruction($target,$data=''){return new php4DomProcessingInstruction($this->myDOMNode->createProcessingInstruction($target,$data),$this);} |
|
143 | + function create_text_node($content) {return new php4DOMText($this->myDOMNode->createTextNode($content),$this);} |
|
144 | + function document_element() {return parent::_newDOMElement($this->myDOMNode->documentElement,$this);} |
|
145 | + function dump_file($filename,$compressionmode=false,$format=false) |
|
146 | + { |
|
147 | + $format0=$this->myDOMNode->formatOutput; |
|
148 | + $this->myDOMNode->formatOutput=$format; |
|
149 | + $res=$this->myDOMNode->save($filename); |
|
150 | + $this->myDOMNode->formatOutput=$format0; |
|
151 | + return $res; |
|
152 | + } |
|
153 | + function dump_mem($format=false,$encoding=false) |
|
154 | + { |
|
155 | + $format0=$this->myDOMNode->formatOutput; |
|
156 | + $this->myDOMNode->formatOutput=$format; |
|
157 | + $encoding0=$this->myDOMNode->encoding; |
|
158 | + if ($encoding) $this->myDOMNode->encoding=$encoding; |
|
159 | + $dump=$this->myDOMNode->saveXML(); |
|
160 | + $this->myDOMNode->formatOutput=$format0; |
|
161 | + if ($encoding) $this->myDOMNode->encoding= $encoding0=='' ? 'UTF-8' : $encoding0; //UTF-8 is XML default encoding |
|
162 | + return $dump; |
|
163 | + } |
|
164 | + function free() |
|
165 | + { |
|
166 | + if ($this->myDOMNode->hasChildNodes()) $this->myDOMNode->removeChild($this->myDOMNode->firstChild); |
|
167 | + $this->myDOMNode=null; |
|
168 | + $this->myOwnerDocument=null; |
|
169 | + } |
|
170 | + function get_element_by_id($id) {return parent::_newDOMElement($this->myDOMNode->getElementById($id),$this);} |
|
171 | + function get_elements_by_tagname($name) |
|
172 | + { |
|
173 | + $myDOMNodeList=$this->myDOMNode->getElementsByTagName($name); |
|
174 | + $nodeSet=array(); |
|
175 | + $i=0; |
|
176 | + if (isset($myDOMNodeList)) |
|
177 | + while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this); |
|
178 | + return $nodeSet; |
|
179 | + } |
|
180 | + function html_dump_mem() {return $this->myDOMNode->saveHTML();} |
|
181 | + function root() {return parent::_newDOMElement($this->myDOMNode->documentElement,$this);} |
|
182 | + function xinclude() {return $this->myDOMNode->xinclude();} |
|
183 | + function xpath_new_context() {return new php4DOMXPath($this);} |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | class php4DOMElement extends php4DOMNode |
187 | 187 | { |
188 | - function add_namespace($uri,$prefix) |
|
189 | - { |
|
190 | - if ($this->myDOMNode->hasAttributeNS('http://www.w3.org/2000/xmlns/',$prefix)) return false; |
|
191 | - else |
|
192 | - { |
|
193 | - $this->myDOMNode->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:'.$prefix,$uri); //By Daniel Walker 2006-09-08 |
|
194 | - return true; |
|
195 | - } |
|
196 | - } |
|
197 | - function get_attribute($name) {return $this->myDOMNode->getAttribute($name);} |
|
198 | - function get_attribute_node($name) {return parent::_newDOMElement($this->myDOMNode->getAttributeNode($name),$this->myOwnerDocument);} |
|
199 | - function get_elements_by_tagname($name) |
|
200 | - { |
|
201 | - $myDOMNodeList=$this->myDOMNode->getElementsByTagName($name); |
|
202 | - $nodeSet=array(); |
|
203 | - $i=0; |
|
204 | - if (isset($myDOMNodeList)) |
|
205 | - while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument); |
|
206 | - return $nodeSet; |
|
207 | - } |
|
208 | - function has_attribute($name) {return $this->myDOMNode->hasAttribute($name);} |
|
209 | - function remove_attribute($name) {return $this->myDOMNode->removeAttribute($name);} |
|
210 | - function set_attribute($name,$value) |
|
211 | - { |
|
212 | - //return $this->myDOMNode->setAttribute($name,$value); //Does not return a DomAttr |
|
213 | - $myAttr=$this->myDOMNode->ownerDocument->createAttribute($name); |
|
214 | - $myAttr->value=htmlspecialchars($value,ENT_QUOTES); //Entity problem reported by AL-DesignWorks 2007-09-07 |
|
215 | - $this->myDOMNode->setAttributeNode($myAttr); |
|
216 | - return new php4DOMAttr($myAttr,$this->myOwnerDocument); |
|
217 | - } |
|
218 | - /*function set_attribute_node($attr) |
|
188 | + function add_namespace($uri,$prefix) |
|
189 | + { |
|
190 | + if ($this->myDOMNode->hasAttributeNS('http://www.w3.org/2000/xmlns/',$prefix)) return false; |
|
191 | + else |
|
192 | + { |
|
193 | + $this->myDOMNode->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:'.$prefix,$uri); //By Daniel Walker 2006-09-08 |
|
194 | + return true; |
|
195 | + } |
|
196 | + } |
|
197 | + function get_attribute($name) {return $this->myDOMNode->getAttribute($name);} |
|
198 | + function get_attribute_node($name) {return parent::_newDOMElement($this->myDOMNode->getAttributeNode($name),$this->myOwnerDocument);} |
|
199 | + function get_elements_by_tagname($name) |
|
200 | + { |
|
201 | + $myDOMNodeList=$this->myDOMNode->getElementsByTagName($name); |
|
202 | + $nodeSet=array(); |
|
203 | + $i=0; |
|
204 | + if (isset($myDOMNodeList)) |
|
205 | + while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument); |
|
206 | + return $nodeSet; |
|
207 | + } |
|
208 | + function has_attribute($name) {return $this->myDOMNode->hasAttribute($name);} |
|
209 | + function remove_attribute($name) {return $this->myDOMNode->removeAttribute($name);} |
|
210 | + function set_attribute($name,$value) |
|
211 | + { |
|
212 | + //return $this->myDOMNode->setAttribute($name,$value); //Does not return a DomAttr |
|
213 | + $myAttr=$this->myDOMNode->ownerDocument->createAttribute($name); |
|
214 | + $myAttr->value=htmlspecialchars($value,ENT_QUOTES); //Entity problem reported by AL-DesignWorks 2007-09-07 |
|
215 | + $this->myDOMNode->setAttributeNode($myAttr); |
|
216 | + return new php4DOMAttr($myAttr,$this->myOwnerDocument); |
|
217 | + } |
|
218 | + /*function set_attribute_node($attr) |
|
219 | 219 | { |
220 | 220 | $this->myDOMNode->setAttributeNode($this->_importNode($attr)); |
221 | 221 | return $attr; |
222 | 222 | }*/ |
223 | - function set_name($name) |
|
224 | - { |
|
225 | - if ($this->myDOMNode->prefix=='') $newNode=$this->myDOMNode->ownerDocument->createElement($name); |
|
226 | - else $newNode=$this->myDOMNode->ownerDocument->createElementNS($this->myDOMNode->namespaceURI,$this->myDOMNode->prefix.':'.$name); |
|
227 | - $myDOMNodeList=$this->myDOMNode->attributes; |
|
228 | - $i=0; |
|
229 | - if (isset($myDOMNodeList)) |
|
230 | - while ($node=$myDOMNodeList->item($i++)) |
|
231 | - if ($node->namespaceURI=='') $newNode->setAttribute($node->name,$node->value); |
|
232 | - else $newNode->setAttributeNS($node->namespaceURI,$node->nodeName,$node->value); |
|
233 | - $myDOMNodeList=$this->myDOMNode->childNodes; |
|
234 | - if (isset($myDOMNodeList)) |
|
235 | - while ($node=$myDOMNodeList->item(0)) $newNode->appendChild($node); |
|
236 | - $this->myDOMNode->parentNode->replaceChild($newNode,$this->myDOMNode); |
|
237 | - $this->myDOMNode=$newNode; |
|
238 | - return true; |
|
239 | - } |
|
240 | - function tagname() {return $this->tagname;} |
|
223 | + function set_name($name) |
|
224 | + { |
|
225 | + if ($this->myDOMNode->prefix=='') $newNode=$this->myDOMNode->ownerDocument->createElement($name); |
|
226 | + else $newNode=$this->myDOMNode->ownerDocument->createElementNS($this->myDOMNode->namespaceURI,$this->myDOMNode->prefix.':'.$name); |
|
227 | + $myDOMNodeList=$this->myDOMNode->attributes; |
|
228 | + $i=0; |
|
229 | + if (isset($myDOMNodeList)) |
|
230 | + while ($node=$myDOMNodeList->item($i++)) |
|
231 | + if ($node->namespaceURI=='') $newNode->setAttribute($node->name,$node->value); |
|
232 | + else $newNode->setAttributeNS($node->namespaceURI,$node->nodeName,$node->value); |
|
233 | + $myDOMNodeList=$this->myDOMNode->childNodes; |
|
234 | + if (isset($myDOMNodeList)) |
|
235 | + while ($node=$myDOMNodeList->item(0)) $newNode->appendChild($node); |
|
236 | + $this->myDOMNode->parentNode->replaceChild($newNode,$this->myDOMNode); |
|
237 | + $this->myDOMNode=$newNode; |
|
238 | + return true; |
|
239 | + } |
|
240 | + function tagname() {return $this->tagname;} |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | class php4DOMNode |
244 | 244 | { |
245 | - public $myDOMNode; |
|
246 | - public $myOwnerDocument; |
|
247 | - function php4DOMNode($aDomNode,$aOwnerDocument) |
|
248 | - { |
|
249 | - $this->myDOMNode=$aDomNode; |
|
250 | - $this->myOwnerDocument=$aOwnerDocument; |
|
251 | - } |
|
252 | - function __get($name) |
|
253 | - { |
|
254 | - switch ($name) |
|
255 | - { |
|
256 | - case 'type': return $this->myDOMNode->nodeType; |
|
257 | - case 'tagname': return ($this->myDOMNode->nodeType===XML_ELEMENT_NODE) ? $this->myDOMNode->localName : $this->myDOMNode->tagName; //Avoid namespace prefix for DOMElement |
|
258 | - case 'content': return $this->myDOMNode->textContent; |
|
259 | - case 'value': return $this->myDOMNode->value; |
|
260 | - default: |
|
261 | - $myErrors=debug_backtrace(); |
|
262 | - trigger_error('Undefined property: '.get_class($this).'::$'.$name.' ['.$myErrors[0]['file'].':'.$myErrors[0]['line'].']',E_USER_NOTICE); |
|
263 | - return false; |
|
264 | - } |
|
265 | - } |
|
266 | - function add_child($newnode) {return append_child($newnode);} |
|
267 | - function add_namespace($uri,$prefix) {return false;} |
|
268 | - function append_child($newnode) {return self::_newDOMElement($this->myDOMNode->appendChild($this->_importNode($newnode)),$this->myOwnerDocument);} |
|
269 | - function append_sibling($newnode) {return self::_newDOMElement($this->myDOMNode->parentNode->appendChild($this->_importNode($newnode)),$this->myOwnerDocument);} |
|
270 | - function attributes() |
|
271 | - { |
|
272 | - $myDOMNodeList=$this->myDOMNode->attributes; |
|
273 | - if (!(isset($myDOMNodeList)&&$this->myDOMNode->hasAttributes())) return null; |
|
274 | - $nodeSet=array(); |
|
275 | - $i=0; |
|
276 | - while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMAttr($node,$this->myOwnerDocument); |
|
277 | - return $nodeSet; |
|
278 | - } |
|
279 | - function child_nodes() |
|
280 | - { |
|
281 | - $myDOMNodeList=$this->myDOMNode->childNodes; |
|
282 | - $nodeSet=array(); |
|
283 | - $i=0; |
|
284 | - if (isset($myDOMNodeList)) |
|
285 | - while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=self::_newDOMElement($node,$this->myOwnerDocument); |
|
286 | - return $nodeSet; |
|
287 | - } |
|
288 | - function children() {return $this->child_nodes();} |
|
289 | - function clone_node($deep=false) {return self::_newDOMElement($this->myDOMNode->cloneNode($deep),$this->myOwnerDocument);} |
|
290 | - //dump_node($node) should only be called on php4DOMDocument |
|
291 | - function dump_node($node=null) {return $node==null ? $this->myOwnerDocument->myDOMNode->saveXML($this->myDOMNode) : $this->myOwnerDocument->myDOMNode->saveXML($node->myDOMNode);} |
|
292 | - function first_child() {return self::_newDOMElement($this->myDOMNode->firstChild,$this->myOwnerDocument);} |
|
293 | - function get_content() {return $this->myDOMNode->textContent;} |
|
294 | - function has_attributes() {return $this->myDOMNode->hasAttributes();} |
|
295 | - function has_child_nodes() {return $this->myDOMNode->hasChildNodes();} |
|
296 | - function insert_before($newnode,$refnode) {return self::_newDOMElement($this->myDOMNode->insertBefore($this->_importNode($newnode),$refnode==null?null:$refnode->myDOMNode),$this->myOwnerDocument);} |
|
297 | - function is_blank_node() {return ($this->myDOMNode->nodeType===XML_TEXT_NODE)&&preg_match('%^\s*$%',$this->myDOMNode->nodeValue);} |
|
298 | - function last_child() {return self::_newDOMElement($this->myDOMNode->lastChild,$this->myOwnerDocument);} |
|
299 | - function new_child($name,$content) |
|
300 | - { |
|
301 | - $mySubNode=$this->myDOMNode->ownerDocument->createElement($name); |
|
302 | - $mySubNode->appendChild($this->myDOMNode->ownerDocument->createTextNode(_entityDecode($content))); |
|
303 | - $this->myDOMNode->appendChild($mySubNode); |
|
304 | - return new php4DOMElement($mySubNode,$this->myOwnerDocument); |
|
305 | - } |
|
306 | - function next_sibling() {return self::_newDOMElement($this->myDOMNode->nextSibling,$this->myOwnerDocument);} |
|
307 | - function node_name() {return ($this->myDOMNode->nodeType===XML_ELEMENT_NODE) ? $this->myDOMNode->localName : $this->myDOMNode->nodeName;} //Avoid namespace prefix for DOMElement |
|
308 | - function node_type() {return $this->myDOMNode->nodeType;} |
|
309 | - function node_value() {return $this->myDOMNode->nodeValue;} |
|
310 | - function owner_document() {return $this->myOwnerDocument;} |
|
311 | - function parent_node() {return self::_newDOMElement($this->myDOMNode->parentNode,$this->myOwnerDocument);} |
|
312 | - function prefix() {return $this->myDOMNode->prefix;} |
|
313 | - function previous_sibling() {return self::_newDOMElement($this->myDOMNode->previousSibling,$this->myOwnerDocument);} |
|
314 | - function remove_child($oldchild) {return self::_newDOMElement($this->myDOMNode->removeChild($oldchild->myDOMNode),$this->myOwnerDocument);} |
|
315 | - function replace_child($newnode,$oldnode) {return self::_newDOMElement($this->myDOMNode->replaceChild($this->_importNode($newnode),$oldnode->myDOMNode),$this->myOwnerDocument);} |
|
316 | - function replace_node($newnode) {return self::_newDOMElement($this->myDOMNode->parentNode->replaceChild($this->_importNode($newnode),$this->myDOMNode),$this->myOwnerDocument);} |
|
317 | - function set_content($text) {return $this->myDOMNode->appendChild($this->myDOMNode->ownerDocument->createTextNode(_entityDecode($text)));} //Entity problem reported by AL-DesignWorks 2007-09-07 |
|
318 | - //function set_name($name) {return $this->myOwnerDocument->renameNode($this->myDOMNode,$this->myDOMNode->namespaceURI,$name);} |
|
319 | - function set_namespace($uri,$prefix=null) |
|
320 | - {//Contributions by Daniel Walker 2006-09-08 |
|
321 | - $nsprefix=$this->myDOMNode->lookupPrefix($uri); |
|
322 | - if ($nsprefix==null) |
|
323 | - { |
|
324 | - $nsprefix= $prefix==null ? $nsprefix='a'.sprintf('%u',crc32($uri)) : $prefix; |
|
325 | - if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) |
|
326 | - { |
|
327 | - if (($prefix!=null)&&$this->myDOMNode->ownerElement->hasAttributeNS('http://www.w3.org/2000/xmlns/',$nsprefix)&& |
|
328 | - ($this->myDOMNode->ownerElement->getAttributeNS('http://www.w3.org/2000/xmlns/',$nsprefix)!=$uri)) |
|
329 | - {//Remove namespace |
|
330 | - $parent=$this->myDOMNode->ownerElement; |
|
331 | - $parent->removeAttributeNode($this->myDOMNode); |
|
332 | - $parent->setAttribute($this->myDOMNode->localName,$this->myDOMNode->nodeValue); |
|
333 | - $this->myDOMNode=$parent->getAttributeNode($this->myDOMNode->localName); |
|
334 | - return; |
|
335 | - } |
|
336 | - $this->myDOMNode->ownerElement->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:'.$nsprefix,$uri); |
|
337 | - } |
|
338 | - } |
|
339 | - if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) |
|
340 | - { |
|
341 | - $parent=$this->myDOMNode->ownerElement; |
|
342 | - $parent->removeAttributeNode($this->myDOMNode); |
|
343 | - $parent->setAttributeNS($uri,$nsprefix.':'.$this->myDOMNode->localName,$this->myDOMNode->nodeValue); |
|
344 | - $this->myDOMNode=$parent->getAttributeNodeNS($uri,$this->myDOMNode->localName); |
|
345 | - } |
|
346 | - elseif ($this->myDOMNode->nodeType===XML_ELEMENT_NODE) |
|
347 | - { |
|
348 | - $NewNode=$this->myDOMNode->ownerDocument->createElementNS($uri,$nsprefix.':'.$this->myDOMNode->localName); |
|
349 | - foreach ($this->myDOMNode->attributes as $n) $NewNode->appendChild($n->cloneNode(true)); |
|
350 | - foreach ($this->myDOMNode->childNodes as $n) $NewNode->appendChild($n->cloneNode(true)); |
|
351 | - $xpath=new DOMXPath($this->myDOMNode->ownerDocument); |
|
352 | - $myDOMNodeList=$xpath->query('namespace::*[name()!="xml"]',$this->myDOMNode); //Add old namespaces |
|
353 | - foreach ($myDOMNodeList as $n) $NewNode->setAttributeNS('http://www.w3.org/2000/xmlns/',$n->nodeName,$n->nodeValue); |
|
354 | - $this->myDOMNode->parentNode->replaceChild($NewNode,$this->myDOMNode); |
|
355 | - $this->myDOMNode=$NewNode; |
|
356 | - } |
|
357 | - } |
|
358 | - function unlink_node() |
|
359 | - { |
|
360 | - if ($this->myDOMNode->parentNode!=null) |
|
361 | - { |
|
362 | - if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) $this->myDOMNode->parentNode->removeAttributeNode($this->myDOMNode); |
|
363 | - else $this->myDOMNode->parentNode->removeChild($this->myDOMNode); |
|
364 | - } |
|
365 | - } |
|
366 | - protected function _importNode($newnode) {return $this->myOwnerDocument===$newnode->myOwnerDocument ? $newnode->myDOMNode : $this->myOwnerDocument->myDOMNode->importNode($newnode->myDOMNode,true);} //To import DOMNode from another DOMDocument |
|
367 | - static function _newDOMElement($aDOMNode,$aOwnerDocument) |
|
368 | - {//Check the PHP5 DOMNode before creating a new associated PHP4 DOMNode wrapper |
|
369 | - if ($aDOMNode==null) return null; |
|
370 | - switch ($aDOMNode->nodeType) |
|
371 | - { |
|
372 | - case XML_ELEMENT_NODE: return new php4DOMElement($aDOMNode,$aOwnerDocument); |
|
373 | - case XML_TEXT_NODE: return new php4DOMText($aDOMNode,$aOwnerDocument); |
|
374 | - case XML_ATTRIBUTE_NODE: return new php4DOMAttr($aDOMNode,$aOwnerDocument); |
|
375 | - case XML_PI_NODE: return new php4DomProcessingInstruction($aDOMNode,$aOwnerDocument); |
|
376 | - default: return new php4DOMNode($aDOMNode,$aOwnerDocument); |
|
377 | - } |
|
378 | - } |
|
245 | + public $myDOMNode; |
|
246 | + public $myOwnerDocument; |
|
247 | + function php4DOMNode($aDomNode,$aOwnerDocument) |
|
248 | + { |
|
249 | + $this->myDOMNode=$aDomNode; |
|
250 | + $this->myOwnerDocument=$aOwnerDocument; |
|
251 | + } |
|
252 | + function __get($name) |
|
253 | + { |
|
254 | + switch ($name) |
|
255 | + { |
|
256 | + case 'type': return $this->myDOMNode->nodeType; |
|
257 | + case 'tagname': return ($this->myDOMNode->nodeType===XML_ELEMENT_NODE) ? $this->myDOMNode->localName : $this->myDOMNode->tagName; //Avoid namespace prefix for DOMElement |
|
258 | + case 'content': return $this->myDOMNode->textContent; |
|
259 | + case 'value': return $this->myDOMNode->value; |
|
260 | + default: |
|
261 | + $myErrors=debug_backtrace(); |
|
262 | + trigger_error('Undefined property: '.get_class($this).'::$'.$name.' ['.$myErrors[0]['file'].':'.$myErrors[0]['line'].']',E_USER_NOTICE); |
|
263 | + return false; |
|
264 | + } |
|
265 | + } |
|
266 | + function add_child($newnode) {return append_child($newnode);} |
|
267 | + function add_namespace($uri,$prefix) {return false;} |
|
268 | + function append_child($newnode) {return self::_newDOMElement($this->myDOMNode->appendChild($this->_importNode($newnode)),$this->myOwnerDocument);} |
|
269 | + function append_sibling($newnode) {return self::_newDOMElement($this->myDOMNode->parentNode->appendChild($this->_importNode($newnode)),$this->myOwnerDocument);} |
|
270 | + function attributes() |
|
271 | + { |
|
272 | + $myDOMNodeList=$this->myDOMNode->attributes; |
|
273 | + if (!(isset($myDOMNodeList)&&$this->myDOMNode->hasAttributes())) return null; |
|
274 | + $nodeSet=array(); |
|
275 | + $i=0; |
|
276 | + while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMAttr($node,$this->myOwnerDocument); |
|
277 | + return $nodeSet; |
|
278 | + } |
|
279 | + function child_nodes() |
|
280 | + { |
|
281 | + $myDOMNodeList=$this->myDOMNode->childNodes; |
|
282 | + $nodeSet=array(); |
|
283 | + $i=0; |
|
284 | + if (isset($myDOMNodeList)) |
|
285 | + while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=self::_newDOMElement($node,$this->myOwnerDocument); |
|
286 | + return $nodeSet; |
|
287 | + } |
|
288 | + function children() {return $this->child_nodes();} |
|
289 | + function clone_node($deep=false) {return self::_newDOMElement($this->myDOMNode->cloneNode($deep),$this->myOwnerDocument);} |
|
290 | + //dump_node($node) should only be called on php4DOMDocument |
|
291 | + function dump_node($node=null) {return $node==null ? $this->myOwnerDocument->myDOMNode->saveXML($this->myDOMNode) : $this->myOwnerDocument->myDOMNode->saveXML($node->myDOMNode);} |
|
292 | + function first_child() {return self::_newDOMElement($this->myDOMNode->firstChild,$this->myOwnerDocument);} |
|
293 | + function get_content() {return $this->myDOMNode->textContent;} |
|
294 | + function has_attributes() {return $this->myDOMNode->hasAttributes();} |
|
295 | + function has_child_nodes() {return $this->myDOMNode->hasChildNodes();} |
|
296 | + function insert_before($newnode,$refnode) {return self::_newDOMElement($this->myDOMNode->insertBefore($this->_importNode($newnode),$refnode==null?null:$refnode->myDOMNode),$this->myOwnerDocument);} |
|
297 | + function is_blank_node() {return ($this->myDOMNode->nodeType===XML_TEXT_NODE)&&preg_match('%^\s*$%',$this->myDOMNode->nodeValue);} |
|
298 | + function last_child() {return self::_newDOMElement($this->myDOMNode->lastChild,$this->myOwnerDocument);} |
|
299 | + function new_child($name,$content) |
|
300 | + { |
|
301 | + $mySubNode=$this->myDOMNode->ownerDocument->createElement($name); |
|
302 | + $mySubNode->appendChild($this->myDOMNode->ownerDocument->createTextNode(_entityDecode($content))); |
|
303 | + $this->myDOMNode->appendChild($mySubNode); |
|
304 | + return new php4DOMElement($mySubNode,$this->myOwnerDocument); |
|
305 | + } |
|
306 | + function next_sibling() {return self::_newDOMElement($this->myDOMNode->nextSibling,$this->myOwnerDocument);} |
|
307 | + function node_name() {return ($this->myDOMNode->nodeType===XML_ELEMENT_NODE) ? $this->myDOMNode->localName : $this->myDOMNode->nodeName;} //Avoid namespace prefix for DOMElement |
|
308 | + function node_type() {return $this->myDOMNode->nodeType;} |
|
309 | + function node_value() {return $this->myDOMNode->nodeValue;} |
|
310 | + function owner_document() {return $this->myOwnerDocument;} |
|
311 | + function parent_node() {return self::_newDOMElement($this->myDOMNode->parentNode,$this->myOwnerDocument);} |
|
312 | + function prefix() {return $this->myDOMNode->prefix;} |
|
313 | + function previous_sibling() {return self::_newDOMElement($this->myDOMNode->previousSibling,$this->myOwnerDocument);} |
|
314 | + function remove_child($oldchild) {return self::_newDOMElement($this->myDOMNode->removeChild($oldchild->myDOMNode),$this->myOwnerDocument);} |
|
315 | + function replace_child($newnode,$oldnode) {return self::_newDOMElement($this->myDOMNode->replaceChild($this->_importNode($newnode),$oldnode->myDOMNode),$this->myOwnerDocument);} |
|
316 | + function replace_node($newnode) {return self::_newDOMElement($this->myDOMNode->parentNode->replaceChild($this->_importNode($newnode),$this->myDOMNode),$this->myOwnerDocument);} |
|
317 | + function set_content($text) {return $this->myDOMNode->appendChild($this->myDOMNode->ownerDocument->createTextNode(_entityDecode($text)));} //Entity problem reported by AL-DesignWorks 2007-09-07 |
|
318 | + //function set_name($name) {return $this->myOwnerDocument->renameNode($this->myDOMNode,$this->myDOMNode->namespaceURI,$name);} |
|
319 | + function set_namespace($uri,$prefix=null) |
|
320 | + {//Contributions by Daniel Walker 2006-09-08 |
|
321 | + $nsprefix=$this->myDOMNode->lookupPrefix($uri); |
|
322 | + if ($nsprefix==null) |
|
323 | + { |
|
324 | + $nsprefix= $prefix==null ? $nsprefix='a'.sprintf('%u',crc32($uri)) : $prefix; |
|
325 | + if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) |
|
326 | + { |
|
327 | + if (($prefix!=null)&&$this->myDOMNode->ownerElement->hasAttributeNS('http://www.w3.org/2000/xmlns/',$nsprefix)&& |
|
328 | + ($this->myDOMNode->ownerElement->getAttributeNS('http://www.w3.org/2000/xmlns/',$nsprefix)!=$uri)) |
|
329 | + {//Remove namespace |
|
330 | + $parent=$this->myDOMNode->ownerElement; |
|
331 | + $parent->removeAttributeNode($this->myDOMNode); |
|
332 | + $parent->setAttribute($this->myDOMNode->localName,$this->myDOMNode->nodeValue); |
|
333 | + $this->myDOMNode=$parent->getAttributeNode($this->myDOMNode->localName); |
|
334 | + return; |
|
335 | + } |
|
336 | + $this->myDOMNode->ownerElement->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:'.$nsprefix,$uri); |
|
337 | + } |
|
338 | + } |
|
339 | + if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) |
|
340 | + { |
|
341 | + $parent=$this->myDOMNode->ownerElement; |
|
342 | + $parent->removeAttributeNode($this->myDOMNode); |
|
343 | + $parent->setAttributeNS($uri,$nsprefix.':'.$this->myDOMNode->localName,$this->myDOMNode->nodeValue); |
|
344 | + $this->myDOMNode=$parent->getAttributeNodeNS($uri,$this->myDOMNode->localName); |
|
345 | + } |
|
346 | + elseif ($this->myDOMNode->nodeType===XML_ELEMENT_NODE) |
|
347 | + { |
|
348 | + $NewNode=$this->myDOMNode->ownerDocument->createElementNS($uri,$nsprefix.':'.$this->myDOMNode->localName); |
|
349 | + foreach ($this->myDOMNode->attributes as $n) $NewNode->appendChild($n->cloneNode(true)); |
|
350 | + foreach ($this->myDOMNode->childNodes as $n) $NewNode->appendChild($n->cloneNode(true)); |
|
351 | + $xpath=new DOMXPath($this->myDOMNode->ownerDocument); |
|
352 | + $myDOMNodeList=$xpath->query('namespace::*[name()!="xml"]',$this->myDOMNode); //Add old namespaces |
|
353 | + foreach ($myDOMNodeList as $n) $NewNode->setAttributeNS('http://www.w3.org/2000/xmlns/',$n->nodeName,$n->nodeValue); |
|
354 | + $this->myDOMNode->parentNode->replaceChild($NewNode,$this->myDOMNode); |
|
355 | + $this->myDOMNode=$NewNode; |
|
356 | + } |
|
357 | + } |
|
358 | + function unlink_node() |
|
359 | + { |
|
360 | + if ($this->myDOMNode->parentNode!=null) |
|
361 | + { |
|
362 | + if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) $this->myDOMNode->parentNode->removeAttributeNode($this->myDOMNode); |
|
363 | + else $this->myDOMNode->parentNode->removeChild($this->myDOMNode); |
|
364 | + } |
|
365 | + } |
|
366 | + protected function _importNode($newnode) {return $this->myOwnerDocument===$newnode->myOwnerDocument ? $newnode->myDOMNode : $this->myOwnerDocument->myDOMNode->importNode($newnode->myDOMNode,true);} //To import DOMNode from another DOMDocument |
|
367 | + static function _newDOMElement($aDOMNode,$aOwnerDocument) |
|
368 | + {//Check the PHP5 DOMNode before creating a new associated PHP4 DOMNode wrapper |
|
369 | + if ($aDOMNode==null) return null; |
|
370 | + switch ($aDOMNode->nodeType) |
|
371 | + { |
|
372 | + case XML_ELEMENT_NODE: return new php4DOMElement($aDOMNode,$aOwnerDocument); |
|
373 | + case XML_TEXT_NODE: return new php4DOMText($aDOMNode,$aOwnerDocument); |
|
374 | + case XML_ATTRIBUTE_NODE: return new php4DOMAttr($aDOMNode,$aOwnerDocument); |
|
375 | + case XML_PI_NODE: return new php4DomProcessingInstruction($aDOMNode,$aOwnerDocument); |
|
376 | + default: return new php4DOMNode($aDOMNode,$aOwnerDocument); |
|
377 | + } |
|
378 | + } |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | class php4DomProcessingInstruction extends php4DOMNode |
382 | 382 | { |
383 | - function data() {return $this->myDOMNode->data;} |
|
384 | - function target() {return $this->myDOMNode->target;} |
|
383 | + function data() {return $this->myDOMNode->data;} |
|
384 | + function target() {return $this->myDOMNode->target;} |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | class php4DOMText extends php4DOMNode |
388 | 388 | { |
389 | - function __get($name) |
|
390 | - { |
|
391 | - if ($name==='tagname') return '#text'; |
|
392 | - else return parent::__get($name); |
|
393 | - } |
|
394 | - function tagname() {return '#text';} |
|
395 | - function set_content($text) {$this->myDOMNode->nodeValue=$text; return true;} |
|
389 | + function __get($name) |
|
390 | + { |
|
391 | + if ($name==='tagname') return '#text'; |
|
392 | + else return parent::__get($name); |
|
393 | + } |
|
394 | + function tagname() {return '#text';} |
|
395 | + function set_content($text) {$this->myDOMNode->nodeValue=$text; return true;} |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | if (!defined('XPATH_NODESET')) |
399 | 399 | { |
400 | - define('XPATH_UNDEFINED',0); |
|
401 | - define('XPATH_NODESET',1); |
|
402 | - define('XPATH_BOOLEAN',2); |
|
403 | - define('XPATH_NUMBER',3); |
|
404 | - define('XPATH_STRING',4); |
|
405 | - /*define('XPATH_POINT',5); |
|
400 | + define('XPATH_UNDEFINED',0); |
|
401 | + define('XPATH_NODESET',1); |
|
402 | + define('XPATH_BOOLEAN',2); |
|
403 | + define('XPATH_NUMBER',3); |
|
404 | + define('XPATH_STRING',4); |
|
405 | + /*define('XPATH_POINT',5); |
|
406 | 406 | define('XPATH_RANGE',6); |
407 | 407 | define('XPATH_LOCATIONSET',7); |
408 | 408 | define('XPATH_USERS',8); |
@@ -411,89 +411,89 @@ discard block |
||
411 | 411 | |
412 | 412 | class php4DOMNodelist |
413 | 413 | { |
414 | - private $myDOMNodelist; |
|
415 | - public $nodeset; |
|
416 | - public $type=XPATH_UNDEFINED; |
|
417 | - public $value; |
|
418 | - function php4DOMNodelist($aDOMNodelist,$aOwnerDocument) |
|
419 | - { |
|
420 | - if (!isset($aDOMNodelist)) return; |
|
421 | - elseif (is_object($aDOMNodelist)||is_array($aDOMNodelist)) |
|
422 | - { |
|
423 | - if ($aDOMNodelist->length>0) |
|
424 | - { |
|
425 | - $this->myDOMNodelist=$aDOMNodelist; |
|
426 | - $this->nodeset=array(); |
|
427 | - $this->type=XPATH_NODESET; |
|
428 | - $i=0; |
|
429 | - while ($node=$this->myDOMNodelist->item($i++)) $this->nodeset[]=php4DOMNode::_newDOMElement($node,$aOwnerDocument); |
|
430 | - } |
|
431 | - } |
|
432 | - elseif (is_int($aDOMNodelist)||is_float($aDOMNodelist)) |
|
433 | - { |
|
434 | - $this->type=XPATH_NUMBER; |
|
435 | - $this->value=$aDOMNodelist; |
|
436 | - } |
|
437 | - elseif (is_bool($aDOMNodelist)) |
|
438 | - { |
|
439 | - $this->type=XPATH_BOOLEAN; |
|
440 | - $this->value=$aDOMNodelist; |
|
441 | - } |
|
442 | - elseif (is_string($aDOMNodelist)) |
|
443 | - { |
|
444 | - $this->type=XPATH_STRING; |
|
445 | - $this->value=$aDOMNodelist; |
|
446 | - } |
|
447 | - } |
|
414 | + private $myDOMNodelist; |
|
415 | + public $nodeset; |
|
416 | + public $type=XPATH_UNDEFINED; |
|
417 | + public $value; |
|
418 | + function php4DOMNodelist($aDOMNodelist,$aOwnerDocument) |
|
419 | + { |
|
420 | + if (!isset($aDOMNodelist)) return; |
|
421 | + elseif (is_object($aDOMNodelist)||is_array($aDOMNodelist)) |
|
422 | + { |
|
423 | + if ($aDOMNodelist->length>0) |
|
424 | + { |
|
425 | + $this->myDOMNodelist=$aDOMNodelist; |
|
426 | + $this->nodeset=array(); |
|
427 | + $this->type=XPATH_NODESET; |
|
428 | + $i=0; |
|
429 | + while ($node=$this->myDOMNodelist->item($i++)) $this->nodeset[]=php4DOMNode::_newDOMElement($node,$aOwnerDocument); |
|
430 | + } |
|
431 | + } |
|
432 | + elseif (is_int($aDOMNodelist)||is_float($aDOMNodelist)) |
|
433 | + { |
|
434 | + $this->type=XPATH_NUMBER; |
|
435 | + $this->value=$aDOMNodelist; |
|
436 | + } |
|
437 | + elseif (is_bool($aDOMNodelist)) |
|
438 | + { |
|
439 | + $this->type=XPATH_BOOLEAN; |
|
440 | + $this->value=$aDOMNodelist; |
|
441 | + } |
|
442 | + elseif (is_string($aDOMNodelist)) |
|
443 | + { |
|
444 | + $this->type=XPATH_STRING; |
|
445 | + $this->value=$aDOMNodelist; |
|
446 | + } |
|
447 | + } |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | class php4DOMXPath |
451 | 451 | { |
452 | - public $myDOMXPath; |
|
453 | - private $myOwnerDocument; |
|
454 | - function php4DOMXPath($dom_document) |
|
455 | - { |
|
456 | - //TODO: If $dom_document is a DomElement, make that default $contextnode and modify XPath. Ex: '/test' |
|
457 | - $this->myOwnerDocument=$dom_document->myOwnerDocument; |
|
458 | - $this->myDOMXPath=new DOMXPath($this->myOwnerDocument->myDOMNode); |
|
459 | - } |
|
460 | - function xpath_eval($eval_str,$contextnode=null) |
|
461 | - { |
|
462 | - if (method_exists($this->myDOMXPath,'evaluate')) $xp=isset($contextnode) ? $this->myDOMXPath->evaluate($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->evaluate($eval_str); |
|
463 | - else $xp=isset($contextnode) ? $this->myDOMXPath->query($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->query($eval_str); |
|
464 | - $xp=new php4DOMNodelist($xp,$this->myOwnerDocument); |
|
465 | - return ($xp->type===XPATH_UNDEFINED) ? false : $xp; |
|
466 | - } |
|
467 | - function xpath_register_ns($prefix,$namespaceURI) {return $this->myDOMXPath->registerNamespace($prefix,$namespaceURI);} |
|
452 | + public $myDOMXPath; |
|
453 | + private $myOwnerDocument; |
|
454 | + function php4DOMXPath($dom_document) |
|
455 | + { |
|
456 | + //TODO: If $dom_document is a DomElement, make that default $contextnode and modify XPath. Ex: '/test' |
|
457 | + $this->myOwnerDocument=$dom_document->myOwnerDocument; |
|
458 | + $this->myDOMXPath=new DOMXPath($this->myOwnerDocument->myDOMNode); |
|
459 | + } |
|
460 | + function xpath_eval($eval_str,$contextnode=null) |
|
461 | + { |
|
462 | + if (method_exists($this->myDOMXPath,'evaluate')) $xp=isset($contextnode) ? $this->myDOMXPath->evaluate($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->evaluate($eval_str); |
|
463 | + else $xp=isset($contextnode) ? $this->myDOMXPath->query($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->query($eval_str); |
|
464 | + $xp=new php4DOMNodelist($xp,$this->myOwnerDocument); |
|
465 | + return ($xp->type===XPATH_UNDEFINED) ? false : $xp; |
|
466 | + } |
|
467 | + function xpath_register_ns($prefix,$namespaceURI) {return $this->myDOMXPath->registerNamespace($prefix,$namespaceURI);} |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | if (extension_loaded('xsl')) |
471 | 471 | {//See also: http://alexandre.alapetite.net/doc-alex/xslt-php4-php5/ |
472 | - function domxml_xslt_stylesheet($xslstring) {return new php4DomXsltStylesheet(DOMDocument::loadXML($xslstring));} |
|
473 | - function domxml_xslt_stylesheet_doc($dom_document) {return new php4DomXsltStylesheet($dom_document);} |
|
474 | - function domxml_xslt_stylesheet_file($xslfile) {return new php4DomXsltStylesheet(DOMDocument::load($xslfile));} |
|
475 | - class php4DomXsltStylesheet |
|
476 | - { |
|
477 | - private $myxsltProcessor; |
|
478 | - function php4DomXsltStylesheet($dom_document) |
|
479 | - { |
|
480 | - $this->myxsltProcessor=new xsltProcessor(); |
|
481 | - $this->myxsltProcessor->importStyleSheet($dom_document); |
|
482 | - } |
|
483 | - function process($dom_document,$xslt_parameters=array(),$param_is_xpath=false) |
|
484 | - { |
|
485 | - foreach ($xslt_parameters as $param=>$value) $this->myxsltProcessor->setParameter('',$param,$value); |
|
486 | - $myphp4DOMDocument=new php4DOMDocument(); |
|
487 | - $myphp4DOMDocument->myDOMNode=$this->myxsltProcessor->transformToDoc($dom_document->myDOMNode); |
|
488 | - return $myphp4DOMDocument; |
|
489 | - } |
|
490 | - function result_dump_file($dom_document,$filename) |
|
491 | - { |
|
492 | - $html=$dom_document->myDOMNode->saveHTML(); |
|
493 | - file_put_contents($filename,$html); |
|
494 | - return $html; |
|
495 | - } |
|
496 | - function result_dump_mem($dom_document) {return $dom_document->myDOMNode->saveHTML();} |
|
497 | - } |
|
472 | + function domxml_xslt_stylesheet($xslstring) {return new php4DomXsltStylesheet(DOMDocument::loadXML($xslstring));} |
|
473 | + function domxml_xslt_stylesheet_doc($dom_document) {return new php4DomXsltStylesheet($dom_document);} |
|
474 | + function domxml_xslt_stylesheet_file($xslfile) {return new php4DomXsltStylesheet(DOMDocument::load($xslfile));} |
|
475 | + class php4DomXsltStylesheet |
|
476 | + { |
|
477 | + private $myxsltProcessor; |
|
478 | + function php4DomXsltStylesheet($dom_document) |
|
479 | + { |
|
480 | + $this->myxsltProcessor=new xsltProcessor(); |
|
481 | + $this->myxsltProcessor->importStyleSheet($dom_document); |
|
482 | + } |
|
483 | + function process($dom_document,$xslt_parameters=array(),$param_is_xpath=false) |
|
484 | + { |
|
485 | + foreach ($xslt_parameters as $param=>$value) $this->myxsltProcessor->setParameter('',$param,$value); |
|
486 | + $myphp4DOMDocument=new php4DOMDocument(); |
|
487 | + $myphp4DOMDocument->myDOMNode=$this->myxsltProcessor->transformToDoc($dom_document->myDOMNode); |
|
488 | + return $myphp4DOMDocument; |
|
489 | + } |
|
490 | + function result_dump_file($dom_document,$filename) |
|
491 | + { |
|
492 | + $html=$dom_document->myDOMNode->saveHTML(); |
|
493 | + file_put_contents($filename,$html); |
|
494 | + return $html; |
|
495 | + } |
|
496 | + function result_dump_mem($dom_document) {return $dom_document->myDOMNode->saveHTML();} |
|
497 | + } |
|
498 | 498 | } |
499 | 499 | ?> |