Skip to content

Instantly share code, notes, and snippets.

View remcotolsma's full-sized avatar
🏢
Working @pronamic

Remco Tolsma remcotolsma

🏢
Working @pronamic
View GitHub Profile
@remcotolsma
remcotolsma / hmapi.js
Last active July 13, 2016 11:11
Holiday Media JavaScript API from https://lib.hmcms.nl/js/2/ha/booking/hmapi.js unminified with http://unminify.com/.
window.hmapi || (window.hmapi = function(n) {
"use strict";
var i, e = n.document,
o = function(n, i, o, t) {
o = e.createElement("script"), o.src = n, o.onload = i, o.onreadystatechange = function(n) {
n = this.readyState, ("complete" == n || "loaded" == n) && i()
}, t = e.getElementsByTagName("script")[0], t.parentNode.insertBefore(o, t)
},
t = function() {
var t, r = "https://lib.hmcms.nl/js/2/",
@remcotolsma
remcotolsma / functions.php
Created July 13, 2016 08:20
SSL en Issuu PDF Sync
<?php
function emg_magazine_embed_ssl_compatible( $content ) {
if ( 'magazine' === get_post_type() ) {
// Fix Issuu PDF Sync SSL link
// @see https://plugins.trac.wordpress.org/browser/issuu-pdf-sync/tags/3.1/classes/shortcodes.php#L75
$content = str_replace( 'http://static.issuu.com/', 'https://static.issuu.com/', $content );
}
return $content;
@remcotolsma
remcotolsma / pronamic-ideal-booking.php
Created July 7, 2016 07:56
Proof of concept Pronamic iDEAL Booking Calendar support.
<?php
function pronamic_ideal_booking_settings() {
echo 'Pronamic iDEAL';
}
add_bk_action( 'wpdev_bk_payment_show_tab_in_top_settings', 'pronamic_ideal_booking_settings');
function pronamic_ideal_booking_payment_form( $blank, $booking_id, $summ,$bk_title, $booking_days_count, $booking_type, $bkform, $wp_nonce, $is_deposit ) {
$output = wpdev_bk_define_payment_form_bank_transfer( $blank, $booking_id, $summ,$bk_title, $booking_days_count, $booking_type, $bkform, $wp_nonce, $is_deposit );
@remcotolsma
remcotolsma / locations.php
Created June 8, 2016 08:39
WordPress custom table with post locations and query to select posts within distance.
<?php
function wkd_sync_location_to_table( $post_id ) {
// Sync locations
global $wpdb;
$location_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->wkd_post_locations WHERE post_id = %d;", $post_id ) );
$format = array(
'post_id' => '%d',
@remcotolsma
remcotolsma / api-pronamic-eu-test.php
Created May 3, 2016 13:06
Pronamic.eu API tester script
<?php
define( 'WP_USE_THEMES', false );
require './wp-blog-header.php';
$response = wp_remote_get( 'https://api.pronamic.eu/licenses/check/1.0/' );
var_dump( $response );
@remcotolsma
remcotolsma / gist:c2d205a94138fa17fbda455f8ea793af
Created May 3, 2016 06:42
SiteGround - 403 - Forbidden Error - api.pronamic.eu
array(5) {
["headers"]=>
array(6) {
["server"]=>
string(5) "nginx"
["date"]=>
string(29) "Tue, 03 May 2016 06:29:15 GMT"
["content-type"]=>
string(9) "text/html"
@remcotolsma
remcotolsma / find-hacked-content.php
Last active May 2, 2016 12:12
WordPress find hacked content.
<?php
define( 'WP_USE_THEMES', false );
require './wp-blog-header.php';
global $wpdb;
$search = 'position:absolute;';
@remcotolsma
remcotolsma / search-html-entities.sh
Last active April 14, 2016 10:18
Search for HTML entities in PHP files.
grep --recursive --exclude-dir={node_modules,vendor} "&[^\s]*;" */*.php
grep --recursive --exclude-dir={bower_components,languages,node_modules,src,vendor} "&[^\s]*;" *.php
grep --recursive --include="*.php" --exclude-dir={bower_components,node_modules,vendor} "&[[:alnum:]]*;" .
// @see http://www.webdeveloper.com/forum/showthread.php?175987-RESOLVED-Regex-to-match-html-entities
// @see http://stackoverflow.com/a/186020
// @see https://gist.github.com/a1phanumeric/5346170
@remcotolsma
remcotolsma / test.sh
Created April 12, 2016 08:28
cURL command to test OmniKassa response request
curl 'http://www.remcotolsma.nl/' --data 'Data=test&Seal=test&InterfaceVersion=HP_1.0'
@remcotolsma
remcotolsma / wp-config.php
Last active April 7, 2016 09:15
WordPress readonly from wp-config.php
<?php
// ...
if ( is_readable( 'readonly.html' ) && ! in_array( $_SERVER['REQUEST_METHOD'], array( 'HEAD', 'GET' ) ) ) {
header( 'HTTP/1.1 503 Service Temporarily Unavailable', true, 503 );
header( 'Status: 503 Service Temporarily Unavailable', true, 503 );
header( 'Retry-After: 3600' );
include 'readonly.html';