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


PHP xPDO::log方法代码示例

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


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

示例1: _getByFsockopen

 /**
  * If for some reason the server does not have allow_url_fopen or cURL
  * enabled, use this function to get the file via fsockopen.
  *
  * @access protected
  * @param string $url The source URL to retrieve
  * @return string The response from the server
  */
 protected function _getByFsockopen($url)
 {
     $purl = parse_url($url);
     $host = $purl['host'];
     $path = !empty($purl['path']) ? $purl['path'] : '/';
     if (!empty($purl['query'])) {
         $path .= '?' . $purl['query'];
     }
     $port = !empty($purl['port']) ? $purl['port'] : '80';
     $timeout = 10;
     $response = '';
     $fp = @fsockopen($host, $port, $errno, $errstr, $timeout);
     if (!$fp) {
         $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, 'Could not retrieve from ' . $url);
     } else {
         fwrite($fp, "GET {$path} HTTP/1.0\r\n" . "Host: {$host}\r\n" . "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3\r\n" . "Accept: */*\r\n" . "Accept-Language: en-us,en;q=0.5\r\n" . "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" . "Keep-Alive: 300\r\n" . "Connection: keep-alive\r\n" . "Referer: http://{$host}\r\n\r\n");
         while ($line = fread($fp, 4096)) {
             $response .= $line;
         }
         fclose($fp);
         $pos = strpos($response, "\r\n\r\n");
         $response = substr($response, $pos + 4);
     }
     return $response;
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:33,代码来源:modtransportpackage.class.php

示例2: _getPHPType

 /**
  * Gets the php data type for the specified field.
  *
  * @access protected
  * @param string $key The field name to get the data type for.
  * @return string The PHP data type of the field.
  */
 protected function _getPHPType($key) {
     $type= 'string';
     if (isset ($this->_fieldMeta[$key]['phptype'])) {
         $type= strtolower($this->_fieldMeta[$key]['phptype']);
     } elseif ($this->xpdo->getDebug() === true) {
         $this->xpdo->log(xPDO::LOG_LEVEL_DEBUG, "xPDOObject::_getPHPType() -- No PHP type specified for field ({$key}), using `string`.");
     }
     return $type;
 }
开发者ID:ncrossland,项目名称:revolution,代码行数:16,代码来源:xpdoobject.class.php

示例3: _loadLexicon

 /**
  * Load the modLexicon service
  *
  * @return boolean
  */
 protected function _loadLexicon()
 {
     if (!$this->xpdo->lexicon) {
         $this->xpdo->lexicon = $this->xpdo->getService('lexicon', 'modLexicon');
         if (empty($this->xpdo->lexicon)) {
             $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, '[Quip] Could not load MODx lexicon.');
             return false;
         }
     }
     return true;
 }
开发者ID:raadhuis,项目名称:modx-basic,代码行数:16,代码来源:quipcomment.class.php

示例4: request

 /**
  * Sends a REST request to the provider
  *
  * @param string $path The path of the request
  * @param string $method The method of the request (GET/POST)
  * @param array $params An array of parameters to send to the REST request
  * @return modRestResponse|bool The response from the REST request, or false
  */
 public function request($path, $method = 'GET', $params = array())
 {
     $response = false;
     $service = $this->getClient();
     if ($service) {
         $response = $service->request($this->get('service_url'), $path, $method, $this->args($params));
     } else {
         $this->xpdo->log(modX::LOG_LEVEL_ERROR, $this->xpdo->lexicon('provider_err_no_client'), '', __METHOD__, __FILE__, __LINE__);
     }
     return $response;
 }
开发者ID:modxcustomize,项目名称:Clickatell,代码行数:19,代码来源:modtransportprovider.class.php

