* @link http://wp-dreams.com, http://codecanyon.net/user/wpdreams/portfolio * @copyright Copyright (c) 2015, Ernest Marcinko */ class wpdreamsUserRoleSelect extends wpdreamsType { private $selected, $types; function getType() { parent::getType(); $this->processData(); $this->types = $this->getEditableRoles(); echo "
" . $this->label . ""; echo '

' . __('Available user roles', 'ajax-search-pro') . '

    '; if ($this->types != null && is_array($this->types)) { foreach ($this->types as $_role => $_data) { if ($this->selected == null || !in_array($_role, $this->selected)) { echo '
  • ' . $_role . '
  • '; } } } echo "
"; echo '

' . __('Drag here the user roles you want to exclude!', 'ajax-search-pro') . '

    '; if ($this->selected != null && is_array($this->selected)) { foreach ($this->selected as $k => $v) { echo '
  • ' . $v . '
  • '; } } echo "
"; echo " "; echo " "; echo "
"; } function processData() { $this->data = str_replace("\n", "", $this->data); if ($this->data != "") $this->selected = explode("|", $this->data); else $this->selected = null; } final function getData() { return $this->data; } final function getSelected() { return $this->selected; } function getEditableRoles() { global $wp_roles; return $wp_roles->roles; } } }