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

' . __('Available post types', 'ajax-search-pro') . '

    '; if ($this->types != null && is_array($this->types)) { foreach ($this->types as $k => $v) { if ($this->selected == null || !wd_in_array_r($k, $this->selected)) { echo '
  • '; } } } echo "
"; echo '

' . __('Drag here the post types you want to use!', 'ajax-search-pro') . '

    '; if ($this->selected != null && is_array($this->selected)) { foreach ($this->selected as $k => $v) { echo '
  • '; } } echo "
"; echo " "; echo "
"; } public function processData() { // Make sure that the correct variables are used $this->selected = $this->decode_param($this->data); $this->data = $this->encode_param($this->data); $this->types = get_post_types(array( "public" => true, "_builtin" => false ), "objects", "OR"); foreach ($this->types as $k => $v) { if (in_array($k, array( "revision", "nav_menu_item", "attachment", "acf", "wpcf7_contact_form", "dslc_templates", "acf-field", "acf-group", "acf-groups" ))) { unset($this->types[$k]); continue; } } } public final function getData() { return $this->data; } public final function getSelected() { return $this->selected; } } }