Get blog posts.

@EXT\Route("", name="apiv2_blog_post_list")
@EXT\Method("GET")

@param Blog $blog

@return array
6797
public function listAction(Request $request, Blog $blog)
    {
        $this->checkPermission('OPEN', $blog->getResourceNode(), [], true);

        $parameters = $request->query->all();

        //if no edit rights, list only published posts
        $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,
            !$blog->getOptions()->getDisplayFullPosts());

        return new JsonResponse($posts);
    }
882989
public function listPages($blogId, $optParams = array()) {
      $params = array('blogId' => $blogId);
      $params = array_merge($params, $optParams);
      $data = $this->__call('list', array($params));
      if ($this->useObjects()) {
        return new Google_PageList($data);
      } else {
        return $data;
      }
    }
1348098
public function findRssDatas(Blog $blog, $executeQuery = true)
    {
        $query = $this->createQueryBuilder('post')
            ->select(['post'])
            ->andWhere('post.blog = :blogId')
            ->andWhere('post.status = :postStatus')
            ->andWhere('post.publicationDate IS NOT NULL')
            ->setParameter('blogId', $blog->getId())
            ->setParameter('postStatus', Statusable::STATUS_PUBLISHED)
            ->getQuery()
        ;

        return $executeQuery ? $query->getResult() : $query;
    }
754082
public function destroy(BlogRequest $request, Blog $blog)
    {
        try {

            $blog->delete();
            return $this->response->message(trans('messages.success.deleted', ['Module' => trans('blog::blog.name')]))
                ->code(202)
                ->status('success')
                ->url(guard_url('blog/blog/0'))
                ->redirect();

        } catch (Exception $e) {

            return $this->response->message($e->getMessage())
                ->code(400)
                ->status('error')
                ->url(guard_url('blog/blog/' . $blog->getRouteKey()))
                ->redirect();
        }

    }
747036
public List<Post> blogPosts(String blogName, Map<String, ?> options) {
        if (options == null) {
            options = Collections.emptyMap();
        }
        Map<String, Object> soptions = JumblrClient.safeOptionMap(options);
        soptions.put("api_key", apiKey);

        String path = "/posts";
        if (soptions.containsKey("type")) {
            path += "/" + soptions.get("type").toString();
            soptions.remove("type");
        }
        return requestBuilder.get(JumblrClient.blogPath(blogName, path), soptions).getPosts();
    }
134335
public function getArchives($blog)
    {
        $postDatas = $this->repo->findArchiveDatasByBlog($blog);
        $archiveDatas = [];

        foreach ($postDatas as $postData) {
            $year = $postData['year'];
            $month = $postData['month'];
            $count = $postData['count'];

            $archiveDatas[$year][] = [
                'month' => $this->translator->trans('month.'.date('F', mktime(0, 0, 0, $month, 10)), [], 'platform'),
                'monthValue' => $month,
                'count' => $count,
            ];
        }

        return $archiveDatas;
    }
1023842
public function edit(BlogRequest $request, Blog $blog)
    {
        return $this->response->title(trans('app.edit') . ' ' . trans('blog::blog.name'))
            ->view('blog::blog.edit', true)
            ->data(compact('blog'))
            ->output();
    }
457535
private static function get_all_plugins( $blog_id = 0 ) {
            self::require_plugin_essentials();

            $all_plugins = fs_get_plugins();

            $active_plugins_basenames = self::get_active_plugins_basenames( $blog_id );

            foreach ( $all_plugins as $basename => &$data ) {
                // By default set to inactive (next foreach update the active plugins).
                $data['is_active'] = false;
                // Enrich with plugin slug.
                $data['slug'] = self::get_plugin_slug( $basename );
            }

            // Flag active plugins.
            foreach ( $active_plugins_basenames as $basename ) {
                if ( isset( $all_plugins[ $basename ] ) ) {
                    $all_plugins[ $basename ]['is_active'] = true;
                }
            }

            return $all_plugins;
        }
463295
public function getPostsByTagPaged(Blog $blog, Tag $tag, $filterByPublishPost, $page = 1)
    {
        $query = $this->repo->getByTag($blog, $tag, $filterByPublishPost, false);

        return $this->setPager($query, $page, $blog->getOptions()->getPostPerPage());
    }
66109
public function show(BlogRequest $request, Blog $blog)
    {

        if ($blog->exists) {
            $view = 'blog::blog.show';
        } else {
            $view = 'blog::blog.new';
        }

        return $this->response->title(trans('app.view') . ' ' . trans('blog::blog.name'))
            ->data(compact('blog'))
            ->view($view, true)
            ->output();
    }
