[21:35:16] 1. Controllers call out to a repository to answer questions (like give me comments for a post, or are there any active users)
[21:35:27] so the repositories contain those business rules
[21:35:37] the entities (orm models) contain the application agnostic business rules
[21:35:42] like what makes a valid person
[21:36:09] 2. The repository interacts with the ORM to get the entities
[21:36:42] 3. The controller is merely responsible for processing the request, calling out to the appropriate repositories, and constructing the response
[21:36:52] All of the interactions are injected of course
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Import a remote database into a local database | |
# ---------------------------------------------- | |
# | |
# Based on http://danherd.net/quick-script-synchronise-from-a-remote-expressionengine-database/ | |
# | |
# Don’t forget chmod +x to make the script executable. | |
# | |
# Change the extension to .command to run the script directly from OS X Finder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- so it turns out that the object tag can act like an iframe | |
but the cool thing is you can nest object tags inside eachother for a fallback path. | |
what this means is you can "objectframe" a site.. and if it fails.. (site down, offline, whatever).. it'll use the next one. | |
so you can objectframe the live site and fallback to a screenshot. | |
or something. | |
demo at : http://jsfiddle.net/paul/CY2FQ/1/ | |
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2010 Google Inc. All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are | |
* met: | |
* | |
* * Redistributions of source code must retain the above copyright | |
* notice, this list of conditions and the following disclaimer. | |
* * Redistributions in binary form must reproduce the above |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This will execute the exp:tag if first segment is empty | |
{if segment_1 != ''} | |
{exp:class:method} | |
{if var == "foo"} | |
Lorem | |
{if:else} | |
Ipsum | |
{/if} | |
{/exp:class:method} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function safecracker_submit_entry_start() | |
{ | |
$my_custom_rules = array( | |
'my_field_1' => 'max_length[5]', | |
'my_field_2' => 'required|max_length[10]', | |
); | |
foreach ($my_custom_rules as $field_name => $field_rules) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Modifying the final CP Output | |
* | |
* This extension demonstrates how you can access and modify the final ExpressionEngine | |
* CP output. It is not a hack, but it is a new technique that to my knowledge has not | |
* been used before in an EE addon. | |
* | |
* This has not been road tested and its side effects are unknown, so use this at your own risk. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this used to work: | |
function login_temporary_user() | |
{ | |
if( $this->EE->session->userdata['member_id'] == 0) | |
{ | |
$this->EE->session->create_new_session(1, TRUE); | |
$this->EE->session->userdata['group_id'] = 1; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Appears in your bootstrap file, before the call to $app->run() | |
$app['upload'] = $app->extend('upload', function ($handler, $app) { | |
if ($app['request']->get('contenttype') == 'pages') { | |
if ($app['request']->get('contenttypeslug') && $app['request']->get('id')) { | |
$handler->setPrefix("/".$app['request']->get('contenttypeslug')."/".$app['request']->get('id')); | |
} | |
} | |
return $handler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Backwards-compatibility with pre-2.6 Localize class | |
$format_date_fn = (version_compare(APP_VER, '2.6', '>=')) ? 'format_date' : 'decode_date'; | |
echo $this->EE->localize->{$format_date_fn}('%Y-%m-%d', $this->EE->localize->now); | |
// 2013-04-18 |
OlderNewer