Ejemplo n.º 1
1
 /**
  * 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.
  *
  *  You could use this area to provide "recent comments" data to the template,
  *  for instance.
  *
  *  Note that the variables added here should possibly *always* be added,
  *  especially 'user'.
  *
  *  Also, this function gets executed *after* regular data is assigned to the
  *  template.  So the values here, unless checked, will overwrite any existing
  *  values.
  */
 public function add_template_vars()
 {
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     if (!$this->template_engine->assigned('user')) {
         $this->assign('user', User::identify());
     }
     if (!$this->template_engine->assigned('page')) {
         $page = Controller::get_var('page');
         $this->assign('page', isset($page) ? $page : 1);
     }
     $copyright = Options::get('simplerer__copyright_notice');
     if ($copyright == null) {
         $copyright = '© Copyright ' . date('Y') . '. All Rights Reserved.';
     } else {
         $copyright = str_replace('%year', date('Y'), $copyright);
     }
     $this->assign('copyright', $copyright);
     parent::add_template_vars();
 }
Ejemplo n.º 2
0
 /**
  * Add additional template variables to the template output.
  * 
  * This function gets executed *after* regular data is assigned to the
  * template.  So the values here, unless checked, will overwrite any existing 
  * values.
  */
 public function add_template_vars()
 {
     parent::add_template_vars();
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get('page_list'));
     }
     if (!$this->template_engine->assigned('asides')) {
         //For Asides loop in sidebar.php
         $this->assign('asides', Posts::get('asides'));
     }
     if (!$this->template_engine->assigned('recent_comments')) {
         //for recent comments loop in sidebar.php
         $this->assign('recent_comments', Comments::get(array('limit' => 5, 'status' => Comment::STATUS_APPROVED, 'orderby' => 'date DESC')));
     }
     if (!$this->template_engine->assigned('more_posts')) {
         //Recent posts in sidebar.php
         //visiting page/2 will offset to the next page of posts in the footer /3 etc
         $pagination = Options::get('pagination');
         $this->assign('more_posts', Posts::get(array('content_type' => 'entry', 'status' => 'published', 'vocabulary' => array('tags:not:tag' => 'asides'), 'offset' => $pagination * $this->page, 'limit' => 5)));
     }
     if (!$this->template_engine->assigned('all_tags')) {
         // List of all the tags
         $this->assign('all_tags', Tags::vocabulary()->get_tree());
     }
     if (!$this->template_engine->assigned('all_entries')) {
         // List of all the entries
         $this->assign('all_entries', Posts::get(array('content_type' => 'entry', 'status' => 'published', 'nolimit' => 1)));
     }
 }
Ejemplo n.º 3
0
 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
     $this->assign('links_list', array('Follow me on Twitter' => 'http://twitter.com/sebastianp'));
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     // Fetch the last 5 posts, for displaying in the quickbar
     if (!$this->template_engine->assigned('latest_posts')) {
         $this->assign('latest_posts', Posts::get(array('content_type' => 'entry', 'status' => Post::status('published'), 'limit' => 5)));
     }
     // Fetch the last 5 comments, for displaying in the quickbar
     if (!$this->template_engine->assigned('latest_comments')) {
         $this->assign('latest_comments', Comments::get(array('status' => Comment::STATUS_APPROVED)));
     }
     if (!$this->template_engine->assigned('taglist')) {
         $this->assign('taglist', $this->theme_show_tags());
     }
     // Fetch all the posts
     if (!$this->template_engine->assigned('archives')) {
         $this->assign('archives', Posts::get(array('content_type' => 'entry', 'status' => Post::status('published'))));
     }
     parent::add_template_vars();
 }
