Exemplo n.º 1
0
        ?>
" width="11" height="11"></a>
			<?php 
    }
    ?>
		</h4>
		<div class="article-content<?php 
    if ($row['DelUsersID']) {
        ?>
 comment-deleted<?php 
    }
    ?>
">
			<p>
				<?php 
    echo parse_comment($row['Comments']);
    ?>
			</p>
		</div>
	<?php 
}
?>

<?php 
if ($count > 10 && !isset($_GET['comments'])) {
    ?>
	<h3>
		<a href="<?php 
    echo htmlentities(get_pkgbase_uri($pkgbase_name), ENT_QUOTES) . '?' . mkurl('comments=all');
    ?>
" title="<?php 
Exemplo n.º 2
0
function build_route_file($return = false)
{
    $meta = array();
    if ($cfiles = glob(AROOT . 'controller' . DS . '*Controller.php')) {
        foreach ($cfiles as $cfile) {
            require_once $cfile;
        }
    }
    if ($classes = get_declared_classes()) {
        $ret = array();
        foreach ($classes as $class) {
            if (end_with($class, 'Controller')) {
                // 开始遍历
                $ref = new \ReflectionClass($class);
                if ($methods = $ref->getMethods()) {
                    foreach ($methods as $method) {
                        $item = array();
                        if ($item['meta'] = format_meta(parse_comment($method->getDocComment()))) {
                            $item['class'] = $class;
                            $item['method'] = $method->name;
                            $item['meta']['binding'] = get_param_info($method->getParameters());
                            if (isset($item['meta']['LazyRoute'][0]['route'])) {
                                $item['meta']['route'][] = array('uri' => $item['meta']['LazyRoute'][0]['route'], 'params' => get_route_params($item['meta']['LazyRoute'][0]['route']));
                            }
                            $ret[] = $item;
                        }
                    }
                }
            }
        }
        if (count($ret) > 0) {
            foreach ($ret as $method_info) {
                // 只处理标记了路由的方法
                if (isset($method_info['meta']['route'])) {
                    //print_r( $method_info['meta']['route'] );
                    $key = cmkey($method_info);
                    //echo "{$method_info['class']} , {$method_info['method']} = $key (build) \r\n";
                    $meta[$key] = $method_info['meta'];
                    // 生成路由部分代码
                    foreach ($method_info['meta']['route'] as $route) {
                        $source[] = '$app->' . "route('" . t($route['uri']) . "',array( '" . $method_info['class'] . "','" . $method_info['method'] . "'));";
                    }
                }
            }
        }
    }
    $GLOBALS['meta'] = $meta;
    if (isset($source) && is_array($source) && count($source) > 0) {
        $source_code = build_source_code($source, $meta);
        if ($return) {
            return $source_code;
        } else {
            save_route_file($source_code);
        }
    }
}