Skip to content

Instantly share code, notes, and snippets.

@scragz
Created January 17, 2011 04:08
Show Gist options
  • Save scragz/782480 to your computer and use it in GitHub Desktop.
Save scragz/782480 to your computer and use it in GitHub Desktop.
/**
* Theme/Plugin "activates" the plugin
* Allow designers/developers to choose what and how they use KST
*
* @since 0.1
*/
public static function init( $settings ) {
/**
* KST itself needs options so just require the class for everyone
* @see settings_core.php
*/
require_once KST_DIR_LIB . '/KST/Options.php';
require_once KST_DIR_LIB . '/KST/Doodad.php';
/* Make sure they set a 'prefix' in their setting array or give help */
if ( isset($settings['prefix']) ) { // Need an id to proceed
/* Define a variable variable constant for each doodad so they can reference their own object */
define($settings['prefix'], $settings['prefix']); // constant named by prefix with a value of it's own name
/* Create an object for each doodad (theme/plugin(s) to work with */
return new KST_Doodad( $settings );
} else { // Help them
exit('<h1>No "prefix" has been given in your settings array</h1><p>Make sure you have created a settings array with the required settings included</p>');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment