Exemplo n.º 1
0
 public function __construct()
 {
     if (self::$_instance) {
         throw new Exception('This class is a singleton, use "instance()"-method instead');
     }
     $logpath = Configuration::get('log_dir') . '/application.log';
     $this->log = new Logger('WPBase');
     $this->log->pushHandler(new StreamHandler($logpath, Logger::DEBUG));
 }
#!/usr/bin/env php
<?php 
/*
 * Small script that generates wp-base.php mostly because we do not want to update multiple files.
 *
 * Script runns after composer-update
 */
require __DIR__ . '/../vendor/autoload.php';
use DigitalUnited\WPBase\Configuration;
Configuration::load_configuration('cli');
$mustache = new \Mustache_Engine(array('loader' => new \Mustache_Loader_FilesystemLoader(Configuration::get('templates_dir'))));
$json = json_decode(file_get_contents(__DIR__ . '/../composer.json'));
$data = $mustache->loadTemplate('wp_bootstrap')->render(array('plugin_name' => 'WP Base', 'plugin_uri' => $json->homepage, 'description' => $json->description, 'author' => 'Digital United', 'version' => $json->version, 'author_uri' => 'http://digitalunited.io'));
file_put_contents(__DIR__ . '/../wp-base.php', $data);
echo "bin/generate_wp_boostrap.php: wp-base.php updated";