Skip to content

Instantly share code, notes, and snippets.

View tribulant's full-sized avatar

Tribulant tribulant

View GitHub Profile
@tribulant
tribulant / gist:548d7d53cb0995a27a6a
Created May 7, 2015 20:04
WordPress Shopping Cart: Redirect/Hosted Payment Gateway step 6
// WordPress Shopping Cart: Redirect/Hosted Payment Gateway step 6
// http://tribulant.com/docs/wordpress-shopping-cart-plugin/7190
<?php
function process_order($order = null, $user = null, $params = null) {
global $wpcoDb, $Order, $Item;
$wpcoDb -> model = $Item -> model;
$items = $wpcoDb -> find_all(array('order_id' => $order -> id));
@tribulant
tribulant / gist:659bebaa8a078dc4fe79
Created May 7, 2015 20:03
WordPress Shopping Cart: Redirect/Hosted Payment Gateway step 5
// WordPress Shopping Cart: Redirect/Hosted Payment Gateway step 5
// http://tribulant.com/docs/wordpress-shopping-cart-plugin/7190
<!-- Gateway Settings -->
<table class="form-table">
<tbody>
<tr>
<th><label for="gateway_title"><?php _e('Title', $this -> plugin_name); ?></label></th>
<td>
<input type="text" name="gateway_title" value="<?php echo wpco_get_option('gateway_title'); ?>" id="gateway_title" class="widefat" />
@tribulant
tribulant / gist:8396dd4ac8b6cb27e772
Created May 7, 2015 20:03
WordPress Shopping Cart: Redirect/Hosted Payment Gateway step 4
// WordPress Shopping Cart: Redirect/Hosted Payment Gateway step 4
// http://tribulant.com/docs/wordpress-shopping-cart-plugin/7190
function gateway_pmethods_metaboxes($page = null, $position = null, $post = null) {
add_meta_box('gateway', __('Gateway', 'checkout-gateway'), 'gateway_metabox_settings', $page, $position, 'core');
return true;
}
function gateway_metabox_settings() {
include dirname(__FILE__) . '/settings.php';
@tribulant
tribulant / gist:ffb76641721662b8cce2
Created May 7, 2015 20:03
WordPress Shopping Cart: Redirect/Hosted Payment Gateway step 3
// WordPress Shopping Cart: Redirect/Hosted Payment Gateway step 3
// http://tribulant.com/docs/wordpress-shopping-cart-plugin/7190
function gateway_pmethods_list($active = null, $cssclass = null) {
?>
<tr class="<?php echo $cssclass = (empty($cssclass)) ? 'alternate' : ''; ?>">
<td><label><input <?php echo (!empty($active) && is_array($active) && in_array('gateway', $active)) ? 'checked="checked"' : ''; ?> type="checkbox" name="paymentmethods[]" value="gateway" /> <?php _e('Gateway', 'checkout-gateway'); ?></label></td>
</tr>
@tribulant
tribulant / gist:9c6e9ef53619c2317ea3
Created May 7, 2015 20:01
WordPress Shopping Cart: Redirect/Hosted Payment Gateway step 2
// WordPress Shopping Cart: Redirect/Hosted Payment Gateway step 2
// http://tribulant.com/docs/wordpress-shopping-cart-plugin/7190
function gateway_extensions_list($extensions = null) {
$extensions['gateway'] = array(
'name' => __('Gateway', 'checkout-gateway'),
'link' => "http://domain.com/gateway/",
'image' => plugins_url() . '/gateway/icon.jpg',
'description' => __("Gateway which sends customers through to a secure payment page.", 'checkout-gateway'),
'slug' => 'gateway',
@tribulant
tribulant / gist:eb07dd559a141701a00b
Created May 7, 2015 20:00
WordPress Shopping Cart: Redirect/Hosted Payment Gateway step 1
// WordPress Shopping Cart: Redirect/Hosted Payment Gateway step 1
// http://tribulant.com/docs/wordpress-shopping-cart-plugin/7190
function gateway_activation_hook() {
require_once ABSPATH . 'wp-admin' . DS . 'admin-functions.php';
$path = 'wp-checkout' . DS . 'wp-checkout.php';
if (!is_plugin_active(plugin_basename($path))) {
_e('You must have the Shopping Cart plugin installed and activated in order to use this.', "checkout-gateway");
exit(); die();
@tribulant
tribulant / api.php
Last active January 15, 2018 21:24
WordPress Newsletter plugin: Initiate JSON API
<?php
$url = 'http://domain.com/wp-admin/admin-ajax.php?action=newsletters_api';
$data = array(
'api_method' => 'subscriber_add',
'api_key' => '37C1D6053E817212348E507D29CCCE49',
'api_data' => array(
'email' => "email@domain.com",
'list_id' => array(1,2,3),
)
@tribulant
tribulant / colorbox.css
Last active December 13, 2015 20:19
Colorbox FontAwesome
/*
ColorBox Core Style:
The following CSS is consistent between example themes and should not be altered.
*/
#colorbox, #cboxOverlay, #cboxWrapper{position: absolute;
top: 0;
left: 0;
z-index: 9999;
overflow: hidden;
border-bottom: 21px white solid; }
@stevelacey
stevelacey / counties.php
Created April 18, 2012 08:45
UK Counties Array
<?php
// Source: http://www.carronmedia.com/uk-postal-counties-list
array(
'England' => array(
'Avon',
'Bedfordshire',
'Berkshire',
'Buckinghamshire',