Completed
Push — master ( 945d9a...e5db64 )
by Schlaefer
02:51
created
app/Config/bootstrap.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include App::path('Lib')[0] . 'BaseFunctions.php';
3
+include App::path('Lib')[0].'BaseFunctions.php';
4 4
 
5 5
 // Load Composer autoload.
6
-require ROOT . DS . APP_DIR . DS . 'Vendor' . DS . 'autoload.php';
6
+require ROOT.DS.APP_DIR.DS.'Vendor'.DS.'autoload.php';
7 7
 Cake2ComposerAutoloadFix();
8 8
 
9 9
 /**
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	/**
211 211
  * Check if the forum is installed
212 212
  */
213
-if ( file_exists(APP . 'Config' . DS . 'installed.txt') ) :
213
+if (file_exists(APP.'Config'.DS.'installed.txt')) :
214 214
 	Configure::write('Saito.installed', TRUE);
215 215
 else :
216 216
 	Configure::write('Saito.installed', FALSE);
Please login to merge, or discard this patch.
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -33,43 +33,43 @@  discard block
 block discarded – undo
33 33
 
34 34
 
35 35
 if (!isset($engine)) {
36
-	$engine = 'File';
37
-	$prefix = 'saito_';
36
+    $engine = 'File';
37
+    $prefix = 'saito_';
38 38
 }
39 39
 
40 40
 // Setup a 'default' cache configuration for use in the application.
41 41
 Cache::config(
42
-	'default',
43
-	[
44
-		'engine' => $engine,
45
-		'prefix'	 => $prefix
46
-	]
42
+    'default',
43
+    [
44
+        'engine' => $engine,
45
+        'prefix'	 => $prefix
46
+    ]
47 47
 );
48 48
 
49 49
 /**
50 50
  * Long term cache for performance cheating
51 51
  */
52 52
 Cache::config(
53
-	'entries',
54
-	[
55
-		'engine'   => $engine,
56
-		'prefix'	 => $prefix,
57
-		'groups'	 => ['entries'],
58
-		'duration' => 3600
59
-	]
53
+    'entries',
54
+    [
55
+        'engine'   => $engine,
56
+        'prefix'	 => $prefix,
57
+        'groups'	 => ['entries'],
58
+        'duration' => 3600
59
+    ]
60 60
 );
61 61
 
62 62
 /**
63 63
  * Short term cache for performance cheating
64 64
  */
65 65
 Cache::config(
66
-	'short',
67
-	[
68
-		'engine'   => $engine,
69
-		'prefix'	 => $prefix,
70
-		'groups'	 => ['short'],
71
-		'duration' => 180
72
-	]
66
+    'short',
67
+    [
68
+        'engine'   => $engine,
69
+        'prefix'	 => $prefix,
70
+        'groups'	 => ['short'],
71
+        'duration' => 180
72
+    ]
73 73
 );
74 74
 
75 75
 /**
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
  *
108 108
  */
109 109
 
110
-	/**
111
-	 * Cake doesn't handle Smiley <-> Smilies
112
-	 */
110
+    /**
111
+     * Cake doesn't handle Smiley <-> Smilies
112
+     */
113 113
 Inflector::rules('plural', array(
114
-								'/^(smil)ey$/i' => '\1ies'));
114
+                                '/^(smil)ey$/i' => '\1ies'));
115 115
 Inflector::rules('singular', array(
116
-								'/^(smil)ies$/i' => '\1ey'));
116
+                                '/^(smil)ies$/i' => '\1ey'));
117 117
 
118 118
 /**
119 119
  * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
  */
127 127
 
128 128
 CakePlugin::loadAll(
129
-	[
130
-		'Api' => ['bootstrap' => true, 'routes' => true],
131
-		'M' => ['bootstrap' => true, 'routes' => true],
132
-		'SaitoHelp' => ['routes' => true],
133
-	]
129
+    [
130
+        'Api' => ['bootstrap' => true, 'routes' => true],
131
+        'M' => ['bootstrap' => true, 'routes' => true],
132
+        'SaitoHelp' => ['routes' => true],
133
+    ]
134 134
 );
135 135
 
136 136
 /**
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
  * ));
151 151
  */
152 152
 Configure::write('Dispatcher.filters', array(
153
-	'AssetDispatcher',
154
-	'Stopwatch.StopwatchFilter',
153
+    'AssetDispatcher',
154
+    'Stopwatch.StopwatchFilter',
155 155
 ));
156 156
 
157 157
 /**
@@ -159,35 +159,35 @@  discard block
 block discarded – undo
159 159
  */
160 160
 App::uses('CakeLog', 'Log');
161 161
 CakeLog::config('debug', array(
162
-	'engine' => 'FileLog',
163
-	'types' => array('notice', 'info', 'debug'),
164
-	'file' => 'debug',
162
+    'engine' => 'FileLog',
163
+    'types' => array('notice', 'info', 'debug'),
164
+    'file' => 'debug',
165 165
 ));
166 166
 CakeLog::config('error', array(
167
-	'engine' => 'FileLog',
168
-	'types' => array('warning', 'error', 'critical', 'alert', 'emergency'),
169
-	'file' => 'error',
167
+    'engine' => 'FileLog',
168
+    'types' => array('warning', 'error', 'critical', 'alert', 'emergency'),
169
+    'file' => 'error',
170 170
 ));
171 171
 CakeLog::config('saito-error', array(
172
-	'engine' => 'FileLog',
173
-	'size' => '1MB',
174
-	'rotate' => '4',
175
-	'types' => ['saito.error'],
176
-	'file' => 'saito-error'
172
+    'engine' => 'FileLog',
173
+    'size' => '1MB',
174
+    'rotate' => '4',
175
+    'types' => ['saito.error'],
176
+    'file' => 'saito-error'
177 177
 ));
178 178
 CakeLog::config('saito', array(
179
-		'engine' => 'FileLog',
180
-		'size' => '1MB',
181
-		'rotate' => '4',
182
-		'types' => ['saito.info'],
183
-		'file' => 'saito-info'
179
+        'engine' => 'FileLog',
180
+        'size' => '1MB',
181
+        'rotate' => '4',
182
+        'types' => ['saito.info'],
183
+        'file' => 'saito-info'
184 184
 ));
185 185
 CakeLog::config('auth', array(
186
-		'engine' => 'FileLog',
187
-		'size' => '1MB',
188
-		'rotate' => '4',
189
-		'types' => ['saito.forbidden'],
190
-		'file' => 'saito-auth'
186
+        'engine' => 'FileLog',
187
+        'size' => '1MB',
188
+        'rotate' => '4',
189
+        'types' => ['saito.forbidden'],
190
+        'file' => 'saito-auth'
191 191
 ));
192 192
 
193 193
 include 'version.php';
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
  */
208 208
 Configure::write('Saito.Globals.postingsPerThread', 10);
209 209
 
210
-	/**
211
- * Check if the forum is installed
212
- */
210
+    /**
211
+     * Check if the forum is installed
212
+     */
213 213
 if ( file_exists(APP . 'Config' . DS . 'installed.txt') ) :
214
-	Configure::write('Saito.installed', TRUE);
214
+    Configure::write('Saito.installed', TRUE);
215 215
 else :
216
-	Configure::write('Saito.installed', FALSE);
216
+    Configure::write('Saito.installed', FALSE);
217 217
 endif;
218 218
 
219 219
 /**
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -212,8 +212,10 @@
 block discarded – undo
212 212
  */
213 213
 if ( file_exists(APP . 'Config' . DS . 'installed.txt') ) :
214 214
 	Configure::write('Saito.installed', TRUE);
215
-else :
215
+else {
216
+    :
216 217
 	Configure::write('Saito.installed', FALSE);
218
+}
217 219
 endif;
218 220
 
219 221
 /**
Please login to merge, or discard this patch.
app/Config/core.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
  */
338 338
 Cache::config('_cake_core_', array(
339 339
 	'engine' => $engine,
340
-	'prefix' => $prefix . 'cake_core_',
341
-	'path' => CACHE . 'persistent' . DS,
340
+	'prefix' => $prefix.'cake_core_',
341
+	'path' => CACHE.'persistent'.DS,
342 342
 	'serialize' => ($engine === 'File'),
343 343
 	'duration' => $duration
344 344
 ));
@@ -349,8 +349,8 @@  discard block
 block discarded – undo
349 349
  */
350 350
 Cache::config('_cake_model_', array(
351 351
 	'engine' => $engine,
352
-	'prefix' => $prefix . 'cake_model_',
353
-	'path' => CACHE . 'models' . DS,
352
+	'prefix' => $prefix.'cake_model_',
353
+	'path' => CACHE.'models'.DS,
354 354
 	'serialize' => ($engine === 'File'),
355 355
 	'duration' => $duration
356 356
 ));
Please login to merge, or discard this patch.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  * In production mode, flash messages redirect after a time interval.
34 34
  * In development mode, you need to click the flash message to continue.
35 35
  */
36
-	Configure::write('debug', 0);
36
+    Configure::write('debug', 0);
37 37
 
38 38
 /**
39 39
  * Configure the Error handler used to handle errors for your application. By default
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
  *
51 51
  * @see ErrorHandler for more information on error handling and configuration.
52 52
  */
53
-	Configure::write('Error', array(
54
-		'handler' => 'ErrorHandler::handleError',
55
-		'level' => E_ALL & ~E_DEPRECATED,
56
-		'trace' => true
57
-	));
53
+    Configure::write('Error', array(
54
+        'handler' => 'ErrorHandler::handleError',
55
+        'level' => E_ALL & ~E_DEPRECATED,
56
+        'trace' => true
57
+    ));
58 58
 
59 59
 /**
60 60
  * Configure the Exception handler used for uncaught exceptions. By default,
@@ -76,16 +76,16 @@  discard block
 block discarded – undo
76 76
  *
77 77
  * @see ErrorHandler for more information on exception handling and configuration.
78 78
  */
