当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::content方法代码示例

本文整理汇总了PHP中Pagekit\Application::content方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::content方法的具体用法?PHP Application::content怎么用?PHP Application::content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pagekit\Application的用法示例。


在下文中一共展示了Application::content方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendMail

 /**
  * @return MailHelper
  */
 public function sendMail()
 {
     if (!($adminMail = $this->submission->form->get('submitEmail'))) {
         return $this;
     }
     $user_email = $this->submission->email ?: false;
     $mailSubject = $this->replaceString($this->submission->form->get('email_subject'));
     $mailBody = $this->replaceString($this->submission->form->get('email_body'));
     $mailBody = App::content()->applyPlugins($mailBody, ['submission' => $this->submission, 'markdown' => $this->submission->form->get('email_body_markdown')]);
     try {
         /** @var Message $mail */
         $mail = App::mailer()->create();
         if ($user_email && $this->submission->form->get('use_replyto', 0)) {
             $mail->setReplyTo($user_email);
         }
         $mail->setTo($adminMail)->setSubject($mailSubject)->setBody(App::view('bixie/formmaker/mails/template.php', compact('mailBody')), 'text/html')->send();
         if ($user_email) {
             $mail = App::mailer()->create();
             $mail->setTo($user_email)->setSubject($mailSubject)->setBody(App::view('bixie/formmaker/mails/template.php', compact('mailBody')), 'text/html')->send();
         }
     } catch (\Exception $e) {
         throw new Exception(__('Unable to send confirmation mail.'));
     }
     return $this;
 }
开发者ID:Bixie,项目名称:pagekit-formmaker,代码行数:28,代码来源:MailHelper.php

示例2: indexAction

 /**
  * @Route("/", methods="GET")
  * @Request({"filter": "array", "post":"int", "page":"int", "limit":"int"})
  */
 public function indexAction($filter = [], $post = 0, $page = 0, $limit = 0)
 {
     $query = Comment::query();
     $filter = array_merge(array_fill_keys(['status', 'search', 'order'], ''), $filter);
     extract($filter, EXTR_SKIP);
     if ($post) {
         $query->where(['post_id = ?'], [$post]);
     } elseif (!$this->user->hasAccess('blog: manage comments')) {
         App::abort(403, __('Insufficient user rights.'));
     }
     if (!$this->user->hasAccess('blog: manage comments')) {
         $query->where(['status = ?'], [Comment::STATUS_APPROVED]);
         if ($this->user->isAuthenticated()) {
             $query->orWhere(function ($query) {
                 $query->where(['status = ?', 'user_id = ?'], [Comment::STATUS_PENDING, App::user()->id]);
             });
         }
     } elseif (is_numeric($status)) {
         $query->where(['status = ?'], [(int) $status]);
     } else {
         $query->where(function ($query) {
             $query->orWhere(['status = ?', 'status = ?'], [Comment::STATUS_APPROVED, Comment::STATUS_PENDING]);
         });
     }
     if ($search) {
         $query->where(function ($query) use($search) {
             $query->orWhere(['author LIKE ?', 'email LIKE ?', 'url LIKE ?', 'ip LIKE ?', 'content LIKE ?'], array_fill(0, 5, "%{$search}%"));
         });
     }
     $count = $query->count();
     $pages = ceil($count / ($limit ?: PHP_INT_MAX));
     $page = max(0, min($pages - 1, $page));
     if ($limit) {
         $query->offset($page * $limit)->limit($limit);
     }
     if (preg_match('/^(created)\\s(asc|desc)$/i', $order, $match)) {
         $order = $match;
     } else {
         $order = [1 => 'created', 2 => App::module('blog')->config('comments.order')];
     }
     $comments = $query->related(['post' => function ($query) {
         return $query->related('comments');
     }])->related('user')->orderBy($order[1], $order[2])->get();
     $posts = [];
     foreach ($comments as $i => $comment) {
         $p = $comment->post;
         if ($post && (!$p || !$p->hasAccess($this->user) || !($p->isPublished() || $this->user->hasAccess('blog: manage comments')))) {
             App::abort(403, __('Post not found.'));
         }
         $comment->content = App::content()->applyPlugins($comment->content, ['comment' => true]);
         $posts[$p->id] = $p;
         $comment->special = count(array_diff($comment->user ? $comment->user->roles : [], [0, 1, 2]));
         $comment->post = null;
         $comment->user = null;
     }
     $comments = array_values($comments);
     $posts = array_values($posts);
     return compact('comments', 'posts', 'pages', 'count');
 }
开发者ID:vanclist,项目名称:spatoday,代码行数:63,代码来源:CommentApiController.php

