Beispiel #1
0
 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);
 }
Beispiel #2
0
 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');
 }
Beispiel #3
0
 /**
  * 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);
 }
Beispiel #4
0
 /**
  * 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');
 }
Beispiel #5
0
 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);
 }
Beispiel #6
0
 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");
 }
Beispiel #7
0
	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>' );
	}
Beispiel #8
0
 /**
  * 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');
 }
Beispiel #9
0
 /**
  * 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);
 }
Beispiel #10
0
 /**
  * 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);
 }
Beispiel #11
0
 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');
 }
Beispiel #12
0
 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');
 }
Beispiel #13
0
 /**
  * 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 );
 }
Beispiel #14
0
<?php

Format::apply_with_hook_params('more', 'post_content_out', 'Read the rest &raquo;');
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();
    }
}
Beispiel #15
0
*
* @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.
     *
Beispiel #16
0
 * @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 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');
Format::apply_with_hook_params('more', 'post_content_out', 'more', 100, 1);
// 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
{
    /**
     * 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.
     *  
Beispiel #17
0
/**
 * @package Ic3berg
 */
// 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 g:ia');
// Excerpt titles in the quickbar
Format::apply('post_title_excerpt', 'post_title');
// Remove the comment on the following line to limit post length on the home page to 1 paragraph or 100 characters
Format::apply_with_hook_params('more', 'post_content_out', _t('Read more...'), 100, 1);
// We must tell Habari to use MyTheme as the custom theme class:
define('THEME_CLASS', 'Ic3berg');
/**
 * A custom theme for K2 output
 */
class Ic3berg extends Theme
{
    public function add_template_vars()
    {
        //Theme Options
        $this->assign('show_author', true);
        //Display author in posts
        // How many months should be displayed by the RN Archives plugin
        $this->assign('rn_archives_months', 2);
        // Links list
Beispiel #18
0
 public function action_init_theme()
 {
     Format::apply('tag_and_list', 'post_tags_out', ' : ', ' : ');
     Format::apply_with_hook_params('more', 'post_content_excerpt', '', 56, 1);
 }
Beispiel #19
0
 *
 * @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 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_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>');
// We must tell Habari to use MyTheme as the custom theme class:
define('THEME_CLASS', 'CornerStone');
/**
 * A custom theme for mzingi output
 */
class CornerStone 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)