Index: html/user_data/plugins/plugin_menu.tpl
===================================================================
--- html/user_data/plugins/plugin_menu.tpl (リビジョン 0)
+++ html/user_data/plugins/plugin_menu.tpl (リビジョン 0)
@@ -0,0 +1,33 @@
+
+
Index: html/user_data/plugins/plugins.xml
===================================================================
--- html/user_data/plugins/plugins.xml (リビジョン 0)
+++ html/user_data/plugins/plugins.xml (リビジョン 0)
@@ -0,0 +1,7 @@
+
+
+
+ Google Analytics
+ google_analytics
+
+
Index: html/user_data/plugins/google_analytics/sql/delete.sql
===================================================================
--- html/user_data/plugins/google_analytics/sql/delete.sql (リビジョン 0)
+++ html/user_data/plugins/google_analytics/sql/delete.sql (リビジョン 0)
@@ -0,0 +1,2 @@
+DELETE FROM dtb_bloc WHERE filename = 'google_analytics';
+DELETE FROM dtb_blocposition WHERE filename = 'google_analytics';
\ No newline at end of file
Index: html/user_data/plugins/google_analytics/sql/insert.sql
===================================================================
--- html/user_data/plugins/google_analytics/sql/insert.sql (リビジョン 0)
+++ html/user_data/plugins/google_analytics/sql/insert.sql (リビジョン 0)
@@ -0,0 +1,2 @@
+INSERT INTO dtb_bloc (bloc_name, tpl_path, filename, php_path, del_flg) VALUES ('Google Analytics', 'user_data/plugins/google_analytics/tpl/ga.tpl', 'google_analytics', 'user_data/plugins/google_analytics/ga.php', 1);
+INSERT INTO dtb_blocposition (page_id, target_id, bloc_id, bloc_row, filename, anywhere) VALUES (1, 10, (SELECT bloc_id FROM dtb_bloc WHERE filename = 'google_analytics'), 0, 'google_analytics', 1);
\ No newline at end of file
Index: html/user_data/plugins/google_analytics/tpl/ga.tpl
===================================================================
--- html/user_data/plugins/google_analytics/tpl/ga.tpl (リビジョン 0)
+++ html/user_data/plugins/google_analytics/tpl/ga.tpl (リビジョン 0)
@@ -0,0 +1,9 @@
+
+
Index: html/user_data/plugins/google_analytics/tpl/index.tpl
===================================================================
--- html/user_data/plugins/google_analytics/tpl/index.tpl (リビジョン 0)
+++ html/user_data/plugins/google_analytics/tpl/index.tpl (リビジョン 0)
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Google Analytics Plugin
+
+
+
+
+
Index: html/user_data/plugins/google_analytics/require.php
===================================================================
--- html/user_data/plugins/google_analytics/require.php (リビジョン 0)
+++ html/user_data/plugins/google_analytics/require.php (リビジョン 0)
@@ -0,0 +1,6 @@
+
\ No newline at end of file
Index: html/user_data/plugins/google_analytics/classes/pages/ga_config.php
===================================================================
--- html/user_data/plugins/google_analytics/classes/pages/ga_config.php (リビジョン 0)
+++ html/user_data/plugins/google_analytics/classes/pages/ga_config.php (リビジョン 0)
@@ -0,0 +1,3 @@
+
Index: html/user_data/plugins/google_analytics/classes/pages/LC_Page_FrontParts_Bloc_GoogleAnalytics.php
===================================================================
--- html/user_data/plugins/google_analytics/classes/pages/LC_Page_FrontParts_Bloc_GoogleAnalytics.php (リビジョン 0)
+++ html/user_data/plugins/google_analytics/classes/pages/LC_Page_FrontParts_Bloc_GoogleAnalytics.php (リビジョン 0)
@@ -0,0 +1,70 @@
+tpl_mainpage = USER_PATH . 'plugins/google_analytics/tpl/ga.tpl';
+ $this->tpl_subtitle = "Google Analytics Plugin";
+ }
+
+ /**
+ * Page のプロセス.
+ *
+ * @return void
+ */
+ function process() {
+ $objView = new SC_SiteView();
+ $objView->assignobj($this);
+ $objView->display($this->tpl_mainpage);
+ }
+
+ /**
+ * デストラクタ.
+ *
+ * @return void
+ */
+ function destroy() {
+ parent::destroy();
+ }
+}
+?>
\ No newline at end of file
Index: html/user_data/plugins/google_analytics/classes/pages/LC_Page_Admin_GoogleAnalytics.php
===================================================================
--- html/user_data/plugins/google_analytics/classes/pages/LC_Page_Admin_GoogleAnalytics.php (リビジョン 0)
+++ html/user_data/plugins/google_analytics/classes/pages/LC_Page_Admin_GoogleAnalytics.php (リビジョン 0)
@@ -0,0 +1,139 @@
+tpl_mainpage = PLUGIN_PATH . 'google_analytics/tpl/index.tpl';
+ $this->tpl_subtitle = "Google Analytics Plugin";
+
+ if (empty($_POST["mode"])) {
+ $_POST["mode"] = "";
+ }
+
+ if (empty($_GET["mode"])) {
+ $_GET["mode"] = "";
+ }
+ }
+
+ /**
+ * Page のプロセス.
+ *
+ * POST パラメータ "mode" が register の場合は登録処理を行う.
+ * 登録処理の後, 自ページをリロードし, GET パラメータ "mode" を付与する.
+ * 登録に成功し, GET パラメータ "mode" の値が success の場合は
+ * 「登録に成功しました」というメッセージをポップアップで表示する.
+ * 登録に失敗し, GET パラメータ "mode" の値が failure の場合は
+ * 「登録に失敗しました」というメッセージをポップアップで表示する.
+ *
+ * @return void
+ */
+ function process() {
+ // 認証可否の判定
+ SC_Utils_Ex::sfIsSuccess(new SC_Session());
+
+ switch ($_POST["mode"]) {
+ case "register":
+ if ($this->register($_POST['ga_ua'])) {
+ $this->reload(array("mode" => "success"));
+ exit;
+ } else {
+ $this->reload(array("mode" => "failure"));
+ exit;
+ }
+ break;
+
+ default:
+ }
+
+ switch ($_GET["mode"]) {
+ case "success":
+ $this->tpl_onload .= "window.alert('登録に成功しました。');";
+ break;
+
+ case "failure":
+ $this->tpl_onload .= "window.alert('登録に失敗しました。');";
+ break;
+
+ default:
+ }
+
+ $objView = new SC_AdminView();
+ $objView->assignobj($this);
+ $objView->display($this->tpl_mainpage);
+ }
+
+ /**
+ * UA の登録を行う.
+ *
+ * classes/pages/ga_config.php を読み込み, ウェブプロパティID の文字列
+ * を定数として書き出す.
+ *
+ * @param string ウェブプロパティID の文字列
+ * @return boolean 登録に成功した場合 true; 失敗した場合 false;
+ */
+ function register($ua) {
+ $data = "\n";
+
+ $configFile = PLUGIN_PATH . "google_analytics/classes/pages/ga_config.php";
+ $handle = fopen($configFile, "w");
+ if (!$handle) {
+ return false;
+ }
+ // ファイルの内容を書き出す.
+ if (fwrite($handle, $data) === false) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * デストラクタ.
+ *
+ * @return void
+ */
+ function destroy() {
+ parent::destroy();
+ }
+}
+?>
\ No newline at end of file
Index: html/user_data/plugins/google_analytics/ga.php
===================================================================
--- html/user_data/plugins/google_analytics/ga.php (リビジョン 0)
+++ html/user_data/plugins/google_analytics/ga.php (リビジョン 0)
@@ -0,0 +1,12 @@
+init();
+$objPage->process();
+?>
\ No newline at end of file
Index: html/user_data/plugins/google_analytics/index.php
===================================================================
--- html/user_data/plugins/google_analytics/index.php (リビジョン 0)
+++ html/user_data/plugins/google_analytics/index.php (リビジョン 0)
@@ -0,0 +1,34 @@
+init();
+$objPage->process();
+?>
\ No newline at end of file
Index: html/install/sql/insert_data.sql
===================================================================
--- html/install/sql/insert_data.sql (リビジョン 18218)
+++ html/install/sql/insert_data.sql (作業コピー)
@@ -1114,5 +1114,8 @@
INSERT INTO mtb_constants VALUES ('OSTORE_E_C_BATCH_ERR', '"2010"', 522, 'オーナーズストア通信エラーコード');
INSERT INTO mtb_constants VALUES ('OPTION_FAVOFITE_PRODUCT', '1', 523, 'お気に入り商品登録(有効:1 無効:0)');
INSERT INTO mtb_constants VALUES ('IMAGE_RENAME', 'true', 525, '画像リネーム設定(商品画像のみ)(true:リネームする、false:リネームしない)');
+INSERT INTO mtb_constants VALUES ('PLUGIN_DIR', '"plugins/"', 600, 'プラグインディレクトリ');
+INSERT INTO mtb_constants VALUES ('PLUGIN_PATH', 'USER_PATH . PLUGIN_DIR', 601, 'プラグイン保存先');
+INSERT INTO mtb_constants VALUES ('PLUGIN_URL', 'USER_URL . PLUGIN_DIR', 602, 'プラグイン URL');
INSERT INTO dtb_module (module_id,module_code,module_name,update_date,create_date) VALUES (0,0,'patch',now(),now());
Index: data/Smarty/templates/default/admin/main_frame.tpl
===================================================================
--- data/Smarty/templates/default/admin/main_frame.tpl (リビジョン 18218)
+++ data/Smarty/templates/default/admin/main_frame.tpl (作業コピー)
@@ -112,6 +112,10 @@
on">
OWNERS STORE
+ on">
+
+ プラグイン設定
+
Index: data/require_plugin.php
===================================================================
--- data/require_plugin.php (リビジョン 18218)
+++ data/require_plugin.php (作業コピー)
@@ -1,5 +1,39 @@
plugin as $plugin) {
+
+ $requireFile = USER_PATH . "plugins/" . $plugin->path . "/require.php";
+ if (file_exists($requireFile)) {
+ require_once($requireFile);
+ }
+ }
+}
?>
Index: data/mtb_constants_init.php
===================================================================
--- data/mtb_constants_init.php (リビジョン 18218)
+++ data/mtb_constants_init.php (作業コピー)
@@ -670,4 +670,10 @@
define('OPTION_FAVOFITE_PRODUCT','1');
/** 画像リネーム設定(商品画像のみ) */
define('IMAGE_RENAME', true);
+/** プラグインディレクトリ */
+define("PLUGIN_DIR", "plugins/");
+/** プラグイン保存先 */
+define("PLUGIN_PATH", USER_PATH . PLUGIN_DIR);
+/** プラグイン URL */
+define("PLUGIN_URL", USER_URL . PLUGIN_DIR);
?>
Index: data/class/pages/LC_Page.php
===================================================================
--- data/class/pages/LC_Page.php (リビジョン 18218)
+++ data/class/pages/LC_Page.php (作業コピー)
@@ -82,6 +82,9 @@
*/
function init() {
$this->tpl_authority = $_SESSION['authority'];
+ // XXX すべてのページで宣言するべき
+ $layout = new SC_Helper_PageLayout_Ex();
+ $layout->sfGetPageLayout($this, false);
}
/**
Index: data/class/helper/SC_Helper_PageLayout.php
===================================================================
--- data/class/helper/SC_Helper_PageLayout.php (リビジョン 18218)
+++ data/class/helper/SC_Helper_PageLayout.php (作業コピー)
@@ -61,9 +61,11 @@
$objPage->tpl_mainpage = USER_PATH . "templates/preview/"
. TEMPLATE_NAME . "/" . $arrPageData[0]['filename'] . ".tpl";
}
-
- foreach($arrPageData[0] as $key => $val) {
- $debug_message.= "arrPageData[$key]:" . $val . "\n";
+
+ if (!empty($arrPageData[0])) {
+ foreach($arrPageData[0] as $key => $val) {
+ $debug_message.= "arrPageData[$key]:" . $val . "\n";
+ }
}
$debug_message.= "TEMPLATE_NAME:".TEMPLATE_NAME . "\n";