Commit 3417eb92 authored by John Punzalan's avatar John Punzalan

Add User Role Editor Plugin

parent 3486fc4f
/*! jQuery UI - v1.10.4 - 2014-01-18
* http://jqueryui.com
* Includes: jquery.ui.core.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css, jquery.ui.theme.css
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
/* Layout helpers
----------------------------------*/
.ui-helper-hidden {
display: none;
}
.ui-helper-hidden-accessible {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.ui-helper-reset {
margin: 0;
padding: 0;
border: 0;
outline: 0;
line-height: 1.3;
text-decoration: none;
font-size: 100%;
list-style: none;
}
.ui-helper-clearfix:before,
.ui-helper-clearfix:after {
content: "";
display: table;
border-collapse: collapse;
}
.ui-helper-clearfix:after {
clear: both;
}
.ui-helper-clearfix {
min-height: 0; /* support: IE7 */
}
.ui-helper-zfix {
width: 100%;
height: 100%;
top: 0;
left: 0;
position: absolute;
opacity: 0;
filter:Alpha(Opacity=0);
}
.ui-front {
z-index: 100;
}
/* Interaction Cues
----------------------------------*/
.ui-state-disabled {
cursor: default !important;
}
/* Icons
----------------------------------*/
/* states and images */
.ui-icon {
display: block;
text-indent: -99999px;
overflow: hidden;
background-repeat: no-repeat;
}
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.ui-resizable {
position: relative;
}
.ui-resizable-handle {
position: absolute;
font-size: 0.1px;
display: block;
}
.ui-resizable-disabled .ui-resizable-handle,
.ui-resizable-autohide .ui-resizable-handle {
display: none;
}
.ui-resizable-n {
cursor: n-resize;
height: 7px;
width: 100%;
top: -5px;
left: 0;
}
.ui-resizable-s {
cursor: s-resize;
height: 7px;
width: 100%;
bottom: -5px;
left: 0;
}
.ui-resizable-e {
cursor: e-resize;
width: 7px;
right: -5px;
top: 0;
height: 100%;
}
.ui-resizable-w {
cursor: w-resize;
width: 7px;
left: -5px;
top: 0;
height: 100%;
}
.ui-resizable-se {
cursor: se-resize;
width: 12px;
height: 12px;
right: 1px;
bottom: 1px;
}
.ui-resizable-sw {
cursor: sw-resize;
width: 9px;
height: 9px;
left: -5px;
bottom: -5px;
}
.ui-resizable-nw {
cursor: nw-resize;
width: 9px;
height: 9px;
left: -5px;
top: -5px;
}
.ui-resizable-ne {
cursor: ne-resize;
width: 9px;
height: 9px;
right: -5px;
top: -5px;
}
.ui-selectable-helper {
position: absolute;
z-index: 100;
border: 1px dotted black;
}
.ui-accordion .ui-accordion-header {
display: block;
cursor: pointer;
position: relative;
margin-top: 2px;
padding: .5em .5em .5em .7em;
min-height: 0; /* support: IE7 */
}
.ui-accordion .ui-accordion-icons {
padding-left: 2.2em;
}
.ui-accordion .ui-accordion-noicons {
padding-left: .7em;
}
.ui-accordion .ui-accordion-icons .ui-accordion-icons {
padding-left: 2.2em;
}
.ui-accordion .ui-accordion-header .ui-accordion-header-icon {
position: absolute;
left: .5em;
top: 50%;
margin-top: -8px;
}
.ui-accordion .ui-accordion-content {
padding: 1em 2.2em;
border-top: 0;
overflow: auto;
}
.ui-autocomplete {
position: absolute;
top: 0;
left: 0;
cursor: default;
}
.ui-button {
display: inline-block;
position: relative;
padding: 0;
line-height: normal;
margin-right: .1em;
cursor: pointer;
vertical-align: middle;
text-align: center;
overflow: visible; /* removes extra width in IE */
}
.ui-button,
.ui-button:link,
.ui-button:visited,
.ui-button:hover,
.ui-button:active {
text-decoration: none;
}
/* to make room for the icon, a width needs to be set here */
.ui-button-icon-only {
width: 2.2em;
}
/* button elements seem to need a little more width */
button.ui-button-icon-only {
width: 2.4em;
}
.ui-button-icons-only {
width: 3.4em;
}
button.ui-button-icons-only {
width: 3.7em;
}
/* button text element */
.ui-button .ui-button-text {
display: block;
line-height: normal;
}
.ui-button-text-only .ui-button-text {
padding: .4em 1em;
}
.ui-button-icon-only .ui-button-text,
.ui-button-icons-only .ui-button-text {
padding: .4em;
text-indent: -9999999px;
}
.ui-button-text-icon-primary .ui-button-text,
.ui-button-text-icons .ui-button-text {
padding: .4em 1em .4em 2.1em;
}
.ui-button-text-icon-secondary .ui-button-text,
.ui-button-text-icons .ui-button-text {
padding: .4em 2.1em .4em 1em;
}
.ui-button-text-icons .ui-button-text {
padding-left: 2.1em;
padding-right: 2.1em;
}
/* no icon support for input elements, provide padding by default */
input.ui-button {
padding: .4em 1em;
}
/* button icon element(s) */
.ui-button-icon-only .ui-icon,
.ui-button-text-icon-primary .ui-icon,
.ui-button-text-icon-secondary .ui-icon,
.ui-button-text-icons .ui-icon,
.ui-button-icons-only .ui-icon {
position: absolute;
top: 50%;
margin-top: -8px;
}
.ui-button-icon-only .ui-icon {
left: 50%;
margin-left: -8px;
}
.ui-button-text-icon-primary .ui-button-icon-primary,
.ui-button-text-icons .ui-button-icon-primary,
.ui-button-icons-only .ui-button-icon-primary {
left: .5em;
}
.ui-button-text-icon-secondary .ui-button-icon-secondary,
.ui-button-text-icons .ui-button-icon-secondary,
.ui-button-icons-only .ui-button-icon-secondary {
right: .5em;
}
/* button sets */
.ui-buttonset {
margin-right: 7px;
}
.ui-buttonset .ui-button {
margin-left: 0;
margin-right: -.3em;
}
/* workarounds */
/* reset extra padding in Firefox, see h5bp.com/l */
input.ui-button::-moz-focus-inner,
button.ui-button::-moz-focus-inner {
border: 0;
padding: 0;
}
.ui-datepicker {
width: 17em;
padding: .2em .2em 0;
display: none;
}
.ui-datepicker .ui-datepicker-header {
position: relative;
padding: .2em 0;
}
.ui-datepicker .ui-datepicker-prev,
.ui-datepicker .ui-datepicker-next {
position: absolute;
top: 2px;
width: 1.8em;
height: 1.8em;
}
.ui-datepicker .ui-datepicker-prev-hover,
.ui-datepicker .ui-datepicker-next-hover {
top: 1px;
}
.ui-datepicker .ui-datepicker-prev {
left: 2px;
}
.ui-datepicker .ui-datepicker-next {
right: 2px;
}
.ui-datepicker .ui-datepicker-prev-hover {
left: 1px;
}
.ui-datepicker .ui-datepicker-next-hover {
right: 1px;
}
.ui-datepicker .ui-datepicker-prev span,
.ui-datepicker .ui-datepicker-next span {
display: block;
position: absolute;
left: 50%;
margin-left: -8px;
top: 50%;
margin-top: -8px;
}
.ui-datepicker .ui-datepicker-title {
margin: 0 2.3em;
line-height: 1.8em;
text-align: center;
}
.ui-datepicker .ui-datepicker-title select {
font-size: 1em;
margin: 1px 0;
}
.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year {
width: 49%;
}
.ui-datepicker table {
width: 100%;
font-size: .9em;
border-collapse: collapse;
margin: 0 0 .4em;
}
.ui-datepicker th {
padding: .7em .3em;
text-align: center;
font-weight: bold;
border: 0;
}
.ui-datepicker td {
border: 0;
padding: 1px;
}
.ui-datepicker td span,
.ui-datepicker td a {
display: block;
padding: .2em;
text-align: right;
text-decoration: none;
}
.ui-datepicker .ui-datepicker-buttonpane {
background-image: none;
margin: .7em 0 0 0;
padding: 0 .2em;
border-left: 0;
border-right: 0;
border-bottom: 0;
}
.ui-datepicker .ui-datepicker-buttonpane button {
float: right;
margin: .5em .2em .4em;
cursor: pointer;
padding: .2em .6em .3em .6em;
width: auto;
overflow: visible;
}
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
float: left;
}
/* with multiple calendars */
.ui-datepicker.ui-datepicker-multi {
width: auto;
}
.ui-datepicker-multi .ui-datepicker-group {
float: left;
}
.ui-datepicker-multi .ui-datepicker-group table {
width: 95%;
margin: 0 auto .4em;
}
.ui-datepicker-multi-2 .ui-datepicker-group {
width: 50%;
}
.ui-datepicker-multi-3 .ui-datepicker-group {
width: 33.3%;
}
.ui-datepicker-multi-4 .ui-datepicker-group {
width: 25%;
}
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
border-left-width: 0;
}
.ui-datepicker-multi .ui-datepicker-buttonpane {
clear: left;
}
.ui-datepicker-row-break {
clear: both;
width: 100%;
font-size: 0;
}
/* RTL support */
.ui-datepicker-rtl {
direction: rtl;
}
.ui-datepicker-rtl .ui-datepicker-prev {
right: 2px;
left: auto;
}
.ui-datepicker-rtl .ui-datepicker-next {
left: 2px;
right: auto;
}
.ui-datepicker-rtl .ui-datepicker-prev:hover {
right: 1px;
left: auto;
}
.ui-datepicker-rtl .ui-datepicker-next:hover {
left: 1px;
right: auto;
}
.ui-datepicker-rtl .ui-datepicker-buttonpane {
clear: right;
}
.ui-datepicker-rtl .ui-datepicker-buttonpane button {
float: left;
}
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
.ui-datepicker-rtl .ui-datepicker-group {
float: right;
}
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
border-right-width: 0;
border-left-width: 1px;
}
.ui-dialog {
overflow: hidden;
position: absolute;
top: 0;
left: 0;
padding: .2em;
outline: 0;
}
.ui-dialog .ui-dialog-titlebar {
padding: .4em 1em;
position: relative;
}
.ui-dialog .ui-dialog-title {
float: left;
margin: .1em 0;
white-space: nowrap;
width: 90%;
overflow: hidden;
text-overflow: ellipsis;
}
.ui-dialog .ui-dialog-titlebar-close {
position: absolute;
right: .3em;
top: 50%;
width: 20px;
margin: -10px 0 0 0;
padding: 1px;
height: 20px;
}
.ui-dialog .ui-dialog-content {
position: relative;
border: 0;
padding: .5em 1em;
background: none;
overflow: auto;
}
.ui-dialog .ui-dialog-buttonpane {
text-align: left;
border-width: 1px 0 0 0;
background-image: none;
margin-top: .5em;
padding: .3em 1em .5em .4em;
}
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
float: right;
}
.ui-dialog .ui-dialog-buttonpane button {
margin: .5em .4em .5em 0;
cursor: pointer;
}
.ui-dialog .ui-resizable-se {
width: 12px;
height: 12px;
right: -5px;
bottom: -5px;
background-position: 16px 16px;
}
.ui-draggable .ui-dialog-titlebar {
cursor: move;
}
.ui-menu {
list-style: none;
padding: 2px;
margin: 0;
display: block;
outline: none;
}
.ui-menu .ui-menu {
margin-top: -3px;
position: absolute;
}
.ui-menu .ui-menu-item {
margin: 0;
padding: 0;
width: 100%;
/* support: IE10, see #8844 */
list-style-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7);
}
.ui-menu .ui-menu-divider {
margin: 5px -2px 5px -2px;
height: 0;
font-size: 0;
line-height: 0;
border-width: 1px 0 0 0;
}
.ui-menu .ui-menu-item a {
text-decoration: none;
display: block;
padding: 2px .4em;
line-height: 1.5;
min-height: 0; /* support: IE7 */
font-weight: normal;
}
.ui-menu .ui-menu-item a.ui-state-focus,
.ui-menu .ui-menu-item a.ui-state-active {
font-weight: normal;
margin: -1px;
}
.ui-menu .ui-state-disabled {
font-weight: normal;
margin: .4em 0 .2em;
line-height: 1.5;
}
.ui-menu .ui-state-disabled a {
cursor: default;
}
/* icon support */
.ui-menu-icons {
position: relative;
}
.ui-menu-icons .ui-menu-item a {
position: relative;
padding-left: 2em;
}
/* left-aligned */
.ui-menu .ui-icon {
position: absolute;
top: .2em;
left: .2em;
}
/* right-aligned */
.ui-menu .ui-menu-icon {
position: static;
float: right;
}
.ui-progressbar {
height: 2em;
text-align: left;
overflow: hidden;
}
.ui-progressbar .ui-progressbar-value {
margin: -1px;
height: 100%;
}
.ui-progressbar .ui-progressbar-overlay {
background: url("images/animated-overlay.gif");
height: 100%;
filter: alpha(opacity=25);
opacity: 0.25;
}
.ui-progressbar-indeterminate .ui-progressbar-value {
background-image: none;
}
.ui-slider {
position: relative;
text-align: left;
}
.ui-slider .ui-slider-handle {
position: absolute;
z-index: 2;
width: 1.2em;
height: 1.2em;
cursor: default;
}
.ui-slider .ui-slider-range {
position: absolute;
z-index: 1;
font-size: .7em;
display: block;
border: 0;
background-position: 0 0;
}
/* For IE8 - See #6727 */
.ui-slider.ui-state-disabled .ui-slider-handle,
.ui-slider.ui-state-disabled .ui-slider-range {
filter: inherit;
}
.ui-slider-horizontal {
height: .8em;
}
.ui-slider-horizontal .ui-slider-handle {
top: -.3em;
margin-left: -.6em;
}
.ui-slider-horizontal .ui-slider-range {
top: 0;
height: 100%;
}
.ui-slider-horizontal .ui-slider-range-min {
left: 0;
}
.ui-slider-horizontal .ui-slider-range-max {
right: 0;
}
.ui-slider-vertical {
width: .8em;
height: 100px;
}
.ui-slider-vertical .ui-slider-handle {
left: -.3em;
margin-left: 0;
margin-bottom: -.6em;
}
.ui-slider-vertical .ui-slider-range {
left: 0;
width: 100%;
}
.ui-slider-vertical .ui-slider-range-min {
bottom: 0;
}
.ui-slider-vertical .ui-slider-range-max {
top: 0;
}
.ui-spinner {
position: relative;
display: inline-block;
overflow: hidden;
padding: 0;
vertical-align: middle;
}
.ui-spinner-input {
border: none;
background: none;
color: inherit;
padding: 0;
margin: .2em 0;
vertical-align: middle;
margin-left: .4em;
margin-right: 22px;
}
.ui-spinner-button {
width: 16px;
height: 50%;
font-size: .5em;
padding: 0;
margin: 0;
text-align: center;
position: absolute;
cursor: default;
display: block;
overflow: hidden;
right: 0;
}
/* more specificity required here to override default borders */
.ui-spinner a.ui-spinner-button {
border-top: none;
border-bottom: none;
border-right: none;
}
/* vertically center icon */
.ui-spinner .ui-icon {
position: absolute;
margin-top: -8px;
top: 50%;
left: 0;
}
.ui-spinner-up {
top: 0;
}
.ui-spinner-down {
bottom: 0;
}
/* TR overrides */
.ui-spinner .ui-icon-triangle-1-s {
/* need to fix icons sprite */
background-position: -65px -16px;
}
.ui-tabs {
position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
padding: .2em;
}
.ui-tabs .ui-tabs-nav {
margin: 0;
padding: .2em .2em 0;
}
.ui-tabs .ui-tabs-nav li {
list-style: none;
float: left;
position: relative;
top: 0;
margin: 1px .2em 0 0;
border-bottom-width: 0;
padding: 0;
white-space: nowrap;
}
.ui-tabs .ui-tabs-nav .ui-tabs-anchor {
float: left;
padding: .5em 1em;
text-decoration: none;
}
.ui-tabs .ui-tabs-nav li.ui-tabs-active {
margin-bottom: -1px;
padding-bottom: 1px;
}
.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,
.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,
.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor {
cursor: text;
}
.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor {
cursor: pointer;
}
.ui-tabs .ui-tabs-panel {
display: block;
border-width: 0;
padding: 1em 1.4em;
background: none;
}
.ui-tooltip {
padding: 8px;
position: absolute;
z-index: 9999;
max-width: 300px;
-webkit-box-shadow: 0 0 5px #aaa;
box-shadow: 0 0 5px #aaa;
}
body .ui-tooltip {
border-width: 2px;
}
/* Component containers
----------------------------------*/
.ui-widget {
font-family: Verdana,Arial,sans-serif;
font-size: 1.1em;
}
.ui-widget .ui-widget {
font-size: 1em;
}
.ui-widget input,
.ui-widget select,
.ui-widget textarea,
.ui-widget button {
font-family: Verdana,Arial,sans-serif;
font-size: 1em;
}
.ui-widget-content {
border: 1px solid #aaaaaa;
background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x;
color: #222222;
}
.ui-widget-content a {
color: #222222;
}
.ui-widget-header {
border: 1px solid #aaaaaa;
background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;
color: #222222;
font-weight: bold;
}
.ui-widget-header a {
color: #222222;
}
/* Interaction states
----------------------------------*/
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default {
border: 1px solid #d3d3d3;
background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x;
font-weight: normal;
color: #555555;
}
.ui-state-default a,
.ui-state-default a:link,
.ui-state-default a:visited {
color: #555555;
text-decoration: none;
}
.ui-state-hover,
.ui-widget-content .ui-state-hover,
.ui-widget-header .ui-state-hover,
.ui-state-focus,
.ui-widget-content .ui-state-focus,
.ui-widget-header .ui-state-focus {
border: 1px solid #999999;
background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x;
font-weight: normal;
color: #212121;
}
.ui-state-hover a,
.ui-state-hover a:hover,
.ui-state-hover a:link,
.ui-state-hover a:visited,
.ui-state-focus a,
.ui-state-focus a:hover,
.ui-state-focus a:link,
.ui-state-focus a:visited {
color: #212121;
text-decoration: none;
}
.ui-state-active,
.ui-widget-content .ui-state-active,
.ui-widget-header .ui-state-active {
border: 1px solid #aaaaaa;
background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x;
font-weight: normal;
color: #212121;
}
.ui-state-active a,
.ui-state-active a:link,
.ui-state-active a:visited {
color: #212121;
text-decoration: none;
}
/* Interaction Cues
----------------------------------*/
.ui-state-highlight,
.ui-widget-content .ui-state-highlight,
.ui-widget-header .ui-state-highlight {
border: 1px solid #fcefa1;
background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x;
color: #363636;
}
.ui-state-highlight a,
.ui-widget-content .ui-state-highlight a,
.ui-widget-header .ui-state-highlight a {
color: #363636;
}
.ui-state-error,
.ui-widget-content .ui-state-error,
.ui-widget-header .ui-state-error {
border: 1px solid #cd0a0a;
background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x;
color: #cd0a0a;
}
.ui-state-error a,
.ui-widget-content .ui-state-error a,
.ui-widget-header .ui-state-error a {
color: #cd0a0a;
}
.ui-state-error-text,
.ui-widget-content .ui-state-error-text,
.ui-widget-header .ui-state-error-text {
color: #cd0a0a;
}
.ui-priority-primary,
.ui-widget-content .ui-priority-primary,
.ui-widget-header .ui-priority-primary {
font-weight: bold;
}
.ui-priority-secondary,
.ui-widget-content .ui-priority-secondary,
.ui-widget-header .ui-priority-secondary {
opacity: .7;
filter:Alpha(Opacity=70);
font-weight: normal;
}
.ui-state-disabled,
.ui-widget-content .ui-state-disabled,
.ui-widget-header .ui-state-disabled {
opacity: .35;
filter:Alpha(Opacity=35);
background-image: none;
}
.ui-state-disabled .ui-icon {
filter:Alpha(Opacity=35); /* For IE8 - See #6059 */
}
/* Icons
----------------------------------*/
/* states and images */
.ui-icon {
width: 16px;
height: 16px;
}
.ui-icon,
.ui-widget-content .ui-icon {
background-image: url(images/ui-icons_222222_256x240.png);
}
.ui-widget-header .ui-icon {
background-image: url(images/ui-icons_222222_256x240.png);
}
.ui-state-default .ui-icon {
background-image: url(images/ui-icons_888888_256x240.png);
}
.ui-state-hover .ui-icon,
.ui-state-focus .ui-icon {
background-image: url(images/ui-icons_454545_256x240.png);
}
.ui-state-active .ui-icon {
background-image: url(images/ui-icons_454545_256x240.png);
}
.ui-state-highlight .ui-icon {
background-image: url(images/ui-icons_2e83ff_256x240.png);
}
.ui-state-error .ui-icon,
.ui-state-error-text .ui-icon {
background-image: url(images/ui-icons_cd0a0a_256x240.png);
}
/* positioning */
.ui-icon-blank { background-position: 16px 16px; }
.ui-icon-carat-1-n { background-position: 0 0; }
.ui-icon-carat-1-ne { background-position: -16px 0; }
.ui-icon-carat-1-e { background-position: -32px 0; }
.ui-icon-carat-1-se { background-position: -48px 0; }
.ui-icon-carat-1-s { background-position: -64px 0; }
.ui-icon-carat-1-sw { background-position: -80px 0; }
.ui-icon-carat-1-w { background-position: -96px 0; }
.ui-icon-carat-1-nw { background-position: -112px 0; }
.ui-icon-carat-2-n-s { background-position: -128px 0; }
.ui-icon-carat-2-e-w { background-position: -144px 0; }
.ui-icon-triangle-1-n { background-position: 0 -16px; }
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
.ui-icon-triangle-1-e { background-position: -32px -16px; }
.ui-icon-triangle-1-se { background-position: -48px -16px; }
.ui-icon-triangle-1-s { background-position: -64px -16px; }
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
.ui-icon-triangle-1-w { background-position: -96px -16px; }
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
.ui-icon-arrow-1-n { background-position: 0 -32px; }
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
.ui-icon-arrow-1-e { background-position: -32px -32px; }
.ui-icon-arrow-1-se { background-position: -48px -32px; }
.ui-icon-arrow-1-s { background-position: -64px -32px; }
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
.ui-icon-arrow-1-w { background-position: -96px -32px; }
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
.ui-icon-arrow-4 { background-position: 0 -80px; }
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
.ui-icon-extlink { background-position: -32px -80px; }
.ui-icon-newwin { background-position: -48px -80px; }
.ui-icon-refresh { background-position: -64px -80px; }
.ui-icon-shuffle { background-position: -80px -80px; }
.ui-icon-transfer-e-w { background-position: -96px -80px; }
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
.ui-icon-folder-collapsed { background-position: 0 -96px; }
.ui-icon-folder-open { background-position: -16px -96px; }
.ui-icon-document { background-position: -32px -96px; }
.ui-icon-document-b { background-position: -48px -96px; }
.ui-icon-note { background-position: -64px -96px; }
.ui-icon-mail-closed { background-position: -80px -96px; }
.ui-icon-mail-open { background-position: -96px -96px; }
.ui-icon-suitcase { background-position: -112px -96px; }
.ui-icon-comment { background-position: -128px -96px; }
.ui-icon-person { background-position: -144px -96px; }
.ui-icon-print { background-position: -160px -96px; }
.ui-icon-trash { background-position: -176px -96px; }
.ui-icon-locked { background-position: -192px -96px; }
.ui-icon-unlocked { background-position: -208px -96px; }
.ui-icon-bookmark { background-position: -224px -96px; }
.ui-icon-tag { background-position: -240px -96px; }
.ui-icon-home { background-position: 0 -112px; }
.ui-icon-flag { background-position: -16px -112px; }
.ui-icon-calendar { background-position: -32px -112px; }
.ui-icon-cart { background-position: -48px -112px; }
.ui-icon-pencil { background-position: -64px -112px; }
.ui-icon-clock { background-position: -80px -112px; }
.ui-icon-disk { background-position: -96px -112px; }
.ui-icon-calculator { background-position: -112px -112px; }
.ui-icon-zoomin { background-position: -128px -112px; }
.ui-icon-zoomout { background-position: -144px -112px; }
.ui-icon-search { background-position: -160px -112px; }
.ui-icon-wrench { background-position: -176px -112px; }
.ui-icon-gear { background-position: -192px -112px; }
.ui-icon-heart { background-position: -208px -112px; }
.ui-icon-star { background-position: -224px -112px; }
.ui-icon-link { background-position: -240px -112px; }
.ui-icon-cancel { background-position: 0 -128px; }
.ui-icon-plus { background-position: -16px -128px; }
.ui-icon-plusthick { background-position: -32px -128px; }
.ui-icon-minus { background-position: -48px -128px; }
.ui-icon-minusthick { background-position: -64px -128px; }
.ui-icon-close { background-position: -80px -128px; }
.ui-icon-closethick { background-position: -96px -128px; }
.ui-icon-key { background-position: -112px -128px; }
.ui-icon-lightbulb { background-position: -128px -128px; }
.ui-icon-scissors { background-position: -144px -128px; }
.ui-icon-clipboard { background-position: -160px -128px; }
.ui-icon-copy { background-position: -176px -128px; }
.ui-icon-contact { background-position: -192px -128px; }
.ui-icon-image { background-position: -208px -128px; }
.ui-icon-video { background-position: -224px -128px; }
.ui-icon-script { background-position: -240px -128px; }
.ui-icon-alert { background-position: 0 -144px; }
.ui-icon-info { background-position: -16px -144px; }
.ui-icon-notice { background-position: -32px -144px; }
.ui-icon-help { background-position: -48px -144px; }
.ui-icon-check { background-position: -64px -144px; }
.ui-icon-bullet { background-position: -80px -144px; }
.ui-icon-radio-on { background-position: -96px -144px; }
.ui-icon-radio-off { background-position: -112px -144px; }
.ui-icon-pin-w { background-position: -128px -144px; }
.ui-icon-pin-s { background-position: -144px -144px; }
.ui-icon-play { background-position: 0 -160px; }
.ui-icon-pause { background-position: -16px -160px; }
.ui-icon-seek-next { background-position: -32px -160px; }
.ui-icon-seek-prev { background-position: -48px -160px; }
.ui-icon-seek-end { background-position: -64px -160px; }
.ui-icon-seek-start { background-position: -80px -160px; }
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
.ui-icon-seek-first { background-position: -80px -160px; }
.ui-icon-stop { background-position: -96px -160px; }
.ui-icon-eject { background-position: -112px -160px; }
.ui-icon-volume-off { background-position: -128px -160px; }
.ui-icon-volume-on { background-position: -144px -160px; }
.ui-icon-power { background-position: 0 -176px; }
.ui-icon-signal-diag { background-position: -16px -176px; }
.ui-icon-signal { background-position: -32px -176px; }
.ui-icon-battery-0 { background-position: -48px -176px; }
.ui-icon-battery-1 { background-position: -64px -176px; }
.ui-icon-battery-2 { background-position: -80px -176px; }
.ui-icon-battery-3 { background-position: -96px -176px; }
.ui-icon-circle-plus { background-position: 0 -192px; }
.ui-icon-circle-minus { background-position: -16px -192px; }
.ui-icon-circle-close { background-position: -32px -192px; }
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
.ui-icon-circle-zoomin { background-position: -176px -192px; }
.ui-icon-circle-zoomout { background-position: -192px -192px; }
.ui-icon-circle-check { background-position: -208px -192px; }
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
.ui-icon-circlesmall-close { background-position: -32px -208px; }
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
.ui-icon-squaresmall-close { background-position: -80px -208px; }
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
/* Misc visuals
----------------------------------*/
/* Corner radius */
.ui-corner-all,
.ui-corner-top,
.ui-corner-left,
.ui-corner-tl {
border-top-left-radius: 4px;
}
.ui-corner-all,
.ui-corner-top,
.ui-corner-right,
.ui-corner-tr {
border-top-right-radius: 4px;
}
.ui-corner-all,
.ui-corner-bottom,
.ui-corner-left,
.ui-corner-bl {
border-bottom-left-radius: 4px;
}
.ui-corner-all,
.ui-corner-bottom,
.ui-corner-right,
.ui-corner-br {
border-bottom-right-radius: 4px;
}
/* Overlays */
.ui-widget-overlay {
background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;
opacity: .3;
filter: Alpha(Opacity=30);
}
.ui-widget-shadow {
margin: -8px 0 0 -8px;
padding: 8px;
background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;
opacity: .3;
filter: Alpha(Opacity=30);
border-radius: 8px;
}
/*! jQuery UI - v1.10.4 - 2014-01-18
* http://jqueryui.com
* Includes: jquery.ui.core.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css, jquery.ui.theme.css
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin-top:2px;padding:.5em .5em .5em .7em;min-height:0}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-noicons{padding-left:.7em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-button{display:inline-block;position:relative;padding:0;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:normal}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:49%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-dialog{overflow:hidden;position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:12px;height:12px;right:-5px;bottom:-5px;background-position:16px 16px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-menu{list-style:none;padding:2px;margin:0;display:block;outline:none}.ui-menu .ui-menu{margin-top:-3px;position:absolute}.ui-menu .ui-menu-item{margin:0;padding:0;width:100%;list-style-image:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}.ui-menu .ui-menu-divider{margin:5px -2px 5px -2px;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-menu-item a{text-decoration:none;display:block;padding:2px .4em;line-height:1.5;min-height:0;font-weight:normal}.ui-menu .ui-menu-item a.ui-state-focus,.ui-menu .ui-menu-item a.ui-state-active{font-weight:normal;margin:-1px}.ui-menu .ui-state-disabled{font-weight:normal;margin:.4em 0 .2em;line-height:1.5}.ui-menu .ui-state-disabled a{cursor:default}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item a{position:relative;padding-left:2em}.ui-menu .ui-icon{position:absolute;top:.2em;left:.2em}.ui-menu .ui-menu-icon{position:static;float:right}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("images/animated-overlay.gif");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:22px}.ui-spinner-button{width:16px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:none;border-bottom:none;border-right:none}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px;-webkit-box-shadow:0 0 5px #aaa;box-shadow:0 0 5px #aaa}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Verdana,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Verdana,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #aaa;background:#fff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x;color:#222}.ui-widget-content a{color:#222}.ui-widget-header{border:1px solid #aaa;background:#ccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;color:#222;font-weight:bold}.ui-widget-header a{color:#222}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #d3d3d3;background:#e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#555}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#555;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #999;background:#dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited{color:#212121;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #aaa;background:#fff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#212121;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #fcefa1;background:#fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x;color:#363636}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x;color:#cd0a0a}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#cd0a0a}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#cd0a0a}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url(images/ui-icons_222222_256x240.png)}.ui-widget-header .ui-icon{background-image:url(images/ui-icons_222222_256x240.png)}.ui-state-default .ui-icon{background-image:url(images/ui-icons_888888_256x240.png)}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url(images/ui-icons_454545_256x240.png)}.ui-state-active .ui-icon{background-image:url(images/ui-icons_454545_256x240.png)}.ui-state-highlight .ui-icon{background-image:url(images/ui-icons_2e83ff_256x240.png)}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url(images/ui-icons_cd0a0a_256x240.png)}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:4px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:4px}.ui-widget-overlay{background:#aaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30)}.ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30);border-radius:8px}
\ No newline at end of file
/**
* @author zhixin wen <wenzhixin2010@gmail.com>
*/
.ms-parent {
display: inline-block;
position: relative;
vertical-align: middle;
}
.ms-choice {
display: block;
height: 26px;
padding: 0;
overflow: hidden;
position: relative;
cursor: pointer;
border: 1px solid #aaa;
white-space: nowrap;
line-height: 26px;
color: #444;
text-decoration: none;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background-color: #fff;
}
.ms-choice.disabled {
background-color: #f4f4f4;
background-image: none;
border: 1px solid #ddd;
cursor: default;
}
.ms-choice > span {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
float: left;
padding-left: 8px;
}
.ms-choice > span.placeholder {
color: #999;
}
.ms-choice > div {
float: right;
width: 20px;
height: 25px;
background: url('multiple-select.png') right top no-repeat;
}
.ms-choice > div.open {
background: url('multiple-select.png') left top no-repeat;
}
.ms-drop {
overflow: hidden;
display: none;
margin-top: -1px;
padding: 0;
position: absolute;
z-index: 1000;
top: 100%;
background: #fff;
color: #000;
border: 1px solid #aaa;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
-moz-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
}
.ms-search {
display: inline-block;
margin: 0;
min-height: 26px;
padding: 4px;
position: relative;
white-space: nowrap;
width: 100%;
z-index: 10000;
}
.ms-search input {
width: 100%;
height: auto !important;
min-height: 24px;
padding: 0 20px 0 5px;
margin: 0;
outline: 0;
font-family: sans-serif;
font-size: 1em;
border: 1px solid #aaa;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
background: #fff url('multiple-select.png') no-repeat 100% -22px;
background: url('multiple-select.png') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
background: url('multiple-select.png') no-repeat 100% -22px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
background: url('multiple-select.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
background: url('multiple-select.png') no-repeat 100% -22px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
background: url('multiple-select.png') no-repeat 100% -22px, -ms-linear-gradient(top, #ffffff 85%, #eeeeee 99%);
background: url('multiple-select.png') no-repeat 100% -22px, linear-gradient(top, #ffffff 85%, #eeeeee 99%);
}
.ms-search, .ms-search input {
-webkit-box-sizing: border-box;
-khtml-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.ms-drop ul {
overflow: auto;
margin: 0;
padding: 5px 8px;
}
.ms-drop ul > li {
list-style: none;
display: list-item;
background-image: none;
position: static;
}
.ms-drop ul > li .disabled {
opacity: .35;
filter: Alpha(Opacity=35);
}
.ms-drop ul > li.multiple {
display: block;
float: left;
}
.ms-drop ul > li.group {
clear: both;
}
.ms-drop ul > li.multiple label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.ms-drop ul > li label.optgroup {
font-weight: bold;
}
.ms-drop input[type="checkbox"] {
vertical-align: middle;
}
/*
Document : ure_admin
Created on : 10.03.2010
Author : Vladimir Garagulya
Description:
User Role Editor plugin Admin Settings Page CSS
*/
/*
Syntax recommendation http://www.w3.org/TR/REC-CSS2/
*/
.txt_left {
text-align: left;
}
.txt_center {
text-align: center;
}
.txt_right {
text-align: right;
}
.nowrap {
white-space: nowrap;
}
img.input_radio {
vertical-align: middle;
}
a.ure_rsb_link {
padding:4px;
display:block;
padding-left:25px;
background-repeat:no-repeat;
background-position:5px 50%;
text-decoration:none;
border:none;
}
a.ure_rsb_link:hover {
border-bottom-width:1px;
}
input.warning:hover, a.warning:hover {
color: red;
}
#ure_container {
display: table;
width: 100%;
}
.ure-table {
display: table;
}
.ure-table-cell {
display: table-cell;
margin: 0;
padding: 0;
vertical-align: top;
}
#ure-sidebar {
width: 270px;
padding-left: 20px;
}
.hidden {
display: none;
}
#user_role_editor {
}
#ure_form_controls {
}
#ure_role_selector {
padding: 10px 0 0 10px;
}
#ure_user_caps_header {
padding: 10px 0 0 10px;
font-size: 16px;
}
#ure_user_caps_title {
font-weight: bold;
}
#ure_role_select_label {
font-size: 16px;
font-weight: bold;
}
.ure-caps-option {
padding-left: 20px;
}
#ure_caps_container {
width: 100%;
}
#ure_toolbar {
margin-top: 10px;
border: 1px solid #dfdfdf;
-webkit-box-shadow: inset 0 1px 0 #fff;
box-shadow: inset 0 1px 0 #fff;
-webkit-border-radius: 3px;
border-radius: 3px;
background: #f5f5f5;
padding: 5px;
}
.ure_toolbar_button {
width: 100%;
margin-bottom: 3px;
}
#ure_update {
width: 100%;
margin-top: 10px;
margin-bottom: 10px;
}
#ure_service_tools {
margin-top: 10px;
}
.ure-modal-dialog {
display: none;
padding: 10px;
}
.ure-label {
clear: left;
float: left;
display: block;
width: 150px;
}
.ure-input {
float: left;
display: inline;
width: 200px;
margin-bottom: 5px;
}
#ure_user_roles {
vertical-align: text-top;
padding-right: 10px;
padding-top: 5px;
font-size: 1.1em;
border-top: 1px solid #cccccc;
border-right: 1px solid #cccccc;
min-width: 200px;
width: 20%;
}
.ure-user-role-section-title {
margin-top: 5px;
margin-bottom: 5px;
font-weight: bold;
}
/* Multipe select */
.countLabel {
color:Gray;
font-style:italic;
}
.storageBox {
display:none;
}
.copiedOption {
background-color:Yellow;
}
.ure-caps-cell {
vertical-align:top;
padding-top: 5px;
}
.ure-cap-div {
white-space: nowrap;
}
#other_default_roles {
display: block;
margin: 10px;
}
.ure-dialog {
display: none;
}
#ure_admin_menu_access_table tr:hover {
background-color: #2ea2cc;
color: #ffffff;
}
#ure_caps_groups_td {
padding:0 10px 0 10px;
min-width:25%;
border-right: 1px solid #cccccc;
}
#ure_caps_td {
width:60%;
padding-left: 10px;
}
#ure_toolbar_td {
width: 15%;
min-width:200px;
padding-left: 10px;
}
#ure_editor_options {
margin-bottom: 10px;
}
#ure_caps_groups_title {
min-width: 250px;
vertical-align:middle;
border-bottom: 1px solid #cccccc;
border-right: 1px solid #cccccc;
}
#ure_caps_select {
vertical-align:middle;
border-bottom: 1px solid #cccccc;
padding: 5px 5px 5px 10px;
}
#ure_toolbar_title {
border-bottom: 1px solid #cccccc;
}
#ure_caps_groups_list .ui-selecting {
background: #DDDDDD;
}
#ure_caps_groups_list .ui-selected {
background: #CCCCCC;
color: #444444;
}
#ure_caps_groups_list li {
min-height: 20px;
line-height: 20px;
cursor: pointer;
}
.plugins {
color: #444444;
}
#ure_caps_list_container {
float: left;
width: 100%;
overflow: auto;
min-height: 600px;
max-height: 720px;
}
#ure_caps_list {
-moz-column-count: 1;
-webkit-column-count: 1;
column-count: 1;
column-width: auto;
display: inline-block;
min-width: 100%;
}
\ No newline at end of file
<?php
// Silence is golden.
?>
\ No newline at end of file
<?php
/*
* User Role Editor plugin: advertisement showing class
* Author: Vladimir Garagulya
* email: vladimir@shinephp.com
* site: http://shinephp.com
*
*/
class URE_Advertisement {
private $slots = array(0=>'');
function __construct() {
$used = array(-1);
//$index = $this->rand_unique( $used );
$index = 0;
$this->slots[$index] = $this->admin_menu_editor();
$used[] = $index;
}
// end of __construct
/**
* Returns random number not included into input array
*
* @param array $used - array of numbers used already
*
* @return int
*/
private function rand_unique( $used = array(-1) ) {
$index = rand(0, 2);
while (in_array($index, $used)) {
$index = rand(0, 2);
}
return $index;
}
// return rand_unique()
// content of Admin Menu Editor advertisement slot
private function admin_menu_editor() {
$output = '
<div style="text-align: center;">
<a href="http://w-shadow.com/admin-menu-editor-pro/?utm_source=UserRoleEditor&utm_medium=banner&utm_campaign=Plugins " target="_new" >
<img src="'. URE_PLUGIN_URL . 'images/admin-menu-editor-pro.jpg' .'" alt="Admin Menu Editor Pro" title="Move, rename, hide, add admin menu items, restrict access"/>
</a>
</div>
';
return $output;
}
// end of admin_menu_editor()
/**
* Output all existed ads slots
*/
public function display() {
?>
<div id="ure-sidebar" class="ure_table_cell" >
<?php
foreach ($this->slots as $slot) {
echo $slot . "\n";
}
?>
</div>
<?php
}
// end of display()
}
// end of ure_Advertisement
\ No newline at end of file
<?php
/*
* User Role Editor WordPress plugin
* Author: Vladimir Garagulya
* Email: support@role-editor.com
* License: GPLv2 or later
*/
/**
* Process AJAX requrest from User Role Editor
*
* @author vladimir
*/
class URE_Ajax_Processor {
protected $lib = null;
protected $action = null;
public function __construct($lib) {
$this->lib = $lib;
}
// end of __construct()
protected function get_action() {
$action = filter_input(INPUT_POST, 'sub_action', FILTER_SANITIZE_STRING);
if (empty($action)) {
$action = filter_input(INPUT_GET, 'sub_action', FILTER_SANITIZE_STRING);
}
$this->action = $action;
return $action;
}
protected function ajax_check_permissions() {
if (!wp_verify_nonce($_REQUEST['wp_nonce'], 'user-role-editor')) {
echo json_encode(array('result'=>'error', 'message'=>'URE: Wrong or expired request'));
die;
}
$key_capability = URE_Own_Capabilities::get_key_capability();
if (!current_user_can($key_capability)) {
echo json_encode(array('result'=>'error', 'message'=>'URE: Insufficient permissions'));
die;
}
}
// end of ajax_check_permissions()
protected function get_caps_to_remove() {
$html = URE_Role_View::caps_to_remove_html();
$answer = array('result'=>'success', 'html'=>$html, 'message'=>'success');
return $answer;
}
// end of get_caps_to_remove()
protected function get_users_without_role() {
global $wp_roles;
$new_role = filter_input(INPUT_POST, 'new_role', FILTER_SANITIZE_STRING);
if (empty($new_role)) {
$answer = array('result'=>'failure', 'message'=>'Provide new role');
return $answer;
}
$assign_role = $this->lib->get_assign_role();
if ($new_role==='no_rights') {
$assign_role->create_no_rights_role();
}
if (!isset($wp_roles)) {
$wp_roles = new WP_Roles();
}
if (!isset($wp_roles->roles[$new_role])) {
$answer = array('result'=>'failure', 'message'=>'Selected new role does not exist');
return $answer;
}
$users = $assign_role->get_users_without_role($new_role);
$answer = array('result'=>'success', 'users'=>$users, 'new_role'=>$new_role, 'message'=>'success');
return $answer;
}
// end of get_users_without_role()
protected function _dispatch() {
switch ($this->action) {
case 'get_caps_to_remove':
$answer = $this->get_caps_to_remove();
break;
case 'get_users_without_role':
$answer = $this->get_users_without_role();
break;
default:
$answer = array('result' => 'error', 'message' => 'unknown action "' . $this->action . '"');
}
return $answer;
}
// end of _dispatch()
/**
* AJAX requests dispatcher
*/
public function dispatch() {
$this->get_action();
$this->ajax_check_permissions();
$answer = $this->_dispatch();
$json_answer = json_encode($answer);
echo $json_answer;
die;
}
}
// end of URE_Ajax_Processor
<?php
/**
* Project: User Role Editor plugin
* Author: Vladimir Garagulya
* Author email: support@role-editor.com
* Author URI: https://www.role-editor.com
* Greetings: some ideas and code samples for long runing cron job was taken from the "Broken Link Checker" plugin (Janis Elst).
* License: GPL v2+
*
* Assign role to the users without role stuff
*/
class URE_Assign_Role {
const MAX_USERS_TO_PROCESS = 50;
protected $lib = null;
function __construct($lib) {
$this->lib = $lib;
}
// end of __construct()
public function create_no_rights_role() {
global $wp_roles;
$role_id = 'no_rights';
$role_name = 'No rights';
if (!isset($wp_roles)) {
$wp_roles = new WP_Roles();
}
if (isset($wp_roles->roles[$role_id])) {
return;
}
add_role($role_id, $role_name, array());
}
// end of create_no_rights_role()
private function get_where_condition() {
global $wpdb;
$usermeta = $this->lib->get_usermeta_table_name();
$id = get_current_blog_id();
$blog_prefix = $wpdb->get_blog_prefix($id);
$where = "where not exists (select user_id from {$usermeta}
where user_id=users.ID and meta_key='{$blog_prefix}capabilities') or
exists (select user_id from {$usermeta}
where user_id=users.ID and meta_key='{$blog_prefix}capabilities' and meta_value='a:0:{}')";
return $where;
}
// end of get_where_condition()
public function count_users_without_role() {
global $wpdb;
$users_quant = get_transient('ure_users_without_role');
if (empty($users_quant)) {
$where = $this->get_where_condition();
$query = "select count(ID) from {$wpdb->users} users {$where}";
$users_quant = $wpdb->get_var($query);
set_transient('ure_users_without_role', $users_quant, 15);
}
return $users_quant;
}
// end of count_users_without_role()
public function get_users_without_role($new_role='') {
global $wpdb;
$top_limit = self::MAX_USERS_TO_PROCESS;
$where = $this->get_where_condition();
$query = "select ID from {$wpdb->users} users
{$where}
limit 0, {$top_limit}";
$users0 = $wpdb->get_col($query);
return $users0;
}
// end of get_users_without_role()
}
// end of URE_Assign_Role class
\ No newline at end of file
<?php
/*
* General stuff for usage at WordPress plugins
* Author: Vladimir Garagulya
* Author email: vladimir@shinephp.com
* Author URI: http://shinephp.com
*
*/
/**
* This class contains general stuff for usage at WordPress plugins and must be extended by child class
*/
class URE_Base_Lib {
protected static $instance = null; // object exemplar reference
protected $options_id = ''; // identifire to save/retrieve plugin options to/from wp_option DB table
protected $options = array(); // plugin options data
protected $multisite = false;
protected $active_for_network = false;
protected $blog_ids = null;
protected $main_blog_id = 0;
public static function get_instance($options_id = '') {
if (self::$instance===null) {
self::$instance = new URE_Base_Lib($options_id);
}
return self::$instance;
}
// end of get_instance()
/**
* class constructor
* @param string $options_id to save/retrieve plugin options to/from wp_option DB table
*/
protected function __construct($options_id) {
$this->multisite = function_exists('is_multisite') && is_multisite();
if ($this->multisite) {
$this->blog_ids = $this->get_blog_ids();
// get Id of 1st (main) blog
$this->main_blog_id = $this->get_main_site();
}
$this->init_options($options_id);
}
// end of __construct()
public function get($property_name) {
if (!property_exists($this, $property_name)) {
syslog(LOG_ERR, 'Lib class does not have such property '. $property_name);
}
return $this->$property_name;
}
// end of get_property()
public function set($property_name, $property_value) {
if (!property_exists($this, $property_name)) {
syslog(LOG_ERR, 'Lib class does not have such property '. $property_name);
}
$this->$property_name = $property_value;
}
// end of get_property()
public function get_main_site() {
global $current_site;
return $current_site->blog_id;
}
// end of get_main_site()
/**
* Returns the array of multisite WP blogs IDs
* @global wpdb $wpdb
* @return array
*/
protected function get_blog_ids() {
global $wpdb;
$blog_ids = $wpdb->get_col("select blog_id from $wpdb->blogs order by blog_id asc");
return $blog_ids;
}
// end of get_blog_ids()
/**
* get current options for this plugin
*/
protected function init_options($options_id) {
$this->options_id = $options_id;
$this->options = get_option($options_id);
}
// end of init_options()
/**
* Return HTML formatted message
*
* @param string $message message text
* @param string $error_style message div CSS style
*/
public function show_message($message, $error_style = false) {
if ($message) {
if ($error_style) {
echo '<div id="message" class="error" >';
} else {
echo '<div id="message" class="updated fade">';
}
echo $message . '</div>';
}
}
// end of show_message()
/**
* Returns value by name from GET/POST/REQUEST. Minimal type checking is provided
*
* @param string $var_name Variable name to return
* @param string $request_type type of request to process get/post/request (default)
* @param string $var_type variable type to provide value checking
* @return mix variable value from request
*/
public function get_request_var($var_name, $request_type = 'request', $var_type = 'string') {
$result = 0;
if ($request_type == 'get') {
if (isset($_GET[$var_name])) {
$result = filter_var($_GET[$var_name], FILTER_SANITIZE_STRING);
}
} else if ($request_type == 'post') {
if (isset($_POST[$var_name])) {
if ($var_type != 'checkbox') {
$result = filter_var($_POST[$var_name], FILTER_SANITIZE_STRING);;
} else {
$result = 1;
}
}
} else {
if (isset($_REQUEST[$var_name])) {
$result = filter_var($_REQUEST[$var_name], FILTER_SANITIZE_STRING);
}
}
if ($result) {
if ($var_type == 'int' && !is_numeric($result)) {
$result = 0;
}
if ($var_type != 'int') {
$result = esc_attr($result);
}
}
return $result;
}
// end of get_request_var()
/**
* returns option value for option with name in $option_name
*/
public function get_option($option_name, $default = false) {
if (isset($this->options[$option_name])) {
return $this->options[$option_name];
} else {
return $default;
}
}
// end of get_option()
/**
* puts option value according to $option_name option name into options array property
*/
public function put_option($option_name, $option_value, $flush_options = false) {
$this->options[$option_name] = $option_value;
if ($flush_options) {
$this->flush_options();
}
}
// end of put_option()
/**
* Delete URE option with name option_name
* @param string $option_name
* @param bool $flush_options
*/
public function delete_option($option_name, $flush_options = false) {
if (array_key_exists($option_name, $this->options)) {
unset($this->options[$option_name]);
if ($flush_options) {
$this->flush_options();
}
}
}
// end of delete_option()
/**
* saves options array into WordPress database wp_options table
*/
public function flush_options() {
update_option($this->options_id, $this->options);
}
// end of flush_options()
/**
* Check product versrion and stop execution if product version is not compatible
* @param type $must_have_version
* @param type $version_to_check
* @param type $error_message
* @return type
*/
public static function check_version($must_have_version, $version_to_check, $error_message, $plugin_file_name) {
if (version_compare($must_have_version, $version_to_check, '<')) {
if (is_admin() && (!defined('DOING_AJAX') || !DOING_AJAX )) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
deactivate_plugins($plugin_file_name);
wp_die($error_message);
} else {
return;
}
}
}
// end of check_version()
public function get_current_url() {
global $wp;
$current_url = esc_url_raw(add_query_arg($wp->query_string, '', home_url($wp->request)));
return $current_url;
}
// end of get_current_url()
/**
* Returns comma separated list from the first $items_count element of $full_list array
*
* @param array $full_list
* @param int $items_count
* @return string
*/
public function get_short_list_str($full_list, $items_count=3) {
$short_list = array(); $i = 0;
foreach($full_list as $key=>$item) {
if ($i>=$items_count) {
break;
}
$short_list[] = $item;
$i++;
}
$str = implode(', ', $short_list);
if ($items_count<count($full_list)) {
$str .= '...';
}
return $str;
}
// end of get_short_list_str()
/**
* Private clone method to prevent cloning of the instance of the
* *Singleton* instance.
*
* @return void
*/
private function __clone() {
}
// end of __clone()
/**
* Private unserialize method to prevent unserializing of the *Singleton*
* instance.
*
* @return void
*/
private function __wakeup() {
}
// end of __wakeup()
}
// end of Garvs_WP_Lib class
\ No newline at end of file
<?php
/**
* Support for bbPress user roles and capabilities
*
* Project: User Role Editor WordPress plugin
* Author: Vladimir Garagulya
* Author email: vladimir@shinephp.com
* Author URI: http://shinephp.com
*
**/
class URE_bbPress {
public static $instance = null;
protected $lib = null;
protected function __construct(Ure_Lib $lib) {
$this->lib = $lib;
}
// end of __construct()
static public function get_instance(Ure_Lib $lib) {
if (!function_exists('bbp_filter_blog_editable_roles')) { // bbPress plugin is not active
return null;
}
if (self::$instance!==null) {
return self::$instance;
}
if ($lib->is_pro()) {
self::$instance = new URE_bbPress_Pro($lib);
} else {
self::$instance = new URE_bbPress($lib);
}
return self::$instance;
}
// end of get_instance()
/**
* Exclude roles created by bbPress
*
* @global array $wp_roles
* @return array
*/
public function get_roles() {
global $wp_roles;
$roles = bbp_filter_blog_editable_roles($wp_roles->roles); // exclude bbPress roles
return $roles;
}
// end of get_roles()
/**
* Get full list user capabilities created by bbPress
*
* @return array
*/
public function get_caps() {
$caps = array_keys(bbp_get_caps_for_role(bbp_get_keymaster_role()));
return $caps;
}
// end of get_caps()
}
// end of URE_bbPress class
\ No newline at end of file
<?php
/**
* Class to group user capabilities for better structuring
*
* @package User-Role-Editor
* @subpackage Admin
* @author Vladimir Garagulya <support@role-editor.com>
* @copyright Copyright (c) 2010 - 2016, Vladimir Garagulya
**/
class URE_Capabilities_Groups_Manager {
private static $instance = null;
private $lib = null;
private $groups = null;
private $built_in_wp_caps = null;
private $cpt_caps = null;
public static function get_instance() {
if (self::$instance === null) {
// new static() will work too
self::$instance = new URE_Capabilities_Groups_Manager();
}
return self::$instance;
}
// end of get_instance()
private function __construct() {
$this->lib = URE_Lib::get_instance();
$this->_get_built_in_wp_caps();
$this->_get_all_custom_post_types_capabilities();
}
// end of __construct()
public function add_custom_post_types() {
$this->groups['custom_post_types'] = array('caption'=>esc_html__('Custom Post Types', 'user-role-editor'), 'parent'=>'all', 'level'=>1);
$post_types = get_post_types(array(), 'objects');
$_post_types = $this->lib->_get_post_types();
$built_in_pt = array('post', 'page');
if ($post_types['attachment']->cap->edit_posts=='edit_posts') {
$built_in_pt[] = 'attachment';
}
$show_wc_post_types_under_wc_only = apply_filters('ure_show_wc_post_types_under_wc_only', false);
foreach($post_types as $post_type) {
if (!isset($_post_types[$post_type->name]) || in_array($post_type->name, $built_in_pt)) {
continue;
}
if ($show_wc_post_types_under_wc_only && in_array($post_type->name, URE_Woocommerce_Capabilities::$post_types)) {
continue;
}
/*
if (!$post_type->public) {
continue;
}
*
*/
$this->groups[$post_type->name] = array('caption'=>$post_type->labels->name, 'parent'=>'custom_post_types', 'level'=>2);
}
}
// end of add_custom_post_types()
private function add_ure_group() {
$this->groups['user_role_editor'] = array('caption'=>esc_html__('User Role Editor', 'user-role-editor'), 'parent'=>'custom', 'level'=>3);
}
// end of get_ure_group()
private function add_woocommerce_groups() {
$full_caps = $this->lib->get('full_capabilities');
if (!isset($full_caps['manage_woocommerce'])) {
return;
}
$post_types = get_post_types(array(), 'objects');
$this->groups['woocommerce'] = array('caption'=>esc_html__('WooCommerce', 'user-role-editor'), 'parent'=>'custom', 'level'=>3);
$this->groups['woocommerce_core'] = array('caption'=>esc_html__('Core', 'user-role-editor'), 'parent'=>'woocommerce', 'level'=>4);
foreach(URE_Woocommerce_Capabilities::$post_types as $post_type) {
if (!isset($post_types[$post_type])) {
continue;
}
$this->groups['woocommerce_'. $post_type] = array('caption'=>$post_types[$post_type]->labels->name, 'parent'=>'woocommerce', 'level'=>4);
}
}
// end of add_woocommerce_group()
public function get_groups_tree() {
if ($this->groups!==null) {
return $this->groups;
}
$this->groups = array(
'all'=>array('caption'=>esc_html__('All', 'user-role-editor'), 'parent'=>null, 'level'=>0),
'core'=>array('caption'=>esc_html__('Core', 'user-role-editor'), 'parent'=>'all', 'level'=>1),
'general'=>array('caption'=>esc_html__('General', 'user-role-editor'), 'parent'=>'core', 'level'=>2),
'themes'=>array('caption'=>esc_html__('Themes', 'user-role-editor'), 'parent'=>'core', 'level'=>2),
'posts'=>array('caption'=>esc_html__('Posts', 'user-role-editor'), 'parent'=>'core', 'level'=>2),
'pages'=>array('caption'=>esc_html__('Pages', 'user-role-editor'), 'parent'=>'core', 'level'=>2),
'plugins'=>array('caption'=>esc_html__('Plugins', 'user-role-editor'), 'parent'=>'core', 'level'=>2),
'users'=>array('caption'=>esc_html__('Users', 'user-role-editor'), 'parent'=>'core', 'level'=>2)
);
$multisite = $this->lib->get('multisite');
if ($multisite) {
$this->groups['multisite'] = array('caption'=>esc_html__('Multisite', 'user-role-editor'), 'parent'=>'core', 'level'=>2);
}
$this->groups['deprecated'] = array('caption'=>esc_html__('Deprecated', 'user-role-editor'), 'parent'=>'core', 'level'=>2);
$this->add_custom_post_types();
$this->groups['custom'] = array('caption'=>esc_html__('Custom capabilities', 'user-role-editor'), 'parent'=>'all', 'level'=>1);
$this->add_ure_group();
$this->add_woocommerce_groups();
$this->groups = apply_filters('ure_capabilities_groups_tree', $this->groups);
return $this->groups;
}
// end of get_groups_tree()
/**
* return array of built-in WP capabilities (WP 3.1 wp-admin/includes/schema.php)
*
* @return array
*/
private function _get_built_in_wp_caps() {
$wp_version = get_bloginfo('version');
$multisite = $this->lib->get('multisite');
$caps = array();
$caps['switch_themes'] = array('core', 'themes');
$caps['edit_themes'] = array('core', 'themes');
$caps['activate_plugins'] = array('core', 'plugins');
$caps['edit_plugins'] = array('core', 'plugins');
$caps['edit_users'] = array('core', 'users');
$caps['edit_files'] = array('core', 'deprecated');
$caps['manage_options'] = array('core', 'general');
$caps['moderate_comments'] = array('core', 'posts', 'general');
$caps['manage_categories'] = array('core', 'posts', 'general');
$caps['manage_links'] = array('core', 'others');
$caps['upload_files'] = array('core', 'general');
$caps['import'] = array('core', 'general');
$caps['unfiltered_html'] = array('core');
if ($multisite) {
$caps['unfiltered_html'] = array('deprecated');
}
$caps['edit_posts'] = array('core', 'posts');
$caps['edit_others_posts'] = array('core', 'posts');
$caps['edit_published_posts'] = array('core', 'posts');
$caps['publish_posts'] = array('core', 'posts');
$caps['edit_pages'] = array('core', 'pages');
$caps['read'] = array('core', 'general');
$caps['level_10'] = array('core', 'deprecated');
$caps['level_9'] = array('core', 'deprecated');
$caps['level_8'] = array('core', 'deprecated');
$caps['level_7'] = array('core', 'deprecated');
$caps['level_6'] = array('core', 'deprecated');
$caps['level_5'] = array('core', 'deprecated');
$caps['level_4'] = array('core', 'deprecated');
$caps['level_3'] = array('core', 'deprecated');
$caps['level_2'] = array('core', 'deprecated');
$caps['level_1'] = array('core', 'deprecated');
$caps['level_0'] = array('core', 'deprecated');
$caps['edit_others_pages'] = array('core', 'pages');
$caps['edit_published_pages'] = array('core', 'pages');
$caps['publish_pages'] = array('core', 'pages');
$caps['delete_pages'] = array('core', 'pages');
$caps['delete_others_pages'] = array('core', 'pages');
$caps['delete_published_pages'] = array('core', 'pages');
$caps['delete_posts'] = array('core', 'posts');
$caps['delete_others_posts'] = array('core', 'posts');
$caps['delete_published_posts'] = array('core', 'posts');
$caps['delete_private_posts'] = array('core', 'posts');
$caps['edit_private_posts'] = array('core', 'posts');
$caps['read_private_posts'] = array('core', 'posts');
$caps['delete_private_pages'] = array('core', 'pages');
$caps['edit_private_pages'] = array('core', 'pages');
$caps['read_private_pages'] = array('core', 'pages');
$caps['unfiltered_upload'] = array('core', 'general');
$caps['edit_dashboard'] = array('core', 'general');
$caps['update_plugins'] = array('core', 'plugins');
$caps['delete_plugins'] = array('core', 'plugins');
$caps['install_plugins'] = array('core', 'plugins');
$caps['update_themes'] = array('core', 'themes');
$caps['install_themes'] = array('core', 'themes');
$caps['update_core'] = array('core', 'general');
$caps['list_users'] = array('core', 'users');
$caps['remove_users'] = array('core', 'users');
if (version_compare($wp_version, '4.4', '<')) {
$caps['add_users'] = array('core', 'users'); // removed from WP v. 4.4.
}
$caps['promote_users'] = array('core', 'users');
$caps['edit_theme_options'] = array('core', 'themes');
$caps['delete_themes'] = array('core', 'themes');
$caps['export'] = array('core', 'general');
$caps['delete_users'] = array('core', 'users');
$caps['create_users'] = array('core', 'users');
if ($multisite) {
$caps['manage_network'] = array('core', 'multisite', 'general');
$caps['manage_sites'] = array('core', 'multisite', 'general');
$caps['create_sites'] = array('core', 'multisite', 'general');
$caps['manage_network_users'] = array('core', 'multisite', 'users');
$caps['manage_network_themes'] = array('core', 'multisite', 'themes');
$caps['manage_network_plugins'] = array('core', 'multisite', 'plugins');
$caps['manage_network_options'] = array('core', 'multisite', 'general');
}
$caps['create_posts'] = array('core', 'posts');
$caps['create_pages'] = array('core', 'pages');
$caps = apply_filters('ure_built_in_wp_caps', $caps);
$this->built_in_wp_caps = $caps;
return $this->built_in_wp_caps;
}
// end of _get_built_in_wp_caps()
public function get_built_in_wp_caps() {
return $this->built_in_wp_caps;
}
// end of get_built_in_wp_caps()
private function get_post_types_without_caps() {
$pt_without_caps = array();
$wc_pts = URE_Woocommerce_Capabilities::get_post_types_without_caps();
$pt_without_caps = array_merge($pt_without_caps, $wc_pts);
return $pt_without_caps;
}
// end of get_post_types_without_caps()
/**
* Get capabilities registered with custom post type
*
* @param object $post_type
* @param array $post_edit_caps
*/
private function get_registered_cpt_caps($post_type, $post_edit_caps) {
foreach ($post_edit_caps as $capability) {
if (isset($post_type->cap->$capability)) {
$cap = $post_type->cap->$capability;
} else {
continue;
}
if (!isset($this->cpt_caps[$cap])) {
$this->cpt_caps[$cap] = array('custom', 'custom_post_types');
}
$this->cpt_caps[$cap][] = $post_type->name;
}
}
// end of get_registered_cpt_caps()
private function get_custom_post_type_capabilities($post_type, $post_edit_caps) {
$pt_without_caps = $this->get_post_types_without_caps();
if (!in_array($post_type->name, $pt_without_caps)) {
$this->get_registered_cpt_caps($post_type, $post_edit_caps);
}
}
// end of get_custom_post_type_capabilities()
private function _get_all_custom_post_types_capabilities() {
$post_edit_caps = $this->lib->get_edit_post_capabilities();
$post_types = get_post_types(array(), 'objects');
$_post_types = $this->lib->_get_post_types();
$built_in_pt = array('post', 'page');
if ($post_types['attachment']->cap->edit_posts=='edit_posts') {
$built_in_pt[] = 'attachment';
}
$this->cpt_caps = array();
foreach($post_types as $post_type) {
if (!isset($_post_types[$post_type->name])) {
continue;
}
if (in_array($post_type->name, $built_in_pt)) {
continue;
}
if (!isset($post_type->cap)) {
continue;
}
$this->get_custom_post_type_capabilities($post_type, $post_edit_caps);
}
return $this->cpt_caps;
}
// end of _get_all_custom_post_types_capabilities()
private function get_groups_for_custom_cap($cap_id) {
$ure_caps = URE_Own_Capabilities::get_caps_groups();
if (isset($ure_caps[$cap_id])) {
$groups1 = $ure_caps[$cap_id];
}
if (empty($groups1)) {
$wc_caps = URE_Woocommerce_Capabilities::get_caps_groups();
if (isset($wc_caps[$cap_id])) {
$groups1 = $wc_caps[$cap_id];
}
}
if (isset($this->cpt_caps[$cap_id])) {
$groups2 = $this->cpt_caps[$cap_id];
}
$groups = array('custom');
if (!empty($groups1)) {
$groups = array_merge($groups, $groups1);
}
if (!empty($groups2)) {
$groups = array_merge($groups, $groups2);
}
return $groups;
}
// end of get_groups_for_custom_cap()
public function get_cap_groups($cap_id, $built_in_wp_caps=null) {
if (isset($this->built_in_wp_caps[$cap_id])) {
$groups = $built_in_wp_caps[$cap_id];
} else {
$groups = $this->get_groups_for_custom_cap($cap_id);
}
$groups = apply_filters('ure_custom_capability_groups', $groups, $cap_id);
$groups[] = 'all'; // Every capability belongs to the 'all' group
$groups = array_unique($groups);
foreach($groups as $key=>$value) {
$groups[$key] = 'ure-'. $value;
}
return $groups;
}
// end of get_cap_groups()
}
// end of class URE_Capabilities_Groups_Manager
\ No newline at end of file
<?php
/**
* Class to work with user capability
*
* @package User-Role-Editor
* @subpackage Admin
* @author Vladimir Garagulya <support@role-editor.com>
* @copyright Copyright (c) 2010 - 2016, Vladimir Garagulya
**/
class URE_Capability {
const SPACE_REPLACER = '_URE-SR_';
const SLASH_REPLACER = '_URE-SLR_';
const VERT_LINE_REPLACER = '_URE-VLR_';
public static function escape($cap_id) {
$search = array(' ', '/', '|');
$replace = array(self::SPACE_REPLACER, self::SLASH_REPLACER, self::VERT_LINE_REPLACER);
$cap_id_esc = str_replace($search, $replace, $cap_id);
return $cap_id_esc;
}
// end escape()
// sanitize user input for security
public static function validate($cap_id_raw) {
$match = array();
$found = preg_match('/[A-Za-z0-9_\-]*/', $cap_id_raw, $match);
if ( !$found || ($found && ($match[0]!=$cap_id_raw)) ) { // some non-alphanumeric charactes found!
$result = false;
} else {
$result = true;
}
$data = array('result'=>$result, 'cap_id'=>strtolower($match[0]));
return $data;
}
// end of validate()
/**
* Add new user capability
*
* @global WP_Roles $wp_roles
* @return string
*/
public static function add() {
global $wp_roles;
if (!current_user_can('ure_create_capabilities')) {
return esc_html__('Insufficient permissions to work with User Role Editor','user-role-editor');
}
$mess = '';
if (!isset($_POST['capability_id']) || empty($_POST['capability_id'])) {
return 'Wrong Request';
}
$data = self::validate($_POST['capability_id']);
if (!$data['result']) {
return esc_html__('Error: Capability name must contain latin characters and digits only!', 'user-role-editor');
}
$cap_id = $data['cap_id'];
$lib = URE_Lib::get_instance();
$lib->get_user_roles();
$lib->init_full_capabilities();
$full_capabilities = $lib->get('full_capabilities');
if (!isset($full_capabilities[$cap_id])) {
$admin_role = $lib->get_admin_role();
$wp_roles->use_db = true;
$wp_roles->add_cap($admin_role, $cap_id);
$mess = sprintf(esc_html__('Capability %s is added successfully', 'user-role-editor'), $cap_id);
} else {
$mess = sprintf(esc_html__('Capability %s exists already', 'user-role-editor'), $cap_id);
}
return $mess;
}
// end of add()
/**
* Extract capabilities selected from deletion from the $_POST global
*
* @return array
*/
private static function get_caps_for_deletion_from_post($caps_allowed_to_remove) {
$caps = array();
foreach($_POST as $key=>$value) {
if (substr($key, 0, 3)!=='rm_') {
continue;
}
if (!isset($caps_allowed_to_remove[$value])) {
continue;
}
$caps[] = $value;
}
return $caps;
}
// end of get_caps_for_deletion_from_post()
private static function revoke_caps_from_user($user_id, $caps) {
$user = get_user_to_edit($user_id);
foreach($caps as $cap_id) {
if (isset($user->caps[$cap_id])) {
$user->remove_cap($cap_id);
}
}
}
// end of revoke_caps_from_user()
private static function revoke_caps_from_role($wp_role, $caps) {
foreach($caps as $cap_id) {
if ($wp_role->has_cap($cap_id)) {
$wp_role->remove_cap($cap_id);
}
}
}
// end of revoke_caps_from_role()
private static function revoke_caps($caps) {
global $wpdb, $wp_roles;
// remove caps from users
$users_ids = $wpdb->get_col("SELECT $wpdb->users.ID FROM $wpdb->users");
foreach ($users_ids as $user_id) {
self::revoke_caps_from_user($user_id, $caps);
}
// remove caps from roles
foreach ($wp_roles->role_objects as $wp_role) {
self::revoke_caps_from_role($wp_role, $caps);
}
}
// end of revoke_caps()
/**
* Delete capability
*
* @global wpdb $wpdb
* @global WP_Roles $wp_roles
* @return string - information message
*/
public static function delete() {
if (!isset($_POST['action']) || $_POST['action']!='delete-user-capability') {
return 'Wrong Request';
}
if (!current_user_can('ure_delete_capabilities')) {
return esc_html__('Insufficient permissions to work with User Role Editor','user-role-editor');
}
$lib = URE_Lib::get_instance();
$mess = '';
$caps_allowed_to_remove = $lib->get_caps_to_remove();
if (!is_array($caps_allowed_to_remove) || count($caps_allowed_to_remove) == 0) {
return esc_html__('There are no capabilities available for deletion!', 'user-role-editor');
}
$capabilities = self::get_caps_for_deletion_from_post($caps_allowed_to_remove);
if (empty($capabilities)) {
return esc_html__('There are no capabilities available for deletion!', 'user-role-editor');
}
self::revoke_caps($capabilities);
if (count($capabilities)==1) {
$mess = sprintf(esc_html__('Capability %s was removed successfully', 'user-role-editor'), $capabilities[0]);
} else {
$short_list_str = $lib->get_short_list_str($capabilities);
$mess = count($capabilities) .' '. esc_html__('capabilities were removed successfully', 'user-role-editor') .': '.
$short_list_str;
}
return $mess;
}
// end of delete()
}
// end of class URE_Capability
<?php
class URE_Known_JS_CSS_Compatibility_Issues {
public static function fix($hook_suffix, $ure_hook_suffixes) {
$ure_hook_suffixes[] = 'users.php';
$ure_hook_suffixes[] = 'profile.php';
if (!in_array($hook_suffix, $ure_hook_suffixes)) {
return;
}
self::unload_techgostore($hook_suffix);
self::unload_musicplay($hook_suffix);
self::unload_conflict_plugins_css($hook_suffix);
}
// end of fix()
/**
* Unload WP TechGoStore theme JS and CSS to exclude compatibility issues with URE
*/
private static function unload_techgostore($hook_suffix) {
if (!defined('THEME_SLUG') || THEME_SLUG !== 'techgo_') {
return;
}
wp_deregister_script('jqueryform');
wp_deregister_script('tab');
wp_deregister_script('shortcode_js');
wp_deregister_script('fancybox_js');
wp_deregister_script('bootstrap-colorpicker');
wp_deregister_script('logo_upload');
wp_deregister_script('js_wd_menu_backend');
wp_deregister_style('config_css');
wp_deregister_style('fancybox_css');
wp_deregister_style('colorpicker');
wp_deregister_style('font-awesome');
wp_deregister_style('css_wd_menu_backend');
}
// end of unload_techgostore()
/**
* Unload MusicPlay theme CSS to exclude compatibility issues with URE
*
*/
private static function unload_musicplay($hook_suffix) {
if (!in_array($hook_suffix, array('users.php', 'profile.php')) ) {
return;
}
if (defined('THEMENAME') && THEMENAME!=='MusicPlay') {
return;
}
wp_deregister_style('atpadmin');
wp_deregister_style('appointment-style');
wp_deregister_style('atp-chosen');
wp_deregister_style('atp_plupload');
wp_deregister_style('atp-jquery-timepicker-addon');
wp_deregister_style('atp-jquery-ui');
}
// end of unload_music_play()
private static function unload_conflict_plugins_css($hook_suffix) {
global $wp_styles;
if (!in_array($hook_suffix, array('users.php', 'profile.php')) ) {
return;
}
// remove conflict CSS from responsive-admin-maintenance-pro plugin
if (isset($wp_styles->registered['admin-page-css'])) {
wp_deregister_style('admin-page-css');
}
}
// end of unload_conflict_plugins_css()
}
// end of URE_Fix_Known_JS_CSS_Compatibility_Issues
\ No newline at end of file
<?php
/**
* Class to provide the routine for the own User Role Editor user capabilities list
*
* @package User-Role-Editor
* @subpackage Admin
* @author Vladimir Garagulya <support@role-editor.com>
* @copyright Copyright (c) 2010 - 2016, Vladimir Garagulya
**/
class URE_Own_Capabilities {
const URE_SETTINGS_CAP_TR = 'ure_settings_cap';
public static function get_caps() {
$lib = URE_Lib::get_instance();
$ure_caps = array(
'ure_edit_roles' => 1,
'ure_create_roles' => 1,
'ure_delete_roles' => 1,
'ure_create_capabilities' => 1,
'ure_delete_capabilities' => 1,
'ure_manage_options' => 1,
'ure_reset_roles' => 1
);
if ($lib->is_pro()) {
$ure_caps['ure_export_roles'] = 1;
$ure_caps['ure_import_roles'] = 1;
$ure_caps['ure_admin_menu_access'] = 1;
$ure_caps['ure_widgets_access'] = 1;
$ure_caps['ure_widgets_show_access'] = 1;
$ure_caps['ure_meta_boxes_access'] = 1;
$ure_caps['ure_other_roles_access'] = 1;
$ure_caps['ure_edit_posts_access'] = 1;
$ure_caps['ure_plugins_activation_access'] = 1;
$ure_caps['ure_view_posts_access'] = 1;
$ure_caps['ure_front_end_menu_access'] = 1;
$multisite = $lib->get('multisite');
if ($multisite) {
$ure_caps['ure_themes_access'] = 1;
}
}
return $ure_caps;
}
// end of get_caps()
/**
* return key capability to have access to User Role Editor Plugin
*/
public static function get_key_capability() {
$lib = URE_Lib::get_instance();
$key_cap = $lib->get('key_capability');
if (!empty($key_cap)) {
return $key_cap;
}
$multisite = $lib->get('multisite');
if (!$multisite) {
$key_cap = URE_KEY_CAPABILITY;
} else {
$enable_simple_admin_for_multisite = $lib->get_option('enable_simple_admin_for_multisite', 0);
if ( (defined('URE_ENABLE_SIMPLE_ADMIN_FOR_MULTISITE') && URE_ENABLE_SIMPLE_ADMIN_FOR_MULTISITE == 1) ||
$enable_simple_admin_for_multisite) {
$key_cap = URE_KEY_CAPABILITY;
} else {
$key_cap = 'manage_network_plugins';
}
}
$lib->set('key_capability', $key_cap);
return $key_cap;
}
// end of get_key_capability()
/**
* Return user capability for the User Role Editor Settings page
*
* @return string
*/
public static function get_settings_capability() {
$lib = URE_Lib::get_instance();
$settings_cap = $lib->get('settings_capability');
if (!empty($settings_cap)) {
return $settings_cap;
}
$multisite = $lib->get('multisite');
if (!$multisite) {
$settings_cap = 'ure_manage_options';
} else {
$enable_simple_admin_for_multisite = $lib->get_option('enable_simple_admin_for_multisite', 0);
if ((defined('URE_ENABLE_SIMPLE_ADMIN_FOR_MULTISITE') && URE_ENABLE_SIMPLE_ADMIN_FOR_MULTISITE == 1) ||
$enable_simple_admin_for_multisite) {
$settings_cap = 'ure_manage_options';
} else {
$settings_cap = self::get_key_capability();
}
}
$lib->set('settings_capability', $settings_cap);
return $settings_cap;
}
// end of get_settings_capability()
public static function init_caps() {
global $wp_roles;
if (!isset($wp_roles)) {
$wp_roles = new WP_Roles();
}
if (!isset($wp_roles->roles['administrator'])) {
return;
}
$lib = URE_Lib::get_instance();
$multisite = $lib->get('multisite');
// Do not turn on URE caps for local administrator by default under multisite, as there is a superadmin.
$turn_on = !$multisite;
$old_use_db = $wp_roles->use_db;
$wp_roles->use_db = true;
$administrator = $wp_roles->role_objects['administrator'];
$ure_caps = self::get_caps();
foreach(array_keys($ure_caps) as $cap) {
if (!$administrator->has_cap($cap)) {
$administrator->add_cap($cap, $turn_on);
}
}
$wp_roles->use_db = $old_use_db;
}
// end of init_caps()
/**
* Return list of URE capabilities with data about groups they were included
*
* @return array
*/
public static function get_caps_groups() {
$ure_caps = self::get_caps();
$caps = array();
foreach($ure_caps as $ure_cap=>$value) {
$caps[$ure_cap] = array('custom', 'user_role_editor');
}
return $caps;
}
// end of get_caps_groups()
}
// end of URE_Capabilities class
\ No newline at end of file
<?php
/*
* Main class of User Role Editor WordPress plugin
* Author: Vladimir Garagulya
* Author email: support@role-editor.com
* Author URI: https://www.role-editor.com
* License: GPL v2+
*
*/
class URE_Protect_Admin {
private $lib = null;
private $user_to_check = null; // cached list of user IDs, who has Administrator role
public function __construct($lib) {
$this->lib = $lib;
$this->user_to_check = array();
// Exclude administrator role from edit list.
add_filter('editable_roles', array($this, 'exclude_admin_role'));
// prohibit any actions with user who has Administrator role
add_filter('user_has_cap', array($this, 'not_edit_admin'), 10, 3);
// exclude users with 'Administrator' role from users list
add_action('pre_user_query', array($this, 'exclude_administrators'));
// do not show 'Administrator (s)' view above users list
add_filter('views_users', array($this, 'exclude_admins_view'));
}
// end of __construct()
// apply protection to the user edit pages only
protected function is_protection_applicable() {
$result = false;
$links_to_block = array('profile.php', 'users.php', 'user-new.php');
foreach ($links_to_block as $key => $value) {
$result = stripos($_SERVER['REQUEST_URI'], $value);
if ($result !== false) {
break;
}
}
return $result;
}
// end of is_protection_applicable()
/**
* exclude administrator role from the roles list
*
* @param string $roles
* @return array
*/
public function exclude_admin_role($roles) {
if ($this->is_protection_applicable() && isset($roles['administrator'])) {
unset($roles['administrator']);
}
return $roles;
}
// end of exclude_admin_role()
/**
* Check if user has "Administrator" role assigned
*
* @global wpdb $wpdb
* @param int $user_id
* @return boolean returns true is user has Role "Administrator"
*/
private function has_administrator_role($user_id) {
global $wpdb;
if (empty($user_id) || !is_numeric($user_id)) {
return false;
}
$table_name = $this->lib->get_usermeta_table_name();
$meta_key = $wpdb->prefix . 'capabilities';
$query = "SELECT count(*)
FROM $table_name
WHERE user_id=$user_id AND meta_key='$meta_key' AND meta_value like '%administrator%'";
$has_admin_role = $wpdb->get_var($query);
if ($has_admin_role > 0) {
$result = true;
} else {
$result = false;
}
// cache checking result for the future use
$this->user_to_check[$user_id] = $result;
return $result;
}
// end of has_administrator_role()
/**
* We have two vulnerable queries with user id at admin interface, which should be processed
* 1st: http://blogdomain.com/wp-admin/user-edit.php?user_id=ID&wp_http_referer=%2Fwp-admin%2Fusers.php
* 2nd: http://blogdomain.com/wp-admin/users.php?action=delete&user=ID&_wpnonce=ab34225a78
* If put Administrator user ID into such request, user with lower capabilities (if he has 'edit_users')
* can edit, delete admin record
* This function removes 'edit_users' capability from current user capabilities
* if request has admin user ID in it
*
* @param array $allcaps
* @param type $caps
* @param string $name
* @return array
*/
public function not_edit_admin($allcaps, $caps, $name) {
$user_keys = array('user_id', 'user');
foreach ($user_keys as $user_key) {
$access_deny = false;
$user_id = $this->lib->get_request_var($user_key, 'get');
if (empty($user_id)) {
break;
}
if ($user_id == 1) { // built-in WordPress Admin
$access_deny = true;
} else {
if (!isset($this->user_to_check[$user_id])) {
// check if user_id has Administrator role
$access_deny = $this->has_administrator_role($user_id);
} else {
// user_id was checked already, get result from cash
$access_deny = $this->user_to_check[$user_id];
}
}
if ($access_deny) {
unset($allcaps['edit_users']);
}
break;
}
return $allcaps;
}
// end of not_edit_admin()
/**
* add where criteria to exclude users with 'Administrator' role from users list
*
* @global wpdb $wpdb
* @param type $user_query
*/
public function exclude_administrators($user_query) {
global $wpdb;
if (!$this->is_protection_applicable()) { // block the user edit stuff only
return;
}
// get user_id of users with 'Administrator' role
$tableName = $this->lib->get_usermeta_table_name();
$meta_key = $wpdb->prefix . 'capabilities';
$admin_role_key = '%"administrator"%';
$query = "select user_id
from $tableName
where meta_key='$meta_key' and meta_value like '$admin_role_key'";
$ids_arr = $wpdb->get_col($query);
if (is_array($ids_arr) && count($ids_arr) > 0) {
$ids = implode(',', $ids_arr);
$user_query->query_where .= " AND ( $wpdb->users.ID NOT IN ( $ids ) )";
}
}
// end of exclude_administrators()
/*
* Exclude view of users with Administrator role
*
*/
public function exclude_admins_view($views) {
unset($views['administrator']);
return $views;
}
// end of exclude_admins_view()
}
// end of URE_Protect_Admin class
<?php
class URE_Role_Additional_Options {
private static $instance = null;
private $lib = null;
private $items = null;
private $active_items = null;
const STORAGE_ID = 'ure_role_additional_options_values';
public function __construct($lib) {
$this->lib = $lib;
$this->init();
}
// end of __construct()
public static function get_instance($lib) {
if (self::$instance===null) {
self::$instance = new URE_Role_Additional_Options($lib);
}
return self::$instance;
}
// end of get_instance()
public static function create_item($id, $label, $hook, $routine) {
$item = new stdClass();
$item->id = $id;
$item->label = $label;
$item->hook = $hook;
$item->routine = $routine;
return $item;
}
// end of create_item()
public static function get_active_items() {
$data = get_option(self::STORAGE_ID, array());
/*
// It's enough to update the role via URE to achieve this, that why this code is commented:
// remove deactivated options
$modified = false;
foreach($data as $role=>$items) {
foreach($items as $item_id) {
if (!isset($this->items[$item_id])) {
$modified = true;
unset($data[$role][$item_id]);
}
}
}
if ($modified) {
put_option(self::STORAGE_ID, $data);
}
*/
return $data;
}
private function init() {
$this->items = array();
$item = self::create_item('hide_admin_bar', esc_html__('Hide admin bar', 'user-role-editor'), 'init', 'ure_hide_admin_bar');
$this->items[$item->id] = $item;
// Allow other developers to modify the list of role's additonal options
$this->items = apply_filters('ure_role_additional_options', $this->items);
$this->active_items = self::get_active_items();
}
// end of init()
public function set_active_items_hooks() {
global $current_user;
if (current_user_can('ure_edit_roles')) {
return;
}
foreach($current_user->roles as $role) {
if (!isset($this->active_items[$role])) {
continue;
}
foreach(array_keys($this->active_items[$role]) as $item_id) {
if (isset($this->items[$item_id])) {
add_action($this->items[$item_id]->hook, $this->items[$item_id]->routine, 99);
}
}
}
}
// end of set_active_items_hooks()
public function save($current_role) {
$this->active_items = self::get_active_items();
$this->active_items[$current_role] = array();
foreach($this->items as $item) {
if (isset($_POST[$item->id])) {
$this->active_items[$current_role][$item->id] = 1;
}
}
update_option(self::STORAGE_ID, $this->active_items);
}
// end of save()
public function show($current_role) {
?>
<hr />
<?php echo esc_html__('Additional Options', 'user-role-editor');?>:
<table class="form-table" style="clear:none;" cellpadding="0" cellspacing="0">
<tr>
<td>
<?php
$first_time = true;
foreach($this->items as $item) {
$checked = (isset($this->active_items[$current_role]) &&
isset($this->active_items[$current_role][$item->id])) ? 'checked="checked"' : '';
if (!$first_time) {
?>
<br/>
<?php
}
?>
<input type="checkbox" name="<?php echo $item->id;?>" id="<?php echo $item->id;?>" value="<?php echo $item->id;?>" <?php echo $checked;?> >
<label for="<?php echo $item->id;?>"><?php echo $item->label;?></label>
<?php
$first_time = false;
}
?>
</td>
<td></td>
</tr>
</table>
<?php
}
// end of show()
}
// end of URE_Role_Additional_Options class
\ No newline at end of file
<?php
/**
* Role capabilities View class to output HTML with role capabilities
*
* @package User-Role-Editor
* @subpackage Admin
* @author Vladimir Garagulya <support@role-editor.com>
* @copyright Copyright (c) 2010 - 2016, Vladimir Garagulya
**/
class URE_Role_View extends URE_View {
private $lib = null;
public $role_default_html = '';
private $role_to_copy_html = '';
private $role_select_html = '';
private $role_delete_html = '';
public function __construct() {
parent::__construct();
$this->lib = URE_Lib::get_instance();
$this->caps_to_remove = $this->lib->get_caps_to_remove();
}
// end of __construct()
public function role_default_prepare_html($select_width=200) {
$roles = $this->lib->get('roles');
if (!isset($roles) || !$roles) {
// get roles data from database
$roles = $this->lib->get_user_roles();
}
$caps_access_restrict_for_simple_admin = $this->lib->get_option('caps_access_restrict_for_simple_admin', 0);
$show_admin_role = $this->lib->show_admin_role_allowed();
if ($select_width>0) {
$select_style = 'style="width: '. $select_width .'px"';
} else {
$select_style = '';
}
$wp_default_role = $this->lib->get('wp_default_role');
$this->role_default_html = '<select id="default_user_role" name="default_user_role" '. $select_style .'>';
foreach ($roles as $key => $value) {
$selected = selected($key, $wp_default_role, false);
$disabled = ($key==='administrator' && $caps_access_restrict_for_simple_admin && !$this->lib->is_super_admin()) ? 'disabled' : '';
if ($show_admin_role || $key != 'administrator') {
$translated_name = esc_html__($value['name'], 'user-role-editor'); // get translation from URE language file, if exists
if ($translated_name === $value['name']) { // get WordPress internal translation
$translated_name = translate_user_role($translated_name);
}
$translated_name .= ' (' . $key . ')';
$this->role_default_html .= '<option value="' . $key . '" ' . $selected .' '. $disabled .'>' . $translated_name . '</option>';
}
}
$this->role_default_html .= '</select>';
}
// end of role_default_prepare_html()
private function role_select_copy_prepare_html($select_width=200) {
global $current_user;
$key_capability = URE_Own_Capabilities::get_key_capability();
$user_is_ure_admin = current_user_can($key_capability);
$role_to_skip = ($user_is_ure_admin) ? '':$current_user->roles[0];
$caps_access_restrict_for_simple_admin = $this->lib->get_option('caps_access_restrict_for_simple_admin', 0);
$show_admin_role = $this->lib->show_admin_role_allowed();
$this->role_to_copy_html = '<select id="user_role_copy_from" name="user_role_copy_from" style="width: '. $select_width .'px">
<option value="none" selected="selected">' . esc_html__('None', 'user-role-editor') . '</option>';
$this->role_select_html = '<select id="user_role" name="user_role" onchange="ure_role_change(this.value);">';
$current_role = $this->lib->get('current_role');
$roles = $this->lib->get_editable_user_roles();
foreach ($roles as $key => $value) {
if ($key===$role_to_skip) { // skip role of current user if he does not have full access to URE
continue;
}
$selected1 = selected($key, $current_role, false);
$disabled = ($key==='administrator' && $caps_access_restrict_for_simple_admin && !$this->lib->is_super_admin()) ? 'disabled' : '';
if ($show_admin_role || $key != 'administrator') {
$translated_name = esc_html__($value['name'], 'user-role-editor'); // get translation from URE language file, if exists
if ($translated_name === $value['name']) { // get WordPress internal translation
$translated_name = translate_user_role($translated_name);
}
$translated_name .= ' (' . $key . ')';
$this->role_select_html .= '<option value="' . $key . '" ' . $selected1 .' '. $disabled .'>' . $translated_name . '</option>';
$this->role_to_copy_html .= '<option value="' . $key .'" '. $disabled .'>' . $translated_name . '</option>';
}
}
$this->role_select_html .= '</select>';
$this->role_to_copy_html .= '</select>';
}
// end of role_select_copy_prepare_html()
private function role_delete_prepare_html() {
$roles_can_delete = $this->lib->get_roles_can_delete();
if ($roles_can_delete && count($roles_can_delete) > 0) {
$this->role_delete_html = '<select id="del_user_role" name="del_user_role" width="200" style="width: 200px">';
foreach ($roles_can_delete as $key => $value) {
$this->role_delete_html .= '<option value="' . $key . '">' . esc_html__($value, 'user-role-editor') . '</option>';
}
$this->role_delete_html .= '<option value="-1" style="color: red;">' . esc_html__('Delete All Unused Roles', 'user-role-editor') . '</option>';
$this->role_delete_html .= '</select>';
} else {
$this->role_delete_html = '';
}
}
// end of role_delete_prepare_html()
/**
* Build HTML for select drop-down list from capabilities we can remove
*
* @return string
**/
public static function caps_to_remove_html() {
global $wp_roles;
$lib = URE_Lib::get_instance();
$caps_to_remove = $lib->get_caps_to_remove();
if (empty($caps_to_remove) || !is_array($caps_to_remove) && count($caps_to_remove)==0) {
return '';
}
$caps = array_keys($caps_to_remove);
asort($caps);
$network_admin = filter_input(INPUT_POST, 'network_admin', FILTER_SANITIZE_NUMBER_INT);
$current_role = filter_input(INPUT_POST, 'current_role', FILTER_SANITIZE_STRING);
if (!isset($wp_roles->roles[$current_role])) {
$current_role = '';
}
ob_start();
?>
<form name="ure_remove_caps_form" id="ure_remove_caps_form" method="POST"
action="<?php echo URE_WP_ADMIN_URL . ($network_admin ? 'network/':'') . URE_PARENT .'?page=users-'.URE_PLUGIN_FILE;?>" >
<table id="ure_remove_caps_table">
<tr>
<th>
<input type="checkbox" id="ure_remove_caps_select_all">
</th>
<th></th>
</tr>
<?php
foreach($caps as $cap_id) {
$cap_id_esc = 'rm_'.URE_Capability::escape($cap_id);
?>
<tr>
<td>
<input type="checkbox" name="<?php echo $cap_id_esc;?>" id="<?php echo $cap_id_esc;?>" class="ure-cb-column"
value="<?php echo $cap_id;?>"/>
</td>
<td>
<label for="<?php echo $cap_id_esc;?>"><?php echo $cap_id; ?></label>
</td>
</tr>
<?php
} // foreach($caps...)
?>
</table>
<input type="hidden" name="action" id="action" value="delete-user-capability" />
<input type="hidden" name="user_role" id="ure_role" value="<?php echo $current_role;?>" />
<?php wp_nonce_field('user-role-editor', 'ure_nonce'); ?>
</form>
<?php
$html = ob_get_contents();
ob_end_clean();
return $html;
}
// end of caps_to_remove_html()
public function role_edit_prepare_html($select_width=200) {
$this->role_select_copy_prepare_html($select_width);
$multisite = $this->lib->get('multisite');
if ($multisite && !is_network_admin()) {
$this->role_default_prepare_html($select_width);
}
$this->role_delete_prepare_html();
}
// end of role_edit_prepare_html()
public function display_edit_dialogs() {
$multisite = $this->lib->get('multisite');
$current_role = $this->lib->get('current_role');
$current_role_name = $this->lib->get('current_role_name');
?>
<script language="javascript" type="text/javascript">
var ure_current_role = '<?php echo $current_role; ?>';
var ure_current_role_name = '<?php echo $current_role_name; ?>';
</script>
<!-- popup dialogs markup -->
<div id="ure_add_role_dialog" class="ure-modal-dialog" style="padding: 10px;">
<form id="ure_add_role_form" name="ure_add_role_form" method="POST">
<div class="ure-label"><?php esc_html_e('Role name (ID): ', 'user-role-editor'); ?></div>
<div class="ure-input"><input type="text" name="user_role_id" id="user_role_id" size="25"/></div>
<div class="ure-label"><?php esc_html_e('Display Role Name: ', 'user-role-editor'); ?></div>
<div class="ure-input"><input type="text" name="user_role_name" id="user_role_name" size="25"/></div>
<div class="ure-label"><?php esc_html_e('Make copy of: ', 'user-role-editor'); ?></div>
<div class="ure-input"><?php echo $this->role_to_copy_html; ?></div>
</form>
</div>
<div id="ure_rename_role_dialog" class="ure-modal-dialog" style="padding: 10px;">
<form id="ure_rename_role_form" name="ure_rename_role_form" method="POST">
<div class="ure-label"><?php esc_html_e('Role name (ID): ', 'user-role-editor'); ?></div>
<div class="ure-input"><input type="text" name="ren_user_role_id" id="ren_user_role_id" size="25" disabled /></div>
<div class="ure-label"><?php esc_html_e('Display Role Name: ', 'user-role-editor'); ?></div>
<div class="ure-input"><input type="text" name="ren_user_role_name" id="ren_user_role_name" size="25"/></div>
</form>
</div>
<div id="ure_delete_role_dialog" class="ure-modal-dialog">
<div style="padding:10px;">
<div class="ure-label"><?php esc_html_e('Select Role:', 'user-role-editor');?></div>
<div class="ure-input"><?php echo $this->role_delete_html; ?></div>
</div>
</div>
<?php
if ($multisite && !is_network_admin()) {
?>
<div id="ure_default_role_dialog" class="ure-modal-dialog">
<div style="padding:10px;">
<?php echo $this->role_default_html; ?>
</div>
</div>
<?php
}
?>
<div id="ure_delete_capability_dialog" class="ure-modal-dialog">
<div style="padding:10px;">
<div class="ure-input"></div>
</div>
</div>
<div id="ure_add_capability_dialog" class="ure-modal-dialog">
<div style="padding:10px;">
<div class="ure-label"><?php esc_html_e('Capability name (ID): ', 'user-role-editor'); ?></div>
<div class="ure-input"><input type="text" name="capability_id" id="capability_id" size="25"/></div>
</div>
</div>
<?php
}
// end of output_role_edit_dialogs()
/**
* output HTML code to create URE toolbar
*
* @param string $this->current_role
* @param boolean $role_delete
* @param boolean $capability_remove
*/
public function toolbar() {
$caps_access_restrict_for_simple_admin = $this->lib->get_option('caps_access_restrict_for_simple_admin', 0);
if ($caps_access_restrict_for_simple_admin) {
$add_del_role_for_simple_admin = $this->lib->get_option('add_del_role_for_simple_admin', 1);
} else {
$add_del_role_for_simple_admin = 1;
}
$super_admin = $this->lib->is_super_admin();
$multisite = $this->lib->get('multisite');
?>
<div id="ure_toolbar" >
<div id="ure_update">
<button id="ure_update_role" class="ure_toolbar_button button-primary" >Update</button>
<?php
do_action('ure_role_edit_toolbar_update');
?>
</div>
<?php
if (!$multisite || $super_admin || $add_del_role_for_simple_admin) { // restrict single site admin
?>
<hr />
<?php
if (current_user_can('ure_create_roles')) {
?>
<button id="ure_add_role" class="ure_toolbar_button">Add Role</button>
<?php
}
?>
<button id="ure_rename_role" class="ure_toolbar_button">Rename Role</button>
<?php
} // restrict single site admin
if (!$multisite || $super_admin || !$caps_access_restrict_for_simple_admin) { // restrict single site admin
if (current_user_can('ure_create_capabilities')) {
?>
<button id="ure_add_capability" class="ure_toolbar_button">Add Capability</button>
<?php
}
} // restrict single site admin
if (!$multisite || $super_admin || $add_del_role_for_simple_admin) { // restrict single site admin
if (!empty($this->role_delete_html) && current_user_can('ure_delete_roles')) {
?>
<button id="ure_delete_role" class="ure_toolbar_button">Delete Role</button>
<?php
}
} // restrict single site admin
if (!$multisite || $super_admin || !$caps_access_restrict_for_simple_admin) { // restrict single site admin
if (!empty($this->caps_to_remove) && is_array($this->caps_to_remove) && count($this->caps_to_remove)>0 &&
current_user_can('ure_delete_capabilities')) {
?>
<button id="ure_delete_capability" class="ure_toolbar_button">Delete Capability</button>
<?php
}
if ($multisite && !is_network_admin()) { // Show for single site for WP multisite only
?>
<hr />
<button id="ure_default_role" class="ure_toolbar_button">Default Role</button>
<hr />
<?php
}
?>
<div id="ure_service_tools">
<?php
do_action('ure_role_edit_toolbar_service');
if (!$multisite || (is_main_site( get_current_blog_id()) || (is_network_admin() && $this->lib->is_super_admin()))) {
if (current_user_can('ure_reset_roles')) {
?>
<button id="ure_reset_roles_button" class="ure_toolbar_button" style="color: red;" title="Reset Roles to its original state">Reset</button>
<?php
}
}
?>
</div>
<?php
} // restrict single site admin
?>
</div>
<?php
}
// end of toolbar()
private function display_options() {
$multisite = $this->lib->get('multisite');
$active_for_network = $this->lib->get('active_for_network');
?>
<div id="ure_editor_options">
<?php
$caps_readable = $this->lib->get('caps_readable');
if ($caps_readable) {
$checked = 'checked="checked"';
} else {
$checked = '';
}
$caps_access_restrict_for_simple_admin = $this->lib->get_option('caps_access_restrict_for_simple_admin', 0);
if ($this->lib->is_super_admin() || !$multisite || !$this->lib->is_pro() || !$caps_access_restrict_for_simple_admin) {
?>
<input type="checkbox" name="ure_caps_readable" id="ure_caps_readable" value="1" <?php echo $checked; ?> onclick="ure_turn_caps_readable(0);"/>
<label for="ure_caps_readable"><?php esc_html_e('Show capabilities in human readable form', 'user-role-editor'); ?></label>&nbsp;&nbsp;
<?php
$show_deprecated_caps = $this->lib->get('show_deprecated_caps');
if ($show_deprecated_caps) {
$checked = 'checked="checked"';
} else {
$checked = '';
}
?>
<input type="checkbox" name="ure_show_deprecated_caps" id="ure_show_deprecated_caps" value="1" <?php echo $checked; ?> onclick="ure_turn_deprecated_caps(0);"/>
<label for="ure_show_deprecated_caps"><?php esc_html_e('Show deprecated capabilities', 'user-role-editor'); ?></label>
<?php
}
if ($multisite && $active_for_network && !is_network_admin() && is_main_site(get_current_blog_id()) && $this->lib->is_super_admin()) {
$hint = esc_html__('If checked, then apply action to ALL sites of this Network');
$apply_to_all = $this->lib->get('apply_to_all');
if ($apply_to_all) {
$checked = 'checked="checked"';
$fontColor = 'color:#FF0000;';
} else {
$checked = '';
$fontColor = '';
}
?>
<div style="float: right; margin-left:10px; margin-right: 20px; <?php echo $fontColor; ?>" id="ure_apply_to_all_div">
<input type="checkbox" name="ure_apply_to_all" id="ure_apply_to_all" value="1"
<?php echo $checked; ?> title="<?php echo $hint; ?>" onclick="ure_apply_to_all_on_click(this)"/>
<label for="ure_apply_to_all" title="<?php echo $hint; ?>"><?php esc_html_e('Apply to All Sites', 'user-role-editor'); ?></label>
</div>
<?php
}
?>
</div>
<hr>
<?php
}
// end of display_options()
public function display() {
?>
<div class="postbox" style="min-width:800px;width:100%">
<div id="ure_role_selector">
<span id="ure_role_select_label"><?php esc_html_e('Select Role and change its capabilities:', 'user-role-editor'); ?></span> <?php echo $this->role_select_html; ?>
</div>
<div class="inside">
<?php
$this->display_options();
$this->display_caps();
$ao = $this->lib->get('role_additional_options');
$current_role = $this->lib->get('current_role');
$ao->show($current_role);
?>
<input type="hidden" name="object" value="role" />
</div>
</div>
<?php
}
// end of display()
}
// end of class URE_Role_View
\ No newline at end of file
<?php
/*
* User Role Editor On Screen Help class
*
*/
class URE_Screen_Help {
protected function get_general_tab() {
$text = '<h2>'. esc_html__('User Role Editor Options page help', 'user-role-editor') .'</h2>
<p>
<ul>
<li><strong>' . esc_html__('Show Administrator role at User Role Editor', 'user-role-editor').'</strong> - ' .
esc_html__('turn this option on in order to make the "Administrator" role available at the User Role Editor '
. 'roles selection drop-down list. It is hidden by default for security reasons.','user-role-editor') . '</li>
<li><strong>' . esc_html__('Show capabilities in the human readable form','user-role-editor').'</strong> - ' .
esc_html__('automatically converts capability names from the technical form for internal use like '
. '"edit_others_posts" to more user friendly form, e.g. "Edit others posts".','user-role-editor') . '</li>
<li><strong>' . esc_html__('Show deprecated capabilities','user-role-editor').'</strong> - '.
esc_html__('Capabilities like "level_0", "level_1" are deprecated and are not used by WordPress. '
. 'They are left at the user roles for the compatibility purpose with the old themes and plugins code. '
. 'Turning on this option will show those deprecated capabilities.', 'user-role-editor') . '</li>
<li><strong>' . esc_html__('Edit user capabilities','user-role-editor').'</strong> - '.
esc_html__('If turned off - capabilities section of selected user is shown in readonly mode. '
. 'Administrator can not assign capabilities to the user directly. '
. 'He should make it using roles only.', 'user-role-editor') . '</li>';
$text = apply_filters('ure_get_settings_general_tab_help', $text);
$text .='
</ul>
</p>';
return $text;
}
// end of get_general_tab()
protected function get_additional_modules_tab() {
$text = '<h2>'. esc_html__('User Role Editor Options page help', 'user-role-editor') .'</h2>
<p>
<ul>';
if (!is_multisite()) {
$text .= '<li><strong>' . esc_html__('Count users without role', 'user-role-editor').'</strong> - ' .
esc_html__('Show at the "Users" page a quant of users without role. Module allows to assign all of them '.
'an empty role "No rights", in order to look on the users list with role "No rights" at the separate tab then.','user-role-editor') . '</li>';
}
$text = apply_filters('ure_get_settings_additional_modules_tab_help', $text);
$text .='
</ul>
</p>';
return $text;
}
// end of get_additional_modules_tab()
protected function get_default_roles_tab() {
$text = '<h2>'. esc_html__('User Role Editor Options page help', 'user-role-editor') .'</h2>
<p>
<ul>
<li><strong>' . esc_html__('Other default roles for new registered user', 'user-role-editor').'</strong> - ' .
esc_html__('select roles below to assign them to the new user automatically as an addition to the primary role. '.
'Note for multisite environment: take into account that other default roles should exist at the site, '.
'in order to be assigned to the new registered users.','user-role-editor') . '</li>';
$text = apply_filters('ure_get_settings_default_roles_tab_help', $text);
$text .='
</ul>
</p>';
return $text;
}
// end of get_default_roles_tab()
protected function get_multisite_tab() {
$text = '<h2>'. esc_html__('User Role Editor Options page help', 'user-role-editor') .'</h2>
<p>
<ul>
<li><strong>' . esc_html__('Allow non super-admininstrators to create, edit and delete users', 'user-role-editor').'</strong> - ' .
esc_html__('Super administrator only may create, edit and delete users under WordPress multi-site by default. '
. 'Turn this option on in order to remove this limitation.','user-role-editor') . '</li>';
$text = apply_filters('ure_get_settings_multisite_tab_help', $text);
$text .='
</ul>
</p>';
return $text;
}
// end of get_multisite_tab()
public function get_settings_help($tab_name) {
switch ($tab_name) {
case 'general':{
$text = $this->get_general_tab();
break;
}
case 'additional_modules':{
$text = $this->get_additional_modules_tab();
break;
}
case 'default_roles':{
$text = $this->get_default_roles_tab();
break;
}
case 'multisite':{
$text = $this->get_multisite_tab();
break;
}
default:
}
return $text;
}
// end of get_settings_help()
}
// end of URE_Screen_Help
<?php
/*
* User Role Editor Pro WordPress plugin
* Author: Vladimir Garagulya
* Author email: support@role-editor.com
* Author URI: https://www.role-editor.com
* License: GPL v3
*
*/
/*
* User Role Editor's internal tasks queue
* Usage: on URE plugin activation URE adds 'on_activation' task to this queue, which fires 'ure_on_activation' action
* on the next WordPress call. It's useful when some action is needed unavailable at standard plugin activation point,
* like 'admin_menu', which is used for the admin menu access data conversion - class URE_Admin_Menu_Hashes.
* Class User_Role_Editor_Pro adds execute_once method for the 'ure_on_activation' action, where
* URE_Admin_Menu_Hashes::require_data_conversion(); method is called which registers tasks for data coversion, including
* individual tasks for every site of the multisite network
*
*/
class URE_Task_Queue {
private static $instance = null; // object exemplar reference according to singleton patern
const OPTION_NAME = 'ure_tasks_queue';
private $queue = null;
public static function get_instance() {
if (self::$instance===null) {
self::$instance = new URE_Task_Queue();
}
return self::$instance;
}
// end of get_instance()
protected function __construct() {
$this->init();
}
// end of __construct()
private function init() {
$this->queue = get_option(self::OPTION_NAME, array());
}
// end of init()
public function reinit() {
$this->init();
}
// end of reinit()
/**
*
* @param string $task_id
* @param array $args=array('action'=>'action_name', 'routine'=>'routine_name', 'priority'=>99)
*/
public function add($task_id, $args=array()) {
$this->queue[$task_id] = $args;
update_option(self::OPTION_NAME, $this->queue);
}
// end of add_task()
public function remove($task_id) {
if (isset($this->queue[$task_id])) {
unset($this->queue[$task_id]);
update_option(self::OPTION_NAME, $this->queue);
}
}
// end of remove_task()
/**
* Returns true in case a queue is empty
*
* @return boolean
*/
public function is_empty() {
return count($this->queue)==0;
}
// end of is_empty()
/**
* Consumers should add there tasks with add_method and add 'ure_fulfil_task' action routine to work on it.
* Do not forget remove task after it was fulfilled.
*
* @return void
*/
public function process() {
if ($this->is_empty()) {
return;
}
foreach($this->queue as $task_id=>$task) {
if ($task_id=='on_activation') {
do_action('ure_on_activation');
$this->remove('on_activation'); // remove this task after execution if it was defined
} elseif (!empty($task['action'])) {
$priority = empty($task['priority']) ? 10: $task['priority'];
add_action($task['action'], $task['routine'], $priority);
} else {
add_action('init', $task['routine']);
}
}
}
// end of process();
/**
* Private clone method to prevent cloning of the instance of the
* *Singleton* instance.
*
* @return void
*/
private function __clone() {
}
// end of __clone()
/**
* Private unserialize method to prevent unserializing of the *Singleton*
* instance.
*
* @return void
*/
private function __wakeup() {
}
// end of __wakeup()
}
// end of class URE_On_Activation
\ No newline at end of file
<?php
/*
* Stuff specific for User Role Editor WordPress plugin
* Author: Vladimir Garagulya
* Author email: support@role-editor.com
* Author URI: https://www.role-editor.com
*
*/
/**
* This class contains general stuff for usage at WordPress plugins
*/
class Ure_Lib extends URE_Base_Lib {
const TRANSIENT_EXPIRATION = 600;
protected $roles = null;
protected $notification = ''; // notification message to show on page
protected $apply_to_all = 0;
protected $current_role = '';
protected $capabilities_to_save = null;
protected $wp_default_role = '';
protected $current_role_name = '';
protected $user_to_edit = '';
protected $show_deprecated_caps = false;
protected $caps_readable = false;
protected $caps_columns_quant = 1;
protected $hide_pro_banner = false;
protected $full_capabilities = false;
protected $ure_object = 'role'; // what to process, 'role' or 'user'
protected $advert = null;
protected $role_additional_options = null;
protected $bbpress = null; // reference to the URE_bbPress class instance
protected $key_capability = ''; // Key user capability for get full access to the User Role Editor
protected $settings_capability = ''; // User capability for access to User Role Editor Settings
// when allow_edit_users_to_not_super_admin option is turned ON, we set this property to true
// when we raise single site admin permissions up to the superadmin for the 'Add new user' new-user.php page
// User_Role_Editor::allow_add_user_as_superadmin()
protected $raised_permissions = false;
protected $debug = false;
/** class constructor
*
* @param string $options_id
*
*/
protected function __construct($options_id) {
parent::__construct($options_id);
$this->debug = defined('URE_DEBUG') && (URE_DEBUG==1 || URE_DEBUG==true);
$this->bbpress = URE_bbPress::get_instance($this);
$this->upgrade();
}
// end of __construct()
public static function get_instance($options_id = '') {
if (self::$instance === null) {
if (empty($options_id)) {
throw new Exception('URE_Lib::get_inctance() - Error: plugin options ID string is required');
}
// new static() will work too
self::$instance = new URE_Lib($options_id);
}
return self::$instance;
}
// end of get_instance()
protected function upgrade() {
$ure_version = $this->get_option('ure_version', '0');
if (version_compare( $ure_version, URE_VERSION, '<' ) ) {
// put version upgrade stuff here
$this->put_option('ure_version', URE_VERSION, true);
}
}
// end of upgrade()
/**
* Is this the Pro version?
* @return boolean
*/
public function is_pro() {
return false;
}
// end of is_pro()
public function get_ure_object() {
return $this->ure_object;
}
// end of get_ure_object();
public function set_notification($value) {
$this->notification = $value;
}
// end of esc_html()
public function set_apply_to_all($value) {
$this->apply_to_all = !empty($value) ? 1 : 0;
}
// end of set_apply_to_all()
public function set_raised_permissions($value) {
$this->raised_permissions = !empty($value) ? true : false;
}
// end of set_raised_permissions()
/**
* get options for User Role Editor plugin
* User Role Editor stores its options at the main blog/site only and applies them to the all network
*
*/
protected function init_options($options_id) {
global $wpdb;
if ($this->multisite) {
if ( ! function_exists( 'is_plugin_active_for_network' ) ) { // Be sure the function is defined before trying to use it
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
}
$this->active_for_network = is_plugin_active_for_network(URE_PLUGIN_BASE_NAME);
}
$current_blog = $wpdb->blogid;
if ($this->multisite && $current_blog!=$this->main_blog_id) {
if ($this->active_for_network) { // plugin is active for whole network, so get URE options from the main blog
switch_to_blog($this->main_blog_id);
}
}
$this->options_id = $options_id;
$this->options = get_option($options_id);
if ($this->multisite && $current_blog!=$this->main_blog_id) {
if ($this->active_for_network) { // plugin is active for whole network, so return back to the current blog
restore_current_blog();
}
}
}
// end of init_options()
/**
* saves options array into WordPress database wp_options table
*/
public function flush_options() {
global $wpdb;
$current_blog = $wpdb->blogid;
if ($this->multisite && $current_blog!==$this->main_blog_id) {
if ($this->active_for_network) { // plugin is active for whole network, so get URE options from the main blog
switch_to_blog($this->main_blog_id); // in order to save URE options to the main blog
}
}
update_option($this->options_id, $this->options);
if ($this->multisite && $current_blog!==$this->main_blog_id) {
if ($this->active_for_network) { // plugin is active for whole network, so return back to the current blog
restore_current_blog();
}
}
}
// end of flush_options()
public function get_main_blog_id() {
return $this->main_blog_id;
}
/**
* return front-end according to the context - role or user editor
*/
public function editor() {
if (!$this->editor_init0()) {
$this->show_message(esc_html__('Error: wrong request', 'user-role-editor'));
return false;
}
$this->process_user_request();
$this->editor_init1();
$this->show_editor();
}
// end of editor()
protected function show_editor() {
$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
}
// end of show_editor()
// validate information about user we intend to edit
protected function check_user_to_edit() {
if ($this->ure_object == 'user') {
if (!isset($_REQUEST['user_id'])) {
return false; // user_id value is missed
}
$user_id = $_REQUEST['user_id'];
if (!is_numeric($user_id)) {
return false;
}
if (!$user_id) {
return false;
}
$this->user_to_edit = get_user_to_edit($user_id);
if (empty($this->user_to_edit)) {
return false;
}
}
return true;
}
// end of check_user_to_edit()
protected function init_current_role_name() {
if (!isset($this->roles[$_POST['user_role']])) {
$mess = esc_html__('Error: ', 'user-role-editor') . esc_html__('Role', 'user-role-editor') . ' <em>' . esc_html($_POST['user_role']) . '</em> ' .
esc_html__('does not exist', 'user-role-editor');
$this->current_role = '';
$this->current_role_name = '';
} else {
$this->current_role = $_POST['user_role'];
$this->current_role_name = $this->roles[$this->current_role]['name'];
$mess = '';
}
return $mess;
}
// end of init_current_role_name()
/**
* prepare capabilities from user input to save at the database
*/
protected function prepare_capabilities_to_save() {
$this->capabilities_to_save = array();
foreach ($this->full_capabilities as $available_capability) {
$cap_id_esc = URE_Capability::escape($available_capability['inner']);
if (isset($_POST[$cap_id_esc])) {
$this->capabilities_to_save[$available_capability['inner']] = true;
}
}
}
// end of prepare_capabilities_to_save()
/**
* save changes to the roles or user
* @param string $mess - notification message to the user
* @return string - notification message to the user
*/
protected function permissions_object_update($mess) {
if ($this->ure_object == 'role') { // save role changes to database
if ($this->update_roles()) {
if ($mess) {
$mess .= '<br/>';
}
if (!$this->apply_to_all) {
$mess = esc_html__('Role is updated successfully', 'user-role-editor');
} else {
$mess = esc_html__('Roles are updated for all network', 'user-role-editor');
}
} else {
if ($mess) {
$mess .= '<br/>';
}
$mess = esc_html__('Error occured during role(s) update', 'user-role-editor');
}
} else {
if ($this->update_user($this->user_to_edit)) {
if ($mess) {
$mess .= '<br/>';
}
$mess = esc_html__('User capabilities are updated successfully', 'user-role-editor');
} else {
if ($mess) {
$mess .= '<br/>';
}
$mess = esc_html__('Error occured during user update', 'user-role-editor');
}
}
return $mess;
}
// end of permissions_object_update()
/**
* Process user request
*/
protected function process_user_request() {
$this->notification = '';
if (isset($_POST['action'])) {
if (empty($_POST['ure_nonce']) || !wp_verify_nonce($_POST['ure_nonce'], 'user-role-editor')) {
echo '<h3>Wrong nonce. Action prohibitied.</h3>';
exit;
}
$action = $_POST['action'];
if ($action == 'reset') {
$this->reset_user_roles();
exit;
} else if ($action == 'add-new-role') {
// process new role create request
$this->notification = $this->add_new_role();
} else if ($action == 'rename-role') {
// process rename role request
$this->notification = $this->rename_role();
} else if ($action == 'delete-role') {
$this->notification = $this->delete_role();
} else if ($action == 'change-default-role') {
$this->notification = $this->change_default_role();
} else if ($action == 'caps-readable') {
if ($this->caps_readable) {
$this->caps_readable = 0;
} else {
$this->caps_readable = 1;
}
set_site_transient( 'ure_caps_readable', $this->caps_readable, 600 );
} else if ($action == 'show-deprecated-caps') {
if ($this->show_deprecated_caps) {
$this->show_deprecated_caps = 0;
} else {
$this->show_deprecated_caps = 1;
}
set_site_transient( 'ure_show_deprecated_caps', $this->show_deprecated_caps, 600 );
} else if ($action == 'hide-pro-banner') {
$this->hide_pro_banner = 1;
$this->put_option('ure_hide_pro_banner', 1);
$this->flush_options();
} else if ($action == 'add-new-capability') {
$this->notification = URE_Capability::add();
} else if ($action == 'delete-user-capability') {
$this->notification = URE_Capability::delete();
} else if ($action == 'roles_restore_note') {
$this->notification = esc_html__('User Roles are restored to WordPress default values. ', 'user-role-editor');
} else if ($action == 'update') {
$this->roles = $this->get_user_roles();
$this->init_full_capabilities();
if (isset($_POST['user_role'])) {
$this->notification = $this->init_current_role_name();
}
$this->prepare_capabilities_to_save();
$this->notification = $this->permissions_object_update($this->notification);
} else {
do_action('ure_process_user_request');
} // if ($action
}
}
// end of process_user_request()
protected function get_apply_to_all_from_post() {
if (isset($_POST['ure_apply_to_all'])) {
$this->apply_to_all = 1;
} else {
$this->apply_to_all = 0;
}
}
// end of get_apply_to_all_from_post()
protected function get_caps_columns_quant() {
if (isset($_POST['caps_columns_quant']) && in_array($_POST['caps_columns_quant'], array(1,2,3))) {
$value = (int) $_POST['caps_columns_quant'];
set_site_transient('ure_caps_columns_quant', $value, self::TRANSIENT_EXPIRATION);
} else {
$value = get_site_transient('ure_caps_columns_quant');
if ($value===false) {
$value = 1;
}
}
$this->caps_columns_quant = $value;
}
// end of get_apply_to_all_from_post()
public function get_default_role() {
$this->wp_default_role = get_option('default_role');
}
// end of get_default_role()
protected function editor_init0() {
$this->caps_readable = get_site_transient('ure_caps_readable');
if (false === $this->caps_readable) {
$this->caps_readable = $this->get_option('ure_caps_readable');
set_site_transient('ure_caps_readable', $this->caps_readable, self::TRANSIENT_EXPIRATION);
}
$this->show_deprecated_caps = get_site_transient('ure_show_deprecated_caps');
if (false === $this->show_deprecated_caps) {
$this->show_deprecated_caps = $this->get_option('ure_show_deprecated_caps');
set_site_transient('ure_caps_readable', $this->caps_readable, self::TRANSIENT_EXPIRATION);
}
$this->hide_pro_banner = $this->get_option('ure_hide_pro_banner', 0);
$this->get_default_role();
// could be sent as by POST, as by GET
if (isset($_REQUEST['object'])) {
$this->ure_object = $_REQUEST['object'];
if (!$this->check_user_to_edit()) {
return false;
}
} else {
$this->ure_object = 'role';
}
$this->get_apply_to_all_from_post();
$this->get_caps_columns_quant();
return true;
}
// end of editor_init0()
public function editor_init1() {
$this->roles = $this->get_user_roles();
$this->init_full_capabilities();
if (empty($this->role_additional_options)) {
$this->role_additional_options = URE_Role_Additional_Options::get_instance($this);
}
if (!$this->is_pro()) {
require_once(URE_PLUGIN_DIR . 'includes/classes/advertisement.php');
}
}
// end of editor_init1()
/**
* return id of role last in the list of sorted roles
*
*/
protected function get_last_role_id() {
// get the key of the last element in roles array
$keys = array_keys($this->roles);
$last_role_id = array_pop($keys);
return $last_role_id;
}
// end of get_last_role_id()
public function get_usermeta_table_name() {
global $wpdb;
$table_name = (!$this->multisite && defined('CUSTOM_USER_META_TABLE')) ? CUSTOM_USER_META_TABLE : $wpdb->usermeta;
return $table_name;
}
// end of get_usermeta_table_name()
/**
* Check if user has "Administrator" role assigned
*
* @global wpdb $wpdb
* @param int $user_id
* @return boolean returns true is user has Role "Administrator"
*/
public function has_administrator_role($user_id) {
global $wpdb;
if (empty($user_id) || !is_numeric($user_id)) {
return false;
}
$table_name = $this->get_usermeta_table_name();
$meta_key = $wpdb->prefix . 'capabilities';
$query = "SELECT count(*)
FROM $table_name
WHERE user_id=$user_id AND meta_key='$meta_key' AND meta_value like '%administrator%'";
$has_admin_role = $wpdb->get_var($query);
if ($has_admin_role > 0) {
$result = true;
} else {
$result = false;
}
// cache checking result for the future use
$this->lib->user_to_check[$user_id] = $result;
return $result;
}
// end of has_administrator_role()
/**
* Checks if user is allowed to use User Role Editor
*
* @global int $current_user
* @param int $user_id
* @return boolean true
*/
public function user_is_admin($user_id = false) {
global $current_user;
$ure_key_capability = URE_Own_Capabilities::get_key_capability();
if (empty($user_id)) {
$user_id = $current_user->ID;
}
$result = user_can($user_id, $ure_key_capability);
return $result;
}
// end of user_is_admin()
/**
* return array with WordPress user roles
*
* @global WP_Roles $wp_roles
* @global type $wp_user_roles
* @return array
*/
public function get_user_roles() {
global $wp_roles;
if (!isset($wp_roles)) {
$wp_roles = new WP_Roles();
}
if (!empty($this->bbpress)) { // bbPress plugin is active
$this->roles = $this->bbpress->get_roles();
} else {
$this->roles = $wp_roles->roles;
}
if (is_array($this->roles) && count($this->roles) > 0) {
asort($this->roles);
}
return $this->roles;
}
// end of get_user_roles()
/**
* Respect 'editable_roles' filter, when needed
* @return array
*/
public function get_editable_user_roles() {
if (empty($this->roles)) {
$this->get_user_roles();
}
if ($this->bbpress!==null) {
remove_filter('editable_roles', 'bbp_filter_blog_editable_roles');
}
$roles = apply_filters('editable_roles', $this->roles);
if ($this->bbpress!==null) {
add_filter('editable_roles', 'bbp_filter_blog_editable_roles');
}
return $roles;
}
// end of get_editable_user_roles()
/*
// restores User Roles from the backup record
protected function restore_user_roles()
{
global $wpdb, $wp_roles;
$error_message = 'Error! ' . __('Database operation error. Check log file.', 'user-role-editor');
$option_name = $wpdb->prefix . 'user_roles';
$backup_option_name = $wpdb->prefix . 'backup_user_roles';
$query = "select option_value
from $wpdb->options
where option_name='$backup_option_name'
limit 0, 1";
$option_value = $wpdb->get_var($query);
if ($wpdb->last_error) {
$this->log_event($wpdb->last_error, true);
return $error_message;
}
if ($option_value) {
$query = "update $wpdb->options
set option_value='$option_value'
where option_name='$option_name'
limit 1";
$record = $wpdb->query($query);
if ($wpdb->last_error) {
$this->log_event($wpdb->last_error, true);
return $error_message;
}
$wp_roles = new WP_Roles();
$reload_link = wp_get_referer();
$reload_link = remove_query_arg('action', $reload_link);
$reload_link = esc_url_raw(add_query_arg('action', 'roles_restore_note', $reload_link));
?>
<script type="text/javascript" >
document.location = '<?php echo $reload_link; ?>';
</script>
<?php
$mess = '';
} else {
$mess = __('No backup data. It is created automatically before the first role data update.', 'user-role-editor');
}
if (isset($_REQUEST['user_role'])) {
unset($_REQUEST['user_role']);
}
return $mess;
}
// end of restore_user_roles()
*/
protected function convert_caps_to_readable($caps_name)
{
$caps_name = str_replace('_', ' ', $caps_name);
$caps_name = ucfirst($caps_name);
return $caps_name;
}
// ure_ConvertCapsToReadable
public function make_roles_backup()
{
global $wpdb;
// check if backup user roles record exists already
$backup_option_name = $wpdb->prefix . 'backup_user_roles';
$query = "select option_id
from $wpdb->options
where option_name='$backup_option_name'
limit 0, 1";
$option_id = $wpdb->get_var($query);
if ($wpdb->last_error) {
$this->log_event($wpdb->last_error, true);
return false;
}
if (!$option_id) {
$roles_option_name = $wpdb->prefix.'user_roles';
$query = "select option_value
from $wpdb->options
where option_name like '$roles_option_name' limit 0,1";
$serialized_roles = $wpdb->get_var($query);
// create user roles record backup
$query = "insert into $wpdb->options
(option_name, option_value, autoload)
values ('$backup_option_name', '$serialized_roles', 'no')";
$record = $wpdb->query($query);
if ($wpdb->last_error) {
$this->log_event($wpdb->last_error, true);
return false;
}
}
return true;
}
// end of ure_make_roles_backup()
protected function role_contains_caps_not_allowed_for_simple_admin($role_id) {
$result = false;
$role = $this->roles[$role_id];
if (!is_array($role['capabilities'])) {
return false;
}
foreach (array_keys($role['capabilities']) as $cap) {
if ($this->block_cap_for_single_admin($cap)) {
$result = true;
break;
}
}
return $result;
}
// end of role_contains_caps_not_allowed_for_simple_admin()
/**
* return array with roles which we could delete, e.g self-created and not used with any blog user
*
* @global wpdb $wpdb - WP database object
* @return array
*/
public function get_roles_can_delete() {
$default_role = get_option('default_role');
$standard_roles = array('administrator', 'editor', 'author', 'contributor', 'subscriber');
$roles_can_delete = array();
$users = count_users();
foreach ($this->roles as $key => $role) {
$can_delete = true;
// check if it is default role for new users
if ($key == $default_role) {
$can_delete = false;
continue;
}
// check if it is standard role
if (in_array($key, $standard_roles)) {
continue;
}
// check if role has capabilities prohibited for the single site administrator
if ($this->role_contains_caps_not_allowed_for_simple_admin($key)) {
continue;
}
if (!isset($users['avail_roles'][$key])) {
$roles_can_delete[$key] = $role['name'] . ' (' . $key . ')';
}
}
return $roles_can_delete;
}
// end of get_roles_can_delete()
/**
* return array of built-in WP capabilities (WP 3.1 wp-admin/includes/schema.php)
*
* @return array
*/
public function get_built_in_wp_caps() {
$caps_groups = URE_Capabilities_Groups_Manager::get_instance();
$caps = $caps_groups->get_built_in_wp_caps();
return $caps;
}
// end of get_built_in_wp_caps()
/**
* return the array of unused user capabilities
*
* @global WP_Roles $wp_roles
* @global wpdb $wpdb
* @return array
*/
public function get_caps_to_remove() {
global $wp_roles;
// build full capabilities list from all roles except Administrator
$full_caps_list = array();
foreach ($wp_roles->roles as $role) {
// validate if capabilities is an array
if (isset($role['capabilities']) && is_array($role['capabilities'])) {
foreach ($role['capabilities'] as $capability => $value) {
if (!isset($full_caps_list[$capability])) {
$full_caps_list[$capability] = 1;
}
}
}
}
$caps_to_exclude = $this->get_built_in_wp_caps();
$ure_caps = URE_Own_Capabilities::get_caps();
$caps_to_exclude = array_merge($caps_to_exclude, $ure_caps);
$caps_to_remove = array();
foreach ($full_caps_list as $capability => $value) {
if (!isset($caps_to_exclude[$capability])) { // do not touch built-in WP caps
// check roles
$cap_in_use = false;
foreach ($wp_roles->role_objects as $wp_role) {
if ($wp_role->name != 'administrator') {
if ($wp_role->has_cap($capability)) {
$cap_in_use = true;
break;
}
}
}
if (!$cap_in_use) {
$caps_to_remove[$capability] = 1;
}
}
}
return $caps_to_remove;
}
// end of get_caps_to_remove()
/**
* Return true if $capability is included to the list of capabilities allowed for the single site administrator
* @param string $capability - capability ID
* @param boolean $ignore_super_admin - if
* @return boolean
*/
public function block_cap_for_single_admin($capability, $ignore_super_admin=false) {
if (!$this->is_pro()) { // this functionality is for the Pro version only.
return false;
}
if (!$this->multisite) { // work for multisite only
return false;
}
if (!$ignore_super_admin && $this->is_super_admin()) { // Do not block superadmin
return false;
}
$caps_access_restrict_for_simple_admin = $this->get_option('caps_access_restrict_for_simple_admin', 0);
if (!$caps_access_restrict_for_simple_admin) {
return false;
}
$allowed_caps = $this->get_option('caps_allowed_for_single_admin', array());
if (in_array($capability, $allowed_caps)) {
$block_this_cap = false;
} else {
$block_this_cap = true;
}
return $block_this_cap;
}
// end of block_cap_for_single_admin()
/**
* Go through all users and if user has non-existing role lower him to Subscriber role
*
*/
protected function validate_user_roles() {
global $wp_roles;
$default_role = get_option('default_role');
if (empty($default_role)) {
$default_role = 'subscriber';
}
$users_query = new WP_User_Query(array('fields' => 'ID'));
$users = $users_query->get_results();
foreach ($users as $user_id) {
$user = get_user_by('id', $user_id);
if (is_array($user->roles) && count($user->roles) > 0) {
foreach ($user->roles as $role) {
$user_role = $role;
break;
}
} else {
$user_role = is_array($user->roles) ? '' : $user->roles;
}
if (!empty($user_role) && !isset($wp_roles->roles[$user_role])) { // role doesn't exists
$user->set_role($default_role); // set the lowest level role for this user
$user_role = '';
}
if (empty($user_role)) {
// Cleanup users level capabilities from non-existed roles
$cap_removed = true;
while (count($user->caps) > 0 && $cap_removed) {
foreach ($user->caps as $capability => $value) {
if (!isset($this->full_capabilities[$capability])) {
$user->remove_cap($capability);
$cap_removed = true;
break;
}
$cap_removed = false;
}
} // while ()
}
} // foreach()
}
// end of validate_user_roles()
protected function add_capability_to_full_caps_list($cap_id) {
if (!isset($this->full_capabilities[$cap_id])) { // if capability was not added yet
$cap = array();
$cap['inner'] = $cap_id;
$cap['human'] = esc_html__($this->convert_caps_to_readable($cap_id), 'user-role-editor');
if (isset($this->built_in_wp_caps[$cap_id])) {
$cap['wp_core'] = true;
} else {
$cap['wp_core'] = false;
}
$this->full_capabilities[$cap_id] = $cap;
}
}
// end of add_capability_to_full_caps_list()
/**
* Add capabilities from user roles save at WordPress database
*
*/
protected function add_roles_caps() {
foreach ($this->roles as $role) {
// validate if capabilities is an array
if (isset($role['capabilities']) && is_array($role['capabilities'])) {
foreach (array_keys($role['capabilities']) as $cap) {
$this->add_capability_to_full_caps_list($cap);
}
}
}
}
// end of add_roles_caps()
/**
* Add Gravity Forms plugin capabilities, if available
*
*/
protected function add_gravity_forms_caps() {
if (class_exists('GFCommon')) {
$gf_caps = GFCommon::all_caps();
foreach ($gf_caps as $gf_cap) {
$this->add_capability_to_full_caps_list($gf_cap);
}
}
}
// end of add_gravity_forms_caps()
/**
* Add bbPress plugin user capabilities (if available)
*/
protected function add_bbpress_caps() {
if (empty($this->bbpress)) {
return;
}
$caps = $this->bbpress->get_caps();
foreach ($caps as $cap) {
$this->add_capability_to_full_caps_list($cap);
}
}
// end of add_bbpress_caps()
/**
* Provide compatibility with plugins and themes which define their custom user capabilities using
* 'members_get_capabilities' filter from Members plugin
*
*/
protected function add_members_caps() {
$custom_caps = array();
$custom_caps = apply_filters( 'members_get_capabilities', $custom_caps );
foreach ($custom_caps as $cap) {
$this->add_capability_to_full_caps_list($cap);
}
}
// end of add_members_caps()
/**
* Add capabilities assigned directly to user, and not included into any role
*
*/
protected function add_user_caps() {
if ($this->ure_object=='user') {
foreach(array_keys($this->user_to_edit->caps) as $cap) {
if (!isset($this->roles[$cap])) { // it is the user capability, not role
$this->add_capability_to_full_caps_list($cap);
}
}
}
}
// end of add_user_caps()
/**
* Add built-in WordPress caps in case some were not included to the roles for some reason
*
*/
protected function add_wordpress_caps() {
foreach (array_keys($this->built_in_wp_caps) as $cap) {
$this->add_capability_to_full_caps_list($cap);
}
}
// end of add_wordpress_caps()
/**
* Return all available post types except non-public WordPress built-in post types
*
* @return array
*/
public function _get_post_types() {
$post_types = get_transient('ure_public_post_types');
if (empty($post_types)) {
$all_post_types = get_post_types();
$internal_post_types = get_post_types(array('public'=>false, '_builtin'=>true));
$post_types = array_diff($all_post_types, $internal_post_types);
set_transient('ure_public_post_types', $post_types, 30);
}
return $post_types;
}
// end of _get_post_types()
public function get_edit_post_capabilities() {
$capabilities = array(
'create_posts',
'edit_posts',
'edit_published_posts',
'edit_others_posts',
'edit_private_posts',
'publish_posts',
'read_private_posts',
'delete_posts',
'delete_private_posts',
'delete_published_posts',
'delete_others_posts'
);
return $capabilities;
}
// end of get_edit_post_capabilities();
protected function add_custom_post_type_caps() {
global $wp_roles;
$capabilities = $this->get_edit_post_capabilities();
$post_types = get_post_types(array(), 'objects');
$_post_types = $this->_get_post_types();
// do not forget attachment post type as it may use the own capabilities set
$attachment_post_type = get_post_type_object('attachment');
if ($attachment_post_type->cap->edit_posts!=='edit_posts') {
$post_types['attachment'] = $attachment_post_type;
}
foreach($post_types as $post_type) {
if (!isset($_post_types[$post_type->name])) {
continue;
}
if (!isset($post_type->cap)) {
continue;
}
foreach($capabilities as $capability) {
if (!isset($post_type->cap->$capability)) {
continue;
}
$cap_to_check = $post_type->cap->$capability;
$this->add_capability_to_full_caps_list($cap_to_check);
if (!$this->multisite &&
isset($wp_roles->role_objects['administrator']) &&
!isset($wp_roles->role_objects['administrator']->capabilities[$cap_to_check])) {
// admin should be capable to edit any posts
$wp_roles->role_objects['administrator']->add_cap($cap_to_check, true);
}
}
}
if (!$this->multisite && isset($wp_roles->role_objects['administrator'])) {
foreach(array('post', 'page') as $post_type_name) {
$post_type = get_post_type_object($post_type_name);
if ($post_type->cap->create_posts!=='edit_'. $post_type->name .'s') { // 'create' capability is active
if (!isset($wp_roles->role_objects['administrator']->capabilities[$post_type->cap->create_posts])) {
// admin should be capable to create posts and pages
$wp_roles->role_objects['administrator']->add_cap($post_type->cap->create_posts, true);
}
}
} // foreach()
} // if ()
}
// end of add_custom_post_type_caps()
/**
* Add capabilities for URE permissions system in case some were excluded from Administrator role
*
*/
protected function add_ure_caps() {
$key_cap = URE_Own_Capabilities::get_key_capability();
if (!current_user_can($key_cap)) {
return;
}
$ure_caps = URE_Own_Capabilities::get_caps();
foreach(array_keys($ure_caps) as $cap) {
$this->add_capability_to_full_caps_list($cap);
}
}
// end of add_ure_caps()
public function init_full_capabilities() {
$this->built_in_wp_caps = $this->get_built_in_wp_caps();
$this->full_capabilities = array();
$this->add_roles_caps();
$this->add_gravity_forms_caps();
$this->add_bbpress_caps();
$this->add_members_caps();
$this->add_user_caps();
$this->add_wordpress_caps();
$this->add_custom_post_type_caps();
$this->add_ure_caps();
unset($this->built_in_wp_caps);
asort($this->full_capabilities);
$this->full_capabilities = apply_filters('ure_full_capabilites', $this->full_capabilities);
}
// end of init_full_capabilities()
/**
* return WordPress user roles to its initial state, just like after installation
* @global WP_Roles $wp_roles
*/
protected function wp_roles_reinit() {
global $wp_roles;
$wp_roles->roles = array();
$wp_roles->role_objects = array();
$wp_roles->role_names = array();
$wp_roles->use_db = true;
require_once(ABSPATH . '/wp-admin/includes/schema.php');
populate_roles();
$wp_roles->reinit();
$this->roles = $this->get_user_roles();
}
// end of wp_roles_reinit()
/**
* reset user roles to WordPress default roles
*/
protected function reset_user_roles() {
if (!current_user_can('ure_reset_roles')) {
return esc_html__('Insufficient permissions to work with User Role Editor','user-role-editor');
}
$this->wp_roles_reinit();
URE_Own_Capabilities::init_caps();
if ($this->is_full_network_synch() || $this->apply_to_all) {
$this->current_role = '';
$this->direct_network_roles_update();
}
//$this->validate_user_roles(); // if user has non-existing role lower him to Subscriber role
$reload_link = wp_get_referer();
$reload_link = esc_url_raw(remove_query_arg('action', $reload_link));
?>
<script type="text/javascript" >
jQuery.ure_postGo('<?php echo $reload_link; ?>',
{ action: 'roles_restore_note',
ure_nonce: ure_data.wp_nonce} );
</script>
<?php
}
// end of reset_user_roles()
/**
* if returns true - make full syncronization of roles for all sites with roles from the main site
* else - only currently selected role update is replicated
*
* @return boolean
*/
public function is_full_network_synch() {
$result = defined('URE_MULTISITE_DIRECT_UPDATE') && URE_MULTISITE_DIRECT_UPDATE == 1;
return $result;
}
// end of is_full_network_synch()
protected function last_check_before_update() {
global $current_user;
if (empty($this->roles) || !is_array($this->roles) || count($this->roles)==0) { // Nothing to save - something goes wrong - stop ...
return false;
}
$key_capability = URE_Own_Capabilities::get_key_capability();
$user_is_ure_admin = current_user_can($key_capability);
if (!$user_is_ure_admin) {
if (in_array($this->current_role, $current_user->roles)) {
// do not allow to a user update his own role if he does not have full access to the User Role Editor
return false;
}
}
return true;
}
// end of last_check_before_update()
// Save Roles to database
protected function save_roles() {
global $wpdb;
if (!$this->last_check_before_update()) {
return false;
}
if (!isset($this->roles[$this->current_role])) {
return false;
}
$this->capabilities_to_save = $this->remove_caps_not_allowed_for_single_admin($this->capabilities_to_save);
$this->roles[$this->current_role]['name'] = $this->current_role_name;
$this->roles[$this->current_role]['capabilities'] = $this->capabilities_to_save;
$option_name = $wpdb->prefix . 'user_roles';
update_option($option_name, $this->roles);
// save additional options for the current role
if (empty($this->role_additional_options)) {
$this->role_additional_options = URE_Role_Additional_Options::get_instance($this);
}
$this->role_additional_options->save($this->current_role);
return true;
}
// end of save_roles()
/**
* Update roles for all network using direct database access - quicker in several times
*
* @global wpdb $wpdb
* @return boolean
*/
public function direct_network_roles_update() {
global $wpdb;
if (!$this->last_check_before_update()) {
return false;
}
if (!empty($this->current_role)) {
$this->roles[$this->current_role]['name'] = $this->current_role_name;
$this->roles[$this->current_role]['capabilities'] = $this->capabilities_to_save;
}
$serialized_roles = serialize($this->roles);
foreach ($this->blog_ids as $blog_id) {
$prefix = $wpdb->get_blog_prefix($blog_id);
$options_table_name = $prefix . 'options';
$option_name = $prefix . 'user_roles';
$query = "update $options_table_name
set option_value='$serialized_roles'
where option_name='$option_name'
limit 1";
$wpdb->query($query);
if ($wpdb->last_error) {
$this->log_event($wpdb->last_error, true);
return false;
}
// save role additional options
}
return true;
}
// end of direct_network_roles_update()
public function restore_after_blog_switching($blog_id = 0) {
if (!empty($blog_id)) {
switch_to_blog($blog_id);
}
// cleanup blog switching data
$GLOBALS['_wp_switched_stack'] = array();
$GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );
}
// end of restore_after_blog_switching()
protected function wp_api_network_roles_update() {
global $wpdb;
$result = true;
$old_blog = $wpdb->blogid;
foreach ($this->blog_ids as $blog_id) {
switch_to_blog($blog_id);
$this->roles = $this->get_user_roles();
if (!isset($this->roles[$this->current_role])) { // add new role to this blog
$this->roles[$this->current_role] = array('name' => $this->current_role_name, 'capabilities' => array('read' => true));
}
if (!$this->save_roles()) {
$result = false;
break;
}
}
$this->restore_after_blog_switching($old_blog);
$this->roles = $this->get_user_roles();
return $result;
}
// end of wp_api_network_roles_update()
/**
* Update role for all network using WordPress API
*
* @return boolean
*/
protected function multisite_update_roles() {
if ($this->debug) {
$time_shot = microtime();
}
if ($this->is_full_network_synch()) {
$result = $this->direct_network_roles_update();
} else {
$result = $this->wp_api_network_roles_update();
}
if ($this->debug) {
echo '<div class="updated fade below-h2">Roles updated for ' . ( microtime() - $time_shot ) . ' milliseconds</div>';
}
return $result;
}
// end of multisite_update_roles()
/**
* Process user request on update roles
*
* @global wpdb $wpdb
* @return boolean
*/
protected function update_roles() {
global $wp_roles;
if ($this->multisite && $this->is_super_admin() && $this->apply_to_all) { // update Role for the all blogs/sites in the network (permitted to superadmin only)
if (!$this->multisite_update_roles()) {
return false;
}
} else {
if (!$this->save_roles()) {
return false;
}
}
// refresh global $wp_roles
$wp_roles = new WP_Roles();
return true;
}
// end of update_roles()
/**
* Write message to the log file
*
* @global type $wp_version
* @param string $message
* @param boolean $show_message
*/
protected function log_event($message, $show_message = false) {
global $wp_version, $wpdb;
$file_name = URE_PLUGIN_DIR . 'user-role-editor.log';
$fh = fopen($file_name, 'a');
$cr = "\n";
$s = $cr . date("d-m-Y H:i:s") . $cr .
'WordPress version: ' . $wp_version . ', PHP version: ' . phpversion() . ', MySQL version: ' . $wpdb->db_version() . $cr;
fwrite($fh, $s);
fwrite($fh, $message . $cr);
fclose($fh);
if ($show_message) {
$this->show_message('Error! ' . esc_html__('Error is occur. Please check the log file.', 'user-role-editor'));
}
}
// end of log_event()
/**
* returns array without capabilities blocked for single site administrators
* @param array $capabilities
* @return array
*/
protected function remove_caps_not_allowed_for_single_admin($capabilities) {
foreach(array_keys($capabilities) as $cap) {
if ($this->block_cap_for_single_admin($cap)) {
unset($capabilities[$cap]);
}
}
return $capabilities;
}
// end of remove_caps_not_allowed_for_single_admin()
/**
* process new role create request
*
* @global WP_Roles $wp_roles
*
* @return string - message about operation result
*
*/
protected function add_new_role() {
global $wp_roles;
if (!current_user_can('ure_create_roles')) {
return esc_html__('Insufficient permissions to work with User Role Editor','user-role-editor');
}
$mess = '';
$this->current_role = '';
if (isset($_POST['user_role_id']) && $_POST['user_role_id']) {
$user_role_id = utf8_decode($_POST['user_role_id']);
// sanitize user input for security
$valid_name = preg_match('/[A-Za-z0-9_\-]*/', $user_role_id, $match);
if (!$valid_name || ($valid_name && ($match[0] != $user_role_id))) { // some non-alphanumeric charactes found!
return esc_html__('Error: Role ID must contain latin characters, digits, hyphens or underscore only!', 'user-role-editor');
}
$numeric_name = preg_match('/[0-9]*/', $user_role_id, $match);
if ($numeric_name && ($match[0] == $user_role_id)) { // numeric name discovered
return esc_html__('Error: WordPress does not support numeric Role name (ID). Add latin characters to it.', 'user-role-editor');
}
if ($user_role_id) {
$user_role_name = isset($_POST['user_role_name']) ? $_POST['user_role_name'] : false;
if (!empty($user_role_name)) {
$user_role_name = sanitize_text_field($user_role_name);
} else {
$user_role_name = $user_role_id; // as user role name is empty, use user role ID instead
}
if (!isset($wp_roles)) {
$wp_roles = new WP_Roles();
}
if (isset($wp_roles->roles[$user_role_id])) {
return sprintf('Error! ' . esc_html__('Role %s exists already', 'user-role-editor'), $user_role_id);
}
$user_role_id = strtolower($user_role_id);
$this->current_role = $user_role_id;
$user_role_copy_from = isset($_POST['user_role_copy_from']) ? $_POST['user_role_copy_from'] : false;
if (!empty($user_role_copy_from) && $user_role_copy_from != 'none' && $wp_roles->is_role($user_role_copy_from)) {
$role = $wp_roles->get_role($user_role_copy_from);
$capabilities = $this->remove_caps_not_allowed_for_single_admin($role->capabilities);
} else {
$capabilities = array('read' => true, 'level_0' => true);
}
// add new role to the roles array
$result = add_role($user_role_id, $user_role_name, $capabilities);
if (!isset($result) || empty($result)) {
$mess = 'Error! ' . esc_html__('Error is encountered during new role create operation', 'user-role-editor');
} else {
$mess = sprintf(esc_html__('Role %s is created successfully', 'user-role-editor'), $user_role_name);
}
}
}
return $mess;
}
// end of new_role_create()
/**
* process rename role request
*
* @global WP_Roles $wp_roles
*
* @return string - message about operation result
*
*/
protected function rename_role() {
global $wp_roles;
$mess = '';
$user_role_id = filter_input(INPUT_POST, 'user_role_id', FILTER_SANITIZE_STRING);
if (empty($user_role_id)) {
return esc_html__('Error: Role ID is empty!', 'user-role-editor');
}
$user_role_id = utf8_decode($user_role_id);
// sanitize user input for security
$match = array();
$valid_name = preg_match('/[A-Za-z0-9_\-]*/', $user_role_id, $match);
if (!$valid_name || ($valid_name && ($match[0] != $user_role_id))) { // some non-alphanumeric charactes found!
return esc_html__('Error: Role ID must contain latin characters, digits, hyphens or underscore only!', 'user-role-editor');
}
$numeric_name = preg_match('/[0-9]*/', $user_role_id, $match);
if ($numeric_name && ($match[0] == $user_role_id)) { // numeric name discovered
return esc_html__('Error: WordPress does not support numeric Role name (ID). Add latin characters to it.', 'user-role-editor');
}
$new_role_name = filter_input(INPUT_POST, 'user_role_name', FILTER_SANITIZE_STRING);
if (!empty($new_role_name)) {
$new_role_name = sanitize_text_field($new_role_name);
} else {
return esc_html__('Error: Empty role display name is not allowed.', 'user-role-editor');
}
if (!isset($wp_roles)) {
$wp_roles = new WP_Roles();
}
if (!isset($wp_roles->roles[$user_role_id])) {
return sprintf('Error! ' . esc_html__('Role %s does not exists', 'user-role-editor'), $user_role_id);
}
$this->current_role = $user_role_id;
$this->current_role_name = $new_role_name;
$old_role_name = $wp_roles->roles[$user_role_id]['name'];
$wp_roles->roles[$user_role_id]['name'] = $new_role_name;
update_option( $wp_roles->role_key, $wp_roles->roles );
$mess = sprintf(esc_html__('Role %s is renamed to %s successfully', 'user-role-editor'), $old_role_name, $new_role_name);
return $mess;
}
// end of rename_role()
/**
* Deletes user role from the WP database
*/
protected function delete_wp_roles($roles_to_del) {
global $wp_roles;
if (!current_user_can('ure_delete_roles')) {
return esc_html__('Insufficient permissions to work with User Role Editor','user-role-editor');
}
if (!isset($wp_roles)) {
$wp_roles = new WP_Roles();
}
$result = false;
foreach($roles_to_del as $role_id) {
if (!isset($wp_roles->roles[$role_id])) {
$result = false;
break;
}
if ($this->role_contains_caps_not_allowed_for_simple_admin($role_id)) { // do not delete
continue;
}
unset($wp_roles->role_objects[$role_id]);
unset($wp_roles->role_names[$role_id]);
unset($wp_roles->roles[$role_id]);
$result = true;
} // foreach()
if ($result) {
update_option($wp_roles->role_key, $wp_roles->roles);
}
return $result;
}
// end of delete_wp_roles()
protected function delete_all_unused_roles() {
$this->roles = $this->get_user_roles();
$roles_to_del = array_keys($this->get_roles_can_delete());
$result = $this->delete_wp_roles($roles_to_del);
$this->roles = null; // to force roles refresh
return $result;
}
// end of delete_all_unused_roles()
/**
* process user request for user role deletion
* @global WP_Roles $wp_roles
* @return type
*/
protected function delete_role() {
if (!current_user_can('ure_delete_roles')) {
return esc_html__('Insufficient permissions to work with User Role Editor','user-role-editor');
}
$mess = '';
if (isset($_POST['user_role_id']) && $_POST['user_role_id']) {
$role = $_POST['user_role_id'];
if ($role==-1) { // delete all unused roles
$result = $this->delete_all_unused_roles();
} else {
$result = $this->delete_wp_roles(array($role));
}
if (empty($result)) {
$mess = 'Error! ' . esc_html__('Error encountered during role delete operation', 'user-role-editor');
} elseif ($role==-1) {
$mess = sprintf(esc_html__('Unused roles are deleted successfully', 'user-role-editor'), $role);
} else {
$mess = sprintf(esc_html__('Role %s is deleted successfully', 'user-role-editor'), $role);
}
unset($_POST['user_role']);
}
return $mess;
}
// end of ure_delete_role()
/**
* Change default WordPress role
* @global WP_Roles $wp_roles
* @return string
*/
protected function change_default_role() {
global $wp_roles;
if (!$this->multisite || is_network_admin()) {
return 'Try to misuse the plugin functionality';
}
$mess = '';
if (!isset($wp_roles)) {
$wp_roles = new WP_Roles();
}
if (!empty($_POST['user_role_id'])) {
$user_role_id = $_POST['user_role_id'];
unset($_POST['user_role_id']);
if (isset($wp_roles->role_objects[$user_role_id]) && $user_role_id !== 'administrator') {
$result = update_option('default_role', $user_role_id);
if (empty($result)) {
$mess = 'Error! ' . esc_html__('Error encountered during default role change operation', 'user-role-editor');
} else {
$this->get_default_role();
$mess = sprintf(esc_html__('Default role for new users is set to %s successfully', 'user-role-editor'), $wp_roles->role_names[$user_role_id]);
}
} elseif ($user_role_id === 'administrator') {
$mess = 'Error! ' . esc_html__('Can not set Administrator role as a default one', 'user-role-editor');
} else {
$mess = 'Error! ' . esc_html__('This role does not exist - ', 'user-role-editor') . esc_html($user_role_id);
}
}
return $mess;
}
// end of change_default_role()
/**
* Not really used in the plugin - just storage for the translation strings
*/
protected function translation_data() {
// for the translation purpose
if (false) {
// Standard WordPress roles
__('Editor', 'user-role-editor');
__('Author', 'user-role-editor');
__('Contributor', 'user-role-editor');
__('Subscriber', 'user-role-editor');
// Standard WordPress capabilities
__('Switch themes', 'user-role-editor');
__('Edit themes', 'user-role-editor');
__('Activate plugins', 'user-role-editor');
__('Edit plugins', 'user-role-editor');
__('Edit users', 'user-role-editor');
__('Edit files', 'user-role-editor');
__('Manage options', 'user-role-editor');
__('Moderate comments', 'user-role-editor');
__('Manage categories', 'user-role-editor');
__('Manage links', 'user-role-editor');
__('Upload files', 'user-role-editor');
__('Import', 'user-role-editor');
__('Unfiltered html', 'user-role-editor');
__('Edit posts', 'user-role-editor');
__('Edit others posts', 'user-role-editor');
__('Edit published posts', 'user-role-editor');
__('Publish posts', 'user-role-editor');
__('Edit pages', 'user-role-editor');
__('Read', 'user-role-editor');
__('Level 10', 'user-role-editor');
__('Level 9', 'user-role-editor');
__('Level 8', 'user-role-editor');
__('Level 7', 'user-role-editor');
__('Level 6', 'user-role-editor');
__('Level 5', 'user-role-editor');
__('Level 4', 'user-role-editor');
__('Level 3', 'user-role-editor');
__('Level 2', 'user-role-editor');
__('Level 1', 'user-role-editor');
__('Level 0', 'user-role-editor');
__('Edit others pages', 'user-role-editor');
__('Edit published pages', 'user-role-editor');
__('Publish pages', 'user-role-editor');
__('Delete pages', 'user-role-editor');
__('Delete others pages', 'user-role-editor');
__('Delete published pages', 'user-role-editor');
__('Delete posts', 'user-role-editor');
__('Delete others posts', 'user-role-editor');
__('Delete published posts', 'user-role-editor');
__('Delete private posts', 'user-role-editor');
__('Edit private posts', 'user-role-editor');
__('Read private posts', 'user-role-editor');
__('Delete private pages', 'user-role-editor');
__('Edit private pages', 'user-role-editor');
__('Read private pages', 'user-role-editor');
__('Delete users', 'user-role-editor');
__('Create users', 'user-role-editor');
__('Unfiltered upload', 'user-role-editor');
__('Edit dashboard', 'user-role-editor');
__('Update plugins', 'user-role-editor');
__('Delete plugins', 'user-role-editor');
__('Install plugins', 'user-role-editor');
__('Update themes', 'user-role-editor');
__('Install themes', 'user-role-editor');
__('Update core', 'user-role-editor');
__('List users', 'user-role-editor');
__('Remove users', 'user-role-editor');
__('Add users', 'user-role-editor');
__('Promote users', 'user-role-editor');
__('Edit theme options', 'user-role-editor');
__('Delete themes', 'user-role-editor');
__('Export', 'user-role-editor');
}
}
// end of translation_data()
/**
* placeholder - realized at the Pro version
*/
protected function check_blog_user($user) {
return true;
}
// end of check_blog_user()
/**
* placeholder - realized at the Pro version
*/
protected function network_update_user($user) {
return true;
}
// end of network_update_user()
/**
* Update user roles and capabilities
*
* @global WP_Roles $wp_roles
* @param WP_User $user
* @return boolean
*/
protected function update_user($user) {
global $wp_roles;
if ($this->multisite) {
if (!$this->check_blog_user($user)) {
return false;
}
}
$primary_role = $_POST['primary_role'];
if (empty($primary_role) || !isset($wp_roles->roles[$primary_role])) {
$primary_role = '';
}
if (function_exists('bbp_filter_blog_editable_roles')) { // bbPress plugin is active
$bbp_user_role = bbp_get_user_role($user->ID);
} else {
$bbp_user_role = '';
}
$edit_user_caps_mode = $this->get_edit_user_caps_mode();
if (!$edit_user_caps_mode) { // readonly mode
$this->capabilities_to_save = $user->caps;
}
// revoke all roles and capabilities from this user
$user->roles = array();
$user->remove_all_caps();
// restore primary role
if (!empty($primary_role)) {
$user->add_role($primary_role);
}
// restore bbPress user role if she had one
if (!empty($bbp_user_role)) {
$user->add_role($bbp_user_role);
}
// add other roles to user
foreach ($_POST as $key => $value) {
$result = preg_match('/^wp_role_(.+)/', $key, $match);
if ($result === 1) {
$role = $match[1];
if (isset($wp_roles->roles[$role])) {
$user->add_role($role);
if (!$edit_user_caps_mode && isset($this->capabilities_to_save[$role])) {
unset($this->capabilities_to_save[$role]);
}
}
}
}
// add individual capabilities to user
if (count($this->capabilities_to_save) > 0) {
foreach ($this->capabilities_to_save as $key => $value) {
$user->add_cap($key);
}
}
$user->update_user_level_from_caps();
do_action('profile_update', $user->ID, $user); // in order other plugins may hook to the user permissions update
if ($this->apply_to_all) { // apply update to the all network
if (!$this->network_update_user($user)) {
return false;
}
}
return true;
}
// end of update_user()
/**
* Returns administrator role ID
*
* @return string
*/
public function get_admin_role() {
if (isset($this->roles['administrator'])) {
$admin_role_id = 'administrator';
} else {
// go through all roles and select one with max quant of capabilities included
$max_caps = -1;
$admin_role_id = '';
foreach(array_keys($this->roles) as $role_id) {
$caps = count($this->roles[$role_id]['capabilities']);
if ($caps>$max_caps) {
$max_caps = $caps;
$admin_role_id = $role_id;
}
}
}
return $admin_role_id;
}
// end get_admin_role()
/**
* Returns text presentation of user roles
*
* @param type $roles user roles list
* @return string
*/
public function roles_text($roles) {
global $wp_roles;
if (is_array($roles) && count($roles) > 0) {
$role_names = array();
foreach ($roles as $role) {
$role_names[] = $wp_roles->roles[$role]['name'];
}
$output = implode(', ', $role_names);
} else {
$output = '';
}
return $output;
}
// end of roles_text()
public function about() {
if ($this->is_pro()) {
return;
}
?>
<h2>User Role Editor</h2>
<strong><?php esc_html_e('Version:', 'user-role-editor');?></strong> <?php echo URE_VERSION; ?><br/><br/>
<a class="ure_rsb_link" style="background-image:url(<?php echo URE_PLUGIN_URL . 'images/vladimir.png'; ?>);" target="_blank" href="http://www.shinephp.com/"><?php _e("Author's website", 'user-role-editor'); ?></a><br/>
<a class="ure_rsb_link" style="background-image:url(<?php echo URE_PLUGIN_URL . 'images/user-role-editor-icon.png'; ?>);" target="_blank" href="https://www.role-editor.com"><?php _e('Plugin webpage', 'user-role-editor'); ?></a><br/>
<a class="ure_rsb_link" style="background-image:url(<?php echo URE_PLUGIN_URL . 'images/user-role-editor-icon.png'; ?>);" target="_blank" href="https://www.role-editor.com/download-plugin"><?php _e('Plugin download', 'user-role-editor'); ?></a><br/>
<a class="ure_rsb_link" style="background-image:url(<?php echo URE_PLUGIN_URL . 'images/changelog-icon.png'; ?>);" target="_blank" href="https://www.role-editor.com/changelog"><?php _e('Changelog', 'user-role-editor'); ?></a><br/>
<a class="ure_rsb_link" style="background-image:url(<?php echo URE_PLUGIN_URL . 'images/faq-icon.png'; ?>);" target="_blank" href="http://www.shinephp.com/user-role-editor-wordpress-plugin/#faq"><?php _e('FAQ', 'user-role-editor'); ?></a><br/>
<hr />
<div style="text-align: center;">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="encrypted"
value="-----BEGIN PKCS7-----MIIHZwYJKoZIhvcNAQcEoIIHWDCCB1QCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBME5QAQYFDddWBHA4YXI1x3dYmM77clH5s0CgokYnLVk0P8keOxMtYyNQo6xJs6pY1nJfE3tqNg8CZ3btJjmOUa6DsE+K8Nm6OxGHMQF45z8WAs+f/AvQWdSpPXD0eSMu9osNgmC3yv46hOT3B1J3rKkpeZzMThCdUfECqu+lluzELMAkGBSsOAwIaBQAwgeQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIeMSZk/UuZnuAgcAort75TUUbtDhmdTi1N0tR9W75Ypuw5nBw01HkZFsFHoGezoT95c3ZesHAlVprhztPrizl1UzE9COQs+3p62a0o+BlxUolkqUT3AecE9qs9dNshqreSvmC8SOpirOroK3WE7DStUvViBfgoNAPTTyTIAKKX24uNXjfvx1jFGMQGBcFysbb3OTkc/B6OiU2G951U9R8dvotaE1RQu6JwaRgwA3FEY9d/P8M+XdproiC324nzFel5WlZ8vtDnMyuPxOgggOHMIIDgzCCAuygAwIBAgIBADANBgkqhkiG9w0BAQUFADCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20wHhcNMDQwMjEzMTAxMzE1WhcNMzUwMjEzMTAxMzE1WjCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMFHTt38RMxLXJyO2SmS+Ndl72T7oKJ4u4uw+6awntALWh03PewmIJuzbALScsTS4sZoS1fKciBGoh11gIfHzylvkdNe/hJl66/RGqrj5rFb08sAABNTzDTiqqNpJeBsYs/c2aiGozptX2RlnBktH+SUNpAajW724Nv2Wvhif6sFAgMBAAGjge4wgeswHQYDVR0OBBYEFJaffLvGbxe9WT9S1wob7BDWZJRrMIG7BgNVHSMEgbMwgbCAFJaffLvGbxe9WT9S1wob7BDWZJRroYGUpIGRMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbYIBADAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAIFfOlaagFrl71+jq6OKidbWFSE+Q4FqROvdgIONth+8kSK//Y/4ihuE4Ymvzn5ceE3S/iBSQQMjyvb+s2TWbQYDwcp129OPIbD9epdr4tJOUNiSojw7BHwYRiPh58S1xGlFgHFXwrEBb3dgNbMUa+u4qectsMAXpVHnD9wIyfmHMYIBmjCCAZYCAQEwgZQwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMAkGBSsOAwIaBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0xMTEyMTAwODU3MjdaMCMGCSqGSIb3DQEJBDEWBBSFh6YmkoVtYdMaDd5G6EN0dGcPpzANBgkqhkiG9w0BAQEFAASBgAB91K/+gsmpbKxILdCVXCkiOg1zSG+tfq2EZSNzf8z/R1E3HH8qPdm68OToILsgWohKFwE+RCwcQ0iq77wd0alnWoknvhBBoFC/U0yJ3XmA3Hkgrcu6yhVijY/Odmf6WWcz79/uLGkvBSECbjTY0GLxvhRlsh2nAioCfxAr1cFo-----END PKCS7-----">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</div>
<?php
}
// end of about()
protected function set_current_role() {
if (!isset($this->current_role) || !$this->current_role) {
if (isset($_REQUEST['user_role']) && $_REQUEST['user_role'] && isset($this->roles[$_REQUEST['user_role']])) {
$this->current_role = $_REQUEST['user_role'];
} else {
$this->current_role = $this->get_last_role_id();
}
$this->current_role_name = $this->roles[$this->current_role]['name'];
}
}
// end of set_current_role()
public function show_admin_role_allowed() {
$show_admin_role = $this->get_option('show_admin_role', 0);
$show_admin_role = ((defined('URE_SHOW_ADMIN_ROLE') && URE_SHOW_ADMIN_ROLE==1) || $show_admin_role==1) && $this->user_is_admin();
return $show_admin_role;
}
// end of show_admin_role()
// returns true if $user has $capability assigned through the roles or directly
// returns true if user has role with name equal $capability
public function user_can($capability) {
if (isset($this->user_to_edit->caps[$capability])) {
return true;
}
foreach ($this->user_to_edit->roles as $role) {
if ($role===$capability) {
return true;
}
if (!empty($this->roles[$role]['capabilities'][$capability])) {
return true;
}
}
return false;
}
// end of user_can()
/**
* Returns true if user has a real super administrator permissions
* It takes into account $this->raised_permissions value, in order do not count a user with temporally raised permissions
* of a real superadmin under WP Multisite
* For WP Singlesite superadmin is a user with 'administrator' role only in opposite the WordPress's is_super_admin(),
* which counts any user with 'delete_users' capability as a superadmin.
*
* @param int $user_id
* @global WP_User $current_user
* @return boolean
*/
public function is_super_admin($user_id = false) {
if (empty($user_id)) {
$user = wp_get_current_user();
$user_id = $user->ID;
} else {
$user = get_userdata($user_id);
}
if (!$user || !$user->exists()) {
return false;
}
if ($this->multisite && !$this->raised_permissions && is_super_admin($user_id)) {
return true;
}
if (!$this->multisite && $this->user_has_capability($user, 'administrator')) {
return true;
}
return false;
}
// end of is_super_admin()
// Returns true if user is a real superadmin
// Returns true if user has $capability assigned through the roles or directly
// Returns true if user has role with name equal $cap
public function user_has_capability($user, $cap) {
global $wp_roles;
if (!is_object($user) || empty($user->ID)) {
return false;
}
if ($this->multisite && !$this->raised_permissions && is_super_admin($user->ID)) { // do not replace with $this->is_super_admin() to exclude recursion
return true;
}
if (isset($user->caps[$cap])) {
return true;
}
foreach ($user->roles as $role) {
if ($role === $cap) {
return true;
}
if (!empty($wp_roles->roles[$role]['capabilities'][$cap])) {
return true;
}
}
return false;
}
// end of user_has_capability()
public function show_other_default_roles() {
$other_default_roles = $this->get_option('other_default_roles', array());
foreach ($this->roles as $role_id => $role) {
if ( $role_id=='administrator' || $role_id==$this->wp_default_role ) {
continue;
}
if ( in_array($role_id, $other_default_roles) ) {
$checked = 'checked="checked"';
} else {
$checked = '';
}
echo '<label for="wp_role_' . $role_id .'"><input type="checkbox" id="wp_role_' . $role_id .
'" name="wp_role_' . $role_id . '" value="' . $role_id . '"' . $checked .' />&nbsp;' .
esc_html__($role['name'], 'user-role-editor') . '</label><br />';
}
}
// end of show_other_default_roles()
public function get_current_role() {
return $this->current_role;
}
// end of get_current_role()
public function get_edit_user_caps_mode() {
if ($this->multisite && $this->is_super_admin()) {
return 1;
}
$edit_user_caps = $this->get_option('edit_user_caps', 1);
return $edit_user_caps;
}
// end of get_edit_user_caps_mode()
/**
* Returns comma separated string of capabilities directly (not through the roles) assigned to the user
*
* @global WP_Roles $wp_roles
* @param object $user
* @return string
*/
public function get_edited_user_caps($user) {
global $wp_roles;
$output = '';
foreach ($user->caps as $cap => $value) {
if (!$wp_roles->is_role($cap)) {
if ('' != $output) {
$output .= ', ';
}
$output .= $value ? $cap : sprintf(__('Denied: %s'), $cap);
}
}
return $output;
}
// end of get_edited_user_caps()
public function is_user_profile_extention_allowed() {
// Check if we are not at the network admin center
$result = stripos($_SERVER['REQUEST_URI'], 'network/user-edit.php') == false;
return $result;
}
// end of is_user_profile_extention_allowed()
// create assign_role object
public function get_assign_role() {
$assign_role = new URE_Assign_Role($this);
return $assign_role;
}
// end of get_assign_role()
public function get_ure_page_url() {
$page_url = URE_WP_ADMIN_URL . URE_PARENT . '?page=users-' . URE_PLUGIN_FILE;
$object = $this->get_request_var('object', 'get');
$user_id = $this->get_request_var('user_id', 'get', 'int');
if ($object=='user' && $user_id>0) {
$page_url .= '&object=user&user_id='. $user_id;
}
return $page_url;
}
// end of get_ure_page_url()
/**
* Compare if current URL path is equal to the required one
* if $path is empty, then just check if URL leads to wp-admin
* @param string $path
* @return boolean
*/
public function is_right_admin_path($path='') {
$result = true;
$admin_url = admin_url($path);
$parsed = parse_url($admin_url);
$full_path = $parsed['path'];
if ( stripos($_SERVER['REQUEST_URI'], $full_path)===false ) {
$result = false;
}
return $result;
}
// end of is_right_admin_path()
}
// end of URE_Lib class
\ No newline at end of file
<?php
/*
* Project: User Role Editor WordPress plugin
* Class for Assigning to a user multiple roles
* Author: Vladimir Garagulya
* Author email: support@role-editor.com
* Author URI: https://www.role-editor.com
* License: GPL v2+
*
*/
class URE_User_Other_Roles {
protected $lib = null;
function __construct() {
$this->lib = URE_Lib::get_instance();
$this->set_hooks();
}
// end of $lib
public function set_hooks() {
if (is_admin()) {
add_filter( 'additional_capabilities_display', array($this, 'additional_capabilities_display'), 10, 1);
add_action( 'admin_print_styles-user-edit.php', array($this, 'load_css') );
add_action( 'admin_print_styles-user-new.php', array($this, 'load_css') );
add_action( 'admin_enqueue_scripts', array($this, 'load_js' ) );
add_action( 'edit_user_profile', array($this, 'edit_user_profile_html'), 10, 1 );
add_action( 'user_new_form', array($this, 'user_new_form'), 10, 1 );
add_action( 'profile_update', array($this, 'update'), 10 );
}
$multisite = $this->lib->get('multisite');
if ($multisite) {
add_action( 'wpmu_activate_user', array($this, 'add_other_roles'), 10, 1 );
}
add_action( 'user_register', array($this, 'add_other_roles'), 10, 1 );
}
// end of set_hooks()
public function additional_capabilities_display($display) {
$display = false;
return $display;
}
// end of additional_capabilities_display()
/*
* Load CSS for the user profile edit page
*/
public function load_css() {
wp_enqueue_style('wp-jquery-ui-dialog');
wp_enqueue_style('ure-jquery-multiple-select', plugins_url('/css/multiple-select.css', URE_PLUGIN_FULL_PATH), array(), false, 'screen');
}
// end of load_css()
public function load_js($hook_suffix) {
if (!in_array($hook_suffix, array('user-edit.php', 'user-new.php'))) {
return;
}
wp_enqueue_script('jquery-ui-dialog', false, array('jquery-ui-core', 'jquery-ui-button', 'jquery'));
wp_register_script('ure-jquery-multiple-select', plugins_url('/js/jquery.multiple.select.js', URE_PLUGIN_FULL_PATH));
wp_enqueue_script('ure-jquery-multiple-select');
wp_register_script('ure-user-profile-other-roles', plugins_url('/js/ure-user-profile-other-roles.js', URE_PLUGIN_FULL_PATH));
wp_enqueue_script('ure-user-profile-other-roles');
wp_localize_script('ure-user-profile-other-roles', 'ure_data_user_profile_other_roles', array(
'wp_nonce' => wp_create_nonce('user-role-editor'),
'other_roles' => esc_html__('Other Roles', 'user-role-editor'),
'select_roles' => esc_html__('Select additional roles for this user', 'user-role-editor')
));
}
// end of load_js()
/**
* Returns list of user roles, except 1st one, and bbPress assigned as they are shown by WordPress and bbPress theirselves.
*
* @param type $user WP_User from wp-includes/capabilities.php
* @return array
*/
public function get_roles_array($user) {
if (!is_array($user->roles) || count($user->roles) <= 1) {
return array();
}
// get bbPress assigned user role
if (function_exists('bbp_filter_blog_editable_roles')) {
$bb_press_role = bbp_get_user_role($user->ID);
} else {
$bb_press_role = '';
}
$roles = array();
foreach ($user->roles as $key => $value) {
if (!empty($bb_press_role) && $bb_press_role === $value) {
// exclude bbPress assigned role
continue;
}
$roles[] = $value;
}
array_shift($roles); // exclude primary role which is shown by WordPress itself
return $roles;
}
// end of get_roles_array()
private function roles_select_html($user) {
global $wp_roles;
$user_roles = $user->roles;
$primary_role = array_shift($user_roles);
$roles = apply_filters('editable_roles', $wp_roles->roles); // exclude restricted roles if any
if (isset($roles[$primary_role])) { // exclude role assigned to the user as a primary role
unset($roles[$primary_role]);
}
$other_roles = $this->get_roles_array($user);
echo '<select multiple="multiple" id="ure_select_other_roles" name="ure_select_other_roles" style="width: 500px;" >'."\n";
foreach($roles as $key=>$role) {
echo '<option value="'.$key.'" >'.$role['name'].'</option>'."\n";
} // foreach()
echo '</select><br>'."\n";
if (is_array($other_roles) && count($other_roles) > 0) {
$other_roles_str = implode(',', $other_roles);
} else {
$other_roles_str = '';
}
echo '<input type="hidden" name="ure_other_roles" id="ure_other_roles" value="' . $other_roles_str . '" />';
$output = $this->lib->roles_text($other_roles);
echo '<span id="ure_other_roles_list">'. $output .'</span>';
}
// end of roles_select()
private function user_profile_capabilities($user) {
global $current_user;
$user_caps = $this->lib->get_edited_user_caps($user);
?>
<tr>
<th>
<?php esc_html_e('Capabilities', 'user-role-editor'); ?>
</th>
<td>
<?php
echo $user_caps .'<br/>';
if ($this->lib->user_is_admin($current_user->ID)) {
echo '<a href="' . wp_nonce_url("users.php?page=users-".URE_PLUGIN_FILE."&object=user&amp;user_id={$user->ID}", "ure_user_{$user->ID}") . '">' .
esc_html__('Edit', 'user-role-editor') . '</a>';
}
?>
</td>
</tr>
<?php
}
// end of user_profile_capabilities()
private function display($user, $context) {
?>
<table class="form-table">
<tr>
<th scope="row"><?php esc_html_e('Other Roles', 'user-role-editor'); ?></th>
<td>
<?php
$this->roles_select_html($user);
?>
</td>
</tr>
<?php
if ($context=='user-edit') {
$this->user_profile_capabilities($user);
}
?>
</table>
<?php
}
// end of display()
/**
* Add URE stuff to the edit user profile page
*
* @global object $current_user
* @param object $user
* @return void
*/
public function edit_user_profile_html($user) {
if (!$this->lib->is_user_profile_extention_allowed()) {
return;
}
$show = apply_filters('ure_show_additional_capabilities_section', true);
if (empty($show)) {
return;
}
?>
<h3><?php esc_html_e('Additional Capabilities', 'user-role-editor'); ?></h3>
<?php
$this->display($user, 'user-edit');
}
// end of edit_user_profile()
public function user_new_form($context) {
$show = apply_filters('ure_show_additional_capabilities_section', true);
if (empty($show)) {
return;
}
$user = new WP_User();
?>
<table>
<?php
$this->display($user, $context);
?>
</table>
<?php
}
// end of edit_user_profile_html()
// save additional user roles when user profile is updated, as WordPress itself doesn't know about them
public function update($user_id) {
global $wp_roles;
if (!current_user_can('edit_users')) {
return false;
}
if (!current_user_can('edit_user', $user_id)) {
return false;
}
$user = get_userdata($user_id);
if (empty($_POST['ure_other_roles'])) {
return false;
}
$data = explode(',', str_replace(' ', '', $_POST['ure_other_roles']));
$ure_other_roles = array();
foreach($data as $role_id) {
if (!isset($wp_roles->roles[$role_id])) { // skip unexisted roles
continue;
}
if (is_array($user->roles) && !in_array($role_id, $user->roles)) {
$ure_other_roles[] = $role_id;
}
}
foreach ($ure_other_roles as $role) {
$user->add_role($role);
}
return true;
}
// end of update()
private function add_default_other_roles($user_id) {
$user = get_user_by('id', $user_id);
if (empty($user->ID)) {
return;
}
// Get default roles if any
$other_default_roles = $this->lib->get_option('other_default_roles', array());
if (count($other_default_roles) == 0) {
return;
}
foreach ($other_default_roles as $role) {
if (!isset($user->caps[$role])) {
$user->add_role($role);
}
}
}
// end of add_default_other_roles()
public function add_other_roles($user_id) {
if (empty($user_id)) {
return;
}
$result = $this->update($user_id);
if ($result) { // roles were assigned manually
return;
}
$this->add_default_other_roles($user_id);
}
// end of add_other_roles()
}
// end of URE_User_Other_Roles class
<?php
/*
* Main class of User Role Editor WordPress plugin
* Author: Vladimir Garagulya
* Author email: support@role-editor.com
* Author URI: https://www.role-editor.com
* License: GPL v2+
*
*/
class User_Role_Editor {
// plugin specific library object: common code stuff, including options data processor
protected $lib = null;
// work with user multiple roles class
protected $user_other_roles = null;
// plugin's Settings page reference, we've got it from add_options_pages() call
protected $setting_page_hook = null;
// URE's key capability
public $key_capability = 'not allowed';
protected $main_page_hook_suffix = null;
protected $settings_hook_suffix = null;
// URE pages hook suffixes
protected $ure_hook_suffixes = null;
/**
* class constructor
*/
public function __construct() {
if (empty($this->lib)) {
$this->lib = URE_Lib::get_instance('user_role_editor');
}
$this->user_other_roles = new URE_User_Other_Roles();
if ($this->lib->is_pro()) {
$this->main_page_hook_suffix = 'users_page_users-user-role-editor-pro';
$this->settings_hook_suffix = 'settings_page_settings-user-role-editor-pro';
} else {
$this->main_page_hook_suffix = 'users_page_users-user-role-editor';
$this->settings_hook_suffix = 'settings_page_settings-user-role-editor';
}
$this->ure_hook_suffixes = array($this->settings_hook_suffix, $this->main_page_hook_suffix);
// activation action
register_activation_hook(URE_PLUGIN_FULL_PATH, array($this, 'setup'));
// deactivation action
register_deactivation_hook(URE_PLUGIN_FULL_PATH, array($this, 'cleanup'));
// Who can use this plugin
$this->key_capability = URE_Own_Capabilities::get_key_capability();
// Process URE's internal tasks queue
$task_queue = URE_Task_Queue::get_instance();
$task_queue->process();
$this->set_hooks();
}
// end of __construct()
private function set_hooks() {
$multisite = $this->lib->get('multisite');
if ($multisite) {
// new blog may be registered not at admin back-end only but automatically after new user registration, e.g.
// Gravity Forms User Registration Addon does
add_action( 'wpmu_new_blog', array($this, 'duplicate_roles_for_new_blog'), 10, 2);
}
// setup additional options hooks for the roles
add_action('init', array($this, 'set_role_additional_options_hooks'), 9);
if (!is_admin()) {
return;
}
add_action('admin_init', array($this, 'plugin_init'), 1);
// Add the translation function after the plugins loaded hook.
add_action('plugins_loaded', array($this, 'load_translation'));
// add own submenu
add_action('admin_menu', array($this, 'plugin_menu'));
if ($multisite) {
// add own submenu
add_action('network_admin_menu', array($this, 'network_plugin_menu'));
}
// add a Settings link in the installed plugins page
add_filter('plugin_action_links_'. URE_PLUGIN_BASE_NAME, array($this, 'plugin_action_links'), 10, 1);
add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2);
}
// end of set_hooks()
/**
* True - if it's an instance of Pro version, false - for free version
* @return boolean
*/
public function is_pro() {
return $this->lib->is_pro();
}
// end of is_pro()
/**
* Plugin initialization
*
*/
public function plugin_init() {
global $current_user, $pagenow;
if (!empty($current_user->ID)) {
$user_id = $current_user->ID;
} else {
$user_id = 0;
}
$supress_protection = apply_filters('ure_supress_administrators_protection', false);
// these filters and actions should prevent editing users with administrator role
// by other users with 'edit_users' capability
if (!$supress_protection && !$this->lib->user_is_admin($user_id)) {
new URE_Protect_Admin($this->lib);
}
add_action('admin_enqueue_scripts', array($this, 'admin_load_js'));
add_action('user_row_actions', array($this, 'user_row'), 10, 2);
add_filter('all_plugins', array($this, 'exclude_from_plugins_list'));
$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);
if ($allow_edit_users_to_not_super_admin) {
add_filter('map_meta_cap', array($this, 'restore_users_edit_caps'), 1, 4);
remove_all_filters('enable_edit_any_user_configuration');
add_filter('enable_edit_any_user_configuration', '__return_true');
add_action('admin_head', array($this, 'edit_user_permission_check'), 1);
if ($pagenow == 'user-new.php') {
add_filter('site_option_site_admins', array($this, 'allow_add_user_as_superadmin'));
}
}
} else {
$count_users_without_role = $this->lib->get_option('count_users_without_role', 0);
if ($count_users_without_role) {
add_action('restrict_manage_users', array($this, 'move_users_from_no_role_button'));
add_action('admin_init', array($this, 'add_css_to_users_page'));
add_action('admin_footer', array($this, 'add_js_to_users_page'));
}
}
add_action('wp_ajax_ure_ajax', array($this, 'ure_ajax'));
}
// end of plugin_init()
/**
* Allow non-superadmin user to add/create users to the site as superadmin does.
* Include current user to the list of superadmins - for the user-new.php page only, and
* if user really can create_users and promote_users
* @global string $page
* @param array $site_admins
* @return array
*/
public function allow_add_user_as_superadmin($site_admins) {
global $pagenow, $current_user;
$this->lib->set_raised_permissions(false);
if ($pagenow!=='user-new.php') {
return $site_admins;
}
// Check if current user really can create and promote users
remove_filter('site_option_site_admins', array($this, 'allow_add_user_as_superadmin'));
$can_add_user = current_user_can('create_users') && current_user_can('promote_users');
add_filter('site_option_site_admins', array($this, 'allow_add_user_as_superadmin'));
if (!$can_add_user) {
return $site_admins; // no help in this case
}
if (!in_array($current_user->user_login, $site_admins)) {
$this->lib->set_raised_permissions(true);
$site_admins[] = $current_user->user_login;
}
return $site_admins;
}
// end of allow_add_user_as_superadmin()
public function move_users_from_no_role_button() {
if (!$this->lib->is_right_admin_path('users.php')) {
return;
}
$assign_role = $this->lib->get_assign_role();
$users_quant = $assign_role->count_users_without_role();
if ($users_quant>0) {
?>
&nbsp;&nbsp;<input type="button" name="move_from_no_role" id="move_from_no_role" class="button"
value="Without role (<?php echo $users_quant;?>)" onclick="ure_move_users_from_no_role_dialog()">
<div id="move_from_no_role_dialog" class="ure-dialog">
<div id="move_from_no_role_content" style="padding: 10px;"></div>
</div>
<?php
}
}
// end of move_users_from_no_role()
public function add_css_to_users_page() {
if (isset($_GET['page'])) {
return;
}
if (!$this->lib->is_right_admin_path('users.php')) {
return;
}
wp_enqueue_style('wp-jquery-ui-dialog');
wp_enqueue_style('ure-admin-css', URE_PLUGIN_URL . 'css/ure-admin.css', array(), false, 'screen');
}
// end of add_css_to_users_page()
public function add_js_to_users_page() {
if (isset($_GET['page'])) {
return;
}
if (!$this->lib->is_right_admin_path('users.php')) {
return;
}
wp_enqueue_script('jquery-ui-dialog', false, array('jquery-ui-core','jquery-ui-button', 'jquery') );
wp_register_script( 'ure-users-js', plugins_url( '/js/ure-users.js', URE_PLUGIN_FULL_PATH ) );
wp_enqueue_script ( 'ure-users-js' );
wp_localize_script( 'ure-users-js', 'ure_users_data', array(
'wp_nonce' => wp_create_nonce('user-role-editor'),
'move_from_no_role_title' => esc_html__('Change role for users without role', 'user-role-editor'),
'to' => esc_html__('To:', 'user-role-editor'),
'no_rights_caption' => esc_html__('No rights', 'user-role-editor'),
'provide_new_role_caption' => esc_html__('Provide new role', 'user-role-editor')
));
}
// end of add_js_to_users_page()
/**
* restore edit_users, delete_users, create_users capabilities for non-superadmin users under multisite
* (code is provided by http://wordpress.org/support/profile/sjobidoo)
*
* @param type $caps
* @param type $cap
* @param type $user_id
* @param type $args
* @return type
*/
public function restore_users_edit_caps($caps, $cap, $user_id, $args) {
foreach ($caps as $key => $capability) {
if ($capability != 'do_not_allow')
continue;
switch ($cap) {
case 'edit_user':
case 'edit_users':
$caps[$key] = 'edit_users';
break;
case 'delete_user':
case 'delete_users':
$caps[$key] = 'delete_users';
break;
case 'create_users':
$caps[$key] = $cap;
break;
}
}
return $caps;
}
// end of restore_user_edit_caps()
/**
* Checks that both the editing user and the user being edited are
* members of the blog and prevents the super admin being edited.
* (code is provided by http://wordpress.org/support/profile/sjobidoo)
*
*/
public function edit_user_permission_check() {
global $current_user, $profileuser;
wp_get_current_user();
if ($current_user->ID===0) {
return;
}
if ($this->lib->is_super_admin()) { // Superadmin may do all
return;
}
$screen = get_current_screen();
if (empty($screen)) {
return;
}
if ($screen->base !== 'user-edit' && $screen->base !== 'user-edit-network') {
return;
}
// editing a user profile: it's correct to call is_super_admin() directly here, as permissions are raised for the $current_user only
if (!$this->lib->is_super_admin($current_user->ID) && is_super_admin($profileuser->ID)) { // trying to edit a superadmin while himself is less than a superadmin
wp_die(esc_html__('You do not have permission to edit this user.', 'user-role-editor'));
} elseif (!( is_user_member_of_blog($profileuser->ID, get_current_blog_id()) && is_user_member_of_blog($current_user->ID, get_current_blog_id()) )) { // editing user and edited user aren't members of the same blog
wp_die(esc_html__('You do not have permission to edit this user.', 'user-role-editor'));
}
}
// end of edit_user_permission_check()
/**
* Add/hide edit actions for every user row at the users list
*
* @global type $pagenow
* @global type $current_user
* @param string $actions
* @param type $user
* @return string
*/
public function user_row($actions, $user) {
global $pagenow, $current_user;
if ($pagenow == 'users.php') {
if ($current_user->has_cap($this->key_capability)) {
$actions['capabilities'] = '<a href="' .
wp_nonce_url("users.php?page=users-" . URE_PLUGIN_FILE . "&object=user&amp;user_id={$user->ID}", "ure_user_{$user->ID}") .
'">' . esc_html__('Capabilities', 'user-role-editor') . '</a>';
}
}
return $actions;
}
// end of user_row()
/**
* every time when new blog created - duplicate to it roles from the main blog (1)
* @global wpdb $wpdb
* @global WP_Roles $wp_roles
* @param int $blog_id
* @param int $user_id
*
*/
public function duplicate_roles_for_new_blog($blog_id)
{
global $wpdb, $wp_roles;
// get Id of 1st (main) blog
$main_blog_id = $this->lib->get_main_blog_id();
if ( empty($main_blog_id) ) {
return;
}
$current_blog = $wpdb->blogid;
switch_to_blog( $main_blog_id );
$main_roles = new WP_Roles(); // get roles from primary blog
$default_role = get_option('default_role'); // get default role from primary blog
switch_to_blog($blog_id); // switch to the new created blog
$main_roles->use_db = false; // do not touch DB
$main_roles->add_cap('administrator', 'dummy_123456'); // just to save current roles into new blog
$main_roles->role_key = $wp_roles->role_key;
$main_roles->use_db = true; // save roles into new blog DB
$main_roles->remove_cap('administrator', 'dummy_123456'); // remove unneeded dummy capability
update_option('default_role', $default_role); // set default role for new blog as it set for primary one
switch_to_blog($current_blog); // return to blog where we were at the begin
}
// end of duplicate_roles_for_new_blog()
/**
* Filter out URE plugin from not admin users to prevent its not authorized deactivation
* @param type array $plugins plugins list
* @return type array $plugins updated plugins list
*/
public function exclude_from_plugins_list($plugins) {
$multisite = $this->lib->get('multisite');
// if multi-site, then allow plugin activation for network superadmins and, if that's specially defined, - for single site administrators too
if ($multisite) {
if ($this->lib->is_super_admin() || $this->lib->user_is_admin()) {
return $plugins;
}
} else {
// is_super_admin() defines superadmin for not multisite as user who can 'delete_users' which I don't like.
// So let's check if user has 'administrator' role better.
if (current_user_can('administrator') || $this->lib->user_is_admin()) {
return $plugins;
}
}
// exclude URE from plugins list
$key = basename(URE_PLUGIN_DIR) . '/' . URE_PLUGIN_FILE;
unset($plugins[$key]);
return $plugins;
}
// end of exclude_from_plugins_list()
/**
* Load plugin translation files - linked to the 'plugins_loaded' action
*
*/
function load_translation() {
load_plugin_textdomain('user-role-editor', '', dirname( plugin_basename( URE_PLUGIN_FULL_PATH ) ) .'/lang');
}
// end of ure_load_translation()
/**
* Modify plugin action links
*
* @param array $links
* @return array
*/
public function plugin_action_links($links) {
$single_site_settings_link = '<a href="options-general.php?page=settings-' . URE_PLUGIN_FILE . '">' . esc_html__('Settings', 'user-role-editor') .'</a>';
$multisite = $this->lib->get('multisite');
if (!$multisite ) {
$settings_link = $single_site_settings_link;
} else {
$ure = basename(URE_PLUGIN_DIR) . '/' . URE_PLUGIN_FILE;
$active_for_network = is_plugin_active_for_network($ure);
if (!$active_for_network) {
$settings_link = $single_site_settings_link;
} else {
if (!current_user_can('manage_network_plugins')) {
return $links;
}
$settings_link = '<a href="'. network_admin_url() .'settings.php?page=settings-'. URE_PLUGIN_FILE .'">'. esc_html__('Settings', 'user-role-editor') .'</a>';
}
}
array_unshift($links, $settings_link);
return $links;
}
// end of plugin_action_links()
public function plugin_row_meta($links, $file) {
if ($file == plugin_basename(dirname(URE_PLUGIN_FULL_PATH) .'/'.URE_PLUGIN_FILE)) {
$links[] = '<a target="_blank" href="http://role-editor.com/changelog">' . esc_html__('Changelog', 'user-role-editor') . '</a>';
}
return $links;
}
// end of plugin_row_meta
public function settings_screen_configure() {
$multisite = $this->lib->get('multisite');
$settings_page_hook = $this->settings_page_hook;
if ($multisite) {
$settings_page_hook .= '-network';
}
$screen = get_current_screen();
// Check if current screen is URE's settings page
if ($screen->id != $settings_page_hook) {
return;
}
$screen_help = new Ure_Screen_Help();
$screen->add_help_tab( array(
'id' => 'general',
'title' => esc_html__('General', 'user-role-editor'),
'content' => $screen_help->get_settings_help('general')
));
if ($this->lib->is_pro() || !$multisite) {
$screen->add_help_tab( array(
'id' => 'additional_modules',
'title' => esc_html__('Additional Modules', 'user-role-editor'),
'content' => $screen_help->get_settings_help('additional_modules')
));
}
$screen->add_help_tab( array(
'id' => 'default_roles',
'title' => esc_html__('Default Roles', 'user-role-editor'),
'content' => $screen_help->get_settings_help('default_roles')
));
if ($multisite) {
$screen->add_help_tab( array(
'id' => 'multisite',
'title' => esc_html__('Multisite', 'user-role-editor'),
'content' => $screen_help->get_settings_help('multisite')
));
}
}
// end of settings_screen_configure()
public function plugin_menu() {
$translated_title = esc_html__('User Role Editor', 'user-role-editor');
if (function_exists('add_submenu_page')) {
$ure_page = add_submenu_page(
'users.php',
$translated_title,
$translated_title,
'ure_edit_roles',
'users-' . URE_PLUGIN_FILE,
array($this, 'edit_roles'));
add_action("admin_print_styles-$ure_page", array($this, 'admin_css_action'));
}
$multisite = $this->lib->get('multisite');
$active_for_network = $this->lib->get('active_for_network');
if ( !$multisite || ($multisite && !$active_for_network) ) {
$settings_capability = URE_Own_Capabilities::get_settings_capability();
$this->settings_page_hook = add_options_page(
$translated_title,
$translated_title,
$settings_capability,
'settings-' . URE_PLUGIN_FILE,
array($this, 'settings'));
add_action( 'load-'.$this->settings_page_hook, array($this,'settings_screen_configure') );
add_action("admin_print_styles-{$this->settings_page_hook}", array($this, 'admin_css_action'));
}
}
// end of plugin_menu()
public function network_plugin_menu() {
if (is_multisite()) {
$translated_title = esc_html__('User Role Editor', 'user-role-editor');
$this->settings_page_hook = add_submenu_page(
'settings.php',
$translated_title,
$translated_title,
$this->key_capability,
'settings-' . URE_PLUGIN_FILE,
array(&$this, 'settings'));
add_action( 'load-'.$this->settings_page_hook, array($this,'settings_screen_configure') );
add_action("admin_print_styles-{$this->settings_page_hook}", array($this, 'admin_css_action'));
}
}
// end of network_plugin_menu()
protected function get_settings_action() {
$action = 'show';
$update_buttons = array('ure_settings_update', 'ure_addons_settings_update', 'ure_settings_ms_update', 'ure_default_roles_update');
foreach($update_buttons as $update_button) {
if (!isset($_POST[$update_button])) {
continue;
}
if (!wp_verify_nonce($_POST['_wpnonce'], 'user-role-editor')) {
wp_die('Security check failed');
}
$action = $update_button;
break;
}
return $action;
}
// end of get_settings_action()
/**
* Update General Options tab
*/
protected function update_general_options() {
if (defined('URE_SHOW_ADMIN_ROLE') && (URE_SHOW_ADMIN_ROLE == 1)) {
$show_admin_role = 1;
} else {
$show_admin_role = $this->lib->get_request_var('show_admin_role', 'checkbox');
}
$this->lib->put_option('show_admin_role', $show_admin_role);
$caps_readable = $this->lib->get_request_var('caps_readable', 'checkbox');
$this->lib->put_option('ure_caps_readable', $caps_readable);
$show_deprecated_caps = $this->lib->get_request_var('show_deprecated_caps', 'checkbox');
$this->lib->put_option('ure_show_deprecated_caps', $show_deprecated_caps);
$confirm_role_update = $this->lib->get_request_var('confirm_role_update', 'checkbox');
$this->lib->put_option('ure_confirm_role_update', $confirm_role_update);
$edit_user_caps = $this->lib->get_request_var('edit_user_caps', 'checkbox');
$this->lib->put_option('edit_user_caps', $edit_user_caps);
do_action('ure_settings_update1');
$this->lib->flush_options();
$this->lib->show_message(esc_html__('User Role Editor options are updated', 'user-role-editor'));
}
// end of update_general_options()
/**
* Update Additional Modules Options tab
*/
protected function update_addons_options() {
$multisite = $this->lib->get('multisite');
if (!$multisite) {
$count_users_without_role = $this->lib->get_request_var('count_users_without_role', 'checkbox');
$this->lib->put_option('count_users_without_role', $count_users_without_role);
}
do_action('ure_settings_update2');
$this->lib->flush_options();
$this->lib->show_message(esc_html__('User Role Editor options are updated', 'user-role-editor'));
}
// end of update_addons_options()
protected function update_default_roles() {
global $wp_roles;
// Primary default role
$primary_default_role = $this->lib->get_request_var('default_user_role', 'post');
if (!empty($primary_default_role) && isset($wp_roles->role_objects[$primary_default_role]) && $primary_default_role !== 'administrator') {
update_option('default_role', $primary_default_role);
}
// Other default roles
$other_default_roles = array();
foreach($_POST as $key=>$value) {
$prefix = substr($key, 0, 8);
if ($prefix!=='wp_role_') {
continue;
}
$role_id = substr($key, 8);
if ($role_id!=='administrator' && isset($wp_roles->role_objects[$role_id])) {
$other_default_roles[] = $role_id;
}
} // foreach()
$this->lib->put_option('other_default_roles', $other_default_roles, true);
$this->lib->show_message(esc_html__('Default Roles are updated', 'user-role-editor'));
}
// end of update_default_roles()
protected function update_multisite_options() {
$multisite = $this->lib->get('multisite');
if (!$multisite) {
return;
}
$allow_edit_users_to_not_super_admin = $this->lib->get_request_var('allow_edit_users_to_not_super_admin', 'checkbox');
$this->lib->put_option('allow_edit_users_to_not_super_admin', $allow_edit_users_to_not_super_admin);
do_action('ure_settings_ms_update');
$this->lib->flush_options();
$this->lib->show_message(esc_html__('User Role Editor options are updated', 'user-role-editor'));
}
// end of update_multisite_options()
public function settings() {
$settings_capability = URE_Own_Capabilities::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');
}
// end of settings()
public function admin_css_action() {
wp_enqueue_style('wp-jquery-ui-dialog');
wp_enqueue_style('wp-jquery-ui-selectable');
if (stripos($_SERVER['REQUEST_URI'], 'settings-user-role-editor')!==false) {
wp_enqueue_style('ure-jquery-ui-tabs', URE_PLUGIN_URL . 'css/jquery-ui-1.10.4.custom.min.css', array(), false, 'screen');
}
wp_enqueue_style('ure-admin-css', URE_PLUGIN_URL . 'css/ure-admin.css', array(), false, 'screen');
}
// end of admin_css_action()
// call roles editor page
public function edit_roles() {
if (!current_user_can('ure_edit_roles')) {
wp_die(esc_html__('Insufficient permissions to work with User Role Editor', 'user-role-editor'));
}
$this->lib->editor();
}
// end of edit_roles()
/**
* execute on plugin activation
*/
function setup() {
$this->lib->make_roles_backup();
URE_Own_Capabilities::init_caps();
$task_queue = URE_Task_Queue::get_instance();
$task_queue->add('on_activation');
}
// end of setup()
protected function load_main_page_js() {
$confirm_role_update = $this->lib->get_option('ure_confirm_role_update', 1);
$page_url = $this->lib->get_ure_page_url();
wp_enqueue_script('jquery-ui-dialog', false, array('jquery-ui-core', 'jquery-ui-button', 'jquery'));
wp_enqueue_script('jquery-ui-selectable', false, array('jquery-ui-core', 'jquery'));
wp_register_script('ure-js', plugins_url('/js/ure-js.js', URE_PLUGIN_FULL_PATH));
wp_enqueue_script('ure-js');
wp_localize_script('ure-js', 'ure_data', array(
'wp_nonce' => wp_create_nonce('user-role-editor'),
'network_admin' => is_network_admin() ? 1 : 0,
'page_url' => $page_url,
'is_multisite' => is_multisite() ? 1 : 0,
'confirm_role_update' => $confirm_role_update ? 1 : 0,
'confirm_title' => esc_html__('Confirm', 'user-role-editor'),
'yes_label' => esc_html__('Yes', 'user-role-editor'),
'no_label' => esc_html__('No', 'user-role-editor'),
'select_all' => esc_html__('Select All', 'user-role-editor'),
'unselect_all' => esc_html__('Unselect All', 'user-role-editor'),
'reverse' => esc_html__('Reverse', 'user-role-editor'),
'update' => esc_html__('Update', 'user-role-editor'),
'confirm_submit' => esc_html__('Please confirm permissions update', 'user-role-editor'),
'add_new_role_title' => esc_html__('Add New Role', 'user-role-editor'),
'rename_role_title' => esc_html__('Rename Role', 'user-role-editor'),
'role_name_required' => esc_html__(' Role name (ID) can not be empty!', 'user-role-editor'),
'role_name_valid_chars' => esc_html__(' Role name (ID) must contain latin characters, digits, hyphens or underscore only!', 'user-role-editor'),
'numeric_role_name_prohibited' => esc_html__(' WordPress does not support numeric Role name (ID). Add latin characters to it.', 'user-role-editor'),
'add_role' => esc_html__('Add Role', 'user-role-editor'),
'rename_role' => esc_html__('Rename Role', 'user-role-editor'),
'delete_role' => esc_html__('Delete Role', 'user-role-editor'),
'cancel' => esc_html__('Cancel', 'user-role-editor'),
'add_capability' => esc_html__('Add Capability', 'user-role-editor'),
'delete_capability' => esc_html__('Delete Capability', 'user-role-editor'),
'reset' => esc_html__('Reset', 'user-role-editor'),
'reset_warning' => esc_html__('DANGER! Resetting will restore default settings from WordPress Core.', 'user-role-editor') . "\n\n" .
esc_html__('If any plugins have changed capabilities in any way upon installation (such as S2Member, WooCommerce, and many more), those capabilities will be DELETED!', 'user-role-editor') . "\n\n" .
esc_html__('For more information on how to undo changes and restore plugin capabilities go to', 'user-role-editor') . "\n" .
'http://role-editor.com/how-to-restore-deleted-wordpress-user-roles/' . "\n\n" .
esc_html__('Continue?', 'user-role-editor'),
'default_role' => esc_html__('Default Role', 'user-role-editor'),
'set_new_default_role' => esc_html__('Set New Default Role', 'user-role-editor'),
'delete_capability' => esc_html__('Delete Capability', 'user-role-editor'),
'delete_capability_warning' => esc_html__('Warning! Be careful - removing critical capability could crash some plugin or other custom code', 'user-role-editor'),
'capability_name_required' => esc_html__(' Capability name (ID) can not be empty!', 'user-role-editor'),
'capability_name_valid_chars' => esc_html__(' Capability name (ID) must contain latin characters, digits, hyphens or underscore only!', 'user-role-editor'),
));
// load additional JS stuff for Pro version, if exists
do_action('ure_load_js');
}
// end of load_main_page_js()
protected function load_settings_js() {
wp_enqueue_script('jquery-ui-tabs', false, array('jquery-ui-core', 'jquery'));
do_action('ure_load_js_settings');
}
// end of load_settings_js()
/**
* Load plugin javascript stuff
*
* @param string $hook_suffix
*/
public function admin_load_js($hook_suffix) {
URE_Known_JS_CSS_Compatibility_Issues::fix($hook_suffix, $this->ure_hook_suffixes);
if ($hook_suffix==$this->main_page_hook_suffix) {
$this->load_main_page_js();
} elseif($hook_suffix==$this->settings_hook_suffix) {
$this->load_settings_js();
}
}
// end of admin_load_js()
public function ure_ajax() {
$ajax_processor = new URE_Ajax_Processor($this->lib);
$ajax_processor->dispatch();
}
// end of ure_ajax()
public function set_role_additional_options_hooks() {
$role_additional_options = URE_Role_Additional_Options::get_instance($this->lib);
$role_additional_options->set_active_items_hooks();
}
// end of set_role_additional_options_hooks()
// execute on plugin deactivation
function cleanup() {
}
// end of setup()
}
// end of User_Role_Editor
<?php
/**
* User capabilities View class to output HTML with capabilities assigne to the user
*
* @package User-Role-Editor
* @subpackage Admin
* @author Vladimir Garagulya <support@role-editor.com>
* @copyright Copyright (c) 2010 - 2016, Vladimir Garagulya
**/
class URE_User_View extends URE_View {
private $lib = null;
private $user_to_edit = null;
public function __construct() {
parent::__construct();
$this->lib = URE_Lib::get_instance();
$this->user_to_edit = $this->lib->get('user_to_edit');
}
// end of __construct()
public function display_edit_dialogs() {
}
// end of display_edit_dialogs()
/**
* output HTML code to create URE toolbar
*
* @param boolean $role_delete
* @param boolean $capability_remove
*/
public function toolbar() {
?>
<div id="ure_toolbar" >
<div id="ure_update">
<button id="ure_update_role" class="ure_toolbar_button button-primary">Update</button>
<?php
do_action('ure_user_edit_toolbar_update');
?>
</div>
</div>
<?php
}
// end of toolbar()
private function get_user_info() {
$switch_to_user = '';
if (!is_multisite() || current_user_can('manage_network_users')) {
$anchor_start = '<a href="' . wp_nonce_url("user-edit.php?user_id={$this->user_to_edit->ID}", "ure_user_{$this->user_to_edit->ID}") . '" >';
$anchor_end = '</a>';
if (class_exists('user_switching') && current_user_can('switch_to_user', $this->user_to_edit->ID)) {
$switch_to_user_link = user_switching::switch_to_url($this->user_to_edit);
$switch_to_user = '<a href="' . esc_url($switch_to_user_link) . '">' . esc_html__('Switch&nbsp;To', 'user-switching') . '</a>';
}
} else {
$anchor_start = '';
$anchor_end = '';
}
$user_info = ' <span style="font-weight: bold;">' . $anchor_start . $this->user_to_edit->user_login;
if ($this->user_to_edit->display_name !== $this->user_to_edit->user_login) {
$user_info .= ' (' . $this->user_to_edit->display_name . ')';
}
$user_info .= $anchor_end . '</span>';
if (is_multisite() && $this->lib->is_super_admin($this->user_to_edit->ID)) {
$user_info .= ' <span style="font-weight: bold; color:red;">' . esc_html__('Network Super Admin', 'user-role-editor') . '</span>';
}
if (!empty($switch_to_user)) {
$user_info .= '&nbsp;&nbsp;&nbsp;&nbsp;' . $switch_to_user;
}
return $user_info;
}
// end of get_user_info()
private function show_primary_role_dropdown_list($user_roles) {
?>
<select name="primary_role" id="primary_role">
<?php
// Compare user role against currently editable roles
$user_roles = array_intersect( array_values( $user_roles ), array_keys( get_editable_roles() ) );
$user_primary_role = array_shift( $user_roles );
// print the full list of roles with the primary one selected.
wp_dropdown_roles($user_primary_role);
// print the 'no role' option. Make it selected if the user has no role yet.
$selected = ( empty($user_primary_role) ) ? 'selected="selected"' : '';
echo '<option value="" '. $selected.'>' . esc_html__('&mdash; No role for this site &mdash;') . '</option>';
?>
</select>
<?php
}
// end of show_primary_role_dropdown_list()
private function show_secondary_roles() {
$show_admin_role = $this->lib->show_admin_role_allowed();
$values = array_values($this->user_to_edit->roles);
$primary_role = array_shift($values); // get 1st element from roles array
$roles = $this->lib->get('roles');
foreach ($roles as $role_id => $role) {
if (($show_admin_role || $role_id != 'administrator') && ($role_id !== $primary_role)) {
if ($this->lib->user_can($role_id)) {
$checked = 'checked="checked"';
} else {
$checked = '';
}
echo '<label for="wp_role_' . $role_id . '"><input type="checkbox" id="wp_role_' . $role_id .
'" name="wp_role_' . $role_id . '" value="' . $role_id . '"' . $checked . ' />&nbsp;' .
esc_html__($role['name'], 'user-role-editor') . '</label><br />';
}
}
}
// end of show_secondary_roles()
public function display() {
$caps_readable = $this->lib->get('caps_readable');
$show_deprecated_caps = $this->lib->get('show_deprecated_caps');
$edit_user_caps_mode = $this->lib->get_edit_user_caps_mode();
$caps_access_restrict_for_simple_admin = $this->lib->get_option('caps_access_restrict_for_simple_admin', 0);
$user_info = $this->get_user_info();
?>
<div class="postbox" style="float:left;min-width:1000px;width: 100%;">
<div id="ure_user_caps_header">
<span id="ure_user_caps_title"><?php esc_html_e('Change capabilities for user', 'user-role-editor')?></span> <?php echo $user_info;?>
</div>
<div class="inside">
<table cellpadding="0" cellspacing="0" style="width: 100%;">
<tr>
<td>&nbsp;</td>
<td style="padding-left: 10px; padding-bottom: 5px;">
<?php
if ($this->lib->is_super_admin() || !$this->multisite || !class_exists('User_Role_Editor_Pro') || !$caps_access_restrict_for_simple_admin) {
if ($caps_readable) {
$checked = 'checked="checked"';
} else {
$checked = '';
}
?>
<input type="checkbox" name="ure_caps_readable" id="ure_caps_readable" value="1"
<?php echo $checked; ?> onclick="ure_turn_caps_readable(<?php echo $this->user_to_edit->ID; ?>);" />
<label for="ure_caps_readable"><?php esc_html_e('Show capabilities in human readable form', 'user-role-editor'); ?></label>&nbsp;&nbsp;&nbsp;
<?php
if ($show_deprecated_caps) {
$checked = 'checked="checked"';
} else {
$checked = '';
}
?>
<input type="checkbox" name="ure_show_deprecated_caps" id="ure_show_deprecated_caps" value="1"
<?php echo $checked; ?> onclick="ure_turn_deprecated_caps(<?php echo $this->user_to_edit->ID; ?>);"/>
<label for="ure_show_deprecated_caps"><?php esc_html_e('Show deprecated capabilities', 'user-role-editor'); ?></label>
<?php
}
?>
</td>
</tr>
<tr>
<td id="ure_user_roles">
<div class="ure-user-role-section-title"><?php esc_html_e('Primary Role:', 'user-role-editor'); ?></div>
<?php
$this->show_primary_role_dropdown_list($this->user_to_edit->roles);
if (function_exists('bbp_filter_blog_editable_roles') ) { // bbPress plugin is active
?>
<div class="ure-user-role-section-title" style="margin-top: 5px;"><?php esc_html_e('bbPress Role:', 'user-role-editor'); ?></div>
<?php
$dynamic_roles = bbp_get_dynamic_roles();
$bbp_user_role = bbp_get_user_role($this->user_to_edit->ID);
if (!empty($bbp_user_role)) {
echo $dynamic_roles[$bbp_user_role]['name'];
}
}
?>
<div style="margin-top: 5px;margin-bottom: 5px; font-weight: bold;"><?php esc_html_e('Other Roles:', 'user-role-editor'); ?></div>
<?php
$this->show_secondary_roles();
?>
</td>
<td style="padding-left: 5px; padding-top: 5px; border-top: 1px solid #ccc;">
<?php $this->display_caps(false, $edit_user_caps_mode ); ?>
</td>
</tr>
</table>
<input type="hidden" name="object" value="user" />
<input type="hidden" name="user_id" value="<?php echo $this->user_to_edit->ID; ?>" />
</div>
</div>
<?php
}
// end of display()
}
// end of class URE_User_View
\ No newline at end of file
<?php
/**
* View class to output any HTML used at User Role Editor
*
* @package User-Role-Editor
* @subpackage Admin
* @author Vladimir Garagulya <support@role-editor.com>
* @copyright Copyright (c) 2010 - 2016, Vladimir Garagulya
**/
class URE_View {
private $lib = null;
public function __construct() {
$this->lib = URE_Lib::get_instance();
}
// end of __construct()
public function display() {}
public function toolbar() {}
/**
* display opening part of the HTML box with title and CSS style
*
* @param string $title
* @param string $style
*/
public function display_box_start($title, $style = '') {
?>
<div class="postbox" style="float: left; <?php echo $style; ?>">
<h3 style="cursor:default;"><span><?php echo $title ?></span></h3>
<div class="inside">
<?php
}
// end of display_box_start()
/**
* close HTML box opened by display_box_start() call
*/
public function display_box_end() {
?>
</div>
</div>
<?php
}
// end of display_box_end()
public function show_caps_groups() {
$groups = URE_Capabilities_Groups_Manager::get_instance();
$groups_list = $groups->get_groups_tree();
$output = '<ul id="ure_caps_groups_list">'. PHP_EOL;
foreach($groups_list as $group_id=>$group) {
if ($group_id=='all') {
$spacer = '';
$subgroup = '';
} else {
$spacer = 'style="padding-left: '. 15*$group['level'] .'px"';
$subgroup = '- ';
}
$output .= '<li id="ure_caps_group_'. $group_id .'" '. $spacer .'>' .
$subgroup . $group['caption'] .'</li>'. PHP_EOL;
}
$output .= '</ul>'. PHP_EOL;
echo $output;
}
// end of show_caps_groups()
private function deprecated_show_and_color($cap_id, $builtin_wp_caps, &$label_style, &$hidden_class) {
if (isset($builtin_wp_caps[$cap_id])) {
if (in_array('deprecated', $builtin_wp_caps[$cap_id])) {
$show_deprecated_caps = $this->lib->get('show_deprecated_caps');
if (!$show_deprecated_caps) {
$hidden_class = 'hidden';
}
$label_style = 'style="color:#BBBBBB;"';
}
}
}
// end of deprecated_show_and_color()
private function blocked_for_single_admin_style($cap_id, &$label_style) {
$blocked = false;
$multisite = $this->lib->get('multisite');
if ($multisite && $this->lib->block_cap_for_single_admin($cap_id, true)) {
if ($this->lib->is_super_admin()) {
if (!is_network_admin()) {
$label_style = 'style="color: red;"';
}
} else {
$blocked = true;
}
}
return $blocked;
}
// end of blocked_for_single_admin_style()
/**
* output HTML-code for capabilities list
* @param boolean $for_role - if true, it is role capabilities list, else - user specific capabilities list
* @param boolean $edit_mode - if false, capabilities checkboxes are shown as disable - readonly mode
*/
public function show_capabilities($for_role = true, $edit_mode=true) {
$onclick_for_admin = '';
$multisite = $this->lib->get('multisite');
$current_role = $this->lib->get('current_role');
if (!($multisite && $this->lib->is_super_admin())) { // do not limit SuperAdmin for multi-site
if ('administrator'==$current_role) {
$onclick_for_admin = 'onclick="ure_turn_it_back(this)"';
}
}
$user_to_edit = $this->lib->get('user_to_edit');
$roles = $this->lib->get('roles');
$full_capabilities = $this->lib->get('full_capabilities');
$built_in_wp_caps = $this->lib->get_built_in_wp_caps();
$caps_readable = $this->lib->get('caps_readable');
$caps_groups_manager = URE_Capabilities_Groups_Manager::get_instance();
$key_capability = URE_Own_Capabilities::get_key_capability();
$user_is_ure_admin = current_user_can($key_capability);
$ure_caps = URE_Own_Capabilities::get_caps();
$output = '<div id="ure_caps_list_container">'
. '<div id="ure_caps_list">';
foreach ($full_capabilities as $capability) {
$cap_id = $capability['inner'];
if (!$user_is_ure_admin) {
if (isset($ure_caps[$cap_id]) ||
($multisite && $cap_id=='manage_network_plugins')) {
// exclude URE caps if user does not have full access to URE
continue;
}
}
$label_style = '';
$hidden_class = '';
$this->deprecated_show_and_color($cap_id, $built_in_wp_caps, $label_style, $hidden_class);
$blocked = $this->blocked_for_single_admin_style($cap_id, $label_style);
$classes = array('ure-cap-div');
if ($blocked) {
$classes[] = 'blocked';
$hidden_class = 'hidden';
}
if ($hidden_class) {
$classes[] = $hidden_class;
}
$cap_groups = $caps_groups_manager->get_cap_groups($cap_id, $built_in_wp_caps);
$classes = array_merge($classes, $cap_groups);
$checked = '';
$disabled = '';
if ($for_role) {
if (isset($roles[$current_role]['capabilities'][$cap_id]) &&
!empty($roles[$current_role]['capabilities'][$cap_id])) {
$checked = 'checked="checked"';
}
} else {
if (empty($edit_mode)) {
$disabled = 'disabled="disabled"';
} else {
$disabled = '';
}
if ($this->lib->user_can($cap_id)) {
$checked = 'checked="checked"';
if (!isset($user_to_edit->caps[$cap_id])) {
$disabled = 'disabled="disabled"';
}
}
}
$class = 'class="' . implode(' ', $classes) .'"';
$cap_id_esc = URE_Capability::escape($cap_id);
$cap_html = '<div id="ure_cap_div_'. $cap_id_esc .'" '. $class .'><input type="checkbox" name="' . $cap_id_esc . '" id="' .
$cap_id_esc . '" value="' . $cap_id .'" '. $checked . ' ' . $disabled . ' ' . $onclick_for_admin .
'class="ure-cap-cb">';
if ($caps_readable) {
$cap_ind = 'human';
$cap_ind_alt = 'inner';
} else {
$cap_ind = 'inner';
$cap_ind_alt = 'human';
}
$cap_html .= '<label for="' . $cap_id_esc . '" title="' . $capability[$cap_ind_alt] . '" ' . $label_style . ' > ' .
$capability[$cap_ind] . '</label> </div>';
$output .= $cap_html;
}
$output .= '</div></div>' ;
echo $output;
}
// end of show_capabilities()
// content of User Role Editor Pro advertisement slot - for direct call
public function advertise_pro() {
?>
<div id="ure_pro_advertisement" style="clear:left;display:block; float: left;">
<a href="https://www.role-editor.com?utm_source=UserRoleEditor&utm_medium=banner&utm_campaign=Plugins " target="_new" >
<?php
$hide_pro_banner = $this->lib->get_option('ure_hide_pro_banner', 0);
if ($hide_pro_banner) {
echo 'User Role Editor Pro: extended functionality, no advertisement - from $29.</a>';
} else {
?>
<img src="<?php echo URE_PLUGIN_URL; ?>images/user-role-editor-pro-728x90.jpg" alt="User Role Editor Pro"
title="More functionality and premium support with Pro version of User Role Editor."/>
</a><br />
<label for="ure_hide_pro_banner">
<input type="checkbox" name="ure_hide_pro_banner" id="ure_hide_pro_banner" onclick="ure_hide_pro_banner();"/>&nbsp;Thanks, hide this banner.
</label>
<?php
}
?>
</div>
<?php
}
// end of advertise_pro_version()
public function advertise_commercials() {
$this->advert = new URE_Advertisement();
$this->advert->display();
}
// end of advertisement()
public function output_confirmation_dialog() {
?>
<div id="ure_confirmation_dialog" class="ure-modal-dialog">
<div id="ure_cd_html" style="padding:10px;"></div>
</div>
<?php
}
// end of output_confirmation_dialog()
public function display_caps($for_role = true, $edit_mode=true) {
$caps_columns_quant = $this->lib->get('caps_columns_quant');
?>
<table id="ure_caps_container" cellpadding="0" cellspacing="0">
<tr>
<td id="ure_caps_groups_title"><span style="font-weight: bold;"><?php esc_html_e('Group', 'user-role-editor');?></span> (<?php esc_html_e('Total', 'user-role-editor');?>/<?php esc_html_e('Granted', 'user-role-editor');?>)</td>
<td id="ure_caps_select">
<div class="ure-table">
<div class="ure-table-cell">
<input type="checkbox" id="ure_select_all_caps" name="ure_select_all_caps" value="ure_select_all_caps"/>
</div>
<div class="ure-table-cell ure-caps-option nowrap">
<?php esc_html_e('Quick filter:', 'user-role-editor'); ?>&nbsp;
<input type="text" id="quick_filter" name="quick_filter" value="" size="10" onkeyup="ure_filter_capabilities(this.value);" />&nbsp;&nbsp;&nbsp;
<input type="checkbox" id="granted_only" name="granted_only" />
<label for="granted_only"><?php esc_html_e('Granted Only', 'user-role-editor'); ?></label>&nbsp;
</div>
<div class="ure-table-cell ure-caps-option nowrap">
<?php esc_html_e('Columns:', 'user-role-editor');?>
<select id="caps_columns_quant" name="caps_columns_quant" onchange="ure_change_caps_columns_quant();">
<option value="1" <?php selected(1, $caps_columns_quant);?> >1</option>
<option value="2" <?php selected(2, $caps_columns_quant);?> >2</option>
<option value="3" <?php selected(3, $caps_columns_quant);?> >3</option>
</select>
</div>
</div>
</td>
<td id="ure_toolbar_title">&nbsp;</td>
</tr>
<tr>
<td id="ure_caps_groups_td" class="ure-caps-cell">
<?php $this->show_caps_groups(); ?>
</td>
<td id="ure_caps_td" class="ure-caps-cell">
<?php $this->show_capabilities($for_role, $edit_mode); ?>
</td>
<td id="ure_toolbar_td" class="ure-caps-cell">
<?php $this->toolbar(); ?>
</td>
</tr>
</table>
<?php
}
// end of display_caps()
}
// end of class URE_View
\ No newline at end of file
<?php
/**
* Class to provide the list of WooCommerce plugin user capabilities
*
* @package User-Role-Editor
* @subpackage Admin
* @author Vladimir Garagulya <support@role-editor.com>
* @copyright Copyright (c) 2010 - 2016, Vladimir Garagulya
**/
class URE_Woocommerce_Capabilities {
public static $post_types = array('product', 'shop_order', 'shop_coupon', 'shop_webhook', 'product_variation', 'shop_order_refund');
private static $capability_types = array('product', 'shop_order', 'shop_coupon', 'shop_webhook');
public static function add_group_to_caps(&$caps, $post_type, $group) {
$post_types = $post_type .'s';
$caps['edit_'. $post_types][] = $group;
$caps['edit_others_'. $post_types][] = $group;
$caps['publish_'. $post_types][] = $group;
$caps['read_private_'. $post_types][] = $group;
$caps['delete_'. $post_types][] = $group;
$caps['delete_private_'. $post_types][] = $group;
$caps['delete_published_'. $post_types][] = $group;
$caps['delete_others_'. $post_types][] = $group;
$caps['edit_private_'. $post_types][] = $group;
$caps['edit_published_'. $post_types][] = $group;
}
// end of add_group_to_caps()
private static function add_base_caps(&$caps, $group, $subgroup, $cap_type) {
$cap_types = $cap_type .'s';
$caps['edit_'. $cap_type] = array('custom', $group, $subgroup, $cap_type);
$caps['read_'. $cap_type] = array('custom', $group, $subgroup, $cap_type);
$caps['delete_'. $cap_type] = array('custom', $group, $subgroup, $cap_type);
$caps['edit_'. $cap_types] = array('custom', $group, $subgroup, $cap_type);
$caps['edit_others_'. $cap_types] = array('custom', $group, $subgroup, $cap_type);
$caps['publish_'. $cap_types] = array('custom', $group, $subgroup, $cap_type);
$caps['read_private_'. $cap_types] = array('custom', $group, $subgroup, $cap_type);
$caps['delete_'. $cap_types] = array('custom', $group, $subgroup, $cap_type);
$caps['delete_private_'. $cap_types] = array('custom', $group, $subgroup, $cap_type);
$caps['delete_published_'. $cap_types] = array('custom', $group, $subgroup, $cap_type);
$caps['delete_others_'. $cap_types] = array('custom', $group, $subgroup, $cap_type);
$caps['edit_private_'. $cap_types] = array('custom', $group, $subgroup, $cap_type);
$caps['edit_published_'. $cap_types] = array('custom', $group, $subgroup, $cap_type);
}
// end of add_caps()
/**
* Returns full list of WooCommerce plugin user capabilities
*/
public static function get_caps_groups() {
$caps = array(
'manage_woocommerce'=>array('custom', 'woocommerce', 'woocommerce_core'),
'view_woocommerce_reports'=>array('custom', 'woocommerce', 'woocommerce_core'),
'view_admin_dashboard'=>array('custom', 'woocommerce', 'woocommerce_core')
);
// code was built on the base of woocommerce/includes/class-wc-install.php method WC_Install::get_core_capabilities()
$group = 'woocommerce';
foreach (self::$capability_types as $cap_type) {
$subgroup = $group .'_'. $cap_type;
self::add_base_caps($caps, $group, $subgroup, $cap_type);
$caps['manage_'. $cap_type .'_terms'] = array('custom', $group, $subgroup, $cap_type);
$caps['edit_'. $cap_type .'_terms'] = array('custom', $group, $subgroup, $cap_type);
$caps['delete_'. $cap_type .'_terms'] = array('custom', $group, $subgroup, $cap_type);
$caps['assign_'. $cap_type .'_terms'] = array('custom', $group, $subgroup, $cap_type);
}
$pto1 = get_post_type_object('product_variation');
if (empty($pto1) || $pto1->capability_type === 'product') { // default, not redefined by some plugin
// add capabilities group for the product_variation custom post type
self::add_group_to_caps($caps, 'product', 'woocommerce_product_variation');
self::add_group_to_caps($caps, 'product', 'product_variation');
} else {
$cap_type = 'product_variation';
$subgroup = $group .'_'. $cap_type;
self::add_base_caps($caps, $group, $subgroup, $cap_type);
}
$pto2 = get_post_type_object('shop_order_refund');
if (empty($pto2) || $pto2->capability_type === 'shop_order') { // default, not redefined by some plugin
// add capabilities group for the shop_order_refund custom post type
self::add_group_to_caps($caps, 'shop_order', 'woocommerce_shop_order_refund');
self::add_group_to_caps($caps, 'shop_order', 'shop_order_refund');
} else {
$cap_type = 'shop_order_variant';
$subgroup = $group .'_'. $cap_type;
self::add_base_caps($caps, $group, $subgroup, $cap_type);
}
return $caps;
}
// end of get()
/**
* This custom post types use capabilities from the other custom post types
* So we should define capabilities set for theme manually
* @return array()
*/
public static function get_post_types_without_caps() {
$pt_without_caps = array();
$pto1 = get_post_type_object('product_variation');
if (!empty($pto1) && $pto1->capability_type === 'product') {
$pt_without_caps[] = $pto1->name;
}
$pto2 = get_post_type_object('shop_order_refund');
if (!empty($pto2) && $pto2->capability_type === 'shop_order') {
$pt_without_caps[] = $pto2->name;
}
return $pt_without_caps;
}
// end of get_post_types_without_caps()
}
// end of URE_Woocommerce_Capabilities class
\ No newline at end of file
<?php
/*
* Constant definitions for use in User Role Editor WordPress plugin
* Author: Vladimir Garagulya
* Author email: vladimir@shinephp.com
* Author URI: http://shinephp.com
*
*/
define('URE_WP_ADMIN_URL', admin_url());
define('URE_ERROR', 'Error is encountered');
define('URE_PARENT', is_network_admin() ? 'network/users.php':'users.php');
define('URE_KEY_CAPABILITY', 'ure_manage_options');
\ No newline at end of file
<?php
/**
* Load related files
* Project: User Role Editor WordPress plugin
*
* Author: Vladimir Garagulya
* email: support@role-editor.com
*
**/
require_once(URE_PLUGIN_DIR .'includes/define-constants.php');
require_once(URE_PLUGIN_DIR .'includes/misc-support-stuff.php');
require_once(URE_PLUGIN_DIR .'includes/classes/task-queue.php');
require_once(URE_PLUGIN_DIR .'includes/classes/own-capabilities.php');
require_once(URE_PLUGIN_DIR .'includes/classes/bbpress.php');
require_once(URE_PLUGIN_DIR .'includes/classes/assign-role.php');
require_once(URE_PLUGIN_DIR .'includes/classes/user-other-roles.php');
require_once(URE_PLUGIN_DIR .'includes/classes/protect-admin.php');
require_once(URE_PLUGIN_DIR .'includes/classes/ajax-processor.php');
require_once(URE_PLUGIN_DIR .'includes/classes/screen-help.php');
require_once(URE_PLUGIN_DIR .'includes/classes/known-js-css-compatibility-issues.php');
require_once(URE_PLUGIN_DIR .'includes/classes/role-additional-options.php');
require_once(URE_PLUGIN_DIR .'includes/classes/capability.php');
require_once(URE_PLUGIN_DIR .'includes/classes/woocommerce-capabilities.php');
require_once(URE_PLUGIN_DIR .'includes/classes/capabilities-groups-manager.php');
require_once(URE_PLUGIN_DIR .'includes/classes/view.php');
require_once(URE_PLUGIN_DIR .'includes/classes/role-view.php');
require_once(URE_PLUGIN_DIR .'includes/classes/user-view.php');
require_once(URE_PLUGIN_DIR .'includes/classes/user-role-editor.php');
<?php
/*
* Miscellaneous support stuff, which should still be defined beyond of classes
*
* Author: Vladimir Garagulya
* Author email: vladimir@shinephp.com
* Author URI: http://shinephp.com
* License: GPL v3
*
*/
if (class_exists('GFForms') ) { // if Gravity Forms is installed
// Support for Gravity Forms capabilities
// As Gravity Form has integrated support for the Members plugin - let's imitate its presense,
// so GF code, like
// self::has_members_plugin())
// considers that it is has_members_plugin()
if (!function_exists('members_get_capabilities')) {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if (!is_plugin_active('members/members.php')) {
// define stub function to say "Gravity Forms" plugin: 'Hey! While I'm not the "Members" plugin, but I'm "User Role Editor" and
// I'm capable to manage your roles and capabilities too
function members_get_capabilities() {
}
}
}
}
if (!function_exists('ure_get_post_view_access_users')) {
function ure_get_post_view_access_users($post_id) {
if (!$GLOBALS['user_role_editor']->is_pro()) {
return false;
}
$result = $GLOBALS['user_role_editor']->get_post_view_access_users($post_id);
return $result;
}
// end of ure_get_post_view_users()
}
if (!function_exists('ure_hide_admin_bar')) {
function ure_hide_admin_bar() {
show_admin_bar(false);
}
// end of hide_admin_bar()
}
<?php
/*
* User Role Editor WordPress plugin options page
*
* @Author: Vladimir Garagulya
* @URL: http://role-editor.com
* @package UserRoleEditor
*
*/
?>
<div class="wrap">
<a href="http://role-editor.com">
<div id="ure-icon" class="icon32"><br></div>
</a>
<h1><?php esc_html_e('User Role Editor - Options', 'user-role-editor'); ?></h1>
<div id="ure_tabs" style="clear: left;">
<ul>
<li><a href="#ure_tabs-1"><?php esc_html_e('General', 'user-role-editor');?></a></li>
<?php
if (!$license_key_only) {
if ($this->lib->is_pro() || !$multisite) {
?>
<li><a href="#ure_tabs-2"><?php esc_html_e('Additional Modules', 'user-role-editor'); ?></a></li>
<?php
}
?>
<li><a href="#ure_tabs-3"><?php esc_html_e('Default Roles', 'user-role-editor'); ?></a></li>
<?php
if ($multisite && ($this->lib->is_pro() || $this->lib->is_super_admin())) {
?>
<li><a href="#ure_tabs-4"><?php esc_html_e('Multisite', 'user-role-editor'); ?></a></li>
<?php
}
}
?>
<li><a href="#ure_tabs-5"><?php esc_html_e('About', 'user-role-editor');?></a></li>
</ul>
<div id="ure_tabs-1">
<div id="ure-settings-form">
<form method="post" action="<?php echo $link; ?>?page=settings-<?php echo URE_PLUGIN_FILE; ?>" >
<table id="ure_settings">
<?php
if (!$license_key_only) {
?>
<tr>
<td>
<input type="checkbox" name="show_admin_role" id="show_admin_role" value="1"
<?php echo ($show_admin_role == 1) ? 'checked="checked"' : ''; ?>
<?php echo defined('URE_SHOW_ADMIN_ROLE') ? 'disabled="disabled" title="Predefined by \'URE_SHOW_ADMIN_ROLE\' constant at wp-config.php"' : ''; ?> />
<label for="show_admin_role"><?php esc_html_e('Show Administrator role at User Role Editor', 'user-role-editor'); ?></label></td>
<td>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="caps_readable" id="caps_readable" value="1"
<?php echo ($caps_readable == 1) ? 'checked="checked"' : ''; ?> />
<label for="caps_readable"><?php esc_html_e('Show capabilities in the human readable form', 'user-role-editor'); ?></label></td>
<td>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="show_deprecated_caps" id="show_deprecated_caps" value="1"
<?php echo ($show_deprecated_caps == 1) ? 'checked="checked"' : ''; ?> />
<label for="show_deprecated_caps"><?php esc_html_e('Show deprecated capabilities', 'user-role-editor'); ?></label></td>
<td>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="confirm_role_update" id="confirm_role_update" value="1"
<?php echo ($confirm_role_update == 1) ? 'checked="checked"' : ''; ?> />
<label for="confirm_role_update"><?php esc_html_e('Confirm role update', 'user-role-editor'); ?></label></td>
<td>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="edit_user_caps" id="edit_user_caps" value="1"
<?php echo ($edit_user_caps == 1) ? 'checked="checked"' : ''; ?> />
<label for="edit_user_caps"><?php esc_html_e('Edit user capabilities', 'user-role-editor'); ?></label></td>
<td>
</td>
</tr>
<?php
}
do_action('ure_settings_show1');
?>
</table>
<?php wp_nonce_field('user-role-editor'); ?>
<input type="hidden" name="ure_tab_idx" value="0" />
<p class="submit">
<input type="submit" class="button-primary" name="ure_settings_update" value="<?php _e('Save', 'user-role-editor') ?>" />
</p>
</form>
</div>
</div> <!-- ure_tabs-1 -->
<?php
if (!$license_key_only) {
if ($this->lib->is_pro() || !$multisite) {
?>
<div id="ure_tabs-2">
<form name="ure_additional_modules" method="post" action="<?php echo $link; ?>?page=settings-<?php echo URE_PLUGIN_FILE; ?>" >
<table id="ure_addons">
<?php
if (!$multisite) {
?>
<tr>
<td>
<input type="checkbox" name="count_users_without_role" id="count_users_without_role" value="1"
<?php echo ($count_users_without_role == 1) ? 'checked="checked"' : ''; ?> />
<label for="count_users_without_role"><?php esc_html_e('Count users without role', 'user-role-editor'); ?></label></td>
<td>
</td>
</tr>
<?php
}
?>
<?php
do_action('ure_settings_show2');
?>
</table>
<?php wp_nonce_field('user-role-editor'); ?>
<input type="hidden" name="ure_tab_idx" value="1" />
<p class="submit">
<input type="submit" class="button-primary" name="ure_addons_settings_update" value="<?php _e('Save', 'user-role-editor') ?>" />
</form>
</div>
<?php
}
?>
<div id="ure_tabs-3">
<form name="ure_default_roles" method="post" action="<?php echo $link; ?>?page=settings-<?php echo URE_PLUGIN_FILE; ?>" >
<?php
if (!$multisite) {
esc_html_e('Primary default role: ', 'user-role-editor');
echo $view->role_default_html;
?>
<hr>
<?php
}
?>
<?php esc_html_e('Other default roles for new registered user: ', 'user-role-editor'); ?>
<div id="other_default_roles">
<?php $this->lib->show_other_default_roles(); ?>
</div>
<?php
if ($multisite) {
echo '<p>'. esc_html__('Note for multisite environment: take into account that other default roles should exist at the site, in order to be assigned to the new registered users.', 'user-role-editor') .'</p>';
}
?>
<hr>
<?php wp_nonce_field('user-role-editor'); ?>
<input type="hidden" name="ure_tab_idx" value="2" />
<p class="submit">
<input type="submit" class="button-primary" name="ure_default_roles_update" value="<?php _e('Save', 'user-role-editor') ?>" />
</p>
</form>
</div> <!-- ure_tabs-3 -->
<?php
if ( $multisite && ($this->lib->is_pro() || $this->lib->is_super_admin())) {
?>
<div id="ure_tabs-4">
<div id="ure-settings-form-ms">
<form name="ure_settings_ms" method="post" action="<?php echo $link; ?>?page=settings-<?php echo URE_PLUGIN_FILE; ?>" >
<table id="ure_settings_ms">
<?php
if ($this->lib->is_super_admin()) {
?>
<tr>
<td>
<input type="checkbox" name="allow_edit_users_to_not_super_admin" id="allow_edit_users_to_not_super_admin" value="1"
<?php echo ($allow_edit_users_to_not_super_admin == 1) ? 'checked="checked"' : ''; ?> />
<label for="allow_edit_users_to_not_super_admin"><?php esc_html_e('Allow non super administrators to create, edit, and delete users', 'user-role-editor'); ?></label>
</td>
<td>
</td>
</tr>
<?php
}
do_action('ure_settings_ms_show');
?>
</table>
<?php wp_nonce_field('user-role-editor'); ?>
<input type="hidden" name="ure_tab_idx" value="3" />
<p class="submit">
<input type="submit" class="button-primary" name="ure_settings_ms_update" value="<?php _e('Save', 'user-role-editor') ?>" />
</p>
</form>
</div> <!-- ure-settings-form-ms -->
</div> <!-- ure_tabs-4 -->
<?php
}
} // if (!$license_key_only) {
?>
<div id="ure_tabs-5">
<?php $this->lib->about(); ?>
</div> <!-- ure_tabs-5 -->
</div> <!-- ure_tabs -->
</div>
<script>
jQuery(function() {
jQuery('#ure_tabs').tabs();
<?php
if ($ure_tab_idx>0) {
?>
jQuery("#ure_tabs").tabs("option", "active", <?php echo $ure_tab_idx; ?>);
<?php
}
?>
});
</script>
/**
* @author zhixin wen <wenzhixin2010@gmail.com>
* @version 1.0.4
*
* http://wenzhixin.net.cn/p/multiple-select/
*/
(function($) {
'use strict';
function MultipleSelect($el, options) {
var that = this,
elWidth = $el.width();
this.$el = $el.hide();
this.options = options;
this.$parent = $('<div class="ms-parent"></div>');
this.$choice = $('<div class="ms-choice"><span class="placeholder">' +
options.placeholder + '</span><div></div></div>');
this.$drop = $('<div class="ms-drop"></div>');
this.$el.after(this.$parent);
this.$parent.append(this.$choice);
this.$parent.append(this.$drop);
if (this.$el.prop('disabled')) {
this.$choice.addClass('disabled');
}
this.$choice.css('width', elWidth + 'px')
.find('span').css('width', (elWidth - 28) + 'px');
this.$drop.css({
width: (options.width || elWidth) + 'px'
});
$('body').click(function(e) {
if ($(e.target)[0] === that.$choice[0] ||
$(e.target).parents('.ms-choice')[0] === that.$choice[0]) {
return;
}
if (($(e.target)[0] === that.$drop[0] ||
$(e.target).parents('.ms-drop')[0] !== that.$drop[0]) &&
that.options.isopen) {
that.close();
}
});
if (this.options.isopen) {
this.open();
}
}
MultipleSelect.prototype = {
constructor : MultipleSelect,
init: function() {
var that = this,
html = [];
if (this.options.filter) {
html.push(
'<div class="ms-search">',
'<input type="text" autocomplete="off" autocorrect="off" autocapitilize="off" spellcheck="false">',
'</div>'
);
}
html.push('<ul>');
if (this.options.selectAll) {
html.push(
'<li>',
'<label>',
'<input type="checkbox" name="selectAll" /> ',
'[' + this.options.selectAllText + ']',
'</label>',
'</li>'
);
}
$.each(this.$el.children(), function(i, elm) {
html.push(that.optionToHtml(i, elm));
});
html.push('</ul>');
this.$drop.html(html.join(''));
this.$drop.find('ul').css('max-height', this.options.maxHeight + 'px');
this.$drop.find('.multiple').css('width', this.options.multipleWidth + 'px');
this.$searchInput = this.$drop.find('.ms-search input');
this.$selectAll = this.$drop.find('input[name="selectAll"]');
this.$selectGroups = this.$drop.find('label.optgroup');
this.$selectItems = this.$drop.find('input[name="selectItem"]:enabled');
this.$disableItems = this.$drop.find('input[name="selectItem"]:disabled');
this.events();
this.update();
},
optionToHtml: function(i, elm, group, groupDisabled) {
var that = this,
$elm = $(elm),
html = [],
multiple = this.options.multiple;
if ($elm.is('option')) {
var value = $elm.val(),
text = $elm.text(),
selected = $elm.prop('selected'),
disabled = groupDisabled || $elm.prop('disabled');
html.push(
'<li' + (multiple ? ' class="multiple"' : '') + '>',
'<label' + (disabled ? ' class="disabled"' : '') + '>',
'<input type="checkbox" name="selectItem" value="' + value + '"' +
(selected ? ' checked="checked"' : '') +
(disabled ? ' disabled="disabled"' : '') +
(group ? ' data-group="' + group + '"' : '') +
'/> ',
text,
'</label>',
'</li>'
);
} else if (!group && $elm.is('optgroup')) {
var _group = 'group_' + i,
label = $elm.attr('label'),
disabled = $elm.prop('disabled');
html.push(
'<li class="group">',
'<label class="optgroup' + (disabled ? ' disabled' : '') + '" data-group="' + _group + '">',
label,
'</label>',
'</li>');
$.each($elm.children(), function(i, elm) {
html.push(that.optionToHtml(i, elm, _group, disabled));
});
}
return html.join('');
},
events: function() {
var that = this;
this.$choice.off('click').on('click', function() {
that[that.options.isopen ? 'close' : 'open']();
});
this.$searchInput.off('keyup').on('keyup', function() {
that.filter();
});
this.$selectAll.off('click').on('click', function() {
var checked = $(this).prop('checked'),
$items = that.$selectItems.filter(':visible');
if ($items.length === that.$selectItems.length) {
that[checked ? 'checkAll' : 'uncheckAll']();
} else { // when the filter option is true
$items.prop('checked', checked);
that.update();
}
});
this.$selectGroups.off('click').on('click', function() {
var group = $(this).attr('data-group'),
$items = that.$selectItems.filter(':visible'),
$children = $items.filter('[data-group="' + group + '"]'),
checked = $children.length !== $children.filter(':checked').length;
$children.prop('checked', checked);
that.updateSelectAll();
that.update();
that.options.onOptgroupClick({
label: $(this).text(),
checked: checked,
children: $children.get()
});
});
this.$selectItems.off('click').on('click', function() {
that.updateSelectAll();
that.update();
that.options.onClick({
label: $(this).parent().text(),
value: $(this).val(),
checked: $(this).prop('checked')
});
});
},
open: function() {
if (this.$choice.hasClass('disabled')) {
return;
}
this.options.isopen = true;
this.$choice.find('>div').addClass('open');
this.$drop.show();
if (this.options.filter) {
this.$searchInput.val('');
this.filter();
}
this.options.onOpen();
},
close: function() {
this.options.isopen = false;
this.$choice.find('>div').removeClass('open');
this.$drop.hide();
this.options.onClose();
},
update: function() {
var selects = this.getSelects('text'),
$span = this.$choice.find('>span');
if (selects.length) {
$span.removeClass('placeholder').html(selects.join(','));
} else {
$span.addClass('placeholder').html(this.options.placeholder);
}
// set selects to select
this.$el.val(this.getSelects());
},
updateSelectAll: function() {
var $items = this.$selectItems.filter(':visible');
this.$selectAll.prop('checked', $items.length &&
$items.length === $items.filter(':checked').length);
},
//value or text, default: 'value'
getSelects: function(type) {
var values = [];
this.$drop.find('input[name="selectItem"]:checked').each(function() {
values.push(type === 'text' ? $(this).parent().text() : $(this).val());
});
return values;
},
setSelects: function(values) {
var that = this;
this.$selectItems.prop('checked', false);
$.each(values, function(i, value) {
that.$selectItems.filter('[value="' + value + '"]').prop('checked', true);
});
this.$selectAll.prop('checked', this.$selectItems.length ===
this.$selectItems.filter(':checked').length);
this.update();
},
enable: function() {
this.$choice.removeClass('disabled');
},
disable: function() {
this.$choice.addClass('disabled');
},
checkAll: function() {
this.$selectItems.prop('checked', true);
this.$selectAll.prop('checked', true);
this.update();
this.options.onCheckAll();
},
uncheckAll: function() {
this.$selectItems.prop('checked', false);
this.$selectAll.prop('checked', false);
this.update();
this.options.onUncheckAll();
},
refresh: function() {
this.init();
},
filter: function() {
var that = this,
text = $.trim(this.$searchInput.val()).toLowerCase();
if (text.length === 0) {
this.$selectItems.parent().show();
this.$disableItems.parent().show();
this.$selectGroups.show();
} else {
this.$selectItems.each(function() {
var $parent = $(this).parent();
$parent[$parent.text().toLowerCase().indexOf(text) < 0 ? 'hide' : 'show']();
});
this.$disableItems.parent().hide();
this.$selectGroups.each(function() {
var group = $(this).attr('data-group'),
$items = that.$selectItems.filter(':visible');
$(this)[$items.filter('[data-group="' + group + '"]').length === 0 ? 'hide' : 'show']();
});
}
this.updateSelectAll();
}
};
$.fn.multipleSelect = function() {
var option = arguments[0],
args = arguments,
value,
allowedMethods = ['getSelects', 'setSelects', 'enable', 'disable', 'checkAll', 'uncheckAll', 'refresh'];
this.each(function() {
var $this = $(this),
data = $this.data('multipleSelect'),
options = $.extend({}, $.fn.multipleSelect.defaults, typeof option === 'object' && option);
if (!data) {
data = new MultipleSelect($this, options);
$this.data('multipleSelect', data);
}
if (typeof option === 'string') {
if ($.inArray(option, allowedMethods) < 0) {
throw "Unknown method: " + option;
}
value = data[option](args[1]);
} else {
data.init();
}
});
return value ? value : this;
};
$.fn.multipleSelect.defaults = {
isopen: false,
placeholder: '',
selectAll: true,
selectAllText: 'Select all',
multiple: false,
multipleWidth: 80,
filter: false,
width: undefined,
maxHeight: 250,
onOpen: function() {return false;},
onClose: function() {return false;},
onCheckAll: function() {return false;},
onUncheckAll: function() {return false;},
onOptgroupClick: function() {return false;},
onClick: function() {return false;}
};
})(jQuery);
// get/post via jQuery
(function ($) {
$.extend({
ure_getGo: function (url, params) {
document.location = url + '?' + $.param(params);
},
ure_postGo: function (url, params) {
var $form = $('<form>')
.attr('method', 'post')
.attr('action', url);
$.each(params, function (name, value) {
$("<input type='hidden'>")
.attr('name', name)
.attr('value', value)
.appendTo($form);
});
$form.appendTo('body');
$form.submit();
}
});
})(jQuery);
var ure_ajax_get_caps_to_remove = null;
jQuery(document).ready(function() {
// Get from the server a list of capabilities we can delete and show dialog to select what to delete
ure_ajax_get_caps_to_remove = {
url: ajaxurl,
type: 'POST',
dataType: 'html',
data: {
action: 'ure_ajax',
sub_action: 'get_caps_to_remove',
current_role: jQuery('#user_role').val(),
network_admin: ure_data.network_admin,
wp_nonce: ure_data.wp_nonce
},
success: function (response) {
var data = jQuery.parseJSON(response);
if (typeof data.result !== 'undefined') {
if (data.result === 'success') {
jQuery('#ure_delete_capability_dialog .ure-input').html(data.html);
ure_main.show_delete_capability_dialog();
} else if (data.result === 'failure') {
alert(data.message);
} else {
alert('Wrong response: ' + response)
}
} else {
alert('Wrong response: ' + response)
}
},
error: function (XMLHttpRequest, textStatus, exception) {
alert("Ajax failure\n" + XMLHttpRequest.statusText);
},
async: true
};
});
// Main User Role Editor object
var ure_main = {
selected_group: 'all',
caps_counter: null,
class_prefix: 'ure-',
show_delete_capability_dialog: function () {
jQuery('#ure_delete_capability_dialog').dialog({
dialogClass: 'wp-dialog',
modal: true,
autoOpen: true,
closeOnEscape: true,
width: 350,
height: 400,
resizable: false,
title: ure_data.delete_capability,
buttons: {
'Delete Capability': function () {
if (!confirm(ure_data.delete_capability + ' - ' + ure_data.delete_capability_warning)) {
return;
}
jQuery('#ure_remove_caps_form').submit();
jQuery(this).dialog('close');
},
Cancel: function () {
jQuery(this).dialog('close');
}
}
});
// translate buttons caption
jQuery('.ui-dialog-buttonpane button:contains("Delete Capability")').attr('id', 'dialog-delete-capability-button');
jQuery('#dialog-delete-capability-button').html(ure_ui_button_text(ure_data.delete_capability));
jQuery('.ui-dialog-buttonpane button:contains("Cancel")').attr('id', 'delete-capability-dialog-cancel-button');
jQuery('#delete-capability-dialog-cancel-button').html(ure_ui_button_text(ure_data.cancel));
jQuery('#ure_remove_caps_select_all').click(this.remove_caps_auto_select);
},
remove_caps_auto_select: function (event) {
if (event.shiftKey) {
jQuery('.ure-cb-column').each(function () { // reverse selection
jQuery(this).prop('checked', !jQuery(this).prop('checked'));
});
} else { // switch On/Off all checkboxes
jQuery('.ure-cb-column').prop('checked', jQuery('#ure_remove_caps_select_all').prop('checked'));
}
}
}; // end of ure_main declaration
//-------------------------------
function ure_ui_button_text(caption) {
var wrapper = '<span class="ui-button-text">' + caption + '</span>';
return wrapper;
}
function ure_select_selectable_element(selectable_container, elements_to_select) {
// add unselecting class to all elements in the styleboard canvas except the ones to select
jQuery(".ui-selected", selectable_container).not(elements_to_select).removeClass("ui-selected").addClass("ui-unselecting");
// add ui-selecting class to the elements to select
jQuery(elements_to_select).not(".ui-selected").addClass("ui-selecting");
// trigger the mouse stop event (this will select all .ui-selecting elements, and deselect all .ui-unselecting elements)
selectable_container.data("ui-selectable")._mouseStop(null);
}
jQuery(function ($) {
ure_count_caps_in_groups();
ure_sizes_update();
$('#ure_select_all_caps').click(ure_auto_select_caps);
$('#granted_only').click(ure_show_granted_caps_only);
$('#ure_caps_groups_list').selectable({
selected: function( event, ui ) {
// do not allow multiple selection
$(ui.selected).siblings().removeClass("ui-selected");
ure_caps_refresh(ui.selected.id);
}
});
ure_select_selectable_element($('#ure_caps_groups_list'), $('#ure_caps_group_all'));
$('#ure_update_role').button({
label: ure_data.update
}).click(function () {
if (ure_data.confirm_role_update == 1) {
event.preventDefault();
ure_confirm(ure_data.confirm_submit, ure_form_submit);
}
});
function ure_form_submit() {
$('#ure_form').submit();
}
function ure_show_add_role_dialog() {
$('#ure_add_role_dialog').dialog({
dialogClass: 'wp-dialog',
modal: true,
autoOpen: true,
closeOnEscape: true,
width: 450,
height: 230,
resizable: false,
title: ure_data.add_new_role_title,
'buttons': {
'Add Role': function () {
var role_id = $('#user_role_id').val();
if (role_id == '') {
alert(ure_data.role_name_required);
return false;
}
if (!(/^[\w-]*$/.test(role_id))) {
alert(ure_data.role_name_valid_chars);
return false;
}
if ((/^[0-9]*$/.test(role_id))) {
alert(ure_data.numeric_role_name_prohibited);
return false;
}
var role_name = $('#user_role_name').val();
var role_copy_from = $('#user_role_copy_from').val();
$(this).dialog('close');
$.ure_postGo(ure_data.page_url,
{action: 'add-new-role', user_role_id: role_id, user_role_name: role_name, user_role_copy_from: role_copy_from,
ure_nonce: ure_data.wp_nonce});
},
Cancel: function () {
$(this).dialog('close');
return false;
}
}
});
$('.ui-dialog-buttonpane button:contains("Add Role")').attr('id', 'dialog-add-role-button');
$('#dialog-add-role-button').html(ure_ui_button_text(ure_data.add_role));
$('.ui-dialog-buttonpane button:contains("Cancel")').attr('id', 'add-role-dialog-cancel-button');
$('#add-role-dialog-cancel-button').html(ure_ui_button_text(ure_data.cancel));
}
$('#ure_add_role').button({
label: ure_data.add_role
}).click(function (event) {
event.preventDefault();
ure_show_add_role_dialog();
});
function ure_show_rename_role_dialog() {
$('#ure_rename_role_dialog').dialog({
dialogClass: 'wp-dialog',
modal: true,
autoOpen: true,
closeOnEscape: true,
width: 450,
height: 230,
resizable: false,
title: ure_data.rename_role_title,
'buttons': {
'Rename Role': function () {
var role_id = $('#ren_user_role_id').val();
var role_name = $('#ren_user_role_name').val();
$(this).dialog('close');
$.ure_postGo(ure_data.page_url,
{action: 'rename-role', user_role_id: role_id, user_role_name: role_name, ure_nonce: ure_data.wp_nonce}
);
},
Cancel: function () {
$(this).dialog('close');
return false;
}
}
});
$('.ui-dialog-buttonpane button:contains("Rename Role")').attr('id', 'dialog-rename-role-button');
$('#dialog-rename-role-button').html(ure_ui_button_text(ure_data.rename_role));
$('.ui-dialog-buttonpane button:contains("Cancel")').attr('id', 'rename-role-dialog-cancel-button');
$('#rename-role-dialog-cancel-button').html(ure_ui_button_text(ure_data.cancel));
$('#ren_user_role_id').val(ure_current_role);
$('#ren_user_role_name').val(ure_current_role_name);
}
$('#ure_rename_role').button({
label: ure_data.rename_role
}).click(function (event) {
event.preventDefault();
ure_show_rename_role_dialog();
});
function ure_show_delete_role_dialog() {
$('#ure_delete_role_dialog').dialog({
dialogClass: 'wp-dialog',
modal: true,
autoOpen: true,
closeOnEscape: true,
width: 320,
height: 190,
resizable: false,
title: ure_data.delete_role,
buttons: {
'Delete Role': function () {
var user_role_id = $('#del_user_role').val();
if (!confirm(ure_data.delete_role)) {
return false;
}
$(this).dialog('close');
$.ure_postGo(ure_data.page_url,
{action: 'delete-role', user_role_id: user_role_id, ure_nonce: ure_data.wp_nonce});
},
Cancel: function () {
$(this).dialog('close');
}
}
});
// translate buttons caption
$('.ui-dialog-buttonpane button:contains("Delete Role")').attr('id', 'dialog-delete-button');
$('#dialog-delete-button').html(ure_ui_button_text(ure_data.delete_role));
$('.ui-dialog-buttonpane button:contains("Cancel")').attr('id', 'delete-role-dialog-cancel-button');
$('#delete-role-dialog-cancel-button').html(ure_ui_button_text(ure_data.cancel));
}
$('#ure_delete_role').button({
label: ure_data.delete_role
}).click(function (event) {
event.preventDefault();
ure_show_delete_role_dialog();
});
function ure_show_add_capability_dialog() {
$('#ure_add_capability_dialog').dialog({
dialogClass: 'wp-dialog',
modal: true,
autoOpen: true,
closeOnEscape: true,
width: 350,
height: 190,
resizable: false,
title: ure_data.add_capability,
'buttons': {
'Add Capability': function () {
var capability_id = $('#capability_id').val();
if (capability_id == '') {
alert(ure_data.capability_name_required);
return false;
}
if (!(/^[\w-]*$/.test(capability_id))) {
alert(ure_data.capability_name_valid_chars);
return false;
}
$(this).dialog('close');
$.ure_postGo(ure_data.page_url,
{action: 'add-new-capability', capability_id: capability_id, ure_nonce: ure_data.wp_nonce});
},
Cancel: function () {
$(this).dialog('close');
}
}
});
$('.ui-dialog-buttonpane button:contains("Add Capability")').attr('id', 'dialog-add-capability-button');
$('#dialog-add-capability-button').html(ure_ui_button_text(ure_data.add_capability));
$('.ui-dialog-buttonpane button:contains("Cancel")').attr('id', 'add-capability-dialog-cancel-button');
$('#add-capability-dialog-cancel-button').html(ure_ui_button_text(ure_data.cancel));
}
$('#ure_add_capability').button({
label: ure_data.add_capability
}).click(function (event) {
event.preventDefault();
ure_show_add_capability_dialog();
});
if ($('#ure_delete_capability').length > 0) {
$('#ure_delete_capability').button({
label: ure_data.delete_capability
}).click(function (event) {
event.preventDefault();
$.ajax(ure_ajax_get_caps_to_remove);
});
}
function ure_show_default_role_dialog() {
$('#ure_default_role_dialog').dialog({
dialogClass: 'wp-dialog',
modal: true,
autoOpen: true,
closeOnEscape: true,
width: 320,
height: 190,
resizable: false,
title: ure_data.default_role,
buttons: {
'Set New Default Role': function () {
$(this).dialog('close');
var user_role_id = $('#default_user_role').val();
$.ure_postGo(ure_data.page_url,
{action: 'change-default-role', user_role_id: user_role_id, ure_nonce: ure_data.wp_nonce});
},
Cancel: function () {
$(this).dialog('close');
}
}
});
// translate buttons caption
$('.ui-dialog-buttonpane button:contains("Set New Default Role")').attr('id', 'dialog-default-role-button');
$('#dialog-default-role-button').html(ure_ui_button_text(ure_data.set_new_default_role));
$('.ui-dialog-buttonpane button:contains("Cancel")').attr('id', 'default-role-dialog-cancel-button');
$('#default-role-dialog-cancel-button').html(ure_ui_button_text(ure_data.cancel));
}
if ($('#ure_default_role').length > 0) {
$('#ure_default_role').button({
label: ure_data.default_role
}).click(function (event) {
event.preventDefault();
ure_show_default_role_dialog();
});
}
$('#ure_reset_roles_button').button({
label: ure_data.reset
}).click(function (event) {
event.preventDefault();
if (!confirm(ure_data.reset_warning)) {
return false;
}
jQuery.ure_postGo(ure_data.page_url, {action: 'reset', ure_nonce: ure_data.wp_nonce});
});
function ure_confirm(message, routine) {
$('#ure_confirmation_dialog').dialog({
dialogClass: 'wp-dialog',
modal: true,
autoOpen: true,
closeOnEscape: true,
width: 400,
height: 180,
resizable: false,
title: ure_data.confirm_title,
'buttons': {
'No': function () {
$(this).dialog('close');
return false;
},
'Yes': function () {
$(this).dialog('close');
routine();
return true;
}
}
});
$('#ure_cd_html').html(message);
$('.ui-dialog-buttonpane button:contains("No")').attr('id', 'dialog-no-button');
$('#dialog-no-button').html(ure_ui_button_text(ure_data.no_label));
$('.ui-dialog-buttonpane button:contains("Yes")').attr('id', 'dialog-yes-button');
$('#dialog-yes-button').html(ure_ui_button_text(ure_data.yes_label));
}
// end of ure_confirm()
});
// end of jQuery(function() ...
// change color of apply to all check box - for multi-site setup only
function ure_apply_to_all_on_click(cb) {
el = document.getElementById('ure_apply_to_all_div');
if (cb.checked) {
el.style.color = '#FF0000';
} else {
el.style.color = '#000000';
}
}
// end of ure_apply_to_all_on_click()
// turn on checkbox back if clicked to turn off
function ure_turn_it_back(control) {
control.checked = true;
}
// end of ure_turn_it_back()
function ure_apply_selection(cb_id) {
var qfilter = jQuery('#quick_filter').val();
var parent_div = jQuery('#ure_cap_div_'+ cb_id);
var disabled = jQuery('#'+ cb_id).attr('disabled');
var result = false;
if (parent_div.hasClass(ure_main.class_prefix + ure_main.selected_group) && // make selection inside currently selected group of capabilities only
!parent_div.hasClass('hidden') && disabled!=='disabled') { // select not hidden and not disabled checkboxes (capabilities) only
// if quick filter is not empty, then apply selection to the tagged element only
if (qfilter==='' || parent_div.hasClass('ure_tag')) {
result = true;
}
}
return result;
}
function ure_auto_select_caps(event) {
if (event.shiftKey) {
jQuery('.ure-cap-cb').each(function () { // reverse selection
if (ure_apply_selection(this.id)) {
jQuery(this).prop('checked', !jQuery(this).prop('checked'));
}
});
} else {
jQuery('.ure-cap-cb').each(function () { // switch On/Off all checkboxes
if (ure_apply_selection(this.id)) {
jQuery(this).prop('checked', jQuery('#ure_select_all_caps').prop('checked'));
}
});
}
}
function ure_turn_caps_readable(user_id) {
var ure_obj = 'user';
if (user_id === 0) {
ure_obj = 'role';
}
jQuery.ure_postGo(ure_data.page_url, {action: 'caps-readable', object: ure_obj, user_id: user_id, ure_nonce: ure_data.wp_nonce});
}
// end of ure_turn_caps_readable()
function ure_turn_deprecated_caps(user_id) {
var ure_obj = 'user';
if (user_id === 0) {
ure_obj = 'role';
}
jQuery.ure_postGo(ure_data.page_url, {action: 'show-deprecated-caps', object: ure_obj, user_id: user_id, ure_nonce: ure_data.wp_nonce});
}
// ure_turn_deprecated_caps()
function ure_role_change(role_name) {
jQuery.ure_postGo(ure_data.page_url, {action: 'role-change', object: 'role', user_role: role_name, ure_nonce: ure_data.wp_nonce});
}
// end of ure_role_change()
function ure_filter_capabilities(cap_id) {
var div_list = jQuery('.ure-cap-div');
for (i = 0; i < div_list.length; i++) {
if (cap_id !== '' && div_list[i].id.substr(11).indexOf(cap_id) !== -1) {
jQuery('#'+ div_list[i].id).addClass('ure_tag');
div_list[i].style.color = '#27CF27';
} else {
div_list[i].style.color = '#000000';
jQuery('#'+ div_list[i].id).removeClass('ure_tag');
}
}
;
}
// end of ure_filter_capabilities()
function ure_hide_pro_banner() {
jQuery.ure_postGo(ure_data.page_url, {action: 'hide-pro-banner', ure_nonce: ure_data.wp_nonce});
}
// end of ure_hide_this_banner()
function ure_caps_refresh_all() {
jQuery('.ure-cap-div').each(function () {
if (jQuery(this).hasClass('hidden')) {
if (!jQuery(this).hasClass(ure_main.class_prefix + 'deprecated')) {
jQuery(this).removeClass('hidden');
}
}
});
}
function ure_caps_refresh_for_group(group_id) {
var show_deprecated = jQuery('#ure_show_deprecated_caps').attr('checked');
jQuery('.ure-cap-div').each(function () {
var el = jQuery(this);
if (el.hasClass(ure_main.class_prefix + group_id)) {
if (el.hasClass('hidden')) {
if (el.hasClass('blocked')) {
return;
}
if (el.hasClass(ure_main.class_prefix + 'deprecated')) {
if (group_id==='deprecated' || show_deprecated) {
el.removeClass('hidden');
}
} else {
el.removeClass('hidden');
}
} else {
if (el.hasClass(ure_main.class_prefix + 'deprecated')) {
if (!show_deprecated) {
el.addClass('hidden');
}
}
}
} else {
if (!el.hasClass('hidden')) {
el.addClass('hidden');
}
}
});
}
function ure_caps_refresh(group) {
var group_id = group.substr(15);
ure_main.selected_group = group_id;
if (group_id === 'all') {
ure_caps_refresh_all();
} else {
ure_caps_refresh_for_group(group_id);
}
ure_change_caps_columns_quant();
jQuery('#granted_only').attr('checked', false);
}
function ure_validate_columns(columns) {
if (columns==1 || ure_main.selected_group=='all') {
return columns;
}
// Do not split list on columns in case it contains less then < 25 capabilities
for (i=0; i<ure_main.caps_counter.length; i++) {
if (ure_main.caps_counter[i].id==ure_main.selected_group) {
if (ure_main.caps_counter[i].total<=25) {
columns = 1;
}
break;
}
}
return columns;
}
function ure_change_caps_columns_quant() {
var selected_index = parseInt(jQuery('#caps_columns_quant').val());
var columns = ure_validate_columns(selected_index);
var el = jQuery('#ure_caps_list');
el.css('-moz-column-count', columns);
el.css('-webkit-column-count', columns);
el.css('column-count', columns);
}
function ure_init_caps_counter() {
ure_main.caps_counter = new Array();
jQuery('#ure_caps_groups_list li').each(function() {
var group_id = jQuery(this).attr('id').substr(15);
group_counter = {'id': group_id, 'total': 0, 'granted':0};
ure_main.caps_counter.push(group_counter);
});
}
function ure_count_caps_in_groups() {
ure_init_caps_counter();
jQuery('.ure-cap-div').each(function () {
var cap_div = jQuery(this);
var capability = cap_div.attr('id').substr(12);
for (i=0; i<ure_main.caps_counter.length; i++) {
if (cap_div.hasClass(ure_main.class_prefix + ure_main.caps_counter[i].id)) {
ure_main.caps_counter[i].total++;
if (jQuery('#'+ capability).is(':checked')) {
ure_main.caps_counter[i].granted++;
}
}
}
});
for (i=0; i<ure_main.caps_counter.length; i++) {
var el = jQuery('#ure_caps_group_'+ ure_main.caps_counter[i].id);
var value = el.text() +' ('+ ure_main.caps_counter[i].total +'/'+ ure_main.caps_counter[i].granted +')';
el.text(value);
}
}
function ure_sizes_update() {
var width = jQuery('#ure_caps_td').css('width');
jQuery('#ure_caps_list_container').css('width', width);
}
jQuery(window).resize(function() {
ure_sizes_update();
});
function ure_show_granted_caps_only() {
var show_deprecated = jQuery('#ure_show_deprecated_caps').attr('checked');
var hide_flag = jQuery('#granted_only').attr('checked');
jQuery('.ure-cap-div').each(function () {
var cap_div = jQuery(this);
if (!cap_div.hasClass(ure_main.class_prefix + ure_main.selected_group)) { // apply to the currently selected group only
return;
}
var cap_id = cap_div.attr('id').substr(12);
var granted = jQuery('#'+ cap_id).attr('checked');
if (granted) {
return;
}
if (hide_flag) {
if (!cap_div.hasClass('hidden')) {
cap_div.addClass('hidden');
}
} else {
if (cap_div.hasClass('deprecated') && !show_deprecated) {
return;
}
if (cap_div.hasClass('hidden')) {
cap_div.removeClass('hidden');
}
}
});
}
\ No newline at end of file
/* User Role Editor - assign to the user other roles
* Author: Vladimir Garagulya
* email: support@role-editor.com
*/
jQuery(document).ready(function(){
if (jQuery('#ure_select_other_roles').length==0) {
return;
}
jQuery('#ure_select_other_roles').multipleSelect({
filter: true,
multiple: true,
selectAll: false,
multipleWidth: 600,
maxHeight: 300,
placeholder: ure_data_user_profile_other_roles.select_roles,
onClick: function(view) {
ure_update_linked_controls_other_roles();
}
});
var other_roles = jQuery('#ure_other_roles').val();
var selected_roles = other_roles.split(',');
jQuery('#ure_select_other_roles').multipleSelect('setSelects', selected_roles);
});
function ure_update_linked_controls_other_roles() {
var data_value = jQuery('#ure_select_other_roles').multipleSelect('getSelects');
var to_save = '';
for (i=0; i<data_value.length; i++) {
if (to_save!=='') {
to_save = to_save + ', ';
}
to_save = to_save + data_value[i];
}
jQuery('#ure_other_roles').val(to_save);
var data_text = jQuery('#ure_select_other_roles').multipleSelect('getSelects', 'text');
var to_show = '';
for (i=0; i<data_text.length; i++) {
if (to_show!=='') {
to_show = to_show + ', ';
}
to_show = to_show + data_text[i];
}
jQuery('#ure_other_roles_list').html(to_show);
}
/* User Role Editor for users.php */
jQuery(document).ready(function() {
jQuery('#move_from_no_role_content').append(ure_users_data.to +' <select id="ure_new_role" name="ure_new_role"></select>');
var ure_new_role = jQuery('#ure_new_role');
var options = jQuery("#new_role > option").clone();
jQuery('#ure_new_role').empty().append(options);
if (jQuery('#ure_new_role option[value="no_rights"]').length === 0) {
jQuery('#ure_new_role').append('<option value="no_rights">' + ure_users_data.no_rights_caption + '</option>');
}
// Exclude change role to
jQuery('#ure_new_role option[value=""]').remove();
var new_role = jQuery('#new_role').find(":selected").val();
if (new_role.length > 0) {
ure_new_role.val(new_role);
}
ure_new_role.trigger('updated');
});
function ure_move_users_from_no_role_dialog() {
jQuery('#move_from_no_role_dialog').dialog({
dialogClass: 'wp-dialog',
modal: true,
autoOpen: true,
closeOnEscape: true,
width: 400,
height: 200,
resizable: false,
title: ure_users_data.move_from_no_role_title,
'buttons': {
'OK': function () {
ure_move_users_from_no_role();
jQuery(this).dialog('close');
},
Cancel: function () {
jQuery(this).dialog('close');
return false;
}
}
});
}
function ure_move_users_from_no_role() {
var new_role = jQuery('#ure_new_role').find(":selected").val();
if (new_role.length==0) {
alert(ure_users_data.provide_new_role_caption);
return;
}
jQuery.ajax({
url: ajaxurl,
type: 'POST',
dataType: 'html',
data: {
action: 'ure_ajax',
sub_action: 'get_users_without_role',
wp_nonce: ure_users_data.wp_nonce,
new_role: new_role
},
success: function(response) {
var data = jQuery.parseJSON(response);
if (typeof data.result !== 'undefined') {
if (data.result === 'success') {
ure_post_move_users_command(data);
} else if (data.result === 'failure') {
alert(data.message);
} else {
alert('Wrong response: ' + response)
}
} else {
alert('Wrong response: ' + response)
}
},
error: function(XMLHttpRequest, textStatus, exception) {
alert("Ajax failure\n" + XMLHttpRequest.statusText);
},
async: true
});
}
function ure_post_move_users_command(data) {
var options = jQuery("#ure_new_role > option").clone();
jQuery('#new_role').empty().append(options);
jQuery("#new_role").val(data.new_role);
var el = jQuery('.bulkactions').append();
for(var i=0; i<data.users.length; i++) {
if (jQuery('#user_'+ data.users[i]).length>0) {
jQuery('#user_'+ data.users[i]).prop('checked', true);
} else {
var html = '<input type="checkbox" name="users[]" id="user_'+ data.users[i] +'" value="'+ data.users[i] +'" checked="checked" style="display: none;">';
el.append(html);
}
}
// submit form
jQuery('#changeit').click();
}
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: User Role Editor 4.19.2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-13 11:10+0700\n"
"PO-Revision-Date: \n"
"Last-Translator: Vladimir Garagulya <vladimir@shinephp.com>\n"
"Language-Team: https://www.role-editor.com <support@role-editor.com>\n"
"Language: en_EN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: __;_e;esc_html__;esc_html_e\n"
"X-Poedit-Basepath: .\n"
"X-Generator: Poedit 1.8.7.1\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../includes/classes/capabilities-groups-manager.php:44
msgid "Custom Post Types"
msgstr ""
#: ../includes/classes/capabilities-groups-manager.php:75
#: ../includes/classes/ure-lib.php:230
#: ../includes/classes/user-role-editor.php:525
#: ../includes/classes/user-role-editor.php:556
msgid "User Role Editor"
msgstr ""
#: ../includes/classes/capabilities-groups-manager.php:90
msgid "WooCommerce"
msgstr ""
#: ../includes/classes/capabilities-groups-manager.php:91
#: ../includes/classes/capabilities-groups-manager.php:111
msgid "Core"
msgstr ""
#: ../includes/classes/capabilities-groups-manager.php:110
msgid "All"
msgstr ""
#: ../includes/classes/capabilities-groups-manager.php:112
#: ../includes/classes/user-role-editor.php:497
#: ../includes/settings-template.php:21
msgid "General"
msgstr ""
#: ../includes/classes/capabilities-groups-manager.php:113
msgid "Themes"
msgstr ""
#: ../includes/classes/capabilities-groups-manager.php:114
msgid "Posts"
msgstr ""
#: ../includes/classes/capabilities-groups-manager.php:115
msgid "Pages"
msgstr ""
#: ../includes/classes/capabilities-groups-manager.php:116
msgid "Plugins"
msgstr ""
#: ../includes/classes/capabilities-groups-manager.php:117
msgid "Users"
msgstr ""
#: ../includes/classes/capabilities-groups-manager.php:121
#: ../includes/classes/user-role-editor.php:515
#: ../includes/settings-template.php:34
msgid "Multisite"
msgstr ""
#: ../includes/classes/capabilities-groups-manager.php:123
msgid "Deprecated"
msgstr ""
#: ../includes/classes/capabilities-groups-manager.php:126
msgid "Custom capabilities"
msgstr ""
#: ../includes/classes/capability.php:56 ../includes/classes/capability.php:164
#: ../includes/classes/ure-lib.php:1223 ../includes/classes/ure-lib.php:1498
#: ../includes/classes/ure-lib.php:1614 ../includes/classes/ure-lib.php:1662
#: ../includes/classes/user-role-editor.php:766
msgid "Insufficient permissions to work with User Role Editor"
msgstr ""
#: ../includes/classes/capability.php:66
msgid "Error: Capability name must contain latin characters and digits only!"
msgstr ""
#: ../includes/classes/capability.php:78
#, php-format
msgid "Capability %s is added successfully"
msgstr ""
#: ../includes/classes/capability.php:80
#, php-format
msgid "Capability %s exists already"
msgstr ""
#: ../includes/classes/capability.php:171
#: ../includes/classes/capability.php:176
msgid "There are no capabilities available for deletion!"
msgstr ""
#: ../includes/classes/capability.php:182
#, php-format
msgid "Capability %s was removed successfully"
msgstr ""
#: ../includes/classes/capability.php:185
msgid "capabilities were removed successfully"
msgstr ""
#: ../includes/classes/role-additional-options.php:69
msgid "Hide admin bar"
msgstr ""
#: ../includes/classes/role-additional-options.php:121
msgid "Additional Options"
msgstr ""
#: ../includes/classes/role-view.php:75
msgid "None"
msgstr ""
#: ../includes/classes/role-view.php:108
msgid "Delete All Unused Roles"
msgstr ""
#: ../includes/classes/role-view.php:208 ../includes/classes/role-view.php:219
msgid "Role name (ID): "
msgstr ""
#: ../includes/classes/role-view.php:210 ../includes/classes/role-view.php:221
msgid "Display Role Name: "
msgstr ""
#: ../includes/classes/role-view.php:212
msgid "Make copy of: "
msgstr ""
#: ../includes/classes/role-view.php:228
msgid "Select Role:"
msgstr ""
#: ../includes/classes/role-view.php:253
msgid "Capability name (ID): "
msgstr ""
#: ../includes/classes/role-view.php:372 ../includes/classes/user-view.php:154
msgid "Show capabilities in human readable form"
msgstr ""
#: ../includes/classes/role-view.php:382 ../includes/classes/screen-help.php:21
#: ../includes/classes/user-view.php:164 ../includes/settings-template.php:69
msgid "Show deprecated capabilities"
msgstr ""
#: ../includes/classes/role-view.php:386
msgid "If checked, then apply action to ALL sites of this Network"
msgstr ""
#: ../includes/classes/role-view.php:399
msgid "Apply to All Sites"
msgstr ""
#: ../includes/classes/role-view.php:416
msgid "Select Role and change its capabilities:"
msgstr ""
#: ../includes/classes/screen-help.php:12
#: ../includes/classes/screen-help.php:41
#: ../includes/classes/screen-help.php:60
#: ../includes/classes/screen-help.php:79
msgid "User Role Editor Options page help"
msgstr ""
#: ../includes/classes/screen-help.php:15 ../includes/settings-template.php:53
msgid "Show Administrator role at User Role Editor"
msgstr ""
#: ../includes/classes/screen-help.php:16
msgid ""
"turn this option on in order to make the \"Administrator\" role available at "
"the User Role Editor roles selection drop-down list. It is hidden by default "
"for security reasons."
msgstr ""
#: ../includes/classes/screen-help.php:18 ../includes/settings-template.php:61
msgid "Show capabilities in the human readable form"
msgstr ""
#: ../includes/classes/screen-help.php:19
msgid ""
"automatically converts capability names from the technical form for internal "
"use like \"edit_others_posts\" to more user friendly form, e.g. \"Edit "
"others posts\"."
msgstr ""
#: ../includes/classes/screen-help.php:22
msgid ""
"Capabilities like \"level_0\", \"level_1\" are deprecated and are not used "
"by WordPress. They are left at the user roles for the compatibility purpose "
"with the old themes and plugins code. Turning on this option will show those "
"deprecated capabilities."
msgstr ""
#: ../includes/classes/screen-help.php:25 ../includes/settings-template.php:85
msgid "Edit user capabilities"
msgstr ""
#: ../includes/classes/screen-help.php:26
msgid ""
"If turned off - capabilities section of selected user is shown in readonly "
"mode. Administrator can not assign capabilities to the user directly. He "
"should make it using roles only."
msgstr ""
#: ../includes/classes/screen-help.php:45 ../includes/settings-template.php:119
msgid "Count users without role"
msgstr ""
#: ../includes/classes/screen-help.php:46
msgid ""
"Show at the \"Users\" page a quant of users without role. Module allows to "
"assign all of them an empty role \"No rights\", in order to look on the "
"users list with role \"No rights\" at the separate tab then."
msgstr ""
#: ../includes/classes/screen-help.php:63
msgid "Other default roles for new registered user"
msgstr ""
#: ../includes/classes/screen-help.php:64
msgid ""
"select roles below to assign them to the new user automatically as an "
"addition to the primary role. Note for multisite environment: take into "
"account that other default roles should exist at the site, in order to be "
"assigned to the new registered users."
msgstr ""
#: ../includes/classes/screen-help.php:82
msgid "Allow non super-admininstrators to create, edit and delete users"
msgstr ""
#: ../includes/classes/screen-help.php:83
msgid ""
"Super administrator only may create, edit and delete users under WordPress "
"multi-site by default. Turn this option on in order to remove this "
"limitation."
msgstr ""
#: ../includes/classes/ure-lib.php:207
msgid "Error: wrong request"
msgstr ""
#: ../includes/classes/ure-lib.php:291
msgid "Error: "
msgstr ""
#: ../includes/classes/ure-lib.php:291
msgid "Role"
msgstr ""
#: ../includes/classes/ure-lib.php:292
msgid "does not exist"
msgstr ""
#: ../includes/classes/ure-lib.php:335
msgid "Role is updated successfully"
msgstr ""
#: ../includes/classes/ure-lib.php:337
msgid "Roles are updated for all network"
msgstr ""
#: ../includes/classes/ure-lib.php:343
msgid "Error occured during role(s) update"
msgstr ""
#: ../includes/classes/ure-lib.php:350
msgid "User capabilities are updated successfully"
msgstr ""
#: ../includes/classes/ure-lib.php:355
msgid "Error occured during user update"
msgstr ""
#: ../includes/classes/ure-lib.php:413
msgid "User Roles are restored to WordPress default values. "
msgstr ""
#: ../includes/classes/ure-lib.php:1461
msgid "Error is occur. Please check the log file."
msgstr ""
#: ../includes/classes/ure-lib.php:1507 ../includes/classes/ure-lib.php:1574
msgid ""
"Error: Role ID must contain latin characters, digits, hyphens or underscore "
"only!"
msgstr ""
#: ../includes/classes/ure-lib.php:1511 ../includes/classes/ure-lib.php:1578
msgid ""
"Error: WordPress does not support numeric Role name (ID). Add latin "
"characters to it."
msgstr ""
#: ../includes/classes/ure-lib.php:1526
#, php-format
msgid "Role %s exists already"
msgstr ""
#: ../includes/classes/ure-lib.php:1541
msgid "Error is encountered during new role create operation"
msgstr ""
#: ../includes/classes/ure-lib.php:1543
#, php-format
msgid "Role %s is created successfully"
msgstr ""
#: ../includes/classes/ure-lib.php:1567
msgid "Error: Role ID is empty!"
msgstr ""
#: ../includes/classes/ure-lib.php:1585
msgid "Error: Empty role display name is not allowed."
msgstr ""
#: ../includes/classes/ure-lib.php:1592
#, php-format
msgid "Role %s does not exists"
msgstr ""
#: ../includes/classes/ure-lib.php:1600
#, php-format
msgid "Role %s is renamed to %s successfully"
msgstr ""
#: ../includes/classes/ure-lib.php:1673
msgid "Error encountered during role delete operation"
msgstr ""
#: ../includes/classes/ure-lib.php:1675
msgid "Unused roles are deleted successfully"
msgstr ""
#: ../includes/classes/ure-lib.php:1677
#, php-format
msgid "Role %s is deleted successfully"
msgstr ""
#: ../includes/classes/ure-lib.php:1708
msgid "Error encountered during default role change operation"
msgstr ""
#: ../includes/classes/ure-lib.php:1711
#, php-format
msgid "Default role for new users is set to %s successfully"
msgstr ""
#: ../includes/classes/ure-lib.php:1714
msgid "Can not set Administrator role as a default one"
msgstr ""
#: ../includes/classes/ure-lib.php:1716
msgid "This role does not exist - "
msgstr ""
#: ../includes/classes/ure-lib.php:1732
msgid "Editor"
msgstr ""
#: ../includes/classes/ure-lib.php:1733
msgid "Author"
msgstr ""
#: ../includes/classes/ure-lib.php:1734
msgid "Contributor"
msgstr ""
#: ../includes/classes/ure-lib.php:1735
msgid "Subscriber"
msgstr ""
#: ../includes/classes/ure-lib.php:1737
msgid "Switch themes"
msgstr ""
#: ../includes/classes/ure-lib.php:1738
msgid "Edit themes"
msgstr ""
#: ../includes/classes/ure-lib.php:1739
msgid "Activate plugins"
msgstr ""
#: ../includes/classes/ure-lib.php:1740
msgid "Edit plugins"
msgstr ""
#: ../includes/classes/ure-lib.php:1741
msgid "Edit users"
msgstr ""
#: ../includes/classes/ure-lib.php:1742
msgid "Edit files"
msgstr ""
#: ../includes/classes/ure-lib.php:1743
msgid "Manage options"
msgstr ""
#: ../includes/classes/ure-lib.php:1744
msgid "Moderate comments"
msgstr ""
#: ../includes/classes/ure-lib.php:1745
msgid "Manage categories"
msgstr ""
#: ../includes/classes/ure-lib.php:1746
msgid "Manage links"
msgstr ""
#: ../includes/classes/ure-lib.php:1747
msgid "Upload files"
msgstr ""
#: ../includes/classes/ure-lib.php:1748
msgid "Import"
msgstr ""
#: ../includes/classes/ure-lib.php:1749
msgid "Unfiltered html"
msgstr ""
#: ../includes/classes/ure-lib.php:1750
msgid "Edit posts"
msgstr ""
#: ../includes/classes/ure-lib.php:1751
msgid "Edit others posts"
msgstr ""
#: ../includes/classes/ure-lib.php:1752
msgid "Edit published posts"
msgstr ""
#: ../includes/classes/ure-lib.php:1753
msgid "Publish posts"
msgstr ""
#: ../includes/classes/ure-lib.php:1754
msgid "Edit pages"
msgstr ""
#: ../includes/classes/ure-lib.php:1755
msgid "Read"
msgstr ""
#: ../includes/classes/ure-lib.php:1756
msgid "Level 10"
msgstr ""
#: ../includes/classes/ure-lib.php:1757
msgid "Level 9"
msgstr ""
#: ../includes/classes/ure-lib.php:1758
msgid "Level 8"
msgstr ""
#: ../includes/classes/ure-lib.php:1759
msgid "Level 7"
msgstr ""
#: ../includes/classes/ure-lib.php:1760
msgid "Level 6"
msgstr ""
#: ../includes/classes/ure-lib.php:1761
msgid "Level 5"
msgstr ""
#: ../includes/classes/ure-lib.php:1762
msgid "Level 4"
msgstr ""
#: ../includes/classes/ure-lib.php:1763
msgid "Level 3"
msgstr ""
#: ../includes/classes/ure-lib.php:1764
msgid "Level 2"
msgstr ""
#: ../includes/classes/ure-lib.php:1765
msgid "Level 1"
msgstr ""
#: ../includes/classes/ure-lib.php:1766
msgid "Level 0"
msgstr ""
#: ../includes/classes/ure-lib.php:1767
msgid "Edit others pages"
msgstr ""
#: ../includes/classes/ure-lib.php:1768
msgid "Edit published pages"
msgstr ""
#: ../includes/classes/ure-lib.php:1769
msgid "Publish pages"
msgstr ""
#: ../includes/classes/ure-lib.php:1770
msgid "Delete pages"
msgstr ""
#: ../includes/classes/ure-lib.php:1771
msgid "Delete others pages"
msgstr ""
#: ../includes/classes/ure-lib.php:1772
msgid "Delete published pages"
msgstr ""
#: ../includes/classes/ure-lib.php:1773
msgid "Delete posts"
msgstr ""
#: ../includes/classes/ure-lib.php:1774
msgid "Delete others posts"
msgstr ""
#: ../includes/classes/ure-lib.php:1775
msgid "Delete published posts"
msgstr ""
#: ../includes/classes/ure-lib.php:1776
msgid "Delete private posts"
msgstr ""
#: ../includes/classes/ure-lib.php:1777
msgid "Edit private posts"
msgstr ""
#: ../includes/classes/ure-lib.php:1778
msgid "Read private posts"
msgstr ""
#: ../includes/classes/ure-lib.php:1779
msgid "Delete private pages"
msgstr ""
#: ../includes/classes/ure-lib.php:1780
msgid "Edit private pages"
msgstr ""
#: ../includes/classes/ure-lib.php:1781
msgid "Read private pages"
msgstr ""
#: ../includes/classes/ure-lib.php:1782
msgid "Delete users"
msgstr ""
#: ../includes/classes/ure-lib.php:1783
msgid "Create users"
msgstr ""
#: ../includes/classes/ure-lib.php:1784
msgid "Unfiltered upload"
msgstr ""
#: ../includes/classes/ure-lib.php:1785
msgid "Edit dashboard"
msgstr ""
#: ../includes/classes/ure-lib.php:1786
msgid "Update plugins"
msgstr ""
#: ../includes/classes/ure-lib.php:1787
msgid "Delete plugins"
msgstr ""
#: ../includes/classes/ure-lib.php:1788
msgid "Install plugins"
msgstr ""
#: ../includes/classes/ure-lib.php:1789
msgid "Update themes"
msgstr ""
#: ../includes/classes/ure-lib.php:1790
msgid "Install themes"
msgstr ""
#: ../includes/classes/ure-lib.php:1791
msgid "Update core"
msgstr ""
#: ../includes/classes/ure-lib.php:1792
msgid "List users"
msgstr ""
#: ../includes/classes/ure-lib.php:1793
msgid "Remove users"
msgstr ""
#: ../includes/classes/ure-lib.php:1794
msgid "Add users"
msgstr ""
#: ../includes/classes/ure-lib.php:1795
msgid "Promote users"
msgstr ""
#: ../includes/classes/ure-lib.php:1796
msgid "Edit theme options"
msgstr ""
#: ../includes/classes/ure-lib.php:1797
msgid "Delete themes"
msgstr ""
#: ../includes/classes/ure-lib.php:1798
msgid "Export"
msgstr ""
#: ../includes/classes/ure-lib.php:1963
msgid "Version:"
msgstr ""
#: ../includes/classes/ure-lib.php:1964
msgid "Author's website"
msgstr ""
#: ../includes/classes/ure-lib.php:1965
msgid "Plugin webpage"
msgstr ""
#: ../includes/classes/ure-lib.php:1966
msgid "Plugin download"
msgstr ""
#: ../includes/classes/ure-lib.php:1967
#: ../includes/classes/user-role-editor.php:474
msgid "Changelog"
msgstr ""
#: ../includes/classes/ure-lib.php:1968
msgid "FAQ"
msgstr ""
#: ../includes/classes/ure-lib.php:2150
#, php-format
msgid "Denied: %s"
msgstr ""
#: ../includes/classes/user-other-roles.php:81
#: ../includes/classes/user-other-roles.php:182
msgid "Other Roles"
msgstr ""
#: ../includes/classes/user-other-roles.php:82
msgid "Select additional roles for this user"
msgstr ""
#: ../includes/classes/user-other-roles.php:161
#: ../includes/classes/user-role-editor.php:356
msgid "Capabilities"
msgstr ""
#: ../includes/classes/user-other-roles.php:168
msgid "Edit"
msgstr ""
#: ../includes/classes/user-other-roles.php:218
msgid "Additional Capabilities"
msgstr ""
#: ../includes/classes/user-role-editor.php:255
msgid "Change role for users without role"
msgstr ""
#: ../includes/classes/user-role-editor.php:256
msgid "To:"
msgstr ""
#: ../includes/classes/user-role-editor.php:257
msgid "No rights"
msgstr ""
#: ../includes/classes/user-role-editor.php:258
msgid "Provide new role"
msgstr ""
#: ../includes/classes/user-role-editor.php:330
#: ../includes/classes/user-role-editor.php:332
msgid "You do not have permission to edit this user."
msgstr ""
#: ../includes/classes/user-role-editor.php:448
#: ../includes/classes/user-role-editor.php:461
msgid "Settings"
msgstr ""
#: ../includes/classes/user-role-editor.php:503
#: ../includes/settings-template.php:26
msgid "Additional Modules"
msgstr ""
#: ../includes/classes/user-role-editor.php:509
#: ../includes/settings-template.php:30
msgid "Default Roles"
msgstr ""
#: ../includes/classes/user-role-editor.php:619
#: ../includes/classes/user-role-editor.php:637
#: ../includes/classes/user-role-editor.php:682
msgid "User Role Editor options are updated"
msgstr ""
#: ../includes/classes/user-role-editor.php:665
msgid "Default Roles are updated"
msgstr ""
#: ../includes/classes/user-role-editor.php:691
msgid ""
"You do not have sufficient permissions to manage options for User Role "
"Editor."
msgstr ""
#: ../includes/classes/user-role-editor.php:804
msgid "Confirm"
msgstr ""
#: ../includes/classes/user-role-editor.php:805
msgid "Yes"
msgstr ""
#: ../includes/classes/user-role-editor.php:806
msgid "No"
msgstr ""
#: ../includes/classes/user-role-editor.php:807
msgid "Select All"
msgstr ""
#: ../includes/classes/user-role-editor.php:808
msgid "Unselect All"
msgstr ""
#: ../includes/classes/user-role-editor.php:809
msgid "Reverse"
msgstr ""
#: ../includes/classes/user-role-editor.php:810
msgid "Update"
msgstr ""
#: ../includes/classes/user-role-editor.php:811
msgid "Please confirm permissions update"
msgstr ""
#: ../includes/classes/user-role-editor.php:812
msgid "Add New Role"
msgstr ""
#: ../includes/classes/user-role-editor.php:813
#: ../includes/classes/user-role-editor.php:818
msgid "Rename Role"
msgstr ""
#: ../includes/classes/user-role-editor.php:814
msgid " Role name (ID) can not be empty!"
msgstr ""
#: ../includes/classes/user-role-editor.php:815
msgid ""
" Role name (ID) must contain latin characters, digits, hyphens or underscore "
"only!"
msgstr ""
#: ../includes/classes/user-role-editor.php:816
msgid ""
" WordPress does not support numeric Role name (ID). Add latin characters to "
"it."
msgstr ""
#: ../includes/classes/user-role-editor.php:817
msgid "Add Role"
msgstr ""
#: ../includes/classes/user-role-editor.php:819
msgid "Delete Role"
msgstr ""
#: ../includes/classes/user-role-editor.php:820
msgid "Cancel"
msgstr ""
#: ../includes/classes/user-role-editor.php:821
msgid "Add Capability"
msgstr ""
#: ../includes/classes/user-role-editor.php:822
#: ../includes/classes/user-role-editor.php:831
msgid "Delete Capability"
msgstr ""
#: ../includes/classes/user-role-editor.php:823
msgid "Reset"
msgstr ""
#: ../includes/classes/user-role-editor.php:824
msgid "DANGER! Resetting will restore default settings from WordPress Core."
msgstr ""
#: ../includes/classes/user-role-editor.php:825
msgid ""
"If any plugins have changed capabilities in any way upon installation (such "
"as S2Member, WooCommerce, and many more), those capabilities will be DELETED!"
msgstr ""
#: ../includes/classes/user-role-editor.php:826
msgid ""
"For more information on how to undo changes and restore plugin capabilities "
"go to"
msgstr ""
#: ../includes/classes/user-role-editor.php:828
msgid "Continue?"
msgstr ""
#: ../includes/classes/user-role-editor.php:829
msgid "Default Role"
msgstr ""
#: ../includes/classes/user-role-editor.php:830
msgid "Set New Default Role"
msgstr ""
#: ../includes/classes/user-role-editor.php:832
msgid ""
"Warning! Be careful - removing critical capability could crash some plugin "
"or other custom code"
msgstr ""
#: ../includes/classes/user-role-editor.php:833
msgid " Capability name (ID) can not be empty!"
msgstr ""
#: ../includes/classes/user-role-editor.php:834
msgid ""
" Capability name (ID) must contain latin characters, digits, hyphens or "
"underscore only!"
msgstr ""
#: ../includes/classes/user-view.php:61
msgid "Switch&nbsp;To"
msgstr ""
#: ../includes/classes/user-view.php:73
msgid "Network Super Admin"
msgstr ""
#: ../includes/classes/user-view.php:98
msgid "&mdash; No role for this site &mdash;"
msgstr ""
#: ../includes/classes/user-view.php:137
msgid "Change capabilities for user"
msgstr ""
#: ../includes/classes/user-view.php:172
msgid "Primary Role:"
msgstr ""
#: ../includes/classes/user-view.php:178
msgid "bbPress Role:"
msgstr ""
#: ../includes/classes/user-view.php:187
msgid "Other Roles:"
msgstr ""
#: ../includes/classes/view.php:260
msgid "Group"
msgstr ""
#: ../includes/classes/view.php:260
msgid "Total"
msgstr ""
#: ../includes/classes/view.php:260
msgid "Granted"
msgstr ""
#: ../includes/classes/view.php:267
msgid "Quick filter:"
msgstr ""
#: ../includes/classes/view.php:270
msgid "Granted Only"
msgstr ""
#: ../includes/classes/view.php:273
msgid "Columns:"
msgstr ""
#: ../includes/settings-template.php:17
msgid "User Role Editor - Options"
msgstr ""
#: ../includes/settings-template.php:39
msgid "About"
msgstr ""
#: ../includes/settings-template.php:77
msgid "Confirm role update"
msgstr ""
#: ../includes/settings-template.php:98 ../includes/settings-template.php:134
#: ../includes/settings-template.php:166 ../includes/settings-template.php:198
msgid "Save"
msgstr ""
#: ../includes/settings-template.php:146
msgid "Primary default role: "
msgstr ""
#: ../includes/settings-template.php:153
msgid "Other default roles for new registered user: "
msgstr ""
#: ../includes/settings-template.php:159
msgid ""
"Note for multisite environment: take into account that other default roles "
"should exist at the site, in order to be assigned to the new registered "
"users."
msgstr ""
#: ../includes/settings-template.php:185
msgid "Allow non super administrators to create, edit, and delete users"
msgstr ""
User Role Editor WordPress plugin
Copyright 2009-2016 by Vladimir Garagulya - vladimir@shinephp.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
This program is based on the work covered by the following copyright and
permission notices:
WordPress - Web publishing software
Copyright 2003-2010 by the contributors
WordPress is released under the GPL
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
WRITTEN OFFER
The source code for any program binaries or compressed scripts that are
included with WordPress can be freely obtained at the following URL:
http://wordpress.org/download/source/
=== User Role Editor ===
Contributors: shinephp
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=vladimir%40shinephp%2ecom&lc=RU&item_name=ShinePHP%2ecom&item_number=User%20Role%20Editor%20WordPress%20plugin&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
Tags: user, role, editor, security, access, permission, capability
Requires at least: 4.0
Tested up to: 4.7
Stable tag: 4.31.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
User Role Editor WordPress plugin makes user roles and capabilities changing easy. Edit/add/delete WordPress user roles and capabilities.
== Description ==
With User Role Editor WordPress plugin you can change user role (except Administrator) capabilities easy, with a few clicks.
Just turn on check boxes of capabilities you wish to add to the selected role and click "Update" button to save your changes. That's done.
Add new roles and customize its capabilities according to your needs, from scratch of as a copy of other existing role.
Unnecessary self-made role can be deleted if there are no users whom such role is assigned.
Role assigned every new created user by default may be changed too.
Capabilities could be assigned on per user basis. Multiple roles could be assigned to user simultaneously.
You can add new capabilities and remove unnecessary capabilities which could be left from uninstalled plugins.
Multi-site support is provided.
To read more about 'User Role Editor' visit [this page](http://www.shinephp.com/user-role-editor-wordpress-plugin/) at [shinephp.com](http://shinephp.com)
Do you need more functionality with quality support in the real time? Do you wish to remove advertisements from User Role Editor pages?
[Buy Pro version](https://www.role-editor.com).
[User Role Editor Pro](https://www.role-editor.com) includes extra modules:
<ul>
<li>Block selected admin menu items for role.</li>
<li>Hide selected front-end menu items for no logged-in visitors, logged-in users, roles.</li>
<li>Block selected widgets under "Appearance" menu for role.</li>
<li>Show widgets at front-end for selected roles.</li>
<li>Block selected meta boxes (dashboard, posts, pages, custom post types) for role.</li>
<li>"Export/Import" module. You can export user roles to the local file and import them then to any WordPress site or other sites of the multi-site WordPress network.</li>
<li>Roles and Users permissions management via Network Admin for multisite configuration. One click Synchronization to the whole network.</li>
<li>"Other roles access" module allows to define which other roles user with current role may see at WordPress: dropdown menus, e.g assign role to user editing user profile, etc.</li>
<li>Manage user access to editing posts/pages/custom post type using posts/pages, authors, taxonomies ID list.</li>
<li>Per plugin users access management for plugins activate/deactivate operations.</li>
<li>Per form users access management for Gravity Forms plugin.</li>
<li>Shortcode to show enclosed content to the users with selected roles only.</li>
<li>Posts and pages view restrictions for selected roles.</li>
</ul>
Pro version is advertisement free. Premium support is included.
== Installation ==
Installation procedure:
1. Deactivate plugin if you have the previous version installed.
2. Extract "user-role-editor.zip" archive content to the "/wp-content/plugins/user-role-editor" directory.
3. Activate "User Role Editor" plugin via 'Plugins' menu in WordPress admin menu.
4. Go to the "Users"-"User Role Editor" menu item and change your WordPress standard roles capabilities according to your needs.
== Frequently Asked Questions ==
- Does it work with WordPress in multi-site environment?
Yes, it works with WordPress multi-site. By default plugin works for every blog from your multi-site network as for locally installed blog.
To update selected role globally for the Network you should turn on the "Apply to All Sites" checkbox. You should have superadmin privileges to use User Role Editor under WordPress multi-site.
Pro version allows to manage roles of the whole network from the Netwok Admin.
To read full FAQ section visit [this page](http://www.shinephp.com/user-role-editor-wordpress-plugin/#faq) at [shinephp.com](shinephp.com).
== Screenshots ==
1. screenshot-1.png User Role Editor main form
2. screenshot-2.png Add/Remove roles or capabilities
3. screenshot-3.png User Capabilities link
4. screenshot-4.png User Capabilities Editor
5. screenshot-5.png Bulk change role for users without roles
To read more about 'User Role Editor' visit [this page](http://www.shinephp.com/user-role-editor-wordpress-plugin/) at [shinephp.com](shinephp.com).
= Translations =
If you wish to check available translations or help with plugin translation to your language visit this link
https://translate.wordpress.org/projects/wp-plugins/user-role-editor/
== Changelog ==
= [4.31.1] 06.01.2017 =
* Fix: WP transients get/set were removed from URE_Own_Capabilities class. It leaded to the MySQL deadlock in some cases.
* Update: Base_Lib::get_request_var() sanitizes user input by PHP's filter_var() in addition to WordPress core's esc_attr().
= [4.31] 14.12.2016 =
* New: It's possible to remove unused user capabilities by list.
* Fix: There was no support for installations with the hidden/changed URL to wp-admin. URE uses 'admin_url()' now to get and check admin URL, instead of direct comparing URL with 'wp-admin' string.
* Fix: Deprecated capabilities were shown in some cases at the 'Core' group even with "Show deprecated capabilities" mode switched off.
* Update: Capability groups CSS classes are prefixed with 'ure-' in order to minimize possible CSS conflicts with other plugins/themes which may load styles with the same classes globally and break URE's markup.
= [4.30] 01.12.2016 =
* Update: compatible with WordPress 4.7
* New: "Granted Only" checkbox to the right from the "Quick Filter" input control allows to show only granted capabilities for the selected role or user.
= [4.29] 10.11.2016 =
* New: User Role Editor own user capabilities are grouped separately under Custom capabilities.
* Update: URE_Lib::is_super_admin() uses WordPress core is_super_admin() for multisite setup only. Superadmin is a user with 'administrator' role in the case of single site WordPress installation.
This is the difference with the WordPress core which counts as a superadmin (for single site WP installation) any user with a 'delete_users' capability.
* Update: BaseLib::option_selected() calls were replaced with the calls of a similar selected() function from WordPress core.
= [4.28] 20.10.2016 =
* New: WooCommerce plugin user capabilities (if exist) are grouped separately under Custom capabilities.
* Update: Temporally raised permissions flag is taken into account when checking, if user has a superadmin privileges. WordPress is_super_admin() function was replaced with custom wrapper to define if current user is a real superadmin or just a local admin with the temporally raised (add/edit users pages) permissions.
= [4.27.2] 15.09.2016 =
* Update: There was a conflict with plugins which use a '|' character at the custom user capabilities: e.g. 'Nginx Helper | Config' from "Nginx Helper' plugin.
* Fix: PHP notice was removed: Undefined property: URE_Role_View::$multisite in wp-content/plugins/user-role-editor/includes/classes/view.php on line 143
* Fix: WordPress multisite: Settings link under the URE plugin at the plugins list leads to the network admin now, not to the the single site settings page, which does not exist.
* Fix: WordPress multisite: conflict with "Visual Composer" plugin was resolved: single site administrators could now use Visual Composer editor.
* Fix: WordPress multisite: changed role name was not replicated to other sites when user clicked "Update" with "Apply to All Sites" option turned ON.
= [4.27.1] 22.08.2016 =
* Update: There was a conflict with plugins which use a '/' character at the custom user capabilities: e.g. vc_access_rules_backend_editor/disabled_ce_editor from Visual Composer.
* Update: add/delete, escape, validate user capability code extracted from URE_Lib to the separate URE_Capability class
= [4.27] 18.08.2016 =
* New: Total/Granted counters were added to the capabilities groups titles.
* New: "Columns" drop-down menu allows to change capabilities section layout to 1, 2 or 3 columns.
* New: Capabilities section is limited in height and has independent scrollbar.
* Update: User Role Editor page markup was updated to use more available space on page.
* Update: URE_Ajax_Processor class allows to differentiate required user permissions according to action submitted by user.
* Fix: CSS updated to exclude text overlapping at capabilities groups section when custom post type name is not fitted into 1 line.
* Fix: required JavaScript files were not loaded at "Network Admin->Settings->User Role Editor" page.
= [4.26.3] 25.07.2016 =
* Fix: Selecting a sub-group/list of caps does make the ure_select_all_caps checkbox select all within that group, but checking that box when at the "All" top-level group did not work.
* Fix: Notice: Undefined property: URE_Role_View::$apply_to_all
= [4.26.1] 14.07.2016 =
* Fix: some bugs, like 'undefined property' notices, etc.
= [4.26] 14.07.2016 =
* New: User capabilities were groupd by functionality for more convenience.
* Update: URE_KEY_CAPABILITY constant was changed from 'ure_edit_roles' to 'ure_manage_options'. To make possible for non-admin users access to the User Role Editor without access to the 'administrator' role and users with 'administrator' role.
* Update: User receives full access to User Role Editor under WordPress multisite if he has 'manage_network_plugins' capability instead of 'manager_network_users' as earlier. This allows to give user ability to edit network users without giving him access to the User Role Editor.
* Update: Multisite: use WordPress's global $current_site->blog_id to define main blog ID instead of selecting the 1st one from the sorted list of blogs.
* Update: use WP transients at URE_Lib::_get_post_types() to reduce response time.
* Update: various internal optimizations.
= [4.25.2] 03.05.2016 =
* Update: Enhanced inner processing of available custom post types list.
* Update: Uses 15 seconds transient cache in order to not count users without role twice when 'restrict_manage_users' action fires.
* Update: URE fires action 'profile_update' after direct update of user permissions in order other plugins may catch such change.
* Update: All URE's PHP classes files renamed and moved to the includes/classes subdirectory
= [4.25.1] 15.04.2016 =
* Fix: Selected role's capabilities list was returned back to old after click "Update" button. It was showed correctly according to the recent updates just after additional page refresh.
* Update: deprecated function get_current_user_info() call was replaced with wp_get_current_user().
= [4.25] 02.04.2016 =
* Important security update: Any registered user could get an administrator access. Thanks to [John Muncaster](http://johnmuncaster.com/) for discovering and wisely reporting it.
* URE pages title tag was replaced from h2 to h1, for compatibility with other WordPress pages.
* Fix: "Assign role to the users without role" feature ignored role selected by user.
* Fix: PHP fatal error (line 34) was raised at uninstall.php for WordPress multisite.
* Update: action priority 99 was added for role additional options hook action setup.
Click [here](https://www.role-editor.com/changelog)</a> to look at [the full list of changes](https://www.role-editor.com/changelog) of User Role Editor plugin.
== Additional Documentation ==
You can find more information about "User Role Editor" plugin at [this page](http://www.shinephp.com/user-role-editor-wordpress-plugin/)
I am ready to answer on your questions about plugin usage. Use [plugin page comments](http://www.shinephp.com/user-role-editor-wordpress-plugin/) for that.
<?php
/*
* User Role Editor plugin uninstall script
* Author: vladimir@shinephp.com
*
*/
global $wpdb;
if (!defined('ABSPATH') || !defined('WP_UNINSTALL_PLUGIN')) {
exit(); // silence is golden
}
function ure_delete_options() {
global $wpdb;
$backup_option_name = $wpdb->prefix.'backup_user_roles';
delete_option($backup_option_name);
delete_option('ure_caps_readable');
delete_option('ure_show_deprecated_caps');
delete_option('ure_hide_pro_banner');
delete_option('user_role_editor');
delete_option('ure_role_additional_options_values');
delete_option('ure_task_queue');
}
if (!is_multisite()) {
ure_delete_options();
} else {
$old_blog = $wpdb->blogid;
// Get all blog ids
$blogIds = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
foreach ($blogIds as $blog_id) {
switch_to_blog($blog_id);
ure_delete_options();
}
switch_to_blog($old_blog);
}
<?php
/*
Plugin Name: User Role Editor
Plugin URI: https://www.role-editor.com
Description: Change/add/delete WordPress user roles and capabilities.
Version: 4.31.1
Author: Vladimir Garagulya
Author URI: https://www.role-editor.com
Text Domain: ure
Domain Path: /lang/
*/
/*
Copyright 2010-2016 Vladimir Garagulya (email: support@role-editor.com)
*/
if (!function_exists('get_option')) {
header('HTTP/1.0 403 Forbidden');
die; // Silence is golden, direct call is prohibited
}
if (defined('URE_PLUGIN_URL')) {
wp_die('It seems that other version of User Role Editor is active. Please deactivate it before use this version');
}
define('URE_VERSION', '4.31.1');
define('URE_PLUGIN_URL', plugin_dir_url(__FILE__));
define('URE_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('URE_PLUGIN_BASE_NAME', plugin_basename(__FILE__));
define('URE_PLUGIN_FILE', basename(__FILE__));
define('URE_PLUGIN_FULL_PATH', __FILE__);
require_once(URE_PLUGIN_DIR.'includes/classes/base-lib.php');
require_once(URE_PLUGIN_DIR.'includes/classes/ure-lib.php');
// check PHP version
$ure_required_php_version = '5.2.4';
$exit_msg = sprintf( 'User Role Editor requires PHP %s or newer.', $ure_required_php_version ) .
'<a href="http://wordpress.org/about/requirements/"> ' . 'Please update!' . '</a>';
Ure_Lib::check_version( PHP_VERSION, $ure_required_php_version, $exit_msg, __FILE__ );
// check WP version
$ure_required_wp_version = '4.0';
$exit_msg = sprintf( 'User Role Editor requires WordPress %s or newer.', $ure_required_wp_version ) .
'<a href="http://codex.wordpress.org/Upgrading_WordPress"> ' . 'Please update!' . '</a>';
Ure_Lib::check_version(get_bloginfo('version'), $ure_required_wp_version, $exit_msg, __FILE__ );
require_once(URE_PLUGIN_DIR .'includes/loader.php');
$GLOBALS['user_role_editor'] = new User_Role_Editor();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment