当前位置: 首页>>代码示例>>PHP>>正文


PHP Post::type方法代码示例

本文整理汇总了PHP中Post::type方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::type方法的具体用法?PHP Post::type怎么用?PHP Post::type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Post的用法示例。


在下文中一共展示了Post::type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_plugin_act_display_reviews

 public function action_plugin_act_display_reviews($handler)
 {
     $paramarray['fallback'] = array('review.multiple', 'entry.multiple', 'multiple', 'home');
     $default_filters = array('content_type' => Post::type('review'));
     $paramarray['user_filters'] = $default_filters;
     return $handler->theme->act_display($paramarray);
 }
开发者ID:ringmaster,项目名称:review,代码行数:7,代码来源:review.plugin.php

示例2: add_template_vars

 /**
  * 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();
 }
开发者ID:psaintlaurent,项目名称:Habari,代码行数:29,代码来源:theme.php

示例3: add_template_vars

 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();
 }
开发者ID:ringmaster,项目名称:dark-autumn,代码行数:28,代码来源:theme.php

示例4: module_setup

	/**
	 * Sets up the fixture, for example, opens a network connection.
	 * This method is called before a test is executed.
	 *
	 * @access protected
	 */
	protected function module_setup()
	{
		$user = User::get_by_name( 'posts_test' );
		if ( !$user ) {
			$user = User::create( array (
				'username'=>'posts_test',
				'email'=>'posts_test@example.com',
				'password'=>md5('q' . rand( 0,65535 ) ),
			) );
		}
		$this->user = $user;
		$post = Post::create( array(
			'title' => 'Test Post',
			'content' => 'These tests expect there to be at least one post.',
			'user_id' => $user->id,
			'status' => Post::status( 'published' ),
			'content_type' => Post::type( 'entry' ),
		) );

		$this->post_id = $post->id;
		$this->paramarray = array(
			'id' => 'foofoo',
			'post_id' => $this->post_id,
			'name' => 'test',
			'email' => 'test@example.org',
			'url' => 'http://example.org',
			'ip' => ip2long('127.0.0.1'),
			'content' => 'test content',
			'status' => Comment::STATUS_UNAPPROVED,
			'date' => HabariDateTime::date_create(),
			'type' => Comment::COMMENT
		);
		$this->comment = Comment::create( $this->paramarray );
	}
开发者ID:rynodivino,项目名称:tests,代码行数:40,代码来源:test_comment.php

示例5: get_dashboard

 /**
  * Handles get requests for the dashboard
  * @todo update check should probably be cron'd and cached, not re-checked every load
  */
 public function get_dashboard()
 {
     // Not sure how best to determine this yet, maybe set an option on install, maybe do this:
     $firstpostdate = DB::get_value('SELECT min(pubdate) FROM {posts} WHERE status = ?', array(Post::status('published')));
     $this->theme->active_time = HabariDateTime::date_create($firstpostdate);
     // get the active theme, so we can check it
     // @todo this should be worked into the main Update::check() code for registering beacons
     $active_theme = Themes::get_active();
     $active_theme = $active_theme->name . ':' . $active_theme->version;
     // check to see if we have updates to display
     $this->theme->updates = Options::get('updates_available', array());
     // collect all the stats we display on the dashboard
     $this->theme->stats = array('author_count' => Users::get(array('count' => 1)), 'page_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('page'), 'status' => Post::status('published'))), 'entry_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('entry'), 'status' => Post::status('published'))), 'comment_count' => Comments::count_total(Comment::STATUS_APPROVED, false), 'tag_count' => Tags::vocabulary()->count_total(), 'page_draft_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('page'), 'status' => Post::status('draft'), 'user_id' => User::identify()->id)), 'entry_draft_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('entry'), 'status' => Post::status('draft'), 'user_id' => User::identify()->id)), 'unapproved_comment_count' => User::identify()->can('manage_all_comments') ? Comments::count_total(Comment::STATUS_UNAPPROVED, false) : Comments::count_by_author(User::identify()->id, Comment::STATUS_UNAPPROVED), 'spam_comment_count' => User::identify()->can('manage_all_comments') ? Comments::count_total(Comment::STATUS_SPAM, false) : Comments::count_by_author(User::identify()->id, Comment::STATUS_SPAM), 'user_entry_scheduled_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('scheduled'), 'user_id' => User::identify()->id)));
     $this->fetch_dashboard_modules();
     // check for first run
     $u = User::identify();
     if (!isset($u->info->experience_level)) {
         $this->theme->first_run = true;
         $u->info->experience_level = 'user';
         $u->info->commit();
     } else {
         $this->theme->first_run = false;
     }
     $this->display('dashboard');
 }
