/** * @return WPLib_Theme_Base */ static function theme() { if (!self::$_theme) { foreach (WPLib::site_classes() as $class_name) { if (is_subclass_of($class_name, 'WPLib_Theme_Base')) { /* * Will create instance of FIRST class found that subclasses WPLib_Theme_Base. * That means sites should ONLY have ONE subclass of WPLib_Theme_Base. */ self::$_theme = new $class_name(); break; } } } if (!self::$_theme) { self::$_theme = new WPLib_Theme_Default(); } return self::$_theme; }
/** * @return string */ static function post_type_list_class() { $called_class = get_called_class(); if (!($post_type_list_class = WPLib::cache_get($cache_key = "list_post_type_class[{$called_class}]"))) { foreach (WPLib::site_classes() as $class_name) { if (is_subclass_of($class_name, 'WPLib_Post_List_Base') && ($post_type = static::get_constant('POST_TYPE', $class_name))) { $post_type_list_class = $class_name; } } if (!$post_type_list_class) { $post_type_list_class = 'WPLib_Post_List_Default'; } WPLib::cache_get($cache_key, $post_type_list_class); } return $post_type_list_class; }