} ?> <label for="<?php echo $cap_id; ?> " title="<?php echo $capability[$capIndAlt]; ?> " <?php echo $labelStyle; ?> ><?php echo $capability[$capInd]; ?> </label> <?php echo ure_capability_help_link($capability['inner']); ?> <br/> <?php $quantInCell++; } if ($quantInCell >= $quantInColumn) { $quantInCell = 0; echo '</td> <td style="vertical-align:top;">'; } } ?> </td> </tr> </table>
/** * 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' } }