本文整理汇总了PHP中get_extended函数的典型用法代码示例。如果您正苦于以下问题:PHP get_extended函数的具体用法?PHP get_extended怎么用?PHP get_extended使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_extended函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mt_getpost
function mt_getpost($params)
{
// ($postid, $user, $pass)
$xpostid = $params->getParam(0);
$xuser = $params->getParam(1);
$xpass = $params->getParam(2);
$post_ID = $xpostid->scalarval();
$username = $xuser->scalarval();
$password = $xpass->scalarval();
// Check login
if (user_pass_ok(addslashes($username), $password)) {
$postdata = get_postdata($post_ID);
if ($postdata['Date'] != '') {
// why were we converting to GMT here? spec doesn't call for that.
//$post_date = mysql2date('U', $postdata['Date']);
//$post_date = gmdate('Ymd', $post_date).'T'.gmdate('H:i:s', $post_date);
$post_date = strtotime($postdata['Date']);
$post_date = date('Ymd', $post_date) . 'T' . date('H:i:s', $post_date);
$catids = wp_get_post_cats('1', $post_ID);
logIO('O', 'Category No:' . count($catids));
foreach ($catids as $catid) {
$catname = get_cat_name($catid);
logIO('O', 'Category:' . $catname);
$catnameenc = new xmlrpcval(mb_conv($catname, 'UTF-8', $GLOBALS['blog_charset']));
$catlist[] = $catnameenc;
}
$post = get_extended($postdata['Content']);
$allow_comments = 'open' == $postdata['comment_status'] ? 1 : 0;
$allow_pings = 'open' == $postdata['ping_status'] ? 1 : 0;
$resp = array('link' => new xmlrpcval(post_permalink($post_ID)), 'title' => new xmlrpcval(mb_conv($postdata['Title'], 'UTF-8', $GLOBALS['blog_charset'])), 'description' => new xmlrpcval(mb_conv($post['main'], 'UTF-8', $GLOBALS['blog_charset'])), 'dateCreated' => new xmlrpcval($post_date, 'dateTime.iso8601'), 'userid' => new xmlrpcval($postdata['Author_ID']), 'postid' => new xmlrpcval($postdata['ID']), 'content' => new xmlrpcval(mb_conv($postdata['Content'], 'UTF-8', $GLOBALS['blog_charset'])), 'permalink' => new xmlrpcval(post_permalink($post_ID)), 'categories' => new xmlrpcval($catlist, 'array'), 'mt_keywords' => new xmlrpcval("{$catids[0]}"), 'mt_excerpt' => new xmlrpcval(mb_conv($postdata['Excerpt'], 'UTF-8', $GLOBALS['blog_charset'])), 'mt_allow_comments' => new xmlrpcval($allow_comments, 'int'), 'mt_allow_pings' => new xmlrpcval($allow_pings, 'int'), 'mt_convert_breaks' => new xmlrpcval('true'), 'mt_text_more' => new xmlrpcval(mb_conv($post['extended'], 'UTF-8', $GLOBALS['blog_charset'])));
$resp = new xmlrpcval($resp, 'struct');
return new xmlrpcresp($resp);
} else {
return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 3, "No such post #{$post_ID}");
}
} else {
return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 3, 'Wrong username/password combination ' . $username . ' / ' . starify($password));
}
}
示例2: appendExtended
/**
* Append the extended contents to the "read more" link
*
* @param string $link The current "read more" link
* @param string $linkText The text for the "read more" link
*
* @return string "Read more" link with the extended entry contents
*/
public function appendExtended($link, $linkText)
{
$link = $this->replaceLinkText($link, $linkText);
$post = get_post();
$extended = get_extended($post->post_content);
$extended = "<div class=\"entry-extended\">{$extended['extended']}</div>";
return $link . $extended;
}
示例3: get_raw_value
/**
* @see CPAC_Column::get_raw_value()
* @since 2.0.3
*/
function get_raw_value($post_id)
{
$value = '';
$p = get_post($post_id);
$extended = get_extended($p->post_content);
if (!empty($extended['extended'])) {
$value = $this->get_shortened_string($extended['main'], $this->options->excerpt_length);
}
return $value;
}
示例4: toutatis_excerpt
function toutatis_excerpt($length)
{
global $post;
// No excerpt needed
if ($length == 0) {
return '';
}
// Do we have an excerpt ? (excerpt field in the post editor)
if (has_excerpt()) {
return apply_filters('the_excerpt', wpautop(strip_shortcodes(strip_tags(get_the_excerpt()))));
}
// Do we have a read more tag (<!--more-->) in the post content ?
if (strpos($post->post_content, '<!--more-->')) {
$content_arr = get_extended($post->post_content);
return apply_filters('the_excerpt', wpautop(strip_shortcodes(strip_tags($content_arr['main']))));
}
// Get the post content without shortcodes or HTML tags
$content = strip_shortcodes(strip_tags(get_the_content()));
// Create a custom excerpt based on the post content
return apply_filters('the_excerpt', wpautop(wp_trim_words($content, $length)));
}
示例5: bdn_xmlrpc_get_posts
function bdn_xmlrpc_get_posts($args)
{
global $wp_xmlrpc_server;
$wp_xmlrpc_server->escape($args);
$blog_ID = (int) $args[0];
$username = $args[1];
$password = $args[2];
$post_type = $args[3];
$category = $args[4];
$numberposts = $args[5];
$extra = $args[6];
if (!($user = $wp_xmlrpc_server->login($username, $password))) {
return $wp_xmlrpc_server->error;
}
$category_int = (int) $category;
if (!empty($category_int)) {
$category_call = 'cat';
} else {
$category_call = 'category_name';
}
$post_args = array('numberposts' => $numberposts, 'posts_per_page' => $numberposts, $category_call => $category, 'post_type' => $post_type, 'post_status' => 'any');
if (is_array($extra)) {
$post_args = array_merge($post_args, $extra);
}
$posts_list = query_posts($post_args);
if (!$posts_list) {
$wp_xmlrpc_server->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
return $wp_xmlrpc_server->error;
}
foreach ($posts_list as $entry) {
if (!current_user_can('edit_post', $entry->ID)) {
continue;
}
$post_date = mysql2date('Ymd\\TH:i:s', $entry->post_date, false);
$post_date_gmt = mysql2date('Ymd\\TH:i:s', $entry->post_date_gmt, false);
$post_modified = mysql2date('Ymd\\TH:i:s', $entry->post_modified, false);
// For drafts use the GMT version of the date
if ($entry->post_status == 'draft') {
$post_date_gmt = get_gmt_from_date(mysql2date('Y-m-d H:i:s', $entry->post_date), 'Ymd\\TH:i:s');
}
$categories = array();
$cats = get_the_category($entry->ID, 'category');
foreach ($cats as $cat) {
$categories[] = array('name' => $cat->cat_name, 'parent' => $cat->category_parent);
}
$publications = array();
$pubs = get_the_terms($entry->ID, 'publication');
foreach ($pubs as $pub) {
$publications[] = $pub->name;
}
$post = get_extended($entry->post_content);
$link = post_permalink($entry->ID);
// Get the post author info.
$authors = (array) get_userdata($entry->post_author);
if (function_exists('get_coauthors')) {
$authors = get_coauthors($entry->ID);
}
$allow_comments = 'open' == $entry->comment_status ? 1 : 0;
$allow_pings = 'open' == $entry->ping_status ? 1 : 0;
// Consider future posts as published
if ($entry->post_status === 'future') {
$entry->post_status = 'publish';
}
$entryPost = array('post_date' => new IXR_Date($post_date), 'post_updated' => new IXR_Date($post_modified), 'userid' => $entry->post_author, 'post_id' => $entry->ID, 'description' => $post['main'], 'post_title' => $entry->post_title, 'link' => $link, 'permaLink' => $link, 'post_parent' => strval($post['post_parent']), 'post_content' => $entry->post_content, 'categories' => $categories, 'mt_excerpt' => $entry->post_excerpt, 'mt_text_more' => $post['extended'], 'mt_allow_comments' => $allow_comments, 'mt_allow_pings' => $allow_pings, 'wp_slug' => $entry->post_name, 'wp_password' => $entry->post_password, 'wp_authors' => $authors, 'date_created_gmt' => new IXR_Date($post_date_gmt), 'post_status' => $entry->post_status, 'custom_fields' => $wp_xmlrpc_server->get_custom_fields($entry->ID), 'publications' => $publications);
$post_type_taxonomies = get_object_taxonomies(POST_TYPE, 'names');
$terms = wp_get_object_terms($entry->ID, $post_type_taxonomies);
$entryPost['terms'] = array();
foreach ($terms as $term) {
$entryPost['terms'][] = _prepare_term($term);
}
$struct[] = $entryPost;
}
$recent_posts = array();
for ($j = 0; $j < count($struct); $j++) {
array_push($recent_posts, $struct[$j]);
}
return $recent_posts;
}
示例6: hippo_has_more_content
/**
* Check that content has <!--more--> tag or not :)
*
* @param $contents
*
* @return bool
*/
function hippo_has_more_content($contents)
{
$contents = get_extended($contents);
return !empty($contents['extended']);
}
示例7: mltlngg_the_content_filter
function mltlngg_the_content_filter($content)
{
global $hook_suffix, $post, $wpdb, $mltlngg_table_translate, $mltlngg_current_language, $mltlngg_active_language, $mltlngg_options, $mltlngg_wp_providers;
if (is_admin() && !('post.php' == $hook_suffix || 'post-new.php' == $hook_suffix)) {
return $content;
}
$mltlngg_post_type = get_post_type($post->ID);
/* If current post type enabled to translation */
if ($mltlngg_post_type == 'post' || $mltlngg_post_type == 'page') {
if (is_admin()) {
$mltlngg_current_language = isset($_GET['lang']) ? $_GET['lang'] : (isset($mltlngg_active_language['locale']) ? $mltlngg_active_language['locale'] : $mltlngg_options['default_language']);
}
$new_content = $wpdb->get_var($wpdb->prepare("SELECT `post_content` FROM {$mltlngg_table_translate} WHERE `post_ID` = %d AND `language` = '%s' ", $post->ID, $mltlngg_current_language));
if (!empty($new_content)) {
if (!is_admin()) {
if (!post_password_required()) {
$noteaser = false !== strpos($new_content, '<!--noteaser-->') ? true : false;
$extends = get_extended($new_content);
$extended = $extends['extended'];
$new_content = $extends['main'];
if (!empty($mltlngg_wp_providers)) {
foreach ($mltlngg_wp_providers as $template) {
if (false !== preg_match($template, $extends['extended'])) {
$extended = preg_replace_callback($template, "mltlngg_videos_filter", $extended);
}
if (false !== preg_match($template, $extends['main'])) {
$new_content = preg_replace_callback($template, "mltlngg_videos_filter", $new_content);
}
}
}
if (!is_single() && !is_page() && !is_search()) {
$more_link_text = __('(more…)');
$more_link = apply_filters('the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">{$more_link_text}</a>", $more_link_text);
if ('' != $extended) {
$new_content .= $more_link;
}
} elseif (is_page()) {
$new_content .= $extended;
} else {
if ($noteaser) {
$new_content = '';
}
$new_content .= 0 != strlen($new_content) ? '<span id="more-' . $post->ID . '"></span>' . $extended : $extended;
}
if (0 != strlen($new_content)) {
return $new_content;
}
} else {
$content = get_the_password_form();
}
/* If translation is exist and not empty, filter content */
} else {
$content = $new_content;
}
}
}
return $content;
}
示例8: mw_getRecentPosts
function mw_getRecentPosts($args)
{
$this->escape($args);
$blog_ID = (int) $args[0];
$user_login = $args[1];
$user_pass = $args[2];
$num_posts = (int) $args[3];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
$posts_list = wp_get_recent_posts($num_posts);
if (!$posts_list) {
$this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
return $this->error;
}
set_current_user(0, $user_login);
foreach ($posts_list as $entry) {
if (!current_user_can('edit_post', $entry['ID'])) {
continue;
}
$post_date = mysql2date('Ymd\\TH:i:s', $entry['post_date']);
$post_date_gmt = mysql2date('Ymd\\TH:i:s', $entry['post_date_gmt']);
$categories = array();
$catids = wp_get_post_categories($entry['ID']);
foreach ($catids as $catid) {
$categories[] = get_cat_name($catid);
}
$tagnames = array();
$tags = wp_get_post_tags($entry['ID']);
if (!empty($tags)) {
foreach ($tags as $tag) {
$tagnames[] = $tag->name;
}
$tagnames = implode(', ', $tagnames);
} else {
$tagnames = '';
}
$post = get_extended($entry['post_content']);
$link = post_permalink($entry['ID']);
// Get the post author info.
$author = get_userdata($entry['post_author']);
$allow_comments = 'open' == $entry['comment_status'] ? 1 : 0;
$allow_pings = 'open' == $entry['ping_status'] ? 1 : 0;
$struct[] = array('dateCreated' => new IXR_Date($post_date), 'userid' => $entry['post_author'], 'postid' => $entry['ID'], 'description' => $post['main'], 'title' => $entry['post_title'], 'link' => $link, 'permaLink' => $link, 'categories' => $categories, 'mt_excerpt' => $entry['post_excerpt'], 'mt_text_more' => $post['extended'], 'mt_allow_comments' => $allow_comments, 'mt_allow_pings' => $allow_pings, 'mt_keywords' => $tagnames, 'wp_slug' => $entry['post_name'], 'wp_password' => $entry['post_password'], 'wp_author_id' => $author->ID, 'wp_author_display_name' => $author->display_name, 'date_created_gmt' => new IXR_Date($post_date_gmt));
}
$recent_posts = array();
for ($j = 0; $j < count($struct); $j++) {
array_push($recent_posts, $struct[$j]);
}
return $recent_posts;
}
示例9: the_ID
<div id="post-<?php
the_ID();
?>
" <?php
post_class();
?>
>
<div class="post-quote">
<?php
// Fetch post content
$content = get_post_field('post_content', get_the_ID());
// Get content parts
$content_parts = get_extended($content);
// Output part before <!--more--> tag
echo $content_parts['main'];
?>
</div> <!-- /post-quote -->
<?php
if (is_sticky()) {
?>
<div class="is-sticky">
<div class="genericon genericon-pinned"></div>
</div>
<?php
示例10: mw_getRecentPosts
function mw_getRecentPosts($args) {
$this->escape($args);
$blog_ID = $args[0];
$user_login = $args[1];
$user_pass = $args[2];
$num_posts = $args[3];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
$posts_list = wp_get_recent_posts($num_posts);
if (!$posts_list) {
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
return $this->error;
}
foreach ($posts_list as $entry) {
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
$categories = array();
$catids = wp_get_post_categories($entry['ID']);
foreach($catids as $catid) {
$categories[] = get_cat_name($catid);
}
$post = get_extended($entry['post_content']);
$link = post_permalink($entry['ID']);
$allow_comments = ('open' == $entry['comment_status']) ? 1 : 0;
$allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
$struct[] = array(
'dateCreated' => new IXR_Date($post_date),
'userid' => $entry['post_author'],
'postid' => $entry['ID'],
'description' => $post['main'],
'title' => $entry['post_title'],
'link' => $link,
'permaLink' => $link,
// commented out because no other tool seems to use this
// 'content' => $entry['post_content'],
'categories' => $categories,
'mt_excerpt' => $entry['post_excerpt'],
'mt_text_more' => $post['extended'],
'mt_allow_comments' => $allow_comments,
'mt_allow_pings' => $allow_pings
);
}
$recent_posts = array();
for ($j=0; $j<count($struct); $j++) {
array_push($recent_posts, $struct[$j]);
}
return $recent_posts;
}
示例11: get_orderby_posts_vars
//.........这里部分代码省略.........
}
break;
case 'column-sticky':
$sort_flag = SORT_REGULAR;
$stickies = get_option('sticky_posts');
foreach ($this->get_any_posts_by_posttype($post_type) as $p) {
$cposts[$p->ID] = $p->ID;
if (!empty($stickies) && in_array($p->ID, $stickies)) {
$cposts[$p->ID] = 0;
}
}
break;
case 'column-featured_image':
$sort_flag = SORT_REGULAR;
foreach ($this->get_any_posts_by_posttype($post_type) as $p) {
$cposts[$p->ID] = $p->ID;
$thumb = get_the_post_thumbnail($p->ID);
if (!empty($thumb)) {
$cposts[$p->ID] = 0;
}
}
break;
case 'column-roles':
$sort_flag = SORT_STRING;
foreach ($this->get_any_posts_by_posttype($post_type) as $p) {
$cposts[$p->ID] = 0;
$userdata = get_userdata($p->post_author);
if (!empty($userdata->roles[0])) {
$cposts[$p->ID] = $userdata->roles[0];
}
}
break;
case 'column-status':
$sort_flag = SORT_STRING;
foreach ($this->get_any_posts_by_posttype($post_type) as $p) {
$cposts[$p->ID] = $p->post_status . strtotime($p->post_date);
}
break;
case 'column-comment-status':
$sort_flag = SORT_STRING;
foreach ($this->get_any_posts_by_posttype($post_type) as $p) {
$cposts[$p->ID] = $p->comment_status;
}
break;
case 'column-ping-status':
$sort_flag = SORT_STRING;
foreach ($this->get_any_posts_by_posttype($post_type) as $p) {
$cposts[$p->ID] = $p->ping_status;
}
break;
case 'column-taxonomy':
$sort_flag = SORT_STRING;
// needed to sort
$taxonomy = str_replace('column-taxonomy-', '', $id);
$cposts = $this->get_posts_sorted_by_taxonomy($post_type, $taxonomy);
break;
case 'column-author-name':
$sort_flag = SORT_STRING;
$display_as = $column[$id]['display_as'];
if ('userid' == $display_as) {
$sort_flag = SORT_NUMERIC;
}
foreach ($this->get_any_posts_by_posttype($post_type) as $p) {
if (!empty($p->post_author)) {
$name = Codepress_Admin_Columns::get_author_field_by_nametype($display_as, $p->post_author);
$cposts[$p->ID] = $name;
}
}
break;
case 'column-before-moretag':
$sort_flag = SORT_STRING;
foreach ($this->get_any_posts_by_posttype($post_type) as $p) {
$extended = get_extended($p->post_content);
$content = !empty($extended['extended']) ? $extended['main'] : '';
$cposts[$p->ID] = $this->prepare_sort_string_value($content);
}
break;
/** native WP columns */
// categories
/** native WP columns */
// categories
case 'categories':
$sort_flag = SORT_STRING;
// needed to sort
$cposts = $this->get_posts_sorted_by_taxonomy($post_type, 'category');
break;
// tags
// tags
case 'tags':
$sort_flag = SORT_STRING;
// needed to sort
$cposts = $this->get_posts_sorted_by_taxonomy($post_type, 'post_tag');
break;
}
// we will add the sorted post ids to vars['post__in'] and remove unused vars
if (isset($sort_flag)) {
$vars = $this->get_vars_post__in($vars, $cposts, $sort_flag);
}
return $vars;
}
示例12: get_header
<?php
get_header();
?>
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<?php
$post_content = get_extended($post->post_content);
$content_main = apply_filters('the_content', $post_content['main']);
$content_extended = apply_filters('the_content', $post_content['extended']);
$show_author = get_field('show_author');
//echo '<pre class="debug">';print_r($post_content);echo '</pre>';
if (!empty($post_content['more_text'])) {
$more_btn_text = $post_content['more_text'];
} else {
$more_btn_text = "Continue Reading";
}
?>
<!-- Container -->
<div class="container">
<article <?php
post_class();
?>
>
示例13: get_the_time
<?php
if ($fields->show_date) {
?>
<p><?php
echo get_the_time('Y-m-d H:i', $post->ID);
?>
</p>
<?php
}
?>
<?php
if ($fields->show_excerpt) {
?>
<p><?php
echo isset(get_extended($post->post_content)['main']) ? get_extended($post->post_content)['main'] : '';
?>
</p>
<?php
}
?>
</div>
</a>
</div>
<?php
}
?>
</div>
<?php
}
示例14: get_extended
public function get_extended()
{
return get_extended($this->post->post_content);
}
示例15: make_excerpt
public function make_excerpt($more_text = null)
{
// Author inserted a <!--more--> tag
$parts = get_extended($this->post_content);
if (!empty($parts['extended'])) {
$ret = trim($parts['main']);
// Conditionally add a read more link and
// clean up punctuation and ellipsis at end of excerpt
$wc_excerpt = str_word_count($ret);
$wc_content = str_word_count($this->post_content);
if ($wc_excerpt < $wc_content) {
$ret = preg_replace('/([\\.,;:!?\'"]{4,})$/', '...', $ret . '...');
if (!empty($more_text)) {
$ret = $ret . ' <a href="' . $this->permalink . '" class="more-link">' . $more_text . '</a>';
}
}
}
// Excerpt is empty, so generate one
if (empty($parts['extended'])) {
$text = strip_shortcodes($this->post_content);
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
$text = strip_tags($text);
$excerpt_length = apply_filters('excerpt_length', 55);
$read_more = apply_filters('read_more', ' ' . '[...]', $this);
$words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
if (count($words) > $excerpt_length) {
array_pop($words);
$text = implode(' ', $words);
$text = $text . $read_more;
} else {
$text = implode(' ', $words);
}
$ret = apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
}
/* TODO: cache results of this function */
return $ret;
}