Get post tags.

@param Post $post

@return array
482823
public function setTags($post, $tags = [])
    {
        $event = new GenericDataEvent([
            'tags' => $tags,
            'data' => [
                [
                    'class' => 'Icap\BlogBundle\Entity\Post',
                    'id' => $post->getUuid(),
                    'name' => $post->getTitle(),
                ],
            ],
            'replace' => true,
        ]);

        $this->eventDispatcher->dispatch('claroline_tag_multiple_data', $event);
    }
642110
public function getTags()
    {
        $value = $this->getData('tags');
        /** @noinspection IsEmptyFunctionUsageInspection */
        if (!empty($decoded = json_decode($value, true))) {
            return $decoded;
        }
        return [];
    }
1024790
def postags(self):
        
        if not self.is_tagged(ANALYSIS):
            self.tag_analysis()
        return self.get_analysis_element(POSTAG)
20445
protected function tagsFromRequest() {
		$tags = $this->owner->getRequest()->getVar('tags') ? $this->owner->getRequest()->getVar('tags') : '';

		if (strlen($tags)) {
			$tags = explode(',', $tags);
		} else {
			$tags = array();
		}
		
		return $tags;
	}
1077119
public function convertPostContent($post) {
		$content = $post->Content;
		
		$lines = explode("\n", $content);
		
		$newContent = array();
		$title = '';
		$converted = false;
		
		// store the converted items
		$convertedLinks = array();
		
		foreach ($lines as $line) {
			$url = trim($line);
			if (strlen($url) && $this->isWebpage($url)) {
				$convertedContent = $this->convertUrl($url);
				if ($convertedContent) {
					$converted = true;
					$line = 'CONVERTEDCONTENT:' . count($convertedLinks);
					$convertedLinks[] = $convertedContent;
					$title = strlen($convertedContent['Title']) ? $convertedContent['Title'] : '';
				}
			} 
			$newContent[] = $line;
		}

		$newContent = implode("\n", $newContent);
		$newContent = RestrictedMarkdown::create($newContent)->parse();
		
		// replace the converted bits
		$newContent = preg_replace_callback('/CONVERTEDCONTENT:(\d+)/is', function ($bit) use ($convertedLinks) {
			return isset($convertedLinks[$bit[1]]) ? $convertedLinks[$bit[1]]['Content'] : '';
		}, $newContent);
		
		if ($converted) {
			$post->IsOembed = true;
			$post->OriginalContent = $post->Content;
			$post->Content = $newContent;
			$post->Title = $title;
		}

		return $post;
	}
513159
protected function get_data( \WP_Post $post ){
        switch( $this->name ){
            case 'excerpt':
                return $post->post_excerpt;
                break;
            default:
                if( false !== array_search(Taxonomy::class, class_uses(get_called_class())) ){
                    // This is taxonomy
                    $terms = get_the_terms($post, $this->name);
                    $term_id = 0;
                    if( $terms && !is_wp_error($terms) ){
                        foreach($terms as $term){
                            $term_id = $term->term_id;
                        }
                    }
                    return $term_id;

                }else{
                    // This is post meta
                    return get_post_meta($post->ID, $this->name, true);
                }
                break;
        }
    }
740612
protected function retrieveConfigPostMetas($post, $postTypeModel)
	{
		$metaKeys = [];
		$metaTaxonomies = [];

		$allKeys = $this->getValidationsKeys($postTypeModel);
		foreach($allKeys as $key => $value){

			$customFieldObject = $this->getCustomFieldObject($postTypeModel, $key);

			if(isset($customFieldObject['type']) && $customFieldObject['type'] == 'taxonomy'){

				// We need to get the values from the taxonomy table
				if(array_key_exists('post_type', $customFieldObject)){

					$customfieldPostTypes = $this->getPostTypeIdentifiers($customFieldObject['post_type']);

					// Lets query the post to retrieve all the connected ids
					$taxonomyIds = $post->taxonomies()->whereIn('post_type', $customfieldPostTypes)
						->get();

					// Lets foreach all the posts because we only need the id
					$ids = [];
					foreach($taxonomyIds as $value){
						array_push($ids, $value->id);
					}

					$ids = json_encode($ids);

					$metaTaxonomies[$key] = [
						'meta_key' => $key,
						'meta_value' => $ids,
					];

				}

			// The other items are default
			} else {

				// Register it to the main array so we can query it later
				array_push($metaKeys, $key);

			}

		}

		// Lets query the database to get only the values where we have registered the meta keys
		$postmetaSimple = $post->postmeta()
			->whereIn('meta_key', $metaKeys)
			->select(['meta_key', 'meta_value'])
			->get()
			->keyBy('meta_key')
			->toArray();

		// Lets attach the default post columns
		$defaultPostData = [];

		$defaultPostData['post_title'] = [
			'meta_key' => 'post_title',
			'meta_value' => $post->post_title,
		];

		$defaultPostData['post_name'] = [
			'meta_key' => 'post_name',
			'meta_value' => $post->post_name,
		];

		// Lets merge all the types of configs
		$postmeta = array_merge($postmetaSimple, $metaTaxonomies, $defaultPostData);

		// Return the post meta's
		return $postmeta;
	}
