AL Manager : WordPress Plugin


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!

Cleared
Cleared
Cleared
Cleared

Meta_caps and Post_Types

WP custom post types gives you some great power but with that power comes even greater responsibilities so you may not want to give users access to all custom post types. Fortunately you can do this when registering your post types register_post_types()  by enabling the map_meta_cap argument setting it to true and adding a capability_type other that post, lines highlighted in the code.

  $args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true,
    'show_in_menu' => true,
    'query_var' => true,
    'rewrite' => true,
    'capability_type' => 'books',
    'map_meta_cap' => true,
    'has_archive' => true,
    'hierarchical' => false,
    'menu_position' => null,
    'supports' => array('title','editor','author','thumbnail','excerpt','comments')
  );
  register_post_type('book',$args);

Wait you are not completed yet, you will need to set who can use your roles I use the members plugin by Justin Tadlock. Go to users roles and add new roles edit_books, publish_books etc (click image), you will see that the options are added using the _books (edit_books, publish_books) to define capabilities of the role.

More info here:

Codex : http://codex.wordpress.org/Function_Reference/register_post_type

Justin Tadlock on meta post capabilities : http://justintadlock.com/archives/2010/07/10/meta-capabilities-for-custom-post-types

-Shawn.

Cleared
Cleared

Why I don’t run a ton of WordPress Plugins!

 

I don’t run a ton of  WordPress plugins I believe it’s bad, bad in practice, bad by design, bad for the user, bad, bad, bad!!! There, I got it off my chest!!! A Ryan Imel article over on WP Candy Stop telling users they shouldn’t be running very many pluginsgot me thinking that maybe I was wrong about the ton of plugin thing, after all he is a respected voice in the WP community and by 6.00pm the afternoon there were about 60 comments on the post most in agreement with his opinion.

WordPress has evolved into a pretty stable and very efficient platform there is no doubting that, unfortunately plugin and theme stability and efficiency is simply not at the same place. The WordPress development process is very well managed and supported by the community, plugins aren’t. In an ideal world there would be one plugin for every task and that plugin would be supported by the community, bicycles would fly and I wouldn’t be writing this post.

Just because you can doesn’t mean you should…

I feel like my Dad giving me a lecture “Son just because you can doesn’t mean you should”. Is WordPress capable? Yes! Should you run a ton of plugins that’s your choice, I don’t and I don’t encourage users to do it either.

I put a plugin through the paces before I install them on a live site, users usually don’t. By practice I:

  • test every plugin before I install for both application (WordPress), version and theme compatibility
  • run them on my development server
  • ensure that it does everything I want, if it doesn’t I get one that does.
  • check the to see that it is updated regularly.
  • look for support and user guides
  • check to see how well the code is written
  • check popularity of the plugin…

I  was taught and believe that design is a process of function; good design not only looks appealing it has function and purpose, a good design seeks to remove unnecessary function and places importance on objectives, resulting in great viewer / reader experiences both on the front and back-end of the application.

Finally Ryan’s position wrongly assumes that every user will recognize the difference between a good or bad plugin and it is here that I feel he really got it wrong,the average WordPress user does not. I really try not to generalize,  it is safer to provide users with as much information as possible to make informed decisions.

Here some additional reading:

http://www.wpbeginner.com/wp-tutorials/how-wordpress-plugins-affect-your-sites-load-time/

http://www.wptavern.com/plugin-quality-not-plugin-quantity

 

Cleared
Cleared
Cleared

Adobe Carousel???

Abobe Carousel is being billed as LightRoom for all devices, and from what I can tell it looks, feels and behaves like lightroom. I’m puzzled though why would adobe launch a lightroom like product at half the cost of it parent version. Whats disturbing though is the fact that they did a Mac version first, as a PC user and Adobe supporter I take offense that Adobe seems to be kissing up  the Fanboys.

 

 

Cleared