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


PHP Utils::log方法代码示例

本文整理汇总了PHP中Utils::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::log方法的具体用法?PHP Utils::log怎么用?PHP Utils::log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utils的用法示例。


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

示例1: main

function main()
{
    require_once './inc/config.php';
    require_once './inc/utils.php';
    require_once UFLEX . 'autoload.php';
    $utils = new Utils();
    $utils->log($_SESSION, '$_SESSION', 'debug.html', 'w');
    $utils->log($_SESSION[userData], '$_SESSION[userData');
    // $utils->log('START', 'debug.html');
    $utils->log('$_SESSION["attempts"] = ' . $_SESSION['attempts']);
    if ($_SESSION['redirect'] == true) {
        require_once 'inc/redirect.php';
        $utils->log('**redirect control***', 'debug.html');
        $utils->execute($vars['controller'], $vars['task'], $vars);
        // (controller, task)
        exit;
    } else {
        $url = $utils->urlToArray();
        $utils->log($url, 'This should be the $url');
        if (!isset($url['controller']) || !isset($url['task'])) {
            $utils->log('Controller or task not set', 'debug.html');
            $_REQUEST['view'] = 'landing';
            $utils->execute('landings', 'display');
            // (controller, task)
            exit;
        }
        $utils->log('**Execute ' . $url['controller'] . '->' . $url['task'] . ' ***');
        $result = $utils->execute($url['controller'], $url['task']);
        $utils->log($result, 'Execute success?');
        exit;
    }
}
开发者ID:ac109158,项目名称:ngAdmin,代码行数:32,代码来源:main.php

示例2: __autoload

function __autoload($className)
{
    if (preg_match('/.*Dao$/', $className) > 0) {
        # Dao class
        if (file_exists(realpath(dirname(__FILE__)) . '/../dao/' . $className . '.php')) {
            include_once realpath(dirname(__FILE__)) . '/../dao/' . $className . '.php';
        }
    } elseif (preg_match('/.*Manager$/', $className) > 0) {
        # Managers interfaces
        if (file_exists(realpath(dirname(__FILE__)) . '/../managers/' . $className . '.php')) {
            include_once realpath(dirname(__FILE__)) . '/../managers/' . $className . '.php';
        }
    } elseif (preg_match('/.*Module$/', $className) > 0) {
        # Get the module name
        $moduleName = strtolower(preg_replace('/^(.*)Module$/', '\\1', $className));
        if (file_exists(realpath(dirname(__FILE__)) . '/../../modules/' . $moduleName . '/' . $className . '.php')) {
            include_once realpath(dirname(__FILE__)) . '/../../modules/' . $moduleName . '/' . $className . '.php';
        }
    } else {
        #  Models
        if (file_exists(realpath(dirname(__FILE__)) . '/../model/' . $className . '.php')) {
            include_once realpath(dirname(__FILE__)) . '/../model/' . $className . '.php';
        }
    }
    Utils::log(LOG_DEBUG, "Class {$className} loaded", __FILE__, __LINE__);
}
开发者ID:basvandervlies,项目名称:pakiti3,代码行数:26,代码来源:Loader.php

示例3: translate

 /**
  * @desc Translate a key
  * @param $key The key to translate
  * @param $args Arguments to pass to sprintf
  */
 public function translate($key, $args = false)
 {
     $arr = explode('.', $key);
     if (is_array($this->hash) && array_key_exists($arr[0], $this->hash) && array_key_exists($arr[1], $this->hash[$arr[0]])) {
         $skey = $this->hash[$arr[0]][$arr[1]];
         if (is_array($this->translations) && array_key_exists($skey, $this->translations) && isset($this->translations[$skey])) {
             $string = $this->translations[$skey];
         } else {
             if ($this->language != 'en') {
                 \Utils::log('Locale: Translation not found in [' . $this->language . '] for "' . $key . '" : "' . $skey . '"');
             }
             if (is_string($skey)) {
                 $string = $skey;
             } else {
                 \Utils::log('Locale: Double definition for "' . $key . '" got ' . serialize($skey));
                 $string = $skey[0];
             }
         }
         if ($args != false) {
             array_unshift($args, $string);
             $string = call_user_func_array("sprintf", $args);
         }
         return $string;
     } else {
         \Utils::log('Locale: Translation key "' . $key . '" not found');
     }
 }
