Takes an array `posts` of sorted posts and returns
a sorted array with all tags

@params {Array} posts
@returns {Array}
515021
function getTags (posts) {
  var tags = posts.reduce(function (tags, post) {
    if (!post.tags || !Array.isArray(post.tags)) return tags;
    return tags.concat(post.tags);
  }, []);

  return _.unique(tags).sort();
}
822634
public static function postsTags()
    {
        if (!getConfig('sitemap.posts_tags')) {
            return [];
        }

        $table = TableRegistry::get('MeCms.Tags');
        $url = Cache::read('sitemap', $table->getCacheName());

        if (!$url) {
            $tags = $table->find('active')
                ->select(['tag', 'modified'])
                ->order(['tag' => 'ASC']);

            if ($tags->isEmpty()) {
                return [];
            }

            $latest = $table->find()
                ->select(['modified'])
                ->order(['modified' => 'DESC'])
                ->firstOrFail();

            //Adds the tags index
            $url[] = self::parse(['_name' => 'postsTags'], ['lastmod' => $latest->modified]);

            //Adds each tag
            foreach ($tags as $tag) {
                $url[] = self::parse(['_name' => 'postsTag', $tag->slug], ['lastmod' => $tag->modified]);
            }

            Cache::write('sitemap', $url, $table->getCacheName());
        }

        return $url;
    }
110347
function fetchPosts({state, actions, opts: {api}}, reddit) {
	let posts = state.postsByReddit[reddit]

	if (_shouldFetchPosts(posts)) {
		api.fetchPosts(reddit)
			.then(json => actions.postsFetched(reddit, json))

		return {
			...state,
			postsByReddit: {
				...state.postsByReddit,
				[reddit]: Object.assign({}, posts, {
					isFetching: true, 
					didInvalidate: false, 
					posts: []
				})
			}
		}

	}

	return state
}
55097
function getPosts (poet) {
  if (poet.cache.posts)
    return poet.cache.posts;

  var posts = utils.sortPosts(poet.posts).filter(function (post) {
    // Filter out draft posts if showDrafts is false
    return (poet.options.showDrafts || !post.draft) &&
    // Filter out posts in the future if showFuture is false
      (poet.options.showFuture || post.date < Date.now());
  });

  return poet.cache.posts = posts;
}
55560
public static function get_posts( $args ) {
		if ( is_string( $args ) ) {
			$args = add_query_arg(
				[
					'suppress_filters' => false,
				]
			);
		} elseif ( is_array( $args ) && ! isset( $args['suppress_filters'] ) ) {
			$args['suppress_filters'] = false;
		}

		// Get the posts.
		// TODO: WordPress.VIP.RestrictedFunctions.get_posts_get_posts.
		$posts = get_posts( $args );

		// Properly format the array.
		$items = [];
		foreach ( $posts as $post ) {
			$items[ $post->ID ] = $post->post_title;
		}
		wp_reset_postdata();

		return $items;
	}
1020734
function removePostsContent( posts, options ) {

	var _sortPosts = options && typeof options.sortPosts === 'function' ?
				options.sortPosts : sortPosts,
			i = 0,
			len = 0;

	// Posts should be objects separated by commas but not wrapped in []
	posts = JSON.parse( '[' + posts.contents.toString() + ']' );

	len = posts.length;

	for ( i; i < len; i++ ) {

		delete posts[i].content;
	}

	// Sort posts by newest
	posts.sort( _sortPosts );

	return JSON.stringify( posts );
}
1229711
public function posts()
    {
        $links[] = [__d('me_cms', 'List posts'), [
            'controller' => 'Posts',
            'action' => 'index',
            'plugin' => 'MeCms',
            'prefix' => ADMIN_PREFIX,
        ]];
        $links[] = [__d('me_cms', 'Add post'), [
            'controller' => 'Posts',
            'action' => 'add',
            'plugin' => 'MeCms',
            'prefix' => ADMIN_PREFIX,
        ]];

        //Only admins and managers can access these actions
        if ($this->Auth->isGroup(['admin', 'manager'])) {
            $links[] = [__d('me_cms', 'List categories'), [
                'controller' => 'PostsCategories',
                'action' => 'index',
                'plugin' => 'MeCms',
                'prefix' => ADMIN_PREFIX,
            ]];
            $links[] = [__d('me_cms', 'Add category'), [
                'controller' => 'PostsCategories',
                'action' => 'add',
                'plugin' => 'MeCms',
                'prefix' => ADMIN_PREFIX,
            ]];
        }

        $links[] = [__d('me_cms', 'List tags'), [
            'controller' => 'PostsTags',
            'action' => 'index',
            'plugin' => 'MeCms',
            'prefix' => ADMIN_PREFIX,
        ]];

        return [$links, I18N_POSTS, ['icon' => 'far file-alt']];
    }
