BlogController
extends BlogFrontAppController
in package
ブログ記事コントローラー
Table of Contents
Properties
- $Authentication : AuthenticationComponent
- $BcMessage : BcMessageComponent
- $Paginator : PaginatorComponent
- $Security : SecurityComponent
- $_View : View
- View
Methods
- __construct() : mixed
- BcAppController constructor.
- _blackHoleCallback() : void
- Securityコンポーネントのブラックホールからのコールバック
- ajax_add_comment() : mixed
- ブログコメントを登録する
- archives() : void
- [PUBLIC] ブログアーカイブを表示する
- beforeFilter() : void
- beforeFilter
- beforeRender() : Response|void|null
- Before render
- captcha() : void
- 認証用のキャプチャ画像を表示する
- dispatchLayerEvent() : bool|Event
- イベントを発火
- getService() : array<string|int, mixed>|mixed|object
- Get Service
- hasService() : bool
- Has Service
- index() : void|ResponseInterface
- [PUBLIC] ブログを一覧表示する
- initialize() : void
- initialize
- notFound() : void
- NOT FOUNDページを出力する
- posts() : mixed
- 記事リストを出力 requestAction用
- redirectIfIsRequireMaintenance() : Response|void|null
- メンテナンス画面へのリダイレクトが必要な場合にリダイレクトする
- setTitle() : void
- Set Title
- setupFrontView() : void
- フロント用のViewクラスをセットアップする
- tags() : mixed
- 全体タグ一覧
- _autoConvertEncodingByArray() : array<string|int, mixed>
- 配列の文字コードを変換する
- loadViewConditions() : void
- 画面の情報をセッションから読み込む
- saveViewConditions() : void
- 画面の情報をセッションに保存する
- setViewConditions() : void
- 画面の情報をセットする
- __cleanupQueryParams() : void
- クエリーパラメーターの調整 環境によって?キーにamp;が付加されてしまうため
- __convertEncodingHttpInput() : void
- http経由で送信されたデータを変換する とりあえず、UTF-8で固定
- checkPermission() : bool
- アクセスルールの権限を確認する
Properties
$Authentication
public
AuthenticationComponent
$Authentication
$BcMessage
public
BcMessageComponent
$BcMessage
$Paginator
public
PaginatorComponent
$Paginator
$Security
public
SecurityComponent
$Security
$_View
View
protected
View
$_View
Methods
__construct()
BcAppController constructor.
public
__construct([ServerRequest|null $request = null ][, Response|null $response = null ][, string|null $name = null ][, EventManagerInterface|null $eventManager = null ][, ComponentRegistry|null $components = null ]) : mixed
Parameters
- $request : ServerRequest|null = null
- $response : Response|null = null
- $name : string|null = null
- $eventManager : EventManagerInterface|null = null
- $components : ComponentRegistry|null = null
Tags
_blackHoleCallback()
Securityコンポーネントのブラックホールからのコールバック
public
_blackHoleCallback(string $err, mixed $exception) : void
フォーム改ざん対策・CSRF対策・SSL制限・HTTPメソッド制限などへの違反が原因で Securityコンポーネントに"ブラックホールされた"場合の動作を指定する
Parameters
- $err : string
-
エラーの種類
- $exception : mixed
Tags
ajax_add_comment()
ブログコメントを登録する
public
ajax_add_comment(BlogCommentsServiceInterface $service, BcCaptchaServiceInterface $bcCaptchaService) : mixed
画像認証を行い認証されればブログのコメントを登録する コメント承認を利用していないブログの場合、公開されているコメント投稿者にアラートを送信する
Parameters
- $service : BlogCommentsServiceInterface
- $bcCaptchaService : BcCaptchaServiceInterface
Tags
archives()
[PUBLIC] ブログアーカイブを表示する
public
archives(BlogFrontService $service, BlogContentsService $blogContentsService, BlogPostsService $blogPostsService, string $type) : void
$type として、category / author / tag / date を指定し、ブログ記事をそれぞれのタイプごとにフィルタリングする事ができる。 また、$type を指定しない場合は、詳細ページを表示する。
URL例
- カテゴリ別記事一覧: /news/archives/category/category-name
- 作成者別記事一覧: /news/archives/author/author-name
- タグ別記事一覧: /news/archives/tag/tag-name
- 年別記事一覧: /news/archives/date/2022
- 月別記事一覧: /news/archives/date/2022/12
- 日別記事一覧: /news/archives/date/2022/12/12
- 詳細ページ:/news/archives/1
Parameters
- $service : BlogFrontService
- $blogContentsService : BlogContentsService
- $blogPostsService : BlogPostsService
- $type : string
Tags
beforeFilter()
beforeFilter
public
beforeFilter(EventInterface $event) : void
Parameters
- $event : EventInterface
beforeRender()
Before render
public
beforeRender(EventInterface $event) : Response|void|null
Parameters
- $event : EventInterface
Tags
Return values
Response|void|nullcaptcha()
認証用のキャプチャ画像を表示する
public
captcha(BcCaptchaServiceInterface $service, string $token) : void
Parameters
- $service : BcCaptchaServiceInterface
- $token : string
dispatchLayerEvent()
イベントを発火
public
dispatchLayerEvent(string $name[, array<string|int, mixed> $data = [] ][, mixed $options = [] ]) : bool|Event
Parameters
- $name : string
- $data : array<string|int, mixed> = []
- $options : mixed = []
Tags
Return values
bool|EventgetService()
Get Service
public
getService( $service) : array<string|int, mixed>|mixed|object
Parameters
Tags
Return values
array<string|int, mixed>|mixed|objecthasService()
Has Service
public
hasService( $service) : bool
Parameters
Tags
Return values
boolindex()
[PUBLIC] ブログを一覧表示する
public
index(BlogFrontService $service, BlogContentsService $blogContentsService, BlogPostsService $blogPostsService) : void|ResponseInterface
Parameters
- $service : BlogFrontService
- $blogContentsService : BlogContentsService
- $blogPostsService : BlogPostsService
Tags
Return values
void|ResponseInterfaceinitialize()
initialize
public
initialize() : void
コンポーネントをロードする
Tags
notFound()
NOT FOUNDページを出力する
public
notFound() : void
Tags
posts()
記事リストを出力 requestAction用
public
posts(int $blogContentId[, mixed $limit = 5 ]) : mixed
Parameters
- $blogContentId : int
- $limit : mixed = 5
redirectIfIsRequireMaintenance()
メンテナンス画面へのリダイレクトが必要な場合にリダイレクトする
public
redirectIfIsRequireMaintenance() : Response|void|null
Tags
Return values
Response|void|nullsetTitle()
Set Title
public
setTitle(string $title) : void
Parameters
- $title : string
Tags
setupFrontView()
フロント用のViewクラスをセットアップする
public
setupFrontView() : void
Tags
tags()
全体タグ一覧
public
tags(BlogPostsServiceInterface $service[, $name = null ]) : mixed
Parameters
- $service : BlogPostsServiceInterface
- $name : = null
Tags
_autoConvertEncodingByArray()
配列の文字コードを変換する
protected
_autoConvertEncodingByArray(array<string|int, mixed> $data[, string $outenc = 'UTF-8' ]) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
-
変換前データ
- $outenc : string = 'UTF-8'
-
変換後の文字コード
Tags
Return values
array<string|int, mixed> —変換後データ
loadViewConditions()
画面の情報をセッションから読み込む
protected
loadViewConditions([array<string|int, mixed> $targetModel = [] ][, array<string|int, mixed>|string $options = [] ]) : void
初期値が設定されている場合は初期値を設定した上で、セッションで上書きし、 ServerRequestに設定する。
Parameters
- $targetModel : array<string|int, mixed> = []
- $options : array<string|int, mixed>|string = []
-
オプション
-
default
: 読み出す初期値(初期値:[]) -
group
: 保存するグループ名(初期値:'') -
post
: POSTデータを保存するかどうか(初期値:true) -
get
: GETデータを保存するかどうか(初期値:false)
-
Tags
saveViewConditions()
画面の情報をセッションに保存する
protected
saveViewConditions([array<string|int, mixed> $targetModel = [] ][, array<string|int, mixed> $options = [] ]) : void
次のセッション名に保存。
- POSTデータ: BcApp.viewConditions.{$contentsName}.data.{$model}
- クエリパラメーター: BcApp.viewConditions.{$contentsName}.query
$contentsNameは次の形式となる。 {$controllerName}{$actionName}.{$group}
ただし、ページネーションにおいて、1ページ目はクエリパラメーターpage
を付けない仕様となっているため
page
は保存しない。
Parameters
- $targetModel : array<string|int, mixed> = []
- $options : array<string|int, mixed> = []
-
オプション
-
group
: 保存するグループ名(初期値:'') -
post
: POSTデータを保存するかどうか(初期値:true) -
get
: GETデータを保存するかどうか(初期値:false)
-
Tags
setViewConditions()
画面の情報をセットする
protected
setViewConditions([array<string|int, mixed> $targetModel = [] ][, array<string|int, mixed> $options = [] ]) : void
POSTデータとクエリパラメーターをセッションに保存した上で、 指定されたデフォルト値も含めて ServerRequest に設定する。
$this->setViewConditions(['Content'], [
'group' => 'index',
'default' => [
'query' => ['limit' => 10],
'data' => ['title' => 'default']
],
'get' => true
]);
Parameters
- $targetModel : array<string|int, mixed> = []
-
ターゲットとなるモデル
- $options : array<string|int, mixed> = []
-
オプション
-
default
: 読み出す初期値(初期値:[]) -
group
: 保存するグループ名(初期値:'') -
post
: POSTデータを保存するかどうか(初期値:true) -
get
: GETデータを保存するかどうか(初期値:false)
-
Tags
__cleanupQueryParams()
クエリーパラメーターの調整 環境によって?キーにamp;が付加されてしまうため
private
__cleanupQueryParams() : void
Tags
__convertEncodingHttpInput()
http経由で送信されたデータを変換する とりあえず、UTF-8で固定
private
__convertEncodingHttpInput() : void
Tags
checkPermission()
アクセスルールの権限を確認する
private
checkPermission() : bool
現在アクセスしているURLについて権限があるかどうかを確認する。