Exemplo n.º 1
0
    protected function show_editor()
    {
        //$container_width = $this->get_ure_container_width();
        $this->show_message($this->notification);
        if ($this->ure_object == 'user') {
            $view = new URE_User_View();
        } else {
            $this->set_current_role();
            $view = new URE_Role_View();
            $view->role_edit_prepare_html();
        }
        ?>
        <div class="wrap">
            <h1><?php 
        _e('User Role Editor', 'user-role-editor');
        ?>
</h1>
            <div id="ure_container">                
                <div id="user_role_editor" class="ure-table-cell" >
                    <form id="ure_form" method="post" action="<?php 
        echo URE_WP_ADMIN_URL . URE_PARENT . '?page=users-' . URE_PLUGIN_FILE;
        ?>
" >			
                        <div id="ure_form_controls">
        <?php 
        $view->display();
        wp_nonce_field('user-role-editor', 'ure_nonce');
        ?>
                            <input type="hidden" name="action" value="update" />
                        </div>      
                    </form>		      
<?php 
        if (!$this->is_pro()) {
            $view->advertise_pro();
        }
        ?>
                </div>
<?php 
        if (!$this->is_pro()) {
            $view->advertise_commercials();
        }
        $view->display_edit_dialogs();
        do_action('ure_dialogs_html');
        $view->output_confirmation_dialog();
        ?>
            
            </div>
        </div>
        <?php 
    }
    public function settings() {
        $settings_capability = $this->lib->get_settings_capability();
        if (!current_user_can($settings_capability)) {
            wp_die(esc_html__( 'You do not have sufficient permissions to manage options for User Role Editor.', 'user-role-editor' ));
        }
        $action = $this->get_settings_action();
        switch ($action) {
            case 'ure_settings_update':
                $this->update_general_options();
                break;
            case 'ure_addons_settings_update':
                $this->update_addons_options();
                break;
            case 'ure_settings_ms_update':
                $this->update_multisite_options();
                break;
            case 'ure_default_roles_update':
                $this->update_default_roles();
            case 'show':
            default:                
            ;
        } // switch()
                        
        if (defined('URE_SHOW_ADMIN_ROLE') && (URE_SHOW_ADMIN_ROLE == 1)) {
            $show_admin_role = 1;
        } else {
            $show_admin_role = $this->lib->get_option('show_admin_role', 0);
        }
        $caps_readable = $this->lib->get_option('ure_caps_readable', 0);
        $show_deprecated_caps = $this->lib->get_option('ure_show_deprecated_caps', 0);
        $confirm_role_update = $this->lib->get_option('ure_confirm_role_update', 1);
        $edit_user_caps = $this->lib->get_option('edit_user_caps', 1);
        $multisite = $this->lib->get('multisite');
        if ($multisite) {
            $allow_edit_users_to_not_super_admin = $this->lib->get_option('allow_edit_users_to_not_super_admin', 0);
        } else {
            $count_users_without_role = $this->lib->get_option('count_users_without_role', 0);
        }
        
        $this->lib->get_default_role();
        $view = new URE_Role_View();
        $view->role_default_prepare_html(0);
        
        $ure_tab_idx = $this->lib->get_request_var('ure_tab_idx', 'int');
                
        do_action('ure_settings_load');        

        if ($multisite && is_network_admin()) {
            $link = 'settings.php';
        } else {
            $link = 'options-general.php';
        }
        
        $active_for_network = $this->lib->get('active_for_network');
        $license_key_only = $multisite && is_network_admin() && !$active_for_network;

        
        require_once(URE_PLUGIN_DIR . 'includes/settings-template.php');
    }