baserCMS クラスリファレンス

BlogHelper extends Helper
in package
Uses BcContainerTrait, BcEventDispatcherTrait

ブログヘルパー

Table of Contents

Properties

$BcBaser  : BcBaserHelper
$BcContents  : BcContentsHelper
$BcTime  : BcTimeHelper
$BcUpload  : BcUploadHelper
$BlogCategory  : BlogCategory
ブログカテゴリモデル
$BlogContentsService  : BlogContentsServiceInterface
ブログコンテンツサービス
$content  : array<string|int, mixed>
コンテンツ
$helpers  : array<string|int, mixed>
ヘルパー
$Html  : HtmlHelper
$_View  : View
View

Methods

__construct()  : void
コンストラクタ
allowPublish()  : bool
公開状態を取得する
author()  : void
記事の投稿者を出力する
blogName()  : void
ブログのコンテンツ名を出力する
category()  : void
記事が属するカテゴリ名を出力する
currentBlogId()  : void
ブログIDを出力する
description()  : void
ブログの説明文を出力する
descriptionExists()  : bool
ブログの説明文が指定されているかどうかを判定する
dispatchLayerEvent()  : bool|Event
イベントを発火
eyeCatch()  : void
アイキャッチ画像を出力する
getBlogArchiveType()  : string
ブログのアーカイブタイプを取得する
getBlogName()  : string
ブログのコンテンツ名を取得する
getBlogTemplates()  : array<string|int, mixed>
ブログテンプレートを取得
getCategories()  : mixed
カテゴリを取得する
getCategory()  : string
記事が属するカテゴリ名を取得する
getCategoryByName()  : array<string|int, mixed>
ブログのカテゴリを取得する - 例: $this->Blog->getBlogArchiveCategoryData($this->Blog->getCurrentBlogId()); 現在のページがカテゴリ一覧の場合、$categoryName は省略可
getCategoryList()  : string
カテゴリーの一覧をリストタグで取得する
getCategoryName()  : string
記事が属するカテゴリ名を取得
getCategoryTitle()  : string
記事が属するカテゴリタイトルを取得
getCategoryUrl()  : string
カテゴリ一覧へのURLを取得する
getContents()  : mixed
Blogの基本情報を全て取得する
getContentsUrl()  : string
ブログコンテンツのURLを取得する
getCurrentBlogId()  : int
ブログIDを取得する
getCurrentBlogTag()  : array<string|int, mixed>
現在のブログタグアーカイブのブログタグ情報を取得する
getDescription()  : string
ブログの説明文を取得する
getEyeCatch()  : string
アイキャッチ画像を取得する
getHtmlById()  : string
記事中のタグで指定したIDの内容を取得する
getNextPost()  : BlogPost
次の記事を取得する
getParentCategory()  : array<string|int, mixed>
親カテゴリを取得する
getPostContent()  : string
記事の本文を取得する
getPostCount()  : false|mixed
記事件数を取得する 一覧でのみ利用可能
getPostDate()  : string
登録日
getPostDetail()  : string
記事の詳細を取得する
getPostId()  : string
記事のIDを取得
getPostImg()  : string
記事中の画像を取得する
getPostLink()  : string
記事へのリンクを取得する
getPostLinkUrl()  : string
ブログ記事のURLを取得する
getPosts()  : mixed
ブログ記事を取得する
getPostTitle()  : string
記事タイトルを取得する
getPrevPost()  : BlogPost
前の記事を取得する
getRelatedPosts()  : array<string|int, mixed>
同じタグの関連投稿を取得する
getService()  : array<string|int, mixed>|mixed|object
Get Service
getTag()  : mixed
タグを取得する
getTagLink()  : string
タグ一覧へのリンクタグを取得する
getTagLinkUrl()  : string
タグ一覧へのURLを取得する
getTagList()  : array<string|int, mixed>|null
ブログタグリストを取得する
getTitle()  : string
タイトルを取得する
getViewVarsBlogMonthlyArchivesWidget()  : array<string|int, mixed>
ブログ月別アーカイブウィジェット用の View 変数を取得する
getViewVarsForBlogAuthorArchivesWidget()  : array<string|int, mixed>|false
ブログ投稿者一覧ウィジェット用の View 変数を取得する
getViewVarsForBlogCalendarWidget()  : array<string|int, mixed>
ブログカレンダーウィジェット用の View 変数を取得する
getViewVarsForBlogCategoryArchivesWdget()  : array<string|int, mixed>
ブログカテゴリウィジェット用の View 変数を取得する
getViewVarsForBlogYearlyArchivesWidget()  : array<string|int, mixed>
ブログ年別アーカイブウィジェット用の View 変数を取得する
getViewVarsRecentEntriesWidget()  : array<string|int, mixed>
最近の投稿ウィジェット用 View 変数を取得する
hasChildCategory()  : mixed
子カテゴリを持っているかどうか
hasNextLink()  : bool
次の記事へのリンクが存在するかチェックする
hasPrevLink()  : bool
前の記事へのリンクがあるかチェックする
hasService()  : bool
Has Service
isArchive()  : bool
アーカイブページ判定
isBlog()  : bool
現在のページがブログプラグインかどうかを判定する
isCategory()  : bool
カテゴリー別記事一覧ページ判定
isDate()  : bool
日別記事一覧ページ判定
isHome()  : bool
インデックスページ判定
isMonth()  : bool
月別記事一覧ページ判定
isSameSiteBlogContent()  : bool
指定したブログコンテンツIDが、現在のサイトと同じかどうか判定する
isSingle()  : bool
個別ページ判定
isTag()  : bool
タグ別記事一覧ページ判定
isYear()  : bool
年別記事一覧ページ判定
mailFormLink()  : void
メールフォームプラグインのフォームへのリンクを生成する
nextLink()  : void
次の記事へのリンクを出力する
parseContentName()  : mixed
コンテンツ名を解析して検索条件を設定する
postContent()  : void
記事の本文を表示する
postDate()  : void
記事の登録日を出力する
postDetail()  : void
記事の詳細を表示する
postImg()  : void
記事中の画像を出力する
postLink()  : void
記事へのリンクを出力する
posts()  : void
ブログ記事一覧出力
postTitle()  : void
記事のタイトルを出力する
prevLink()  : void
前の記事へのリンクを出力する
removeCtrlChars()  : mixed
文字列から制御文字を取り除く
setContent()  : void
ブログコンテンツデータをセットする
tag()  : void
タグを出力する
tagLink()  : void
タグ一覧へのリンクタグを出力する
tagList()  : mixed
タグリストを出力する
title()  : void
ブログタイトルを出力する
_mergePostCountToBlogsData()  : array<string|int, mixed>
Blogの基本情報に公開記事数を追加する
_mergePostCountToTagsData()  : array<string|int, mixed>
ブログタグリストに公開記事数を追加する

