Source for file Ethna.php
Documentation is available at Ethna.php
// vim: foldmethod=marker
* @author Masaki Fujimoto <fujimoto@php.net>
* @license http://www.opensource.org/licenses/bsd-license.php The BSD License
* @version $Id: 6864b6d4ccd537c691bc2e67740033a865052e30 $
// PEAR OS_WINDOWS constant replacement.
// PEAR の OS_WINDOWS 定数は、defined関数で
// よって require_once 'PEAR.php' とすると
// E_NOTICEが出ることから、Windows環境判定用
if (substr(PHP_OS, 0, 3) ==
'WIN'
define('ETHNA_OS_WINDOWS', true);
} elseif (!defined('ETHNA_OS_WINDOWS')) {
define('ETHNA_OS_WINDOWS', false);
// date.timezone が設定されていないと
// E_STRICT|WARNING が発生する
ini_set('date.timezone', 'Asia/Tokyo');
/** include_path separator(Windows) */
define('PATH_SEPARATOR', ';');
/** include_path separator(Unix) */
define('PATH_SEPARATOR', ':');
if (!defined('DIRECTORY_SEPARATOR')) {
/** directory separator(Windows) */
define('DIRECTORY_SEPARATOR', '\\');
define('DIRECTORY_SEPARATOR', '/');
define('ETHNA_VERSION', '2.6.0-beta3');
* PEAR非依存、かつ互換性を維持するためのもの
define('ETHNA_ERROR_DUMMY', 'dummy');
define('ETHNA_BASE', dirname(__FILE__
));
require_once ETHNA_BASE .
'/class/ActionClass.php';
require_once ETHNA_BASE .
'/class/ActionError.php';
require_once ETHNA_BASE .
'/class/ActionForm.php';
require_once ETHNA_BASE .
'/class/AppManager.php';
require_once ETHNA_BASE .
'/class/AppObject.php';
require_once ETHNA_BASE .
'/class/AppSQL.php';
require_once ETHNA_BASE .
'/class/AppSearchObject.php';
require_once ETHNA_BASE .
'/class/Backend.php';
require_once ETHNA_BASE .
'/class/CacheManager.php';
require_once ETHNA_BASE .
'/class/Config.php';
require_once ETHNA_BASE .
'/class/Controller.php';
require_once ETHNA_BASE .
'/class/ClassFactory.php';
require_once ETHNA_BASE .
'/class/DB.php';
require_once ETHNA_BASE .
'/class/Error.php';
require_once ETHNA_BASE .
'/class/Filter.php';
require_once ETHNA_BASE .
'/class/Handle.php';
require_once ETHNA_BASE .
'/class/I18N.php';
require_once ETHNA_BASE .
'/class/Logger.php';
require_once ETHNA_BASE .
'/class/MailSender.php';
require_once ETHNA_BASE .
'/class/Session.php';
require_once ETHNA_BASE .
'/class/Generator.php';
require_once ETHNA_BASE .
'/class/UrlHandler.php';
require_once ETHNA_BASE .
'/class/Util.php';
require_once ETHNA_BASE .
'/class/ViewClass.php';
require_once ETHNA_BASE .
'/class/View/Json.php';
require_once ETHNA_BASE .
'/class/View/Redirect.php';
require_once ETHNA_BASE .
'/class/View/403.php';
require_once ETHNA_BASE .
'/class/View/404.php';
require_once ETHNA_BASE .
'/class/View/500.php';
require_once ETHNA_BASE .
'/class/View/List.php';
require_once ETHNA_BASE .
'/class/Plugin.php';
require_once ETHNA_BASE .
'/class/Renderer.php';
require_once ETHNA_BASE .
'/class/CLI/ActionClass.php';
require_once ETHNA_BASE .
'/class/SOAP/ActionForm.php';
require_once ETHNA_BASE .
'/class/SOAP/Gateway.php';
require_once ETHNA_BASE .
'/class/SOAP/GatewayGenerator.php';
require_once ETHNA_BASE .
'/class/SOAP/Util.php';
require_once ETHNA_BASE .
'/class/SOAP/WsdlGenerator.php';
define('VAR_TYPE_DATETIME', 4);
define('VAR_TYPE_BOOLEAN', 5);
define('FORM_TYPE_PASSWORD', 2);
define('FORM_TYPE_TEXTAREA', 3);
define('FORM_TYPE_SELECT', 4);
define('FORM_TYPE_CHECKBOX', 6);
define('FORM_TYPE_SUBMIT', 7);
define('FORM_TYPE_BUTTON', 9);
define('FORM_TYPE_HIDDEN', 10);
/** エラーコード: DBユニークキーエラー */
define('E_DB_INVALIDTYPE', 6);
/** エラーコード: セッションエラー(有効期限切れ) */
define('E_SESSION_EXPIRE', 16);
/** エラーコード: セッションエラー(IPアドレスチェックエラー) */
define('E_SESSION_IPCHECK', 17);
/** エラーコード: アクション未定義エラー */
define('E_APP_UNDEFINED_ACTION', 32);
/** エラーコード: アクションクラス未定義エラー */
define('E_APP_UNDEFINED_ACTIONCLASS', 33);
/** エラーコード: アプリケーションオブジェクトID重複エラー */
/** エラーコード: アプリケーションメソッドが存在しない */
/** エラーコード: CSV分割エラー(行継続) */
define('E_UTIL_CSV_CONTINUE', 64);
/** エラーコード: フォーム値型エラー(スカラー引数に配列指定) */
define('E_FORM_WRONGTYPE_SCALAR', 128);
/** エラーコード: フォーム値型エラー(配列引数にスカラー指定) */
define('E_FORM_WRONGTYPE_ARRAY', 129);
/** エラーコード: フォーム値型エラー(整数型) */
define('E_FORM_WRONGTYPE_INT', 130);
/** エラーコード: フォーム値型エラー(浮動小数点数型) */
define('E_FORM_WRONGTYPE_FLOAT', 131);
/** エラーコード: フォーム値型エラー(日付型) */
define('E_FORM_WRONGTYPE_DATETIME', 132);
/** エラーコード: フォーム値型エラー(BOOL型) */
define('E_FORM_WRONGTYPE_BOOLEAN', 133);
/** エラーコード: フォーム値型エラー(FILE型) */
define('E_FORM_WRONGTYPE_FILE', 134);
/** エラーコード: フォーム値必須エラー */
define('E_FORM_REQUIRED', 135);
/** エラーコード: フォーム値最小値エラー(整数型) */
define('E_FORM_MIN_INT', 136);
/** エラーコード: フォーム値最小値エラー(浮動小数点数型) */
define('E_FORM_MIN_FLOAT', 137);
/** エラーコード: フォーム値最小値エラー(文字列型) */
define('E_FORM_MIN_STRING', 138);
/** エラーコード: フォーム値最小値エラー(日付型) */
define('E_FORM_MIN_DATETIME', 139);
/** エラーコード: フォーム値最小値エラー(ファイル型) */
define('E_FORM_MIN_FILE', 140);
/** エラーコード: フォーム値最大値エラー(整数型) */
define('E_FORM_MAX_INT', 141);
/** エラーコード: フォーム値最大値エラー(浮動小数点数型) */
define('E_FORM_MAX_FLOAT', 142);
/** エラーコード: フォーム値最大値エラー(文字列型) */
define('E_FORM_MAX_STRING', 143);
/** エラーコード: フォーム値最大値エラー(日付型) */
define('E_FORM_MAX_DATETIME', 144);
/** エラーコード: フォーム値最大値エラー(ファイル型) */
define('E_FORM_MAX_FILE', 145);
/** エラーコード: フォーム値文字種(正規表現)エラー */
/** エラーコード: フォーム値数値(カスタムチェック)エラー */
define('E_FORM_INVALIDVALUE', 147);
/** エラーコード: フォーム値文字種(カスタムチェック)エラー */
define('E_FORM_INVALIDCHAR', 148);
/** エラーコード: 確認用エントリ入力エラー */
define('E_FORM_CONFIRM', 149);
/** エラーコード: キャッシュタイプ不正 */
define('E_CACHE_INVALID_TYPE', 192);
define('E_CACHE_NO_VALUE', 193);
define('E_CACHE_EXPIRED', 194);
/** エラーコード: キャッシュエラー(その他) */
define('E_CACHE_GENERAL', 195);
/** エラーコード: プラグインが見つからない */
define('E_PLUGIN_NOTFOUND', 196);
/** エラーコード: プラグインエラー(その他) */
define('E_PLUGIN_GENERAL', 197);
if (defined('E_DEPRECATED') ==
false) {
/** Ethnaグローバル変数: エラーコールバック関数 */
$GLOBALS['_Ethna_error_callback_list'] =
array();
/** Ethnaグローバル変数: エラーメッセージ */
$GLOBALS['_Ethna_error_message_list'] =
array();
* @author Masaki Fujimoto <fujimoto@php.net>
* 渡されたオブジェクトが Ethna_Error オブジェクト
* またはそのサブクラスのオブジェクトかどうかチェックします。
* @param mixed $data チェックする変数
* @param mixed $msgcode チェックするエラーメッセージまたはエラーコード
* @return mixed 変数が、Ethna_Error の場合に TRUEを返します。
* 第2引数が設定された場合は、さらに 所与された $msgcode
public static function isError($data, $msgcode =
NULL)
} elseif ($data->getCode() ==
$msgcode) {
* Ethna_Errorオブジェクトを生成する(エラーレベル:E_USER_ERROR)
* @param string $message エラーメッセージ
* @param int $code エラーコード
public static function raiseError($message, $code =
E_GENERAL)
$userinfo =
$userinfo[0];
* Ethna_Errorオブジェクトを生成する(エラーレベル:E_USER_WARNING)
* @param string $message エラーメッセージ
* @param int $code エラーコード
public static function raiseWarning($message, $code =
E_GENERAL)
$userinfo =
$userinfo[0];
* Ethna_Errorオブジェクトを生成する(エラーレベル:E_USER_NOTICE)
* @param string $message エラーメッセージ
* @param int $code エラーコード
public static function raiseNotice($message, $code =
E_GENERAL)
$userinfo =
$userinfo[0];
* エラー発生時の(フレームワークとしての)コールバック関数を設定する
* @param mixed string:コールバック関数名 array:コールバッククラス(名|オブジェクト)+メソッド名
$GLOBALS['_Ethna_error_callback_list'][] =
$callback;
* エラー発生時の(フレームワークとしての)コールバック関数をクリアする
$GLOBALS['_Ethna_error_callback_list'] =
array();
* エラー発生時の処理を行う(コールバック関数/メソッドを呼び出す)
* @param object Ethna_Error Ethna_Errorオブジェクト
for ($i =
0; $i <
count($GLOBALS['_Ethna_error_callback_list']); $i++
) {
$callback =
$GLOBALS['_Ethna_error_callback_list'][$i];
// perform some more checks?
$object->$method($error);
Documentation generated on Fri, 11 Nov 2011 03:58:04 +0900 by phpDocumentor 1.4.3