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


PHP sanitize_trackback_urls函数代码示例

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


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

示例1: new_update_post_meta

function new_update_post_meta($post_id, $meta_key, $post_type, $data_type = 'text', $pre = 'new_')
{
    // Checks save status
    $is_autosave = wp_is_post_autosave($post_id);
    $is_revision = wp_is_post_revision($post_id);
    $is_valid_nonce = isset($_POST[$post_type . '_meta_box_nonce']) && wp_verify_nonce($_POST[$post_type . '_meta_box_nonce'], basename(__FILE__)) ? 'true' : 'false';
    // Exits script depending on save status
    if ($is_autosave || $is_revision || !$is_valid_nonce) {
        return;
    }
    // Checks for input and sanitizes/saves if needed
    if (isset($_POST[$pre . $meta_key])) {
        if (strcasecmp('text', $data_type) == 0) {
            $value = sanitize_text_field($_POST[$pre . $meta_key]);
        } else {
            $value = sanitize_trackback_urls($_POST[$pre . $meta_key]);
        }
        update_post_meta($post_id, $pre . $meta_key, $value);
    }
}
开发者ID:shizus,项目名称:farhat-guitar-child-theme,代码行数:20,代码来源:tomate-functions.php

示例2: get_to_ping

/**
 * Retrieve URLs that need to be pinged.
 *
 * @since 1.5.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int $post_id Post ID
 * @return array
 */
