예제 #1
0
 public static function ajax_number_formatter()
 {
     if (!isset($_REQUEST['number'])) {
         self::ajax_fail('Forget something?');
     }
     $nonce = $_REQUEST['security'];
     if (!wp_verify_nonce($nonce, self::NONCE)) {
         self::ajax_fail('Not going to fall for it!');
     }
     $number = $_REQUEST['number'];
     $currency = array('money' => sa_get_formatted_money($number), 'unformatted_money' => sa_get_unformatted_money($number), 'float' => si_get_number_format($number), 'int' => (int) si_get_number_format($number));
     header('Content-type: application/json');
     if (self::DEBUG) {
         header('Access-Control-Allow-Origin: *');
     }
     echo wp_json_encode($currency);
     exit;
 }
예제 #2
0
 public function set_amount($amount)
 {
     $this->save_post_meta(array(self::$meta_keys['amount'] => sa_get_unformatted_money($amount)));
 }