# |
Apr 27th 2021, 11:06 |
etibor |
if i try this: I18n::setLocale('en_US'); it does not work for translation behavior I18n::setLocale('en'); this will work but the whole site already using 'en_US' form |
# |
Apr 27th 2021, 09:35 |
paolo.bragagni |
(In my old cake 2 I've built an helper for bootstrap 2 menu) |
# |
Apr 27th 2021, 09:34 |
paolo.bragagni |
In your opinion is better to use this https://github.com/Holt59/cakephp4-bootstrap-helpers ? |
# |
Apr 27th 2021, 09:34 |
paolo.bragagni |
@erwane I've installed this https://github.com/icings/menu |
# |
Apr 27th 2021, 09:27 |
erwane |
@paolo.bragagni check https://github.com/Holt59/cakephp4-bootstrap-helpers and doc : https://holt59.github.io/cakephp3-bootstrap-helpers/navbar-helper/basics/ |
# |
Apr 27th 2021, 09:12 |
etibor |
its not really good because the whole site is using the 5 characters schema |
# |
Apr 27th 2021, 09:11 |
etibor |
i have a minor issue with translation behaviour, saving the translated fields working good but when i try to display the field when the local is 5 character long like en_US it does not work, only when the local is 2 characters long 'en' display the desired fields |
# |
Apr 27th 2021, 09:09 |
etibor |
hello evryone |
# |
Apr 27th 2021, 08:19 |
paolo.bragagni |
icings template menu with bootstrap 4 and nested submenus are available somewhere? |
# |
Apr 27th 2021, 08:18 |
paolo.bragagni |
hi all. |
# |
Apr 27th 2021, 02:48 |
slackebot |
SecurityException $exception = null) { if ($exception instanceof SecurityException andand $exception->getType() === 'secure') { return $this->redirect('https://' . env('SERVER_NAME') . Router::url($this->request->getRequestTarget())); } throw $exception; }``` If anyone could point me in the right direction, I'd greatly appreciate it. |
# |
Apr 27th 2021, 02:48 |
francisdoydora |
Good day everyone, I'm trying to figure out what's wrong with my force HTTPS redirect. The URL after successfully logging in redirects me to https://local.juniorhigh/login?redirect=%2Fadmin-panels%2Fdashboard instead of https://local.juniorhigh/admin-panels/dashboard I've created this function in AppController.php as prescribed in the documentation for CakePhp 3.8 ```public function forceSSL($error = '', |
# |
Apr 26th 2021, 23:14 |
D-rex |
I am trying to set a custom repsonse code. when inspecting the dev tools in chrome I can see the url is marked with the custom code 503 but when I use the getStatusCode() method or php built-in http_response_code() I get a 200. |
# |
Apr 26th 2021, 21:41 |
greg138 |
Looks eminently reasonable. |
# |
Apr 26th 2021, 21:38 |
slackebot |
strtolower(preg_replace( '/[^A-Za-z0-9_-]/', '', $tmp )); }``` |
# |
Apr 26th 2021, 21:38 |
kevin.pfeifer |
basically i blatenly copied parts of wordpresses `sanitize_html_class()` function and just created a little helper function like that ``` function clean_dom_class_string($string) { // Stolen from wordpress sanitize_html_class() function // Strip out any % encoded octets $tmp = preg_replace( '|%[a-fA-F0-9][a-fA-F0-9]|', '', $string ); // Limit to A-Z, a-z, 0-9, '_', '-'. return |
# |
Apr 26th 2021, 21:24 |
greg138 |
I'm not sure `h` is what you want in there. Is `<p class="a<b">` a useful thing to use, for example? Maybe a simple replace of things like `<`, `>` and `and` with underscores would be better? |
# |
Apr 26th 2021, 21:06 |
sebastiansperandio093 |
Thanks @kevin.pfeifer |
# |
Apr 26th 2021, 20:11 |
kevin.pfeifer |
i guess h() it is :) |
# |
Apr 26th 2021, 20:10 |
kevin.pfeifer |
yop |
# |
Apr 26th 2021, 20:09 |
greg138 |
Oh wait, in classes? Like `<p class="blah">`? |
# |
Apr 26th 2021, 20:08 |
greg138 |
`h()`? |
# |
Apr 26th 2021, 19:40 |
kevin.pfeifer |
or should i just write my own :) |
# |
Apr 26th 2021, 19:40 |
kevin.pfeifer |
is there a “built in” View Helper which lets me sanitize strings to be used in HTML classes? |
# |
Apr 26th 2021, 16:33 |
ndm |
After 8 rounds of voting It would probably look like `<(![ProgressHelper]!)>$io->helper('Progress')` :troll: |
# |
Apr 26th 2021, 16:32 |
ndm |
Maybe in a few years we get language level typecasts. |
# |
Apr 26th 2021, 16:31 |
ndm |
Well, the base class certainly doesn't satisfy that type, so that's where an inline hint would be required, being it an ignore, or a type hint. Not sure if PhpStan maybe has a tag for typehinting method return values by now. |
# |
Apr 26th 2021, 16:29 |
neon1024 |
Nevermind, thanks for looking :) |
# |
Apr 26th 2021, 16:28 |
neon1024 |
The load method inside returns mixed too, so unsure |
# |
Apr 26th 2021, 16:27 |
neon1024 |
I thought it allowed child classes, but I guess I was wrong |
# |
Apr 26th 2021, 16:26 |
neon1024 |
I can add a line ignore, it’s only a utility :) |
# |
Apr 26th 2021, 16:26 |
neon1024 |
Unfortunately it’s a catch 22 |
# |
Apr 26th 2021, 16:23 |
ndm |
Type as the concrete implementation ie `ProgresssHelper` |
# |
Apr 26th 2021, 16:23 |
ndm |
Using the base class is the opposite of what I ment :) |
# |
Apr 26th 2021, 16:20 |
neon1024 |
Just using the base class might work I guess if I ignore the errors |
# |
Apr 26th 2021, 16:20 |
tyler.adam.lazenby |
and my browser doesn't 100% like my certificate |
# |
Apr 26th 2021, 16:19 |
tyler.adam.lazenby |
oof ok the reaons was because I had set it to secure and httponly as true |
# |
Apr 26th 2021, 16:19 |
tyler.adam.lazenby |
Well that did set the expires to something else and the cookie is there, BUUUUUT I am still getting logged out as soon as the session ends. |
# |
Apr 26th 2021, 16:18 |
ndm |
Every helper is a `\Cake\Console\Helper`, but not every `\Cake\Console\Helper` is a `\Cake\Shell\Helper\ProgressHelper`. Drop the base class reference. |
# |
Apr 26th 2021, 16:17 |
neon1024 |
It cannot be sidestepped either `* @var \Cake\Shell\Helper\ProgressHelper|\Cake\Console\Helper` :x: |
# |
Apr 26th 2021, 16:17 |
neon1024 |
Perhaps the ProgressHelper is only for Shells? ..and not Commands? :thinking_face: |