本文整理汇总了PHP中Am_Form_Setup::setDefault方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Form_Setup::setDefault方法的具体用法?PHP Am_Form_Setup::setDefault怎么用?PHP Am_Form_Setup::setDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Form_Setup
的用法示例。
在下文中一共展示了Am_Form_Setup::setDefault方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initSetupForm
public function _initSetupForm(Am_Form_Setup $form)
{
$form->addText("key")->setLabel(array('Access Key', '
You\'ll find your AccessKey in
ControlCenter --> My Configuration'));
$form->addText("project")->setLabel(array('Project Identifier'));
$form->addAdvCheckbox("testing")->setLabel("Test Mode Enabled");
$form->addMagicSelect("methods")->setLabel(___("Available methods\n" . "if none is selected then all methods will be listed"))->loadOptions(array('prepay' => $this->defaultPrepayDescription, 'lastschrift' => $this->defaultLastschriftDescription));
$form->addText("prepay.title")->setLabel(array('Prepay method title', $this->defaultPrepayDescription));
$form->setDefault('prepay.title', $this->defaultPrepayDescription);
$form->addText("lastschrift.title")->setLabel(array('Lastschrift method title', $this->defaultLastschriftDescription));
$form->setDefault('lastschrift.title', $this->defaultLastschriftDescription);
}
示例2: array
function _initSetupForm(Am_Form_Setup $form)
{
$form->setTitle('Selectel');
$form->addText('access_key', array('size' => 40))->setLabel('Your account login')->addRule('required');
$form->addPassword('secret_key', array('size' => 40))->setLabel(array('Password for Cloud Storage', '(separate password then for Control Panel)'))->addRule('required');
$form->addText('expire', array('size' => 5))->setLabel('Video link life-time, min');
$form->setDefault('expire', 15);
if ($this->isConfigured()) {
try {
$containers = $this->getDi()->cacheFunction->call(array($this->getConnector(), 'getContainersList'), array(), array(), $this->cacheLifetime);
$containers = array('' => '== Please select public Container ==') + $containers;
} catch (Exception $e) {
$containers = array('' => 'Please create public container');
}
$form->addSelect('links_container', '', array('options' => array_combine($containers, $containers)))->setLabel(array('Container for links', 'aMember will create links in the following format: http://yourcloudstorageurl.com/CONTAINERNAME/uniquekey/filename.mp4'))->addRule('required');
}
$msg = <<<EOT
Make sure that you store all your files in private containers.
In order to provide an access to the files, create one free container, and specify it in plugin configuration.
aMember will create symlinks to the files and put these symilnks to that public container. Links are one-time and time-limited.
For example if you name your public container "download", end-user will see these links:
https://88901.selcdn.ru/download/9365d4a676845f607e46e19038305ba0/filename.mp4
EOT;
$form->addProlog(<<<CUT
<div class="info"><strong>{$msg}</strong></div>
CUT
);
}
示例3: _initSetupForm
public function _initSetupForm(Am_Form_Setup $form)
{
$form->addText('account_id')->setLabel(array('Merchant Account Id'));
$form->addText('secret')->setLabel(array('Merchant Secret Key'));
$form->addText('java_path')->setLabel(array('Unix path to java binary', 'for ex. java or /usr/bin/java'));
$form->setDefault('java_path', 'java');
}
示例4: array
function _initSetupForm(Am_Form_Setup $form)
{
$form->setTitle(___('Single Login Session'));
$form->addText('timeout', array('size' => 4))->setLabel(___('Session Timeout, min'));
$form->setDefault('timeout', 5);
$form->addSelect('action')->setId('form-action')->setLabel(___('Action on Simultaneous Login Attempt'))->loadOptions(array(self::ACTION_LOGIN_REJECT => ___('Show error and do not allow to login until session timeout'), self::ACTION_LOGOUT_OTHER => ___('Delete other session when user try to login from new one'), self::ACTION_NOTHING => ___('Nothing, allow simultaneous login for same user from different computers')));
$form->addTextarea('error', array('class' => 'el-wide'))->setId('form-error')->setLabel(___('Error Message'));
$form->setDefault('error', 'There is already exits active login session for your account. Simultaneous login from different computers is not allowed.');
$error = self::ACTION_LOGIN_REJECT;
$form->addScript()->setScript(<<<CUT
\$('#form-action').change(function(){
\$('#form-error').closest('.row').toggle(\$(this).val() == '{$error}')
}).change();
CUT
);
$form->addElement('email_checkbox', 'notify_admin')->setLabel(___('Notify Admin on Simultaneous Login'));
}
示例5: _initSetupForm
public function _initSetupForm(Am_Form_Setup $form)
{
$form->addInteger('seller_id', array('size' => 20))->setLabel('2CO Account#');
$form->setDefault('secret', $this->getDi()->app->generateRandomString(10));
$form->addText('secret', array('size' => 30))->setLabel(array('2CO Secret Phrase', 'set it to the same value as configured in 2CO'));
$form->addText('api_username')->setLabel('2CO API Username');
$form->addPassword('api_password')->setLabel('2CO Password');
$form->addSelect('lang', array(), array('options' => array('en' => 'English', 'zh' => 'Chinese', 'da' => 'Danish', 'nl' => 'Dutch', 'fr' => 'French', 'gr' => 'German', 'el' => 'Greek', 'it' => 'Italian', 'jp' => 'Japanese', 'no' => 'Norwegian', 'pt' => 'Portuguese', 'sl' => 'Slovenian', 'es_ib' => 'Spanish (es_ib)', 'es_la' => 'Spanish (es_la)', 'sv' => 'Swedish')))->setLabel('2CO Interface language');
}
示例6: _initSetupForm
protected function _initSetupForm(Am_Form_Setup $form)
{
$el = $form->addText('url', array('size' => 60))->setLabel('AutoResponse Pro Url');
$el->addRule('required');
$el->addRule('regex', 'URL must start with http:// or https://', '/^(http|https):\\/\\//');
$ef = $form->addSelect('email_field')->setLabel('Choose Alternative E-Mail Field');
$fields = $this->getDi()->userTable->getFields(true);
$ef->loadOptions(array_combine($fields, $fields));
$ef->addRule('required', true);
$form->setDefault('email_field', 'email');
$ff = $form->addMagicSelect('fields')->setLabel('Pass additional fields to ARP');
$ff->loadOptions(array_combine($fields, $fields));
}
示例7: onSetupForms
function onSetupForms(Am_Event_SetupForms $event)
{
$form = new Am_Form_Setup('facebook');
$form->setTitle('Facebook');
$fs = $form->addFieldset()->setLabel(___('FaceBook Application'));
$fs->addText('app_id')->setLabel(___('FaceBook App ID'));
$fs->addText('app_secret', array('size' => 40))->setLabel(___('Facebook App Secret'));
$fs = $form->addFieldset()->setLabel(___('Features'));
$gr = $fs->addCheckboxedGroup('like')->setLabel(___('Add "Like" button'));
$gr->addStatic()->setContent(___('Like Url'));
$gr->addText('likeurl', array('size' => 40));
$form->setDefault('likeurl', ROOT_URL);
$fs->addAdvCheckbox('no_signup')->setLabel(___('Do not add to Signup Form'));
$fs->addAdvCheckbox('no_login')->setLabel(___('Do not add to Login Form'));
$form->addFieldsPrefix('misc.facebook.');
$event->addForm($form);
}
示例8: onSetupForms
function onSetupForms(Am_Event_SetupForms $event)
{
$form = new Am_Form_Setup('facebook');
$form->setTitle('Facebook');
$fs = $form->addFieldset()->setLabel(___('FaceBook Application'));
$fs->addText(self::FB_APP_ID)->setLabel(___('FaceBook App ID'));
$fs->addText(self::FB_APP_SECRET, array('size' => 40))->setLabel(___('Facebook App Secret'));
$fs = $form->addFieldset()->setLabel(___('Features'));
$gr = $fs->addCheckboxedGroup('like')->setLabel(___('Add "Like" button'));
$gr->addStatic()->setContent(___('Like Url'));
$gr->addText('likeurl', array('size' => 40));
$form->setDefault('likeurl', ROOT_URL);
$fs->addAdvCheckbox('no_signup')->setLabel(___('Do not add to Signup Form'));
$fs->addAdvCheckbox('no_login')->setLabel(___('Do not add to Login Form'));
$fs->addSelect('add_access', null, array('options' => array('' => '-- Do not add access --') + Am_Di::getInstance()->productTable->getOptions()))->setLabel(___('Add free access to a product if user signup from Facebook'));
$form->addFieldsPrefix('misc.facebook.');
$this->_afterInitSetupForm($form);
$event->addForm($form);
}
示例9: array
function _initSetupForm(Am_Form_Setup $form)
{
$form->setTitle('Amazon S3');
$form->addText('access_key', array('size' => 40))->setLabel('AWS Access Key')->addRule('required')->addRule('regex', 'must be alphanumeric', '/^[A-Z0-9]+$/');
$form->addPassword('secret_key', array('size' => 40))->setLabel('AWS Secret Key')->addRule('required');
$form->addSelect('region')->loadOptions($this->_regions)->setLabel('Amazon S3 Region');
$form->addText('expire', array('size' => 5))->setLabel('Video link lifetime, min');
$form->setDefault('expire', 15);
$msg = ___('Your content on Amazon S3 should not be public.
Please restrict public access to your files on Amazon S3 side
and ensure you can not access it directly from Amazon S3.
aMember use Access Key and Secret Key to generate links with
authentication token for users to provide access them to your
content on Amazon S3.');
$form->addProlog(<<<CUT
<div class="info"><strong>{$msg}</strong></div>
CUT
);
}
示例10: _initSetupForm
protected function _initSetupForm(Am_Form_Setup $form)
{
$form->addText('vendor')->setLabel('Merchant Vendor Id (main username)');
$form->addText('user')->setLabel('Merchant User Id (of the API user, or the same as Vendor Id)');
$form->addPassword('pass')->setLabel('Merchant Password');
$form->addText('partner')->setLabel('Partner');
$form->setDefault('partner', 'PayPal');
$form->addAdvCheckbox('advanced')->setLabel("Use PayPal Advanced\ncredit card info will be asked in iframe on your website");
$form->addAdvCheckbox('testing')->setLabel('Test Mode');
}
示例11: _afterInitSetupForm
protected function _afterInitSetupForm(Am_Form_Setup $form)
{
// insert title, description fields
$form->setTitle(ucfirst(toCamelCase($this->getId())));
$el = $form->addMagicSelect('reattempt', array('multiple' => 'multiple'));
$options = array();
for ($i = 1; $i < 60; $i++) {
$options[$i] = ___("on %d-th day", $i);
}
$el->loadOptions($options);
$el->setLabel(___("Retry On Failure\n" . "if the recurring billing has failed,\n" . "aMember can repeat it after several days,\n" . "and extend customer subscription for that period\n" . "enter number of days to repeat billing attempt"));
if ($this->canUseMaxmind()) {
$form->addFieldset()->setLabel(___('MaxMind Credit Card Fraud Detection'));
$form->addAdvCheckbox('use_maxmind')->setLabel(___('Use MaxMind Credit Card Fraud Detection'));
$form->addText('maxmind_license_key')->setLabel(___("Maxmind License Key\n" . "%sObtain a Free or Premium license key%s", '<a href="http://www.maxmind.com/app/minfraud" target="_blank">', '</a>'));
$form->addSelect('maxmind_requested_type')->setLabel(___("Requested Type\n" . "To be used if you have multiple plans in one account\n" . "and wish to select type of query you wish to make.\n" . "By default the service uses the highest level available"))->loadOptions(array("" => 'Default', "free" => 'Free', "city" => 'City (standard paid service)', "premium" => 'Premium (premium paid service)'));
$form->addText('maxmind_risk_score')->setLabel(___("Risk Score\n" . "Overall %sRisk Score%s (decimal from 0 to 10)\n" . "For orders that return a fraud score of 2.5 and above,\n" . " it is recommended to hold for review,\n" . " or require the validation with the Telephone Verification service\n", '<a href="http://www.maxmind.com/app/web_services_score2" target="_blank">', '</a>'));
$form->setDefault('maxmind_risk_score', '2.5');
/*$form->addAdvCheckbox('maxmind_use_telephone_verification')->setLabel(
___("Telephone Verification\n" .
"Enable %sTelephone Verification%s service"
, '<a href="http://www.maxmind.com/app/telephone_overview" target="_blank">', '</a>'));*/
$form->addAdvCheckbox('maxmind_use_number_identification')->setLabel(___("Number Identification\n" . "Enable %sTelephone Number Identification (TNI)%s service", '<a href="http://www.maxmind.com/app/phone_id" target="_blank">', '</a>'));
$form->addMagicSelect('maxmind_tni_phone_types')->setLabel(___("Allowed Phone Types\n" . "The TNI service is able to categorize customer inputted US and Canadian\n" . "phone numbers into %seight different phone types%s\n" . "such as fixed land line, mobile, VoIP, and invalid phone numbers", '<a href="http://www.maxmind.com/app/phone_id_codes" target="_blank">', '</a>'))->loadOptions(array('0' => 'Undetermined (Medium Risk Level)', '1' => 'Fixed Line (Low Risk Level)', '2' => 'Mobile (Low-Medium Risk Level)', '3' => 'PrePaid Mobile (Medium-High Risk Level)', '4' => 'Toll-Free (High Risk Level)', '5' => 'Non-Fixed VoIP (High Risk Level)', '8' => 'Invalid Number (High Risk Level)', '9' => 'Restricted Number (High Risk Level)'));
$form->addAdvCheckbox('maxmind_allow_country_not_matched')->setLabel(___("Allow payment if country not matched\n" . "Whether country of IP address matches billing address country\n" . "(mismatch = higher risk)"));
$form->addAdvCheckbox('maxmind_allow_high_risk_country')->setLabel(___("Allow payment if high risk countries\n" . "Whether IP address or billing address country is in\n" . "Egypt, Ghana, Indonesia, Lebanon, Macedonia, Morocco, Nigeria,\n" . "Pakistan, Romania, Serbia and Montenegro, Ukraine, or Vietnam"));
$form->addAdvCheckbox('maxmind_allow_anonymous_proxy')->setLabel(___("Allow payment if anonymous proxy\n" . "Whether IP address is %sAnonymous Proxy%s\n" . "(anonymous proxy = very high risk)", '<a href="http://www.maxmind.com/app/proxy#anon" target="_blank">', '</a>'));
$form->addAdvCheckbox('maxmind_allow_free_mail')->setLabel(___("Allow payment if free e-mail\n" . "Whether e-mail is from free e-mail provider\n" . "(free e-mail = higher risk)"));
$form->addElement('script')->setScript(<<<CUT
function showHideMaxmind()
{
var el = \$("[id^=use_maxmind-]");
\$("[id^=maxmind_]").closest(".row").toggle(el.prop('checked'));
if(el.prop('checked'))
/*showHideNumberidentification();*/
showHidePhonetypes();
}
/*function showHideNumberidentification()
{
var el = \$("[id^=maxmind_use_telephone_verification-]");
\$("[id^=maxmind_tni_phone_types-]").closest(".row").toggle(el.prop('checked'));
\$("[id^=maxmind_use_number_identification-]").closest(".row").toggle(el.prop('checked'));
if(el.prop('checked'))
showHidePhonetypes();
}*/
function showHidePhonetypes()
{
\$("[id^=maxmind_tni_phone_types-]").closest(".row").toggle(\$("[id^=maxmind_use_number_identification-]").prop('checked'));
}
\$(function(){
\$("[id^=use_maxmind-]").click(function(){
showHideMaxmind();
});
/*\$("[id^=maxmind_use_telephone_verification-]").click(function(){
showHideNumberidentification();
});*/
\$("[id^=maxmind_use_number_identification-]").click(function(){
showHidePhonetypes();
});
showHideMaxmind();
});
CUT
);
}
if ($this->storesCcInfo() && !$this->_pciDssNotRequired) {
$text = "<p><font color='red'>WARNING!</font> Every application processing credit card information, must be certified\n" . "as PA-DSS compliant, and every website processing credit cards must\n" . "be certified as PCI-DSS compliant.</p>";
$text .= "<p>aMember Pro is not yet certified as PA-DSS compliant. " . "This plugins is provided solely for TESTING purproses\n" . "Use it for anything else but testing at your own risk.</p>";
$form->addProlog(<<<CUT
<div class="warning_box">
{$text}
</div>
CUT
);
}
$keyFile = defined('AM_KEYFILE') ? AM_KEYFILE : APPLICATION_PATH . '/configs/key.php';
if (!is_readable($keyFile)) {
$random = $this->getDi()->app->generateRandomString(78);
$text = "<p>To use credit card plugins, you need to create a key file that contains unique\n";
$text .= "encryption key for your website. It is necessary even if the plugin does not\n";
$text .= "store sensitive information.</p>";
$text .= "<p>In a text editor, create file with the following content (one-line, no spaces before opening <?php):\n";
$text .= "<br /><br /><pre style='background-color: #e0e0e0;'><?php return '{$random}';</pre>\n";
$text .= "<br />save the file as <b>key.php</b>, and upload to <i>amember/application/configs/</i> folder.\n";
$text .= "This warning will disappear once you do it correctly.</p>";
$text .= "<p>KEEP A BACKUP COPY OF THE key.php FILE (!)</p>";
$form->addProlog(<<<CUT
<div class="warning_box">
{$text}
</div>
CUT
);
}
return parent::_afterInitSetupForm($form);
}
示例12: array
function _initSetupForm(Am_Form_Setup $form)
{
$gr = $form->addGroup('')->setLabel(___("Electronically Supplied Service\n" . 'Enable if ALL your products are electronic services.'));
$gr->addAdvCheckbox('tax_digital');
$gr->addHTML()->setHTML(<<<EOT
<div><a href="javascript:;" onclick="\$('#tax_digital_example').toggle()" class="local">Examples of Electronic Service</a></div>
<div id="tax_digital_example" style="display:none">
<ul class="list">
<li>Website supply, web-hosting, distance maintenance of programmes and equipment;</li>
<li>Supply of software and updating thereof;</li>
<li>Supply of images, text and information and making available of databases;</li>
<li>Supply of music, films and games, including games of chance and gambling games, and of
political, cultural, artistic, sporting, scientific and entertainment broadcast and events;</li>
<li>Supply of distance teaching.</li>
</ul>
</div>
EOT
);
$fieldSet = $form->addFieldSet('maxmind', array('id' => 'maxmind'))->setLabel('Location Validation Settings');
$fieldSet->addHTML(null, array('class' => 'no-label'))->setHTML(<<<EOT
<p>According to new EU VAT rules your are required to collect two pieces of non-conflicting evidence of customer's location country if you are selling Digital (Electronic Service) Products. These two pieces of evidence will be checked on each invoice which has Digital Product included:</p>
<ul class="list">
<li>Address Contry (so make sure that you have added Address info brick to signup form)</li>
<li>IP Address Country</li>
</ul>
<p>In order to get country from customer's IP address, aMember uses MaxMind GeoIP2 service. Please signup <a href = "https://www.maxmind.com/en/geoip2-precision-country" target="_blank" class="link">here</a> in order to get MaxMind user ID and license key.</p>
EOT
);
$fieldSet->addAdvCheckbox('tax_location_validation')->setLabel(___("Enable Location Validation\n" . 'aMember will require two peices of location evidence before an invoice is created. ' . 'Invoice that fials validation will be blocked and user will receive warning.'));
$fieldSet->addAdvCheckbox('tax_location_validate_all')->setLabel(___("Validate Location even if Invoice has no VAT \n" . "Validate All New Invoices (even if invoice has no VAT)\n" . "If unchecked, location will be validated only when \n" . "user selects country inside EU and only if VAT should be applied to invoice.\n" . "Free invoices won't be validated still"));
$fieldSet->addAdvCheckbox('tax_location_validate_self')->setLabel(___("Enable Self-Validation\n" . "If validation failed, user will be able to confirm current location manually\n"));
$fieldSet->addText('tax_maxmind_user_id')->setLabel(___('MaxMind User ID'));
$fieldSet->addText('tax_maxmind_license')->setLabel(___('MaxMind License'));
$fieldSet = $form->addFieldSet('vat_id')->setLabel(___("Account Information"));
$fieldSet->addSelect('my_country')->setLabel(___('My Country'))->loadOptions($this->countries)->addRule('required');
$fieldSet->addText('my_id')->setLabel(___('VAT Id'))->addRule('required');
$fieldSet = $form->addFieldSet('numbering')->setLabel(___('Invoice numbering'));
$fieldSet->addAdvCheckbox("sequential")->setLabel(___("Sequential Receipt# Numbering\n" . "aMember still creates unique id for invoices, but it will\n" . "generate PDF receipts for each payment that will be\n" . "available in the member area for customers"));
$form->setDefault('sequential', 1);
$form->setDefault('tax_digital', 1);
$fieldSet->addText('invoice_prefix')->setLabel(___("Receipt# Number Prefix\n" . 'If you change prefix numbers will start over from 1'))->setValue('INV-');
$fieldSet->addText('initial_invoice_number')->setLabel(___('Initial Receipt# Number'))->setValue(1);
$fieldSet->addText('invoice_refund_prefix')->setLabel(___("Refund Receipt# Prefix\n" . 'If you change prefix numbers will start over from 1'))->setValue('RFND-');
$fieldSet->addText('initial_invoice_refund_number')->setLabel(___('Initial Receipt# Refund Number'))->setValue(1);
$fs = $form->addFieldSet('rates')->setLabel(___('VAT Rates, %'));
$rates = array_filter($this->getConfig('rates', array()));
foreach ($this->rates as $c => $rate) {
if (!isset($this->countries[$c])) {
continue;
}
$r = $fs->addText('rate.' . $c, 'size=3')->setLabel($this->countries[$c]);
$r->setValue(!empty($rate[$c]) ? $rate[$c] : $this->rates[$c]);
}
}
示例13: onSetupForms
/**
* Initialize setup form
* You have to override this function and add elements
* to returned (from parent::initSetupForm) form.
* @return Am_Form_Setup
*/
function onSetupForms(Am_Event_SetupForms $event)
{
$form = new Am_Form_Setup($this->getId());
$form->setTitle($this->getConfigPageId());
$plugin = $this->getId();
$form->addText("title", array('size' => 40))->setLabel(___("Payment System Title"));
$form->setDefault("payment.{$plugin}.title", @$this->defaultTitle);
$form->addText("description", array('size' => 40))->setLabel(___("Payment System Description"));
$form->setDefault("payment.{$plugin}.description", @$this->defaultDescription);
/*
$form->addAdvCheckbox("disable_postback_log")
->setLabel(___("Disable PostBack messages Logging (not recommended)\n".
"By default aMember logs all payment system postback messages\n".
"you can disable it by changing this configuration value"
));
*/
if ($this->canResendPostback()) {
$gr = $form->addElement(new Am_Form_Element_CheckboxedGroup('resend_postback'));
$gr->setLabel(___("Resend Postback\nenter list of URLs to resend incoming postback\none URL per line"));
$gr->addTextarea('resend_postback_urls', array('rows' => 3, 'cols' => 70));
}
$event->addForm($form);
$this->_initSetupForm($form);
if ($this->canAutoCreate()) {
$form->addAdvCheckbox('auto_create')->setLabel(___("Accept Direct Payments\n" . "handle payments made on payment system side\n" . "(without signup to aMember first)"));
}
$form->addFieldsPrefix("payment.{$plugin}.");
if ($plugin_readme = $this->getReadme()) {
$plugin_readme = str_replace(array('%root_url%', '%root_surl%', '%root_dir%'), array(ROOT_URL, ROOT_SURL, ROOT_DIR), $plugin_readme);
$form->addEpilog('<div class="info"><pre>' . $plugin_readme . '</pre></div>');
}
if (defined($const = get_class($this) . "::PLUGIN_STATUS") && (constant($const) == self::STATUS_BETA || constant($const) == self::STATUS_DEV)) {
$beta = constant($const) == self::STATUS_DEV ? 'ALPHA' : 'BETA';
$form->addProlog("<div class='warning_box'>This plugin is currently in {$beta} testing stage, some functions may work unstable." . "Please test it carefully before use.</div>");
}
return $form;
}