I announce that I cease all development and activity in the programming universe indefinitely. My career has reached the turning point I was not expecting for at least another year, leaving me highly off guard and without laid-out plans for this hobby's continuity. I have begun a 5-year residency program in Neurosurgery which is clearly not compatible, time-wise, with programming.
I gave in all my passion for developing, and you gave me back your loyalty and trust, even when I did not deserve that much. Now it is the time for payback. I release all my present and past work as Open Source software, in the hope some talented developer will continue maintaining and expanding my vision of a modern, sleek forum software. The intrinsic flexibility of MyBB is the true hidden gem of an otherwise outdated codebase; I do hope the project can continue and be updated complying to the latest coding standards.
I hereby thank Euan, kawaii, andrewjs18, Ben, Matt, Omar G., effone, Eric J., Devilshakerz, Wildcard, JordanMussi and all the other team members I have had the opportunity to work with when I was a MyBB team member. I thank Tomm M, my mentor, who inspired me to pick up coding with his piece-of-art plugins. And finally, I thank all of you MyBBoost subscribers who have helped me getting through my toughest university years economically.
Yours sincerely, Filippo
Whether you are on MyBB 1.6 or on the latest version, you can integrate this script in your plugins and instantaneously get all the available hooks with additional informations like the precise code line and eventual arguments passed. The purpose of having an ordered-by-hooksname list is that hooks might be run multiple times in different scripts, even in third party plugins, so you exactly know where and how many times a hook is run.function get_hooks($order_by = 'filename')
{
// Set up the recursive iterator
$dir = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(MYBB_ROOT, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST,
RecursiveIteratorIterator::CATCH_GET_CHILD
);
$order_by_filename = $order_by_hookname = [];
// Iterate through all directories
foreach ($dir as $fileinfo) {
$filename = $fileinfo->getFilename();
$pathname = $fileinfo->getPathname();
$clean_pathname = str_replace(MYBB_ROOT, '', $pathname);
// Check if this file is a valid .php file
if (pathinfo($filename, PATHINFO_EXTENSION) == 'php') {
$grep_matches = [];
// Match with a low-memory bash grep command every hook run in the current file
exec('grep -n ' . escapeshellarg('$plugins->run_hooks').' ' . $pathname, $grep_matches);
// Tidy the results given by grep, filtering line number, hook's name and eventual arguments
preg_match_all('#(\d+):(?:[^"\']*)["\']([^"\']*)["\'](?:\)|,\s*([^)]*))#im', implode("#", $grep_matches), $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
// Hooks ordered by filename (eg.: inc/functions.php => pre_output_page)
$order_by_filename[$clean_pathname][$match[1]] = [
'name' => $match[2]
];
// Deal with eventual arguments matched
if ($match[3]) {
$output[$clean_pathname][$match[1]]['arguments'] = $match[3];
}
// Hooks ordered by hookname (eg.: pre_output_page => inc/functions.php, inc/plugins/mycustomplugin.php)
$order_by_hookname[$match[2]][$match[1]] = $clean_pathname;
}
}
}
if ($order_by == 'filename') {
return (array) $order_by_filename;
}
else {
return (array) $order_by_hookname;
}
}