519961
private static function get_active_plugins( $blog_id = 0 ) {
            self::require_plugin_essentials();

            $active_plugin            = array();
            $all_plugins              = fs_get_plugins();
            $active_plugins_basenames = self::get_active_plugins_basenames( $blog_id );

            foreach ( $active_plugins_basenames as $plugin_basename ) {
                $active_plugin[ $plugin_basename ] = $all_plugins[ $plugin_basename ];
            }

            return $active_plugin;
        }
1342477
public function updateOptionsAction(Request $request, Blog $blog)
    {
        $this->checkPermission('EDIT', $blog->getResourceNode(), [], true);
        $data = json_decode($request->getContent(), true);
        $this->blogManager->updateOptions($blog, $this->blogOptionsSerializer->deserialize($data), $data['infos']);

        return new JsonResponse($this->blogOptionsSerializer->serialize($blog, $blog->getOptions()));
    }
1306712
public static function get_entries($filters = array(), $page = 0, $perpage = 10) {
        global $PAGE;

        $warnings = array();
        $params = self::validate_parameters(self::get_entries_parameters(),
            array('filters' => $filters, 'page' => $page, 'perpage' => $perpage));

        list($context, $filters, $courseid, $userid) = self::validate_access_and_filters($params['filters']);

        $PAGE->set_context($context); // Needed by internal APIs.
        $output = $PAGE->get_renderer('core');

        // Get filters.
        $blogheaders = blog_get_headers($filters['courseid'], $filters['groupid'], $filters['userid'], $filters['tagid'],
            $filters['tag'], $filters['cmid'], $filters['entryid'], $filters['search']);
        $bloglisting = new \blog_listing($blogheaders['filters']);

        $page  = $params['page'];
        $limit = empty($params['perpage']) ? get_user_preferences('blogpagesize', 10) : $params['perpage'];
        $start = $page * $limit;
        $entries = $bloglisting->get_entries($start, $limit);
        $totalentries = $bloglisting->count_entries();

        $exportedentries = array();
        foreach ($entries as $entry) {
            $exporter = new post_exporter($entry, array('context' => $context));
            $exportedentries[] = $exporter->export($output);
        }
        return array(
            'warnings' => $warnings,
            'entries' => $exportedentries,
            'totalentries' => $totalentries,
        );
    }
689147
public function get()
	{

//		dump($this->getPostType());
//		dump($this->getTax());
//		dump($this->getTerm());
		$b = [];

		if (!is_front_page())
		{
			// home
			$b[] = [
				'title' => ($this->homeTitle) ? $this->homeTitle : get_bloginfo('name'),
				'url'   => get_option('home')
			];

			if (is_category())
			{
				if ($c = get_category(get_query_var('cat')))
				{
					$b[] = ['title' => $c->name, 'url' => false];
				}

			}
			else if (is_post_type_archive() && !is_tax() && $this->post)
			{
				$postType = $this->post->postType;
				if (!in_array($postType->name, $this->excludedPostTypes))
				{
					$b[] = ['title' => $postType->label, 'url' => null];
				}

			}
			else if (is_tax())
			{

				// if is custom post type
				if ($pt = get_post_type_object($this->getPostType()))
				{
					if (!in_array($pt->name, $this->excludedPostTypes))
					{
						$b[] = ['title' => $pt->label, 'url' => get_post_type_archive_link($this->getPostType())];
					}
				}

				$tax = get_term_by('slug', $this->getTerm(), get_query_var('taxonomy'));
				$b[] = ['title' => $tax->name, 'url' => null];

			}
			else if (is_single())
			{

				// if is custom post type
				$postType = $this->post->postType;
				if (!in_array($postType->name, $this->excludedPostTypes))
				{
					$b[] = ['title' => $postType->label, 'url' => $postType->permalink];
				}
				else if (in_array($postType->name, $this->excludedPostTypes)
					&& $custom = $this->getOverloaded($postType->name)
				)
				{
					$b[] = ['title' => $custom->labels->name, 'url' => $custom->permalink];
				}

				if ($this->post->categories)
				{
					foreach ($this->post->categories as $c)
					{
						$b[] = ['title' => $c->name, 'url' => $c->permalink];
					}
				}

				if ($tax = $this->getCurrentTaxonomy())
				{
					$b[] = ['title' => $tax->name, 'url' => get_term_link($tax)];
				}

				$b[] = ['title' => $this->post->title, 'url' => false];

			}
			elseif (is_date())
			{
				$b[] = ['title' => get_the_time($this->dateFormat), 'url' => false];
			}
			elseif (is_page() && $this->post->post_parent)
			{
				for ($i = count($this->post->ancestors) - 1; $i >= 0; $i--)
				{
					$b[] = [
						'title' => get_the_title($this->post->ancestors[$i]),
						'url'   => get_permalink($this->post->ancestors[$i])
					];
				}

				$b[] = ['title' => $this->post->title, 'url' => false];

			}
			elseif (is_page())
			{
				$b[] = ['title' => $this->post->title, 'url' => false];
			}
			else if (is_tag())
			{
				$b[] = ['title' => single_tag_title('', false), 'url' => false];
			}
			else if (is_author())
			{
				$b[] = ['title' => sprintf(__('Posts by %s'), get_the_author()), 'url' => false];
			}
			else if (is_search())
			{
				$b[] = [
					'title' => sprintf(__('Search Results %1$s %2$s'), ':', '"' . esc_html(get_search_query()) . '"'),
					'url'   => false
				];
			}
			elseif (is_404())
			{
				$b[] = ['title' => __('Page not found'), 'url' => false];
			}
		}
		else
		{
			$b[] = [
				'title' => ($this->homeTitle) ? $this->homeTitle : get_bloginfo('name'),
				'url'   => false
			];
		}

		return Collection::make($b);
	}
