account_tab_key); if(isset($_POST['selfpushoptions']) && !empty($_POST['selfpushoptions'])){ if(! wp_verify_nonce( $_POST['_wpnonce'], 'selfpushoptions' )) { print 'Sorry, your nonce did not verify. Please try again.'; exit; } $postid = intval($_POST['selfpushoptions']); $disableBulkSend = $accountOptions[pw_mobile_app_settings::$disableBulkSend]; $disableNotificationCache = $accountOptions[pw_mobile_app_settings::$disableNotificationCache]; $postType = "post"; $postdata = get_post( $postid); $postType = $postdata->post_type; if(class_exists('WP_JSON_Posts')){ $wp_server_posts = new WP_JSON_Posts(new WP_JSON_Server() ); $response = $wp_server_posts->get_post($postid, 'view'); if(isset($response) && isset($response->data)){ $wppost = $response->data; } $title = $wppost['title']; $excerpt = $wppost['pwapp_excerpt']; }else if(class_exists('WP_REST_Posts_Controller')){ //TODO: handle page $wp_server_posts = new WP_REST_Posts_Controller($postdata->post_type); $request = array(); $request['id'] = $postid; $response = $wp_server_posts->get_item($request); //print_r($response); if(isset($response) && isset($response->data)){ $wppost = $response->data; } $title = $wppost['title']['rendered']; $excerpt = $wppost['excerpt']['rendered']; } $postimage = $wppost['featuredimage']; if(empty($postimage)){ $postimage = $wppost['pwapp_post_image']; } $postlink = $wppost['link']; $cache = "yes"; if(isset($disableNotificationCache) && $disableNotificationCache == 'yes'){ $cache = "no"; } if(!empty($title)){ if($postType == "post"){//To fix notification issue $postType = "posts"; }else if ($postType == "page"){ $postType = "pages"; } if(isset($_POST['immediate']) && $_POST['immediate'] == '1'){ _e('Push notification Logs','androapp'); echo "
";
require_once PW_MOBILE_PATH.'gcm/send_message.php';
sendPushNotification(array("post_id" => $postid,
"title" => $title, "excerpt" =>$excerpt,
"postImage" => $postimage, "link" => $postlink, "cache" => $cache,
"postType" => $postType,
"notification_type" => "stack"),
$accountOptions[ANDROAPP_GCM_API_KEY], !($disableBulkSend == '1'));
echo ""; print_r($result); echo ""; echo $last7days . $thismonth . $lastmonth.$alltime; if(empty($result)){ echo "".__('No Records found for the duration','androapp')." "; }else{ ?>
| * | * | $row->title | $row->created_at | $row->eligible | "; echo "$row->bulk_sent | $row->success | $row->notRegistered | " . "$row->ios_eligible | $row->ios_bulk_sent | $row->ios_sent | $row->ios_notRegistered | " . "$row->mismatchsenderid | $row->other | $row->status | "; } ?>
|---|