Skip to content

Instantly share code, notes, and snippets.

@iammerrick
Created January 17, 2011 21:32
Show Gist options
  • Save iammerrick/783524 to your computer and use it in GitHub Desktop.
Save iammerrick/783524 to your computer and use it in GitHub Desktop.
Party Foul?
<?php
/*
Plugin Name: Location
Description: Manage locations of restaurants, and the displaying of them.
Version: 1.0
Author: Riser Media
Author URI: http://www.risermedia.com
License: Commercial
*/
spl_autoload_register(
function($class)
{
/**
* Only autoload classes under the Location Namespace. This prevents it from trying to autoload WordPress classes or colliding with other plugins.
*
* @author Merrick Christensen
*/
if(preg_match('/^Location/', $class))
{
// Convert "\" namespace characters to folder references "/".
$file = __DIR__.'/'.str_replace('\\', '/', $class) . '.php';
// If it exists require it.
if(file_exists($file))
{
require_once $file;
}
}
}
);
new Location\vendor\ActiveRecord;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment