Skip to content

Instantly share code, notes, and snippets.

View jimboobrien's full-sized avatar

Jimobrien jimboobrien

View GitHub Profile
@jimboobrien
jimboobrien / stripe-payment-button.php
Created July 24, 2017 23:44 — forked from lewayotte/stripe-payment-button.php
Stripe Payments - WordCamp ATL 2015
<?php
// Custom forms: https://stripe.com/docs/tutorials/forms
function stripe_payment_button() {
$payment_image = false;
$publishable_key = 'key';
$transaction_return_page = get_permalink( 1 ); //Whatever page ID you're using for your transaction return page
$description = 'S-Mart';
@jimboobrien
jimboobrien / paypal-payment-url.php
Created July 24, 2017 23:44 — forked from lewayotte/paypal-payment-url.php
PayPal Payments - WordCamp ATL 2015
<?php
if ( !defined( 'PAYPAL_PAYMENT_LIVE_URL' ) )
define( 'PAYPAL_PAYMENT_LIVE_URL', 'https://www.paypal.com/cgi-bin/webscr' );
if ( !defined( 'PAYPAL_PAYMENT_SANDBOX_URL' ) )
define( 'PAYPAL_PAYMENT_SANDBOX_URL', 'https://www.sandbox.paypal.com/cgi-bin/webscr' );
/* Insecure */
function insecure_paypal_payment_url() {
$paypal_email = '[email protected]';
@jimboobrien
jimboobrien / charge.php
Last active July 21, 2023 18:34
Stripe PHP Elements Example V3
<?php
$email = $_POST['email'];
$phone = $_POST['phone'];
$first_name = $_POST['fname'];
$last_name = $_POST['lname'];
try {
require_once('Stripe/init.php');
// Use Stripe's library to make requests...
@jimboobrien
jimboobrien / post-content-appender.php
Created September 20, 2017 22:41 — forked from wpscholar/post-content-appender.php
Sample class to demonstrate how classes can be used in WordPress.
<?php
/**
* Class PostContentAppender
*/
class PostContentAppender {
protected $append = '';
public function __construct( $append ) {
@jimboobrien
jimboobrien / array-insert-before.php
Created September 20, 2017 22:41 — forked from wpscholar/array-insert-before.php
Insert a value or key/value pair before a specific key in an array. If key doesn't exist, value is prepended to the beginning of the array.
<?php
/**
* Insert a value or key/value pair before a specific key in an array. If key doesn't exist, value is prepended
* to the beginning of the array.
*
* @param array $array
* @param string $key
* @param array $new
*
@jimboobrien
jimboobrien / array-insert-after.php
Created September 20, 2017 22:41 — forked from wpscholar/array-insert-after.php
Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended to the end of the array.
<?php
/**
* Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended
* to the end of the array.
*
* @param array $array
* @param string $key
* @param array $new
*
<?php
/**
* Drop this code into your main plugin file to hide plugin deactivation from the WordPress admin.
*/
add_filter( 'plugin_action_links', function ( $actions, $plugin_file ) {
if ( plugin_basename( __FILE__ ) === $plugin_file ) {
unset( $actions['deactivate'] );
}
<?php
/**
* Ensure that a specific theme is never updated. This works by removing the
* theme from the list of available updates.
*/
add_filter( 'http_request_args', function ( $response, $url ) {
if ( 0 === strpos( $url, 'https://api.wordpress.org/themes/update-check' ) ) {
$themes = json_decode( $response['body']['themes'] );
<?php
/**
* Ensure that a specific plugin is never updated. This works by removing the
* plugin from the list of available updates.
*/
add_filter( 'http_request_args', function ( $response, $url ) {
if ( 0 === strpos( $url, 'https://api.wordpress.org/plugins/update-check' ) ) {
$basename = plugin_basename( __FILE__ );