当前位置: 首页>>代码示例>>PHP>>正文


PHP Entity::getByID方法代码示例

本文整理汇总了PHP中Idno\Common\Entity::getByID方法的典型用法代码示例。如果您正苦于以下问题:PHP Entity::getByID方法的具体用法?PHP Entity::getByID怎么用?PHP Entity::getByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Idno\Common\Entity的用法示例。


在下文中一共展示了Entity::getByID方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getContent

 function getContent()
 {
     if ($staticpages = \Idno\Core\Idno::site()->plugins()->get('StaticPages')) {
         if (!empty($staticpages->getCurrentHomepageId())) {
             $object = \Idno\Common\Entity::getByID($staticpages->getCurrentHomepageId());
             if (empty($object)) {
                 $object = \Idno\Common\Entity::getBySlug($staticpages->getCurrentHomepageId());
             }
             if (empty($object)) {
                 $this->goneContent();
             }
             // From here, we know the object is set
             // Ensure we're talking about pages ...
             if (!$object instanceof \IdnoPlugins\StaticPages\StaticPage) {
                 $this->goneContent();
             }
             // Check that we can see it
             if (!$object->canRead()) {
                 $this->deniedContent();
             }
             // Forward if necessary
             if (!empty($object->forward_url) && !\Idno\Core\Idno::site()->session()->isAdmin()) {
                 $this->forward($object->forward_url);
             }
             $this->setOwner($object->getOwner());
             $this->setPermalink();
             // This is a permalink
             $this->setLastModifiedHeader($object->updated);
             // Say when this was last modified
             $t = \Idno\Core\Idno::site()->template();
             $t->__(array('title' => $object->getTitle(), 'body' => $t->__(array('object' => $object))->draw('staticpages/page'), 'description' => $object->getShortDescription()))->drawPage();
         }
     }
     parent::getContent();
 }
开发者ID:smartboyathome,项目名称:Known,代码行数:35,代码来源:Homepage.php

示例2: setAsHomepage

 /**
  * Sets a static page as the homepage, overwriting the current setting if one is set.
  * @param $pageId
  * @return bool
  */
 function setAsHomepage($pageId)
 {
     if (\Idno\Core\Idno::site()->session()->isLoggedIn()) {
         if (\Idno\Core\Idno::site()->session()->currentUser()->isAdmin()) {
             if (!empty(\Idno\Common\Entity::getByID($pageId))) {
                 \Idno\Core\Idno::site()->config->staticPages['homepage'] = $pageId;
                 return \Idno\Core\Idno::site()->config->save();
             }
         }
     }
     return false;
 }
开发者ID:smartboyathome,项目名称:Known,代码行数:17,代码来源:Main.php

示例3: deleteContent

 function deleteContent()
 {
     if (!empty($this->arguments[0])) {
         $object = \Idno\Common\Entity::getByID($this->arguments[0]);
     }
     if (empty($object)) {
         $this->forward();
     }
     // TODO: 404
     if ($object->delete()) {
         \Idno\Core\Idno::site()->session()->addMessage($object->getTitle() . ' was deleted.');
     }
     $this->forward($_SERVER['HTTP_REFERER']);
 }
开发者ID:smartboyathome,项目名称:Known,代码行数:14,代码来源:View.php

示例4: getContent

 function getContent()
 {
     if (!empty($this->arguments[0])) {
         $object = \Idno\Common\Entity::getByID($this->arguments[0]);
     }
     if (empty($object)) {
         $this->forward();
     }
     // TODO: 404
     if (!$object->canEdit()) {
         $this->forward($object->getURL());
     }
     $t = \Idno\Core\site()->template();
     $t->__(array('title' => $object->getTitle(), 'body' => $object->drawEdit()))->drawPage();
 }
开发者ID:phpsource,项目名称:idno,代码行数:15,代码来源:Edit.php

示例5: postContent

 function postContent()
 {
     if (!empty($this->arguments[0])) {
         $object = \Idno\Common\Entity::getByID($this->arguments[0]);
     }
     if (empty($object)) {
         $this->setResponse(404);
         echo \Idno\Core\Idno::site()->template()->__(array('body' => \Idno\Core\Idno::site()->template()->draw('404'), 'title' => 'Not found'))->drawPage();
         exit;
     }
     if (!$object->canEdit()) {
         $this->setResponse(403);
         echo \Idno\Core\Idno::site()->template()->__(array('body' => \Idno\Core\Idno::site()->template()->draw('403'), 'title' => 'Permission denied'))->drawPage();
         exit;
     }
     $object->unsyndicate();
     \Idno\Core\Idno::site()->session()->addMessage("We removed copies on all the syndicated sites.");
     $this->forward($object->getDisplayURL());
 }
开发者ID:sintoris,项目名称:Known,代码行数:19,代码来源:Withdraw.php

