Skip to content

Instantly share code, notes, and snippets.

View muskie9's full-sized avatar

Nic muskie9

View GitHub Profile
@muskie9
muskie9 / post-merge
Last active August 29, 2015 14:16 — forked from wernerkrauss/post-merge
#!/bin/bash
echo "running git post receive hook..."
DIR=$(git rev-parse --show-toplevel)
if [ -e "$DIR/composer.json" ]; then
if [ -d "$DIR/vendor" ]; then
composer.phar install
else
composer.phar update
fi
/**
* This function should return true if the current user can publish this
* page. It can be overloaded to customise the security model for an
* application.
*
* Denies permission if any of the following conditions is TRUE:
* - canPublish() on any decorator returns FALSE
* - canEdit() returns FALSE
*
* @uses SiteTreeDecorator->canPublish()
@muskie9
muskie9 / FoxyStripeDropdownField.php
Created April 3, 2015 02:46
This field accepts an associative array as a source and handles FoxyCart value encryption if it's needed.
<?php
/**
* Created by PhpStorm.
* User: nhorstmeier
* Date: 4/1/15
* Time: 9:40 PM
*/
class FoxyStripeDropdownField extends DropdownField{
0 =>
object(ArrayData)[1251]
protected 'array' =>
array (size=4)
'Title' => string 'Alabama' (length=7)
'Value' => string 'AL||a42dcac1d6f375a09a7e65fdc679c773d6fcd1c6b901c6fbe46aa7dcee3d7ccc' (length=68)
'Selected' => boolean false
'Disabled' => boolean false
protected 'failover' => null
protected 'customisedObject' => null
<?php
class Page_Controller extends ContentController {
private static $allowed_actions = array(
'MyForm'
);
public function MyForm() {
$fields = new FieldList(
<!DOCTYPE html>
<!--
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Simple. by Sara (saratusar.com, @saratusar) for Innovatif - an awesome Slovenia-based digital agency (innovatif.com/en)
Change it, enhance it and most importantly enjoy it!
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-->
<!--[if !IE]><!-->
<html lang="en-US">
---
Name: foxystripe-campaignmonitor
---
public function onBeforeWrite(){
if(!$this->CategoryID){
$default = ProductCategory::get()->filter(array('Code' => 'DEFAULT'))->first();
$this->CategoryID = $default->ID;
}
//update many_many lists when multi-group is on
if(SiteConfig::current_site_config()->MultiGroup){
$holders = $this->getManyManyComponents('ProductHolders');
<?php
/**
*
* @package FoxyStripe
*
*/
class ProductPage extends Page implements PermissionProvider {
private static $allowed_children = 'none';
@muskie9
muskie9 / SiteTreeError.php
Last active August 29, 2015 14:21
Base installation with TestPage that hides Page
<?php
class TestPage extends Page{
private static $singular_name = 'Test Page';
private static $plural_name = 'Test Pages';
private static $description = 'A test page';
private static $hide_ancestor = 'Page';
private static $db = array();