Skip to content

Instantly share code, notes, and snippets.

Avatar

Patrick Rauland BFTrick

View GitHub Profile
@BFTrick
BFTrick / Paypal Caller Service
Created May 9, 2012
Paypal Caller Service Sample Code
View Paypal Caller Service
<?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
SOAP Connection to Midax API
View 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 Aug 17, 2012
A sample Army Builder exported list. Space Marines - 800 points
View sample-army-builder-file-space-marines-800pt-list.xml
<?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 Oct 10, 2015
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.
View get-closest-ancestral-featured-image.php
@BFTrick
BFTrick / .htaccess
Created Sep 12, 2012
Default WordPress .htaccess File
View .htaccess
# 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 Sep 12, 2012
WordPress Hooks Demo
View functions.php
/*-------------------------------------
/ 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 Sep 12, 2012
Store Locator Plus Example show_search_form Hook
View functions.php
/*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 Sep 22, 2012
WordPress Plugin Deploy Script
View deploy.sh
#! /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 Sep 24, 2012
Dequeue CSS From Plugins
View functions.php
//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 Oct 16, 2012
Load jQuery From CDN With Local Fallback
View functions.php
//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');
You can’t perform that action at this time.