This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Allow people to specify a coupon code in the URL, and add it to their cart. | |
*/ | |
function yst_edd_discount_link() { | |
if ( isset( $_GET['coupon'] ) ) { | |
// Check whether it's a valid coupon, if so, add it to the cart. | |
if ( edd_is_discount_valid( $_GET['coupon'] ) ) | |
edd_set_cart_discount( $_GET['coupon'] ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php # -*- coding: utf-8 -*- | |
/** | |
* Plugin Name: T5 Silent Flush | |
* Description: Flushes rewrite rules whenever a custom post type or taxonomy is registered and not already part of these rules. This is a soft flush, the .htaccess will not be rewritten. | |
* Version: 2013.05.04 | |
* Author: Thomas Scholz <info@toscho.de> | |
* Author URI: http://toscho.de | |
* License: MIT | |
* License URI: http://www.opensource.org/licenses/mit-license.php | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template Loader for Plugins | |
* | |
* @package Template_Loader_For_Plugins | |
* @author Gary Jones | |
* @link http://gamajo.com/template-loader | |
* @copyright 2013 Gary Jones | |
* @license GPL-2.0+ | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Show license key limit in [purchase_history] shortcode. | |
* | |
* @since 0.1.0 | |
*/ | |
function edd_site_count_downloads_license_limit_th() { | |
echo '<th class="edd-site-count-site-count">' . __( 'Site Count', 'edd-site-count' ) . '</th>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Register the payment icon | |
*/ | |
function pw_edd_payment_icon($icons) { | |
$icons['url/to/your/image/icon.png'] = 'Name of the Payment Method'; | |
return $icons; | |
} | |
add_filter('edd_accepted_payment_icons', 'pw_edd_payment_icon'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Automatically append mtime to script and style versions for cache-busting action **/ | |
add_action( 'wp_enqueue_scripts', function() { | |
global $wp_styles, $wp_scripts; | |
foreach( array( 'wp_styles', 'wp_scripts' ) as $resource ) { | |
foreach( $$resource->registered as $name => $registered_resource ) { | |
// Not hosted here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
echo PHP_EOL; | |
// output a little introduction | |
echo '>> Starting unit tests' . PHP_EOL; | |
// get the name for this project; probably the topmost folder name | |
$projectName = basename(getcwd()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Rarst\GitHub\Gist; | |
use GuzzleHttp\Client; | |
use GuzzleHttp\Command\Guzzle\Description; | |
use GuzzleHttp\Command\Guzzle\GuzzleClient; | |
/** | |
* Build Gist comments feed for specific user, using GitHub API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo nl2br(print_r(divide_money_evenly((float)(string) 78.23, 3), true)); | |
function divide_money_evenly($number, $divided_by, $numbers=array()) { | |
$total = 0; | |
for($i=1; $i<=$divided_by; $i++) { | |
if(abs($number - $total) != 0) { | |
$divided = $number / $divided_by; | |
if($divided < 1) { | |
$rounded = 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: WP_Rewrite endpoints demo | |
Description: A plugin giving example usage of the WP_Rewrite endpoint API | |
Plugin URI: http://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/ | |
Author: Jon Cave | |
Author URI: http://joncave.co.uk/ | |
*/ | |
function makeplugins_endpoints_add_endpoint() { |