Apmgr / library / ZFHistory / Plugin / History.php

<?php
/**
 * Keep a record of the visitor's steps on our application
 * Push elements into the session stack and pop them out when we hit back
 */

class ZFHistory_Plugin_History extends Zend_Controller_Plugin_Abstract {

    /**
     * (non-PHPdoc)
     * @see library/Zend/Controller/Plugin/Zend_Controller_Plugin_Abstract#preDispatch($request)
     */
    public function preDispatch(Zend_Controller_Request_Abstract $request) {
        $trace = new Zend_Session_Namespace('wulfStorageTrace');
        $url = Zend_Controller_Front :: getInstance()->getBaseUrl() ? Zend_Controller_Front :: getInstance()->getBaseUrl() : "/";

        //Yield the url
        //TODO can't work well with exceptions
        foreach( $request->getUserParams() as $id=>$x ) {
            $url .=$x.DIRECTORY_SEPARATOR;
        }


        if( isset($trace->history) ) {
            $found = false;
            //	If we find it, then do not add it into the stack
            foreach($trace->history as $key=>$value) {
                if($value==$url) {
                    $found = true;
                    break;
                }
            }
            if($found==false) {
                $trace->history[] = $url;
            }
        } else {
            $trace->history = array();
            foreach( $request->getUserParams() as $id=>$x ) {
                $url .=$x.DIRECTORY_SEPARATOR;
            }
            $trace->history[] = $url;
        }
    }
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.