PHP Class BlogHelper

User: powellc Date: 7/29/12 Time: 10:13 PM To change this template use File | Settings | File Templates.
Afficher le fichier Open project: baserproject/basercms Class Usage Examples

Méthodes publiques

Свойство Type Description
$BlogCategory BlogCategory ブログカテゴリモデル
$helpers array ヘルパー

Méthodes publiques

Méthode Description
__construct ( View $View, array $settings = [] ) : void コンストラクタ
allowPublish ( array $data ) : boolean 公開状態を取得する
author ( array $post ) : void 記事の投稿者を出力する
blogName ( ) : void ブログアカウント名を出力する
category ( array $post, array $options = [] ) : void 記事が属するカテゴリ名を出力する
currentBlogId ( ) : void ブログIDを出力する
description ( ) : void ブログの説明文を出力する
descriptionExists ( ) : boolean ブログの説明文が指定されているかどうかを判定する
eyeCatch ( array $post, array $options = [] ) : void アイキャッチ画像を出力する
getBlogArchiveType ( ) : string ブログのアーカイブタイプを取得する
getBlogName ( ) : string ブログアカウント名を取得する
getBlogTemplates ( $siteId ) : array ブログテンプレートを取得
getCategory ( array $post, array $options = [] ) : string 記事が属するカテゴリ名を取得する
getCategoryList ( array $categories, integer $depth = 3, boolean $count = false, array $options = [] ) : string カテゴリーの一覧をリストタグで取得する
getCategoryUrl ( $blogCategoryId, array $options = [] ) : string カテゴリ一覧へのURLを取得する
getCurrentBlogId ( ) : integer ブログIDを取得する
getDescription ( ) : string ブログの説明文を取得する
getEyeCatch ( array $post, array $options = [] ) : string アイキャッチ画像を取得する
getHtmlById ( array $post, string $id ) : string 記事中のタグで指定したIDの内容を取得する
getParentCategory ( array $post ) : array 親カテゴリを取得する
getPostContent ( array $post, boolean $moreText = true, mixied $moreLink = false, mixed $cut = false ) : string 記事の本文を取得する
getPostDate ( array $post, string $format = 'Y/m/d' ) : string 登録日
getPostDetail ( array $post, array $options = [] ) : string 記事の詳細を取得する
getPostImg ( array $post, array $options = [] ) : string 記事中の画像を取得する
getPostLink ( array $post, string $title, array $options = [] ) : string 記事へのリンクを取得する
getPostLinkUrl ( array $post ) : string ブログ記事のURLを取得する
getPostTitle ( array $post, boolean $link = true ) : string 記事タイトルを取得する
getRelatedPosts ( array $post, array $options = [] ) : array 同じタグの関連投稿を取得する
getTag ( array $post, string $separator = ' , ' ) : void タグを取得する
getTitle ( ) : string タイトルを取得する
isArchive ( ) : boolean アーカイブページ判定
isCategory ( ) : boolean カテゴリー別記事一覧ページ判定
isDate ( ) : boolean 日別記事一覧ページ判定
isHome ( ) : boolean インデックスページ判定
isMonth ( ) : boolean 月別記事一覧ページ判定
isSingle ( ) : boolean 個別ページ判定
isTag ( ) : boolean タグ別記事一覧ページ判定
isYear ( ) : boolean 年別記事一覧ページ判定
mailFormLink ( string $title, string $contentsName, array $datas = [], array $options = [] ) : void メールフォームプラグインのフォームへのリンクを生成する
nextLink ( array $post, string $title = '', array $htmlAttributes = [] ) : void 次の記事へのリンクを出力する
postContent ( array $post, boolean $moreText = true, mixied $moreLink = false, mixed $cut = false ) : void 記事の本文を表示する
postDate ( array $post, string $format = 'Y/m/d' ) : void 記事の登録日を出力する
postDetail ( array $post, array $options = [] ) : void 記事の詳細を表示する
postImg ( array $post, array $options = [] ) : void 記事中の画像を出力する
postLink ( array $post, string $title, array $options = [] ) : void 記事へのリンクを出力する
postTitle ( array $post, boolean $link = true ) : void 記事のタイトルを出力する
prevLink ( array $post, string $title = '', array $htmlAttributes = [] ) : void 前の記事へのリンクを出力する
removeCtrlChars ( $string ) 文字列から制御文字を取り除く
setContent ( integer $blogContentId = null ) : void ブログコンテンツデータをセットする
tag ( array $post, string $separator = ' , ' ) : void タグを出力する
title ( ) : void ブログタイトルを出力する

