Skip to content

Instantly share code, notes, and snippets.

View nyeholt's full-sized avatar

Marcus nyeholt

  • Symbiote
  • Melbourne
View GitHub Profile
diff --git a/filesystem/File.php b/filesystem/File.php
index 026a7bf..0082dfe 100644
--- a/filesystem/File.php
+++ b/filesystem/File.php
@@ -646,7 +646,7 @@ class File extends DataObject {
* @return string
*/
public function getAbsoluteURL() {
- return Director::absoluteBaseURL() . $this->getFilename();
+ return Director::absoluteURL($this->getURL());
<?php
/**
* Redirects write queries to a specific database configuration
*
* @author <marcus@silverstripe.com.au>
* @license BSD License http://www.silverstripe.org/bsd-license
*/
class MySQLWriteDbAspect implements BeforeCallAspect {
/**
Injector:
S3Service:
constructor:
- kidding
- right?
S3ContentReader:
type: prototype
properties:
s3service: %$S3Service
bucket: kfc
diff --git a/framework/forms/Form.php b/framework/forms/Form.php
index c93d1e4..d8acb64 100644
--- a/framework/forms/Form.php
+++ b/framework/forms/Form.php
@@ -363,6 +363,14 @@ class Form extends RequestHandler {
return $this->$funcName($vars, $this, $request);
} elseif($field = $this->checkFieldsForAction($this->Fields(), $funcName)) {
return $field->$funcName($vars, $this, $request);
+ } else {
+ $action = $this->Actions()->dataFieldByName('action_' . $funcName);
@nyeholt
nyeholt / ORM.php
Created November 2, 2012 04:24 — forked from stojg/ORM.php
ORM scratch board
<?php
/*
Ideas on ORM interface and interactions / relationships
*/
class Dataobject {
function __construct(Data $mapper, array $data = null) {
$this->mapper = $mapper;
if($data) {
@nyeholt
nyeholt / MyPage.php
Created October 18, 2012 04:23
Simple example of data objects in grids
<?php
/**
* Description of MyPage
*
* @author marcus@silverstripe.com.au
* @license BSD License http://silverstripe.org/bsd-license/
*/
class MyPage extends Page {
public static $has_many = array(
@nyeholt
nyeholt / SimpleGalleryPage.ss
Created August 31, 2012 00:56
SS SimpleGalleryPage template
<% require javascript(js/galleriffic-2.0/js/jquery.history.js) %>
<% require javascript(js/galleriffic-2.0/js/jquery.galleriffic.js) %>
<% require javascript(js/galleriffic-2.0/js/jquery.opacityrollover.js) %>
<% require css(js/galleriffic-2.0/css/galleriffic-3.css) %>
<% if Images %>
<div id="GalleryContent">
<div id="ContentLeft">
@nyeholt
nyeholt / SimpleGalleryPage.php
Created August 31, 2012 00:55
SS SimpleGalleryPage
<?php
/**
*
* @author Marcus Nyeholt <marcus@silverstripe.com.au>
* @license BSD http://silverstripe.org/BSD-license
*/
class SimpleGalleryPage extends Page {
public static $has_one = array(
diff --git a/core/Config.php b/core/Config.php
index e1db5f4..6bc413b 100644
--- a/core/Config.php
+++ b/core/Config.php
@@ -118,7 +118,7 @@ class Config {
* @return Config
*/
static public function inst() {
- if (!self::$instance) self::$instance = singleton('Config');
+ if (!self::$instance) self::$instance = new Config();
<?php
/**
* @author marcus@silverstripe.com.au
* @license BSD License http://silverstripe.org/bsd-license/
*/
class FilesystemPublishingJob extends AbstractQueuedJob {
public function __construct($object = null) {
if ($object) {