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


PHP do_enclose函数代码示例

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


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

示例1: wpfc_sermon_audio_validate

/**
 * Enclose audio file for podcast on save and store in custom fields.
 * Using meta boxes validation filter.
 * Added by T Hyde 9 Oct 2013; Updated by Jack 4/4/14
 *
 * @param $new
 * @param $post_id
 * @param $field
 * @return $new unchanged
 */
function wpfc_sermon_audio_validate($new, $post_id, $field)
{
    // only for sermon audio
    if ($field['id'] != 'sermon_audio') {
        return $new;
    }
    $audio = get_post_meta($post_id, 'sermon_audio', 'true');
    // Stop if PowerPress plugin is active
    // Solves conflict regarding enclosure field: http://wordpress.org/support/topic/breaks-blubrry-powerpress-plugin?replies=6
    if (defined('POWERPRESS_VERSION')) {
        return false;
    }
    // Populate enclosure field with URL, length and format, if valid URL found
    // This will set the length of the enclosure automatically
    do_enclose($audio, $post_id);
    // Set duration as post meta
    $current = get_post_meta($post_id, 'sermon_audio', 'true');
    $currentduration = get_post_meta($post_id, '_wpfc_sermon_duration', 'true');
    // only grab if different (getting data from dropbox can be a bit slow)
    if ($new != '' && ($new != $current || empty($currentduration))) {
        // get file data
        $duration = wpfc_mp3_duration($new);
        // store in hidden custom fields
        update_post_meta($post_id, '_wpfc_sermon_duration', $duration);
    } elseif ($new == '') {
        // clean up if file removed
        delete_post_meta($post_id, '_wpfc_sermon_duration');
    }
    return $new;
}
开发者ID:mlloewen,项目名称:wp-muirlake,代码行数:40,代码来源:admin-functions.php

示例2: pushpress_send_ping

 function pushpress_send_ping($callback, $post_id, $feed_type, $secret)
 {
     global $pushpress;
     // Need to make sure that the PuSHPress options are initialized
     $pushpress->init();
     do_action('pushpress_send_ping');
     $remote_opt = array('headers' => array('format' => $feed_type), 'sslverify' => FALSE, 'timeout' => $pushpress->http_timeout, 'user-agent' => $pushpress->http_user_agent);
     $post = get_post($post_id);
     do_enclose($post->post_content, $post_id);
     update_postmeta_cache(array($post_id));
     query_posts("p={$post_id}");
     ob_start();
     $feed_url = FALSE;
     if ($feed_type == 'rss2') {
         do_action('pushpress_send_ping_rss2');
         $feed_url = get_bloginfo('rss2_url');
         $remote_opt['headers']['Content-Type'] = 'application/rss+xml';
         $remote_opt['headers']['Content-Type'] .= '; charset=' . get_option('blog_charset');
         @load_template(ABSPATH . WPINC . '/feed-rss2.php');
     } elseif ($feed_type == 'atom') {
         do_action('pushpress_send_ping_atom');
         $feed_url = get_bloginfo('atom_url');
         $remote_opt['headers']['Content-Type'] = 'application/atom+xml';
         $remote_opt['headers']['Content-Type'] .= '; charset=' . get_option('blog_charset');
         @load_template(ABSPATH . WPINC . '/feed-atom.php');
     }
     $remote_opt['body'] = ob_get_contents();
     ob_end_clean();
     // Figure out the signatur header if we have a secret on
     // on file for this callback
     if (!empty($secret)) {
         $remote_opt['headers']['X-Hub-Signature'] = 'sha1=' . hash_hmac('sha1', $remote_opt['body'], $secret);
     }
     $response = wp_remote_post($callback, $remote_opt);
     // look for failures
     if (is_wp_error($result)) {
         do_action('pushpress_ping_wp_error');
         return FALSE;
     }
     if (isset($response->errors['http_request_failed'][0])) {
         do_action('pushpress_ping_http_failure');
         return FALSE;
     }
     $status_code = (int) $response['response']['code'];
     if ($status_code < 200 || $status_code > 299) {
         do_action('pushpress_ping_not_2xx_failure');
         $pushpress->unsubscribe_callback($feed_url, $callback);
         return FALSE;
     }
 }
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:50,代码来源:send-ping.php

