Check if a post type has its on Controller (check made by patter {slug}Controller.php.

@param  $postTypeSlug
@return bool
336674
public static function haveItsOwnController($postTypeSlug)
    {
        $postTypeSlug = ucfirst(camel_case($postTypeSlug));
        $filePath = Theme::getPath() . '/controllers/'.$postTypeSlug.'Controller.php';

        if(file_exists($filePath)) {
            return true;
        }

        return false;
    }
1316628
private function isPosting() {
		if ( empty( $_POST['activateKey'] ) ) {
			return false;
		}

		if ( empty( $_GET['nonce'] ) || ! wp_verify_nonce( $_GET['nonce'], 'bglib-key-prompt') ) {
			return false;
		}

		if ( ! current_user_can( 'update_plugins' ) ) {
			return false;
		}

		return true;
	}
1203507
public function findBySlug($slug)
    {
        return $this->model
            ->whereSlug($slug)
            ->with($this->with)
            ->first();
    }
1123247
public function postsSingle($lang, $postTypeSlug, $view, $id)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess($postTypeSlug, $view, $id, true)) {
            $message = "You can't edit this post because you don't own it!";
            return view('errors.permissions', compact('message'));
        }
        return view('content');
    }
1270673
public function isCorsRequest(string $type, $request): bool
    {
        $origin = (new Request($type, $request))->getOrigin();

        switch (strtolower($type)) {
            case 'psr-7':
                $scheme = $request->getUri()->getScheme();
                $httpHost = $scheme.'://'.$request->getUri()->getHost();
                $port = $request->getUri()->getPort();

                if (('http' == $scheme && 80 == $port) || ('https' == $scheme && 443 == $port)) {
                    $isSameHost = $origin === $httpHost;
                    break;
                }

                $isSameHost = $origin === ($httpHost.':'.$port);
                break;

            case 'laravel':
            case 'symfony':
                $isSameHost = $origin === $request->getSchemeAndHttpHost();
                break;

            default:
                $isSameHost = false;
                break;
        }

        return $origin && !$isSameHost;
    }
772679
public function findOneBySlug($slug)
    {
        return $this->_em->createQueryBuilder()
            ->select('p, t, c, co')
            ->from('VeonikBlogBundle:AbstractPost', 'p')
            ->leftJoin('p.tags', 't')
            ->leftJoin('p.categories', 'c')
            ->leftJoin('p.comments', 'co')
            ->where('p.slug = :slug')
            ->andWhere('p.active = true')
            ->setParameter('slug', $slug)
            ->getQuery()
            ->getOneOrNullResult();
    }
683747
public function hasImages($type = null)
    {
        if ($type) {
            if ($this->relationLoaded('images')) {
                return $this->images->contains('image_type', $type);
            } else {
                return $this->images()->where('image_type', '=', $type)->exists();
            }
        }

        return (bool) count($this->images);
    }
1182433
public function listing(Request $request, $contenttypeslug)
    {
        $listingParameters = $this->getListingParameters($contenttypeslug);
        $content = $this->getContent($contenttypeslug, $listingParameters);
        $contenttype = $this->getContentType($contenttypeslug);

        $template = $this->templateChooser()->listing($contenttype);

        // Make sure we can also access it as {{ pages }} for pages, etc. We set these in the global scope,
        // So that they're also available in menu's and templates rendered by extensions.
        $globals = [
            'records'        => $content,
            $contenttypeslug => $content,
            'contenttype'    => $contenttype['name'],
        ];

        return $this->render($template, [], $globals);
    }
211242
public function canHandle(string $type) : bool
    {
        $response = false;

        foreach ($this->contentTypes as $contentType) {
            if (stripos($type, $contentType) !== false) {
                $response = true;
                break;
            }
        }

        return $response;
    }
503883
protected function getSelectedCategory($categorySlug = null)
    {
        $selectedCategory = null;

        if ($categorySlug !== null) {
            $selectedCategory = $this->getCategoryRepository()->findOneBy(array('isActive' => true, 'slug' => $categorySlug));
        }

        return $selectedCategory;
    }
709865
public static function isExistBySlugType( $slug, $type, $config = [] ) {

		$model	= static::findBySlugType( $slug, $type, $config );

		return isset( $model );
	}
