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


PHP Comment::list_comment_types方法代码示例

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


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

示例1: configure

 public function configure()
 {
     $form = new FormUI('selectivep');
     $options = array_flip(Post::list_active_post_types());
     unset($options[0]);
     $options = array_combine(array_map(function ($a) {
         return 'P-' . $a;
     }, $options), array_map(function ($a) {
         return 'Post Type: ' . $a;
     }, $options));
     $comment_options = array_combine(Comment::list_comment_types(), Comment::list_comment_types());
     $comment_options = array_combine(array_map(function ($a) {
         return 'C-' . $a;
     }, $comment_options), array_map(function ($a) {
         return 'Comment Type: ' . $a;
     }, $comment_options));
     $options = array_merge($options, $comment_options);
     //$options['comment'] = 'Any Comment';
     $form->append(new FormControlStatic('prompt', 'Select the types that should have autop applied to their content:'));
     $form->append(new FormControlCheckboxes('post_types', 'selectivep_types', 'Post types that should autop', $options));
     $form->append(new FormControlSubmit('save', 'Save'));
     return $form;
 }
开发者ID:ringmaster,项目名称:selectivep,代码行数:23,代码来源:selectivep.plugin.php

示例2: search_to_get

 /**
  * Parses a search string for status, type, author, and tag keywords. Returns
  * an associative array which can be passed to Comments::get(). If multiple
  * authors, statuses, or types are specified, we assume an implicit OR
  * such that (e.g.) any author that matches would be returned.
  *
  * @param string $search_string The search string
  * @return array An associative array which can be passed to Comments::get()
  */
 public static function search_to_get($search_string)
 {
     $keywords = array('author' => 1, 'status' => 1, 'type' => 1);
     // Comments::list_comment_statuses and list_comment_types return associative arrays with key/values
     // in the opposite order of the equivalent functions in Posts. Maybe we should change this?
     // In any case, we need to flip them for our purposes
     $statuses = array_flip(Comment::list_comment_statuses());
     $types = array_flip(Comment::list_comment_types());
     $arguments = array('name' => array(), 'status' => array(), 'type' => array());
     $criteria = '';
     $tokens = explode(' ', $search_string);
     foreach ($tokens as $token) {
         // check for a keyword:value pair
         if (preg_match('/^\\w+:\\S+$/u', $token)) {
             list($keyword, $value) = explode(':', $token);
             $keyword = strtolower($keyword);
             $value = MultiByte::strtolower($value);
             switch ($keyword) {
                 case 'author':
                     $arguments['name'][] = $value;
                     break;
                 case 'status':
                     if (isset($statuses[$value])) {
                         $arguments['status'][] = (int) $statuses[$value];
                     }
                     break;
                 case 'type':
                     if (isset($types[$value])) {
                         $arguments['type'][] = (int) $types[$value];
                     }
                     break;
             }
         } else {
             $criteria .= $token . ' ';
         }
     }
     // flatten keys that have single-element or no-element arrays
     foreach ($arguments as $key => $arg) {
         switch (count($arg)) {
             case 0:
                 unset($arguments[$key]);
                 break;
             case 1:
                 $arguments[$key] = $arg[0];
                 break;
         }
     }
     if ($criteria != '') {
         $arguments['criteria'] = $criteria;
     }
     return $arguments;
 }
开发者ID:psaintlaurent,项目名称:Habari,代码行数:61,代码来源:comments.php

示例3: type_name

 /**
  * Obtain the friendly name of a comment type, or null
  * @param string|integer A comment type number, or name
  * @return string A string of the comment type, or emptystring
  */
 public static function type_name($type)
 {
     $types = Comment::list_comment_types();
     if (is_numeric($type) && isset($types[$type])) {
         return $types[$type];
     }
     $types = array_flip($types);
     if (isset($types[$type])) {
         return $type;
     }
     return '';
 }
开发者ID:habari,项目名称:system,代码行数:17,代码来源:comment.php

示例4: post_comments

	/**
	 * Handles the submission of the comment moderation form.
	 * @todo Separate delete from "delete until purge"
	 */
	public function post_comments()
	{
		// Get special search statuses
		$statuses = Comment::list_comment_statuses();
		$labels = array_map(
			create_function( '$a', 'return MultiByte::ucfirst(Plugins::filter("comment_status_display", $a));' ),
			$statuses
			);
		$terms = array_map(
			create_function( '$a', 'return "status:{$a}";' ),
			$statuses
			);
		$statuses = array_combine( $terms, $labels );

		// Get special search types
		$types = Comment::list_comment_types();
		$labels = array_map(
			create_function( '$a', 'return MultiByte::ucfirst(Plugins::filter("comment_type_display", $a, "singular")) ;' ),
			$types
		);
		$terms = array_map(
			create_function( '$a', 'return "type:{$a}";' ),
			$types
		);
		$types = array_combine( $terms, $labels );

		$this->theme->special_searches = array_merge( $statuses, $types );

		$this->fetch_comments();
		$this->display( 'comments' );
	}