开发者ID:ringmaster,项目名称:system,代码行数:29,代码来源:admindashboardhandler.php

示例6: get_dashboard

 /**
  * Handles get requests for the dashboard
  * @todo update check should probably be cron'd and cached, not re-checked every load
  */
 public function get_dashboard()
 {
     // Not sure how best to determine this yet, maybe set an option on install, maybe do this:
     $firstpostdate = DB::get_value('SELECT min(pubdate) FROM {posts} WHERE status = ?', array(Post::status('published')));
     if ($firstpostdate) {
         $this->theme->active_time = DateTime::create($firstpostdate);
     }
     // check to see if we have updates to display
     $this->theme->updates = Options::get('updates_available', array());
     // collect all the stats we display on the dashboard
     $user = User::identify();
     $this->theme->stats = array('author_count' => Users::get(array('count' => 1)), 'post_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('published'))), 'comment_count' => Comments::count_total('approved', false), 'tag_count' => Tags::vocabulary()->count_total(), 'user_draft_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('draft'), 'user_id' => $user->id)), 'unapproved_comment_count' => User::identify()->can('manage_all_comments') ? Comments::count_total('unapproved', false) : Comments::count_by_author(User::identify()->id, Comment::status('unapproved')), 'spam_comment_count' => $user->can('manage_all_comments') ? Comments::count_total('spam', false) : Comments::count_by_author($user->id, Comment::status('spam')), 'user_scheduled_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('scheduled'), 'user_id' => $user->id)));
     // check for first run
     $u = User::identify();
     $uinfo = $u->info;
     if (!isset($uinfo->experience_level)) {
         $this->theme->first_run = true;
         $u->info->experience_level = 'user';
         $u->info->commit();
     } else {
         $this->theme->first_run = false;
     }
     $this->get_additem_form();
     Stack::add('admin_header_javascript', 'dashboard-js');
     $this->display('dashboard');
 }
开发者ID:habari,项目名称:system,代码行数:30,代码来源:admindashboardhandler.php

示例7: action_form_publish

 public function action_form_publish($form, $post)
 {
     $selector = $form->append('wrapper', 'type_selector');
     $selector->class = 'container';
     // Utils::debug( 'bob' );
     if (Controller::get_var('to_type') != NULL && $post->content_type != Controller::get_var('to_type')) {
         /* set type */
         $post->content_type = Post::type(Controller::get_var('to_type'));
         $post->update();
         Utils::redirect(URL::get('admin', 'page=publish&id=' . $post->id));
         // Refresh view
     }
     foreach (Post::list_active_post_types() as $type) {
         if ($type != 0) {
             if ($post->id == 0) {
                 $url = URL::get('admin', 'page=publish&content_type=' . Post::type_name($type));
             } else {
                 $url = URL::get('admin', 'page=publish&to_type=' . Post::type_name($type) . '&id=' . $post->id);
             }
             $html = '<a href="' . $url . '"';
             if (Post::type_name($type) == $post->content_type || $type == $post->content_type) {
                 $html .= ' class="active"';
             }
             $html .= '>' . Post::type_name($type) . '</a>';
             $selector->append('static', 'type_selector_' . $type, $html);
         }
     }
     $selector->move_before($selector, $form);
     return $form;
 }
开发者ID:habari-extras,项目名称:supertypes,代码行数:30,代码来源:supertypes.plugin.php

示例8: get_stat

 public static function get_stat($type, $month = NULL)
 {
     $str = 'chicklet_stat_' . $type;
     if ($month != NULL) {
         $str .= '_' . $month;
     }
     if (Cache::has($str)) {
         return Cache::get($str);
     }
     switch ($type) {
         case 'entries':
         case 'posts':
             $params = array('content_type' => array(Post::type('entry'), Post::type('link')), 'nolimit' => TRUE);
             $stat = count(Posts::get($params));
             break;
         case 'subscribers':
             $stat = self::fetch();
             break;
         case 'comments':
             $stat = Comments::count_total(Comment::STATUS_APPROVED);
             break;
         case 'tags':
             $stat = count(Tags::vocabulary()->get_tree());
             break;
         default:
             $stat = 0;
             break;
     }
     Cache::set($str, $stat);
     return $stat;
 }
开发者ID:habari-extras,项目名称:chicklet,代码行数:31,代码来源:chicklet.plugin.php