示例3: getThankyou

 public function getThankyou()
 {
     if ($this->form->get('afterSubmit') == 'thankyou') {
         $thankyou = (new MailHelper($this))->replaceString($this->form->get('thankyou'));
         return App::content()->applyPlugins($thankyou, ['submission' => $this, 'markdown' => $this->form->get('thankyou_markdown')]);
     }
     return '';
 }
开发者ID:Eichi,项目名称:pagekit-formmaker,代码行数:8,代码来源:Submission.php

示例4: indexAction

 public function indexAction($id = 0)
 {
     if (!($page = Page::find($id))) {
         App::abort(404, __('Page not found.'));
     }
     $page->content = App::content()->applyPlugins($page->content, ['page' => $page, 'markdown' => $page->get('markdown')]);
     return ['$view' => ['title' => $page->title, 'name' => 'system/site/page.php'], 'page' => $page, 'node' => App::node()];
 }
开发者ID:pagekit,项目名称:pagekit,代码行数:8,代码来源:PageController.php

示例5: projectAction

 /**
  * @Route("/{id}", name="id")
  */
 public function projectAction($id = 0)
 {
     if (!($project = Project::where(['id = ?', 'date < ?'], [$id, new \DateTime()])->first())) {
         App::abort(404, __('Project not found.'));
     }
     $project->intro = App::content()->applyPlugins($project->intro, ['project' => $project, 'markdown' => $project->get('markdown')]);
     $project->content = App::content()->applyPlugins($project->content, ['project' => $project, 'markdown' => $project->get('markdown')]);
     $previous = Project::getPrevious($project);
     $next = Project::getNext($project);
     return ['$view' => ['title' => __($project->title), 'name' => 'bixie/portfolio/project.php'], 'portfolio' => $this->portfolio, 'config' => $this->portfolio->config(), 'previous' => $previous, 'next' => $next, 'project' => $project];
 }
开发者ID:4nxiety,项目名称:pagekit-portfolio,代码行数:14,代码来源:SiteController.php

示例6: postAction

 /**
  * @Route("/{id}", name="id")
  */
 public function postAction($id = 0)
 {
     if (!($post = Post::where(['id = ?', 'status = ?', 'date < ?'], [$id, Post::STATUS_PUBLISHED, new \DateTime()])->related('user')->first())) {
         App::abort(404, __('Post not found!'));
     }
     if (!$post->hasAccess(App::user())) {
         App::abort(403, __('Insufficient User Rights.'));
     }
     $post->excerpt = App::content()->applyPlugins($post->excerpt, ['post' => $post, 'markdown' => $post->get('markdown')]);
     $post->content = App::content()->applyPlugins($post->content, ['post' => $post, 'markdown' => $post->get('markdown')]);
     $user = App::user();
     return ['$view' => ['title' => __($post->title), 'name' => 'blog/post.php'], '$comments' => ['config' => ['post' => $post->id, 'enabled' => $post->isCommentable(), 'requireinfo' => $this->blog->config('comments.require_email'), 'max_depth' => $this->blog->config('comments.max_depth')], 'user' => ['name' => $user->name, 'isAuthenticated' => $user->isAuthenticated(), 'canComment' => $user->hasAccess('blog: post comments'), 'skipApproval' => $user->hasAccess('blog: skip comment approval')]], 'blog' => $this->blog, 'post' => $post];
 }
开发者ID:bcismariu,项目名称:extension-blog,代码行数:16,代码来源:SiteController.php

示例7: postAction

 /**
  * @Route("/{id}", name="id")
  */
 public function postAction($id = 0)
 {
     if (!($post = Post::where(['id = ?', 'status = ?', 'date < ?'], [$id, Post::STATUS_PUBLISHED, new \DateTime()])->related('user')->first())) {
         App::abort(404, __('Post not found!'));
     }
     if (!$post->hasAccess(App::user())) {
         App::abort(403, __('Insufficient User Rights.'));
     }
     $post->excerpt = App::content()->applyPlugins($post->excerpt, ['post' => $post, 'markdown' => $post->get('markdown')]);
     $post->content = App::content()->applyPlugins($post->content, ['post' => $post, 'markdown' => $post->get('markdown')]);
     $user = App::user();
     $description = $post->get('meta.og:description');
     if (!$description) {
         $description = strip_tags($post->excerpt ?: $post->content);
         $description = rtrim(mb_substr($description, 0, 150), " \t\n\r\v.,") . '...';
     }
     return ['$view' => ['title' => __($post->title), 'name' => 'blog/post.php', 'og:type' => 'article', 'article:published_time' => $post->date->format(\DateTime::ATOM), 'article:modified_time' => $post->modified->format(\DateTime::ATOM), 'article:author' => $post->user->name, 'og:title' => $post->get('meta.og:title') ?: $post->title, 'og:description' => $description, 'og:image' => $post->get('image.src') ? App::url()->getStatic($post->get('image.src'), [], 0) : false], '$comments' => ['config' => ['post' => $post->id, 'enabled' => $post->isCommentable(), 'requireinfo' => $this->blog->config('comments.require_email'), 'max_depth' => $this->blog->config('comments.max_depth'), 'user' => ['name' => $user->name, 'isAuthenticated' => $user->isAuthenticated(), 'canComment' => $user->hasAccess('blog: post comments'), 'skipApproval' => $user->hasAccess('blog: skip comment approval')]]], 'blog' => $this->blog, 'post' => $post];
 }
