function add_to_context($data) { //$class = class_exists('\Natty\Model\Globals') ? '\Natty\Model\Globals' : '\WPSW\Core\Model\Globals'; //$data['globals'] = new \Yare\Yare('WP_Option'); //pc($data, 'globals'); $data['request'] = Yare::request(); return $data; }
public function __construct(array $args) { if (!isset($args['table'])) { throw new Exception("Error Processing Request", 1); } $table = array_pull($args, 'table'); if (!in_array($table, array('posts', 'terms', 'comments', 'users'))) { throw new Exception("Error Processing Request", 1); } $fn = "get_{$table}"; $this->model = array_pull($args, 'model', 'Model'); $this->args = $args; $this->results = $this->{$fn}(); $this->request = Yare::request(); }