예제 #1
0
// INIT AND CONFIG LOAD
// Check TAL is available
if (!file_exists('antie/php/antieframework.php')) {
    echo "<h2>Framework error</h2>";
    echo "<h4>antieframework.php can not be found.</h4>";
    echo "<h4>Please install TAL to a folder 'antie' in your application's root</h4>";
    exit;
}
require 'antie/php/antieframework.php';
// Enable javascript cache busting (this should be disabled in production mode)
$javascript_cache_busting = true;
// Set up application ID and path to framework configuration directory
$application_id = "calculatrice";
$antie_config_path = 'antie/config';
// Create an AntieFramework instance
$antie = new AntieFramework($antie_config_path);
// Get brand and model from url parameters, or use
// brand = default, model = webkit
$device_brand = isset($_GET['brand']) ? $_GET['brand'] : 'default';
$device_model = isset($_GET['model']) ? $_GET['model'] : 'webkit';
// Normalises to lower case with spaces replaced by underscores
$device_brand = $antie->normaliseKeyNames($device_brand);
$device_model = $antie->normaliseKeyNames($device_model);
// Framework device config files in format BRAND-MODEL-default.json
// Construct filename from this and config path
$device_configuration_name = $device_brand . "-" . $device_model;
$device_configuration_file_path = $antie_config_path . "/devices/" . $device_configuration_name . "-default.json";
// Load in device configuration
try {
    $device_configuration = @file_get_contents($device_configuration_file_path);
    if (!$device_configuration) {
예제 #2
0
 function testAppConfigOverridesDeviceConfigWhenMerged()
 {
     $this->setUpNormalConfig();
     $deviceConfigJSON = $this->getGenericDevice1Config();
     $appConfigJSON = json_decode($this->framework->getConfigurationFromFilesystem('generic-tv1', 'applicationconfig'));
     $mergedConfig = AntieFramework::mergeConfigurations($deviceConfigJSON, $appConfigJSON);
     $this->assertEquals('overridetest', $mergedConfig->deviceelements->deviceelement1);
 }