1. BasesfCodeViewActions.class.php
  2. /** * Base actions for the sfCodeViewPlugin sfCodeView module. * * @package sfCodeViewPlugin * @subpackage sfCodeView * @author Your name here * @version SVN: $Id: BaseActions.class.php 12628 2008-11-04 14:43:36Z Kris.Wallsmith $ */
  3. abstract class BasesfCodeViewActions extends sfActions
  4. {
  5. /**
  6. * Executes index action
  7. *
  8. * @param sfRequest $request A request object
  9. */
  10. public function executeIndex(sfWebRequest $request)
  11. {
  12. $this->class = $request->getParameter('class');
  13. if (empty($this->class))
  14. {
  15. $this->class = $request->getGetParameter('class');
  16. }
  17. $this->method = $request->getParameter('method');
  18. if (empty($this->method))
  19. {
  20. $this->method = $request->getGetParameter('method');
  21. }
  22. if (!empty($this->method))
  23. {
  24. $this->class = array($this->class, $this->method);
  25. }
  26. $this->viewer = new sfCodeViewer($this->class);
  27. if ($request->isXmlHttpRequest())
  28. {
  29. sfProjectConfiguration::getActive()->loadHelpers('Url');
  30. $this->renderText($this->viewer->render(url_for('sfCodeView')));
  31. return sfView::NONE;
  32. }
  33. else
  34. {
  35. // maintain history
  36. $this->history = $this->getUser()->getAttribute('history', array());
  37. if (false !== ($index = array_search($this->class, $this->history)))
  38. {
  39. unset($this->history[$index]);
  40. }
  41. array_unshift($this->history, $this->class);
  42. array_splice($this->history, 10);
  43. $this->getUser()->setAttribute('history', $this->history);
  44. }
  45. }
  46. }

Debug toolbar