@param Blog $blog
@param User $author
@param $filterByPublishPost
@param int $page

@return array
559499
public function getPostsByAuthorPaged(Blog $blog, User $author, $filterByPublishPost, $page = 1)
    {
        $query = $this->repo->getByAuthor($blog, $author, $filterByPublishPost, false);

        return $this->setPager($query, $page, $blog->getOptions()->getPostPerPage());
    }
1347627
public function getContentReplies(string $author, string $permalink)
    {
        $request = [
            'route' => 'get_content_replies',
            'query' =>
                [
                    'author'   => $author,
                    'permlink' => $permalink,
                ]
        ];

        return parent::call($request);
    }
1327546
public function getTagsAction(Blog $blog)
    {
        $this->checkPermission('OPEN', $blog->getResourceNode(), [], true);

        $parameters['limit'] = -1;
        $posts = $this->postManager->getPosts(
            $blog->getId(),
            $parameters,
            $this->checkPermission('ADMINISTRATE', $blog->getResourceNode())
            || $this->checkPermission('EDIT', $blog->getResourceNode())
            || $this->checkPermission('MODERATE', $blog->getResourceNode())
                ? PostManager::GET_ALL_POSTS
                : PostManager::GET_PUBLISHED_POSTS,
            true);

        $postsData = [];
        if (!empty($posts)) {
            $postsData = $posts['data'];
        }

        return new JsonResponse($this->blogManager->getTags($blog, $postsData));
    }
987593
public function getPosts($blogId, $filters, $publication = self::GET_PUBLISHED_POSTS, $abstract = true)
    {
        if (!isset($filters['hiddenFilters'])) {
            $filters['hiddenFilters'] = [];
        }
        //filter on current blog
        $filters['hiddenFilters'] = [
            'blog' => $blogId,
        ];
        $publicationOptions = [];
        if (self::GET_PUBLISHED_POSTS === $publication) {
            $publicationOptions = ['published' => true];
        } elseif (self::GET_UNPUBLISHED_POSTS === $publication) {
            $publicationOptions = ['published' => false];
        }
        $filters['hiddenFilters'] = array_merge($filters['hiddenFilters'], $publicationOptions);

        return $this->finder->search('Icap\BlogBundle\Entity\Post', $filters, [
            'abstract' => $abstract,
        ]);
    }
562998
private static function get_site_active_plugins( $blog_id = 0 ) {
            $active_basenames = ( is_multisite() && $blog_id > 0 ) ?
                get_blog_option( $blog_id, 'active_plugins' ) :
                get_option( 'active_plugins' );

            $active = array();

            if ( ! is_array( $active_basenames ) ) {
                return $active;
            }

            foreach ( $active_basenames as $basename ) {
                $active[ $basename ] = array(
                    'is_active' => true,
                    'Version'   => '1.0', // Dummy version.
                    'slug'      => self::get_plugin_slug( $basename ),
                );
            }

            return $active;
        }
407270
public function addBannedMember(Blog $blog, User $user)
    {
        $member = new Member();
        $member->setBlog(blog);
        $member->setUser($user);
        $member->setBanned(true);

        $this->om->persist($member);
        $this->om->flush();

        return $member;
    }
98110
public function getCommenters($page = null, $per_page = null)
    {
        list($response, $statusCode, $httpHeader) = $this->getCommentersWithHttpInfo ($page, $per_page);
        return $response; 
    }
