確認画面自動生成
- registry.phpがphp4で動かんので直してみる。
<?php function &singleton( $class ) { static $instances; if ( !is_array( $instances ) ) { $instances = array(); } if ( !isset( $instances[$class] ) ) { $instances[$class] =& new $class; } return $instances[$class]; } class Registry { var $_registry; var $values; function initialize() { $this->_registry =& singleton( 'Registry' ); } function getInstance() { $this->_registry =& singleton( 'Registry' ); return $this->_registry; } function Registry() { $this->values = array(); } function get( $key ) { $_this =& singleton( 'Registry' ); if ( !array_key_exists( $key, $_this->values ) ) { return null; } return $_this->values[$key]; } function set( $key, $value ) { $_this =& singleton( 'Registry' ); $_this->values[$key] = $value; } } ?>
- debug1以上はキャッシュしない。
--- /path/to/compile/cached_view_file.php.org 2008-01-13 11:30:16.000000000 +0900 +++ /path/to/compile/cached_view_file.php 2008-11-14 02:42:39.000000000 +0900 @@ -45,7 +45,7 @@ * @return boolean true=ある */ function hasCompiledFile() { - + if (Configure::read() != 0) return false; $filePath = $this->getCompileFileName($this->fileName); if (!file_exists($filePath)) { return false;
- 空のラベル・空要素・ドットファイル対応。
--- /path/to/compile/modules/translation.php.org 2008-01-14 11:11:10.000000000 +0900 +++ /path/to/compile/modules/translation.php 2008-11-14 02:42:39.000000000 +0900 @@ -36,6 +36,8 @@ $text .= '"' . $key . '"=>' . $value . ', '; } else if (substr($value, 0, 1) == '(') { $text .= '"' . $key . '"=> array' . str_replace(":", "=>", $value) . ', '; + } else if ( $key == 'label' && !$value ) { + $text .= '"label"=>false, '; } else { $text .= '"' . $key . '"=>"' . $value . '", '; } @@ -74,14 +74,15 @@ * 変換しない */ class Other extends Translation { - + var $empty_tags = array( 'br', 'hr', 'meta', 'img', 'input', 'link', 'area', 'param', 'embed' ); function transBeginTag($dom) { - $html = "<" . $dom->iNodeName . " "; + $nodeName = $dom->iNodeName; + $html = "<" . $nodeName . " "; $attrValues = $dom->iNodeAttributes; foreach ($attrValues as $key => $value) { $html .= $key . "='" . $value . "' "; } - $html .= ">"; + $html .= in_array( $nodeName, $this->empty_tags ) ? "/>" : ">"; return $html; } @@ -116,6 +117,7 @@ $DIRECTORY = dirname(__FILE__); $dir = dir($DIRECTORY); while ($file = $dir->read()) { + if ( preg_match( '/^\./', $file ) ) continue; $path = $DIRECTORY . DS . $file; if (basename(__FILE__) != $file && is_file($path)) { require_once($path);
- </script></script>の対応
--- /path/to/compile/modules/script.php.org 2008-01-13 11:30:16.000000000 +0900 +++ /path/to/compile/modules/script.php 2008-11-14 00:07:08.000000000 +0900 @@ -31,8 +31,20 @@ if (stristr($attrValues["src"], "http") !== false) { return false; } + Registry::set( 'replaice_script', true ); $script = '<?php echo $javascript->link("' . $attrValues["src"] . '"); ?>'; return $script; } + function transEndTag( $dom) { + if ("script" != $dom->iNodeName) { + return false; + } + if ( Registry::get( 'replaice_script' ) ) { + Registry::set( 'replaice_script', false ); + return "\n"; + } + + return false; + } } ?>
- デフォで<div>で囲まれるのはかんべん
--- /path/to/compile/modules/input.php.org 2008-01-14 12:37:32.000000000 +0900 +++ /path/to/compile/modules/input.php 2008-11-14 02:29:45.000000000 +0900 @@ -97,6 +97,7 @@ $input = '<?php echo $form->input("' . $attrValues["name"] . '", array('; unset($attrValues["name"]); + $attrValues["div"] = isset( $attrValues["div"] ) ? true : false; $input .= $this->arrayTo($attrValues); $input .= ')); ?>'; return $input; --- /path/to/compile/modules/select.php.org 2008-01-14 10:51:50.000000000 +0900 +++ /path/to/compile/modules/select.php 2008-11-14 02:32:26.000000000 +0900 @@ -35,6 +35,7 @@ $input = '<?php echo $form->input("' . $attrValues["name"] . '", array('; unset($attrValues["name"]); + $attrValues["div"] = isset( $attrValues["div"] ) ? true : false; $input .= $this->arrayTo($attrValues); $input .= ')); ?>'; return $input; --- /path/to/compile/modules/textarea.php.org 2008-01-14 12:28:06.000000000 +0900 +++ /path/to/compile/modules/textarea.php 2008-11-14 02:27:19.000000000 +0900 @@ -35,6 +35,7 @@ $input = '<?php echo $form->input("' . $attrValues["name"] . '", array('; unset($attrValues["name"]); + $attrValues["div"] = isset( $attrValues["div"] ) ? true : false; $input .= $this->arrayTo($attrValues); $input .= ')); ?>'; return $input;
- 改行を入れてみる
--- /path/to/compile/modules/form.php.org 2008-01-14 12:35:12.000000000 +0900 +++ /path/to/compile/modules/form.php 2008-11-14 00:19:40.000000000 +0900 @@ -56,8 +56,9 @@ $form = '<?php echo $form->create("' . $attrValues["model"] . '", array('; unset($attrValues["model"]); $form .= $this->arrayTo($attrValues); - $form .= ')); ?>'; + $form .= ")); ?>\n"; return $form; } @@ -67,7 +68,7 @@ foreach ($attrValues as $key => $value) { $form .= ' ' . $key . '="' . $value . '"'; } - $form .= '>'; + $form .= ">\n"; return $form; } --- /path/to/compile/modules/link.php.org 2008-01-13 11:30:16.000000000 +0900 +++ /path/to/compile/modules/link.php 2008-11-14 23:20:06.000000000 +0900 @@ -27,8 +27,9 @@ if (!array_key_exists("href", $attrValues)) { return false; } - $link = '<?php echo $html->css("' . basename($attrValues["href"], ".css") . '"); ?>'; + $link = '<?php echo $html->css("' . basename($attrValues["href"], ".css") . '"); ?>' . "\n"; return $link; } + } ?>
TODO
- <form freeze=""...>ではなく、<input type="hidden" name="freeze"...>にしたい。
- <input type="submit" ...>が動作してない...