本文整理汇总了PHP中GFCommon::get_card_types方法的典型用法代码示例。如果您正苦于以下问题:PHP GFCommon::get_card_types方法的具体用法?PHP GFCommon::get_card_types怎么用?PHP GFCommon::get_card_types使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFCommon
的用法示例。
在下文中一共展示了GFCommon::get_card_types方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forms_page
//.........这里部分代码省略.........
<?php
_e('Sub-Labels', 'gravityforms');
?>
<?php
gform_tooltip('form_field_sub_labels');
?>
</label>
<div id="field_sub_labels_container">
<!-- content dynamically created from js.php -->
</div>
</li>
<?php
do_action('gform_field_standard_settings', 1425, $form_id);
?>
<?php
do_action('gform_field_standard_settings', 1430, $form_id);
?>
<li class="credit_card_setting field_setting">
<label>
<?php
_e('Supported Credit Cards', 'gravityforms');
?>
<?php
gform_tooltip('form_field_credit_cards');
?>
</label>
<ul>
<?php
$cards = GFCommon::get_card_types();
foreach ($cards as $card) {
?>
<li>
<input type="checkbox" id="field_credit_card_<?php
echo esc_attr($card['slug']);
?>
" value="<?php
echo esc_attr($card['slug']);
?>
" onclick="SetCardType(this, this.value);" />
<label for="field_credit_card_<?php
echo esc_attr($card['slug']);
?>
" class="inline"><?php
echo esc_html($card['name']);
?>
</label>
</li>
<?php
}
?>
</ul>
</li>
<?php
do_action('gform_field_standard_settings', 1435, $form_id);
?>
<li class="credit_card_style_setting field_setting">
<label for="credit_card_style">
<?php
_e('Card Icon Style', 'gravityforms');
示例2: get_field_input
//.........这里部分代码省略.........
}
} else {
$language = empty($field["captchaLanguage"]) ? "en" : esc_attr($field["captchaLanguage"]);
$options = "<script type='text/javascript'>" . apply_filters("gform_cdata_open", "") . " var RecaptchaOptions = {theme : '{$theme}'}; if(parseInt('" . self::$tab_index . "') > 0) {RecaptchaOptions.tabindex = " . self::$tab_index++ . ";}" . apply_filters("gform_recaptcha_init_script", "", $form_id, $field) . apply_filters("gform_cdata_close", "") . "</script>";
$is_ssl = !empty($_SERVER['HTTPS']);
return $options . "<div class='ginput_container' id='{$field_id}'>" . recaptcha_get_html($publickey, null, $is_ssl, $language) . "</div>";
}
}
break;
case "creditcard":
$card_number = "";
$card_name = "";
$expiration_date = "";
$expiration_month = "";
$expiration_year = "";
$security_code = "";
if (is_array($value)) {
$card_number = esc_attr(rgget($field["id"] . ".1", $value));
$card_name = esc_attr(rgget($field["id"] . ".5", $value));
$expiration_date = rgget($field["id"] . ".2", $value);
if (!is_array($expiration_date) && !empty($expiration_date)) {
$expiration_date = explode("/", $expiration_date);
}
if (is_array($expiration_date) && count($expiration_date) == 2) {
$expiration_month = $expiration_date[0];
$expiration_year = $expiration_date[1];
}
$security_code = esc_attr(rgget($field["id"] . ".3", $value));
}
$action = !IS_ADMIN ? "gformMatchCard(\"{$field_id}_1\");" : "";
$onchange = "onchange='{$action}'";
$onkeyup = "onkeyup='{$action}'";
$card_icons = '';
$cards = GFCommon::get_card_types();
$card_style = rgar($field, 'creditCardStyle') ? rgar($field, 'creditCardStyle') : 'style1';
foreach ($cards as $card) {
$style = "";
if (self::is_card_supported($field, $card["slug"])) {
$print_card = true;
} else {
if (IS_ADMIN) {
$print_card = true;
$style = "style='display:none;'";
} else {
$print_card = false;
}
}
if ($print_card) {
$card_icons .= "<div class='gform_card_icon gform_card_icon_{$card['slug']}' {$style}>{$card['name']}</div>";
}
}
$card_icons = "<div class='gform_card_icon_container gform_card_icon_{$card_style}'>{$card_icons}</div>";
//card number fields
$tabindex = self::get_tabindex();
$card_field = sprintf("<span class='ginput_full{$class_suffix}' id='{$field_id}_1_container'>{$card_icons}<input type='text' name='input_%d.1' id='%s_1' value='%s' {$tabindex} %s {$onchange} {$onkeyup} /><label for='%s_1' id='{$field_id}_1_label'>" . apply_filters("gform_card_number_{$form_id}", apply_filters("gform_card_number", __("Card Number", "gravityforms"), $form_id), $form_id) . "</label></span>", $id, $field_id, $card_number, $disabled_text, $field_id);
//expiration date field
$expiration_field = "<span class='ginput_full{$class_suffix} ginput_cardextras' id='{$field_id}_2_container'>" . "<span class='ginput_cardinfo_left{$class_suffix}' id='{$field_id}_2_container'>" . "<span class='ginput_card_expiration_container'>" . "<select name='input_{$id}.2[]' id='{$field_id}_2_month' " . self::get_tabindex() . " {$disabled_text} class='ginput_card_expiration ginput_card_expiration_month'>" . self::get_expiration_months($expiration_month) . "</select>" . "<select name='input_{$id}.2[]' id='{$field_id}_2_year' " . self::get_tabindex() . " {$disabled_text} class='ginput_card_expiration ginput_card_expiration_year'>" . self::get_expiration_years($expiration_year) . "</select>" . "<label for='{$field_id}_2_month' >" . apply_filters("gform_card_expiration_{$form_id}", apply_filters("gform_card_expiration", __("Expiration Date", "gravityforms"), $form_id), $form_id) . "</label>" . "</span>" . "</span>";
//security code field
$tabindex = self::get_tabindex();
$security_field = "<span class='ginput_cardinfo_right{$class_suffix}' id='{$field_id}_2_container'>" . "<input type='text' name='input_{$id}.3' id='{$field_id}_3' {$tabindex} {$disabled_text} class='ginput_card_security_code' value='{$security_code}' />" . "<span class='ginput_card_security_code_icon'> </span>" . "<label for='{$field_id}_3' >" . apply_filters("gform_card_security_code_{$form_id}", apply_filters("gform_card_security_code", __("Security Code", "gravityforms"), $form_id), $form_id) . "</label>" . "</span>" . "</span>";
$tabindex = self::get_tabindex();
$card_name_field = sprintf("<span class='ginput_full{$class_suffix}' id='{$field_id}_5_container'><input type='text' name='input_%d.5' id='%s_5' value='%s' {$tabindex} %s /><label for='%s_5' id='{$field_id}_5_label'>" . apply_filters("gform_card_name_{$form_id}", apply_filters("gform_card_name", __("Cardholder Name", "gravityforms"), $form_id), $form_id) . "</label></span>", $id, $field_id, $card_name, $disabled_text, $field_id);
return "<div class='ginput_complex{$class_suffix} ginput_container' id='{$field_id}'>" . $card_field . $expiration_field . $security_field . $card_name_field . " </div>";
break;
case "list":
if (!empty($value)) {
示例3: get_credit_card_rules
public static function get_credit_card_rules()
{
$cards = GFCommon::get_card_types();
//$supported_cards = //TODO: Only include enabled cards
$rules = array();
foreach ($cards as $card) {
$prefixes = explode(',', $card['prefixes']);
foreach ($prefixes as $prefix) {
$rules[$card['slug']][] = $prefix;
}
}
return $rules;
}
示例4: forms_page
//.........这里部分代码省略.........
</li>
<?php
do_action("gform_field_standard_settings", 1425, $form_id);
?>
<li class="description_setting field_setting">
<label for="field_description">
<?php
_e("Description", "gravityforms");
?>
<?php
gform_tooltip("form_field_description");
?>
</label>
<textarea id="field_description" class="fieldwidth-3 fieldheight-2" onkeyup="SetFieldDescription(this.value);"></textarea>
</li>
<?php
do_action("gform_field_standard_settings", 1430, $form_id);
?>
<li class="credit_card_setting field_setting">
<label>
<?php
_e("Supported Credit Cards", "gravityforms");
?>
<?php
gform_tooltip("form_field_credit_cards");
?>
</label>
<ul>
<?php
$cards = GFCommon::get_card_types();
foreach ($cards as $card) {
?>
<li>
<input type="checkbox" id="field_credit_card_<?php
echo $card['slug'];
?>
" value="<?php
echo $card['slug'];
?>
" onclick="SetCardType(this, this.value);" />
<label for="field_credit_card_<?php
echo $card['slug'];
?>
" class="inline"><?php
echo $card['name'];
?>
</label>
</li>
<?php
}
?>
</ul>
</li>
<?php
do_action("gform_field_standard_settings", 1435, $form_id);
?>
<li class="credit_card_style_setting field_setting">
<label for="credit_card_style">
<?php
_e("Card Icon Style", "gravityforms");
示例5: get_card_labels
public function get_card_labels()
{
$card_types = GFCommon::get_card_types();
$card_labels = array();
foreach ($card_types as $card_type) {
$card_labels[$card_type['slug']] = $card_type['name'];
}
return $card_labels;
}
示例6: get_card_slug
/**
* Get the slug for the card type returned by Stripe.js
*
* @param string $type The possible types are "Visa", "MasterCard", "American Express", "Discover", "Diners Club", and "JCB" or "Unknown".
*
* @return string
*/
public function get_card_slug($type)
{
if ($type) {
$card_types = GFCommon::get_card_types();
foreach ($card_types as $card) {
if ($type == rgar($card, 'name')) {
return rgar($card, 'slug');
}
}
}
return $type;
}
示例7: get_card_slug
/**
* Get the slug for the card type returned by Stripe.js
*
* @param string $type The possible types are "Visa", "MasterCard", "American Express", "Discover", "Diners Club", and "JCB" or "Unknown".
*
* @return string
*/
public function get_card_slug($type)
{
// If type is defined, attempt to get card slug.
if ($type) {
// Get card types.
$card_types = GFCommon::get_card_types();
// Loop through card types.
foreach ($card_types as $card) {
// If the requested card type is equal to the current card's name, return the slug.
if (rgar($card, 'name') === $type) {
return rgar($card, 'slug');
}
}
}
return $type;
}
示例8: get_field_input
//.........这里部分代码省略.........
break;
case "creditcard" :
$card_number = "";
$card_name = "";
$expiration_date = "";
$expiration_month = "";
$expiration_year = "";
$security_code = "";
$autocomplete = RGFormsModel::is_html5_enabled() ? "autocomplete='off'" : "";
if(is_array($value)){
$card_number = esc_attr(rgget($field["id"] . ".1",$value));
$card_name = esc_attr(rgget($field["id"] . ".5",$value));
$expiration_date = rgget($field["id"] . ".2",$value);
if(!is_array($expiration_date) && !empty($expiration_date))
$expiration_date = explode("/", $expiration_date);
if(is_array($expiration_date) && count($expiration_date) == 2){
$expiration_month = $expiration_date[0];
$expiration_year = $expiration_date[1];
}
$security_code = esc_attr(rgget($field["id"] . ".3",$value));
}
$action = !IS_ADMIN ? "gformMatchCard(\"{$field_id}_1\");" : "";
$onchange= "onchange='{$action}'";
$onkeyup = "onkeyup='{$action}'";
$card_icons = '';
$cards = GFCommon::get_card_types();
$card_style = rgar($field, 'creditCardStyle') ? rgar($field, 'creditCardStyle') : 'style1';
foreach($cards as $card) {
$style = "";
if(self::is_card_supported($field, $card["slug"])){
$print_card = true;
}
else if (IS_ADMIN){
$print_card = true;
$style = "style='display:none;'";
}
else{
$print_card = false;
}
if($print_card){
$card_icons .= "<div class='gform_card_icon gform_card_icon_{$card['slug']}' {$style}>{$card['name']}</div>";
}
}
$payment_methods = apply_filters("gform_payment_methods", array(), $field, $form_id);
$payment_options = "";
if(is_array($payment_methods)){
foreach($payment_methods as $payment_method){
$checked = rgpost("gform_payment_method") == $payment_method["key"] ? "checked='checked'" : "";
$payment_options .="<div class='gform_payment_option gform_payment_{$payment_method["key"]}'><input type='radio' name='gform_payment_method' value='{$payment_method["key"]}' id='gform_payment_method_{$payment_method["key"]}' onclick='gformToggleCreditCard();' {$checked}/> {$payment_method["label"]}</div>";
}
}
$checked = rgpost("gform_payment_method") == "creditcard" || rgempty("gform_payment_method") ? "checked='checked'" : "";
$card_radio_button = empty($payment_options) ? "" : "<input type='radio' name='gform_payment_method' id='gform_payment_method_creditcard' value='creditcard' onclick='gformToggleCreditCard();' {$checked}/>";
$card_icons = "{$payment_options}<div class='gform_card_icon_container gform_card_icon_{$card_style}'>{$card_radio_button}{$card_icons}</div>";