Skip to content

Instantly share code, notes, and snippets.

View larscwallin's full-sized avatar

Lars Wallin larscwallin

View GitHub Profile
@larscwallin
larscwallin / aspect.modx.extjs.xsl
Created November 30, 2011 15:39
SIMPLX Reflect
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output omit-xml-declaration="yes" />
<xsl:output method="text" />
<xsl:output indent="yes" />
<xsl:output media-type="text/plain" />
<xsl:param name="directory"/>
<xsl:param name="label-composite">Composites</xsl:param>
<xsl:param name="label-aggregate">Aggregates</xsl:param>
<?php
/* JSONPath 0.8.1 - XPath for JSON
*
* Copyright (c) 2007 Stefan Goessner (goessner.net)
* Licensed under the MIT (MIT-LICENSE.txt) licence.
*/
// API function
function jsonPath($obj, $expr, $args=null) {
$jsonpath = new JsonPath();
<?php
// First we require the xml2json file of course.
require_once($modx->getOption('core_path').'components/simplx/common/xml2json.php');
// xml2json simply takes a String containing XML contents as input.
// Remember that the preprocessor always get a parameter called $dataSet
// containing the complete dataSet recieved from the dataSourceUrl or the
// dataSet Snippet parameter.
@larscwallin
larscwallin / README.txt
Created November 17, 2011 11:32
SIMPLX Widgeteer 0.8.5
SIMPLX Widgeteer 0.8.5
UPDATE 120117 10:04
Fixed a bug in the templateNSPlaceholder method thanks to Keith Baker :)
NEW FEAUTURES
If you use namespaced placeholders, you can now reference the first object in any list (array). This was not possible
before. This is going to be even easier later on as you are going to be able to query for objects using regex etc.
@larscwallin
larscwallin / a_readme.txt
Created November 9, 2011 09:49
SIMPLX MIRAGE
* WELCOME TO THE SIMPLX MIRAGE EXPERIMENT! *
PURPOSE:
The idea behind this little project is to hide the quite quirky MODx notion that a Resource (or document) does not
"own" its extended properties. In MODx these are called Template Variables and, as the name suggests, they are
bound to one or more Templates. This means that the normal concept that a Template conforms to the data in an Object
is reversed. As a result, in MODx a Resource potentially "looses" properties when a user changes its Template.
I want a solid way of using the current MODx Template Variable concept to quickly build custom content types
@larscwallin
larscwallin / simplx.jsonrpc.js
Created October 19, 2011 13:30
SIMPLX RPC - Super simple JavaScript implementation of JsonRPC.
<script src="https://github.com/douglascrockford/JSON-js/raw/master/json2.js"> </script>
<script type="text/javascript">
var simplx = new Object();
simplx.jsonrpc = (function(){
var response = null;
var self = this;
this.url="";
this.host="";
@larscwallin
larscwallin / mygit.modx.example.2.php
Created October 5, 2011 10:43
SIMPLX MyGit Version 0.1 Public Release. Wrapper for the Gist part of the http://developer.github.com/v3/gists/ API
<?php
require_once($modx->getOption('core_path').'components/simplx/mygit/simplx.mygit.php');
$action = isset($action) ? $action : '';
$username = isset($username) ? $username : '';
$password = isset($password) ? $password : '';
$object = isset($object) ? $object : '';
$objectid = isset($objectid) ? $objectid : '';
switch($action){
@larscwallin
larscwallin / IModGenericMessage
Created September 14, 2011 15:58
simplx.request static class which wrapps the HTTP Request
<?php
/*
IModGenericMessage
A VERY abstract representation of a system/client request/response message.
The class is meant to normalize all types of inter-system communication for all protocols used.
*/
interface IModGenericMessage{
@larscwallin
larscwallin / README.txt
Created September 14, 2011 14:02
simplx.controller, now with url routing
SIMPLX Controller V0.7
UPDATE 111109
NEW FEATURES:
- Added a whole bunch of modResource fields to the Request object. This means that you can route on stuff like:
pagetitle
template
@larscwallin
larscwallin / simplx.rpc.client.js
Created September 12, 2011 10:35
simplx.rpc client javascript
<script src="https://github.com/douglascrockford/JSON-js/raw/master/json2.js"> </script>
<script type="text/javascript">
var simplx = new Object();
simplx.jsonrpc = (function(){
var response = null;
var self = this;