Skip to content

Instantly share code, notes, and snippets.

$gps_time = urldecode($wp_query->query_vars['gpstime']);
// gpstime of '0000-00-00 00:00:00' is how we determine if its a nonce request
if ($gps_time == '0000-00-00 00:00:00') {
$session_id = $wp_query->query_vars['sessionid'];
$session_id_pattern = '[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}';
if (preg_match($session_id_pattern, $session_id)) {
$wpnonce = wp_create_nonce($session_id);
} else {
<?php
defined('ABSPATH') or exit;
/*
Plugin Name: Gps Tracker Endpoint
Plugin URI: https://www.websmithing.com/gps-tracker
Description: Create an endpoint for Gps Tracker.
Version: 1.0.0
Author: Nick Fox
Author URI: https://www.websmithing.com/hire-me
License: GPL2
/*
here is the json being passed into the function when the user clicks on the routes dropdown box
{"locations":[{"latitude":"47.610000","longitude":"-122.330000","speed":"0","direction":"0","distance":"0.0","location_method":"na","gps_time":"Jan 3 2007 01:37PM","user_name":"wordpressUser2","session_id":"8BA21D90-3F90-407F-BAAE-800B04B1F5EA","accuracy":"137","extra_info":"na"}]}
{"locations":[{"latitude":"47.610000","longitude":"-122.330000","speed":"0","direction":"0","distance":"0.0","location_method":"na","gps_time":"Jan 3 2007 01:37PM","user_name":"wordpressUser","session_id":"8BA21D90-3F90-407F-BAAE-800B04B1F5EC","accuracy":"137","extra_info":"na"}]}
*/
function loadGPSLocations(json) {
<?php
/*
Plugin Name: rewrite test
Description: rewrite test
Author: Nick
Version: 1.0
*/
register_activation_hook(__FILE__, 'activate');
// launches the settings screen that lets user turn on gps radio
private void launchGPSOptions() {
final ComponentName toLaunch = new ComponentName("com.android.settings","com.android.settings.SecuritySettings");
final Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setComponent(toLaunch);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult(intent, 0);
}
// launches the settings screen that lets user turn on gps radio
private void launchGPSOptions() {
final ComponentName toLaunch = new ComponentName("com.android.settings","com.android.settings.SecuritySettings");
final Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setComponent(toLaunch);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult(intent, 0);
}
// put this in your activity
@Override
protected Dialog onCreateDialog(int id) {
if(id == ID_DIALOG_VALIDATE){
ProgressDialog registerDialog = new ProgressDialog(this);
registerDialog.setMessage(getString(R.string.alert_registering_phone));
registerDialog.setIndeterminate(true);
registerDialog.setCancelable(true);
return registerDialog;
Android Debug Bridge
ADB quickview
* Manage the state of an emulator or device
* Run shell commands on a device
* Manage port forwarding on an emulator or device
* Copy files to/from an emulator or device
In this document
// launches the settings screen that lets user turn on gps radio
private void launchGPSOptions() {
final ComponentName toLaunch = new ComponentName("com.android.settings","com.android.settings.SecuritySettings");
final Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setComponent(toLaunch);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult(intent, 0);
}
package com.mysite.aes;
import javax.crypto.*;
import javax.crypto.spec.*;
public class AES {
static String key = "Z7Y74jNe43F3o15T"; // must be 16-bytes
static String iv = "P0LrHf3nkBo7z46f";
public static String Encrypt(String stringToEncrypt) {