lundi 30 mars 2015

How to call class method in plugin wordpress

I have this code



function woocommerce_robokassa(){

if (!class_exists('WC_Payment_Gateway'))
return;
if(class_exists('WC_ROBOKASSA'))
return;

class WC_ROBOKASSA extends WC_Payment_Gateway{

public function X {}

}
}
function add_robokassa_gateway($methods){
$methods[] = 'WC_ROBOKASSA';
return $methods;
}

add_filter('woocommerce_payment_gateways', 'add_robokassa_gateway');


Now I have to call X function her, but when I do it in this way



if(isset($_POST['newSum']) && !empty($_POST['newSum'])) {

$myClass = new WC_ROBOKASSA();
$myClass->X();
}


I get errore class WC_ROBOKASSA is not defined, how can call X function


Aucun commentaire:

Enregistrer un commentaire