
A simple PHP( class / interface) auto-load manager for WordPress, built with PHP-Autoload-Manager by http://bashar.alfallouji.com/php-autoload-manager/. AL-Manager allows you to easily extend the power of WordPress using Object Oriented PHP, classes and libraries. Now you can easily add some of the great PHP classes available on the web to you projects.
I built a class after reading post on the web about optimizing WordPress plugins and themes, as proof of concept to demonstrate the possibility of adding and extending WP by leveraging “OO PHP”, making it easier to reuse code and reduce a lot of the code repetition that can sometimes be found in WP.
The first release is really simple and includes a Paypal and Facebook php library, I plan to add more soon. It uses the WP filter function (alm_filter) to add class paths to the auto-loader.
Download the class : https://github.com/shawnsandy/AL-MANAGER
To use, install/upload and activate the plugin, use WP add_filter() function (alm_filter) to add your class folder check the sample code below.
/**
* --- AL-Manager -----
*/
//check if ALM is loaded and add filter
if(class_exists('al_manager')) add_filter('alm_filter', 'al_paths');
//sample fliter adds 'inc' dir to the autoload paths
function al_paths($folders) {
$p = array(your_DIR . '/inc/');
$folders = array_merge($p, $folders);
return $folders;
}
//use any class in the folder no need to add includes
$class = new Your_class_name();
$class = new Another_class_name();
//end********************
A simple PHP classes / interface auto-load manager for wordpress, built with PHP-Autoload-Manager by http://bashar.alfallouji.com/php-autoload-manager/. AL-Manager allows you to easily extend the power of WordPress using Object Oriented PHP, classes and libraries. =Developer Info = The AutoLoad Manager is a generic autoloader that can be used with any PHP framework or library. Using the PHP tokenizer mechanism, it will parse folder(s) and discover the different classes and interfaces defined. The big advantage of using this autoloadManager is that it will allow you to implement whatever naming rules you want and may have mutliple classes in one file (if you want to have a such feature). So basically, you don’t have anymore to implement some complex naming rules between the filename and the classname. You may organize the way you want your API (may have as many subfolders as you want, you may have multiple API folders, etc.). (http://bashar.alfallouji.com/php-autoload-manager/).”
More info will be available soon, stay tuned!
