本文整理汇总了PHP中Format::apply_with_hook_params方法的典型用法代码示例。如果您正苦于以下问题:PHP Format::apply_with_hook_params方法的具体用法?PHP Format::apply_with_hook_params怎么用?PHP Format::apply_with_hook_params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Format
的用法示例。
在下文中一共展示了Format::apply_with_hook_params方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_format_priority
public function test_format_priority()
{
Format::apply(function ($v) {
return $v . '7';
}, 'test_filter_7');
Format::apply(function ($v) {
return $v . '8';
}, 'test_filter');
$result = Plugins::filter('test_filter', 'test');
$this->assert_equal('test78', $result);
Format::apply(function ($v, $c) {
return $v . '7' . $c;
}, 'test_filter2_7', 'a');
Format::apply(function ($v, $c) {
return $v . '8' . $c;
}, 'test_filter2', 'b');
$result = Plugins::filter('test_filter2', 'test');
$this->assert_equal('test7a8b', $result);
Format::apply_with_hook_params(function ($v, $h, $c) {
return $v . '7' . $h . $c;
}, 'test_filter3_7', 'a');
Format::apply_with_hook_params(function ($v, $h, $c) {
return $v . '8' . $h . $c;
}, 'test_filter3', 'b');
$result = Plugins::filter('test_filter3', 'test', 'h');
$this->assert_equal('test7ha8hb', $result);
}
示例2: action_init_theme
public function action_init_theme()
{
Format::apply('tag_and_list', 'post_tags_out', ', ', ', ');
Format::apply_with_hook_params('more', 'post_content_out', 'More ›', null, 1);
Stack::add('template_stylesheet', array(Site::get_url('theme') . '/css/screen.css', 'screen, projection'), 'screen');
Stack::add('template_stylesheet', array(Site::get_url('theme') . '/css/style.css', 'screen, projection'), 'style');
}
示例3: action_init_theme
/**
* Execute on theme init to apply these filters to output
*/
public function action_init_theme()
{
// Apply Format::autop() to comment content...
Format::apply('autop', 'comment_content_out');
// Truncate content excerpt at "more" or 56 characters...
Format::apply('autop', 'post_content_excerpt');
Format::apply_with_hook_params('more', 'post_content_excerpt', '', 56, 1);
}
示例4: action_init_theme
/**
* Execute on theme init to apply these filters to output
*/
public function action_init_theme()
{
// Apply Format::autop() to comment content...
Format::apply('autop', 'comment_content_out');
// Truncate content excerpt at "more" or 56 characters...
Format::apply('autop', 'post_content_excerpt');
Format::apply_with_hook_params('more', 'post_content_excerpt', '', 56, 1);
// Add FormUI template placing the input before the label
$this->add_template('charcoal_text', dirname(__FILE__) . '/formcontrol_text.php');
}
示例5: action_init_theme
public function action_init_theme()
{
$this->load_text_domain('sp');
// Apply Format::autop() to comment content.
Format::apply('autop', 'comment_content_out');
// Apply Format::tag_and_list() to post tags...
Format::apply('tag_and_list', 'post_tags_out');
// Only triggered by <!--more--> tag, not by length.
Format::apply_with_hook_params('more', 'post_content_out', _t('--More--', 'sp'));
// Excerpt output. echo $post->content_excerpt.
Format::apply_with_hook_params('more', 'post_content_excerpt', _t('--More--', 'sp'), 60, 1);
}
示例6: action_init_theme
public function action_init_theme()
{
// Apply Format::autop() to comment content...
Format::apply('autop', 'comment_content_out');
// Apply Format::tag_and_list() to post tags...
Format::apply('tag_and_list', 'post_tags_out');
// Only uses the <!--more--> tag, with the 'more' as the link to full post
Format::apply_with_hook_params('more', 'post_content_out', 'more');
// Creates an excerpt option. echo $post->content_excerpt;
Format::apply('autop', 'post_content_excerpt');
Format::apply_with_hook_params('more', 'post_content_excerpt', 'more', 60, 1);
$this->autoCompileLess(dirname(__FILE__) . "/less/bootstrap.less", dirname(__FILE__) . "/css/bootstrap.css");
$this->autoCompileLess(dirname(__FILE__) . "/less/custom.less", dirname(__FILE__) . "/css/custom.css");
}
示例7: action_init_theme
public function action_init_theme()
{
// Apply Format::autop() to comment content...
Format::apply( 'autop', 'comment_content_out' );
// Apply Format::tag_and_list() to post tags...
Format::apply( 'tag_and_list', 'post_tags_out' );
// Only uses the <!--more--> tag, with the 'more' as the link to full post
Format::apply_with_hook_params( 'more', 'post_content_out', 'more' );
// Creates an excerpt option. echo $post->content_excerpt;
Format::apply( 'autop', 'post_content_excerpt' );
Format::apply_with_hook_params( 'more', 'post_content_excerpt', 'more',60, 1 );
// Format the calendar like date for home, entry.single and entry.multiple templates
Format::apply( 'format_date', 'post_pubdate_out','<span class="calyear">{Y}</span><br><span class="calday">{j}</span><br><span class="calmonth">{F}</span>' );
}
示例8: action_init_theme
/**
* Execute on theme init to apply these filters to output
*/
public function action_init_theme()
{
if (!Plugins::is_loaded('HabariMarkdown')) {
// Apply Format::autop() to post content...
Format::apply('autop', 'post_content_out');
}
// Truncate content excerpt at "<!--more-->"...
Format::apply_with_hook_params('more', 'post_content_out');
// Apply Format::autop() to comment content...
Format::apply('autop', 'comment_content_out');
// Apply Format::tag_and_list() to post tags...
Format::apply('tag_and_list', 'post_tags_out');
$this->load_text_domain('demorgan');
}
示例9: action_init_theme
/**
* Execute on theme init to apply these filters to output
*/
public function action_init_theme()
{
// Apply Format::autop() to post content...
Format::apply('autop', 'post_content_out');
Format::apply('autop', 'post_content_excerpt');
// Apply Format::autop() to comment content...
Format::apply('autop', 'comment_content_out');
// Apply Format::tag_and_list() to post tags...
Format::apply('tag_and_list', 'post_tags_out');
// Apply Format::nice_date() to post date...
Format::apply('nice_date', 'post_pubdate_out', 'F j, Y g:ia');
// Apply Format::nice_date() to comment date...
Format::apply('nice_date', 'comment_date_out', 'F j, Y g:ia');
// Truncate content excerpt at "more" or 75 characters...
Format::apply_with_hook_params('more', 'post_content_excerpt', 'Read More', 75);
}
示例10: action_init_theme
/**
* Execute on theme init to apply these filters to output
*/
public function action_init_theme()
{
// Apply Format::autop() to post content
Format::apply('autop', 'post_content_out');
// Apply Format::autop() to comment content
Format::apply('autop', 'comment_content_out');
// Apply Format::nice_date() to post date...
Format::apply('nice_date', 'post_pubdate_out', 'j-M-Y');
// Apply Format::nice_date() to post date time...
Format::apply('nice_date', 'post_pubdate_time', '\\a\\t g:ia');
// Apply Format::nice_date() to post date excerpt...
Format::apply('nice_date', 'post_pubdate_excerpt', 'l, F jS, Y');
// Apply Format::nice_date() to comment date...
//Format::apply( 'nice_date', 'comment_date', 'l, F jS, Y \a\t g:ia' );
// Truncate content excerpt at "more" or 56 characters...
Format::apply_with_hook_params('more', 'post_content_excerpt', '', 256, 1);
}
示例11: action_init_theme
public function action_init_theme()
{
// Apply Format::autop() to post content...
Format::apply('autop', 'post_content_out');
// Only uses the <!--more--> tag, with the 'more' as the link to full post
Format::apply_with_hook_params('more', 'post_content_out', 'more');
// Creates an excerpt option. echo $post->content_excerpt;
Format::apply_with_hook_params('more', 'post_content_excerpt', 'more', 60, 1);
// Apply Format::autop() to comment content...
Format::apply('autop', 'comment_content_out');
// Apply Format::tag_and_list() to post tags...
Format::apply('tag_and_list', 'post_tags_out');
// Apply Format::nice_date() to comment date...
Format::apply('nice_date', 'comment_date_out', 'F jS, Y');
// Apply Format::nice_date() to post date...
Format::apply('nice_date', 'post_pubdate_out', 'F jS, Y');
}
示例12: action_init_theme
function action_init_theme($theme)
{
// Apply Format::autop() to post content...
Format::apply('autop', 'post_content_out');
// Apply Format::autop() to comment content...
Format::apply('autop', 'comment_content_out');
// Apply Format::tag_and_list() to post tags...
Format::apply('tag_and_list', 'post_tags_out');
// Only uses the <!--more--> tag, with the 'more' as the link to full post
Format::apply_with_hook_params('more', 'post_content_out', 'more');
// Creates an excerpt option. echo $post->content_excerpt;
Format::apply('autop', 'post_content_excerpt');
Format::apply_with_hook_params('more', 'post_content_excerpt', '<span class="more">Read more</span>', 150, 1);
// Excerpt for lead article
Format::apply('autop', 'post_content_lead');
Format::apply_with_hook_params('more', 'post_content_lead', '<span class="more">Read more</span>', 400, 1);
// Apply Format::nice_date() to post date...
Format::apply('nice_date', 'post_pubdate_out', 'F j, Y');
// Apply Format::nice_time() to post date...
//Format::apply( 'nice_time', 'post_pubdate_out', 'g:ia' );
// Apply Format::nice_date() to comment date
Format::apply('nice_date', 'comment_date_out', 'F j, Y g:ia');
}
示例13: action_init_theme
/**
* Execute on theme init to apply these filters to output
*/
public function action_init_theme()
{
if (!Plugins::is_loaded('HabariMarkdown')) {
// Apply Format::autop() to post content...
Format::apply('autop', 'post_content_out');
}
// Apply Format::autop() to comment content...
Format::apply('autop', 'comment_content_out');
// Apply Format::tag_and_list() to post tags...
Format::apply('tag_and_list', 'post_tags_out');
// Apply Format::nice_date() to post date...
Format::apply('nice_date', 'post_pubdate_out', 'F j, Y');
// Apply Format::nice_date() to post date...
Format::apply('nice_date', 'post_pubdate_time', 'g:i a');
// Format post date to ISO-8601...
Format::apply('nice_date', 'post_pubdate_iso', 'c');
// Apply Format::nice_date() to comment date...
Format::apply('nice_date', 'comment_date_out', 'F j, Y ‒ g:i a');
// Format comment date to ISO-8601...
Format::apply('nice_date', 'comment_date_iso', 'c');
// Truncate content excerpt at "more" or 100 characters...
Format::apply_with_hook_params('more', 'post_content_excerpt', '', 100, 1);
//Format::apply_with_hook_params( 'more', 'post_content_out', 'more', 100, 1 );
}
示例14: add_template_vars
<?php
Format::apply_with_hook_params('more', 'post_content_out', 'Read the rest »');
Format::apply('autop', 'post_content_out');
Format::apply('autop', 'comment_content_out');
Format::apply('nice_date', 'comment_date_out');
Format::apply('tag_and_list', 'post_tags_out', ' , ', ' and ');
Format::apply('nice_date', 'post_pubdate_out', 'F j');
// We must tell Habari to use MyTheme as the custom theme class:
define('THEME_CLASS', 'MyTheme');
/**
* A custom theme for K2 output
*/
class MyTheme extends Theme
{
public function add_template_vars()
{
if (!$this->template_engine->assigned('pages')) {
$this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'))));
}
if (!$this->template_engine->assigned('user')) {
$this->assign('user', User::identify());
}
if (!$this->template_engine->assigned('page')) {
$this->assign('page', isset($page) ? $page : 1);
}
//for recent comments loop in sidebar.php
$this->assign('recent_comments', Comments::get(array('limit' => 8, 'status' => Comment::STATUS_APPROVED, 'orderby' => 'date DESC')));
parent::add_template_vars();
}
}
示例15:
*
* @package Habari
*/
/**
* @todo This stuff needs to move into the custom theme class:
*/
// Apply Format::autop() to post content...
Format::apply('autop', 'post_content_out');
// Apply Format::autop() to post excerpt...
Format::apply('autop', 'post_content_excerpt');
// Apply Format::autop() to comment content...
Format::apply('autop', 'comment_content_out');
// Apply Format::tag_and_list() to post tags...
Format::apply('tag_and_list', 'post_tags_out');
// Limit post length to 1 paragraph or 100 characters. This theme only works with excerpts.
Format::apply_with_hook_params('more', 'post_content_excerpt', '<span class="read-on">read on</span>', 100, 1);
// We must tell Habari to use Blossom as the custom theme class (to be removed upon release of 0.7):
define('THEME_CLASS', 'Blossom');
/**
* A custom theme for Blossom output
*/
class Blossom extends Theme
{
/**
* Add additional template variables to the template output.
*
* You can assign additional output values in the template here, instead of
* having the PHP execute directly in the template. The advantage is that
* you would easily be able to switch between template types (RawPHP/Smarty)
* without having to port code from one to the other.
*