source:
branches/comu-ver2/patches/GoogleAnalytics_plugin.patch
@
18225
Revision 18225, 21.2 KB checked in by nanasess, 15 years ago (diff) |
---|
-
html/user_data/plugins/plugin_menu.tpl
1 <ul id="navi-plugin-menu" class="level1"> 2 </ul> 3 <script type="text/javascript"> 4 //<![CDATA[ 5 $(function(){ 6 $.ajax({ 7 url: '<!--{$smarty.const.PLUGIN_URL}-->plugins.xml', 8 type: 'GET', 9 dataType: 'xml', 10 timeout: 2000, 11 error: function(){ 12 alert("xmlファイルの読み込みに失敗しました"); 13 }, 14 success: function(xml){ 15 $(xml).find("plugin").each(function(){ 16 var item_text = $(this).find("name").text(); 17 var item_path = $(this).find("path").text(); 18 19 $("<li id='navi-plugin-index'></li>") 20 .html("<a href='javascript:;'><span>" + item_text + "</span></a>") 21 .appendTo('ul#navi-plugin-menu') 22 .click(function() { 23 win03('<!--{$smarty.const.PLUGIN_URL}-->' + item_path 24 + '/index.php', 'plugins', '800','600'); 25 return false; 26 }); 27 }); 28 $("li.plugin_menu").html(""); 29 } 30 }); 31 }); 32 //]]> 33 </script> -
html/user_data/plugins/plugins.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 <plugins> 3 <plugin> 4 <name>Google Analytics</name> 5 <path>google_analytics</path> 6 </plugin> 7 </plugins> -
html/user_data/plugins/google_analytics/sql/delete.sql
1 DELETE FROM dtb_bloc WHERE filename = 'google_analytics'; 2 DELETE FROM dtb_blocposition WHERE filename = 'google_analytics'; 3 No newline at end of file -
html/user_data/plugins/google_analytics/sql/insert.sql
1 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); 2 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); 3 No newline at end of file -
html/user_data/plugins/google_analytics/tpl/ga.tpl
1 <script type="text/javascript"> 2 var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); 3 document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); 4 </script> 5 <script type="text/javascript"> 6 try { 7 var pageTracker = _gat._getTracker("UA-<!--{$smarty.const.GA_UA}-->"); 8 pageTracker._trackPageview(); 9 } catch(err) {}</script> -
html/user_data/plugins/google_analytics/tpl/index.tpl
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> 3 4 <head> 5 <meta http-equiv="content-type" content="application/xhtml+xml; charset=<!--{$smarty.const.CHAR_CODE}-->" /> 6 <meta http-equiv="content-script-type" content="text/javascript" /> 7 <meta http-equiv="content-style-type" content="text/css" /> 8 <link rel="stylesheet" href="<!--{$TPL_DIR}-->css/admin_contents.css" type="text/css" media="all" /> 9 <script type="text/javascript" src="<!--{$TPL_DIR}-->js/css.js"></script> 10 <script type="text/javascript" src="<!--{$TPL_DIR}-->js/navi.js"></script> 11 <script type="text/javascript" src="<!--{$TPL_DIR}-->js/win_op.js"></script> 12 <script type="text/javascript" src="<!--{$TPL_DIR}-->js/site.js"></script> 13 <script type="text/javascript" src="<!--{$TPL_DIR}-->js/jquery.js"></script> 14 <script type="text/javascript" src="<!--{$TPL_DIR}-->js/admin.js"></script> 15 <title><!--{$tpl_subtitle}--></title> 16 <script type="text/javascript"> 17 18 </script> 19 <style type="text/css"> 20 @charset "UTF-8"; 21 </style> 22 </head> 23 24 <body onload="<!--{$tpl_onload}-->" class="authority_0" style="min_width: 400px"> 25 <noscript> 26 <p>JavaScript を有効にしてご利用下さい.</p> 27 </noscript> 28 29 <div id="container"> 30 <a name="top"></a> 31 <!--▼CONTENTS--> 32 <h1>Google Analytics Plugin</h1> 33 <div id="contents" class="clear-block"> 34 <form method="post" action="index.php"> 35 <div id="system" class="contents-main"> 36 <table class="list"> 37 <tr> 38 <th>ウェブ プロパティ ID</th> 39 <td>UA-<input type="text" name="ga_ua" value="<!--{$smarty.const.GA_UA}-->" /></td> 40 </tr> 41 </table> 42 <div class="btn addnew"> 43 <input type="hidden" name="mode" value="register" /> 44 <button type="submit"><span>この内容で登録する</span></button> 45 </div> 46 </div> 47 </form> 48 </div> 49 <!--▲CONTENTS--> 50 </div> 51 </body> 52 </html> -
html/user_data/plugins/google_analytics/require.php
1 <?php 2 /* 3 * EC-CUBE 本体で, このプラグインの関数を使用したい場合は, ここで require する 4 */ 5 require_once(PLUGIN_PATH . "google_analytics/classes/pages/ga_config.php"); 6 ?> 7 No newline at end of file -
html/user_data/plugins/google_analytics/classes/pages/ga_config.php
1 <?php 2 define('GA_UA', ''); 3 ?> -
html/user_data/plugins/google_analytics/classes/pages/LC_Page_FrontParts_Bloc_GoogleAnalytics.php
1 <?php 2 /* 3 * This file is part of EC-CUBE 4 * 5 * Copyright(c) 2000-2009 LOCKON CO.,LTD. All Rights Reserved. 6 * 7 * http://www.lockon.co.jp/ 8 * 9 * This program is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU General Public License 11 * as published by the Free Software Foundation; either version 2 12 * of the License, or (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 */ 23 24 // {{{ requires 25 require_once CLASS_PATH . "pages/LC_Page.php"; 26 27 /** 28 * Google Analytics プラグインを制御するクラス. 29 * 30 * @package Page 31 * @author Kentaro Ohkouchi 32 * @version $Id$ 33 */ 34 class LC_Page_FrontParts_Bloc_GoogleAnalytics extends LC_Page { 35 36 // }}} 37 // {{{ functions 38 39 /** 40 * Page を初期化する. 41 * 42 * @return void 43 */ 44 function init() { 45 parent::init(); 46 $this->tpl_mainpage = USER_PATH . 'plugins/google_analytics/tpl/ga.tpl'; 47 $this->tpl_subtitle = "Google Analytics Plugin"; 48 } 49 50 /** 51 * Page のプロセス. 52 * 53 * @return void 54 */ 55 function process() { 56 $objView = new SC_SiteView(); 57 $objView->assignobj($this); 58 $objView->display($this->tpl_mainpage); 59 } 60 61 /** 62 * デストラクタ. 63 * 64 * @return void 65 */ 66 function destroy() { 67 parent::destroy(); 68 } 69 } 70 ?> 71 No newline at end of file -
html/user_data/plugins/google_analytics/classes/pages/LC_Page_Admin_GoogleAnalytics.php
1 <?php 2 /* 3 * This file is part of EC-CUBE 4 * 5 * Copyright(c) 2000-2009 LOCKON CO.,LTD. All Rights Reserved. 6 * 7 * http://www.lockon.co.jp/ 8 * 9 * This program is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU General Public License 11 * as published by the Free Software Foundation; either version 2 12 * of the License, or (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 */ 23 24 // {{{ requires 25 require_once CLASS_PATH . "pages/LC_Page.php"; 26 27 /** 28 * Google Analytics プラグインの管理画面を制御するクラス. 29 * 30 * @package Page 31 * @author Kentaro Ohkouchi 32 * @version $Id$ 33 */ 34 class LC_Page_Admin_GoogleAnalytics extends LC_Page { 35 36 // }}} 37 // {{{ functions 38 39 /** 40 * Page を初期化する. 41 * 42 * @return void 43 */ 44 function init() { 45 parent::init(); 46 $this->tpl_mainpage = PLUGIN_PATH . 'google_analytics/tpl/index.tpl'; 47 $this->tpl_subtitle = "Google Analytics Plugin"; 48 49 if (empty($_POST["mode"])) { 50 $_POST["mode"] = ""; 51 } 52 53 if (empty($_GET["mode"])) { 54 $_GET["mode"] = ""; 55 } 56 } 57 58 /** 59 * Page のプロセス. 60 * 61 * POST パラメータ "mode" が register の場合は登録処理を行う. 62 * 登録処理の後, 自ページをリロードし, GET パラメータ "mode" を付与する. 63 * 登録に成功し, GET パラメータ "mode" の値が success の場合は 64 * 「登録に成功しました」というメッセージをポップアップで表示する. 65 * 登録に失敗し, GET パラメータ "mode" の値が failure の場合は 66 * 「登録に失敗しました」というメッセージをポップアップで表示する. 67 * 68 * @return void 69 */ 70 function process() { 71 // 認証可否の判定 72 SC_Utils_Ex::sfIsSuccess(new SC_Session()); 73 74 switch ($_POST["mode"]) { 75 case "register": 76 if ($this->register($_POST['ga_ua'])) { 77 $this->reload(array("mode" => "success")); 78 exit; 79 } else { 80 $this->reload(array("mode" => "failure")); 81 exit; 82 } 83 break; 84 85 default: 86 } 87 88 switch ($_GET["mode"]) { 89 case "success": 90 $this->tpl_onload .= "window.alert('登録に成功しました。');"; 91 break; 92 93 case "failure": 94 $this->tpl_onload .= "window.alert('登録に失敗しました。');"; 95 break; 96 97 default: 98 } 99 100 $objView = new SC_AdminView(); 101 $objView->assignobj($this); 102 $objView->display($this->tpl_mainpage); 103 } 104 105 /** 106 * UA の登録を行う. 107 * 108 * classes/pages/ga_config.php を読み込み, ウェブプロパティID の文字列 109 * を定数として書き出す. 110 * 111 * @param string ウェブプロパティID の文字列 112 * @return boolean 登録に成功した場合 true; 失敗した場合 false; 113 */ 114 function register($ua) { 115 $data = "<?php\ndefine('GA_UA', '" 116 . htmlspecialchars($ua, ENT_QUOTES) . "');\n?>\n"; 117 118 $configFile = PLUGIN_PATH . "google_analytics/classes/pages/ga_config.php"; 119 $handle = fopen($configFile, "w"); 120 if (!$handle) { 121 return false; 122 } 123 // ファイルの内容を書き出す. 124 if (fwrite($handle, $data) === false) { 125 return false; 126 } 127 return true; 128 } 129 130 /** 131 * デストラクタ. 132 * 133 * @return void 134 */ 135 function destroy() { 136 parent::destroy(); 137 } 138 } 139 ?> 140 No newline at end of file -
html/user_data/plugins/google_analytics/ga.php
1 <?php 2 // {{{ requires 3 require_once(PLUGIN_PATH . "google_analytics/classes/pages/LC_Page_FrontParts_Bloc_GoogleAnalytics.php"); 4 5 // }}} 6 // {{{ generate page 7 8 $objPage = new LC_Page_FrontParts_Bloc_GoogleAnalytics(); 9 register_shutdown_function(array($objPage, "destroy")); 10 $objPage->init(); 11 $objPage->process(); 12 ?> 13 No newline at end of file -
html/user_data/plugins/google_analytics/index.php
1 <?php 2 /* 3 * This file is part of EC-CUBE 4 * 5 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. 6 * 7 * http://www.lockon.co.jp/ 8 * 9 * This program is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU General Public License 11 * as published by the Free Software Foundation; either version 2 12 * of the License, or (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 */ 23 // {{{ requires 24 require_once("../../../admin/require.php"); 25 require_once(USER_PATH . 'plugins/google_analytics/classes/pages/LC_Page_Admin_GoogleAnalytics.php'); 26 27 // }}} 28 // {{{ generate page 29 30 $objPage = new LC_Page_Admin_GoogleAnalytics(); 31 register_shutdown_function(array($objPage, 'destroy')); 32 $objPage->init(); 33 $objPage->process(); 34 ?> 35 No newline at end of file -
html/install/sql/insert_data.sql
1114 1114 INSERT INTO mtb_constants VALUES ('OSTORE_E_C_BATCH_ERR', '"2010"', 522, 'オーナーズストア通信エラーコード'); 1115 1115 INSERT INTO mtb_constants VALUES ('OPTION_FAVOFITE_PRODUCT', '1', 523, 'お気に入り商品登録(有効:1 無効:0)'); 1116 1116 INSERT INTO mtb_constants VALUES ('IMAGE_RENAME', 'true', 525, '画像リネーム設定(商品画像のみ)(true:リネームする、false:リネームしない)'); 1117 INSERT INTO mtb_constants VALUES ('PLUGIN_DIR', '"plugins/"', 600, 'プラグインディレクトリ'); 1118 INSERT INTO mtb_constants VALUES ('PLUGIN_PATH', 'USER_PATH . PLUGIN_DIR', 601, 'プラグイン保存先'); 1119 INSERT INTO mtb_constants VALUES ('PLUGIN_URL', 'USER_URL . PLUGIN_DIR', 602, 'プラグイン URL'); 1117 1120 1118 1121 INSERT INTO dtb_module (module_id,module_code,module_name,update_date,create_date) VALUES (0,0,'patch',now(),now()); -
data/Smarty/templates/default/admin/main_frame.tpl
112 112 <li id="navi-ownersstore" class="<!--{if $tpl_mainno eq "ownersstore"}-->on<!--{/if}-->"> 113 113 <a><span>OWNERS STORE</span></a> 114 114 <!--{include file="`$smarty.const.TEMPLATE_ADMIN_DIR`ownersstore/subnavi.tpl"}--> 115 <li id="navi-plugin" class="<!--{if $tpl_mainno eq "plugin"}-->on<!--{/if}-->"> 116 </li> 117 <a><span>プラグイン設定</span></a> 118 <!--{include file="`$smarty.const.PLUGIN_PATH`plugin_menu.tpl"}--> 115 119 </li> 116 120 </ul> 117 121 <div style="clear: both;"></div> -
data/require_plugin.php
1 1 <?php 2 /* 3 * プラグインを require するためのファイル 4 */ 2 /* 3 * This file is part of EC-CUBE 4 * 5 * Copyright(c) 2000-2009 LOCKON CO.,LTD. All Rights Reserved. 6 * 7 * http://www.lockon.co.jp/ 8 * 9 * This program is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU General Public License 11 * as published by the Free Software Foundation; either version 2 12 * of the License, or (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 */ 23 24 // load plugins 25 /* ----------------------------------------------------------------------------- 26 * TODO PHP4 でも使えるように, XML パーサーをファクトリークラスで実装する 27 * ----------------------------------------------------------------------------*/ 28 if (version_compare("5", PHP_VERSION, "<")) { 29 $plugins = file_get_contents(USER_PATH . "plugins/plugins.xml"); 30 $xml = new SimpleXMLElement($plugins); 31 foreach ($xml->plugin as $plugin) { 32 33 $requireFile = USER_PATH . "plugins/" . $plugin->path . "/require.php"; 34 if (file_exists($requireFile)) { 35 require_once($requireFile); 36 } 37 } 38 } 5 39 ?> -
data/mtb_constants_init.php
670 670 define('OPTION_FAVOFITE_PRODUCT','1'); 671 671 /** 画像リネーム設定(商品画像のみ) */ 672 672 define('IMAGE_RENAME', true); 673 /** プラグインディレクトリ */ 674 define("PLUGIN_DIR", "plugins/"); 675 /** プラグイン保存先 */ 676 define("PLUGIN_PATH", USER_PATH . PLUGIN_DIR); 677 /** プラグイン URL */ 678 define("PLUGIN_URL", USER_URL . PLUGIN_DIR); 673 679 ?> -
data/class/pages/LC_Page.php
82 82 */ 83 83 function init() { 84 84 $this->tpl_authority = $_SESSION['authority']; 85 // XXX すべてのページで宣言するべき 86 $layout = new SC_Helper_PageLayout_Ex(); 87 $layout->sfGetPageLayout($this, false); 85 88 } 86 89 87 90 /** -
data/class/helper/SC_Helper_PageLayout.php
61 61 $objPage->tpl_mainpage = USER_PATH . "templates/preview/" 62 62 . TEMPLATE_NAME . "/" . $arrPageData[0]['filename'] . ".tpl"; 63 63 } 64 65 foreach($arrPageData[0] as $key => $val) { 66 $debug_message.= "arrPageData[$key]:" . $val . "\n"; 64 65 if (!empty($arrPageData[0])) { 66 foreach($arrPageData[0] as $key => $val) { 67 $debug_message.= "arrPageData[$key]:" . $val . "\n"; 68 } 67 69 } 68 70 69 71 $debug_message.= "TEMPLATE_NAME:".TEMPLATE_NAME . "\n";
Note: See TracBrowser
for help on using the repository browser.