/** * @see \wcf\system\dashboard\box\IDashboardBox::init() */ public function init(DashboardBox $box, IPage $page) { parent::init($box, $page); //visitors of the last 604800 sec = 1 week $this->visits = VisitCountHandler::getInstance()->getVisitors(TIME_NOW - 604800, TIME_NOW); $this->fetched(); }
/** * @see \wcf\page\IPage::readData() */ public function readData() { parent::readData(); VisitCountHandler::getInstance()->count(); $this->fileReader = new FileReader($this->file->getLocation(), array('filename' => $this->file->getTitle(), 'mimeType' => $this->file->fileType, 'filesize' => $this->file->filesize, 'showInline' => in_array($this->file->fileType, self::$inlineMimeTypes), 'enableRangeSupport' => false, 'lastModificationTime' => $this->file->uploadTime, 'expirationDate' => TIME_NOW + 31536000, 'maxAge' => 31536000)); // count downloads $fileEditor = new FileEditor($this->file); $fileEditor->updateCounters(array('downloads' => 1)); }
public function readData() { parent::readData(); VisitCountHandler::getInstance()->count(); WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('cms.page.news'), LinkHandler::getInstance()->getLink('NewsCategoryList', array('application' => 'cms')))); // get categories $categoryTree = new NewsCategoryNodeTree('de.codequake.cms.category.news'); $this->categoryList = $categoryTree->getIterator(); $this->categoryList->setMaxDepth(0); }
/** * @see \wcf\page\IPage::readData() */ public function readData() { parent::readData(); // set dates if (isset($_POST['startDate'])) { $this->startDate = strtotime($_POST['startDate']); } if (isset($_POST['endDate'])) { $this->endDate = strtotime($_POST['endDate']); } if ($this->startDate == 0) { $this->startDate = TIME_NOW - 604800; } if ($this->endDate == 0) { $this->endDate = TIME_NOW; } // get stats $this->visits = VisitCountHandler::getInstance()->getVisitors($this->startDate, $this->endDate); foreach ($this->visits as $visit) { $browsers = @unserialize($visit['visitors']['browsers']); if (empty($browsers)) { $browsers = array(); } foreach ($browsers as $key => $value) { $this->browsers[$key] = array('visits' => isset($this->browsers[$key]['visits']) ? $this->browsers[$key]['visits'] + $value : $value); } $platforms = @unserialize($visit['visitors']['platforms']); if (empty($platforms)) { $platforms = array(); } foreach ($platforms as $key => $value) { $this->platforms[$key] = array('visits' => isset($this->platforms[$key]['visits']) ? $this->platforms[$key]['visits'] + $value : $value); } $devices = @unserialize($visit['visitors']['devices']); if (empty($devices)) { $devices = array(); } foreach ($devices as $key => $value) { $this->devices[$key] = array('visits' => isset($this->devices[$key]['visits']) ? $this->devices[$key]['visits'] + $value : $value); } } // read pages $list = new PageList(); $list->sqlOrderBy = 'page.clicks DESC'; $list->sqlLimit = '8'; $list->readObjects(); $this->pages = $list->getObjects(); // user online list $this->usersOnlineList = new UsersOnlineList(); $this->usersOnlineList->readStats(); $this->usersOnlineList->readObjects(); }
public function readData() { parent::readData(); VisitCountHandler::getInstance()->count(); WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('cms.page.news'), LinkHandler::getInstance()->getLink('NewsCategoryList', array('application' => 'cms')))); $this->commentObjectTypeID = CommentHandler::getInstance()->getObjectTypeID('de.codequake.cms.news.comment'); $this->commentManager = CommentHandler::getInstance()->getObjectType($this->commentObjectTypeID)->getProcessor(); $this->commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->commentObjectTypeID, $this->newsID); $newsEditor = new NewsEditor($this->news->getDecoratedObject()); $newsEditor->update(array('clicks' => $this->news->clicks + 1)); // get Tags if (MODULE_TAGGING) { $this->tags = $this->news->getTags(); } if ($this->news->teaser != '') { MetaTagHandler::getInstance()->addTag('description', 'description', $this->news->teaser); } else { MetaTagHandler::getInstance()->addTag('description', 'description', StringUtil::decodeHTML(StringUtil::stripHTML($this->news->getExcerpt()))); } if (!empty($this->tags)) { MetaTagHandler::getInstance()->addTag('keywords', 'keywords', implode(',', $this->tags)); } MetaTagHandler::getInstance()->addTag('og:title', 'og:title', $this->news->subject . ' - ' . WCF::getLanguage()->get(PAGE_TITLE), true); MetaTagHandler::getInstance()->addTag('og:url', 'og:url', LinkHandler::getInstance()->getLink('News', array('application' => 'cms', 'object' => $this->news->getDecoratedObject())), true); MetaTagHandler::getInstance()->addTag('og:type', 'og:type', 'article', true); if ($this->news->getImage() != null) { MetaTagHandler::getInstance()->addTag('og:image', 'og:image', $this->news->getImage()->getLink(), true); } if ($this->news->getUserProfile()->facebook != '') { MetaTagHandler::getInstance()->addTag('article:author', 'article:author', 'https://facebook.com/' . $this->news->getUserProfile()->facebook, true); } if (FACEBOOK_PUBLIC_KEY != '') { MetaTagHandler::getInstance()->addTag('fb:app_id', 'fb:app_id', FACEBOOK_PUBLIC_KEY, true); } MetaTagHandler::getInstance()->addTag('og:description', 'og:description', StringUtil::decodeHTML(StringUtil::stripHTML($this->news->getExcerpt())), true); if ($this->news->isNew()) { $newsAction = new NewsAction(array($this->news->getDecoratedObject()), 'markAsRead', array('viewableNews' => $this->news)); $newsAction->executeAction(); } // fetch likes if (MODULE_LIKE) { $objectType = LikeHandler::getInstance()->getObjectType('de.codequake.cms.likeableNews'); LikeHandler::getInstance()->loadLikeObjects($objectType, array($this->newsID)); $this->likeData = LikeHandler::getInstance()->getLikeObjects($objectType); } }
/** * @see \wcf\page\IPage::show() */ public function show() { parent::show(); // register visit VisitCountHandler::getInstance()->count(); // count click $pageEditor = new PageEditor($this->page); $pageEditor->updateCounters(array('clicks' => 1)); }