public function getCallbackURL() { $params = ['agent' => ClassFinder::getClassBasename($this)]; if (isset($_GET['external_token'])) { $params['external_token'] = Request::getString($_GET['external_token']); } if (isset($this->backUrl)) { $params['backurl'] = $this->backUrl; } return $this->req->getBaseUrl() . '/component/Account/ExternalAuthRedirect/json?' . http_build_query($params); }
public function defaultControllerHandler($name) { $class = '\\WakePHP\\Actions\\' . ClassFinder::getClassBasename($this) . '\\' . $name; if (class_exists($class)) { $action = new $class(); $action->setAppInstance($this->appInstance); $action->setRequest($this->req); $action->setComponent($this); $action->perform(); } else { $this->req->setResult(array('errmsg' => 'Unknown controller.')); } }
/** * @param Request $req */ public function __construct($req) { $this->req = $req; $this->appInstance = $req->appInstance; $this->dbname =& $this->appInstance->dbname; Daemon::log(__CLASS__ . ' up.'); $this->db = $this->appInstance->db; $this->ORM = new MUChat($this); $this->tags = array(); $this->minMsgInterval = 1; $this->cache = \PHPDaemon\Clients\Memcache\Pool::getInstance(); $this->ipcId = sprintf('%x', crc32(Daemon::$process->pid . '-' . microtime(true))); $my_class = ClassFinder::getClassBasename($this); $this->config = isset($this->appInstance->config->{$my_class}) ? $this->appInstance->config->{$my_class} : null; $defaults = $this->getConfigDefaults(); if ($defaults) { $this->processDefaultConfig($defaults); } $this->dbname = $this->config->dbname->value; $this->init(); $this->onReady(); }
public function handleException($e) { if ($this->cmpName !== null) { if ($this->triggerAndCount('exception', $e)) { Daemon::log('handle exception trigger true'); return true; } $this->setResult(['exception' => is_callable([$e, 'toArray']) ? $e->toArray() : ['type' => ClassFinder::getClassBasename($e), 'code' => $e->getCode(), 'msg' => $e->getMessage()]]); $this->finish(); if (!$e instanceof \WakePHP\Exceptions\Generic || !$e->isSilent()) { Daemon::log('Debug: ' . $e . ': ' . $e->getTraceAsString()); } return true; } }
public function toArray() { return ['type' => ClassFinder::getClassBasename($this), 'code' => $this->getCode(), 'msg' => $this->getMessage(), 'critical' => $this->critical]; }
/** * @param WakePHP $appInstance */ public function __construct($appInstance) { $this->appInstance = $appInstance; $this->name = ClassFinder::getClassBasename($this); $this->init(); }
public function __construct($cond, $objOrCb, $orm) { $this->orm = $orm; $this->appInstance = $orm->appInstance; $this->cond($cond instanceof \MongoId ? ['_id' => $cond] : $cond); $this->type = ClassFinder::getClassBasename($this); $this->construct(); if (is_array($objOrCb) && !isset($objOrCb[0])) { $this->create($objOrCb); } elseif (is_callable($objOrCb)) { $this->fetch($objOrCb); } elseif (is_array($objOrCb)) { $this->create($objOrCb); } }