Check if current post is included in a manually picked data source in exapndable list
@param  integer $id Post id
@return array       Modules included in
17083
public function checkIfManuallyPicked($id)
    {
        global $wpdb;

        $result = $wpdb->get_results("
            SELECT *
            FROM $wpdb->postmeta
            WHERE meta_key = 'posts_data_posts'
                  AND meta_value LIKE '%\"{$id}\"%'
        ", OBJECT);

        if (count($result) === 0) {
            return false;
        }

        $posts = array();
        foreach ($result as $item) {
            $posts[] = $item->post_id;
        }

        return $posts;
    }
844203
public function findParentNodesByChildId($id)
	{
        // To be returned
        $result = array();

        $rl = $this->getRelations();
        $data = $rl[RelationBuilder::TREE_PARAM_ITEMS];

        // If can't find, then return empty array
        if (!isset($data[$id])) {
            return array();
        }

        $current = $data[$id];
        $parentId = $current[RelationBuilder::TREE_PARAM_PARENT_ID];

        while (isset($data[$parentId])) {
            $current = $data[$parentId];
            $parentId = $current[RelationBuilder::TREE_PARAM_PARENT_ID];

            array_push($result, $current);
        }

        return $result;
    }
1312463
protected function getAnchorsInPage($id)
    {
        $page = SiteTree::get()->byID($id);

        if (!$page || !$page->canView()) {
            return [];
        }

        return $page->getAnchorsOnPage();
    }
513064
public function MangaNews(int $id): array
    {
        return $this->myanimelist->getNewsList(
            new Request\Manga\MangaNewsRequest($id)
        );
    }
548840
public function get_data( $id, $is_valid = true ) {
		$table = $this->get_related_table_name();
		$data  = $this->app->db->select_row( $table, [
			'id' => $id,
		] );
		if ( empty( $data ) ) {
			return false;
		}
		$post_id = $data['post_id'];
		$post    = get_post( $post_id );
		if ( empty( $post ) || $post->post_type != $this->get_post_type() || ( $is_valid && $post->post_status !== 'publish' ) ) {
			return false;
		}

		return $this->filter_item( $this->set_post_data( $data, $post ) );
	}
604313
public function getPostEditPost($id)
    {
        $form = new EditPostForm($this->di, $id);
        $form->check();

        $views = [
            ["comment/default-form", ["form" => $form->getHTML()], "main"]
        ];

        $this->di->get("pageRenderComment")->renderPage([
            "views" => $views,
            "title" => "Edit post | $id"
        ]);
    }
317616
public function install($id)
    {
        $plugin = $this->getById($id);
        if (!$plugin) {
            return ['code' => -1, 'message' => 'Plugin not found'];
        }

        if ($this->isInstalled($id)) {
            return ['code' => -2, 'message' => 'Plugin has been installed'];
        }

        $ret = $plugin->install();
        if ($ret['code'] !== 1) {
            return $ret;
        }

        $pluginIds = $this->getInstalledIds();
        $pluginIds[] = $id;
        $this->setInstalledIds($pluginIds);

        $this->getEvents(true);

        return $ret;
    }
396558
public function hasDirectory($id)
    {
        $fsConfig = $this->getOption(self::OPTION_ADAPTERS);
        return isset($fsConfig[$id]);
    }
240132
protected function flaggedForImport( $id ) {

		$chapters = getset( '_POST', 'chapters' );

		if ( ! is_array( $chapters ) ) {
			return false;
		}

		if ( ! isset( $chapters[ $id ] ) ) {
			return false;
		}

		if ( ! isset( $chapters[ $id ]['import'] ) ) {
			return false;
		}

		return ( 1 === (int) $chapters[ $id ]['import'] ? true : false );
	}
851672
public static function images($id)
    {
        $sizes = self::imageSizes();
        $urls = [];

        if(has_post_thumbnail($id))
        {
            $image = wp_get_attachment_image_src(
                get_post_thumbnail_id($id),
                'full'
            );

            $image = pathinfo($image[0]);
            $extension = $image['extension'];
            $image = $image['dirname'] . '/' . $image['filename'];
            $urls['full'] = $image . '.' . $extension;

            foreach($sizes as $size)
            {
                $urls[Data::spaceToCamelCase($size->name, '-')] = $image . '-' . $size->width . 'x' . $size->height . '.' . $extension;
            }

            return (object) $urls;
        }
        else
        {
            return false;
        }
    }
1370658
public function getDependencies($id)
    {
        return (isset($this->dependenciesById[$id])) ?
            $this->dependenciesById[$id] :
            null;
    }
1063719
public function findById($id)
    {
        $result = array();
        $relations = $this->getRelations();

        $items = $relations[RelationBuilder::TREE_PARAM_ITEMS];

        if (isset($items[$id])) {
            return $items[$id];
        } else {
            return false;
        }
    }
249972
public static function getPosts($module)
    {
        $fields = json_decode(json_encode(get_fields($module->ID)));
        if ($fields->posts_data_source == 'input') {
            return self::getManualInputPosts($fields->data);
        }

        return get_posts(self::getPostArgs($module->ID));
    }
556787
public function hasActive($id)
    {
        foreach ($this->getChildren() as $child) {
            if ($child->hasActive($id) || $child->getId() == $id) {
                return true;
            }
        }

        return false;
    }
182276
public static function getModuleUsage($id, $limit = false)
    {
        global $wpdb;

        // Normal modules
        $query = "
            SELECT
                {$wpdb->postmeta}.post_id,
                {$wpdb->posts}.post_title,
                {$wpdb->posts}.post_type
            FROM {$wpdb->postmeta}
            LEFT JOIN
                {$wpdb->posts} ON ({$wpdb->postmeta}.post_id = {$wpdb->posts}.ID)
            WHERE
                {$wpdb->postmeta}.meta_key = 'modularity-modules'
                AND ({$wpdb->postmeta}.meta_value REGEXP '.*\"postid\";s:[0-9]+:\"{$id}\".*')
                AND {$wpdb->posts}.post_type != 'revision'
            ORDER BY {$wpdb->posts}.post_title ASC
        ";

        $modules = $wpdb->get_results($query, OBJECT);

        // Shortcode modules
        $query = "
            SELECT
                {$wpdb->posts}.ID AS post_id,
                {$wpdb->posts}.post_title,
                {$wpdb->posts}.post_type
            FROM {$wpdb->posts}
            WHERE
                ({$wpdb->posts}.post_content REGEXP '([\[]modularity.*id=\"{$id}\".*[\]])')
                AND {$wpdb->posts}.post_type != 'revision'
            ORDER BY {$wpdb->posts}.post_title ASC
        ";

        $shortcodes = $wpdb->get_results($query, OBJECT);

        $result = array_merge($modules, $shortcodes);

        if (is_numeric($limit)) {
            if (count($result) > $limit) {
                $sliced = array_slice($result, $limit);
            } else {
                $sliced = $result;
            }

            return (object) array(
                'data' => $sliced,
                'more' => (count($result) > 0 && count($sliced) > 0) ? count($result) - count($sliced) : 0
            );
        }

        return $result;
    }
1092207
public function actionMods($id = null)
    {
        $mod = null;
        $moderators = User::find()->where(['role' => User::ROLE_MODERATOR])->indexBy('id')->all();
        if (is_numeric($id) && $id > 0) {
            if (isset($moderators[$id])) {
                $mod = $moderators[$id];
            }
        } else {
            reset($moderators);
            $mod = current($moderators);
        }
        $searchModel = new ForumSearch();
        $dataProvider = $searchModel->searchForMods(Yii::$app->request->get());
        $postData = Yii::$app->request->post();
        if ($postData) {
            if (!User::can(Rbac::PERM_PROMOTE_USER)) {
                $this->error(Yii::t('podium/flash', 'You are not allowed to perform this action.'));
            } else {
                $mod_id = !empty($postData['mod_id']) && is_numeric($postData['mod_id']) && $postData['mod_id'] > 0 ? $postData['mod_id'] : 0;
                $selection = !empty($postData['selection']) ? $postData['selection'] : [];
                $pre = !empty($postData['pre']) ? $postData['pre'] : [];
                if ($mod_id == $mod->id) {
                    if ($mod->updateModeratorForMany($selection, $pre)) {
                        $this->success(Yii::t('podium/flash', 'Moderation list has been saved.'));
                    } else {
                        $this->error(Yii::t('podium/flash', 'Sorry! There was an error while saving the moderation list.'));
                    }
                    return $this->refresh();
                }
                $this->error(Yii::t('podium/flash', 'Sorry! There was an error while selecting the moderator ID.'));
            }
        }
        return $this->render('mods', [
            'moderators' => $moderators,
            'mod' => $mod,
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }
225439
public function getEdit($id = '')
    {

        $form = FormBuilder::create(get_class($this->form));


        $form_content = view('form-builder::form.components.formgenerator.full', [
            'form' => $form
        ]);
        $content      = view('expendable::admin.form.state.form', [

        ]);

        $this->layoutManager->add([
            'form'    => $form_content,
            'content' => $content,
        ]);

        return $this->layoutManager->render();
    }