function get_to_ping($post_id)
{
    global $wpdb;
    $to_ping = $wpdb->get_var($wpdb->prepare("SELECT to_ping FROM {$wpdb->posts} WHERE ID = %d", $post_id));
    $to_ping = sanitize_trackback_urls($to_ping);
    $to_ping = preg_split('/\\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY);
    /**
     * Filter the list of URLs yet to ping for the given post.
     *
     * @since 2.0.0
     *
     * @param array $to_ping List of URLs yet to ping.
     */
    return apply_filters('get_to_ping', $to_ping);
}
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:25,代码来源:post.php

示例3: get_to_ping

/**
 * Retrieve URLs that need to be pinged.
 *
 * @since 1.5.0
 * @uses $wpdb
 *
 * @param int $post_id Post ID
 * @return array
 */
function get_to_ping($post_id)
{
    global $wpdb;
    $to_ping = $wpdb->get_var($wpdb->prepare("SELECT to_ping FROM {$wpdb->posts} WHERE ID = %d", $post_id));
    $to_ping = sanitize_trackback_urls($to_ping);
    $to_ping = preg_split('/\\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY);
    $to_ping = apply_filters('get_to_ping', $to_ping);
    return $to_ping;
}
开发者ID:par-orillonsoft,项目名称:Wishmagnet,代码行数:18,代码来源:post.php

示例4: pmxi_insert_post


//.........这里部分代码省略.........
        if ($wp_error) {
            return new WP_Error('invalid_date', __('Whoops, the provided date is invalid.'));
        } else {
            return 0;
        }
    }
    if (empty($post_date_gmt) || '0000-00-00 00:00:00' == $post_date_gmt) {
        if (!in_array($post_status, array('draft', 'pending', 'auto-draft'))) {
            $post_date_gmt = get_gmt_from_date($post_date);
        } else {
            $post_date_gmt = '0000-00-00 00:00:00';
        }
    }
    if ($update || '0000-00-00 00:00:00' == $post_date) {
        $post_modified = current_time('mysql');
        $post_modified_gmt = current_time('mysql', 1);
    } else {
        $post_modified = $post_date;
        $post_modified_gmt = $post_date_gmt;
    }
    if ('publish' == $post_status) {
        $now = gmdate('Y-m-d H:i:59');
        if (mysql2date('U', $post_date_gmt, false) > mysql2date('U', $now, false)) {
            $post_status = 'future';
        }
    } elseif ('future' == $post_status) {
        $now = gmdate('Y-m-d H:i:59');
        if (mysql2date('U', $post_date_gmt, false) <= mysql2date('U', $now, false)) {
            $post_status = 'publish';
        }
    }
    if (empty($comment_status)) {
        if ($update) {
            $comment_status = 'closed';
        } else {
            $comment_status = get_option('default_comment_status');
        }
    }
    if (empty($ping_status)) {
        $ping_status = get_option('default_ping_status');
    }
    if (isset($to_ping)) {
        $to_ping = sanitize_trackback_urls($to_ping);
    } else {
        $to_ping = '';
    }
    if (!isset($pinged)) {
        $pinged = '';
    }
    if (isset($post_parent)) {
        $post_parent = (int) $post_parent;
    } else {
        $post_parent = 0;
    }
    // Check the post_parent to see if it will cause a hierarchy loop
    $post_parent = apply_filters('wp_insert_post_parent', $post_parent, $post_ID, compact(array_keys($postarr)), $postarr);
    if (isset($menu_order)) {
        $menu_order = (int) $menu_order;
    } else {
        $menu_order = 0;
    }
    $post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent);
    // expected_slashed (everything!)
    $data = compact(array('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'guid'));
    $data = wp_unslash($data);
    $where = array('ID' => $post_ID);
    if ($update) {
        if (false === $wpdb->update($wpdb->posts, $data, $where)) {
            if ($wp_error) {
                return new WP_Error('db_update_error', __('Could not update post in the database'), $wpdb->last_error);
            } else {
                return 0;
            }
        }
    } else {
        if (isset($post_mime_type)) {
            $data['post_mime_type'] = wp_unslash($post_mime_type);
        }
        // This isn't in the update
        if (false === $wpdb->insert($wpdb->posts, $data)) {
            if ($wp_error) {
                return new WP_Error('db_insert_error', __('Could not insert post into the database'), $wpdb->last_error);
            } else {
                return 0;
            }
        }
        $post_ID = (int) $wpdb->insert_id;
        // use the newly generated $post_ID
        $where = array('ID' => $post_ID);
    }
    if (isset($tags_input) && is_object_in_taxonomy($post_type, 'post_tag')) {
        wp_set_post_tags($post_ID, $tags_input);
    }
    $current_guid = get_post_field('guid', $post_ID);
    // Set GUID
    if (!$update && '' == $current_guid) {
        $wpdb->update($wpdb->posts, array('guid' => get_permalink($post_ID)), $where);
    }
    return $post_ID;
}
开发者ID:thabofletcher,项目名称:tc-site,代码行数:101,代码来源:pmxi_insert_post.php

示例5: etwp_insert_post


//.........这里部分代码省略.........
    if ($update || '0000-00-00 00:00:00' == $post_date) {
        $post_modified = current_time('mysql');
        $post_modified_gmt = current_time('mysql', 1);
    } else {
        $post_modified = $post_date;
        $post_modified_gmt = $post_date_gmt;
    }
    if ('attachment' !== $post_type) {
        if ('publish' == $post_status) {
            $now = gmdate('Y-m-d H:i:59');
            if (mysql2date('U', $post_date_gmt, false) > mysql2date('U', $now, false)) {
                $post_status = 'future';
            }
        } elseif ('future' == $post_status) {
            $now = gmdate('Y-m-d H:i:59');
            if (mysql2date('U', $post_date_gmt, false) <= mysql2date('U', $now, false)) {
                $post_status = 'publish';
            }
        }
    }
    if (empty($postarr['comment_status'])) {
        if ($update) {
            $comment_status = 'closed';
        } else {
            $comment_status = get_option('default_comment_status');
        }
    } else {
        $comment_status = $postarr['comment_status'];
    }
    // These variables are needed by compact() later.
    $post_content_filtered = $postarr['post_content_filtered'];
    $post_author = empty($postarr['post_author']) ? $user_id : $postarr['post_author'];
    $ping_status = empty($postarr['ping_status']) ? get_option('default_ping_status') : $postarr['ping_status'];
    $to_ping = isset($postarr['to_ping']) ? sanitize_trackback_urls($postarr['to_ping']) : '';
    $pinged = isset($postarr['pinged']) ? $postarr['pinged'] : '';
    $import_id = isset($postarr['import_id']) ? $postarr['import_id'] : 0;
    /*
     * The 'wp_insert_post_parent' filter expects all variables to be present.
     * Previously, these variables would have already been extracted
     */
    if (isset($postarr['menu_order'])) {
        $menu_order = (int) $postarr['menu_order'];
    } else {
        $menu_order = 0;
    }
    $post_password = isset($postarr['post_password']) ? $postarr['post_password'] : '';
    if ('private' == $post_status) {
        $post_password = '';
    }
    if (isset($postarr['post_parent'])) {
        $post_parent = (int) $postarr['post_parent'];
    } else {
        $post_parent = 0;
    }
    /**
     * Filter the post parent -- used to check for and prevent hierarchy loops.
     *
     * @since 3.1.0
     *
     * @param int   $post_parent Post parent ID.
     * @param int   $post_ID     Post ID.
     * @param array $new_postarr Array of parsed post data.
     * @param array $postarr     Array of sanitized, but otherwise unmodified post data.
     */
    $post_parent = apply_filters('wp_insert_post_parent', $post_parent, $post_ID, compact(array_keys($postarr)), $postarr);
    $post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent);
