00001 <?php 00024 class ImageCodeCaptchaCommand extends BaseCommand implements Commandable { 00030 protected function __construct () { 00031 // Call parent constructor 00032 parent::__construct(__CLASS__); 00033 } 00034 00041 public final static function createImageCodeCaptchaCommand (CommandResolver $resolverInstance) { 00042 // Get new instance 00043 $commandInstance = new ImageCodeCaptchaCommand(); 00044 00045 // Set the application instance 00046 $commandInstance->setResolverInstance($resolverInstance); 00047 00048 // Return the prepared instance 00049 return $commandInstance; 00050 } 00051 00059 public function execute (Requestable $requestInstance, Responseable $responseInstance) { 00060 // Get the decrypted string from request (previously created by a filter!) 00061 $decryptedCode = $requestInstance->getRequestElement('decrypted'); 00062 00063 // Get the application instance 00064 $appInstance = $this->getResolverInstance()->getApplicationInstance(); 00065 00066 // Prepare a template instance 00067 $templateInstance = $this->prepareTemplateInstance($appInstance); 00068 00069 // Assign variable 00070 $templateInstance->assignVariable('decrypted_code', $decryptedCode); 00071 00072 // Load the code (pardon, image...) template 00073 $templateInstance->loadCodeTemplate('code_captcha'); 00074 00075 // Compile the template 00076 $templateInstance->compileTemplate(); 00077 00078 // Compile all variables 00079 $templateInstance->compileVariables(); 00080 00081 // Transfer it to the response 00082 $templateInstance->transferToResponse($responseInstance); 00083 } 00084 00092 public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { 00093 // Extra filters here... 00094 } 00095 } 00096 00097 // [EOF] 00098 ?>
1.5.6