当前位置: 首页>>代码示例>>PHP>>正文


PHP Globals类代码示例

本文整理汇总了PHP中Globals的典型用法代码示例。如果您正苦于以下问题:PHP Globals类的具体用法?PHP Globals怎么用?PHP Globals使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Globals类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initConfig

 private static function initConfig()
 {
     if (self::$_no_of_instance == null) {
         $config = Zend_Registry::get('configuration');
         if (isset($config->cachingfarm)) {
             if (isset($config->default_cache)) {
                 self::$_default_instance = $config->default_cache;
             }
             $list = $config->cachingfarm->list;
             $arr = explode(',', $list);
             if (count($arr) > 0) {
                 self::$_no_of_instance = count($arr);
                 for ($i = 0; $i < self::$_no_of_instance; $i++) {
                     $cache = $arr[$i];
                     if (isset($config->cachingfarm->{$cache})) {
                         $con = $config->cachingfarm->{$cache};
                         $_enable = $con->enable;
                         $_server = $con->host;
                         $_port = $con->port;
                         $debug = Globals::isDebug();
                         if (empty($debug)) {
                             $debug = false;
                         }
                         if ($_enable) {
                             //echo "i'm here with $cache - $_enable - $_server - $_port <br>";
                             $memcache = new Zing_Cache_ZingCache($_server, $_port, $debug);
                             self::$_cache_array[$cache] = $memcache;
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:utcuong3010,项目名称:vng,代码行数:34,代码来源:ZingGlobalCache.php

示例2: getGoodDistanceNew

function getGoodDistanceNew(SmrSector &$sector, $goodID, $transaction)
{
    global $var, $container;
    // check if we already did this
    if (isset($var['good_distance'])) {
        // transfer this value
        transfer('good_distance');
        // return this value
        return $var['good_distance'];
    }
    $x = Globals::getGood($goodID);
    switch ($transaction) {
        case 'Buy':
            $x['TransactionType'] = 'Sell';
            break;
        case 'Sell':
            $x['TransactionType'] = 'Buy';
    }
    $di = Plotter::findDistanceToX($x, $sector, true);
    if (is_object($di)) {
        $di = $di->getRelativeDistance();
    }
    $container['good_distance'] = $di;
    return $di;
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:25,代码来源:testDistancePlotters.php

示例3: checkRepMySQL

function checkRepMySQL()
{
    if (!Globals::$rep_mysql or !mysql_ping(Globals::$rep_mysql)) {
        Globals::$rep_mysql = mysql_pconnect(Config::$rep_mysqlhost . ':' . Config::$rep_mysqlport, Config::$rep_mysqluser, Config::$rep_mysqlpass);
        mysql_select_db(Config::$rep_mysqldb, Globals::$rep_mysql);
    }
}
开发者ID:Riamse,项目名称:cluebotng,代码行数:7,代码来源:mysql_functions.php

示例4: checkRepMySQL

function checkRepMySQL()
{
    if (!Globals::$mw_mysql or !mysqli_ping(Globals::$mw_mysql)) {
        Globals::$mw_mysql = mysqli_connect('p:' . Config::$mw_mysql_host, Config::$mw_mysql_user, Config::$mw_mysql_pass, Config::$mw_mysql_db, Config::$mw_mysql_port);
        mysqli_select_db(Globals::$mw_mysql, Config::$mw_mysql_db);
    }
}
开发者ID:pandalion98,项目名称:cluebotng,代码行数:7,代码来源:mysql_functions.php

示例5: doSwitch

 /**
  * Alterna entre los entornos disonibles
  *
  * @param string $next_environment Entorno a utilizar, si no se indica se 
  *                                 se utilizara el siguiente disponible
  */
 public static function doSwitch($next_environment = null)
 {
     $environment = self::info();
     if (empty($environment['available'])) {
         return false;
     }
     if ($next_environment === null) {
         $index = array_search($environment['current'], $environment['available']) + 1;
         if ($index >= count($environment['available'])) {
             $index = 0;
         }
     } else {
         $index = array_search($next_environment, $environment['available']);
         if (false === $index) {
             return false;
         }
     }
     $environment['current'] = $environment['available'][$index];
     $info = json_encode($environment, JSON_PRETTY_PRINT);
     $path = Globals::get('base_path') . '/config/environment.json';
     if (false === @file_put_contents($path, $info)) {
         return false;
     }
     return $environment['current'];
 }
开发者ID:vickoman,项目名称:framework,代码行数:31,代码来源:Environment.php

示例6: __construct

 public function __construct()
 {
     //set country
     //lookup country from subdomain
     // must be format like http://country.site.org
     $parts = explode('.', $_SERVER['HTTP_HOST']);
     self::$COUNTRY = $parts[0];
     require_once 'settings.php';
     $countryLoaded = false;
     if ($parts[1] == 'trainingdata') {
         Settings::$DB_DATABASE = Globals::$DB_TABLE_PREFIX . $parts[0];
         self::$COUNTRY = $parts[0];
         Settings::$COUNTRY_BASE_URL = 'http://' . $parts[0] . '.' . Globals::$DOMAIN;
         $countryLoaded = true;
     }
     error_reporting(E_ALL);
     // PATH_SEPARATOR =  ; for windows, : for *nix
     $iReturn = ini_set('include_path', Globals::$BASE_PATH . PATH_SEPARATOR . Globals::$BASE_PATH . 'app' . PATH_SEPARATOR . (Globals::$BASE_PATH . 'ZendFramework' . DIRECTORY_SEPARATOR . 'library') . PATH_SEPARATOR . ini_get('include_path'));
     require_once 'Zend/Loader.php';
     if ($countryLoaded) {
         //fixes mysterious configuration issue
         require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
         require_once 'Zend/Db.php';
         //set a default database adaptor
         $db = Zend_Db::factory('PDO_MYSQL', array('host' => Settings::$DB_SERVER, 'username' => Settings::$DB_USERNAME, 'password' => Settings::$DB_PWD, 'dbname' => Settings::$DB_DATABASE));
         require_once 'Zend/Db/Table/Abstract.php';
         Zend_Db_Table_Abstract::setDefaultAdapter($db);
     }
 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:29,代码来源:globals.php

示例7: channel_msg_sd_list

function channel_msg_sd_list($fp, $rdata, $account, $player)
{
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!sd list\\s$/i', $rdata, $msg)) {
        global $sds;
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        echo_r('[SD_LIST] by ' . $nick . ' in ' . $channel);
        $refresh_per_hour = 250 * Globals::getGameSpeed($player->getGameID());
        $refresh_per_sec = $refresh_per_hour / 3600;
        fputs($fp, 'PRIVMSG ' . $channel . ' :The following supply/demand list has been recorded:' . EOL);
        fputs($fp, 'PRIVMSG ' . $channel . ' :Sector   Amount' . EOL);
        foreach ($sds as $sd) {
            if ($sd[3] == $channel) {
                $seconds_since_refresh = time() - $sd[2];
                if ($seconds_since_refresh < 0) {
                    $seconds_since_refresh = 0;
                }
                $amt_to_add = floor($seconds_since_refresh * $refresh_per_sec);
                if ($sd[1] + $amt_to_add > 4000) {
                    fputs($fp, 'PRIVMSG ' . $channel . ' : ' . sprintf('%4s', $sd[0]) . '     ' . sprintf('%4s', 'full') . EOL);
                } else {
                    fputs($fp, 'PRIVMSG ' . $channel . ' : ' . sprintf('%4s', $sd[0]) . '     ' . sprintf('%4s', $sd[1] + $amt_to_add) . EOL);
                }
            }
        }
        return true;
    }
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:30,代码来源:channel_msg_sd.php

示例8: checkModeAdmin

 public static function checkModeAdmin()
 {
     if (session_id() == '') {
         @session_start("suite");
     }
     $_SERVER['HTTP_SOURCE'] = isset($_SERVER['HTTP_SOURCE']) ? $_SERVER['HTTP_SOURCE'] : "";
     if ($_SERVER['HTTP_SOURCE'] != "suite") {
         $manager = null;
         // controla o acesso ao manager, verificando a autenticação
         /*if(count(Globals::get('app/options/master/manager')) > 0 ){
              $manager = Globals::get('app/options/master/manager');
           }*/
         if (count(Globals::get('settings/manager')) > 0) {
             $manager = Globals::get('settings/manager');
         }
         //$manager = isset(Globals::get('app/options/master/manager/access/username'))?'1':null;//isset(Globals::get('app/options/master/manager'))?Globals::get('app/options/master/manager'):null;
         if ($manager != null) {
             $manager_access = count($manager->access) > 0 ? $manager->access : null;
             if ($manager_access != null && strpos(Globals::get('http/controllers/destination'), '!/manager/access') === false) {
                 if (!isset($_SESSION["suite"])) {
                     return false;
                 }
                 $sessionSuite = $_SESSION["suite"];
                 $sessionSuiteObj = json_decode($sessionSuite);
                 if (!isset($sessionSuiteObj->manager->access)) {
                     //$querys = "&querybefore=". Globals::get()->http->destination;
                     header("location: " . Globals::get('path/manager/link') . "/manager/access");
                     return false;
                 }
             }
         }
         //return false;
     }
     return true;
 }
开发者ID:wallrio,项目名称:suite,代码行数:35,代码来源:Functions.php

示例9: saveAction

 public function saveAction()
 {
     require Globals::get('current/path/action/path') . "../ModelAssistent.php";
     $modelAssistent = new ModelAssistent();
     $data = $_POST['data'];
     $dataObj = json_decode($data);
     $option = "";
     foreach ($dataObj as $key => $value) {
         foreach ($value as $key2 => $value2) {
             if ($option != "") {
                 $option .= ",";
             }
             $option .= '"' . $key2 . '" : ' . json_encode($value2) . '';
         }
     }
     $options = "{" . $option . "}";
     $filename = Globals::get('path/domain/path') . 'options.json';
     $result = file_put_contents($filename, $options);
     if ($result) {
         $status = "success";
     }
     $optionsObj = json_decode($options);
     $modelAssistent->makeStruct($optionsObj);
     echo json_encode(array('status' => $status));
     return array('continue' => false);
 }
开发者ID:wallrio,项目名称:suite,代码行数:26,代码来源:Assistant_control.php

示例10: post

 public function post()
 {
     $post = Input::all();
     $validator = Product::validate($post);
     $productId = $post['id'];
     if ($validator->fails()) {
         return Redirect::to('productos/' . $productId)->withErrors($validator)->withInput();
     } else {
         $product = self::__checkExistence($productId);
         $isNew = false;
         if (!$productId) {
             $product = new Product();
             $isNew = true;
         }
         $product->name = $post['name'];
         $product->description = $post['description'];
         $product->code = $post['code'];
         $product->minimum_stock = $post['minimum_stock'];
         $product->cost = str_replace(',', '.', $post['cost']);
         $product->save();
         if ($isNew) {
             Globals::triggerAlerts(4, array('productId' => $product->id));
         }
         if ($post['status'] == 'inactive') {
             $product->delete();
         } else {
             if ($product->trashed()) {
                 $product->restore();
             }
         }
         Session::flash('success', 'Producto guardado correctamente.');
         return Redirect::to('productos');
     }
 }
开发者ID:frankpaul142,项目名称:cloudinventory,代码行数:34,代码来源:ProductController.php

示例11: doInit

function doInit()
{
    if (Config::$pass == null) {
        Config::$pass = trim(file_get_contents(getenv("HOME") . '/.cluebotng.password.only'));
    }
    API::init();
    API::$a->login(Config::$user, Config::$pass);
    Globals::$mysql = false;
    checkMySQL();
    Globals::$tfas = 0;
    Globals::$stdin = fopen('php://stdin', 'r');
    Globals::$run = API::$q->getpage('User:' . Config::$user . '/Run');
    Globals::$wl = API::$q->getpage('Wikipedia:Huggle/Whitelist');
    Globals::$optin = API::$q->getpage('User:' . Config::$user . '/Optin');
    Globals::$aoptin = API::$q->getpage('User:' . Config::$user . '/AngryOptin');
    Globals::$stalk = array();
    Globals::$edit = array();
    $tmp = explode("\n", API::$q->getpage('User:' . Config::$owner . '/CBAutostalk.js'));
    foreach ($tmp as $tmp2) {
        if (substr($tmp2, 0, 1) != '#') {
            $tmp3 = explode('|', $tmp2, 2);
            Globals::$stalk[$tmp3[0]] = trim($tmp3[1]);
        }
    }
    $tmp = explode("\n", API::$q->getpage('User:' . Config::$owner . '/CBAutoedit.js'));
    foreach ($tmp as $tmp2) {
        if (substr($tmp2, 0, 1) != '#') {
            $tmp3 = explode('|', $tmp2, 2);
            Globals::$edit[$tmp3[0]] = trim($tmp3[1]);
        }
    }
}
开发者ID:Riamse,项目名称:cluebotng,代码行数:32,代码来源:misc_functions.php

示例12: cacheCleanAction

 function cacheCleanAction()
 {
     if ($this->getRequest()->getOption('all')) {
         Globals::getCache()->clean(Zend_Cache::CLEANING_MODE_ALL);
     } else {
         Globals::getCache()->clean(Zend_Cache::CLEANING_MODE_OLD);
     }
 }
开发者ID:baphled,项目名称:boodah,代码行数:8,代码来源:ProcessController.php

示例13: logoutAction

 public function logoutAction()
 {
     //$path = Globals::get('path/manager/link').'manager/access/out';
     //$html = file_get_contents($path);
     Session::out();
     header("location:" . Globals::get('path/manager/link'));
     return array('continue' => false, 'parameters' => array('title' => 'Suite Manager', 'subtitle' => 'Manager Tool', 'content' => ''), 'view' => array(array('html' => '$html')));
 }
开发者ID:wallrio,项目名称:suite,代码行数:8,代码来源:Logout_control.php

示例14: ICDCodeSearch

 public function ICDCodeSearch($params)
 {
     ini_set('memory_limit', '256M');
     $type = Globals::getGlobal('dx_code_type');
     $query = is_object($params) ? $params->query : $params;
     /**
      * get last icd9 code revision
      */
     $revision = $this->getLastRevisionByCodeType('ICD9');
     $records = array();
     $whereQuery = '';
     $queries = explode(' ', $query);
     $wheres = array();
     $wheresIndex = 0;
     foreach ($queries as $q) {
         $q = trim($q);
         $w0 = ':W0' . $wheresIndex;
         $wheres[$w0] = '%' . $q . '%';
         $w1 = ':W1' . $wheresIndex;
         $wheres[$w1] = $q . '%';
         $w2 = ':W2' . $wheresIndex;
         $wheres[$w2] = $q . '%';
         $w3 = ':W3' . $wheresIndex++;
         $wheres[$w3] = $q . '%';
         $whereQuery .= " AND (short_desc \tLIKE {$w0}\n                         OR long_desc \t\t    LIKE {$w1}\n                         OR dx_code\t\t\t    LIKE {$w2}\n                         OR formatted_dx_code\tLIKE {$w3}) ";
     }
     if ($type == 'ICD9' || $type == 'BOTH') {
         /**
          * ICD9
          */
         $sql = "SELECT dx_id AS id,\n\t\t\t\t\t\t  formatted_dx_code,\n\t\t\t\t\t\t  formatted_dx_code AS code,\n\t\t\t\t\t\t  dx_code,\n\t\t\t\t\t\t  dx_code \t\t\tAS xcode,\n\t\t\t\t\t\t  long_desc,\n\t\t\t\t\t\t  long_desc \t\tAS code_text,\n\t\t\t\t\t\t  short_desc,\n\t\t\t\t\t\t  'ICD9-DX'\t\t\tAS code_type\n\t\t\t\t     FROM icd9_dx_code\n\t                WHERE active = '1'\n\t                  AND revision = '{$revision}'\n\t                  {$whereQuery}\n\t             ORDER BY formatted_dx_code ASC";
         $recordSet = $this->conn->prepare($sql);
         $recordSet->execute($wheres);
         $records = array_merge($records, $recordSet->fetchAll(PDO::FETCH_ASSOC));
     } elseif ($type == 'ICD10' || $type == 'BOTH') {
         /**
          *  get last icd10 code revision
          */
         $revision = $this->getLastRevisionByCodeType('ICD10');
         /**
          * ICD10 DX
          */
         $sql = "SELECT dx_id AS id,\n\t\t\t\t\t\t  formatted_dx_code,\n\t\t\t\t\t\t  formatted_dx_code AS code,\n\t\t\t\t\t\t  dx_code,\n\t\t\t\t\t\t  dx_code \t\t\tAS xcode,\n\t\t\t\t\t\t  long_desc,\n\t\t\t\t\t\t  TRIM(long_desc) \t\tAS code_text,\n\t\t\t\t\t\t  short_desc,\n\t\t\t\t\t\t  'ICD10-CM'\t\tAS code_type\n\t\t\t\t\t FROM icd10_dx_order_code\n                    WHERE active = '1'\n                      AND revision = '{$revision}'\n                     {$whereQuery}\n                 ORDER BY formatted_dx_code ASC";
         $recordSet = $this->conn->prepare($sql);
         $recordSet->execute($wheres);
         $records = array_merge($records, $recordSet->fetchAll(PDO::FETCH_ASSOC));
     }
     if (is_object($params)) {
         $total = count($records);
         if (isset($params->start) && isset($params->limit)) {
             $records = array_slice($records, $params->start, $params->limit, true);
         }
         return array('totals' => $total, 'rows' => $records);
     } else {
         return $records;
     }
 }
开发者ID:igez,项目名称:gaiaehr,代码行数:57,代码来源:DiagnosisCodes.php

示例15: open

 public function open($db)
 {
     $this->db = (string) $db;
     $dbglobs = Globals::getDBInfo();
     $host_port = (string) $dbglobs[0] . ':' . (string) $dbglobs[2];
     // connection to testing database
     $this->connect = mysql_connect($host_port, $dbglobs[3], $dbglobs[4]) or die(mysql_error());
     $select = mysql_select_db($this->db, $this->connect) or die(mysql_error());
 }
开发者ID:newfront,项目名称:dojophp,代码行数:9,代码来源:clsDatabase.php


注:本文中的Globals类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。