svn: /pear2/sandbox/SimpleChannelFrontend/trunk/ src/SimpleChannelFrontend/ReleaseFileBrowser/FilteredIterator.php src/SimpleChannelFrontend/ReleaseFileBrowser.php www/templates/html/ReleaseFileBrowser.tpl.php
[email protected] (Brett Bieber)
| Newsgroups | php.pear.cvs,php.pear.core |
|---|---|
| Message-ID | <[email protected]> |
saltybeagle Tue, 13 Jul 2010 04:07:38 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=301227
Log:
Add a FilterIterator to filter out unwanted files from the file browser. Ignore .xmlregistry Directory.
Changed paths:
A pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ReleaseFileBrowser/
A pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ReleaseFileBrowser/FilteredIterator.php
U pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ReleaseFileBrowser.php
U pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/html/ReleaseFileBrowser.tpl.php
Added: pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ReleaseFileBrowser/FilteredIterator.php
===================================================================
--- pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ReleaseFileBrowser/FilteredIterator.php (rev 0)
+++ pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ReleaseFileBrowser/FilteredIterator.php 2010-07-13 04:07:38 UTC (rev 301227)
@@ -0,0 +1,15 @@
+<?php
+namespace PEAR2\SimpleChannelFrontend\ReleaseFileBrowser;
+
+class FilteredIterator extends \RecursiveFilterIterator
+{
+ function __construct($iterator)
+ {
+ parent::__construct($iterator);
+ }
+
+ function accept()
+ {
+ return !($this->getInnerIterator()->getBasename() == '.xmlregistry');
+ }
+}
\ No newline at end of file
Modified: pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ReleaseFileBrowser.php
===================================================================
--- pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ReleaseFileBrowser.php 2010-07-13 01:56:07 UTC (rev 301226)
+++ pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ReleaseFileBrowser.php 2010-07-13 04:07:38 UTC (rev 301227)
@@ -48,7 +48,7 @@
throw new \Exception('Cannot find the package ' . $file . '.');
}
- $this->releaseFile = new \PharData($file);
+ $this->releaseFile = new ReleaseFileBrowser\FilteredIterator(new \PharData($file));
if (isset($options['file'])) {
$file = 'phar://' . $file . '/' . $options['file'];
Modified: pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/html/ReleaseFileBrowser.tpl.php
===================================================================
--- pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/html/ReleaseFileBrowser.tpl.php 2010-07-13 01:56:07 UTC (rev 301226)
+++ pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/html/ReleaseFileBrowser.tpl.php 2010-07-13 04:07:38 UTC (rev 301227)
@@ -1,6 +1,6 @@
<ul style="width:250px; float:left;">
<?php
-foreach (new RecursiveIteratorIterator($context->getRaw('release')) as $file) {
+foreach ($context->release as $file) {
$filename = substr($file, strpos($file, $context->options['release'])+strlen($context->options['release'])+1);
echo '<li><a href="?view=filebrowser&release='.$context->options['release'].'&internal='.$filename.'">'.$filename.'</a></li>';
}