Archive for the 'Resources' Category

PHPDocs and PHPXref for MyBB

If you are a developer of plugins or modifications for MyBB, or you are studying the MyBB code for fun, two resources may be of use to you.

PHPDocs

The generated PHPDocs provided by MyBB Central is a quick and easy way to find out the description of a particular function, its parameters, and the file in which the function is defined. The PHPDocs also give an overview of each class listing what variables and methods are in each.

PHPXref

The documentation generated from the PHPXref takes PHPDocs up a notch. This is provided both by MyBB Fans and by MyBBoard.de. You will be able to find the same function listing and description (by clicking Function List at the top of the index page, selecting a function, and then clicking the filename under “Definition”), the class listing and description (by clicking Class List at the top of the index page, selecting a class, then clicking the filename under “Definition”). However, PHPXref can go far beyond that.

In any function documentation, you will see a “X-Ref” link. Clicking on it will lead you to a list of locations where the function is used. Clicking on the line number on any of these “references”, you will be shown the exact line within the source code of the page where it is used. This is beneficial if you are looking for an example of how to utilize a function or class.

PHPXref also comes with a handy search function which lets you quickly find the information page for a particular class, function, variable or constant. The search can be found at the top-right of each page. The downside of this is that you must know the exact name of what you are looking for, or else the server will spit out an ugly error 404 message.

However, PHPXref also is extremely helpful if you are just browsing the MyBB code. If you notice on the left frame, there is an interactive file listing. Clicking on any file will show you an overview of the file, and anything it defines. Clicking on the “Source View” page will bring you to the actual source code of the page. Of course it is syntax-highlighted and all that, but if you hover over any function or constant, a popup will show you a description (if it is a function), where it is defined, and where it is referenced. Clicking on variables will show you a listing of where the variables are defined and referenced, as we’ve seen before.

PHPDocs and PHPXref go hand in hand if you are interested in the MyBB source code. PHPDocs provides simple documentation for functions and classes, and PHPXref provides you with further information on where things are defined and referenced.