@@ -124,7 +124,7 @@ |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | - * @param $variable |
|
127 | + * @param string $variable |
|
128 | 128 | * @return mixed |
129 | 129 | */ |
130 | 130 | public function getConfigurationValue($variable) |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | * display the edit and delete icons in the sortable table |
908 | 908 | * |
909 | 909 | * @param integer $id the id of the template |
910 | - * @return html code for the link to edit and delete the template |
|
910 | + * @return string code for the link to edit and delete the template |
|
911 | 911 | * |
912 | 912 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
913 | 913 | * @version August 2008 |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | * Display the image of the template in the sortable table |
924 | 924 | * |
925 | 925 | * @param string $image the image |
926 | - * @return html code for the image |
|
926 | + * @return string code for the image |
|
927 | 927 | * |
928 | 928 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
929 | 929 | * @version August 2008 |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | /** |
1121 | 1121 | * Returns an array containing the list of options used to populate the gradebook_number_decimals variable |
1122 | 1122 | * This function is called through a call_user_func() in the generate_settings_form function. |
1123 | - * @return array List of gradebook_number_decimals options |
|
1123 | + * @return string[] List of gradebook_number_decimals options |
|
1124 | 1124 | * |
1125 | 1125 | * @author Guillaume Viguier <[email protected]> |
1126 | 1126 | */ |
@@ -471,8 +471,9 @@ discard block |
||
471 | 471 | $extraction_path = $cssToUpload.$style_name.'/'; |
472 | 472 | for ($i = 0; $i < $num_files; $i++) { |
473 | 473 | $entry = $zip->getNameIndex($i); |
474 | - if (substr($entry, -1) == '/') |
|
475 | - continue; |
|
474 | + if (substr($entry, -1) == '/') { |
|
475 | + continue; |
|
476 | + } |
|
476 | 477 | |
477 | 478 | $pos_slash = strpos($entry, '/'); |
478 | 479 | $entry_without_first_dir = substr($entry, $pos_slash + 1); |
@@ -1231,17 +1232,21 @@ discard block |
||
1231 | 1232 | $hideme = array('disabled'); |
1232 | 1233 | } elseif ($url_info['active'] == 1) { |
1233 | 1234 | // We show the elements. |
1234 | - if (empty($row['variable'])) |
|
1235 | - $row['variable'] = 0; |
|
1236 | - if (empty($row['subkey'])) |
|
1237 | - $row['subkey'] = 0; |
|
1238 | - if (empty($row['category'])) |
|
1239 | - $row['category'] = 0; |
|
1235 | + if (empty($row['variable'])) { |
|
1236 | + $row['variable'] = 0; |
|
1237 | + } |
|
1238 | + if (empty($row['subkey'])) { |
|
1239 | + $row['subkey'] = 0; |
|
1240 | + } |
|
1241 | + if (empty($row['category'])) { |
|
1242 | + $row['category'] = 0; |
|
1243 | + } |
|
1240 | 1244 | |
1241 | 1245 | if (is_array($settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ])) { |
1242 | 1246 | // We are sure that the other site have a selected value. |
1243 | - if ($settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ]['selected_value'] != '') |
|
1244 | - $row['selected_value'] = $settings_by_access_list[$row['variable']] [$row['subkey']] [$row['category']]['selected_value']; |
|
1247 | + if ($settings_by_access_list[ $row['variable'] ] [ $row['subkey'] ] [ $row['category'] ]['selected_value'] != '') { |
|
1248 | + $row['selected_value'] = $settings_by_access_list[$row['variable']] [$row['subkey']] [$row['category']]['selected_value']; |
|
1249 | + } |
|
1245 | 1250 | } |
1246 | 1251 | // There is no else{} statement because we load the default $row['selected_value'] of the main Chamilo site. |
1247 | 1252 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * @param string ISO code (fr_FR, ...) |
29 | 29 | * @param int Whether the sublanguage is published (0=unpublished, 1=published) |
30 | 30 | * @param int ID del idioma padre |
31 | - * @return int New sub language ID or false on error |
|
31 | + * @return false|string New sub language ID or false on error |
|
32 | 32 | */ |
33 | 33 | function add_sub_language ($original_name,$english_name,$isocode,$sublanguage_available,$parent_id) { |
34 | 34 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
@@ -128,7 +128,7 @@ |
||
128 | 128 | /** |
129 | 129 | * Update users from the imported data |
130 | 130 | * @param array $users List of users |
131 | - * @return void |
|
131 | + * @return false|null |
|
132 | 132 | * @uses global variable $inserted_in_course, which returns the list of courses the user was inserted in |
133 | 133 | */ |
134 | 134 |
@@ -454,7 +454,10 @@ |
||
454 | 454 | <blockquote> |
455 | 455 | <pre> |
456 | 456 | <b>UserName</b>;LastName;FirstName;Email;NewUserName;Password;AuthSource;OfficialCode;PhoneNumber;Status;ExpiryDate;Active;Language;Courses;ClassId; |
457 | - xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;user/teacher/drh;0000-00-00 00:00:00;0/1;xxx;<span style="color:red;"><?php if (count($list_reponse) > 0) echo implode(';', $list_reponse).';'; ?></span>xxx1|xxx2|xxx3;1;<br /> |
|
457 | + xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;user/teacher/drh;0000-00-00 00:00:00;0/1;xxx;<span style="color:red;"><?php if (count($list_reponse) > 0) { |
|
458 | + echo implode(';', $list_reponse).';'; |
|
459 | +} |
|
460 | +?></span>xxx1|xxx2|xxx3;1;<br /> |
|
458 | 461 | </pre> |
459 | 462 | </blockquote> |
460 | 463 | <p><?php |
@@ -206,7 +206,7 @@ |
||
206 | 206 | |
207 | 207 | /** |
208 | 208 | * Restores an attendance entry and fallback to attendances rendering |
209 | - * @param int $attendanceId |
|
209 | + * @param int $attendance_id |
|
210 | 210 | */ |
211 | 211 | public function attendance_restore($attendance_id) |
212 | 212 | { |
@@ -529,10 +529,11 @@ |
||
529 | 529 | $result['full_name'] = api_get_person_name($user['firstname'], $user['lastname']); |
530 | 530 | foreach ($data_array['attendant_calendar'] as $class_day) { |
531 | 531 | if ($class_day['done_attendance'] == 1) { |
532 | - if ($data_users_presence[$user['user_id']][$class_day['id']]['presence'] == 1) |
|
533 | - $result[$class_day['id']] = get_lang('UserAttendedSymbol'); |
|
534 | - else |
|
535 | - $result[$class_day['id']] = '<span style="color:red">'.get_lang('UserNotAttendedSymbol').'</span>'; |
|
532 | + if ($data_users_presence[$user['user_id']][$class_day['id']]['presence'] == 1) { |
|
533 | + $result[$class_day['id']] = get_lang('UserAttendedSymbol'); |
|
534 | + } else { |
|
535 | + $result[$class_day['id']] = '<span style="color:red">'.get_lang('UserNotAttendedSymbol').'</span>'; |
|
536 | + } |
|
536 | 537 | } else { |
537 | 538 | $result[$class_day['id']] = " "; |
538 | 539 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | require_once api_get_path(SYS_PATH).'main/auth/external_login/functions.inc.php'; |
11 | 11 | |
12 | 12 | /** |
13 | -* @return true if cas is configured |
|
13 | +* @return boolean if cas is configured |
|
14 | 14 | * |
15 | 15 | **/ |
16 | 16 | function cas_configured() { |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | /** |
517 | 517 | * Logs a string in debug mode. |
518 | 518 | * |
519 | - * @param $str the string to write |
|
519 | + * @param string $str the string to write |
|
520 | 520 | * |
521 | 521 | * @private |
522 | 522 | */ |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | * This method is used by interface methods to print an error and where the function |
538 | 538 | * was originally called from. |
539 | 539 | * |
540 | - * @param $msg the message to print |
|
540 | + * @param string $msg the message to print |
|
541 | 541 | * |
542 | 542 | * @private |
543 | 543 | */ |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | /** |
665 | 665 | * This method returns the phpCAS version. |
666 | 666 | * |
667 | - * @return the phpCAS version. |
|
667 | + * @return string phpCAS version. |
|
668 | 668 | */ |
669 | 669 | function getVersion() { |
670 | 670 | return PHPCAS_VERSION; |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | * @warning should not be called only after phpCAS::forceAuthentication() |
1071 | 1071 | * or phpCAS::checkAuthentication(). |
1072 | 1072 | * |
1073 | - * @return the login name of the authenticated user |
|
1073 | + * @return string login name of the authenticated user |
|
1074 | 1074 | */ |
1075 | 1075 | function getUser() { |
1076 | 1076 | global $PHPCAS_CLIENT, $PHPCAS_AUTH_CHECK_CALL; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * |
75 | 75 | * Used by CASClient::PrintHTMLHeader() and CASClient::printHTMLFooter(). |
76 | 76 | * |
77 | - * @param $str the string to filter and output |
|
77 | + * @param string $str the string to filter and output |
|
78 | 78 | * |
79 | 79 | * @private |
80 | 80 | */ |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | /** |
188 | 188 | * This method returns the language used by phpCAS. |
189 | 189 | * |
190 | - * @return a string representing the language |
|
190 | + * @return string string representing the language |
|
191 | 191 | * |
192 | 192 | * @private |
193 | 193 | */ |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | /** |
213 | 213 | * This method returns a string depending on the language. |
214 | 214 | * |
215 | - * @param $str the index of the string in $_string. |
|
215 | + * @param integer $str the index of the string in $_string. |
|
216 | 216 | * |
217 | 217 | * @return the string corresponding to $index in $string. |
218 | 218 | * |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * This method is used to set the language used by phpCAS. |
234 | 234 | * @note Can be called only once. |
235 | 235 | * |
236 | - * @param $lang a string representing the language. |
|
236 | + * @param string $lang a string representing the language. |
|
237 | 237 | * |
238 | 238 | * @public |
239 | 239 | * @sa CAS_LANG_FRENCH, CAS_LANG_ENGLISH |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | /** |
422 | 422 | * This method is used to retrieve the service validating URL of the CAS server. |
423 | - * @return a URL. |
|
423 | + * @return string URL. |
|
424 | 424 | * @private |
425 | 425 | */ |
426 | 426 | function getServerServiceValidateURL() |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | } |
442 | 442 | /** |
443 | 443 | * This method is used to retrieve the SAML validating URL of the CAS server. |
444 | - * @return a URL. |
|
444 | + * @return string URL. |
|
445 | 445 | * @private |
446 | 446 | */ |
447 | 447 | function getServerSamlValidateURL() |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | } |
461 | 461 | /** |
462 | 462 | * This method is used to retrieve the proxy validating URL of the CAS server. |
463 | - * @return a URL. |
|
463 | + * @return string URL. |
|
464 | 464 | * @private |
465 | 465 | */ |
466 | 466 | function getServerProxyValidateURL() |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | |
542 | 542 | /** |
543 | 543 | * This method checks to see if the request is secured via HTTPS |
544 | - * @return true if https, false otherwise |
|
544 | + * @return boolean if https, false otherwise |
|
545 | 545 | * @private |
546 | 546 | */ |
547 | 547 | function isHttps() { |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | * CASClient constructor. |
562 | 562 | * |
563 | 563 | * @param $server_version the version of the CAS server |
564 | - * @param $proxy TRUE if the CAS client is a CAS proxy, FALSE otherwise |
|
564 | + * @param boolean $proxy TRUE if the CAS client is a CAS proxy, FALSE otherwise |
|
565 | 565 | * @param $server_hostname the hostname of the CAS server |
566 | 566 | * @param $server_port the port the CAS server is running on |
567 | 567 | * @param $server_uri the URI the CAS server is responding on |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | * @warning should be called only after CASClient::forceAuthentication() or |
760 | 760 | * CASClient::isAuthenticated(), otherwise halt with an error. |
761 | 761 | * |
762 | - * @return the login name of the authenticated user |
|
762 | + * @return string login name of the authenticated user |
|
763 | 763 | */ |
764 | 764 | function getUser() |
765 | 765 | { |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | /** |
832 | 832 | * This method is called to be sure that the user is authenticated. When not |
833 | 833 | * authenticated, halt by redirecting to the CAS server; otherwise return TRUE. |
834 | - * @return TRUE when the user is authenticated; otherwise halt. |
|
834 | + * @return boolean when the user is authenticated; otherwise halt. |
|
835 | 835 | * @public |
836 | 836 | */ |
837 | 837 | function forceAuthentication() |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | |
878 | 878 | /** |
879 | 879 | * This method is called to check whether the user is authenticated or not. |
880 | - * @return TRUE when the user is authenticated, FALSE otherwise. |
|
880 | + * @return boolean when the user is authenticated, FALSE otherwise. |
|
881 | 881 | * @public |
882 | 882 | */ |
883 | 883 | function checkAuthentication() |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | * This method is called to check if the user is authenticated (previously or by |
934 | 934 | * tickets given in the URL). |
935 | 935 | * |
936 | - * @return TRUE when the user is authenticated. Also may redirect to the same URL without the ticket. |
|
936 | + * @return boolean when the user is authenticated. Also may redirect to the same URL without the ticket. |
|
937 | 937 | * |
938 | 938 | * @public |
939 | 939 | */ |
@@ -1003,7 +1003,7 @@ discard block |
||
1003 | 1003 | |
1004 | 1004 | /** |
1005 | 1005 | * This method tells if the current session is authenticated. |
1006 | - * @return true if authenticated based soley on $_SESSION variable |
|
1006 | + * @return boolean if authenticated based soley on $_SESSION variable |
|
1007 | 1007 | * @since 0.4.22 by Brendan Arnold |
1008 | 1008 | */ |
1009 | 1009 | function isSessionAuthenticated () |
@@ -1017,7 +1017,7 @@ discard block |
||
1017 | 1017 | * |
1018 | 1018 | * @note This function switches to callback mode when needed. |
1019 | 1019 | * |
1020 | - * @return TRUE when the user has already been authenticated; FALSE otherwise. |
|
1020 | + * @return boolean when the user has already been authenticated; FALSE otherwise. |
|
1021 | 1021 | * |
1022 | 1022 | * @private |
1023 | 1023 | */ |
@@ -1129,7 +1129,7 @@ discard block |
||
1129 | 1129 | } |
1130 | 1130 | |
1131 | 1131 | /** |
1132 | - * @return true if the current request is a logout request. |
|
1132 | + * @return boolean if the current request is a logout request. |
|
1133 | 1133 | * @private |
1134 | 1134 | */ |
1135 | 1135 | function isLogoutRequest() { |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | |
1242 | 1242 | /** |
1243 | 1243 | * This method returns the Service Ticket provided in the URL of the request. |
1244 | - * @return The service ticket. |
|
1244 | + * @return string service ticket. |
|
1245 | 1245 | * @private |
1246 | 1246 | */ |
1247 | 1247 | function getST() |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | |
1258 | 1258 | /** |
1259 | 1259 | * This method tells if a Service Ticket was stored. |
1260 | - * @return TRUE if a Service Ticket has been stored. |
|
1260 | + * @return boolean if a Service Ticket has been stored. |
|
1261 | 1261 | * @private |
1262 | 1262 | */ |
1263 | 1263 | function hasST() |
@@ -1330,7 +1330,7 @@ discard block |
||
1330 | 1330 | * $text_reponse and $tree_response on success. These parameters are used later |
1331 | 1331 | * by CASClient::validatePGT() for CAS proxies. |
1332 | 1332 | * Used for all CAS 1.0 validations |
1333 | - * @param $validate_url the URL of the request to the CAS server. |
|
1333 | + * @param string $validate_url the URL of the request to the CAS server. |
|
1334 | 1334 | * @param $text_response the response of the CAS server, as is (XML text). |
1335 | 1335 | * @param $tree_response the response of the CAS server, as a DOM XML tree. |
1336 | 1336 | * |
@@ -1460,7 +1460,7 @@ discard block |
||
1460 | 1460 | * $text_reponse and $tree_response on success. These parameters are used later |
1461 | 1461 | * by CASClient::validatePGT() for CAS proxies. |
1462 | 1462 | * |
1463 | - * @param $validate_url the URL of the request to the CAS server. |
|
1463 | + * @param string $validate_url the URL of the request to the CAS server. |
|
1464 | 1464 | * @param $text_response the response of the CAS server, as is (XML text). |
1465 | 1465 | * @param $tree_response the response of the CAS server, as a DOM XML tree. |
1466 | 1466 | * |
@@ -1648,7 +1648,7 @@ discard block |
||
1648 | 1648 | |
1649 | 1649 | /** |
1650 | 1650 | * This method returns the Proxy Granting Ticket given by the CAS server. |
1651 | - * @return The Proxy Granting Ticket. |
|
1651 | + * @return string Proxy Granting Ticket. |
|
1652 | 1652 | * @private |
1653 | 1653 | */ |
1654 | 1654 | function getPGT() |
@@ -1664,7 +1664,7 @@ discard block |
||
1664 | 1664 | |
1665 | 1665 | /** |
1666 | 1666 | * This method tells if a Proxy Granting Ticket was stored. |
1667 | - * @return TRUE if a Proxy Granting Ticket has been stored. |
|
1667 | + * @return boolean if a Proxy Granting Ticket has been stored. |
|
1668 | 1668 | * @private |
1669 | 1669 | */ |
1670 | 1670 | function hasPGT() |
@@ -1697,7 +1697,7 @@ discard block |
||
1697 | 1697 | /** |
1698 | 1698 | * This method sets/unsets callback mode. |
1699 | 1699 | * |
1700 | - * @param $callback_mode TRUE to set callback mode, FALSE otherwise. |
|
1700 | + * @param boolean $callback_mode TRUE to set callback mode, FALSE otherwise. |
|
1701 | 1701 | * |
1702 | 1702 | * @private |
1703 | 1703 | */ |
@@ -1710,7 +1710,7 @@ discard block |
||
1710 | 1710 | * This method returns TRUE when the CAs client is running i callback mode, |
1711 | 1711 | * FALSE otherwise. |
1712 | 1712 | * |
1713 | - * @return A boolean. |
|
1713 | + * @return boolean boolean. |
|
1714 | 1714 | * |
1715 | 1715 | * @private |
1716 | 1716 | */ |
@@ -1734,7 +1734,7 @@ discard block |
||
1734 | 1734 | * fact the URL of the current request without any CGI parameter, except if |
1735 | 1735 | * phpCAS::setFixedCallbackURL() was used). |
1736 | 1736 | * |
1737 | - * @return The callback URL |
|
1737 | + * @return string callback URL |
|
1738 | 1738 | * |
1739 | 1739 | * @private |
1740 | 1740 | */ |
@@ -1777,6 +1777,7 @@ discard block |
||
1777 | 1777 | * This method sets the callback url. |
1778 | 1778 | * |
1779 | 1779 | * @param $callback_url url to set callback |
1780 | + * @param string $url |
|
1780 | 1781 | * |
1781 | 1782 | * @private |
1782 | 1783 | */ |
@@ -1861,7 +1862,7 @@ discard block |
||
1861 | 1862 | /** |
1862 | 1863 | * This method reads a PGT from its Iou and deletes the corresponding storage entry. |
1863 | 1864 | * |
1864 | - * @param $pgt_iou the PGT Iou |
|
1865 | + * @param string $pgt_iou the PGT Iou |
|
1865 | 1866 | * |
1866 | 1867 | * @return The PGT corresponding to the Iou, FALSE when not found. |
1867 | 1868 | * |
@@ -1991,7 +1992,7 @@ discard block |
||
1991 | 1992 | * @param $err_code an error code (PHPCAS_SERVICE_OK on success). |
1992 | 1993 | * @param $err_msg an error message (empty on success). |
1993 | 1994 | * |
1994 | - * @return a Proxy Ticket, or FALSE on error. |
|
1995 | + * @return false|string Proxy Ticket, or FALSE on error. |
|
1995 | 1996 | * |
1996 | 1997 | * @private |
1997 | 1998 | */ |
@@ -2093,14 +2094,14 @@ discard block |
||
2093 | 2094 | /** |
2094 | 2095 | * This method is used to acces a remote URL. |
2095 | 2096 | * |
2096 | - * @param $url the URL to access. |
|
2097 | + * @param string $url the URL to access. |
|
2097 | 2098 | * @param $cookies an array containing cookies strings such as 'name=val' |
2098 | 2099 | * @param $headers an array containing the HTTP header lines of the response |
2099 | 2100 | * (an empty array on failure). |
2100 | 2101 | * @param $body the body of the response, as a string (empty on failure). |
2101 | 2102 | * @param $err_msg an error message, filled on failure. |
2102 | 2103 | * |
2103 | - * @return TRUE on success, FALSE otherwise (in this later case, $err_msg |
|
2104 | + * @return boolean on success, FALSE otherwise (in this later case, $err_msg |
|
2104 | 2105 | * contains an error message). |
2105 | 2106 | * |
2106 | 2107 | * @private |
@@ -2197,7 +2198,7 @@ discard block |
||
2197 | 2198 | /** |
2198 | 2199 | * This method is used to build the SAML POST body sent to /samlValidate URL. |
2199 | 2200 | * |
2200 | - * @return the SOAP-encased SAMLP artifact (the ticket). |
|
2201 | + * @return string SOAP-encased SAMLP artifact (the ticket). |
|
2201 | 2202 | * |
2202 | 2203 | * @private |
2203 | 2204 | */ |
@@ -2235,7 +2236,7 @@ discard block |
||
2235 | 2236 | * @param $output the output of the service (also used to give an error |
2236 | 2237 | * message on failure). |
2237 | 2238 | * |
2238 | - * @return TRUE on success, FALSE otherwise (in this later case, $err_code |
|
2239 | + * @return boolean on success, FALSE otherwise (in this later case, $err_code |
|
2239 | 2240 | * gives the reason why it failed and $output contains an error message). |
2240 | 2241 | * |
2241 | 2242 | * @public |
@@ -2382,7 +2383,7 @@ discard block |
||
2382 | 2383 | |
2383 | 2384 | /** |
2384 | 2385 | * This method returns the Proxy Ticket provided in the URL of the request. |
2385 | - * @return The proxy ticket. |
|
2386 | + * @return string proxy ticket. |
|
2386 | 2387 | * @private |
2387 | 2388 | */ |
2388 | 2389 | function getPT() |
@@ -2401,14 +2402,14 @@ discard block |
||
2401 | 2402 | |
2402 | 2403 | /** |
2403 | 2404 | * This method tells if a Proxy Ticket was stored. |
2404 | - * @return TRUE if a Proxy Ticket has been stored. |
|
2405 | + * @return boolean if a Proxy Ticket has been stored. |
|
2405 | 2406 | * @private |
2406 | 2407 | */ |
2407 | 2408 | function hasPT() |
2408 | 2409 | { return !empty($this->_pt); } |
2409 | 2410 | /** |
2410 | 2411 | * This method returns the SAML Ticket provided in the URL of the request. |
2411 | - * @return The SAML ticket. |
|
2412 | + * @return string SAML ticket. |
|
2412 | 2413 | * @private |
2413 | 2414 | */ |
2414 | 2415 | function getSA() |
@@ -2424,7 +2425,7 @@ discard block |
||
2424 | 2425 | |
2425 | 2426 | /** |
2426 | 2427 | * This method tells if a SAML Ticket was stored. |
2427 | - * @return TRUE if a SAML Ticket has been stored. |
|
2428 | + * @return boolean if a SAML Ticket has been stored. |
|
2428 | 2429 | * @private |
2429 | 2430 | */ |
2430 | 2431 | function hasSA() |
@@ -2442,6 +2443,7 @@ discard block |
||
2442 | 2443 | /** |
2443 | 2444 | * This method is used to validate a ST or PT; halt on failure |
2444 | 2445 | * Used for all CAS 2.0 validations |
2446 | + * @param string $validate_url |
|
2445 | 2447 | * @return bool TRUE when successfull, halt otherwise by calling CASClient::authError(). |
2446 | 2448 | * |
2447 | 2449 | * @private |
@@ -2556,7 +2558,7 @@ discard block |
||
2556 | 2558 | * This method returns the URL of the current request (without any ticket |
2557 | 2559 | * CGI parameter). |
2558 | 2560 | * |
2559 | - * @return The URL |
|
2561 | + * @return string URL |
|
2560 | 2562 | * |
2561 | 2563 | * @private |
2562 | 2564 | */ |
@@ -2634,7 +2636,7 @@ discard block |
||
2634 | 2636 | /** |
2635 | 2637 | * This method sets the URL of the current request |
2636 | 2638 | * |
2637 | - * @param $url url to set for service |
|
2639 | + * @param string $url url to set for service |
|
2638 | 2640 | * |
2639 | 2641 | * @private |
2640 | 2642 | */ |
@@ -2649,9 +2651,9 @@ discard block |
||
2649 | 2651 | /** |
2650 | 2652 | * This method is used to print the HTML output when the user was not authenticated. |
2651 | 2653 | * |
2652 | - * @param $failure the failure that occured |
|
2654 | + * @param string $failure the failure that occured |
|
2653 | 2655 | * @param $cas_url the URL the CAS server was asked for |
2654 | - * @param $no_response the response from the CAS server (other |
|
2656 | + * @param boolean $no_response the response from the CAS server (other |
|
2655 | 2657 | * parameters are ignored if TRUE) |
2656 | 2658 | * @param $bad_response bad response from the CAS server ($err_code |
2657 | 2659 | * and $err_msg ignored if TRUE) |
@@ -193,8 +193,9 @@ discard block |
||
193 | 193 | */ |
194 | 194 | function getLang() |
195 | 195 | { |
196 | - if ( empty($this->_lang) ) |
|
197 | - $this->setLang(PHPCAS_LANG_DEFAULT); |
|
196 | + if ( empty($this->_lang) ) { |
|
197 | + $this->setLang(PHPCAS_LANG_DEFAULT); |
|
198 | + } |
|
198 | 199 | return $this->_lang; |
199 | 200 | } |
200 | 201 | |
@@ -596,14 +597,14 @@ discard block |
||
596 | 597 | phpCAS::trace("No session found, creating new session"); |
597 | 598 | session_start(); |
598 | 599 | } |
599 | - }else{ |
|
600 | + } else{ |
|
600 | 601 | phpCAS::trace("Ticket found"); |
601 | 602 | // We have to copy any old data before renaming the session |
602 | 603 | if (session_id()) { |
603 | 604 | phpCAS::trace("Old active session found, saving old data and destroying session"); |
604 | 605 | $old_session = $_SESSION; |
605 | 606 | session_destroy(); |
606 | - }else{ |
|
607 | + } else{ |
|
607 | 608 | session_start(); |
608 | 609 | phpCAS::trace("Starting possible old session to copy variables"); |
609 | 610 | $old_session = $_SESSION; |
@@ -620,7 +621,7 @@ discard block |
||
620 | 621 | $_SESSION = $old_session; |
621 | 622 | } |
622 | 623 | } |
623 | - }else{ |
|
624 | + } else{ |
|
624 | 625 | phpCAS::trace("Skipping session creation"); |
625 | 626 | } |
626 | 627 | |
@@ -631,9 +632,10 @@ discard block |
||
631 | 632 | //check version |
632 | 633 | switch ($server_version) { |
633 | 634 | case CAS_VERSION_1_0: |
634 | - if ( $this->isProxy() ) |
|
635 | - phpCAS::error('CAS proxies are not supported in CAS ' |
|
635 | + if ( $this->isProxy() ) { |
|
636 | + phpCAS::error('CAS proxies are not supported in CAS ' |
|
636 | 637 | .$server_version); |
638 | + } |
|
637 | 639 | break; |
638 | 640 | case CAS_VERSION_2_0: |
639 | 641 | break; |
@@ -817,8 +819,9 @@ discard block |
||
817 | 819 | function renewAuthentication(){ |
818 | 820 | phpCAS::traceBegin(); |
819 | 821 | // Either way, the user is authenticated by CAS |
820 | - if( isset( $_SESSION['phpCAS']['auth_checked'] ) ) |
|
821 | - unset($_SESSION['phpCAS']['auth_checked']); |
|
822 | + if( isset( $_SESSION['phpCAS']['auth_checked'] ) ) { |
|
823 | + unset($_SESSION['phpCAS']['auth_checked']); |
|
824 | + } |
|
822 | 825 | if ( $this->isAuthenticated() ) { |
823 | 826 | phpCAS::trace('user already authenticated; renew'); |
824 | 827 | $this->redirectToCas(false,true); |
@@ -897,8 +900,10 @@ discard block |
||
897 | 900 | // // never reached |
898 | 901 | // $res = FALSE; |
899 | 902 | // avoid a check against CAS on every request |
900 | - if (! isset($_SESSION['phpCAS']['unauth_count']) ) |
|
901 | - $_SESSION['phpCAS']['unauth_count'] = -2; // uninitialized |
|
903 | + if (! isset($_SESSION['phpCAS']['unauth_count']) ) { |
|
904 | + $_SESSION['phpCAS']['unauth_count'] = -2; |
|
905 | + } |
|
906 | + // uninitialized |
|
902 | 907 | |
903 | 908 | if (($_SESSION['phpCAS']['unauth_count'] != -2 && $this->_cache_times_for_auth_recheck == -1) |
904 | 909 | || ($_SESSION['phpCAS']['unauth_count'] >= 0 && $_SESSION['phpCAS']['unauth_count'] < $this->_cache_times_for_auth_recheck)) |
@@ -909,13 +914,11 @@ discard block |
||
909 | 914 | { |
910 | 915 | $_SESSION['phpCAS']['unauth_count']++; |
911 | 916 | phpCAS::trace('user is not authenticated (cached for '.$_SESSION['phpCAS']['unauth_count'].' times of '.$this->_cache_times_for_auth_recheck.')'); |
912 | - } |
|
913 | - else |
|
917 | + } else |
|
914 | 918 | { |
915 | 919 | phpCAS::trace('user is not authenticated (cached for until login pressed)'); |
916 | 920 | } |
917 | - } |
|
918 | - else |
|
921 | + } else |
|
919 | 922 | { |
920 | 923 | $_SESSION['phpCAS']['unauth_count'] = 0; |
921 | 924 | $_SESSION['phpCAS']['auth_checked'] = true; |
@@ -948,8 +951,7 @@ discard block |
||
948 | 951 | // authenticated, nothing to be done. |
949 | 952 | phpCAS::trace('user was already authenticated, no need to look for tickets'); |
950 | 953 | $res = TRUE; |
951 | - } |
|
952 | - else { |
|
954 | + } else { |
|
953 | 955 | if ( $this->hasST() ) { |
954 | 956 | // if a Service Ticket was given, validate it |
955 | 957 | phpCAS::trace('ST `'.$this->getST().'\' is present'); |
@@ -962,8 +964,7 @@ discard block |
||
962 | 964 | } |
963 | 965 | $_SESSION['phpCAS']['user'] = $this->getUser(); |
964 | 966 | $res = TRUE; |
965 | - } |
|
966 | - elseif ( $this->hasPT() ) { |
|
967 | + } elseif ( $this->hasPT() ) { |
|
967 | 968 | // if a Proxy Ticket was given, validate it |
968 | 969 | phpCAS::trace('PT `'.$this->getPT().'\' is present'); |
969 | 970 | $this->validatePT($validate_url,$text_response,$tree_response); // note: if it fails, it halts |
@@ -975,8 +976,7 @@ discard block |
||
975 | 976 | } |
976 | 977 | $_SESSION['phpCAS']['user'] = $this->getUser(); |
977 | 978 | $res = TRUE; |
978 | - } |
|
979 | - elseif ( $this->hasSA() ) { |
|
979 | + } elseif ( $this->hasSA() ) { |
|
980 | 980 | // if we have a SAML ticket, validate it. |
981 | 981 | phpCAS::trace('SA `'.$this->getSA().'\' is present'); |
982 | 982 | $this->validateSA($validate_url,$text_response,$tree_response); // if it fails, it halts |
@@ -984,8 +984,7 @@ discard block |
||
984 | 984 | $_SESSION['phpCAS']['user'] = $this->getUser(); |
985 | 985 | $_SESSION['phpCAS']['attributes'] = $this->getAttributes(); |
986 | 986 | $res = TRUE; |
987 | - } |
|
988 | - else { |
|
987 | + } else { |
|
989 | 988 | // no ticket given, not authenticated |
990 | 989 | phpCAS::trace('no ticket found'); |
991 | 990 | } |
@@ -1581,8 +1580,7 @@ discard block |
||
1581 | 1580 | foreach($attr_array as $attr_key => $attr_value) { |
1582 | 1581 | if(count($attr_value) > 1) { |
1583 | 1582 | $this->_attributes[$attr_key] = $attr_value; |
1584 | - } |
|
1585 | - else { |
|
1583 | + } else { |
|
1586 | 1584 | $this->_attributes[$attr_key] = $attr_value[0]; |
1587 | 1585 | } |
1588 | 1586 | } |
@@ -2601,8 +2599,9 @@ discard block |
||
2601 | 2599 | $query_string = $this->removeParameterFromQueryString('ticket', $request_uri[1]); |
2602 | 2600 | |
2603 | 2601 | // If the query string still has anything left, append it to the final URI |
2604 | - if ($query_string !== '') |
|
2605 | - $final_uri .= "?$query_string"; |
|
2602 | + if ($query_string !== '') { |
|
2603 | + $final_uri .= "?$query_string"; |
|
2604 | + } |
|
2606 | 2605 | |
2607 | 2606 | } |
2608 | 2607 | |
@@ -2680,10 +2679,11 @@ discard block |
||
2680 | 2679 | phpCAS::trace('Reason: CAS error'); |
2681 | 2680 | break; |
2682 | 2681 | case CAS_VERSION_2_0: |
2683 | - if ( empty($err_code) ) |
|
2684 | - phpCAS::trace('Reason: no CAS error'); |
|
2685 | - else |
|
2686 | - phpCAS::trace('Reason: ['.$err_code.'] CAS error: '.$err_msg); |
|
2682 | + if ( empty($err_code) ) { |
|
2683 | + phpCAS::trace('Reason: no CAS error'); |
|
2684 | + } else { |
|
2685 | + phpCAS::trace('Reason: ['.$err_code.'] CAS error: '.$err_msg); |
|
2686 | + } |
|
2687 | 2687 | break; |
2688 | 2688 | } |
2689 | 2689 | } |
@@ -457,6 +457,10 @@ discard block |
||
457 | 457 | $this->myOwnerDocument=$dom_document->myOwnerDocument; |
458 | 458 | $this->myDOMXPath=new DOMXPath($this->myOwnerDocument->myDOMNode); |
459 | 459 | } |
460 | + |
|
461 | + /** |
|
462 | + * @param string $eval_str |
|
463 | + */ |
|
460 | 464 | function xpath_eval($eval_str,$contextnode=null) |
461 | 465 | { |
462 | 466 | if (method_exists($this->myDOMXPath,'evaluate')) $xp=isset($contextnode) ? $this->myDOMXPath->evaluate($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->evaluate($eval_str); |
@@ -464,6 +468,11 @@ discard block |
||
464 | 468 | $xp=new php4DOMNodelist($xp,$this->myOwnerDocument); |
465 | 469 | return ($xp->type===XPATH_UNDEFINED) ? false : $xp; |
466 | 470 | } |
471 | + |
|
472 | + /** |
|
473 | + * @param string $prefix |
|
474 | + * @param string $namespaceURI |
|
475 | + */ |
|
467 | 476 | function xpath_register_ns($prefix,$namespaceURI) {return $this->myDOMXPath->registerNamespace($prefix,$namespaceURI);} |
468 | 477 | } |
469 | 478 |
@@ -55,8 +55,12 @@ discard block |
||
55 | 55 | { |
56 | 56 | $dom=new php4DOMDocument($mode); |
57 | 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; |
|
58 | + if ($errorMode) { |
|
59 | + libxml_use_internal_errors(true); |
|
60 | + } |
|
61 | + if (!$dom->myDOMNode->load($filename)) { |
|
62 | + $dom=null; |
|
63 | + } |
|
60 | 64 | if ($errorMode) |
61 | 65 | { |
62 | 66 | $error=array_map('_error_report',libxml_get_errors()); |
@@ -68,8 +72,12 @@ discard block |
||
68 | 72 | { |
69 | 73 | $dom=new php4DOMDocument($mode); |
70 | 74 | $errorMode=(func_num_args()>2)&&defined('LIBXML_VERSION'); |
71 | - if ($errorMode) libxml_use_internal_errors(true); |
|
72 | - if (!$dom->myDOMNode->loadXML($str)) $dom=null; |
|
75 | + if ($errorMode) { |
|
76 | + libxml_use_internal_errors(true); |
|
77 | + } |
|
78 | + if (!$dom->myDOMNode->loadXML($str)) { |
|
79 | + $dom=null; |
|
80 | + } |
|
73 | 81 | if ($errorMode) |
74 | 82 | { |
75 | 83 | $error=array_map('_error_report',libxml_get_errors()); |
@@ -80,8 +88,11 @@ discard block |
||
80 | 88 | function html_doc($html_doc,$from_file=false) |
81 | 89 | { |
82 | 90 | $dom=new php4DOMDocument(); |
83 | - if ($from_file) $result=$dom->myDOMNode->loadHTMLFile($html_doc); |
|
84 | - else $result=$dom->myDOMNode->loadHTML($html_doc); |
|
91 | + if ($from_file) { |
|
92 | + $result=$dom->myDOMNode->loadHTMLFile($html_doc); |
|
93 | + } else { |
|
94 | + $result=$dom->myDOMNode->loadHTML($html_doc); |
|
95 | + } |
|
85 | 96 | return $result ? $dom : null; |
86 | 97 | } |
87 | 98 | function html_doc_file($filename) {return html_doc($filename,true);} |
@@ -97,8 +108,11 @@ discard block |
||
97 | 108 | { |
98 | 109 | function __get($name) |
99 | 110 | { |
100 | - if ($name==='name') return $this->myDOMNode->name; |
|
101 | - else return parent::__get($name); |
|
111 | + if ($name==='name') { |
|
112 | + return $this->myDOMNode->name; |
|
113 | + } else { |
|
114 | + return parent::__get($name); |
|
115 | + } |
|
102 | 116 | } |
103 | 117 | function name() {return $this->myDOMNode->name;} |
104 | 118 | function set_content($text) {} |
@@ -113,14 +127,24 @@ discard block |
||
113 | 127 | { |
114 | 128 | $this->myDOMNode=new DOMDocument(); |
115 | 129 | $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; |
|
130 | + if ($mode & DOMXML_LOAD_VALIDATING) { |
|
131 | + $this->myDOMNode->validateOnParse=true; |
|
132 | + } |
|
133 | + if ($mode & DOMXML_LOAD_RECOVERING) { |
|
134 | + $this->myDOMNode->recover=true; |
|
135 | + } |
|
136 | + if ($mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES) { |
|
137 | + $this->myDOMNode->substituteEntities=true; |
|
138 | + } |
|
139 | + if ($mode & DOMXML_LOAD_DONT_KEEP_BLANKS) { |
|
140 | + $this->myDOMNode->preserveWhiteSpace=false; |
|
141 | + } |
|
120 | 142 | } |
121 | 143 | function add_root($name) |
122 | 144 | { |
123 | - if ($this->myDOMNode->hasChildNodes()) $this->myDOMNode->removeChild($this->myDOMNode->firstChild); |
|
145 | + if ($this->myDOMNode->hasChildNodes()) { |
|
146 | + $this->myDOMNode->removeChild($this->myDOMNode->firstChild); |
|
147 | + } |
|
124 | 148 | return new php4DOMElement($this->myDOMNode->appendChild($this->myDOMNode->createElement($name)),$this->myOwnerDocument); |
125 | 149 | } |
126 | 150 | function create_attribute($name,$value) |
@@ -134,8 +158,12 @@ discard block |
||
134 | 158 | function create_element($name) {return new php4DOMElement($this->myDOMNode->createElement($name),$this);} |
135 | 159 | function create_element_ns($uri,$name,$prefix=null) |
136 | 160 | { |
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)); |
|
161 | + if ($prefix==null) { |
|
162 | + $prefix=$this->myDOMNode->lookupPrefix($uri); |
|
163 | + } |
|
164 | + if (($prefix==null)&&(($this->myDOMNode->documentElement==null)||(!$this->myDOMNode->documentElement->isDefaultNamespace($uri)))) { |
|
165 | + $prefix='a'.sprintf('%u',crc32($uri)); |
|
166 | + } |
|
139 | 167 | return new php4DOMElement($this->myDOMNode->createElementNS($uri,$prefix==null ? $name : $prefix.':'.$name),$this); |
140 | 168 | } |
141 | 169 | function create_entity_reference($content) {return new php4DOMNode($this->myDOMNode->createEntityReference($content),$this);} //By Walter Ebert 2007-01-22 |
@@ -155,15 +183,22 @@ discard block |
||
155 | 183 | $format0=$this->myDOMNode->formatOutput; |
156 | 184 | $this->myDOMNode->formatOutput=$format; |
157 | 185 | $encoding0=$this->myDOMNode->encoding; |
158 | - if ($encoding) $this->myDOMNode->encoding=$encoding; |
|
186 | + if ($encoding) { |
|
187 | + $this->myDOMNode->encoding=$encoding; |
|
188 | + } |
|
159 | 189 | $dump=$this->myDOMNode->saveXML(); |
160 | 190 | $this->myDOMNode->formatOutput=$format0; |
161 | - if ($encoding) $this->myDOMNode->encoding= $encoding0=='' ? 'UTF-8' : $encoding0; //UTF-8 is XML default encoding |
|
191 | + if ($encoding) { |
|
192 | + $this->myDOMNode->encoding= $encoding0=='' ? 'UTF-8' : $encoding0; |
|
193 | + } |
|
194 | + //UTF-8 is XML default encoding |
|
162 | 195 | return $dump; |
163 | 196 | } |
164 | 197 | function free() |
165 | 198 | { |
166 | - if ($this->myDOMNode->hasChildNodes()) $this->myDOMNode->removeChild($this->myDOMNode->firstChild); |
|
199 | + if ($this->myDOMNode->hasChildNodes()) { |
|
200 | + $this->myDOMNode->removeChild($this->myDOMNode->firstChild); |
|
201 | + } |
|
167 | 202 | $this->myDOMNode=null; |
168 | 203 | $this->myOwnerDocument=null; |
169 | 204 | } |
@@ -173,8 +208,9 @@ discard block |
||
173 | 208 | $myDOMNodeList=$this->myDOMNode->getElementsByTagName($name); |
174 | 209 | $nodeSet=array(); |
175 | 210 | $i=0; |
176 | - if (isset($myDOMNodeList)) |
|
177 | - while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this); |
|
211 | + if (isset($myDOMNodeList)) { |
|
212 | + while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this); |
|
213 | + } |
|
178 | 214 | return $nodeSet; |
179 | 215 | } |
180 | 216 | function html_dump_mem() {return $this->myDOMNode->saveHTML();} |
@@ -187,8 +223,9 @@ discard block |
||
187 | 223 | { |
188 | 224 | function add_namespace($uri,$prefix) |
189 | 225 | { |
190 | - if ($this->myDOMNode->hasAttributeNS('http://www.w3.org/2000/xmlns/',$prefix)) return false; |
|
191 | - else |
|
226 | + if ($this->myDOMNode->hasAttributeNS('http://www.w3.org/2000/xmlns/',$prefix)) { |
|
227 | + return false; |
|
228 | + } else |
|
192 | 229 | { |
193 | 230 | $this->myDOMNode->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:'.$prefix,$uri); //By Daniel Walker 2006-09-08 |
194 | 231 | return true; |
@@ -201,8 +238,9 @@ discard block |
||
201 | 238 | $myDOMNodeList=$this->myDOMNode->getElementsByTagName($name); |
202 | 239 | $nodeSet=array(); |
203 | 240 | $i=0; |
204 | - if (isset($myDOMNodeList)) |
|
205 | - while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument); |
|
241 | + if (isset($myDOMNodeList)) { |
|
242 | + while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument); |
|
243 | + } |
|
206 | 244 | return $nodeSet; |
207 | 245 | } |
208 | 246 | function has_attribute($name) {return $this->myDOMNode->hasAttribute($name);} |
@@ -222,17 +260,23 @@ discard block |
||
222 | 260 | }*/ |
223 | 261 | function set_name($name) |
224 | 262 | { |
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); |
|
263 | + if ($this->myDOMNode->prefix=='') { |
|
264 | + $newNode=$this->myDOMNode->ownerDocument->createElement($name); |
|
265 | + } else { |
|
266 | + $newNode=$this->myDOMNode->ownerDocument->createElementNS($this->myDOMNode->namespaceURI,$this->myDOMNode->prefix.':'.$name); |
|
267 | + } |
|
227 | 268 | $myDOMNodeList=$this->myDOMNode->attributes; |
228 | 269 | $i=0; |
229 | - if (isset($myDOMNodeList)) |
|
230 | - while ($node=$myDOMNodeList->item($i++)) |
|
270 | + if (isset($myDOMNodeList)) { |
|
271 | + while ($node=$myDOMNodeList->item($i++)) |
|
231 | 272 | if ($node->namespaceURI=='') $newNode->setAttribute($node->name,$node->value); |
232 | - else $newNode->setAttributeNS($node->namespaceURI,$node->nodeName,$node->value); |
|
273 | + } else { |
|
274 | + $newNode->setAttributeNS($node->namespaceURI,$node->nodeName,$node->value); |
|
275 | + } |
|
233 | 276 | $myDOMNodeList=$this->myDOMNode->childNodes; |
234 | - if (isset($myDOMNodeList)) |
|
235 | - while ($node=$myDOMNodeList->item(0)) $newNode->appendChild($node); |
|
277 | + if (isset($myDOMNodeList)) { |
|
278 | + while ($node=$myDOMNodeList->item(0)) $newNode->appendChild($node); |
|
279 | + } |
|
236 | 280 | $this->myDOMNode->parentNode->replaceChild($newNode,$this->myDOMNode); |
237 | 281 | $this->myDOMNode=$newNode; |
238 | 282 | return true; |
@@ -270,10 +314,14 @@ discard block |
||
270 | 314 | function attributes() |
271 | 315 | { |
272 | 316 | $myDOMNodeList=$this->myDOMNode->attributes; |
273 | - if (!(isset($myDOMNodeList)&&$this->myDOMNode->hasAttributes())) return null; |
|
317 | + if (!(isset($myDOMNodeList)&&$this->myDOMNode->hasAttributes())) { |
|
318 | + return null; |
|
319 | + } |
|
274 | 320 | $nodeSet=array(); |
275 | 321 | $i=0; |
276 | - while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMAttr($node,$this->myOwnerDocument); |
|
322 | + while ($node=$myDOMNodeList->item($i++)) { |
|
323 | + $nodeSet[]=new php4DOMAttr($node,$this->myOwnerDocument); |
|
324 | + } |
|
277 | 325 | return $nodeSet; |
278 | 326 | } |
279 | 327 | function child_nodes() |
@@ -281,8 +329,9 @@ discard block |
||
281 | 329 | $myDOMNodeList=$this->myDOMNode->childNodes; |
282 | 330 | $nodeSet=array(); |
283 | 331 | $i=0; |
284 | - if (isset($myDOMNodeList)) |
|
285 | - while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=self::_newDOMElement($node,$this->myOwnerDocument); |
|
332 | + if (isset($myDOMNodeList)) { |
|
333 | + while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=self::_newDOMElement($node,$this->myOwnerDocument); |
|
334 | + } |
|
286 | 335 | return $nodeSet; |
287 | 336 | } |
288 | 337 | function children() {return $this->child_nodes();} |
@@ -342,15 +391,20 @@ discard block |
||
342 | 391 | $parent->removeAttributeNode($this->myDOMNode); |
343 | 392 | $parent->setAttributeNS($uri,$nsprefix.':'.$this->myDOMNode->localName,$this->myDOMNode->nodeValue); |
344 | 393 | $this->myDOMNode=$parent->getAttributeNodeNS($uri,$this->myDOMNode->localName); |
345 | - } |
|
346 | - elseif ($this->myDOMNode->nodeType===XML_ELEMENT_NODE) |
|
394 | + } elseif ($this->myDOMNode->nodeType===XML_ELEMENT_NODE) |
|
347 | 395 | { |
348 | 396 | $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)); |
|
397 | + foreach ($this->myDOMNode->attributes as $n) { |
|
398 | + $NewNode->appendChild($n->cloneNode(true)); |
|
399 | + } |
|
400 | + foreach ($this->myDOMNode->childNodes as $n) { |
|
401 | + $NewNode->appendChild($n->cloneNode(true)); |
|
402 | + } |
|
351 | 403 | $xpath=new DOMXPath($this->myDOMNode->ownerDocument); |
352 | 404 | $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); |
|
405 | + foreach ($myDOMNodeList as $n) { |
|
406 | + $NewNode->setAttributeNS('http://www.w3.org/2000/xmlns/',$n->nodeName,$n->nodeValue); |
|
407 | + } |
|
354 | 408 | $this->myDOMNode->parentNode->replaceChild($NewNode,$this->myDOMNode); |
355 | 409 | $this->myDOMNode=$NewNode; |
356 | 410 | } |
@@ -359,14 +413,19 @@ discard block |
||
359 | 413 | { |
360 | 414 | if ($this->myDOMNode->parentNode!=null) |
361 | 415 | { |
362 | - if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) $this->myDOMNode->parentNode->removeAttributeNode($this->myDOMNode); |
|
363 | - else $this->myDOMNode->parentNode->removeChild($this->myDOMNode); |
|
416 | + if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) { |
|
417 | + $this->myDOMNode->parentNode->removeAttributeNode($this->myDOMNode); |
|
418 | + } else { |
|
419 | + $this->myDOMNode->parentNode->removeChild($this->myDOMNode); |
|
420 | + } |
|
364 | 421 | } |
365 | 422 | } |
366 | 423 | 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 | 424 | static function _newDOMElement($aDOMNode,$aOwnerDocument) |
368 | 425 | {//Check the PHP5 DOMNode before creating a new associated PHP4 DOMNode wrapper |
369 | - if ($aDOMNode==null) return null; |
|
426 | + if ($aDOMNode==null) { |
|
427 | + return null; |
|
428 | + } |
|
370 | 429 | switch ($aDOMNode->nodeType) |
371 | 430 | { |
372 | 431 | case XML_ELEMENT_NODE: return new php4DOMElement($aDOMNode,$aOwnerDocument); |
@@ -388,8 +447,11 @@ discard block |
||
388 | 447 | { |
389 | 448 | function __get($name) |
390 | 449 | { |
391 | - if ($name==='tagname') return '#text'; |
|
392 | - else return parent::__get($name); |
|
450 | + if ($name==='tagname') { |
|
451 | + return '#text'; |
|
452 | + } else { |
|
453 | + return parent::__get($name); |
|
454 | + } |
|
393 | 455 | } |
394 | 456 | function tagname() {return '#text';} |
395 | 457 | function set_content($text) {$this->myDOMNode->nodeValue=$text; return true;} |
@@ -417,8 +479,9 @@ discard block |
||
417 | 479 | public $value; |
418 | 480 | function php4DOMNodelist($aDOMNodelist,$aOwnerDocument) |
419 | 481 | { |
420 | - if (!isset($aDOMNodelist)) return; |
|
421 | - elseif (is_object($aDOMNodelist)||is_array($aDOMNodelist)) |
|
482 | + if (!isset($aDOMNodelist)) { |
|
483 | + return; |
|
484 | + } elseif (is_object($aDOMNodelist)||is_array($aDOMNodelist)) |
|
422 | 485 | { |
423 | 486 | if ($aDOMNodelist->length>0) |
424 | 487 | { |
@@ -426,20 +489,19 @@ discard block |
||
426 | 489 | $this->nodeset=array(); |
427 | 490 | $this->type=XPATH_NODESET; |
428 | 491 | $i=0; |
429 | - while ($node=$this->myDOMNodelist->item($i++)) $this->nodeset[]=php4DOMNode::_newDOMElement($node,$aOwnerDocument); |
|
492 | + while ($node=$this->myDOMNodelist->item($i++)) { |
|
493 | + $this->nodeset[]=php4DOMNode::_newDOMElement($node,$aOwnerDocument); |
|
494 | + } |
|
430 | 495 | } |
431 | - } |
|
432 | - elseif (is_int($aDOMNodelist)||is_float($aDOMNodelist)) |
|
496 | + } elseif (is_int($aDOMNodelist)||is_float($aDOMNodelist)) |
|
433 | 497 | { |
434 | 498 | $this->type=XPATH_NUMBER; |
435 | 499 | $this->value=$aDOMNodelist; |
436 | - } |
|
437 | - elseif (is_bool($aDOMNodelist)) |
|
500 | + } elseif (is_bool($aDOMNodelist)) |
|
438 | 501 | { |
439 | 502 | $this->type=XPATH_BOOLEAN; |
440 | 503 | $this->value=$aDOMNodelist; |
441 | - } |
|
442 | - elseif (is_string($aDOMNodelist)) |
|
504 | + } elseif (is_string($aDOMNodelist)) |
|
443 | 505 | { |
444 | 506 | $this->type=XPATH_STRING; |
445 | 507 | $this->value=$aDOMNodelist; |
@@ -459,8 +521,11 @@ discard block |
||
459 | 521 | } |
460 | 522 | function xpath_eval($eval_str,$contextnode=null) |
461 | 523 | { |
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); |
|
524 | + if (method_exists($this->myDOMXPath,'evaluate')) { |
|
525 | + $xp=isset($contextnode) ? $this->myDOMXPath->evaluate($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->evaluate($eval_str); |
|
526 | + } else { |
|
527 | + $xp=isset($contextnode) ? $this->myDOMXPath->query($eval_str,$contextnode->myDOMNode) : $this->myDOMXPath->query($eval_str); |
|
528 | + } |
|
464 | 529 | $xp=new php4DOMNodelist($xp,$this->myOwnerDocument); |
465 | 530 | return ($xp->type===XPATH_UNDEFINED) ? false : $xp; |
466 | 531 | } |
@@ -482,7 +547,9 @@ discard block |
||
482 | 547 | } |
483 | 548 | function process($dom_document,$xslt_parameters=array(),$param_is_xpath=false) |
484 | 549 | { |
485 | - foreach ($xslt_parameters as $param=>$value) $this->myxsltProcessor->setParameter('',$param,$value); |
|
550 | + foreach ($xslt_parameters as $param=>$value) { |
|
551 | + $this->myxsltProcessor->setParameter('',$param,$value); |
|
552 | + } |
|
486 | 553 | $myphp4DOMDocument=new php4DOMDocument(); |
487 | 554 | $myphp4DOMDocument->myDOMNode=$this->myxsltProcessor->transformToDoc($dom_document->myDOMNode); |
488 | 555 | return $myphp4DOMDocument; |