Skip to content

Instantly share code, notes, and snippets.

@ajshort
ajshort / ManifestFileFinder.php
Created February 17, 2011 04:42
ManifestFileFinder.php
<?php
/**
*
*
* @package sapphire
* @subpackage manifest
*/
class ManifestFileFinder {
const CONFIG_FILE = '_config.php';
@ajshort
ajshort / jquery-ondemand-context.diff
Created January 31, 2011 23:29
Fixes callback handlers not being passed the correct context.
Index: javascript/core/jquery.ondemand.js
===================================================================
--- javascript/core/jquery.ondemand.js (revision 115901)
+++ javascript/core/jquery.ondemand.js (working copy)
@@ -150,12 +150,15 @@
// This replaces the usual ajax success & complete handlers. They are called after any on demand JS is loaded.
var _ondemandComplete = function(xml, status) {
- var status = $.httpSuccess(xml) ? 'success' : 'error';
+ var status = $.httpSuccess(xml) ? 'success' : 'error';
Index: core/control/Director.php
===================================================================
--- core/control/Director.php (revision 115357)
+++ core/control/Director.php (working copy)
@@ -112,12 +112,11 @@
array_merge((array)$_POST, (array)$_FILES),
@file_get_contents('php://input')
);
-
- // @todo find better way to extract HTTP headers
@ajshort
ajshort / export-layers.py
Created November 26, 2010 03:51
GIMP Python script to export each layer as a separate image.
#!/usr/bin/env python
#
# A GIMP plugin to save each layer in an image as a separate file
from gimpfu import *
import os
def export_layers(img, drw, path, name):
img = img.duplicate()
Index: CMSMain.php
===================================================================
--- CMSMain.php (revision 106168)
+++ CMSMain.php (working copy)
@@ -48,6 +48,7 @@
'restore',
'revert',
'rollback',
+ 'RootForm',
'sidereport',
<?php
/**
* Rewrites plain internal HTML links into shortcode form, using existing link tracking information.
*
* @package sapphire
* @subpackage tasks
*/
class MigrateSiteTreeLinkingTask extends BuildTask {
protected $title = 'Migrate SiteTree Linking Task';
<?php
/**
*
*
* @package sapphire
* @subpackage tasks
*/
class MigrateSiteTreeLinkingTask extends BuildTask {
protected $title = 'Migrate SiteTree Linking Task';
@@ -41,10 +41,20 @@ class ContentController extends Controller {
$this->dataRecord = $dataRecord;
$this->failover = $this->dataRecord;
parent::__construct();
}
+ /**
+ * Return the link to this controller, but force the expanded link to be returned so that form methods and
+ * similar will function properly.
+ *
@@ -30,61 +30,80 @@ class HtmlEditorField extends TextareaField {
/**
* @return string
*/
function Field() {
+ // mark up broken links
+ $value = new SS_HTMLValue($this->value);
+ $parser = ShortcodeParser::get_active();
+