286283
public static function exists($sSlug): bool
    {
        $aModules = static::modules();

        foreach ($aModules as $oModule) {
            if ($sSlug === $oModule->slug) {
                return true;
            }
        }

        return false;
    }
1275139
public function getPost( $slug ) {

		// Supported post names (ie. slugs)
		$supported = array_keys( $this->supported );
		if ( ! in_array( $slug, $supported, true ) ) {
			return false;
		}

		$args = [
			'name' => $slug,
			'post_type' => 'custom-style',
			'posts_per_page' => 1,
			'post_status' => 'publish',
			'orderby' => 'modified',
			'no_found_rows' => true,
			'cache_results' => true,
		];

		$q = new \WP_Query();
		$results = $q->query( $args );

		if ( empty( $results ) ) {
			return false;
		}

		return $results[0];
	}
591419
public function record(Request $request, $contenttypeslug, $slug = '')
    {
        $contenttype = $this->getContentType($contenttypeslug);

        // If the ContentType is 'viewless', don't show the record page.
        if (isset($contenttype['viewless']) && $contenttype['viewless'] === true) {
            $this->abort(Response::HTTP_NOT_FOUND, "Page $contenttypeslug/$slug not found.");

            return null;
        }

        // Perhaps we don't have a slug. Let's see if we can pick up the 'id', instead.
        if (empty($slug)) {
            $slug = $request->get('id');
        }

        $slug = $this->app['slugify']->slugify($slug);

        // First, try to get it by slug.
        $content = $this->getContent($contenttype['slug'], ['slug' => $slug, 'returnsingle' => true, 'log_not_found' => !is_numeric($slug)]);

        if (is_numeric($slug) && !$content) {
            // And otherwise try getting it by ID
            $content = $this->getContent($contenttype['slug'], ['id' => $slug, 'returnsingle' => true]);
        }

        // No content, no page!
        if (!$content) {
            $this->abort(Response::HTTP_NOT_FOUND, "Page $contenttypeslug/$slug not found.");

            return null;
        }

        // Then, select which template to use, based on our 'cascading templates rules'
        $template = $this->templateChooser()->record($content);

        // Setting the editlink
        $this->app['editlink'] = $this->generateUrl('editcontent', ['contenttypeslug' => $contenttype['slug'], 'id' => $content->id]);
        $this->app['edittitle'] = $content->getTitle();

        // Make sure we can also access it as {{ page.title }} for pages, etc. We set these in the global scope,
        // So that they're also available in menu's and templates rendered by extensions.
        $globals = [
            'record'                      => $content,
            $contenttype['singular_slug'] => $content,
        ];

        return $this->render($template, [], $globals);
    }
223533
private static function createCategoryRelationsTable($postTypeSlug)
    {
        if(!Schema::hasTable($postTypeSlug."_categories")) {
            Schema::create(
                $postTypeSlug."_categories", function ($table) use ($postTypeSlug) {
                    // create general fields
                    $table->bigIncrements("categoryRelationID");
                    $table->bigInteger("postID")->unsigned()->nullable();
                    $table->unsignedInteger("categoryID")->nullable();

                    $table->foreign('postID')
                        ->references('postID')->on($postTypeSlug)
                        ->onDelete('cascade');

                    $table->foreign('categoryID')
                        ->references('categoryID')->on("categories")
                        ->onDelete('cascade');

                    $table->unique(array('postID', 'categoryID'));
                }
            );
        }
    }
1167838
public function getContentTypeGrouping($contenttypeslug)
    {
        $grouping = false;
        $taxonomy = $this->getContentTypeTaxonomy($contenttypeslug);
        foreach ($taxonomy as $tax) {
            if ($tax['behaves_like'] === 'grouping') {
                $grouping = $tax['slug'];
                break;
            }
        }

        return $grouping;
    }
428396
private function getPostSelectedCategories($id, $postTypeSlug)
    {
        // get the selected categories from the DB table categories_relations
        $categoryRelationTable = $postTypeSlug.'_categories';
        $selectedCategories = DB::table($categoryRelationTable)
            ->leftJoin('categories', $categoryRelationTable.'.categoryID', 'categories.categoryID')
            ->where($categoryRelationTable.'.postID', $id)
            ->select("categories.categoryID", "categories.postTypeID", "categories.title", "categories.slug")
            ->get();

        return Language::filterRows($selectedCategories, false);
    }