Properties

$BcContents

public BcContentsHelper $BcContents

BcContentsヘルパ

$BlogCategory

ブログカテゴリモデル

public BlogCategory $BlogCategory = null

$content

コンテンツ

public array<string|int, mixed> $content = null

$helpers

ヘルパー

public array<string|int, mixed> $helpers = ['Html', 'Url', 'BaserCore.BcTime', 'BaserCore.BcBaser', 'BaserCore.BcUpload', 'BaserCore.BcContents']

Methods

__construct()

コンストラクタ

public __construct(View $view[, array<string|int, mixed> $config = [] ]) : void
Parameters
$view : View
$config : array<string|int, mixed> = []
Tags
checked
noTodo
unitTest

allowPublish()

公開状態を取得する

public allowPublish(EntityInterface $post) : bool
Parameters
$post : EntityInterface
Tags
checked
noTodo
unitTest

ラッパーメソッドのためテスト不要

Return values
bool

公開状態

author()

記事の投稿者を出力する

public author(BlogPost $post) : void
Parameters
$post : BlogPost

ブログ記事

Tags
checked
noTodo

blogName()

ブログのコンテンツ名を出力する

public blogName() : void
Tags
checked
noTodo

category()

記事が属するカテゴリ名を出力する

public category(BlogPost $post[, array<string|int, mixed> $options = [] ]) : void
Parameters
$post : BlogPost

記事データ

$options : array<string|int, mixed> = []

オプション(初期値 : array())

  • link : リンクをつけるかどうか(初期値 : true) ※ その他のオプションは、linkオプションがtrueの場合に 生成されるa要素の属性設定となる。(HtmlHelper::link() を参照)
Tags
checked
noTodo

currentBlogId()

ブログIDを出力する

public currentBlogId() : void
Tags
checked
noTodo

description()

ブログの説明文を出力する

public description() : void
Tags
checked
noTodo

descriptionExists()

ブログの説明文が指定されているかどうかを判定する

public descriptionExists() : bool
Tags
checked
noTodo
Return values
bool

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
checked
unitTest
noTodo
Return values
bool|Event

eyeCatch()

アイキャッチ画像を出力する

public eyeCatch(BlogPost $post[, array<string|int, mixed> $options = [] ]) : void
Parameters
$post : BlogPost

ブログ記事

$options : array<string|int, mixed> = []

オプション(初期値 : array())

  • imgsize : 画像サイズ[default|thumb|mobile_thumb](初期値 : thumb)
  • link : 大きいサイズの画像へのリンク有無(初期値 : true)
  • escape : タイトルについてエスケープする場合に true を指定(初期値 : false)
    • mobile : モバイルの画像を表示する場合に true を指定(初期値 : false)
    • alt : alt属性(初期値 : '')
    • width : 横幅(初期値 : '')
    • height : 高さ(初期値 : '')
    • noimage : 画像が存在しない場合に表示する画像(初期値 : '')
    • tmp : 一時保存データの場合に true を指定(初期値 : false)
    • class : タグの class を指定(初期値 : img-eye-catch)
    • force : 画像が存在しない場合でも強制的に出力する場合に true を指定する(初期値 : false) ※ その他のオプションについては、リンクをつける場合、HtmlHelper::link() を参照、つけない場合、Html::image() を参照
