Skip to content

Instantly share code, notes, and snippets.

View DracoBlue's full-sized avatar

DracoBlue

View GitHub Profile
@DracoBlue
DracoBlue / agavi_override_request_method.patch
Created September 24, 2012 20:19
Override the request method in agavi, in case of a POST form.
Index: agavi/src/request/AgaviWebRequest.class.php
===================================================================
--- agavi/src/request/AgaviWebRequest.class.php (revision 4918)
+++ agavi/src/request/AgaviWebRequest.class.php (working copy)
@@ -353,7 +353,16 @@
// map REQUEST_METHOD value to a method name, or fall back to the default in $sourceDefaults.
// if someone set a static value as default for a source that does not have a mapping, then he's really asking for it, and thus out of luck
$this->setMethod($this->getParameter(sprintf('method_names[%s]', $REQUEST_METHOD), $this->getParameter(sprintf('method_names[%s]', $sourceDefaults['REQUEST_METHOD']))));
-
+
// IN
var values = {
"share_url": "http://dracoblue.net",
"share_title": "dracoblue's page",
"share_summary": "It's an awesome blog!",
"share_image_url": "http://dracoblue.net/avatar/120x120.jpg"
};
@DracoBlue
DracoBlue / agavi_json_payload.patch
Created September 17, 2012 15:58
Agavi patch to allow json payload in AgaviWebRequest + allow PATCH-method
Index: agavi/request/AgaviWebRequest.class.php
===================================================================
--- agavi/request/AgaviWebRequest.class.php (revision 1086)
+++ agavi/request/AgaviWebRequest.class.php (working copy)
@@ -343,6 +343,7 @@
$methods = array_merge(array(
'GET' => 'read',
'POST' => 'write',
+ 'PATCH' => 'patch',
'PUT' => 'create',
<?xml version="1.0" encoding="UTF-8"?>
<ae:configurations xmlns="http://agavi.org/agavi/config/parts/autoload/1.0"
xmlns:ae="http://agavi.org/agavi/config/global/envelope/1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
<ae:configuration>
<autoloads>
<autoload name="DrSlump\Protobuf\AnnotatedMessage">%core.app_dir%/../libs/DrSlump/Protobuf/AnnotatedMessage.php</autoload>
<autoload name="DrSlump\Protobuf\Codec\Binary\Reader">%core.app_dir%/../libs/DrSlump/Protobuf/Codec/Binary/Reader.php</autoload>
<autoload name="DrSlump\Protobuf\Codec\Binary\Unknown">%core.app_dir%/../libs/DrSlump/Protobuf/Codec/Binary/Unknown.php</autoload>
@DracoBlue
DracoBlue / agavi_errors_in_validator_definitions.patch
Created July 26, 2012 08:36
Enables usage of errors in validator definitions in agavi validation
Index: config/AgaviValidatorConfigHandler.class.php
===================================================================
--- config/AgaviValidatorConfigHandler.class.php (revision 731)
+++ config/AgaviValidatorConfigHandler.class.php (working copy)
@@ -70,10 +70,11 @@
foreach($cfg->get('validator_definitions') as $def) {
$name = $def->getAttribute('name');
if(!isset($this->classMap[$name])) {
- $this->classMap[$name] = array('class' => $def->getAttribute('class'), 'parameters' => array());
+ $this->classMap[$name] = array('class' => $def->getAttribute('class'), 'parameters' => array(), 'errors' => array());
@DracoBlue
DracoBlue / .gitignore
Created June 11, 2012 11:36 — forked from evelynmitchell/.gitignore
comfortable shell script for running TWS
*~
*.o
Index: libs/agavi/filter/AgaviFormPopulationFilter.class.php
===================================================================
--- libs/agavi/filter/AgaviFormPopulationFilter.class.php (revision 351)
+++ libs/agavi/filter/AgaviFormPopulationFilter.class.php (revision 355)
@@ -580,7 +580,22 @@
// now output the remaining incidents
// might include errors for cookies, headers and whatnot, but that is okay
- if($this->insertErrorMessages($form, $errorMessageRules, $allIncidents)) {
+ if($this->insertErrorMessages($form, $errorMessageRules, $allIncidents) && count($allIncidents)) {
Index: libs/agavi/validator/AgaviStringValidator.class.php
===================================================================
--- libs/agavi/validator/AgaviStringValidator.class.php (revision 329)
+++ libs/agavi/validator/AgaviStringValidator.class.php (working copy)
@@ -85,10 +85,12 @@
return false;
}
+ /* To fix the: 'non SGML character number 11' issue. */
+ $originalValue = preg_replace('/[\x1-\x8\xB-\xC\xE-\x1F]/', '', $originalValue);
@DracoBlue
DracoBlue / AgaviProxyRenderer.class.php
Created May 4, 2012 11:46
A proxy renderer for agavi, which allows fallback to another renderer, if the first one fails.
<?php
/**
* The AgaviProxyRenderer will try to load multiple renderers by name and
* return the first successful attempt to render the given layer.
*
* This allows you to mix e.g. .twig and .php templates in the same directory,
* but still use the proper renderer for each file.
*
* @example <pre>
Index: libs/ApplicationBase/agavi/renderer/ApplicationPhpRenderer.class.php
===================================================================
--- libs/ApplicationBase/agavi/renderer/ApplicationPhpRenderer.class.php (revision 305)
+++ libs/ApplicationBase/agavi/renderer/ApplicationPhpRenderer.class.php (working copy)
@@ -94,6 +94,31 @@
public function render(AgaviTemplateLayer $layer, array &$attributes = array(), array &$slots = array(),
array &$more_assigns = array())
{
+ /*
+ * Dragons