Méthodes protégées

Méthode Description
_getCategoryList ( array $categories, integer $depth = 3, integer $current = 1, boolean $count = false, array $options = [] ) : string カテゴリーリストを取得する

Method Details

__construct() public méthode

コンストラクタ
public __construct ( View $View, array $settings = [] ) : void
$View View Viewオブジェクト
$settings array 設定
Résultat void

_getCategoryList() protected méthode

カテゴリーリストを取得する
protected _getCategoryList ( array $categories, integer $depth = 3, integer $current = 1, boolean $count = false, array $options = [] ) : string
$categories array カテゴリ一覧データ
$depth integer 階層(初期値 : 3)
$current integer 現在の階層(初期値 : 1)
$count boolean 件数を表示するかどうか(初期値 : false)
$options array オプション(初期値 : array()) - `link` : リンクをつけるかどうか(初期値 : true) ※ その他のオプションは、`link`オプションが`true`の場合に 生成されるa要素の属性設定となる。(HtmlHelper::link() を参照)
Résultat string HTMLのカテゴリ一覧

allowPublish() public méthode

公開状態を取得する
public allowPublish ( array $data ) : boolean
$data array ブログ記事
Résultat boolean 公開状態

author() public méthode

記事の投稿者を出力する
public author ( array $post ) : void
$post array ブログ記事
Résultat void

blogName() public méthode

ブログアカウント名を出力する
public blogName ( ) : void
Résultat void

category() public méthode

記事が属するカテゴリ名を出力する
public category ( array $post, array $options = [] ) : void
$post array 記事データ
$options array オプション(初期値 : array()) - `link` : リンクをつけるかどうか(初期値 : true) ※ その他のオプションは、`link`オプションが`true`の場合に 生成されるa要素の属性設定となる。(HtmlHelper::link() を参照)
Résultat void

currentBlogId() public méthode

ブログIDを出力する
public currentBlogId ( ) : void
Résultat void

description() public méthode

ブログの説明文を出力する
public description ( ) : void
Résultat void

descriptionExists() public méthode

ブログの説明文が指定されているかどうかを判定する
public descriptionExists ( ) : boolean
Résultat boolean

eyeCatch() public méthode