Tags
checked
noTodo

getBlogArchiveType()

ブログのアーカイブタイプを取得する

public getBlogArchiveType() : string
Tags
checked
noTodo
Return values
string

ブログのアーカイブタイプ

getBlogName()

ブログのコンテンツ名を取得する

public getBlogName() : string
Tags
checked
noTodo
Return values
string

getBlogTemplates()

ブログテンプレートを取得

public getBlogTemplates([mixed $siteId = 0 ]) : array<string|int, mixed>

コンボボックスのソースとして利用

Parameters
$siteId : mixed = 0
Tags
checked
noTodo
Return values
array<string|int, mixed>

ブログテンプレート一覧

getCategories()

カテゴリを取得する

public getCategories([array<string|int, mixed> $options = [] ]) : mixed
Parameters
$options : array<string|int, mixed> = []
Tags
checked
noTodo

getCategory()

記事が属するカテゴリ名を取得する

public getCategory(BlogPost $post[, array<string|int, mixed> $options = [] ]) : string
Parameters
$post : BlogPost

記事データ

$options : array<string|int, mixed> = []

オプション(初期値 : array())

  • link : リンクをつけるかどうか(初期値 : true) ※ その他のオプションは、linkオプションがtrueの場合に 生成されるa要素の属性設定となる。(HtmlHelper::link() を参照)
Tags
checked
noTodo
unitTest
Return values
string

カテゴリ名

getCategoryByName()

ブログのカテゴリを取得する - 例: $this->Blog->getBlogArchiveCategoryData($this->Blog->getCurrentBlogId()); 現在のページがカテゴリ一覧の場合、$categoryName は省略可