Ejemplo n.º 4
0
 /**
  * Add some variables to the template output
  */
 public function add_template_vars()
 {
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     $page = Controller::get_var('page');
     $page = isset($page) ? $page : 1;
     if (!$this->template_engine->assigned('page')) {
         $this->assign('page', $page);
     }
     $this->assign('show_previously', false);
     $this->assign('show_latest', false);
     $action = Controller::get_action();
     if ($action == 'display_home' || $action == 'display_entries') {
         $offset = (int) (($page + 1 - 1) * Options::get('pagination'));
         $this->assign('previously', Posts::get(array('status' => 'published', 'content_type' => 'entry', 'offset' => $offset, 'limit' => self::PREVIOUSLY_ITEMS)));
         $this->assign('show_previously', true);
     }
     if ($action != 'display_home') {
         $this->assign('latest', Posts::get(array('status' => 'published', 'content_type' => 'entry', 'offset' => 0, 'limit' => self::LATEST_ITEMS)));
         $this->assign('show_latest', true);
     }
     $this->assign('controller_action', $action);
     parent::add_template_vars();
 }
Ejemplo n.º 5
0
 /**
  * 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.
  *  
  *  You could use this area to provide "recent comments" data to the template,
  *  for instance.	  	 	 
  *  
  *  Note that the variables added here should possibly *always* be added, 
  *  especially 'user'.
  * 	 
  *  Also, this function gets executed *after* regular data is assigned to the
  *  template.  So the values here, unless checked, will overwrite any existing 
  *  values.	 	 	 
  */
 public function add_template_vars()
 {
     $this->add_template('formcontrol_text', dirname(__FILE__) . '/forms/formcontrol_text.php', true);
     $this->add_template('formcontrol_textarea', dirname(__FILE__) . '/forms/formcontrol_textarea.php', true);
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     if (!$this->template_engine->assigned('user')) {
         $this->assign('user', User::identify());
     }
     if (!$this->template_engine->assigned('page')) {
         $this->assign('page', isset($page) ? $page : 1);
     }
     if (!$this->template_engine->assigned('feed_alternate')) {
         $matched_rule = URL::get_matched_rule();
         switch ($matched_rule->name) {
             case 'display_entry':
             case 'display_page':
                 $feed_alternate = URL::get('entry', array('slug' => Controller::get_var('slug')));
                 break;
             case 'display_entries_by_tag':
                 $feed_alternate = URL::get('tag_collection', array('tag' => Controller::get_var('tag')));
                 break;
             case 'index_page':
             default:
                 $feed_alternate = URL::get('collection', array('index' => '1'));
         }
         $this->assign('feed_alternate', $feed_alternate);
     }
     parent::add_template_vars();
 }
Ejemplo n.º 6
0
 /**
  * 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.
  *
  *  You could use this area to provide "recent comments" data to the template,
  *  for instance.
  *
  *  Note that the variables added here should possibly *always* be added,
  *  especially 'user'.
  *
  *  Also, this function gets executed *after* regular data is assigned to the
  *  template.  So the values here, unless checked, will overwrite any existing
  *  values.
  */
 public function add_template_vars()
 {
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     if (!$this->template_engine->assigned('user')) {
         $this->assign('user', User::identify());
     }
     if (!$this->template_engine->assigned('tags')) {
         $this->assign('tags', Tags::get());
     }
     if (!$this->template_engine->assigned('page')) {
         $this->assign('page', isset($page) ? $page : 1);
     }
     if (!$this->template_engine->assigned('feed_alternate')) {
         $matched_rule = URL::get_matched_rule();
         switch ($matched_rule->name) {
             case 'display_entry':
             case 'display_page':
                 $feed_alternate = URL::get('atom_entry', array('slug' => Controller::get_var('slug')));
                 break;
             case 'display_entries_by_tag':
                 $feed_alternate = URL::get('atom_feed_tag', array('tag' => Controller::get_var('tag')));
                 break;
             case 'display_home':
             default:
                 $feed_alternate = URL::get('atom_feed', array('index' => '1'));
         }
         $this->assign('feed_alternate', $feed_alternate);
     }
     // Specify pages you want in your navigation here
     $this->assign('nav_pages', Posts::get(array('content_type' => 'page', 'status' => 'published', 'nolimit' => 1)));
     parent::add_template_vars();
 }
