Skip to content

Instantly share code, notes, and snippets.

View nyeholt's full-sized avatar

Marcus nyeholt

  • Symbiote
  • Melbourne
View GitHub Profile
<?php
/**
* @author Marcus Nyeholt <marcus@silverstripe.com.au>
*/
class FacebookService {
static $api_urls = array(
'object' => 'https://graph.facebook.com/%s',
'auth' => 'https://graph.facebook.com/oauth/access_token?client_id=%s&client_secret=%s&grant_type=client_credentials',
<?php
public function fakeplastictrees() {
$fields = array(
'ID', 'Title', 'MenuTitle', 'URLSegment', 'ParentID', 'CanViewType'
);
$query = new SQLQuery($fields, 'SiteTree');
$query = $query->setOrderBy('ParentID', 'ASC');
$query->addWhere('"CanViewType" NOT IN (\'LoggedInUsers\', \'OnlyTheseUsers\')');
<?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) {
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();
@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(
@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 / 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) {
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 / site-data-service.php
Last active December 9, 2015 02:56
Fake Plastic Trees
<?php
/**
* Capture / cache some commonly used data elements for each page
*
* @author marcus
*/
class SiteDataService {
protected $items = array();