Skip to content

Instantly share code, notes, and snippets.

View cklosowski's full-sized avatar

Chris Klosowski cklosowski

View GitHub Profile
@cklosowski
cklosowski / eddwp-custom-session-start.php
Created May 31, 2019 23:58
Selectivly start Sessions with Easy Digital Downloads
<?php
/**
* If the page loaded is the homepage, we don't need to start a session if one doesn't exist
*/
function eddwp_ck_maybe_start_session( $start_session ) {
// Doesn't start sessions on the homepage.
if ( '/' == $_SERVER['REQUEST_URI'] ) {
$start_session = false;

Keybase proof

I hereby claim:

  • I am cklosowski on github.
  • I am cklosowski (https://keybase.io/cklosowski) on keybase.
  • I have a public key ASCOP7reanfM8vuURtRSisGC-Fn16yydrouHAkSF1psdVwo

To claim this, I am signing this object:

@cklosowski
cklosowski / edd-2.9.4-templatable-changes.txt
Last active July 9, 2018 18:37
A list of changes for the Easy Digital Downloads 2.9.4 release that add nonce verification to some actions. The format lists the file, a function (if relevant), what changes were made, and then the previous version of code, and the new version of the code.
/**
*
* Templates Changed
*
* These files are part of the Easy Digital Downlaods template structure. If you've added custom template files to your theme, for any of the following files, you will need to be sure the changes
* are added to your custom templates in order to avoid any unexpected behavior.
*
*/
@cklosowski
cklosowski / edd-sl-custom-local-domains.php
Created January 25, 2018 19:55
Add TLDs and Subdomains to Software Licensing is_local_url checks.
<?php
// Example of adding a TLD (.org in this example) to the is_local_url check.
function ck_add_url_tlds( $tlds_to_check ) {
$tlds_to_check[] = '.org';
return $tlds_to_check;
}
add_filter( 'edd_sl_url_tlds', 'ck_add_url_tlds', 10, 1 );

Keybase proof

I hereby claim:

  • I am cklosowski on github.
  • I am cklosowski (https://keybase.io/cklosowski) on keybase.
  • I have a public key ASAOloI2X1e3X9gnhxhRaQKn83WoFGGXbn8FFIrHFJFoqAo

To claim this, I am signing this object:

<?php
/**
* This is a rollbot for earn.gg written in PHP
*
* It will use the parameters below to run bets. If a bet wins it resets to the $starting value.
* If a bet loses, it doubles your bet amount and continues to do so until you win, or hit the $max_bet.
*
* Once you win, it kicks back down to the $starting bet.
*
@cklosowski
cklosowski / edd-rial-to-toman.php
Created July 27, 2017 21:34
EDD 2.8 - Rial > Toman purchase link fix
<?php
if ( ! function_exists( 'edd_toman_currency_symbol' ) ) {
function edd_toman_currency_symbol( $symbol, $currency ) {
if ( ! is_admin() && 'rial' === strtolower( $currency ) ) {
return 'تومان';
}
return 'ریال';
}
}
add_filter( 'edd_currency_symbol', 'edd_toman_currency_symbol', 10, 3 );
@cklosowski
cklosowski / azwp-tempe-07.13.2017.md
Created July 14, 2017 03:42
Arizona WordPress Meetup (Tempe) - July 13, 2017
@cklosowski
cklosowski / edd-variable-price-advanced-options-example.php
Last active June 29, 2017 19:59
Integrating with the Easy Digital Downloads variable price advanced options in version 2.8
<?php
/**
* Custom section for EDD price options
*/
function eddwp_custom_price_option_section( $post_id, $key, $args ) {
$recurring = EDD_Recurring()->is_price_recurring( $post_id, $key );
?>
<div class="edd-custom-price-option-section">
<span class="edd-custom-price-option-section-title">My Sample Extension</span>
<?php
function eddwp_trigger_after_payment_actions_example( $payment_id = 0, $payment = false, $customer = false ) {
/**
* The $payment variable contains the EDD_Payment object that has been completed.
* The $customer variable contains the EDD_Customer object that the payment belongs to.
*/
}
add_action( 'edd_after_payment_actions', 'eddwp_trigger_after_payment_actions_example', 10, 3 );