public static function update($cacheName = "") { $updateList = empty($cacheName) ? array() : (is_array($cacheName) ? $cacheName : array($cacheName)); if (!$updateList) { $cacheDir = Ibos::getPathOfAlias(self::CACHE_ALIAS); $cacheDirHandle = dir($cacheDir); while ($entry = $cacheDirHandle->read()) { $isProviderFile = preg_match("/^([\\_\\w]+)CacheProvider\\.php\$/", $entry, $matches) && substr($entry, -4) == ".php" && is_file($cacheDir . "/" . $entry); if (!in_array($entry, array(".", "..")) && $isProviderFile) { $class = basename($matches[0], ".php"); if (class_exists($class)) { Ibos::app()->attachBehavior("onUpdateCache", array("class" => self::CACHE_ALIAS . "." . $class)); } } } } else { foreach ($updateList as $entry) { $owner = ucfirst($entry) . "CacheProvider"; if (class_exists($owner)) { Ibos::app()->attachBehavior("onUpdateCache", array("class" => self::CACHE_ALIAS . "." . $owner)); } } } if (Ibos::app()->hasEventHandler("onUpdateCache")) { Ibos::app()->raiseEvent("onUpdateCache", new CEvent(Ibos::app())); } }
protected function init() { Ibos::setPathOfAlias("engineDriver", Ibos::getPathOfAlias("ext.enginedriver.sae")); $alias = Ibos::getPathOfAlias("engineDriver"); $classes = array("CMemCache" => $alias . "/caching/CMemCache.php", "CDbCommand" => $alias . "/db/CDbCommand.php", "CDbConnection" => $alias . "/db/CDbConnection.php"); Ibos::$classMap = CMap::mergeArray(Ibos::$classMap, $classes); Ibos::import("engineDriver.*"); }
public function init() { $widgetPath = Ibos::getPathOfAlias($this->widgetPath); Ibos::setPathOfAlias("wfwidget", $widgetPath); }
public static function getModulePath() { static $path; if (!$path) { $path = Ibos::getPathOfAlias("application") . self::DS . self::MODULE_ALIAS . self::DS; } return $path; }
private function parseTemplate($_data) { $user = User::model()->fetchByUid($_data["uid"]); $_data["data"] = unserialize($_data["feeddata"]); $var = $_data["data"]; if (!empty($var["attach_id"])) { $var["attachInfo"] = AttachUtil::getAttach($var["attach_id"]); $attachUrl = FileUtil::getAttachUrl(); foreach ($var["attachInfo"] as $ak => $av) { $_attach = array("attach_id" => $av["aid"], "attach_name" => $av["filename"], "attach_url" => FileUtil::fileName($attachUrl . "/" . $av["attachment"]), "extension" => StringUtil::getFileExt($av["filename"]), "size" => $av["filesize"]); if ($_data["type"] == "postimage") { $_attach["attach_small"] = WbCommonUtil::getThumbImageUrl($av, WbConst::ALBUM_DISPLAY_WIDTH, WbConst::ALBUM_DISPLAY_HEIGHT); $_attach["attach_middle"] = WbCommonUtil::getThumbImageUrl($av, WbConst::WEIBO_DISPLAY_WIDTH, WbConst::WEIBO_DISPLAY_HEIGHT); } $var["attachInfo"][$ak] = $_attach; } } $var["uid"] = $_data["uid"]; $var["actor"] = "<a href='{$user["space_url"]}' data-toggle='usercard' data-param=\"uid={$user["uid"]}\">{$user["realname"]}</a>"; $var["actor_uid"] = $user["uid"]; $var["actor_uname"] = $user["realname"]; $var["feedid"] = $_data["feedid"]; if (!empty($_data["rowid"])) { empty($_data["table"]) && ($_data["table"] = "feed"); $var["sourceInfo"] = Source::getSourceInfo($_data["table"], $_data["rowid"], false, $_data["module"]); } else { $var["sourceInfo"] = null; } $feedTemplateAlias = "application.modules.message.config.feed.{$_data["type"]}Feed"; $file = Ibos::getPathOfAlias($feedTemplateAlias); if (!file_exists($file . ".php")) { $feedTemplateAlias = "application.modules.message.config.feed.postFeed"; } $feedXmlContent = Ibos::app()->getController()->renderPartial($feedTemplateAlias, $var, true); $s = simplexml_load_string($feedXmlContent); if (!$s) { return false; } $result = $s->xpath("//feed[@type='" . StringUtil::filterCleanHtml($_data["type"]) . "']"); $actions = (array) $result[0]->feedAttr; $return["content"] = $var["content"]; if (isset($var["attach_id"])) { $return["attach_id"] = $var["attach_id"]; } $return["userInfo"] = $user; $return["title"] = trim((string) $result[0]->title); $return["body"] = trim((string) $result[0]->body); $return["info"] = trim((string) $result[0]["info"]); $return["body"] = StringUtil::parseHtml($return["body"]); $return["api_source"] = $var["sourceInfo"]; $return["actions"] = $actions["@attributes"]; if (!$this->notDel($_data["module"], $_data["type"], $_data["rowid"])) { $return["body"] = Ibos::lang("Info already delete", "message.default"); } return $return; }