Show default page.

@param  string  $slug

@return mixed
335335
protected function page($slug)
    {
        $page = Content::page()->publish()->where('slug', '=', $slug)->firstOrFail();
        $slug = preg_replace('/^_page_\//', '', $slug);

        if (! View::exists($view = "orchestra/story::pages.{$slug}")) {
            $view = 'orchestra/story::page';
        }

        return Facile::view($view)->with(['page' => $page])->render();
    }
1020264
public function show($slug)
	{
		$post = $this->posts->findBySlug($slug);

		if ( ! $post)
		{
			return App::abort(404, 'Page not found');
		}

		return View::make($this->theme.'.post', compact('post'));
	}
917243
public function checkIfSlugIsUnique($slug)
    {
        $i = 0;
        $this->base_slug = $slug;

        while ($this->post->whereSlug($slug)->get()->count() > 0) {
            $i++;
            $slug = "$this->base_slug-$i";
        }

        return $slug;
    }
695330
public function findBySlug($slug)
    {
        return $this->plugger
            ->setModel($this)
            ->setAdapter(Post::class)
            ->plugIn(get_page_by_path($slug, OBJECT, $this->getSlug()))
            ->getConnected()
            ->first();
    }
853308
public function actionViewBySlug($slug)
    {
        $lh = $this->module->langHelper;
        $language = $lh::normalizeLangCode(Yii::$app->language);

        $model = null;
        $modelI18n = $this->module->model('NewsI18n')->findOne([
            'slug' => $slug,
            'lang_code' => $language,
        ]);

        // but after language switching slug for article on another language can be another
        if (empty($modelI18n)) {  // try to get language from referer
            $referer = Yii::$app->request->referrer;
            $hostInfo = Yii::$app->request->hostInfo;
            if (0 === strpos($referer, $hostInfo)) {
                $previousLanguage = substr($referer, strlen($hostInfo) + 1, 2);
                $previousLanguage = $lh::normalizeLangCode($previousLanguage);
                $modelI18n = $this->module->model('NewsI18n')->findOne([
                    'slug' => $slug,
                    'lang_code' => $previousLanguage,
                ]);
                if (!empty($modelI18n)) {  // found i18n-model for previous language
                    $model = $modelI18n->getMain()->one();  // get common model
                    if (!empty($model)) {
                        $modelsI18n = $model::prepareI18nModels($model);
                        if (!empty($modelsI18n[$language])) {
                            // do now show page with illegal slug in URL - prepare to redirect with correct slug
                            $newSlug = $modelsI18n[$language]->slug;
                            $result = Yii::$app->getUrlManager()->parseRequest(Yii::$app->request);
                            if (is_array($result)) {
                                list ($route, $routeParams) = $result;
                                $routeParams[0] = $route;
                                $routeParams['lang'] = $language;
                                $routeParams['slug'] = $newSlug;
                                $link = Yii::$app->urlManager->createUrl($routeParams);
                                return $this->redirect($link);
                            }                
                        }
                    }
                }
            }
        }
        
        if (!empty($modelI18n)) {
            $contentHelper = new $this->contentHelperClass;
            $modelI18n->body = $contentHelper::afterSelectBody($modelI18n->body);
            $model = $modelI18n->getMain()->one();
        }

        $searchModel = $this->module->model('NewsSearchFront');
        $model = $searchModel::canShow($model, $modelI18n);
        if (!$model) {
            $modelI18n = false;
        }

        return $this->render('view', compact('model', 'modelI18n'));
    }
899814
public function getThemePath($slug)
    {
        if (Str::length($slug) > 3) {
            $theme = Str::studly($slug);
        } else {
            $theme = Str::upper($slug);
        }

        return $this->getThemesPath() .DS .$theme .DS;
    }
1265499
public function getBySlug($slug)
    {
        $image = $this->adapter->get(sprintf('%s/images/%s', $this->endpoint, $slug));

        $image = json_decode($image);

        return new ImageEntity($image->image);
    }
534188
public function get($slug)
    {
        return $this->ports->first(function (Port $port) use ($slug) {
            return $port->slug() === $slug;
        });
    }
1257290
static function getBaseTheme( $slug ) {
		$filename = static::getCustomCssFolder() . sanitize_file_name( $slug . '.css' );
		if ( ! file_exists( $filename ) ) {
			return false;
		}
		$theme = get_file_data(
			$filename, [
				'ThemeURI' => 'Theme URI',
			]
		);
		$theme_slug = str_replace( [ 'http://pressbooks.com/themes/', 'https://pressbooks.com/themes/' ], [ '', '' ], $theme['ThemeURI'] );

		return untrailingslashit( $theme_slug );
	}
