Changeset 1911cc4 in github
- Timestamp:
- Nov 19, 2011 4:46:38 AM (19 months ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.8
- Children:
- bda028e
- Parents:
- e37e7dd
- File:
-
- 1 edited
-
program/steps/settings/about.inc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/steps/settings/about.inc
r45fa64c r1911cc4 31 31 $plugins = array_flip($plugins); 32 32 33 $metadata = array(34 'name' => 'string(//rc:package/rc:name)',35 'version' => 'string(//rc:package/rc:version/rc:release)',36 'license' => 'string(//rc:package/rc:license)',37 'license_uri' => 'string(//rc:package/rc:license/@uri)',38 'source_uri' => 'string(//rc:package/rc:srcuri)',39 );40 41 33 foreach ($plugins as $name => $plugin) { 42 $package = INSTALL_PATH . "/plugins/$name/package.xml"; 43 if (file_exists($package) && ($file = file_get_contents($package))) { 44 $doc = new DOMDocument(); 45 $doc->loadXML($file); 46 $xpath = new DOMXPath($doc); 47 $xpath->registerNamespace('rc', "http://pear.php.net/dtd/package-2.0"); 48 $data = array(); 49 50 foreach ($metadata as $key => $path) { 51 $data[$key] = $xpath->evaluate($path); 52 } 53 54 $plugins[$name] = $data; 55 } 56 else { 57 unset($plugins[$name]); 58 } 34 rcube_plugin_data($name, $plugins); 59 35 } 60 36 … … 74 50 75 51 foreach ($plugins as $name => $data) { 52 $uri = $data['uri'] ? $data['uri'] : $data['channel']; 53 if ($uri && stripos($uri, 'http') !== 0) { 54 $uri = 'http://' . $uri; 55 } 56 76 57 $table->add_row(); 77 58 $table->add('name', Q($data['name'] ? $data['name'] : $name)); … … 79 60 $table->add('license', $data['license_uri'] ? html::a(array('target' => '_blank', href=> Q($data['license_uri'])), 80 61 Q($data['license'])) : $data['license']); 81 $table->add('source', $ data['source_uri'] ? html::a(array('target' => '_blank', href=> Q($data['source_uri'])),62 $table->add('source', $uri ? html::a(array('target' => '_blank', href=> Q($uri)), 82 63 Q(rcube_label('source'))) : ''); 83 64 } … … 86 67 } 87 68 69 function rcube_plugin_data($name, &$plugins = array()) 70 { 71 // XPaths of plugin metadata elements 72 $metadata = array( 73 'name' => 'string(//rc:package/rc:name)', 74 'version' => 'string(//rc:package/rc:version/rc:release)', 75 'license' => 'string(//rc:package/rc:license)', 76 'license_uri' => 'string(//rc:package/rc:license/@uri)', 77 'uri' => 'string(//rc:package/rc:uri)', 78 'channel' => 'string(//rc:package/rc:channel)', 79 ); 80 81 $package = INSTALL_PATH . "/plugins/$name/package.xml"; 82 if (file_exists($package) && ($file = file_get_contents($package))) { 83 $doc = new DOMDocument(); 84 $doc->loadXML($file); 85 $xpath = new DOMXPath($doc); 86 $xpath->registerNamespace('rc', "http://pear.php.net/dtd/package-2.0"); 87 $data = array(); 88 89 foreach ($metadata as $key => $path) { 90 $data[$key] = $xpath->evaluate($path); 91 } 92 93 $plugins[$name] = $data; 94 95 // dependent required plugins (can be used, but not included in config) 96 $deps = $xpath->evaluate('//rc:package/rc:dependencies/rc:required/rc:package/rc:name'); 97 $cnt = $deps->length; 98 99 for ($i=0; $i<$cnt; $i++) { 100 $dn = $deps->item($i)->nodeValue; 101 if (!array_key_exists($dn, $plugins)) { 102 rcube_plugin_data($dn, $plugins); 103 } 104 } 105 } 106 else { 107 unset($plugins[$name]); 108 } 109 } 110 111 88 112 $OUTPUT->set_pagetitle(rcube_label('about')); 89 113
Note: See TracChangeset
for help on using the changeset viewer.