1045874
protected function process_post_data($posts) {
        $discussionids = [];
        $forumids = [];
        $courseids = [];

        $this->log_start("Processing post information");

        $start = microtime(true);
        foreach ($posts as $id => $post) {
            $discussionids[$post->discussion] = true;
            $forumids[$post->forum] = true;
            $courseids[$post->course] = true;
            $this->add_data_for_post($post);
            $this->posts[$id] = $post;
        }
        $this->log_finish(sprintf("Processed %s posts", count($this->posts)));

        if (empty($this->posts)) {
            $this->log("No posts found. Returning early.");
            return;
        }

        // Please note, this order is intentional.
        // The forum cache makes use of the course.
        $this->log_start("Filling caches");

        $start = microtime(true);
        $this->log_start("Filling course cache", 1);
        $this->fill_course_cache(array_keys($courseids));
        $this->log_finish("Done", 1);

        $this->log_start("Filling forum cache", 1);
        $this->fill_forum_cache(array_keys($forumids));
        $this->log_finish("Done", 1);

        $this->log_start("Filling discussion cache", 1);
        $this->fill_discussion_cache(array_keys($discussionids));
        $this->log_finish("Done", 1);

        $this->log_start("Filling user subscription cache", 1);
        $this->fill_user_subscription_cache();
        $this->log_finish("Done", 1);

        $this->log_start("Filling digest cache", 1);
        $this->fill_digest_cache();
        $this->log_finish("Done", 1);

        $this->log_finish("All caches filled");

        $this->log_start("Queueing user tasks.");
        $this->queue_user_tasks();
        $this->log_finish("All tasks queued.");
    }
237575
function filterAfter(posts) {
      after = moment(after.replace(/\//g, '-'), 'MM-DD-YYYY', true);
      if (!after.isValid()) {
        console.log(chalk.red('After date is not valid (expecting `MM-DD-YYYY`), ignoring argument.'));
        return posts;
      }

      return posts.filter(function filterPosts(post) {
        return moment(post.date).isAfter(after);
      });
    }
528745
function highlightPostSyntax( post ) {

	var codeTags = [],
			i = 0,
			len = 0;

	doc = doc || createDom( post.content );
	
	codeTags = doc.querySelectorAll('pre code');

	len = codeTags.length;

	for ( ; i < len; i++ ) {

		// Replace class names beginning with "lang-" with "language-" for Highlight.js
		codeTags[i].className = codeTags[i].className.replace('lang-', 'language-');

		hljs.highlightBlock( codeTags[i] );
	}

	post.content = doc.body.innerHTML;
}
1052818
def _format(self, posts):
        
        if posts.__class__ == Post:
            # format a single post
            return posts.dict()
        formated_posts = []
        for post in posts:
            formated_posts.append(post.dict())
        return formated_posts
610877
def tagged(self, tag):
        """"""
        return PostCollection([p for p in self if unicode(tag) in p.tags])
766602
function havePosts( error, post ) {
  this.debug( 'haveSingle' );
  console.log( require( 'util' ).inspect( post, { showHidden: false, colors: true, depth: 4 } ) );
}
243991
def query_by_post(postid):
        '''
        
        '''
        return TabPost2Tag.select().where(
            TabPost2Tag.post_id == postid
        ).order_by(TabPost2Tag.order)
130604
function filterCategory(posts) {
      var reCat = new RegExp(cat);
      return posts.filter(function filterPosts(post) {
        return post.categories.data.some(function checkRe(postCat) {
          return reCat.test(postCat.name);
        });
      });
    }
746463
def find_related_posts
      @related_posts = @post.find_related_tags.limit(amount_of_related_posts_to_display)
      amount_of_related_posts = @related_posts.length

      if amount_of_related_posts != amount_of_related_posts_to_display && (amount_of_related_posts + @popular_posts.length) >= amount_of_related_posts_to_display
        @related_posts = @related_posts.to_a.concat(@popular_posts[0...amount_of_related_posts_to_display - amount_of_related_posts])
      end
    end
218101
function taggedLog(...tags) {
    const tag = normalizeDefaults(tags)
    /**
     * message Logger
     * @function messageLog
     * @template T
     * @param {...T} messages message
     * @returns {T}
     */
    function messageLog(...messages) {
      if (active) {
        const protectedMessage = messageArrayProtect(messages)
        levelLogger(tag, ...protectedMessage)
      }
      return messages[0]
    }
    return messageLog
  }