@@ -65,7 +65,7 @@ Service Accessors
65
65
values that are specific to the environment itself, like database
66
66
settings, API keys, etc.
67
67
68
- .. php :function :: esc($data[, $context = 'html' [, $encoding]])
68
+ .. php :function :: esc($data[, $context = 'html'[, $encoding]])
69
69
70
70
:param string|array $data: The information to be escaped.
71
71
:param string $context: The escaping context. Default is 'html'.
@@ -89,7 +89,7 @@ Service Accessors
89
89
90
90
For full details, see the :doc: `helpers ` page.
91
91
92
- .. php :function :: lang($line[, $args[, $locale ]])
92
+ .. php :function :: lang($line[, $args[, $locale]])
93
93
94
94
:param string $line: The line of text to retrieve
95
95
:param array $args: An array of data to substitute for placeholders.
@@ -99,15 +99,15 @@ Service Accessors
99
99
100
100
For more information, see the :doc: `Localization </outgoing/localization >` page.
101
101
102
- .. php :function :: model($name [, $getShared = true [, &$conn = null ]])
102
+ .. php :function :: model($name[, $getShared = true[, &$conn = null]])
103
103
104
104
:param string $name:
105
105
:param boolean $getShared:
106
106
:param ConnectionInterface|null $conn:
107
107
:returns: More simple way of getting model instances
108
108
:rtype: mixed
109
109
110
- .. php :function :: old( $key[, $default = null, [, $escape = 'html' ]] )
110
+ .. php :function :: old($key[, $default = null,[, $escape = 'html']] )
111
111
112
112
:param string $key: The name of the old form data to check for.
113
113
:param mixed $default: The default value to return if $key doesn't exist.
@@ -124,7 +124,7 @@ Service Accessors
124
124
.. note :: If you are using the :doc:`form helper </helpers/form_helper>`, this feature is built-in. You only
125
125
need to use this function when not using the form helper.
126
126
127
- .. php :function :: session( [$key] )
127
+ .. php :function :: session([$key])
128
128
129
129
:param string $key: The name of the session item to check for.
130
130
:returns: An instance of the Session object if no $key, the value found in the session for $key, or null.
@@ -133,7 +133,7 @@ Service Accessors
133
133
Provides a convenient way to access the session class and to retrieve a
134
134
stored value. For more information, see the :doc: `Sessions </libraries/sessions >` page.
135
135
136
- .. php :function :: timer( [$name] )
136
+ .. php :function :: timer([$name])
137
137
138
138
:param string $name: The name of the benchmark point.
139
139
:returns: The Timer instance
@@ -147,7 +147,7 @@ Service Accessors
147
147
148
148
.. literalinclude :: common_functions/003.php
149
149
150
- .. php :function :: view ($name [, $data [, $options ]])
150
+ .. php :function :: view($name[, $data[, $options]])
151
151
152
152
:param string $name: The name of the file to load
153
153
:param array $data: An array of key/value pairs to make available within the view.
@@ -175,7 +175,7 @@ Service Accessors
175
175
176
176
For more details, see the :doc: `Views </outgoing/views >` page.
177
177
178
- .. php :function :: view_cell ( $library [, $params = null [, $ttl = 0 [, $cacheName = null]]] )
178
+ .. php :function :: view_cell( $library[, $params = null[, $ttl = 0[, $cacheName = null]]])
179
179
180
180
:param string $library:
181
181
:param null $params:
@@ -189,51 +189,51 @@ Service Accessors
189
189
Miscellaneous Functions
190
190
=======================
191
191
192
- .. php :function :: app_timezone ()
192
+ .. php :function :: app_timezone()
193
193
194
194
:returns: The timezone the application has been set to display dates in.
195
195
:rtype: string
196
196
197
197
Returns the timezone the application has been set to display dates in.
198
198
199
- .. php :function :: csp_script_nonce ()
199
+ .. php :function :: csp_script_nonce()
200
200
201
201
:returns: The CSP nonce attribute for script tag.
202
202
:rtype: string
203
203
204
204
Returns the nonce attribute for a script tag. For example: ``nonce="Eskdikejidojdk978Ad8jf" ``.
205
205
See :ref: `content-security-policy `.
206
206
207
- .. php :function :: csp_style_nonce ()
207
+ .. php :function :: csp_style_nonce()
208
208
209
209
:returns: The CSP nonce attribute for style tag.
210
210
:rtype: string
211
211
212
212
Returns the nonce attribute for a style tag. For example: ``nonce="Eskdikejidojdk978Ad8jf" ``.
213
213
See :ref: `content-security-policy `.
214
214
215
- .. php :function :: csrf_token ()
215
+ .. php :function :: csrf_token()
216
216
217
217
:returns: The name of the current CSRF token.
218
218
:rtype: string
219
219
220
220
Returns the name of the current CSRF token.
221
221
222
- .. php :function :: csrf_header ()
222
+ .. php :function :: csrf_header()
223
223
224
224
:returns: The name of the header for current CSRF token.
225
225
:rtype: string
226
226
227
227
The name of the header for current CSRF token.
228
228
229
- .. php :function :: csrf_hash ()
229
+ .. php :function :: csrf_hash()
230
230
231
231
:returns: The current value of the CSRF hash.
232
232
:rtype: string
233
233
234
234
Returns the current CSRF hash value.
235
235
236
- .. php :function :: csrf_field ()
236
+ .. php :function :: csrf_field()
237
237
238
238
:returns: A string with the HTML for hidden input with all required CSRF information.
239
239
:rtype: string
@@ -242,7 +242,7 @@ Miscellaneous Functions
242
242
243
243
<input type="hidden" name="{csrf_token}" value="{csrf_hash}">
244
244
245
- .. php :function :: csrf_meta ()
245
+ .. php :function :: csrf_meta()
246
246
247
247
:returns: A string with the HTML for meta tag with all required CSRF information.
248
248
:rtype: string
@@ -251,7 +251,7 @@ Miscellaneous Functions
251
251
252
252
<meta name="{csrf_header}" content="{csrf_hash}">
253
253
254
- .. php :function :: force_https ( $duration = 31536000 [, $request = null [, $response = null]] )
254
+ .. php :function :: force_https( $duration = 31536000[, $request = null[, $response = null]])
255
255
256
256
:param int $duration: The number of seconds browsers should convert links to this resource to HTTPS.
257
257
:param RequestInterface $request: An instance of the current Request object.
@@ -262,24 +262,24 @@ Miscellaneous Functions
262
262
but through HTTPS. Will set the HTTP Strict Transport Security header, which instructs
263
263
modern browsers to automatically modify any HTTP requests to HTTPS requests for the $duration.
264
264
265
- .. php :function :: function_usable ( $function_name )
265
+ .. php :function :: function_usable( $function_name)
266
266
267
267
:param string $function_name: Function to check for
268
268
:returns: true if the function exists and is safe to call, false otherwise.
269
269
:rtype: bool
270
270
271
- .. php :function :: is_cli ()
271
+ .. php :function :: is_cli()
272
272
273
273
:returns: true if the script is being executed from the command line or false otherwise.
274
274
:rtype: bool
275
275
276
- .. php :function :: is_really_writable ( $file )
276
+ .. php :function :: is_really_writable( $file)
277
277
278
278
:param string $file: The filename being checked.
279
279
:returns: true if you can write to the file, false otherwise.
280
280
:rtype: bool
281
281
282
- .. php :function :: log_message ($level, $message [, $context])
282
+ .. php :function :: log_message($level, $message [, $context])
283
283
284
284
:param string $level: The level of severity
285
285
:param string $message: The message that is to be logged.
@@ -295,7 +295,7 @@ Miscellaneous Functions
295
295
Context can be used to substitute values in the message string. For full details, see the
296
296
:doc: `Logging Information <logging >` page.
297
297
298
- .. php :function :: redirect( string $route )
298
+ .. php :function :: redirect(string $route)
299
299
300
300
:param string $route: The reverse-routed or named route to redirect the user to.
301
301
@@ -326,19 +326,25 @@ Miscellaneous Functions
326
326
327
327
.. literalinclude :: common_functions/007.php
328
328
329
- .. php :function :: route_to ( $method [, ...$params] )
329
+ .. php :function :: route_to( $method[, ...$params])
330
330
331
331
:param string $method: The named route alias, or name of the controller/method to match.
332
- :param mixed $params: One or more parameters to be passed to be matched in the route.
332
+ :param int|string $params: One or more parameters to be passed to be matched in the route.
333
333
334
334
.. note :: This function requires the controller/method to have a route defined in **app/Config/routes.php**.
335
335
336
- Generates a URI relative to the domain name (not ** baseUrl **) for you based on either a named route alias,
336
+ Generates a route for you based on either a named route alias,
337
337
or a controller::method combination. Will take parameters into effect, if provided.
338
338
339
- For full details, see the :doc: ` /incoming/routing ` page.
339
+ .. literalinclude :: common_functions/009.php
340
340
341
- .. php :function :: service ( $name [, ...$params] )
341
+ .. literalinclude :: common_functions/010.php
342
+
343
+ .. note :: ``route_to()`` returns a route, not a full URI path for your site.
344
+ If your **baseURL ** contains sub folders, the return value is not the same
345
+ as the URI to link. In that case, just use :php:func: `url_to ` instead.
346
+
347
+ .. php :function :: service($name[, ...$params])
342
348
343
349
:param string $name: The name of the service to load
344
350
:param mixed $params: One or more parameters to pass to the service method.
@@ -353,7 +359,7 @@ Miscellaneous Functions
353
359
354
360
.. literalinclude :: common_functions/008.php
355
361
356
- .. php :function :: single_service ( $name [, ...$params] )
362
+ .. php :function :: single_service( $name [, ...$params])
357
363
358
364
:param string $name: The name of the service to load
359
365
:param mixed $params: One or more parameters to pass to the service method.
@@ -372,7 +378,7 @@ Miscellaneous Functions
372
378
373
379
Fetch a config file item with slash appended (if not empty)
374
380
375
- .. php :function :: stringify_attributes ( $attributes [, $js] )
381
+ .. php :function :: stringify_attributes( $attributes [, $js])
376
382
377
383
:param mixed $attributes: string, array of key value pairs, or object
378
384
:param boolean $js: true if values do not need quotes (Javascript-style)
0 commit comments