Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3493479
PhortuneCreditCardForm.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
PhortuneCreditCardForm.php
View Options
<?php
final
class
PhortuneCreditCardForm
{
private
$formID
;
private
$scripts
=
array
(
)
;
private
$user
;
private
$errors
=
array
(
)
;
private
$cardNumberError
;
private
$cardCVCError
;
private
$cardExpirationError
;
private
$securityAssurance
;
public
function
setSecurityAssurance
(
$security_assurance
)
{
$this
->
securityAssurance
=
$security_assurance
;
return
$this
;
}
public
function
getSecurityAssurance
(
)
{
return
$this
->
securityAssurance
;
}
public
function
setUser
(
PhabricatorUser
$user
)
{
$this
->
user
=
$user
;
return
$this
;
}
public
function
setErrors
(
array
$errors
)
{
$this
->
errors
=
$errors
;
return
$this
;
}
public
function
addScript
(
$script_uri
)
{
$this
->
scripts
[
]
=
$script_uri
;
return
$this
;
}
public
function
getFormID
(
)
{
if
(
!
$this
->
formID
)
{
$this
->
formID
=
celerity_generate_unique_node_id
(
)
;
}
return
$this
->
formID
;
}
public
function
buildForm
(
)
{
$form_id
=
$this
->
getFormID
(
)
;
require_celerity_resource
(
'phortune-credit-card-form-css'
)
;
require_celerity_resource
(
'phortune-credit-card-form'
)
;
require_celerity_resource
(
'aphront-tooltip-css'
)
;
Javelin
::
initBehavior
(
'phabricator-tooltips'
)
;
$form
=
new
AphrontFormView
(
)
;
foreach
(
$this
->
scripts
as
$script
)
{
$form
->
appendChild
(
phutil_tag
(
'script'
,
array
(
'type'
=>
'text/javascript'
,
'src'
=>
$script
,
)
)
)
;
}
$errors
=
$this
->
errors
;
$e_number
=
isset
(
$errors
[
PhortuneErrCode
::
ERR_CC_INVALID_NUMBER
]
)
?
pht
(
'Invalid'
)
:
null
;
$e_cvc
=
isset
(
$errors
[
PhortuneErrCode
::
ERR_CC_INVALID_CVC
]
)
?
pht
(
'Invalid'
)
:
null
;
$e_expiry
=
isset
(
$errors
[
PhortuneErrCode
::
ERR_CC_INVALID_EXPIRY
]
)
?
pht
(
'Invalid'
)
:
null
;
$form
->
setID
(
$form_id
)
->
appendChild
(
id
(
new
AphrontFormTextControl
(
)
)
->
setLabel
(
'Card Number'
)
->
setDisableAutocomplete
(
true
)
->
setSigil
(
'number-input'
)
->
setError
(
$e_number
)
)
->
appendChild
(
id
(
new
AphrontFormTextControl
(
)
)
->
setLabel
(
'CVC'
)
->
setDisableAutocomplete
(
true
)
->
addClass
(
'aphront-form-cvc-input'
)
->
setSigil
(
'cvc-input'
)
->
setError
(
$e_cvc
)
)
->
appendChild
(
id
(
new
PhortuneMonthYearExpiryControl
(
)
)
->
setLabel
(
'Expiration'
)
->
setUser
(
$this
->
user
)
->
setError
(
$e_expiry
)
)
;
$assurance
=
$this
->
getSecurityAssurance
(
)
;
if
(
$assurance
)
{
$assurance
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'phortune-security-assurance'
,
)
,
array
(
id
(
new
PHUIIconView
(
)
)
->
setIconFont
(
'fa-lock grey'
)
,
' '
,
$assurance
,
)
)
;
$form
->
appendChild
(
id
(
new
AphrontFormMarkupControl
(
)
)
->
setValue
(
$assurance
)
)
;
}
return
$form
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Apr 17, 06:42 (13 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1223191
Default Alt Text
PhortuneCreditCardForm.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment