| Server IP : 151.101.66.159 / Your IP : 216.73.216.66 Web Server : Flywheel/5.1.0 System : Linux wordpress 6.12.113+ #1 SMP Thu Oct 22 02:38:20 UTC 2026 x86_64 User : root ( ) PHP Version : 7.4.33.18 Disable Function : disk_free_space,diskfreespace,dl,exec,fpassthru,getmypid,getmyuid,highlight_file,link,opcache_compile_file,opcache_get_configuration,opcache_is_script_cached,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,phpinfo,popen,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,socket_listen,source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wp-content/plugins/pods/classes/fields/ |
Upload File : |
<?php
// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
/**
* @package Pods\Fields
*/
class PodsField_Email extends PodsField {
/**
* {@inheritdoc}
*/
public static $group = 'Text';
/**
* {@inheritdoc}
*/
public static $type = 'email';
/**
* {@inheritdoc}
*/
public static $label = 'E-mail';
/**
* {@inheritdoc}
*/
public static $prepare = '%s';
/**
* {@inheritdoc}
*/
public function setup() {
static::$group = __( 'Text', 'pods' );
static::$label = __( 'E-mail', 'pods' );
}
/**
* {@inheritdoc}
*/
public function options() {
$options = [
static::$type . '_max_length' => [
'label' => __( 'Maximum Length', 'pods' ),
'default' => 255,
'type' => 'number',
'help' => __( 'Set to -1 for no limit', 'pods' ),
],
static::$type . '_html5' => [
'label' => __( 'Enable HTML5 Input Field', 'pods' ),
'default' => apply_filters( 'pods_form_ui_field_html5', 0, static::$type ),
'type' => 'boolean',
],
static::$type . '_placeholder' => [
'label' => __( 'HTML Placeholder', 'pods' ),
'default' => '',
'type' => 'text',
'help' => [
__( 'Placeholders can provide instructions or an example of the required data format for a field. Please note: It is not a replacement for labels or description text, and it is less accessible for people using screen readers.', 'pods' ),
'https://www.w3.org/WAI/tutorials/forms/instructions/#placeholder-text',
],
],
];
return $options;
}
/**
* {@inheritdoc}
*/
public function schema( $options = null ) {
$length = (int) pods_v( static::$type . '_max_length', $options, 255 );
$schema = 'VARCHAR(' . $length . ')';
if ( 255 < $length || $length < 1 ) {
$schema = 'LONGTEXT';
}
return $schema;
}
/**
* {@inheritdoc}
*/
public function input( $name, $value = null, $options = null, $pod = null, $id = null ) {
$options = ( is_array( $options ) || is_object( $options ) ) ? $options : (array) $options;
$form_field_type = PodsForm::$field_type;
$value = $this->normalize_value_for_input( $value, $options );
$field_type = 'email';
if ( isset( $options['name'] ) && ! pods_permission( $options ) ) {
if ( pods_v_bool( 'read_only_restricted', $options ) ) {
$options['readonly'] = true;
$field_type = 'text';
} else {
return;
}
} elseif ( ! pods_has_permissions( $options ) ) {
if ( pods_v_bool( 'read_only', $options ) ) {
$options['readonly'] = true;
$field_type = 'text';
}
}
if ( ! empty( $options['disable_dfv'] ) ) {
return pods_view( PODS_DIR . 'ui/fields/email.php', compact( array_keys( get_defined_vars() ) ) );
}
$type = pods_v( 'type', $options, static::$type );
$args = compact( array_keys( get_defined_vars() ) );
$args = (object) $args;
$this->render_input_script( $args );
}
/**
* {@inheritdoc}
*/
public function validate( $value, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) {
$validate = parent::validate( $value, $name, $options, $fields, $pod, $id, $params );
$errors = [];
if ( is_array( $validate ) ) {
$errors = $validate;
}
$check = $this->pre_save( $value, $id, $name, $options, $fields, $pod, $params );
if ( is_array( $check ) ) {
$errors = $check;
} else {
if ( 0 < strlen( (string) $value ) && '' === $check ) {
$label = pods_v( 'label', $options, ucwords( str_replace( '_', ' ', $name ) ) );
if ( $this->is_required( $options ) ) {
// translators: %s is the field label.
$errors[] = sprintf( __( '%s is required', 'pods' ), $label );
} else {
// translators: %s is the field label.
$errors[] = sprintf( __( 'Invalid e-mail provided for %s', 'pods' ), $label );
}
}
}
if ( ! empty( $errors ) ) {
return $errors;
}
return $validate;
}
/**
* {@inheritdoc}
*/
public function pre_save( $value, $id = null, $name = null, $options = null, $fields = null, $pod = null, $params = null ) {
$options = ( is_array( $options ) || is_object( $options ) ) ? $options : (array) $options;
if ( ! is_email( $value ) ) {
$value = '';
}
$length = (int) pods_v( static::$type . '_max_length', $options, 255 );
if ( 0 < $length && $length < pods_mb_strlen( $value ) ) {
$value = pods_mb_substr( $value, 0, $length );
}
return $value;
}
/**
* {@inheritdoc}
*/
public function ui( $id, $value, $name = null, $options = null, $fields = null, $pod = null ) {
return '<a href="mailto:' . esc_attr( $value ) . '">' . $value . '</a>';
}
}