function load_ub_modules()
{
    $modules = get_ub_activated_modules();
    if (is_dir(ub_files_dir('modules'))) {
        if ($dh = opendir(ub_files_dir('modules'))) {
            $ub_modules = array();
            while (($module = readdir($dh)) !== false) {
                if (substr($module, -4) == '.php') {
                    $ub_modules[] = $module;
                }
            }
            closedir($dh);
            sort($ub_modules);
            $ub_modules = apply_filters('ultimatebranding_available_modules', $ub_modules);
            foreach ($ub_modules as $ub_module) {
                if (in_array($ub_module, $modules)) {
                    include_once ub_files_dir('modules/' . $ub_module);
                }
            }
        }
    }
    do_action('ultimatebranding_modules_loaded');
}
Exemplo n.º 2
0
        function handle_main_page()
        {
            global $action, $page;
            wp_reset_vars(array('action', 'page'));
            $tab = isset($_GET['tab']) ? $_GET['tab'] : '';
            if (empty($tab)) {
                $tab = 'dashboard';
            }
            // Get the activated modules
            $modules = get_ub_activated_modules();
            ?>
            <div class='wrap nosubsub'>
                <?php 
            $menus = array();
            $menus['dashboard'] = __('Dashboard', 'ub');
            foreach ($modules as $key => $title) {
                switch ($key) {
                    case 'favicons.php':
                    case 'login-image.php':
                        $menus['images'] = __('Images', 'ub');
                        break;
                    case 'custom-admin-bar.php':
                        $menus['adminbar'] = __('Admin Bar', 'ub');
                        break;
                    case 'admin-help-content.php':
                        $menus['help'] = __('Help Content', 'ub');
                        break;
                    case 'global-footer-content.php':
                    case 'admin-footer-text.php':
                        $menus['footer'] = __('Footer Content', 'ub');
                        break;
                    case 'global-header-content.php':
                        $menus['header'] = __('Header Content', 'ub');
                        break;
                        //case 'admin-menu.php': $menus['admin_menu'] = __('Admin Menu', 'ub');
                        break;
                    case 'custom-dashboard-welcome.php':
                    case 'remove-wp-dashboard-widgets.php':
                    case 'rebranded-meta-widget.php':
                        $menus['widgets'] = __('Widgets', 'ub');
                        break;
                    case 'remove-permalinks-menu-item.php':
                        $menus['permalinks'] = __('Permalinks Menu', 'ub');
                        break;
                    case 'site-generator-replacement.php':
                        $menus['sitegenerator'] = __('Site Generator', 'ub');
                        break;
                    case 'site-wide-text-change.php':
                        $menus['textchange'] = __('Text Change', 'ub');
                        break;
                    case 'custom-login-css.php':
                    case 'custom-admin-css.php':
                        $menus['css'] = __('CSS', 'ub');
                        break;
                    case 'custom-email-from.php':
                        $menus['from_email'] = __('E-mail From', 'ub');
                        break;
                    case 'ultimate-color-schemes.php':
                        $menus['ultimate-color-schemes'] = __('Ultimate Color Schemes', 'ub');
                        break;
                }
            }
            $menus = apply_filters('ultimatebranding_settings_menus', $menus);
            ?>

                <h3 class="nav-tab-wrapper">
                    <?php 
            foreach ($menus as $key => $menu) {
                ?>
                        <a class="nav-tab<?php 
                if ($tab == $key) {
                    echo ' nav-tab-active';
                }
                ?>
" href="admin.php?page=<?php 
                echo $page;
                ?>
&amp;tab=<?php 
                echo $key;
                ?>
"><?php 
                echo $menu;
                ?>
</a>
                        <?php 
            }
            ?>
                </h3>

                <?php 
            switch ($tab) {
                case 'dashboard':
                    $this->show_dashboard_page();
                    break;
                case 'images':
                    $this->handle_images_panel();
                    break;
                case 'adminbar':
                    $this->handle_adminbar_panel();
                    break;
                case 'help':
                    $this->handle_help_panel();
                    break;
                case 'footer':
                    $this->handle_footer_panel();
                    break;
                case 'header':
                    $this->handle_header_panel();
                    break;
                case 'widgets':
                    $this->handle_widgets_panel();
                    break;
                case 'permalinks':
                    $this->handle_permalinks_panel();
                    break;
                case 'sitegenerator':
                    $this->handle_sitegenerator_panel();
                    break;
                case 'textchange':
                    $this->handle_textchange_panel();
                    break;
                case 'css':
                    $this->handle_css_panel();
                    break;
                case 'from_email':
                    $this->handle_email_from_panel();
                    break;
                case 'admin_menu':
                    $this->handle_admin_menu_panel();
                    break;
                case 'ultimate-color-schemes':
                    $this->handle_ultimate_color_schemes_panel();
                    break;
                default:
                    do_action('ultimatebranding_settings_menu_' . $tab);
                    break;
            }
            ?>

            </div> <!-- wrap -->
            <?php 
        }