868697
private function parse_buttons( $buttons, $post = null )
    {
        $buttons = explode( '|', $buttons );

        $buttons = array_map( function ( $button ) use ( $post ) {

            $params = array_map( 'trim', explode( ',', $button ) );

            $button = [
                'title' => $params[0],
                'type'  => $params[1],
            ];

            if ( $button['type'] === 'postback' ) {
                $button['payload'] = $params[2];
            }

            if ( $button['type'] === 'web_url' ) {
                if ( $params[2] === 'permalink' ) {
                    $params[2] = get_permalink( $post );
                }

                if ( filter_var( $params[2], FILTER_VALIDATE_URL ) ) {
                    $button['url'] = $params[2];
                }
            }

            return $button;

        }, $buttons );

        return $buttons;
    }
200538
public function getPostsByTags($limit = 6, $tagIDs = [])
    {
        $tags = "tags";
        // Validate post type
        if(!$tagIDs) {
            $tagIDs = [];
            foreach ($this->$tags as $tag) {
                $tagIDs[] = $tag->tagID;
            }
        }

        if($tagIDs) {
            $postsObj = new Post();
            $postsObj->setTable($this->getTable());
            $posts = $postsObj
                ->select('postID', 'title', 'featuredImageID', 'slug')
                ->join($this->getTable().'_tags', $this->getTable().'_tags.postID', $this->getTable() . '.postID')
                ->with('featuredImage')
                ->published()
                ->whereIn('tagID', $tagIDs)
                ->where('postID', "!=", $this->postID)
                ->orderBy('published_at', 'DESC')
                ->limit($limit)
                ->get();

            return $posts;
        }else{
            return collect();
        }
    }
123903
public static function getFields($post_type)
    {
        $postType = PostType::all()->where('slug', $post_type)->first();

        if($postType) {
            return $postType->fields;
        }
        
        return [];
    }
465752
protected static function get_post_area(\stdClass $post) : Array {
        $parts = [
            $post->created,
            $post->subject,
            $post->id,
        ];
        $area[] = implode('-', $parts);

        return $area;
    }
1361146
public function tags(): array
    {

        if (property_exists($this, 'tags')) {
            if (is_null($this->token))
                return array_merge($this->tags, ['public']);

            return array_merge($this->tags, ['character_id:' . $this->getCharacterId()]);
        }

        if (is_null($this->token))
            return ['unknown_tag', 'public'];

        return ['unknown_tag', 'character_id:' . $this->getCharacterId()];
    }
861902
public function taggedWith($tag)
    {
        $results = [];

        if (isset($this->tags[$tag]))
        {
            foreach ($this->tags[$tag] as $view)
            {
                $results[] = $view;
            }

        }

        return $results;
    }
939903
public function getTerms($post)
    {
        $taxonomies = get_field('taxonomy_display', $this->data['ID']);

        if (empty($taxonomies)) {
            return [];
        }


        $terms = array();
        if (!empty($taxonomies)) {
            foreach ($taxonomies as $taxonomy) {
                $terms = array_merge($terms, get_the_terms($post->ID, $taxonomy));
            }
        }

        return $terms;
    }
241001
public function getTags($blog, array $postData = [])
    {
        $postUuids = array_column($postData, 'id');

        $event = new GenericDataEvent([
            'class' => 'Icap\BlogBundle\Entity\Post',
            'ids' => $postUuids,
            'frequency' => true,
        ]);

        $this->eventDispatcher->dispatch(
            'claroline_retrieve_used_tags_by_class_and_ids',
            $event
        );
        $tags = $event->getResponse();

        //only keep max tag number, if defined
        if ($blog->getOptions()->isTagTopMode() && $blog->getOptions()->getMaxTag() > 0) {
            arsort($tags);
            $tags = array_slice($tags, 0, $blog->getOptions()->getMaxTag());
        }

        return (object) $tags;
    }
1191164
private function get_metadata( $post_id ) {
		$metadata = get_metadata( 'post', $post_id );
		$items    = [];
		foreach ( $metadata as $key => $values ) {
			foreach ( $values as $item_value ) {
				$item_value    = maybe_unserialize( $item_value );
				$items[ $key ] = $item_value;
			}
		}

		return $items;
	}
309394
protected function get_placeholders(){
        return [
            'title' => $this->__('Post title'),
            'url' => $this->__('Permalink'),
            'excerpt' => $this->__('Excerpt'),
            'date' => $this->__('Published'),
            'modified' => $this->__('Last modified'),
            'author' => $this->__('Author name'),
            'category' => $this->__('Category'),
            'tag' => $this->__('Post tag'),
        ];
    }