Skip to content

Instantly share code, notes, and snippets.

<?php
foreach ( $pees as $tinkle ) {
if ( preg_match( '!</?blockquote([^>]*)>!', $tinkle) >= 1 ) {
// pee inside blockquotes (prevents splashing)
$yellowblock = preg_replace('|<blockquote([^>]*)>|i', "<blockquote$1><p>", $tinkle);
$yellowblock = str_replace('</blockquote>', '</p></blockquote>', $yellowblock);
$pee .= $yellowblock . "\n";
} elseif ( preg_match( '!</?' . $allblocks . '[^>]*>!', $tinkle ) >= 1 ) {
$pee .= trim($tinkle, "\n") . "\n"; // ignore wrapping block elements in the stream
$.fn.extend({
disableSubmit: function () {
return $(this).data('label',$(this).val()).attr('disabled',true).addClass('disabled').val($co.submitting);
},
enableSubmit: function (){
return $(this).attr('disabled', false).removeClass('disabled').val($(this).data('label'));
}
});
// Validate paycard number before submit
@jonathandavis
jonathandavis / Patch-2652.diff
Created December 17, 2013 19:16
Patch file fix for issue report #2652
diff --git a/core/flow/Pages.php b/core/flow/Pages.php
index e4539eb..57a12dd 100755
--- a/core/flow/Pages.php
+++ b/core/flow/Pages.php
@@ -197,7 +197,7 @@ class ShoppPage {
$title = apply_filters('shopp_' . get_class_property($classname, 'name') . '_pagetitle', $this->title); // @deprecated Use shopp_storefront_page_title or shopp_{$name}_storefront_page_title instead
$title = apply_filters('shopp_' . get_class_property($classname, 'name') . '_storefront_page_title', $title);
- return $title = apply_filters('shopp_storefront_page_title', $title);
+ return apply_filters('shopp_storefront_page_title', $title);
<?php
//Add One handling fee for any quantity
add_filter('shopp_cart_fees','flat_rate_filter');
function flat_rate_filter ( $fee ) {
$shipping = shopp('cart.get-shipping','number=on');
$products = array();
while( shopp('cart.items') )
$products[] = shopp('cartitem.get-product');
@jonathandavis
jonathandavis / ErrorsPatch.diff
Created September 30, 2013 15:15
Fix for image server typehinting issues
diff --git a/services/image.php b/services/image.php
index 280b386..31eab04 100755
--- a/services/image.php
+++ b/services/image.php
@@ -328,6 +328,7 @@ class ImageServer {
if ( ! defined('SHOPP_ADDONS') )
define('SHOPP_ADDONS', WP_CONTENT_DIR . '/shopp-addons');
+ $Errors = ShoppErrors();
$Shopp->Storage = new StorageEngines();
@jonathandavis
jonathandavis / shipmethod.js
Last active December 23, 2015 10:49
Shipping method selector behaviors
/*!
* shipmethods.js - Shopp catalog behaviors library
* Copyright © 2008-2013 by Ingenesis Limited
* Licensed under the GPLv3 {@see license.txt}
*/
$('#shopp form').on('change', '.shipmethod', function () {
var prefix = '.shopp-cart.cart-',
spans = 'span'+prefix,
inputs = 'input'+prefix,
fields = ['shipping','tax','total'],
@jonathandavis
jonathandavis / SearchFitler.php
Created September 9, 2013 19:27
Pre-filters search words to collapse dashes everywhere: 2444-22-1 becomes 2444221 and radio-controlled becomes radiocontrolled
<?php
add_filter('shopp_search_query', 'collapse_dashed_words', 5);
add_filter('shopp_boolean_search', 'collapse_dashed_words', 5);
add_filter('shopp_shortword_search', 'collapse_dashed_words', 5);
add_filter('shopp_index_content', 'collapse_dashed_words', 5);
function collapse_dashed_words ( $string ) {
return str_replace('-', '', $string);
}
@jonathandavis
jonathandavis / ShoppImagingAddonDemo.php
Created August 27, 2013 12:35
A demo of a Shopp imaging module
<?php
/**
* Imaging Addon Demo
*
* @author Jonathan Davis
* @copyright Ingenesis Limited, 2013
* @package shopp
* @since 1.3
* @version 1.0
**/
@jonathandavis
jonathandavis / category.php
Created August 20, 2013 14:22
Example product image only category layout
<?php if ( shopp( 'collection.hasproducts', 'load=coverimages' ) ) : ?>
<?php while( shopp( 'collection.products' ) ) : ?>
<?php shopp( 'product.coverimage', 'setting=thumbnails&itemprop=image' ); ?>
<?php endwhile; ?>
<?php endif; ?>
@jonathandavis
jonathandavis / product-descriptions.php
Created August 15, 2013 17:51
Include product descriptions in a Shopp collection
<?php
shopp('storefront.catalog-products','load=true');
shopp('collection.has-products','load=description');
shopp('collection.products');
shopp('product.name'); echo BR.BR;
shopp('product.description');