本文整理汇总了PHP中Comments::count_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Comments::count_by_id方法的具体用法?PHP Comments::count_by_id怎么用?PHP Comments::count_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comments
的用法示例。
在下文中一共展示了Comments::count_by_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
/**
* function __get
* Overrides QueryRecord __get to implement custom object properties
* @param string Name of property to return
* @return mixed The requested field value
*/
public function __get($name)
{
$fieldnames = array_merge(array_keys($this->fields), array('permalink', 'tags', 'comments', 'comment_count', 'approved_comment_count', 'comment_feed_link', 'author', 'editlink'));
if (!in_array($name, $fieldnames) && strpos($name, '_') !== false) {
preg_match('/^(.*)_([^_]+)$/', $name, $matches);
list($junk, $name, $filter) = $matches;
} else {
$filter = false;
}
switch ($name) {
case 'statusname':
$out = self::status_name($this->status);
break;
case 'typename':
$out = self::type_name($this->content_type);
break;
case 'permalink':
$out = $this->get_permalink();
break;
case 'editlink':
$out = $this->get_editlink();
break;
case 'tags':
$out = $this->get_tags();
break;
case 'comments':
$out = $this->get_comments();
break;
case 'comment_count':
$out = $this->get_comments()->count();
break;
case 'approved_comment_count':
$out = Comments::count_by_id($this->id);
break;
case 'comment_feed_link':
$out = $this->get_comment_feed_link();
break;
case 'author':
$out = $this->get_author();
break;
case 'info':
$out = $this->get_info();
break;
default:
$out = parent::__get($name);
break;
}
$out = Plugins::filter("post_get", $out, $name, $this);
$out = Plugins::filter("post_{$name}", $out, $this);
if ($filter) {
$out = Plugins::filter("post_{$name}_{$filter}", $out, $this);
}
return $out;
}
示例2: __get
/**
* function __get
* Overrides QueryRecord __get to implement custom object properties
* @param string Name of property to return
* @return mixed The requested field value
*/
public function __get( $name )
{
// some properties are considered special and accidentally filtering them would be bad, so we exclude those
$fieldnames = array_merge( array_keys( $this->fields ), array( 'permalink', 'tags', 'comments', 'comment_count', 'approved_comment_count', 'comment_feed_link', 'author', 'editlink', 'info' ) );
$filter = false;
if ( !in_array( $name, $fieldnames ) && strpos( $name, '_' ) !== false ) {
$field_matches = implode('|', $fieldnames);
if(preg_match( '/^(' . $field_matches . ')_(.+)$/', $name, $matches )) {
list( $junk, $name, $filter )= $matches;
}
}
switch ( $name ) {
case 'statusname':
$out = self::status_name( $this->status );
break;
case 'typename':
$out = self::type_name( $this->content_type );
break;
case 'permalink':
$out = $this->get_permalink();
break;
case 'editlink':
$out = $this->get_editlink();
break;
case 'tags':
$out = $this->get_tags();
break;
case 'comments':
$out = $this->get_comments();
break;
case 'comment_count':
$out = $this->get_comments()->count();
break;
case 'approved_comment_count':
$out = Comments::count_by_id( $this->id );
break;
case 'comment_feed_link':
$out = $this->get_comment_feed_link();
break;
case 'author':
$out = $this->get_author();
break;
case 'info':
$out = $this->get_info();
break;
default:
$out = parent::__get( $name );
break;
}
$out = Plugins::filter( "post_get", $out, $name, $this );
$out = Plugins::filter( "post_{$name}", $out, $this );
if ( $filter ) {
$out = Plugins::filter( "post_{$name}_{$filter}", $out, $this );
}
return $out;
}
示例3: __get
/**
* Overrides QueryRecord __get to implement custom object properties
* @param string $name Name of property to return
* @return mixed The requested field value
*/
public function __get($name)
{
// some properties are considered special and accidentally filtering them would be bad, so we exclude those
$fieldnames = array_merge(array_keys($this->fields), array('permalink', 'tags', 'comments', 'comment_count', 'approved_comment_count', 'comment_feed_link', 'author', 'editlink', 'info'));
$filter = false;
if (!in_array($name, $fieldnames) && strpos($name, '_') !== false) {
$field_matches = implode('|', $fieldnames);
if (preg_match('/^(' . $field_matches . ')_(.+)$/', $name, $matches)) {
list($junk, $name, $filter) = $matches;
}
}
switch ($name) {
case 'content':
if ($filter == 'internal') {
$out = parent::__get('content');
} else {
$out = parent::__get('cached_content');
// Didn't bother to store a cached version? Run the prerender filter on the raw version.
if (empty($out)) {
$out = Plugins::filter("post_prerender_content", parent::__get('content'), $this);
// Queue rendered content for writing to cached_content field?
}
}
break;
case 'statusname':
$out = self::status_name($this->status);
break;
case 'typename':
$out = self::type_name($this->content_type);
break;
case 'permalink':
$out = $this->get_permalink();
break;
case 'editlink':
$out = $this->get_editlink();
break;
case 'tags':
$out = $this->get_tags();
break;
case 'comments':
$out = $this->get_comments();
break;
case 'comment_count':
$out = $this->get_comments()->count();
break;
case 'approved_comment_count':
$out = Comments::count_by_id($this->id);
break;
case 'comment_feed_link':
$out = $this->get_comment_feed_link();
break;
case 'author':
$out = $this->get_author();
break;
case 'info':
$out = $this->get_info();
break;
case 'excerpt':
$field = 'content' . ($filter ? '_' . $filter : '_out');
$out = $this->__get($field);
if (!Plugins::implemented('post_excerpt', 'filter')) {
$out = Format::more($out, $this, Options::get('excerpt_settings', array('max_paragraphs' => 2)));
}
break;
default:
$out = parent::__get($name);
break;
}
if ($filter != 'internal') {
$out = Plugins::filter("post_get", $out, $name, $this);
$out = Plugins::filter("post_{$name}", $out, $this);
}
if ($filter) {
$out = Plugins::filter("post_{$name}_{$filter}", $out, $this);
}
return $out;
}