Ejemplo n.º 7
0
 /**
  * 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.
  *
  *  You could use this area to provide "recent comments" data to the template,
  *  for instance.
  *
  *  Note that the variables added here should possibly *always* be added,
  *  especially 'user'.
  *
  *  Also, this function gets executed *after* regular data is assigned to the
  *  template.  So the values here, unless checked, will overwrite any existing
  *  values.
  */
 public function add_template_vars()
 {
     //Theme Options
     $this->assign('home_tab', 'Home');
     //Set to whatever you want your first tab text to be.
     $this->assign('show_author', false);
     //Display author in posts
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     if (!$this->template_engine->assigned('page')) {
         $page = Controller::get_var('page');
         $this->assign('page', isset($page) ? $page : 1);
     }
     parent::add_template_vars();
     //from mzingi
     //visiting page/2, /3 will offset to the next page of posts in the sidebar
     $page = Controller::get_var('page');
     $pagination = Options::get('pagination');
     if ($page == '') {
         $page = 1;
     }
     $this->assign('more_posts', Posts::get(array('status' => 'published', 'content_type' => 'entry', 'offset' => $pagination * $page, 'limit' => 5)));
     //from mzingi
     //for recent comments loop in sidebar.php
     $this->assign('recent_comments', Comments::get(array('limit' => 5, 'status' => Comment::STATUS_APPROVED, 'orderby' => 'date DESC')));
 }
