Esempio n. 1
0
 public function testIsSubmittedInputWithCSRFCheck()
 {
     $uid = (string) crc32(__FILE__ . '_' . (__LINE__ + 6));
     $csrf = sha1(session_id());
     $input['gajus']['dora']['uid'] = $uid;
     $input['gajus']['dora']['csrf'] = $csrf;
     $form = new \Gajus\Dora\Form($input);
     $this->assertSame($form->getUid(), $uid);
     $this->assertTrue($form->isSubmitted(false));
     $this->assertTrue($form->isSubmitted());
 }
Esempio n. 2
0
 public function testInputData()
 {
     $uid = (string) crc32(__FILE__ . '_' . (__LINE__ + 11));
     $input = ['foo' => 'bar', 'gajus' => ['dora' => ['uid' => $uid]]];
     $form = new \Gajus\Dora\Form($input);
     $this->assertSame($form->getUid(), $uid);
     $this->assertTrue($form->isSubmitted(false));
     $this->assertSame(['foo' => 'bar'], $form->getData());
 }
Esempio n. 3
0
</label>
        <?php 
    echo $input;
    ?>
        <?php 
    /*if ($tags):?>
      <ul class="demo-tags">
          <li><?=implode('</li><li>', $tags)?></li>
      </ul>
      <?php endif;*/
    ?>
    </div>
    <?php 
    return ob_get_clean();
});
?>
<form action="" method="post">
    <?php 
echo $label->input('tag_input');
?>
    <?php 
echo $form->input('action[submit]', ['type' => 'submit', 'value' => 'Submit']);
?>
</form>
<?php 
if ($form->isSubmitted()) {
    foreach (array_filter(explode(',', $_POST['tag_input'])) as $tag) {
        // Append new "tag-list" value to the input[name="tag_input"] dataset.
        $form->send('tag_input', 'tag-list', htmlspecialchars($tag));
    }
}