Symfony\Component\Form\FormConfiguration::getDefaultCsrfFieldName PHP 메소드

getDefaultCsrfFieldName() 공개 정적인 메소드

Returns the default CSRF field name
public static getDefaultCsrfFieldName ( ) : string
리턴 string The CSRF field name
    static public function getDefaultCsrfFieldName()
    {
        return self::$defaultCsrfFieldName;
    }

Usage Example

예제 #1
0
파일: Form.php 프로젝트: notbrain/symfony
 /**
  * Enables CSRF protection for this form.
  */
 public function enableCsrfProtection($csrfFieldName = null, $csrfSecret = null)
 {
     if (!$this->isCsrfProtected()) {
         if (null === $csrfFieldName) {
             $csrfFieldName = FormConfiguration::getDefaultCsrfFieldName();
         }
         if (null === $csrfSecret) {
             $csrfSecret = md5(__FILE__ . php_uname());
         }
         $field = new HiddenField($csrfFieldName, array('property_path' => null));
         $field->setData($this->generateCsrfToken($csrfSecret));
         $this->add($field);
         $this->csrfFieldName = $csrfFieldName;
         $this->csrfSecret = $csrfSecret;
     }
 }