示例5: loadPreserved

 /**
  * Load preserved objects from the previous install().
  *
  * @return array An array of preserved objects, or an empty array.
  */
 public function loadPreserved()
 {
     $preserved = array();
     $fileName = $this->path . $this->signature . '/preserved.php';
     if (file_exists($fileName)) {
         $content = (include $fileName);
         if (is_array($content)) {
             $preserved = $content;
         } else {
             $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, 'Error loading preserved objects from ' . $fileName);
         }
     }
     return $preserved;
 }
开发者ID:Kleist,项目名称:xPDO,代码行数:19,代码来源:xpdotransport.class.php

示例6: leaveGroup

 /**
  * Removes the User from the specified User Group.
  *
  * @access public
  * @param mixed $groupId Either the name or ID of the User Group to join.
  * @return boolean True if successful.
  */
 public function leaveGroup($groupId)
 {
     $left = false;
     $c = $this->xpdo->newQuery('modUserGroupMember');
     $c->innerJoin('modUserGroup', 'UserGroup');
     $c->where(array('member' => $this->get('id')));
     $fk = is_string($groupId) ? 'name' : 'id';
     $c->where(array('member' => $this->get('id'), 'UserGroup.' . $fk => $groupId));
     /** @var modUserGroupMember $member */
     $member = $this->xpdo->getObject('modUserGroupMember', $c);
     if (empty($member)) {
         $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, 'User could not leave group with key "' . $groupId . '" because the User was not a part of that group.');
     } else {
         $left = $member->remove();
         if (!$left) {
             $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, 'An unknown error occurred preventing removing the User from the User Group.');
         } else {
             unset($_SESSION["modx.user.{$this->get('id')}.userGroupNames"], $_SESSION["modx.user.{$this->get('id')}.userGroups"]);
         }
     }
     return $left;
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:29,代码来源:moduser.class.php

示例7: getList

 /**
  * Get a full list of all boards on the forum, for any user
  * @static
  * @param xPDO $modx
  * @param int $board
  * @param bool $category
  * @return array
  */
 public static function getList(xPDO &$modx, $board = 0, $category = false)
 {
     $response = array();
     /* get a comma-sep-list of thread IDs for comparing to read ids for user */
     $threadsCriteria = $modx->newQuery('disThread');
     $threadsCriteria->setClassAlias('Threadr');
     $threadsCriteria->select(array('GROUP_CONCAT(Threadr.id)'));
     $threadsCriteria->where(array('Threadr.board = disBoard.id'));
     $threadsCriteria->prepare();
     $threadsSql = $threadsCriteria->toSql();
     /* subboards sql */
     $sbCriteria = $modx->newQuery('disBoard');
     $sbCriteria->setClassAlias('subBoard');
     $sbCriteria->select(array('GROUP_CONCAT(CONCAT_WS(":",subBoardClosureBoard.id,subBoardClosureBoard.name) SEPARATOR "||") AS name'));
     $sbCriteria->innerJoin('disBoardClosure', 'subBoardClosure', 'subBoardClosure.ancestor = subBoard.id');
     $sbCriteria->innerJoin('disBoard', 'subBoardClosureBoard', 'subBoardClosureBoard.id = subBoardClosure.descendant');
     $sbCriteria->where(array('subBoard.id = disBoard.id', 'subBoard.status:!=' => disBoard::STATUS_INACTIVE, 'subBoardClosureBoard.status:!=' => disBoard::STATUS_INACTIVE, 'subBoardClosure.descendant != disBoard.id', 'subBoardClosure.depth' => 1));
     $sbCriteria->groupby($modx->getSelectColumns('disBoard', 'subBoard', '', array('id')));
     $sbCriteria->prepare();
     $sbSql = $sbCriteria->toSql();
     /* get main query */
     $c = $modx->newQuery('disBoard');
     $c->innerJoin('disCategory', 'Category');
     $c->innerJoin('disBoardClosure', 'Descendants');
     $c->leftJoin('disPost', 'LastPost');
     $c->leftJoin('disUser', 'LastPostAuthor', 'LastPost.author = LastPostAuthor.id');
     $c->leftJoin('disThread', 'LastPostThread', 'LastPostThread.id = LastPost.thread');
     $c->where(array('disBoard.status:!=' => disBoard::STATUS_INACTIVE));
     if (isset($board) && $board !== null) {
         $c->where(array('disBoard.parent' => $board));
     }
     if (!empty($category)) {
         $c->where(array('disBoard.category' => $category));
     }
     $ugc = $modx->newQuery('disBoardUserGroup');
     $ugc->select(array('GROUP_CONCAT(usergroup)'));
     $ugc->where(array('board = disBoard.id'));
     $ugc->groupby('board');
     $ugc->prepare();
     $userGroupsSql = $ugc->toSql();
     $response['total'] = $modx->getCount('disBoard', $c);
     $c->query['distinct'] = 'DISTINCT';
     $c->select($modx->getSelectColumns('disBoard', 'disBoard'));
     $c->select(array('Category.name AS category_name', '(' . $sbSql . ') AS ' . $modx->escape('subboards'), '(' . $threadsSql . ') AS ' . $modx->escape('threads'), '(' . $userGroupsSql . ') AS ' . $modx->escape('usergroups'), 'LastPost.id AS last_post_id', 'LastPost.thread AS last_post_thread', 'LastPost.author AS last_post_author', 'LastPost.createdon AS last_post_createdon', 'LastPostThread.replies AS last_post_replies', 'LastPostThread.title AS last_post_title', 'LastPostAuthor.username AS last_post_username', 'LastPostAuthor.use_display_name AS last_post_udn', 'LastPostAuthor.display_name AS last_post_display_name'));
     $c->sortby('Category.rank', 'ASC');
     $c->sortby('disBoard.rank', 'ASC');
     $c->prepare();
     $modx->log(modX::LOG_LEVEL_ERROR, $c->toSQL());
     $response['results'] = $modx->getCollection('disBoard', $c);
     return $response;
 }
