@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | $htmlHeadXtra[] = api_get_password_checker_js('#username', '#password1'); |
34 | -$htmlHeadXtra[] = '<link href="'. api_get_path(WEB_PATH) .'web/assets/cropper/dist/cropper.min.css" rel="stylesheet">'; |
|
35 | -$htmlHeadXtra[] = '<script src="'. api_get_path(WEB_PATH) .'web/assets/cropper/dist/cropper.min.js"></script>'; |
|
34 | +$htmlHeadXtra[] = '<link href="'.api_get_path(WEB_PATH).'web/assets/cropper/dist/cropper.min.css" rel="stylesheet">'; |
|
35 | +$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_PATH).'web/assets/cropper/dist/cropper.min.js"></script>'; |
|
36 | 36 | $htmlHeadXtra[] = '<script> |
37 | 37 | $(document).ready(function() { |
38 | 38 | var $image = $("#previewImage"); |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | if (api_is_western_name_order()) { |
169 | 169 | // FIRST NAME and LAST NAME |
170 | 170 | $form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40)); |
171 | - $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40)); |
|
171 | + $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40)); |
|
172 | 172 | } else { |
173 | 173 | // LAST NAME and FIRST NAME |
174 | - $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40)); |
|
174 | + $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40)); |
|
175 | 175 | $form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40)); |
176 | 176 | } |
177 | 177 | if (api_get_setting('profile', 'name') !== 'true') { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $form->applyFilter(array('lastname', 'firstname'), 'stripslashes'); |
181 | 181 | $form->applyFilter(array('lastname', 'firstname'), 'trim'); |
182 | 182 | $form->applyFilter(array('lastname', 'firstname'), 'html_filter'); |
183 | -$form->addRule('lastname' , get_lang('ThisFieldIsRequired'), 'required'); |
|
183 | +$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
184 | 184 | $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
185 | 185 | |
186 | 186 | // USERNAME |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $form->freeze('email'); |
224 | 224 | } |
225 | 225 | |
226 | -if (api_get_setting('registration', 'email') == 'true' && api_get_setting('profile', 'email') == 'true') { |
|
226 | +if (api_get_setting('registration', 'email') == 'true' && api_get_setting('profile', 'email') == 'true') { |
|
227 | 227 | $form->applyFilter('email', 'stripslashes'); |
228 | 228 | $form->applyFilter('email', 'trim'); |
229 | 229 | $form->addRule('email', get_lang('ThisFieldIsRequired'), 'required'); |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | |
390 | 390 | // the $jquery_ready_content variable collects all functions that |
391 | 391 | // will be load in the $(document).ready javascript function |
392 | -$htmlHeadXtra[] ='<script> |
|
392 | +$htmlHeadXtra[] = '<script> |
|
393 | 393 | $(document).ready(function(){ |
394 | 394 | '.$jquery_ready_content.' |
395 | 395 | }); |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | |
546 | 546 | if (!check_user_email($user_data['email']) && |
547 | 547 | empty($user_data['password0']) |
548 | - ){ |
|
548 | + ) { |
|
549 | 549 | Display::addFlash( |
550 | 550 | Display:: return_message( |
551 | 551 | get_lang('ToChangeYourEmailMustTypeYourPassword'), |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | $available_values_to_modify = array(); |
655 | 655 | foreach ($profile_list as $key => $status) { |
656 | 656 | if ($status == 'true') { |
657 | - switch($key) { |
|
657 | + switch ($key) { |
|
658 | 658 | case 'login': |
659 | 659 | $available_values_to_modify[] = 'username'; |
660 | 660 | break; |
@@ -787,10 +787,10 @@ discard block |
||
787 | 787 | |
788 | 788 | if (isset($_GET['type']) && $_GET['type'] == 'extended') { |
789 | 789 | $actions .= '<a href="profile.php?type=reduced'.$show.'">'. |
790 | - Display::return_icon('edit.png', get_lang('EditNormalProfile'),'',16).'</a>'; |
|
790 | + Display::return_icon('edit.png', get_lang('EditNormalProfile'), '', 16).'</a>'; |
|
791 | 791 | } else { |
792 | 792 | $actions .= '<a href="profile.php?type=extended'.$show.'">'. |
793 | - Display::return_icon('edit.png', get_lang('EditExtendProfile'),'',16).'</a>'; |
|
793 | + Display::return_icon('edit.png', get_lang('EditExtendProfile'), '', 16).'</a>'; |
|
794 | 794 | } |
795 | 795 | $actions .= '</div>'; |
796 | 796 | } |
@@ -9,5 +9,5 @@ |
||
9 | 9 | require_once('authcas.php'); |
10 | 10 | global $cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri; |
11 | 11 | |
12 | -phpCAS::client($cas_auth_ver,$cas_auth_server,$cas_auth_port,$cas_auth_uri); |
|
12 | +phpCAS::client($cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri); |
|
13 | 13 | phpCAS::logout(); |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | if (!is_object($PHPCAS_CLIENT)) { |
44 | - phpCAS::client($cas_auth_ver,$cas_auth_server,$cas_auth_port,$cas_auth_uri); |
|
44 | + phpCAS::client($cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri); |
|
45 | 45 | phpCAS::setNoCasServerValidation(); |
46 | 46 | } |
47 | 47 | $auth = phpCAS::checkAuthentication(); |
48 | 48 | |
49 | 49 | if ($auth) { |
50 | - $login= trim(phpCAS::getUser()); |
|
50 | + $login = trim(phpCAS::getUser()); |
|
51 | 51 | /* |
52 | 52 | Get user attributes. Here are the attributes for crdp platform |
53 | 53 | sn => name |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | default: |
80 | 80 | $status=5; // Student |
81 | 81 | }*/ |
82 | - if (!$logout){ |
|
82 | + if (!$logout) { |
|
83 | 83 | // get user info from username |
84 | 84 | $tab_user_info = api_get_user_info($login); |
85 | 85 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $chamilo_user = extldap_get_chamilo_user($ldapuser); |
93 | 93 | $chamilo_user['user_id'] = $tab_user_info['user_id']; |
94 | 94 | $chamilo_user['status'] = $tab_user_info['status']; |
95 | - UserManager::update_user ($chamilo_user["user_id"], $chamilo_user["firstname"], $chamilo_user["lastname"], $login, null, null, $chamilo_user["email"], $chamilo_user["status"], '', '', '', '', 1, null, 0, null,'') ; |
|
95 | + UserManager::update_user($chamilo_user["user_id"], $chamilo_user["firstname"], $chamilo_user["lastname"], $login, null, null, $chamilo_user["email"], $chamilo_user["status"], '', '', '', '', 1, null, 0, null, ''); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | return $login; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | case PLATFORM_AUTH_SOURCE : |
106 | 106 | // user will have to modify firstname, lastname, email in chamilo profil edit |
107 | 107 | $userdata = get_lang("EditInProfil"); |
108 | - UserManager::create_user($userdata, $userdata, '5', $userdata, $login, 'casplaceholder', '','','','',CAS_AUTH_SOURCE); |
|
108 | + UserManager::create_user($userdata, $userdata, '5', $userdata, $login, 'casplaceholder', '', '', '', '', CAS_AUTH_SOURCE); |
|
109 | 109 | $user_added = $login; |
110 | 110 | break; |
111 | 111 | case LDAP_AUTH_SOURCE : |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @see online_logout() |
165 | 165 | */ |
166 | -function cas_logout($uinfo=null, $location=null) |
|
166 | +function cas_logout($uinfo = null, $location = null) |
|
167 | 167 | { |
168 | 168 | global $cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri; |
169 | 169 | global $PHPCAS_CLIENT; |
@@ -39,7 +39,7 @@ |
||
39 | 39 | $firstpage = $_GET['firstpage']; |
40 | 40 | setcookie("GotoCourse", $firstpage); |
41 | 41 | } |
42 | - if (!is_object($PHPCAS_CLIENT) ) { |
|
42 | + if (!is_object($PHPCAS_CLIENT)) { |
|
43 | 43 | phpCAS::client( |
44 | 44 | $cas_auth_ver, |
45 | 45 | $cas_auth_server, |
@@ -131,17 +131,17 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @public |
133 | 133 | */ |
134 | - function PGTStorageFile($cas_parent,$format,$path) |
|
134 | + function PGTStorageFile($cas_parent, $format, $path) |
|
135 | 135 | { |
136 | 136 | phpCAS::traceBegin(); |
137 | 137 | // call the ancestor's constructor |
138 | 138 | $this->PGTStorage($cas_parent); |
139 | 139 | |
140 | - if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT; |
|
141 | - if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH; |
|
140 | + if (empty($format)) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT; |
|
141 | + if (empty($path)) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH; |
|
142 | 142 | |
143 | 143 | // check that the path is an absolute path |
144 | - if (getenv("OS")=="Windows_NT"){ |
|
144 | + if (getenv("OS") == "Windows_NT") { |
|
145 | 145 | |
146 | 146 | if (!preg_match('`^[a-zA-Z]:`', $path)) { |
147 | 147 | phpCAS::error('an absolute path is needed for PGT storage to file'); |
@@ -151,13 +151,13 @@ discard block |
||
151 | 151 | else |
152 | 152 | { |
153 | 153 | |
154 | - if ( $path[0] != '/' ) { |
|
154 | + if ($path[0] != '/') { |
|
155 | 155 | phpCAS::error('an absolute path is needed for PGT storage to file'); |
156 | 156 | } |
157 | 157 | |
158 | 158 | // store the path (with a leading and trailing '/') |
159 | - $path = preg_replace('|[/]*$|','/',$path); |
|
160 | - $path = preg_replace('|^[/]*|','/',$path); |
|
159 | + $path = preg_replace('|[/]*$|', '/', $path); |
|
160 | + $path = preg_replace('|^[/]*|', '/', $path); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | $this->_path = $path; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | { |
187 | 187 | phpCAS::traceBegin(); |
188 | 188 | // if the storage has already been initialized, return immediatly |
189 | - if ( $this->isInitialized() ) |
|
189 | + if ($this->isInitialized()) |
|
190 | 190 | return; |
191 | 191 | // call the ancestor's method (mark as initialized) |
192 | 192 | parent::init(); |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @public |
224 | 224 | */ |
225 | - function write($pgt,$pgt_iou) |
|
225 | + function write($pgt, $pgt_iou) |
|
226 | 226 | { |
227 | 227 | phpCAS::traceBegin(); |
228 | 228 | $fname = $this->getPGTIouFilename($pgt_iou); |
229 | - if ( $f=fopen($fname,"w") ) { |
|
230 | - if ( fputs($f,$pgt) === FALSE ) { |
|
229 | + if ($f = fopen($fname, "w")) { |
|
230 | + if (fputs($f, $pgt) === FALSE) { |
|
231 | 231 | phpCAS::error('could not write PGT to `'.$fname.'\''); |
232 | 232 | } |
233 | 233 | fclose($f); |
@@ -252,10 +252,10 @@ discard block |
||
252 | 252 | phpCAS::traceBegin(); |
253 | 253 | $pgt = FALSE; |
254 | 254 | $fname = $this->getPGTIouFilename($pgt_iou); |
255 | - if ( !($f=fopen($fname,"r")) ) { |
|
255 | + if (!($f = fopen($fname, "r"))) { |
|
256 | 256 | phpCAS::trace('could not open `'.$fname.'\''); |
257 | 257 | } else { |
258 | - if ( ($pgt=fgets($f)) === FALSE ) { |
|
258 | + if (($pgt = fgets($f)) === FALSE) { |
|
259 | 259 | phpCAS::trace('could not read PGT from `'.$fname.'\''); |
260 | 260 | } |
261 | 261 | fclose($f); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @hideinitializer |
58 | 58 | * @private |
59 | 59 | */ |
60 | - var $_url=''; |
|
60 | + var $_url = ''; |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * This method returns the PEAR DB URL to use to connect to the database. |
@@ -159,18 +159,18 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @public |
161 | 161 | */ |
162 | - function PGTStorageDB($cas_parent,$user,$password,$database_type,$hostname,$port,$database,$table) |
|
162 | + function PGTStorageDB($cas_parent, $user, $password, $database_type, $hostname, $port, $database, $table) |
|
163 | 163 | { |
164 | 164 | phpCAS::traceBegin(); |
165 | 165 | |
166 | 166 | // call the ancestor's constructor |
167 | 167 | $this->PGTStorage($cas_parent); |
168 | 168 | |
169 | - if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE; |
|
170 | - if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME; |
|
171 | - if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT; |
|
172 | - if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE; |
|
173 | - if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE; |
|
169 | + if (empty($database_type)) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE; |
|
170 | + if (empty($hostname)) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME; |
|
171 | + if ($port == 0) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT; |
|
172 | + if (empty($database)) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE; |
|
173 | + if (empty($table)) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE; |
|
174 | 174 | |
175 | 175 | // build and store the PEAR DB URL |
176 | 176 | $this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | { |
193 | 193 | phpCAS::traceBegin(); |
194 | 194 | // if the storage has already been initialized, return immediatly |
195 | - if ( $this->isInitialized() ) |
|
195 | + if ($this->isInitialized()) |
|
196 | 196 | return; |
197 | 197 | // call the ancestor's method (mark as initialized) |
198 | 198 | parent::init(); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | // try to connect to the database |
207 | 207 | $this->_link = DB::connect($this->getURL()); |
208 | - if ( DB::isError($this->_link) ) { |
|
208 | + if (DB::isError($this->_link)) { |
|
209 | 209 | phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')'); |
210 | 210 | } |
211 | 211 | var_dump($this->_link); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | function PGTStorage($cas_parent) |
64 | 64 | { |
65 | 65 | phpCAS::traceBegin(); |
66 | - if ( !$cas_parent->isProxy() ) { |
|
66 | + if (!$cas_parent->isProxy()) { |
|
67 | 67 | phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy'); |
68 | 68 | } |
69 | 69 | phpCAS::traceEnd(); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @private |
108 | 108 | * @deprecated not used. |
109 | 109 | */ |
110 | - var $_error_message=FALSE; |
|
110 | + var $_error_message = FALSE; |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * This method sets en error message, which can be read later by |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * |
186 | 186 | * @protected |
187 | 187 | */ |
188 | - function write($pgt,$pgt_iou) |
|
188 | + function write($pgt, $pgt_iou) |
|
189 | 189 | { |
190 | 190 | phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); |
191 | 191 | } |
@@ -12,13 +12,13 @@ |
||
12 | 12 | /** |
13 | 13 | * a phpCAS string index |
14 | 14 | */ |
15 | -define("CAS_STR_USING_SERVER", 1); |
|
16 | -define("CAS_STR_AUTHENTICATION_WANTED", 2); |
|
17 | -define("CAS_STR_LOGOUT", 3); |
|
15 | +define("CAS_STR_USING_SERVER", 1); |
|
16 | +define("CAS_STR_AUTHENTICATION_WANTED", 2); |
|
17 | +define("CAS_STR_LOGOUT", 3); |
|
18 | 18 | define("CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED", 4); |
19 | -define("CAS_STR_AUTHENTICATION_FAILED", 5); |
|
20 | -define("CAS_STR_YOU_WERE_NOT_AUTHENTICATED", 6); |
|
21 | -define("CAS_STR_SERVICE_UNAVAILABLE", 7); |
|
19 | +define("CAS_STR_AUTHENTICATION_FAILED", 5); |
|
20 | +define("CAS_STR_YOU_WERE_NOT_AUTHENTICATED", 6); |
|
21 | +define("CAS_STR_SERVICE_UNAVAILABLE", 7); |
|
22 | 22 | //@} |
23 | 23 | |
24 | 24 | ?> |
25 | 25 | \ No newline at end of file |
@@ -42,178 +42,178 @@ discard block |
||
42 | 42 | http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/ |
43 | 43 | */ |
44 | 44 | |
45 | -define('DOMXML_LOAD_PARSING',0); |
|
46 | -define('DOMXML_LOAD_VALIDATING',1); |
|
47 | -define('DOMXML_LOAD_RECOVERING',2); |
|
48 | -define('DOMXML_LOAD_SUBSTITUTE_ENTITIES',4); |
|
45 | +define('DOMXML_LOAD_PARSING', 0); |
|
46 | +define('DOMXML_LOAD_VALIDATING', 1); |
|
47 | +define('DOMXML_LOAD_RECOVERING', 2); |
|
48 | +define('DOMXML_LOAD_SUBSTITUTE_ENTITIES', 4); |
|
49 | 49 | //define('DOMXML_LOAD_COMPLETE_ATTRS',8); |
50 | -define('DOMXML_LOAD_DONT_KEEP_BLANKS',16); |
|
50 | +define('DOMXML_LOAD_DONT_KEEP_BLANKS', 16); |
|
51 | 51 | |
52 | -function domxml_new_doc($version) {return new php4DOMDocument();} |
|
53 | -function domxml_new_xmldoc($version) {return new php4DOMDocument();} |
|
54 | -function domxml_open_file($filename,$mode=DOMXML_LOAD_PARSING,&$error=null) |
|
52 | +function domxml_new_doc($version) {return new php4DOMDocument(); } |
|
53 | +function domxml_new_xmldoc($version) {return new php4DOMDocument(); } |
|
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'); |
|
56 | + $dom = new php4DOMDocument($mode); |
|
57 | + $errorMode = (func_num_args() > 2) && defined('LIBXML_VERSION'); |
|
58 | 58 | if ($errorMode) libxml_use_internal_errors(true); |
59 | - if (!$dom->myDOMNode->load($filename)) $dom=null; |
|
59 | + if (!$dom->myDOMNode->load($filename)) $dom = null; |
|
60 | 60 | if ($errorMode) |
61 | 61 | { |
62 | - $error=array_map('_error_report',libxml_get_errors()); |
|
62 | + $error = array_map('_error_report', libxml_get_errors()); |
|
63 | 63 | libxml_clear_errors(); |
64 | 64 | } |
65 | 65 | return $dom; |
66 | 66 | } |
67 | -function domxml_open_mem($str,$mode=DOMXML_LOAD_PARSING,&$error=null) |
|
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'); |
|
69 | + $dom = new php4DOMDocument($mode); |
|
70 | + $errorMode = (func_num_args() > 2) && defined('LIBXML_VERSION'); |
|
71 | 71 | if ($errorMode) libxml_use_internal_errors(true); |
72 | - if (!$dom->myDOMNode->loadXML($str)) $dom=null; |
|
72 | + if (!$dom->myDOMNode->loadXML($str)) $dom = null; |
|
73 | 73 | if ($errorMode) |
74 | 74 | { |
75 | - $error=array_map('_error_report',libxml_get_errors()); |
|
75 | + $error = array_map('_error_report', libxml_get_errors()); |
|
76 | 76 | libxml_clear_errors(); |
77 | 77 | } |
78 | 78 | return $dom; |
79 | 79 | } |
80 | -function html_doc($html_doc,$from_file=false) |
|
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); |
|
82 | + $dom = new php4DOMDocument(); |
|
83 | + if ($from_file) $result = $dom->myDOMNode->loadHTMLFile($html_doc); |
|
84 | + else $result = $dom->myDOMNode->loadHTML($html_doc); |
|
85 | 85 | return $result ? $dom : null; |
86 | 86 | } |
87 | -function html_doc_file($filename) {return html_doc($filename,true);} |
|
88 | -function xmldoc($str) {return domxml_open_mem($str);} |
|
89 | -function xmldocfile($filename) {return domxml_open_file($filename);} |
|
90 | -function xpath_eval($xpath_context,$eval_str,$contextnode=null) {return $xpath_context->xpath_eval($eval_str,$contextnode);} |
|
91 | -function xpath_new_context($dom_document) {return new php4DOMXPath($dom_document);} |
|
92 | -function xpath_register_ns($xpath_context,$prefix,$namespaceURI) {return $xpath_context->myDOMXPath->registerNamespace($prefix,$namespaceURI);} |
|
93 | -function _entityDecode($text) {return html_entity_decode(strtr($text,array('''=>'\'')),ENT_QUOTES,'UTF-8');} |
|
94 | -function _error_report($error) {return array('errormessage'=>$error->message,'nodename'=>'','line'=>$error->line,'col'=>$error->column)+($error->file==''?array():array('directory'=>dirname($error->file),'file'=>basename($error->file)));} |
|
87 | +function html_doc_file($filename) {return html_doc($filename, true); } |
|
88 | +function xmldoc($str) {return domxml_open_mem($str); } |
|
89 | +function xmldocfile($filename) {return domxml_open_file($filename); } |
|
90 | +function xpath_eval($xpath_context, $eval_str, $contextnode = null) {return $xpath_context->xpath_eval($eval_str, $contextnode); } |
|
91 | +function xpath_new_context($dom_document) {return new php4DOMXPath($dom_document); } |
|
92 | +function xpath_register_ns($xpath_context, $prefix, $namespaceURI) {return $xpath_context->myDOMXPath->registerNamespace($prefix, $namespaceURI); } |
|
93 | +function _entityDecode($text) {return html_entity_decode(strtr($text, array('''=>'\'')), ENT_QUOTES, 'UTF-8'); } |
|
94 | +function _error_report($error) {return array('errormessage'=>$error->message, 'nodename'=>'', 'line'=>$error->line, 'col'=>$error->column) + ($error->file == '' ? array() : array('directory'=>dirname($error->file), 'file'=>basename($error->file))); } |
|
95 | 95 | |
96 | 96 | class php4DOMAttr extends php4DOMNode |
97 | 97 | { |
98 | 98 | function __get($name) |
99 | 99 | { |
100 | - if ($name==='name') return $this->myDOMNode->name; |
|
100 | + if ($name === 'name') return $this->myDOMNode->name; |
|
101 | 101 | else return parent::__get($name); |
102 | 102 | } |
103 | - function name() {return $this->myDOMNode->name;} |
|
103 | + function name() {return $this->myDOMNode->name; } |
|
104 | 104 | function set_content($text) {} |
105 | 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;} |
|
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) |
|
112 | + function php4DOMDocument($mode = DOMXML_LOAD_PARSING) |
|
113 | 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; |
|
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 | 120 | } |
121 | 121 | function add_root($name) |
122 | 122 | { |
123 | 123 | if ($this->myDOMNode->hasChildNodes()) $this->myDOMNode->removeChild($this->myDOMNode->firstChild); |
124 | - return new php4DOMElement($this->myDOMNode->appendChild($this->myDOMNode->createElement($name)),$this->myOwnerDocument); |
|
124 | + return new php4DOMElement($this->myDOMNode->appendChild($this->myDOMNode->createElement($name)), $this->myOwnerDocument); |
|
125 | 125 | } |
126 | - function create_attribute($name,$value) |
|
126 | + function create_attribute($name, $value) |
|
127 | 127 | { |
128 | - $myAttr=$this->myDOMNode->createAttribute($name); |
|
129 | - $myAttr->value=htmlspecialchars($value,ENT_QUOTES); |
|
130 | - return new php4DOMAttr($myAttr,$this); |
|
128 | + $myAttr = $this->myDOMNode->createAttribute($name); |
|
129 | + $myAttr->value = htmlspecialchars($value, ENT_QUOTES); |
|
130 | + return new php4DOMAttr($myAttr, $this); |
|
131 | 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) |
|
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 | 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); |
|
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 | 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) |
|
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 | 146 | { |
147 | - $format0=$this->myDOMNode->formatOutput; |
|
148 | - $this->myDOMNode->formatOutput=$format; |
|
149 | - $res=$this->myDOMNode->save($filename); |
|
150 | - $this->myDOMNode->formatOutput=$format0; |
|
147 | + $format0 = $this->myDOMNode->formatOutput; |
|
148 | + $this->myDOMNode->formatOutput = $format; |
|
149 | + $res = $this->myDOMNode->save($filename); |
|
150 | + $this->myDOMNode->formatOutput = $format0; |
|
151 | 151 | return $res; |
152 | 152 | } |
153 | - function dump_mem($format=false,$encoding=false) |
|
153 | + function dump_mem($format = false, $encoding = false) |
|
154 | 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 |
|
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 | 162 | return $dump; |
163 | 163 | } |
164 | 164 | function free() |
165 | 165 | { |
166 | 166 | if ($this->myDOMNode->hasChildNodes()) $this->myDOMNode->removeChild($this->myDOMNode->firstChild); |
167 | - $this->myDOMNode=null; |
|
168 | - $this->myOwnerDocument=null; |
|
167 | + $this->myDOMNode = null; |
|
168 | + $this->myOwnerDocument = null; |
|
169 | 169 | } |
170 | - function get_element_by_id($id) {return parent::_newDOMElement($this->myDOMNode->getElementById($id),$this);} |
|
170 | + function get_element_by_id($id) {return parent::_newDOMElement($this->myDOMNode->getElementById($id), $this); } |
|
171 | 171 | function get_elements_by_tagname($name) |
172 | 172 | { |
173 | - $myDOMNodeList=$this->myDOMNode->getElementsByTagName($name); |
|
174 | - $nodeSet=array(); |
|
175 | - $i=0; |
|
173 | + $myDOMNodeList = $this->myDOMNode->getElementsByTagName($name); |
|
174 | + $nodeSet = array(); |
|
175 | + $i = 0; |
|
176 | 176 | if (isset($myDOMNodeList)) |
177 | - while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this); |
|
177 | + while ($node = $myDOMNodeList->item($i++)) $nodeSet[] = new php4DOMElement($node, $this); |
|
178 | 178 | return $nodeSet; |
179 | 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);} |
|
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) |
|
188 | + function add_namespace($uri, $prefix) |
|
189 | 189 | { |
190 | - if ($this->myDOMNode->hasAttributeNS('http://www.w3.org/2000/xmlns/',$prefix)) return false; |
|
190 | + if ($this->myDOMNode->hasAttributeNS('http://www.w3.org/2000/xmlns/', $prefix)) return false; |
|
191 | 191 | else |
192 | 192 | { |
193 | - $this->myDOMNode->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:'.$prefix,$uri); //By Daniel Walker 2006-09-08 |
|
193 | + $this->myDOMNode->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:'.$prefix, $uri); //By Daniel Walker 2006-09-08 |
|
194 | 194 | return true; |
195 | 195 | } |
196 | 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);} |
|
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 | 199 | function get_elements_by_tagname($name) |
200 | 200 | { |
201 | - $myDOMNodeList=$this->myDOMNode->getElementsByTagName($name); |
|
202 | - $nodeSet=array(); |
|
203 | - $i=0; |
|
201 | + $myDOMNodeList = $this->myDOMNode->getElementsByTagName($name); |
|
202 | + $nodeSet = array(); |
|
203 | + $i = 0; |
|
204 | 204 | if (isset($myDOMNodeList)) |
205 | - while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument); |
|
205 | + while ($node = $myDOMNodeList->item($i++)) $nodeSet[] = new php4DOMElement($node, $this->myOwnerDocument); |
|
206 | 206 | return $nodeSet; |
207 | 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) |
|
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 | 211 | { |
212 | 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 |
|
213 | + $myAttr = $this->myDOMNode->ownerDocument->createAttribute($name); |
|
214 | + $myAttr->value = htmlspecialchars($value, ENT_QUOTES); //Entity problem reported by AL-DesignWorks 2007-09-07 |
|
215 | 215 | $this->myDOMNode->setAttributeNode($myAttr); |
216 | - return new php4DOMAttr($myAttr,$this->myOwnerDocument); |
|
216 | + return new php4DOMAttr($myAttr, $this->myOwnerDocument); |
|
217 | 217 | } |
218 | 218 | /*function set_attribute_node($attr) |
219 | 219 | { |
@@ -222,186 +222,186 @@ discard block |
||
222 | 222 | }*/ |
223 | 223 | function set_name($name) |
224 | 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; |
|
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 | 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; |
|
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 | 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; |
|
235 | + while ($node = $myDOMNodeList->item(0)) $newNode->appendChild($node); |
|
236 | + $this->myDOMNode->parentNode->replaceChild($newNode, $this->myDOMNode); |
|
237 | + $this->myDOMNode = $newNode; |
|
238 | 238 | return true; |
239 | 239 | } |
240 | - function tagname() {return $this->tagname;} |
|
240 | + function tagname() {return $this->tagname; } |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | class php4DOMNode |
244 | 244 | { |
245 | 245 | public $myDOMNode; |
246 | 246 | public $myOwnerDocument; |
247 | - function php4DOMNode($aDomNode,$aOwnerDocument) |
|
247 | + function php4DOMNode($aDomNode, $aOwnerDocument) |
|
248 | 248 | { |
249 | - $this->myDOMNode=$aDomNode; |
|
250 | - $this->myOwnerDocument=$aOwnerDocument; |
|
249 | + $this->myDOMNode = $aDomNode; |
|
250 | + $this->myOwnerDocument = $aOwnerDocument; |
|
251 | 251 | } |
252 | 252 | function __get($name) |
253 | 253 | { |
254 | 254 | switch ($name) |
255 | 255 | { |
256 | 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 |
|
257 | + case 'tagname': return ($this->myDOMNode->nodeType === XML_ELEMENT_NODE) ? $this->myDOMNode->localName : $this->myDOMNode->tagName; //Avoid namespace prefix for DOMElement |
|
258 | 258 | case 'content': return $this->myDOMNode->textContent; |
259 | 259 | case 'value': return $this->myDOMNode->value; |
260 | 260 | default: |
261 | - $myErrors=debug_backtrace(); |
|
262 | - trigger_error('Undefined property: '.get_class($this).'::$'.$name.' ['.$myErrors[0]['file'].':'.$myErrors[0]['line'].']',E_USER_NOTICE); |
|
261 | + $myErrors = debug_backtrace(); |
|
262 | + trigger_error('Undefined property: '.get_class($this).'::$'.$name.' ['.$myErrors[0]['file'].':'.$myErrors[0]['line'].']', E_USER_NOTICE); |
|
263 | 263 | return false; |
264 | 264 | } |
265 | 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);} |
|
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 | 270 | function attributes() |
271 | 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); |
|
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 | 277 | return $nodeSet; |
278 | 278 | } |
279 | 279 | function child_nodes() |
280 | 280 | { |
281 | - $myDOMNodeList=$this->myDOMNode->childNodes; |
|
282 | - $nodeSet=array(); |
|
283 | - $i=0; |
|
281 | + $myDOMNodeList = $this->myDOMNode->childNodes; |
|
282 | + $nodeSet = array(); |
|
283 | + $i = 0; |
|
284 | 284 | if (isset($myDOMNodeList)) |
285 | - while ($node=$myDOMNodeList->item($i++)) $nodeSet[]=self::_newDOMElement($node,$this->myOwnerDocument); |
|
285 | + while ($node = $myDOMNodeList->item($i++)) $nodeSet[] = self::_newDOMElement($node, $this->myOwnerDocument); |
|
286 | 286 | return $nodeSet; |
287 | 287 | } |
288 | - function children() {return $this->child_nodes();} |
|
289 | - function clone_node($deep=false) {return self::_newDOMElement($this->myDOMNode->cloneNode($deep),$this->myOwnerDocument);} |
|
288 | + function children() {return $this->child_nodes(); } |
|
289 | + function clone_node($deep = false) {return self::_newDOMElement($this->myDOMNode->cloneNode($deep), $this->myOwnerDocument); } |
|
290 | 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) |
|
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 | 300 | { |
301 | - $mySubNode=$this->myDOMNode->ownerDocument->createElement($name); |
|
301 | + $mySubNode = $this->myDOMNode->ownerDocument->createElement($name); |
|
302 | 302 | $mySubNode->appendChild($this->myDOMNode->ownerDocument->createTextNode(_entityDecode($content))); |
303 | 303 | $this->myDOMNode->appendChild($mySubNode); |
304 | - return new php4DOMElement($mySubNode,$this->myOwnerDocument); |
|
304 | + return new php4DOMElement($mySubNode, $this->myOwnerDocument); |
|
305 | 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 |
|
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 | 318 | //function set_name($name) {return $this->myOwnerDocument->renameNode($this->myDOMNode,$this->myDOMNode->namespaceURI,$name);} |
319 | - function set_namespace($uri,$prefix=null) |
|
319 | + function set_namespace($uri, $prefix = null) |
|
320 | 320 | {//Contributions by Daniel Walker 2006-09-08 |
321 | - $nsprefix=$this->myDOMNode->lookupPrefix($uri); |
|
322 | - if ($nsprefix==null) |
|
321 | + $nsprefix = $this->myDOMNode->lookupPrefix($uri); |
|
322 | + if ($nsprefix == null) |
|
323 | 323 | { |
324 | - $nsprefix= $prefix==null ? $nsprefix='a'.sprintf('%u',crc32($uri)) : $prefix; |
|
325 | - if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) |
|
324 | + $nsprefix = $prefix == null ? $nsprefix = 'a'.sprintf('%u', crc32($uri)) : $prefix; |
|
325 | + if ($this->myDOMNode->nodeType === XML_ATTRIBUTE_NODE) |
|
326 | 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)) |
|
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 | 329 | {//Remove namespace |
330 | - $parent=$this->myDOMNode->ownerElement; |
|
330 | + $parent = $this->myDOMNode->ownerElement; |
|
331 | 331 | $parent->removeAttributeNode($this->myDOMNode); |
332 | - $parent->setAttribute($this->myDOMNode->localName,$this->myDOMNode->nodeValue); |
|
333 | - $this->myDOMNode=$parent->getAttributeNode($this->myDOMNode->localName); |
|
332 | + $parent->setAttribute($this->myDOMNode->localName, $this->myDOMNode->nodeValue); |
|
333 | + $this->myDOMNode = $parent->getAttributeNode($this->myDOMNode->localName); |
|
334 | 334 | return; |
335 | 335 | } |
336 | - $this->myDOMNode->ownerElement->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:'.$nsprefix,$uri); |
|
336 | + $this->myDOMNode->ownerElement->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:'.$nsprefix, $uri); |
|
337 | 337 | } |
338 | 338 | } |
339 | - if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) |
|
339 | + if ($this->myDOMNode->nodeType === XML_ATTRIBUTE_NODE) |
|
340 | 340 | { |
341 | - $parent=$this->myDOMNode->ownerElement; |
|
341 | + $parent = $this->myDOMNode->ownerElement; |
|
342 | 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); |
|
343 | + $parent->setAttributeNS($uri, $nsprefix.':'.$this->myDOMNode->localName, $this->myDOMNode->nodeValue); |
|
344 | + $this->myDOMNode = $parent->getAttributeNodeNS($uri, $this->myDOMNode->localName); |
|
345 | 345 | } |
346 | - elseif ($this->myDOMNode->nodeType===XML_ELEMENT_NODE) |
|
346 | + elseif ($this->myDOMNode->nodeType === XML_ELEMENT_NODE) |
|
347 | 347 | { |
348 | - $NewNode=$this->myDOMNode->ownerDocument->createElementNS($uri,$nsprefix.':'.$this->myDOMNode->localName); |
|
348 | + $NewNode = $this->myDOMNode->ownerDocument->createElementNS($uri, $nsprefix.':'.$this->myDOMNode->localName); |
|
349 | 349 | foreach ($this->myDOMNode->attributes as $n) $NewNode->appendChild($n->cloneNode(true)); |
350 | 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; |
|
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 | 356 | } |
357 | 357 | } |
358 | 358 | function unlink_node() |
359 | 359 | { |
360 | - if ($this->myDOMNode->parentNode!=null) |
|
360 | + if ($this->myDOMNode->parentNode != null) |
|
361 | 361 | { |
362 | - if ($this->myDOMNode->nodeType===XML_ATTRIBUTE_NODE) $this->myDOMNode->parentNode->removeAttributeNode($this->myDOMNode); |
|
362 | + if ($this->myDOMNode->nodeType === XML_ATTRIBUTE_NODE) $this->myDOMNode->parentNode->removeAttributeNode($this->myDOMNode); |
|
363 | 363 | else $this->myDOMNode->parentNode->removeChild($this->myDOMNode); |
364 | 364 | } |
365 | 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) |
|
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 | 368 | {//Check the PHP5 DOMNode before creating a new associated PHP4 DOMNode wrapper |
369 | - if ($aDOMNode==null) return null; |
|
369 | + if ($aDOMNode == null) return null; |
|
370 | 370 | switch ($aDOMNode->nodeType) |
371 | 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); |
|
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 | 377 | } |
378 | 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 | 389 | function __get($name) |
390 | 390 | { |
391 | - if ($name==='tagname') return '#text'; |
|
391 | + if ($name === 'tagname') return '#text'; |
|
392 | 392 | else return parent::__get($name); |
393 | 393 | } |
394 | - function tagname() {return '#text';} |
|
395 | - function set_content($text) {$this->myDOMNode->nodeValue=$text; return true;} |
|
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); |
|
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 | 405 | /*define('XPATH_POINT',5); |
406 | 406 | define('XPATH_RANGE',6); |
407 | 407 | define('XPATH_LOCATIONSET',7); |
@@ -413,36 +413,36 @@ discard block |
||
413 | 413 | { |
414 | 414 | private $myDOMNodelist; |
415 | 415 | public $nodeset; |
416 | - public $type=XPATH_UNDEFINED; |
|
416 | + public $type = XPATH_UNDEFINED; |
|
417 | 417 | public $value; |
418 | - function php4DOMNodelist($aDOMNodelist,$aOwnerDocument) |
|
418 | + function php4DOMNodelist($aDOMNodelist, $aOwnerDocument) |
|
419 | 419 | { |
420 | 420 | if (!isset($aDOMNodelist)) return; |
421 | - elseif (is_object($aDOMNodelist)||is_array($aDOMNodelist)) |
|
421 | + elseif (is_object($aDOMNodelist) || is_array($aDOMNodelist)) |
|
422 | 422 | { |
423 | - if ($aDOMNodelist->length>0) |
|
423 | + if ($aDOMNodelist->length > 0) |
|
424 | 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); |
|
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 | 430 | } |
431 | 431 | } |
432 | - elseif (is_int($aDOMNodelist)||is_float($aDOMNodelist)) |
|
432 | + elseif (is_int($aDOMNodelist) || is_float($aDOMNodelist)) |
|
433 | 433 | { |
434 | - $this->type=XPATH_NUMBER; |
|
435 | - $this->value=$aDOMNodelist; |
|
434 | + $this->type = XPATH_NUMBER; |
|
435 | + $this->value = $aDOMNodelist; |
|
436 | 436 | } |
437 | 437 | elseif (is_bool($aDOMNodelist)) |
438 | 438 | { |
439 | - $this->type=XPATH_BOOLEAN; |
|
440 | - $this->value=$aDOMNodelist; |
|
439 | + $this->type = XPATH_BOOLEAN; |
|
440 | + $this->value = $aDOMNodelist; |
|
441 | 441 | } |
442 | 442 | elseif (is_string($aDOMNodelist)) |
443 | 443 | { |
444 | - $this->type=XPATH_STRING; |
|
445 | - $this->value=$aDOMNodelist; |
|
444 | + $this->type = XPATH_STRING; |
|
445 | + $this->value = $aDOMNodelist; |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | } |
@@ -454,46 +454,46 @@ discard block |
||
454 | 454 | function php4DOMXPath($dom_document) |
455 | 455 | { |
456 | 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); |
|
457 | + $this->myOwnerDocument = $dom_document->myOwnerDocument; |
|
458 | + $this->myDOMXPath = new DOMXPath($this->myOwnerDocument->myDOMNode); |
|
459 | 459 | } |
460 | - function xpath_eval($eval_str,$contextnode=null) |
|
460 | + function xpath_eval($eval_str, $contextnode = null) |
|
461 | 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; |
|
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 | 466 | } |
467 | - function xpath_register_ns($prefix,$namespaceURI) {return $this->myDOMXPath->registerNamespace($prefix,$namespaceURI);} |
|
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));} |
|
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 | 475 | class php4DomXsltStylesheet |
476 | 476 | { |
477 | 477 | private $myxsltProcessor; |
478 | 478 | function php4DomXsltStylesheet($dom_document) |
479 | 479 | { |
480 | - $this->myxsltProcessor=new xsltProcessor(); |
|
480 | + $this->myxsltProcessor = new xsltProcessor(); |
|
481 | 481 | $this->myxsltProcessor->importStyleSheet($dom_document); |
482 | 482 | } |
483 | - function process($dom_document,$xslt_parameters=array(),$param_is_xpath=false) |
|
483 | + function process($dom_document, $xslt_parameters = array(), $param_is_xpath = false) |
|
484 | 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); |
|
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 | 488 | return $myphp4DOMDocument; |
489 | 489 | } |
490 | - function result_dump_file($dom_document,$filename) |
|
490 | + function result_dump_file($dom_document, $filename) |
|
491 | 491 | { |
492 | - $html=$dom_document->myDOMNode->saveHTML(); |
|
493 | - file_put_contents($filename,$html); |
|
492 | + $html = $dom_document->myDOMNode->saveHTML(); |
|
493 | + file_put_contents($filename, $html); |
|
494 | 494 | return $html; |
495 | 495 | } |
496 | - function result_dump_mem($dom_document) {return $dom_document->myDOMNode->saveHTML();} |
|
496 | + function result_dump_mem($dom_document) {return $dom_document->myDOMNode->saveHTML(); } |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | ?> |