Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View pippinsplugins's full-sized avatar

Pippin Williamson pippinsplugins

View GitHub Profile
@pippinsplugins
pippinsplugins / gist:5629997157daa96ad9a7
Created October 10, 2014 21:00
Adds a handling fee to EDD purchases that go through PayPal Standard
<?php
/**
* Plugin Name: Easy Digital Downloads - PayPal Handling Fee
* Description: Adds a handling fee to EDD purchases that go through PayPal
* Author: Pippin Williamson
* Author URI: http://pippinsplugins.com
* Contributors: mordauk
* Version: 1.0
*/
@pippinsplugins
pippinsplugins / gist:542ff08a4d1b8aa49140
Last active August 29, 2015 14:19
Restrict Content Pro base gateway class
<?php
/**
* Payment Gateway Base Class
*
* @package Restrict Content Pro
* @subpackage Classes/Roles
* @copyright Copyright (c) 2012, Pippin Williamson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 2.1
*/
@pippinsplugins
pippinsplugins / gist:55a3d6cbf9e9f2d51789
Created December 8, 2014 15:08
My answer to why I don't actively fight piracy.

While I'm often a member of a rather small group of people that think this way, I actually believe very strongly that spending time and effort figuring out how to make it harder for dishonest people to take things from you is generally a waste of time.

security is all about steadily making it harder for dishonest people to try stuff.

Piracy happens in just about every industry, but the impact that piracy has on your business largely has to do with how you choose to fight it. If you take an active approach and invest multitudes of time, effort, and money into combatting those that have no appreciation for the value of your product, you will actually undermine the intrinsic value of the product. How? Simply by investing time, money and effort in the wrong place. I prefer to take the time, effort and money that I could use to fight piracy and invest it directly into real customers and the people that have an appreciation for what has been built. Is some money lost due to piracy? Maybe. Is a whole lot more g

@pippinsplugins
pippinsplugins / all_post_types.php
Created April 21, 2012 16:54
All Post Types in Search
<?php
function ecpt_include_post_types_in_search($query) {
if(is_search()) {
$post_types = get_post_types(array('public' => true, 'exclude_from_search' => false), 'objects');
$searchable_types = array();
if($post_types) {
foreach( $post_types as $type) {
$searchable_types[] = $type->name;
}
@pippinsplugins
pippinsplugins / edd-currencies.php
Created April 25, 2012 20:52
EDD Currency Function
function edd_get_currencies() {
$currencies = apply_filters('edd_currencies', array(
'USD' => __('US Dollars (&#36;)', 'edd'),
'EUR' => __('Euros (&euro;)', 'edd'),
'GBP' => __('Pounds Sterling (&pound;)', 'edd'),
'AUD' => __('Australian Dollars (&#36;)', 'edd'),
'BRL' => __('Brazilian Real (&#36;)', 'edd'),
'CAD' => __('Canadian Dollars (&#36;)', 'edd'),
'CZK' => __('Czech Koruna', 'edd'),
'DKK' => __('Danish Krone', 'edd'),
@pippinsplugins
pippinsplugins / gist:2579659
Created May 2, 2012 19:41
Trying to change upload directory on "download" post type
<?php
function edd_load_upload_filter() {
add_action('load-edit.php', 'edd_change_downloads_upload_dir');
add_action('load-post.php', 'edd_change_downloads_upload_dir');
}
add_action('admin_init', 'edd_load_upload_filter');
function edd_change_downloads_upload_dir() {
$current_screen = get_current_screen();
@pippinsplugins
pippinsplugins / meta_field_class.php
Created May 7, 2012 15:23
Adds the value of an ECPT meta field to the post class
function ecpt_meta_field_classes($classes) {
$meta_value = get_post_meta(get_the_ID(), 'ecpt_fieldname', true);
if($meta_value) {
$classes[] = $meta_value;
}
return $classes;
}
add_filter('post_class', 'ecpt_meta_field_classes');
@pippinsplugins
pippinsplugins / edd_cart_quantity.php
Created May 24, 2012 01:31
Easy Digital Downloads Cart Quantity
<a href="<?php echo edd_get_checkout_uri(); ?>">
Cart (<span class="header-cart edd-cart-quantity"><?php echo edd_get_cart_quantity(); ?></span>)
</a>
@pippinsplugins
pippinsplugins / edd_post_type_labels.php
Created May 24, 2012 01:42
Modify the labels of the Downloads post type for Easy Digital Downloads
<?php
function set_download_labels($labels) {
$labels = array(
'name' => _x('Products', 'post type general name', 'your-domain'),
'singular_name' => _x('Product', 'post type singular name', 'your-domain'),
'add_new' => __('Add New', 'your-domain'),
'add_new_item' => __('Add New Product', 'your-domain'),
'edit_item' => __('Edit Product', 'your-domain'),
'new_item' => __('New Product', 'your-domain'),
'all_items' => __('All Products', 'your-domain'),
@pippinsplugins
pippinsplugins / ecpt_dates.php
Created May 25, 2012 16:51
Show nice dates from ECPT date meta fields
<?php
echo date( get_option('date_format'), get_post_meta( $post->ID, 'ecpt_datefieldname', true) );