79
-	Configure::write('Exception', array(
80
-		'handler' => 'ErrorHandler::handleException',
81
-		'renderer' => 'ExceptionRenderer',
82
-		'log' => true
83
-	));
79
+    Configure::write('Exception', array(
80
+        'handler' => 'ErrorHandler::handleException',
81
+        'renderer' => 'ExceptionRenderer',
82
+        'log' => true
83
+    ));
84 84
 
85 85
 /**
86 86
  * Application wide charset encoding
87 87
  */
88
-	Configure::write('App.encoding', 'UTF-8');
88
+    Configure::write('App.encoding', 'UTF-8');
89 89
 
90 90
 /**
91 91
  * To configure CakePHP *not* to use mod_rewrite and to
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
  * included primarily as a development convenience - and
107 107
  * thus not recommended for production applications.
108 108
  */
109
-	//Configure::write('App.baseUrl', env('SCRIPT_NAME'));
109
+    //Configure::write('App.baseUrl', env('SCRIPT_NAME'));
110 110
 
111 111
 /**
112 112
  * To configure CakePHP to use a particular domain URL
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
  * will override the automatic detection of full base URL and can be
116 116
  * useful when generating links from the CLI (e.g. sending emails)
117 117
  */
118
-	//Configure::write('App.fullBaseURL', 'http://example.com');
118
+    //Configure::write('App.fullBaseURL', 'http://example.com');
119 119
 
120 120
 /**
121 121
  * Uncomment the define below to use CakePHP prefix routes.
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
  *	`manager_index()` and `/manager/controller/index`
134 134
  *
135 135
  */
136
-	Configure::write('Routing.prefixes', array('admin'));
136
+    Configure::write('Routing.prefixes', array('admin'));
137 137
 /**
138
- * Turn off all caching application-wide.
139
- *
140
- */
141
-	//Configure::write('Cache.disable', true);
138
+     * Turn off all caching application-wide.
139
+     *
140
+     */
141
+    //Configure::write('Cache.disable', true);
142 142
 
143 143
 /**
144 144
  * Enable cache checking.
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
  * or in each action using $this->cacheAction = true.
150 150
  *
151 151
  */
152
-	//Configure::write('Cache.check', true);
152
+    //Configure::write('Cache.check', true);
153 153
 
154 154
 /**
155 155
  * Defines the default error type when using the log() function. Used for
156 156
  * differentiating error logging and debugging. Currently PHP supports LOG_DEBUG.
157 157
  */
158
-	define('LOG_ERROR', LOG_ERR);
158
+    define('LOG_ERROR', LOG_ERR);
159 159
 
160 160
 /**
161 161
  * Session configuration.
@@ -194,20 +194,20 @@  discard block
 block discarded – undo
194 194
  * the cake shell command: cake schema create Sessions
195 195
  *
196 196
  */
197
-	Configure::write('Session', array(
198
-		'defaults' => 'php',
199
-		'cookie' => 'Saito',
200
-	));
197
+    Configure::write('Session', array(
198
+        'defaults' => 'php',
199
+        'cookie' => 'Saito',
200
+    ));
201 201
 
202 202
 /**
203 203
  * A random string used in security hashing methods.
204 204
  */
205
-	Configure::write('Security.salt', 'shouldBeAtLeast22CharsLongNoUnderscores');
205
+    Configure::write('Security.salt', 'shouldBeAtLeast22CharsLongNoUnderscores');
206 206
 
207 207
 /**
208 208
  * A random numeric string (digits only) used to encrypt/decrypt strings.
209 209
  */
210
-	Configure::write('Security.cipherSeed', '0123456789');
210
+    Configure::write('Security.cipherSeed', '0123456789');
211 211
 
212 212
 /**
213 213
  * Apply timestamps with the last modified time to static assets (js, css, images).
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
  * Set to `true` to apply timestamps when debug > 0. Set to 'force' to always enable
218 218
  * timestamping regardless of debug value.
219 219
  */
220
-	Configure::write('Asset.timestamp', 'force');
220
+    Configure::write('Asset.timestamp', 'force');
221 221
 
222 222
 /**
223 223
  * Compress CSS output by removing comments, whitespace, repeating tags, etc.
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
  *
227 227
  * To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use HtmlHelper::css().
228 228
  */
229
-	//Configure::write('Asset.filter.css', 'css.php');
229
+    //Configure::write('Asset.filter.css', 'css.php');
230 230
 
231 231
 /**
232 232
  * Plug in your own custom JavaScript compressor by dropping a script in your webroot to handle the
@@ -234,20 +234,20 @@  discard block
 block discarded – undo
234 234
  *
235 235
  * To use, prefix your JavaScript link URLs with '/cjs/' instead of '/js/' or use JavaScriptHelper::link().
236 236
  */
237
-	//Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php');
237
+    //Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php');
238 238
 
239 239
 /**
240 240
  * The class name and database used in CakePHP's
241 241
  * access control lists.
242 242
  */
243
-	Configure::write('Acl.classname', 'DbAcl');
244
-	Configure::write('Acl.database', 'default');
243
+    Configure::write('Acl.classname', 'DbAcl');
244
+    Configure::write('Acl.database', 'default');
245 245
 
246 246
 /**
247 247
  * Uncomment this line and correct your server timezone to fix
248 248
  * any date & time related errors.
249 249
  */
250
-	date_default_timezone_set('UTC');
250
+    date_default_timezone_set('UTC');
251 251
 
252 252
 /**
253 253
  *
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 // In development mode, caches should expire quickly.
326 326
 $duration = '+999 days';
327 327
 if (Configure::read('debug') > 0) {
328
-	$duration = '+10 seconds';
328
+    $duration = '+10 seconds';
329 329
 }
330 330
 
331 331
 // Prefix each application on the same server with a different string, to avoid Memcache and APC conflicts.
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
  * object listings, and translation cache files are stored with this configuration.
337 337
  */
338 338
 Cache::config('_cake_core_', array(
339
-	'engine' => $engine,
340
-	'prefix' => $prefix . 'cake_core_',
341
-	'path' => CACHE . 'persistent' . DS,
342
-	'serialize' => ($engine === 'File'),
343
-	'duration' => $duration
339
+    'engine' => $engine,
340
+    'prefix' => $prefix . 'cake_core_',
341
+    'path' => CACHE . 'persistent' . DS,
342
+    'serialize' => ($engine === 'File'),
343
+    'duration' => $duration
344 344
 ));
345 345
 
346 346
 /**
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
  * is used to store schema descriptions, and table listings in connections.
349 349
  */
350 350
 Cache::config('_cake_model_', array(
351
-	'engine' => $engine,
352
-	'prefix' => $prefix . 'cake_model_',
353
-	'path' => CACHE . 'models' . DS,
354
-	'serialize' => ($engine === 'File'),
355
-	'duration' => $duration
351
+    'engine' => $engine,
352
+    'prefix' => $prefix . 'cake_model_',
353
+    'path' => CACHE . 'models' . DS,
354
+    'serialize' => ($engine === 'File'),
355
+    'duration' => $duration
356 356
 ));
Please login to merge, or discard this patch.
app/View/Helper/EntryHHelper.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,18 +26,18 @@  discard block
 block discarded – undo
26 26
 
27 27
 			if ($lastAction !== 'add'):
28 28
 				if ($this->Session->read('paginator.lastPage')):
29
-					$indexPage .= '/page:' . $this->Session->read('paginator.lastPage');
29
+					$indexPage .= '/page:'.$this->Session->read('paginator.lastPage');
30 30
 				endif;
31 31
 			endif;
32
-			$indexPage .= '/jump:' . $tid;
32
+			$indexPage .= '/jump:'.$tid;
33 33
 
34 34
 			return $indexPage;
35 35
 		}
36 36
 
37 37
 		public function getFastLink($entry, $params = array('class' => '')) {
38 38
 			// @todo @performance
39
-			$out = "<a href='{$this->request->webroot}entries/view/{$entry['Entry']['id']}' class='{$params['class']}'>" .
40
-					$this->getSubject($this->dic->newInstance('\Saito\Posting\Posting', ['rawData' => $entry])) . '</a>';
39
+			$out = "<a href='{$this->request->webroot}entries/view/{$entry['Entry']['id']}' class='{$params['class']}'>".
40
+					$this->getSubject($this->dic->newInstance('\Saito\Posting\Posting', ['rawData' => $entry])).'</a>';
41 41
 			return $out;
42 42
 		}
