public function go()
{
$this->do_hook('go');
$_GET = pods_unsanitize($_GET);
// fix wp sanitization
$_POST = pods_unsanitize($_POST);
// fix wp sanitization
if (false !== $this->css) {
?>
<link type="text/css" rel="stylesheet" href="<?php
echo esc_url($this->css);
?>
" />
<?php
}
if (false !== $this->wpcss) {
$stylesheets = array('global', 'wp-admin', $this->wpcss);
foreach ($stylesheets as $style) {
if (!wp_style_is($style, 'queue') && !wp_style_is($style, 'to_do') && !wp_style_is($style, 'done')) {
wp_enqueue_style($style);
}
}
}
$this->ui_page = array($this->action);
if ('add' == $this->action && !in_array($this->action, $this->actions_disabled)) {
$this->ui_page[] = 'form';
if ('create' == $this->do && $this->save && !in_array($this->do, $this->actions_disabled) && !empty($_POST)) {
$this->ui_page[] = $this->do;
$this->save(true);
$this->manage();
} else {
$this->add();
}
} elseif ('edit' == $this->action && !in_array($this->action, $this->actions_disabled) || 'duplicate' == $this->action && !in_array($this->action, $this->actions_disabled)) {
$this->ui_page[] = 'form';
if ('save' == $this->do && $this->save && !empty($_POST)) {
$this->save();
}
$this->edit('duplicate' == $this->action && !in_array($this->action, $this->actions_disabled) ? true : false);
} elseif ('delete' == $this->action && !in_array($this->action, $this->actions_disabled) && false !== wp_verify_nonce($this->_nonce, 'pods-ui-action-delete')) {
$this->delete($this->id);
$this->manage();
} elseif ('reorder' == $this->action && !in_array($this->action, $this->actions_disabled) && false !== $this->reorder['on']) {
if ('save' == $this->do) {
$this->ui_page[] = $this->do;
$this->reorder();
}
$this->manage(true);
} elseif ('save' == $this->do && $this->save && !in_array($this->do, $this->actions_disabled) && !empty($_POST)) {
$this->ui_page[] = $this->do;
$this->save();
$this->manage();
} elseif ('create' == $this->do && $this->save && !in_array($this->do, $this->actions_disabled) && !empty($_POST)) {
$this->ui_page[] = $this->do;
$this->save(true);
$this->manage();
} elseif ('view' == $this->action && !in_array($this->action, $this->actions_disabled)) {
$this->view();
} else {
if (isset($this->actions_custom[$this->action])) {
$more_args = false;
if (is_array($this->actions_custom[$this->action]) && isset($this->actions_custom[$this->action]['more_args'])) {
$more_args = $this->actions_custom[$this->action]['more_args'];
}
$row = $this->row;
if (empty($row)) {
$row = $this->get_row();
}
if ($this->restricted($this->action, $row) || $more_args && !empty($more_args['nonce']) && false === wp_verify_nonce($this->_nonce, 'pods-ui-action-' . $this->action)) {
return $this->error(sprintf(__('<strong>Error:</strong> You do not have access to this %s.', 'pods'), $this->item));
} elseif ($more_args && false !== $this->callback_action(true, $this->action, $this->id, $row)) {
return null;
} elseif (false !== $this->callback_action(true, $this->action, $this->id)) {
return null;
}
}
if (!in_array('manage', $this->actions_disabled)) {
// handle session / user persistent settings for show_per_page, orderby, search, and filters
$methods = array('session', 'user');
// @todo fix this to set ($this) AND save (setting)
foreach ($methods as $method) {
foreach ($this->{$method} as $setting) {
if ('show_per_page' == $setting) {
$value = $this->limit;
} elseif ('orderby' == $setting) {
if (empty($this->orderby)) {
$value = '';
} elseif (isset($this->orderby['default'])) {
$value = $this->orderby['default'] . ' ' . (false === strpos($this->orderby['default'], ' ') ? $this->orderby_dir : '');
} else {
$value = '';
}
} else {
$value = $this->{$setting};
}
pods_v_set($value, $setting, $method);
}
}
$this->manage();
}
}
}