本文整理汇总了PHP中Form::disableSecurityToken方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::disableSecurityToken方法的具体用法?PHP Form::disableSecurityToken怎么用?PHP Form::disableSecurityToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Form
的用法示例。
在下文中一共展示了Form::disableSecurityToken方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Form
function Form()
{
$form = new Form($this, 'Form', new FieldList(new EmailField('Email')), new FieldList(new FormAction('doSubmit')), new RequiredFields('Email'));
// Disable CSRF protection for easier form submission handling
$form->disableSecurityToken();
return $form;
}
示例2: getGoogleSiteSearchForm
/**
* returns the form
* @return Form
*/
public function getGoogleSiteSearchForm($name = "GoogleSiteSearchForm")
{
$formIDinHTML = "Form_" . $name;
if ($page = GoogleCustomSearchPage::get()->first()) {
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::javascript('googlecustomsearch/javascript/GoogleCustomSearch.js');
$apiKey = Config::inst()->get("GoogleCustomSearchExt", "api_key");
$cxKey = Config::inst()->get("GoogleCustomSearchExt", "cx_key");
if ($apiKey && $cxKey) {
Requirements::customScript("\n\t\t\t\t\t\tGoogleCustomSearch.apiKey = '" . $apiKey . "';\n\t\t\t\t\t\tGoogleCustomSearch.cxKey = '" . $cxKey . "';\n\t\t\t\t\t\tGoogleCustomSearch.formSelector = '#" . $formIDinHTML . "';\n\t\t\t\t\t\tGoogleCustomSearch.inputFieldSelector = '#" . $formIDinHTML . "_search';\n\t\t\t\t\t\tGoogleCustomSearch.resultsSelector = '#" . $formIDinHTML . "_Results';\n\t\t\t\t\t", "GoogleCustomSearchExt");
$form = new Form($this->owner, 'GoogleSiteSearchForm', new FieldList($searchField = new TextField('search'), $resultField = new LiteralField($name . "_Results", "<div id=\"" . $formIDinHTML . "_Results\"></div>")), new FieldList(new FormAction('doSearch', _t("GoogleCustomSearchExt.GO", "Full Results"))));
$form->setFormMethod('GET');
if ($page = GoogleCustomSearchPage::get()->first()) {
$form->setFormAction($page->Link());
}
$form->disableSecurityToken();
$form->loadDataFrom($_GET);
$searchField->setAttribute("autocomplete", "off");
$form->setAttribute("autocomplete", "off");
return $form;
} else {
user_error("You must set an API Key and a CX key in your configs to use the Google Custom Search Form", E_USER_NOTICE);
}
} else {
user_error("You must create a GoogleCustomSearchPage first.", E_USER_NOTICE);
}
}
示例3: HasManyForm
function HasManyForm()
{
$team = DataObject::get_one('ComplexTableFieldTest_Team', "\"Name\" = 'The Awesome People'");
$sponsorsField = new ComplexTableField($this, 'Sponsors', 'ComplexTableFieldTest_Sponsor', ComplexTableFieldTest_Sponsor::$summary_fields, 'getCMSFields');
$sponsorsField->setParentClass('ComplexTableFieldTest_Team');
$form = new Form($this, 'HasManyForm', new FieldSet(new HiddenField('ID', '', $team->ID), $sponsorsField), new FieldSet(new FormAction('doSubmit', 'Submit')));
$form->disableSecurityToken();
return $form;
}
示例4: Form
public function Form()
{
$fields = new FieldList(new TextField('Name'), new EmailField('Email'), new TextareaField('Content'));
$actions = new FieldList(new FormAction('doSubmit', 'Submit'));
$validator = new RequiredFields('Name', 'Content');
$form = new Form($this, 'Form', $fields, $actions, $validator);
$form->enableSpamProtection(array('protector' => 'AkismetSpamProtector', 'name' => 'IsSpam', 'mapping' => array('Content' => 'body', 'Name' => 'authorName', 'Email' => 'authorMail')));
// Because we don't want to be testing this
$form->disableSecurityToken();
return $form;
}
示例5: Form
function Form()
{
$query = $this->request->getVar("search");
$fields = new FieldList(new TextField("search", "", $query));
$actions = new FieldList($searchaction = new FormAction("index", "Search"));
$searchaction->setFullAction(null);
$form = new Form($this, "SearchForm", $fields, $actions);
$form->setFormAction($this->Link());
$form->setFormMethod("GET");
$form->disableSecurityToken();
return $form;
}
示例6: getGoogleSiteSearchForm
/**
* Return a form which sends the user to the first results page. If you want
* to customize this form, use your own extension and apply that to the
* page.
*
* @return Form
*/
public function getGoogleSiteSearchForm()
{
if ($page = GoogleSiteSearchPage::get()->first()) {
$label = Config::inst()->get('GoogleSiteSearchDefaultFormExtension', 'submit_button_label');
$formLabel = Config::inst()->get('GoogleSiteSearchDefaultFormExtension', 'input_label');
$form = new Form($this, 'GoogleSiteSearchForm', new FieldList(new TextField('Search', $formLabel)), new FieldList(new FormAction('doSearch', $label)));
$form->setFormMethod('GET');
$form->setFormAction($page->Link());
$form->disableSecurityToken();
$form->loadDataFrom($_GET);
return $form;
}
}
开发者ID:helpfulrobot,项目名称:dnadesign-silverstripe-googlesitesearch,代码行数:20,代码来源:GoogleSiteSearchDefaultFormExtension.php
示例7: SearchForm
public function SearchForm()
{
$searchText = '';
if ($this->request && $this->request->getVar('Search')) {
$searchText = $this->request->getVar('Search');
}
$queryField = new TextField('Search', FALSE, $searchText);
$queryField->setAttribute('placeholder', 'Search news');
$fields = new FieldList($queryField);
$actions = new FieldList(new FormAction('results', 'Search'));
$form = new Form($this, 'SearchForm', $fields, $actions);
$form->setFormMethod('get');
$form->disableSecurityToken();
return $form;
}
示例8: ProcessForm
/**
* Show the "choose payment method" form
*/
function ProcessForm()
{
$fields = new FieldList();
// Create a dropdown select field for choosing gateway
$supported_methods = PaymentProcessor::get_supported_methods();
$source = array();
foreach ($supported_methods as $methodName) {
$methodConfig = PaymentFactory::get_factory_config($methodName);
$source[$methodName] = $methodConfig['title'];
}
$fields->push(new DropDownField('PaymentMethod', 'Select Payment Method', $source));
$actions = new FieldList(new FormAction('proceed', 'Proceed'));
$processForm = new Form($this, 'ProcessForm', $fields, $actions);
$processForm->disableSecurityToken();
return $processForm;
}
示例9: ImageForm
/**
* Return a {@link Form} instance allowing a user to
* add images to the TinyMCE content editor.
*
* @return Form
*/
function ImageForm()
{
Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js");
Requirements::javascript(EXTERNALCONTENT . "/javascript/external_tiny_mce_improvements.js");
Requirements::css('cms/css/TinyMCEImageEnhancement.css');
Requirements::javascript('cms/javascript/TinyMCEImageEnhancement.js');
Requirements::javascript(THIRDPARTY_DIR . '/SWFUpload/SWFUpload.js');
Requirements::javascript(CMS_DIR . '/javascript/Upload.js');
$form = new Form($this->controller, "{$this->name}/ImageForm", new FieldSet(new LiteralField('Heading', '<h2><img src="cms/images/closeicon.gif" alt="' . _t('HtmlEditorField.CLOSE', 'close') . '" title="' . _t('HtmlEditorField.CLOSE', 'close') . '" />' . _t('HtmlEditorField.IMAGE', 'Image') . '</h2>'), new TreeDropdownField('FolderID', _t('HtmlEditorField.FOLDER', 'Folder'), 'Folder'), new LiteralField('AddFolderOrUpload', '<div style="clear:both;"></div><div id="AddFolderGroup" style="display: none">
<a style="" href="#" id="AddFolder" class="link">' . _t('HtmlEditorField.CREATEFOLDER', 'Create Folder') . '</a>
<input style="display: none; margin-left: 2px; width: 94px;" id="NewFolderName" class="addFolder" type="text">
<a style="display: none;" href="#" id="FolderOk" class="link addFolder">' . _t('HtmlEditorField.OK', 'Ok') . '</a>
<a style="display: none;" href="#" id="FolderCancel" class="link addFolder">' . _t('HtmlEditorField.FOLDERCANCEL', 'Cancel') . '</a>
</div>
<div id="PipeSeparator" style="display: none">|</div>
<div id="UploadGroup" class="group" style="display: none; margin-top: 2px;">
<a href="#" id="UploadFiles" class="link">' . _t('HtmlEditorField.UPLOAD', 'Upload') . '</a>
</div>'), new TextField('getimagesSearch', _t('HtmlEditorField.SEARCHFILENAME', 'Search by file name')), new ThumbnailStripField('FolderImages', 'FolderID', 'getimages'), new TextField('AltText', _t('HtmlEditorField.IMAGEALTTEXT', 'Alternative text (alt) - shown if image cannot be displayed'), '', 80), new TextField('ImageTitle', _t('HtmlEditorField.IMAGETITLE', 'Title text (tooltip) - for additional information about the image')), new TextField('CaptionText', _t('HtmlEditorField.CAPTIONTEXT', 'Caption text')), new DropdownField('CSSClass', _t('HtmlEditorField.CSSCLASS', 'Alignment / style'), array('left' => _t('HtmlEditorField.CSSCLASSLEFT', 'On the left, with text wrapping around.'), 'leftAlone' => _t('HtmlEditorField.CSSCLASSLEFTALONE', 'On the left, on its own.'), 'right' => _t('HtmlEditorField.CSSCLASSRIGHT', 'On the right, with text wrapping around.'), 'center' => _t('HtmlEditorField.CSSCLASSCENTER', 'Centered, on its own.'))), new FieldGroup(_t('HtmlEditorField.IMAGEDIMENSIONS', 'Dimensions'), new TextField('Width', _t('HtmlEditorField.IMAGEWIDTHPX', 'Width'), 100), new TextField('Height', " x " . _t('HtmlEditorField.IMAGEHEIGHTPX', 'Height'), 100))), new FieldSet(new FormAction('insertimage', _t('HtmlEditorField.BUTTONINSERTIMAGE', 'Insert image'))));
$form->disableSecurityToken();
$form->loadDataFrom($this);
return $form;
}
开发者ID:helpfulrobot,项目名称:silverstripe-external-content,代码行数:28,代码来源:ExternalHtmlEditorField_Toolbar.php
示例10: getPostSnapshotForm
/**
* @param SS_HTTPRequest $request
* @return Form
*/
public function getPostSnapshotForm(SS_HTTPRequest $request)
{
// Performs canView permission check by limiting visible projects
$project = $this->getCurrentProject();
if (!$project) {
return $this->project404Response();
}
if (!$project->canUploadArchive()) {
return new SS_HTTPResponse("Not allowed to upload", 401);
}
// Framing an environment as a "group of people with download access"
// makes more sense to the user here, while still allowing us to enforce
// environment specific restrictions on downloading the file later on.
$envs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
return $item->canUploadArchive();
});
$envsMap = array();
foreach ($envs as $env) {
$envsMap[$env->ID] = $env->Name;
}
$form = new Form($this, 'PostSnapshotForm', new FieldList(DropdownField::create('Mode', 'What does this file contain?', DNDataArchive::get_mode_map()), DropdownField::create('EnvironmentID', 'Initial ownership of the file', $envsMap)), new FieldList($action = new FormAction('doPostSnapshot', "Submit request")), new RequiredFields('File'));
$action->addExtraClass('btn');
$form->disableSecurityToken();
$form->addExtraClass('fields-wide');
// Tweak the action so it plays well with our fake URL structure.
$form->setFormAction($project->Link() . '/PostSnapshotForm');
return $form;
}
示例11: SearchForm
function SearchForm()
{
// get all page types in a dropdown-compatible format
$pageTypes = SiteTree::page_type_classes();
array_unshift($pageTypes, 'All');
$pageTypes = array_combine($pageTypes, $pageTypes);
asort($pageTypes);
// get all filter instances
$filters = ClassInfo::subclassesFor('CMSSiteTreeFilter');
$filterMap = array();
// remove base class
array_shift($filters);
// add filters to map
foreach ($filters as $filter) {
$filterMap[$filter] = call_user_func(array($filter, 'title'));
}
// ensure that 'all pages' filter is on top position
uasort($filterMap, create_function('$a,$b', 'return ($a == "CMSSiteTreeFilter_Search") ? 1 : -1;'));
$fields = new FieldSet(new TextField('Term', _t('CMSSearch.FILTERLABELTEXT', 'Content')), $dateGroup = new FieldGroup($dateFrom = new DateField('LastEditedFrom', _t('CMSSearch.FilterDateFrom', 'from')), $dateTo = new DateField('LastEditedTo', _t('CMSSearch.FilterDateFrom', 'to'))), new DropdownField('FilterClass', _t('CMSMain.SearchTreeFormPagesDropdown', 'Pages'), $filterMap), new DropdownField('ClassName', _t('CMSMain.PAGETYPEOPT', 'Page Type', PR_MEDIUM, 'Dropdown for limiting search to a page type'), $pageTypes, null, null, _t('CMSMain.PAGETYPEANYOPT', 'Any')));
$dateGroup->subfieldParam = 'FieldHolder';
$dateFrom->setConfig('showcalendar', true);
$dateTo->setConfig('showcalendar', true);
$actions = new FieldSet($resetAction = new ResetFormAction('clear', _t('CMSMain_left.ss.CLEAR', 'Clear')), $searchAction = new FormAction('doSearch', _t('CMSMain_left.ss.SEARCH', 'Search')));
$resetAction->addExtraClass('ss-ui-action-minor');
$form = new Form($this, 'SearchForm', $fields, $actions);
$form->setFormMethod('GET');
$form->disableSecurityToken();
$form->unsetValidator();
return $form;
}
示例12: TestForm
public function TestForm()
{
$page = AdvancedWidgetEditorTest_FakePage::get()->first();
$form = new Form($this, 'TestForm', new FieldList(new AdvancedWidgetAreaEditor('SideBar')), new FieldList(new FormAction('doSave', 'Save')));
$form->loadDataFrom($page);
$form->disableSecurityToken();
return $form;
}
开发者ID:helpfulrobot,项目名称:undefinedoffset-silverstripe-advancedwidgeteditor,代码行数:8,代码来源:AdvancedWidgetEditorTest.php
示例13: MediaForm
/**
* Return a {@link Form} instance allowing a user to
* add images and flash objects to the TinyMCE content editor.
*
* @return Form
*/
function MediaForm() {
// TODO Handle through GridState within field - currently this state set too late to be useful here (during request handling)
$parentID = $this->controller->getRequest()->requestVar('ParentID');
$fileFieldConfig = GridFieldConfig::create();
$fileFieldConfig->addComponent(new GridFieldSortableHeader());
$fileFieldConfig->addComponent(new GridFieldFilterHeader());
$fileFieldConfig->addComponent(new GridFieldDataColumns());
$fileFieldConfig->addComponent(new GridFieldPaginator(5));
$fileField = new GridField('Files', false, null, $fileFieldConfig);
$fileField->setList($this->getFiles($parentID));
$fileField->setAttribute('data-selectable', true);
$fileField->setAttribute('data-multiselect', true);
$columns = $fileField->getConfig()->getComponentByType('GridFieldDataColumns');
$columns->setDisplayFields(array(
'CMSThumbnail' => false,
'Name' => _t('File.Name'),
));
$numericLabelTmpl = '<span class="step-label"><span class="flyout">%d</span><span class="arrow"></span><strong class="title">%s</strong></span>';
$fromCMS = new CompositeField(
new LiteralField('headerSelect', '<h4 class="field header-select">' . sprintf($numericLabelTmpl, '1', _t('HtmlEditorField.Find', 'Find')) . '</h4>'),
$selectComposite = new CompositeField(
new TreeDropdownField('ParentID', _t('HtmlEditorField.FOLDER', 'Folder'), 'Folder'),
$fileField
)
);
$fromCMS->addExtraClass('content');
$selectComposite->addExtraClass('content-select');
Requirements::css(FRAMEWORK_DIR . '/css/AssetUploadField.css');
$computerUploadField = Object::create('UploadField', 'AssetUploadField', '');
$computerUploadField->setConfig('previewMaxWidth', 40);
$computerUploadField->setConfig('previewMaxHeight', 30);
$computerUploadField->addExtraClass('ss-assetuploadfield');
$computerUploadField->removeExtraClass('ss-uploadfield');
$computerUploadField->setTemplate('HtmlEditorField_UploadField');
$computerUploadField->setFolderName(Upload::$uploads_folder);
$tabSet = new TabSet(
"MediaFormInsertImageTabs",
new Tab(
_t('HtmlEditorField.FROMCOMPUTER','From your computer'),
$computerUploadField
),
new Tab(
_t('HtmlEditorField.FROMCMS','From the CMS'),
$fromCMS
)
);
$allFields = new CompositeField(
$tabSet,
new LiteralField('headerEdit', '<h4 class="field header-edit">' . sprintf($numericLabelTmpl, '2', _t('HtmlEditorField.EditDetails', 'Edit details')) . '</h4>'),
$editComposite = new CompositeField(
new LiteralField('contentEdit', '<div class="content-edit"></div>')
)
);
$fields = new FieldList(
new LiteralField(
'Heading',
sprintf('<h3 class="htmleditorfield-mediaform-heading insert">%s</h3>', _t('HtmlEditorField.INSERTIMAGE', 'Insert Image')).
sprintf('<h3 class="htmleditorfield-mediaform-heading update">%s</h3>', _t('HtmlEditorField.UpdateIMAGE', 'Update Image'))
),
$allFields
);
$actions = new FieldList(
FormAction::create('insertimage', _t('HtmlEditorField.BUTTONINSERT', 'Insert'))
->addExtraClass('ss-ui-action-constructive image-insert')
->setAttribute('data-icon', 'accept')
->setUseButtonTag(true),
FormAction::create('insertimage', _t('HtmlEditorField.BUTTONUpdate', 'Update'))
->addExtraClass('ss-ui-action-constructive image-update')
->setAttribute('data-icon', 'accept')
->setUseButtonTag(true)
);
$form = new Form(
$this->controller,
"{$this->name}/MediaForm",
$fields,
$actions
);
$form->unsetValidator();
$form->disableSecurityToken();
$form->loadDataFrom($this);
$form->addExtraClass('htmleditorfield-form htmleditorfield-mediaform cms-dialog-content');
// TODO Re-enable once we remove $.metadata dependency which currently breaks the JS due to $.ui.widget
//.........这里部分代码省略.........
示例14: getEPayForm
function getEPayForm()
{
Requirements::javascript("http://www.epay.dk/js/standardwindow.js");
Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery.js");
$customscript = <<<JS
\t\t\tjQuery(document).ready(function(\$) {\t\t\t\t
\t\t\t\t\$("form#ePay").submit(function(){
\t\t\t\t\topen_ePay_window();
\t\t\t\t\treturn false;
\t\t\t\t});
\t\t\t\t
\t\t\t});\t
JS;
if (Director::isLive()) {
$customscript .= <<<JS
\t\t\t\tjQuery(document).ready(function(\$) {
\t\t\t\t\topen_ePay_window(); //enable for auto-submit
\t\t\t\t\t\$("form#ePay").hide();
\t\t\t\t});\t
JS;
}
Requirements::customScript($customscript, 'epayinit');
$controller = new EpaydkPayment_Controller();
//http://tech.epay.dk/ePay-Payment-Window-technical-documentation_9.html
$fields = new FieldSet(new HiddenField('merchantnumber', 'Merchant Number', self::$merchant_number), new HiddenField('orderid', 'Order ID', $this->ID), new HiddenField('currency', 'Currency', self::$supported_currencies[$this->Amount->Currency]['code']), new HiddenField('amount', 'Amount', $this->Amount->Amount * 100), new HiddenField('language', 'Language', self::$language), new HiddenField('accepturl', 'Accept URL', Director::absoluteBaseURL() . $controller->Link('accept')), new HiddenField('declineurl', 'Decline URL', Director::absoluteBaseURL() . $controller->Link('decline')), new HiddenField('callbackurl', 'Callback URL', Director::absoluteBaseURL() . $controller->Link('callback')), new HiddenField('instantcallback', 'Instant Callback', 1), new HiddenField('instantcapture', 'Instant Capture', 1), new HiddenField('windowstate', 'Window State', 2), new HiddenField('ownreceipt', 'Own Receipt', 1));
//custom configs
if (self::$md5key) {
$md5data = $this->generateMD5();
$fields->push(new HiddenField('md5key', 'MD5 Key', $md5data));
}
if (self::$limit_card_types) {
$fields->push(new HiddenField('cardtype', 'Card Type', self::$limit_card_types));
}
if (self::$add_fee) {
$fields->push(new HiddenField('addfee', 'Add Fee', 1));
}
if (self::$auth_sms) {
$fields->push(new HiddenField('authsms', 'Auth SMS', self::$auth_sms));
}
if (self::$auth_mail) {
$fields->push(new HiddenField('authmail', 'Auth Mail', self::$auth_mail));
}
if (self::$google_tracker) {
$fields->push(new HiddenField('googletracker', 'Google Tracker', self::$google_tracker));
}
if (self::$use3d) {
$fields->push(new HiddenField('use3D', 'Use 3D', self::$use3d));
}
$actions = new FieldSet($openwindow = new FormAction('openwindow', _t('EpaydkPayment.OPENPAYMENTWINDOW', 'Open the ePay Payment Window')));
$form = new Form($controller, 'ePay', $fields, $actions);
$form->setHTMLID('ePay');
$form->setFormAction(self::$submit_url);
$form->unsetValidator();
$form->disableSecurityToken();
return $form;
}
示例15: SearchForm
/**
* @return Form
*/
public function SearchForm()
{
$context = $this->getSearchContext();
$form = new Form($this, "SearchForm", $context->getSearchFields(), new FieldList(Object::create('FormAction', 'search', _t('MemberTableField.APPLY_FILTER', 'Apply Filter'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive'), Object::create('ResetFormAction', 'clearsearch', _t('ModelAdmin.RESET', 'Reset'))->setUseButtonTag(true)), new RequiredFields());
$form->setFormMethod('get');
$form->setFormAction($this->Link($this->sanitiseClassName($this->modelClass)));
$form->addExtraClass('cms-search-form');
$form->disableSecurityToken();
$form->loadDataFrom($this->request->getVars());
$this->extend('updateSearchForm', $form);
return $form;
}