Перейти к публикации

Toggle Developers Mode On/Off 1.1

   (0 отзывов)

1 скриншот

Описание файла

So many questions:

  1. Why did I make this instead of doing more productive things?
  2. Why is this not baked into the software to begin with?
  3. Why did it take me (anyone?) over two years to get around to making this?
  4. Does there exist in the world a better gif to use as a primary screenshot?


Here is a list of things. You should read them.

1) If you install this on a live site to toggle dev mode on and off you ain't real smarts. If I've done my url check right, this cannot be used on live sites. 

Another 1) CIC user? Why are you here? You can't run developers mode on CIC. Also, I check for CIC installation and then stop you from doing something stupid like using this.

2) You must already have a constants.php file; this won't make one for you. Oh, I could, maybe later... I could even just add a full on "edit your constants file from the ACP" thing. Maybe. Buy me beer. Seems like an "I'm drinking so lets do this" coding thing. Oh yeah, this constants file should have the define( 'IN_DEV', TRUE ); line already in there. True or false; either one. 

Also 2) If you don't have a constants.php file and try to turn dev mode on/off the plugin will insult you, or just tell you it can't be found. Not entirely sure as I have a constants.php file and am far too attached to it to even move it for the briefest period of time, let alone rename it. This shall remain a mystery until @AndyF is forced to test it. And he has! No insult alas...

2 the Third) Another good thing to have is a dev folder. I check for that. Just the folder. If you want to enable developers mode with an empty dev folder that's up to you.

3) This grabs the constants.php content, case insensitive regex for the in_dev true or false, switches yonder true/false, then redirects. Where you ask? Journey to yonder plugin settings and chooseth your post-toggle target: the applications page or ye'olde plugins page.

4) I'm targeting single quotes for 'IN_DEV', so don't use "IN_DEV" in your constants.php. Yes I could deal with that. I could.

5) The toggle you seek is on your ACP usermenu.


6) You're stuck with fa-flask for an icon. I'll let you run wild and free with the next version whenever that is...

7) dmt_on and dmt_off are the language bits you seek if the existing words are not to your tastes.

8) IPS 4.2 or better. The usermenu hook might still be fine on 4.19.4 or lower but that's untested.

Изменения в версии 1.1   Просмотреть список изменений


PHP 7.2.4 (and higher) is  now so fast that before the constants file finishes being written the redirect that occurs immediately afterwards will still pull the previously existing constants values making it seem like you have to hit the toggle twice before anything happens. Added a sleep(2) to fix as a sleep(1) wasn't enough...

Отзывы пользователей

Вы можете оставить отзыв к файлу только после его скачивания.

Нет отзывов для отображения.