本文整理汇总了PHP中HTML_QuickForm2::removeAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm2::removeAttribute方法的具体用法?PHP HTML_QuickForm2::removeAttribute怎么用?PHP HTML_QuickForm2::removeAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_QuickForm2
的用法示例。
在下文中一共展示了HTML_QuickForm2::removeAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printForm
function printForm($data = array())
{
foreach (array('name', 'email', 'copy_me', 'subject', 'text') as $value) {
if (!isset($data[$value])) {
$data[$value] = '';
}
}
$form = new HTML_QuickForm2('contect', 'post', array('action' => '/account-mail.php?handle=' . htmlspecialchars($_GET['handle'])));
$form->removeAttribute('name');
// Set defaults for the form elements
$form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('name' => htmlspecialchars($data['name']), 'email' => htmlspecialchars($data['email']), 'copy_me' => htmlspecialchars($data['copy_me']), 'subject' => htmlspecialchars($data['subject']), 'text' => htmlspecialchars($data['text']))));
$form->addElement('text', 'name', array('required' => 'required'))->setLabel('Y<span class="accesskey">o</span>ur Name:', 'size="40" accesskey="o"');
$form->addElement('email', 'email', array('required' => 'required'))->setLabel('Email Address:');
$form->addElement('checkbox', 'copy_me')->setLabel('CC me?:');
$form->addElement('text', 'subject', array('required' => 'required', 'size' => '80'))->setLabel('Subject:');
$form->addElement('textarea', 'text', array('cols' => 80, 'rows' => 10, 'required' => 'required'))->setLabel('Text:');
if (!auth_check('pear.dev')) {
$numeralCaptcha = new Text_CAPTCHA_Numeral();
$form->addElement('number', 'captcha', array('maxlength' => 4, 'required' => 'required'))->setLabel("What is " . $numeralCaptcha->getOperation() . '?');
$_SESSION['answer'] = $numeralCaptcha->getAnswer();
}
$form->addElement('submit', 'submit')->setLabel('Send Email');
print $form;
}
示例2: htmlspecialchars
echo 'No karma yet';
} else {
$table = new HTML_Table('style="width: 90%"');
$table->setCaption('Karma levels for ' . htmlspecialchars($handle), 'style="background-color: #CCCCCC;"');
$table->addRow(array("Level", "Added by", "Added at", "Remove"), null, 'th');
foreach ($user_karma as $item) {
$remove = sprintf("karma.php?action=remove&handle=%s&level=%s", htmlspecialchars($handle), htmlspecialchars($item['level']));
$table->addRow(array(htmlspecialchars($item['level']), htmlspecialchars($item['granted_by']), htmlspecialchars($item['granted_at']), make_link($remove, make_image("delete.gif"), false, 'onclick="javascript:return confirm(\'Do you really want to remove the karma level ' . htmlspecialchars($item['level']) . '?\');"')));
}
echo $table->toHTML();
}
echo "<br /><br />";
$table = new HTML_Table('style="width: 100%"');
$table->setCaption("Grant karma to " . htmlspecialchars($handle), 'style="background-color: #CCCCCC;"');
$form = new HTML_QuickForm2('karma_grant', 'post', array('action' => 'karma.php?action=grant'));
$form->removeAttribute('name');
$form->addElement('text', 'level')->setLabel('Level: ');
$form->addElement('hidden', 'handle')->setValue(htmlspecialchars($handle));
$form->addElement('submit', 'submit')->setLabel('Submit Changes');
$csrf_token_value = create_csrf_token($csrf_token_name);
$form->addElement('hidden', $csrf_token_name)->setValue($csrf_token_value);
$table->addRow(array((string) $form));
echo $table->toHTML();
}
echo "<p> </p><hr />";
$table = new HTML_Table('style="width: 90%"');
$table->setCaption("Karma Statistics", 'style="background-color: #CCCCCC;"');
if (!empty($_GET['a']) && $_GET['a'] == "details" && !empty($_GET['level'])) {
$table->addRow(array('Handle', 'Granted'), null, 'th');
foreach ($karma->getUsers($_GET['level']) as $user) {
$detail = sprintf("Granted by <a href=\"/user/%s\">%s</a> on %s", htmlspecialchars($user['granted_by']), htmlspecialchars($user['granted_by']), htmlspecialchars($user['granted_at']));
示例3: testIdAndMethodAreReadonly
public function testIdAndMethodAreReadonly()
{
$form = new HTML_QuickForm2('foo', 'get');
try {
$form->removeAttribute('id');
} catch (HTML_QuickForm2_InvalidArgumentException $e) {
try {
$form->setAttribute('method', 'post');
} catch (HTML_QuickForm2_InvalidArgumentException $e) {
try {
$form->setId('newId');
} catch (HTML_QuickForm2_InvalidArgumentException $e) {
return;
}
}
}
$this->fail('Expected HTML_QuickForm2_InvalidArgumentException was not thrown');
}