开发者ID:vijo,项目名称:movim,代码行数:32,代码来源:Locale.php

示例4: loadSubSources

 protected function loadSubSources()
 {
     Utils::log(LOG_DEBUG, "Loading CVE sources", __FILE__, __LINE__);
     # List all files in the sources directory, each file represents submodule
     if (!file_exists(realpath(dirname(__FILE__)) . '/../sources/' . $this->getName() . 'SubSources/')) {
         mkdir(realpath(dirname(__FILE__)) . '/../sources/' . $this->getName() . 'SubSources/');
     }
     $dir = realpath(dirname(__FILE__)) . '/../sources/' . $this->getName() . 'SubSources/';
     if ($handle = opendir($dir)) {
         while (false !== ($file = readdir($handle))) {
             # Load only files and ommit the OvalSourceInterface
             if (is_file($dir . $file) && preg_match('/.php$/i', $file)) {
                 require_once $dir . $file;
                 # Get the filename and extension, filename represent the class name
                 $className = preg_replace('/.php$/i', '', $file);
                 eval("\$subSource = new {$className}(\$this->_pakiti);");
                 # Check if the module is already registered
                 if (($id = $this->_pakiti->getManager("DbManager")->queryToSingleValue("select id from VdsSubSource where type='" . $this->_pakiti->getManager("DbManager")->escape($subSource->getType()) . "' and name='" . $this->_pakiti->getManager("DbManager")->escape($subSource->getName()) . "'")) == null) {
                     # Module is not registered, so store the name and type into the DB
                     # Start transaction
                     $this->_pakiti->getManager("DbManager")->begin();
                     $this->_pakiti->getManager("DbManager")->query("insert into VdsSubSource set type='" . $subSource->getType() . "', name='" . $subSource->getName() . "', vdsSourceId=" . $this->getId());
                     $id = $this->_pakiti->getManager("DbManager")->getLastInsertedId();
                     # Commit transaction
                     $this->_pakiti->getManager("DbManager")->commit();
                 }
                 # Set the submodule ID
                 $subSource->setId($id);
                 # Finally add the CVE submodule
                 array_push($this->_subSources, $subSource);
             }
         }
     }
 }
开发者ID:basvandervlies,项目名称:pakiti3,代码行数:34,代码来源:Source.php

示例5: register

 public function register()
 {
     Utils::log('Lets get You Registred!');
     //Instantiate the User object
     $user = new ptejada\uFlex\User();
     //Add database credentials
     $user->config->database->host = DB_HOST;
     $user->config->database->user = DB_USER;
     $user->config->database->password = DB_PASS;
     $user->config->database->name = DB_NAME;
     //Database name
     /*
      * You can update any customizable property of the class before starting the object
      * construction process
      */
     //Start object construction
     $user->start();
     $_POST['groupID'] = 0;
     $input = new ptejada\uFlex\Collection($_POST);
     Utils::log($input, 'This is the $input data');
     $registered = $user->register(array('Username' => $input->username, 'Password' => $input->password, 'Password2' => $input->password2, 'Email' => $input->email, 'GroupID' => $input->groupID), true);
     if ($registered) {
         echo "User Registered";
     } else {
         //Display Errors
         foreach ($user->log->getErrors() as $err) {
             echo "<b>Error:</b> {$err} <br/ >";
         }
     }
 }
开发者ID:ac109158,项目名称:ngAdmin,代码行数:30,代码来源:users.php

示例6: createCveException

 /**
  * Stores Exception into DB
  * @param CveException|Exception $exception
  * @return Exception
  * @throws Exception
  */
 public function createCveException(CveException &$exception)
 {
     if ($exception == null) {
         Utils::log(LOG_DEBUG, "Exception", __FILE__, __LINE__);
         throw new Exception("Exception object is not valid");
     }
     Utils::log(LOG_DEBUG, "Creating the exception", __FILE__, __LINE__);
     $this->getPakiti()->getDao("CveException")->create($exception);
     return $exception;
 }
