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 | |
// in ZF2 project, place this in ./bin directory | |
chdir(dirname(__DIR__)); | |
$zf2Path = (getenv('ZF2_PATH') ?: 'vendor/ZendFramework/library'); | |
require_once $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; | |
require_once $zf2Path . '/Zend/Loader/StandardAutoloader.php'; | |
use Zend\Loader\AutoloaderFactory; | |
use Zend\Loader\StandardAutoloader; |
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 | |
namespace { | |
require_once 'ZendFramework/library/Zend/Loader/StandardAutoloader.php'; | |
$autoloader = new \Zend\Loader\StandardAutoloader; | |
spl_autoload_register(array($autoloader, 'autoload')); | |
$di = new Zend\Di\Di; | |
$di->configure( | |
new Zend\Di\Configuration( | |
array( |
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 | |
/** | |
* IGN Application Module | |
* | |
* @category Application | |
* @package Application_View | |
* @copyright Copyright (c) 2006-2011 IGN Entertainment, Inc. (http://corp.ign.com/) | |
*/ | |
namespace Application\View\Helper; |
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 | |
namespace Ign\View\Strategy; | |
use Zend\EventManager\EventCollection, | |
Zend\EventManager\ListenerAggregate, | |
Zend\Feed\Writer\Feed, | |
Zend\Mvc\MvcEvent, | |
Zend\View\Renderer\FeedRenderer, | |
Zend\View\Renderer\JsonRenderer, | |
Zend\View\Renderer\PhpRenderer, |
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 | |
return | |
array( | |
'modules' => array( | |
'Application', | |
), | |
'module_listener_options' => array( | |
'config_cache_enabled' => true, | |
'cache_dir' => 'data/cache', | |
'config_cache_key' => 'app-cache-key', |
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 | |
function parseCacheControl($header) | |
{ | |
$cacheControl = array(); | |
preg_match_all('#([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))?#', $header, $matches, PREG_SET_ORDER); | |
foreach ($matches as $match) { | |
$cacheControl[strtolower($match[1])] = isset($match[2]) && $match[2] ? $match[2] : (isset($match[3]) ? $match[3] : true); | |
} | |
return $cacheControl; |
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 | |
function parse($string) | |
{ | |
$string = trim($string); | |
$directives = array(); | |
// handle empty string early so we don't need a separate start state | |
if ($string == '') { | |
return $directives; |
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 | |
function parseValue($value) | |
{ | |
$directives = array(); | |
$lastPosition = 0; | |
$array = str_split($value); | |
while (false !== ($token = tokenizer($value, $array, ', ', $lastPosition))) { | |
$directive = explode('=', trim($token)); | |
if (false === $directive) { | |
throw new Exception('Invalid header line for Cache-Control string: "' . $value . '"'); |
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 | |
namespace Application { | |
abstract class Page { | |
public $blocks; | |
public function addBlock(Block $block){ | |
$this->blocks[] = $block; | |
} | |
} | |
class FancyPage extends Page{ |
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 | |
return array( | |
'di' => array( | |
'definition' => array( | |
'class' => array( | |
'Zend\Cache\StorageFactory' => array( | |
'methods' => array( | |
'factory' => array( | |
'cfg' => array( | |
'required' => true, |