Пример #1
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'));
Пример #2
0
<?php

/**
 * Created by PhpStorm.
 * User: mirel
 * Date: 18.09.2014
 * Time: 16:35
 */
namespace mpf\test;

define('LIBS_FOLDER', dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR);
define('APP_ROOT', __DIR__ . DIRECTORY_SEPARATOR);
require_once LIBS_FOLDER . 'mpf' . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . 'AutoLoader.php';
use mpf\base\AutoLoader;
use mpf\web\request\HTML;
AutoLoader::get()->register();
class HtmlRequest extends \PHPUnit_Framework_TestCase
{
    /**
     * @return \mpf\web\request\HTML
     */
    public function getHTMLRequest($config = array())
    {
        return HTML::get($config);
    }
    public function testParseURL()
    {
        $test = array();
        foreach ($test as $url => $result) {
            $this->assertEquals($result, $this->getHTMLRequest()->createURL($params['controller'], $params['action'], $params['params'], $params['module']));
        }
Пример #3
0
 /**
  * @return \mpf\interfaces\AutoLoaderInterface
  */
 public function getAutoLoader($config = array())
 {
     return \mpf\base\AutoLoader::get($config);
 }
Пример #4
0
 public function log($level, $message, array $context = array())
 {
     $details = array();
     $context['time'] = microtime(true);
     foreach ($context as $k => $v) {
         $details[] = $k . ' : ' . (is_string($v) ? nl2br($v) : print_r($v, true));
     }
     $details = implode('<br />', $details);
     echo "<div class=\"log-message log-{$level}\"><b>{$level} : {$message}</b><span><br />{$details}</span></div>";
     $baseScriptsURL = \mpf\web\AssetsPublisher::get()->publishFolder(dirname(\mpf\base\AutoLoader::getLastRegistered()->path('\\mpf\\__assets\\scripts\\jquery')) . DIRECTORY_SEPARATOR . 'jquery');
     echo \mpf\web\helpers\Html::get()->scriptFile($baseScriptsURL . 'jquery.min.js');
     echo \mpf\web\helpers\Html::get()->script('$(document).ready(function(){' . '$(".log-message").click(function(){if ($("span", this).is(":visible")) {$("span", this).hide();} else {$("span", this).show();} })' . '})');
 }