336297
public static function grab($slug)
    {
        /*
         * Comment out prior to 0.2 launch. Will cause massive amount
         * of Database queries. Only for adding new settings while
         * in development and testing.
         */
        //       Cache::flush();

        $setting = Cache::remember('ticketit::settings.'.$slug, 60, function () use ($slug) {
            $settings = Cache::remember('ticketit::settings', 60, function () {
                return Table::all();
            });

            $setting = $settings->where('slug', $slug)->first();

            if ($setting->lang) {
                return trans($setting->lang);
            }

            if (self::is_serialized($setting->value)) {
                $setting = unserialize($setting->value);
            } else {
                $setting = $setting->value;
            }

            return $setting;
        });

        return $setting;
    }
842700
public function getSlug() : ?string 
    {
        if ( ! $this->hasSlug()) {
            $this->setSlug($this->getDefaultSlug());
        }
        return $this->slug;
    }
1061039
public function widget($slug)
    {
        $widget = app(WidgetRepository::class)->getBySlug($slug);

        if ($widget) {
            if (Gate::allows('cms', Auth::user())) {
                $widget->content .= '<a href="'.url(config('cms.backend-route-prefix', 'cms').'/widgets/'.$widget->id.'/edit').'" class="btn btn-sm ml-2 btn-outline-secondary"><span class="fa fa-edit"></span> Edit</a>';
            }

            if (config('app.locale') !== config('cms.default-language') && $widget->translation(config('app.locale'))) {
                return $widget->translationData(config('app.locale'))->content;
            } else {
                return $widget->content;
            }
        }

        return '';
    }
146814
protected function activateUrl(string $slug, string $type): string
    {
        $qualifier           = $type === 'theme' ? $slug : null;
        $identifier          = $type === 'theme' ? 'stylesheet' : 'plugin';
        $nonce_action_prefix = $type === 'theme' ? 'switch' : 'activate';

        if ($type === 'plugin' && !($qualifier = $this->s::installedPluginData($slug, 'basename'))) {
            return ''; // Not installed or no basename.
        } // Possible empty string on failure. Please check return value.

        $args = [
            'action'        => 'activate',
            '___action_via' => $this->App->Config->©brand['©slug'],
            $identifier     => $qualifier, // Dependency.
        ];
        // Activations always use `self_admin_url()`.

        $url = self_admin_url('/'.$type.'s.php');
        $url = $this->c::addUrlQueryArgs($args, $url);
        $url = $this->s::addUrlNonce($url, $nonce_action_prefix.'-'.$type.'_'.$qualifier);

        return $url;
    }
730138
public function actionIndex($slug)
    {
        $this->trigger(self::EVENT_BEFORE_VIEW_SHOW);

        $data['slug'] = $slug;
        $data['route'] = '/' . $this->getRoute();

        $videoFinder = new VideoFinder();
        $data['video'] = $videoFinder->findBySlug($slug);

        if (empty($data['video'])) {
            throw new NotFoundHttpException('The requested page does not exist.');
        }

        $settings = Yii::$app->settings->getAll();
        $settings['videos'] = Module::getInstance()->settings->getAll();

        if ($data['video']['template'] !== '') {
            $template = $data['video']['template'];
        } else {
            $template = 'view';
        }

        Event::on(self::class, self::EVENT_AFTER_VIEW_SHOW, [\ytubes\videos\events\UpdateCountersEvent::class, 'onClickVideo'], $data);

        $this->trigger(self::EVENT_AFTER_VIEW_SHOW);

        return $this->render($template, [
            'data' => $data,
            'settings' => $settings
        ]);
    }
965900
public function indexAction(Request $request, $slug)
    {
        $em = $this->getDoctrine()->getManager();
        $page = $em->getRepository('AmulenPageBundle:Page')->findOneBy(array("slug" => $slug));
        if (!$page) {
            return $this->redirect($this->generateUrl('homepage'));
        }

        $response = $this->forward('FlowcodePageBundle:Page:show', array(
            'id' => $page->getId(),
            'parameterBag' => $request->query->all(),
        ));
        return $response;
    }
944440
public function page($slug, $action)
    {
        $route = $this->addRoute('GET', $slug, $action);
        $route->setWordPressConditional('is_page');

        return $route;
    }
879634
public function showAction($slug)
    {
        $securityContext = $this->container->get('security.authorization_checker');
        $question        = $this->getQuestionRepository()->findOneBySlug($slug);

        if (!$question || (!$question->isPublic() && !$securityContext->isGranted('ROLE_EDITOR'))) {
            throw $this->createNotFoundException('question not found');
        }

        return $this->render(
            'GenjFaqBundle:Question:show.html.twig',
            array(
                'question' => $question
            )
        );
    }