Skip to content

Instantly share code, notes, and snippets.

View AmauriC's full-sized avatar

Amauri CHAMPEAUX AmauriC

View GitHub Profile
@AmauriC
AmauriC / push_xmlrpc.php
Last active October 8, 2017 19:51
Send a push notification when a post is published on WordPress with WPAPP.NINJA
<?php
function wpappninja_push_xmlrpc( $post_id ) {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
$lang_array = wpappninja_available_lang();
$post_data = get_post($post_id);
@AmauriC
AmauriC / custom-php.php
Created April 29, 2017 12:07
Inject custom code before and/or after the content on a WPAPP.NINJA app
<?php
add_filter( 'the_content', 'wpappninja_custom_php' );
function wpappninja_custom_php($content) {
$before = "HERE THE CONTENT BEFORE THE POST";
$after = "HERE THE CONTENT AFTER THE POST";
@AmauriC
AmauriC / detect.js
Last active August 29, 2015 14:17 — forked from PaulKinlan/detect.js
var detectInjection = function(knownHostsArray) {
var requests = window.performance.getEntriesByType("resource");
var unknownHosts = [];
var knownHosts = {};
var foundHosts = {};
for (var knownHost in knownHostsArray) {
knownHosts[knownHostsArray[knownHost]] = true;
}