Skip to content

Instantly share code, notes, and snippets.

View andrerom's full-sized avatar

André R. andrerom

View GitHub Profile
@andrerom
andrerom / gist:6792186
Created October 2, 2013 11:13
Backport of Zeta patch: "Fixed Header Mime encoding failing using multi-byte characters" in issue EZP-21567 for eZ Publish 5.0 and lower Gist based on: https://github.com/zetacomponents/Mail/pull/8 Note: 5.0 needs to run composer update and apply this patch for mixed + pure legacy setup.
diff --git a/ezpublish_legacy/lib/ezc/Mail/src/interfaces/part.php b/ezpublish_legacy/lib/ezc/Mail/src/interfaces/part.php
index 6adcabf..8bdceb6 100644
--- a/src/interfaces/part.php
+++ b/src/interfaces/part.php
@@ -387,18 +387,9 @@ public function generateHeaders()
// break intentionally missing
default:
- $preferences = array(
- 'input-charset' => $charset,
@andrerom
andrerom / dump.php
Created August 14, 2013 15:40
For dumping a database to a "fixture" php file, as used by integration tests in eZ Publish 5.x
#!/usr/bin/env php
<?php
require 'ezc/Base/base.php';
spl_autoload_register( 'ezcBase::autoload' );
$db = ezcDbFactory::create( 'mysql://user:password@server/databse_name' );
// Get all tables
$tables = array();
@andrerom
andrerom / new_way.php
Last active December 12, 2015 09:49 — forked from dpobel/new_way.php
Updated query to reflect added ContentTypeIdentifier by @crevillo in 0cb178324a63767664dc0aed0f2ddd1ace7d1e1d in January 2013
<?php
use \eZ\Publish\API\Repository\Values\Content\Query;
$locationService = $this->getRepository()->getLocationService();
$searchService = $this->getRepository()->getSearchService();
$urlAliasService = $this->getRepository()->getUrlAliasService();
$root = $locationService->loadLocation( 2 );
$query = new Query();
$query->criterion = new Criterion\LogicalAND(
@andrerom
andrerom / papi_bootstrap.php
Created September 5, 2012 09:46 — forked from pspanja/papi_bootstrap.php
Public API boostrap
<?php
/**
* Get ServiceContainer (exposes the API)
* @var \eZ\Publish\API\Container $serviceContainer
*/
$serviceContainer = require "bootstrap.php";
$repository = $serviceContainer->getRepository();
$administratorUser = $repository->getUserService()->loadUser( 14 );
@andrerom
andrerom / responsive_images.htm
Created May 15, 2012 23:22
Responsive image html support proposal
<p>The proposed (but human unreadable) WHATWG syntax:<p>
<pre>
<img src="face-600-200@1.jpg" alt=""
set="face-600-200@1.jpg 600w 200h 1x,
face-600-200@2.jpg 600w 200h 2x,
face-icon.png 200w 200h">
</pre>
<p>The propposed RICG syntax (that WHATWG rejects):</p>
@andrerom
andrerom / Deprecate eZMySQLDB for setup wizard
Created March 11, 2011 10:48
Makes ure it's not default one and make it clear that it's deprecated.
diff --git a/kernel/setup/ezsetupcommon.php b/kernel/setup/ezsetupcommon.php
index 9ef9cb7..bd137c8 100644
--- a/kernel/setup/ezsetupcommon.php
+++ b/kernel/setup/ezsetupcommon.php
@@ -51,9 +51,15 @@ function eZSetupOptionalTests()
function eZSetupDatabaseMap()
{
- return array( 'mysql' => array( 'type' => 'mysql',
+ return array( 'mysqli' => array( 'type' => 'mysqli',
@andrerom
andrerom / Singleton.php
Created November 27, 2010 13:25
Note: Singleton's are not a good pattern for unit testing, you should as much as possible look into passing object around in your application flow instead of relying on Singleton's. But there are cases where it might make a lot of sense nevertheless, for
<?php
/**
* File contains misc ways to archive Singleton pattern depending on PHP version
*
* Note that the Singleton pattern is hard to test: {@link http://www.phparch.com/2010/03/03/static-methods-vs-singletons-choose-neither/}
*/
/**
* Singleton in any PHP 5.x version using code duplication
*/