1289166
private function findByFiltersIds($filters, $page, $pageSize, $limit, $locale, $options = [])
    {
        $parameter = [];

        $queryBuilder = $this->createQueryBuilder('c')
            ->select('c.id')
            ->distinct()
            ->orderBy('c.id', 'ASC');

        $tagRelation = $this->appendTagsRelation($queryBuilder, 'c');
        $categoryRelation = $this->appendCategoriesRelation($queryBuilder, 'c');

        if (array_key_exists('sortBy', $filters) && is_array($filters['sortBy'])) {
            $sortMethod = array_key_exists('sortMethod', $filters) ? $filters['sortMethod'] : 'asc';
            $this->appendSortBy($filters['sortBy'], $sortMethod, $queryBuilder, 'c', $locale);

            foreach ($filters['sortBy'] as $sortColumn) {
                $queryBuilder->addSelect($sortColumn);
            }
        }

        $parameter = array_merge($parameter, $this->append($queryBuilder, 'c', $locale, $options));
        if (isset($filters['dataSource'])) {
            $includeSubFolders = $this->getBoolean($filters['includeSubFolders'] ?: false);
            $parameter = array_merge(
                $parameter,
                $this->appendDatasource($filters['dataSource'], $includeSubFolders, $queryBuilder, 'c')
            );
        }

        if (isset($filters['tags']) && !empty($filters['tags'])) {
            $parameter = array_merge(
                $parameter,
                $this->appendRelation(
                    $queryBuilder,
                    $tagRelation,
                    $filters['tags'],
                    strtolower($filters['tagOperator']),
                    'adminTags'
                )
            );
        }

        if (isset($filters['categories']) && !empty($filters['categories'])) {
            $parameter = array_merge(
                $parameter,
                $this->appendRelation(
                    $queryBuilder,
                    $categoryRelation,
                    $filters['categories'],
                    strtolower($filters['categoryOperator']),
                    'adminCategories'
                )
            );
        }

        if (isset($filters['targetGroupId']) && $filters['targetGroupId']) {
            $targetGroupRelation = $this->appendTargetGroupRelation($queryBuilder, 'c');
            $parameter = array_merge(
                $parameter,
                $this->appendRelation(
                    $queryBuilder,
                    $targetGroupRelation,
                    [$filters['targetGroupId']],
                    'and',
                    'targetGroupId'
                )
            );
        }

        if (isset($filters['websiteTags']) && !empty($filters['websiteTags'])) {
            $parameter = array_merge(
                $parameter,
                $this->appendRelation(
                    $queryBuilder,
                    $tagRelation,
                    $filters['websiteTags'],
                    strtolower($filters['websiteTagsOperator']),
                    'websiteTags'
                )
            );
        }

        if (isset($filters['websiteCategories']) && !empty($filters['websiteCategories'])) {
            $parameter = array_merge(
                $parameter,
                $this->appendRelation(
                    $queryBuilder,
                    $categoryRelation,
                    $filters['websiteCategories'],
                    strtolower($filters['websiteCategoriesOperator']),
                    'websiteCategories'
                )
            );
        }

        $query = $queryBuilder->getQuery();
        foreach ($parameter as $name => $value) {
            $query->setParameter($name, $value);
        }

        if (null !== $page && $pageSize > 0) {
            $pageOffset = ($page - 1) * $pageSize;
            $restLimit = $limit - $pageOffset;

            // if limitation is smaller than the page size then use the rest limit else use page size plus 1 to
            // determine has next page
            $maxResults = (null !== $limit && $pageSize > $restLimit ? $restLimit : ($pageSize + 1));

            if ($maxResults <= 0) {
                return [];
            }

            $query->setMaxResults($maxResults);
            $query->setFirstResult($pageOffset);
        } elseif (null !== $limit) {
            $query->setMaxResults($limit);
        }

        return array_map(
            function($item) {
                return $item['id'];
            },
            $query->getScalarResult()
        );
    }
650239
public function loadByBlog(Blog $blog, $max = null)
    {
        $results = $this->getTagRepository()->findByBlog($blog, true, $max);
        $tags = [];

        if (0 < count($results)) {
            $maxWeight = intval($results[0]['frequency']);
            $resultsValues = array_values($results);
            $endResult = end($resultsValues);
            $minWeight = intval($endResult['frequency']);
            $diff = $maxWeight - $minWeight;

            foreach ($results as $result) {
                /** @var \Icap\BlogBundle\Entity\Tag $tag */
                $tag = $result[0];

                if ($diff > 10) {
                    $weight = round(((intval($result['frequency']) - $minWeight) / $diff) * 9 + 1);
                } else {
                    $weight = intval($result['frequency']) - $minWeight + 1;
                }

                $tagArray = [
                    'name' => $tag->getName(),
                    'slug' => $tag->getSlug(),
                    'weight' => $weight,
                    'countPosts' => intval($result['countPosts']),
                    'text' => $tag->getName(),
                    'id' => $tag->getId(),
                ];
                array_push($tags, $tagArray);
            }
        }

        return $tags;
    }
815325
public function get_items( $priority = 1000, $user_id = 0 ) {
		// Get the current author ID, if not specified.
		if ( ! $user_id ) {
			$user_id = get_queried_object_id();
		}

		// Create the author breadcrumb item.
		$item = Carbon_Breadcrumb_Item::factory( $this->get_type(), $priority );
		$item->set_id( $user_id );
		$item->setup();

		return array( $item );
	}
