| Server IP : 89.39.208.18 / Your IP : 216.73.217.74 Web Server : LiteSpeed System : User : ( ) PHP Version : 7.4.33 Disable Function : eval,./,ln,passthru,dl,system,exec,popen,shell_exec,posix_getpwuid,posix_uname,ftp_exec,posix_uname,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,get_current_user,getmyuid,getmygid,listen,chgrp,apache_note,apache_setenv,apache_child_terminate,closelog,debugger_off,debugge_on,ini_restore,netscript,escapeshellarg,cmd,backtick,virtual,show_sourc,show_source,pclose,pcntl_exec,datasec,old_offset,ctrl_dir,ini_alter,leak,listen,chgrp,apache_setenv,define_syslog_variables,root,diskfreespace,disk_free_space,disk_total_space,posix_kill,getmyuid,getmygid,apache_child_terminate,php_ini_scanned_files,ls,ps_aux,chown,getrusage,posixc,posame,chgrp,posix_setuid,posix_setsid,posix_setgid,apache_note,apache_setenv,x_getuid,e_ini_file,nfo,SQL,mysql_li,t_dbs,filegroup,highlight_file,ilegetcontents,get_dir,popen,popens,pfsockopen,dos_conv,apache_get_modules,crack_check,crack_closedict,rar_open,bzopen,bzread,bzwrite,shellcode,posix_isatty,posix_getservbyname,escapeshellarg,hypot,pg_host,pos,posix_access,inurl,posix_times,posix_mknod,pclose,ps_fill,symlink,id,escapeshellcmd,php_uname,phpinfo MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home3/mahyarcake/./././www/wp-content/plugins/gravityforms/includes/settings/fields/ |
Upload File : |
<?php
namespace Gravity_Forms\Gravity_Forms\Settings\Fields;
use Gravity_Forms\Gravity_Forms\Settings\Fields;
defined( 'ABSPATH' ) || die();
class Text extends Base {
/**
* Field type.
*
* @since 2.5
*
* @var string
*/
public $type = 'text';
/**
* Input type.
*
* @since 2.5
*
* @var string
*/
public $input_type = 'text';
protected $step;
protected $append;
// # RENDER METHODS ------------------------------------------------------------------------------------------------
/**
* Render field.
*
* @since 2.5
*
* @return string
*/
public function markup() {
// Get value.
$value = $this->get_value();
// Prepare after_input.
// Dynamic after_input content should use a callable to render.
if ( isset( $this->after_input ) && is_callable( $this->after_input ) ) {
$this->after_input = call_user_func( $this->after_input, $value, $this );
}
// Prepare markup.
// Display description.
$html = $this->get_description();
$html .= sprintf(
'<span class="%s"><input type="%s" name="%s_%s" value="%s" %s %s />%s %s</span>',
esc_attr( $this->get_container_classes() ),
esc_attr( $this->input_type ),
esc_attr( $this->settings->get_input_name_prefix() ),
esc_attr( $this->name ),
$value ? esc_attr( htmlspecialchars( $value, ENT_QUOTES ) ) : '',
$this->get_describer() ? sprintf( 'aria-describedby="%s"', $this->get_describer() ) : '',
implode( ' ', $this->get_attributes() ),
isset( $this->append ) ? sprintf( '<span class="gform-settings-field__text-append">%s</span>', esc_html( $this->append ) ) : '',
$this->get_error_icon()
);
// Insert after input markup.
$html .= isset( $this->after_input ) ? $this->after_input : '';
return $html;
}
// # VALIDATION METHODS --------------------------------------------------------------------------------------------
/**
* Validate posted field value.
*
* @since 2.5
*
* @param string $value Posted field value.
*/
public function do_validation( $value ) {
// If field is required and value is missing, set field error.
if ( $this->required && rgblank( $value ) ) {
$this->set_error( rgobj( $this, 'error_message' ) );
}
// Sanitize posted value.
$sanitized_value = sanitize_text_field( $value );
// If posted and sanitized values do not match, add field error.
if ( $value !== $sanitized_value ) {
// Prepare correction script.
$double_encoded_safe_value = htmlspecialchars( htmlspecialchars( $sanitized_value, ENT_QUOTES ), ENT_QUOTES );
$script = sprintf(
'jQuery("input[name=\"%s_%s\"]").val(jQuery(this).data("safe"));',
$this->settings->get_input_name_prefix(),
$this->name
);
// Prepare message.
$message = sprintf(
"%s <a href='javascript:void(0);' onclick='%s' data-safe='%s'>%s</a>",
esc_html__( 'The text you have entered is not valid. For security reasons, some characters are not allowed. ', 'gravityforms' ),
htmlspecialchars( $script, ENT_QUOTES ),
$double_encoded_safe_value,
esc_html__( 'Fix it', 'gravityforms' )
);
// Set field error.
$this->set_error( $message );
}
}
}
Fields::register( 'text', '\Gravity_Forms\Gravity_Forms\Settings\Fields\Text' );