예제 #1
0
 /**
  * active module
  * @param $args
  * @param $assoc_args
  * @cmd wp hw-module active xx
  */
 public function activate($args, $assoc_args)
 {
     //note run any code from this context is make code of site fully execute such as wp ajax
     $name = $this->get_cmd_arg($assoc_args, 'name');
     //get module name
     if ($name) {
         #hw_activate_modules(array($name));
         $plugin_table = new HW_TGMPA_List_Table();
         $plugin_table->process_bulk_action(array($name), 'tgmpa-bulk-activate');
     }
     $this->success(' activate module ' . $name . ' successful.');
 }
        /**
         * install module page callback
         */
        public function hw_install_module_page()
        {
            #var_dump('hw_install_module_page');
            // Store new instance of plugin table in object.
            $plugin_table = new HW_TGMPA_List_Table();
            // Return early if processing a plugin installation action.
            if (isset($_POST['action']) && in_array($_POST['action'], array('tgmpa-bulk-activate', 'tgmpa-bulk-deactivate')) && $plugin_table->hw_process_bulk_actions() || $this->hw_do_module_install()) {
                return;
            }
            hw_get_modules(true);
            //refresh plugins list
            ?>
            <div class="tgmpa wrap">
                <h2><?php 
            echo esc_html(get_admin_page_title());
            ?>
</h2>
                <?php 
            $plugin_table->prepare_items();
            ?>

                <?php 
            if (isset($this->message)) {
                echo wp_kses_post($this->message);
            }
            ?>

                <form id="tgmpa-plugins" action="" method="post">
                    <input type="hidden" name="tgmpa-page" value="<?php 
            echo $this->menu;
            ?>
" />
                    <?php 
            //searchbox
            $plugin_table->search_box('Tìm kiếm', 'search_id');
            ?>
                    <?php 
            $plugin_table->display();
            ?>
                </form>

            </div>
        <?php 
        }