@@ -24,6 +24,8 @@ require CAKE . 'functions.php';
2424To your application's ` config/bootstrap.php ` . Doing this will load global
2525aliases for * all* functions listed below.
2626
27+ ### __ ()
28+
2729` function ` ** __ (string $string_id, [ $formatArgs] )**
2830
2931This function handles localization in CakePHP applications. The
@@ -45,6 +47,8 @@ __('You have {unread} unread messages', ['unread' => $number]);
4547> [ Internationalization & Localization] ( ../core-libraries/internationalization-and-localization ) section for
4648> more information.
4749
50+ ### __ d()
51+
4852` function ` ** __ d(string $domain, string $msg, mixed $args = null)**
4953
5054Allows you to override the current domain for a single message lookup.
@@ -55,12 +59,16 @@ Useful when internationalizing a plugin:
5559> [ !NOTE]
5660> Make sure to use the underscored version of the plugin name here as domain.
5761
62+ ### __ dn()
63+
5864` function ` ** __ dn(string $domain, string $singular, string $plural, integer $count, mixed $args = null)**
5965
6066Allows you to override the current domain for a single plural message
6167lookup. Returns correct plural form of message identified by ` $singular `
6268and ` $plural ` for count ` $count ` from domain ` $domain ` .
6369
70+ ### __ dx()
71+
6472` function ` ** __ dx(string $domain, string $context, string $msg, mixed $args = null)**
6573
6674Allows you to override the current domain for a single message lookup. It
@@ -69,6 +77,8 @@ also allows you to specify a context.
6977The context is a unique identifier for the translations string that makes it
7078unique within the same domain.
7179
80+ ### __ dxn()
81+
7282` function ` ** __ dxn(string $domain, string $context, string $singular, string $plural, integer $count, mixed $args = null)**
7383
7484Allows you to override the current domain for a single plural message
@@ -80,17 +90,23 @@ for plural messages dependent on the count.
8090The context is a unique identifier for the translations string that makes it
8191unique within the same domain.
8292
93+ ### __ n()
94+
8395` function ` ** __ n(string $singular, string $plural, integer $count, mixed $args = null)**
8496
8597Returns correct plural form of message identified by ` $singular ` and
8698` $plural ` for count ` $count ` . Some languages have more than one form for
8799plural messages dependent on the count.
88100
101+ ### __ x()
102+
89103` function ` ** __ x(string $context, string $msg, mixed $args = null)**
90104
91105The context is a unique identifier for the translations string that makes it
92106unique within the same domain.
93107
108+ ### __ xn()
109+
94110` function ` ** __ xn(string $context, string $singular, string $plural, integer $count, mixed $args = null)**
95111
96112Returns correct plural form of message identified by ` $singular ` and
@@ -101,12 +117,16 @@ messages dependent on the count.
101117The context is a unique identifier for the translations string that makes it
102118unique within the same domain.
103119
120+ ### collection()
121+
104122` function ` ** collection(mixed $items)**
105123
106124Convenience wrapper for instantiating a new ` Cake\Collection\Collection `
107125object, wrapping the passed argument. The ` $items ` parameter takes either
108126a ` Traversable ` object or an array.
109127
128+ ### debug()
129+
110130` function ` ** debug(mixed $var, boolean $showHtml = null, $showFrom = true)**
111131
112132If the core ` $debug ` variable is ` true ` , ` $var ` is printed out.
@@ -115,25 +135,33 @@ browser-friendly. If `$showFrom` is not set to `false`, the debug output
115135will start with the line from which it was called. Also see
116136[ Debugging] ( ../development/debugging )
117137
138+ ### dd()
139+
118140` function ` ** dd(mixed $var, boolean $showHtml = null)**
119141
120142It behaves like ` debug() ` , but execution is also halted.
121143If the core ` $debug ` variable is ` true ` , ` $var ` is printed.
122144If ` $showHTML ` is ` true ` or left as ` null ` , the data is rendered to be
123145browser-friendly. Also see [ Debugging] ( ../development/debugging )
124146
147+ ### pr()
148+
125149` function ` ** pr(mixed $var)**
126150
127151Convenience wrapper for ` print_r() ` , with the addition of
128152wrapping ` <pre> ` tags around the output.
129153
154+ ### pj()
155+
130156` function ` ** pj(mixed $var)**
131157
132158JSON pretty print convenience function, with the addition of
133159wrapping ` <pre> ` tags around the output.
134160
135161It is meant for debugging the JSON representation of objects and arrays.
136162
163+ ### env()
164+
137165` function ` ** env(string $key, string $default = null)**
138166
139167Gets an environment variable from available sources. Used as a backup if
@@ -144,17 +172,23 @@ unsupporting servers. In fact, it's a good idea to always use `env()`
144172instead of ` $_SERVER ` or ` getenv() ` (especially if you plan to
145173distribute the code), since it's a full emulation wrapper.
146174
175+ ### h()
176+
147177` function ` ** h(string $text, boolean $double = true, string $charset = null)**
148178
149179Convenience wrapper for ` htmlspecialchars() ` .
150180
181+ ### pluginSplit()
182+
151183` function ` ** pluginSplit(string $name, boolean $dotAppend = false, string $plugin = null)**
152184
153185Splits a dot syntax plugin name into its plugin and class name. If ` $name `
154186does not have a dot, then index 0 will be ` null ` .
155187
156188Commonly used like ` list($plugin, $name) = pluginSplit('Users.User'); `
157189
190+ ### namespaceSplit()
191+
158192` function ` ** namespaceSplit(string $class)**
159193
160194Split the namespace from the classname.
0 commit comments