Ejemplo n.º 8
0
 public function add_template_vars()
 {
     //Theme Options
     $this->assign('header_text', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt.');
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     if (!$this->template_engine->assigned('user')) {
         $this->assign('user', User::identify()->loggedin);
     }
     /*		if( !$this->template_engine->assigned( 'page' ) ) {
     			$this->assign('page', isset( $page ) ? $page : 1 );
     		}*/
     if (!$this->template_engine->assigned('all_tags')) {
         // List of all the tags
         $tags = Tags::get();
         $this->assign('all_tags', $tags);
     }
     //visiting page/2, /3 will offset to the next page of posts in the sidebar
     $page = Controller::get_var('page');
     $pagination = Options::get('pagination');
     if ($page == '') {
         $page = 1;
     }
     $this->assign('more_posts', Posts::get(array('status' => 'published', 'content_type' => 'entry', 'offset' => $pagination * $page, 'limit' => 5)));
     parent::add_template_vars();
     $this->add_template('formcontrol_text', dirname(__FILE__) . '/forms/formcontrol_text.php', true);
     $this->add_template('formcontrol_textarea', dirname(__FILE__) . '/forms/formcontrol_textarea.php', true);
 }
Ejemplo n.º 9
0
 /**
  * Add some variables to the template output
  */
 public function add_template_vars()
 {
     // Use theme options to set values that can be used directly in the templates
     // Don't check for constant values in the template code itself
     $this->assign('show_title_image', self::SHOW_TITLE_IMAGE);
     $this->assign('home_label', self::HOME_LABEL);
     $this->assign('show_powered', self::SHOW_POWERED);
     $this->assign('display_login', self::DISPLAY_LOGIN);
     $this->assign('tags_in_multiple', self::TAGS_IN_MULTIPLE);
     $this->assign('post_class', 'post' . (!self::SHOW_ENTRY_PAPERCLIP ? ' alt' : ''));
     $this->assign('page_class', 'post' . (!self::SHOW_PAGE_PAPERCLIP ? ' alt' : ''));
     $this->assign('show_post_nav', self::SHOW_POST_NAV);
     $locale = Options::get('locale');
     if (file_exists(Site::get_dir('theme', true) . $locale . '.css')) {
         $this->assign('localized_css', $locale . '.css');
     } else {
         $this->assign('localized_css', false);
     }
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     $this->assign('post_id', isset($this->post) && $this->post->content_type == Post::type('page') ? $this->post->id : 0);
     // Add FormUI template placing the input before the label
     $this->add_template('charcoal_text', dirname(__FILE__) . '/formcontrol_text.php');
     parent::add_template_vars();
 }
Ejemplo n.º 10
0
 public function add_template_vars()
 {
     //TODO: Fully support localization;
     //theme configuration
     $this->assign('da_feedtext', $this->options['darkautumn__feedtext']);
     $this->assign('da_maintenancetitle', $this->options['darkautumn__maintenancetitle']);
     $this->assign('da_blurbtext', $this->options['darkautumn__blurbtext']);
     $this->assign('da_sidenotes_tag', $this->options['darkautumn__sidenotestag']);
     $this->base_url = Site::get_url('habari');
     //TODO: use assign instead
     $this->theme_url = Site::get_url('theme');
     //TODO: use assign instead
     if (!$this->posts) {
         $this->posts = Posts::get(array('content_type' => 'entry', 'status' => Post::status('published')));
     }
     if (!$this->pages) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     if (!$this->sidenotes) {
         $this->assign('sidenotes', Posts::get(array('tag' => $this->options['darkautumn__sidenotestag'], 'limit' => 5)));
     }
     if (!$this->page) {
         $this->page = isset($page) ? $page : 1;
         //TODO: use assign instead
     }
     $this->assign('post_id', isset($this->post) && $this->post->content_type == Post::type('page') ? $this->post->id : 0);
     parent::add_template_vars();
 }
Ejemplo n.º 11
0
	/**
	 * 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.
	 *
	 *  You could use this area to provide "recent comments" data to the template,
	 *  for instance.
	 *
	 *  Note that the variables added here should possibly *always* be added,
	 *  especially 'user'.
	 *
	 *  Also, this function gets executed *after* regular data is assigned to the
	 *  template.  So the values here, unless checked, will overwrite any existing
	 *  values.
	 */
	public function add_template_vars ( ) {
		
		parent::add_template_vars();
		
		$this->assign( 'display_login', Options::get( __CLASS__ . '__login_display_location', 'sidebar' ) );
		$this->assign( 'show_author', Options::get( __CLASS__ . '__show_author', false ) );
		$this->assign( 'home_label' , Options::get( __CLASS__ . '__home_label', _t( 'Blog' ) ) );

		$this->add_template( 'k2_text', dirname( __FILE__ ) . '/formcontrol_text.php' );
		
		if ( !isset( $this->pages ) ) {
			$this->pages = Posts::get( 'page_list' );
		}
		
		if ( User::identify()->loggedin ) {
			Stack::add( 'template_header_javascript', Site::get_url( 'scripts' ) . '/jquery.js', 'jquery' );
		}
		
		if ( ( $this->request->display_entry || $this->request->display_page ) && isset( $this->post ) && $this->post->title != '' ) {
			$this->page_title = $this->post->title . ' - ' . Options::get( 'title' );
		}
		else {
			$this->page_title = Options::get('title');
		}
		
	}
Ejemplo n.º 12
0
	/**
	 * 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.
	 *
	 *  You could use this area to provide "recent comments" data to the template,
	 *  for instance.
	 *
	 *  Note that the variables added here should possibly *always* be added,
	 *  especially 'user'.
	 *
	 *  Also, this function gets executed *after* regular data is assigned to the
	 *  template.  So the values here, unless checked, will overwrite any existing
	 *  values.
	 */
	public function add_template_vars ( ) {
		
		parent::add_template_vars();
		
		$this->home_tab = 'Blog';
		$this->show_author = false;
		
		$this->add_template( 'k2_text', dirname( __FILE__ ) . '/formcontrol_text.php' );
		
		if ( !isset( $this->pages ) ) {
			$this->pages = Posts::get( array( 'content_type' => 'page', 'status' => 'published', 'nolimit' => true ) );
		}
		
		if ( User::identify()->loggedin ) {
			Stack::add( 'template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery' );
		}
		
		if ( ( $this->request->display_entry || $this->request->display_page ) && isset( $this->post ) && $this->post->title != '' ) {
			$this->page_title = $this->post->title . ' - ' . Options::get('title');
		}
		else {
			$this->page_title = Options::get('title');
		}
		
	}
Ejemplo n.º 13
0
 public function add_template_vars()
 {
     if ($this->request->display_page && URL::get_matched_rule()->entire_match == 'archive') {
         if (!$this->template_engine->assigned('entries')) {
             $this->assign('entries', Posts::get(array('content_type' => 'entry', 'status' => Post::status('published'), 'nolimit' => true)));
         }
     }
     parent::add_template_vars();
 }
Ejemplo n.º 14
0
 public function add_template_vars()
 {
     // Auto add FormControl templates
     $user_formcontrols = glob(dirname(__FILE__) . '/*.formcontrol.php');
     foreach ($user_formcontrols as $file) {
         $name = substr($file, strrpos($file, '/') + 1, -1 * strlen('.formcontrol.php'));
         $this->add_template($this->name . '_' . $name, $file);
     }
     parent::add_template_vars();
 }
Ejemplo n.º 15
0
 public function add_template_vars()
 {
     //Theme Options
     $this->assign('show_author', true);
     //Display author in posts
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     parent::add_template_vars();
 }
Ejemplo n.º 16
0
 public function add_template_vars()
 {
     $this->add_template('formcontrol_text', dirname(__FILE__) . '/forms/formcontrol_text.php', true);
     $this->add_template('formcontrol_textarea', dirname(__FILE__) . '/forms/formcontrol_textarea.php', true);
     $this->recent_comments = Comments::get(array('limit' => 5, 'status' => Comment::STATUS_APPROVED, 'orderby' => 'date DESC'));
     $this->recent_posts = Posts::get(array('limit' => 5, 'orderby' => 'pubdate DESC', 'content_type' => Post::type('entry'), 'status' => Post::status('published')));
     if (!$this->template_engine->assigned('pages')) {
         $this->pages = Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1));
     }
     parent::add_template_vars();
 }
