OSDN Git Service

c7c1d8bd6a1b483e177e52c45b4c58b25179daaf
[magic3/magic3.git] / include / manager / envManager.php
1 <?php
2 /**
3  * 環境取得用マネージャー
4  *
5  * PHP versions 5
6  *
7  * LICENSE: This source file is licensed under the terms of the GNU General Public License.
8  *
9  * @package    Magic3 Framework
10  * @author     平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
11  * @copyright  Copyright 2006-2018 Magic3 Project.
12  * @license    http://www.gnu.org/copyleft/gpl.html  GPL License
13  * @version    SVN: $Id$
14  * @link       http://www.magic3.org
15  */
16 require_once(M3_SYSTEM_INCLUDE_PATH . '/common/version.php');   // システムバージョンクラス
17 require_once(M3_SYSTEM_INCLUDE_PATH . '/common/userInfo.php');          // ユーザ情報クラス
18 require_once(M3_SYSTEM_INCLUDE_PATH . '/common/core.php');
19
20 class EnvManager extends Core
21 {
22         public  $sysVersion;            // システムバージョンオブジェクト
23         private $currentTemplateId;     // 現在のテンプレートID(ディレクトリ名)
24         private $currentSubTemplateId;  // 現在のサブテンプレートID
25         private $currentTemplateType;   // 現在のテンプレートのタイプ
26         private $currentTemplateGenerator;              // テンプレート作成アプリケーション
27         private $currentTemplateVersion;                // テンプレートバージョン
28         private $currentTemplateCleanType;      // 現在のテンプレートのクリーンタイプ
29         private $currentTemplateUseBootstrap;   // 現在のテンプレートでBootstrapライブラリを使用するかどうか
30         private $currentTemplateInfoRow;                // 現在のテンプレートの情報
31         private $currentRenderType;             // 現在のビュー作成タイプ
32         private $currentWidgetObj;              // 現在実行中のウィジェットオブジェクト
33         private $currentWidgetId;       // 現在作成中のウィジェットId
34         private $currentWidgetConfigId; // 現在作成中のウィジェットの定義ID
35         private $currentIWidgetConfigId;        // 現在作成中のインナーウィジェットの定義ID
36         private $currentIWidgetId;      // 現在作成中のインナーウィジェットId
37         private $currentPageId;         // 現在のページId
38         private $currentPageSubId;      // 現在のページサブId
39         private $currentPageDefSerial;  // 現在処理を行っているページ定義のレコードのシリアル番号
40         private $currentPageDefRec;             // 現在処理中のウィジェットのページ定義レコード
41         private $defaultPageSubId;      // デフォルトのページサブId
42         private $currentPageDeviceType;         // 現在のページの端末タイプ
43         private $currentWidgetHeadTitle;                // 現在作成中のウィジェットのヘッドタイトル文字列
44         private $currentWidgetPrefix;   // 現在作成中のウィジェットのプレフィックス文字列
45         private $currentWidgetTitle;    // 現在作成中のウィジェットのタイトル文字列
46         private $currentWidgetStyle;    // 現在作成中のウィジェットのスタイル文字列
47         private $currentWidgetJoomlaParam;      // 現在作成中のウィジェットのJoomla用パラメータ
48         private $currentWidgetParams = array();         // 現在作成中のウィジェットのその他パラメータ
49         private $isCurrentWidgetShared; // 現在作成中のウィジェットが共通ウィジェットかどうか
50         private $currentDomainRootUrl;  // マルチドメイン運用時の現在のルートURL
51         private $protocolRelativeRootUrl;       // プロトコル省略型のルートURL
52         private $defaultLanguage;       // デフォルト言語(システムで固定)
53         private $currentLanguage;       // 現在の言語(ユーザによって可変)
54         private $defaultLocale;         // デフォルトのロケール
55         private $currentLocale;         // 現在のロケール(ユーザによって可変)
56         private $multiLanguage;         // 多言語対応かどうか
57         private $adminDefaultTheme;     // 管理画面のデフォルトテーマ
58         private $accessPath;            // アクセスポイントパス
59         private $accessDir;                     // アクセスポイントディレクトリ(空文字列=PC用、s=スマートフォン用、m=携帯用)
60         private $db;                            // DBオブジェクト
61         private $canUseDbSession;       // DBセッションが使用できるかどうか
62         private $canUseDb;                      // DBが使用可能状態にあるかどうか
63         private $canUseCookie;          // クッキーが使用可能かどうか
64         private $mobileUseSession;      // 携帯でセッション管理を使用するかどうか
65         private $canChangeLang;         // 言語変更可能かどうか
66         private $useSsl;                        // SSL機能を使用するかどうか
67         private $useSslAdmin;           // 管理画面にSSL機能を使用するかどうか
68         private $sslUrl;                        // SSL用URL
69         private $siteName;                      // サイト名称
70         private $siteOwner;                     // サイト所有者
71         private $siteCopyRight;         // サイトコピーライト
72         private $siteEmail;                     // サイトEメール
73         private $widgetLog;                     // ウィジェット実行ログを残すかどうか
74         private $multiDomain;           // マルチドメイン運用かどうか
75         private $isPcSite;                      // PC用URLアクセスかどうか
76         private $isMobileSite;          // 携帯用URLアクセスかどうか
77         private $isSmartphoneSite;      // スマートフォン用URLへのアクセスかどうか
78         private $isSubWidget;           // サブウィジェットの起動かどうか
79         private $isServerConnector;     // サーバ接続かどうか
80         private $mobileEncoding;        // 携帯用の入力、出力エンコーディング
81         private $workDir;                       // 作業用ディレクトリ
82         private $userAgent = array();   // アクセス端末の情報
83         private $menuAttr = array();            // メニューの表示属性
84         private $joomlaDocument;                // Joomla!ドキュメント
85         private $joomlaMenuContent;             // Joomla!v1.5用メニューコンテンツ
86         private $joomlaMenuData;                // Joomla!v2.5用メニュー階層データ
87         private $joomlaPageNavData;             // Joomla!v2.5用ページ前後遷移データ
88         private $joomlaPaginationData;  // Joomla!v2.5用ページ番号遷移データ
89         private $joomlaViewData;                // Joomla!ビュー作成用データ
90         private $wpHeadScriptsData;             // WordPressヘッダ部出力データ(Javascript)
91         private $wpComponentPath;               // WordPressコンポーネント生成ファイルパス
92         private $wpWidgetClass;                 // WordPressウィジェットクラス名
93         private $remoteContent = array();                       // リモート表示コンテンツ
94         private $defaultLacaleArray;    // デフォルトのロケール取得用
95         private $selectedMenuItems = array();                           // 現在選択中のメニュー項目
96         const DEFAULT_LOCALE = 'ja_JP';                 // デフォルトロケール
97         const DEFAULT_CSV_DELIM_CODE = 'csv_delim_code';                // デフォルトのCSV区切り文字コード
98         const DEFAULT_CSV_NL_CODE = 'csv_nl_code';              // デフォルトのCSV改行コード
99         const DEFAULT_CSV_FILE_SUFFIX = 'csv_file_suffix';              // デフォルトのCSVファイル拡張子
100         const MULTI_LANGUAGE = 'multi_language';                // 多言語対応かどうか
101         const MOBILE_ENCODING = 'mobile_encoding';              // 携帯用入出力エンコーディング
102         const MOBILE_CHARSET = 'mobile_charset';                // 携帯用HTML上のエンコーディング表記
103         const DEFAULT_THEME_CSS_FILE = 'jquery-ui.custom.css';          // テーマファイル
104         const CONFIG_ID_WORK_DIR = 'work_dir';                  // 作業用ディレクトリ
105         const DEFAULT_PAGE_ID = 'index';                                        // デフォルトのページID
106         const DEFAULT_REGIST_PAGE_ID = 'regist';                // デフォルトの登録機能用ページID
107         const DEFAULT_MOBILE_PAGE_ID = 'm_index';                                       // 携帯用デフォルトのページID
108         const DEFAULT_SMARTPHONE_PAGE_ID = 's_index';                           // スマートフォン用デフォルトのページID
109         const DEFAULT_ADMIN_PAGE_ID = 'admin_index';            // デフォルトの管理機能用ページID
110         const USER_AGENT_TYPE_PC = 'pc';                                        // アクセス端末の種類(PC)
111         const USER_AGENT_TYPE_MOBILE = 'mobile';                        // アクセス端末の種類(携帯)
112         const CF_CSV_DOWNLOAD_ENCODING = 'csv_download_encoding';                       // CSVダウンロードエンコーディング
113         const CF_CSV_UPLOAD_ENCODING = 'csv_upload_encoding';                   // CSVアップロードエンコーディング
114         const CF_MOBILE_USE_SESSION = 'mobile_use_session';             // 携帯でセッション管理を行うかどうか
115         const CF_USE_SSL = 'use_ssl';           // SSL機能を使用するかどうか
116         const CF_USE_SSL_ADMIN = 'use_ssl_admin';               // 管理画面にSSL機能を使用するかどうか
117         const CF_SSL_URL = 'ssl_root_url';                              // SSL用のルートURL
118         const CF_DEFAULT_LANG = 'default_lang';                 // デフォルト言語
119         const CF_MULTI_DOMAIN = 'multi_domain';                 // マルチドメイン運用かどうか
120         const CF_SITE_SMARTPHONE_URL = 'site_smartphone_url';           // スマートフォン用サイトURL
121         const CF_SITE_MOBILE_URL = 'site_mobile_url';           // 携帯用サイトURL
122         const CF_REALTIME_SERVER_PORT = 'realtime_server_port';         // リアルタイムサーバ用ポート番号
123         const CF_MULTI_DEVICE_ADMIN = 'multi_device_admin';                     // マルチデバイス最適化管理画面
124         const DEFAULT_SITE_NAME = 'サイト名未設定';              // 管理画面用のデフォルトサイト名
125         const DETECT_DEVICE_SCRIPT = '/Mobile-Detect-2.8.26/Mobile_Detect.php';         // デバイス判定用スクリプト
126         
127         /**
128          * コンストラクタ
129          */
130         function __construct()
131         {
132                 // 親クラスを呼び出す
133                 parent::__construct();
134                 
135                 // パラメータエラーチェック
136                 if (strEndsWith(M3_SYSTEM_ROOT_URL, '/')){
137                         $errMsg = '設定の不正: M3_SYSTEM_ROOT_URLの値の最後の「/」を削除してください。ファイル=include/siteDef.php';
138                         $this->gLog->error(__METHOD__, $errMsg);
139                 }
140                         
141                 // データ初期化
142                 $this->accessPath = '';         // アクセスポイントパス
143                 $this->accessDir = '';          // アクセスポイントディレクトリ
144                 $this->defaultLacaleArray = array('ja'          => 'ja_JP',
145                                                                                         'en'    => 'en_US');    // デフォルトのロケール取得用
146                 $this->currentWidgetId = '';    // 現在作成中のウィジェットId
147
148                 // デフォルトの作業用ディレクトリ取得
149                 if (function_exists('sys_get_temp_dir')){               // PHP 5.2.1以上
150                         $this->workDir = sys_get_temp_dir();
151                 } else {
152                 $this->workDir = getenv('TMP');
153                         if (empty($this->workDir)) $this->workDir = getenv('TEMP');
154                         if (empty($this->workDir)) $this->workDir = getenv('TMPDIR');
155                         if (empty($this->workDir)){
156                                 $temp = tempnam(__FILE__, '');
157                                 if (file_exists($temp)){
158                                         unlink($temp);
159                                         $this->workDir = dirname($temp);
160                                 }
161                         }
162                 }
163                 $this->workDir = rtrim($this->workDir, DIRECTORY_SEPARATOR);            // 最後の「/」「\」を除く
164                 if (!file_exists($this->workDir)) $this->workDir = M3_SYSTEM_WORK_DIR_PATH;// 作業用ディレクトリデフォルト値
165                 
166                 // システムバージョンオブジェクト作成
167                 $this->sysVersion = new m3Version();
168                 
169                 // システムDBオブジェクト取得
170                 $this->db = $this->gInstance->getSytemDbObject();
171                 
172                 // ######## DBの接続チェック ########
173                 if (defined('M3_STATE_IN_INSTALL')){            // システムがインストールモードで起動のとき
174                         $this->canUseDb = false;                        // DBは使用できない
175                 } else {
176                         // システム名称、バージョンを取得
177                         $status = $this->db->getDisplayErrMessage();    // 出力状態を取得
178                         $this->db->displayErrMessage(false);            // 画面へのエラー出力を抑止
179                         //$value = $this->db->getSystemConfig(M3_TB_FIELD_SYSTEM_NAME);
180                         $ret = $this->gSystem->_loadSystemConfig();
181                         $this->db->displayErrMessage($status);          // 抑止解除
182                         // 値が取得できたときは、セッションDBテーブルも作成されているとする
183                         /*if ($value == ''){
184                                 $this->canUseDbSession = false;
185                                 $this->canUseDb = false;                        // DBは使用できない
186                         } else {
187                                 $this->canUseDbSession = true;
188                                 $this->canUseDb = true;                 // DBは使用可能
189                                 
190                                 // システム関係のパラメータを取得
191                                 $this->loadSystemParams();
192                         }*/
193                         if ($ret){
194                                 $this->canUseDbSession = true;
195                                 $this->canUseDb = true;                 // DBは使用可能
196                                 
197                                 // システム関係のパラメータを取得
198                                 $this->loadSystemParams(false);         // DBから再取得しない
199                         } else {
200                                 $this->canUseDbSession = false;
201                                 $this->canUseDb = false;                        // DBは使用できない
202                         }
203                 }
204                 // 日本語処理関係
205                 if (extension_loaded('mbstring')){      // mbstring使用可能
206                         if (version_compare(PHP_VERSION, '5.6.0') < 0){
207                                 ini_set('mbstring.http_input',                  'pass');
208                                 ini_set('mbstring.http_output',                 'pass');
209                         }
210                         ini_set('mbstring.encoding_translation',        'Off');         // ここでは設定を変更できない?
211                         ini_set('mbstring.substitute_character',                'none');        // 無効な文字の代替出力
212                         ini_set('mbstring.func_overload',               '0');
213                         
214                         if (function_exists('mb_language')) mb_language("Japanese");
215                         if (function_exists('mb_internal_encoding')) mb_internal_encoding("UTF-8");
216                 }
217                 // 現在のルートURL初期化。外部アクセスのときはこのURLを使用。
218                 $this->currentDomainRootUrl = M3_SYSTEM_ROOT_URL;
219                 
220                 // プロトコル省略型のルートURL
221                 $this->protocolRelativeRootUrl = preg_replace('(^https?:)', '', M3_SYSTEM_ROOT_URL);
222         }
223         /**
224          * システム関係のパラメータを再取得
225          *
226          * @param bool $reloadFromDb            DBから再取得するかどうか
227          * @return                                                      なし
228          */
229         public function loadSystemParams($reloadFromDb = true)
230         {
231                 if ($reloadFromDb) $this->gSystem->_loadSystemConfig();
232                 
233                 // デフォルト値取得
234                 $this->defaultLanguage = $this->gSystem->getSystemConfig(self::CF_DEFAULT_LANG);// デフォルト言語
235                 $this->defaultLocale = $this->defaultLacaleArray[$this->defaultLanguage];               // デフォルトのロケール
236                 if (empty($this->defaultLocale)) $this->defaultLocale = self::DEFAULT_LOCALE;
237                 $this->currentLanguage = $this->defaultLanguage;
238                 $this->currentLocale = $this->defaultLocale;                    // 現在のロケール
239                 $this->canChangeLang = $this->gSystem->canChangeLang();// 言語変更可能かどうか
240                 $this->multiLanguage = $this->gSystem->getSystemConfig(self::MULTI_LANGUAGE);           // 多言語対応かどうか
241                 $this->multiDomain      = $this->gSystem->getSystemConfig(self::CF_MULTI_DOMAIN);               // マルチドメイン運用かどうか
242                 
243                 $this->adminDefaultTheme = $this->gSystem->adminDefaultTheme(); // 管理画面のデフォルトテーマ
244                 $this->useSsl = $this->gSystem->getSystemConfig(self::CF_USE_SSL);              // SSL機能を使用するかどうか
245                 $this->useSslAdmin = $this->gSystem->getSystemConfig(self::CF_USE_SSL_ADMIN);           // 管理画面にSSL機能を使用するかどうか
246                 $this->sslUrl = $this->gSystem->getSystemConfig(self::CF_SSL_URL);                      // SSL用URL
247                 $this->mobileEncoding = $this->gSystem->getSystemConfig(self::MOBILE_ENCODING); // 携帯用の入力、出力エンコーディング
248                 $this->mobileCharset = $this->gSystem->getSystemConfig(self::MOBILE_CHARSET);           // 携帯用HTML上のエンコーディング表記
249                 $this->mobileUseSession = $this->gSystem->getSystemConfig(self::CF_MOBILE_USE_SESSION); // 携帯でセッション管理を使用するかどうか
250                 $value = $this->gSystem->getSystemConfig(self::CONFIG_ID_WORK_DIR);// 作業用ディレクトリ
251                 if (!empty($value)) $this->workDir = $value;
252         }
253         /**
254          * マルチドメイン用設定初期化
255          *
256          * @return                                                      なし
257          */
258         public function initMultiDomain()
259         {
260                 // マルチドメイン運用の場合はルートURLを設定
261                 if ($this->multiDomain){
262                         $url = '';
263                         if ($this->isSmartphoneSite){
264                                 $url = $this->gSystem->getSystemConfig(self::CF_SITE_SMARTPHONE_URL);   // スマートフォン用サイトURL
265                         } else if ($this->isMobileSite){
266                                 $url = $this->gSystem->getSystemConfig(self::CF_SITE_MOBILE_URL);               // 携帯用サイトURL
267                         }
268                         if (!empty($url)) $this->currentDomainRootUrl = $url;
269                 }
270         }
271         /**
272          * デバッグ出力を行うかどうか
273          */
274         public function getSystemDebugOut()
275         {
276                 return M3_SYSTEM_DEBUG_OUT;
277         }
278
279         // ##################### システム全体のパス環境 #####################
280         /**
281          * システムルートディレクトリへのパスを取得
282          *
283          * @return string                       パス
284          */
285         public function getSystemRootPath()
286         {
287                 return M3_SYSTEM_ROOT_PATH;
288         }
289         /**
290          * 管理用ディレクトリへのパスを取得
291          *
292          * @return string                       パス
293          */
294         public function getAdminPath()
295         {
296                 return M3_SYSTEM_ROOT_PATH . DIRECTORY_SEPARATOR . M3_DIR_NAME_ADMIN;
297         }
298         /**
299          * includeディレクトリへのパスを取得
300          *
301          * @return string                       パス
302          */
303         public function getIncludePath()
304         {
305                 return M3_SYSTEM_INCLUDE_PATH;
306         }
307         /**
308          * インナーウィジェット用ディレクトリへのパスを取得
309          */
310 /*      public function getIWidgetsPath()
311         {
312                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'iwidgets';
313         }*/
314         /**
315          * addonsディレクトリへのパスを取得
316          *
317          * @return string                       パス
318          */
319         public function getAddonsPath()
320         {
321                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'addons';
322         }
323         /**
324          * cronjobsディレクトリへのパスを取得
325          *
326          * @return string                       パス
327          */
328         public function getCronjobsPath()
329         {
330                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'cronjobs';
331         }
332         /**
333          * コンテナクラス用ディレクトリへのパスを取得
334          *
335          * @return string                       パス
336          */
337         public function getContainerPath()
338         {
339                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'container';
340         }
341         /**
342          * DBクラス用ディレクトリへのパスを取得
343          *
344          * @return string                       パス
345          */
346         public function getDbPath()
347         {
348                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'db';
349         }
350         /**
351          * ライブラリ用ディレクトリへのパスを取得
352          *
353          * @return string                       パス
354          */
355         public function getLibPath()
356         {
357                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'lib';
358         }
359         /**
360          * SQL格納用ディレクトリへのパスを取得
361          *
362          * @return string                       パス
363          */
364         public function getSqlPath()
365         {
366                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'sql';
367         }
368         /**
369          * テーブル作成用SQL格納用ディレクトリへのパスを取得
370          *
371          * @return string                       パス
372          */
373         public function getTablesPath()
374         {
375                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'tables';
376         }
377         /**
378          * Coreディレクトリへのパスを取得
379          *
380          * @return string                       パス
381          */
382         public function getCorePath()
383         {
384                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'core';
385         }
386         /**
387          * Commonディレクトリへのパスを取得
388          *
389          * @return string                       パス
390          */
391         public function getCommonPath()
392         {
393                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'common';
394         }
395         /**
396          * dataディレクトリへのパスを取得
397          *
398          * @return string                       パス
399          */
400         public function getDataPath()
401         {
402                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'data';
403         }
404         /**
405          * Joomla用ライブラリルートディレクトリへのパスを取得
406          *
407          * @return string                       パス
408          */
409         public function getJoomlaRootPath()
410         {
411                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'mos';
412         }
413         /**
414          * Wordpress用ライブラリルートディレクトリへのパスを取得
415          *
416          * @return string                       パス
417          */
418         public function getWordpressRootPath()
419         {
420                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'wp';
421         }
422         /**
423          * スクリプトファイルディレクトリへのパスを取得
424          *
425          * @return string                       パス
426          */
427         public function getScriptsPath()
428         {
429                 return M3_SYSTEM_ROOT_PATH . DIRECTORY_SEPARATOR . 'scripts';
430         }
431         /**
432          * テンプレート用ディレクトリへのパスを取得
433          *
434          * @return string                       パス
435          */
436         public function getTemplatesPath()
437         {
438                 return M3_SYSTEM_ROOT_PATH . DIRECTORY_SEPARATOR . 'templates';
439         }
440         /**
441          * リソース用ディレクトリへのパスを取得
442          *
443          * @return string                       パス
444          */
445         public function getResourcePath()
446         {
447                 return M3_SYSTEM_ROOT_PATH . DIRECTORY_SEPARATOR . 'resource';
448         }
449         /**
450          * ユーザの種別に対応したリソース用ディレクトリへのパスを取得(外部アプリケーション用)
451          *
452          * @return string               パス
453          */
454         public function getResourcePathForUser()
455         {
456                 $path = $this->getResourcePath();
457                 
458                 // ユーザのリソース制限が必要な場合は、ユーザごとのディレクトリを設定
459                 if ($this->isResourceLimitedUser()){
460                         $path .= '/' . M3_DIR_NAME_HOME . '/' . $this->getCurrentUserAccount();
461                 }
462                 return $path;
463         }
464         /**
465          * 非公開リソースディレクトリへのパスを取得
466          *
467          * @return string                       パス
468          */
469         public function getPrivateResourcePath()
470         {
471                 return M3_SYSTEM_INCLUDE_PATH . DIRECTORY_SEPARATOR . 'etc';
472         }
473         /**
474          * widgetsディレクトリへのパスを取得
475          *
476          * 例) /var/www/html/magic3/widgets
477          *
478          * @return string                       パス
479          */
480         public function getWidgetsPath()
481         {
482                 return M3_SYSTEM_ROOT_PATH . DIRECTORY_SEPARATOR . 'widgets';
483         }
484         /**
485          * ウィジェットのdbディレクトリへのパスを取得
486          *
487          * 例) /var/www/html/magic3/widgets/xxxxx/include/db
488          *
489          * @param string $widgetId                      ウィジェットID
490          * @return string                                       パス
491          */
492         public function getWidgetDbPath($widgetId)
493         {
494                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $widgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'db';
495         }
496         /**
497          * ウィジェットのcontainerディレクトリへのパスを取得
498          *
499          * 例) /var/www/html/magic3/widgets/xxxxx/include/container
500          *
501          * @param string $widgetId                      ウィジェットID
502          * @return string                                       パス
503          */
504         public function getWidgetContainerPath($widgetId)
505         {
506                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $widgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'container';
507         }
508         /**
509          * ウィジェットのincludeディレクトリへのパスを取得
510          *
511          * 例) /var/www/html/magic3/widgets/xxxxx/include
512          *
513          * @param string $widgetId                      ウィジェットID
514          * @return string                                       パス
515          */
516         public function getWidgetIncludePath($widgetId)
517         {
518                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $widgetId . DIRECTORY_SEPARATOR . 'include';
519         }
520         /**
521          * システムのルートURLを取得
522          */
523         public function getRootUrl()
524         {
525                 //return M3_SYSTEM_ROOT_URL;
526                 return $this->currentDomainRootUrl;
527         }
528         /**
529          * システムのルートURLがSSLのURLかどうか
530          *
531          * @return bool                 true=SSLのURL、false=SSLのURLではない
532          */
533         public function isRootUrlSsl()
534         {
535                 if (strncasecmp($this->currentDomainRootUrl, 'https://', 8) == 0){
536                         return true;
537                 } else {
538                         return false;
539                 }
540         }
541         /**
542          * SSL用のルートURLを取得
543          */
544         public function getSslRootUrl()
545         {
546                 // 設定値が空のときはシステムルートURLから生成
547                 if (empty($this->sslUrl)){
548                         $url = str_replace('http://', 'https://', M3_SYSTEM_ROOT_URL);
549                 } else {
550                         $url = $this->sslUrl;
551                 }
552                 return $url;
553         }
554         /**
555          * 現在のページのシステムのルートURLを取得
556          */
557         public function getRootUrlByCurrentPage()
558         {
559                 //$url = M3_SYSTEM_ROOT_URL;
560                 $url = $this->currentDomainRootUrl;
561                 if ($this->isAdminDirAccess()){         // 管理画面へのアクセスのとき
562                         // 管理画面のSSL状態を参照
563                         //if ($this->useSslAdmin) $url = str_replace('http://', 'https://', $url);
564                         if ($this->useSslAdmin) $url = $this->getSslRootUrl();
565                 } else {
566                         $url = $this->getRootUrlByPage($this->getCurrentPageId(), $this->getCurrentPageSubId());
567                 }
568                 return $url;
569         }
570         /**
571          * 指定のページのシステムのルートURLを取得
572          *
573          * @param string $pageId                ページID
574          * @param string $pageSubId             ページサブID
575          * @return string                               URL
576          */
577         public function getRootUrlByPage($pageId, $pageSubId)
578         {
579                 global $gPageManager;
580                 
581                 //$url = M3_SYSTEM_ROOT_URL;
582                 $url = $this->currentDomainRootUrl;
583                 $isSslPage = $gPageManager->isSslPage($pageId, $pageSubId);
584                 if ($isSslPage) $url = $this->getSslRootUrl();
585                 return $url;
586         }
587         /**
588          * リアルタイムサーバ用のURLを取得
589          *
590          * @return string                               URL
591          */
592         public function getRealtimeServerUrl()
593         {
594                 static $serverUrl;
595                 
596                 if (!isset($serverUrl)){
597                         // リアルタイムサーバ用ポート番号を取得
598                         $portNo = $this->gSystem->getSystemConfig(self::CF_REALTIME_SERVER_PORT);
599                         $rootUrl = $this->getRootUrlByCurrentPage();
600                         
601                         $parsedUrl = parse_url($rootUrl);
602                         $url = $parsedUrl['scheme'] . '://' . $parsedUrl['host'];
603                         if (!empty($portNo)) $url .= ':' . $portNo;
604                         $serverUrl = $url;
605                 }
606                 return $serverUrl;
607         }
608         /**
609          * 現在のページにSSLが必要かどうかを取得
610          */
611         public function isSslByCurrentPage()
612         {
613                 global $gPageManager;
614                 
615                 $isSslPage = false;
616                 if ($this->isAdminDirAccess()){         // 管理画面へのアクセスのとき
617                         // 管理画面のSSL状態を参照
618                         if ($this->useSslAdmin) $isSslPage = true;
619                 } else {
620                         $isSslPage = $gPageManager->isSslPage($this->getCurrentPageId(), $this->getCurrentPageSubId());
621                 }
622                 return $isSslPage;
623         }
624         /**
625          * widgetsディレクトリへのURLを取得
626          *
627          * 例) http://www.magic3.org/magic3/widgets
628          */
629         public function getWidgetsUrl()
630         {
631                 //return M3_SYSTEM_ROOT_URL . '/widgets';
632                 return $this->currentDomainRootUrl . '/widgets';
633         }
634         /**
635          * widgetsディレクトリへのSSL用URLを取得
636          *
637          * 例) https://www.magic3.org/magic3/widgets
638          */
639         public function getSslWidgetsUrl()
640         {
641                 return $this->getSslRootUrl() . '/widgets';
642         }
643         /**
644          * リソース用ディレクトリへのURLを取得
645          */
646         public function getResourceUrl()
647         {
648                 //return M3_SYSTEM_ROOT_URL . '/resource';
649                 return $this->currentDomainRootUrl . '/resource';
650         }
651         /**
652          * ユーザの種別に対応したリソース用ディレクトリへのURLを取得(外部アプリケーション用)
653          *
654          * @return string               URL
655          */
656         public function getResourceUrlForUser()
657         {
658                 $url = $this->getResourceUrl();
659                 
660                 // ユーザのリソース制限が必要な場合は、ユーザごとのディレクトリを設定
661                 if ($this->isResourceLimitedUser()){
662                         $url .= '/' . M3_DIR_NAME_HOME . '/' . $this->getCurrentUserAccount();
663                 }
664                 return $url;
665         }
666         /**
667          * リソース用ディレクトリへのSSL用URLを取得
668          */
669         public function getSslResourceUrl()
670         {
671                 return $this->getSslRootUrl() . '/resource';
672         }
673         /**
674          * 画像用ディレクトリへのパスを取得
675          */
676         public function getImagesUrl()
677         {
678                 //return M3_SYSTEM_ROOT_URL . '/images';
679                 return $this->currentDomainRootUrl . '/images';
680         }
681         /**
682          * 絵文字画像用ディレクトリへのパスを取得
683          */
684         public function getEmojiImagesUrl()
685         {
686                 //return M3_SYSTEM_ROOT_URL . '/images/system/emoji';
687                 return $this->currentDomainRootUrl . '/images/system/emoji';
688         }
689         /**
690          * scriptsディレクトリ(共通スクリプトディレクトリ)へのURLを取得
691          *
692          * 例) http://www.magic3.org/magic3/scripts
693          */
694         public function getScriptsUrl()
695         {
696                 //return M3_SYSTEM_ROOT_URL . '/scripts';
697                 return $this->currentDomainRootUrl . '/scripts';
698         }
699         /**
700          * scriptsディレクトリ(共通スクリプトディレクトリ)へのSSL用URLを取得
701          *
702          * 例) http://www.magic3.org/magic3/scripts
703          */
704         public function getSslScriptsUrl()
705         {
706                 return $this->getSslRootUrl() . '/scripts';
707         }
708         /**
709          * scriptsディレクトリへのURLを取得
710          *
711          * 例) //www.magic3.org/magic3/scripts
712          */
713         public function getProtocolRelativeScriptsUrl()
714         {
715                 return $this->protocolRelativeRootUrl . '/scripts';
716         }
717         /**
718          * templatesディレクトリ(テンプレートディレクトリ)へのURLを取得
719          *
720          * 例) http://www.magic3.org/magic3/templates
721          */
722         public function getTemplatesUrl()
723         {
724                 //return M3_SYSTEM_ROOT_URL . '/templates';
725                 return $this->currentDomainRootUrl . '/templates';
726         }
727         /**
728          * templatesディレクトリ(テンプレートディレクトリ)へのSSL用URLを取得
729          *
730          * 例) http://www.magic3.org/magic3/templates
731          */
732         public function getSslTemplatesUrl()
733         {
734                 return $this->getSslRootUrl() . '/templates';
735         }
736         /**
737          * themesディレクトリ(jQueryUIテーマディレクトリ)へのURLを取得
738          *
739          * 例) http://www.magic3.org/magic3/ui/themes
740          */
741         public function getThemesUrl()
742         {
743                 //return M3_SYSTEM_ROOT_URL . '/ui/themes';
744                 return $this->currentDomainRootUrl . '/ui/themes';
745         }
746         /**
747          * 管理用ディレクトリへのURLパスを取得
748          *
749          * @param bool $removeAdminDir          「admin」ディレクトリ名を削除するかどうか
750          * @return string                                       管理用ディレクトリへのURLパス
751          */
752         public function getAdminUrl($removeAdminDir = false)
753         {
754                 static $url;
755                 
756                 if (!isset($url)){
757                         $url = M3_SYSTEM_ROOT_URL;
758                         if ($this->useSslAdmin) $url = $this->getSslRootUrl();
759                 }
760                 $destUrl = $url;
761                 if (!$removeAdminDir) $destUrl .= '/' . M3_DIR_NAME_ADMIN;
762                 return $destUrl;
763         }
764         /**
765          * システムのデフォルトindexのURLを取得
766          *
767          * @return string                                       デフォルトURL
768          */
769         public function getDefaultUrl()
770         {
771                 //return M3_SYSTEM_ROOT_URL . '/' . M3_FILENAME_INDEX;
772                 return $this->currentDomainRootUrl . '/' . M3_FILENAME_INDEX;
773         }
774         /**
775          * システムのPC用デフォルトindexのURLを取得
776          *
777          * @return string                                       デフォルトURL
778          */
779         public function getDefaultPcUrl()
780         {
781                 return M3_SYSTEM_ROOT_URL . '/' . M3_FILENAME_INDEX;
782         }
783         /**
784          * システムの携帯用デフォルトindexのURLを取得
785          *
786          * @param bool $withMobileParam         携帯用のパラメータを付加するかどうか
787          * @param bool $withFilename            ファイル名を付加するかどうか
788          * @return string                                       携帯用デフォルトURL
789          */
790         public function getDefaultMobileUrl($withMobileParam = false, $withFilename = true)
791         {
792                 static $mobileUrl;
793                 
794                 if ($this->multiDomain){                        // マルチドメイン運用の場合
795                         if (!isset($mobileUrl)) $mobileUrl = $this->gSystem->getSystemConfig(self::CF_SITE_MOBILE_URL);         // 携帯用サイトURL
796
797                         if (empty($mobileUrl)){
798                                 $url = M3_SYSTEM_ROOT_URL . '/' . M3_DIR_NAME_MOBILE;
799                         } else {
800                                 $url = $mobileUrl;
801                         }
802                 } else {
803                         $url = M3_SYSTEM_ROOT_URL . '/' . M3_DIR_NAME_MOBILE;
804                 }
805                 if ($withFilename) $url .= '/' . M3_FILENAME_INDEX;
806                 if ($withMobileParam){          // 携帯用のパラメータを付加するとき
807                         $url = createUrl($url, $this->_getMobileUrlParam());
808                 }
809                 return $url;
810         }
811         /**
812          * システムのスマートフォン用デフォルトindexのURLを取得
813          *
814          * @param bool $withFilename            ファイル名を付加するかどうか
815          * @return string                                       スマートフォン用デフォルトURL
816          */
817         public function getDefaultSmartphoneUrl($withFilename = true)
818         {
819                 static $smartphoneUrl;
820                 
821                 if ($this->multiDomain){                        // マルチドメイン運用の場合
822                         if (!isset($smartphoneUrl)) $smartphoneUrl = $url = $this->gSystem->getSystemConfig(self::CF_SITE_SMARTPHONE_URL);      // スマートフォン用サイトURL
823                         
824                         if (empty($smartphoneUrl)){
825                                 $url = M3_SYSTEM_ROOT_URL . '/' . M3_DIR_NAME_SMARTPHONE;
826                         } else {
827                                 $url = $smartphoneUrl;
828                         }
829                 } else {
830                         $url = M3_SYSTEM_ROOT_URL . '/' . M3_DIR_NAME_SMARTPHONE;
831                 }
832                 if ($withFilename) $url .= '/' . M3_FILENAME_INDEX;
833                 return $url;
834         }
835         /**
836          * システムのデフォルトの管理用indexのURLを取得
837          */
838         public function getDefaultAdminUrl()
839         {
840                 return $this->getAdminUrl() . '/' . M3_FILENAME_INDEX;
841         }
842         /**
843          * 管理画面用jQueryUIテーマのCSSのURLを取得
844          *
845          * @return string               CSSのURL
846          */
847         public function getAdminDefaultThemeUrl()
848         {
849                 $themeFile = $this->getThemesUrl() . '/'. $this->adminDefaultTheme . '/'. self::DEFAULT_THEME_CSS_FILE; // 管理画面用jQueryUIテーマ
850                 return $themeFile;
851         }
852         /**
853          * 作業用ディレクトリへのパスを取得
854          *
855          * @return string               作業ディレクトリ
856          */
857         public function getWorkDirPath()
858         {
859                 return $this->workDir;
860         }
861         /**
862          * 一般ユーザ用の作業用ディレクトリへのパスを取得
863          *
864          * @return string               作業ディレクトリ
865          */
866         public function getUserWorkDirPath()
867         {
868                 return $this->workDir . DIRECTORY_SEPARATOR . 'users';
869         }
870         /**
871          * セッション単位の一時ディレクトリを取得
872          *
873          * @param bool  $createDir      ディレクトリが存在しない場合、作成するかどうか
874          * @return string               一時ディレクトリ
875          */
876         function getTempDirBySession($createDir = false)
877         {
878                 $dir = $this->workDir . DIRECTORY_SEPARATOR . session_id();
879                 if (!file_exists($dir) && $createDir) mkdir($dir, M3_SYSTEM_DIR_PERMISSION, true/*再帰的*/);
880                 return $dir;
881         }
882         /**
883          * 一般ユーザ用のセッション単位の一時ディレクトリを取得
884          *
885          * @param bool  $createDir      ディレクトリが存在しない場合、作成するかどうか
886          * @return string               一時ディレクトリ
887          */
888         function getUserTempDirBySession($createDir = false)
889         {
890                 $dir = $this->getUserWorkDirPath() . DIRECTORY_SEPARATOR . session_id();
891                 if (!file_exists($dir) && $createDir) mkdir($dir, M3_SYSTEM_DIR_PERMISSION, true/*再帰的*/);
892                 return $dir;
893         }
894         /**
895          * 一時ディレクトリを取得
896          *
897          * 一時ディレクトリを作成してパスを取得
898          *
899          * @return string               ディレクトリパス(失敗のときは空を返す)
900          */
901         public function getTempDir()
902         {
903                 $path = $this->workDir . '/' . M3_SYSTEM_WORK_DIRNAME_HEAD . uniqid();
904                         
905                 if (!file_exists($path)){// ディレクトリがないとき
906                         if (!mkdir($path, M3_SYSTEM_DIR_PERMISSION)){
907                                 $path = $this->workDir . '/' . M3_SYSTEM_WORK_DIRNAME_HEAD . uniqid(rand());
908                                 if (!mkdir($path, M3_SYSTEM_DIR_PERMISSION)) return '';
909                         }
910                 }
911                 return $path;
912         }
913         // ##################### パス処理 #####################
914         /**
915          * サーバのURLを取得
916          *
917          * 例) http://www.magic3.org, http://www.magic3.org:8080
918          */
919         public function getServerUrl()
920         {
921                 // クライアントからの情報を元にURLを取得
922                 if (isset($_SERVER['HTTPS'])){          // SSL通信の場合
923                         $url = 'https://' . $_SERVER['HTTP_HOST'];
924                 } else {
925                         $url = 'http://' . $_SERVER['HTTP_HOST'];
926                 }
927                 return $url;
928         }
929         /**
930          * 現在実行中のスクリプトファイルのURLを取得
931          *
932          * 例) http://www.magic3.org/magic3/index.php
933          */
934         public function getCurrentScriptUrl()
935         {
936                 //return $_SERVER["SCRIPT_URI"];                // SCRIPT_URIはサーバによってはundefinedになる
937                 return $this->getServerUrl() . $_SERVER["PHP_SELF"];
938         }
939         /**
940          * クライアントから要求されたURI(パラメータ付き)を取得
941          *
942          * 例) http://www.magic3.org/magic3/index.php?aaa=bbb
943          */
944         public function getCurrentRequestUri()
945         {
946                 return $this->getServerUrl() . $_SERVER["REQUEST_URI"];
947         }
948         /**
949          * 現在実行中のスクリプトファイルのパスを取得
950          *
951          * 例) /var/www/html/magic3/index.php
952          */
953         public function getCurrentScriptPath()
954         {
955                 return realpath($_SERVER["SCRIPT_FILENAME"]);
956         }       
957         /**
958          * ドキュメントルートを取得
959          *
960          * 例) /var/www/html
961          */
962         public function getDocumentRoot()
963         {
964                 // バーチャルサーバの場合にも対応
965                 //return $_SERVER["DOCUMENT_ROOT"];
966                 $name = $_SERVER["SCRIPT_NAME"];
967                 $filename = $_SERVER["SCRIPT_FILENAME"];
968                 $dir = substr($filename, 0, strlen($filename) - strlen($name));
969                 return $dir;
970         }
971         /**
972          * ドキュメントルートURLを取得
973          *
974          * 例) http://www.magic3.org, http://www.magic3.org:8080
975          */
976         public function getDocumentRootUrl()
977         {
978                 $rootUrl = parse_url($this->getRootUrl());
979                 $url = 'http://' . $rootUrl['host'];
980                 if (!empty($rootUrl['port'])) $url .= ':' . $rootUrl['port'];
981                 return $url;
982         }
983         /**
984          * システムルートURLを求める
985          *
986          * @return string               システムのルートURL。算出できなかったときは空文字列を返す。
987          */
988         public function calcSystemRootUrl()
989         {       
990                 // 相対パスを得る
991                 $base = explode(DIRECTORY_SEPARATOR, $this->getSystemRootPath());
992                 $target = explode(DIRECTORY_SEPARATOR, $this->getCurrentScriptPath());
993                 
994                 for ($i = 0; $i < count($base); $i++)
995                 {
996                         if ($base[$i] != $target[$i]) break;
997                 }
998                 $relativePath = '';
999                 for ($j = $i; $j < count($target); $j++)
1000                 {
1001                         $relativePath .= '/' . $target[$j];
1002                 }
1003                 // システムルートディレクトリ取得
1004                 $sytemRootUrl = '';
1005                 $pos = strrpos($this->getCurrentScriptUrl(), $relativePath);
1006                 if (!($pos === false)){
1007                         $sytemRootUrl = substr($this->getCurrentScriptUrl(), 0, $pos);
1008                 }
1009                 return $sytemRootUrl;
1010         }
1011         /**
1012          * 相対パスを求める
1013          *
1014          * @param string $basePath              基点となるディレクトリの絶対パス
1015          * @param string $targetPath    対象となるディレクトリの絶対パス
1016          * @return string                               相対パス
1017          */
1018         public function calcRelativePath($basePath, $targetPath)
1019         {
1020                 // 相対パスを得る
1021                 $base = explode('/', $basePath);
1022                 $target = explode('/', $targetPath);
1023                 
1024                 for ($i = 0; $i < count($base); $i++)
1025                 {
1026                         if ($base[$i] != $target[$i]) break;
1027                 }
1028                 $relativePath = '';
1029                 for ($j = $i; $j < count($target); $j++)
1030                 {
1031                         $relativePath .= '/' . $target[$j];
1032                 }
1033                 return $relativePath;
1034         }
1035         /**
1036          * パーマネントリンク用の現在のページURLを取得
1037          *
1038          * @param bool $hasSubPage              サブページIDを必ず付加するかどうか。必ず付加しない場合はデフォルトページのとき省略
1039          * @return string                               パーマネントリンクURL
1040          */
1041         /*public function getCurrentPermanentPageUrl($hasSubPage=false)
1042         {
1043                 $url = $this->getDefaultUrl();
1044                 if ($hasSubPage || $this->currentPageSubId != $this->defaultPageSubId) $url .= '?sub=' . $this->currentPageSubId;
1045                 return $url;
1046         }*/
1047         /**
1048          * ドキュメントルートからのリソース用ディレクトリへの相対パスを取得(外部アプリケーション用)
1049          *
1050          * @return string               相対パス
1051          */
1052         public function getRelativeResourcePathToDocumentRoot()
1053         {
1054                 // 相対パスを得る
1055                 //if (isset($_SERVER['HTTPS'])){                // SSL通信の場合
1056                 //      $res = parse_url($this->getSslResourceUrl());
1057                 //} else {
1058                         $res = parse_url($this->getResourceUrl());
1059                 //}
1060                 return $res['path'];
1061         }
1062         /**
1063          * ユーザの種別に対応した、ドキュメントルートからのリソース用ディレクトリへの相対パスを取得(外部アプリケーション用)
1064          *
1065          * @return string               相対パス
1066          */
1067         public function getRelativeResourcePathToDocumentRootForUser()
1068         {
1069                 // 相対パスを取得
1070                 $res = parse_url($this->getResourceUrl());
1071                 $path = $res['path'];
1072                 
1073                 // ユーザのリソース制限が必要な場合は、ユーザごとのディレクトリを設定
1074                 //if ($this->isCurrentUserLogined() && !$this->isSystemManageUser()){
1075                 if ($this->isResourceLimitedUser()){
1076                         $path .= '/' . M3_DIR_NAME_HOME . '/' . $this->getCurrentUserAccount();
1077                 }
1078                 return $path;
1079         }
1080         /**
1081          * アプリケーションルートから指定ディレクトリへの相対パスを取得
1082          *
1083          * @param string $url   指定URL
1084          * @return string               相対パス
1085          */
1086         public function getRelativePathToSystemRootUrl($url)
1087         {
1088                 // システムのルートURL以下か、SSL用のルートURL以下か判断
1089                 $rootUrl = $this->getRootUrl();
1090                 $relativePath = str_replace($this->getSslRootUrl(), '', $url);
1091                 if (empty($relativePath) || strStartsWith($relativePath, '/') || strStartsWith($relativePath, '?') || strStartsWith($relativePath, '#')){
1092                         $rootUrl = $this->getSslRootUrl();
1093                 }
1094                         
1095                 // URLから相対パスを得る
1096                 $root = parse_url($rootUrl);
1097                 $target = parse_url($url);
1098                 return $this->calcRelativePath($root['path'], $target['path']);
1099         }
1100         /**
1101          * アプリケーションルートから指定ディレクトリへの相対パスを取得
1102          *
1103          * @param string $path  指定パス
1104          * @return string               相対パス
1105          */
1106         public function getRelativePathToSystemRootPath($path)
1107         {
1108                 return $this->calcRelativePath($this->getSystemRootPath(), $path);
1109         }
1110         /**
1111          * URLから絶対パスを取得
1112          *
1113          * @param string $url   指定URL
1114          * @return string               絶対パス
1115          */
1116         public function getAbsolutePath($url)
1117         {
1118                 return $this->getSystemRootPath() . $this->getRelativePathToSystemRootUrl($url);
1119         }
1120         /**
1121          * フルパスからURLを取得
1122          *
1123          * @param string $path  指定パス
1124          * @return string               URL
1125          */
1126         public function getUrlToPath($path)
1127         {
1128                 return $this->getRootUrl() . $this->calcRelativePath($this->getSystemRootPath(), $path);
1129         }
1130         /**
1131          * マクロ変換したパスを取得
1132          *
1133          * @param string $path  変換元パス(絶対パス、相対パス)
1134          * @return string               変換したパス
1135          */
1136         public function getMacroPath($path)
1137         {
1138                 $destPath = $path;
1139                 if (strncmp($destPath, '/', 1) == 0){           // 相対パス表記のとき
1140                         $destPath = M3_TAG_START . M3_TAG_MACRO_ROOT_URL . M3_TAG_END . $this->getRelativePathToSystemRootUrl($this->getDocumentRootUrl() . $destPath);
1141                 } else if (strncmp($destPath, 'http', strlen('http')) == 0 || strncmp($destPath, 'https', strlen('https')) == 0){                               // 絶対パス表記のとき
1142                         $destPath = str_replace('https://', 'http://', $destPath);              // 一旦httpに統一
1143                         $rootUrl = str_replace('https://', 'http://', $this->getRootUrl());             // 一旦httpに統一
1144                         $destPath = str_replace($rootUrl, M3_TAG_START . M3_TAG_MACRO_ROOT_URL . M3_TAG_END, $destPath);// マクロ変換
1145                 }
1146                 return $destPath;
1147         }
1148         /**
1149          * SSL用のURLに変換
1150          *
1151          * @param string $url   指定URL
1152          */
1153         public function getSslUrl($url)
1154         {
1155                 // 「?」以降のパラメータはそのまま維持する
1156                 list($tmp, $query) = explode('?', $url);
1157                 
1158                 // URLから相対パスを得て、SSL用URLに連結
1159                 $destUrl = $this->getSslRootUrl() . $this->getRelativePathToSystemRootUrl($url);
1160                 if (!empty($query)) $destUrl .= '?' . $query;
1161                 return $destUrl;
1162         }
1163         /**
1164          * URLを解析
1165          *
1166          * @param string $url                   指定URL
1167          * @param string $pageId                ページIDが返る
1168          * @param string $pageSubId             ページサブIDが返る
1169          * @param array $params                 ページID,ページサブID以外のパラメータが返る
1170          * @return bool                                 true=解析成功、false=解析失敗(Magic3以外のURL)
1171          */
1172 /*      public function parseUrl($url, &$pageId, &$pageSubId, &$params)
1173         {
1174                 // 引数エラーチェック
1175                 if (empty($url)) return false;
1176                 
1177                 $params = array();
1178                 if ($this->isSystemUrlAccess($url)){
1179                         // URLを解析
1180                         $queryArray = array();
1181                         $parsedUrl = parse_url($url);
1182                         if (!empty($parsedUrl['query'])) parse_str($parsedUrl['query'], $queryArray);           // クエリーの解析
1183                         
1184                         // ルートからの相対パスを取得
1185                         $relativePath = $this->getRelativePathToSystemRootUrl($url);
1186                         
1187                         // ページIDを取得
1188                         $path = trim($relativePath, '/');
1189                         $pathArray = explode('/', $path);
1190                         $basename = '';
1191                         for ($i = 0; $i < count($pathArray); $i++){
1192                                 if ($i == 0){
1193                                         $basename .= $pathArray[$i];
1194                                 } else {
1195                                         $basename .= ('_' . $pathArray[$i]);
1196                                 }
1197                         }
1198                         $basename = basename($basename, '.php');
1199                         if (empty($basename)) $basename = $this->getDefaultPageId();
1200                         $pageId = $basename;
1201                         
1202                         // ページサブID取得
1203                         $pageSubId = $this->_getPageSubIdFromUrlQuery($pageId, $parsedUrl['query']);
1204
1205                         // その他のパラメータを取得
1206                         $keys = array_keys($queryArray);
1207                         $keyCount = count($keys);
1208                         for ($i = 0; $i < $keyCount; $i++){
1209                                 $key = $keys[$i];
1210                                 $value = $queryArray[$key];
1211                                 if ($key != M3_REQUEST_PARAM_PAGE_SUB_ID){              // ページIDは追加しない
1212                                         $params[$key] = $value;
1213                                 }
1214                         }
1215                         return true;
1216                 } else {// システムディレクトリ以外のときはエラー
1217                         return false;
1218                 }
1219         }*/
1220         /**
1221          * ページIDとURLのクエリー文字列からサブページIDを取得
1222          *
1223          * @param string $pageId        ページID
1224          * @param string $query         クエリー文字列
1225          * @return string                       サブページID
1226          */
1227 /*      public function _getPageSubIdFromUrlQuery($pageId, $query)
1228         {
1229                 $queryArray = array();
1230                 if (!empty($query)) parse_str($query, $queryArray);             // クエリーの解析
1231                         
1232                 // ページサブID取得
1233                 $pageSubId = $queryArray[M3_REQUEST_PARAM_PAGE_SUB_ID];
1234                 if (empty($pageSubId)){
1235                         // ページサブIDがないときは、パラメータからページ属性を判断する
1236                         // キーが設定されていれば値は空文字列でも属性を持っているとする
1237                         if (isset($queryArray[M3_REQUEST_PARAM_CONTENT_ID]) || isset($queryArray[M3_REQUEST_PARAM_CONTENT_ID_SHORT])){          // コンテンツIDのとき
1238                                 $pageSubId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_CONTENT, $pageId);// ページサブIDを取得
1239                         } else if (isset($queryArray[M3_REQUEST_PARAM_PRODUCT_ID]) || isset($queryArray[M3_REQUEST_PARAM_PRODUCT_ID_SHORT])){   // 製品IDのとき
1240                                 $pageSubId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_PRODUCT, $pageId);// ページサブIDを取得
1241                         } else if (isset($queryArray[M3_REQUEST_PARAM_BBS_ID]) || isset($queryArray[M3_REQUEST_PARAM_BBS_ID_SHORT])){   // 掲示板投稿記事のとき
1242                                 $pageSubId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_BBS, $pageId);// ページサブIDを取得
1243                         } else if (isset($queryArray[M3_REQUEST_PARAM_BLOG_ENTRY_ID]) || isset($queryArray[M3_REQUEST_PARAM_BLOG_ENTRY_ID_SHORT])){     // ブログ記事のとき
1244                                 $pageSubId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_BLOG, $pageId);// ページサブIDを取得
1245                         }
1246                 }
1247                 if (empty($pageSubId)) $pageSubId = $this->db->getDefaultPageSubId($pageId);    // 最終的に見つからないときはデフォルト値を取得
1248                 return $pageSubId;
1249         }*/
1250         /**
1251          * Magic3システムへのアクセスかどうか(SSL用のURL含む)
1252          *
1253          * @param string $url           指定URL(空のときは現在のスクリプト)
1254          * @return bool                         Magic3システムディレクトリ以下のアクセスのときはtrue。それ以外の場合はfalse。
1255          */
1256         public function isSystemUrlAccess($url = '')
1257         {
1258                 if (empty($url)) $url = $_SERVER["HTTP_REFERER"];
1259                 
1260                 $url = str_replace('https://', 'http://', $url);                // 一旦httpに統一
1261                 $systemUrl = str_replace('https://', 'http://', $this->getRootUrl());           // 一旦httpに統一
1262                 $systemSslUrl = str_replace('https://', 'http://', $this->getSslRootUrl());             // 一旦httpに統一
1263                         
1264                 // パスを解析
1265                 $relativePath = str_replace($systemUrl, '', $url);              // ルートURLからの相対パスを取得
1266                 if (empty($relativePath)){                      // Magic3のルートURLの場合
1267                         return true;
1268                 } else if (strStartsWith($relativePath, '/') || strStartsWith($relativePath, '?') || strStartsWith($relativePath, '#')){                // ルートURL配下のとき
1269                         return true;
1270                 } else {                // ルートURL以外のURLのとき(SSL用のURL以下かどうかチェック)
1271                         $relativePath = str_replace($systemSslUrl, '', $url);           // ルートURLからの相対パスを取得
1272                         if (empty($relativePath)){                      // Magic3のルートURLの場合
1273                                 return true;
1274                         } else if (strStartsWith($relativePath, '/') || strStartsWith($relativePath, '?') || strStartsWith($relativePath, '#')){                // ルートURL配下のとき
1275                                 return true;
1276                         } else {                // ルートURL以外のURLのとき(SSL用のURL以下かどうかチェック)
1277                                 return false;
1278                         }
1279                 }
1280         }
1281         /**
1282          * 管理者用URLへのアクセスかどうか
1283          *
1284          * @param string $url           判断対象のURL(空のときは現在のスクリプト)
1285          * @return bool                         管理者用ディレクトリへのアクセスのときは、true。それ以外の場合はfalse。
1286          */
1287         public function isAdminUrlAccess($url = '')
1288         {
1289                 if (empty($url)) $url = $_SERVER["HTTP_REFERER"];
1290                 
1291                 $url = str_replace('https://', 'http://', $url);                // 一旦httpに統一
1292                 $adminUrl = str_replace('https://', 'http://', $this->getAdminUrl());           // 一旦httpに統一
1293                         
1294                 // パスを解析
1295                 $relativePath = str_replace($adminUrl, '', $url);               // ルートURLからの相対パスを取得
1296                 if (empty($relativePath)){                      // Magic3のルートURLの場合
1297                         return true;
1298                 } else if (strStartsWith($relativePath, '/') || strStartsWith($relativePath, '?') || strStartsWith($relativePath, '#')){                // ルートURL配下のとき
1299                         return true;
1300                 } else {                // ルートURL以外のURLのとき
1301                         return false;
1302                 }
1303         }
1304         /**
1305          * 管理者用URLへのアクセスかどうか
1306          *
1307          * @return bool         管理者用ディレクトリへのアクセスのときはtrue。それ以外の場合はfalse。
1308          */
1309         public function isAdminDirAccess()
1310         {
1311                 static $isAdminDirAccess;
1312                 
1313                 if (!isset($isAdminDirAccess)){
1314                         if (dirname($this->getCurrentScriptPath()) == $this->getAdminPath()){
1315                                 $isAdminDirAccess = true;
1316                         } else {
1317                                 $isAdminDirAccess = false;
1318                         }
1319                 }
1320                 return $isAdminDirAccess;
1321         }
1322         // ##################### カレントのテンプレート関係 #####################
1323         /**
1324          * 現在のテンプレートを設定
1325          *
1326          * @param string $name                          テンプレートID
1327          * @param string $subTemplateId         サブテンプレートID
1328          * @return                                                      なし
1329          */
1330         public function setCurrentTemplateId($name, $subTemplateId = '')
1331         {
1332                 global $gPageManager;
1333                 
1334                 $this->currentTemplateId = $name;
1335
1336                 // テンプレートの属性を取得
1337                 $this->currentSubTemplateId = '';       // 現在のサブテンプレートID
1338                 $this->currentTemplateType = 0;
1339                 $this->currentTemplateGenerator = '';           // テンプレート作成アプリケーション
1340                 $this->currentTemplateVersion = '';             // テンプレートバージョン
1341                 $this->currentTemplateCleanType = 0;
1342                 $this->currentTemplateUseBootstrap = false;     // 現在のテンプレートでBootstrapライブラリを使用するかどうか
1343                 if ($this->canUseDb){           // DB使用可能なとき
1344                         if ($this->db->getTemplate($name, $row)){
1345                                 $this->currentTemplateType = $row['tm_type'];           // テンプレートタイプ
1346                                 $this->currentTemplateGenerator = $row['tm_generator'];         // テンプレート作成アプリケーション
1347                                 $this->currentTemplateVersion = $row['tm_version'];             // テンプレートバージョン
1348                                 $this->currentTemplateCleanType = $row['tm_clean_type'];        // 現在のテンプレートのクリーンタイプ
1349                                 $this->currentTemplateUseBootstrap = $row['tm_use_bootstrap'];  // 現在のテンプレートでBootstrapライブラリを使用するかどうか
1350                                 $this->currentTemplateInfoRow = $row;           // 現在のテンプレートの情報
1351                                 
1352                                 // テンプレートが設定された段階でBootstrapの使用があればページマネージャーに反映する。ウィジェット側で使用状況を参照してビューを作成することがあるため。
1353                                 if ($this->currentTemplateUseBootstrap) $gPageManager->useBootstrap();
1354                                 
1355                                 if (!empty($subTemplateId)) $this->currentSubTemplateId = $subTemplateId;       // 現在のサブテンプレートID
1356                         }
1357                 }
1358         }
1359         /**
1360          * 現在のテンプレートを取得
1361          *
1362          * @return string               テンプレートID
1363          */
1364         public function getCurrentTemplateId()
1365         {
1366                 return $this->currentTemplateId;
1367         }
1368         /**
1369          * 現在のサブテンプレートを取得
1370          *
1371          * @return string               サブテンプレートID
1372          */
1373         public function getCurrentSubTemplateId()
1374         {
1375                 return $this->currentSubTemplateId;
1376         }
1377         /**
1378          * 現在のテンプレートタイプ
1379          *
1380          * @return int          0=デフォルトテンプレート(Joomla!v1.0),1=Joomla!v1.5,2=Joomla!v2.5,10=Bootstrap v3.0
1381          */
1382         public function getCurrentTemplateType()
1383         {
1384                 return $this->currentTemplateType;
1385         }
1386         /**
1387          * テンプレート作成アプリケーション
1388          *
1389          * @return string               テンプレート作成アプリケーション(artisteer,themler)
1390          */
1391         public function getCurrentTemplateGenerator()
1392         {
1393                 return $this->currentTemplateGenerator;
1394         }
1395         /**
1396          * テンプレートバージョン
1397          *
1398          * @return string               バージョン文字列
1399          */
1400         public function getCurrentTemplateVersion()
1401         {
1402                 return $this->currentTemplateVersion;
1403         }
1404         /**
1405          * 現在のテンプレートのクリーンタイプ
1406          *
1407          * @return int          クリーンタイプ
1408          */
1409         public function getCurrentTemplateCleanType()
1410         {
1411                 return $this->currentTemplateCleanType;
1412         }
1413         /**
1414          * 現在のテンプレートでBootstrapライブラリを使用するかどうか
1415          *
1416          * @return bool         true=使用、false=未使用
1417          */
1418         public function getCurrentTemplateUseBootstrap()
1419         {
1420                 return $this->currentTemplateUseBootstrap;
1421         }
1422         /**
1423          * 現在のビュー作成タイプを設定
1424          *
1425          * @param string $renderType    ビュー作成タイプ
1426          * @return                                              なし
1427          */
1428         public function setCurrentRenderType($renderType)
1429         {
1430                 $this->currentRenderType = $renderType;
1431         }
1432         /**
1433          * 現在のビュー作成タイプを取得
1434          *
1435          * @return string                       ビュー作成タイプ
1436          */
1437         public function getCurrentRenderType()
1438         {
1439                 return $this->currentRenderType;
1440         }
1441         /**
1442          * 現在のテンプレートへのパスを取得
1443          *
1444          * 例) /var/www/html/magic3/templates/menu
1445          */
1446         public function getCurrentTemplatePath()
1447         {
1448                 return M3_SYSTEM_ROOT_PATH . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $this->currentTemplateId;
1449         }
1450         /**
1451          * 現在のテンプレートへのURLを取得
1452          *
1453          * 例) http://www.magic3.org/magic3/templates/menu
1454          */
1455         public function getCurrentTemplateUrl()
1456         {
1457                 //return M3_SYSTEM_ROOT_URL . '/templates/' . $this->currentTemplateId;
1458                 return $this->currentDomainRootUrl . '/templates/' . $this->currentTemplateId;
1459         }
1460         /**
1461          * 現在のテンプレートのカスタマイズパラメータを取得
1462          *
1463          * @return string                       カスタマイズデータ(シリアライズ)
1464          */
1465         public function getCurrentTemplateCustomParam()
1466         {
1467                 return $this->currentTemplateInfoRow['tm_custom_params'];               // 現在のテンプレートの情報
1468         }
1469         /**
1470          * 現在のテンプレートのカスタマイズパラメータを更新
1471          *
1472          * @param string $params        カスタマイズデータ(シリアライズ)
1473          * @return bool                         true=成功、false=失敗
1474          */
1475         public function updateCurrentTemplateCustomParam($params)
1476         {
1477                 $updateParam = array();
1478                 $updateParam['tm_custom_params'] = $params;
1479                 $ret = $this->db->updateTemplate($this->currentTemplateId, $updateParam);
1480                 return $ret;
1481         }
1482         // ##################### カレントのウィジェット関係 #####################
1483         /**
1484          * 現在処理中のウィジェットのルートディレクトリへのパスを取得
1485          *
1486          * 例) http://www.magic3.org/magic3/widgets/xxxxx
1487          */
1488         public function getCurrentWidgetRootUrl()
1489         {
1490                 //return M3_SYSTEM_ROOT_URL . '/widgets/' . $this->currentWidgetId;
1491                 return $this->currentDomainRootUrl . '/widgets/' . $this->currentWidgetId;
1492         }
1493         /**
1494          * 現在処理中のウィジェットのSSLルートディレクトリへのパスを取得
1495          *
1496          * 例) https://www.magic3.org/magic3/widgets/xxxxx
1497          */
1498         public function getCurrentWidgetSslRootUrl()
1499         {
1500                 return $this->getSslRootUrl() . '/widgets/' . $this->currentWidgetId;
1501         }
1502         /**
1503          * 現在処理中のウィジェットのルートディレクトリへのパスを取得
1504          */
1505         public function getCurrentWidgetRootPath()
1506         {
1507                 return M3_SYSTEM_ROOT_PATH . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . $this->currentWidgetId;
1508         }
1509         /**
1510          * 現在処理中のウィジェットのincludeディレクトリへのパスを取得
1511          */
1512         public function getCurrentWidgetIncludePath()
1513         {
1514                 return M3_SYSTEM_ROOT_PATH . '/widgets/' . $this->currentWidgetId . '/include';
1515         }
1516         /**
1517          * 現在処理中のウィジェットのdbディレクトリへのパスを取得
1518          *
1519          * 例) /var/www/html/magic3/widgets/xxxxx/include/db
1520          */
1521         public function getCurrentWidgetDbPath()
1522         {
1523                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $this->currentWidgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'db';
1524         }
1525         /**
1526          * 現在処理中のウィジェットのcontainerディレクトリへのパスを取得
1527          *
1528          * 例) /var/www/html/magic3/widgets/xxxxx/include/container
1529          */
1530         public function getCurrentWidgetContainerPath()
1531         {
1532                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $this->currentWidgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'container';
1533         }
1534         /**
1535          * 現在処理中のウィジェットのlibディレクトリへのパスを取得
1536          *
1537          * 例) /var/www/html/magic3/widgets/xxxxx/include/lib
1538          */
1539         public function getCurrentWidgetLibPath()
1540         {
1541                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $this->currentWidgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'lib';
1542         }
1543         /**
1544          * 現在処理中のウィジェットのtemplateディレクトリへのパスを取得
1545          *
1546          * 例) /var/www/html/magic3/widgets/xxxxx/include/template
1547          */
1548         public function getCurrentWidgetTemplatePath()
1549         {
1550                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $this->currentWidgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'template';
1551         }
1552         /**
1553          * 現在処理中のウィジェットのlocaleディレクトリへのパスを取得
1554          *
1555          * 例) /var/www/html/magic3/widgets/xxxxx/include/locale
1556          */
1557         public function getCurrentWidgetLocalePath()
1558         {
1559                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $this->currentWidgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'locale';
1560         }
1561         /**
1562          * 現在処理中のウィジェットのsqlディレクトリへのパスを取得
1563          *
1564          * 例) /var/www/html/magic3/widgets/xxxxx/include/sql
1565          */
1566         public function getCurrentWidgetSqlPath()
1567         {
1568                 return $this->getWidgetsPath() . DIRECTORY_SEPARATOR . $this->currentWidgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'sql';
1569         }
1570         /**
1571          * 現在処理中のウィジェットのscriptsディレクトリへURLを取得
1572          */
1573         public function getCurrentWidgetScriptsUrl()
1574         {
1575                 //return M3_SYSTEM_ROOT_URL . '/widgets/' . $this->currentWidgetId . '/scripts';
1576                 return $this->currentDomainRootUrl . '/widgets/' . $this->currentWidgetId . '/scripts';
1577         }
1578         /**
1579          * 現在処理中のウィジェットのimagesディレクトリへURLを取得
1580          */
1581         public function getCurrentWidgetImagesUrl()
1582         {
1583                 //return M3_SYSTEM_ROOT_URL . '/widgets/' . $this->currentWidgetId . '/images';
1584                 return $this->currentDomainRootUrl . '/widgets/' . $this->currentWidgetId . '/images';
1585         }
1586         /**
1587          * 現在処理中のウィジェットのscriptsディレクトリへURLを取得
1588          */
1589         public function getCurrentWidgetCssUrl()
1590         {
1591                 //return M3_SYSTEM_ROOT_URL . '/widgets/' . $this->currentWidgetId . '/css';
1592                 return $this->currentDomainRootUrl . '/widgets/' . $this->currentWidgetId . '/css';
1593         }
1594         /**
1595          * 現在処理中のインナーウィジェットのルートディレクトリへのパスを取得
1596          *
1597          * 例) /var/www/html/magic3/widgets/xxxxx/include/iwidgets/yyyyy
1598          */
1599         public function getCurrentIWidgetRootPath()
1600         {
1601                 // ウィジェットIDとインナーウィジェットIDを取り出す
1602                 list($widgetId, $iWidgetId) = explode(M3_WIDGET_ID_SEPARATOR, $this->currentIWidgetId);
1603
1604                 return $this->getWidgetsPath() . '/' . $widgetId . '/include/iwidgets/' . $iWidgetId;
1605         }
1606         /**
1607          * 現在処理中のインナーウィジェットのdbディレクトリへのパスを取得
1608          *
1609          * 例) /var/www/html/magic3/widgets/xxxxx/include/iwidgets/yyyyy/include/db
1610          */
1611         public function getCurrentIWidgetDbPath()
1612         {
1613                 // ウィジェットIDとインナーウィジェットIDを取り出す
1614                 list($widgetId, $iWidgetId) = explode(M3_WIDGET_ID_SEPARATOR, $this->currentIWidgetId);
1615
1616                 return $this->getWidgetsPath() . '/' . $widgetId . '/include/iwidgets/' . $iWidgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'db';
1617         }
1618         /**
1619          * 現在処理中のインナーウィジェットのdbディレクトリへのパスを取得
1620          *
1621          * 例) /var/www/html/magic3/widgets/xxxxx/include/iwidgets/yyyyy/include/container
1622          */
1623         public function getCurrentIWidgetContainerPath()
1624         {
1625                 // ウィジェットIDとインナーウィジェットIDを取り出す
1626                 list($widgetId, $iWidgetId) = explode(M3_WIDGET_ID_SEPARATOR, $this->currentIWidgetId);
1627
1628                 return $this->getWidgetsPath() . '/' . $widgetId . '/include/iwidgets/' . $iWidgetId . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'container';
1629         }
1630         /**
1631          * 現在実行中のウィジェットオブジェクトを設定
1632          *
1633          * @param object $obj           ウィジェットオブジェクト
1634          * @return                                      なし
1635          */
1636         public function setCurrentWidgetObj($obj)
1637         {
1638                 $this->currentWidgetObj = $obj;
1639         }
1640         /**
1641          * 現在実行中のウィジェットオブジェクトを取得
1642          *
1643          * @return object               ウィジェットオブジェクト
1644          */
1645         public function getCurrentWidgetObj()
1646         {
1647                 return $this->currentWidgetObj;
1648         }
1649         /**
1650          * 現在処理中のウィジェット
1651          */
1652         public function setCurrentWidgetId($id = '')
1653         {
1654                 $this->currentWidgetId = $id;
1655         }
1656         /**
1657          * 現在処理中のウィジェット
1658          */
1659         public function getCurrentWidgetId()
1660         {
1661                 return $this->currentWidgetId;
1662         }
1663         /**
1664          * 現在処理中のインナーウィジェット
1665          */
1666         public function setCurrentIWidgetId($id = '')
1667         {
1668                 $this->currentIWidgetId = $id;
1669         }
1670         /**
1671          * 現在処理中のインナーウィジェット
1672          */
1673         public function getCurrentIWidgetId()
1674         {
1675                 return $this->currentIWidgetId;
1676         }
1677         /**
1678          * 現在作成中のウィジェットの定義ID
1679          *
1680          * @param int,string $id                定義ID(定義なしの場合は空文字列。それ以外の場合はint型の値。)
1681          */
1682         public function setCurrentWidgetConfigId($id)
1683         {
1684                 $this->currentWidgetConfigId = $id;
1685         }
1686         /**
1687          * 現在作成中のウィジェットの定義ID
1688          *
1689          * @return int,string                   定義ID(定義なしの場合は空文字列。それ以外の場合はint型の値。)
1690          */
1691         public function getCurrentWidgetConfigId()
1692         {
1693                 return $this->currentWidgetConfigId;
1694         }
1695         /**
1696          * 現在作成中のインナーウィジェットの定義ID
1697          *
1698          * @param in,string $id         定義ID(定義なしの場合は空文字列。それ以外の場合はint型の値。)
1699          */
1700         public function setCurrentIWidgetConfigId($id)
1701         {
1702                 $this->currentIWidgetConfigId = $id;
1703         }
1704         /**
1705          * 現在作成中のインナーウィジェットの定義ID
1706          *
1707          * @return int,string                   定義ID(定義なしの場合は空文字列。それ以外の場合はint型の値。)
1708          */
1709         public function getCurrentIWidgetConfigId()
1710         {
1711                 return $this->currentIWidgetConfigId;
1712         }
1713         /**
1714          * 現在処理中のウィジェットのプレフィックス文字列
1715          */
1716         public function setCurrentWidgetPrefix($val)
1717         {
1718                 $this->currentWidgetPrefix = $val;
1719         }
1720         /**
1721          * 現在処理中のウィジェットのプレフィックス文字列
1722          */
1723         public function getCurrentWidgetPrefix()
1724         {
1725                 return $this->currentWidgetPrefix;
1726         }
1727         /**
1728          * 現在処理中のウィジェットのヘッドタイトル文字列を設定
1729          *
1730          * @param string $val   タイトル文字列
1731          * @return                              なし
1732          */
1733         public function setCurrentWidgetHeadTitle($val)
1734         {
1735                 $this->currentWidgetHeadTitle = $val;
1736         }
1737         /**
1738          * 現在処理中のウィジェットのヘッドタイトル文字列を取得
1739          *
1740          * @return string       タイトル文字列
1741          */
1742         public function getCurrentWidgetHeadTitle()
1743         {
1744                 return $this->currentWidgetHeadTitle;
1745         }
1746         /**
1747          * 現在処理中のウィジェットのタイトル文字列
1748          *
1749          * @param string $val   タイトル文字列
1750          * @return                              なし
1751          */
1752         public function setCurrentWidgetTitle($val)
1753         {
1754                 $this->currentWidgetTitle = $val;
1755         }
1756         /**
1757          * 現在処理中のウィジェットのタイトル文字列
1758          *
1759          * @return string       タイトル文字列
1760          */
1761         public function getCurrentWidgetTitle()
1762         {
1763                 return $this->currentWidgetTitle;
1764         }
1765         /**
1766          * 現在処理中のウィジェットのパラメータ設定
1767          *
1768          * @param string $key   キー
1769          * @param string $val   値
1770          * @return                              なし
1771          */
1772         public function setCurrentWidgetParams($key, $val)
1773         {
1774                 $this->currentWidgetParams[$key] = $val;
1775         }
1776         /**
1777          * 現在処理中のウィジェットのパラメータから値取得
1778          *
1779          * @param string $key   キー
1780          * @return string               値
1781          */
1782         public function getCurrentWidgetParams($key)
1783         {
1784                 return $this->currentWidgetParams[$key];
1785         }
1786         /**
1787          * 現在処理中のウィジェットのスタイル文字列
1788          *
1789          * @param bool $val     スタイル文字列
1790          * @return                      なし
1791          */
1792         public function setCurrentWidgetStyle($val)
1793         {
1794                 $this->currentWidgetStyle = $val;
1795         }
1796         /**
1797          * 現在処理中のウィジェットのスタイル文字列
1798          *
1799          * @return string       スタイル文字列
1800          */
1801         public function getCurrentWidgetStyle()
1802         {
1803                 return $this->currentWidgetStyle;
1804         }
1805         /**
1806          * 現在作成中のウィジェットのJoomla用パラメータを設定
1807          *
1808          * @param array $val    Joomla用パラメータ
1809          * @return              なし
1810          */
1811         public function setCurrentWidgetJoomlaParam($val)
1812         {
1813                 $this->currentWidgetJoomlaParam = $val;
1814         }
1815         /**
1816          * 現在作成中のウィジェットのJoomla用パラメータを取得
1817          *
1818          * @return array        Joomla用パラメータ
1819          */
1820         public function getCurrentWidgetJoomlaParam()
1821         {
1822                 return $this->currentWidgetJoomlaParam;
1823         }
1824         /**
1825          * 現在作成中のウィジェットが共通ウィジェットかどうかを設定
1826          *
1827          * @param bool          $val    現在のウィジェットの共通ウィジェット状態
1828          */
1829         public function setIsCurrentWidgetShared($val)
1830         {
1831                 $this->isCurrentWidgetShared = $val;
1832         }
1833         /**
1834          * 現在作成中のウィジェットが共通ウィジェットかどうか
1835          */
1836         public function isCurrentWidgetShared()
1837         {
1838                 return $this->isCurrentWidgetShared;
1839         }
1840         /**
1841          * 現在処理を行っているページ定義のレコードのシリアル番号
1842          *
1843          * @param int $serial           シリアル番号
1844          */
1845         public function setCurrentPageDefSerial($serial)
1846         {
1847                 $this->currentPageDefSerial = $serial;
1848         }
1849         /**
1850          * 現在処理を行っているページ定義のレコードのシリアル番号
1851          *
1852          * @return int                  シリアル番号
1853          */
1854         public function getCurrentPageDefSerial()
1855         {
1856                 return $this->currentPageDefSerial;
1857         }
1858         /**
1859          * 現在処理を行っているページ定義レコードを設定
1860          *
1861          * @param array $rec                    ページ定義レコード
1862          * @return                                              なし
1863          */
1864         public function setCurrentPageDefRec($rec = null)
1865         {
1866                 $this->currentPageDefRec = $rec;
1867         }
1868         /**
1869          * 現在処理を行っているページ定義レコードを取得
1870          *
1871          * @return array                        ページ定義レコード
1872          */
1873         public function getCurrentPageDefRec()
1874         {
1875                 return $this->currentPageDefRec;
1876         }
1877         // ##################### ユーザ情報 #####################
1878         /**
1879          * 現在アクセス中のユーザ情報取得
1880          *
1881          * @return UserInfo             ユーザ情報。設定されていない場合はnullを返す。
1882          */
1883         public function getCurrentUserInfo()
1884         {
1885                 global $gInstanceManager;
1886
1887                 return $gInstanceManager->getUserInfo();
1888         }
1889         /**
1890          * 現在アクセス中のユーザID取得
1891          *
1892          * @return int          ユーザID,ユーザが確定できないときは0
1893          */
1894         public function getCurrentUserId()
1895         {
1896                 global $gInstanceManager;
1897
1898                 $userInfo = $gInstanceManager->getUserInfo();
1899                 if (is_null($userInfo)){                // ログインしていない場合
1900                         return 0;
1901                 } else {
1902                         return $userInfo->userId;
1903                 }
1904         }
1905         /**
1906          * 現在アクセス中のユーザのアカウント取得
1907          *
1908          * @return string               ユーザアカウント,ユーザが確定できないときは空文字列
1909          */
1910         public function getCurrentUserAccount()
1911         {
1912                 global $gInstanceManager;
1913
1914                 $userInfo = $gInstanceManager->getUserInfo();
1915                 if (is_null($userInfo)){                // ログインしていない場合
1916                         return '';
1917                 } else {
1918                         return $userInfo->account;
1919                 }
1920         }
1921         /**
1922          * 現在アクセス中のユーザの名前を取得
1923          *
1924          * @return string               ユーザ名,ユーザが確定できないときは空文字列
1925          */
1926         public function getCurrentUserName()
1927         {
1928                 global $gInstanceManager;
1929
1930                 $userInfo = $gInstanceManager->getUserInfo();
1931                 if (is_null($userInfo)){                // ログインしていない場合
1932                         return '';
1933                 } else {
1934                         return $userInfo->name;
1935                 }
1936         }
1937         /**
1938          * 現在アクセス中のユーザのタイプを取得
1939          *
1940          * @return int          ユーザ名,ユーザが確定できないときは0
1941          */
1942         public function getCurrentUserType()
1943         {
1944                 global $gInstanceManager;
1945
1946                 $userInfo = $gInstanceManager->getUserInfo();
1947                 if (is_null($userInfo)){                // ログインしていない場合
1948                         return 0;
1949                 } else {
1950                         return $userInfo->userType;
1951                 }
1952         }
1953         /**
1954          * 現在アクセス中のユーザのEメールを取得
1955          *
1956          * @return string               Eメールが確定できないときは空文字列
1957          */
1958         public function getCurrentUserEmail()
1959         {
1960                 global $gInstanceManager;
1961
1962                 $userInfo = $gInstanceManager->getUserInfo();
1963                 if (is_null($userInfo)){                // ログインしていない場合
1964                         return '';
1965                 } else {
1966                         return $userInfo->email;
1967                 }
1968         }
1969         /**
1970          * 現在のユーザがアクセス可能なウィジェットを取得
1971          *
1972          * @return array                ウィジェット
1973          */
1974 /*      public function getAccessableWidget()
1975         {
1976                 global $gInstanceManager;
1977
1978                 $userInfo = $gInstanceManager->getUserInfo();
1979                 if (is_null($userInfo)){                // ログインしていない場合
1980                         return array();
1981                 } else {
1982                         return $userInfo->adminWidget;
1983                 }
1984         }*/
1985         /**
1986          * 現在のユーザが指定のウィジェットの管理画面が使用可能かを取得
1987          *
1988          * @param string $widgetId      ウィジェットID
1989          * @return bool                         true=使用可能、false=使用不可
1990          */
1991         public function canUseWidgetAdmin($widgetId)
1992         {
1993                 global $gInstanceManager;
1994
1995                 $canUseAdmin = false;
1996                 $userInfo = $gInstanceManager->getUserInfo();
1997                 if (!is_null($userInfo)){               // ログイン中の場合
1998                         if ($userInfo->userType == UserInfo::USER_TYPE_SYS_ADMIN){      // システム管理者の場合
1999                                 $canUseAdmin = true;
2000                         } else if ($userInfo->userType == UserInfo::USER_TYPE_MANAGER){ // システム運用者の場合
2001                                 $accessWidget = $userInfo->adminWidget;
2002                                 if (empty($accessWidget)){
2003                                         $canUseAdmin = true;
2004                                 } else {
2005                                         if (in_array($widgetId, $accessWidget)) $canUseAdmin = true;
2006                                 }
2007                         }
2008                 }
2009                 return $canUseAdmin;
2010         }
2011         /**
2012          * 現在のユーザがユーザタイプオプションを持っているかを取得
2013          *
2014          * @param string $option        ユーザタイプオプション
2015          * @return bool                         true=オプションあり、false=オプションなし
2016          */
2017         public function hasUserTypeOption($option)
2018         {
2019                 global $gInstanceManager;
2020
2021                 $hasOption = false;
2022                 $userInfo = $gInstanceManager->getUserInfo();
2023                 if (!is_null($userInfo)){               // ログイン中の場合
2024                         if ($userInfo->userType == UserInfo::USER_TYPE_MANAGER){        // システム運用者の場合
2025                                 $pos = strpos($userInfo->userTypeOption, $option);
2026                                 if ($pos !== false) $hasOption = true;
2027                         }
2028                 }
2029                 return $hasOption;
2030         }
2031         /**
2032          * 現在アクセス中のユーザに管理者権限があるかどうかを返す
2033          *
2034          * @return bool         true=ログイン中かつ管理者権限あり、false=未ログインまたはログイン中であるが管理者権限なし
2035          */
2036         public function isSystemAdmin()
2037         {
2038                 $isAdmin = false;
2039                 $userInfo = $this->getCurrentUserInfo();
2040                 if (is_null($userInfo)){                // ログインしていない場合
2041                 } else {
2042                         if ($userInfo->isSystemAdmin()){        // システム管理者の場合
2043                                 $isAdmin = true;
2044                         }
2045                 }
2046                 return $isAdmin;
2047         }
2048         /**
2049          * 現在アクセス中のユーザにシステム運用者かどうかを返す
2050          *
2051          * @param string $optionType    ユーザオプションタイプ
2052          * @return bool                                 true=システム運用者、false=システム運用者ではない
2053          */
2054         public function isSystemManager(&$optionType = NULL)
2055         {
2056                 $isManager = false;
2057                 $userInfo = $this->getCurrentUserInfo();
2058                 if (is_null($userInfo)){                // ログインしていない場合
2059                 } else {
2060                         if ($userInfo->userType == UserInfo::USER_TYPE_MANAGER){        // システム運用者の場合
2061                                 $optionType = $userInfo->userOptType;
2062                                 $isManager = true;
2063                         }
2064                 }
2065                 return $isManager;
2066         }
2067         /**
2068          * 現在アクセス中のユーザにシステム運用権限があるかどうかを返す
2069          *
2070          * @return bool         true=システム運用可、false=システム運用不可
2071          */
2072         public function isSystemManageUser()
2073         {
2074                 $canManage = false;
2075                 $userInfo = $this->getCurrentUserInfo();
2076                 if (is_null($userInfo)){                // ログインしていない場合
2077                 } else {
2078                         if ($userInfo->userType >= UserInfo::USER_TYPE_MANAGER){        // システム運用者以上の場合
2079                                 $canManage = true;
2080                         }
2081                 }
2082                 return $canManage;
2083         }
2084         /**
2085          * 現在アクセス中のユーザにコンテンツ編集権限があるかどうかを返す
2086          *
2087          * @return bool         true=コンテンツ編集可、false=コンテンツ編集不可
2088          */
2089         public function isContentEditableUser()
2090         {
2091                 $canManage = false;
2092                 $userInfo = $this->getCurrentUserInfo();
2093                 if (is_null($userInfo)){                // ログインしていない場合
2094                 } else {
2095                         if ($userInfo->userType >= UserInfo::USER_TYPE_AUTHOR){ // 投稿ユーザ以上の場合
2096                                 $canManage = true;
2097                         }
2098                 }
2099                 return $canManage;
2100         }
2101         /**
2102          * 現在アクセス中のユーザがリソース制限必要なユーザかどうかを返す
2103          *
2104          * @return bool         true=制限が必要、false=制限なし
2105          */
2106         public function isResourceLimitedUser()
2107         {
2108                 global $gInstanceManager;
2109
2110                 $resourceLimited = true;                // デフォルトはリソース制限あり
2111                 $userInfo = $gInstanceManager->getUserInfo();
2112 /*              if (!is_null($userInfo)){               // ログイン中の場合
2113                         if ($userInfo->userType == UserInfo::USER_TYPE_SYS_ADMIN){      // システム管理者の場合
2114                                 $resourceLimited = false;
2115                         } else if ($userInfo->userType == UserInfo::USER_TYPE_MANAGER && empty($userInfo->userOptType)){                        // システム運用者でユーザタイプオプションがない場合
2116                                 $resourceLimited = false;
2117                         }
2118                 }*/
2119                 // リソースアクセス制限はページマネージャーのパーソナルモード時と同じにする
2120                 if (!empty($userInfo)) $resourceLimited = $userInfo->isPersonal();
2121                 return $resourceLimited;
2122         }
2123         /**
2124          * 現在アクセス中のユーザがログインしているか確認
2125          *
2126          * @return bool         true=ログイン中、false=未ログイン
2127          */
2128         public function isCurrentUserLogined()
2129         {
2130                 $userInfo = $this->getCurrentUserInfo();
2131                 if (is_null($userInfo)){                // ログインしていない場合
2132                         return false;
2133                 } else {
2134                         return true;
2135                 }
2136         }
2137         /**
2138          * 指定のユーザに管理者権限があるかどうかを返す
2139          *
2140          * @param int $userId   ユーザID
2141          * @return bool                 true=管理者権限あり、false=管理者権限なし
2142          */
2143         public function isSystemAdminUser($userId)
2144         {
2145                 return $this->db->isSystemAdmin($userId);
2146         }
2147         // ##################### アクセスログ #####################
2148         /**
2149          * 現在のアクセスログのシリアル番号を返す
2150          *
2151          * @return int                  アクセスログシリアル番号
2152          */
2153         public function getCurrentAccessLogSerial()
2154         {
2155                 global $gAccessManager;
2156                 return $gAccessManager->getAccessLogSerialNo();
2157         }
2158         /**
2159          * アクセスポイントパスを設定
2160          *
2161          * @param string $path          アクセスポイントパス
2162          * @return なし
2163          */
2164         public function setAccessPath($path)
2165         {
2166                 $this->accessPath = $path;              // アクセスポイントパス
2167                 $pathArray = explode('/', $path);
2168                 if (count($pathArray) >= 2){
2169                         $this->accessDir = $pathArray[0];                       // アクセスポイントディレクトリ
2170                 } else {
2171                         $this->accessDir = '';
2172                 }
2173         }
2174         /**
2175          * アクセスポイントパスを取得
2176          *
2177          * @return string                       アクセスポイントパス
2178          */
2179         public function getAccessPath()
2180         {
2181                 return $this->accessPath;
2182         }
2183         /**
2184          * アクセスポイントディレクトリを取得
2185          *
2186          * @return string                       アクセスポイントディレクトリ
2187          */
2188         public function getAccessDir()
2189         {
2190                 return $this->accessDir;
2191         }
2192         // ##################### ページ制御 #####################
2193         /**
2194          * デフォルトのページID取得
2195          *
2196          * @return string                       デフォルトのページID
2197          */
2198         public function getDefaultPageId()
2199         {
2200                 return self::DEFAULT_PAGE_ID;
2201         }
2202         /**
2203          * デフォルトの登録機能用ページID
2204          *
2205          * @return string                       デフォルトのページID
2206          */
2207         public function getDefaultRegistPageId()
2208         {
2209                 return self::DEFAULT_REGIST_PAGE_ID;
2210         }
2211         /**
2212          * 携帯用デフォルトのページID取得
2213          *
2214          * @return string                       携帯用デフォルトのページID
2215          */
2216         public function getDefaultMobilePageId()
2217         {
2218                 return self::DEFAULT_MOBILE_PAGE_ID;
2219         }
2220         /**
2221          * スマートフォン用デフォルトのページID取得
2222          *
2223          * @return string                       スマートフォン用デフォルトのページID
2224          */
2225         public function getDefaultSmartphonePageId()
2226         {
2227                 return self::DEFAULT_SMARTPHONE_PAGE_ID;
2228         }
2229         /**
2230          * デフォルトの管理機能用ページID取得
2231          *
2232          * @return string                       デフォルトの管理機能用ページID
2233          */
2234         public function getDefaultAdminPageId()
2235         {
2236                 return self::DEFAULT_ADMIN_PAGE_ID;
2237         }
2238         /**
2239          * フロント画面のデフォルトのページID取得
2240          *
2241          * @return array                        ページID(0=PC,1=携帯,2=スマートフォン)
2242          */
2243         public function getAllDefaultPageId()
2244         {
2245                 return array(self::DEFAULT_PAGE_ID, self::DEFAULT_MOBILE_PAGE_ID, self::DEFAULT_SMARTPHONE_PAGE_ID);
2246         }
2247         /**
2248          * フロント画面のデフォルトのアクセスポイント取得
2249          *
2250          * @return array                        アクセスポイント(0=PC,1=携帯,2=スマートフォン)
2251          */
2252         public function getAllDefaultAccessPoint()
2253         {
2254                 return array('', M3_DIR_NAME_MOBILE, M3_DIR_NAME_SMARTPHONE);
2255         }
2256         /**
2257          * 現在のアクセスポイント取得
2258          *
2259          * @return string                       アクセスポイント(空文字列=PC,m=携帯,s=スマートフォン)
2260          */
2261         public function getCurrentAccessPoint()
2262         {
2263                 $accessPoint = '';
2264                 
2265                 switch ($this->currentPageId){
2266                 case self::DEFAULT_PAGE_ID:
2267                 default:
2268                         break;
2269                 case self::DEFAULT_MOBILE_PAGE_ID:
2270                         $accessPoint = M3_DIR_NAME_MOBILE;
2271                         break;
2272                 case self::DEFAULT_SMARTPHONE_PAGE_ID:
2273                         $accessPoint = DEFAULT_SMARTPHONE_PAGE_ID;
2274                         break;
2275                 }
2276                 return $accessPoint;
2277         }
2278         /**
2279          * 現在のページID
2280          */
2281         public function setCurrentPageId($id)
2282         {
2283                 // 現在のページIDが変更のときは、デフォルトのページサブIDを更新
2284                 if ($this->canUseDb && $this->currentPageId != $id){
2285                         $deviceType = 0;                // 端末タイプ取得
2286                         $this->defaultPageSubId = $this->db->getDefaultPageSubId($id, $deviceType);
2287                         $this->currentPageDeviceType = $deviceType;             // 現在のページの端末タイプ
2288                 }
2289                 $this->currentPageId = $id;
2290         }
2291         /**
2292          * 現在のページID
2293          */
2294         public function getCurrentPageId()
2295         {
2296                 return $this->currentPageId;
2297         }
2298         /**
2299          * 現在のページサブID
2300          */
2301         public function setCurrentPageSubId($id)
2302         {
2303                 $this->currentPageSubId = $id;
2304         }
2305         /**
2306          * 現在のページサブID
2307          */
2308         public function getCurrentPageSubId()
2309         {
2310                 return $this->currentPageSubId;
2311         }
2312         /**
2313          * 現在のページのデフォルトのページサブID
2314          *
2315          * @return string               デフォルトのページサブID
2316          */
2317         public function getDefaultPageSubId()
2318         {
2319                 return $this->defaultPageSubId;
2320         }
2321         /**
2322          * 管理画面のデフォルトのページサブID
2323          *
2324          * @return string               デフォルトのページサブID
2325          */
2326         public function getAdminDefaultPageSubId()
2327         {
2328                 return $this->getDefaultPageSubIdByPageId(self::DEFAULT_ADMIN_PAGE_ID);
2329         }
2330         /**
2331          * 指定ページのデフォルトのページサブID
2332          *
2333          * @param string $pageId        ページID
2334          * @return string                       デフォルトのページサブID
2335          */
2336         public function getDefaultPageSubIdByPageId($pageId)
2337         {
2338                 return $this->db->getDefaultPageSubId($pageId);
2339         }
2340         /**
2341          * 現在実行中のウィジェット用のページサブID取得
2342          *
2343          * @return string               ページサブID。共通属性ありの場合、現在のページサブIDがデフォルトページサブIDと同じときは空。
2344          */
2345         public function getCurrentWidgetPageSubId()
2346         {
2347                 if ($this->isCurrentWidgetShared) return '';            // 共通属性ありの場合
2348                 
2349                 if ($this->currentPageSubId == $this->defaultPageSubId) return '';
2350                 
2351                 return $this->currentPageSubId;
2352         }
2353         /**
2354          * コンテンツ種別からデフォルトのページサブID取得
2355          *
2356          * @param string $pageId                ページID
2357          * @param string $contentType   コンテンツ種別    * @return string                               ページサブID
2358          */
2359         public function getPageSubIdByContentType($pageId, $contentType)
2360         {
2361                 $pageSubId = $this->db->getSubPageIdWithContent($contentType, $pageId);// ページサブIDを取得
2362                 return $pageSubId;
2363         }
2364         /**
2365          * 現在のページの端末タイプを取得
2366          *
2367          * @return string               端末タイプ(0=PC、1=携帯、2=スマートフォン)
2368          */
2369         public function getCurrentPageDeviceType()
2370         {
2371                 return $this->currentPageDeviceType;            // 現在のページの端末タイプ
2372         }
2373         /**
2374          * 現在のページID、サブページIDのURLを作成
2375          *
2376          * @param bool          $withPageSubId          ページサブIDを付加するかどうか
2377          * @return string               作成したURL
2378          */
2379         public function createCurrentPageUrl($withPageSubId = true)
2380         {
2381                 $url = $this->createPageUrl();
2382                 if ($withPageSubId) $url .= '?sub=' . $this->getCurrentPageSubId();
2383                 return $url;
2384         }
2385         /**
2386          * 指定ページIDのURLを作成
2387          *
2388          * @param string $pageId        ページID。空のときは現在のページIDから作成
2389          * @param string $isSslPage     SSLが必要なページかどうか
2390          * @return string                       作成したURL
2391          */
2392         public function createPageUrl($pageId='', $isSslPage = false)
2393         {
2394                 if (empty($pageId)) $pageId = $this->getCurrentPageId();
2395                 if (empty($pageId)) $pageId = $this->getDefaultPageId();// 空のときはデフォルトページIDを設定
2396                 
2397                 // ページIDからパスを求める
2398                 $path = '';
2399                 $pathArray = explode('_', $pageId);
2400                 if ($this->multiDomain){                        // マルチドメイン運用の場合
2401                         $path = '/' . $pathArray[count($pathArray) - 1];
2402                 } else {
2403                         for ($i = 0; $i < count($pathArray); $i++){
2404                                 $path .= '/' . $pathArray[$i];
2405                         }
2406                 }
2407                 if ($isSslPage){                        // SSLページのとき
2408                         $url = $this->getSslRootUrl() . $path . '.php';
2409                 } else {
2410                         $url = $this->getRootUrl() . $path . '.php';
2411                 }
2412                 return $url;
2413         }
2414         /**
2415          * 現在のページID、サブページIDのURLを作成(セッションID付き)
2416          *
2417          * @return string               作成したURL
2418          */
2419         /*public function createCurrentPageUrlWithSessionId()
2420         {
2421                 return $this->getCurrentScriptUrl() . '?sub=' . $this->getCurrentPageSubId() . '&' . session_name() . '=' . session_id();
2422         }*/
2423         /**
2424          * 携帯用の現在のページID、サブページIDのURLを作成
2425          *
2426          * 携帯用URLには以下の情報を付加する
2427          * ・セッションID
2428          * ・ドコモ端末の場合はiモードID受信用のパラメータを付加
2429          *
2430          * @param string,array  $addParam               追加パラメータ
2431          * @param bool          $withSessionId  セッションIDを付加するかどうか
2432          * @return string               作成したURL
2433          */
2434         public function createCurrentPageUrlForMobile($addParam = '', $withSessionId = true)
2435         {
2436                 // 携帯用パラメータ取得
2437                 $param = $this->_getMobileUrlParam($withSessionId);
2438                 
2439                 // ページサブID付加
2440                 $param['sub'] = $this->getCurrentPageSubId();
2441
2442                 // 追加パラメータがある場合
2443                 if (!empty($addParam)){
2444                         if (is_array($addParam)){               // 配列の場合
2445                                 $newParam = $addParam;
2446                         } else {                // 文字列の場合
2447                                 $newParam = array();
2448                                 $addParamArray = explode('&', trim($addParam, "?&"));
2449                                 for ($i = 0; $i < count($addParamArray); $i++){
2450                                         list($key, $value) = explode('=', $addParamArray[$i]);
2451                                         $key = trim($key);
2452                                         $value = trim($value);
2453                                         $newParam[$key] = $value;
2454                                 }
2455                         }
2456                         $param = array_merge($param, $newParam);
2457                 }
2458                 //$url = $this->_createUrl($this->getCurrentScriptUrl(), $param);
2459                 $url = createUrl($this->createPageUrl(), $param);
2460                 return $url;
2461         }
2462         /**
2463          * デフォルト言語取得
2464          */
2465         public function getDefaultLanguage()
2466         {
2467                 return $this->defaultLanguage;
2468         }
2469         /**
2470          * デフォルトの言語名をカレントの言語で表したもの
2471          */
2472         public function getDefaultLanguageNameByCurrentLanguage()
2473         {
2474                 return $this->db->getLanguageNameByDispLanguageId($this->defaultLanguage, $this->currentLanguage);
2475         }
2476         /**
2477          * カレント言語取得
2478          */
2479         public function getCurrentLanguage()
2480         {
2481                 return $this->currentLanguage;
2482         }
2483         /**
2484          * カレント言語設定
2485          */
2486         public function setCurrentLanguage($value)
2487         {
2488                 $this->currentLanguage = $value;
2489                 
2490                 // ロケールも変更
2491                 $locale = $this->defaultLacaleArray[$value];
2492                 if (!empty($locale)) $this->currentLocale = $locale;
2493         }
2494         /**
2495          * デフォルトロケール取得
2496          */
2497         public function getDefaultLocale()
2498         {
2499                 return $this->defaultLocale;
2500         }
2501         /**
2502          * カレントロケール取得
2503          */
2504         public function getCurrentLocale()
2505         {
2506                 return $this->currentLocale;
2507         }
2508         /**
2509          * カレントロケール設定
2510          */
2511         public function setCurrentLocale($value)
2512         {
2513                 $this->currentLocale = $value;
2514         }
2515         /**
2516          * カレント言語の変更可否を取得
2517          */
2518         public function getCanChangeLang()
2519         {
2520                 return $this->canChangeLang;
2521         }
2522         /**
2523          * 多言語対応かどうかを取得(廃止予定 => isMultiLanguageSite())
2524          */
2525         public function getMultiLanguage()
2526         {
2527                 return $this->multiLanguage;
2528         }
2529         /**
2530          * 多言語対応サイトかどうかを取得
2531          */
2532         public function isMultiLanguageSite()
2533         {
2534                 return $this->multiLanguage;
2535         }
2536         /**
2537          * マルチドメイン運用かどうかを取得
2538          *
2539          * @param bool          true=マルチドメイン運用、false=シングルドメイン運用
2540          */
2541         public function isMultiDomain()
2542         {
2543                 return $this->multiDomain;              // マルチドメイン運用かどうか
2544         }
2545         /**
2546          * SSL機能を使用するかどうかを取得
2547          */
2548         public function getUseSsl()
2549         {
2550                 return $this->useSsl;
2551         }
2552         /**
2553          * 管理画面にSSL機能を使用するかどうかを取得
2554          */
2555         public function getUseSslAdmin()
2556         {
2557                 return $this->useSslAdmin;
2558         }
2559         /**
2560          * 携帯用の入出力エンコーディングを設定
2561          *
2562          * @param string                エンコーディング
2563          */
2564         public function setMobileEncoding($value)
2565         {
2566                 $this->mobileEncoding = $value;
2567         }
2568         /**
2569          * 携帯用の入出力エンコーディングを取得
2570          *
2571          * @return string               エンコーディング
2572          */
2573         public function getMobileEncoding()
2574         {
2575                 return $this->mobileEncoding;
2576         }
2577         /**
2578          * 携帯用HTML上のエンコーディング表記を設定
2579          *
2580          * @param string                エンコーディング
2581          */
2582         public function setMobileCharset($value)
2583         {
2584                 $this->mobileCharset = $value;
2585         }
2586         /**
2587          * 携帯用HTML上のエンコーディング表記を取得
2588          *
2589          * @return string               エンコーディング
2590          */
2591         public function getMobileCharset()
2592         {
2593                 return $this->mobileCharset;
2594         }
2595         /**
2596          * DBセッションが使用できるかどうか
2597          */
2598         public function canUseDbSession()
2599         {
2600                 return $this->canUseDbSession;
2601         }
2602         /**
2603          * DBが使用可能かどうか
2604          */
2605         public function canUseDb()
2606         {
2607                 return $this->canUseDb;
2608         }
2609         /**
2610          * クッキーが使用可能かどうかを設定
2611          *
2612          * @param bool                  true=使用可、false=使用不可
2613          * @return                              なし
2614          */
2615         public function setCanUseCookie($value)
2616         {
2617                 $this->canUseCookie = $value;
2618         }
2619         /**
2620          * クッキーが使用可能かどうか
2621          *
2622          * @return bool                 true=使用可、false=使用不可
2623          */
2624         public function canUseCookie()
2625         {
2626                 return $this->canUseCookie;
2627         }
2628         /**
2629          * Timestamp型データの初期値を取得
2630          *
2631          * @param string Timestmp型初期データ文字列
2632          */
2633         public function getInitValueOfTimestamp()
2634         {
2635                 if ($this->db->getDbType() == M3_DB_TYPE_MYSQL){                // MySQLの場合
2636                         return M3_TIMESTAMP_INIT_VALUE_MYSQL;
2637                 } else if ($this->db->getDbType() == M3_DB_TYPE_PGSQL){
2638                         return M3_TIMESTAMP_INIT_VALUE_PGSQL;
2639                 } else {
2640                         return '';
2641                 }
2642         }
2643         /**
2644          * Date型データの初期値を取得
2645          *
2646          * @param string Date型初期データ文字列
2647          */
2648         public function getInitValueOfDate()
2649         {
2650                 if ($this->db->getDbType() == M3_DB_TYPE_MYSQL){                // MySQLの場合
2651                         return M3_DATE_INIT_VALUE_MYSQL;
2652                 } else if ($this->db->getDbType() == M3_DB_TYPE_PGSQL){
2653                         return M3_DATE_INIT_VALUE_PGSQL;
2654                 } else {
2655                         return '';
2656                 }
2657         }
2658         /**
2659          * サイトの名称を取得
2660          *
2661          * @param bool $reload  データを再取得するかどうか
2662          * @return string               サイト名称
2663          */
2664         public function getSiteName($reload = false)
2665         {
2666                 // DBが使用不可のときはデフォルト名を返す
2667                 if (!$this->canUseDb) return self::DEFAULT_SITE_NAME;
2668                 
2669                 if ($reload || empty($this->siteName)){                 // サイト名称
2670                         $this->siteName = $this->gSystem->getSiteDef(M3_TB_FIELD_SITE_NAME);
2671                         if (empty($this->siteName)) $this->siteName = self::DEFAULT_SITE_NAME;
2672                 }
2673                 return $this->siteName;
2674         }
2675         /**
2676          * サイトの所有者を取得
2677          *
2678          * @param bool $reload  データを再取得するかどうか
2679          * @return string               サイト所有者
2680          */
2681         public function getSiteOwner($reload = false)
2682         {
2683                 // DBが使用不可のときは空文字列を返す
2684                 if (!$this->canUseDb) return '';
2685                 
2686                 if ($reload || empty($this->siteOwner)){                        // サイト所有者
2687                         $this->siteOwner = $this->gSystem->getSiteDef(M3_TB_FIELD_SITE_OWNER);
2688                 }
2689                 return $this->siteOwner;
2690         }
2691         /**
2692          * サイトコピーライトを取得
2693          *
2694          * @param bool $reload  データを再取得するかどうか
2695          * @return string               サイトコピーライト
2696          */
2697         public function getSiteCopyRight($reload = false)
2698         {
2699                 // DBが使用不可のときは空文字列を返す
2700                 if (!$this->canUseDb) return '';
2701                 
2702                 if ($reload || empty($this->siteCopyRight)){                    // サイトコピーライト
2703                         $this->siteCopyRight = $this->gSystem->getSiteDef(M3_TB_FIELD_SITE_COPYRIGHT);
2704                 }
2705                 return $this->siteCopyRight;
2706         }
2707         /**
2708          * サイトEメールを取得
2709          *
2710          * @param bool $reload  データを再取得するかどうか
2711          * @return string               サイトEメール
2712          */
2713         public function getSiteEmail($reload = false)
2714         {
2715                 // DBが使用不可のときは空文字列を返す
2716                 if (!$this->canUseDb) return '';
2717                 
2718                 if ($reload || empty($this->siteEmail)){                        // サイトEメール
2719                         $this->siteEmail = $this->gSystem->getSiteDef(M3_TB_FIELD_SITE_EMAIL);
2720                 }
2721                 return $this->siteEmail;
2722         }
2723         /**
2724          * 現在選択中のメニュー項目を設定
2725          *
2726          * @param array $menuItemData   メニュー項目データ(title=タイトル、url=リンク)の配列
2727          * @return                                              なし
2728          */
2729         public function setSelectedMenuItems($menuItemData)
2730         {
2731                 $this->selectedMenuItems = $menuItemData;                               // 現在選択中のメニュー項目
2732         }
2733         /**
2734          * 現在選択中のメニュー項目を取得
2735          *
2736          * @return array                                メニュー項目データ(title=タイトル、url=リンク)
2737          */
2738         public function getSelectedMenuItems()
2739         {
2740                 return $this->selectedMenuItems;                                // 現在選択中のメニュー項目
2741         }
2742         /**
2743          * デフォルトCSV区切り文字コードを取得
2744          *
2745          * @return string               区切り文字
2746          */
2747         public function getDefaultCsvDelimCode()
2748         {
2749                 static $code;
2750                 
2751                 if (!isset($code)){             // 設定されていないとき
2752                         $retValue = $this->gSystem->getSystemConfig(self::DEFAULT_CSV_DELIM_CODE);
2753                         if (empty($retValue)){
2754                                 $code = ',';
2755                         } else {
2756                                 $code = $retValue;
2757                         }
2758                 }
2759                 return $code;
2760         }
2761         /**
2762          * デフォルトCSV改行コードを取得
2763          *
2764          * @return string               改行文字
2765          */
2766         public function getDefaultCsvNLCode()
2767         {
2768                 static $code;
2769                 
2770                 if (!isset($code)){             // 設定されていないとき
2771                         $retValue = $this->gSystem->getSystemConfig(self::DEFAULT_CSV_NL_CODE);
2772                         if (empty($retValue)){
2773                                 $code = '\r\n';
2774                         } else {
2775                                 $code = $retValue;
2776                         }
2777                 }
2778                 return $code;
2779         }
2780         /**
2781          * デフォルトCSVファイル拡張子を取得
2782          *
2783          * @return string               改行文字
2784          */
2785         public function getDefaultCsvFileSuffix()
2786         {
2787                 return $this->gSystem->getSystemConfig(self::DEFAULT_CSV_FILE_SUFFIX);
2788         }
2789         /**
2790          * CSVファイルのダウンロードエンコーディングを取得
2791          *
2792          * @return string               エンコーディング
2793          */
2794         public function getCsvDownloadEncoding()
2795         {
2796                 static $encoding;
2797                 
2798                 if (!isset($encoding)){         // 設定されていないとき
2799                         $retValue = $this->gSystem->getSystemConfig(self::CF_CSV_DOWNLOAD_ENCODING);
2800                         if (empty($retValue)){
2801                                 $encoding = 'SJIS-win';
2802                         } else {
2803                                 $encoding = $retValue;
2804                         }
2805                 }
2806                 return $encoding;
2807         }
2808         /**
2809          * CSVファイルのアップロードロードエンコーディングを取得
2810          *
2811          * @return string               エンコーディング
2812          */
2813         public function getCsvUploadEncoding()
2814         {
2815                 static $encoding;
2816                 
2817                 if (!isset($encoding)){         // 設定されていないとき
2818                         $retValue = $this->gSystem->getSystemConfig(self::CF_CSV_UPLOAD_ENCODING);
2819                         if (empty($retValue)){
2820                                 $encoding = 'SJIS-win';
2821                         } else {
2822                                 $encoding = $retValue;
2823                         }
2824                 }
2825                 return $encoding;
2826         }
2827         /**
2828          * ウィジェット実行ログを残すかどうか
2829          *
2830          * @return bool         true=ログ出力、false=ログ出力しない
2831          */
2832         public function getWidgetLog()
2833         {
2834                 return $this->widgetLog;
2835         }
2836         /**
2837          * PC用URLへのアクセスかどうかを設定(管理画面はPC用URLとしない)
2838          *
2839          * @param bool $status                  true=PC用アクセス、false=PC用管理画面のアクセス
2840          * @return                      なし
2841          */
2842         public function setIsPcSite($status)
2843         {
2844                 $this->isPcSite = $status;
2845         }
2846         /**
2847          * PC用URLへのアクセスかどうか(管理画面はPC用URLとしない)
2848          *
2849          * @return bool         true=PC用アクセス、false=PC用管理画面のアクセス
2850          */
2851         public function getIsPcSite()
2852         {
2853                 return $this->isPcSite;
2854         }
2855         /**
2856          * 携帯用URLへのアクセスかどうかを設定
2857          *
2858          * @param bool $status                  true=携帯アクセス、false=通常アクセス
2859          * @return                      なし
2860          */
2861         public function setIsMobileSite($status)
2862         {
2863                 $this->isMobileSite = $status;
2864                 
2865                 if ($this->isMobile() && $status){
2866                         // ##### 携帯用の設定 #####
2867                         // セッションをURLに保存
2868                         ini_set('session.use_cookies', 0);      // クッキーは使用しない
2869                 }
2870         }
2871         /**
2872          * 携帯用URLへのアクセスかどうか
2873          *
2874          * @return bool         true=携帯アクセス、false=通常アクセス
2875          */
2876         public function getIsMobileSite()
2877         {
2878                 return $this->isMobileSite;
2879         }
2880         /**
2881          * スマートフォン用URLへのアクセスかどうかを設定
2882          *
2883          * @param bool $status                  true=スマートフォン用URLへのアクセス、false=スマートフォン用URL以外へのアクセス
2884          * @return                      なし
2885          */
2886         public function setIsSmartphoneSite($status)
2887         {
2888                 $this->isSmartphoneSite = $status;
2889         }
2890         /**
2891          * スマートフォン用URLへのアクセスかどうか
2892          *
2893          * @return bool         true=スマートフォン用URLへのアクセス、false=スマートフォン用URL以外へのアクセス
2894          */
2895         public function getIsSmartphoneSite()
2896         {
2897                 return $this->isSmartphoneSite;
2898         }
2899         /**
2900          * サブウィジェットの起動かどうかを設定
2901          *
2902          * @param bool $status                  true=サブウィジェットでの起動、false=通常のウィジェット起動
2903          * @return                      なし
2904          */
2905         public function setIsSubWidget($status)
2906         {
2907                 $this->isSubWidget = $status;
2908         }
2909         /**
2910          * サブウィジェットの起動かどうか
2911          *
2912          * @return bool         true=サブウィジェットでの起動、false=通常のウィジェット起動
2913          */
2914         public function getIsSubWidget()
2915         {
2916                 return $this->isSubWidget;
2917         }
2918         /**
2919          * サーバ接続かどうかを設定
2920          *
2921          * @param bool $status                  true=サーバ接続、false=サーバ接続でない
2922          * @return                      なし
2923          */
2924         public function setIsServerConnector($status)
2925         {
2926                 $this->isServerConnector = $status;
2927         }
2928         /**
2929          * サーバ接続かどうか
2930          *
2931          * @return bool         true=サーバ接続、false=サーバ接続でない
2932          */
2933         public function isServerConnector()
2934         {
2935                 return $this->isServerConnector;
2936         }
2937         /**
2938          * 携帯端末IDを取得
2939          *
2940          * @return string               携帯端末ID
2941          */
2942         public function getMobileId()
2943         {
2944                 global $gInstanceManager;
2945                 global $gRequestManager;
2946                 
2947                 $agent = $gInstanceManager->getMobileAgent();
2948                 if ($agent->isDoCoMo()){        // ドコモ端末のとき
2949                         $mobileId = $gRequestManager->trimServerValueOf('HTTP_X_DCMGUID');
2950                         if (!empty($mobileId)) $mobileId = 'DC-' . $mobileId;           // キャリアコードを付加
2951                 } else if ($agent->isEZweb()){  // au端末のとき
2952                         $mobileId = $gRequestManager->trimServerValueOf('HTTP_X_UP_SUBNO');
2953                         // ドメイン名を消去
2954                         $pos = strpos($mobileId, '.ezweb.ne.jp');
2955                         if ($pos !== false) $mobileId = substr($mobileId, 0, $pos);
2956                         if (!empty($mobileId)) $mobileId = 'AU-' . $mobileId;           // キャリアコードを付加
2957                 } else if ($agent->isSoftBank()){       // ソフトバンク端末のとき
2958                         $mobileId = $gRequestManager->trimServerValueOf('HTTP_X_JPHONE_UID');
2959                         if (!empty($mobileId)) $mobileId = 'SB-' . $mobileId;           // キャリアコードを付加
2960                 } else {                // その他の端末のとき(PC用)
2961                         $mobileId = '';
2962                 }
2963                 return $mobileId;
2964         }
2965         /**
2966          * 携帯端末でのアクセスかどうか
2967          *
2968          * @return bool         true=携帯端末アクセス、false=携帯端末以外からのアクセス
2969          */
2970         public function isMobile()
2971         {
2972                 global $gInstanceManager;
2973                 static $isMobile;
2974                 
2975                 if (!isset($isMobile)){
2976                         $isMobile = false;
2977                         $agent = $gInstanceManager->getMobileAgent();
2978                         if (method_exists($agent, 'isNonMobile')){
2979                                 if (!$agent->isNonMobile()){                    // 携帯端末でのアクセスの場合
2980                                         $isMobile = true;
2981                                 }
2982                         }
2983                 }
2984                 return $isMobile;
2985         }
2986         /**
2987          * スマートフォン端末でのアクセスかどうか
2988          *
2989          * @return bool         true=スマートフォン端末アクセス、false=スマートフォン端末以外からのアクセス
2990          */
2991         public function isSmartphone()
2992         {
2993                 global $gRequestManager;
2994                 static $isSmartphone;
2995                 
2996                 if (!isset($isSmartphone)){
2997                         $isSmartphone = false;
2998                         $agent = $gRequestManager->trimServerValueOf('HTTP_USER_AGENT');
2999                         if (preg_match('/android/i', $agent)){
3000                                 $isSmartphone = true;
3001                         } else if (preg_match('/ipod/i', $agent) || preg_match('/iphone/i', $agent)){
3002                                 $isSmartphone = true;
3003                         }
3004                 }
3005                 return $isSmartphone;
3006         }
3007         /**
3008          * 携帯用のURLパラメータを取得
3009          *
3010          * @param bool   $withSessionId セッションIDを付加するかどうか
3011          * @return array                                URLパラメータ
3012          */
3013         function _getMobileUrlParam($withSessionId = true)
3014         {
3015                 global $gInstanceManager;
3016                 
3017                 $param = array();
3018                 $agent = $gInstanceManager->getMobileAgent();
3019                 if (method_exists($agent, 'isNonMobile')){
3020                         if (!$agent->isNonMobile()){                    // 携帯端末でのアクセスの場合
3021                                 // ログインしている場合はセッションIDを付加(セッション管理機能が使用可能なときのみ)
3022                                 //if (!empty($this->mobileUseSession) && $this->isCurrentUserLogined()) $param[session_name()] = session_id();
3023                                 // ログイン状況に関わらずセッションIDを付加(セッション管理機能が使用可能なときのみ)
3024                                 if ($withSessionId && !empty($this->mobileUseSession)) $param[session_name()] = session_id();
3025                                         
3026                                 // ドコモ端末の場合はiモードIDを送信させる
3027                                 if ($agent->isDoCoMo()) $param['guid'] = 'ON';
3028                         }
3029                 }
3030                 return $param;
3031         }
3032         /**
3033          * 管理画面の小画面デバイス最適化を行うかどうか
3034          *
3035          * @return bool         true=最適化を行う、false=最適化を行わない
3036          */
3037         public function isSmallDeviceAdmin()
3038         {
3039                 static $isSmallDeviceAdmin;
3040                 
3041                 if (!isset($isSmallDeviceAdmin)){
3042                         // マルチデバイス最適化管理画面かどうか
3043                         $multiDeviceAdmin = $this->gSystem->getSystemConfig(self::CF_MULTI_DEVICE_ADMIN);
3044                         if ($multiDeviceAdmin){
3045                                 // 小画面デバイスかどうか判断
3046                                 require_once(M3_SYSTEM_LIB_PATH . self::DETECT_DEVICE_SCRIPT);
3047                                 
3048                                 $detect = new Mobile_Detect;
3049                                 if ($detect->isMobile() && !$detect->isTablet()){               // 小画面デバイスかどうか(モバイルかつタブレットではない)
3050                                         $isSmallDeviceAdmin = true;
3051                                 } else {
3052                                         $isSmallDeviceAdmin = false;
3053                                 }
3054                         } else {
3055                                 $isSmallDeviceAdmin = false;
3056                         }
3057                 }
3058                 return $isSmallDeviceAdmin;
3059         }
3060         /**
3061          * メニューの表示属性を設定
3062          *
3063          * @param array $attr           メニュー表示属性
3064          * @return                                      なし
3065          */
3066         public function setMenuAttr($attr)
3067         {
3068                 $this->menuAttr = $attr;
3069         }
3070         /**
3071          * メニューの表示属性を取得
3072          *
3073          * @return array                メニュー表示属性
3074          */
3075         public function getMenuAttr()
3076         {
3077                 return $this->menuAttr;
3078         }
3079         /**
3080          * Joomla!ドキュメントを設定
3081          *
3082          * @param object $doc                   Joomla!ドキュメントオブジェクト
3083          * @return                                              なし
3084          */
3085         public function setJoomlaDocument($text)
3086         {
3087                 $this->joomlaDocument = $text;
3088         }
3089         /**
3090          * Joomla!ドキュメントを取得
3091          *
3092          * @return object               Joomla!ドキュメントオブジェクト
3093          */
3094         public function getJoomlaDocument()
3095         {
3096                 return $this->joomlaDocument;
3097         }
3098         /**
3099          * Joomla!v1.5用メニューコンテンツを設定
3100          *
3101          * @param string $text                  メニューコンテンツ文字列
3102          * @return                      なし
3103          */
3104         public function setJoomlaMenuContent($text)
3105         {
3106                 $this->joomlaMenuContent = $text;
3107         }
3108         /**
3109          * Joomla!v1.5用メニューコンテンツを取得
3110          *
3111          * @return string               メニューコンテンツ文字列
3112          */
3113         public function getJoomlaMenuContent()
3114         {
3115                 return $this->joomlaMenuContent;
3116         }
3117         /**
3118          * Joomla!v2.5用メニュー階層データを設定
3119          *
3120          * @param array $menuData               メニュー階層データ
3121          * @return                                              なし
3122          */
3123         public function setJoomlaMenuData($menuData)
3124         {
3125                 $this->joomlaMenuData = $menuData;
3126         }
3127         /**
3128          * Joomla!v2.5用メニュー階層データを取得
3129          *
3130          * @return array                メニューデータ
3131          */
3132         public function getJoomlaMenuData()
3133         {
3134                 return $this->joomlaMenuData;
3135         }
3136         /**
3137          * Joomla!v2.5用ページ前後遷移データを設定
3138          *
3139          * @param array $navData                ページ遷移データ
3140          * @return                                              なし
3141          */
3142         public function setJoomlaPageNavData($navData)
3143         {
3144                 $this->joomlaPageNavData = $navData;
3145         }
3146         /**
3147          * Joomla!v2.5用ページ前後遷移データを取得
3148          *
3149          * @return array                ページ遷移データ
3150          */
3151         public function getJoomlaPageNavData()
3152         {
3153                 return $this->joomlaPageNavData;
3154         }
3155         /**
3156          * Joomla!v2.5用ページ番号遷移データを設定
3157          *
3158          * @param array $data           ページ遷移データ
3159          * @return                                      なし
3160          */
3161         public function setJoomlaPaginationData($data)
3162         {
3163                 $this->joomlaPaginationData = $data;
3164         }
3165         /**
3166          * Joomla!v2.5用ページ番号遷移データを取得
3167          *
3168          * @return array                ページ遷移データ
3169          */
3170         public function getJoomlaPaginationData()
3171         {
3172                 return $this->joomlaPaginationData;
3173         }
3174         /**
3175          * Joomla!用ビュー作成用データを設定
3176          *
3177          * @param array $viewData               ビュー作成データ
3178          * @return                                              なし
3179          */
3180         public function setJoomlaViewData($viewData)
3181         {
3182                 $this->joomlaViewData = $viewData;
3183         }
3184         /**
3185          * Joomla!用ビュー作成用データを取得
3186          *
3187          * @return array                ビュー作成データ
3188          */
3189         public function getJoomlaViewData()
3190         {
3191                 return $this->joomlaViewData;
3192         }
3193         /**
3194          * WordPressヘッダ部出力データ(Javascript)を設定
3195          *
3196          * @param string $headData              ヘッダ部出力データ
3197          * @return                                              なし
3198          */
3199         public function setWpHeadScriptsData($headData)
3200         {
3201                 $this->wpHeadScriptsData = $headData;
3202         }
3203         /**
3204          * WordPressヘッダ部出力データ(Javascript)を取得
3205          *
3206          * @return string                       ヘッダ部出力データ
3207          */
3208         public function getWpHeadScriptsData()
3209         {
3210                 return $this->wpHeadScriptsData;
3211         }
3212         /**
3213          * WordPressコンポーネント生成ファイルパスを設定
3214          *
3215          * @param string $path                  ファイルパス
3216          * @return                                              なし
3217          */
3218         public function setWpComponentPath($path)
3219         {
3220                 $this->wpComponentPath = $path;
3221         }
3222         /**
3223          * WordPressコンポーネント生成ファイルパスを取得
3224          *
3225          * @return string                       ファイルパス
3226          */
3227         public function getWpComponentPath()
3228         {
3229                 return $this->wpComponentPath;
3230         }
3231         /**
3232          * WordPressウィジェットクラス名を設定
3233          *
3234          * @param string $class                 クラス名
3235          * @return                                              なし
3236          */
3237         public function setWpWidgetClass($class)
3238         {
3239                 $this->wpWidgetClass = $class;
3240         }
3241         /**
3242          * WordPressウィジェットクラス名を取得
3243          *
3244          * @return string                       ファイルパス
3245          */
3246         public function getWpWidgetClass()
3247         {
3248                 return $this->wpWidgetClass;
3249         }
3250         /**
3251          * リモート表示コンテンツを設定
3252          *
3253          * @param string $position              配置ポジション名
3254          * @param string $data                  コンテンツデータ
3255          * @return                                              なし
3256          */
3257         public function setRemoteContent($position, $data)
3258         {
3259                 $this->remoteContent[$position] = $data;
3260         }
3261         /**
3262          * リモート表示コンテンツを取得
3263          *
3264          * @param string $position              配置ポジション名
3265          * @return string                               コンテンツデータ
3266          */
3267         public function getRemoteContent($position)
3268         {
3269                 return $this->remoteContent[$position];
3270         }
3271 }
3272 ?>