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


PHP Entity::getFromX方法代码示例

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


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

示例1: getContent

 function getContent()
 {
     $subject = $this->getInput('q');
     $types = $this->getInput('types');
     $subject = trim($subject);
     $offset = (int) $this->getInput('offset');
     if (empty($types)) {
         $types = '!Idno\\Entities\\ActivityStreamPost';
     } else {
         if (!is_array($types)) {
             $types = [$types];
         }
         $types[] = '!Idno\\Entities\\ActivityStreamPost';
     }
     if (!empty($subject)) {
         $regexObj = new \MongoRegex("/" . addslashes($subject) . "/i");
         $items = \Idno\Common\Entity::getFromX($types, ['$or' => [['body' => $regexObj], ['title' => $regexObj], ['description' => $regexObj]]], [], 10, $offset);
         $count = \Idno\Common\Entity::countFromX($types, ['$or' => [['body' => $regexObj], ['title' => $regexObj], ['description' => $regexObj]]]);
     } else {
         $items = [];
         $subject = 'Search';
         $count = 0;
     }
     $t = \Idno\Core\site()->template();
     $t->__(array('title' => $subject, 'body' => $t->__(array('subject' => $subject, 'items' => $items, 'count' => $count, 'offset' => $offset))->draw('entity/search')))->drawPage();
 }
开发者ID:phpsource,项目名称:idno,代码行数:26,代码来源:Search.php

示例2: getContent

 function getContent()
 {
     if (!empty($this->arguments[0])) {
         $user = \Idno\Entities\User::getByHandle($this->arguments[0]);
     }
     if (empty($user)) {
         $this->noContent();
     }
     // Users own their own profiles
     $this->setOwner($user);
     $types = \Idno\Common\ContentType::getRegisteredClasses();
     $offset = (int) $this->getInput('offset');
     $count = \Idno\Common\Entity::countFromX($types, array('owner' => $user->getUUID()));
     $feed = \Idno\Common\Entity::getFromX($types, array('owner' => $user->getUUID()), array(), \Idno\Core\Idno::site()->config()->items_per_page, $offset);
     $last_modified = $user->updated;
     if (!empty($feed) && is_array($feed)) {
         if ($feed[0]->updated > $last_modified) {
             $last_modified = $feed[0]->updated;
         }
     }
     $this->setLastModifiedHeader($last_modified);
     $t = \Idno\Core\Idno::site()->template();
     $t->__(array('title' => $user->getTitle(), 'body' => $t->__(array('user' => $user, 'items' => $feed, 'count' => $count, 'offset' => $offset))->draw('entity/User/profile'), 'description' => 'The ' . \Idno\Core\Idno::site()->config()->title . ' profile for ' . $user->getTitle()))->drawPage();
 }
开发者ID:smartboyathome,项目名称:Known,代码行数:24,代码来源:View.php

示例3: date

                echo date('r', $user->created);
                ?>
"
                                                  class="dt-published"><?php 
                echo date('r', $user->created);
                ?>
</time>
                                        </small>
                                    </p>
                                </div>
                                <div class="col-sm-2 col-xs-6">
                                    <p class="user-tbl">
                                        <small><strong>Last update posted</strong>
                                            <br>
                                            <?php 
                if ($feed = \Idno\Common\Entity::getFromX(null, ['owner' => $user->getUUID()], array(), 1, 0)) {
                    ?>
                                                    <time datetime="<?php 
                    echo date('r', $feed[0]->updated);
                    ?>
"
                                                          class="dt-published"><?php 
                    echo date('r', $feed[0]->updated);
                    ?>
</time>
                                                <?php 
                } else {
                    ?>
                                                    Never
                                                    <?php 
                }
开发者ID:smartboyathome,项目名称:Known,代码行数:31,代码来源:users.tpl.php

