/**
  * Handles updating an icon via AJAX and the JSON API.
  */
 public static function update_push_package_icon()
 {
     check_ajax_referer('pushup-notification-settings');
     $white_listed_icon_ids = array('16x16', '16x16@2x', '32x32', '32x32@2x', '128x128', '128x128@2x');
     if (!isset($_POST['actionData']) || !is_array($_POST['actionData'])) {
         wp_send_json(array('error' => true));
     }
     $data = $_POST['actionData'];
     if (!isset($data['iconID']) || !in_array($data['iconID'], $white_listed_icon_ids) || !isset($data['iconURL'])) {
         wp_send_json(array('error' => true));
     } elseif (!isset($data['currentMode']) || !in_array($data['currentMode'], array('basic', 'advanced'))) {
         wp_send_json(array('error' => true));
     }
     $result = PushUp_Notifications_JSON_API::update_icon($data['iconURL'], $data['iconID'], $data['currentMode']);
     wp_send_json($result);
 }