示例6: getContent

 function getContent()
 {
     if (!empty($this->arguments[0])) {
         $object = \Idno\Common\Entity::getByID($this->arguments[0]);
         if (empty($object)) {
             $object = \Idno\Common\Entity::getBySlug($this->arguments[0]);
         }
     }
     if (empty($object)) {
         $this->goneContent();
     }
     $permalink = $object->getUrl() . '/annotations/' . $this->arguments[1];
     $annotation = $object->getAnnotation($permalink);
     $subtype = $object->getAnnotationSubtype($permalink);
     $this->setPermalink();
     // This is a permalink
     $t = \Idno\Core\site()->template();
     $t->__(array('title' => $object->getTitle(), 'body' => $t->__(array('annotation' => $annotation, 'subtype' => $subtype, 'permalink' => $permalink, 'object' => $object))->draw('entity/annotations/shell'), 'description' => $object->getShortDescription()))->drawPage();
 }
开发者ID:phpsource,项目名称:idno,代码行数:19,代码来源:View.php

示例7: getContent

 function getContent()
 {
     if (!empty($this->arguments[0])) {
         $object = \Idno\Common\Entity::getByID($this->arguments[0]);
     }
     if (empty($object)) {
         $this->forward();
     }
     // TODO: 404
     if (!$object->canEdit()) {
         $this->forward($object->getDisplayURL());
     }
     if ($owner = $object->getOwner()) {
         $this->setOwner($owner);
     }
     session_write_close();
     $t = \Idno\Core\Idno::site()->template();
     $t->__(array('title' => $object->getTitle(), 'body' => $t->__(['object' => $object])->draw('entity/editwrapper')))->drawPage();
 }
开发者ID:kreativmind,项目名称:Known,代码行数:19,代码来源:Edit.php

示例8: postContent

 function postContent()
 {
     $this->createGatekeeper();
     if (!empty($this->arguments)) {
         $object = Entity::getByID($this->arguments[0]);
     }
     if ($object) {
         if (!$object->canEdit()) {
             $this->setResponse(403);
             Idno::site()->session()->addErrorMessage("You don't have permission to delete this object.");
         } else {
             if ($object->delete()) {
                 Idno::site()->session()->addMessage($object->getTitle() . ' was deleted.');
             } else {
                 Idno::site()->session()->addErrorMessage("We couldn't delete " . $object->getTitle() . ".");
             }
         }
     }
     $this->forward($_SERVER['HTTP_REFERER']);
 }
开发者ID:kylewm,项目名称:KnownReactions,代码行数:20,代码来源:Delete.php

示例9: postContent

 function postContent()
 {
     $this->gatekeeper();
     if (!empty($this->arguments[0])) {
         $object = \Idno\Common\Entity::getByID($this->arguments[0]);
         if (empty($object)) {
             $object = \Idno\Common\Entity::getBySlug($this->arguments[0]);
         }
     }
     if (empty($object)) {
         $this->goneContent();
     }
     $permalink = $object->getURL() . '/annotations/' . $this->arguments[1];
     if ($object->canEditAnnotation($permalink)) {
         if ($object->removeAnnotation($permalink) && $object->save()) {
             //\Idno\Core\site()->session()->addMessage('The annotation was deleted.');
         }
     }
     $this->forward($object->getURL() . '#comments');
 }
开发者ID:jeffery,项目名称:idno,代码行数:20,代码来源:Delete.php

示例10: postContent

 function postContent()
 {
     $this->gatekeeper();
     if (!empty($this->arguments[0])) {
         $object = \Idno\Common\Entity::getByID($this->arguments[0]);
         if (empty($object)) {
             $object = \Idno\Common\Entity::getBySlug($this->arguments[0]);
         }
     }
     if (empty($object)) {
         $this->goneContent();
     }
     $permalink = $object->getUrl() . '/annotations/' . $this->arguments[1];
     if ($object->canEdit()) {
         if ($object->removeAnnotation($permalink) && $object->save()) {
             \Idno\Core\site()->session()->addMessage('Annotation ' . $permalink . ' was deleted.');
         }
     }
     $this->forward($_SERVER['HTTP_REFERER']);
 }
开发者ID:phpsource,项目名称:idno,代码行数:20,代码来源:Delete.php

示例11: post

 function post()
 {
     \Idno\Core\Idno::site()->logging->debug("Pubsub: Ping received");
     // Since we've overloaded post, we need to parse the arguments
     $arguments = func_get_args();
     if (!empty($arguments)) {
         $this->arguments = $arguments;
     }
     // Find users
     if (!empty($this->arguments[0])) {
         $subscriber = \Idno\Common\Entity::getByID($this->arguments[0]);
     }
     if (empty($subscriber) || !$subscriber instanceof \Idno\Entities\User) {
         $this->goneContent();
     }
     if (!empty($this->arguments[1])) {
         $subscription = \Idno\Common\Entity::getByID($this->arguments[1]);
     }
     if (empty($subscription) || !$subscription instanceof \Idno\Entities\User) {
         $this->goneContent();
     }
     \Idno\Core\Idno::site()->logging->debug("Pubsub: Ping received, pinging out...");
     \Idno\Core\Idno::site()->triggerEvent('pubsubhubbub/ping', array('subscriber' => $subscriber, 'subscription' => $subscription, 'data' => trim(file_get_contents("php://input"))));
 }
开发者ID:smartboyathome,项目名称:Known,代码行数:24,代码来源:Callback.php


注:本文中的Idno\Common\Entity::getByID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。