示例4: getContent

 function getContent()
 {
     $query = $this->getInput('q');
     $offset = (int) $this->getInput('offset');
     $types = $this->getInput('types');
     $friendly_types = array();
     // Check for an empty site
     if (!\Idno\Entities\User::get()) {
         $this->forward(\Idno\Core\Idno::site()->config()->getURL() . 'begin/');
     }
     // Set the homepage owner for single-user sites
     if (!$this->getOwner() && \Idno\Core\Idno::site()->config()->single_user) {
         $owners = \Idno\Entities\User::get(['admin' => true]);
         if (count($owners) === 1) {
             $this->setOwner($owners[0]);
         } else {
             \Idno\Core\Idno::site()->logging()->warning('Expected exactly 1 admin user for single-user site; got ' . count($owners));
         }
     }
     if (!empty($this->arguments[0])) {
         // If we're on the friendly content-specific URL
         if ($friendly_types = explode('/', $this->arguments[0])) {
             $friendly_types = array_filter($friendly_types);
             if (empty($friendly_types) && !empty($query)) {
                 $friendly_types = array('all');
             }
             $types = array();
             // Run through the URL parameters and set content types appropriately
             foreach ($friendly_types as $friendly_type) {
                 if ($friendly_type == 'all') {
                     $types = \Idno\Common\ContentType::getRegisteredClasses();
                     break;
                 }
                 if ($content_type_class = \Idno\Common\ContentType::categoryTitleToClass($friendly_type)) {
                     $types[] = $content_type_class;
                 }
             }
         }
     } else {
         // If user has content-specific preferences, do something with $friendly_types
         if (empty($query)) {
             $types = \Idno\Core\Idno::site()->config()->getHomepageContentTypes();
         }
     }
     $search = array();
     if (!empty($query)) {
         $search = \Idno\Core\Idno::site()->db()->createSearchArray($query);
     }
     if (empty($types)) {
         $types = \Idno\Common\ContentType::getRegisteredClasses();
     } else {
         $types = (array) $types;
     }
     $count = \Idno\Common\Entity::countFromX($types, array());
     $feed = \Idno\Common\Entity::getFromX($types, $search, array(), \Idno\Core\Idno::site()->config()->items_per_page, $offset);
     if (\Idno\Core\Idno::site()->session()->isLoggedIn()) {
         $create = \Idno\Common\ContentType::getRegistered();
         // If we can't create an object of this type, hide from the button bar
         foreach ($create as $key => $obj) {
             if (!$obj->createable) {
                 unset($create[$key]);
             }
         }
     } else {
         $create = false;
     }
     if (!empty(\Idno\Core\Idno::site()->config()->description)) {
         $description = \Idno\Core\Idno::site()->config()->description;
     } else {
         $description = 'An independent social website, powered by Known.';
     }
     // If we have a feed, set our last modified flag to the time of the latest returned entry
     if (!empty($feed)) {
         if (is_array($feed)) {
             $feed = array_filter($feed);
             $this->setLastModifiedHeader(reset($feed)->updated);
         }
     }
     if (!empty(\Idno\Core\Idno::site()->config()->homepagetitle)) {
         $title = \Idno\Core\Idno::site()->config()->homepagetitle;
     } else {
         $title = \Idno\Core\Idno::site()->config()->title;
     }
     $t = \Idno\Core\Idno::site()->template();
     $t->__(array('title' => $title, 'description' => $description, 'content' => $friendly_types, 'body' => $t->__(array('items' => $feed, 'contentTypes' => $create, 'offset' => $offset, 'count' => $count, 'subject' => $query, 'content' => $friendly_types))->draw('pages/home')))->drawPage();
 }
开发者ID:smartboyathome,项目名称:Known,代码行数:86,代码来源:Homepage.php

示例5: getExportRSS

 /**
  * Retrieve all posts as an RSS feed
  * @param bool|true $hide_private Should we hide private posts? Default: true.
  * @param string $user_uuid User UUID to export for. Default: all users.
  * @return bool|false|string
  */
 static function getExportRSS($hide_private = true, $user_uuid = '')
 {
     $types = \Idno\Common\ContentType::getRegisteredClasses();
     if ($hide_private) {
         $groups = ['PUBLIC'];
     } else {
         $groups = [];
     }
     if (!empty($user_uuid)) {
         $search = ['owner' => $user_uuid];
         if ($user = User::getByUUID($user_uuid)) {
             $title = $user->getTitle();
             $description = $user->getDescription();
             $base_url = $user_uuid;
         }
     } else {
         $search = [];
         $title = Idno::site()->config()->getTitle();
         $description = Idno::site()->config()->getDescription();
         $base_url = Idno::site()->config()->getDisplayURL();
     }
     if ($feed = \Idno\Common\Entity::getFromX($types, $search, array(), PHP_INT_MAX - 1, 0, $groups)) {
         $rss_theme = new Template();
         $rss_theme->setTemplateType('rss');
         return $rss_theme->__(array('title' => $title, 'description' => $description, 'body' => $rss_theme->__(array('items' => $feed, 'offset' => 0, 'count' => sizeof($feed), 'subject' => [], 'nocdata' => true, 'base_url' => $base_url))->draw('pages/home')))->drawPage(false);
     }
     return false;
 }
开发者ID:kylewm,项目名称:Known,代码行数:34,代码来源:Migration.php


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