本文整理汇总了PHP中make_site_theme函数的典型用法代码示例。如果您正苦于以下问题:PHP make_site_theme函数的具体用法?PHP make_site_theme怎么用?PHP make_site_theme使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_site_theme函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade_130
/**
* Execute changes made in WordPress 1.5.
*
* @since 1.5.0
*/
function upgrade_130()
{
global $wpdb;
// Remove extraneous backslashes.
$posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM {$wpdb->posts}");
if ($posts) {
foreach ($posts as $post) {
$post_content = addslashes(deslash($post->post_content));
$post_title = addslashes(deslash($post->post_title));
$post_excerpt = addslashes(deslash($post->post_excerpt));
if (empty($post->guid)) {
$guid = get_permalink($post->ID);
} else {
$guid = $post->guid;
}
$wpdb->update($wpdb->posts, compact('post_title', 'post_content', 'post_excerpt', 'guid'), array('ID' => $post->ID));
}
}
// Remove extraneous backslashes.
$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM {$wpdb->comments}");
if ($comments) {
foreach ($comments as $comment) {
$comment_content = deslash($comment->comment_content);
$comment_author = deslash($comment->comment_author);
$wpdb->update($wpdb->comments, compact('comment_content', 'comment_author'), array('comment_ID' => $comment->comment_ID));
}
}
// Remove extraneous backslashes.
$links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM {$wpdb->links}");
if ($links) {
foreach ($links as $link) {
$link_name = deslash($link->link_name);
$link_description = deslash($link->link_description);
$wpdb->update($wpdb->links, compact('link_name', 'link_description'), array('link_id' => $link->link_id));
}
}
$active_plugins = __get_option('active_plugins');
// If plugins are not stored in an array, they're stored in the old
// newline separated format. Convert to new format.
if (!is_array($active_plugins)) {
$active_plugins = explode("\n", trim($active_plugins));
update_option('active_plugins', $active_plugins);
}
// Obsolete tables
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optionvalues');
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiontypes');
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroups');
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroup_options');
// Update comments table to use comment_type
$wpdb->query("UPDATE {$wpdb->comments} SET comment_type='trackback', comment_content = REPLACE(comment_content, '<trackback />', '') WHERE comment_content LIKE '<trackback />%'");
$wpdb->query("UPDATE {$wpdb->comments} SET comment_type='pingback', comment_content = REPLACE(comment_content, '<pingback />', '') WHERE comment_content LIKE '<pingback />%'");
// Some versions have multiple duplicate option_name rows with the same values
$options = $wpdb->get_results("SELECT option_name, COUNT(option_name) AS dupes FROM `{$wpdb->options}` GROUP BY option_name");
foreach ($options as $option) {
if (1 != $option->dupes) {
// Could this be done in the query?
$limit = $option->dupes - 1;
$dupe_ids = $wpdb->get_col($wpdb->prepare("SELECT option_id FROM {$wpdb->options} WHERE option_name = %s LIMIT %d", $option->option_name, $limit));
if ($dupe_ids) {
$dupe_ids = join($dupe_ids, ',');
$wpdb->query("DELETE FROM {$wpdb->options} WHERE option_id IN ({$dupe_ids})");
}
}
}
make_site_theme();
}
示例2: upgrade_130
function upgrade_130() {
global $wpdb;
// Remove extraneous backslashes.
$posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts");
if ($posts) {
foreach($posts as $post) {
$post_content = addslashes(deslash($post->post_content));
$post_title = addslashes(deslash($post->post_title));
$post_excerpt = addslashes(deslash($post->post_excerpt));
if ( empty($post->guid) )
$guid = get_permalink($post->ID);
else
$guid = $post->guid;
$wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt', guid = '$guid' WHERE ID = '$post->ID'");
}
}
// Remove extraneous backslashes.
$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments");
if ($comments) {
foreach($comments as $comment) {
$comment_content = addslashes(deslash($comment->comment_content));
$comment_author = addslashes(deslash($comment->comment_author));
$wpdb->query("UPDATE $wpdb->comments SET comment_content = '$comment_content', comment_author = '$comment_author' WHERE comment_ID = '$comment->comment_ID'");
}
}
// Remove extraneous backslashes.
$links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links");
if ($links) {
foreach($links as $link) {
$link_name = addslashes(deslash($link->link_name));
$link_description = addslashes(deslash($link->link_description));
$wpdb->query("UPDATE $wpdb->links SET link_name = '$link_name', link_description = '$link_description' WHERE link_id = '$link->link_id'");
}
}
// The "paged" option for what_to_show is no more.
if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') {
$wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'");
}
$active_plugins = __get_option('active_plugins');
// If plugins are not stored in an array, they're stored in the old
// newline separated format. Convert to new format.
if ( !is_array( $active_plugins ) ) {
$active_plugins = explode("\n", trim($active_plugins));
update_option('active_plugins', $active_plugins);
}
// Obsolete tables
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optionvalues');
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiontypes');
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroups');
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroup_options');
// Update comments table to use comment_type
$wpdb->query("UPDATE $wpdb->comments SET comment_type='trackback', comment_content = REPLACE(comment_content, '<trackback />', '') WHERE comment_content LIKE '<trackback />%'");
$wpdb->query("UPDATE $wpdb->comments SET comment_type='pingback', comment_content = REPLACE(comment_content, '<pingback />', '') WHERE comment_content LIKE '<pingback />%'");
// Some versions have multiple duplicate option_name rows with the same values
$options = $wpdb->get_results("SELECT option_name, COUNT(option_name) AS dupes FROM `$wpdb->options` GROUP BY option_name");
foreach ( $options as $option ) {
if ( 1 != $option->dupes ) { // Could this be done in the query?
$limit = $option->dupes - 1;
$dupe_ids = $wpdb->get_col("SELECT option_id FROM $wpdb->options WHERE option_name = '$option->option_name' LIMIT $limit");
$dupe_ids = join($dupe_ids, ',');
$wpdb->query("DELETE FROM $wpdb->options WHERE option_id IN ($dupe_ids)");
}
}
make_site_theme();
}