public function execute($filterChain) { $probability = sfConfig::get('app_tipFilter_probability'); srand(myUtils::makeSeed()); $genProb = rand(0, 100) / 100; // put random message to request if ($genProb <= $probability) { $tip = $this->getTip(); $this->getContext()->getRequest()->setParameter('tip', array($tip['place'] => $tip['text'])); } // Execute next filter in the chain $filterChain->execute(); }
public static function getTip() { $holder = tipHolder::getInstance(); srand(myUtils::makeSeed()); return $holder->tips[rand(0, sizeof($holder->tips) - 1)]; }