43 43
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		public function renderThread(&$tree, array $options = []) {
74 74
 			$options += [
75 75
 				'lineCache' => $this->_View->get('LineCache'),
76
-				'maxThreadDepthIndent' => (int)Configure::read('Saito.Settings.thread_depth_indent'),
76
+				'maxThreadDepthIndent' => (int) Configure::read('Saito.Settings.thread_depth_indent'),
77 77
 				'renderer' => 'thread',
78 78
 				'rootWrap' => false
79 79
 			];
Please login to merge, or discard this patch.
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -1,119 +1,119 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-	use Saito\Thread\Renderer;
4
-
5
-	App::uses('AppHelper', 'View/Helper');
6
-
7
-
8
-	# @td refactor helper name to 'EntryHelper'
9
-	/**
10
-	 * @package saito_entry
11
-	 */
12
-
13
-	class EntryHHelper extends AppHelper {
14
-
15
-		use \Saito\Posting\Renderer\HelperTrait;
16
-
17
-		public $helpers = ['Form', 'Html', 'Session', 'TimeH'];
18
-
19
-		/**
20
-		 * @var array perf-cheat for renderers
21
-		 */
22
-		protected $_renderers = [];
23
-
24
-		public function getPaginatedIndexPageId($tid, $lastAction) {
25
-			$indexPage = '/entries/index';
26
-
27
-			if ($lastAction !== 'add'):
28
-				if ($this->Session->read('paginator.lastPage')):
29
-					$indexPage .= '/page:' . $this->Session->read('paginator.lastPage');
30
-				endif;
31
-			endif;
32
-			$indexPage .= '/jump:' . $tid;
33
-
34
-			return $indexPage;
35
-		}
36
-
37
-		public function getFastLink($entry, $params = array('class' => '')) {
38
-			// @todo @performance
39
-			$out = "<a href='{$this->request->webroot}entries/view/{$entry['Entry']['id']}' class='{$params['class']}'>" .
40
-					$this->getSubject($this->dic->newInstance('\Saito\Posting\Posting', ['rawData' => $entry])) . '</a>';
41
-			return $out;
42
-		}
43
-
44
-		public function categorySelect($entry, $categories) {
45
-			if ($entry['Entry']['pid'] == 0) {
46
-				$out = $this->Form->input(
47
-						'category_id',
48
-						[
49
-								'options' => [$categories],
50
-								'empty' => true,
51
-								'label' => __('Category'),
52
-								'tabindex' => 1,
53
-								'error' => ['notEmpty' => __('error_category_empty')]
54
-						]
55
-				);
56
-			} else {
57
-				// Send category for easy access in entries/preview when answering
58
-				// (not used when saved).
59
-				$out = $this->Form->hidden('category_id');
60
-			}
61
-			return $out;
62
-		}
63
-
64
-		/**
65
-		 * renders a posting tree as thread
66
-		 *
67
-		 * @param mixed $tree passed as reference to share CU-decorator "up"
68
-		 * @param $CurrentUser
69
-		 * @param $options
70
-		 * 	- 'renderer' [thread]|mix
71
-		 * @return string
72
-		 */
73
-		public function renderThread(&$tree, array $options = []) {
74
-			$options += [
75
-				'lineCache' => $this->_View->get('LineCache'),
76
-				'maxThreadDepthIndent' => (int)Configure::read('Saito.Settings.thread_depth_indent'),
77
-				'renderer' => 'thread',
78
-				'rootWrap' => false
79
-			];
80
-			$renderer = $options['renderer'];
81
-			unset($options['renderer']);
82
-
83
-			if (is_array($tree)) {
84
-				$tree = $this->createTreeObject($tree, $options);
85
-			}
86
-
87
-			if (isset($this->_renderers[$renderer])) {
88
-				$renderer = $this->_renderers[$renderer];
89
-			} else {
90
-				$name = $renderer;
91
-				switch ($name) {
92
-					case 'mix':
93
-						$renderer = new Renderer\MixHtmlRenderer($this);
94
-						break;
95
-					default:
96
-						$renderer = new Renderer\ThreadHtmlRenderer($this);
97
-				}
98
-				$this->_renderers[$name] = $renderer;
99
-			}
100
-			$renderer->setOptions($options);
101
-			return $renderer->render($tree);
102
-		}
103
-
104
-		/**
105
-		 * helper function for creating object thread tree
106
-		 *
107
-		 * @param array $entrySub
108
-		 * @param array $options
109
-		 * @return Posting
110
-		 */
111
-		public function createTreeObject(array $entrySub, array $options = []) {
112
-			$tree = $this->dic->newInstance(
113
-				'\Saito\Posting\Posting',
114
-				['rawData' => $entrySub, 'options' => $options]
115
-			);
116
-			return $tree;
117
-		}
118
-
119
-	}
3
+    use Saito\Thread\Renderer;
4
+
5
+    App::uses('AppHelper', 'View/Helper');
6
+
7
+
8
+    # @td refactor helper name to 'EntryHelper'
9
+    /**
10
+     * @package saito_entry
11
+     */
12
+
13
+    class EntryHHelper extends AppHelper {
14
+
15
+        use \Saito\Posting\Renderer\HelperTrait;
16
+
17
+        public $helpers = ['Form', 'Html', 'Session', 'TimeH'];
18
+
19
+        /**
20
+         * @var array perf-cheat for renderers
21
+         */
22
+        protected $_renderers = [];
23
+
24
+        public function getPaginatedIndexPageId($tid, $lastAction) {
25
+            $indexPage = '/entries/index';
26
+
27
+            if ($lastAction !== 'add'):
28
+                if ($this->Session->read('paginator.lastPage')):
29
+                    $indexPage .= '/page:' . $this->Session->read('paginator.lastPage');
30
+                endif;
31
+            endif;
32
+            $indexPage .= '/jump:' . $tid;
33
+
34
+            return $indexPage;
35
+        }
36
+
37
+        public function getFastLink($entry, $params = array('class' => '')) {
38
+            // @todo @performance
39
+            $out = "<a href='{$this->request->webroot}entries/view/{$entry['Entry']['id']}' class='{$params['class']}'>" .
40
+                    $this->getSubject($this->dic->newInstance('\Saito\Posting\Posting', ['rawData' => $entry])) . '</a>';
41
+            return $out;
42
+        }
43
+
44
+        public function categorySelect($entry, $categories) {
45
+            if ($entry['Entry']['pid'] == 0) {
46
+                $out = $this->Form->input(
47
+                        'category_id',
48
+                        [
49
+                                'options' => [$categories],
50
+                                'empty' => true,
51
+                                'label' => __('Category'),
52
+                                'tabindex' => 1,
53
+                                'error' => ['notEmpty' => __('error_category_empty')]
54
+                        ]
55
+                );
56
+            } else {
57
+                // Send category for easy access in entries/preview when answering
58
+                // (not used when saved).
59
+                $out = $this->Form->hidden('category_id');
60
+            }
61
+            return $out;
62
+        }
63
+
64
+        /**
65
+         * renders a posting tree as thread
66
+         *
67
+         * @param mixed $tree passed as reference to share CU-decorator "up"
68
+         * @param $CurrentUser
69
+         * @param $options
70
+         * 	- 'renderer' [thread]|mix
71
+         * @return string
72
+         */
73
+        public function renderThread(&$tree, array $options = []) {
74
+            $options += [
75
+                'lineCache' => $this->_View->get('LineCache'),
76
+                'maxThreadDepthIndent' => (int)Configure::read('Saito.Settings.thread_depth_indent'),
77
+                'renderer' => 'thread',
78
+                'rootWrap' => false
79
+            ];
80
+            $renderer = $options['renderer'];
81
+            unset($options['renderer']);
82
+
83
+            if (is_array($tree)) {
84
+                $tree = $this->createTreeObject($tree, $options);
85
+            }
86
+
87
+            if (isset($this->_renderers[$renderer])) {
88
+                $renderer = $this->_renderers[$renderer];
89
+            } else {
90
+                $name = $renderer;
91
+                switch ($name) {
92
+                    case 'mix':
93
+                        $renderer = new Renderer\MixHtmlRenderer($this);
94
+                        break;
95
+                    default:
96
+                        $renderer = new Renderer\ThreadHtmlRenderer($this);
97
+                }
98
+                $this->_renderers[$name] = $renderer;
99
+            }
100
+            $renderer->setOptions($options);
101
+            return $renderer->render($tree);
102
+        }
103
+
104
+        /**
105
+         * helper function for creating object thread tree
106
+         *
107
+         * @param array $entrySub
108
+         * @param array $options
109
+         * @return Posting
110
+         */
111
+        public function createTreeObject(array $entrySub, array $options = []) {
112
+            $tree = $this->dic->newInstance(
113
+                '\Saito\Posting\Posting',
114
+                ['rawData' => $entrySub, 'options' => $options]
115
+            );
116
+            return $tree;
117
+        }
118
+
119
+    }
Please login to merge, or discard this patch.
app/View/Helper/AdminHelper.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			$_nErrorsToShow = 20;
79 79
 			$errors = preg_split('/(?=^\d{4}-\d{2}-\d{2})/m', $log, -1, PREG_SPLIT_NO_EMPTY);
80 80
 			if (empty($errors)) {
81
-				return '<p>' . __('No log file found.') . '</p>';
81
+				return '<p>'.__('No log file found.').'</p>';
82 82
 			}
83 83
 
84 84
 			$out = '';
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 				$_i = self::tagId();
90 90
 				$_details = $e->details();
91 91
 				if (!empty($_details)) {
92
-					$out .= '<button class="btn btn-mini" style="float:right;" onclick="$(\'#' . $_i . '\').toggle(); return false;">' . __('Details') . '</button>' . "\n";
92
+					$out .= '<button class="btn btn-mini" style="float:right;" onclick="$(\'#'.$_i.'\').toggle(); return false;">'.__('Details').'</button>'."\n";
93 93
 				}
94
-				$out .= '<pre style="font-size: 10px;">' . "\n";
94
+				$out .= '<pre style="font-size: 10px;">'."\n";
95 95
 				$out .= '<div class="row"><div class="span2" style="text-align: right">';
96 96
 				$out .= $this->TimeH->formatTime($e->time(), 'eng');
97 97
 
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
 				$out .= '<div class="span7">';
100 100
 				$out .= $e->message();
101 101
 				if (!empty($_details)) {
102
-					$out .= '<span id="' . $_i . '" style="display: none;">' . "\n";
102
+					$out .= '<span id="'.$_i.'" style="display: none;">'."\n";
103 103
 					$out .= $_details;
104 104
 					$out .= '</span>';
105 105
 				}
106 106
 				$out .= '</div></div>';
107
-				$out .= '</pre>' . "\n";
107
+				$out .= '</pre>'."\n";
108 108
 				if ($k++ > $_nErrorsToShow) {
109 109
 					break;
110 110
 				}
Please login to merge, or discard this patch.
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -1,125 +1,125 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-	App::uses('AppHelper', 'View/Helper');
4
-
5
-	class CakeLogEntry {
6
-
7
-		public function __construct($text) {
8
-			$lines = explode("\n", trim($text));
9
-			$_firstLine = array_shift($lines);
10
-			preg_match('/^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) (.*?): (.*)/',
11
-				$_firstLine,
12
-				$matches);
13
-			$this->_time = $matches[1];
14
-			$this->_type = $matches[2];
15
-			$this->_message = trim($matches[3]);
16
-			if (empty($this->_message)) {
17
-				$this->_message = array_shift($lines);
18
-			}
19
-			$this->_detail = implode($lines, '<br>');
20
-		}
21
-
22
-		public function time() {
23
-			return $this->_time;
24
-		}
25
-
26
-		public function type() {
27
-			return $this->_type;
28
-		}
29
-
30
-		public function message() {
31
-			return $this->_message;
32
-		}
33
-
34
-		public function details() {
35
-			return $this->_detail;
36
-		}
37
-
38
-	}
39
-
40
-	class AdminHelper extends AppHelper {
41
-
42
-		public $helpers = [
43
-			'SaitoHelp',
44
-			'Html',
45
-			'TimeH'
46
-		];
47
-
48
-		public function help($id) {
49
-			return $this->SaitoHelp->icon($id, ['style' => 'float: right;']);
50
-		}
51
-
52
-		protected function _cBadge($engine) {
53
-			switch ($engine) {
54
-				case 'File':
55
-					$badge = 'warning';
56
-					break;
57
-				case 'Apc':
58
-					$badge = 'success';
59
-					break;
60
-				default:
61
-					$badge = 'info';
62
-			}
63
-			return $badge;
64
-		}
65
-
66
-		public function badge($text, $type = null) {
67
-			if (is_callable([$this, $type])) {
68
-				$badge = $this->$type($text);
69
-			} elseif (is_string(($type))) {
70
-				$badge = $type;
71
-			} else {
72
-				$badge = 'info';
73
-			}
74
-			return $this->Html->tag('span', $text, ['class' => "label label-$badge"]);
75
-		}
76
-
77
-		public function formatCakeLog($log) {
78
-			$_nErrorsToShow = 20;
79
-			$errors = preg_split('/(?=^\d{4}-\d{2}-\d{2})/m', $log, -1, PREG_SPLIT_NO_EMPTY);
80
-			if (empty($errors)) {
81
-				return '<p>' . __('No log file found.') . '</p>';
82
-			}
83
-
84
-			$out = '';
85
-			$k = 0;
86
-			$errors = array_reverse($errors);
87
-			foreach ($errors as $error) {
88
-				$e = new CakeLogEntry($error);
89
-				$_i = self::tagId();
90
-				$_details = $e->details();
91
-				if (!empty($_details)) {
92
-					$out .= '<button class="btn btn-mini" style="float:right;" onclick="$(\'#' . $_i . '\').toggle(); return false;">' . __('Details') . '</button>' . "\n";
93
-				}
94
-				$out .= '<pre style="font-size: 10px;">' . "\n";
95
-				$out .= '<div class="row"><div class="span2" style="text-align: right">';
96
-				$out .= $this->TimeH->formatTime($e->time(), 'eng');
97
-
98
-				$out .= '</div>';
99
-				$out .= '<div class="span7">';
100
-				$out .= $e->message();
101
-				if (!empty($_details)) {
102
-					$out .= '<span id="' . $_i . '" style="display: none;">' . "\n";
103
-					$out .= $_details;
104
-					$out .= '</span>';
105
-				}
106
-				$out .= '</div></div>';
107
-				$out .= '</pre>' . "\n";
108
-				if ($k++ > $_nErrorsToShow) {
109
-					break;
110
-				}
111
-
112
-			}
113
-			return $out;
114
-		}
115
-
116
-		public function jqueryTable($selector, $sort) {
117
-			$this->Html->script(
118
-				'lib/datatables/media/js/jquery.dataTables.js',
119
-				['inline' => false]
120
-			);
121
-
122
-			$script = <<<EOF
3
+    App::uses('AppHelper', 'View/Helper');
4
+
5
+    class CakeLogEntry {
6
+
7
+        public function __construct($text) {
8
+            $lines = explode("\n", trim($text));
9
+            $_firstLine = array_shift($lines);
10
+            preg_match('/^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) (.*?): (.*)/',
11
+                $_firstLine,
12
+                $matches);
13
+            $this->_time = $matches[1];
14
+            $this->_type = $matches[2];
15
+            $this->_message = trim($matches[3]);
16
+            if (empty($this->_message)) {
17
+                $this->_message = array_shift($lines);
18
+            }
19
+            $this->_detail = implode($lines, '<br>');
20
+        }
21
+
22
+        public function time() {
23
+            return $this->_time;
24
+        }
25
+
26
+        public function type() {
27
+            return $this->_type;
28
+        }
29
+
30
+        public function message() {
31
+            return $this->_message;
32
+        }
33
+
34
+        public function details() {
35
+            return $this->_detail;
36
+        }
37
+
38
+    }
39
+
40
+    class AdminHelper extends AppHelper {
41
+
42
+        public $helpers = [
43
+            'SaitoHelp',
44
+            'Html',
45
+            'TimeH'
46
+        ];
47
+
48
+        public function help($id) {
49
+            return $this->SaitoHelp->icon($id, ['style' => 'float: right;']);
50
+        }
51
+
52
+        protected function _cBadge($engine) {
53
+            switch ($engine) {
54
+                case 'File':
55
+                    $badge = 'warning';
56
+                    break;
57
+                case 'Apc':
58
+                    $badge = 'success';
59
+                    break;
60
+                default:
61
+                    $badge = 'info';
62
+            }
63
+            return $badge;
64
+        }
65
+
66
+        public function badge($text, $type = null) {
67
+            if (is_callable([$this, $type])) {
68
+                $badge = $this->$type($text);
69
+            } elseif (is_string(($type))) {
70
+                $badge = $type;
71
+            } else {
72
+                $badge = 'info';
73
+            }
74
+            return $this->Html->tag('span', $text, ['class' => "label label-$badge"]);
75
+        }
76
+
77
+        public function formatCakeLog($log) {
78
+            $_nErrorsToShow = 20;
79
+            $errors = preg_split('/(?=^\d{4}-\d{2}-\d{2})/m', $log, -1, PREG_SPLIT_NO_EMPTY);
80
+            if (empty($errors)) {
81
+                return '<p>' . __('No log file found.') . '</p>';
82
+            }
83
+
84
+            $out = '';
85
+            $k = 0;
86
+            $errors = array_reverse($errors);
87
+            foreach ($errors as $error) {
88
+                $e = new CakeLogEntry($error);
89
+                $_i = self::tagId();
90
+                $_details = $e->details();
91
+                if (!empty($_details)) {
92
+                    $out .= '<button class="btn btn-mini" style="float:right;" onclick="$(\'#' . $_i . '\').toggle(); return false;">' . __('Details') . '</button>' . "\n";
93
+                }
94
+                $out .= '<pre style="font-size: 10px;">' . "\n";
95
+                $out .= '<div class="row"><div class="span2" style="text-align: right">';
96
+                $out .= $this->TimeH->formatTime($e->time(), 'eng');
97
+
98
+                $out .= '</div>';
99
+                $out .= '<div class="span7">';
100
+                $out .= $e->message();
101
+                if (!empty($_details)) {
102
+                    $out .= '<span id="' . $_i . '" style="display: none;">' . "\n";
103
+                    $out .= $_details;
104
+                    $out .= '</span>';
105
+                }
106
+                $out .= '</div></div>';
107
+                $out .= '</pre>' . "\n";
108
+                if ($k++ > $_nErrorsToShow) {
109
+                    break;
110
+                }
111
+
112
+            }
113
+            return $out;
114
+        }
115
+
116
+        public function jqueryTable($selector, $sort) {
117
+            $this->Html->script(
118
+                'lib/datatables/media/js/jquery.dataTables.js',
119
+                ['inline' => false]
120
+            );
121
+
122
+            $script = <<<EOF
123 123
 $(function() {
124 124
 	$.extend( $.fn.dataTableExt.oStdClasses, {
125 125
 			"sWrapper": "dataTables_wrapper form-inline"
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 });
133 133
 EOF;
134 134
 
135
-			$this->Html->scriptBlock($script, ['inline' => false]);
136
-		}
135
+            $this->Html->scriptBlock($script, ['inline' => false]);
136
+        }
137 137
 
138
-	}
138
+    }
Please login to merge, or discard this patch.
app/View/Helper/MapHelper.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 		protected $_assetsIncluded = false;
18 18
 
19 19
 		public function beforeRender($viewFile) {
20
-			$this->_apiEnabled = (bool)Configure::read('Saito.Settings.map_enabled');
20
+			$this->_apiEnabled = (bool) Configure::read('Saito.Settings.map_enabled');
21 21
 			if (!$this->_apiEnabled) {
22 22
 				return;
23 23
 			}
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 			$this->Html->script([
37 37
 							'../dist/leaflet/leaflet.js',
38 38
 							'../dist/leaflet/leaflet.markercluster.js',
39
-							'//open.mapquestapi.com/sdk/leaflet/v1.0/mq-map.js?key=' . $this->_apiKey,
40
-							'//open.mapquestapi.com/sdk/leaflet/v1.0/mq-geocoding.js?key=' . $this->_apiKey
39
+							'//open.mapquestapi.com/sdk/leaflet/v1.0/mq-map.js?key='.$this->_apiKey,
40
+							'//open.mapquestapi.com/sdk/leaflet/v1.0/mq-geocoding.js?key='.$this->_apiKey
41 41
 					],
42 42
 					['inline' => false, 'block' => 'script-head']);
43 43
 			$this->_assetsIncluded = true;
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
 				// @performance
77 77
 				// filter out every field except the place fields
78 78
 				$users[$key] = [
79
-						'id' => (int)$user['User']['id'],
79
+						'id' => (int) $user['User']['id'],
80 80
 						'name' => $user['User']['username'],
81
-						'lat' => (float)$user['User']['user_place_lat'],
82
-						'lng' => (float)$user['User']['user_place_lng']
81
+						'lat' => (float) $user['User']['user_place_lat'],
82
+						'lng' => (float) $user['User']['user_place_lng']
83 83
 				];
84 84
 				if ($edit) {
85
-					$users[$key]['zoom'] = (int)$user['User']['user_place_zoom'];
85
+					$users[$key]['zoom'] = (int) $user['User']['user_place_zoom'];
86 86
 				} else {
87 87
 					// add simple jitter
88 88
 					$rand = 0; //  rand(-9,9) / pow(10, $this->_precision + 1);
Please login to merge, or discard this patch.
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -1,106 +1,106 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-	App::uses('AppHelper', 'View/Helper');
3
+    App::uses('AppHelper', 'View/Helper');
4 4
 
5
-	class MapHelper extends AppHelper {
5
+    class MapHelper extends AppHelper {
6 6
 
7
-		public $helpers = [
8
-				'Html'
9
-		];
7
+        public $helpers = [
8
+                'Html'
9
+        ];
10 10
 
11
-		protected $_precision = 2;
11
+        protected $_precision = 2;
12 12
 
13
-		protected $_apiEnabled;
13
+        protected $_apiEnabled;
14 14
 
15
-		protected $_apiKey;
15
+        protected $_apiKey;
16 16
 
17
-		protected $_assetsIncluded = false;
17
+        protected $_assetsIncluded = false;
18 18
 
19
-		public function beforeRender($viewFile) {
20
-			$this->_apiEnabled = (bool)Configure::read('Saito.Settings.map_enabled');
21
-			if (!$this->_apiEnabled) {
22
-				return;
23
-			}
24
-			$this->_apiKey = Configure::read('Saito.Settings.map_api_key');
25
-		}
19
+        public function beforeRender($viewFile) {
20
+            $this->_apiEnabled = (bool)Configure::read('Saito.Settings.map_enabled');
21
+            if (!$this->_apiEnabled) {
22
+                return;
23
+            }
24
+            $this->_apiKey = Configure::read('Saito.Settings.map_api_key');
25
+        }
26 26
 
27
-		protected function _includeAssets() {
28
-			if (!$this->_apiEnabled || $this->_assetsIncluded === true) {
29
-				return;
30
-			}
31
-			$this->Html->css([
32
-							'../dist/leaflet/leaflet.css',
33
-							'../dist/leaflet/MarkerCluster.Default.css'
34
-					],
35
-					['inline' => false]);
36
-			$this->Html->script([
37
-							'../dist/leaflet/leaflet.js',
38
-							'../dist/leaflet/leaflet.markercluster.js',
39
-							'//open.mapquestapi.com/sdk/leaflet/v1.0/mq-map.js?key=' . $this->_apiKey,
40
-							'//open.mapquestapi.com/sdk/leaflet/v1.0/mq-geocoding.js?key=' . $this->_apiKey
41
-					],
42
-					['inline' => false, 'block' => 'script-head']);
43
-			$this->_assetsIncluded = true;
44
-		}
27
+        protected function _includeAssets() {
28
+            if (!$this->_apiEnabled || $this->_assetsIncluded === true) {
29
+                return;
30
+            }
31
+            $this->Html->css([
32
+                            '../dist/leaflet/leaflet.css',
33
+                            '../dist/leaflet/MarkerCluster.Default.css'
34
+                    ],
35
+                    ['inline' => false]);
36
+            $this->Html->script([
37
+                            '../dist/leaflet/leaflet.js',
38
+                            '../dist/leaflet/leaflet.markercluster.js',
39
+                            '//open.mapquestapi.com/sdk/leaflet/v1.0/mq-map.js?key=' . $this->_apiKey,
40
+                            '//open.mapquestapi.com/sdk/leaflet/v1.0/mq-geocoding.js?key=' . $this->_apiKey
41
+                    ],
42
+                    ['inline' => false, 'block' => 'script-head']);
43
+            $this->_assetsIncluded = true;
44
+        }
45 45
 
46
-		public function map(array $users = [], array $options = []) {
47
-			$this->_includeAssets();
48
-			// generate options
49
-			$defaults = [
50
-					'fields' => [],
51
-					'type' => 'world',
52
-					'div' => [
53
-							'class' => 'saito-usermap'
54
-					]
55
-			];
56
-			foreach ($defaults as $key => $default) {
57
-				if (isset($options[$key])) {
58
-					if (is_array($options[$key])) {
59
-						$options[$key] = am($default, $options[$key]);
60
-					}
61
-				} else {
62
-					$options[$key] = $default;
63
-				}
64
-			}
46
+        public function map(array $users = [], array $options = []) {
47
+            $this->_includeAssets();
48
+            // generate options
49
+            $defaults = [
50
+                    'fields' => [],
51
+                    'type' => 'world',
52
+                    'div' => [
53
+                            'class' => 'saito-usermap'
54
+                    ]
55
+            ];
56
+            foreach ($defaults as $key => $default) {
57
+                if (isset($options[$key])) {
58
+                    if (is_array($options[$key])) {
59
+                        $options[$key] = am($default, $options[$key]);
60
+                    }
61
+                } else {
62
+                    $options[$key] = $default;
63
+                }
64
+            }
65 65
 
66
-			// show single user
67
-			if (isset($users['User'])) {
68
-				if ($options['type'] === 'world') {
69
-					$options['type'] = 'single';
70
-				}
71
-				$users = [$users];
72
-			}
73
-			$edit = $options['type'] === 'edit';
66
+            // show single user
67
+            if (isset($users['User'])) {
68
+                if ($options['type'] === 'world') {
69
+                    $options['type'] = 'single';
70
+                }
71
+                $users = [$users];
72
+            }
73
+            $edit = $options['type'] === 'edit';
74 74
 
75
-			foreach ($users as $key => $user) {
76
-				// @performance
77
-				// filter out every field except the place fields
78
-				$users[$key] = [
79
-						'id' => (int)$user['User']['id'],
80
-						'name' => $user['User']['username'],
81
-						'lat' => (float)$user['User']['user_place_lat'],
82
-						'lng' => (float)$user['User']['user_place_lng']
83
-				];
84
-				if ($edit) {
85
-					$users[$key]['zoom'] = (int)$user['User']['user_place_zoom'];
86
-				} else {
87
-					// add simple jitter
88
-					$rand = 0; //  rand(-9,9) / pow(10, $this->_precision + 1);
89
-					$users[$key]['lat'] = round($users[$key]['lat'],
90
-									$this->_precision) + $rand;
91
-					$users[$key]['lng'] = round($users[$key]['lng'],
92
-									$this->_precision) + $rand;
93
-				}
94
-			}
75
+            foreach ($users as $key => $user) {
76
+                // @performance
77
+                // filter out every field except the place fields
78
+                $users[$key] = [
79
+                        'id' => (int)$user['User']['id'],
80
+                        'name' => $user['User']['username'],
81
+                        'lat' => (float)$user['User']['user_place_lat'],
82
+                        'lng' => (float)$user['User']['user_place_lng']
83
+                ];
84
+                if ($edit) {
85
+                    $users[$key]['zoom'] = (int)$user['User']['user_place_zoom'];
86
+                } else {
87
+                    // add simple jitter
88
+                    $rand = 0; //  rand(-9,9) / pow(10, $this->_precision + 1);
89
+                    $users[$key]['lat'] = round($users[$key]['lat'],
90
+                                    $this->_precision) + $rand;
91
+                    $users[$key]['lng'] = round($users[$key]['lng'],
92
+                                    $this->_precision) + $rand;
93
+                }
94
+            }
95 95
 
96
-			$options['div'] += [
97
-					'data-users' => json_encode($users),
98
-					'data-params' => json_encode([
99
-							'type' => $options['type'],
100
-							'fields' => $options['fields']
101
-					])
102
-			];
103
-			return $this->Html->div(null, '', $options['div']);
104
-		}
96
+            $options['div'] += [
97
+                    'data-users' => json_encode($users),
98
+                    'data-params' => json_encode([
99
+                            'type' => $options['type'],
100
+                            'fields' => $options['fields']
101
+                    ])
102
+            ];
103
+            return $this->Html->div(null, '', $options['div']);
104
+        }
105 105
 
106
-	}
106
+    }
Please login to merge, or discard this patch.
app/View/Helper/JsDataHelper.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,17 +20,17 @@  discard block
 block discarded – undo
20 20
 					'version' => Configure::read('Saito.v'),
21 21
 					'settings' => [
22 22
 						'autoPageReload' => (isset($View->viewVars['autoPageReload']) ? $View->viewVars['autoPageReload'] : 0),
23
-						'embedly_enabled' => (bool)Configure::read('Saito.Settings.embedly_enabled'),
24
-						'editPeriod' => (int)Configure::read('Saito.Settings.edit_period'),
23
+						'embedly_enabled' => (bool) Configure::read('Saito.Settings.embedly_enabled'),
24
+						'editPeriod' => (int) Configure::read('Saito.Settings.edit_period'),
25 25
 						'notificationIcon' => $this->assetUrl(
26 26
 									'html5-notification-icon.png',
27 27
 									[
28 28
 										'pathPrefix' => Configure::read('App.imageBaseUrl'),
29 29
 										'fullBase' => true
30 30
 									]),
31
-						'subject_maxlength' => (int)Configure::read('Saito.Settings.subject_maxlength'),
32
-						'upload_max_img_size' => (int)Configure::read('Saito.Settings.upload_max_img_size') * 1024,
33
-						'upload_max_number_of_uploads' => (int)Configure::read('Saito.Settings.upload_max_number_of_uploads'),
31
+						'subject_maxlength' => (int) Configure::read('Saito.Settings.subject_maxlength'),
32
+						'upload_max_img_size' => (int) Configure::read('Saito.Settings.upload_max_img_size') * 1024,
33
+						'upload_max_number_of_uploads' => (int) Configure::read('Saito.Settings.upload_max_number_of_uploads'),
34 34
 						'webroot' => $View->request->webroot
35 35
 					]
36 36
 				],
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 					'isPreview' => $View->request->isPreview()
42 42
 				],
43 43
 				'currentUser' => [
44
-					'id' => (int)$View->viewVars['CurrentUser']['id'],
44
+					'id' => (int) $View->viewVars['CurrentUser']['id'],
45 45
 					'username' => $View->viewVars['CurrentUser']['username'],
46 46
 					'user_show_inline' => $View->viewVars['CurrentUser']['inline_view_on_click'] || false,
47 47
 					'user_show_thread_collapsed' => $View->viewVars['CurrentUser']['user_show_thread_collapsed'] || false
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 					'afterViewInit' => []
53 53
 				]
54 54
 			];
55
-			$out = 'var SaitoApp = ' . json_encode($js);
55
+			$out = 'var SaitoApp = '.json_encode($js);
56 56
 			$out .= '; SaitoApp.timeAppStart = new Date().getTime();';
57 57
 			return $out;
58 58
 		}
Please login to merge, or discard this patch.
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -1,69 +1,69 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-	use Saito\JsData;
3
+    use Saito\JsData;
4 4
 
5
-	App::uses('AppHelper', 'View/Helper');
5
+    App::uses('AppHelper', 'View/Helper');
6 6
 
7
-	class JsDataHelper extends AppHelper {
7
+    class JsDataHelper extends AppHelper {
8 8
 
9
-		protected $_JsData;
9
+        protected $_JsData;
10 10
 
11
-		public function __construct(View $view, $settings = array()) {
12
-			$this->_JsData = JsData::getInstance();
13
-			parent::__construct($view, $settings);
14
-		}
11
+        public function __construct(View $view, $settings = array()) {
12
+            $this->_JsData = JsData::getInstance();
13
+            parent::__construct($view, $settings);
14
+        }
15 15
 
16
-		public function getAppJs(View $View) {
17
-			$js = $this->_JsData->getJs();
18
-			$js += [
19
-				'app' => [
20
-					'version' => Configure::read('Saito.v'),
21
-					'settings' => [
22
-						'autoPageReload' => (isset($View->viewVars['autoPageReload']) ? $View->viewVars['autoPageReload'] : 0),
23
-						'embedly_enabled' => (bool)Configure::read('Saito.Settings.embedly_enabled'),
24
-						'editPeriod' => (int)Configure::read('Saito.Settings.edit_period'),
25
-						'notificationIcon' => $this->assetUrl(
26
-									'html5-notification-icon.png',
27
-									[
28
-										'pathPrefix' => Configure::read('App.imageBaseUrl'),
29
-										'fullBase' => true
30
-									]),
31
-						'subject_maxlength' => (int)Configure::read('Saito.Settings.subject_maxlength'),
32
-						'upload_max_img_size' => (int)Configure::read('Saito.Settings.upload_max_img_size') * 1024,
33
-						'upload_max_number_of_uploads' => (int)Configure::read('Saito.Settings.upload_max_number_of_uploads'),
34
-						'webroot' => $View->request->webroot
35
-					]
36
-				],
37
-				'request' => [
38
-					'action' => $View->request->action,
39
-					'controller' => $View->request->controller,
40
-					'isMobile' => $View->request->isMobile(),
41
-					'isPreview' => $View->request->isPreview()
42
-				],
43
-				'currentUser' => [
44
-					'id' => (int)$View->viewVars['CurrentUser']['id'],
45
-					'username' => $View->viewVars['CurrentUser']['username'],
46
-					'user_show_inline' => $View->viewVars['CurrentUser']['inline_view_on_click'] || false,
47
-					'user_show_thread_collapsed' => $View->viewVars['CurrentUser']['user_show_thread_collapsed'] || false
48
-				],
49
-				'callbacks' => [
50
-					'beforeAppInit' => [],
51
-					'afterAppInit' => [],
52
-					'afterViewInit' => []
53
-				]
54
-			];
55
-			$out = 'var SaitoApp = ' . json_encode($js);
56
-			$out .= '; SaitoApp.timeAppStart = new Date().getTime();';
57
-			return $out;
58
-		}
16
+        public function getAppJs(View $View) {
17
+            $js = $this->_JsData->getJs();
18
+            $js += [
19
+                'app' => [
20
+                    'version' => Configure::read('Saito.v'),
21
+                    'settings' => [
22
+                        'autoPageReload' => (isset($View->viewVars['autoPageReload']) ? $View->viewVars['autoPageReload'] : 0),
23
+                        'embedly_enabled' => (bool)Configure::read('Saito.Settings.embedly_enabled'),
24
+                        'editPeriod' => (int)Configure::read('Saito.Settings.edit_period'),
25
+                        'notificationIcon' => $this->assetUrl(
26
+                                    'html5-notification-icon.png',
27
+                                    [
28
+                                        'pathPrefix' => Configure::read('App.imageBaseUrl'),
29
+                                        'fullBase' => true
30
+                                    ]),
31
+                        'subject_maxlength' => (int)Configure::read('Saito.Settings.subject_maxlength'),
32
+                        'upload_max_img_size' => (int)Configure::read('Saito.Settings.upload_max_img_size') * 1024,
33
+                        'upload_max_number_of_uploads' => (int)Configure::read('Saito.Settings.upload_max_number_of_uploads'),
34
+                        'webroot' => $View->request->webroot
35
+                    ]
36
+                ],
37
+                'request' => [
38
+                    'action' => $View->request->action,
39
+                    'controller' => $View->request->controller,
40
+                    'isMobile' => $View->request->isMobile(),
41
+                    'isPreview' => $View->request->isPreview()
42
+                ],
43
+                'currentUser' => [
44
+                    'id' => (int)$View->viewVars['CurrentUser']['id'],
45
+                    'username' => $View->viewVars['CurrentUser']['username'],
46
+                    'user_show_inline' => $View->viewVars['CurrentUser']['inline_view_on_click'] || false,
47
+                    'user_show_thread_collapsed' => $View->viewVars['CurrentUser']['user_show_thread_collapsed'] || false
48
+                ],
49
+                'callbacks' => [
50
+                    'beforeAppInit' => [],
51
+                    'afterAppInit' => [],
52
+                    'afterViewInit' => []
53
+                ]
54
+            ];
55
+            $out = 'var SaitoApp = ' . json_encode($js);
56
+            $out .= '; SaitoApp.timeAppStart = new Date().getTime();';
57
+            return $out;
58
+        }
59 59
 
60
-		public function __call($method, $params) {
61
-			$proxy = array($this->_JsData, $method);
62
-			if (is_callable($proxy)) {
63
-				return call_user_func_array($proxy, $params);
64
-			} else {
65
-				return parent::__call($method, $params);
66
-			}
67
-		}
60
+        public function __call($method, $params) {
61
+            $proxy = array($this->_JsData, $method);
62
+            if (is_callable($proxy)) {
63
+                return call_user_func_array($proxy, $params);
64
+            } else {
65
+                return parent::__call($method, $params);
66
+            }
67
+        }
68 68
 
69
-	}
69
+    }
Please login to merge, or discard this patch.
app/View/Helper/SettingHelper.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 			$anchors = '';
22 22
 			foreach ($settingNames as $name) {
23 23
 				$out .= $this->tableRow($name, $Settings);
24
-				$anchors .= '<a name="' . $name . '"></a>';
24
+				$anchors .= '<a name="'.$name.'"></a>';
25 25
 			}
26 26
 			$key = $this->addHeader($options['nav-title']);
27
-			$out = '<table class="table table-striped table-bordered table-condensed">' .
28
-					$out . '</table>';
27
+			$out = '<table class="table table-striped table-bordered table-condensed">'.
28
+					$out.'</table>';
29 29
 
30 30
 			$sh = '';
31 31
 			if (!empty($options['sh'])) {
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 					['style' => 'float: right; margin: 1em']);
34 34
 			}
