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


PHP Node::get方法代码示例

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


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

示例1: get

 public function get($index, $default = null)
 {
     $path = $this->getPath($index);
     $value = $this->root->get($path, $default);
     if ($value instanceof Leaf) {
         return $value->getValue();
     }
     return $default;
 }
开发者ID:bahulneel,项目名称:phonon,代码行数:9,代码来源:Trie.php

示例2: explode

 function get_from_scad_txt($s)
 {
     //разделяем документ на строки и удаляем последнюю
     $mas = explode('/', $s);
     array_splice($mas, -1, 1);
     //перебор строк
     foreach ($mas as $value) {
         $node = new Node();
         $node->get($value);
         //запись в базу данных
         mysql_query("INSERT INTO " . nodes . " SET\n                      removed = '{$node->removed}',\n                      x = '{$node->x}',\n                      y = '{$node->y}',\n                      z = '{$node->z}'");
     }
 }
开发者ID:vokson,项目名称:scad.local,代码行数:13,代码来源:class_TNode.php

示例3: calculateDistances

 /**
  * Calculates distances
  *
  * @param Node   $node
  * @param Node[] $neighbors
  */
 protected function calculateDistances(Node $node, array $neighbors)
 {
     $this->calculateRanges();
     foreach ($neighbors as $neighbor) {
         $deltas = array();
         foreach ($this->schema->getFields() as $field) {
             list($min, $max) = $this->ranges[$field];
             $range = $max - $min;
             $delta = $neighbor->get($field) - $node->get($field);
             $delta = $delta / $range;
             $deltas[$field] = $delta;
         }
         $total = 0;
         foreach ($deltas as $delta) {
             $total += $delta * $delta;
         }
         $neighbor->setDistance(sqrt($total));
     }
 }
开发者ID:fieg,项目名称:knn,代码行数:25,代码来源:DataSet.php

示例4: getList

 public static function getList($filters = array(), $published = true)
 {
     $values = array(':lang' => \LANG);
     $list = array();
     $sql = "\n                SELECT\n                    post.id as id,\n                    post.blog as blog,\n                    IFNULL(post_lang.title, post.title) as title,\n                    IFNULL(post_lang.text, post.text) as `text`,\n                    IFNULL(post_lang.legend, post.legend) as `legend`,\n                    post.image as `image`,\n                    post.media as `media`,\n                    DATE_FORMAT(post.date, '%d-%m-%Y') as fecha,\n                    post.publish as publish,\n                    post.home as home,\n                    post.footer as footer,\n                    post.author as author,\n                    blog.type as owner_type,\n                    blog.owner as owner_id\n                FROM    post\n                INNER JOIN blog\n                    ON  blog.id = post.blog\n                LEFT JOIN post_lang\n                    ON  post_lang.id = post.id\n                    AND post_lang.lang = :lang\n                ";
     if (in_array($filters['show'], array('all', 'home', 'footer'))) {
         $sql .= " WHERE blog.id IS NOT NULL\n                ";
     } elseif ($filters['show'] == 'updates') {
         $sql .= " WHERE blog.type = 'project'\n                ";
     } else {
         $sql .= " WHERE blog.type = 'node'\n                ";
     }
     if (!empty($filters['blog'])) {
         $sql .= " AND post.blog = :blog\n                ";
         $values[':blog'] = $filters['blog'];
     }
     if (!empty($filters['tag'])) {
         $sql .= " AND post.id IN (SELECT post FROM post_tag WHERE tag = :tag)\n                ";
         $values[':tag'] = $filters['tag'];
     }
     if (!empty($filters['author'])) {
         $sql .= " AND post.author = :author\n                ";
         $values[':author'] = $filters['author'];
     }
     // solo las publicadas
     if ($published || $filters['show'] == 'published') {
         $sql .= " AND post.publish = 1\n                ";
         if (empty($filters['blog'])) {
             $sql .= " AND blog.owner IN (SELECT id FROM node WHERE active = 1)\n                    AND blog.owner != 'testnode'\n                ";
         }
     }
     // solo las del propio blog
     if ($filters['show'] == 'owned') {
         $sql .= " AND blog.owner = :node\n                ";
         $values[':node'] = $filters['node'];
     }
     // solo las de la portada
     if ($filters['show'] == 'home') {
         if ($filters['node'] == \GOTEO_NODE) {
             $sql .= " AND post.home = 1\n                    ";
         } else {
             $sql .= " AND post.id IN (SELECT post FROM post_node WHERE node = :node)\n                    ";
             $values[':node'] = $filters['node'];
         }
     }
     if ($filters['show'] == 'footer') {
         if ($filters['node'] == \GOTEO_NODE) {
             $sql .= " AND post.footer = 1\n                    ";
         }
     }
     $sql .= "\n                ORDER BY post.date DESC, post.id DESC\n                ";
     $query = static::query($sql, $values);
     foreach ($query->fetchAll(\PDO::FETCH_CLASS, __CLASS__) as $post) {
         // galeria
         $post->gallery = Image::getAll($post->id, 'post');
         $post->image = $post->gallery[0];
         // video
         if (isset($post->media)) {
             $post->media = new Media($post->media);
         }
         $post->num_comments = Post\Comment::getCount($post->id);
         // datos del autor del  post
         switch ($post->owner_type) {
             case 'project':
                 $proj_blog = Project::getMini($post->owner_id);
                 $post->author = $proj_blog->owner;
                 $post->user = $proj_blog->user;
                 $post->owner_name = $proj_blog->name;
                 break;
             case 'node':
                 $post->user = User::getMini($post->author);
                 $node_blog = Node::get($post->owner_id);
                 $post->owner_name = $node_blog->name;
                 break;
         }
         $list[$post->id] = $post;
     }
     return $list;
 }
开发者ID:kenjs,项目名称:Goteo,代码行数:79,代码来源:post.php

示例5: nodePropertiesAreHandledCaseInsensitively

 /**
  * @test
  */
 public function nodePropertiesAreHandledCaseInsensitively()
 {
     $node = new Node(array('id' => 1, 'foo' => 'Foo', 'BAR' => 'Bar'));
     $this->assertSame('Foo', $node->foo);
     $this->assertSame('Foo', $node->get('foo'));
     $this->assertSame('Foo', $node->getFoo());
     $this->assertSame('Bar', $node->bar);
     $this->assertSame('Bar', $node->get('bar'));
     $this->assertSame('Bar', $node->getBar());
 }
开发者ID:bluem,项目名称:tree,代码行数:13,代码来源:NodeTest.php

示例6: testGet4

 /**
  * Generated from @assert ('37.5 0 0.3') ==  array (37.5,0,0.3).
  */
 public function testGet4()
 {
     $this->assertEquals(array(37.5, 0, 0.3), $this->object->get('37.5 0 0.3'));
 }
开发者ID:vokson,项目名称:scad.local,代码行数:7,代码来源:NodeTest.php


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