示例#1
0
function getServiceLocator()
{
    $config = Zend\Config\Factory::fromFile(findParentPath('config') . "/module.config.php");
    $serviceManagerConfig = new \Zend\ServiceManager\Config($config['service_manager']);
    $serviceManager = new \Zend\ServiceManager\ServiceManager($serviceManagerConfig);
    $serviceManager->setService('config', $config);
    return $serviceManager;
}
示例#2
0
<?php

/**
 * Copyright (c) 2014 Keith Casey.
 *
 * This code is designed to accompany the lynda.com video course "Design Patterns in PHP"
 *   by Keith Casey. If you've received this code without seeing the videos, go watch the
 *   videos. It will make way more sense and be more useful in general.
 */
require 'vendor/autoload.php';
//Load a php file as array
$config = Zend\Config\Factory::fromFile('config.json');
//Load a xml file as Config object
$config = Zend\Config\Factory::fromFile('config.xml', true);
示例#3
0
if ($is_delivery) {
    $modules = array('Delivery', 'GenericBuysidePartner');
    $config_glob_paths = array('config/autoload/{global,local}.php', 'config/autoload/database.{local,staging,production}.php', 'config/autoload/delivery.{local,staging,production}.php', 'config/autoload/rtb.config.{local,staging,production}.php');
} elseif ($is_legal) {
    $modules = array('WebsiteCustom');
    $config_glob_paths = array('config/autoload/{global,local}.php');
} elseif ($is_maintenance) {
    $modules = array('Maintenance');
    $config_glob_paths = array('config/autoload/{global,local}.php', 'config/autoload/database.{local,staging,production}.php', 'config/autoload/email.{local,staging,production}.php');
    /*
     * Buy Side RTB partners can either be added by a unique subdomain name
     * that maps to the module handing their requests, or it can be
     * added by the seat id ( rtb_seat_id HTTP GET PARAMETER in /bid?rtb_seat_id=0004 )
     */
} elseif (isset($_GET["secret_key"]) && (isset($_GET["rtb_seat_id"]) || $subdomain !== null)) {
    $config = Zend\Config\Factory::fromFile('config/autoload/rtb.config.local.php');
    $secret_key = $_GET["secret_key"];
    $seat_bid_id = isset($_GET["rtb_seat_id"]) ? $_GET["rtb_seat_id"] : $subdomain;
    foreach ($config['buyside_rtb']['supply_partners'] as $partner_key => $partner_entry) {
        if ($seat_bid_id == $partner_entry['buyer_id'] && $secret_key == $partner_entry['secret_key']) {
            $response_seat_id = $partner_entry['response_seat_id'];
            /*
             * Grab the buy side module corresponding to the 
             * rtb_seat_bid GET param out of the rtb.config.php settings
             * 
             * http://server.nginad.com/bid?rtb_seat_id=0001
             * maps to: GenericBuysidePartner
             */
            $modules = array($partner_entry['module_name']);
        }
    }