Пример #1
0
 public static function loadClass($path, $prefix = 'XLib')
 {
     if (is_array($path)) {
         foreach ($path as $item) {
             \XLib\XLib::loadClass($item, $prefix);
         }
     } else {
         $fpath = $path;
         if (false === strpos($path, $prefix)) {
             $fpath = $prefix . $path;
         }
         $rpath = str_replace('\\', '/', __DIR__) . \XLib\XLib::PATH_SEP . $fpath . '.php';
         if (file_exists($rpath)) {
             require_once $rpath;
             return true;
         } else {
             return false;
         }
     }
     return null;
 }
Пример #2
0
<?php

require_once 'SimpleCache.php';
require_once 'XLib.php';
use XLib\XLib;
\XLib\XLib::loadClass(array('Config', 'Object', 'States', 'Brightpearl', 'Cache', 'Context', 'BrightpearlUtils', 'BrightpearlAuth', 'BrightpearlClient', 'BrightpearlRequest'));
require_once __DIR__ . '../../../vendor/autoload.php';
define('XL_DEBUG_OUTPUT_HTML', false);
function _doh()
{
    return defined('XL_DEBUG_OUTPUT_HTML') && XL_DEBUG_OUTPUT_HTML === true;
}
function vd()
{
    $args = func_get_args();
    $hrep = _doh();
    foreach ($args as $arg) {
        if ($hrep) {
            echo '<pre>';
        }
        var_dump($arg);
        if ($hrep) {
            echo '</pre>';
        }
    }
}
function ve()
{
    $args = func_get_args();
    $hrep = _doh();
    foreach ($args as $arg) {
Пример #3
0
<?php

namespace XLib;

require_once 'XLib.php';
use XLib\XLib as XMain;
XMain::loadClass('Object', 'XLib');
class Config extends \XLib\Object
{
    private static $list = array();
    public function __construct()
    {
    }
    public static function exists($name)
    {
        return isset(Config::$list[$name]);
    }
    public static function set($name, $value)
    {
        Config::$list[$name] = $value;
        return true;
    }
    public static function get($name)
    {
        if (Config::exists($name)) {
            return Config::$list[$name];
        }
        return null;
    }
}