HtmlTemplateFramework
[
class tree: HtmlTemplateFramework
] [
index: HtmlTemplateFramework
] [
all elements
]
Packages:
HtmlTemplateFramework
Source for file htf_frm_headtag_element.phl
Documentation is available at
htf_frm_headtag_element.phl
<?php
/**
* htf_frm_headtag_elementクラス
*
* headタグ情報を保持し、htmlタグを生成するクラス。<br>
* htf_frm_headconfigクラスから呼び出すヘルパークラスとして使用されます。
*
*
@package
HtmlTemplateFramework
*
@subpackage
frame
*
@access
public
*
@author
Yamauchi Shogo <htf@as-prj.com>
*
@version
$Id: htf_frm_headtag_element.phl ,v 1.0 $
***/
require_once
(
"htf_com_initialize.inc"
)
;
//共通初期処理
require_once
(
"htf_tag_element.phl"
)
;
//タグオブジェクト
/**
* headタグ情報を保持し、htmlタグを生成するクラス。
*
* htfフレーム情報のheadconfigで指定した内容をタグオブジェクトとして保持します。<br>
* htf_frm_headconfigクラスから呼び出すヘルパークラスとして使用されます。
*
*
@access
public
*
@author
Yamauchi Shogo <htf@as-prj.com>
***/
class
htf_frm_headtag_element
extends
htf_tag_element
{
/**
* addheaderpath属性
*
* addheaderのパス。指定があった場合にはこのパスを指定してincludeします。
*
*
@access
private
*
@var
string
*/
var
$addheaderpath
;
/**
* htf_frm_headtag_element()
*
* htf_frm_headtag_elementを生成します。
*
*
@access
public
*
@param
string
追加ヘッダファイルパス文字列
*
@return
void
***/
function
htf_frm_headtag_element
(
$addheader
)
{
//スーパークラスのコンストラクタ
parent
::
htf_tag_element
(
"head"
,
TRUE
,
HTF_ITEMCASE_ELEMENT
)
;
$this
->
addheaderpath
=
$addheader
;
}
/**
* add_meta_content_type()
*
* Content-Typtを記述したmetaタグを追加します。
*
*
@access
public
*
@param
string
出力するContent-Type文字列
*
@return
void
***/
function
add_meta_content_type
(
$content_type
)
{
if
(
htf_is_existsval
(
$content_type
))
{
$meta_content_type
=
new
htf_tag_element
(
"meta"
,
FALSE
,
HTF_ITEMCASE_ELEMENT
)
;
$meta_content_type
->
add_attribute
(
'http-equiv'
,
'Content-Type'
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$meta_content_type
->
add_attribute
(
'content'
,
$content_type
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$this
->
add_content
(
$meta_content_type
)
;
}
}
/**
* add_meta_content_style_type()
*
* Content-Style-Typeを記述したmetaタグを追加します。
*
*
@access
public
*
@param
string
出力するContent-Style-Type文字列
*
@return
void
***/
function
add_meta_content_style_type
(
$content_style_type
)
{
//metaタグ・Content-Style-Type
if
(
htf_is_existsval
(
$content_style_type
))
{
$meta_content_style_type
=
new
htf_tag_element
(
"meta"
,
FALSE
,
HTF_ITEMCASE_ELEMENT
)
;
$meta_content_style_type
->
add_attribute
(
'http-equiv'
,
'Content-Style-Type'
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$meta_content_style_type
->
add_attribute
(
'content'
,
$content_style_type
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$this
->
add_content
(
$meta_content_style_type
)
;
}
}
/**
* add_meta_content_script_type()
*
* Content-Script-Typeを記述したmetaタグを追加します。
*
*
@access
public
*
@param
string
出力するContent-Script-Type文字列
*
@return
void
***/
function
add_meta_content_script_type
(
$content_script_type
)
{
//metaタグ・Content-Script-Type
if
(
htf_is_existsval
(
$content_script_type
))
{
$meta_content_script_type
=
new
htf_tag_element
(
"meta"
,
FALSE
,
HTF_ITEMCASE_ELEMENT
)
;
$meta_content_script_type
->
add_attribute
(
'http-equiv'
,
'Content-Script-Type'
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$meta_content_script_type
->
add_attribute
(
'content'
,
$content_script_type
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$this
->
add_content
(
$meta_content_script_type
)
;
}
}
/**
* add_meta_author()
*
* Authorを記述したmetaタグを追加します。
*
*
@access
public
*
@param
string
出力するAuthor文字列
*
@return
void
***/
function
add_meta_author
(
$author
)
{
//metaタグ・author
if
(
htf_is_existsval
(
$author
))
{
$meta_author
=
new
htf_tag_element
(
"meta"
,
FALSE
,
HTF_ITEMCASE_ELEMENT
)
;
$meta_author
->
add_attribute
(
'name'
,
'author'
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$meta_author
->
add_attribute
(
'content'
,
$author
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$this
->
add_content
(
$meta_author
)
;
}
}
/**
* add_meta_copyright()
*
* Copyrightを記述したmetaタグを追加します。
*
*
@access
public
*
@param
string
出力するCopyright文字列
*
@return
void
***/
function
add_meta_copyright
(
$copyright
)
{
//metaタグ・copyright
if
(
htf_is_existsval
(
$copyright
))
{
$meta_copyright
=
new
htf_tag_element
(
"meta"
,
FALSE
,
HTF_ITEMCASE_ELEMENT
)
;
$meta_copyright
->
add_attribute
(
'name'
,
'copyright'
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$meta_copyright
->
add_attribute
(
'content'
,
$copyright
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$this
->
add_content
(
$meta_copyright
)
;
}
}
/**
* add_meta_description()
*
* Descriptionを記述したmetaタグを追加します。
*
*
@access
public
*
@param
string
出力するDescription文字列
*
@return
void
***/
function
add_meta_description
(
$description
)
{
//metaタグ・description
if
(
htf_is_existsval
(
$description
))
{
$meta_description
=
new
htf_tag_element
(
"meta"
,
FALSE
,
HTF_ITEMCASE_ELEMENT
)
;
$meta_description
->
add_attribute
(
'name'
,
'description'
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$meta_description
->
add_attribute
(
'content'
,
$description
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$this
->
add_content
(
$meta_description
)
;
}
}
/**
* add_meta_keywords()
*
* Keywordsを記述したmetaタグを追加します。
*
*
@access
public
*
@param
string
出力するKeywords文字列
*
@return
void
***/
function
add_meta_keywords
(
$keywords
)
{
//metaタグ・keywords
if
(
htf_is_existsval
(
$keywords
))
{
$meta_keywords
=
new
htf_tag_element
(
"meta"
,
FALSE
,
HTF_ITEMCASE_ELEMENT
)
;
$meta_keywords
->
add_attribute
(
'name'
,
'keywords'
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$meta_keywords
->
add_attribute
(
'content'
,
$keywords
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$this
->
add_content
(
$meta_keywords
)
;
}
}
/**
* add_meta_robots()
*
* Robotsを記述したmetaタグを追加します。
*
*
@access
public
*
@param
string
出力するRobots文字列
*
@return
void
***/
function
add_meta_robots
(
$robots
)
{
//metaタグ・robots
if
(
htf_is_existsval
(
$robots
))
{
$meta_robots
=
new
htf_tag_element
(
"meta"
,
FALSE
,
HTF_ITEMCASE_ELEMENT
)
;
$meta_robots
->
add_attribute
(
'name'
,
'robots'
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$meta_robots
->
add_attribute
(
'content'
,
$robots
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$this
->
add_content
(
$meta_robots
)
;
}
}
/**
* add_meta_generator()
*
* Generatorを記述したmetaタグを追加します。
*
*
@access
public
*
@return
void
***/
function
add_meta_generator
(
)
{
$meta_generator
=
new
htf_tag_element
(
"meta"
,
FALSE
,
HTF_ITEMCASE_ELEMENT
)
;
$meta_generator
->
add_attribute
(
'name'
,
'GENERATOR'
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$meta_generator
->
add_attribute
(
'content'
,
HTF_PRODUCT_NAME
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$this
->
add_content
(
$meta_generator
)
;
}
/**
* add_title()
*
* titleタグを追加します。
*
*
@access
public
*
@param
string
出力するtitle文字列
*
@return
void
***/
function
add_title
(
$titlestr
)
{
//titleタグ
if
(
htf_is_existsval
(
$titlestr
))
{
$title
=
new
htf_tag_element
(
"title"
,
TRUE
,
HTF_ITEMCASE_ELEMENT
)
;
$title
->
add_content
(
$titlestr
)
;
$this
->
add_content
(
$title
)
;
}
}
/**
* add_style()
*
* 引数のCSS文字列内容のstyleタグを追加します。
*
*
@access
public
*
@param
string
出力するCSS文字列
*
@param
string
StyleType指定文字列
*
@return
void
***/
function
add_style
(
$cssstr
,
$styletype
=
NULL
)
{
//styleタグ(引数のCSS文字列から生成)
if
(
htf_is_existsval
(
$cssstr
))
{
$style
=
new
htf_tag_element
(
"style"
,
TRUE
,
HTF_ITEMCASE_ELEMENT
)
;
if
(
htf_is_existsval
(
$styletype
))
{
$style
->
add_attribute
(
'type'
,
$styletype
,
HTF_ITEMCASE_ATTRIBUTE
)
;
}
$style_content
=
htf_add_cr
(
'<!--'
)
;
$style_content
.=
htf_add_cr
(
$cssstr
)
;
$style_content
.=
htf_add_cr
(
'-->'
)
;
$style
->
add_content
(
$style_content
)
;
$this
->
add_content
(
$style
)
;
}
}
/**
* add_link()
*
* linkタグを追加します。
*
*
@access
public
*
@param
string
出力するCSSファイル名文字列
*
@return
void
***/
function
add_link
(
$cssfname
)
{
//linkタグ(引数のCSSファイル名から生成)
if
(
htf_is_existsval
(
$cssfname
))
{
$link
=
new
htf_tag_element
(
"link"
,
FALSE
,
HTF_ITEMCASE_ELEMENT
)
;
$link
->
add_attribute
(
'rel'
,
'stylesheet'
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$link
->
add_attribute
(
'href'
,
$cssfname
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$link
->
add_attribute
(
'type'
,
'text/css'
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$this
->
add_content
(
$link
)
;
}
}
/**
* add_script()
*
* scriptタグを追加します。(scriptタグのテキスト要素として記述)
*
*
@access
public
*
@param
string
出力するスクリプトファイル名(ファイルシステムパス)文字列
*
@param
string
出力するスクリプト言語の名前文字列
*
@return
void
***/
function
add_script
(
$jspath
,
$mimetype
=
NULL
,
$language
=
NULL
)
{
if
(
htf_is_existsval
(
$jspath
))
{
$script
=
new
htf_tag_element
(
"script"
,
TRUE
,
HTF_ITEMCASE_ELEMENT
)
;
if
(
htf_is_existsval
(
$mimetype
))
{
$script
->
add_attribute
(
'type'
,
$mimetype
,
HTF_ITEMCASE_ATTRIBUTE
)
;
}
if
(
htf_is_existsval
(
$language
))
{
$script
->
add_attribute
(
'language'
,
$language
,
HTF_ITEMCASE_ATTRIBUTE
)
;
}
$content
=
file_get_contents
(
$jspath
)
;
$script
->
add_content
(
$content
)
;
$this
->
add_content
(
$script
)
;
}
}
/**
* add_script_inline()
*
* scriptタグを追加します。(インラインでスクリプト呼び出し)
*
*
@access
public
*
@param
string
出力するスクリプトURL文字列
*
@param
string
出力するスクリプト言語のMIMEタイプ文字列
*
@param
string
出力するスクリプト言語の名前文字列
*
@return
void
***/
function
add_script_inline
(
$jsurl
,
$mimetype
=
NULL
,
$language
=
NULL
)
{
//scriptタグ(イメージスワップ用jsファイルがインクルードにあるはず)
if
(
htf_is_existsval
(
$jsurl
))
{
$script
=
new
htf_tag_element
(
"script"
,
TRUE
,
HTF_ITEMCASE_ELEMENT
)
;
if
(
htf_is_existsval
(
$language
))
{
$script
->
add_attribute
(
'language'
,
$language
,
HTF_ITEMCASE_ATTRIBUTE
)
;
}
if
(
htf_is_existsval
(
$mimetype
))
{
$script
->
add_attribute
(
'type'
,
$mimetype
,
HTF_ITEMCASE_ATTRIBUTE
)
;
}
$script
->
add_attribute
(
'src'
,
$jsurl
,
HTF_ITEMCASE_ATTRIBUTE
)
;
$this
->
add_content
(
$script
)
;
}
}
/**
* print_htmltag()
*
* htmlタグを出力します。
*
*
@access
public
*
@return
void
***/
function
print_htmltag
(
)
{
//headタグprint
print
(
htf_get_comment_areastart
(
'head'
))
;
print
(
$this
->
get_starttag
(
)
.
"\n"
)
;
//スタートタグ出力
print
(
$this
->
get_contents
(
))
;
//コンテンツ出力
//追加ヘッダinclude
if
(
htf_is_existsval
(
$this
->
addheaderpath
))
{
include
(
$this
->
addheaderpath
)
;
}
print
(
$this
->
get_endtag
(
)
.
"\n"
)
;
//終了タグ出力
print
(
htf_get_comment_areaend
(
'head'
))
;
return
;
}
}
?>
Documentation generated on Tue, 19 Sep 2006 06:20:58 +0900 by
phpDocumentor 1.3.0