Skip to content

Instantly share code, notes, and snippets.

View frankmullenger's full-sized avatar

Frank Mullenger frankmullenger

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:gx="http://www.google.com/kml/ext/2.2"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>LandUse</name>
<visibility>1</visibility>
<Schema name="LandUse" id="kml_schema_ft_LandUse">
@frankmullenger
frankmullenger / _config.php
Last active December 22, 2016 01:47
Logging to file and Chrome console
<?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 November 26, 2015 22:39
Simple GPG encryption test
<?php
class EmailPage extends Page {
}
class EmailPage_Controller extends Page_Controller {
private static $allowed_actions = array(
'Form'
);
@frankmullenger
frankmullenger / EditableFileAttachmentField.php
Last active October 1, 2015 22:15
UserForms file attachments
<?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 April 30, 2013 03:54
Simple task to reset database using YAML file for SilverStripe, copies images over to assets/Uploads dir also.
<?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';
<?php
class GridFieldDetailForm_ItemRequest extends RequestHandler {
//...
public function doDelete($data, $form) {
try {
$toDelete = $this->record;
@frankmullenger
frankmullenger / GridFieldConfig.php
Created September 13, 2012 03:08
GridField Detail form with relation ID populated
<?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'));
@frankmullenger
frankmullenger / gist:3102396
Created July 13, 2012 02:52
Validation Result
<?php
$result = new ValidationResult();
$result->error(
'Some message',
'VariationsDisabledError'
);
return $result;
@frankmullenger
frankmullenger / _config.php
Created May 28, 2012 03:55
Payment configuration for SilverStripe
<?php
/*
* Payment
* ====================================================
*/
//Order notifications sent to
Email::setAdminEmail('test@example.com');
@frankmullenger
frankmullenger / OrderPage.php
Created May 17, 2012 06:12
Payment Module Outlines
<?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 {