1321994
public function getPager(array $criteria, $page, $limit = 10, array $sort = [])
    {
        if (!isset($criteria['mode'])) {
            $criteria['mode'] = 'public';
        }

        $parameters = [];
        $query = $this->getRepository()
            ->createQueryBuilder('p')
            ->select('p, t')
            ->orderBy('p.publicationDateStart', 'DESC');

        if ('admin' === $criteria['mode']) {
            $query
                ->leftJoin('p.tags', 't')
                ->leftJoin('p.author', 'a')
            ;
        } else {
            $query
                ->leftJoin('p.tags', 't', Join::WITH, 't.enabled = true')
                ->leftJoin('p.author', 'a', Join::WITH, 'a.enabled = true')
            ;
        }

        if (!isset($criteria['enabled']) && 'public' === $criteria['mode']) {
            $criteria['enabled'] = true;
        }
        if (isset($criteria['enabled'])) {
            $query->andWhere('p.enabled = :enabled');
            $parameters['enabled'] = $criteria['enabled'];
        }

        if (isset($criteria['date'], $criteria['date']['query'], $criteria['date']['params'])) {
            $query->andWhere($criteria['date']['query']);
            $parameters = array_merge($parameters, $criteria['date']['params']);
        }

        if (isset($criteria['tag'])) {
            $query
                ->leftJoin('p.tags', 't2')
                ->andWhere('t2.slug LIKE :tag');
            $parameters['tag'] = (string) $criteria['tag'];
        }

        if (isset($criteria['author'])) {
            if (!\is_array($criteria['author']) && stristr($criteria['author'], 'NULL')) {
                $query->andWhere('p.author IS '.$criteria['author']);
            } else {
                $query->andWhere(sprintf('p.author IN (%s)', implode(',', (array) $criteria['author'])));
            }
        }

        if (isset($criteria['collection']) && $criteria['collection'] instanceof CollectionInterface) {
            $query->andWhere('p.collection = :collectionid');
            $parameters['collectionid'] = $criteria['collection']->getId();
        }

        $query->setParameters($parameters);

        $pager = new Pager();
        $pager->setMaxPerPage($limit);
        $pager->setQuery(new ProxyQuery($query));
        $pager->setPage($page);
        $pager->init();

        return $pager;
    }
1306564
private function getPageFilter($filterName, $storeId = null)
    {
        $pageFilters = $this->getPageFilters($storeId);
        if ($pageFilters && @$pageFilters->$filterName) {
            return (array)$pageFilters->$filterName;
        }
        return [];
    }
582632
public function destroy(UserPolicy $user, Blog $blog)
    {
        return $blog->user_id == user_id() && $blog->user_type == user_type();
    }
172319
private function addTrustedMember(Blog $blog, User $user)
    {
        $member = new Member();
        $member->setBlog($blog);
        $member->setUser($user);
        $member->setTrusted(true);

        $this->om->persist($member);
        $this->om->flush();

        return $member;
    }
716724
public function getRecords($filter = '', $order = ['.id'], $page = 1, $count = null, $dataDimensions = null)
    {
        if ($dataDimensions == null) {
            $dataDimensions = $this->getCurrentDataDimensions();
        }

        if (!is_array($order))
        {
            $order = [$order];
        }

        if ($this->readConnection instanceof FilteringConnection) {
            $records = $this->readConnection->getRecords($this->getCurrentContentTypeName(), $dataDimensions, $filter,
                $page, $count, $order);
        } else {

            $records = $this->getAllRecords($dataDimensions);

            if ($filter != '') {
                $records = RecordsFilter::filterRecords($records, $filter);
            }

            $records = RecordsSorter::orderRecords($records, $order);

            if ($count != null) {
                $records = RecordsPager::sliceRecords($records, $page, $count);
            }
        }

        foreach ($records as $record) {
            $record->setRepository($this);
        }

        return $records;
    }
357876
public function usersList(array $filter = [], $page = null, $limit = null)
    {
        $parameters = [];

        if (count($filter)) {
            $parameters['filter'] = $filter;
        }
        if (null !== $page) {
            $parameters['page'] = (int)$page;
        }
        if (null !== $limit) {
            $parameters['limit'] = (int)$limit;
        }

        /** @noinspection PhpUndefinedMethodInspection */
        return $this->client->makeRequest(
            '/users',
            "GET",
            $parameters
        );
    }
1149231
public function getAll($excludeUnpublished = false, Blog $blog = null)
    {
        $this->clearInstance();
        $this->qb = $this->getInstance();

        //If $excludeUnpublished === true, we exclude the non published results
        if ($excludeUnpublished) {
            $this->qb
                ->andWhere('article.status = :status')
                ->orWhere('article.status = :scheduled_status AND article.publishedAt <= :now')
                ->setParameter('status', PageStatus::PUBLISHED)
                ->setParameter('scheduled_status', PageStatus::SCHEDULED)
                ->setParameter('now', new \DateTime());
        }

        if (null != $blog) {
            $this->qb
                ->andWhere('article.blog = :blog')
                ->setParameter('blog', $blog->getId());
        }

        return $this;
    }