示例3: ctc_sermon_save_audio_enclosure

/**
 * Save enclosure for sermon podcasting
 *
 * When audio URL is provided, save its data to the 'enclosure' field.
 * WordPress automatically uses this data to make feeds useful for podcasting.
 *
 * @since 0.9
 * @param int $post_id ID of post being saved
 * @param object $post Post object being saved
 */
function ctc_sermon_save_audio_enclosure($post_id, $post)
{
    // Stop if no post, auto-save (meta not submitted) or user lacks permission
    $post_type = get_post_type_object($post->post_type);
    if (empty($_POST) || defined('DOING_AUTOSAVE') && DOING_AUTOSAVE || !current_user_can($post_type->cap->edit_post, $post_id)) {
        return false;
    }
    // Stop if PowerPress plugin is active
    // Solves conflict regarding enclosure field: http://wordpress.org/support/topic/breaks-blubrry-powerpress-plugin?replies=6
    if (defined('POWERPRESS_VERSION')) {
        return false;
    }
    // Get audio URL
    $audio = get_post_meta($post_id, '_ctc_sermon_audio', true);
    // Populate enclosure field with URL, length and format, if valid URL found
    do_enclose($audio, $post_id);
}
开发者ID:pmsteil,项目名称:church-theme-content,代码行数:27,代码来源:sermon-fields.php

示例4: execute_all_pings

function execute_all_pings()
{
    global $wpdb;
    // Do pingbacks
    while ($ping = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) {
        $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';");
        pingback($ping->post_content, $ping->ID);
        echo "Pingback: {$ping->post_title} : {$ping->ID}<br/>";
    }
    // Do Enclosures
    while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
        $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';");
        do_enclose($enclosure->post_content, $enclosure->ID);
        echo "Enclosure: {$enclosure->post_title} : {$enclosure->ID}<br/>";
    }
    // Do Trackbacks
    while ($trackback = $wpdb->get_row("SELECT ID FROM {$wpdb->posts} WHERE TRIM(to_ping) != '' AND post_status != 'draft' LIMIT 1")) {
        echo "Trackback : {$trackback->ID}<br/>";
        do_trackbacks($trackback->ID);
    }
}
开发者ID:robertlange81,项目名称:Website,代码行数:21,代码来源:execute-pings.php

示例5: do_all_pings

/**
 * Perform all pingbacks, enclosures, trackbacks, and send to pingback services.
 *
 * @since 2.1.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 */
