2 // vim: foldmethod=marker
6 * @author Masaki Fujimoto <fujimoto@php.net>
7 * @license http://www.opensource.org/licenses/bsd-license.php The BSD License
12 // {{{ Ethna_Controller
16 * @author Masaki Fujimoto <fujimoto@php.net>
20 class Ethna_Controller
26 /** @var string ¥¢¥×¥ê¥±¡¼¥·¥ç¥óID */
29 /** @var string ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥Ù¡¼¥¹¥Ç¥£¥ì¥¯¥È¥ê */
32 /** @var string ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥Ù¡¼¥¹URL */
35 /** @var string ¥¢¥×¥ê¥±¡¼¥·¥ç¥óDSN(Data Source Name) */
38 /** @var array ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥Ç¥£¥ì¥¯¥È¥ê */
39 var $directory = array(
40 'action' => 'app/action',
42 'filter' => 'app/filter',
46 'template' => 'template',
47 'template_c' => 'tmp',
52 /** @var array DB¥¢¥¯¥»¥¹ÄêµÁ */
57 /** @var array ³ÈÄ¥»ÒÀßÄê */
63 /** @var array ¥¯¥é¥¹ÀßÄê */
65 'class' => 'Ethna_ClassFactory',
66 'backend' => 'Ethna_Backend',
67 'config' => 'Ethna_Config',
69 'error' => 'Ethna_ActionError',
70 'form' => 'Ethna_ActionForm',
71 'i18n' => 'Ethna_I18N',
72 'logger' => 'Ethna_Logger',
73 'session' => 'Ethna_Session',
74 'sql' => 'Ethna_AppSQL',
75 'view' => 'Ethna_ViewClass',
78 /** @var array ¥Õ¥£¥ë¥¿ÀßÄê */
82 /** @var string »ÈÍѸÀ¸ìÀßÄê */
85 /** @var string ¥·¥¹¥Æ¥à¦¥¨¥ó¥³¡¼¥Ç¥£¥ó¥° */
88 /** @var string ¥¯¥é¥¤¥¢¥ó¥È¦¥¨¥ó¥³¡¼¥Ç¥£¥ó¥° */
91 /** @var string ¥¯¥é¥¤¥¢¥ó¥È¥¿¥¤¥× */
94 /** @var string ¸½ºß¼Â¹ÔÃæ¤Î¥¢¥¯¥·¥ç¥ó̾ */
97 /** @var array forwardÄêµÁ */
98 var $forward = array();
100 /** @var array actionÄêµÁ */
101 var $action = array();
103 /** @var array soap actionÄêµÁ */
104 var $soap_action = array();
106 /** @var array ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥Þ¥Í¡¼¥¸¥ãÄêµÁ */
107 var $manager = array();
109 /** @var array smarty modifierÄêµÁ */
110 var $smarty_modifier_plugin = array();
112 /** @var array smarty functionÄêµÁ */
113 var $smarty_function_plugin = array();
115 /** @var array smarty prefilterÄêµÁ */
116 var $smarty_prefilter_plugin = array();
118 /** @var array smarty postfilterÄêµÁ */
119 var $smarty_postfilter_plugin = array();
121 /** @var array smarty outputfilterÄêµÁ */
122 var $smarty_outputfilter_plugin = array();
124 /** @var array ¥Õ¥£¥ë¥¿¡¼¥Á¥§¥¤¥ó(Ethna_Filter¥ª¥Ö¥¸¥§¥¯¥È¤ÎÇÛÎó) */
125 var $filter_chain = array();
127 /** @var object Ethna_ClassFactory ¥¯¥é¥¹¥Õ¥¡¥¯¥È¥ê¥ª¥Ö¥¸¥§¥¯¥È */
128 var $class_factory = null;
130 /** @var object Ethna_ActionForm ¥Õ¥©¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È */
131 var $action_form = null;
133 /** @var object Ethna_Config ÀßÄꥪ¥Ö¥¸¥§¥¯¥È */
136 /** @var object Ethna_Logger ¥í¥°¥ª¥Ö¥¸¥§¥¯¥È */
139 /** @var bool CLI¥¢¥¯¥·¥ç¥ó¼Â¹ÔÃæ¥Õ¥é¥° */
146 * Ethna_Controller¥¯¥é¥¹¤Î¥³¥ó¥¹¥È¥é¥¯¥¿
150 function Ethna_Controller()
152 $GLOBALS['controller'] =& $this;
155 // ¥¯¥é¥¹¥Õ¥¡¥¯¥È¥ê¥ª¥Ö¥¸¥§¥¯¥È¤ÎÀ¸À®
156 $class_factory = $this->class['class'];
157 $this->class_factory =& new $class_factory($this, $this->class);
159 // ¥¨¥é¡¼¥Ï¥ó¥É¥é¤ÎÀßÄê
160 Ethna::setErrorCallback(array(&$this, 'handleError'));
162 // ¥Ç¥£¥ì¥¯¥È¥ê̾¤ÎÀßÄê(ÁêÂХѥ¹->ÀäÂХѥ¹)
163 foreach ($this->directory as $key => $value) {
164 if ($key == 'plugins') {
165 // Smarty¥×¥é¥°¥¤¥ó¥Ç¥£¥ì¥¯¥È¥ê¤ÏÇÛÎó¤Ç»ØÄꤹ¤ë
166 $tmp = array(SMARTY_DIR . 'plugins');
167 foreach (to_array($value) as $elt) {
168 if (Ethna_Util::isAbsolute($elt) == false) {
169 $tmp[] = $this->base . (empty($this->base) ? '' : '/') . $elt;
172 $this->directory[$key] = $tmp;
174 if (Ethna_Util::isAbsolute($value) == false) {
175 $this->directory[$key] = $this->base . (empty($this->base) ? '' : '/') . $value;
181 list($this->language, $this->system_encoding, $this->client_encoding) = $this->_getDefaultLanguage();
182 $this->client_type = $this->_getDefaultClientType();
184 $this->config =& $this->getConfig();
185 $this->dsn = $this->_prepareDSN();
186 $this->url = $this->config->get('url');
189 $this->logger =& $this->getLogger();
190 $this->logger->begin();
192 // Ethna¥Þ¥Í¡¼¥¸¥ãÀßÄê
193 $this->_activateEthnaManager();
197 * (¸½ºß¥¢¥¯¥Æ¥£¥Ö¤Ê)¥³¥ó¥È¥í¡¼¥é¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òÊÖ¤¹
200 * @return object Ethna_Controller ¥³¥ó¥È¥í¡¼¥é¤Î¥¤¥ó¥¹¥¿¥ó¥¹
203 function &getInstance()
205 if (isset($GLOBALS['controller'])) {
206 return $GLOBALS['controller'];
213 * ¥¢¥×¥ê¥±¡¼¥·¥ç¥óID¤òÊÖ¤¹
216 * @return string ¥¢¥×¥ê¥±¡¼¥·¥ç¥óID
220 return ucfirst(strtolower($this->appid));
227 * @param string $type DB¼ïÊÌ
230 function getDSN($type = "")
232 if (isset($this->dsn[$type]) == false) {
235 return $this->dsn[$type];
239 * DSN¤Î»ý³ÀܳÀßÄê¤òÊÖ¤¹
242 * @param string $type DB¼ïÊÌ
243 * @return bool true:persistent false:non-persistent(¤¢¤ë¤¤¤ÏÀßÄê̵¤·)
245 function getDSN_persistent($type = "")
247 $key = sprintf("dsn%s_persistent", $type == "" ? "" : "_$type");
249 $dsn_persistent = $this->config->get($key);
250 if (is_null($dsn_persistent)) {
253 return $dsn_persistent;
257 * ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥Ù¡¼¥¹URL¤òÊÖ¤¹
260 * @return string ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥Ù¡¼¥¹URL
268 * ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥Ù¡¼¥¹¥Ç¥£¥ì¥¯¥È¥ê¤òÊÖ¤¹
271 * @return string ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥Ù¡¼¥¹¥Ç¥£¥ì¥¯¥È¥ê
273 function getBasedir()
279 * ¥¯¥é¥¤¥¢¥ó¥È¥¿¥¤¥×/¸À¸ì¤«¤é¥Æ¥ó¥×¥ì¡¼¥È¥Ç¥£¥ì¥¯¥È¥ê̾¤ò·èÄꤹ¤ë
282 * @return string ¥Æ¥ó¥×¥ì¡¼¥È¥Ç¥£¥ì¥¯¥È¥ê
284 function getTemplatedir()
286 $template = $this->getDirectory('template');
288 // ¸À¸ìÊ̥ǥ£¥ì¥¯¥È¥ê
289 if (file_exists($template . '/' . $this->language)) {
290 $template .= '/' . $this->language;
293 // ¥¯¥é¥¤¥¢¥ó¥ÈÊ̥ǥ£¥ì¥¯¥È¥ê(if we need)
294 if ($this->client_type == CLIENT_TYPE_MOBILE_AU && file_exists($template . '/au')) {
302 * ¥¢¥¯¥·¥ç¥ó¥Ç¥£¥ì¥¯¥È¥ê̾¤ò·èÄꤹ¤ë
305 * @return string ¥¢¥¯¥·¥ç¥ó¥Ç¥£¥ì¥¯¥È¥ê
307 function getActiondir()
309 return (empty($this->directory['action']) ? ($this->base . (empty($this->base) ? '' : '/')) : ($this->directory['action'] . "/"));
313 * ¥Ó¥å¡¼¥Ç¥£¥ì¥¯¥È¥ê̾¤ò·èÄꤹ¤ë
316 * @return string ¥¢¥¯¥·¥ç¥ó¥Ç¥£¥ì¥¯¥È¥ê
318 function getViewdir()
320 return (empty($this->directory['view']) ? ($this->base . (empty($this->base) ? '' : '/')) : ($this->directory['view'] . "/"));
324 * ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥Ç¥£¥ì¥¯¥È¥êÀßÄê¤òÊÖ¤¹
327 * @param string $key ¥Ç¥£¥ì¥¯¥È¥ê¥¿¥¤¥×("tmp", "template"...)
328 * @return string $key¤ËÂбþ¤·¤¿¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥Ç¥£¥ì¥¯¥È¥ê(ÀßÄ̵꤬¤¤¾ì¹ç¤Ïnull)
330 function getDirectory($key)
332 if (isset($this->directory[$key]) == false) {
335 return $this->directory[$key];
342 * @param string $key DB¥¿¥¤¥×("r", ...)
343 * @return string $key¤ËÂбþ¤¹¤ëDB¼ïÊÌÄêµÁ(ÀßÄ̵꤬¤¤¾ì¹ç¤Ïnull)
347 if (isset($this->db[$key]) == false) {
350 return $this->db[$key];
354 * ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó³ÈÄ¥»ÒÀßÄê¤òÊÖ¤¹
357 * @param string $key ³ÈÄ¥»Ò¥¿¥¤¥×("php", "tpl"...)
358 * @return string $key¤ËÂбþ¤·¤¿³ÈÄ¥»Ò(ÀßÄ̵꤬¤¤¾ì¹ç¤Ïnull)
360 function getExt($key)
362 if (isset($this->ext[$key]) == false) {
365 return $this->ext[$key];
369 * ¥¯¥é¥¹¥Õ¥¡¥¯¥È¥ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¢¥¯¥»¥µ(R)
372 * @return object Ethna_ClassFactory ¥¯¥é¥¹¥Õ¥¡¥¯¥È¥ê¥ª¥Ö¥¸¥§¥¯¥È
374 function &getClassFactory()
376 return $this->class_factory;
380 * ¥¢¥¯¥·¥ç¥ó¥¨¥é¡¼¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¢¥¯¥»¥µ
383 * @return object Ethna_ActionError ¥¢¥¯¥·¥ç¥ó¥¨¥é¡¼¥ª¥Ö¥¸¥§¥¯¥È
385 function &getActionError()
387 return $this->class_factory->getObject('error');
391 * ¥¢¥¯¥·¥ç¥ó¥Õ¥©¡¼¥àform¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¢¥¯¥»¥µ
394 * @return object Ethna_ActionForm ¥¢¥¯¥·¥ç¥ó¥Õ¥©¡¼¥àform¥ª¥Ö¥¸¥§¥¯¥È
396 function &getActionForm()
398 // ÌÀ¼¨Åª¤Ë¥¯¥é¥¹¥Õ¥¡¥¯¥È¥ê¤òÍøÍѤ·¤Æ¤¤¤Ê¤¤
399 return $this->action_form;
403 * backend¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¢¥¯¥»¥µ
406 * @return object Ethna_Backend backend¥ª¥Ö¥¸¥§¥¯¥È
408 function &getBackend()
410 return $this->class_factory->getObject('backend');
414 * ÀßÄꥪ¥Ö¥¸¥§¥¯¥È¤Î¥¢¥¯¥»¥µ
417 * @return object Ethna_Config ÀßÄꥪ¥Ö¥¸¥§¥¯¥È
419 function &getConfig()
421 return $this->class_factory->getObject('config');
425 * i18n¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¢¥¯¥»¥µ(R)
428 * @return object Ethna_I18N i18n¥ª¥Ö¥¸¥§¥¯¥È
432 return $this->class_factory->getObject('i18n');
436 * ¥í¥°¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¢¥¯¥»¥µ
439 * @return object Ethna_Logger ¥í¥°¥ª¥Ö¥¸¥§¥¯¥È
441 function &getLogger()
443 return $this->class_factory->getObject('logger');
447 * ¥»¥Ã¥·¥ç¥ó¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¢¥¯¥»¥µ
450 * @return object Ethna_Session ¥»¥Ã¥·¥ç¥ó¥ª¥Ö¥¸¥§¥¯¥È
452 function &getSession()
454 return $this->class_factory->getObject('session');
458 * SQL¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¢¥¯¥»¥µ
461 * @return object Ethna_AppSQL SQL¥ª¥Ö¥¸¥§¥¯¥È
465 return $this->class_factory->getObject('sql');
469 * ¥Þ¥Í¡¼¥¸¥ã°ìÍ÷¤òÊÖ¤¹
472 * @return array ¥Þ¥Í¡¼¥¸¥ã°ìÍ÷
474 function getManagerList()
476 return $this->manager;
480 * ¼Â¹ÔÃæ¤Î¥¢¥¯¥·¥ç¥ó̾¤òÊÖ¤¹
483 * @return string ¼Â¹ÔÃæ¤Î¥¢¥¯¥·¥ç¥ó̾
485 function getCurrentActionName()
487 return $this->action_name;
494 * @return array »ÈÍѸÀ¸ì,¥·¥¹¥Æ¥à¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°Ì¾,¥¯¥é¥¤¥¢¥ó¥È¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°Ì¾
496 function getLanguage()
498 return array($this->language, $this->system_encoding, $this->client_encoding);
502 * ¥¯¥é¥¤¥¢¥ó¥È¥¿¥¤¥×¤ò¼èÆÀ¤¹¤ë
505 * @return int ¥¯¥é¥¤¥¢¥ó¥È¥¿¥¤¥×ÄêµÁ(CLIENT_TYPE_WWW...)
507 function getClientType()
509 return $this->client_type;
513 * ¥¯¥é¥¤¥¢¥ó¥È¥¿¥¤¥×¤òÀßÄꤹ¤ë
516 * @param int $client_type ¥¯¥é¥¤¥¢¥ó¥È¥¿¥¤¥×ÄêµÁ(CLIENT_TYPE_WWW...)
518 function setClientType($client_type)
520 $this->client_type = $client_type;
524 * CLI¼Â¹ÔÃæ¥Õ¥é¥°¤ò¼èÆÀ¤¹¤ë
527 * @return bool CLI¼Â¹ÔÃæ¥Õ¥é¥°
535 * CLI¼Â¹ÔÃæ¥Õ¥é¥°¤òÀßÄꤹ¤ë
538 * @param bool CLI¼Â¹ÔÃæ¥Õ¥é¥°
540 function setCLI($cli)
546 * ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥¨¥ó¥È¥ê¥Ý¥¤¥ó¥È
549 * @param string $class_name ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥³¥ó¥È¥í¡¼¥é¤Î¥¯¥é¥¹Ì¾
550 * @param mixed $action_name »ØÄê¤Î¥¢¥¯¥·¥ç¥ó̾(¾Êά²Ä)
551 * @param mixed $fallback_action_name ¥¢¥¯¥·¥ç¥ó¤¬·èÄê¤Ç¤¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¼Â¹Ô¤µ¤ì¤ë¥¢¥¯¥·¥ç¥ó̾(¾Êά²Ä)
554 function main($class_name, $action_name = "", $fallback_action_name = "")
556 $c =& new $class_name;
557 $c->trigger('www', $action_name, $fallback_action_name);
561 * ¥³¥Þ¥ó¥É¥é¥¤¥ó¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥¨¥ó¥È¥ê¥Ý¥¤¥ó¥È
564 * @param string $class_name ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥³¥ó¥È¥í¡¼¥é¤Î¥¯¥é¥¹Ì¾
565 * @param string $action_name ¼Â¹Ô¤¹¤ë¥¢¥¯¥·¥ç¥ó̾
568 function main_CLI($class_name, $action_name)
570 $c =& new $class_name;
572 $c->action[$action_name] = array();
573 $c->trigger('www', $action_name);
577 * SOAP¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥¨¥ó¥È¥ê¥Ý¥¤¥ó¥È
580 * @param string $class_name ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥³¥ó¥È¥í¡¼¥é¤Î¥¯¥é¥¹Ì¾
583 function main_SOAP($class_name)
585 $c =& new $class_name;
586 $c->setClientType(CLIENT_TYPE_SOAP);
591 * AMF(Flash Remoting)¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥¨¥ó¥È¥ê¥Ý¥¤¥ó¥È
594 * @param string $class_name ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥³¥ó¥È¥í¡¼¥é¤Î¥¯¥é¥¹Ì¾
597 function main_AMF($class_name)
599 $c =& new $class_name;
600 $c->setClientType(CLIENT_TYPE_AMF);
605 * ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î½èÍý¤ò³«»Ï¤¹¤ë
608 * @param strint $type ½èÍý¥¿¥¤¥×(WWW/SOAP/AMF)
609 * @param mixed $default_action_name »ØÄê¤Î¥¢¥¯¥·¥ç¥ó̾
610 * @param mixed $fallback_action_name ¥¢¥¯¥·¥ç¥ó̾¤¬·èÄê¤Ç¤¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¼Â¹Ô¤µ¤ì¤ë¥¢¥¯¥·¥ç¥ó̾
611 * @return mixed 0:Àµ¾ï½ªÎ» Ethna_Error:¥¨¥é¡¼
613 function trigger($type, $default_action_name = "", $fallback_action_name = "")
616 $this->_createFilterChain();
619 for ($i = 0; $i < count($this->filter_chain); $i++) {
620 $this->filter_chain[$i]->preFilter();
624 if ($type == 'www') {
625 $this->_trigger($default_action_name, $fallback_action_name);
626 } else if ($type == 'soap') {
627 $this->_trigger_SOAP();
628 } else if ($type == 'amf') {
629 $this->_trigger_AMF();
633 for ($i = count($this->filter_chain) - 1; $i >= 0; $i--) {
634 $this->filter_chain[$i]->postFilter();
639 * ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î½èÍý¤ò¼Â¹Ô¤¹¤ë(WWW)
641 * °ú¿ô$default_action_name¤ËÇÛÎ󤬻ØÄꤵ¤ì¤¿¾ì¹ç¡¢¤½¤ÎÇÛÎó¤Ç»ØÄꤵ¤ì¤¿
642 * ¥¢¥¯¥·¥ç¥ó°Ê³°¤Ï¼õ¤±ÉÕ¤±¤Ê¤¤(¤½¤ì°Ê³°¤Î¥¢¥¯¥·¥ç¥ó¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢
643 * ÇÛÎó¤ÎÀèƬ¤Ç»ØÄꤵ¤ì¤¿¥¢¥¯¥·¥ç¥ó¤¬¼Â¹Ô¤µ¤ì¤ë)
646 * @param mixed $default_action_name »ØÄê¤Î¥¢¥¯¥·¥ç¥ó̾
647 * @param mixed $fallback_action_name ¥¢¥¯¥·¥ç¥ó̾¤¬·èÄê¤Ç¤¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¼Â¹Ô¤µ¤ì¤ë¥¢¥¯¥·¥ç¥ó̾
648 * @return mixed 0:Àµ¾ï½ªÎ» Ethna_Error:¥¨¥é¡¼
650 function _trigger($default_action_name = "", $fallback_action_name = "")
652 // ¥¢¥¯¥·¥ç¥ó̾¤Î¼èÆÀ
653 $action_name = $this->_getActionName($default_action_name, $fallback_action_name);
655 // ¥¢¥¯¥·¥ç¥óÄêµÁ¤Î¼èÆÀ
656 $action_obj =& $this->_getAction($action_name);
657 if (is_null($action_obj)) {
658 if ($fallback_action_name != "") {
659 $this->logger->log(LOG_DEBUG, 'undefined action [%s] -> try fallback action [%s]', $action_name, $fallback_action_name);
660 $action_obj =& $this->_getAction($fallback_action_name);
662 if ($action_obj == null) {
663 return Ethna::raiseError("undefined action [%s]", E_APP_UNDEFINED_ACTION, $action_name);
665 $action_name = $fallback_action_name;
669 // ¥¢¥¯¥·¥ç¥ó¼Â¹ÔÁ°¥Õ¥£¥ë¥¿
670 for ($i = 0; $i < count($this->filter_chain); $i++) {
671 $r = $this->filter_chain[$i]->preActionFilter($action_name);
673 $this->logger->log(LOG_DEBUG, 'action [%s] -> [%s] by %s', $action_name, $r, get_class($this->filter_chain[$i]));
677 $this->action_name = $action_name;
680 $this->_setLanguage($this->language, $this->system_encoding, $this->client_encoding);
683 $form_name = $this->getActionFormName($action_name);
684 $this->action_form =& new $form_name($this);
686 // ¥Ð¥Ã¥¯¥¨¥ó¥É½èÍý¼Â¹Ô
687 $backend =& $this->getBackend();
688 $forward_name = $backend->perform($action_name);
690 // ¥¢¥¯¥·¥ç¥ó¼Â¹Ô¸å¥Õ¥£¥ë¥¿
691 for ($i = count($this->filter_chain) - 1; $i >= 0; $i--) {
692 $r = $this->filter_chain[$i]->postActionFilter($action_name, $forward_name);
694 $this->logger->log(LOG_DEBUG, 'forward [%s] -> [%s] by %s', $forward_name, $r, get_class($this->filter_chain[$i]));
699 // ¥³¥ó¥È¥í¡¼¥é¤ÇÁ«°ÜÀè¤ò·èÄꤹ¤ë(¥ª¥×¥·¥ç¥ó)
700 $forward_name = $this->_sortForward($action_name, $forward_name);
702 if ($forward_name != null) {
703 $view_class_name = $this->getViewClassName($forward_name);
704 $view_class =& new $view_class_name($backend, $forward_name, $this->_getForwardPath($forward_name));
705 $view_class->preforward();
708 $view_class_name = $this->class_factory->getObjectName('view');
709 if (is_subclass_of($view_class, $view_class_name) == false) {
710 $view_class =& new $view_class_name($backend, $forward_name, $this->_getForwardPath($forward_name));
712 $view_class->forward();
719 * SOAP¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î½èÍý¤ò¼Â¹Ô¤¹¤ë
725 function _trigger_SOAP()
727 // ¥¢¥¯¥·¥ç¥ó¥¹¥¯¥ê¥×¥È¤ò¥¤¥ó¥¯¥ë¡¼¥É
728 $this->_includeActionScript();
730 // SOAP¥¨¥ó¥È¥ê¥¯¥é¥¹
731 $gg =& new Ethna_SoapGatewayGenerator();
732 $script = $gg->generate();
735 // SOAP¥ê¥¯¥¨¥¹¥È½èÍý
736 $server =& new SoapServer(null, array('uri' => $this->config->get('url')));
737 $server->setClass($gg->getClassName());
742 * AMF(Flash Remoting)¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î½èÍý¤ò¼Â¹Ô¤¹¤ë
748 function _trigger_AMF()
750 include_once('Ethna/contrib/amfphp/app/Gateway.php');
752 // Credential¥Ø¥Ã¥À¤Ç¥»¥Ã¥·¥ç¥ó¤ò½èÍý¤¹¤ë¤Î¤Ç¤³¤³¤Ç¤Ïnull¤ËÀßÄê
753 $this->session = null;
755 $this->_setLanguage($this->language, $this->system_encoding, $this->client_encoding);
757 // backend¥ª¥Ö¥¸¥§¥¯¥È
758 $backend =& $this->getBackend();
760 // ¥¢¥¯¥·¥ç¥ó¥¹¥¯¥ê¥×¥È¤ò¥¤¥ó¥¯¥ë¡¼¥É
761 $this->_includeActionScript();
763 // amfphp¤Ë½èÍý¤ò°Ñ¾ù
764 $gateway =& new Gateway();
765 $gateway->setBaseClassPath('');
772 * ¥¨¥é¡¼È¯À¸»þ¤ÎÄɲýèÍý¤ò¹Ô¤¤¤¿¤¤¾ì¹ç¤Ï¤³¤Î¥á¥½¥Ã¥É¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤¹¤ë
773 * (¥¢¥é¡¼¥È¥á¡¼¥ëÁ÷¿®Åù¡Ý¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¥í¥°½ÐÎÏ»þ¤Ë¥¢¥é¡¼¥È¥á¡¼¥ë
774 * ¤¬Á÷¿®¤µ¤ì¤ë¤¬¡¢¥¨¥é¡¼È¯À¸»þ¤ËÊ̤˥¢¥é¡¼¥È¥á¡¼¥ë¤ò¤³¤³¤ÇÁ÷¿®
778 * @param object Ethna_Error ¥¨¥é¡¼¥ª¥Ö¥¸¥§¥¯¥È
780 function handleError(&$error)
783 list ($log_level, $dummy) = $this->logger->errorLevelToLogLevel($error->getLevel());
784 $message = $error->getMessage();
785 $this->logger->log($log_level, sprintf("%s [ERROR CODE(%d)]", $message, $error->getCode()));
789 * ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤ò¼èÆÀ¤¹¤ë
792 * @param int $code ¥¨¥é¡¼¥³¡¼¥É
793 * @return string ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸
795 function getErrorMessage($code)
797 $message_list =& $GLOBALS['_Ethna_error_message_list'];
798 for ($i = count($message_list)-1; $i >= 0; $i--) {
799 if (array_key_exists($code, $message_list[$i])) {
800 return $message_list[$i][$code];
807 * ¼Â¹Ô¤¹¤ë¥¢¥¯¥·¥ç¥ó̾¤òÊÖ¤¹
810 * @param mixed $default_action_name »ØÄê¤Î¥¢¥¯¥·¥ç¥ó̾
811 * @return string ¼Â¹Ô¤¹¤ë¥¢¥¯¥·¥ç¥ó̾
813 function _getActionName($default_action_name, $fallback_action_name)
815 // ¥Õ¥©¡¼¥à¤«¤éÍ׵ᤵ¤ì¤¿¥¢¥¯¥·¥ç¥ó̾¤ò¼èÆÀ¤¹¤ë
816 $form_action_name = $this->_getActionName_Form();
817 $form_action_name = preg_replace('/[^a-z0-9\-_]+/i', '', $form_action_name);
818 $this->logger->log(LOG_DEBUG, 'form_action_name[%s]', $form_action_name);
820 // Ethna¥Þ¥Í¡¼¥¸¥ã¤Ø¤Î¥Õ¥©¡¼¥à¤«¤é¤Î¥ê¥¯¥¨¥¹¥È¤ÏµñÈÝ
821 if ($form_action_name == "__ethna_info__") {
822 $form_action_name = "";
825 // ¥Õ¥©¡¼¥à¤«¤é¤Î»ØÄ̵꤬¤¤¾ì¹ç¤Ï¥¨¥ó¥È¥ê¥Ý¥¤¥ó¥È¤Ë»ØÄꤵ¤ì¤¿¥Ç¥Õ¥©¥ë¥ÈÃͤòÍøÍѤ¹¤ë
826 if ($form_action_name == "" && count($default_action_name) > 0) {
827 $tmp = is_array($default_action_name) ? $default_action_name[0] : $default_action_name;
828 if ($tmp{strlen($tmp)-1} == '*') {
829 $tmp = substr($tmp, 0, -1);
831 $this->logger->log(LOG_DEBUG, '-> default_action_name[%s]', $tmp);
834 $action_name = $form_action_name;
837 // ¥¨¥ó¥È¥ê¥Ý¥¤¥ó¥È¤ËÇÛÎ󤬻ØÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï»ØÄê°Ê³°¤Î¥¢¥¯¥·¥ç¥ó̾¤ÏµñÈݤ¹¤ë
838 if (is_array($default_action_name)) {
839 if ($this->_isAcceptableActionName($action_name, $default_action_name) == false) {
840 // »ØÄê°Ê³°¤Î¥¢¥¯¥·¥ç¥ó̾¤Ç¹ç¤Ã¤¿¾ì¹ç¤Ï$fallback_action_name(or ¥Ç¥Õ¥©¥ë¥È)
841 $tmp = $fallback_action_name != "" ? $fallback_action_name : $default_action_name[0];
842 if ($tmp{strlen($tmp)-1} == '*') {
843 $tmp = substr($tmp, 0, -1);
845 $this->logger->log(LOG_DEBUG, '-> fallback_action_name[%s]', $tmp);
850 $this->logger->log(LOG_DEBUG, '<<< action_name[%s] >>>', $action_name);
856 * ¥Õ¥©¡¼¥à¤Ë¤è¤êÍ׵ᤵ¤ì¤¿¥¢¥¯¥·¥ç¥ó̾¤òÊÖ¤¹
858 * ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ÎÀ¼Á¤Ë±þ¤¸¤Æ¤³¤Î¥á¥½¥Ã¥É¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤Æ²¼¤µ¤¤¡£
859 * ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï"action_"¤Ç»Ï¤Þ¤ë¥Õ¥©¡¼¥àÃͤÎ"action_"¤ÎÉôʬ¤ò½ü¤¤¤¿¤â¤Î
860 * ("action_sample"¤Ê¤é"sample")¤¬¥¢¥¯¥·¥ç¥ó̾¤È¤·¤Æ°·¤ï¤ì¤Þ¤¹
863 * @return string ¥Õ¥©¡¼¥à¤Ë¤è¤êÍ׵ᤵ¤ì¤¿¥¢¥¯¥·¥ç¥ó̾
865 function _getActionName_Form()
867 if (isset($_SERVER['REQUEST_METHOD']) == false) {
871 if (strcasecmp($_SERVER['REQUEST_METHOD'], 'post') == 0) {
872 $http_vars =& $_POST;
877 // ¥Õ¥©¡¼¥àÃͤ«¤é¥ê¥¯¥¨¥¹¥È¤µ¤ì¤¿¥¢¥¯¥·¥ç¥ó̾¤ò¼èÆÀ¤¹¤ë
878 $action_name = $sub_action_name = null;
879 foreach ($http_vars as $name => $value) {
880 if ($value == "" || strncmp($name, 'action_', 7) != 0) {
884 $tmp = substr($name, 7);
887 if (preg_match('/_x$/', $name) || preg_match('/_y$/', $name)) {
888 $tmp = substr($tmp, 0, strlen($tmp)-2);
891 // value="dummy"¤È¤Ê¤Ã¤Æ¤¤¤ë¤â¤Î¤ÏÍ¥ÀèÅÙ¤ò²¼¤²¤ë
892 if ($value == "dummy") {
893 $sub_action_name = $tmp;
898 if ($action_name == null) {
899 $action_name = $sub_action_name;
906 * ¥Õ¥©¡¼¥à¤Ë¤è¤êÍ׵ᤵ¤ì¤¿¥¢¥¯¥·¥ç¥ó̾¤ËÂбþ¤¹¤ëÄêµÁ¤òÊÖ¤¹
909 * @param string $action_name ¥¢¥¯¥·¥ç¥ó̾
910 * @return array ¥¢¥¯¥·¥ç¥óÄêµÁ
912 function &_getAction($action_name)
914 if ($this->client_type == CLIENT_TYPE_SOAP) {
915 $action =& $this->soap_action;
917 $action =& $this->action;
920 $action_obj = array();
921 if (isset($action[$action_name])) {
922 $action_obj = $action[$action_name];
923 if (isset($action_obj['inspect']) && $action_obj['inspect']) {
927 $this->logger->log(LOG_DEBUG, "action [%s] is not defined -> try default", $action_name);
930 // ¥¢¥¯¥·¥ç¥ó¥¹¥¯¥ê¥×¥È¤Î¥¤¥ó¥¯¥ë¡¼¥É
931 $this->_includeActionScript($action_obj, $action_name);
934 if (isset($action_obj['class_name']) == false) {
935 $action_obj['class_name'] = $this->getDefaultActionClass($action_name);
938 if (isset($action_obj['form_name']) == false) {
939 $action_obj['form_name'] = $this->getDefaultFormClass($action_name);
940 } else if (class_exists($action_obj['form_name']) == false) {
941 // ÌÀ¼¨»ØÄꤵ¤ì¤¿¥Õ¥©¡¼¥à¥¯¥é¥¹¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï·Ù¹ð
942 $this->logger->log(LOG_WARNING, 'stated form class is not defined [%s]', $action_obj['form_name']);
946 if (class_exists($action_obj['class_name']) == false) {
947 $this->logger->log(LOG_WARNING, 'action class is not defined [%s]', $action_obj['class_name']);
950 if (class_exists($action_obj['form_name']) == false) {
951 // ¥Õ¥©¡¼¥à¥¯¥é¥¹¤Ï̤ÄêµÁ¤Ç¤âÎɤ¤
952 $class_name = $this->class_factory->getObjectName('form');
953 $this->logger->log(LOG_DEBUG, 'form class is not defined [%s] -> falling back to default [%s]', $action_obj['form_name'], $class_name);
954 $action_obj['form_name'] = $class_name;
957 $action_obj['inspect'] = true;
958 $action[$action_name] = $action_obj;
959 return $action[$action_name];
963 * ¥¢¥¯¥·¥ç¥ó̾¤È¥¢¥¯¥·¥ç¥ó¥¯¥é¥¹¤«¤é¤ÎÌá¤êÃͤ˴ð¤Å¤¤¤ÆÁ«°ÜÀè¤ò·èÄꤹ¤ë
966 * @param string $action_name ¥¢¥¯¥·¥ç¥ó̾
967 * @param string $retval ¥¢¥¯¥·¥ç¥ó¥¯¥é¥¹¤«¤é¤ÎÌá¤êÃÍ
968 * @return string Á«°ÜÀè
970 function _sortForward($action_name, $retval)
976 * ¥Õ¥£¥ë¥¿¡¼¥Á¥§¥¤¥ó¤òÀ¸À®¤¹¤ë
980 function _createFilterChain()
982 $this->filter_chain = array();
983 foreach ($this->filter as $filter) {
984 $file = sprintf("%s/%s.%s", $this->getDirectory('filter'), $filter, $this->getExt('php'));
985 if (file_exists($file)) {
988 if (class_exists($filter)) {
989 $this->filter_chain[] =& new $filter($this);
995 * ¥¢¥¯¥·¥ç¥ó̾¤¬¼Â¹Ôµö²Ä¤µ¤ì¤Æ¤¤¤ë¤â¤Î¤«¤É¤¦¤«¤òÊÖ¤¹
998 * @param string $action_name ¥ê¥¯¥¨¥¹¥È¤µ¤ì¤¿¥¢¥¯¥·¥ç¥ó̾
999 * @param array $default_action_name µö²Ä¤µ¤ì¤Æ¤¤¤ë¥¢¥¯¥·¥ç¥ó̾
1000 * @return bool true:µö²Ä false:ÉÔµö²Ä
1002 function _isAcceptableActionName($action_name, $default_action_name)
1004 foreach (to_array($default_action_name) as $name) {
1005 if ($action_name == $name) {
1007 } else if ($name{strlen($name)-1} == '*') {
1008 if (strncmp($action_name, substr($name, 0, -1), strlen($name)-1) == 0) {
1017 * »ØÄꤵ¤ì¤¿¥¢¥¯¥·¥ç¥ó¤Î¥Õ¥©¡¼¥à¥¯¥é¥¹Ì¾¤òÊÖ¤¹(¥ª¥Ö¥¸¥§¥¯¥È¤ÎÀ¸À®¤Ï¹Ô¤ï¤Ê¤¤)
1020 * @param string $action_name ¥¢¥¯¥·¥ç¥ó̾
1021 * @return string ¥¢¥¯¥·¥ç¥ó¤Î¥Õ¥©¡¼¥à¥¯¥é¥¹Ì¾
1023 function getActionFormName($action_name)
1025 $action_obj =& $this->_getAction($action_name);
1026 if (is_null($action_obj)) {
1030 return $action_obj['form_name'];
1034 * ¥¢¥¯¥·¥ç¥ó¤ËÂбþ¤¹¤ë¥Õ¥©¡¼¥à¥¯¥é¥¹Ì¾¤¬¾Êά¤µ¤ì¤¿¾ì¹ç¤Î¥Ç¥Õ¥©¥ë¥È¥¯¥é¥¹Ì¾¤òÊÖ¤¹
1036 * ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï[¥×¥í¥¸¥§¥¯¥ÈID]_Form_[¥¢¥¯¥·¥ç¥ó̾]¤È¤Ê¤ë¤Î¤Ç¹¥¤ß±þ¤¸¤Æ¥ª¡¼¥Ð¥é¥¤¥É¤¹¤ë
1039 * @param string $action_name ¥¢¥¯¥·¥ç¥ó̾
1040 * @param bool $fallback ¥¯¥é¥¤¥¢¥ó¥È¼ïÊ̤ˤè¤ëfallback on/off
1041 * @return string ¥¢¥¯¥·¥ç¥ó¥Õ¥©¡¼¥à̾
1043 function getDefaultFormClass($action_name, $fallback = true)
1045 $postfix = preg_replace('/_(.)/e', "strtoupper('\$1')", ucfirst($action_name));
1048 if ($this->getClientType() == CLIENT_TYPE_SOAP) {
1049 $r = sprintf("%s_SOAPForm_%s", $this->getAppId(), $postfix);
1050 } else if ($this->getClientType() == CLIENT_TYPE_MOBILE_AU) {
1051 $tmp = sprintf("%s_MobileAUForm_%s", $this->getAppId(), $postfix);
1052 if ($fallback == false || class_exists($tmp)) {
1058 $r = sprintf("%s_Form_%s", $this->getAppId(), $postfix);
1060 $this->logger->log(LOG_DEBUG, "default action class [%s]", $r);
1065 * getDefaultFormClass()¤Ç¼èÆÀ¤·¤¿¥¯¥é¥¹Ì¾¤«¤é¥¢¥¯¥·¥ç¥ó̾¤ò¼èÆÀ¤¹¤ë
1067 * getDefaultFormClass()¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤¿¾ì¹ç¡¢¤³¤Á¤é¤â¹ç¤ï¤»¤Æ¥ª¡¼¥Ð¡¼¥é¥¤¥É
1068 * ¤¹¤ë¤³¤È¤ò¿ä¾©(ɬ¿Ü¤Ç¤Ï¤Ê¤¤)
1071 * @param string $class_name ¥Õ¥©¡¼¥à¥¯¥é¥¹Ì¾
1072 * @return string ¥¢¥¯¥·¥ç¥ó̾
1074 function actionFormToName($class_name)
1076 $prefix = sprintf("%s_Form_", $this->getAppId());
1077 if (preg_match("/$prefix(.*)/", $class_name, $match) == 0) {
1081 $target = $match[1];
1083 $action_name = substr(preg_replace('/([A-Z])/e', "'_' . strtolower('\$1')", $target), 1);
1085 return $action_name;
1089 * ¥¢¥¯¥·¥ç¥ó¤ËÂбþ¤¹¤ë¥Õ¥©¡¼¥à¥Ñ¥¹Ì¾¤¬¾Êά¤µ¤ì¤¿¾ì¹ç¤Î¥Ç¥Õ¥©¥ë¥È¥Ñ¥¹Ì¾¤òÊÖ¤¹
1091 * ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï_getDefaultActionPath()¤ÈƱ¤¸·ë²Ì¤òÊÖ¤¹(1¥Õ¥¡¥¤¥ë¤Ë
1092 * ¥¢¥¯¥·¥ç¥ó¥¯¥é¥¹¤È¥Õ¥©¡¼¥à¥¯¥é¥¹¤¬µ½Ò¤µ¤ì¤ë)¤Î¤Ç¡¢¹¥¤ß¤Ë±þ¤¸¤Æ
1093 * ¥ª¡¼¥Ð¡¼¥é¥¤¥É¤¹¤ë
1096 * @param string $action_name ¥¢¥¯¥·¥ç¥ó̾
1097 * @param bool $fallback ¥¯¥é¥¤¥¢¥ó¥È¼ïÊ̤ˤè¤ëfallback on/off
1098 * @return string form class¤¬ÄêµÁ¤µ¤ì¤ë¥¹¥¯¥ê¥×¥È¤Î¥Ñ¥¹Ì¾
1100 function getDefaultFormPath($action_name, $fallback = true)
1102 return $this->getDefaultActionPath($action_name, $fallback);
1106 * »ØÄꤵ¤ì¤¿¥¢¥¯¥·¥ç¥ó¤Î¥¯¥é¥¹Ì¾¤òÊÖ¤¹(¥ª¥Ö¥¸¥§¥¯¥È¤ÎÀ¸À®¤Ï¹Ô¤ï¤Ê¤¤)
1109 * @param string $action_name ¥¢¥¯¥·¥ç¥ó¤Î̾¾Î
1110 * @return string ¥¢¥¯¥·¥ç¥ó¤Î¥¯¥é¥¹Ì¾
1112 function getActionClassName($action_name)
1114 $action_obj =& $this->_getAction($action_name);
1115 if ($action_obj == null) {
1119 return $action_obj['class_name'];
1123 * ¥¢¥¯¥·¥ç¥ó¤ËÂбþ¤¹¤ë¥¢¥¯¥·¥ç¥ó¥¯¥é¥¹Ì¾¤¬¾Êά¤µ¤ì¤¿¾ì¹ç¤Î¥Ç¥Õ¥©¥ë¥È¥¯¥é¥¹Ì¾¤òÊÖ¤¹
1125 * ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï[¥×¥í¥¸¥§¥¯¥ÈID]_Action_[¥¢¥¯¥·¥ç¥ó̾]¤È¤Ê¤ë¤Î¤Ç¹¥¤ß±þ¤¸¤Æ¥ª¡¼¥Ð¥é¥¤¥É¤¹¤ë
1128 * @param string $action_name ¥¢¥¯¥·¥ç¥ó̾
1129 * @param bool $fallback ¥¯¥é¥¤¥¢¥ó¥È¼ïÊ̤ˤè¤ëfallback on/off
1130 * @return string ¥¢¥¯¥·¥ç¥ó¥¯¥é¥¹Ì¾
1132 function getDefaultActionClass($action_name, $fallback = true)
1134 $postfix = preg_replace('/_(.)/e', "strtoupper('\$1')", ucfirst($action_name));
1137 if ($this->getClientType() == CLIENT_TYPE_SOAP) {
1138 $r = sprintf("%s_SOAPAction_%s", $this->getAppId(), $postfix);
1139 } else if ($this->getClientType() == CLIENT_TYPE_MOBILE_AU) {
1140 $tmp = sprintf("%s_MobileAUAction_%s", $this->getAppId(), $postfix);
1141 if ($fallback == false || class_exists($tmp)) {
1147 $r = sprintf("%s_Action_%s", $this->getAppId(), $postfix);
1149 $this->logger->log(LOG_DEBUG, "default action class [%s]", $r);
1154 * getDefaultActionClass()¤Ç¼èÆÀ¤·¤¿¥¯¥é¥¹Ì¾¤«¤é¥¢¥¯¥·¥ç¥ó̾¤ò¼èÆÀ¤¹¤ë
1156 * getDefaultActionClass()¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤¿¾ì¹ç¡¢¤³¤Á¤é¤â¹ç¤ï¤»¤Æ¥ª¡¼¥Ð¡¼¥é¥¤¥É
1157 * ¤¹¤ë¤³¤È¤ò¿ä¾©(ɬ¿Ü¤Ç¤Ï¤Ê¤¤)
1160 * @param string $class_name ¥¢¥¯¥·¥ç¥ó¥¯¥é¥¹Ì¾
1161 * @return string ¥¢¥¯¥·¥ç¥ó̾
1163 function actionClassToName($class_name)
1165 $prefix = sprintf("%s_Action_", $this->getAppId());
1166 if (preg_match("/$prefix(.*)/", $class_name, $match) == 0) {
1170 $target = $match[1];
1172 $action_name = substr(preg_replace('/([A-Z])/e', "'_' . strtolower('\$1')", $target), 1);
1174 return $action_name;
1178 * ¥¢¥¯¥·¥ç¥ó¤ËÂбþ¤¹¤ë¥¢¥¯¥·¥ç¥ó¥Ñ¥¹Ì¾¤¬¾Êά¤µ¤ì¤¿¾ì¹ç¤Î¥Ç¥Õ¥©¥ë¥È¥Ñ¥¹Ì¾¤òÊÖ¤¹
1180 * ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï"foo_bar" -> "/Foo/Bar.php"¤È¤Ê¤ë¤Î¤Ç¹¥¤ß±þ¤¸¤Æ¥ª¡¼¥Ð¡¼¥é¥¤¥É¤¹¤ë
1183 * @param string $action_name ¥¢¥¯¥·¥ç¥ó̾
1184 * @param bool $fallback ¥¯¥é¥¤¥¢¥ó¥È¼ïÊ̤ˤè¤ëfallback on/off
1185 * @return string ¥¢¥¯¥·¥ç¥ó¥¯¥é¥¹¤¬ÄêµÁ¤µ¤ì¤ë¥¹¥¯¥ê¥×¥È¤Î¥Ñ¥¹Ì¾
1187 function getDefaultActionPath($action_name, $fallback = true)
1189 $default_path = preg_replace('/_(.)/e', "'/' . strtoupper('\$1')", ucfirst($action_name)) . '.' . $this->getExt('php');
1190 $action_dir = $this->getActiondir();
1192 if ($this->getClientType() == CLIENT_TYPE_SOAP) {
1193 $r = 'SOAP/' . $default_path;
1194 } else if ($this->getClientType() == CLIENT_TYPE_MOBILE_AU) {
1195 $r = 'MobileAU/' . $default_path;
1200 if ($fallback && file_exists($action_dir . $r) == false && $r != $default_path) {
1201 $this->logger->log(LOG_DEBUG, 'client_type specific file not found [%s] -> try defualt', $r);
1205 $this->logger->log(LOG_DEBUG, "default action path [%s]", $r);
1210 * »ØÄꤵ¤ì¤¿Á«°Ü̾¤ËÂбþ¤¹¤ë¥Ó¥å¡¼¥¯¥é¥¹Ì¾¤òÊÖ¤¹(¥ª¥Ö¥¸¥§¥¯¥È¤ÎÀ¸À®¤Ï¹Ô¤ï¤Ê¤¤)
1213 * @param string $forward_name Á«°ÜÀè¤Î̾¾Î
1214 * @return string view class¤Î¥¯¥é¥¹Ì¾
1216 function getViewClassName($forward_name)
1218 if ($forward_name == null) {
1222 if (isset($this->forward[$forward_name])) {
1223 $forward_obj = $this->forward[$forward_name];
1225 $forward_obj = array();
1228 if (isset($forward_obj['view_name'])) {
1229 $class_name = $forward_obj['view_name'];
1230 if (class_exists($class_name)) {
1237 // view¤Î¥¤¥ó¥¯¥ë¡¼¥É
1238 $this->_includeViewScript($forward_obj, $forward_name);
1240 if (is_null($class_name) == false && class_exists($class_name)) {
1242 } else if (is_null($class_name) == false) {
1243 $this->logger->log(LOG_WARNING, 'stated view class is not defined [%s] -> try default', $class_name);
1246 $class_name = $this->getDefaultViewClass($forward_name);
1247 if (class_exists($class_name)) {
1250 $class_name = $this->class_factory->getObjectName('view');
1251 $this->logger->log(LOG_DEBUG, 'view class is not defined for [%s] -> use default [%s]', $forward_name, $class_name);
1257 * Á«°Ü̾¤ËÂбþ¤¹¤ë¥Ó¥å¡¼¥¯¥é¥¹Ì¾¤¬¾Êά¤µ¤ì¤¿¾ì¹ç¤Î¥Ç¥Õ¥©¥ë¥È¥¯¥é¥¹Ì¾¤òÊÖ¤¹
1259 * ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï[¥×¥í¥¸¥§¥¯¥ÈID]_View_[Á«°Ü̾]¤È¤Ê¤ë¤Î¤Ç¹¥¤ß±þ¤¸¤Æ¥ª¡¼¥Ð¥é¥¤¥É¤¹¤ë
1262 * @param string $forward_name forward̾
1263 * @param bool $fallback ¥¯¥é¥¤¥¢¥ó¥È¼ïÊ̤ˤè¤ëfallback on/off
1264 * @return string view class¥¯¥é¥¹Ì¾
1266 function getDefaultViewClass($forward_name, $fallback = true)
1268 $postfix = preg_replace('/_(.)/e', "strtoupper('\$1')", ucfirst($forward_name));
1271 if ($this->getClientType() == CLIENT_TYPE_MOBILE_AU) {
1272 $tmp = sprintf("%s_MobileAUView_%s", $this->getAppId(), $postfix);
1273 if ($fallback == false || class_exists($tmp)) {
1279 $r = sprintf("%s_View_%s", $this->getAppId(), $postfix);
1281 $this->logger->log(LOG_DEBUG, "default view class [%s]", $r);
1286 * Á«°Ü̾¤ËÂбþ¤¹¤ë¥Ó¥å¡¼¥Ñ¥¹Ì¾¤¬¾Êά¤µ¤ì¤¿¾ì¹ç¤Î¥Ç¥Õ¥©¥ë¥È¥Ñ¥¹Ì¾¤òÊÖ¤¹
1288 * ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï"foo_bar" -> "/Foo/Bar.php"¤È¤Ê¤ë¤Î¤Ç¹¥¤ß±þ¤¸¤Æ¥ª¡¼¥Ð¡¼¥é¥¤¥É¤¹¤ë
1291 * @param string $forward_name forward̾
1292 * @param bool $fallback ¥¯¥é¥¤¥¢¥ó¥È¼ïÊ̤ˤè¤ëfallback on/off
1293 * @return string view class¤¬ÄêµÁ¤µ¤ì¤ë¥¹¥¯¥ê¥×¥È¤Î¥Ñ¥¹Ì¾
1295 function getDefaultViewPath($forward_name, $fallback = true)
1297 $default_path = preg_replace('/_(.)/e', "'/' . strtoupper('\$1')", ucfirst($forward_name)) . '.' . $this->getExt('php');
1298 $view_dir = $this->getViewdir();
1300 if ($this->getClientType() == CLIENT_TYPE_MOBILE_AU) {
1301 $r = 'MobileAU/' . $r;
1306 if ($fallback && file_exists($view_dir . $r) == false && $r != $default_path) {
1307 $this->logger->log(LOG_DEBUG, 'client_type specific file not found [%s] -> try defualt', $r);
1311 $this->logger->log(LOG_DEBUG, "default view path [%s]", $r);
1316 * Á«°Ü̾¤ËÂбþ¤¹¤ë¥Æ¥ó¥×¥ì¡¼¥È¥Ñ¥¹Ì¾¤¬¾Êά¤µ¤ì¤¿¾ì¹ç¤Î¥Ç¥Õ¥©¥ë¥È¥Ñ¥¹Ì¾¤òÊÖ¤¹
1318 * ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï"foo_bar"¤È¤¤¤¦forward̾¤¬"foo/bar" + ¥Æ¥ó¥×¥ì¡¼¥È³ÈÄ¥»Ò¤È¤Ê¤ë
1319 * ¤Î¤Ç¹¥¤ß±þ¤¸¤Æ¥ª¡¼¥Ð¥é¥¤¥É¤¹¤ë
1322 * @param string $forward_name forward̾
1323 * @return string forward¥Ñ¥¹Ì¾
1325 function getDefaultForwardPath($forward_name)
1327 return str_replace('_', '/', $forward_name) . '.' . $this->ext['tpl'];
1331 * ¥Æ¥ó¥×¥ì¡¼¥È¥Ñ¥¹Ì¾¤«¤éÁ«°Ü̾¤ò¼èÆÀ¤¹¤ë
1333 * getDefaultForwardPath()¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤¿¾ì¹ç¡¢¤³¤Á¤é¤â¹ç¤ï¤»¤Æ¥ª¡¼¥Ð¡¼¥é¥¤¥É
1334 * ¤¹¤ë¤³¤È¤ò¿ä¾©(ɬ¿Ü¤Ç¤Ï¤Ê¤¤)
1337 * @param string $forward_path ¥Æ¥ó¥×¥ì¡¼¥È¥Ñ¥¹Ì¾
1338 * @return string Á«°Ü̾
1340 function forwardPathToName($forward_path)
1342 $forward_path = preg_replace('/^\/+/', '', $forward_path);
1343 $forward_path = preg_replace(sprintf('/\.%s$/', $this->getExt('tpl')), '', $forward_path);
1345 return str_replace('/', '_', $forward_path);
1349 * Á«°Ü̾¤«¤é¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹Ì¾¤ò¼èÆÀ¤¹¤ë
1352 * @param string $forward_name forward̾
1353 * @return string ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹Ì¾
1355 function _getForwardPath($forward_name)
1357 $forward_obj = null;
1359 if (isset($this->forward[$forward_name]) == false) {
1361 $this->forward[$forward_name] = array();
1363 $forward_obj =& $this->forward[$forward_name];
1364 if (isset($forward_obj['forward_path']) == false) {
1366 $forward_obj['forward_path'] = $this->getDefaultForwardPath($forward_name);
1369 return $forward_obj['forward_path'];
1373 * ¥Æ¥ó¥×¥ì¡¼¥È¥¨¥ó¥¸¥ó¼èÆÀ¤¹¤ë(¸½ºß¤Ïsmarty¤Î¤ßÂбþ)
1376 * @return object Smarty ¥Æ¥ó¥×¥ì¡¼¥È¥¨¥ó¥¸¥ó¥ª¥Ö¥¸¥§¥¯¥È
1378 function &getTemplateEngine()
1380 $smarty =& new Smarty();
1381 $smarty->template_dir = $this->getTemplatedir();
1382 $smarty->compile_dir = $this->getDirectory('template_c') . '/tpl_' . md5($smarty->template_dir);
1383 if (@is_dir($smarty->compile_dir) == false) {
1384 mkdir($smarty->compile_dir, 0755);
1386 $smarty->plugins_dir = $this->getDirectory('plugins');
1388 // default modifiers
1389 $smarty->register_modifier('number_format', 'smarty_modifier_number_format');
1390 $smarty->register_modifier('strftime', 'smarty_modifier_strftime');
1391 $smarty->register_modifier('count', 'smarty_modifier_count');
1392 $smarty->register_modifier('join', 'smarty_modifier_join');
1393 $smarty->register_modifier('filter', 'smarty_modifier_filter');
1394 $smarty->register_modifier('unique', 'smarty_modifier_unique');
1395 $smarty->register_modifier('wordwrap_i18n', 'smarty_modifier_wordwrap_i18n');
1396 $smarty->register_modifier('truncate_i18n', 'smarty_modifier_truncate_i18n');
1397 $smarty->register_modifier('i18n', 'smarty_modifier_i18n');
1398 $smarty->register_modifier('checkbox', 'smarty_modifier_checkbox');
1399 $smarty->register_modifier('select', 'smarty_modifier_select');
1400 $smarty->register_modifier('form_value', 'smarty_modifier_form_value');
1402 // user defined modifiers
1403 foreach ($this->smarty_modifier_plugin as $modifier) {
1404 $name = str_replace('smarty_modifier_', '', $modifier);
1405 $smarty->register_modifier($name, $modifier);
1408 // default functions
1409 $smarty->register_function('is_error', 'smarty_function_is_error');
1410 $smarty->register_function('message', 'smarty_function_message');
1411 $smarty->register_function('uniqid', 'smarty_function_uniqid');
1412 $smarty->register_function('select', 'smarty_function_select');
1413 $smarty->register_function('checkbox_list', 'smarty_function_checkbox_list');
1415 // user defined functions
1416 foreach ($this->smarty_function_plugin as $function) {
1417 $name = str_replace('smarty_function_', '', $function);
1418 $smarty->register_function($name, $function);
1421 // user defined prefilters
1422 foreach ($this->smarty_prefilter_plugin as $prefilter) {
1423 $smarty->register_prefilter($prefilter);
1426 // user defined postfilters
1427 foreach ($this->smarty_postfilter_plugin as $postfilter) {
1428 $smarty->register_postfilter($postfilter);
1431 // user defined outputfilters
1432 foreach ($this->smarty_outputfilter_plugin as $outputfilter) {
1433 $smarty->register_outputfilter($outputfilter);
1436 $this->_setDefaultTemplateEngine($smarty);
1442 * ¥Æ¥ó¥×¥ì¡¼¥È¥¨¥ó¥¸¥ó¤Î¥Ç¥Õ¥©¥ë¥È¾õÂÖ¤òÀßÄꤹ¤ë
1445 * @param object Smarty $smarty ¥Æ¥ó¥×¥ì¡¼¥È¥¨¥ó¥¸¥ó¥ª¥Ö¥¸¥§¥¯¥È
1447 function _setDefaultTemplateEngine(&$smarty)
1452 * »ÈÍѸÀ¸ì¤òÀßÄꤹ¤ë
1454 * ¾Íè¤Ø¤Î³ÈÄ¥¤Î¤¿¤á¤Î¤ß¤Ë¸ºß¤·¤Æ¤¤¤Þ¤¹¡£¸½ºß¤ÏÆä˥ª¡¼¥Ð¡¼¥é¥¤¥É¤ÎɬÍפϤ¢¤ê¤Þ¤»¤ó¡£
1457 * @param string $language ¸À¸ìÄêµÁ(LANG_JA, LANG_EN...)
1458 * @param string $system_encoding ¥·¥¹¥Æ¥à¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°Ì¾
1459 * @param string $client_encoding ¥¯¥é¥¤¥¢¥ó¥È¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°
1461 function _setLanguage($language, $system_encoding = null, $client_encoding = null)
1463 $this->language = $language;
1464 $this->system_encoding = $system_encoding;
1465 $this->client_encoding = $client_encoding;
1467 $i18n =& $this->getI18N();
1468 $i18n->setLanguage($language, $system_encoding, $client_encoding);
1472 * ¥Ç¥Õ¥©¥ë¥È¾õÂ֤ǤλÈÍѸÀ¸ì¤ò¼èÆÀ¤¹¤ë
1475 * @return array »ÈÍѸÀ¸ì,¥·¥¹¥Æ¥à¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°Ì¾,¥¯¥é¥¤¥¢¥ó¥È¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°Ì¾
1477 function _getDefaultLanguage()
1479 return array(LANG_JA, null, null);
1483 * ¥Ç¥Õ¥©¥ë¥È¾õÂ֤ǤΥ¯¥é¥¤¥¢¥ó¥È¥¿¥¤¥×¤ò¼èÆÀ¤¹¤ë
1486 * @return int ¥¯¥é¥¤¥¢¥ó¥È¥¿¥¤¥×ÄêµÁ(CLIENT_TYPE_WWW...)
1488 function _getDefaultClientType()
1490 if (is_null($GLOBALS['_Ethna_client_type']) == false) {
1491 return $GLOBALS['_Ethna_client_type'];
1493 return CLIENT_TYPE_WWW;
1497 * ¥Þ¥Í¡¼¥¸¥ã¥¯¥é¥¹Ì¾¤ò¼èÆÀ¤¹¤ë
1500 * @param string $name ¥Þ¥Í¡¼¥¸¥ã̾
1501 * @return string ¥Þ¥Í¡¼¥¸¥ã¥¯¥é¥¹Ì¾
1503 function getManagerClassName($name)
1505 return sprintf('%s_%sManager', $this->getAppId(), ucfirst($name));
1509 * ¥¢¥¯¥·¥ç¥ó¥¹¥¯¥ê¥×¥È¤ò¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë
1511 * ¤¿¤À¤·¡¢¥¤¥ó¥¯¥ë¡¼¥É¤·¤¿¥Õ¥¡¥¤¥ë¤Ë¥¯¥é¥¹¤¬Àµ¤·¤¯ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¤ÏÊݾڤ·¤Ê¤¤
1514 * @param array $action_obj ¥¢¥¯¥·¥ç¥óÄêµÁ
1515 * @param string $action_name ¥¢¥¯¥·¥ç¥ó̾
1517 function _includeActionScript($action_obj, $action_name)
1519 $class_path = $form_path = null;
1521 $action_dir = $this->getActiondir();
1523 // class_path°À¥Á¥§¥Ã¥¯
1524 if (isset($action_obj['class_path'])) {
1525 // ¥Õ¥ë¥Ñ¥¹»ØÄꥵ¥Ý¡¼¥È
1526 $tmp_path = $action_obj['class_path'];
1527 if (Ethna_Util::isAbsolute($tmp_path) == false) {
1528 $tmp_path = $action_dir . $tmp_path;
1531 if (file_exists($tmp_path) == false) {
1532 $this->logger->log(LOG_WARNING, 'class_path file not found [%s] -> try default', $tmp_path);
1534 include_once($tmp_path);
1535 $class_path = $tmp_path;
1539 // ¥Ç¥Õ¥©¥ë¥È¥Á¥§¥Ã¥¯
1540 if (is_null($class_path)) {
1541 $class_path = $this->getDefaultActionPath($action_name);
1542 if (file_exists($action_dir . $class_path)) {
1543 include_once($action_dir . $class_path);
1545 $this->logger->log(LOG_DEBUG, 'default action file not found [%s] -> try all files', $class_path);
1550 // Á´¥Õ¥¡¥¤¥ë¥¤¥ó¥¯¥ë¡¼¥É
1551 if (is_null($class_path)) {
1552 $this->_includeDirectory($this->getActiondir());
1556 // form_path°À¥Á¥§¥Ã¥¯
1557 if (isset($action_obj['form_path'])) {
1558 // ¥Õ¥ë¥Ñ¥¹»ØÄꥵ¥Ý¡¼¥È
1559 $tmp_path = $action_obj['class_path'];
1560 if (Ethna_Util::isAbsolute($tmp_path) == false) {
1561 $tmp_path = $action_dir . $tmp_path;
1564 if ($tmp_path == $class_path) {
1567 if (file_exists($tmp_path) == false) {
1568 $this->logger->log(LOG_WARNING, 'form_path file not found [%s] -> try default', $tmp_path);
1570 include_once($tmp_path);
1571 $form_path = $tmp_path;
1575 // ¥Ç¥Õ¥©¥ë¥È¥Á¥§¥Ã¥¯
1576 if (is_null($form_path)) {
1577 $form_path = $this->getDefaultFormPath($action_name);
1578 if ($form_path == $class_path) {
1581 if (file_exists($action_dir . $form_path)) {
1582 include_once($action_dir . $form_path);
1584 $this->logger->log(LOG_DEBUG, 'default form file not found [%s] -> maybe falling back to default form class', $form_path);
1590 * ¥Ó¥å¡¼¥¹¥¯¥ê¥×¥È¤ò¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë
1592 * ¤¿¤À¤·¡¢¥¤¥ó¥¯¥ë¡¼¥É¤·¤¿¥Õ¥¡¥¤¥ë¤Ë¥¯¥é¥¹¤¬Àµ¤·¤¯ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¤ÏÊݾڤ·¤Ê¤¤
1595 * @param array $forward_obj Á«°ÜÄêµÁ
1596 * @param string $forward_name Á«°Ü̾
1598 function _includeViewScript($forward_obj, $forward_name)
1600 $view_dir = $this->getViewdir();
1602 // view_path°À¥Á¥§¥Ã¥¯
1603 if (isset($forward_obj['view_path'])) {
1604 // ¥Õ¥ë¥Ñ¥¹»ØÄꥵ¥Ý¡¼¥È
1605 $tmp_path = $forward_obj['view_path'];
1606 if (Ethna_Util::isAbsolute($tmp_path) == false) {
1607 $tmp_path = $view_dir . $tmp_path;
1610 if (file_exists($tmp_path) == false) {
1611 $this->logger->log(LOG_WARNING, 'view_path file not found [%s] -> try default', $tmp_path);
1613 include_once($tmp_path);
1618 // ¥Ç¥Õ¥©¥ë¥È¥Á¥§¥Ã¥¯
1619 $view_path = $this->getDefaultViewPath($forward_name);
1620 if (file_exists($view_dir . $view_path)) {
1621 include_once($view_dir . $view_path);
1624 $this->logger->log(LOG_DEBUG, 'default view file not found [%s]', $view_path);
1630 * ¥Ç¥£¥ì¥¯¥È¥ê°Ê²¼¤ÎÁ´¤Æ¤Î¥¹¥¯¥ê¥×¥È¤ò¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë
1634 function _includeDirectory($dir)
1636 $ext = "." . $this->ext['php'];
1637 $ext_len = strlen($ext);
1639 if (is_dir($dir) == false) {
1643 $dh = opendir($dir);
1645 while (($file = readdir($dh)) !== false) {
1646 if ($file != '.' && $file != '..' && is_dir("$dir/$file")) {
1647 $this->_includeDirectory("$dir/$file");
1649 if (substr($file, -$ext_len, $ext_len) != $ext) {
1652 include_once("$dir/$file");
1659 * ÀßÄê¥Õ¥¡¥¤¥ë¤ÎDSNÄêµÁ¤«¤é»ÈÍѤ¹¤ë¥Ç¡¼¥¿¤òºÆ¹½ÃÛ¤¹¤ë(¥¹¥ì¡¼¥Ö¥¢¥¯¥»¥¹Ê¬´ôÅù)
1661 * DSN¤ÎÄêµÁÊýË¡(¥Ç¥Õ¥©¥ë¥È:ÀßÄê¥Õ¥¡¥¤¥ë)¤òÊѤ¨¤¿¤¤¾ì¹ç¤Ï¤³¤³¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤¹¤ë
1664 * @return array DSNÄêµÁ
1666 function _prepareDSN()
1670 foreach ($this->db as $key => $value) {
1671 $config_key = "dsn";
1673 $config_key .= "_$key";
1675 $dsn = $this->config->get($config_key);
1676 if (is_array($dsn)) {
1677 // ¼ïÊÌ1¤Ä¤Ë¤Ä¤Ê£¿ôDSN¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¥¢¥¯¥»¥¹Ê¬´ô
1678 $dsn = $this->_selectDSN($key, $dsn);
1686 * DSN¤Î¥¢¥¯¥»¥¹Ê¬´ô¤ò¹Ô¤¦
1688 * ¥¹¥ì¡¼¥Ö¥µ¡¼¥Ð¤Ø¤Î¿¶Ê¬¤±½èÍý(¥Ç¥Õ¥©¥ë¥È:¥é¥ó¥À¥à)¤òÊѹ¹¤·¤¿¤¤¾ì¹ç¤Ï¤³¤Î¥á¥½¥Ã¥É¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤¹¤ë
1691 * @param string $type DB¼ïÊÌ
1692 * @param array $dsn_list DSN°ìÍ÷
1693 * @return string ÁªÂò¤µ¤ì¤¿DSN
1695 function _selectDSN($type, $dsn_list)
1697 // ¥Ç¥Õ¥©¥ë¥È:¥é¥ó¥À¥à
1698 list($usec, $sec) = explode(' ', microtime());
1699 mt_srand($sec + ((float) $usec * 100000));
1700 $n = mt_rand(0, count($dsn_list)-1);
1702 return $dsn_list[$n];
1706 * Ethna¥Þ¥Í¡¼¥¸¥ã¤òÀßÄꤹ¤ë
1708 * ÉÔÍפʾì¹ç¤Ï¶õ¤Î¥á¥½¥Ã¥É¤È¤·¤Æ¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤Æ¤â¤è¤¤
1712 function _activateEthnaManager()
1714 if ($this->config->get('debug') == false) {
1718 include_once(ETHNA_BASE . '/class/Ethna_InfoManager.php');
1721 $this->action['__ethna_info__'] = array(
1722 'form_name' => 'Ethna_Form_Info',
1723 'form_path' => sprintf('%s/class/Action/Ethna_Action_Info.php', ETHNA_BASE),
1724 'class_name' => 'Ethna_Action_Info',
1725 'class_path' => sprintf('%s/class/Action/Ethna_Action_Info.php', ETHNA_BASE),
1729 $this->forward['__ethna_info__'] = array(
1730 'forward_path' => sprintf('%s/tpl/info.tpl', ETHNA_BASE),
1731 'view_name' => 'Ethna_View_Info',
1732 'view_path' => sprintf('%s/class/View/Ethna_View_Info.php', ETHNA_BASE),