Add modules to post_content before indexing a post (makes modules searchable)
@param  WP_Post $post
@return post object
515921
public function elasticPressPreIndex($post)
    {
        $rendered = $this->getRenderedPostModules($post);

        if (is_array($post)) {
            $post['post_content'] .= $rendered;
        } else {
            $post->post_content .= $rendered;
        }

        return $post;
    }
621162
public function add_wp()
    {
        global $wp;

        if (! $wp instanceof WP) {
            return array();
        }

        $output = \get_object_vars($wp);

        unset($output['private_query_vars'], $output['public_query_vars']);

        return \array_filter($output);
    }
697101
def _new_mods(pre_mods, post_mods):
    '''
    
    '''
    pre = set()
    post = set()
    for mod in pre_mods:
        pre.add(mod['module'])
    for mod in post_mods:
        post.add(mod['module'])
    return post - pre
1098674
protected function afterPostCreated(MicroPost $post) {
		$tags = array();
		
		if ($this->data()->SelfTagPosts) {
			$tags[] = $this->data()->selfTag();
		}
		
		$add = $this->AddTags->getValues();
		if (count($add)) {
			$tags = array_merge($tags, $add);
		}

		$post->tag($tags);
	}
580041
public function postTerms(Post $post)
    {
        $adaptees = wp_get_post_terms($post->id, $this->getSlug());

        return $this->plugger
            ->setModel($this)
            ->setAdapter(Term::class)
            ->plugIn($adaptees)
            ->getConnected();
    }
263949
private function extractPostProperties(\WP_Post $post)
    {
        foreach ($post as $key => $value) {
            $this->extractedPostProperties[] = $key;
            $this->$key = $value;
            $this->data[$key] = $value;
        }
    }
125110
public static function get_post_meta_description( $post ) {
		$description = get_post_meta( $post->ID, '_yoast_wpseo_metadesc', true );

		if ( empty( $description ) ) {
			$description = Text::trim_to_nearest_word( wp_strip_all_tags( $post->post_content ), 160 );
		}

		return $description;
	}
432263
public function searchAttachmentPermalink($permalink, $post)
    {
        if (isset($post->post_type) && $post->post_type == 'attachment') {
            return wp_get_attachment_url($post->ID);
        } else {
            return $permalink;
        }
    }
96504
public function getRenderedPostModules($post)
    {
        if (!$post) {
            return;
        }

        if (is_array($post)) {
            $postId = $post['ID'];
        } else {
            $postId = $post->ID;
        }

        $modules = \Modularity\Editor::getPostModules($postId);
        $onlyModules = array();

        // Normalize modules array
        foreach ($modules as $sidebar => $item) {
            if (!isset($item['modules']) || count($item['modules']) === 0) {
                continue;
            }

            $onlyModules = array_merge($onlyModules, $item['modules']);
        }

        // Render modules and append to post content
        $rendered = "<br><br>";
        foreach ($onlyModules as $module) {
            if ($module->post_type === 'mod-wpwidget') {
                continue;
            }

            $markup = \Modularity\App::$display->outputModule($module, array('edit_module' => false), array(), false);
            $rendered .= $markup;
        }

        return $rendered;
    }
793961
public function columnFieldsMetaBoxContent($post, $args)
    {
        $fields = $args['args'][0];
        $fieldValues = get_post_meta($post->ID, 'modularity-mod-posts-expandable-list', true);

        foreach ($fields as $field) {
            $fieldSlug = sanitize_title($field);
            $value = isset($fieldValues[$fieldSlug]) && !empty($fieldValues[$fieldSlug]) ? $fieldValues[$fieldSlug] : '';
            echo '
                <p>
                    <label for="mod-' . $fieldSlug . '">' . $field . ':</label>
                    <input value="' . $value . '" class="widefat" type="text" name="modularity-mod-posts-expandable-list[' . sanitize_title($field) . ']" id="mod-' . sanitize_title($field) . '">
                </p>
            ';
        }

        echo wp_nonce_field('save_columns', 'modularity_post_columns');
    }
96697
public static function &getModules($position)
    {
        if($position) {
            $modules =& JModuleHelper::getModules($position);
        } else {
            $modules =& JModuleHelper::_load();
        }

        return $modules;
    }
555626
private function get_modules_content( \WP_Post $post ) : string {
		$flexible_content = $this->_flexible_content[ $post->ID ] ?? null;

		if ( empty( $flexible_content ) ) {
			$layouts = $this->get_current_post_layouts( $post );

			foreach ( $layouts as $layout ) {

				if ( ! isset( $layout['acf_fc_layout'] ) || empty( $layout['acf_fc_layout'] ) ) {
					continue;
				}

				ob_start();
				$this->render_module_template( $layout['acf_fc_layout'], $layout );
				$flexible_content .= ob_get_clean();
			}

			/*
			 * Store the flexible content to reuse it if `the_content` is
			 * runned more than once.
			 */
			$this->_flexible_content[ $post->ID ] = $flexible_content;
		}

		return (string) $flexible_content;
	}
714611
public function metaBoxSidebar($post, $args)
    {
        global $post;

        $options = null;

        if (\Modularity\Helper\Post::isArchive()) {
            global $archive;
            $options = get_option('modularity_' . $archive . '_sidebar-options');
        } else {
            if ($post) {
                $options = get_post_meta($post->ID, 'modularity-sidebar-options', true);
            } else {
                if (!isset($_GET['id']) || empty($_GET['id'])) {
                    throw new \Error('Get paramter ID is empty.');
                }

                $options = get_post_meta($_GET['id'], 'modularity-sidebar-options', true);
            }
        }

        if (isset($options[$args['args']['sidebar']['id']])) {
            $options = $options[$args['args']['sidebar']['id']];
        } else {
            $options = null;
        }

        include MODULARITY_TEMPLATE_PATH . 'editor/modularity-sidebar-drop-area.php';
    }
760588
protected function set_post_data( $data, $post ) {
		$data['post_title'] = $post->post_title;
		$data['post']       = $post;
		if ( $this->user_can( 'read_post' ) ) {
			$data['edit_link'] = get_edit_post_link( $post->ID );
		}

		foreach ( $this->get_data_field_settings() as $k => $v ) {
			$data[ $k ] = $this->sanitize_input( $this->app->utility->array_get( $data, $k ), $v['type'] );
		}

		return $data;
	}
332096
public function create($user, $post)
    {
        return $this->postPolicy->create($user, $post)
            && $user->can('blog.comment.edit');
    }
758855
public function updateOrFail(Post $post)
    {
        $status = $this->update($post);

        if (is_wp_error($status)) {
            throw new QueryException("Posttype [{$this->slug}] could not update post with id: {$id}.");
        }

        return $status;
    }
380795
public function getTermsForPost(AbstractPost $post)
    {
        $terms = array();

        if ($dbTerms = get_the_terms($post->getId(), $this->getName())) {
            foreach ($dbTerms as $termData) {
                $terms[] = $this->termFactory->create($termData, $this);
            }
        }

        return $terms;
    }