function do_all_pings()
{
    global $wpdb;
    // Do pingbacks
    while ($ping = $wpdb->get_row("SELECT ID, post_content, meta_id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) {
        delete_metadata_by_mid('post', $ping->meta_id);
        pingback($ping->post_content, $ping->ID);
    }
    // Do Enclosures
    while ($enclosure = $wpdb->get_row("SELECT ID, post_content, meta_id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
        delete_metadata_by_mid('post', $enclosure->meta_id);
        do_enclose($enclosure->post_content, $enclosure->ID);
    }
    // Do Trackbacks
    $trackbacks = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE to_ping <> '' AND post_status = 'publish'");
    if (is_array($trackbacks)) {
        foreach ($trackbacks as $trackback) {
            do_trackbacks($trackback);
        }
    }
    //Do Update Services/Generic Pings
    generic_ping();
}
开发者ID:hadywisam,项目名称:WordPress,代码行数:30,代码来源:comment-functions.php

示例6: while

<?php

require_once '../wp-config.php';
// Do pingbacks
while ($ping = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) {
    $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';");
    pingback($ping->post_content, $ping->ID);
}
// Do Enclosures
while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
    $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';");
    do_enclose($enclosure->post_content, $enclosure->ID);
}
// Do Trackbacks
$trackbacks = $wpdb->get_results("SELECT ID FROM {$wpdb->posts} WHERE CHAR_LENGTH(TRIM(to_ping)) > 7 AND post_status != 'draft'");
if (is_array($trackbacks)) {
    foreach ($trackbacks as $trackback) {
        do_trackbacks($trackback->ID);
    }
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:20,代码来源:execute-pings.php

示例7: do_all_pings

/**
 * Perform all pingbacks, enclosures, trackbacks, and send to pingback services.
 *
 * @since 2.1.0
 * @uses $wpdb
 */
function do_all_pings()
{
    global $wpdb;
    // Do pingbacks
    while ($ping = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) {
        $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';");
        pingback($ping->post_content, $ping->ID);
    }
    // Do Enclosures
    while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
        $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key = '_encloseme';", $enclosure->ID));
        do_enclose($enclosure->post_content, $enclosure->ID);
    }
    // Do Trackbacks
    $trackbacks = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE to_ping <> '' AND post_status = 'publish'");
    if (is_array($trackbacks)) {
        foreach ($trackbacks as $trackback) {
            do_trackbacks($trackback);
        }
    }
    //Do Update Services/Generic Pings
    generic_ping();
}
开发者ID:SymbiSoft,项目名称:litprojects,代码行数:29,代码来源:comment.php

示例8: pushpress_send_ping

 function pushpress_send_ping($callback, $post_id, $feed_type, $secret)
 {
     global $pushpress, $current_user;
     // Do all WP_Query calcs and send feeds as logged-out user.
     $old_user_id = $current_user->ID;
     wp_set_current_user(0);
     // Need to make sure that the PuSHPress options are initialized
     $pushpress->init();
     do_action('pushpress_send_ping');
     $remote_opt = array('headers' => array('format' => $feed_type), 'sslverify' => FALSE, 'timeout' => $pushpress->http_timeout, 'user-agent' => $pushpress->http_user_agent);
     $post = get_post($post_id);
     $post_status_obj = get_post_status_object($post->post_status);
     if (!$post_status_obj->public) {
         do_action('pushpress_nonpublic_post', $post_id);
         wp_set_current_user($old_user_id);
         return false;
     }
     do_enclose($post->post_content, $post_id);
     update_postmeta_cache(array($post_id));
     // make sure the channel title stays consistent
     // without this it would append the post title as well
     add_filter('wp_title', '__return_false', 999);
     query_posts("p={$post_id}");
     ob_start();
     $feed_url = FALSE;
     if ($feed_type == 'rss2') {
         do_action('pushpress_send_ping_rss2');
         $feed_url = get_bloginfo('rss2_url');
         $remote_opt['headers']['Content-Type'] = 'application/rss+xml';
         $remote_opt['headers']['Content-Type'] .= '; charset=' . get_option('blog_charset');
         @load_template(ABSPATH . WPINC . '/feed-rss2.php');
     } elseif ($feed_type == 'atom') {
         do_action('pushpress_send_ping_atom');
         $feed_url = get_bloginfo('atom_url');
         $remote_opt['headers']['Content-Type'] = 'application/atom+xml';
         $remote_opt['headers']['Content-Type'] .= '; charset=' . get_option('blog_charset');
         @load_template(ABSPATH . WPINC . '/feed-atom.php');
     }
     $remote_opt['body'] = ob_get_contents();
     ob_end_clean();
     // Figure out the signatur header if we have a secret on
     // on file for this callback
     if (!empty($secret)) {
         $remote_opt['headers']['X-Hub-Signature'] = 'sha1=' . hash_hmac('sha1', $remote_opt['body'], $secret);
     }
     $response = wp_remote_post($callback, $remote_opt);
     // look for failures
     if (is_wp_error($response)) {
         do_action('pushpress_ping_wp_error');
         wp_set_current_user($old_user_id);
         return FALSE;
     }
     if (isset($response->errors['http_request_failed'][0])) {
         do_action('pushpress_ping_http_failure');
         wp_set_current_user($old_user_id);
         return FALSE;
     }
     $status_code = (int) $response['response']['code'];
     if ($status_code < 200 || $status_code > 299) {
         do_action('pushpress_ping_not_2xx_failure');
         $pushpress->unsubscribe_callback($feed_url, $callback);
         wp_set_current_user($old_user_id);
         return FALSE;
     }
     wp_set_current_user($old_user_id);
 }
开发者ID:liangwei1988,项目名称:wordpress,代码行数:66,代码来源:send-ping.php

示例9: cultiv8_sermon_save_audio_enclosure

function cultiv8_sermon_save_audio_enclosure($post_id, $post)
{
    // Stop if no post, auto-save (meta not submitted) or user lacks permission
    if ('ctc_sermon' != $post->post_type) {
        return;
    }
    $post_type = get_post_type_object($post->post_type);
    if (empty($_POST) || defined('DOING_AUTOSAVE') && DOING_AUTOSAVE || !current_user_can($post_type->cap->edit_post, $post_id)) {
        return false;
    }
    // Stop if PowerPress plugin is active
    // Solves conflict regarding enclosure field: http://wordpress.org/support/topic/breaks-blubrry-powerpress-plugin?replies=6
    if (defined('POWERPRESS_VERSION')) {
        return false;
    }
    // Get audio URL
    $audio = get_post_meta($post_id, '_ctc_sermon_audio', true);
    // The built-in do_enclose method goes a roundabout way of getting the file
    // length, which involves an http fetch to get the right length. On some server
    // configurations if the fetch fails the enclosure isn't added. While the fetch
    // is necessary if the file is remote, it's frustrating if the file is on the
    // same server, where WP can get all the information without the http fetch.
    // This method now does the handling of the enclosure data using WP methods if the
    // file is local and then falls back to the normal do_enclose method if it's
    // a remote file
    // Populate enclosure field with URL, length and format, if valid URL found
    $uploads = wp_upload_dir();
    // A local file is assume to be one living in the uploads directory
    $is_local = stripos($audio, $uploads['baseurl']);
    if (!(false === $is_local)) {
        // Get the path to the file
        $audio_src = str_replace($uploads['baseurl'], $uploads['basedir'], $audio);
        // Get meta data
        $metadata = wp_read_audio_metadata($audio_src);
        if ($metadata) {
            // Make sure we got metadata and read the mime_type
            // and filesize values which are needed for the enclosure
            $mime = $metadata['mime_type'];
            $length = $metadata['filesize'];
            if ($mime) {
                // We've got data, add enclosure meta
                update_post_meta($post_id, 'enclosure', "{$audio}\n{$length}\n{$mime}\n");
            }
        }
    } else {
        // Leave do_enclose for remote files
        do_enclose($audio, $post_id);
    }
}
开发者ID:serranoabq,项目名称:cultiv8,代码行数:49,代码来源:feeds.php

示例10: podcasting_save_form

function podcasting_save_form($postID)
{
    global $wpdb;
    // Security prevention
    if (!current_user_can('edit_post', $postID)) {
        return $postID;
    }
    // Extra security prevention
    if (isset($_POST['comment_post_ID'])) {
        return $postID;
    }
    if (isset($_POST['not_spam'])) {
        return $postID;
    }
    // akismet fix
    if (isset($_POST['comment'])) {
        return $postID;
    }
    // moderation.php fix
    // Ignore save_post action for revisions and autosaves
    if (function_exists('wp_is_post_revision') && function_exists('wp_is_post_autosave')) {
        if (wp_is_post_revision($postID) || wp_is_post_autosave($postID)) {
            return $postID;
        }
    }
    // Add new enclosures
    if ($_POST['pod_new_enclosure_ids'] != '') {
        $pod_new_enclosure_ids = explode(',', substr($_POST['pod_new_enclosure_ids'], 0, -1));
        $pod_ignore_enclosure_ids = explode(',', substr($_POST['pod_ignore_enclosure_ids'], 0, -1));
        $added_enclosure_ids = array();
        foreach ($pod_new_enclosure_ids as $pod_enclosure_id) {
            $pod_enclosure_id = (int) $pod_enclosure_id;
            // Check if the enclosure is on the ignore list
            if (!in_array($pod_enclosure_id, $pod_ignore_enclosure_ids)) {
                $pod_content = podcasting_urlencode($_POST['pod_new_file_' . $pod_enclosure_id]);
                $pod_format = $_POST['pod_new_format_' . $pod_enclosure_id];
                $enclosed = get_enclosed($postID);
                do_enclose($pod_content, $postID);
                // Add relationship if new enclosure
                if (!in_array($pod_content, $enclosed)) {
                    $pod_enclosure_id2 = $wpdb->get_var("SELECT meta_id FROM {$wpdb->postmeta} WHERE post_id = {$postID} AND meta_key = 'enclosure' ORDER BY meta_id DESC");
                    // Find the enclosure we just added
                    wp_set_object_terms($pod_enclosure_id2, $pod_format, 'podcast_format', false);
                }
                $added_enclosure_ids[] = $pod_enclosure_id;
            }
        }
    }
    // Update enclosures
    if (isset($_POST['pod_enclosure_ids'])) {
        $pod_enclosure_ids = explode(',', $_POST['pod_enclosure_ids']);
        $pod_new_enclosure_ids = explode(',', substr($_POST['pod_new_enclosure_ids'], 0, -1));
        $pod_ignore_enclosure_ids = explode(',', substr($_POST['pod_ignore_enclosure_ids'], 0, -1));
        $pod_delete_enclosure_ids = explode(',', substr($_POST['pod_delete_enclosure_ids'], 0, -1));
        $enclosures = $wpdb->get_results("SELECT meta_id, meta_value FROM {$wpdb->postmeta} WHERE post_id = {$postID} AND meta_key = 'enclosure' ORDER BY meta_id", ARRAY_A);
        $i = 0;
        if ($_POST['pod_enclosure_ids'] != '') {
            foreach ($pod_enclosure_ids as $pod_enclosure_id) {
                // Ensure we're dealing with an ID
                $pod_enclosure_id = (int) $pod_enclosure_id;
                $itunes = serialize(array('format' => $_POST['pod_format_' . $pod_enclosure_id], 'keywords' => $_POST['pod_keywords_' . $pod_enclosure_id], 'author' => $_POST['pod_author_' . $pod_enclosure_id], 'length' => $_POST['pod_length_' . $pod_enclosure_id], 'explicit' => $_POST['pod_explicit_' . $pod_enclosure_id]));
                // Update format
                wp_set_object_terms($pod_enclosure_id, $_POST['pod_format_' . $pod_enclosure_id], 'podcast_format', false);
                // Update enclsoure
                $enclosure = explode("\n", $enclosures[$i]['meta_value']);
                $enclosure[3] = $itunes;
                update_post_meta($postID, 'enclosure', implode("\n", $enclosure), $enclosures[$i]['meta_value']);
                $i++;
                // Delete enclosure
                if (in_array($pod_enclosure_id, $pod_delete_enclosure_ids)) {
                    // Remove format
                    wp_delete_object_term_relationships($pod_enclosure_id, 'podcast_format');
                    // Remove enclosure
                    delete_meta($pod_enclosure_id);
                }
            }
        }
        if (count($added_enclosure_ids) > 0) {
            foreach ($added_enclosure_ids as $pod_enclosure_id) {
                // Ensure we're dealing with an ID
                $pod_enclosure_id = (int) $pod_enclosure_id;
                // Check if the enclosure is on the ignore list
                if (!in_array($pod_enclosure_id, $pod_ignore_enclosure_ids)) {
                    $itunes = serialize(array('format' => $_POST['pod_new_format_' . $pod_enclosure_id], 'keywords' => $_POST['pod_new_keywords_' . $pod_enclosure_id], 'author' => $_POST['pod_new_author_' . $pod_enclosure_id], 'length' => $_POST['pod_new_length_' . $pod_enclosure_id], 'explicit' => $_POST['pod_new_explicit_' . $pod_enclosure_id]));
                    // Update format
                    $meta_id = $enclosures[$i]['meta_id'];
                    wp_set_object_terms($meta_id, $_POST['pod_new_format_' . $pod_enclosure_id], 'podcast_format', false);
                    // Update enclsoure
                    $enclosure = explode("\n", $enclosures[$i]['meta_value']);
                    $enclosure[3] = $itunes;
                    $enclosure_insert = implode("\n", $enclosure);
                    $wpdb->query("UPDATE {$wpdb->postmeta} SET meta_value = '{$enclosure_insert}' WHERE meta_id = '{$meta_id}'");
                    $i++;
                }
            }
        }
    }
    return $postID;
}
开发者ID:alx,项目名称:barceloneta,代码行数:99,代码来源:podcasting.php

示例11: podcasting_save_form

function podcasting_save_form($postID)
{
    global $wpdb;
    // Security prevention
    if (!current_user_can('edit_post', $postID)) {
        return $postID;
    }
    // Extra security prevention
    if (isset($_POST['comment_post_ID'])) {
        return $postID;
    }
    if (isset($_POST['not_spam'])) {
        return $postID;
    }
    // akismet fix
    if (isset($_POST['comment'])) {
        return $postID;
    }
    // moderation.php fix
    // Update enclosures
    $enclosure_ids = explode(',', $_POST['enclosure_ids']);
    $enclosures = get_post_meta($postID, 'enclosure');
    $i = 0;
    foreach ($enclosure_ids as $enclosure_id) {
        // Ensure we're dealing with an ID
        $enclosure_id = (int) $enclosure_id;
        $itunes = serialize(array('format' => $_POST['pod_format_' . $enclosure_id], 'keywords' => $_POST['pod_keywords_' . $enclosure_id], 'author' => $_POST['pod_author_' . $enclosure_id], 'length' => $_POST['pod_length_' . $enclosure_id], 'explicit' => $_POST['pod_explicit_' . $enclosure_id]));
        // Update format
        wp_set_object_terms($enclosure_id, $_POST['pod_format_' . $enclosure_id], 'podcast_format', false);
        // Update enclsoure
        $enclosure = explode("\n", $enclosures[$i]);
        $enclosure[3] = $itunes;
        update_post_meta($postID, 'enclosure', implode("\n", $enclosure), $enclosures[$i]);
        $i++;
        // Delete enclosure
        if (isset($_POST['delete_pod_' . $enclosure_id])) {
            // Remove format
            wp_delete_object_term_relationships($enclosure_id, 'podcast_format');
            // Remove enclosure
            delete_meta($enclosure_id);
            // Fake a save
            $_POST['save'] = 'Update';
        }
    }
    // Add new enclosures
    if (isset($_POST['pod_new_file']) && '' != $_POST['pod_new_file']) {
        $content = $_POST['pod_new_file'];
        $enclosed = get_enclosed($postID);
        do_enclose($content, $postID);
        // Add relationship if new enclosure
        if (!in_array($content, $enclosed)) {
            $enclosure_id = $wpdb->get_var("SELECT meta_id FROM {$wpdb->postmeta} WHERE post_id = {$postID} AND meta_key = 'enclosure' ORDER BY meta_id DESC");
            // Find the enclosure we just added
            wp_set_object_terms($enclosure_id, 'default-format', 'podcast_format', false);
        }
    }
    return $postID;
}
开发者ID:AkimBolushbek,项目名称:wordpress-soc-2007,代码行数:58,代码来源:podcasting.php

示例12: VALUES

	
	// Add any?
	foreach ($post_categories as $new_cat) {
		if (!in_array($new_cat, $old_categories))
			$wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_ID, $new_cat)");
	}

	if ($prev_status != 'publish' && $post_status == 'publish')
		do_action('private_to_published', $post_ID);

	do_action('edit_post', $post_ID);

	if ($post_status == 'publish') {
		do_action('publish_post', $post_ID);
		do_trackbacks($post_ID);
		do_enclose( $content, $post_ID );
		if ( get_option('default_pingback_flag') )
			pingback($content, $post_ID);
	}

	if ($post_status == 'static') {
		generate_page_rewrite_rules();

		if ( ! update_post_meta($post_ID, '_wp_page_template',  $_POST['page_template'])) {
			add_post_meta($post_ID, '_wp_page_template',  $_POST['page_template'], true);
		}
	}

	exit();
	break;
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:29,代码来源:post.php

