'Search', 'wd_asl' => 'Search', ); /** * Array of already registered shortcodes * * @var array */ private static $registered = array(); /** * Registers all the handlers from the $actions variable */ public static function registerAll() { foreach ( self::$shortcodes as $shortcode => $handler ) { self::register($shortcode, $handler); } } /** * Get all the queued handlers * * @return array */ public static function getAll() { return array_keys(self::$shortcodes); } /** * Get all the already registered handlers * * @return array */ public static function getRegistered() { return self::$registered; } /** * Registers a filter with the handler class name. * * @param string $shortcode * @param string|array $handler * @return bool */ public static function register( $shortcode, $handler ) { if ( is_array($handler) ) { $class = 'WD_ASL_' . $handler[0] . '_Shortcode'; $handle = $handler[1]; } else { $class = 'WD_ASL_' . $handler . '_Shortcode'; $handle = 'handle'; } if ( !class_exists($class) ) { return false; } add_shortcode($shortcode, array( call_user_func(array( $class, 'getInstance' )), $handle )); self::$registered[] = $shortcode; return true; } /** * Deregisters a shortcode * * @param string $shortcode * @return bool */ public static function deregister( $shortcode ) { // Check if it is already registered if ( isset(self::$registered[ $shortcode ]) ) { remove_shortcode( $shortcode ); } elseif ( isset(self::$shortcodes[ $shortcode ]) ) { unset(self::$shortcodes[ $shortcode ]); } return true; } } }