Ejemplo n.º 17
0
 public function add_template_vars()
 {
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     // Comment form
     $this->add_template('formcontrol_text', dirname(__FILE__) . '/forms/formcontrol_text.php', true);
     $this->add_template('formcontrol_textarea', dirname(__FILE__) . '/forms/formcontrol_textarea.php', true);
     $this->add_template('formcontrol_submit', dirname(__FILE__) . '/forms/formcontrol_submit.php', true);
     // Display author
     $this->assign('show_author', true);
     parent::add_template_vars();
 }
Ejemplo n.º 18
0
 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();
 }
Ejemplo n.º 19
0
 public function add_template_vars()
 {
     $this->assign('home_tab', 'Blog');
     //Set to whatever you want your first tab text to be.
     if (!$this->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     if (!$this->assigned('user')) {
         $this->assign('user', User::identify());
     }
     if (!$this->assigned('recent_entries')) {
         $this->assign('recent_entries', Posts::get(array('limit' => 10, 'content_type' => 'entry', 'status' => Post::status('published'), 'orderby' => 'pubdate DESC')));
     }
     $this->add_template('binadamu_submit', dirname(__FILE__) . '/formcontrol_submit.php');
     parent::add_template_vars();
 }
Ejemplo n.º 20
0
 /**
  * Add some variables to the template output
  */
 public function add_template_vars()
 {
     parent::add_template_vars();
     // Use theme options to set values that can be used directly in the templates
     $opts = Options::get_group(__CLASS__);
     $this->assign('show_title_image', $opts['show_title_image']);
     $this->assign('home_label', $opts['home_label']);
     $this->assign('show_powered', $opts['show_powered']);
     $this->assign('display_login', $opts['display_login']);
     $this->assign('tags_in_multiple', $opts['tags_in_multiple']);
     $this->assign('post_class', 'post' . (!$opts['show_entry_paperclip'] ? ' alt' : ''));
     $this->assign('page_class', 'post' . (!$opts['show_page_paperclip'] ? ' alt' : ''));
     $this->assign('show_post_nav', $opts['show_post_nav']);
     $this->assign('loggedin', User::identify()->loggedin);
     $locale = Options::get('locale');
     if ($this->get_url($locale . '.css')) {
         $this->assign('localized_css', $locale . '.css');
     } else {
         $this->assign('localized_css', false);
     }
     if ($opts['show_title_image']) {
         if ($this->get_url('images.' . $locale . '/title-image.png')) {
             $this->assign('title_image', 'images.' . $locale . '/title-image.png');
         } else {
             if ($this->get_url('images/title-image.png')) {
                 $this->assign('title_image', 'images/title-image.png');
             } else {
                 $this->assign('title_image', 'images/sample-title.png');
             }
         }
     }
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get('page_list'));
     }
     $this->assign('post_id', isset($this->post) && $this->post->content_type == Post::type('page') ? $this->post->id : 0);
     if (is_object($this->request) && $this->request->display_entries_by_tag) {
         if (count($this->include_tag) && count($this->exclude_tag) == 0) {
             $this->tags_msg = _t('Displaying posts tagged: %s', array(Format::tag_and_list($this->include_tag)));
         } else {
             if (count($this->exclude_tag) && count($this->include_tag) == 0) {
                 $this->tags_msg = _t('Displaying posts not tagged: %s', array(Format::tag_and_list($this->exclude_tag)));
             } else {
                 $this->tags_msg = _t('Displaying posts tagged: %s and not %s', array(Format::tag_and_list($this->include_tag), Format::tag_and_list($this->exclude_tag)));
             }
         }
     }
 }