开发者ID:basvandervlies,项目名称:pakiti3,代码行数:16,代码来源:CveExceptionsManager.php

示例7: getCveByNameAndCveDefId

 public function getCveByNameAndCveDefId($name, $cveDefId)
 {
     Utils::log(LOG_DEBUG, "Getting CVE its name [name={$name}] and cveDefId [cveDefId={$cveDefId}]", __FILE__, __LINE__);
     $cve = $this->getPakiti()->getDao("Cve")->getCve();
     if (is_object($cve)) {
         $cve->setTag($this->getPakiti()->getManager("TagsManager")->getCveTags($cve));
         $cve->setCveExceptions($this->getPakiti()->getManager("CveExceptionsManager")->getCveExceptionsByCveName($cve->getName()));
     }
     return $cve;
 }
开发者ID:basvandervlies,项目名称:pakiti3,代码行数:10,代码来源:CveDefsManager.php

示例8: query

 public static function query($sql)
 {
     Utils::log($sql);
     //echo $sql."\n";
     $res = self::$db->query($sql);
     if ($res == FALSE) {
         Utils::log("DB ERROR");
         Viewer::addMessage("Nastala chyba pri komunikácii s databázou, prosím kontaktuj administrátora !", Viewer::ERROR);
     }
     return $res;
 }
开发者ID:kabell,项目名称:dotaznik,代码行数:11,代码来源:DB.php

示例9: __construct

 function __construct($page_cd = null)
 {
     if (Utils::isEmpty($page_cd)) {
         Utils::log(Message::MSG_PAGE_CD_NOT_FOUND);
         return false;
     }
     $db_mgr = new DbManager();
     $this->mysqli = $db_mgr->getMysqli();
     $ql = "select * from `pages` where `page_cd` = '{$page_cd}' ";
     $res = $this->mysqli->query($ql);
     $this->page = $res->fetch_assoc();
 }
开发者ID:nakanokenichi,项目名称:Hello-World,代码行数:12,代码来源:PageManager.php

示例10: retrieveDefinitions

 public function retrieveDefinitions()
 {
     Utils::log(LOG_DEBUG, "Retreiving definitions from the " . OvalRedHat::getName() . " OVAL", __FILE__, __LINE__);
     $defs = array();
     foreach ($this->getSubSourceDefs() as $subSourceDef) {
         # Loading the defined file
         $oval = new DOMDocument();
         libxml_set_streams_context(Utils::getStreamContext());
         $oval->load($subSourceDef->getUri());
         if ($oval === FALSE) {
             Utils::log(LOG_DEBUG, "Exception", __FILE__, __LINE__);
             throw new Exception("Cannot load OVAL [source URI=" . $subSourceDef->getUri() . "]");
         }
         # Get the XPath
         $this->_xpath = new DOMXPath($oval);
         $this->_xpath->registerNamespace("def", "http://oval.mitre.org/XMLSchema/oval-definitions-5");
         $xDefinitions = $this->_xpath->query("/def:oval_definitions/def:definitions/def:definition");
         # Go through all definitions
         foreach ($xDefinitions as $xDefinition) {
             $def = array();
             $def['subSourceDefId'] = $subSourceDef->getId();
             $def['definition_id'] = $xDefinition->attributes->item(0)->value;
             $el_severity = $xDefinition->getElementsByTagName('severity')->item(0);
             if (!empty($el_severity)) {
                 $def['severity'] = $el_severity->nodeValue;
             } else {
                 $def['severity'] = "n/a";
             }
             $def['title'] = rtrim($xDefinition->getElementsByTagName('title')->item(0)->nodeValue);
             $def['ref_url'] = $xDefinition->getElementsByTagName('reference')->item(0)->getAttribute('ref_url');
             // Get associated CVEs
             $cve_query = 'def:metadata/def:advisory/def:cve';
             $cves = $this->_xpath->query($cve_query, $xDefinition);
             $def['cves'] = array();
             $def['os'] = array();
             foreach ($cves as $cve) {
                 array_push($def['cves'], $cve->nodeValue);
             }
             // Processing criteria
             $root_criterias_query = 'def:criteria';
             $root_criterias = $this->_xpath->query($root_criterias_query, $xDefinition);
             foreach ($root_criterias as $root_criteria) {
                 $os = null;
                 $package = array();
                 $this->processCriterias($this->_xpath, $root_criteria, $def, $os, $package);
             }
             array_push($defs, $def);
         }
         $this->updateSubSourceLastChecked($subSourceDef);
     }
     return $defs;
 }
