☆スキーウエアNOW ON SALE!!☆★2ピース上下スーツ★ 【エァウォーク】幼児用ウエアAWT‐5524 ピンク(桃色)サイズ:100・110・120
沖縄産スナックパイン1玉(500g〜800g) N−95D23L/C3 technorati RobotReplay 2004/09/30から 今日: 昨日: 最近のツッコミ10発 |
2008-03-25 EC-CUBE更新内容2008-03-25 [長年日記]_ [EC-CUBE] EC-CUBE更新内容1Date: 2008-03-25 13:01:49 +0900 (Tue, 25 Mar 2008) New Revision: 35 Added: eccube2/trunk/data/class/module/ eccube2/trunk/data/class/module/SC_Module.php eccube2/trunk/data/class/module/SC_Module_Payment.php Log: auto commit Added: eccube2/trunk/data/class/module/SC_Module.php =================================================================== --- eccube2/trunk/data/class/module/SC_Module.php (rev 0) +++ eccube2/trunk/data/class/module/SC_Module.php 2008-03-25 04:01:49 UTC (rev 35) @@ -0,0 +1,266 @@ +<?php +/* + * This file is part of EC-CUBE + * + * Copyright(c) 2000-2008 LOCKON CO.,LTD. All Rights Reserved. + * + * http://www.lockon.co.jp/ + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +// {{{ requires +require_once CLASS_PATH . 'SC_Query.php'; +require_once CLASS_EX_PATH . 'db_extends/SC_DB_MasterData_Ex.php'; + +/** + * モジュールデータ管理クラス. + * 各モジュールに固有のデータへのアクセスを担当する. + * + * @example + * $module = new SC_Module('mdl_gmopg', 'GMOPG決済モジュール'); + * $arrSubData = $module->getSubData(); + * $module->registerSubData($arrData); + * $arrPaymethod = $module->getMasterData('paymethod); // data/cache/mtb_mdl_gmopg_paymethod.php + * $module->log('order error!', $debugValue); // data/logs/mdl_gmopg.log + * + * @package module + * @author LOCKON CO.,LTD. + * @version $Id: SC_Module.php 17181 2008-03-25 03:21:14Z adachi $ + * + * TODO モジュールコード周りの改修 命名がばらばらなのを吸収できるように + * TODO テーブル拡張, マスターデータ登録, 初期ファイルコピー処理の追加 + */ +class SC_Module { + + /** モジュール名 */ + var $moduleName; + + /** モジュールコード */ + var $moduleCode; + + /** サブデータを保持する */ + var $subData; + + /** パス定義 */ + var $classPath = 'class/'; + var $templatePath = 'template/'; + var $installPath = 'install/'; + + /** + * コンストラクタ + * + * @param string $code + * @param string $name + * @return SC_Module + */ + function SC_Module($code, $name='') { + $this->setCode($code); + $this->setName($name); + } + + function setName($name) { + $this->moduleName = strtolower($name); + } + + function setCode($code) { + $this->moduleCode = $code; + } + + /** + * モジュール名を返す. + * + * @return string + */ + function getName() { + if (empty($this->moduleName)) { + $moduleName = $this->_getName(); + $this->setName($moduleName); + return $moduleName; + } + return $this->moduleName; + } + + /** + * DBからモジュール名を取得する + * + * @return string + */ + function _getName() { + $objQuery = new SC_Query; + return $objQuery->get('dtb_module', 'module_name', 'module_code = ?', $this->getCode()); + } + + /** + * モジュールコードを返す. + * + * @param boolean $toUpper 大文字に変換するかどうか.デフォルトはfalse + * @return string + */ + function getCode($toUpper = false) { + $moduleCode = $this->moduleCode; + return $toUpper ? strtoupper($moduleCode) : $moduleCode; + } + + /** + * モジュールのベースパスを返す + * + * @return string + */ + function getBasePath() { + return MODULE_PATH . $this->getCode() . '/'; + } + + /** + * テンプレートパスを返す + * + * @return string + */ + function getTemplatePath() { + return $this->getBasePath() . $this->templatePath; + } + + /** + * クラスパスを返す. + * + * @return string + */ + function getClassPath() { + return $this->getBasePath() . $this->classPath; + } + + /** + * dtb_moduleのsub_dataを取得する. + * + * @access private + * @param booean $force + * @return mixed|null + */ + function _getSubData($force = false) { + if (isset($this->subData)) return $this->subData; + + $moduleCode = $this->getCode(); + $objQuery = new SC_Query; + $ret = $objQuery->get( + 'dtb_module', 'sub_data', 'module_code = ?', array($moduleCode) + ); + + if (isset($ret)) { + $this->subData = unserialize($ret); + return $this->subData; + } + return null; + } + + /** + * dtb_moduleのsub_dataを取得する. + * + * @param string $key + * @param boolean $force + * @return mixed|null + */ + function getSubData($key = null, $force = false) { + $subData = $this->_getSubData($force); + $returnData = null; + + if (is_null($key)) { + $returnData = $subData; + } else { + $returnData = isset($subData[$key]) + ? $subData[$key] + : null; + } + + return $returnData; + } + + /** + * サブデータを登録する. + * + * @param mixed $data + * @param string + */ + function registerSubData($data, $key = null) { + $subData = $this->getSubData(); + + if (is_null($key)) { + $subData = $data; + } else { + if (is_array($subData)) { + $subData[$key] = $data; + } else { + $subData = array($key => $data); + } + } + + $arrUpdate = array('sub_data' => serialize($subData)); + + $objQuery = new SC_Query; + $objQuery->update('dtb_module', $arrUpdate, 'module_code = ?', array($this->getCode())); + + $this->subData = $subData; + } + + /** + * マスターデータを登録. + * 作りかけ... + * + * @param unknown_type $key + * @param unknown_type $value + */ + function registerMasterData($key, $value) { + $masterData = new SC_DB_MasterData; + } + + /** + * マスターデータを取得する. + * + * キャッシュはmtb_mdl_[name]_[***].phpで保存されるが、 + * 取得する場合はは$keyに***を指定する. + * 例えば、mtb_mdl_gmopg_paymethod.phpにアクセスしたい場合は、 + * $arrPaymethod = $masterData->getMasterData('paymethod'); + * で取得できる. + * + * @param string $key + * @return array + */ + function getMasterData($key) { + $key = 'mtb_' . $this->getCode() . "_$key"; + $masterData = new SC_DB_MasterData_Ex; + return $masterData->getMasterData($key); + } + + /** + * ログを出力. + * + * @param string $msg + * @param mixed $data Dumpしたいデータ.デバッグ用. + * @param string $suffix + */ + function log($msg, $data = null, $suffix = '') { + $path = DATA_PATH . 'logs/' . $this->getCode() . "$suffix.log"; + GC_Utils::gfPrintLog($msg, $path); + + if (!is_null($data)) { + GC_Utils::gfPrintLog(print_r($data, true), $path); + } + } +} +/* + * Local variables: + * coding: utf-8 + * End: + */ +?> Added: eccube2/trunk/data/class/module/SC_Module_Payment.php =================================================================== --- eccube2/trunk/data/class/module/SC_Module_Payment.php (rev 0) +++ eccube2/trunk/data/class/module/SC_Module_Payment.php 2008-03-25 04:01:49 UTC (rev 35) @@ -0,0 +1,44 @@ +<?php +/* + * This file is part of EC-CUBE + * + * Copyright(c) 2000-2008 LOCKON CO.,LTD. All Rights Reserved. + * + * http://www.lockon.co.jp/ + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +// {{{ requires +require_once CLASS_PATH . 'module/SC_Module.php'; + +/** + * 決済モジュール用のモジュールデータ管理クラス. + * 各モジュールに固有のデータへのアクセスを担当する. + * + * + * @package module + * @author LOCKON CO.,LTD. + * @version $Id: SC_Module_Payment.php 17181 2008-03-25 03:21:14Z adachi $ + */ +class SC_Module_Payment extends SC_Module { + /** 支払方法 */ + var $paymethod = array(); +} +/* + * Local variables: + * coding: utf-8 + * End: + */ +?> _ [EC-CUBE] EC-CUBE更新内容2Date: 2008-03-25 22:01:24 +0900 (Tue, 25 Mar 2008) New Revision: 36 Modified: eccube2/trunk/data/class/pages/upgrade/helper/LC_Upgrade_Helper_Json.php Log: auto commit Modified: eccube2/trunk/data/class/pages/upgrade/helper/LC_Upgrade_Helper_Json.php =================================================================== --- eccube2/trunk/data/class/pages/upgrade/helper/LC_Upgrade_Helper_Json.php 2008-03-25 04:01:49 UTC (rev 35) +++ eccube2/trunk/data/class/pages/upgrade/helper/LC_Upgrade_Helper_Json.php 2008-03-25 13:01:24 UTC (rev 36) @@ -85,7 +85,7 @@ * @return StdClass */ function decode($str) { - if (version_compare(phpversion(), '5.2.0', '>=')) { + if (function_exists('json_decode')) { LC_Upgrade_Helper_Log::log(' *use json_decode()'); return json_decode($str); } |