Skip to content

Instantly share code, notes, and snippets.

@brendo
brendo / ajax-upload.js
Created January 13, 2012 00:54
Uploading a File with AJAX with Symphony
$(document).ready(function() {
// FormData is magic.
var formData = new FormData();
// Listen for drag/drop events.
$('#drop-here')
.on('dragover', function(event) {
event.preventDefault();
})
.on('drop', function(event) {
diff --git a/fields/field.advancedupload.php b/fields/field.advancedupload.php
index b13f6e3..6cc206c 100755
--- a/fields/field.advancedupload.php
+++ b/fields/field.advancedupload.php
@@ -143,8 +143,7 @@
'pages',
'utilities'
);
- $directories = General::listDirStructure(WORKSPACE, true, 'asc', DOCROOT, $ignore);
-
@brendo
brendo / script_texthtml.md
Created February 18, 2012 04:11
Using <script type='text/html'>

Using <script type='text/html'>

While looking for a more manageable way to maintain my Mustache templates, I came across the icanhaz, which promotes putting your templates in your DOM using:

<script type='text/html' id='your-template>
    // Template in here
</script>

Being a bit of a performance nut, I was nervous about putting my templates into the DOM like this for a couple of reasons:

@brendo
brendo / Issue746.md
Created March 10, 2012 12:40
Goodbye old friend, hello new friends!

Goodbye old friend, hello new friends!

The Symphony 2.3 release opens up a whole new range of possibilities for developers to create awesome sites and applications. We've cleaned up a lot of the codebase and we are always looking at ways to make it leaner and more efficient. Because of this reason, we've decided that the Symphony 2.3 line will be the final releases that we test against PHP5.2.

We feel that with the recent release of PHP 5.4, now is a good time to end our relationship and look forward to the new possibilities that developing with a PHP 5.3+ codebase brings.

@brendo
brendo / markup.md
Created March 10, 2012 16:27
Symphony 2.3 Markup Transition

Markup and You

Symphony 2.3 features a significantly improved UI over it's predecessors due to the hard work of the UX Working Group and contributions by other dedicated members of the Symphony community. In making these changes, there's been a number of minor updates to the HTML, CSS and JS throughout the backend. The purpose of this guide is to help document some of these new features, and outline differences that extension developers can implement while updating their extension for 2.3. Eventually a dedicated style guide for Symphony will be available, but this will fill the void for the meantime.

HTML

@brendo
brendo / class.rewrite.php
Created March 10, 2012 18:42
PHP 5.4 Router
<?php
/**
* @package toolkit
*/
/**
* URL rewriter for use in conjunction with the PHP 5.4 internal HTTP server and `rounter.php`.
*/
namespace Rewrite;
@brendo
brendo / event.google_calendar_import.php
Created March 29, 2012 14:05
Google Calendar Event
<?php
require_once EXTENSIONS . '/xmlimporter/extension.driver.php';
require_once EXTENSIONS . '/google_calendar_api/lib/class.json_to_xml.php';
require_once TOOLKIT . '/class.gateway.php';
Class eventgoogle_calendar_import extends Event {
const ROOTELEMENT = 'google-calendar-import';
const GOOGLE_ENDPOINT = 'https://www.googleapis.com/calendar/v3/calendars/%s/events?fields=%s&key=%s';
@brendo
brendo / prepareImportValue.md
Created April 11, 2012 14:03
Introducing the XML Importer's prepareImportValue function

Introducing the XML Importer's prepareImportValue function

The XML Importer extension is widely used to help users import XML content into their Symphony sections. Developers enter a URL that returns XML and then write XPath to map values to their corresponding fields, but sometimes this results in a field not receiving a value, an incorrect value, or the XML Importer failing to import anything.

While not always the case, sometimes the XPath could be wrong, namespaces weren't added or you've discovered a bug (log it, but it can also be because a Field doesn't know how take the value you've given it and save it. This short article will explain how you can ensure that your field is compatible with the XML Importer, thanks to the prepareImportValue function.

Why is it needed?

Fields in Symphony have two existing function's, checkPostFieldData and [processRawFieldData]

@brendo
brendo / backend.html
Created April 13, 2012 15:14
Symphony Backend markup
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<!-- Core styles -->
<link rel="stylesheet" type="text/css" media="screen" href="http://example.com/symphony/assets/css/symphony.css">
<link rel="stylesheet" type="text/css" media="screen" href="http://example.com/symphony/assets/css/symphony.legacy.css">
<link rel="stylesheet" type="text/css" media="screen" href="http://example.com/symphony/assets/css/symphony.grids.css">
@brendo
brendo / S231.md
Created May 29, 2012 13:17
Symphony 2.3.1 Release Notes

Symphony 2.3.1 Release Notes

Final

Bugs

  • #1517 - Remove the LIMIT clause on the Cache driver
  • #1480 - The querystring is now wrapped in CDATA tags
  • Update doc comments
  • Improve robustness in regular expression in ResourceManager