public static function encrypt($text) { $use_mcrypt = apply_filters('gform_use_mcrypt', function_exists('mcrypt_encrypt')); if ($use_mcrypt) { $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $key = substr(md5(wp_salt('nonce')), 0, $iv_size); $encrypted_value = trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, mcrypt_create_iv($iv_size, MCRYPT_RAND)))); } else { $encrypted_value = EncryptDB::encrypt($text, wp_salt('nonce')); //$encrypted_value = base64_encode( $wpdb->get_var( $wpdb->prepare('SELECT AES_ENCRYPT(%s, %s) AS data', $text, wp_salt( 'nonce' ) ) ) ); } return $encrypted_value; }