本文整理汇总了PHP中Cart66Common::isValidEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart66Common::isValidEmail方法的具体用法?PHP Cart66Common::isValidEmail怎么用?PHP Cart66Common::isValidEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cart66Common
的用法示例。
在下文中一共展示了Cart66Common::isValidEmail方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPayment
public function setPayment($p)
{
$this->_payment = $p;
$skip = array('email', 'phone', 'custom-field');
$custom_payment_fields = apply_filters('cart66_after_payment_form', '');
if (is_array($custom_payment_fields)) {
foreach ($custom_payment_fields as $key => $payment_field) {
if (!$payment_field['required']) {
$skip[] = $payment_field['slug'];
}
if (isset($payment_field['validator']) && $payment_field['validator'] != '') {
if (function_exists($payment_field['validator'])) {
$skip[] = $payment_field['slug'];
$data_to_validate = isset($p[$payment_field['slug']]) ? $p[$payment_field['slug']] : '';
$validated = call_user_func($payment_field['validator'], $data_to_validate);
if (!$validated['valid']) {
foreach ($validated['errors'] as $key => $error) {
$this->_errors['Payment ' . $payment_field['slug'] . $key] = $error;
$this->_jqErrors[] = 'payment-' . $payment_field['slug'];
}
}
}
}
}
}
foreach ($p as $key => $value) {
if (!in_array($key, $skip)) {
$value = trim($value);
if ($value == '') {
$keyName = ucwords(preg_replace('/([A-Z])/', " \$1", $key));
$this->_errors['Payment ' . $keyName] = __('Payment ', 'cart66') . $keyName . __(' required', 'cart66');
$this->_jqErrors[] = "payment-{$key}";
}
}
}
if ($p['email'] == '') {
$this->_errors['Email address'] = __('Email address is required', 'cart66');
$this->_jqErrors[] = "payment-email";
}
if ($p['phone'] == '') {
$this->_errors['Phone'] = __('Phone number is required', 'cart66');
$this->_jqErrors[] = "payment-phone";
}
if (!Cart66Common::isValidEmail($p['email'])) {
$this->_errors['Email'] = __("Email address is not valid", "cart66");
$this->_jqErrors[] = 'payment-email';
}
if (Cart66Setting::getValue('checkout_custom_field_display') == 'required' && $p['custom-field'] == '') {
$this->_errors['Custom Field'] = Cart66Setting::getValue('checkout_custom_field_error_label') ? Cart66Setting::getValue('checkout_custom_field_error_label') : __('The Special Instructions Field is required', 'cart66');
$this->_jqErrors[] = 'checkout-custom-field-multi';
$this->_jqErrors[] = 'checkout-custom-field-single';
}
}
示例2: validate
public function validate()
{
$errors = array();
if (empty($this->name)) {
$errors['name'] = __('A name is required for order fulfillment', 'cart66');
}
if (!Cart66Common::isValidEmail($this->email)) {
$errors['email'] = __('Please enter a valid email address', 'cart66');
}
if (empty($this->email)) {
$errors['email'] = __('Email is required for order fulfillment', 'cart66');
}
return $errors;
}
示例3: validate
public function validate()
{
$errors = array();
if ($this->subscription_plan_id == null) {
$errors['subscription_plan_id'] = __('Subscription is required', 'cart66');
}
if (empty($this->interval)) {
$errors['interval'] = __('Reminder Interval is required', 'cart66');
}
if (empty($this->from_name)) {
$errors['from_name'] = __('A name for the email is required', 'cart66');
}
if (empty($this->from_email) || !Cart66Common::isValidEmail($this->from_email)) {
$errors['from_email'] = __('A valid from email address is required', 'cart66');
}
if (empty($this->subject)) {
$errors['subject'] = __('A subject for the email is required', 'cart66');
}
return $errors;
}
示例4: sendTestEmail
public static function sendTestEmail()
{
$to = $_POST['email'];
$status = $_POST['status'];
if (!Cart66Common::isValidEmail($to)) {
$result[0] = 'Cart66Modal alert-message alert-error';
$result[1] = '<strong>Error</strong><br/>' . __('Please enter a valid email address', 'cart66') . '<br>';
} else {
if (isset($_GET['type']) && $_GET['type'] == 'reminder') {
$sendEmail = Cart66MembershipReminders::sendTestReminderEmails($to, $_GET['id']);
} else {
$sendEmail = Cart66AdvancedNotifications::sendTestEmail($to, $status);
}
if ($sendEmail) {
$result[0] = 'Cart66Modal alert-message success';
$result[1] = '<strong>Success</strong><br/>' . __('Email successfully sent to', 'cart66') . ' <br /><strong>' . $to . '</strong><br>';
} else {
$result[0] = 'Cart66Modal alert-message alert-error';
$result[1] = '<strong>Error</strong><br/>' . __('Email not sent. There is an unknown error.', 'cart66') . '<br>';
}
}
echo json_encode($result);
die;
}
示例5: _isEmailValid
/**
* Return true if email address is valid and present
*/
protected function _isEmailValid()
{
$isValid = true;
if (!Cart66Common::isValidEmail($this->email)) {
$isValid = false;
$this->addError('email', __("Email address is invalid", "cart66"), 'account-email');
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Account validation error: email address is not valid");
}
return $isValid;
}
示例6: setPayment
public function setPayment($p)
{
if (is_array($p)) {
// Remove all non-numeric characters from card number
if (isset($p['cardNumber'])) {
$cardNumber = $p['cardNumber'];
$p['cardNumber'] = preg_replace('/\\D/', '', $cardNumber);
}
$this->_payment = $p;
$skip = array('email', 'phone', 'custom-field');
$custom_payment_fields = apply_filters('cart66_after_payment_form', '');
if (is_array($custom_payment_fields)) {
foreach ($custom_payment_fields as $key => $payment_field) {
if (!$payment_field['required']) {
$skip[] = $payment_field['slug'];
}
if (isset($payment_field['validator']) && $payment_field['validator'] != '') {
if (function_exists($payment_field['validator'])) {
$skip[] = $payment_field['slug'];
$data_to_validate = isset($p[$payment_field['slug']]) ? $p[$payment_field['slug']] : '';
$validated = call_user_func($payment_field['validator'], $data_to_validate);
if (!$validated['valid']) {
foreach ($validated['errors'] as $key => $error) {
$this->_errors['Payment ' . $payment_field['slug'] . $key] = $error;
$this->_jqErrors[] = 'payment-' . $payment_field['slug'];
}
}
}
}
}
}
foreach ($p as $key => $value) {
if (!in_array($key, $skip)) {
$value = trim($value);
if ($value == '') {
$keyName = ucwords(preg_replace('/([A-Z])/', " \$1", $key));
$this->_errors['Payment ' . $keyName] = __('Payment ', 'cart66') . $keyName . __(' required', 'cart66');
$this->_jqErrors[] = "payment-{$key}";
}
}
}
foreach ($p as $key => $value) {
if ($key == 'custom-field') {
continue;
}
$value = trim($value);
if ($value == '') {
$keyName = preg_replace('/([A-Z])/', " \$1", $key);
$this->_errors['Payment ' . $keyName] = __('Payment ', 'cart66') . $keyName . __(' required', 'cart66');
$this->_jqErrors[] = "payment-{$key}";
}
}
if (strlen($p['cardNumber']) > 0 && strlen($p['cardNumber']) < 13) {
$this->_errors['Payment Card Number'] = __('Invalid credit card number', 'cart66');
$this->_jqErrors[] = "payment-cardNumber";
}
if (!Cart66Common::isValidEmail($p['email'])) {
$this->_errors['Email'] = __("Email address is not valid", "cart66");
$this->_jqErrors[] = 'payment-email';
}
if (Cart66Setting::getValue('checkout_custom_field_display') == 'required' && $p['custom-field'] == '') {
$this->_errors['Custom Field'] = Cart66Setting::getValue('checkout_custom_field_error_label') ? Cart66Setting::getValue('checkout_custom_field_error_label') : __('The Special Instructions Field is required', 'cart66');
$this->_jqErrors[] = 'checkout-custom-field-multi';
$this->_jqErrors[] = 'checkout-custom-field-single';
}
// For subscription accounts
if (isset($p['password'])) {
if ($p['password'] != $p['password2']) {
$this->_errors['Password'] = __("Passwords do not match", "cart66");
$this->_jqErrors[] = 'payment-password';
}
}
}
}
示例7: setPayment
public function setPayment($p)
{
if ($p['email'] == '') {
$this->_errors['Email address'] = __('Email address is required', 'cart66');
$this->_jqErrors[] = "payment-email";
}
if ($p['phone'] == '') {
$this->_errors['Phone'] = __('Phone number is required', 'cart66');
$this->_jqErrors[] = "payment-phone";
}
if (!Cart66Common::isValidEmail($p['email'])) {
$this->_errors['Email'] = __("Email address is not valid", "cart66");
$this->_jqErrors[] = 'payment-email';
}
if (Cart66Setting::getValue('checkout_custom_field_display') == 'required' && $p['custom-field'] == '') {
$this->_errors['Custom Field'] = Cart66Setting::getValue('checkout_custom_field_error_label') ? Cart66Setting::getValue('checkout_custom_field_error_label') : __('The Special Instructions Field is required', 'cart66');
$this->_jqErrors[] = 'checkout-custom-field-multi';
$this->_jqErrors[] = 'checkout-custom-field-single';
}
$this->_payment['email'] = $p['email'];
$this->_payment['phone'] = $p['phone'];
$this->_payment['custom-field'] = $p['custom-field'];
}