/** * @return mixed */ 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 $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)) { $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)) { 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_var_set($value, $setting, $method); } } $this->manage(); } } }
/** * @return mixed */ 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 $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) ? 1 : 0); } elseif ('delete' == $this->action && !in_array($this->action, $this->actions_disabled)) { $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(); } elseif (isset($this->actions_custom[$this->action]) && is_callable($this->actions_custom[$this->action])) { return call_user_func_array($this->actions_custom[$this->action], array(&$this, $this->id)); } elseif (isset($this->actions_custom[$this->action]) && (is_array($this->actions_custom[$this->action]) && isset($this->actions_custom[$this->action]['callback']) && is_callable($this->actions_custom[$this->action]['callback']))) { return call_user_func_array($this->actions_custom[$this->action]['callback'], array(&$this, $this->id)); } elseif (!in_array('manage', $this->actions_disabled)) { $this->manage(); } // handle session / user persistent settings for show_per_page, orderby, search, and filters $methods = array('session', 'user'); 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'])) { // save this if we have a default index set $value = $this->orderby['default'] . ' ' . (false === strpos($this->orderby['default'], ' ') ? $this->orderby_dir : ''); } else { $value = ''; } } else { $value = $this->{$setting}; } pods_var_set($value, $setting, $method); } } }