$val) { if (! isset($GLOBALS[$name])) $GLOBALS[$name] = $val; } } //プラグインが存在するか function exist_plugin($name) { $name = strtolower($name); // 大文字と小文字を区別しないファイルシステム対策 if (preg_match('/^\w{1,64}$/', $name) && file_exists(PLUGIN_DIR . $name . '.inc.php')) { require_once(PLUGIN_DIR . $name . '.inc.php'); return TRUE; } else { return FALSE; } } //プラグイン関数(action)が存在するか function exist_plugin_action($name) { return function_exists('plugin_' . $name . '_action') ? TRUE : exist_plugin($name) ? function_exists('plugin_' . $name . '_action') : FALSE; } //プラグイン関数(convert)が存在するか function exist_plugin_convert($name) { return function_exists('plugin_' . $name . '_convert') ? TRUE : exist_plugin($name) ? function_exists('plugin_' . $name . '_convert') : FALSE; } //プラグイン関数(inline)が存在するか function exist_plugin_inline($name) { return function_exists('plugin_' . $name . '_inline') ? TRUE : exist_plugin($name) ? function_exists('plugin_' . $name . '_inline') : FALSE; } //プラグインの初期化を実行 function do_plugin_init($name) { static $checked = array(); if (! isset($checked[$name])) { $func = 'plugin_' . $name . '_init'; if (function_exists($func)) { // TRUE or FALSE or NULL (return nothing) $checked[$name] = call_user_func($func); } else { // Not exists $checked[$name] = null; } } return $checked[$name]; } //プラグイン(action)を実行 function do_plugin_action($name) { if (! exist_plugin_action($name)) return array(); if(do_plugin_init($name) === FALSE) die_message("Plugin init failed: $name"); $retvar = call_user_func('plugin_' . $name . '_action'); // 文字エンコーディング検出用 hidden フィールドを挿入 return preg_replace('/(