Skip to content

Instantly share code, notes, and snippets.

View emodric's full-sized avatar
🤘
Adventure, excitement... A Jedi craves not these things!

Edi Modrić emodric

🤘
Adventure, excitement... A Jedi craves not these things!
View GitHub Profile
@emodric
emodric / eztags.tpl
Created January 6, 2012 15:58
eZ Tags hack to support automatic placement of tags in content edit interface
{ezcss_require( array( 'tagssuggest.css', 'jqmodal.css', 'contentstructure-tree.css' ) )}
{ezscript_require( array( 'ezjsc::jquery', 'ezjsc::jqueryio', 'jqModal.js', 'jquery.tagsSuggest.js', 'tagsSuggest-init.js' ) )}
{def $has_add_access = false()}
{def $root_tag = fetch( tags, tag, hash( tag_id, $attribute.contentclass_attribute.data_int1 ) )}
{if $root_tag}{def $root_tag_id = $root_tag.id}{else}{def $root_tag_id = 0}{/if}
{def $user_limitations = user_limitations( 'tags', 'add' )}
{if $user_limitations['accessWord']|ne( 'no' )}
{if is_unset( $user_limitations['simplifiedLimitations']['Tag'] )}
@emodric
emodric / gist:1603175
Created January 12, 2012 21:16
xrowmetadata / fetchMetaData function with corrected empty keyword bug
function fetchMetaData( $attribute )
{
try
{
$xml = new SimpleXMLElement( $attribute->attribute( 'data_text' ) );
$keywords = htmlspecialchars_decode( (string) $xml->keywords, ENT_QUOTES );
$keywords = !empty( $keywords ) ? explode( ",", $keywords ) : array();
$meta = new xrowMetaData( htmlspecialchars_decode( (string)$xml->title, ENT_QUOTES ),
@emodric
emodric / gist:3436314
Created August 23, 2012 12:46
ezp-next REST section tests
www-data@void ~/ezp-next/eZ/Publish/API/Repository/Tests [master] $ phpunit -c phpunit-rest-json.xml -v --group section
PHPUnit 3.6.11 by Sebastian Bergmann.
Configuration read from /var/www/ezp-next/eZ/Publish/API/Repository/Tests/phpunit-rest-json.xml
...............ESE..SSSSS
Time: 11 seconds, Memory: 21.00Mb
There were 2 errors:
@emodric
emodric / 01_load_section.php
Created September 6, 2012 16:17
eZ Publish Summer Camp 2012 / REST API v2 examples
<?php
require_once '../bootstrap.php';
$repository = require '../eZ/Publish/Core/REST/common.php';
$section = $repository->getSectionService()->loadSectionByIdentifier( 'standard' );
var_dump( $section );
@emodric
emodric / How to install Bsoad by Qafoo to test out the REST.txt
Created September 7, 2012 10:48
eZ Summer Camp 2012 / How to install & configure bsoad for VMs
How to install Bsoad by Qafoo to test out the REST API v2
The process to download bsoad and all dependencies is listed below.
1) cd /var/www/
2) git clone git://github.com/Qafoo/bsoad.git
3) cd bsoad
4) curl -s https://getcomposer.org/installer | php
5) php composer.phar install
6) cd src/library/qafoo/bdog
@emodric
emodric / gist:3706271
Created September 12, 2012 12:22
create location
echo '<?xml version="1.0" encoding="UTF-8"?>
<LocationCreate media-type="application/vnd.ez.api.LocationCreate+xml">
<ParentLocation href="/content/locations/1/5" media-type="application/vnd.ez.api.Location+xml"/>
<priority>0</priority>
<hidden>false</hidden>
<sortField>PATH</sortField>
<sortOrder>ASC</sortOrder>
</LocationCreate>' | \
http -v POST localhost:8042/content/objects/58/locations \
'X-Test-User:14' \
@emodric
emodric / gist:3737780
Created September 17, 2012 14:39
load locations for content
www-data@void ~/rest/locations [master] $ ./loadLocationsForObject.sh
GET /content/objects/58/locations HTTP/1.1
Accept: application/vnd.ez.api.LocationList+xml
Accept-Encoding: identity, deflate, compress, gzip
Host: localhost:8042
User-Agent: HTTPie/0.2.8-alpha
X-Test-User: 14
@emodric
emodric / gist:3750640
Created September 19, 2012 16:33
service.ini legacy setup diff
diff --git a/eZ/Publish/Core/settings/service.ini b/eZ/Publish/Core/settings/service.ini
index 8aad823..3074271 100644
--- a/eZ/Publish/Core/settings/service.ini
+++ b/eZ/Publish/Core/settings/service.ini
@@ -14,7 +14,7 @@
#
[parameters]
#legacy_dsn=<driver>://<username>:<password>@<host>:<port>/<database>
-legacy_dsn=sqlite://:memory:
+legacy_dsn=mysql://root@localhost:3306/ezpublish4
@emodric
emodric / TemporaryRedirect.php
Created September 21, 2012 13:46
Test of creating Gist from PhpStorm
<?php
/**
* File containing the TemporaryRedirect ValueObjectVisitor class
*
* @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
* @version //autogentag//
*/
namespace eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor;
@emodric
emodric / gist:3763117
Created September 21, 2012 18:32
REST content
eddie@abyss ~/restScripts/xml/objects [master] $ ./loadContent.sh
GET /content/objects/58 HTTP/1.1
Accept: application/vnd.ez.api.Content+xml
Accept-Encoding: identity, deflate, compress, gzip
Host: localhost:8042
User-Agent: HTTPie/0.2.8-alpha
X-Test-User: 14