Example #1
0
 /**
  *
  * @param string $options
  */
 public function __construct($options = array())
 {
     foreach (\mpf\base\Config::get()->forClass(get_called_class()) as $k => $n) {
         $this->{$k} = $n;
     }
     foreach ($options as $k => $n) {
         if ('noInstance' == $k) {
             continue;
         }
         $this->{$k} = $n;
     }
     if (!isset($options['noInstance'])) {
         self::$_instances[md5(serialize($options))] = $this;
     }
     $this->init($options);
     $this->driver_options[\PDO::ATTR_ERRMODE] = isset($this->driver_options[\PDO::ATTR_ERRMODE]) ? $this->driver_options[\PDO::ATTR_ERRMODE] : \PDO::ERRMODE_EXCEPTION;
     return parent::__construct($this->dns, $this->username, $this->password, $this->driver_options);
 }
Example #2
0
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * MPF Framework is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MPF Framework.  If not, see <http://www.gnu.org/licenses/>.
 */
define('LIBS_FOLDER', dirname(__DIR__) . DIRECTORY_SEPARATOR);
define('APP_ROOT', __DIR__ . DIRECTORY_SEPARATOR);
/**
 * Set ErrorException for every error;
 */
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
    $severity = 1 * E_ERROR | 1 * E_WARNING | 1 * E_PARSE | 1 * E_NOTICE | 0 * E_CORE_ERROR | 0 * E_CORE_WARNING | 0 * E_COMPILE_ERROR | 0 * E_COMPILE_WARNING | 1 * E_USER_ERROR | 1 * E_USER_WARNING | 1 * E_USER_NOTICE | 0 * E_STRICT | 0 * E_RECOVERABLE_ERROR | 0 * E_DEPRECATED | 0 * E_USER_DEPRECATED;
    $ex = new ErrorException($errstr, 0, $errno, $errfile, $errline);
    if (($ex->getSeverity() & $severity) != 0) {
        throw $ex;
    }
});
require_once LIBS_FOLDER . 'mpf' . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . 'AutoLoader.php';
mpf\base\AutoLoader::get()->register();
use mpf\WebApp as App;
use mpf\base\Config;
new Config(__DIR__ . DIRECTORY_SEPARATOR . 'config/web.inc.php');
\mpf\base\AutoLoader::get()->applyConfig(Config::get()->forClass('\\mpf\\base\\AutoLoader'));
App::run(array('requestClass' => '\\mpf\\web\\request\\SOAP'));
Example #3
0
 /**
  * Updates Config class with values from Module config.
  * @param string [string] $config
  * @return $this
  */
 protected function applyModuleConfig($config)
 {
     if (isset($config['mpf\\web\\request\\HTML'])) {
         foreach ($config['mpf\\web\\request\\HTML'] as $k => $v) {
             $this->{$k} = $v;
         }
     }
     if (isset($config['mpf\\WebApp'])) {
         foreach ($config['mpf\\WebApp'] as $k => $v) {
             WebApp::get()->{$k} = $v;
         }
     }
     foreach ($config as $class => $options) {
         if (in_array($class, ['namespace', 'path'])) {
             // this are keywords for module itself not other classes
             continue;
         }
         Config::get()->set($class, $options);
     }
     return $this;
 }