You are here

function pwa_webpush_register in Progressive Web App 7.2

Parameters

$endpoint_sha256:

Return value

array|string[]

4 string references to 'pwa_webpush_register'
pwa_webpush_block_configure in modules/pwa_webpush/pwa_webpush.module
Implements hook_block_configure().
pwa_webpush_block_save in modules/pwa_webpush/pwa_webpush.module
Implements hook_block_save().
pwa_webpush_block_view in modules/pwa_webpush/pwa_webpush.module
Implements hook_block_view().
pwa_webpush_menu in modules/pwa_webpush/pwa_webpush.module
Implements hook_menu().

File

modules/pwa_webpush/pwa_webpush.pages.inc, line 9

Code

function pwa_webpush_register($endpoint_sha256) {
  $out = [
    'status' => 'ok',
  ];
  $uid = $GLOBALS['user']->uid;
  $function = '_pwa_webpush_subscription_' . $_SERVER['REQUEST_METHOD'];
  if (function_exists($function)) {
    $function($endpoint_sha256, $uid, $out);
  }
  else {
    $out['status'] = 'error';
    $out['error'] = 'HTTP Method ' . $_SERVER['REQUEST_METHOD'] . ' not supported';
  }
  return $out;
}