本文整理汇总了PHP中Haanga::Load方法的典型用法代码示例。如果您正苦于以下问题:PHP Haanga::Load方法的具体用法?PHP Haanga::Load怎么用?PHP Haanga::Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Haanga
的用法示例。
在下文中一共展示了Haanga::Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_edit_form
function print_edit_form()
{
global $link, $comment, $current_user, $site_key, $globals;
if ($current_user->user_level != 'god' && time() - $comment->date > $globals['comment_edit_time']) {
die;
}
// $rows = min(40, max(substr_count($comment->content, "\n") * 2, 8));
echo '<div class="commentform">' . "\n";
//echo '<form action="'.htmlspecialchars($_SERVER['PHP_SELF']).'" class="comment" method="post" enctype="multipart/form-data">'."\n";
echo '<form action="' . htmlspecialchars($_SERVER['REQUEST_URI']) . '" class="comment" method="post" enctype="multipart/form-data">' . "\n";
echo '<input type="hidden" name="process" value="editcomment" />' . "\n";
echo '<input type="hidden" name="key" value="' . md5($comment->randkey . $site_key) . '" />' . "\n";
echo '<input type="hidden" name="id" value="' . $comment->id . '" />' . "\n";
echo '<fieldset><legend>' . _('editar comentario') . '</legend>' . "\n";
print_simpleformat_buttons('edit-comment-' . $comment->id);
echo '<div style="clear: right"><textarea name="comment_content" class="droparea" id="edit-comment-' . $comment->id . '" rows="5">' . $comment->content . '</textarea></div>' . "\n";
echo '<input class="button" type="submit" name="submit" value="' . _('modificar comentario') . '" />' . "\n";
// Allow gods to put "admin" comments which does not allow votes
if ($current_user->user_level == 'god') {
if ($comment->type == 'admin') {
$checked = 'checked="true"';
}
echo ' <label><strong>' . _('admin') . ' </strong><input name="type" type="checkbox" value="admin" ' . $checked . '/></label>' . "\n";
}
$vars = compact('link', 'comment');
Haanga::Load('comment_edit.html', $vars);
echo '</fieldset>' . "\n";
echo '</form>' . "\n";
echo "</div>\n";
}
示例2: create_form
function create_form($view, $title, $data = array())
{
global $site_key, $current_user;
$time = microtime(true) * 1000;
$form = array('title' => $title, 'hash' => sha1($site_key . $time . $current_user->user_id), 'time' => $time);
Haanga::Load("league/form.{$view}.tpl", compact('form', 'data'));
}
示例3: display
public function display($template, $page_title = '', $meta_description = '', array $css_files = array(), array $js_files = array())
{
$this->vars['page_title'] = $page_title ? $page_title : DEFAULT_PAGE_TITLE;
$this->vars['meta_description'] = $meta_description ? $meta_description : DEFAULT_META_DESCRIPTION;
// Add CSS files from arguments
if ($css_files) {
foreach ($css_files as $css_file) {
$this->css_files[] = $css_file;
}
}
$this->vars['css_files'] = $this->css_files;
// Add JS files from arguments
if ($js_files) {
foreach ($js_files as $js_file) {
$this->js_files[] = $js_file;
}
}
$this->vars['js_files'] = $this->js_files;
// Add preloaded CSS files
foreach ($this->preloaded_css_files as $css_file) {
$this->vars['css_files'][] = $css_file;
}
// Add preloaded JS files
foreach ($this->preloaded_js_files as $js_file) {
$this->vars['js_files'][] = $js_file;
}
$this->vars['js_vars'] = $this->js_vars;
$this->vars['breadcrumb'] = $this->breadcrumb;
Haanga::Load($template, $this->vars);
}
示例4: haanga_464bf9fc69ec3d748e58e59c7b427e138da5ab9b
function haanga_464bf9fc69ec3d748e58e59c7b427e138da5ab9b($vars, $return = FALSE, $blocks = array())
{
global $test_global, $global1;
extract($vars);
if ($return == TRUE) {
ob_start();
}
$buffer1 = '
';
$buffer2 = '
this is inner1
';
$blocks['inner1'] = isset($blocks['inner1']) ? strpos($blocks['inner1'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner1'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer2, $blocks['inner1']) : $buffer2;
$buffer1 .= $blocks['inner1'] . '
';
$buffer2 = '
this is inner2
';
$blocks['inner2'] = isset($blocks['inner2']) ? strpos($blocks['inner2'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner2'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer2, $blocks['inner2']) : $buffer2;
$buffer1 .= $blocks['inner2'] . '
';
$blocks['outer'] = isset($blocks['outer']) ? strpos($blocks['outer'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['outer'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['outer']) : $buffer1;
echo Haanga::Load('assert_templates/empty_block_base.tpl', $vars, TRUE, $blocks);
if ($return == TRUE) {
return ob_get_clean();
}
}
示例5: testIsCached
/**
* @dataProvider tplProvider
*/
public function testIsCached($test_file, $data, $expected)
{
/* same as above, but we ensure that the file wasn't compiled */
$this->init($test_file, $expected);
$output = Haanga::Load($test_file, $data, TRUE);
$this->assertEquals($output, $expected);
$this->assertFalse(Haanga::$has_compiled);
}
示例6: view
function view($name, $base = null)
{
$this->set('controller', router::$controller);
$this->set('route', router::$route);
$this->set('session', $this->session);
if ($base == null) {
$base = router::$views_path;
}
Haanga::Load($base . '/' . $name, kernel::$haanga_var);
}
示例7: testInvalidTemplates
/**
* @dataProvider tplProvider
*
*/
public function testInvalidTemplates($tpl)
{
Haanga_Compiler::setOption('allow_exec', FALSE);
try {
Haanga::Load($tpl);
$this->assertTrue(FALSE);
} catch (Haanga_Compiler_Exception $e) {
$i = preg_match("/in.*:[0-9]+/", $e->getMessage());
$this->assertEquals(1, $i);
}
}
示例8: print_summary
function print_summary($type = 'full', $karma_best_comment = 0, $show_tags = true)
{
global $current_user, $current_user, $globals, $db;
if (!$this->read) {
return;
}
$this->is_votable();
switch ($this->status) {
case 'queued':
// another color box for not-published
$box_class = 'mnm-queued';
break;
case 'abuse':
// another color box for discarded
// another color box for discarded
case 'autodiscard':
// another color box for discarded
// another color box for discarded
case 'discard':
// another color box for discarded
$box_class = 'mnm-discarded';
break;
case 'published':
// default for published
// default for published
default:
$box_class = 'mnm-published';
break;
}
$this->has_warning = !(!$this->check_warn() || $this->is_discarded());
$this->is_editable = $this->author == $current_user->user_id && $this->is_editable();
$this->total_votes = $this->votes + $this->anonymous;
$this->rpermalink = $this->get_relative_permalink();
$this->author_html = '<a href="' . get_user_uri($this->username, 'history') . '">' . $this->username . '</a>';
$this->normal_link = preg_replace('/\\/mobile\\//', '/', $this->get_relative_permalink());
$this->show_shakebox = $type != 'preview' && $this->votes > 0;
$this->thumb_url = $this->has_thumb();
if ($this->status == 'abuse' || $this->has_warning) {
$this->negative_text = FALSE;
$negatives = $db->get_row("select SQL_CACHE vote_value, count(vote_value) as count from votes where vote_type='links' and vote_link_id={$this->id} and vote_value < 0 group by vote_value order by count desc limit 1");
if ($negatives->count > 2 && $negatives->count >= $this->negatives / 2 && ($negatives->vote_value == -6 || $negatives->vote_value == -8)) {
$this->negative_text = get_negative_vote($negatives->vote_value);
}
}
$text = $this->content;
$my_domain = get_server_name();
$parent_domain = preg_replace('/m\\./', '', $my_domain);
if ($parent_domain != $my_domain && preg_match('#[^\\.]' . preg_quote($parent_domain) . '/#', $text)) {
$text = preg_replace('#([^\\.])' . preg_quote($parent_domain) . '/#', "\$1{$my_domain}/", $text);
}
$vars = compact('type', 'karma_best_comment', 'show_tags', 'box_class', 'nofollow', 'url', 'text');
$vars['self'] = $this;
return Haanga::Load('mobile/link_summary.html', $vars);
}
示例9: render
public function render()
{
$config = array('template_dir' => $this->getTemplateDir(), 'cache_dir' => $this->getCacheDir(), 'debug' => $this->debug, 'compiler' => array('allow_exec' => true));
if ($this->cache && is_callable('xcache_isset')) {
/* don't check for changes in the template for the next 5 min */
$config['check_ttl'] = 300;
$config['check_get'] = 'xcache_get';
$config['check_set'] = 'xcache_set';
}
\Haanga::configure($config);
\Haanga::Load($this->getTpl(), $this->data);
}
示例10: haanga_d905488f199a96b638d52d62c0fc424fd291ed39
function haanga_d905488f199a96b638d52d62c0fc424fd291ed39($vars, $return = FALSE, $blocks = array())
{
global $test_global, $global1;
extract($vars);
if ($return == TRUE) {
ob_start();
}
$buffer1 = '
2.1-overrided
';
$blocks['inner2_1'] = isset($blocks['inner2_1']) ? strpos($blocks['inner2_1'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner2_1'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['inner2_1']) : $buffer1;
echo Haanga::Load('assert_templates/nested_block_second_parent.tpl', $vars, TRUE, $blocks);
if ($return == TRUE) {
return ob_get_clean();
}
}
示例11: haanga_a2c536c1d9b6f09d66feff81ca9b1e993d15d32e
function haanga_a2c536c1d9b6f09d66feff81ca9b1e993d15d32e($vars, $return = FALSE, $blocks = array())
{
global $test_global, $global1;
extract($vars);
if ($return == TRUE) {
ob_start();
}
$buffer1 = '
{{block.1b3231655cebb7a1f783eddf27d254ca}}
new stuff
';
$blocks['outer'] = isset($blocks['outer']) ? strpos($blocks['outer'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['outer'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['outer']) : $buffer1;
echo Haanga::Load('assert_templates/nested_block.tpl', $vars, TRUE, $blocks);
if ($return == TRUE) {
return ob_get_clean();
}
}
示例12: haanga_8012978a44e77332b744185d044350c7eb89603f
function haanga_8012978a44e77332b744185d044350c7eb89603f($vars, $return = FALSE, $blocks = array())
{
global $test_global, $global1;
extract($vars);
if ($return == TRUE) {
ob_start();
}
$buffer1 = 'My Title - {{block.1b3231655cebb7a1f783eddf27d254ca}}';
$blocks['title'] = isset($blocks['title']) ? strpos($blocks['title'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['title'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['title']) : $buffer1;
$buffer1 = '
{{block.1b3231655cebb7a1f783eddf27d254ca}}
:-)
';
$blocks['main.menu'] = isset($blocks['main.menu']) ? strpos($blocks['main.menu'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['main.menu'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['main.menu']) : $buffer1;
echo Haanga::Load('assert_templates/base.tpl', $vars, TRUE, $blocks);
if ($return == TRUE) {
return ob_get_clean();
}
}
示例13: print_edit_form
function print_edit_form($comment, $link)
{
global $current_user, $site_key, $globals, $reply_to;
$data = array();
$html = '';
if ($comment->id == 0) {
$comment->randkey = rand(1000000, 100000000);
}
$html .= '<div class="commentform">';
$html .= '<form action="' . $globals['base_url'] . "comment_ajax?reply_to={$reply_to}&link={$link->id}&id={$comment->id}&user={$current_user->user_id}" . '" class="comment" method="post" enctype="multipart/form-data" id="c_edit_form">';
$html .= '<input type="hidden" name="randkey" value="' . $comment->randkey . '" />';
$html .= '<input type="hidden" name="process" value="editcomment" />';
$html .= '<input type="hidden" name="key" value="' . md5($comment->randkey . $site_key) . '" />';
$html .= '<input type="hidden" name="id" value="' . $comment->id . '" />';
$vars = compact('link', 'comment');
$html .= Haanga::Load('comment_edit.html', $vars, true);
$html .= '</form></div>';
$data['html'] = $html;
$data['error'] = '';
echo json_encode($data);
}
示例14: haanga_f5ad40d56c2438ea6bb3882d3b5e5ebf18352938
function haanga_f5ad40d56c2438ea6bb3882d3b5e5ebf18352938($vars, $return = FALSE, $blocks = array())
{
global $test_global, $global1;
extract($vars);
if ($return == TRUE) {
ob_start();
}
$foo = 5 + 1;
$vars['foo'] = $foo;
echo '
';
$bar = 'testing';
$vars['bar'] = $bar;
echo '
' . htmlspecialchars($foo) . '
' . Haanga::Load('assert_templates/sub_set.tpl', $vars, TRUE, $blocks) . '
';
if ($return == TRUE) {
return ob_get_clean();
}
}
示例15: haanga_93071c9c441d1680a63883802200fe559306006e
function haanga_93071c9c441d1680a63883802200fe559306006e($vars, $return = FALSE, $blocks = array())
{
global $test_global, $global1;
extract($vars);
if ($return == TRUE) {
ob_start();
}
$buffer1 = '
inner2\'s new value
';
$buffer2 = '
2.1
';
$blocks['inner2_1'] = isset($blocks['inner2_1']) ? strpos($blocks['inner2_1'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner2_1'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer2, $blocks['inner2_1']) : $buffer2;
$buffer1 .= $blocks['inner2_1'] . '
';
$blocks['inner2'] = isset($blocks['inner2']) ? strpos($blocks['inner2'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner2'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['inner2']) : $buffer1;
echo Haanga::Load('assert_templates/nested_block.tpl', $vars, TRUE, $blocks);
if ($return == TRUE) {
return ob_get_clean();
}
}