public function __get($varName) { if ($varName == 'pod') { if (!$this->podImpl) { $this->podImpl = PodPool::get_pod($this->type); } return $this->podImpl; } }
public function before_delete($post_id) { $mp_post_id_c_reference = ReferencePod::get_dependencies_of($post_id); if ($mp_post_id_c_reference) { $rgpost_id_by_type = array(); foreach ($mp_post_id_c_reference as $post_idT => $c) { $status = get_post_status($post_idT); if ($status && $status != 'trash') { $post_type = get_post_type($post_idT); if (!$rgpost_id_by_type[$post_type]) { $rgpost_id_by_type[$post_type] = array($post_idT); } else { $rgpost_id_by_type[$post_type][] = $post_idT; } } } if ($rgpost_id_by_type) { echo '<p>Cannot delete "' . get_the_title($post_id) . '", because there are references to it.</p>'; foreach ($rgpost_id_by_type as $post_type => $rgpost_idT) { /**@var CompoundPod pod*/ $pod = PodPool::get_pod($post_type); if ($pod) { echo '<p>In "' . $pod->st_display_name . '": '; } echo '<ul>'; foreach ($rgpost_idT as $post_idT) { echo '<li>'; edit_post_link(get_the_title($post_idT), '<span>', '</span>', $post_idT); echo '</li>'; } echo '</ul></p>'; } } } }
static function ajax_add_new_item() { ListFieldPod::editor_for_item(PodPool::get_pod($_POST['post_type']), $_POST['id'], uniqid('0x'), ''); exit; }