开发者ID:richhu,项目名称:stuqtest,代码行数:67,代码来源:etpost.php

示例6: test_sanitize_trackback_urls_with_multiple_urls

 /**
  * @ticket 21624
  * @dataProvider breaks
  */
 function test_sanitize_trackback_urls_with_multiple_urls($break)
 {
     $this->assertEquals("http://example.com\nhttp://example.org", sanitize_trackback_urls("http://example.com{$break}http://example.org"));
 }
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:8,代码来源:SanitizeTrackbackUrls.php

示例7: get_to_ping

/**
 * Retrieve URLs that need to be pinged.
 *
 * @since 1.5.0
 * @since 4.7.0 $post_id can be a WP_Post object.
 *
 * @param int|WP_Post $post_id Post Object or ID
 * @return array
 */
function get_to_ping($post_id)
{
    $post = get_post($post_id);
    if (!$post) {
        return false;
    }
    $to_ping = sanitize_trackback_urls($post->to_ping);
    $to_ping = preg_split('/\\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY);
    /**
     * Filters the list of URLs yet to ping for the given post.
     *
     * @since 2.0.0
     *
     * @param array $to_ping List of URLs yet to ping.
     */
    return apply_filters('get_to_ping', $to_ping);
}
开发者ID:kucrut,项目名称:wordpress,代码行数:26,代码来源:post.php

示例8: get_default_comment_status

}
// Comment status.
if (empty($postarr['comment_status'])) {
    if ($update) {
        $comment_status = 'closed';
    } else {
        $comment_status = get_default_comment_status($post_type);
    }
} else {
    $comment_status = $postarr['comment_status'];
}
// These variables are needed by compact() later.
$post_content_filtered = $postarr['post_content_filtered'];
$post_author = isset($postarr['post_author']) ? $postarr['post_author'] : $user_id;
$ping_status = empty($postarr['ping_status']) ? get_default_comment_status($post_type, 'pingback') : $postarr['ping_status'];
$to_ping = isset($postarr['to_ping']) ? sanitize_trackback_urls($postarr['to_ping']) : '';
$pinged = isset($postarr['pinged']) ? $postarr['pinged'] : '';
$import_id = isset($postarr['import_id']) ? $postarr['import_id'] : 0;
/*
 * The 'wp_insert_post_parent' filter expects all variables to be present.
 * Previously, these variables would have already been extracted
 */
if (isset($postarr['menu_order'])) {
    $menu_order = (int) $postarr['menu_order'];
} else {
    $menu_order = 0;
}
$post_password = isset($postarr['post_password']) ? $postarr['post_password'] : '';
if ('private' == $post_status) {
    $post_password = '';
}
开发者ID:supermt,项目名称:WordPressAPI,代码行数:31,代码来源:postin.php


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