Ejemplo n.º 21
0
 /**
  * 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.
  *
  *You could use this area to provide "recent comments" data to the template,
  *for instance.
  *
  *Note that the variables added here should possibly *always* be added,
  *especially 'user'.
  *
  *Also, this function gets executed *after* regular data is assigned to the
  *template.So the values here, unless checked, will overwrite any existing
  *values.
  */
 public function add_template_vars()
 {
     $this->add_template('formcontrol_text', dirname(__FILE__) . '/forms/formcontrol_text.php', true);
     $this->add_template('formcontrol_textarea', dirname(__FILE__) . '/forms/formcontrol_textarea.php', true);
     //Theme Options
     $this->assign('home_tab', 'Home');
     //Set to whatever you want your first tab text to be.
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     if (!$this->template_engine->assigned('user')) {
         $this->assign('user', User::identify());
     }
     if (!$this->template_engine->assigned('page')) {
         $this->assign('page', isset($page) ? $page : 1);
     }
     parent::add_template_vars();
 }
Ejemplo n.º 22
0
 /**
  * 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.
  *
  *  You could use this area to provide "recent comments" data to the template,
  *  for instance.
  *
  *  Note that the variables added here should possibly *always* be added,
  *  especially 'user'.
  *
  *  Also, this function gets executed *after* regular data is assigned to the
  *  template.  So the values here, unless checked, will overwrite any existing
  *  values.
  */
 public function add_template_vars()
 {
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'))));
     }
     //For Asides loop in sidebar.php
     $this->assign('asides', Posts::get(array('tag' => 'aside', 'limit' => 5)));
     //for recent comments loop in sidebar.php
     $this->assign('recent_comments', Comments::get(array('limit' => 5, 'status' => Comment::STATUS_APPROVED, 'orderby' => 'date DESC')));
     parent::add_template_vars();
     //visiting page/2, /3 will offset to the next page of posts in the sidebar
     $page = Controller::get_var('page');
     $pagination = Options::get('pagination');
     if ($page == '') {
         $page = 1;
     }
     $this->assign('more_posts', Posts::get(array('status' => 'published', 'content_type' => 'entry', 'offset' => $pagination * $page, 'limit' => 5)));
 }
Ejemplo n.º 23
0
 /**
  * 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.
  *
  *  You could use this area to provide "recent comments" data to the template,
  *  for instance.
  *
  *  Also, this function gets executed *after* regular data is assigned to the
  *  template.  So the values here, unless checked, will overwrite any existing
  *  values.
  */
 public function add_template_vars()
 {
     // Add FormUI template placing the input before the label
     $this->add_template('formcontrol_text', dirname(__FILE__) . '/forms/formcontrol_text.php', true);
     $this->habari = Site::get_url('habari');
     if (!$this->posts) {
         $this->posts = Posts::get(array('content_type' => 'entry', 'status' => Post::status('published')));
     }
     $this->top_posts = array_slice((array) $this->posts, 0, 2);
     $params = array('content_type' => 'entry', 'status' => Post::status('published'), 'limit' => 7);
     $this->previous_posts = array_slice((array) Posts::get($params), 2, 5);
     if (!$this->user) {
         $this->user = User::identify();
     }
     if (!$this->page) {
         $this->page = isset($page) ? $page : 1;
     }
     if (!$this->tags) {
         $this->tags = Tags::vocabulary()->get_tree();
     }
     if (!$this->pages) {
         $this->pages = Posts::get(array('content_type' => 'page', 'status' => Post::status('published')));
     }
     // Use the configured data format
     $date_format = Options::get('blossom_date_format');
     if ($date_format == 'american') {
         // Apply Format::nice_date() to post date - US style
         Format::apply('nice_date', 'post_pubdate_out', 'g:ia m/d/Y');
     } else {
         // Apply Format::nice_date() to post date - European style
         Format::apply('nice_date', 'post_pubdate_out', 'g:ia d/m/Y');
     }
     // del.icio.us username.
     $delicious_username = Options::get('blossom_delicious_username');
     if ($delicious_username == '') {
         $delicious_username = '******';
     }
     $this->delicious = $delicious_username;
     // Default to hidden
     $this->show_interests = (bool) Options::get('show_interests');
     $this->show_other_news = (bool) Options::get('show_other_news');
     parent::add_template_vars();
 }
