Sipsb Опубликовано 7 февраля, 2018 Поделиться Опубликовано 7 февраля, 2018 Просмотреть файл Toggle Developers Mode On/Off Deluxe 5.1 TLDR for Version 5; 1) Toggle developers mode on and off via a ACP usermenu option. 2) Alter the styling of the IN_DEV mode look in the ACP. 3) V5 let's you toggle other IN_DEV related constants on and off as well. 1. Does there exist in the world a better gif to use as a primary screenshot? No. 2. If you are a CIC user OR you do not have an actual dev folder present and you will never be able to use this. I check. 3. You must already have a constants.php file. This won't make one for you. 4. The lines within should look like this: \define('IN_DEV_STRICT_MODE', TRUE); I've got no desire to turn this into a massive parsing operation checking for spacings, double vs. single quotes, comments and the like. Even less desire to pull the file in line by line, DOM it(?), turn every bit into a stored setting, and reconstruct it all the time. The only space you see there in that line is after the comma. The quotes are single quotes. Stick with that formatting and we'll all have a good time. 5. This constants file MUST have the \define('IN_DEV', TRUE ); line already in there. True or false; either one. But you need at least that. 6. 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. 7. This grabs the constants.php content, case insensitive regex for the IN_DEV true or false, switches yonder true/false, then redirects. You can choose between the Application page or the Plugin page for the redirect in settings. 8. 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... But like I said above, I'm not. This is me reminding you again - about both things. 9. The toggle lives on your ACP usermenu drop-down. 10. Can't stand the flask icon? Change them up in settings. Both on and off icons are customizable. 11. dmt_on and dmt_off are the language bits you want if the existing words are not to your tastes. 12. 4.3 and later users of this can now format the warning square and screen edge line that we got with the 4.3 series. Don't want construction yellow and candy stripe edge line? I got ya. 13. Was I drunk when I first wrote this years ago? Yes. The kind where you keep editing the constants.php manually to check stuff in and out of dev, then stop and wonder why the hell you are doing this manually and then the booze says "Fix this... you know you want to..." 14. Deluxe? What's happened? I'm not drunk now and want to change a few more IN_DEV constants. I also cleaned a few things, added some new settings, changed some language, the usual. 15. Other constants like...? Most of the IN_DEV related ones. I'm skipping any that require you to specify a path or name; if you need that, you've got a lot going on and can manage adding it yourself. Those are not likely to be changed often or ever anyways. 16. Menu option for updating constants is underneath the dev mode on/off menu option. 17. For this new feature, you MUST already have the constant you want in your constants file. So if you want to toggle the strict coding checks on and off, add \define('IN_DEV_STRICT_MODE', TRUE); to your constants file. The plugin will then make that available to toggle on/off. Yes, it's this way because I do not want to turn this into a line parsing thing. 18. Oh yeah, the Dev Mode Constants menu option is ONLY AVAILABLE when you are IN_DEV, when you are not IN_DEV only the toggle dev mode on button is visible. 19. You should make them all there already, and let us write them into constants on the fly and.... No. Go away. Also adding all of them and you have 20-some toggles in a row (ask me how I know...). You probably only ever use a few of them anyways. This is a simple utility, it's not gonna be any more. CodingJungle's tools are pretty on the ball; maybe he's got that already all set up, but those tools are not always updated along with new Invision Community versions, so I wanted this toggle thing to be version-agnostic, bullet-proof, and always available and working for the most part. 20. I got other things in my constants and I comment out stuff and... No problem, it's just replacing when it matches. All your other constants junk remains untouched. I know, people put other stuff beyond the IPS known-constants in there. And they comment stuff out however they comment it out, etc... Another reason why this is not a line parsing document thing. You want all that, you write it. 20. Wait! 4.5 no longer parses the custom css theme directory on the ACP side anymore so how can you change the dev mode alert styling? This is still just a plugin! There is that head css method thingy but I'm skipping that. I added a template, just filled that with the CSS, the settings parse there, and I dump that template into the head at the end. If you need to add your own extra ACP css for whatever, just track down my template and add what you want at the end. EDIT: Yeah, lol, maybe not... \IPS\Output::i()->headCss it is so no one has to make a dev folder for this thing... True story: IPS uses the head css method themselves exactly one time throughout all of their apps. 21. Oh, and on the constants toggle popup I list every IN_DEV constant that this handles - just hover over them for a tooltip that explains what they do. TLDR for Version 5; 1) Toggle developers mode on and off via a ACP usermenu option. 2) Alter the styling of the IN_DEV mode look in the ACP. 3) V5 let's you toggle other IN_DEV related constants on and off as well. 1. Does there exist in the world a better gif to use as a primary screenshot? No. 2. If you are a CIC user OR you do not have an actual dev folder present and you will never be able to use this. I check. 3. You must already have a constants.php file. This won't make one for you. 4. The lines within should look like this: \define('IN_DEV_STRICT_MODE', TRUE); I've got no desire to turn this into a massive parsing operation checking for spacings, double vs. single quotes, comments and the like. Even less desire to pull the file in line by line, DOM it(?), turn every bit into a stored setting, and reconstruct it all the time. The only space you see there in that line is after the comma. The quotes are single quotes. Stick with that formatting and we'll all have a good time. 5. This constants file MUST have the \define('IN_DEV', TRUE ); line already in there. True or false; either one. But you need at least that. 6. 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. 7. This grabs the constants.php content, case insensitive regex for the IN_DEV true or false, switches yonder true/false, then redirects. You can choose between the Application page or the Plugin page for the redirect in settings. 8. 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... But like I said above, I'm not. This is me reminding you again - about both things. 9. The toggle lives on your ACP usermenu drop-down. 10. Can't stand the flask icon? Change them up in settings. Both on and off icons are customizable. 11. dmt_on and dmt_off are the language bits you want if the existing words are not to your tastes. 12. 4.3 and later users of this can now format the warning square and screen edge line that we got with the 4.3 series. Don't want construction yellow and candy stripe edge line? I got ya. 13. Was I drunk when I first wrote this years ago? Yes. The kind where you keep editing the constants.php manually to check stuff in and out of dev, then stop and wonder why the hell you are doing this manually and then the booze says "Fix this... you know you want to..." 14. Deluxe? What's happened? I'm not drunk now and want to change a few more IN_DEV constants. I also cleaned a few things, added some new settings, changed some language, the usual. 15. Other constants like...? Most of the IN_DEV related ones. I'm skipping any that require you to specify a path or name; if you need that, you've got a lot going on and can manage adding it yourself. Those are not likely to be changed often or ever anyways. 16. Menu option for updating constants is underneath the dev mode on/off menu option. 17. For this new feature, you MUST already have the constant you want in your constants file. So if you want to toggle the strict coding checks on and off, add \define('IN_DEV_STRICT_MODE', TRUE); to your constants file. The plugin will then make that available to toggle on/off. Yes, it's this way because I do not want to turn this into a line parsing thing. 18. Oh yeah, the Dev Mode Constants menu option is ONLY AVAILABLE when you are IN_DEV, when you are not IN_DEV only the toggle dev mode on button is visible. 19. You should make them all there already, and let us write them into constants on the fly and.... No. Go away. Also adding all of them and you have 20-some toggles in a row (ask me how I know...). You probably only ever use a few of them anyways. This is a simple utility, it's not gonna be any more. CodingJungle's tools are pretty on the ball; maybe he's got that already all set up, but those tools are not always updated along with new Invision Community versions, so I wanted this toggle thing to be version-agnostic, bullet-proof, and always available and working for the most part. 20. I got other things in my constants and I comment out stuff and... No problem, it's just replacing when it matches. All your other constants junk remains untouched. I know, people put other stuff beyond the IPS known-constants in there. And they comment stuff out however they comment it out, etc... Another reason why this is not a line parsing document thing. You want all that, you write it. 20. Wait! 4.5 no longer parses the custom css theme directory on the ACP side anymore so how can you change the dev mode alert styling? This is still just a plugin! There is that head css method thingy but I'm skipping that. I added a template, just filled that with the CSS, the settings parse there, and I dump that template into the head at the end. If you need to add your own extra ACP css for whatever, just track down my template and add what you want at the end. EDIT: Yeah, lol, maybe not... \IPS\Output::i()->headCss it is so no one has to make a dev folder for this thing... True story: IPS uses the head css method themselves exactly one time throughout all of their apps. 21. Oh, and on the constants toggle popup I list every IN_DEV constant that this handles - just hover over them for a tooltip that explains what they do. I can't really imagine anything else that's gonna get added to this plugin so consider this a wrap, minus future compatibility fixes. You can suggest something but I'm struggling to see what anything could be... 100% free as always but I do get thirsty from time to time... Tip jar open via the PayPal with scott@all-astronauts.com Invision Community 4.2.x devs can use version 1.1 Invision Community 4.3.x and 4.4.x devs can use version 1.1 through version 3. Version 4 is quick compatibility fix for Invision Community 4.5 Version 5 is the first deluxe version, the one that includes the extra constants toggling, and is for Invision Community 4.5 Version 5.1 is me removing the CSS template insert in favor of \IPS\Output::i()->headCss so no need for a dev folder for this derpy thing when you toggle dev mode on... Автор Sipsb Добавлен 07.02.2018 Категория Ресурсы для разработчиков Разработчик All Astronauts Локализация EN Совместим 4.34.4 1 Ссылка на комментарий
Рекомендуемые сообщения
Создайте учетную запись или войдите, чтобы комментировать
Вы должны быть пользователем, чтобы оставить комментарий
Создать аккаунт
Зарегистрируйтесь для получения аккаунта. Это просто!
Зарегистрировать аккаунтВойти
Уже зарегистрированы? Войдите здесь.
Войти