示例13: mbpoPingServices

 /**
  * Copy of WP's "generic_ping".
  * Uses another function to send the actual XML-RPC messages.
  * @param string $post_title Title of the post
  * @param integer $post_type Future post or current post
  */
 function mbpoPingServices($post_title, $post_type)
 {
     global $wpdb;
     $this->already_pinged = array();
     $this->_post_type = $post_type;
     if (strpos($post_title, '~#') !== false) {
         $post_id_title = explode('~#', $post_title);
         $this->_post_title = $post_id_title[1];
         $this->_post_url = get_permalink($post_id_title[0]);
     } else {
         $this->_post_title = $post_title;
         $this->_post_url = '';
     }
     if ($this->mbpo_wp_version >= 2.1) {
         // Do pingbacks
         while ($ping = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) {
             $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';");
             pingback($ping->post_content, $ping->ID);
         }
         // Do Enclosures
         while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
             $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';");
             do_enclose($enclosure->post_content, $enclosure->ID);
         }
         // Do Trackbacks
         $trackbacks = $wpdb->get_results("SELECT ID FROM {$wpdb->posts} WHERE CHAR_LENGTH(TRIM(to_ping)) > 7 AND post_status = 'publish'");
         if (is_array($trackbacks)) {
             foreach ($trackbacks as $trackback) {
                 do_trackbacks($trackback->ID);
             }
         }
     }
     $services = get_settings('ping_sites');
     $services = preg_replace("|(\\s)+|", '$1', $services);
     $services = trim($services);
     if ('' != $services) {
         set_time_limit(300);
         $services = explode("\n", $services);
         foreach ($services as $service) {
             $this->mbpoSendXmlrpc($service);
         }
     }
     unset($this->already_pinged);
     set_time_limit(60);
 }