アイキャッチ画像を出力する
public eyeCatch ( array $post, array $options = [] ) : void
$post array ブログ記事
$options array オプション(初期値 : array()) - `imgsize` : 画像サイズ[thumb|small|medium|large](初期値 : 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() を参照
Résultat void

getBlogArchiveType() public méthode

ブログのアーカイブタイプを取得する
public getBlogArchiveType ( ) : string
Résultat string ブログのアーカイブタイプ

getBlogName() public méthode

ブログアカウント名を取得する
public getBlogName ( ) : string
Résultat string

getBlogTemplates() public méthode

コンボボックスのソースとして利用
public getBlogTemplates ( $siteId ) : array
Résultat array ブログテンプレート一覧

getCategory() public méthode

記事が属するカテゴリ名を取得する
public getCategory ( array $post, array $options = [] ) : string
$post array 記事データ
$options array オプション(初期値 : array()) - `link` : リンクをつけるかどうか(初期値 : true) ※ その他のオプションは、`link`オプションが`true`の場合に 生成されるa要素の属性設定となる。(HtmlHelper::link() を参照)
Résultat string カテゴリ名

getCategoryList() public méthode

カテゴリーの一覧をリストタグで取得する
public getCategoryList ( array $categories, integer $depth = 3, boolean $count = false, array $options = [] ) : string
$categories array カテゴリ一覧データ
$depth integer 階層(初期値 : 3)
$count boolean 件数を表示するかどうか(初期値 : false)
$options array オプション(初期値 : array()) - `link` : リンクをつけるかどうか(初期値 : true) ※ その他のオプションは、`link`オプションが`true`の場合に 生成されるa要素の属性設定となる。(HtmlHelper::link() を参照)
Résultat string HTMLのカテゴリ一覧

getCategoryUrl() public méthode

[注意] リンク関数でラップする前提の為、ベースURLは考慮されない
public getCategoryUrl ( $blogCategoryId, array $options = [] ) : string
$options array オプション(初期値 : array()) `named` : URLの名前付きパラメーター
Résultat string カテゴリ一覧へのURL

getCurrentBlogId() public méthode

ブログIDを取得する
public getCurrentBlogId ( ) : integer
Résultat integer

getDescription() public méthode

ブログの説明文を取得する
public getDescription ( ) : string
Résultat string

getEyeCatch() public méthode

アイキャッチ画像を取得する
public getEyeCatch ( array $post, array $options = [] ) : string
$post array ブログ記事
$options array オプション(初期値 : array()) - `imgsize` : 画像サイズ[thumb|small|medium|large](初期値 : 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() を参照
Résultat string アイキャッチ画像のHTML

getHtmlById() public méthode

記事中のタグで指定したIDの内容を取得する
public getHtmlById ( array $post, string $id ) : string
$post array ブログ記事
$id string 取得したいデータが属しているタグのID属性
Résultat string 指定したIDの内容

getParentCategory() public méthode

親カテゴリを取得する
public getParentCategory ( array $post ) : array
$post array ブログ記事
Résultat array $parentCategory 親カテゴリ

getPostContent() public méthode

記事の本文を取得する
public getPostContent ( array $post, boolean $moreText = true, mixied $moreLink = false, mixed $cut = false ) : string
$post array ブログ記事データ
$moreText boolean 詳細データを表示するかどうか(初期値 : true)
$moreLink mixied 詳細ページへのリンクを表示するかどうか。true に指定した場合、 「≫ 続きを読む」という文字列がリンクとして表示される。(初期値 : false) また、文字列を指定するとその文字列がリンクとなる
$cut mixed 文字をカットするかどうかを真偽値で指定。カットする場合、文字数を数値で入力(初期値 : false)
Résultat string 記事本文

getPostDate() public méthode

登録日
public getPostDate ( array $post, string $format = 'Y/m/d' ) : string
$post array ブログ記事
$format string 日付フォーマット(初期値 : Y/m/d)
Résultat string 登録日

getPostDetail() public méthode

記事の詳細を取得する
public getPostDetail ( array $post, array $options = [] ) : string
$post array ブログ記事データ
$options array オプション(初期値 : array()) - `cut` : 文字をカットするかどうかを真偽値で指定。カットする場合、文字数を数値で入力(初期値 : false)
Résultat string 記事本文

getPostImg() public méthode

記事中の画像を取得する
public getPostImg ( array $post, array $options = [] ) : string
$post array ブログ記事
$options array オプション(初期値 : array()) - `num` : 何枚目の画像か順番を指定(初期値 : 1) - `link` : 詳細ページへのリンクをつけるかどうか(初期値 : true) - `alt` : ALT属性(初期値 : ブログ記事のタイトル)
Résultat string

getPostLinkUrl() public méthode

ブログ記事のURLを取得する
public getPostLinkUrl ( array $post ) : string
$post array ブログ記事データ
Résultat string ブログ記事のURL

getPostTitle() public méthode

記事タイトルを取得する
public getPostTitle ( array $post, boolean $link = true ) : string
$post array ブログ記事データ
$link boolean 詳細ページへのリンクをつける場合には、true を指定する(初期値 : true)
Résultat string 記事タイトル

getRelatedPosts() public méthode

同じタグの関連投稿を取得する
public getRelatedPosts ( array $post, array $options = [] ) : array
$post array ブログ記事
$options array オプション(初期値 : array()) - `recursive` : 関連データを取得する場合の階層(初期値 : -1) - `limit` : 件数(初期値 : 5) - `order` : 並び順指定(初期値 : BlogPost.posts_date DESC)
Résultat array

getTag() public méthode

複数所属する場合は複数取得する
public getTag ( array $post, string $separator = ' , ' ) : void
$post array 記事データ
$separator string 区切り文字(初期値 : , )
Résultat void

getTitle() public méthode

タイトルを取得する
public getTitle ( ) : string
Résultat string

isArchive() public méthode

アーカイブページ判定
public isArchive ( ) : boolean
Résultat boolean 現在のページがアーカイブページの場合は true を返す

isCategory() public méthode

カテゴリー別記事一覧ページ判定
public isCategory ( ) : boolean
Résultat boolean 現在のページがカテゴリー別記事一覧ページの場合は true を返す

isDate() public méthode

日別記事一覧ページ判定
public isDate ( ) : boolean
Résultat boolean 現在のページが日別記事一覧ページの場合は true を返す

isHome() public méthode

インデックスページ判定
public isHome ( ) : boolean
Résultat boolean 現在のページがインデックスページの場合は true を返す

isMonth() public méthode

月別記事一覧ページ判定
public isMonth ( ) : boolean
Résultat boolean 現在のページが月別記事一覧ページの場合は true を返す

isSingle() public méthode

個別ページ判定
public isSingle ( ) : boolean
Résultat boolean 現在のページが個別ページの場合は true を返す

isTag() public méthode

タグ別記事一覧ページ判定
public isTag ( ) : boolean
Résultat boolean 現在のページがタグ別記事一覧ページの場合は true を返す

isYear() public méthode

年別記事一覧ページ判定
public isYear ( ) : boolean
Résultat boolean 現在のページが年別記事一覧ページの場合は true を返す

postContent() public méthode

記事の本文を表示する
public postContent ( array $post, boolean $moreText = true, mixied $moreLink = false, mixed $cut = false ) : void
$post array ブログ記事データ
$moreText boolean 詳細データを表示するかどうか(初期値 : true)
$moreLink mixied 詳細ページへのリンクを表示するかどうか。true に指定した場合、 「≫ 続きを読む」という文字列がリンクとして表示される。(初期値 : false) また、文字列を指定するとその文字列がリンクとなる
$cut mixed 文字をカットするかどうかを真偽値で指定。カットする場合、文字数を数値で入力(初期値 : false)
Résultat void

postDate() public méthode

記事の登録日を出力する
public postDate ( array $post, string $format = 'Y/m/d' ) : void
$post array ブログ記事
$format string 日付フォーマット(初期値 : Y/m/d)
Résultat void

postDetail() public méthode

記事の詳細を表示する
public postDetail ( array $post, array $options = [] ) : void
$post array ブログ記事データ
$options array オプション(初期値 : array())getPostDetailを参照
Résultat void

postImg() public méthode

記事中の画像を出力する
public postImg ( array $post, array $options = [] ) : void
$post array ブログ記事
$options array オプション(初期値 : array()) - `num` : 何枚目の画像か順番を指定(初期値 : 1) - `link` : 詳細ページへのリンクをつけるかどうか(初期値 : true) - `alt` : ALT属性(初期値 : ブログ記事のタイトル)
Résultat void

postTitle() public méthode

記事のタイトルを出力する
public postTitle ( array $post, boolean $link = true ) : void
$post array ブログ記事データ
$link boolean 詳細ページへのリンクをつける場合には、true を指定する(初期値 : true)
Résultat void

removeCtrlChars() public méthode

文字列から制御文字を取り除く
public removeCtrlChars ( $string )

setContent() public méthode

アイキャッチを利用する場合に必ず設定が必要
public setContent ( integer $blogContentId = null ) : void
$blogContentId integer ブログコンテンツID
Résultat void

tag() public méthode

複数所属する場合は複数出力する
public tag ( array $post, string $separator = ' , ' ) : void
$post array 記事データ
$separator string 区切り文字(初期値 : , )
Résultat void

title() public méthode

ブログタイトルを出力する
public title ( ) : void
Résultat void

Property Details

$BlogCategory public_oe property

ブログカテゴリモデル
public BlogCategory $BlogCategory
Résultat BlogCategory

$helpers public_oe property

ヘルパー
public array $helpers
Résultat array