HtmlTemplateFramework
[ class tree: HtmlTemplateFramework ] [ index: HtmlTemplateFramework ] [ all elements ]

Source for file htf_frm_headtag_element.phl

Documentation is available at htf_frm_headtag_element.phl

  1. <?php
  2. /**
  3.  * htf_frm_headtag_elementクラス
  4.  *
  5.  * headタグ情報を保持し、htmlタグを生成するクラス。<br>
  6.  * htf_frm_headconfigクラスから呼び出すヘルパークラスとして使用されます。
  7.  *
  8.  * @package HtmlTemplateFramework
  9.  * @subpackage frame
  10.  * @access   public
  11.  * @author    Yamauchi Shogo <htf@as-prj.com>
  12.  * @version $Id: htf_frm_headtag_element.phl ,v 1.0 $
  13.  ***/
  14. require_once("htf_com_initialize.inc");    //共通初期処理
  15. require_once("htf_tag_element.phl");        //タグオブジェクト
  16.  
  17. /**
  18.  * headタグ情報を保持し、htmlタグを生成するクラス。
  19.  *
  20.  * htfフレーム情報のheadconfigで指定した内容をタグオブジェクトとして保持します。<br>
  21.  * htf_frm_headconfigクラスから呼び出すヘルパークラスとして使用されます。
  22.  * 
  23.  * @access  public
  24.  * @author    Yamauchi Shogo <htf@as-prj.com>
  25.  ***/
  26.  
  27.    /**
  28.     * addheaderpath属性
  29.     * 
  30.     * addheaderのパス。指定があった場合にはこのパスを指定してincludeします。
  31.     * 
  32.     * @access private
  33.     * @var string 
  34.     */
  35.     var $addheaderpath;
  36.  
  37.     /**
  38.      * htf_frm_headtag_element()
  39.      *
  40.      * htf_frm_headtag_elementを生成します。
  41.      *
  42.      * @access   public
  43.      * @param     string    追加ヘッダファイルパス文字列
  44.      * @return    void 
  45.      ***/
  46.     function htf_frm_headtag_element($addheader{
  47.         //スーパークラスのコンストラクタ
  48.         parent::htf_tag_element("head"TRUEHTF_ITEMCASE_ELEMENT);
  49.         $this->addheaderpath $addheader;
  50.     }
  51.     
  52.     /**
  53.      * add_meta_content_type()
  54.      *
  55.      * Content-Typtを記述したmetaタグを追加します。
  56.      *
  57.      * @access   public
  58.      * @param     string    出力するContent-Type文字列
  59.      * @return    void 
  60.      ***/
  61.     function add_meta_content_type($content_type{
  62.         if (htf_is_existsval($content_type)) {
  63.             $meta_content_type new htf_tag_element("meta"FALSEHTF_ITEMCASE_ELEMENT);
  64.             $meta_content_type->add_attribute('http-equiv''Content-Type'HTF_ITEMCASE_ATTRIBUTE);
  65.             $meta_content_type->add_attribute('content'$content_typeHTF_ITEMCASE_ATTRIBUTE);
  66.             $this->add_content($meta_content_type);
  67.         }
  68.     }
  69.  
  70.     /**
  71.      * add_meta_content_style_type()
  72.      *
  73.      * Content-Style-Typeを記述したmetaタグを追加します。
  74.      *
  75.      * @access   public
  76.      * @param     string    出力するContent-Style-Type文字列
  77.      * @return    void 
  78.      ***/
  79.     function add_meta_content_style_type($content_style_type{
  80.         //metaタグ・Content-Style-Type
  81.         if (htf_is_existsval($content_style_type)) {
  82.             $meta_content_style_type new htf_tag_element("meta"FALSEHTF_ITEMCASE_ELEMENT);
  83.             $meta_content_style_type->add_attribute('http-equiv''Content-Style-Type'HTF_ITEMCASE_ATTRIBUTE);
  84.             $meta_content_style_type->add_attribute('content'$content_style_typeHTF_ITEMCASE_ATTRIBUTE);
  85.             $this->add_content($meta_content_style_type);
  86.         }
  87.     }
  88.  
  89.     /**
  90.      * add_meta_content_script_type()
  91.      *
  92.      * Content-Script-Typeを記述したmetaタグを追加します。
  93.      *
  94.      * @access   public
  95.      * @param     string    出力するContent-Script-Type文字列
  96.      * @return    void 
  97.      ***/
  98.     function add_meta_content_script_type($content_script_type{
  99.         //metaタグ・Content-Script-Type
  100.         if (htf_is_existsval($content_script_type)) {
  101.             $meta_content_script_type new htf_tag_element("meta"FALSEHTF_ITEMCASE_ELEMENT);
  102.             $meta_content_script_type->add_attribute('http-equiv''Content-Script-Type'HTF_ITEMCASE_ATTRIBUTE);
  103.             $meta_content_script_type->add_attribute('content'$content_script_typeHTF_ITEMCASE_ATTRIBUTE);
  104.             $this->add_content($meta_content_script_type);
  105.         }
  106.     }
  107.  
  108.     /**
  109.      * add_meta_author()
  110.      *
  111.      * Authorを記述したmetaタグを追加します。
  112.      *
  113.      * @access   public
  114.      * @param     string    出力するAuthor文字列
  115.      * @return    void 
  116.      ***/
  117.     function add_meta_author($author{
  118.         //metaタグ・author
  119.         if (htf_is_existsval($author)) {
  120.             $meta_author new htf_tag_element("meta"FALSEHTF_ITEMCASE_ELEMENT);
  121.             $meta_author->add_attribute('name''author'HTF_ITEMCASE_ATTRIBUTE);
  122.             $meta_author->add_attribute('content'$authorHTF_ITEMCASE_ATTRIBUTE);
  123.             $this->add_content($meta_author);
  124.         }
  125.     }
  126.  
  127.     /**
  128.      * add_meta_copyright()
  129.      *
  130.      * Copyrightを記述したmetaタグを追加します。
  131.      *
  132.      * @access   public
  133.      * @param     string    出力するCopyright文字列
  134.      * @return    void 
  135.      ***/
  136.     function add_meta_copyright($copyright{
  137.         //metaタグ・copyright
  138.         if (htf_is_existsval($copyright)) {
  139.             $meta_copyright new htf_tag_element("meta"FALSEHTF_ITEMCASE_ELEMENT);
  140.             $meta_copyright->add_attribute('name''copyright'HTF_ITEMCASE_ATTRIBUTE);
  141.             $meta_copyright->add_attribute('content'$copyrightHTF_ITEMCASE_ATTRIBUTE);
  142.             $this->add_content($meta_copyright);
  143.         }
  144.     }
  145.     
  146.     /**
  147.      * add_meta_description()
  148.      *
  149.      * Descriptionを記述したmetaタグを追加します。
  150.      *
  151.      * @access   public
  152.      * @param     string    出力するDescription文字列
  153.      * @return    void 
  154.      ***/
  155.     function add_meta_description($description{
  156.         //metaタグ・description
  157.         if (htf_is_existsval($description)) {
  158.             $meta_description new htf_tag_element("meta"FALSEHTF_ITEMCASE_ELEMENT);
  159.             $meta_description->add_attribute('name''description'HTF_ITEMCASE_ATTRIBUTE);
  160.             $meta_description->add_attribute('content'$descriptionHTF_ITEMCASE_ATTRIBUTE);
  161.             $this->add_content($meta_description);
  162.         }
  163.     }
  164.  
  165.     /**
  166.      * add_meta_keywords()
  167.      *
  168.      * Keywordsを記述したmetaタグを追加します。
  169.      *
  170.      * @access   public
  171.      * @param     string    出力するKeywords文字列
  172.      * @return    void 
  173.      ***/
  174.     function add_meta_keywords($keywords{
  175.         //metaタグ・keywords
  176.         if (htf_is_existsval($keywords)) {
  177.             $meta_keywords new htf_tag_element("meta"FALSEHTF_ITEMCASE_ELEMENT);
  178.             $meta_keywords->add_attribute('name''keywords'HTF_ITEMCASE_ATTRIBUTE);
  179.             $meta_keywords->add_attribute('content'$keywordsHTF_ITEMCASE_ATTRIBUTE);
  180.             $this->add_content($meta_keywords);
  181.         }
  182.     }
  183.  
  184.     /**
  185.      * add_meta_robots()
  186.      *
  187.      * Robotsを記述したmetaタグを追加します。
  188.      *
  189.      * @access   public
  190.      * @param     string    出力するRobots文字列
  191.      * @return    void 
  192.      ***/
  193.     function add_meta_robots($robots{
  194.         //metaタグ・robots
  195.         if (htf_is_existsval($robots)) {
  196.             $meta_robots new htf_tag_element("meta"FALSEHTF_ITEMCASE_ELEMENT);
  197.             $meta_robots->add_attribute('name''robots'HTF_ITEMCASE_ATTRIBUTE);
  198.             $meta_robots->add_attribute('content'$robotsHTF_ITEMCASE_ATTRIBUTE);
  199.             $this->add_content($meta_robots);
  200.         }
  201.     }
  202.  
  203.     /**
  204.      * add_meta_generator()
  205.      *
  206.      * Generatorを記述したmetaタグを追加します。
  207.      *
  208.      * @access   public
  209.      * @return    void 
  210.      ***/
  211.     function add_meta_generator({
  212.         $meta_generator new htf_tag_element("meta"FALSEHTF_ITEMCASE_ELEMENT);
  213.         $meta_generator->add_attribute('name''GENERATOR'HTF_ITEMCASE_ATTRIBUTE);
  214.         $meta_generator->add_attribute('content'HTF_PRODUCT_NAMEHTF_ITEMCASE_ATTRIBUTE);
  215.         $this->add_content($meta_generator);
  216.     }
  217.  
  218.     /**
  219.      * add_title()
  220.      *
  221.      * titleタグを追加します。
  222.      *
  223.      * @access   public
  224.      * @param     string    出力するtitle文字列
  225.      * @return    void 
  226.      ***/
  227.     function add_title($titlestr{
  228.         //titleタグ
  229.         if (htf_is_existsval($titlestr)) {
  230.             $title new htf_tag_element("title"TRUEHTF_ITEMCASE_ELEMENT);
  231.             $title->add_content($titlestr);
  232.             $this->add_content($title);
  233.         }
  234.     }
  235.  
  236.     /**
  237.      * add_style()
  238.      *
  239.      * 引数のCSS文字列内容のstyleタグを追加します。
  240.      *
  241.      * @access   public
  242.      * @param     string    出力するCSS文字列
  243.      * @param     string    StyleType指定文字列
  244.      * @return    void 
  245.      ***/
  246.     function add_style($cssstr$styletype=NULL{
  247.         //styleタグ(引数のCSS文字列から生成)
  248.         if (htf_is_existsval($cssstr)) {
  249.             $style new htf_tag_element("style"TRUEHTF_ITEMCASE_ELEMENT);
  250.             if (htf_is_existsval($styletype)) {
  251.                 $style->add_attribute('type'$styletypeHTF_ITEMCASE_ATTRIBUTE);
  252.             }
  253.             $style_content htf_add_cr('<!--');
  254.             $style_content.= htf_add_cr($cssstr);
  255.             $style_content.= htf_add_cr('-->');
  256.             $style->add_content($style_content);
  257.             $this->add_content($style);
  258.         }
  259.     }
  260.  
  261.     /**
  262.      * add_link()
  263.      *
  264.      * linkタグを追加します。
  265.      *
  266.      * @access   public
  267.      * @param     string    出力するCSSファイル名文字列
  268.      * @return    void 
  269.      ***/
  270.     function add_link($cssfname{
  271.         //linkタグ(引数のCSSファイル名から生成)
  272.         if (htf_is_existsval($cssfname)) {
  273.             $link new htf_tag_element("link"FALSEHTF_ITEMCASE_ELEMENT);
  274.             $link->add_attribute('rel''stylesheet'HTF_ITEMCASE_ATTRIBUTE);
  275.             $link->add_attribute('href'$cssfnameHTF_ITEMCASE_ATTRIBUTE);
  276.             $link->add_attribute('type''text/css'HTF_ITEMCASE_ATTRIBUTE);
  277.             $this->add_content($link);
  278.         }
  279.     }
  280.  
  281.     /**
  282.      * add_script()
  283.      *
  284.      * scriptタグを追加します。(scriptタグのテキスト要素として記述)
  285.      *
  286.      * @access   public
  287.      * @param     string    出力するスクリプトファイル名(ファイルシステムパス)文字列
  288.      * @param     string    出力するスクリプト言語の名前文字列
  289.      * @return    void 
  290.      ***/
  291.     function add_script($jspath$mimetype=NULL$language=NULL{
  292.         if (htf_is_existsval($jspath)) {
  293.             $script new htf_tag_element("script"TRUEHTF_ITEMCASE_ELEMENT);
  294.             if (htf_is_existsval($mimetype)) {
  295.                 $script->add_attribute('type'$mimetypeHTF_ITEMCASE_ATTRIBUTE);
  296.             }
  297.             if (htf_is_existsval($language)) {
  298.                 $script->add_attribute('language'$languageHTF_ITEMCASE_ATTRIBUTE);
  299.             }
  300.             $content file_get_contents($jspath);
  301.             $script->add_content($content);
  302.             $this->add_content($script);
  303.         }
  304.     }
  305.  
  306.     /**
  307.      * add_script_inline()
  308.      *
  309.      * scriptタグを追加します。(インラインでスクリプト呼び出し)
  310.      *
  311.      * @access   public
  312.      * @param     string    出力するスクリプトURL文字列
  313.      * @param     string    出力するスクリプト言語のMIMEタイプ文字列
  314.      * @param     string    出力するスクリプト言語の名前文字列
  315.      * @return    void 
  316.      ***/
  317.     function add_script_inline($jsurl$mimetype=NULL$language=NULL{
  318.         //scriptタグ(イメージスワップ用jsファイルがインクルードにあるはず)
  319.         if (htf_is_existsval($jsurl)) {
  320.             $script new htf_tag_element("script"TRUEHTF_ITEMCASE_ELEMENT);
  321.             if (htf_is_existsval($language)) {
  322.                 $script->add_attribute('language'$languageHTF_ITEMCASE_ATTRIBUTE);
  323.             }
  324.             if (htf_is_existsval($mimetype)) {
  325.                 $script->add_attribute('type'$mimetypeHTF_ITEMCASE_ATTRIBUTE);
  326.             }
  327.             $script->add_attribute('src'$jsurlHTF_ITEMCASE_ATTRIBUTE);
  328.             $this->add_content($script);
  329.         }
  330.     }
  331.  
  332.     /**
  333.      * print_htmltag()
  334.      *
  335.      * htmlタグを出力します。
  336.      *
  337.      * @access   public
  338.      * @return    void 
  339.      ***/
  340.     function print_htmltag({
  341.         //headタグprint
  342.         print(htf_get_comment_areastart('head'));
  343.         print($this->get_starttag()."\n");    //スタートタグ出力
  344.         print($this->get_contents());    //コンテンツ出力
  345.         //追加ヘッダinclude
  346.         if (htf_is_existsval($this->addheaderpath)) {
  347.             include($this->addheaderpath);
  348.         }
  349.         print($this->get_endtag()."\n");        //終了タグ出力
  350.         print(htf_get_comment_areaend('head'));
  351.  
  352.         return;
  353.  
  354.     }
  355. }
  356.  
  357. ?>

Documentation generated on Tue, 19 Sep 2006 06:20:58 +0900 by phpDocumentor 1.3.0