Last active
August 29, 2015 13:56
-
-
Save cfoellmann/8832520 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PluginNameGrunt { | |
/** | |
* PSR-0 compliant autoloader to load classes as needed. | |
* | |
* @static | |
* @access public | |
* @since 1.0.0 | |
* | |
* @param string $classname The name of the class | |
* @return null Return early if the class name does not start with the correct prefix | |
*/ | |
public static function autoload( $classname ) { | |
if ( 'WPCollab_{%= title_camel_uppercase %}' !== mb_substr( $classname, 0, 19 ) ) { // change length | |
return; | |
} | |
$class = substr( $classname, 9 ); | |
$filename = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . str_replace( '_', DIRECTORY_SEPARATOR, $class ) . '.php'; | |
if ( file_exists( $filename ) ) { | |
require $filename; | |
} | |
} // END autoload() | |
} // END class PluginClassGrunt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PluginName { | |
/** | |
* PSR-0 compliant autoloader to load classes as needed. | |
* | |
* @static | |
* @access public | |
* @since 1.0.0 | |
* | |
* @param string $classname The name of the class | |
* @return null Return early if the class name does not start with the correct prefix | |
*/ | |
public static function autoload( $classname ) { | |
if ( 'WPCollab_PluginName' !== mb_substr( $classname, 0, 19 ) ) { | |
return; | |
} | |
$class = substr( $classname, 9 ); | |
$filename = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . str_replace( '_', DIRECTORY_SEPARATOR, $class ) . '.php'; | |
if ( file_exists( $filename ) ) { | |
require $filename; | |
} | |
} // END autoload() | |
} // END class PluginClass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment