Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
CodingJungle Posted November 23, 2018 Posted November 23, 2018 I'm back to make another totally unreasonable request! 😛 as you might know, some of us dev's use dirty taboo things called IDE's, and love their totally useless features like automatic imports, autocomplete/suggestions/etc. the issue i have and would love to see improved, is a slight tweak to the hook system, to allow me to better generate proxy files. currently you use _HOOK_CLASS_, which is great cause it doesn't toss errors up in the IDE, however, they all get this, so there is no easy way to generate a proxy file for _HOOK_CLASS_. I can easily generate them, but the problem becomes my IDE complains about multiple definitions and then throws its hands up in futility and tells me to GTFO. My suggestion would be to psuedo namespace hook, i believe this can be achieved with extremely limited intrusion to the existing code and remain backwards compatible. example: allow me to append the hooks class to _HOOKS_CLASS_. filename: BrandonMakeThisHappen.php Content: //<?php /* To prevent PHP errors (extending class does not exist) revealing path */ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) ) { exit; } class myapp_hook_BrandonMakeThisHappen extends _HOOK_CLASS_myapp_hook_BrandonMakeThisHappen { protected static function baseJs() { parent::baseJs(); Output::i()->jsFiles = array_merge( Output::i()->jsFiles, Output::i()->js( 'front_myapp.js', 'myapp', 'front' ) ); } } and then in the init.php line 457 change: $contents = "namespace {$namespace}; ". str_replace( '_HOOK_CLASS_', $realClass, file_get_contents( ROOT_PATH . '/' . $data['file'] ) ); to: $contents = "namespace {$namespace}; ". str_replace( array( '_HOOK_CLASS_', '_HOOK_CLASS_'.$data['class'] ), $realClass, file_get_contents( ROOT_PATH . '/' . $data['file'] ) ); this way either are replaced at runtime, backwards compatibility is maintained, and it requires hardly nothing to implement! it is the best of both worlds really, ones who don't use useless IDE's will never notice a difference, and the heathens that do, will be thankful! so @Daniel F @bfarber @Lindy (you guys need code names, lindy is the only one that is easy to find in the @mentions list!), lets make this happen! 🙂Â
Recommended Posts
Archived
This topic is now archived and is closed to further replies.