Feature #19513 » 9657v2.diff

Administrator Admin, 2009-08-31 16:25

View differences:

t3lib/class.t3lib_timetrack.php (Arbeitskopie)
134 134
	 *
135 135
	 * @return	void
136 136
	 */
137
	function start()    {
137
	public function start() {
138 138
		$this->wrapError = array(
139 139
			0 => array('',''),
140 140
			1 => array('<strong>','</strong>'),
......
160 160
	 * @return	void
161 161
	 * @see tslib_cObj::cObjGetSingle(), pull()
162 162
	 */
163
	function push($tslabel, $value='')  {
163
	public function push($tslabel, $value = '') {
164 164
		array_push($this->tsStack[$this->tsStackPointer], $tslabel);
165 165
		array_push($this->currentHashPointer, 'timetracker_'.$this->uniqueCounter++);
166 166

  
......
185 185
	 * @return	void
186 186
	 * @see tslib_cObj::cObjGetSingle(), push()
187 187
	 */
188
	function pull($content='')  {
188
	public function pull($content = '') {
189 189
		$k = end($this->currentHashPointer);
190 190
		$this->tsStackLog[$k]['endtime'] =  microtime(true);
191 191
		$this->tsStackLog[$k]['content'] = $content;
......
203 203
	 * @return	void
204 204
	 * @see tslib_cObj::CONTENT()
205 205
	 */
206
	function setTSlogMessage($content,$num=0)   {
206
	public function setTSlogMessage($content, $num = 0) {
207 207
		end($this->currentHashPointer);
208 208
		$k = current($this->currentHashPointer);
209 209

  
......
220 220
	 * @param	string		Message/Label to attach
221 221
	 * @return	void
222 222
	 */
223
	function setTSselectQuery(array $data,$msg='')  {
223
	public function setTSselectQuery(array $data, $msg = '') {
224 224
		end($this->currentHashPointer);
225 225
		$k = current($this->currentHashPointer);
226 226

  
......
237 237
	 * @return	void
238 238
	 * @see decStackPointer(), TSpagegen::renderContent(), tslib_cObj::cObjGetSingle()
239 239
	 */
240
	function incStackPointer()  {
240
	public function incStackPointer() {
241 241
		$this->tsStackPointer++;
242 242
		$this->tsStack[$this->tsStackPointer]=array();
243 243
	}
......
248 248
	 * @return	void
249 249
	 * @see incStackPointer(), TSpagegen::renderContent(), tslib_cObj::cObjGetSingle()
250 250
	 */
251
	function decStackPointer()  {
251
	public function decStackPointer() {
252 252
		unset($this->tsStack[$this->tsStackPointer]);
253 253
		$this->tsStackPointer--;
254 254
	}
......
259 259
	 * @return	integer
260 260
	 * @deprecated	since TYPO3 4.3 - use getDifferenceToStarttime() instead
261 261
	 */
262
	function mtime() {
262
	protected function mtime() {
263 263
		return $this->getDifferenceToStarttime();
264 264
	}
265 265

  
......
270 270
	 * @return	integer
271 271
	 * @deprecated	since TYPO3 4.3 - use getMilliseconds() instead that expects microtime as float instead of a string
272 272
	 */
273
	function convertMicrotime($microtime) {
273
	public function convertMicrotime($microtime) {
274 274
		t3lib_div::logDeprecatedFunction();
275 275

  
276 276
		$parts = explode(' ',$microtime);
......
328 328
	 * @return	string		HTML table with the information about parsing times.
329 329
	 * @see t3lib_tsfeBeUserAuth::extGetCategory_tsdebug()
330 330
	 */
331
	function printTSlog() {
331
	public function printTSlog() {
332 332
			// Calculate times and keys for the tsStackLog
333 333
		foreach ($this->tsStackLog as $uniqueId => &$data) {
334 334
			$data['endtime'] = $this->getDifferenceToStarttime($data['endtime']);
......
475 475
	 * @param	string		Seems to be the previous tsStackLog key
476 476
	 * @return	string		Returns the $content string generated/modified. Also the $arr array is modified!
477 477
	 */
478
	function fixContent(&$arr, $content, $depthData='', $first=0, $vKey='') {
478
	protected function fixContent(&$arr, $content, $depthData = '', $first = 0, $vKey = '') {
479 479
		$ac=0;
480 480
		$c=0;
481 481
			// First, find number of entries
......
539 539
	 * @param	string		Command: If "FILE" then $this->printConf['contentLength_FILE'] is used for content length comparison, otherwise $this->printConf['contentLength']
540 540
	 * @return	string
541 541
	 */
542
	function fixCLen($c,$v) {
542
	protected function fixCLen($c, $v) {
543 543
		$len = $v=='FILE'?$this->printConf['contentLength_FILE']:$this->printConf['contentLength'];
544 544
		if (strlen($c)>$len) {
545 545
			$c = '<span style="color:green;">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($c,$len)).'</span>';
......
555 555
	 * @param	string		The string to be wrapped
556 556
	 * @return	string
557 557
	 */
558
	function fw($str) {
558
	protected function fw($str) {
559 559
		return '<span style="font-family:Verdana,Arial,Helvetica,sans-serif; font-size:10px; color:black; vertical-align:top;">'.$str.'&nbsp;</span>';
560 560
	}
561 561

  
......
569 569
	 * @access private
570 570
	 * @see printTSlog()
571 571
	 */
572
	function createHierarchyArray(&$arr,$pointer,$uniqueId) {
572
	protected function createHierarchyArray(&$arr, $pointer, $uniqueId) {
573 573
		if (!is_array($arr)) {
574 574
			$arr = array();
575 575
		}
......
591 591
	 * @param	string		URL for the <base> tag (if you want it)
592 592
	 * @return	string
593 593
	 */
594
	function debug_typo3PrintError($header,$text,$js,$baseUrl='') {
594
	public function debug_typo3PrintError($header, $text, $js, $baseUrl = '') {
595 595
		if ($js) {
596 596
			$errorMessage = 'alert(\'' . t3lib_div::slashJS($header . '\n' . $text) . '\');';
597 597
		} else {
......
644 644

  
645 645
// XCLASSing is not possible for this class
646 646

  
647
?>
647
?>
t3lib/class.t3lib_timetracknull.php (Revision 0)
1
<?php
2
/***************************************************************
3
*  Copyright notice
4
*
5
*  (c) 2008 Ingo Renner <ingo@typo3.org>
6
*  All rights reserved
7
*
8
*  This script is part of the TYPO3 project. The TYPO3 project is
9
*  free software; you can redistribute it and/or modify
10
*  it under the terms of the GNU General Public License as published by
11
*  the Free Software Foundation; either version 2 of the License, or
12
*  (at your option) any later version.
13
*
14
*  The GNU General Public License can be found at
15
*  http://www.gnu.org/copyleft/gpl.html.
16
*
17
*  This script is distributed in the hope that it will be useful,
18
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
19
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
*  GNU General Public License for more details.
21
*
22
*  This copyright notice MUST APPEAR in all copies of the script!
23
***************************************************************/
24

  
25

  
26

  
27
/**
28
 * A fake time tracker that does nothing but providing the methods of the real time tracker.
29
 * This is done to save some performance over the real time tracker.
30
 *
31
 * @author	Ingo Renner <ingo@typo3.org>
32
 * @package TYPO3
33
 * @subpackage t3lib
34
 */
35
class t3lib_TimeTrackNull {
36
	/**
37
	 * "Constructor"
38
	 * Sets the starting time
39
	 *
40
	 * does nothing
41
	 *
42
	 * @return	void
43
	 */
44
	public function start() {}
45

  
46
	/**
47
	 * Pushes an element to the TypoScript tracking array
48
	 *
49
	 * does nothing
50
	 *
51
	 * @param	string		Label string for the entry, eg. TypoScript property name
52
	 * @param	string		Additional value(?)
53
	 * @return	void
54
	 */
55
	public function push($tslabel, $value = '') {}
56

  
57
	/**
58
	 * Pulls an element from the TypoScript tracking array
59
	 *
60
	 * does nothing
61
	 *
62
	 * @param	string		The content string generated within the push/pull part.
63
	 * @return	void
64
	 */
65
	public function pull($content = '') {}
66

  
67
	/**
68
	 * Set TSselectQuery - for messages in TypoScript debugger.
69
	 *
70
	 * does nothing
71
	 *
72
	 * @param	array		Query array
73
	 * @param	string		Message/Label to attach
74
	 * @return	void
75
	 */
76
	public function setTSselectQuery(array $data, $msg = '') {}
77

  
78
	/**
79
	 * Logs the TypoScript entry
80
	 *
81
	 * does nothing
82
	 *
83
	 * @param	string		The message string
84
	 * @param	integer		Message type: 0: information, 1: message, 2: warning, 3: error
85
	 * @return	void
86
	 */
87
	public function setTSlogMessage($content, $num = 0) {}
88

  
89
	/**
90
	 * Print TypoScript parsing log
91
	 *
92
	 * does nothing
93
	 *
94
	 * @return	string		HTML table with the information about parsing times.
95
	 */
96
	public function printTSlog() {}
97

  
98
	/**
99
	 * Increases the stack pointer
100
	 *
101
	 * does nothing
102
	 *
103
	 * @return	void
104
	 */
105
	public function incStackPointer() {}
106

  
107
	/**
108
	 * Decreases the stack pointer
109
	 *
110
	 * does nothing
111
	 *
112
	 * @return	void
113
	 */
114
	public function decStackPointer() {}
115

  
116
	/**
117
	 * Returns microtime input to milliseconds
118
	 *
119
	 * does nothing
120
	 *
121
	 * @param	string		PHP microtime string
122
	 * @return	integer
123
	 */
124
	public function convertMicrotime($microtime) {}
125

  
126
	/**
127
	 * Gets a microtime value as milliseconds value.
128
	 *
129
	 * @param	float		$microtime: The microtime value - if not set the current time is used
130
	 * @return	integer		The microtime value as milliseconds value
131
	 */
132
	public function getMilliseconds($microtime = NULL) {}
133

  
134

  
135
	/**
136
	 * This prints out a TYPO3 error message.
137
	 *
138
	 * @param	string		Header string
139
	 * @param	string		Message string
140
	 * @param	boolean		If set, then this will produce a alert() line for inclusion in JavaScript.
141
	 * @param	string		URL for the <base> tag (if you want it)
142
	 * @return	string
143
	 */
144
	public function debug_typo3PrintError($header, $text, $js, $baseUrl = '') {}
145

  
146

  
147
}
148

  
149
// XCLASSing is not possible for this class
150

  
151
?>
typo3/sysext/cms/tslib/index_ts.php (Arbeitskopie)
83 83
// *********************
84 84
// Timetracking started
85 85
// *********************
86
require_once(PATH_t3lib.'class.t3lib_timetrack.php');
87
$TT = new t3lib_timeTrack;
86
if ($_COOKIE['be_typo_user']) {
87
	require_once(PATH_t3lib.'class.t3lib_timetrack.php');
88
	$TT = new t3lib_timeTrack;
89
} else {
90
	require_once(PATH_t3lib.'class.t3lib_timetracknull.php');
91
	$TT = new t3lib_timeTrackNull;
92
}
93

  
88 94
$TT->start();
89 95
$TT->push('','Script start');
90 96

  
(3-3/4)