| Server IP : 185.143.233.238 / Your IP : 185.215.232.195 Web Server : LiteSpeed System : Linux saman.shetabanhost.com 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64 User : behrakir ( 1361) PHP Version : 8.1.34 Disable Function : symlink,shell_exec,show_source,exec,popen,system,passthru,proc_open,proc_close,pcntl_exec,mail MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/behrakir/khanomam.com/wp-content/plugins/wp-score-gamification/app/classes/parts/ |
Upload File : |
<?php namespace Avans\parts;
class convert{
public static function wallet_transaction($user_id,$amount,$description){
$res = false;
$settings = AVANS_SETTINGS['general_settings']['wallet'] ?? [];
if ((int)$amount == 0) {
return false;
}
if (defined('YITH_FUNDS_FILE')) {
if (!class_exists('YITH_Funds')) {
include_once(dirname(YITH_FUNDS_FILE) . '/class.yith-funds.php');
}
}
if (defined('FSWW_FILE')) {
if (!class_exists('Wallet')) {
include_once(dirname(FSWW_FILE) . '/includes/classes/Wallet.php');
}
}
switch (true) {
case (class_exists('MLM_Nav_Menu_Walker')):
$res = self::credit_mlm_wallet($user_id,$amount,$description);
break;
case (class_exists('Wallet')):
$res = self::credit_fs_wallet($user_id,$amount);
break;
case (class_exists('YITH_Funds')):
$res = self::credit_yith_wallet($user_id,$amount,$description);
break;
case (function_exists('woo_wallet')):
$res = self::credit_woo_wallet($user_id,$amount,$description);
break;
case (class_exists('WPVW_Ajax')):
$res = self::credit_appchar_Wallet($user_id,$amount,$description);
break;
case (class_exists('Referral_NIRWALLET')):
$res = self::credit_nir_wallet($user_id, $amount, $description);
break;
case ( function_exists('wal_credit_wallet_fund') ):
$res = self::credit_wallet_for_wc($user_id, $amount, $description);
break;
case (isset($settings['wallet_plugin']) && $settings['wallet_plugin'] == 'custom'):
$res = apply_filters('avans_custom_convert_to_wallet',$res,$user_id,$amount,$description);
break;
}
return $res;
}
public static function credit_wallet_for_wc($user_id, $amount, $description){
wal_credit_wallet_fund( [
'user_id' => $user_id,
'amount' => $amount,
'event_message' => $description
] );
return true;
}
public static function credit_nir_wallet($user_id, $amount, $description){
do_action ('nirwallet_credit', $user_id, $amount, $description );
return true;
}
public static function credit_appchar_Wallet($user_id,$amount,$description){
change_balance($amount,$user_id,$description,$user_id,0,'add');
return true;
}
public static function credit_woo_wallet($user_id,$amount,$description){
// func::log([$user_id,$amount,$description]);
$convert= woo_wallet()->wallet->credit($user_id, $amount, $description);
return $convert;
}
public static function credit_yith_wallet($user_id,$amount,$description){
$fund_user = new \YITH_YWF_Customer($user_id);
$old_funds = $fund_user->get_funds();
$new_funds = $old_funds + intval($amount);
$fund_user->set_funds($new_funds);
$log_args = array( 'user_id' => $user_id, 'type_operation' => 'admin_op', 'fund_user' => $amount, 'description' => $description );
$email_args = array(
'user_id' => $user_id,
'log_date' => date(wc_date_format(), current_time('timestamp')),
'before_funds' => $old_funds,
'after_funds' => $new_funds,
'change_reason' => $description
);
WC()->mailer();
do_action('ywf_send_advise_user_fund_email_notification', $email_args);
YWF_Log()->add_log($log_args);
return true;
}
public static function credit_fs_wallet($user_id,$amount){
\Wallet::add_funds($user_id, $amount, 0);
return true;
}
public static function credit_mlm_wallet($user_id,$amount,$description){
$convert = mlmFire()->wallet->update_meta($user_id, 'mlm_balance', $amount);
if ($convert) {
mlmFire()->db->wallet_record($user_id, 0, 0, $amount, 6, 1, $description);
}
return $convert;
}
}