| 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/query/ |
Upload File : |
<?php
/**
* The Gravity Forms Query Column class.
*/
class GF_Query_Column {
/**
* @const Identifier for searching across any meta field.
*/
const META = '{{ANY META FIELD}}';
/**
* @var string The field ID.
*/
private $_field_id;
/**
* @var int|array The source.
*/
private $_source;
/**
* @var string|false The alias override (for meta rows)
*/
private $_alias = false;
/**
* Represents a column.
*
* @param string $field_id The field ID (meta key or column name).
* @param int|array $source The source this field is referencing.
* @param string|bool $alias An alias override. Default: false.
*/
public function __construct( $field_id, $source = 0, $alias = false ) {
if ( ! ( is_int( $source ) || is_array( $source ) ) ) {
return;
}
$this->_field_id = $field_id;
$this->_source = $source;
$this->_alias = $alias;
}
/**
* Get some SQL for this column.
*
* @param $query GF_Query The query.
*
* @return string The SQL.
*/
public function sql( $query ) {
if ( ! $query instanceof GF_Query ) {
return '';
}
if ( ! $this->field_id ) {
return '';
}
if ( $this->is_entry_column() ) {
return sprintf( '`%s`.`%s`', $this->alias ? $this->alias : $query->_alias( null, $this->source ), $this->field_id );
} else if ( $this->is_meta_column() ) {
return sprintf( '`%s`.`%s`', $this->alias ? $this->alias : $query->_alias( $this->field_id, $this->source, 'm' ), $this->field_id );
}
return '';
}
/**
* Whether this field is an entry column.
*
* @return boolean An entry column or not.
*/
public function is_entry_column() {
if ( ! $this->field_id ) {
return false;
}
static $entry_columns = array();
if ( empty( $entry_columns ) ) {
global $wpdb;
$entry_columns = wp_list_pluck( $wpdb->get_results( 'SHOW COLUMNS FROM ' . GFFormsModel::get_entry_table_name(), ARRAY_A ), 'Field' );
}
return in_array( $this->field_id, $entry_columns );
}
/**
* Whether this field is a nullable entry column.
*
* @since 2.3.1.10
*
* @return boolean An entry column or not.
*/
public function is_nullable_entry_column() {
if ( ! $this->field_id ) {
return false;
}
static $nullable_entry_columns = array();
if ( empty( $nullable_entry_columns ) ) {
global $wpdb;
$nullable_entry_columns = wp_list_pluck( $wpdb->get_results( 'SHOW COLUMNS FROM ' . GFFormsModel::get_entry_table_name() . " WHERE `Null` = 'YES'", ARRAY_A ), 'Field' );
}
return in_array( $this->field_id, $nullable_entry_columns );
}
/**
* Whether this field is a meta column.
*
* @return boolean A meta column or not.
*/
public function is_meta_column() {
if ( ! $this->field_id ) {
return false;
}
return in_array( $this->field_id, array( 'meta_key', 'meta_value' ) );
}
/**
* Proxy read-only values.
*/
public function __get( $key ) {
switch ( $key ):
case 'field_id':
return $this->_field_id;
case 'source':
return $this->_source;
case 'alias':
return $this->_alias;
endswitch;
}
}