Ejemplo n.º 24
0
 public function add_template_vars()
 {
     //Theme Options
     $this->assign('home_tab', 'Blog');
     //Set to whatever you want your first tab text to be.
     if (!$this->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     if (!$this->assigned('user')) {
         $this->assign('user', User::identify());
     }
     if (!$this->assigned('recent_comments')) {
         $this->assign('recent_comments', Comments::get(array('limit' => 10, 'status' => Comment::STATUS_APPROVED, 'type' => Comment::COMMENT, 'orderby' => 'date DESC')));
     }
     if (!$this->assigned('recent_entries')) {
         $this->assign('recent_entries', Posts::get(array('limit' => 10, 'content_type' => 1, 'status' => 2, 'orderby' => 'pubdate DESC')));
     }
     parent::add_template_vars();
 }
Ejemplo n.º 25
0
 /**
  * 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.
  *
  *  You could use this area to provide "recent comments" data to the template,
  *  for instance.
  *
  *  Note that the variables added here should possibly *always* be added,
  *  especially 'user'.
  *
  *  Also, this function gets executed *after* regular data is assigned to the
  *  template.  So the values here, unless checked, will overwrite any existing
  *  values.
  */
 public function add_template_vars()
 {
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get('page_list'));
     }
     //For Asides loop in sidebar.php
     $this->assign('asides', Posts::get('asides'));
     if (is_object($this->request) && $this->request->display_entries_by_tag) {
         if (count($this->include_tag) && count($this->exclude_tag) == 0) {
             $this->tags_msg = _t('Posts tagged with %s', array(Format::tag_and_list($this->include_tag)));
         } else {
             if (count($this->exclude_tag) && count($this->include_tag) == 0) {
                 $this->tags_msg = _t('Posts not tagged with %s', array(Format::tag_and_list($this->exclude_tag)));
             } else {
                 $this->tags_msg = _t('Posts tagged with %s and not with %s', array(Format::tag_and_list($this->include_tag), Format::tag_and_list($this->exclude_tag)));
             }
         }
     }
     parent::add_template_vars();
 }
Ejemplo n.º 26
0
 /**
  * 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.
  *
  *  You could use this area to provide "recent comments" data to the template,
  *  for instance.
  *
  *  Note that the variables added here should possibly *always* be added,
  *  especially 'user'.
  *
  *  Also, this function gets executed *after* regular data is assigned to the
  *  template.  So the values here, unless checked, will overwrite any existing
  *  values.
  */
 public function add_template_vars()
 {
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'))));
     }
     //For Asides loop in sidebar.php
     $this->assign('asides', Posts::get(array('vocabulary' => array('tags:term' => 'aside'), 'limit' => 5)));
     if ($this->request->display_entries_by_tag) {
         if (count($this->include_tag) && count($this->exclude_tag) == 0) {
             $this->tags_msg = _t('Posts tagged with %s', array(Format::tag_and_list($this->include_tag)));
         } else {
             if (count($this->exclude_tag) && count($this->include_tag) == 0) {
                 $this->tags_msg = _t('Posts not tagged with %s', array(Format::tag_and_list($this->exclude_tag)));
             } else {
                 $this->tags_msg = _t('Posts tagged with %s and not with %s', array(Format::tag_and_list($this->include_tag), Format::tag_and_list($this->exclude_tag)));
             }
         }
     }
     parent::add_template_vars();
 }
