本文整理汇总了PHP中DevblocksPlatform::getStartPeakMemory方法的典型用法代码示例。如果您正苦于以下问题:PHP DevblocksPlatform::getStartPeakMemory方法的具体用法?PHP DevblocksPlatform::getStartPeakMemory怎么用?PHP DevblocksPlatform::getStartPeakMemory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevblocksPlatform
的用法示例。
在下文中一共展示了DevblocksPlatform::getStartPeakMemory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writeResponse
public function writeResponse(DevblocksHttpResponse $response)
{
$path = $response->path;
// [JAS]: Ajax? // [TODO] Explore outputting whitespace here for Safari
// if(empty($path))
// return;
$tpl = DevblocksPlatform::getTemplateService();
$session = DevblocksPlatform::getSessionService();
$settings = CerberusSettings::getInstance();
$translate = DevblocksPlatform::getTranslationService();
$active_worker = CerberusApplication::getActiveWorker();
$visit = $session->getVisit();
$page_manifests = $this->_getAllowedPages();
$controller = array_shift($path);
// Default page [TODO] This is supposed to come from framework.config.php
if (empty($controller)) {
$controller = 'home';
}
// [JAS]: Require us to always be logged in for Cerberus pages
if (empty($visit) && 0 != strcasecmp($controller, 'login')) {
$query = array();
if (!empty($response->path)) {
$query = array('url' => urlencode(implode('/', $response->path)));
}
DevblocksPlatform::redirect(new DevblocksHttpRequest(array('login'), $query));
}
$page_id = $this->_getPageIdByUri($controller);
@($page = DevblocksPlatform::getExtension($page_id, true));
/* @var $page CerberusPageExtension */
if (empty($page)) {
header("Status: 404");
return;
// [TODO] 404
}
// [JAS]: Listeners (Step-by-step guided tour, etc.)
$listenerManifests = DevblocksPlatform::getExtensions('devblocks.listener.http');
foreach ($listenerManifests as $listenerManifest) {
/* @var $listenerManifest DevblocksExtensionManifest */
$inst = $listenerManifest->createInstance();
/* @var $inst DevblocksHttpRequestListenerExtension */
$inst->run($response, $tpl);
}
$tpl->assign('active_worker', $active_worker);
$tour_enabled = false;
if (!empty($visit) && !is_null($active_worker)) {
$tour_enabled = intval(DAO_WorkerPref::get($active_worker->id, 'assist_mode', 1));
if (DEMO_MODE) {
$tour_enabled = 1;
}
// override for DEMO
$keyboard_shortcuts = intval(DAO_WorkerPref::get($active_worker->id, 'keyboard_shortcuts', 1));
$tpl->assign('pref_keyboard_shortcuts', $keyboard_shortcuts);
$active_worker_memberships = $active_worker->getMemberships();
$tpl->assign('active_worker_memberships', $active_worker_memberships);
$unread_notifications = DAO_WorkerEvent::getUnreadCountByWorker($active_worker->id);
$tpl->assign('active_worker_notify_count', $unread_notifications);
DAO_Worker::logActivity($active_worker->id, $page->getActivity());
}
$tpl->assign('tour_enabled', $tour_enabled);
// [JAS]: Variables provided to all page templates
$tpl->assign('settings', $settings);
$tpl->assign('session', $_SESSION);
$tpl->assign('translate', $translate);
$tpl->assign('visit', $visit);
$tpl->assign('license', CerberusLicense::getInstance());
$tpl->assign('page_manifests', $page_manifests);
$tpl->assign('page', $page);
$tpl->assign('response_uri', implode('/', $response->path));
$core_tpl = DEVBLOCKS_PLUGIN_PATH . 'cerberusweb.core/templates/';
$tpl->assign('core_tpl', $core_tpl);
// Prebody Renderers
$preBodyRenderers = DevblocksPlatform::getExtensions('cerberusweb.renderer.prebody', true);
if (!empty($preBodyRenderers)) {
$tpl->assign('prebody_renderers', $preBodyRenderers);
}
// Postbody Renderers
$postBodyRenderers = DevblocksPlatform::getExtensions('cerberusweb.renderer.postbody', true);
if (!empty($postBodyRenderers)) {
$tpl->assign('postbody_renderers', $postBodyRenderers);
}
// Timings
$tpl->assign('render_time', microtime(true) - DevblocksPlatform::getStartTime());
if (function_exists('memory_get_usage') && function_exists('memory_get_peak_usage')) {
$tpl->assign('render_memory', memory_get_usage() - DevblocksPlatform::getStartMemory());
$tpl->assign('render_peak_memory', memory_get_peak_usage() - DevblocksPlatform::getStartPeakMemory());
}
$tpl->display($core_tpl . 'border.tpl');
// $cache = DevblocksPlatform::getCacheService();
// $cache->printStatistics();
}
示例2: writeResponse
public function writeResponse(DevblocksHttpResponse $response)
{
$path = $response->path;
// [JAS]: Ajax? // [TODO] Explore outputting whitespace here for Safari
// if(empty($path))
// return;
$tpl = DevblocksPlatform::getTemplateService();
$session = DevblocksPlatform::getSessionService();
$translate = DevblocksPlatform::getTranslationService();
$settings = PortSensorSettings::getInstance();
$visit = $session->getVisit();
$controller = array_shift($path);
$pages = DevblocksPlatform::getExtensions('app.page', true);
// Default page [TODO] This is supposed to come from framework.config.php
if (empty($controller)) {
$controller = 'home';
}
// [JAS]: Require us to always be logged in for pages
if (empty($visit)) {
$controller = 'login';
}
$page_id = $this->_getPageIdByUri($controller);
/* @var $page PageExtension */
@($page = $pages[$page_id]);
if (empty($page)) {
return;
}
// 404
// [JAS]: Listeners (Step-by-step guided tour, etc.)
$listenerManifests = DevblocksPlatform::getExtensions('devblocks.listener.http');
foreach ($listenerManifests as $listenerManifest) {
/* @var $listenerManifest DevblocksExtensionManifest */
$inst = $listenerManifest->createInstance();
/* @var $inst DevblocksHttpRequestListenerExtension */
$inst->run($response, $tpl);
}
// [JAS]: Variables provided to all page templates
$tpl->assign('settings', $settings);
$tpl->assign('session', $_SESSION);
$tpl->assign('translate', $translate);
$tpl->assign('visit', $visit);
$tpl->assign('pages', $pages);
$tpl->assign('page', $page);
$license = PortSensorLicense::getInstance();
$tpl->assign('license', $license);
$tpl->assign('response_uri', implode('/', $response->path));
$tpl_path = dirname(__FILE__) . '/templates/';
$tpl->assign('tpl_path', $tpl_path);
// Timings
$tpl->assign('render_time', microtime(true) - DevblocksPlatform::getStartTime());
if (function_exists('memory_get_usage') && function_exists('memory_get_peak_usage')) {
$tpl->assign('render_memory', memory_get_usage() - DevblocksPlatform::getStartMemory());
$tpl->assign('render_peak_memory', memory_get_peak_usage() - DevblocksPlatform::getStartPeakMemory());
}
$tpl->display($tpl_path . 'border.php');
}
示例3: writeResponse
public function writeResponse(DevblocksHttpResponse $response)
{
/* @var $response DevblocksHttpResponse */
$path = $response->path;
$uri_prefix = array_shift($path);
// should be mobile
// [JAS]: Ajax? // [TODO] Explore outputting whitespace here for Safari
// if(empty($path))
// return;
$tpl = DevblocksPlatform::getTemplateService();
$session = DevblocksPlatform::getSessionService();
$settings = CerberusSettings::getInstance();
$translate = DevblocksPlatform::getTranslationService();
$visit = $session->getVisit();
$controller = array_shift($path);
$pages = DevblocksPlatform::getExtensions('cerberusweb.mobile.page', true);
// Default page [TODO] This is supposed to come from framework.config.php
if (empty($controller)) {
$controller = 'tickets';
}
// [JAS]: Require us to always be logged in for Cerberus pages
// [TODO] This should probably consult with the page itself for ::authenticated()
if (empty($visit)) {
$controller = 'login';
}
$page_id = $this->_getPageIdByUri($controller);
/* @var $page CerberusPageExtension */
@($page = $pages[$page_id]);
if (empty($page)) {
return;
}
// 404
// [TODO] Reimplement
if (!empty($visit) && !is_null($visit->getWorker())) {
DAO_Worker::logActivity($visit->getWorker()->id, $page->getActivity());
}
// [JAS]: Listeners (Step-by-step guided tour, etc.)
$listenerManifests = DevblocksPlatform::getExtensions('devblocks.listener.http');
foreach ($listenerManifests as $listenerManifest) {
/* @var $listenerManifest DevblocksExtensionManifest */
$inst = $listenerManifest->createInstance();
/* @var $inst DevblocksHttpRequestListenerExtension */
$inst->run($response, $tpl);
}
// [JAS]: Pre-translate any dynamic strings
$common_translated = array();
if (!empty($visit) && !is_null($visit->getWorker())) {
$common_translated['header_signed_in'] = vsprintf($translate->_('header.signed_in'), array('<b>' . $visit->getWorker()->getName() . '</b>'));
}
$tpl->assign('common_translated', $common_translated);
// $tour_enabled = false;
// if(!empty($visit) && !is_null($visit->getWorker())) {
// $worker = $visit->getWorker();
// $tour_enabled = DAO_WorkerPref::get($worker->id, 'assist_mode');
// $tour_enabled = ($tour_enabled===false) ? 1 : $tour_enabled;
// if(DEMO_MODE) $tour_enabled = 1; // override for DEMO
// }
// $tpl->assign('tour_enabled', $tour_enabled);
// [JAS]: Variables provided to all page templates
$tpl->assign('settings', $settings);
$tpl->assign('session', $_SESSION);
$tpl->assign('translate', $translate);
$tpl->assign('visit', $visit);
$tpl->assign('license', CerberusLicense::getInstance());
$active_worker = CerberusApplication::getActiveWorker();
$tpl->assign('active_worker', $active_worker);
if (!empty($active_worker)) {
$active_worker_memberships = $active_worker->getMemberships();
$tpl->assign('active_worker_memberships', $active_worker_memberships);
}
$tpl->assign('pages', $pages);
$tpl->assign('page', $page);
$tpl->assign('response_uri', implode('/', $response->path));
$tpl_path = DEVBLOCKS_PLUGIN_PATH . 'cerberusweb.mobile/templates/';
$tpl->assign('core_tpl', DEVBLOCKS_PLUGIN_PATH . 'cerberusweb.core/templates/');
// Timings
$tpl->assign('render_time', microtime(true) - DevblocksPlatform::getStartTime());
if (function_exists('memory_get_usage') && function_exists('memory_get_peak_usage')) {
$tpl->assign('render_memory', memory_get_usage() - DevblocksPlatform::getStartMemory());
$tpl->assign('render_peak_memory', memory_get_peak_usage() - DevblocksPlatform::getStartPeakMemory());
}
$tpl->display($tpl_path . 'border.tpl');
}
示例4: writeResponse
public function writeResponse(DevblocksHttpResponse $response)
{
/* @var $response DevblocksHttpResponse */
$path = $response->path;
$uri_prefix = array_shift($path);
// should be mobile
// [JAS]: Ajax? // [TODO] Explore outputting whitespace here for Safari
// if(empty($path))
// return;
$tpl = DevblocksPlatform::getTemplateService();
$session = DevblocksPlatform::getSessionService();
$settings = DevblocksPlatform::getPluginSettingsService();
$translate = DevblocksPlatform::getTranslationService();
$visit = $session->getVisit();
$controller = array_shift($path);
$pages = DevblocksPlatform::getExtensions('cerberusweb.iphone.page', true);
// Default page [TODO] This is supposed to come from framework.config.php
if (empty($controller)) {
$controller = 'home';
}
// [JAS]: Require us to always be logged in for Cerberus pages
// [TODO] This should probably consult with the page itself for ::authenticated()
if (empty($visit)) {
$controller = 'login';
}
$page_id = $this->_getPageIdByUri($controller);
@($page = DevblocksPlatform::getExtension($page_id, true));
/* @var $page CerberusPageExtension */
if (empty($page)) {
header("Status: 404");
return;
// [TODO] 404
}
// [TODO] Reimplement
if (!empty($visit) && !is_null($visit->getWorker())) {
DAO_Worker::logActivity($page->getActivity());
}
// [JAS]: Listeners (Step-by-step guided tour, etc.)
$listenerManifests = DevblocksPlatform::getExtensions('devblocks.listener.http');
foreach ($listenerManifests as $listenerManifest) {
/* @var $listenerManifest DevblocksExtensionManifest */
$inst = $listenerManifest->createInstance();
/* @var $inst DevblocksHttpRequestListenerExtension */
$inst->run($response, $tpl);
}
// [JAS]: Variables provided to all page templates
$tpl->assign('settings', $settings);
$tpl->assign('session', $_SESSION);
$tpl->assign('translate', $translate);
$tpl->assign('visit', $visit);
$active_worker = CerberusApplication::getActiveWorker();
$tpl->assign('active_worker', $active_worker);
if (!empty($active_worker)) {
$active_worker_memberships = $active_worker->getMemberships();
$tpl->assign('active_worker_memberships', $active_worker_memberships);
}
$tpl->assign('pages', $pages);
$tpl->assign('page', $page);
$tpl->assign('response_uri', implode('/', $response->path));
$tpl->assign('core_tpl', $this->_TPL_PATH);
// Timings
$tpl->assign('render_time', microtime(true) - DevblocksPlatform::getStartTime());
if (function_exists('memory_get_usage') && function_exists('memory_get_peak_usage')) {
$tpl->assign('render_memory', memory_get_usage() - DevblocksPlatform::getStartMemory());
$tpl->assign('render_peak_memory', memory_get_peak_usage() - DevblocksPlatform::getStartPeakMemory());
}
// var_dump($path);
$tpl->display($this->_TPL_PATH . 'index.tpl');
}