示例9: action_admin_theme_post_admin_cctypes

 /**
  * Respond to post requests on the admin_cctypes template
  *
  * @param AdminHandler $handler The admin handler object
  * @param Theme $theme The admin theme object
  */
 function action_admin_theme_post_admin_cctypes($handler, $theme)
 {
     $action = Controller::get_var('cct_action');
     switch ($action) {
         case 'addtype':
             Post::add_new_type($_POST['newtype']);
             $typeid = Post::type($_POST['newtype']);
             $handled = Options::get('cctypes_types');
             if (!is_array($handled)) {
                 $handled = array();
             }
             $handled[$typeid] = $typeid;
             array_unique($handled);
             Options::set('cctypes_types', $handled);
             Session::notice(_t('Added post type "' . $_POST['newtype'] . '".'));
             break;
         case 'deletetype':
             $typename = Post::type_name($_POST['deltype']);
             Post::deactivate_post_type($_POST['deltype']);
             $handled = Options::get('cctypes_types');
             if (isset($handled[$_POST['deltype']])) {
                 unset($handled[$_POST['deltype']]);
             }
             Options::set('cctypes_types', $handled);
             Session::notice(_t('Deactivated post type "' . $typename . '".'));
     }
     Utils::redirect();
 }
开发者ID:habari-extras,项目名称:customctypes,代码行数:34,代码来源:customctypes.plugin.php

示例10: filter_post_url

 public function filter_post_url($url, $post)
 {
     if ($post->content_type == Post::type('urlbounce')) {
         return $post->info->url;
     } else {
         return $url;
     }
 }
开发者ID:habari-extras,项目名称:urlbounce,代码行数:8,代码来源:urlbounce.plugin.php

示例11: action_publish_post

 /**
  * Save the photo URL in the post's postinfo
  *
  * @param Post $post The post that is being saved
  * @param FormUI $form The submitted publish form
  */
 public function action_publish_post($post, $form)
 {
     if ($form->content_type->value == Post::type('entry')) {
         if ($form->photo->value != '') {
             $post->info->photo = $form->photo->value;
         }
     }
 }
开发者ID:habari-extras,项目名称:fun-with-photos,代码行数:14,代码来源:fun_with_photos_plugin.plugin.php

示例12: filter_adminhandler_post_loadplugins_main_menu

 public function filter_adminhandler_post_loadplugins_main_menu($menus)
 {
     unset($menus['create_' . Post::type('imageset')]);
     unset($menus['manage_' . Post::type('imageset')]);
     unset($menus['create_' . Post::type('image')]);
     unset($menus['manage_' . Post::type('image')]);
     unset($menus['create_' . Post::type('gallery')]);
     return $menus;
 }
开发者ID:habari-extras,项目名称:cpg,代码行数:9,代码来源:cpg.plugin.php

示例13: action_form_publish

 public function action_form_publish(FormUI $form, Post $post)
 {
     if ($form->content_type->value == Post::type('entry')) {
         // add password feild to settings splitter
         $settings = $form->settings;
         $settings->append('text', 'postpass', 'null:null', _t('Password', 'postpass'), 'tabcontrol_text');
         $settings->postpass->value = $post->info->password;
     }
 }
开发者ID:habari-extras,项目名称:postpass,代码行数:9,代码来源:postpass.plugin.php

示例14: get_params

 private function get_params($user_filters = array())
 {
     $default_filters = array('content_type' => Post::type('entry'), 'status' => Post::status('published'), 'limit' => Options::get($this->handler_vars['class_name'] . '__posts_per_page'), 'page' => 1, 'orderby' => Options::get($this->handler_vars['class_name'] . '__show_newest_first') ? 'pubdate DESC' : 'pubdate ASC');
     $paramarray = new SuperGlobal($default_filters);
     $paramarray = $paramarray->merge($user_filters, $this->handler_vars);
     unset($paramarray['entire_match']);
     unset($paramarray['class_name']);
     return $paramarray;
 }
开发者ID:habari-extras,项目名称:breezyarchives,代码行数:9,代码来源:breezyarchiveshandler.php

示例15: action_publish_post

 public function action_publish_post($post, $form)
 {
     if ($post->content_type == Post::type('snippet')) {
         if (strlen($form->snippet->snippet_language->value)) {
             $post->info->snippet_language = $form->snippet->snippet_language->value;
         } else {
             $post->info->__unset('snippet_language');
         }
     }
 }
开发者ID:habari-extras,项目名称:snippet,代码行数:10,代码来源:snippet.plugin.php


注:本文中的Post::type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。