开发者ID:pagekit,项目名称:extension-blog,代码行数:21,代码来源:SiteController.php

示例8: sendMail

 /**
  * @return string
  */
 public function sendMail()
 {
     if (!($adminMail = $this->submission->form->get('submitEmail'))) {
         return '';
     }
     $userMail = '';
     $mailSubject = $this->replaceString($this->submission->form->get('email_subject'));
     $mailBody = $this->replaceString($this->submission->form->get('email_body'));
     $mailBody = App::content()->applyPlugins($mailBody, ['submission' => $this->submission, 'markdown' => $this->submission->form->get('email_body_markdown')]);
     try {
         $mail = App::mailer()->create();
         $mail->setTo($adminMail)->setSubject($mailSubject)->setBody(App::view('formmaker:views/mails/template.php', compact('mailBody')), 'text/html')->send();
         if ($this->submission->email) {
             $mail = App::mailer()->create();
             $mail->setTo($this->submission->email)->setSubject($mailSubject)->setBody(App::view('formmaker:views/mails/template.php', compact('mailBody')), 'text/html')->send();
         }
     } catch (\Exception $e) {
         throw new Exception(__('Unable to send confirmation mail.'));
     }
     return $userMail;
 }
开发者ID:nagyistoce,项目名称:pagekit-formmaker,代码行数:24,代码来源:MailHelper.php

示例9: fileAction

 /**
  * @Route("/{id}", name="id")
  * @Request({"id":"int", "category_id":"int"})
  */
 public function fileAction($id = 0, $category_id = 0)
 {
     /** @var File $file */
     if (!($file = File::where(['id = ?', 'status = ?'], [$id, '1'])->where(function ($query) {
         return $query->where('roles IS NULL')->whereInSet('roles', App::user()->roles, false, 'OR');
     })->first())) {
         App::abort(404, __('File not found.'));
     }
     $file->setActiveCategory($category_id);
     App::trigger('bixie.prepare.file', [$file, App::view()]);
     $file->content = App::content()->applyPlugins($file->content, ['file' => $file, 'markdown' => $file->get('markdown')]);
     $previous = File::getPrevious($file);
     $next = File::getNext($file);
     /** @var Category $category */
     if ($category_id && !($category = Category::where(['id = ?', 'status = ?'], [$category_id, '1'])->where(function ($query) {
         return $query->where('roles IS NULL')->whereInSet('roles', App::user()->roles, false, 'OR');
     })->related('files')->first())) {
         App::abort(404, __('Category not found.'));
     }
     if ($breadcrumbs = App::module('bixie/breadcrumbs')) {
         if ($category_id) {
             $cat = $category;
             $crumbs = [['title' => $category->title, 'url' => $category->getUrl()]];
             while ($parent_id = $cat->parent_id) {
                 if ($cat = $cat->find($parent_id, true)) {
                     $crumbs[] = ['title' => $cat->title, 'url' => $cat->getUrl()];
                 }
             }
             foreach (array_reverse($crumbs) as $data) {
                 $breadcrumbs->addUrl($data);
             }
         }
         //add file
         $breadcrumbs->addUrl(['title' => $file->title, 'url' => $file->getUrl()]);
     }
     return ['$view' => ['title' => __($file->title), 'name' => 'bixie/download/file.php'], 'download' => $this->download, 'config' => $this->download->config(), 'previous' => $previous, 'next' => $next, 'file' => $file, 'node' => App::node()];
 }
开发者ID:Bixie,项目名称:pagekit-download,代码行数:41,代码来源:SiteController.php

示例10: function

<?php

use Pagekit\Application as App;
return ['id' => 'htmlcode', 'label' => __('Html code'), 'hasOptions' => 0, 'required' => 0, 'multiple' => 0, 'dependancies' => ['editor'], 'prepareValue' => function ($field, $value) {
    return App::content()->applyPlugins($value, ['field' => $field, 'markdown' => $field->get('markdown')]);
}];
开发者ID:4nxiety,项目名称:pagekit-formmaker,代码行数:6,代码来源:htmlcode.php


注:本文中的Pagekit\Application::content方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。