コード例 #1
0
ファイル: ulang_control.php プロジェクト: renlong567/43168
 public function index_f()
 {
     $list = $this->lib('file')->ls($this->dir_phpok . 'view/');
     $fopen = fopen($this->dir_root . 'langs/lang2.php', 'wb');
     fwrite($fopen, '<?php' . "\n");
     foreach ($list as $key => $value) {
         $handle = fopen($value, 'rb');
         if ($handle) {
             $matches = false;
             while (($buffer = fgets($handle, 4096)) !== false) {
                 preg_match_all("/\\{lang([^\\}]+)\\}/isU", $buffer, $matches);
                 if ($matches && $matches[1]) {
                     foreach ($matches[1] as $k => $v) {
                         $v = str_replace(array("'", '"'), '', $v);
                         $lst = explode("|", $v);
                         $param = false;
                         if ($lst[1]) {
                             $tmp = explode(",", $lst[1]);
                             foreach ($tmp as $key2 => $value2) {
                                 $tmp2 = explode(":", $value2);
                                 if (!$param) {
                                     $param = array();
                                 }
                                 $param[$tmp2[0]] = '<span style="color:red">' . $tmp2[1] . '</span>';
                             }
                         }
                         if ($param) {
                             $string = "array(";
                             $i = 0;
                             foreach ($param as $key2 => $value2) {
                                 if ($i > 0) {
                                     $string .= ",";
                                 }
                                 $string .= "'" . $key . "'=>'" . $value . "'";
                                 $i++;
                             }
                             $string .= ")";
                             fwrite($fopen, "P_Lang('" . $lst[0] . "'," . $string . ");\n");
                         } else {
                             fwrite($fopen, "P_Lang('" . $v . "');\n");
                         }
                     }
                 }
             }
             fclose($handle);
             echo 'Update template: ' . $value . "<br />\n";
         }
     }
     fclose($fopen);
     echo 'Update success.';
     echo debug_time(1, 1, 1, 1);
 }
コード例 #2
0
function recognize(&$ret, &$writing, $rank)
{
    try {
        $debug_start = microtime(true);
        $c = new Character();
        $w = $c->create_sparse_writing($writing);
        //骨架化笔画
        $first_stroke_type = $c->get_first_stroke_type($w);
        //首笔的笔画类型(横竖撇点折)
        $int_strokes = sizeof($w->s);
        //笔画数
        $f = new Feature();
        $features = $f->make_feature($w);
        //获取特征
        $debug_end = microtime(true);
        $ret->debug .= "计算特征所需的时间:" . debug_time($debug_start, $debug_end) . "<br>";
        $debug_start = microtime(true);
        $dic = new Dictionary();
        $cands = $dic->get_candidates_by_strokes($int_strokes, $first_stroke_type, $rank);
        //初步获取候选字
        $debug_end = microtime(true);
        $ret->debug .= "获取候选字所需的时间:" . debug_time($debug_start, $debug_end) . "<br>";
        $debug_start = microtime(true);
        $rec = new Recognizer();
        $res = $rec->get_results($cands, $features, $debug_msg);
        //获取结果
        $debug_end = microtime(true);
        $ret->debug .= "匹配候选字所需的时间:" . debug_time($debug_start, $debug_end) . "<br>";
        if ($res != null) {
            $ret->msgno = MSG_OK;
            $ret->msg = MSG_OK_TXT;
            $ret->res = $res;
        } else {
            $ret->msgno = MSG_ERR;
            $ret->msg = MSG_ERR_NOCAND;
        }
    } catch (Exception $e) {
        $ret->msgno = MSG_ERR;
        $ret->msg = $e->getMessage();
    }
}
コード例 #3
0
ファイル: footer.php プロジェクト: verbazend/AWFA
	</div>
<?php } ?>
	</div><!-- wrapper -->
	<?php //include_once('style_selector.php'); ?>

	<?php if(!$data['status_gmap']): ?><script type="text/javascript" src="http<?php echo (is_ssl())? 's' : ''; ?>://maps.googleapis.com/maps/api/js?v=3.exp&amp;sensor=false&amp;language=<?php echo substr(get_locale(), 0, 2); ?>"></script><?php endif; ?>

	<!-- W3TC-include-js-head -->

	<?php wp_footer(); ?>
	
	<div class="pwdvbz"><a href="http://vbz.com.au/" target="_blank" >Powered by Verbazend</a></div>


	<?php echo $data['space_body']; ?>
	<?php debug_time(9999999); ?>
	<style>
		.pwdvbz {
			background-color:#282a2b !important;
			text-align:center;
			display:block;
			
		}
		.pwdvbz a {
			color:#3d4041 !important;
			
		  }
		  .riskrating {
		  	border:1px solid #b0163c;
		  	padding:3px;
		  	background-color:#ffc0d0;