本文整理汇总了PHP中Debug::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Debug::getInstance方法的具体用法?PHP Debug::getInstance怎么用?PHP Debug::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debug
的用法示例。
在下文中一共展示了Debug::getInstance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bootstrap
public static function bootstrap(array $config)
{
if (!isset($config['mode'])) {
$config['mode'] = Config::get('deploy')->mode;
}
Debug::init($config['debug']);
self::$_MODE = $config['mode'];
self::setErrorReporting($config['mode'] !== self::MODE_PRODUCTION);
Cache::init();
Debug::getInstance()->addCheckpoint('bootstrapped');
}
示例2: triggerAction
/**
* Fire the specified action, calling all the registered handlers for that action.
**/
public static function triggerAction($action, $data = array())
{
Debug::getInstance()->addCheckpoint($action);
if (isset(self::$handlers[$action])) {
foreach (self::$handlers[$action] as $priority => $handlers) {
foreach ($handlers as $handler) {
if (is_callable($handler)) {
call_user_func_array($handler, $data);
}
}
}
}
}
示例3: microtime
<?php
$start_time = microtime(1);
// no cache
header("Expires: Thu, 01 Jan 1970 00:00:00 GMT");
header("Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT");
header("Pragma: no-cache");
header("Cache-Control: no-store, no-cache, must-revalidate");
require_once "init.php";
set_error_handler(array($debug = Debug::getInstance(), 'parsePHPError'));
print "generated in: " . round(microtime(1) - $start_time, 3) . "s; query counter: " . Mysql::get_num_queries() . "; cache hits: " . Mysql::get_cache_hits() . "; cache miss: " . Mysql::get_cache_misses() . "; " . $debug->getErrorStr();
示例4: die
die('<strong>ERROR!</strong><br />CubeCart requires <a href="http://www.php.net">PHP</a> Version 5.2.3 or better. Your server is currently running PHP Version ' . PHP_VERSION);
}
define('ADMIN_CP', false);
// Include core functions
require CC_INCLUDES_DIR . 'functions.inc.php';
// Initialize Cache
$GLOBALS['cache'] = Cache::getInstance();
// Initialise Database class, and fetch default configuration
$GLOBALS['db'] = Database::getInstance($glob);
// Initialise Config class
$GLOBALS['config'] = Config::getInstance($glob);
//We will not need this anymore
unset($glob);
$GLOBALS['config']->merge('config', '', $config_default);
// Initialize debug
$GLOBALS['debug'] = Debug::getInstance();
//Initialize sessions
$GLOBALS['session'] = Session::getInstance();
//Initialize Smarty
$GLOBALS['smarty'] = new Smarty();
$GLOBALS['smarty']->muteExpectedErrors();
$GLOBALS['smarty']->error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING;
$GLOBALS['smarty']->compile_dir = CC_SKIN_CACHE_DIR;
$GLOBALS['smarty']->config_dir = CC_SKIN_CACHE_DIR;
$GLOBALS['smarty']->cache_dir = CC_SKIN_CACHE_DIR;
$GLOBALS['smarty']->debugging = false;
//Initialize language
$GLOBALS['language'] = Language::getInstance();
//Initialize hooks
$GLOBALS['hooks'] = HookLoader::getInstance();
//Initialize SEO
示例5: __construct
public function __construct()
{
session_start();
header('Content-type: text/json');
// Get the website user
$userId = SessionManager::getInstance()->getUserId();
$json['result'] = 'true';
// Make sure a user is logged in
if (!isset($userId)) {
$json['result'] = 'false';
$json['title'] = (string) Content::c()->errors->session->title;
$json['message'] = (string) Content::c()->errors->session->no_session;
echo json_encode($json);
exit;
}
// Validate input
if (empty($_POST['introducee1Name']) || empty($_POST['introducee1FacebookId']) && empty($_POST['introducee1LinkedInId']) && empty($_POST['introducee1TwitterId']) || empty($_POST['introducee2Name']) || empty($_POST['introducee2FacebookId']) && empty($_POST['introducee2LinkedInId']) && empty($_POST['introducee2TwitterId'])) {
$json['result'] = 'false';
$json['title'] = (string) Content::c()->errors->input->title;
$json['message'] = (string) Content::c()->errors->input->introduction_not_created;
echo json_encode($json);
exit;
}
// Make sure the introducees are unique
if (!empty($_POST['introducee1FacebookId']) && !empty($_POST['introducee2FacebookId']) && $_POST['introducee1FacebookId'] == $_POST['introducee2FacebookId'] || !empty($_POST['introducee1LinkedInId']) && !empty($_POST['introducee2LinkedInId']) && $_POST['introducee1LinkedInId'] == $_POST['introducee2LinkedInId'] || !empty($_POST['introducee1TwitterId']) && !empty($_POST['introducee2TwitterId']) && $_POST['introducee1TwitterId'] == $_POST['introducee2TwitterId']) {
$json['result'] = 'false';
$json['title'] = (string) Content::c()->errors->input->title;
$json['message'] = (string) Content::c()->errors->input->introduce_to_self;
echo json_encode($json);
exit;
}
// Connect to the database
$db = Database::getInstance();
$introducee1 = new Person(array('name' => $_POST['introducee1Name'], 'facebookId' => !empty($_POST['introducee1FacebookId']) ? $_POST['introducee1FacebookId'] : '', 'linkedInId' => !empty($_POST['introducee1LinkedInId']) ? $_POST['introducee1LinkedInId'] : null, 'twitterId' => !empty($_POST['introducee1TwitterId']) ? $_POST['introducee1TwitterId'] : null));
$introducee2 = new Person(array('name' => $_POST['introducee2Name'], 'facebookId' => !empty($_POST['introducee2FacebookId']) ? $_POST['introducee2FacebookId'] : '', 'linkedInId' => !empty($_POST['introducee2LinkedInId']) ? $_POST['introducee2LinkedInId'] : null, 'twitterId' => !empty($_POST['introducee2TwitterId']) ? $_POST['introducee2TwitterId'] : null));
// See if the introducees are already in our database, that would be nice!
if (!empty($_POST['introducee1FacebookId'])) {
$introducee1->getDataFromFacebookId($_POST['introducee1FacebookId']);
} elseif (!empty($_POST['introducee1LinkedInId'])) {
$introducee1->getDataFromLinkedInId($_POST['introducee1LinkedInId']);
} elseif (!empty($_POST['introducee1TwitterId'])) {
$introducee1->getDataFromTwitterId($_POST['introducee1TwitterId']);
}
if (!empty($_POST['introducee2FacebookId'])) {
$introducee2->getDataFromFacebookId($_POST['introducee2FacebookId']);
} elseif (!empty($_POST['introducee2LinkedInId'])) {
$introducee2->getDataFromLinkedInId($_POST['introducee2LinkedInId']);
} elseif (!empty($_POST['introducee2TwitterId'])) {
$introducee2->getDataFromTwitterId($_POST['introducee2TwitterId']);
}
// Make sure the introducees are still unique
if ($introducee1->getFacebookId() != null && $introducee1->getFacebookId() == $introducee2->getFacebookId() || $introducee1->getLinkedInId() != null && $introducee1->getLinkedInId() == $introducee2->getLinkedInId() || $introducee1->getTwitterId() != null && $introducee1->getTwitterId() == $introducee2->getTwitterId()) {
$json['result'] = 'false';
$json['title'] = (string) Content::c()->errors->input->title;
$json['message'] = (string) Content::c()->errors->input->introduce_to_self;
echo json_encode($json);
exit;
}
// If the introducees aren't in the database yet, add them
$introducee1->addToDatabase();
$introducee2->addToDatabase();
// If the introducees are on LinkedIn, add their public profile URL and picture to the DB
if ($introducee1->getLinkedInId() != null || $introducee2->getLinkedInId() != null) {
// Connect to LinkedIn API
$sth = $db->prepare('SELECT id, access_token FROM linkedin WHERE person_id = :person_id');
$sth->execute(array(':person_id' => $userId));
$userDetails = $sth->fetch(PDO::FETCH_ASSOC);
if (!empty($userDetails['access_token'])) {
$linkedInAccessToken = $userDetails['access_token'];
// Create LinkedIn object
$API_CONFIG = array('appKey' => LI_API_KEY, 'appSecret' => LI_SECRET, 'callbackUrl' => '');
$OBJ_linkedin = new LinkedIn($API_CONFIG);
$OBJ_linkedin->setTokenAccess(unserialize($linkedInAccessToken));
// Which introducees are on LinkedIn?
$profilesToRequest = array();
if ($introducee1->getLinkedInId() != null) {
$profilesToRequest[] = 'id=' . $introducee1->getLinkedInId();
}
if ($introducee2->getLinkedInId() != null) {
$profilesToRequest[] = 'id=' . $introducee2->getLinkedInId();
}
try {
$linkedInProfiles = $OBJ_linkedin->profileNew('::(' . implode(',', $profilesToRequest) . '):(id,public-profile-url,picture-url)');
} catch (ErrorException $e) {
}
if ($linkedInProfiles['success'] === TRUE) {
$linkedInProfiles['linkedin'] = new SimpleXMLElement($linkedInProfiles['linkedin']);
if ($linkedInProfiles['linkedin']->getName() == 'people') {
foreach ($linkedInProfiles['linkedin']->person as $person) {
$id = (string) $person->id;
$url = (string) $person->{'public-profile-url'};
$pic = (string) $person->{'picture-url'};
if ($id && ($url || $pic)) {
$update = $db->prepare('REPLACE INTO temp_linkedin SET linkedin_id = :linkedin_id, time=NOW(), profile_url = :profile_url, picture_url = :picture_url');
$update->execute(array(':linkedin_id' => $id, ':profile_url' => $url, ':picture_url' => $pic));
}
}
}
}
}
//.........这里部分代码省略.........
示例6: output
/**
* Display XML
* @return XML
*/
public function output()
{
Debug::getInstance()->supress();
header('Content-Type: text/xml');
echo $this->getDocument();
}
示例7: printCachedFriendsIfSet
private function printCachedFriendsIfSet($cache)
{
if (!empty($cache)) {
for ($i = 0, $len = count($cache); $i < $len; $i++) {
if (!empty($cache[$i]['facebook_id'])) {
$json['friends'][$i]['facebookId'] = $cache[$i]['facebook_id'];
}
if (!empty($cache[$i]['linkedin_id'])) {
$json['friends'][$i]['linkedInId'] = $cache[$i]['linkedin_id'];
}
if (!empty($cache[$i]['twitter_id'])) {
$json['friends'][$i]['twitterId'] = $cache[$i]['twitter_id'];
}
$json['friends'][$i]['name'] = $cache[$i]['name'];
}
$json['result'] = 'true';
$json['time'] = Debug::getInstance()->getTimeElapsed();
echo json_encode($json);
exit;
}
}