public _real_escape ( string $string ) : string | ||
$string | string | to escape |
return | string | escaped |
function _real_escape($string)
{
if ($this->dbh) {
if ($this->use_mysqli) {
return mysqli_real_escape_string($this->dbh, $string);
} else {
return mysql_real_escape_string($string, $this->dbh);
}
}
$class = get_class($this);
_doing_it_wrong($class, "{$class} must set a database connection for use with escaping.", E_USER_NOTICE);
return addslashes($string);
}
/** * Constructor * * @param array $tables Table names as keys, columns as value arrays * @param string $from String to find, will be escaped. * @param string $replacement String to use as replacement, will be escaped. * @param wpdb $wpdb */ public function __construct(array $tables, $from, $replacement, wpdb $wpdb) { $this->tables = $tables; $this->from = $wpdb->_real_escape($from); $this->replacement = $wpdb->_real_escape($replacement); $this->wpdb = $wpdb; }