Skip to content

Instantly share code, notes, and snippets.

View flymke's full-sized avatar

Michael Schönrock flymke

View GitHub Profile
@flymke
flymke / class-statistics-survey.php
Last active November 30, 2015 09:57
Workaround to get array_column() working for older PHP Versions in Bolder Surveys Plugin (http://codecanyon.net/item/bolder-surveys-for-wordpress). The file you need to edit is located under bolder-surveys/includes/admin/class-statistics-survey.php.
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Bolder_Survey_Statistics_Single {
/*
* Survey ID
<?php
/**
* Script to send a WooCommerce tracking email to the client
* @author: Mike Schoenrock (ms@halloecho.de)
*/
// Load the WordPress Environment
// change that to where your wp-blog-header.php is located
require( dirname( __FILE__ ) . '../../../../../wp-blog-header.php' );
<?php
/**
* Class for sending tracking emails
* For reference on WC_Emails class see https://docs.woocommerce.com/wc-apidocs/class-WC_Emails.html
* @author: Michael Schönrock (ms@halloecho.de)
*/
class Tracking_Email extends WC_Emails {
public function generate_message($tracking_number, $customer_name) {
@flymke
flymke / index.html
Last active March 7, 2017 13:23
HTML5 Bootstrap Boilerplate
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang=""> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang=""> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
@flymke
flymke / functions.php
Created August 20, 2019 11:05
Find out file handles in WordPress
<?php
add_action( 'wp_head', 'check_jquery' );
add_action( 'admin_head', 'check_jquery' );
function check_jquery() {
global $wp_scripts;
global $wp_styles;
//foreach ( $wp_scripts->registered as $wp_script ) {
@flymke
flymke / infectedFiles.md
Created January 9, 2020 09:37 — forked from frosit/infectedFiles.md
Some commands for finding and clearing infected PHP files

Finding infected files with following bash commands

** Command to list all infected files:

  • grep -lr --include=*.php "eval(base64_decode" /path/to/webroot
  • grep -lr --include=*.php "eval" .
  • grep -lr --include=*.php "base64" .

Command to remove malicious code:

  • grep -lr --include=*.php "eval(base64_decode" /path/to/webroot | xargs sed -i.bak 's/<?php eval(base64_decode[^;]*;/<?php\n/g'
@flymke
flymke / gist:eafbdf972fc5ef6c173ece70ec1731ec
Created May 14, 2020 13:16
Include jQueryModal for SantaPress
function santapress_load_jquerymodal() {
wp_enqueue_script( 'jquery-modal-santapress', 'https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.2/jquery.modal.min.js', array(), '0.9.2', true );
}
add_action('wp_enqueue_scripts', 'santapress_load_jquerymodal');
@flymke
flymke / gist:c5f49b52c8ecf5069c68b6d9a4e84c76
Created September 7, 2020 11:29
klarna-checkout-external-payment-methods-for-woocommerce.php
<?php
/*
Plugin Name: Klarna Checkout (V3) External Payment Methods for WooCommerce
Plugin URI: http://krokedil.com
Description: Adds PayPal and BACS as an extra payment method in Klarna Checkout iframe. Works with V3 of Klarna Checkout.
Version: 2.0.0
Author: Michael Schönrock
Author URI: https://www.halloecho.de
*/
@flymke
flymke / functions.php
Last active September 11, 2020 20:07
WooCommerce Germanized Pro 2.1.6 - send packing slip via email
/*
* WooCommerce Germanized Pro 2.1.6
* Function to send packing slip via email
**/
function woocommerce_order_status_processing_callback($order_id) {
if ( ! $order_id ) {
return;
}
@flymke
flymke / functions.php
Created September 11, 2020 20:06
WooCommerce Germanized Pro 2.6.1 - clone packing slip page on PDF
/*
* WooCommerce Germanized Pro 2.1.6
* Function to clone packing slip on PDF
**/
function my_clone_packing_slip( $attachment, $document ) {
if ( $document->type === 'packing_slip' ) {
WC_germanized_pro()->set_upload_dir_filter();
$path = get_attached_file( $attachment );