Ejemplo n.º 27
0
 /**
  * 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.
  *
  *  You could use this area to provide "recent comments" data to the template,
  *  for instance.
  *
  *  Note that the variables added here should possibly *always* be added,
  *  especially 'user'.
  *
  *  Also, this function gets executed *after* regular data is assigned to the
  *  template.  So the values here, unless checked, will overwrite any existing
  *  values.
  */
 public function add_template_vars()
 {
     $this->assign('css_color', self::CSS_COLOR);
     $this->assign('twitter_in', self::TWITTER_IN);
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     if (!$this->template_engine->assigned('user')) {
         $this->assign('user', User::identify());
     }
     if (!$this->template_engine->assigned('page')) {
         $this->assign('page', isset($page) ? $page : 1);
     }
     $this->assign('nav_pages', Posts::get(array('limit' => 5, 'content_type' => 'page', 'status' => 'published', 'orderby' => 'slug ASC')));
     $this->assign('home_recent_posts', Posts::get(array('limit' => 2, 'content_type' => 'entry', 'status' => 'published', 'orderby' => 'pubdate DESC')));
     $this->assign('recent_posts', Posts::get(array('limit' => 3, 'content_type' => 'entry', 'status' => 'published', 'orderby' => 'pubdate DESC')));
     // FormUI comment form
     $this->add_template('formcontrol_text', dirname(__FILE__) . '/forms/formcontrol_text.php', true);
     $this->add_template('formcontrol_textarea', dirname(__FILE__) . '/forms/formcontrol_textarea.php', true);
     $this->add_template('formcontrol_submit', dirname(__FILE__) . '/forms/formcontrol_submit.php', true);
     parent::add_template_vars();
 }
Ejemplo n.º 28
0
 /**
  * 
  * @return 
  */
 public function add_template_vars()
 {
     //the title to display on the manu bar
     $this->assign('menu_title', $this->calculate_menu_title());
     parent::add_template_vars();
 }
Ejemplo n.º 29
-1
 public function add_template_vars()
 {
     $this->add_template('formcontrol_text', dirname(__FILE__) . '/forms/formcontrol_text.php', true);
     $this->add_template('formcontrol_textarea', dirname(__FILE__) . '/forms/formcontrol_textarea.php', true);
     $this->assign('recent_comments', Comments::get(array('limit' => 5, 'status' => Comment::STATUS_APPROVED, 'orderby' => 'date DESC')));
     $this->assign('recent_posts', Posts::get(array('limit' => 5, 'orderby' => 'pubdate DESC', 'content_type' => 1, 'status' => 2)));
     if ('' != Controller::get_var('tag')) {
         $tag_text = DB::get_value('SELECT tag_text FROM {tags} WHERE tag_slug=?', array(Controller::get_var('tag')));
         $this->assign('tag_text', $tag_text);
     }
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     if (!$this->template_engine->assigned('user')) {
         $this->assign('user', User::identify());
     }
     if (!$this->template_engine->assigned('page')) {
         $page = Controller::get_var('page');
         $this->assign('page', isset($page) ? $page : 1);
     }
     parent::add_template_vars();
 }
Ejemplo n.º 30
-2
 /**
  * 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.
  *
  *  You could use this area to provide "recent comments" data to the template,
  *  for instance.
  *
  *  Note that the variables added here should possibly *always* be added,
  *  especially 'user'.
  *
  *  Also, this function gets executed *after* regular data is assigned to the
  *  template.  So the values here, unless checked, will overwrite any existing
  *  values.
  */
 public function add_template_vars()
 {
     //Theme Options
     $this->assign('home_tab', 'Blog');
     //Set to whatever you want your first tab text to be.
     $this->assign('show_author', false);
     //Display author in posts
     if (!$this->template_engine->assigned('pages')) {
         $this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => Post::status('published'), 'nolimit' => 1)));
     }
     if (!$this->template_engine->assigned('page')) {
         $page = Controller::get_var('page');
         $this->assign('page', isset($page) ? $page : 1);
     }
     parent::add_template_vars();
     if (User::identify()->loggedin) {
         Stack::add('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery');
     }
 }