开发者ID:oneismore,项目名称:Discuss,代码行数:59,代码来源:disboard.class.php

示例8: die

$included = false;
if (file_exists($f)) {
    $included = @(include $f);
}
if (!$included) {
    die('build.properties.php was not found. Please make sure you have created one using the template of build.properties.sample.php.');
}
unset($f, $included);
/* instantiate xpdo instance */
$xpdo = new xPDO(XPDO_DSN, XPDO_DB_USER, XPDO_DB_PASS, array(xPDO::OPT_TABLE_PREFIX => XPDO_TABLE_PREFIX, xPDO::OPT_CACHE_PATH => MODX_CORE_PATH . 'cache/'), array(PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING));
$cacheManager = $xpdo->getCacheManager();
$xpdo->setLogLevel(xPDO::LOG_LEVEL_INFO);
$xpdo->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$xpdo->loadClass('transport.xPDOTransport', XPDO_CORE_PATH, true, true);
$packageDirectory = MODX_CORE_PATH . 'packages/';
$xpdo->log(xPDO::LOG_LEVEL_INFO, 'Beginning build script processes...');
flush();
/* remove pre-existing package files and directory */
if (file_exists($packageDirectory . 'core.transport.zip')) {
    @unlink($packageDirectory . 'core.transport.zip');
}
if (file_exists($packageDirectory . 'core') && is_dir($packageDirectory . 'core')) {
    $cacheManager->deleteTree($packageDirectory . 'core', array('deleteTop' => true, 'skipDirs' => false, 'extensions' => '*'));
}
if (!file_exists($packageDirectory . 'core') && !file_exists($packageDirectory . 'core.transport.zip')) {
    $xpdo->log(xPDO::LOG_LEVEL_INFO, 'Removed pre-existing core/ and core.transport.zip.');
    flush();
} else {
    $xpdo->log(xPDO::LOG_LEVEL_ERROR, 'Could not remove core/ and core.transport.zip before starting build.');
    flush();
}
开发者ID:OptimusCrime,项目名称:revolution,代码行数:31,代码来源:transport.core.php


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