开发者ID:jasmith152,项目名称:golf_atlantic,代码行数:51,代码来源:maxblogpress-ping-optimizer.php

示例14: mw_editPost

 function mw_editPost($args)
 {
     global $wpdb, $post_default_category;
     $this->escape($args);
     $post_ID = $args[0];
     $user_login = $args[1];
     $user_pass = $args[2];
     $content_struct = $args[3];
     $publish = $args[4];
     if (!$this->login_pass_ok($user_login, $user_pass)) {
         return $this->error;
     }
     $user_data = get_userdatabylogin($user_login);
     if (!user_can_edit_post($user_data->ID, $post_ID)) {
         return new IXR_Error(401, 'Sorry, you can not edit this post.');
     }
     $postdata = wp_get_single_post($post_ID, ARRAY_A);
     extract($postdata);
     $this->escape($postdata);
     $post_title = $content_struct['title'];
     $post_content = apply_filters('content_save_pre', $content_struct['description']);
     $catnames = $content_struct['categories'];
     $post_category = array();
     if (is_array($catnames)) {
         foreach ($catnames as $cat) {
             $post_category[] = get_cat_ID($cat);
         }
     }
     $post_excerpt = $content_struct['mt_excerpt'];
     $post_more = $content_struct['mt_text_more'];
     $post_status = $publish ? 'publish' : 'draft';
     if ($post_more) {
         $post_content = $post_content . "\n<!--more-->\n" . $post_more;
     }
     $to_ping = $content_struct['mt_tb_ping_urls'];
     $comment_status = empty($content_struct['mt_allow_comments']) ? get_settings('default_comment_status') : $content_struct['mt_allow_comments'];
     $ping_status = empty($content_struct['mt_allow_pings']) ? get_settings('default_ping_status') : $content_struct['mt_allow_pings'];
     // Do some timestamp voodoo
     $dateCreatedd = $content_struct['dateCreated'];
     if (!empty($dateCreatedd)) {
         $dateCreated = $dateCreatedd->getIso();
         $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
         $post_date_gmt = iso8601_to_datetime($dateCreated, GMT);
     } else {
         $post_date = $postdata['post_date'];
         $post_date_gmt = $postdata['post_date_gmt'];
     }
     // We've got all the data -- post it:
     $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping');
     $result = wp_update_post($newpost);
     if (!$result) {
         return new IXR_Error(500, 'Sorry, your entry could not be edited. Something wrong happened.');
     }
     logIO('O', "(MW) Edited ! ID: {$post_ID}");
     // FIXME: do we pingback always? pingback($content, $post_ID);
     // trackback_url_list($content_struct['mt_tb_ping_urls'], $post_ID);
     if ('publish' == $post_status) {
         if ($post_pingback) {
             pingback($content, $post_ID);
         }
         do_enclose($content, $post_ID);
         do_trackbacks($post_ID);
         do_action('publish_post', $post_ID);
     }
     do_action('edit_post', $post_ID);
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:steampress-svn,代码行数:67,代码来源:xmlrpc.php

示例15: mbpoPingServices

 /**
  * Copy of WP's "generic_ping".
  * Uses another function to send the actual XML-RPC messages.
  * @param string $post_title Title of the post
  * @param integer $post_type Future post or current post
  */
 function mbpoPingServices($post_title, $post_type)
 {
     global $wpdb;
     $this->already_pinged = array();
     $this->_post_type = $post_type;
     if (strpos($post_title, '~#') !== false) {
         $post_id_title = explode('~#', $post_title);
         $this->_post_title = $post_id_title[1];
         $this->_post_url = get_permalink($post_id_title[0]);
     } else {
         $this->_post_title = $post_title;
         $this->_post_url = '';
     }
     if ($this->mbpo_wp_version >= 2.1) {
         // Do pingbacks
         $ping = $this->__mpoGetPingbackPost();
         $this->__mpoDeletePingBack($ping->ID);
         pingback($ping->post_content, $ping->ID);
         // Do Enclosures
         $enclosure = $this->__mpoGetEnclosurePost();
         $this->__mpoDeleteEnclosure($enclosure->ID);
         do_enclose($enclosure->post_content, $enclosure->ID);
         // Do Trackbacks
         $trackbacks = $this->__mpoGetTrackbacks();
         if (is_array($trackbacks)) {
             foreach ($trackbacks as $trackback) {
                 do_trackbacks($trackback->ID);
             }
         }
     }
     $services = get_option('mbp_ping_sites');
     $services = preg_replace("|(\\s)+|", '$1', $services);
     $services = trim($services);
     if ('' != $services) {
         set_time_limit(300);
         $services = explode("\n", $services);
         foreach ($services as $service) {
             $this->mbpoSendXmlrpc($service);
         }
     }
     unset($this->already_pinged);
     set_time_limit(60);
 }
开发者ID:haizrul,项目名称:WP-Mizon,代码行数:49,代码来源:maxblogpress-ping-optimizer.php


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