Prado\Web\UI\WebControls\TCaptcha::generatePrivateKeyFile PHP Method

generatePrivateKeyFile() protected method

Generates a file with a randomly generated private key.
protected generatePrivateKeyFile ( ) : string
return string the path of the file keeping the private key
    protected function generatePrivateKeyFile()
    {
        $captchaScript = $this->getCaptchaScriptFile();
        $path = dirname($this->getApplication()->getAssetManager()->getPublishedPath($captchaScript));
        $fileName = $path . DIRECTORY_SEPARATOR . 'captcha_key.php';
        if (!is_file($fileName)) {
            @mkdir($path);
            $key = $this->generateRandomKey();
            $content = "<?php\n\$privateKey='{$key}';\n?>";
            file_put_contents($fileName, $content);
        }
        return $fileName;
    }