Beispiel #1
0
    echo $hint;
    ?>
"><?php 
    _e('Apply to All Sites', 'ure');
    ?>
</label>
              </div>
<?php 
}
?>
<br/><br/><hr/>
        <table class="form-table" style="clear:none;" cellpadding="0" cellspacing="0">
          <tr>
            <td style="vertical-align:top;">
<?php 
$deprecatedCaps = ure_get_deprecated_caps();
$quant = count($ure_fullCapabilities);
$quantInColumn = (int) $quant / 3;
$quantInCell = 0;
foreach ($ure_fullCapabilities as $capability) {
    if (!$ure_show_deprecated_caps && isset($deprecatedCaps[$capability['inner']])) {
        $input_type = 'hidden';
    } else {
        $input_type = 'checkbox';
    }
    if (isset($deprecatedCaps[$capability['inner']])) {
        $labelStyle = 'style="color:#BBBBBB;"';
    } else {
        $labelStyle = '';
    }
    $checked = '';
Beispiel #2
0
/**
 * output HTML-code for capabilities list
 * @global boolean $ure_currentRole
 * @global type $ure_show_deprecated_caps
 * @global boolean $ure_roles
 * @global boolean $ure_fullCapabilities
 * @global type $ure_caps_readable
 * @param boolean $core - if true, then show WordPress core capabilities, else custom (plugins and themes created)
 * @param boolean $for_role - if true, it is role capabilities list, else - user specific capabilities list
 */
function ure_show_capabilities($core = true, $for_role = true)
{
    global $ure_currentRole, $ure_show_deprecated_caps, $ure_roles, $ure_fullCapabilities, $ure_caps_readable, $ure_userToEdit;
    $onclick_for_admin = '';
    if (!(is_multisite() && is_super_admin())) {
        // do not limit SuperAdmin for multi-site
        if ($core && 'administrator' == $ure_currentRole) {
            $onclick_for_admin = 'onclick="turn_it_back(this)"';
        }
    }
    if ($core) {
        $quant = count(ure_getBuiltInWPCaps());
        $deprecatedCaps = ure_get_deprecated_caps();
    } else {
        $quant = count($ure_fullCapabilities) - count(ure_getBuiltInWPCaps());
        $deprecatedCaps = array();
    }
    $quantInColumn = (int) $quant / 3;
    $printed_quant = 0;
    foreach ($ure_fullCapabilities as $capability) {
        if ($core) {
            if (!$capability['wp_core']) {
                // show WP built-in capabilities 1st
                continue;
            }
        } else {
            if ($capability['wp_core']) {
                // show plugins and themes added capabilities
                continue;
            }
        }
        if (!$ure_show_deprecated_caps && isset($deprecatedCaps[$capability['inner']])) {
            $hidden_class = 'class="hidden"';
        } else {
            $hidden_class = '';
        }
        if (isset($deprecatedCaps[$capability['inner']])) {
            $labelStyle = 'style="color:#BBBBBB;"';
        } else {
            $labelStyle = '';
        }
        $checked = '';
        $disabled = '';
        if ($for_role) {
            if (isset($ure_roles[$ure_currentRole]['capabilities'][$capability['inner']]) && !empty($ure_roles[$ure_currentRole]['capabilities'][$capability['inner']])) {
                $checked = 'checked="checked"';
            }
        } else {
            if (user_can($ure_userToEdit->ID, $capability['inner'])) {
                $checked = 'checked="checked"';
                if (!isset($ure_userToEdit->caps[$capability['inner']])) {
                    $disabled = 'disabled="disabled"';
                }
            }
        }
        $cap_id = str_replace(' ', URE_SPACE_REPLACER, $capability['inner']);
        echo '<input type="checkbox" name="' . $cap_id . '" id="' . $cap_id . '" value="' . $capability['inner'] . '" ' . $hidden_class . ' ' . $checked . ' ' . $disabled . ' ' . $onclick_for_admin . ' />';
        if (empty($hidden_class)) {
            if ($ure_caps_readable) {
                $capInd = 'human';
                $capIndAlt = 'inner';
            } else {
                $capInd = 'inner';
                $capIndAlt = 'human';
            }
            echo '<label for="' . $cap_id . '" title="' . $capability[$capIndAlt] . '" ' . $labelStyle . ' > ' . $capability[$capInd] . '</label> ' . ure_capability_help_link($capability['inner']) . '<br/>';
            $printed_quant++;
            if ($printed_quant >= $quantInColumn) {
                $printed_quant = 0;
                echo '</td>
					    <td style="vertical-align:top;">';
            }
        }
        // if ('hidden'
    }
}