Zeta Components shortcut

Shortcuts

The following shortcuts are available:

Patches ? Bugs ? Outdated redirects ? Feature requests ?

Please inform user "jpic" of IRC channel #zetacomponents on irc.freenode.net.

Source

<?php
#
# Synopsis
#  
# Dumb script that just creates a bunch of cool redirects in the nginx configuration format.
# Requires nginx with http rewrite module.
#
# Configuration
#
# In nginx.conf:
#
#    server {
#            listen          88.191.225.233;
#            server_name     zetac.org;
#            include         /etc/nginx/zetac;
#            root            /srv/zetac.org/www;
#    }   
#
# Usage
# 
# jpic@paloma:~/src/zeta/website$ php scripts/nginx.php > /etc/nginx/zetac
# 

define( 'AUTOLOADS', dirname( __FILE__ ) . '/../../trunk/autoload/*_autoload.php' );

$htaccess = ''; 

foreach( glob( AUTOLOADS ) as $autoload ) { 
    $autoloadArray = include $autoload;

    $tmp = explode( '/', current( $autoloadArray ) );
    $component = $tmp[0];
    $lowerComponent = strtolower( $component );
    
    // forward /Component to /documentation/trunk/Component/tutorial.html
    echo "rewrite /$component\$ http://incubator.apache.org/zetacomponents/documentation/trunk/$component/tutorial.html redirect;\n";
    // forward /component to /documentation/trunk/Component/tutorial.html
    echo "rewrite /$lowerComponent\$ http://incubator.apache.org/zetacomponents/documentation/trunk/$component/tutorial.html redirect;\n";

    foreach( $autoloadArray as $class => $path ) { 
        $lowerClass = strtolower( $class );
        $realPath = preg_replace( '@^([^/]+)/(.*)$@', '$1/src/$2', $path );

        // forwarrd /ezcClassName to /zetacomponents/documentation/trunk/Component/phpdoc/ezcClassName.html
        echo "rewrite /$class\$ http://incubator.apache.org/zetacomponents/documentation/trunk/$component/phpdoc/$class.html redirect;\n";
        // forwarrd /ezcclassname to /zetacomponents/documentation/trunk/Component/phpdoc/ezcClassName.html
        echo "rewrite /$lowerClass\$ http://incubator.apache.org/zetacomponents/documentation/trunk/$component/phpdoc/$class.html redirect;\n";
        // forwarrd /ezcClassName/src to http://fisheye6.atlassian.com/browse/zetacomponents/trunk/PATH?r=HEAD
        echo "rewrite /$class/src\$ http://fisheye6.atlassian.com/browse/zetacomponents/trunk/$realPath?r=HEAD redirect;\n";
        // forwarrd /ezcclassname/src to http://fisheye6.atlassian.com/browse/zetacomponents/trunk/PATH?r=HEAD
        echo "rewrite /$lowerClass/src\$ http://fis
    }   
}
        

Credits

Sponsor

zetac.org is sponsored by ChocolatePistachio hackers

See also

If you like this website, then you probably like to help others on IRC.