开发者ID:rynodivino,项目名称:system,代码行数:35,代码来源:admincommentshandler.php

示例5: post_comments

 /**
  * Handles the submission of the comment moderation form.
  * @todo Separate delete from "delete until purge"
  */
 public function post_comments()
 {
     // Get special search statuses
     $statuses = Comment::list_comment_statuses();
     $statuses = array_combine($statuses, array_map(create_function('$a', 'return "status:{$a}";'), $statuses));
     // Get special search types
     $types = Comment::list_comment_types();
     $types = array_combine($types, array_map(create_function('$a', 'return "type:{$a}";'), $types));
     $this->theme->special_searches = array_merge($statuses, $types);
     $this->fetch_comments();
     $this->display('comments');
 }
开发者ID:psaintlaurent,项目名称:Habari,代码行数:16,代码来源:adminhandler.php

示例6: search_to_get

 /**
  * Parses a search string for status, type, author, and tag keywords. Returns
  * an associative array which can be passed to Comments::get(). If multiple
  * authors, statuses, or types are specified, we assume an implicit OR
  * such that (e.g.) any author that matches would be returned.
  *
  * @param string $search_string The search string
  * @return array An associative array which can be passed to Comments::get()
  */
 public static function search_to_get($search_string)
 {
     $statuses = array_flip(Comment::list_comment_statuses());
     $types = array_flip(Comment::list_comment_types());
     $arguments = array('name' => array(), 'status' => array(), 'type' => array());
     $criteria = '';
     $tokens = explode(' ', $search_string);
     foreach ($tokens as $token) {
         // check for a keyword:value pair
         if (preg_match('/^\\w+:\\S+$/u', $token)) {
             list($keyword, $value) = explode(':', $token);
             $keyword = strtolower($keyword);
             $value = MultiByte::strtolower($value);
             switch ($keyword) {
                 case 'author':
                     $arguments['name'][] = $value;
                     break;
                 case 'status':
                     if (isset($statuses[$value])) {
                         $arguments['status'][] = (int) $statuses[$value];
                     }
                     break;
                 case 'type':
                     if (isset($types[$value])) {
                         $arguments['type'][] = (int) $types[$value];
                     }
                     break;
             }
         } else {
             $criteria .= $token . ' ';
         }
     }
     // flatten keys that have single-element or no-element arrays
     foreach ($arguments as $key => $arg) {
         switch (count($arg)) {
             case 0:
                 unset($arguments[$key]);
                 break;
             case 1:
                 $arguments[$key] = $arg[0];
                 break;
         }
     }
     if ($criteria != '') {
         $arguments['criteria'] = $criteria;
     }
     return $arguments;
 }
开发者ID:habari,项目名称:system,代码行数:57,代码来源:comments.php

示例7: post_comments

 /**
  * Handles the submission of the comment moderation form.
  * @todo Separate delete from "delete until purge"
  */
 public function post_comments()
 {
     // Get special search statuses
     $statuses = Comment::list_comment_statuses();
     $labels = array_map(function ($a) {
         return MultiByte::ucfirst(Plugins::filter("comment_status_display", $a));
     }, $statuses);
     $terms = array_map(function ($a) {
         return "status:{$a}";
     }, $statuses);
     $statuses = array_combine($terms, $labels);
     // Get special search types
     $types = Comment::list_comment_types();
     $labels = array_map(function ($a) {
         return MultiByte::ucfirst(Plugins::filter("comment_type_display", $a, "singular"));
     }, $types);
     $terms = array_map(function ($a) {
         return "type:{$a}";
     }, $types);
     $types = array_combine($terms, $labels);
     $this->theme->special_searches = array_merge($statuses, $types);
     $this->fetch_comments();
     // Create the form for the search and manage dropbutton. I bet we can save some code when combining this with the other manage pages.
     $form = new FormUI('manage');
     //$search = FormControlFacet::create('search');
     //$form->append($search);
     $aggregate = FormControlAggregate::create('selected_items')->set_selector('.comment_checkbox')->label('None Selected');
     $form->append($aggregate);
     $page_actions = FormControlDropbutton::create('page_actions');
     $page_actions->append(FormControlSubmit::create('delete')->set_caption(_t('Delete Selected'))->set_properties(array('onclick' => 'itemManage.update(\'delete\');return false;', 'title' => _t('Delete Selected'))));
     Plugins::act('comments_manage_actions', $page_actions);
     $form->append($page_actions);
     Stack::add('admin_header_javascript', 'manage-js');
     $this->theme->form = $form;
     $this->display('comments');
 }
开发者ID:habari,项目名称:system,代码行数:40,代码来源:admincommentshandler.php


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