本文整理汇总了PHP中Illuminate\Support\Facades\View::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP View::exists方法的具体用法?PHP View::exists怎么用?PHP View::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\View
的用法示例。
在下文中一共展示了View::exists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderTheme
/**
* @param $theme
* @param $data
* @return mixed
*/
protected function renderTheme($theme, $data)
{
$customTemplate = 'blade-pagination/' . $theme;
if (View::exists($customTemplate)) {
return View::make($customTemplate, $data)->render();
}
return View::make('blade-pagination::' . $theme, $data)->render();
}
示例2: page
/**
* Show default page.
*
* @param string $slug
*
* @return mixed
*/
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();
}
示例3: getResponse
/**
* {@inheritdoc}
*/
protected function getResponse($page, $id, $slug)
{
$slug = preg_replace('/^_post_\\//', '', $slug);
if (!View::exists($view = "orchestra/story::posts.{$slug}")) {
$view = 'orchestra/story::post';
}
$data = ['id' => $id, 'page' => $page, 'slug' => $slug];
return Facile::view($view)->with($data)->render();
}
示例4: getView
public function getView($format)
{
// if a custom view is set, we don't have to account for the format and assume
// that the developer knows what he's doing
if ($this->customView !== null && View::exists($this->customView)) {
return $this->customView;
}
return $format;
}
示例5: page
public function page($slug = 'index')
{
$view = implode('/', ['pages', $slug]);
if (!View::exists($view)) {
abort(404);
}
$locale = App::getLocale();
$pageInMarkdown = base_path("resources/pages/{$locale}/{$slug}.md");
$pageInHtml = file_exists($pageInMarkdown) ? (new ParsedownExtra())->text(File::get($pageInMarkdown)) : '';
return view($view, ['slug' => $slug, 'html' => $pageInHtml]);
}
示例6: translateView
/**
* Translate view name
*
* @param $name
* @param string $delimiter
* @return string
*/
protected function translateView($name, $delimiter = '.')
{
$locale = App::getLocale();
$explodedName = (array) explode($delimiter, $name);
$replaceable = end($explodedName);
$replaced = preg_replace("~{$replaceable}(?!.*{$replaceable})~", "{$locale}{$delimiter}{$replaceable}", $name);
if (View::exists($replaced)) {
return $replaced;
}
return $name;
}
示例7: getEmailBugLink
public static function getEmailBugLink(\Exception $exception, $message)
{
$lang = App::getLocale();
$fallbackLang = Config::get('app.fallback_locale');
$emergencyLang = 'en';
$translatedMail = "pretty-error-page::mail.{$lang}";
$fallbackMail = "pretty-error-page::mail.{$fallbackLang}";
$emergencyMail = "pretty-error-page::mail.{$emergencyLang}";
$mailView = View::exists($translatedMail) ? $translatedMail : (View::exists($fallbackMail) ? $fallbackMail : $emergencyMail);
View::share('exception', $exception);
View::share('message', $message);
$mailBody = rawurlencode(View::make($mailView)->render());
$mailRecipient = Config::get('pretty-error-page::recipient');
return "mailto:{$mailRecipient}?body={$mailBody}";
}
示例8: render
public function render($view = '', array $data = array())
{
if (count($data) === 0) {
foreach ($data as $k => $v) {
$this->data($k, $v);
}
}
if (empty($view) || !View::exists($view)) {
$view = $this->_view;
}
if (View::exists($view)) {
return View::make($view, $this->viewData)->with('messages', $this->getMessageBag());
}
return View::make('noexist', array('message' => 'View <strong>' . $view . '</strong> doesn\'t exist'));
}
示例9: sendMail
/**
* Global method to send an email using the provided data
*
* @param array $data
* @param array $mailingList
* @param string $baseUrl
* @param string $htmlTemplate
* @param string $textTemplate
* @return bool
*/
protected function sendMail(array $data, array $mailingList, $baseUrl, $htmlTemplate, $textTemplate)
{
if (View::exists($htmlTemplate) && View::exists($textTemplate)) {
$mailFrom = $this->mailFrom;
Mail::send(array('html' => $htmlTemplate, 'text' => $textTemplate), $data, function ($message) use($mailingList, $baseUrl, $mailFrom) {
$message->from($mailFrom);
$message->subject('Error while using ' . $baseUrl);
foreach ($mailingList as $emailAddress) {
$message->to($emailAddress);
}
});
return true;
}
return false;
}
示例10: matchStaticView
/**
* Returns the matching static view for the request (if the file
* exists), otherwise returns the 404 response.
*
* TODO: Review the security of matchStaticView() function. Does
* the Laravel framework already filter the "Request::path()" or
* "View::make()" methods, or do we need to filter out possible
* directory traversal attacks from the "requestPath" variable?
*
* @param array $parameters Optional parameters for the View
* @param string $view Render the content with the specific view template
* @return View
*/
private function matchStaticView($parameters = array(), $view = null)
{
$basePath = rtrim(base_path(), "/");
$requestPath = rtrim(mb_strtolower(Request::path()), "/");
$fullStaticViewPath = "{$basePath}/resources/views/pages/{$requestPath}";
$staticViewFilename = "pages/{$requestPath}";
if (is_dir($fullStaticViewPath)) {
$staticViewFilename .= "/index";
}
if (View::exists($staticViewFilename)) {
return View::make($staticViewFilename, $parameters);
}
if (isset($view) && View::exists($view)) {
return View::make($view, $parameters);
}
# Otherwise return the 404 response
return App::abort(404);
}
示例11: preview
public function preview($entity, $id)
{
$modelString = 'Yab\\Quarx\\Models\\' . ucfirst($entity);
if (!class_exists($modelString)) {
$modelString = 'Yab\\Quarx\\Models\\' . ucfirst($entity) . 's';
}
$model = new $modelString();
$modelInstance = $model->find($id);
$data = [$entity => $modelInstance];
$view = 'quarx-frontend::' . $entity . '.show';
if (!View::exists($view)) {
$view = 'quarx-frontend::' . $entity . 's.show';
}
if ($entity === 'page') {
$view = 'quarx-frontend::pages.' . $modelInstance->template;
}
return view($view, $data);
}
示例12: getView
/**
* Get view name
* Defaults to the package views unless a custom view is set
*
* @param string $format
*
* @return void
*/
public function getView($format)
{
// if a custom view is set, we don't have to account for the format and assume
// that the developer knows what he's doing
if ($this->customView !== null && View::exists($this->customView)) {
return $this->customView;
}
$packagePrefix = 'feed::';
// for package's default views, we send the view name with appropriate format
return $packagePrefix . $format;
}
示例13: getView
/**
* Get view name
*
* @param string $format
*
* @return void
*/
public function getView($format)
{
// if a custom view is set
if ($this->customView !== null && View::exists($this->customView)) {
return $this->customView;
}
// else return default view
return 'feed::' . $format;
}
示例14: getEmbedHtml
public function getEmbedHtml($height = null, $width = null)
{
$viewPrefix = 'boomcms::assets.embed.';
$assetType = strtolower(class_basename($this->getType()));
$viewName = View::exists($viewPrefix . $assetType) ? $viewPrefix . $assetType : $viewPrefix . 'default';
return View::make($viewName, ['asset' => $this, 'height' => $height, 'width' => $width]);
}
示例15: fileExists
/**
* @return bool
*/
public function fileExists()
{
return View::exists($this->getFullFilename());
}