Skip to content

Instantly share code, notes, and snippets.

View BFTrick's full-sized avatar

Patrick Rauland BFTrick

View GitHub Profile
@BFTrick
BFTrick / Paypal Caller Service
Created May 9, 2012 17:01
Paypal Caller Service Sample Code
<?php
/****************************************************
CallerService.php
This file uses the constants.php to get parameters needed
to make an API call and calls the server.if you want use your
own credentials, you have to change the constants.php
Called by TransactionDetails.php, ReviewOrder.php,
DoDirectPaymentReceipt.php and DoExpressCheckoutPayment.php.
@BFTrick
BFTrick / soap-connection-to-midax-api
Created May 10, 2012 16:45
SOAP Connection to Midax API
<?php
try{
$serviceWsdlUri = "https://XXX.XXX.XXX.XXX/eft/Cards.asmx?WSDL";
$soapClient = new SoapClient($serviceWsdlUri);
$username = "XXXXX";
$password = "XXXXX";
$cardNumber = "XXXXX";
$plasticNo = "";
$amount=3;
@BFTrick
BFTrick / sample-army-builder-file-space-marines-800pt-list.xml
Created August 17, 2012 01:31
A sample Army Builder exported list. Space Marines - 800 points
<?xml version="1.0" encoding="UTF-8"?>
<document signature="Army Builder Roster">
<product major="3" minor="4" patch="0" build="319" />
<game folder="AB40k6" game="Warhammer 40 000 6th Edition" major="1" minor="2" />
<author date="20120816202332" />
<roster name="" race="sm" size="0" activesize="795." racename="Codex: Space Marines">
<tag group="language" tag="English" />
<tag group="ruleset" tag="gnVersion" />
<tag group="ruleset" tag="ohWHA" />
<tag group="ruleset" tag="oh_nohvy" />
@BFTrick
BFTrick / get-closest-ancestral-featured-image.php
Last active October 10, 2015 05:07
This script looks for a featured image on the current page, if it can't find a featured image it will continue to look backwards through the family tree until it can find one. Then it will print it.
@BFTrick
BFTrick / .htaccess
Created September 12, 2012 13:39
Default WordPress .htaccess File
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
@BFTrick
BFTrick / functions.php
Created September 12, 2012 15:12
WordPress Hooks Demo
/*-------------------------------------
/ WordPress Hooks Demo (whd)
-------------------------------------*/
//base function
function whd_a_plus_b(){
$a = 2;
$b = 3;
$a = apply_filters( 'whd_modify_a', $a ); // a = 8
@BFTrick
BFTrick / functions.php
Created September 12, 2012 16:25
Store Locator Plus Example show_search_form Hook
/*base function*/
function slp_show_search_form(){
$showSearchForm = true;
$showSearchForm = apply_filters( 'slp_modify_show_search_form', $showSearchForm );
$result = "";
if($showSearchForm){
//show the form
$result = "some html";
@BFTrick
BFTrick / deploy.sh
Created September 22, 2012 18:28
WordPress Plugin Deploy Script
#! /bin/bash
# A modification of Dean Clatworthy's deploy script as found here: https://github.com/deanc/wordpress-plugin-git-svn
# The difference is that this script lives in the plugin's git repo & doesn't require an existing SVN repo.
# main config
PLUGINSLUG="______your-plugin-name______"
CURRENTDIR=`pwd`
MAINFILE="______your-plugin-name______.php" # this should be the name of your main php file in the wordpress plugin
# git config
@BFTrick
BFTrick / functions.php
Created September 24, 2012 21:41
Dequeue CSS From Plugins
//dequeue css from plugins
add_action('wp_print_styles', 'mytheme_dequeue_css_from_plugins', 100);
function mytheme_dequeue_css_from_plugins() {
wp_dequeue_style( "plugin-css-file-handle" );
}
@BFTrick
BFTrick / functions.php
Created October 16, 2012 19:39
Load jQuery From CDN With Local Fallback
//include jquery - use an empty file path which is basically a promise to WP that you'll hardcode it into your theme
wp_deregister_script('jquery');
wp_register_script('jquery', '', FALSE, '1.8.0', true);
wp_enqueue_script('jquery');