public getCategoryByName(int $blogContentId[, string $categoryName = '' ][, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
$blogContentId : int
$categoryName : string = ''
$options : array<string|int, mixed> = []
Return values
array<string|int, mixed>

getCategoryList()

カテゴリーの一覧をリストタグで取得する

public getCategoryList(array<string|int, mixed> $categories[, int $depth = 3 ][, bool $count = false ][, array<string|int, mixed> $options = [] ]) : string
Parameters
$categories : array<string|int, mixed>

カテゴリ一覧データ

$depth : int = 3

階層(初期値 : 3)

$count : bool = false

件数を表示するかどうか(初期値 : false)

$options : array<string|int, mixed> = []

オプション(初期値 : array())

  • link : リンクをつけるかどうか(初期値 : true) ※ その他のオプションは、linkオプションがtrueの場合に 生成されるa要素の属性設定となる。(HtmlHelper::link() を参照)
Tags
checked
noTodo
Return values
string

HTMLのカテゴリ一覧

getCategoryName()

記事が属するカテゴリ名を取得

public getCategoryName(BlogPost $post) : string
Parameters
$post : BlogPost
Tags
checked
noTodo
Return values
string

getCategoryTitle()

記事が属するカテゴリタイトルを取得

public getCategoryTitle(BlogPost $post) : string
Parameters
$post : BlogPost
Tags
checked
noTodo
Return values
string

getCategoryUrl()

カテゴリ一覧へのURLを取得する

public getCategoryUrl(mixed $blogCategoryId[, array<string|int, mixed> $options = [] ]) : string

[注意] リンク関数でラップする前提のためベースURLは考慮されない

Parameters
$blogCategoryId : mixed
$options : array<string|int, mixed> = []

オプション(初期値 : array()) named : URLの名前付きパラメータ

Tags
checked
noTodo
Return values
string

カテゴリ一覧へのURL

getContents()

Blogの基本情報を全て取得する

public getContents([string $name = '' ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$name : string = ''

ブログのコンテンツ名を指定するとそのブログのみの基本情報を返す。空指定(default)で、全てのブログの基本情報。 ex) 'news' (初期値 : '')

$options : array<string|int, mixed> = []

オプション(初期値 :array())

  • sort : データのソート順 取得出来るフィールドのどれかでソートができる ex) 'created DESC'(初期値 : 'id')
  • siteId : サブサイトIDで絞り込む場合に指定する(初期値:0)
  • postCount : 公開記事数を取得するかどうか (初期値:false)
Return values
mixed

false|array Blogの基本情報

getContentsUrl()

ブログコンテンツのURLを取得する

public getContentsUrl(int $blogContentId[, mixed $base = true ]) : string

別ドメインの場合はフルパスで取得する

Parameters
$blogContentId : int

ブログコンテンツID

$base : mixed = true
Tags
checked
noTodo
Return values
string

getCurrentBlogId()

ブログIDを取得する

public getCurrentBlogId() : int
Tags
checked
noTodo
Return values
int

getCurrentBlogTag()

現在のブログタグアーカイブのブログタグ情報を取得する

public getCurrentBlogTag() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDescription()

ブログの説明文を取得する

public getDescription() : string
Tags
checked
noTodo
Return values
string

getEyeCatch()

アイキャッチ画像を取得する

public getEyeCatch(BlogPost|EntityInterface $post[, array<string|int, mixed> $options = [] ]) : string
Parameters
$post : BlogPost|EntityInterface

ブログ記事

$options : array<string|int, mixed> = []

オプション(初期値 : array())

  • imgsize : 画像サイズ[default|thumb|mobile_thumb](初期値 : thumb)
  • link : 大きいサイズの画像へのリンク有無(初期値 : true)
  • escape : タイトルについてエスケープする場合に true を指定(初期値 : false)
  • mobile : モバイルの画像を表示する場合に true を指定(初期値 : false)
  • alt : alt属性(初期値 : '')
  • width : 横幅(初期値 : '')
  • height : 高さ(初期値 : '')
  • noimage : 画像が存在しない場合に表示する画像(初期値 : '')
  • tmp : 一時保存データの場合に true を指定(初期値 : false)
  • class : タグの class を指定(初期値 : img-eye-catch)
  • force : 画像が存在しない場合でも強制的に出力する場合に true を指定する(初期値 : false)
  • output : 出力形式 tag, url のを指定できる(初期値 : '') ※ その他のオプションについては、リンクをつける場合、HtmlHelper::link() を参照、つけない場合、Html::image() を参照
Tags
checked
noTodo
unitTest
Return values
string

アイキャッチ画像のHTML

getHtmlById()

記事中のタグで指定したIDの内容を取得する

public getHtmlById(BlogPost $post, string $id) : string
Parameters
$post : BlogPost

ブログ記事

$id : string

取得したいデータが属しているタグのID属性

Tags
checked
noTodo
Return values
string

指定したIDの内容

getNextPost()

次の記事を取得する

public getNextPost(BlogPost $post) : BlogPost
Parameters
$post : BlogPost

ブログ記事

Tags
checked
noTodo
unitTest

ラッパーメソッドのためユニットテストはスキップ

Return values
BlogPost

getParentCategory()

親カテゴリを取得する

public getParentCategory(array<string|int, mixed> $post) : array<string|int, mixed>
Parameters
$post : array<string|int, mixed>

ブログ記事

Return values
array<string|int, mixed>

$parentCategory 親カテゴリ

getPostContent()

記事の本文を取得する

public getPostContent(BlogPost $post[, bool $moreText = true ][, mixed $moreLink = false ][, mixed $cut = false ][, mixed $lastText = false ]) : string
Parameters
$post : BlogPost

ブログ記事データ

$moreText : bool = true

詳細データを表示するかどうか(初期値 : true)

$moreLink : mixed = false

詳細ページへのリンクを表示するかどうか。true に指定した場合、 「≫ 続きを読む」という文字列がリンクとして表示される。(初期値 : false) また、文字列を指定するとその文字列がリンクとなる

$cut : mixed = false

文字をカットするかどうかを真偽値で指定。カットする場合、文字数を数値で入力(初期値 : false)

$lastText : mixed = false

本文後に文字列を挿入するかを真偽値で指定。挿入する場合、テキストを入力(初期値 : false)

Tags
checked
noTodo
Return values
string

記事本文

getPostCount()

記事件数を取得する 一覧でのみ利用可能

public getPostCount() : false|mixed
Return values
false|mixed

getPostDate()

登録日

public getPostDate(array<string|int, mixed> $post[, string $format = 'Y/m/d' ]) : string
Parameters
$post : array<string|int, mixed>

ブログ記事

$format : string = 'Y/m/d'

日付フォーマット(初期値 : Y/m/d)

Tags
checked
noTodo
Return values
string

登録日

getPostDetail()

記事の詳細を取得する

public getPostDetail(BlogPost $post[, array<string|int, mixed> $options = [] ]) : string
Parameters
$post : BlogPost

ブログ記事データ

$options : array<string|int, mixed> = []

オプション(初期値 : array())

  • cut : 文字をカットするかどうかを真偽値で指定。カットする場合、文字数を数値で入力(初期値 : false)
Tags
checked
noTodo
Return values
string

記事本文

getPostId()

記事のIDを取得

public getPostId(BlogPost $post) : string
Parameters
$post : BlogPost
Tags
checked
noTodo
Return values
string

getPostImg()

記事中の画像を取得する

public getPostImg(BlogPost $post[, array<string|int, mixed> $options = [] ]) : string
Parameters
$post : BlogPost

ブログ記事

$options : array<string|int, mixed> = []

オプション(初期値 : array())

  • num : 何枚目の画像か順番を指定(初期値 : 1)
  • link : 詳細ページへのリンクをつけるかどうか(初期値 : true)
  • alt : ALT属性(初期値 : ブログ記事のタイトル)
  • output : 出力形式 tag, url のを指定できる(初期値 : '')
Tags
checked
noTodo
Return values
string

記事へのリンクを取得する

public getPostLink(BlogPost $post, string $title[, array<string|int, mixed> $options = [] ]) : string
Parameters
$post : BlogPost

ブログ記事データ

$title : string

タイトル

$options : array<string|int, mixed> = []

オプション(初期値 : array()) ※ オプションについては、 HtmlHelper::link() を参照

Tags
checked
noTodo
Return values
string

記事へのリンク

getPostLinkUrl()

ブログ記事のURLを取得する

public getPostLinkUrl(BlogPost $post[, bool $base = true ][, bool $full = true ]) : string
Parameters
$post : BlogPost

ブログ記事データ

$base : bool = true

ベースとなるURLを付与するかどうか

$full : bool = true
Tags
checked
noTodo
unitTest
Return values
string

ブログ記事のURL

getPosts()

ブログ記事を取得する

public getPosts([array<string|int, mixed> $contentsName = [] ][, int $num = 5 ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$contentsName : array<string|int, mixed> = []
$num : int = 5
$options : array<string|int, mixed> = []

※ パラメーターは、contentTemplate / template 以外、BlogBaserHelper::blogPosts() に準ずる

Tags
checked
noTodo

getPostTitle()

記事タイトルを取得する

public getPostTitle(BlogPost $post[, bool $link = true ][, array<string|int, mixed> $options = [] ]) : string
Parameters
$post : BlogPost

ブログ記事データ

$link : bool = true

詳細ページへのリンクをつける場合には、true を指定する(初期値 : true)

$options : array<string|int, mixed> = []

オプション(初期値:arary())

  • escape : エスケープ処理を行うかどうか ※ その他のオプションについては、HtmlHelper::link() を参照
Tags
checked
noTodo
Return values
string

記事タイトル

getPrevPost()

前の記事を取得する

public getPrevPost(BlogPost $post) : BlogPost
Parameters
$post : BlogPost

ブログ記事

Tags
checked
noTodo
unitTest

ラッパーメソッドのためユニットテストはスキップ

Return values
BlogPost

getRelatedPosts()

同じタグの関連投稿を取得する

public getRelatedPosts(array<string|int, mixed> $post[, EntityInterface $options = [] ]) : array<string|int, mixed>
Parameters
$post : array<string|int, mixed>

ブログ記事

$options : EntityInterface = []

オプション(初期値 : array())

  • recursive : 関連データを取得する場合の階層(初期値 : -1)
  • limit : 件数(初期値 : 5)
  • order : 並び順指定(初期値 : BlogPost.posted DESC)
Tags
checked
noTodo
unitTest

ラッパーメソッドのためユニットテストは不要

Return values
array<string|int, mixed>

getService()

Get Service

public getService( $service) : array<string|int, mixed>|mixed|object
Parameters
$service :
Tags
checked
noTodo
unitTest
Return values
array<string|int, mixed>|mixed|object

getTag()

タグを取得する

public getTag(array<string|int, mixed> $post[, string $options = [] ]) : mixed

複数所属する場合は複数取得する

Parameters
$post : array<string|int, mixed>

記事データ

$options : string = []
  • separator : 区切り文字(初期値 : , )
  • tag : リンク付きのタグで出力するかどうか(初期値 : true) ※ link に統合予定
  • link : リンク付きのタグで出力するかどうか(初期値 : true) ※ 文字列で指定した場合は、separator として扱う
Tags
checked
noTodo
Return values
mixed

''|string|array

タグ一覧へのリンクタグを取得する

public getTagLink(int $blogContentId, BlogTag $tag[, array<string|int, mixed> $options = [] ]) : string
Parameters
$blogContentId : int
$tag : BlogTag
$options : array<string|int, mixed> = []
Tags
checked
noTodo
Return values
string

getTagLinkUrl()

タグ一覧へのURLを取得する

public getTagLinkUrl(int $blogContentId, BlogTag $tag[, bool $base = true ]) : string
Parameters
$blogContentId : int
$tag : BlogTag
$base : bool = true
Tags
checked
noTodo
Return values
string

getTagList()

ブログタグリストを取得する

public getTagList(mixed $name[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>|null
Parameters
$name : mixed
$options : array<string|int, mixed> = []
  • conditions : CakePHP形式の検索条件
  • direction : 並び順の方向
  • sort : 並び順の対象フィールド
  • siteId : サイトIDでフィルタリングする場合に指定する
  • postCount : 記事件数を表示するかどうか
Tags
checked
noTodo
Return values
array<string|int, mixed>|null

getTitle()

タイトルを取得する

public getTitle() : string
Tags
checked
noTodo
Return values
string

getViewVarsBlogMonthlyArchivesWidget()

ブログ月別アーカイブウィジェット用の View 変数を取得する

public getViewVarsBlogMonthlyArchivesWidget(int $blogContentId[, int $limit = 12 ][, bool $viewCount = false ]) : array<string|int, mixed>
Parameters
$blogContentId : int
$limit : int = 12
$viewCount : bool = false
Tags
checked
noTodo
unitTest

ラッパーメソッドのためユニットテストは実装しない

Return values
array<string|int, mixed>

getViewVarsForBlogAuthorArchivesWidget()

ブログ投稿者一覧ウィジェット用の View 変数を取得する

public getViewVarsForBlogAuthorArchivesWidget(int $blogContentId, bool $viewCount) : array<string|int, mixed>|false
Parameters
$blogContentId : int
$viewCount : bool
Tags
checked
noTodo
unitTest

ラッパーメソッドのためユニットテストは実装しない

Return values
array<string|int, mixed>|false

getViewVarsForBlogCalendarWidget()

ブログカレンダーウィジェット用の View 変数を取得する

public getViewVarsForBlogCalendarWidget(int $blogContentId[, string $year = '' ][, string $month = '' ]) : array<string|int, mixed>
Parameters
$blogContentId : int
$year : string = ''
$month : string = ''
Tags
checked
noTodo
unitTest

ラッパーメソッドのためユニットテストは実装しない

Return values
array<string|int, mixed>

getViewVarsForBlogCategoryArchivesWdget()

ブログカテゴリウィジェット用の View 変数を取得する

public getViewVarsForBlogCategoryArchivesWdget(int $blogContentId[, bool $limit = false ][, bool $viewCount = false ][, int $depth = 1 ][, string|null $contentType = null ]) : array<string|int, mixed>
Parameters
$blogContentId : int
$limit : bool = false
$viewCount : bool = false
$depth : int = 1
$contentType : string|null = null
Tags
checked
noTodo
unitTest

ラッパーメソッドのためユニットテストは実装しない

Return values
array<string|int, mixed>

getViewVarsForBlogYearlyArchivesWidget()

ブログ年別アーカイブウィジェット用の View 変数を取得する

public getViewVarsForBlogYearlyArchivesWidget(int $blogContentId[, bool $limit = false ][, bool $viewCount = false ]) : array<string|int, mixed>
Parameters
$blogContentId : int
$limit : bool = false
$viewCount : bool = false
Tags
checked
noTodo
unitTest

ラッパーメソッドのためユニットテストは実装しない

Return values
array<string|int, mixed>

getViewVarsRecentEntriesWidget()

最近の投稿ウィジェット用 View 変数を取得する

public getViewVarsRecentEntriesWidget(int $blogContentId[, int $limit = 5 ]) : array<string|int, mixed>
Parameters
$blogContentId : int
$limit : int = 5
Tags
checked
noTodo
unitTest

ラッパーメソッドのためユニットテストは実装しない

Return values
array<string|int, mixed>

hasChildCategory()

子カテゴリを持っているかどうか

public hasChildCategory(int $id) : mixed
Parameters
$id : int

次の記事へのリンクが存在するかチェックする

public hasNextLink(BlogPost $post) : bool
Parameters
$post : BlogPost

ブログ記事

Tags
checked
noTodo
Return values
bool

前の記事へのリンクがあるかチェックする

public hasPrevLink(BlogPost $post) : bool
Parameters
$post : BlogPost

ブログ記事

Tags
checked
noTodo
Return values
bool

hasService()

Has Service

public hasService( $service) : bool
Parameters
$service :
Tags
checked
noTodo
unitTest
Return values
bool

isArchive()

アーカイブページ判定

public isArchive() : bool
Tags
checked
noTodo
Return values
bool

現在のページがアーカイブページの場合は true を返す

isBlog()

現在のページがブログプラグインかどうかを判定する

public isBlog() : bool
Tags
checked
noTodo
Return values
bool

isCategory()

カテゴリー別記事一覧ページ判定

public isCategory() : bool
Tags
checked
noTodo
Return values
bool

現在のページがカテゴリー別記事一覧ページの場合は true を返す

isDate()

日別記事一覧ページ判定

public isDate() : bool
Tags
checked
noTodo
Return values
bool

現在のページが日別記事一覧ページの場合は true を返す

isHome()

インデックスページ判定

public isHome() : bool
Tags
checked
noTodo
Return values
bool

現在のページがインデックスページの場合は true を返す

isMonth()

月別記事一覧ページ判定

public isMonth() : bool
Tags
checked
noTodo
Return values
bool

現在のページが月別記事一覧ページの場合は true を返す

isSameSiteBlogContent()

指定したブログコンテンツIDが、現在のサイトと同じかどうか判定する

public isSameSiteBlogContent(int $blogContentId) : bool
Parameters
$blogContentId : int

ブログコンテンツID

Tags
checked
noTodo
Return values
bool

isSingle()

個別ページ判定

public isSingle() : bool
Tags
checked
noTodo
Return values
bool

現在のページが個別ページの場合は true を返す

isTag()

タグ別記事一覧ページ判定

public isTag() : bool
Tags
checked
noTodo
Return values
bool

現在のページがタグ別記事一覧ページの場合は true を返す

isYear()

年別記事一覧ページ判定

public isYear() : bool
Tags
checked
noTodo
Return values
bool

現在のページが年別記事一覧ページの場合は true を返す

メールフォームプラグインのフォームへのリンクを生成する

public mailFormLink(string $title, string $contentsName[, array<string|int, mixed> $datas = [] ][, array<string|int, mixed> $options = [] ]) : void
Parameters
$title : string

リンクのタイトル

$contentsName : string

メールフォームのコンテンツ名

$datas : array<string|int, mixed> = []

メールフォームに引き継ぐデータ(初期値 : array())

$options : array<string|int, mixed> = []

a タグの属性(初期値 : array()) ※ オプションについては、HtmlHelper::link() を参照

次の記事へのリンクを出力する

public nextLink(BlogPost $post[, string $title = '' ][, array<string|int, mixed> $htmlAttributes = [] ]) : void
Parameters
$post : BlogPost

ブログ記事

$title : string = ''

タイトル

$htmlAttributes : array<string|int, mixed> = []

HTML属性 ※ HTML属性は、HtmlHelper::link() 参照

Tags
checked
noTodo

parseContentName()

コンテンツ名を解析して検索条件を設定する

public parseContentName(mixed $contentsName, array<string|int, mixed> $options) : mixed
Parameters
$contentsName : mixed
$options : array<string|int, mixed>
Tags
checked
noTodo

postContent()

記事の本文を表示する

public postContent(BlogPost $post[, bool $moreText = true ][, mixed $moreLink = false ][, mixed $cut = false ][, mixed $lastText = false ]) : void
Parameters
$post : BlogPost

ブログ記事データ

$moreText : bool = true

詳細データを表示するかどうか(初期値 : true)

$moreLink : mixed = false

詳細ページへのリンクを表示するかどうか。true に指定した場合、 「≫ 続きを読む」という文字列がリンクとして表示される。(初期値 : false) また、文字列を指定するとその文字列がリンクとなる

$cut : mixed = false

文字をカットするかどうかを真偽値で指定。カットする場合、文字数を数値で入力(初期値 : false)

$lastText : mixed = false

本文後に文字列を挿入するかを真偽値で指定。挿入する場合、テキストを入力(初期値 : false)

Tags
checked
noTodo

postDate()

記事の登録日を出力する

public postDate(BlogPost $post[, string $format = 'Y/m/d' ]) : void
Parameters
$post : BlogPost

ブログ記事

$format : string = 'Y/m/d'

日付フォーマット(初期値 : Y/m/d)

Tags
checked
noTodo

postDetail()

記事の詳細を表示する

public postDetail(BlogPost $post[, array<string|int, mixed> $options = [] ]) : void
Parameters
$post : BlogPost

ブログ記事データ

$options : array<string|int, mixed> = []

オプション(初期値 : array())getPostDetailを参照

Tags
checked
noTodo

postImg()

記事中の画像を出力する

public postImg(BlogPost $post[, array<string|int, mixed> $options = [] ]) : void
Parameters
$post : BlogPost

ブログ記事

$options : array<string|int, mixed> = []

オプション(初期値 : array())

  • num : 何枚目の画像か順番を指定(初期値 : 1)
  • link : 詳細ページへのリンクをつけるかどうか(初期値 : true)
  • alt : ALT属性(初期値 : ブログ記事のタイトル)
Tags
checked
noTodo

記事へのリンクを出力する

public postLink(BlogPost $post, string $title[, array<string|int, mixed> $options = [] ]) : void
Parameters
$post : BlogPost

ブログ記事データ

$title : string

タイトル

$options : array<string|int, mixed> = []

オプション(初期値 : array()) ※ オプションについては、 HtmlHelper::link() を参照

Tags
checked
noTodo

posts()

ブログ記事一覧出力

public posts([mixed $contentsName = [] ][, int $num = 5 ][, array<string|int, mixed> $options = [] ]) : void

ページ編集画面等で利用する事ができる。 ビュー: lib/Baser/Plugin/Blog/View/blog/{コンテンツテンプレート名}/posts.php

《利用例》 $this->BcBaser->blogPosts('news', 3)

複数のコンテンツを指定する場合:配列にて複数のコンテンツ名を指定 コンテンツテンプレート名は配列の先頭を利用する $this->BcBaser->blogPosts(array('news', 'work'), 3)

全てのコンテンツを指定する場合:nullを指定 contentsTemplateオプションにて コンテンツテンプレート名を指定する(必須) $this->BcBaser->blogPosts(null, 3, array('contentsTemplate' => 'news'))

Parameters
$contentsName : mixed = []
$num : int = 5

記事件数(初期値 : 5)

$options : array<string|int, mixed> = []

オプション(初期値 : array())

  • conditions : CakePHP形式の検索条件(初期値 : array())
  • category : カテゴリで絞り込む(初期値 : null)
  • tag : タグで絞り込む(初期値 : null)
  • year : 年で絞り込む(初期値 : null)
  • month : 月で絞り込む(初期値 : null)
  • day : 日で絞り込む(初期値 : null)
  • id : 記事NO で絞り込む(初期値 : null)※ 後方互換のため id を維持
  • no : 記事NO で絞り込む(初期値 : null)
  • keyword : キーワードで絞り込む場合にキーワードを指定(初期値 : null)
  • postId : 記事ID で絞り込む(初期値 : null)
  • siteId : サイトID で絞り込む(初期値 : null)
  • preview : 非公開の記事も見る場合に指定(初期値 : false)
  • contentsTemplate : コンテンツテンプレート名を指定(初期値 : null)
  • template : 読み込むテンプレート名を指定する場合にテンプレート名を指定(初期値 : null)
  • direction : 並び順の方向を指定 [昇順:ASC or 降順:DESC or ランダム:RANDOM](初期値 : null)
  • page : ページ数を指定(初期値 : null)
  • sort : 並び替えの基準となるフィールドを指定(初期値 : null)
  • autoSetCurrentBlog : $contentsName を指定していない場合、現在のコンテンツより自動でブログを指定する(初期値:true)
  • data : エレメントに渡したい変数(初期値 : array)
Tags
checked
noTodo

postTitle()

記事のタイトルを出力する

public postTitle(BlogPost $post[, bool $link = true ][, array<string|int, mixed> $options = [] ]) : void
Parameters
$post : BlogPost

ブログ記事データ

$link : bool = true

詳細ページへのリンクをつける場合には、true を指定する(初期値 : true)

$options : array<string|int, mixed> = []
Tags
checked
noTodo

前の記事へのリンクを出力する

public prevLink(BlogPost $post[, string $title = '' ][, array<string|int, mixed> $htmlAttributes = [] ]) : void
Parameters
$post : BlogPost

ブログ記事

$title : string = ''

タイトル

$htmlAttributes : array<string|int, mixed> = []

HTML属性 ※ HTML属性は、HtmlHelper::link() 参照

Tags
checked
noTodo

removeCtrlChars()

文字列から制御文字を取り除く

public removeCtrlChars(mixed $string) : mixed
Parameters
$string : mixed
Tags
checked
noTodo

setContent()

ブログコンテンツデータをセットする

public setContent([int $blogContentId = null ]) : void

アイキャッチを利用する場合に必ず設定が必要

Parameters
$blogContentId : int = null

ブログコンテンツID

Tags
checked
noTodo

tag()

タグを出力する

public tag(array<string|int, mixed> $post[, string $separator = ' , ' ]) : void

複数所属する場合は複数出力する

Parameters
$post : array<string|int, mixed>

記事データ

$separator : string = ' , '

区切り文字(初期値 : , )

Tags
checked
noTodo

タグ一覧へのリンクタグを出力する

public tagLink(int $blogContentId, BlogTag $tag[, array<string|int, mixed> $options = [] ]) : void
Parameters
$blogContentId : int
$tag : BlogTag
$options : array<string|int, mixed> = []
Tags
checked
noTodo

tagList()

タグリストを出力する

public tagList(mixed $name[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$name : mixed
$options : array<string|int, mixed> = []

※ オプションのパラーメーターは、BlogHelper::getTagList() に準ずる

Tags
checked
noTodo

title()

ブログタイトルを出力する

public title() : void
Tags
checked
noTodo

_mergePostCountToBlogsData()

Blogの基本情報に公開記事数を追加する

private _mergePostCountToBlogsData(array<string|int, mixed> $blogsData) : array<string|int, mixed>
Parameters
$blogsData : array<string|int, mixed>

Blogの基本情報の配列

Return values
array<string|int, mixed>

_mergePostCountToTagsData()

ブログタグリストに公開記事数を追加する

private _mergePostCountToTagsData(array<string|int, mixed> $tags, mixed $options) : array<string|int, mixed>
Parameters
$tags : array<string|int, mixed>

BlogTagの基本情報の配列

$options : mixed
Tags
checked
noTodo
Return values
array<string|int, mixed>

        
On this page

Search results