开发者ID:basvandervlies,项目名称:pakiti3,代码行数:52,代码来源:OvalRedHat.php

示例11: isValid

 /**
  * @see Entity_Field::isValid()
  * @return type 
  */
 public function isValid()
 {
     if (!$this->isRequired() && $this->getValue() == null) {
         return true;
     }
     foreach ($this->getValue()->getFields() as $field) {
         if (!$field->isValid()) {
             Utils::log("Field " . $field->getName() . " is invalid");
             return false;
         }
     }
     return true;
 }
开发者ID:nikelin,项目名称:Direct-API,代码行数:17,代码来源:Reference.php

示例12: isValid

 public function isValid()
 {
     if ($this->getValue() == null && !$this->isRequired()) {
         return true;
     }
     foreach ($this->_validators as $validator) {
         if (!$validator->isValid($this->getValue())) {
             Utils::log("Field " . $this->getName() . " is invalid");
             return false;
         }
     }
     return true;
 }
开发者ID:nikelin,项目名称:Direct-API,代码行数:13,代码来源:Abstract.php

示例13: curlPost

 protected function curlPost($url, $data)
 {
     $ch = curl_init();
     $postString = http_build_query($data, '&');
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_TIMEOUT, 5);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
     Utils::log($postString . "|||" . $url, "curlPost");
     $return = curl_exec($ch);
     curl_close($ch);
     $result = json_decode($return, true);
     return $result ? $result : false;
 }
开发者ID:ManiacMike,项目名称:go_websocket_channel,代码行数:16,代码来源:GoChannel.php

示例14: invoke

 private function invoke(Route $route)
 {
     $className = 'AlfredSlack\\Controllers\\' . ucfirst($route->getController()) . 'Controller';
     $actionName = $route->getAction() . 'Action';
     $controller = new $className();
     if (!$controller instanceof \AlfredSlack\Controllers\Controller) {
         throw new \Exception("{$className} must inherits from AlfredSlack\\Controllers\\Controller");
     }
     Utils::log('ACTION: ' . $className . '::' . $actionName . '()');
     Utils::log('SIMULATE: php -r \'$query="' . str_replace('"', '\\"', json_encode($route)) . '";include "scripts/index.php";\';');
     $interruptAction = $controller->preDispatch($actionName, $route->getParams()) === false;
     if (!$interruptAction) {
         $actionResult = $controller->dispatch($actionName, $route->getParams());
         $controller->postDispatch($actionName, $route->getParams(), $actionResult);
     }
 }
开发者ID:jessefurmanek,项目名称:dotfiles,代码行数:16,代码来源:Bootstrap.php

示例15: __construct

 function __construct($location, $errorInfo = '[no info]')
 {
     //format info
     $errDesc = '';
     if ($errorInfo instanceof PDOException) {
         $errDesc = $errorInfo->getMessage();
     } elseif ($errorInfo instanceof PDOStatement) {
         $errArr = $errorInfo->errorInfo();
         $errDesc = $errArr[2];
     } else {
         $errDesc = $errorInfo;
     }
     $errDesc = str_replace(array("\r", "\n"), array('', ' '), $errDesc);
     $errDesc = $location . ' ' . $errDesc;
     //log it
     Utils::log($errDesc, 'dberror', true);
 }
开发者ID:ManiacMike,项目名称:dixit,代码行数:17,代码来源:LogDbError.php


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