35 35
 
36
-			$out = '<div id="navHeaderAnchor' . $key . '"></div>' .
37
-					$sh .
38
-					$anchors .
39
-					'<h2 >' . $tableName . '</h2>' .
36
+			$out = '<div id="navHeaderAnchor'.$key.'"></div>'.
37
+					$sh.
38
+					$anchors.
39
+					'<h2 >'.$tableName.'</h2>'.
40 40
 					$out;
41 41
 			return $out;
42 42
 		}
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 				[
57 57
 					__d('nondynamic', $name),
58 58
 					$Settings[$name],
59
-					"<p>" . __d('nondynamic', $name . '_exp') . "</p>",
59
+					"<p>".__d('nondynamic', $name.'_exp')."</p>",
60 60
 					$this->Html->link(
61 61
 						__('edit'),
62 62
 						['controller' => 'settings', 'action' => 'edit', $name],
Please login to merge, or discard this patch.
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -1,80 +1,80 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-	App::uses('AppHelper', 'View/Helper');
3
+    App::uses('AppHelper', 'View/Helper');
4 4
 
5
-	class SettingHelper extends AppHelper {
5
+    class SettingHelper extends AppHelper {
6 6
 
7
-		protected $_headers = [];
7
+        protected $_headers = [];
8 8
 
9
-		public $helpers = [
10
-			'Html',
11
-			'SaitoHelp'
12
-		];
9
+        public $helpers = [
10
+            'Html',
11
+            'SaitoHelp'
12
+        ];
13 13
 
14
-		public function table($tableName, array $settingNames, $Settings, array $options = []) {
15
-			$defaults = [
16
-				'nav-title' => $tableName
17
-			];
18
-			$options += $defaults;
14
+        public function table($tableName, array $settingNames, $Settings, array $options = []) {
15
+            $defaults = [
16
+                'nav-title' => $tableName
17
+            ];
18
+            $options += $defaults;
19 19
 
20
-			$out = $this->tableHeaders();
21
-			$anchors = '';
22
-			foreach ($settingNames as $name) {
23
-				$out .= $this->tableRow($name, $Settings);
24
-				$anchors .= '<a name="' . $name . '"></a>';
25
-			}
26
-			$key = $this->addHeader($options['nav-title']);
27
-			$out = '<table class="table table-striped table-bordered table-condensed">' .
28
-					$out . '</table>';
20
+            $out = $this->tableHeaders();
21
+            $anchors = '';
22
+            foreach ($settingNames as $name) {
23
+                $out .= $this->tableRow($name, $Settings);
24
+                $anchors .= '<a name="' . $name . '"></a>';
25
+            }
26
+            $key = $this->addHeader($options['nav-title']);
27
+            $out = '<table class="table table-striped table-bordered table-condensed">' .
28
+                    $out . '</table>';
29 29
 
30
-			$sh = '';
31
-			if (!empty($options['sh'])) {
32
-				$sh = $this->SaitoHelp->icon($options['sh'],
33
-					['style' => 'float: right; margin: 1em']);
34
-			}
30
+            $sh = '';
31
+            if (!empty($options['sh'])) {
32
+                $sh = $this->SaitoHelp->icon($options['sh'],
33
+                    ['style' => 'float: right; margin: 1em']);
34
+            }
35 35
 
36
-			$out = '<div id="navHeaderAnchor' . $key . '"></div>' .
37
-					$sh .
38
-					$anchors .
39
-					'<h2 >' . $tableName . '</h2>' .
40
-					$out;
41
-			return $out;
42
-		}
36
+            $out = '<div id="navHeaderAnchor' . $key . '"></div>' .
37
+                    $sh .
38
+                    $anchors .
39
+                    '<h2 >' . $tableName . '</h2>' .
40
+                    $out;
41
+            return $out;
42
+        }
43 43
 
44
-		public function addHeader($header) {
45
-			$id = count($this->_headers) + 1;
46
-			$this->_headers[$id] = $header;
47
-			return $id;
48
-		}
44
+        public function addHeader($header) {
45
+            $id = count($this->_headers) + 1;
46
+            $this->_headers[$id] = $header;
47
+            return $id;
48
+        }
49 49
 
50
-		public function getHeaders() {
51
-			return $this->_headers;
52
-		}
50
+        public function getHeaders() {
51
+            return $this->_headers;
52
+        }
53 53
 
54
-		public function tableRow($name, $Settings) {
55
-			return $this->Html->tableCells(
56
-				[
57
-					__d('nondynamic', $name),
58
-					$Settings[$name],
59
-					"<p>" . __d('nondynamic', $name . '_exp') . "</p>",
60
-					$this->Html->link(
61
-						__('edit'),
62
-						['controller' => 'settings', 'action' => 'edit', $name],
63
-						['class' => 'btn']
64
-					)
65
-				]
66
-			);
67
-		}
54
+        public function tableRow($name, $Settings) {
55
+            return $this->Html->tableCells(
56
+                [
57
+                    __d('nondynamic', $name),
58
+                    $Settings[$name],
59
+                    "<p>" . __d('nondynamic', $name . '_exp') . "</p>",
60
+                    $this->Html->link(
61
+                        __('edit'),
62
+                        ['controller' => 'settings', 'action' => 'edit', $name],
63
+                        ['class' => 'btn']
64
+                    )
65
+                ]
66
+            );
67
+        }
68 68
 
69
-		public function tableHeaders() {
70
-			return $this->Html->tableHeaders(
71
-				[
72
-					__('Key'),
73
-					__('Value'),
74
-					__('Explanation'),
75
-					__('Actions')
76
-				]
77
-			);
78
-		}
69
+        public function tableHeaders() {
70
+            return $this->Html->tableHeaders(
71
+                [
72
+                    __('Key'),
73
+                    __('Value'),
74
+                    __('Explanation'),
75
+                    __('Actions')
76
+                ]
77
+            );
78
+        }
79 79
 
80
-	}
80
+    }
Please login to merge, or discard this patch.
app/View/Helper/FarbtasticHelper.php 3 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
  *    @version    2010-07-18
18 18
  * 		@td make plugin, fork from http://bakery.cakephp.org/articles/view/helper-for-farbtastic-jquery-color-picker to githup
19 19
  */
20
-class FarbtasticHelper extends Helper  {
20
+class FarbtasticHelper extends Helper {
21 21
 
22 22
     public $helpers = ['Form', 'Html'];
23 23
 
24
-		protected $output_files =	true;
24
+		protected $output_files = true;
25 25
 
26 26
 
27 27
     /**
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     *    Adapted from April Hodge Silver's "Simple Colorpicker" input function
33 33
     *    http://bakery.cakephp.org/articles/view/simple-colorpicker
34 34
     */
35
-    function input($name, $label='') {
35
+    function input($name, $label = '') {
36 36
 
37 37
         $icon_file = '../../js/farbtastic/color.png'; // update to wherever your icon is.
38 38
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             $label = Inflector::Humanize($fieldname);
42 42
         }
43 43
 
44
-        if(isset($this->request->data[$model][$fieldname])) {
44
+        if (isset($this->request->data[$model][$fieldname])) {
45 45
             $color_value = str_replace("#", "", $this->request->data[$model][$fieldname]); // expects an RGB string, strips any incoming '#' character
46 46
         }
47 47
         else {
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         $str = '';
52 52
         $str .= '<div class="input text colorpicker">';
53 53
 				$str .= $this->Form->input($fieldname, [
54
-					'id' => $model . Inflector::Camelize($fieldname),
54
+					'id' => $model.Inflector::Camelize($fieldname),
55 55
 					'class' => 'farbtastic-input',
56 56
 					'maxlength' => 7,
57 57
 					'label' => $label,
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     *    Farbtastic-ize the input, make the button show/hide the color picker div
81 81
     */
82 82
     function readyJS($name) {
83
-        list($model,$fieldname) = explode('.',$name);
83
+        list($model, $fieldname) = explode('.', $name);
84 84
         $str = '$(document).ready(function() { ';
85 85
         $str .= ' $("#farbtastic-picker-'.Inflector::Camelize($fieldname).'").farbtastic("#'.$model.Inflector::Camelize($fieldname).'"); ';
86 86
         $str .= ' $("#farbtastic-picker-icon-'.Inflector::Camelize($fieldname).'").click( function() { $("#farbtastic-picker-'.Inflector::Camelize($fieldname).'").toggle("slow"); }); ';
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@
 block discarded – undo
43 43
 
44 44
         if(isset($this->request->data[$model][$fieldname])) {
45 45
             $color_value = str_replace("#", "", $this->request->data[$model][$fieldname]); // expects an RGB string, strips any incoming '#' character
46
-        }
47
-        else {
46
+        } else {
48 47
             $color_value = "000000"; // black
49 48
         }
50 49
 
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,37 +1,37 @@  discard block
 block discarded – undo
1 1
 <?php
2
-	// @codingStandardsIgnoreFile
3
-	App::uses('AppHelper', 'View/Helper');
2
+    // @codingStandardsIgnoreFile
3
+    App::uses('AppHelper', 'View/Helper');
4 4
 /**
5
- *    Farbtastic helper
6
- *    @author      	Curtis Gibby
7
- *    @author     	Sebastian Siedentopf
8
- *    @desc        This helper does everything you need related to Farbtastic within CakePHP
9
- *
10
- *                Like Farbtastic, requires jQuery to function properly.
11
- *                jQuery: http://jquery.com
12
- *
13
- *                Also requires a Color Wheel icon (color.png in this example)
14
- *                like the one from Mark James' Silk set
15
- *                http://www.iconfinder.net/icondetails/5185/16/
16
- *
17
- *    @version    2010-07-18
18
- * 		@td make plugin, fork from http://bakery.cakephp.org/articles/view/helper-for-farbtastic-jquery-color-picker to githup
19
- */
5
+     *    Farbtastic helper
6
+     *    @author      	Curtis Gibby
7
+     *    @author     	Sebastian Siedentopf
8
+     *    @desc        This helper does everything you need related to Farbtastic within CakePHP
9
+     *
10
+     *                Like Farbtastic, requires jQuery to function properly.
11
+     *                jQuery: http://jquery.com
12
+     *
13
+     *                Also requires a Color Wheel icon (color.png in this example)
14
+     *                like the one from Mark James' Silk set
15
+     *                http://www.iconfinder.net/icondetails/5185/16/
16
+     *
17
+     *    @version    2010-07-18
18
+     * 		@td make plugin, fork from http://bakery.cakephp.org/articles/view/helper-for-farbtastic-jquery-color-picker to githup
19
+     */
20 20
 class FarbtasticHelper extends Helper  {
21 21
 
22 22
     public $helpers = ['Form', 'Html'];
23 23
 
24
-		protected $output_files =	true;
24
+        protected $output_files =	true;
25 25
 
26 26
 
27 27
     /**
28
-    *    Generate a form input and related div and icon
29
-    *
30
-    *    may need to customize $icon_file (relative to webroot)
31
-    *
32
-    *    Adapted from April Hodge Silver's "Simple Colorpicker" input function
33
-    *    http://bakery.cakephp.org/articles/view/simple-colorpicker
34
-    */
28
+     *    Generate a form input and related div and icon
29
+     *
30
+     *    may need to customize $icon_file (relative to webroot)
31
+     *
32
+     *    Adapted from April Hodge Silver's "Simple Colorpicker" input function
33
+     *    http://bakery.cakephp.org/articles/view/simple-colorpicker
34
+     */
35 35
     function input($name, $label='') {
36 36
 
37 37
         $icon_file = '../../js/farbtastic/color.png'; // update to wherever your icon is.
@@ -50,25 +50,25 @@  discard block
 block discarded – undo
50 50
 
51 51
         $str = '';
52 52
         $str .= '<div class="input text colorpicker">';
53
-				$str .= $this->Form->input($fieldname, [
54
-					'id' => $model . Inflector::Camelize($fieldname),
55
-					'class' => 'farbtastic-input',
56
-					'maxlength' => 7,
57
-					'label' => $label,
58
-					'value' => "#$color_value"
59
-				]);
53
+                $str .= $this->Form->input($fieldname, [
54
+                    'id' => $model . Inflector::Camelize($fieldname),
55
+                    'class' => 'farbtastic-input',
56
+                    'maxlength' => 7,
57
+                    'label' => $label,
58
+                    'value' => "#$color_value"
59
+                ]);
60 60
         $str .= '<img id="farbtastic-picker-icon-'.Inflector::Camelize($fieldname).'" src="'.$icon_file.'" alt="Color Picker" title="Color Picker" class="farbtastic-picker-icon">';
61 61
         $str .= '<div style="display:none;" class="farbtastic-picker" id="farbtastic-picker-'.Inflector::Camelize($fieldname).'"></div>';
62 62
         $str .= '</div>';
63 63
 
64
-				$this->readyJS($name);
64
+                $this->readyJS($name);
65 65
 
66
-				### include css and js files
67
-				if ($this->output_files) {
68
-					$this->Html->script('farbtastic/farbtastic', array('inline' => false));
69
-					$this->Html->css('../js/farbtastic/farbtastic', null, array('inline' => false));
70
-				}
71
-				$this->output_files = false;
66
+                ### include css and js files
67
+                if ($this->output_files) {
68
+                    $this->Html->script('farbtastic/farbtastic', array('inline' => false));
69
+                    $this->Html->css('../js/farbtastic/farbtastic', null, array('inline' => false));
70
+                }
71
+                $this->output_files = false;
72 72
 
73 73
         return $str;
74 74
     }
@@ -76,15 +76,15 @@  discard block
 block discarded – undo
76 76
 
77 77
 
78 78
     /**
79
-    *    Add the jQuery magic to the $(document).ready function
80
-    *    Farbtastic-ize the input, make the button show/hide the color picker div
81
-    */
79
+     *    Add the jQuery magic to the $(document).ready function
80
+     *    Farbtastic-ize the input, make the button show/hide the color picker div
81
+     */
82 82
     function readyJS($name) {
83 83
         list($model,$fieldname) = explode('.',$name);
84 84
         $str = '$(document).ready(function() { ';
85 85
         $str .= ' $("#farbtastic-picker-'.Inflector::Camelize($fieldname).'").farbtastic("#'.$model.Inflector::Camelize($fieldname).'"); ';
86 86
         $str .= ' $("#farbtastic-picker-icon-'.Inflector::Camelize($fieldname).'").click( function() { $("#farbtastic-picker-'.Inflector::Camelize($fieldname).'").toggle("slow"); }); ';
87 87
         $str .= '})';
88
-				$this->Html->scriptBlock($str, array('inline'=>false));
88
+                $this->Html->scriptBlock($str, array('inline'=>false));
89 89
     }
90 90
 }?>
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
app/View/Helper/ParserHelper.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 			$defaults = ['return' => 'html', 'multimedia' => true, 'wrap' => true];
61 61
 			$options += $defaults;
62 62
 
63
-			$cacheId = md5(serialize($options) . $string);
63
+			$cacheId = md5(serialize($options).$string);
64 64
 			if (isset($this->_parserCache[$cacheId])) {
65 65
 				$html = $this->_parserCache[$cacheId];
66 66
 			} else {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 				$this->_parserCache[$cacheId] = $html;
69 69
 			}
70 70
 			if ($options['wrap']) {
71
-				$html = '<div class="richtext">' . $html . '</div>';
71
+				$html = '<div class="richtext">'.$html.'</div>';
72 72
 			}
73 73
 			Stopwatch::stop('ParseHelper::parse()');
74 74
 			return $html;
Please login to merge, or discard this patch.
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -1,96 +1,96 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-	App::uses('AppHelper', 'View/Helper');
4
-
5
-	class ParserHelper extends AppHelper {
6
-
7
-		/**
8
-		 * @var array these Helpers are also used in the Parser
9
-		 */
10
-		public $helpers = [
11
-			'FileUpload.FileUpload',
12
-			'MailObfuscator.MailObfuscator',
13
-			'Geshi.Geshi',
14
-			'Embedly.Embedly',
15
-			'Html',
16
-			'Text',
17
-			//= usefull in Parsers
18
-			'Layout',
19
-			'SaitoHelp'
20
-		];
21
-
22
-		protected $_MarkupEditor;
23
-
24
-		/**
25
-		 * @var array parserCache for parsed markup
26
-		 *
27
-		 * Esp. useful for repeating signatures in long mix view threads
28
-		 */
29
-		protected $_parserCache = [];
30
-
31
-		protected $_Parser;
32
-
33
-		public $SmileyRenderer;
34
-
35
-		public function beforeRender($viewFile) {
36
-			if (isset($this->request) && $this->request->action === 'preview') {
37
-				$this->Geshi->showPlainTextButton = false;
38
-			}
39
-		}
40
-
41
-		public function citeText($string) {
42
-			return $this->_getParser()->citeText($string);
43
-		}
44
-
45
-		public function editorHelp() {
46
-			return $this->_getMarkupEditor()->getEditorHelp();
47
-		}
48
-
49
-		public function getButtonSet() {
50
-			return $this->_getMarkupEditor()->getMarkupSet();
51
-		}
52
-
53
-		public function parse($string, array $options = []) {
54
-			Stopwatch::start('ParseHelper::parse()');
55
-			if (empty($string) || $string === 'n/t') {
56
-				Stopwatch::stop('ParseHelper::parse()');
57
-				return $string;
58
-			}
59
-
60
-			$defaults = ['return' => 'html', 'multimedia' => true, 'wrap' => true];
61
-			$options += $defaults;
62
-
63
-			$cacheId = md5(serialize($options) . $string);
64
-			if (isset($this->_parserCache[$cacheId])) {
65
-				$html = $this->_parserCache[$cacheId];
66
-			} else {
67
-				$html = $this->_getParser()->parse($string, $options);
68
-				$this->_parserCache[$cacheId] = $html;
69
-			}
70
-			if ($options['wrap']) {
71
-				$html = '<div class="richtext">' . $html . '</div>';
72
-			}
73
-			Stopwatch::stop('ParseHelper::parse()');
74
-			return $html;
75
-		}
76
-
77
-		protected function _getMarkupEditor() {
78
-			if ($this->_MarkupEditor === null) {
79
-				$this->_MarkupEditor = \Saito\Plugin::getParserClassInstance('Editor', $this);
80
-			}
81
-			return $this->_MarkupEditor;
82
-		}
83
-
84
-		protected function _getParser() {
85
-			if ($this->_Parser === null) {
86
-				$settings = Configure::read('Saito.Settings') + $this->settings;
87
-
88
-				$this->SmileyRenderer = new \Saito\Smiley\Renderer($settings['smiliesData']);
89
-				$this->SmileyRenderer->setHelper($this);
90
-
91
-				$this->_Parser = \Saito\Plugin::getParserClassInstance('Parser', $this, $settings);
92
-			}
93
-			return $this->_Parser;
94
-		}
95
-
96
-	}
97 3
\ No newline at end of file
4
+    App::uses('AppHelper', 'View/Helper');
5
+
6
+    class ParserHelper extends AppHelper {
7
+
8
+        /**
9
+         * @var array these Helpers are also used in the Parser
10
+         */
11
+        public $helpers = [
12
+            'FileUpload.FileUpload',
13
+            'MailObfuscator.MailObfuscator',
14
+            'Geshi.Geshi',
15
+            'Embedly.Embedly',
16
+            'Html',
17
+            'Text',
18
+            //= usefull in Parsers
19
+            'Layout',
20
+            'SaitoHelp'
21
+        ];
22
+
23
+        protected $_MarkupEditor;
24
+
25
+        /**
26
+         * @var array parserCache for parsed markup
27
+         *
28
+         * Esp. useful for repeating signatures in long mix view threads
29
+         */
30
+        protected $_parserCache = [];
31
+
32
+        protected $_Parser;
33
+
34
+        public $SmileyRenderer;
35
+
36
+        public function beforeRender($viewFile) {
37
+            if (isset($this->request) && $this->request->action === 'preview') {
38
+                $this->Geshi->showPlainTextButton = false;
39
+            }
40
+        }
41
+
42
+        public function citeText($string) {
43
+            return $this->_getParser()->citeText($string);
44
+        }
45
+
46
+        public function editorHelp() {
47
+            return $this->_getMarkupEditor()->getEditorHelp();
48
+        }
49
+
50
+        public function getButtonSet() {
51
+            return $this->_getMarkupEditor()->getMarkupSet();
52
+        }
53
+
54
+        public function parse($string, array $options = []) {
55
+            Stopwatch::start('ParseHelper::parse()');
56
+            if (empty($string) || $string === 'n/t') {
57
+                Stopwatch::stop('ParseHelper::parse()');
58
+                return $string;
59
+            }
60
+
61
+            $defaults = ['return' => 'html', 'multimedia' => true, 'wrap' => true];
62
+            $options += $defaults;
63
+
64
+            $cacheId = md5(serialize($options) . $string);
65
+            if (isset($this->_parserCache[$cacheId])) {
66
+                $html = $this->_parserCache[$cacheId];
67
+            } else {
68
+                $html = $this->_getParser()->parse($string, $options);
69
+                $this->_parserCache[$cacheId] = $html;
70
+            }
71
+            if ($options['wrap']) {
72
+                $html = '<div class="richtext">' . $html . '</div>';
73
+            }
74
+            Stopwatch::stop('ParseHelper::parse()');
75
+            return $html;
76
+        }
77
+
78
+        protected function _getMarkupEditor() {
79
+            if ($this->_MarkupEditor === null) {
80
+                $this->_MarkupEditor = \Saito\Plugin::getParserClassInstance('Editor', $this);
81
+            }
82
+            return $this->_MarkupEditor;
83
+        }
84
+
85
+        protected function _getParser() {
86
+            if ($this->_Parser === null) {
87
+                $settings = Configure::read('Saito.Settings') + $this->settings;
88
+
89
+                $this->SmileyRenderer = new \Saito\Smiley\Renderer($settings['smiliesData']);
90
+                $this->SmileyRenderer->setHelper($this);
91
+
92
+                $this->_Parser = \Saito\Plugin::getParserClassInstance('Parser', $this, $settings);
93
+            }
94
+            return $this->_Parser;
95
+        }
96
+
97
+    }
98 98
\ No newline at end of file
Please login to merge, or discard this patch.