Skip to content

Commit 3c3c548

Browse files
committed
[plugin:update_entities] get DTD by func->http_request()
1 parent a3eff0d commit 3c3c548

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

xoops_trust_path/modules/xpwiki/plugin/update_entities.inc.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,16 @@ function plugin_update_entities_create($do = FALSE)
6969
$items = array('php:html_translation_table');
7070
$matches = array();
7171
foreach ($files as $file) {
72-
$source = file($this->cont['W3C_XHTML_DTD_LOCATION'] . $file);
73-
// or die_message('cannot receive ' . W3C_XHTML_DTD_LOCATION . $file . '.');
74-
if (! is_array($source)) {
75-
$items[] = 'w3c:' . $file . ' COLOR(red):not found.';
72+
$results = $this->func->http_request($this->cont['W3C_XHTML_DTD_LOCATION'] . $file,
73+
'GET', '', array(), NULL, '', TRUE, 1,
74+
10, // connect timeout
75+
60); // request timeout
76+
if (! $results['data'] || $results['rc'] != 200) {
77+
$items[] = 'w3c:' . $file . ' COLOR(red):not found.' . $this->func->htmlspecialchars($results['data']);
7678
continue;
7779
}
7880
$items[] = 'w3c:' . $file;
79-
if (preg_match_all('/<!ENTITY\s+([A-Za-z0-9]+)/',
80-
join('', $source), $matches, PREG_PATTERN_ORDER))
81+
if (preg_match_all('/<!ENTITY\s+([A-Za-z0-9]+)/', $results['data'], $matches, PREG_PATTERN_ORDER))
8182
{
8283
$entities = array_merge($entities, $matches[1]);
8384
}

0 commit comments

Comments
 (0)