1227619
public function dispatchPostCreateEvent(Blog $blog, Post $post)
    {
        $event = new LogPostCreateEvent($post);

        return $this->dispatch($event);
    }
192017
def blog_post_list(request, tag=None, year=None, month=None, username=None,
                   category=None, template="blog/blog_post_list.html",
                   extra_context=None):
    
    templates = []
    blog_posts = BlogPost.objects.published(for_user=request.user)
    if tag is not None:
        tag = get_object_or_404(Keyword, slug=tag)
        blog_posts = blog_posts.filter(keywords__keyword=tag)
    if year is not None:
        blog_posts = blog_posts.filter(publish_date__year=year)
        if month is not None:
            blog_posts = blog_posts.filter(publish_date__month=month)
            try:
                month = _(month_name[int(month)])
            except IndexError:
                raise Http404()
    if category is not None:
        category = get_object_or_404(BlogCategory, slug=category)
        blog_posts = blog_posts.filter(categories=category)
        templates.append(u"blog/blog_post_list_%s.html" %
                          str(category.slug))
    author = None
    if username is not None:
        author = get_object_or_404(User, username=username)
        blog_posts = blog_posts.filter(user=author)
        templates.append(u"blog/blog_post_list_%s.html" % username)

    prefetch = ("categories", "keywords__keyword")
    blog_posts = blog_posts.select_related("user").prefetch_related(*prefetch)
    blog_posts = paginate(blog_posts, request.GET.get("page", 1),
                          settings.BLOG_POST_PER_PAGE,
                          settings.MAX_PAGING_LINKS)
    context = {"blog_posts": blog_posts, "year": year, "month": month,
               "tag": tag, "category": category, "author": author}
    context.update(extra_context or {})
    templates.append(template)
    return TemplateResponse(request, templates, context)
1011399
function getTagsByBook( $blog_id, $tag_group ) {

		/** @var $wpdb \wpdb */
		global $wpdb;

		$sql = "SELECT DISTINCT {$this->dbTagsTable}.id, {$this->dbTagsTable}.tag FROM {$this->dbTagsTable}
 				INNER JOIN {$this->dbLinkTable} ON {$this->dbLinkTable}.tags_id = {$this->dbTagsTable}.id
 				INNER JOIN {$this->dbTable} ON {$this->dbTable}.users_id = {$this->dbLinkTable}.users_id AND {$this->dbTable}.blogs_id = {$this->dbLinkTable}.blogs_id
 				WHERE {$this->dbLinkTable}.tags_group = %d AND {$this->dbLinkTable}.users_id = %d AND {$this->dbLinkTable}.blogs_id = %d
 				ORDER BY {$this->dbTagsTable}.tag ASC ";

		return $wpdb->get_results( $wpdb->prepare( $sql, $tag_group, $this->userId, $blog_id ), ARRAY_A ); // @codingStandardsIgnoreLine
	}