Skip to content

Instantly share code, notes, and snippets.

Frank Mullenger frankmullenger

Block or report user

Report or block frankmullenger

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@frankmullenger
frankmullenger / _config.php
Last active Dec 22, 2016
Logging to file and Chrome console
View _config.php
<?php
// Logging to file (create notices.log with necessary permissions for apache to write to)
$handler = new Monolog\Handler\StreamHandler('/var/www/html/assets/notices.log');
$handler->setFormatter(new Monolog\Formatter\LineFormatter(null, null, true, true));
Injector::inst()->get('Logger')->pushHandler($handler);
// Logging to Chrome console (composer require --dev ccampbell/chromephp 4.1.0)
$handler = new Monolog\Handler\ChromePHPHandler();
$handler->setFormatter(new Monolog\Formatter\ChromePHPFormatter());
@frankmullenger
frankmullenger / EmailPage.php
Created Nov 26, 2015
Simple GPG encryption test
View EmailPage.php
<?php
class EmailPage extends Page {
}
class EmailPage_Controller extends Page_Controller {
private static $allowed_actions = array(
'Form'
);
View EditableFileAttachmentField.php
<?php
/**
* Files that are uploaded only to be attached to emails and are not saved into assets.
*/
class EditableFileAttachmentField extends EditableFormField {
private static $singular_name = 'File Attachment Field';
private static $plural_names = 'File Attachment Fields';
@frankmullenger
frankmullenger / ResetDatabaseTask.php
Created Apr 30, 2013
Simple task to reset database using YAML file for SilverStripe, copies images over to assets/Uploads dir also.
View ResetDatabaseTask.php
<?php
class ResetDatabaseTask extends BuildTask {
protected $title = "Reset database";
protected $description = "Reset the database to a blank canvas";
static $fixture_file = 'builder/tasks/Reset.yml';
View GridFieldDetailForm_ItemRequest.php
<?php
class GridFieldDetailForm_ItemRequest extends RequestHandler {
//...
public function doDelete($data, $form) {
try {
$toDelete = $this->record;
@frankmullenger
frankmullenger / GridFieldConfig.php
Created Sep 13, 2012
GridField Detail form with relation ID populated
View GridFieldConfig.php
<?php
class GridFieldConfig_HasManyRelationEditor extends GridFieldConfig {
/**
*
* @param int $itemsPerPage - How many items per page should show up
*/
public function __construct($itemsPerPage=null) {
$this->addComponent(new GridFieldButtonRow('before'));
$this->addComponent(new GridFieldAddNewButton('buttons-before-left'));
View gist:3102396
<?php
$result = new ValidationResult();
$result->error(
'Some message',
'VariationsDisabledError'
);
return $result;
@frankmullenger
frankmullenger / _config.php
Created May 28, 2012
Payment configuration for SilverStripe
View _config.php
<?php
/*
* Payment
* ====================================================
*/
//Order notifications sent to
Email::setAdminEmail('test@example.com');
@frankmullenger
frankmullenger / OrderPage.php
Created May 17, 2012
Payment Module Outlines
View OrderPage.php
<?php
class OrderPage extends Page {
}
/**
* Represents a page with a form which a user fills out to process payment
*/
class OrderPage_Controller extends Page_Controller {
@frankmullenger
frankmullenger / _config.php
Created Mar 6, 2012
Example _config.php settings for SwipeStripe
View _config.php
<?php
/**
* SwipeStripe settings
* ====================================================
*/
//License key
ShopSettings::set_license_key('');
You can’t perform that action at this time.