function mysiteapp_send_push($post_id, $post_details = NULL) { if (!uppsite_api_values_set() || uppsite_push_control_enabled() && !isset($_POST['send_push'])) { return; } if (is_null($post_details)) { $post_details = get_post($post_id, ARRAY_A); } $dataOpts = get_option(MYSITEAPP_OPTIONS_DATA); $json_str = json_encode(array('title' => $post_details['post_title'], 'post_id' => $post_details['ID'], 'utime' => mysiteapp_convert_datetime($post_details['post_date']), 'api_key' => $dataOpts['uppsite_key'])); $hash = mysiteapp_sign_message($json_str); wp_remote_post(MYSITEAPP_PUSHSERVICE, array('body' => 'data=' . $json_str . '&hash=' . $hash, 'timeout' => 5)); }
function uppsite_admin_has_api_creds() { print json_encode(uppsite_api_values_set() ? uppsite_admin_did_setup() ? 2 : 1 : 0); exit; }