/*!
Get the N last published nodes matching the specifications of this RSS Export item

\param number of objects to fetch

\return list of Nodes
771857
static function fetchNodeList( $rssSources, $objectListFilter )
    {
        // compose parameters for several subtrees
        if( is_array( $rssSources ) && count( $rssSources ) )
        {
            foreach( $rssSources as $rssSource )
            {
                // Do not include subnodes
                if ( !intval( $rssSource->Subnodes ) )
                {
                    $depth = 1;
                }
                else // Fetch objects even from subnodes
                {
                    $depth = 0;
                }

                $nodesParams[] = array( 'ParentNodeID' => $rssSource->SourceNodeID,
                                        'ResultID' => $rssSource->ID,
                                        'Depth' => $depth,
                                        'DepthOperator' => 'eq',
                                        'MainNodeOnly' => $objectListFilter['main_node_only'],
                                        'ClassFilterType' => 'include',
                                        'ClassFilterArray' => array( intval( $rssSource->ClassID ) )
                                       );
            }

            $listParams = array( 'Limit' => $objectListFilter['number_of_objects'],
                                 'SortBy' => array( 'published', false )
                                );

            $nodeList = eZContentObjectTreeNode::subTreeMultiPaths( $nodesParams, $listParams );
        }
        else
            $nodeList = null;
        return $nodeList;
    }
627267
public function getNrOfCatArticles()
    {
        $sListType = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('ldtype');

        if (is_null($sListType)) {
            $sListType = $this->getConfig()->getConfigParam('sDefaultListDisplayType');
        }

        if ('grid' === $sListType) {
            $aNrOfCatArticles = $this->getConfig()->getConfigParam('aNrofCatArticlesInGrid');
        } else {
            $aNrOfCatArticles = $this->getConfig()->getConfigParam('aNrofCatArticles');
        }

        return $aNrOfCatArticles;
    }
989937
def dump(self):
        
        # Find all nodes manually, as the Keep object isn't aware of new ListItems
        # until they've been synced to the server.
        nodes = []
        for node in self.all():
            nodes.append(node)
            for child in node.children:
                nodes.append(child)
        return {
            'keep_version': self._keep_version,
            'labels': [label.save(False) for label in self.labels()],
            'nodes': [node.save(False) for node in nodes]
        }
67756
function GetContents() {
		$out = '<' . '?xml version="1.0" encoding="UTF-8"?' . '><xml><records>';
		$number = 0;
		foreach ($this->parent->refs as $id => $ref) {
			$out .= '<record>';
			$out .= '<database name="' . $this->endNoteFile . '" path="C:\\' . $this->endNoteFile . '">' . $this->_export($this->endNoteFile) . '</database>';
			$out .= '<source-app name="EndNote" version="16.0">EndNote</source-app>';
			$out .= '<rec-number>' . $number . '</rec-number>';
			$out .= '<foreign-keys><key app="EN" db-id="s55prpsswfsepue0xz25pxai2p909xtzszzv">' . $number . '</key></foreign-keys>';
			if (isset($ref['type']) && $ref['type'] && isset($this->refTypes[$ref['type']]) ) {
				$out .= "<ref-type name=\"{$ref['type']}\">{$this->refTypes[$ref['type']]}</ref-type>";
			} else {
				$out .= '<ref-type name="Journal Article">17</ref-type>';
			}

			$out .= '<contributors><authors>';
				foreach ($ref['authors'] as $author)
					$out .= '<author><style face="normal" font="default" size="100%">' . $this->_export($author) . '</style></author>';
			$out .= '</authors></contributors>';

			$out .= '<titles>';
				$out .= '<title><style face="normal" font="default" size="100%">' . $this->_export($ref['title']) . '</style></title>';
				$out .= '<secondary-title><style face="normal" font="default" size="100%">' . (isset($ref['title-secondary']) && $ref['title-secondary'] ? $this->_export($ref['title-secondary']) : '') . '</style></secondary-title>';
				if (isset($ref['title-short']) && $ref['title-short'])
					$out .= '<short-title><style face="normal" font="default" size="100%">' . $this->_export($ref['title-short']) . '</style></short-title>';
				if (isset($ref['alt-journal']) && $ref['alt-journal'])
					$out .= '<alt-title><style face="normal" font="default" size="100%">' . $this->_export($ref['alt-journal']) . '</style></alt-title>';
			$out .= '</titles>';

				$out .= '<periodical><full-title><style face="normal" font="default" size="100%">' . (isset($ref['periodical-title']) && $ref['periodical-title'] ? $this->_export($ref['periodical-title']) : '') . '</style></full-title></periodical>';

			// Simple key values
			// EndNote field on left, RefLib on right
			foreach (array(
				'access-date' => 'access-date',
				'accession-num' => 'accession-num',
				'auth-address' => 'address',
				'electronic-resource-num' => 'doi',
				'pages' => 'pages',
				'volume' => 'volume',
				'number' => 'number', // issue #
				'section' => 'section',
				'abstract' => 'abstract',
				'isbn' => 'isbn',
				'label' => 'label',
				'caption' => 'caption',
				'language' => 'language',
				'notes' => 'notes',
				'research-notes' => 'research-notes',
				'remote-database-provider' => 'database-provider',
				'remote-database-name' => 'database',
				'work-type' => 'work-type',
				'custom1' => 'custom1',
				'custom2' => 'custom2',
				'custom3' => 'custom3',
				'custom4' => 'custom4',
				'custom5' => 'custom5',
				'custom6' => 'custom6',
				'custom7' => 'custom7',
			) as $enkey => $ourkey)
				if (isset($ref[$ourkey]) && $ref[$ourkey])
					$out .= "<$enkey><style face=\"normal\" font=\"default\" size=\"100%\">" . $this->_export($ref[$ourkey]) . "</style></$enkey>";

			$out .= '<dates>';
				$out .= '<year><style face="normal" font="default" size="100%">' . (isset($ref['year']) && $ref['year'] ? $this->_export($ref['year']) : '') . '</style></year>';
				$out .= '<pub-dates><date><style face="normal" font="default" size="100%">' . (isset($ref['date']) && $ref['date'] ? $this->_export($this->parent->ToDate($ref['date'])) : '') . '</style></date></pub-dates>';
			$out .= '</dates>';

			if (isset($ref['urls']) && $ref['urls']) {
				$out .= '<urls><related-urls>';
					foreach ((array) $ref['urls'] as $url)
						$out .= '<url><style face="normal" font="default" size="100%">' . $this->_export($url) . '</style></url>';
				$out .= '</related-urls></urls>';
			}

			if (isset($ref['keywords']) && $ref['keywords']) {
				$out .= '<keywords>';
					foreach ((array) $ref['keywords'] as $keyword)
						$out .= '<keyword><style face="normal" font="default" size="100%">' . $this->_export($keyword) . '</style></keyword>';
				$out .= '</keywords>';
			}

			$out .= '</record>';
			$number++;
		}
		$out .= '</records></xml>';
		return $out;
	}
350331
def get_nodes(self, request, *args, **kwargs):
        
        # ListSerializerMixin.list returns a serializer object
        return (self.list(request, *args, **kwargs)).data
1309415
function findStmtNodes(nodeBody) {
  const nodes = [];
  const fnExpressions = utils.findNodes(nodeBody, 'ExpressionStatement');
  const returnStatement = utils.findNodes(nodeBody, 'ReturnStatement');

  if (fnExpressions.length !== 0) {
    fnExpressions.forEach((item) => {
      nodes.push(item);
    });
  }

  if (returnStatement.length !== 0) {
    returnStatement.forEach((item) => {
      nodes.push(item);
    });
  }

  return nodes;
}
1123507
public function getNodesByIds($ids, $published = true)
    {
        if (empty($ids))
        {
            return null;
        }

        if (is_string($ids))
        {
            $ids = json_decode($ids, true);
        }

        if (is_array($ids) && ! empty($ids))
        {
            $placeholders = implode(',', array_fill(0, count($ids), '?'));

            $nodes = Node::whereIn('id', $ids)
                ->orderByRaw('field(id,' . $placeholders . ')', $ids);

            if ($published)
            {
                $nodes->published();
            }

            $nodes = $nodes->get();

            return (count($nodes) > 0) ? $nodes : null;
        }

        return null;
    }
1348424
static function get( $what = 'next', $return_post_id = false, $admin_mode = false ) {

		if ( 'first' === $what ) {
			return static::getFirst( $return_post_id, $admin_mode );
		}

		global $blog_id;

		global $post;

		$current_post_id = $post->ID;
		$book_structure = static::getBookStructure();
		$order = $book_structure['__order'];
		$pos = array_keys( $order );

		$what = ( 'next' === $what ? 'next' : 'prev' );

		// Move internal pointer to correct position
		reset( $pos );
		while ( $find_me = current( $pos ) ) {
			if ( (int) $find_me === (int) $current_post_id ) {
				break;
			} else {
				next( $pos );
			}
		}

		// Get next/previous
		$what( $pos );
		while ( $post_id = current( $pos ) ) {
			if ( $admin_mode ) {
				if ( current_user_can( 'edit_post', $post_id ) ) {
					break;
				} else {
					$what( $pos );
				}
			} else {
				if ( in_array( $order[ $post_id ]['post_status'], [ 'publish', 'web-only' ], true ) ) {
					break;
				} elseif ( current_user_can_for_blog( $blog_id, 'read_private_posts' ) ) {
					break;
				} elseif ( get_option( 'permissive_private_content' ) && current_user_can_for_blog( $blog_id, 'read' ) ) {
					break;
				} else {
					$what( $pos );
				}
			}
		}

		if ( $return_post_id ) {
			return (int) $post_id;
		} else {
			return ( empty( $post_id ) ) ? '/' : get_permalink( $post_id );
		}
	}
386051
function getPosts(req, res, next) {
  db.tags.find(req.params.tag, function(err, tag) {
    if(err) { return next(err); }

    db.posts_tags.tagGetPosts(tag.id, function(err, posts) {
      if(err) { return next(err); }
      res.format({
        'text/html': function() {
          res.render('tags/show', {posts: posts, tag: tag});
        },
        'application/json': function() {
          res.json(posts);
        }
      });
    });
  });
}
1296849
static function getObjectIdsInNodeSubTree($node)
    {
        $db = eZDB::instance();
        $nodePath =  $node->attribute( 'path_string' );
        $pathString = " path_string like '$nodePath%' AND ";

        $objectIDArray = $db->arrayQuery( "SELECT
                                           ezcontentobject.id
                                    FROM
                                           ezcontentobject_tree, ezcontentobject
                                    WHERE
                                          $pathString
                                          ezcontentobject_tree.contentobject_id=ezcontentobject.id AND
                                          ezcontentobject_tree.main_node_id=ezcontentobject_tree.node_id" );

        if ( count( $objectIDArray ) == 0 )
            return null;

        $objectSimpleIDArray = array();

        foreach ( $objectIDArray as $objectID )
        {
            $objectSimpleIDArray[] = $objectID['id'];
        }

        return $objectSimpleIDArray;
    }
1030374
static function exportByNode( $nodeID )
    {
        if ( !$nodeID )
            return array( 'error' => array( 'error_type' => 'kernel',
                                            'error_code' => eZError::KERNEL_NOT_FOUND ) );

        $rssExport = eZPersistentObject::fetchObject( eZRSSExport::definition(),
                                                null,
                                                array( 'node_id' => $nodeID,
                                                       'status' => eZRSSExport::STATUS_VALID ),
                                                true );

        return array( 'result' => $rssExport );
    }
290122
def _list_nodes(full=False, for_output=False):
    '''
    
    '''
    fetch = True
    page = 1
    ret = {}

    while fetch:
        items = query(method='droplets',
                      command='?page=' + six.text_type(page) + '&per_page=200')
        for node in items['droplets']:
            name = node['name']
            ret[name] = {}
            if full:
                ret[name] = _get_full_output(node, for_output=for_output)
            else:
                public_ips, private_ips = _get_ips(node['networks'])
                ret[name] = {
                    'id': node['id'],
                    'image': node['image']['name'],
                    'name': name,
                    'private_ips': private_ips,
                    'public_ips': public_ips,
                    'size': node['size_slug'],
                    'state': six.text_type(node['status']),
                }

        page += 1
        try:
            fetch = 'next' in items['links']['pages']
        except KeyError:
            fetch = False

    return ret
546894
private int getNumRnaNodes(Collection<KamNode> nodes) {
        int count = 0;
        for (KamNode node : nodes) {
            if (node.getFunctionType() == FunctionEnum.RNA_ABUNDANCE) {
                count++;
            }
        }
        return count;
    }
1254644
static function fetchListCount()
    {
        $sql = "SELECT count( node_id ) as count FROM ezcontentobject_tree";
        $db = eZDB::instance();
        $rows = $db->arrayQuery( $sql );
        return $rows[0]['count'];
    }
1225585
function createContentObject( $params )
    {
        $objectID = false;

        $classIdentifier = $params['class_identifier'];
        $location = $params['location'];
        $attributesData = $params['attributes'];

        $parentNode = $this->nodeByUrl( $params );
        if( is_object( $parentNode ) )
        {
            $parentNodeID = $parentNode->attribute( 'node_id' );
            $object = eZContentFunctions::createAndPublishObject( array( 'parent_node_id' => $parentNodeID,
                                                                         'class_identifier' => $classIdentifier,
                                                                         'attributes' => $attributesData ) );

            if( is_object( $object ) )
            {
                $objectID = $object->attribute( 'id' );
            }
        }

        return $objectID;
    }
1018163
public function getPreloadedPublishedNodes(bool $andClear = true, string $namespace = NcrPreloader::DEFAULT_NAMESPACE): array
    {
        $nodes = $this->ncrPreloader->getPublishedNodes($namespace);
        if ($andClear) {
            $this->ncrPreloader->clear($namespace);
        }

        return $nodes;
    }
1264843
static function fetchChildListByVersionStatus( $parentNodeIDList, $status = eZContentObjectVersion::STATUS_PENDING, $asObject = true )
    {
        $db = eZDB::instance();
        $parentIDStatement = $db->generateSQLINStatement( $parentNodeIDList );

        $sql = "SELECT DISTINCT eznode_assignment.*
                FROM ezcontentobject_version, eznode_assignment
                WHERE ezcontentobject_version.contentobject_id = eznode_assignment.contentobject_id
                AND ezcontentobject_version.version = eznode_assignment.contentobject_version
                AND ezcontentobject_version.status = $status
                AND eznode_assignment.parent_node $parentIDStatement
                ORDER BY eznode_assignment.contentobject_id";
        $nodeAssignmentArray = $db->arrayQuery( $sql );
        if( $asObject )
        {
            $result = array();
            foreach( $nodeAssignmentArray as $nodeAssignment )
            {
                $result[] = new eZNodeAssignment( $nodeAssignment );
            }
            return $result;
        }
        else
        {
            return $nodeAssignmentArray;
        }
    }