Ejemplo n.º 1
0
 /**
  * コンストラクタ
  *
  * @param string $language
  */
 public function __construct($language = "en")
 {
     // 言語設定を保存
     $this->language = $language;
     // キャッシュを読み込み
     $this->cache = Vizualizer_Cache_Factory::create("google.geocoding");
 }
Ejemplo n.º 2
0
/**
 * Smarty {inline_css} function plugin
 *
 * Type: function<br>
 * Name: inline_css<br>
 * Purpose: inline css activate plugin.<br>
 *
 * @author Naohisa Minagawa <minagawa at web-life dot co dot jp>
 * @param array $params parameters
 * @param object $smarty Smarty object
 * @param object $template template object
 * @return string null
 */
function smarty_function_inline_css($params, $template)
{
    $attr = Vizualizer::attr();
    $script = "";
    if (!empty($params["href"])) {
        $script .= "<style";
        if (!empty($params["type"])) {
            $script .= " type=\"" . $params["type"] . "\"";
        } else {
            $script .= " type=\"text/css\"";
        }
        if (!empty($params["media"])) {
            $script .= " media=\"" . $params["media"] . "\"";
        } else {
            $script .= " media=\"all\"";
        }
        $script .= ">\r\n";
        if (substr($params["href"], 0, 7) !== "http://" && substr($params["href"], 0, 8) !== "https://") {
            if (substr($params["href"], 0, 1) !== "/") {
                $info = pathinfo($attr["templateName"]);
                $params["href"] = $info["dirname"] . "/" . $params["href"];
            }
            $params["href"] = VIZUALIZER_URL . $params["href"];
        }
        if (class_exists("Memcache") && Vizualizer_Configure::get("memcache_contents") && Vizualizer_Configure::get("memcache") !== "") {
            // memcacheの場合は静的コンテンツをmemcacheにキャッシュする。
            $contents = Vizualizer_Cache_Factory::create("inlineCss_" . urlencode($params["href"]));
            $data = $contents->export();
            if (empty($data)) {
                if (($buffer = file_get_contents($params["href"])) !== FALSE) {
                    $contents->set("content", $buffer);
                }
                $data = $contents->export();
            }
            $script .= $data["content"];
        } else {
            if (($buffer = file_get_contents($params["href"])) !== FALSE) {
                $script .= $buffer;
            }
        }
        $script .= "\r\n</style>";
    }
    return $script;
}
Ejemplo n.º 3
0
 protected function initialize()
 {
     // DBの接続を取得する。
     $connection = Vizualizer_Database_Factory::conn($this->module);
     // 構成されたカラム情報を元に設定値を生成
     $this->_B = $this->_T = $this->_C = $connection->escapeIdentifier($this->tableName);
     $this->_W = $this->_C . ".*";
     // テーブル構成のキャッシュがある場合にはキャッシュからテーブル情報を取得
     $tableConfigure = Vizualizer_Cache_Factory::create("table_" . $this->tableName);
     if ($tableConfigure->options == "") {
         try {
             // テーブルの定義を取得
             $options = $connection->columns($this->_T);
         } catch (Exception $e) {
             //$this->install($connection);
             // テーブルの定義を再取得
             $options = $connection->columns($this->_T);
         }
         // テーブルの主キーを取得
         $keys = $connection->keys($this->_T);
         // テーブルのインデックスを取得
         $indexes = $connection->indexes($this->_T);
         // テーブルの設定をデータキャッシュに登録する。
         $tableConfigure->import(array("options" => $options, "keys" => $keys));
     }
     // カラム情報を設定
     $this->_COLUMNS = array();
     $this->_FIELDS = array();
     foreach ($tableConfigure->options as $option) {
         $column = new Vizualizer_Plugin_Table_Column($this, $option);
         $field = $column->field;
         $this->_COLUMNS[] = $field;
         $this->_FIELDS[$field] = $column;
     }
     // 主キー情報を設定
     $this->_PKEYS = array();
     if (is_array($tableConfigure->keys)) {
         foreach ($tableConfigure->keys as $key) {
             $this->_PKEYS[] = $key;
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * 静的コンテンツを取得する。
  */
 protected static function getStaticContents($filter = null)
 {
     $attr = Vizualizer::attr();
     // 静的コンテンツをキャッシュする。
     $contents = Vizualizer_Cache_Factory::create("content" . strtr($attr["userTemplate"] . $attr["templateName"], array("/" => "_")));
     $data = $contents->export();
     if (empty($data)) {
         if (($buffer = file_get_contents(Vizualizer_Configure::get("site_home") . $attr["userTemplate"] . $attr["templateName"])) !== FALSE) {
             $mtime = filemtime(Vizualizer_Configure::get("site_home") . $attr["userTemplate"] . $attr["templateName"]);
             $contents->set("modified", date("F d Y H:i:s.", $mtime));
             if ($filter !== null) {
                 $contents->set("data", $filter($buffer));
             } else {
                 $contents->set("data", $buffer);
             }
         }
         $data = $contents->export();
     }
     header("Cache-Control: public");
     header("Last-Modified: " . $data["modified"]);
     return $data["data"];
 }