Pressbooks\Pressbooks::allowedRootThemes PHP Метод

allowedRootThemes() публичный Метод

Used by add_filter( 'allowed_themes' ) Will hide any theme not in ./themes-root/* with exceptions for 'pressbooks-root', the PB_ROOT_THEME constant, and $GLOBALS['PB_SECRET_SAUCE']['ROOT_THEMES'][]
public allowedRootThemes ( array $themes ) : array
$themes array
Результат array
    function allowedRootThemes($themes)
    {
        $exceptions = array('pressbooks-root');
        if (defined('PB_ROOT_THEME')) {
            $exceptions[] = PB_ROOT_THEME;
        }
        if (isset($GLOBALS['PB_SECRET_SAUCE']['ROOT_THEMES'])) {
            if (is_array($GLOBALS['PB_SECRET_SAUCE']['ROOT_THEMES'])) {
                $exceptions = array_merge($exceptions, $GLOBALS['PB_SECRET_SAUCE']['ROOT_THEMES']);
            } else {
                $exceptions[] = $GLOBALS['PB_SECRET_SAUCE']['ROOT_THEMES'];
            }
        }
        $compare = search_theme_directories();
        foreach ($compare as $key => $val) {
            if (!in_array($key, $exceptions) && untrailingslashit($val['theme_root']) != PB_PLUGIN_DIR . 'themes-root') {
                unset($themes[$key]);
            }
        }
        return $themes;
    }