示例#1
0
        /**
         * 	Check plugins those will be used if they are active or not
         */
        function load_modules() {

            // Load our remaining modules here
            foreach ($this->modules as $module => $plugin) {
                if (ub_is_active_module($module)) {
                    ub_load_single_module($module);
                }
            }
        }
        function show_module_status()
        {
            global $action, $page;
            ?>
            <table class='widefat'>
                <thead>
                <th><?php 
            _e('Available Modules', 'ub');
            ?>
</th>
                <th><a href='<?php 
            echo wp_nonce_url("?page=" . $page . "&amp;action=enableallmodules", 'enable-all-modules');
            ?>
'><?php 
            _e('Enable', 'ub');
            ?>
</a> / <a href='<?php 
            echo wp_nonce_url("?page=" . $page . "&amp;action=disableallmodules", 'disable-all-modules');
            ?>
'><?php 
            _e('Disable All', 'ub');
            ?>
</a></th>
            </thead>
            <tfoot>
            <th><?php 
            _e('Available Modules', 'ub');
            ?>
</th>
            <th><a href='<?php 
            echo wp_nonce_url("?page=" . $page . "&amp;action=enableallmodules", 'enable-all-modules');
            ?>
'><?php 
            _e('Enable', 'ub');
            ?>
</a> / <a href='<?php 
            echo wp_nonce_url("?page=" . $page . "&amp;action=disableallmodules", 'disable-all-modules');
            ?>
'><?php 
            _e('Disable All', 'ub');
            ?>
</a></th>
            </tfoot>
            <tbody>
                <?php 
            if (!empty($this->modules)) {
                $default_headers = array('Name' => 'Plugin Name', 'Author' => 'Author', 'Description' => 'Description', 'AuthorURI' => 'Author URI');
                foreach ($this->modules as $module => $plugin) {
                    $module_data = get_file_data(ub_files_dir('modules/' . $module), $default_headers, 'plugin');
                    // deactivate any conflisting plugins
                    if (in_array($module, array_keys($this->plugin_msg))) {
                        $this->deactivate_module($module);
                    }
                    if (ub_is_active_module($module)) {
                        ?>
                            <tr class='activemodule'>
                                <td>
                                    <?php 
                        echo $module_data['Name'];
                        ?>
                                </td>
                                <td>
                                    <a href='<?php 
                        echo wp_nonce_url("?page=" . $page . "&amp;action=disable&amp;module=" . $module . "", 'disable-module-' . $module);
                        ?>
' class='disblelink'><?php 
                        _e('Disable', 'ub');
                        ?>
</a>
                                </td>
                            </tr>
                            <?php 
                    } else {
                        ?>
                            <tr class='inactivemodule'>
                                <td>
                                    <?php 
                        echo $module_data['Name'];
                        ?>
                                </td>
                                <td>
                                    <?php 
                        if (!in_array($module, array_keys($this->plugin_msg))) {
                            ?>
                                        <a href='<?php 
                            echo wp_nonce_url("?page=" . $page . "&amp;action=enable&amp;module=" . $module . "", 'enable-module-' . $module);
                            ?>
' class='enablelink'><?php 
                            _e('Enable', 'ub');
                            ?>
</a>
                                    <?php 
                        }
                        ?>
                                </td>
                            </tr>
                            <?php 
                    }
                }
            } else {
                ?>
                    <tr>
                        <td colspan='2'><?php 
                _e('No modules avaiable.', 'ub');
                ?>
</td>
                    </tr>
                    <?php 
            }
            ?>
            </tbody>
            </table>

            <?php 
        }