Compare commits
104 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d87837dc6 | ||
|
|
99d97c76b0 | ||
|
|
67bf4cd7e1 | ||
|
|
7b03bfc16f | ||
|
|
0a541104e3 | ||
|
|
029d279155 | ||
|
|
1d5a7892f2 | ||
|
|
8d241beedb | ||
|
|
774f81b780 | ||
|
|
86b3a35dd7 | ||
|
|
fe080e84db | ||
|
|
8ae6705fd2 | ||
|
|
f5fca82e63 | ||
|
|
303264210a | ||
|
|
b89aca0478 | ||
|
|
1ab98bf52d | ||
|
|
a2797f26d2 | ||
|
|
63b4b6a006 | ||
|
|
85e61d7921 | ||
|
|
3e68b0c7d1 | ||
|
|
c6ab9f325b | ||
|
|
ec48ddfb4e | ||
|
|
44b16a7d23 | ||
|
|
0a1cbe9d09 | ||
|
|
9669f73c62 | ||
|
|
e62f79cfd7 | ||
|
|
0a294916d9 | ||
|
|
8d4f4a9a05 | ||
|
|
e6de513be6 | ||
|
|
dbb5bf710f | ||
|
|
30b010ce8a | ||
|
|
c094d37899 | ||
|
|
784f429843 | ||
|
|
2d2f78d640 | ||
|
|
bf3ac93baf | ||
|
|
45af63e137 | ||
|
|
b01225018a | ||
|
|
fba955f893 | ||
|
|
4afbabc9ca | ||
|
|
2d1b0ab4c6 | ||
|
|
b40b064e8a | ||
|
|
afe460ad19 | ||
|
|
eab4230e88 | ||
|
|
7fab797d2c | ||
|
|
6319a5f7ea | ||
|
|
361dc33680 | ||
|
|
9aed168b89 | ||
|
|
7b14133f66 | ||
|
|
5e739be4f6 | ||
|
|
5543fabff3 | ||
|
|
b3887842de | ||
|
|
f5195ba547 | ||
|
|
3d1fc411a1 | ||
|
|
d38dbe39a7 | ||
|
|
fa21da538e | ||
|
|
8523aeed0b | ||
|
|
9bf06fa83b | ||
|
|
c7fa2a8205 | ||
|
|
6cc57297e7 | ||
|
|
44221ce713 | ||
|
|
fdcacfe365 | ||
|
|
336af0d5f0 | ||
|
|
6ffe93ee09 | ||
|
|
6bd412f2fc | ||
|
|
cdfc66db4d | ||
|
|
297e946ba6 | ||
|
|
79809190ac | ||
|
|
82dac61d61 | ||
|
|
24a1b34acc | ||
|
|
d56d0b0e2c | ||
|
|
1b2e6cfa1d | ||
|
|
1f59bf6469 | ||
|
|
b9e407b164 | ||
|
|
14f73e7ec1 | ||
|
|
42ff9b3d89 | ||
|
|
54da7d4786 | ||
|
|
da5b65f8ee | ||
|
|
2e7a937153 | ||
|
|
630d4c7c8e | ||
|
|
fa946535d7 | ||
|
|
8a6a7d323e | ||
|
|
1cef8c9e5a | ||
|
|
2b1b2ebaf2 | ||
|
|
a021bbe537 | ||
|
|
a8bf70c382 | ||
|
|
f702a97f8c | ||
|
|
8cb1387688 | ||
|
|
0697563967 | ||
|
|
15a2afed1e | ||
|
|
18fcca2916 | ||
|
|
cd63ed5102 | ||
|
|
82c855cce0 | ||
|
|
23f7dc02fe | ||
|
|
2e7a66f15f | ||
|
|
8490921af3 | ||
|
|
4935ef466c | ||
|
|
964a43089d | ||
|
|
f51aa3949c | ||
|
|
03874af5c9 | ||
|
|
c3a4c7463c | ||
|
|
888d60a151 | ||
|
|
5236e251a3 | ||
|
|
3d8bbda3e4 | ||
|
|
a05b1eca46 |
@@ -1,6 +1,6 @@
|
||||
WordPress - Web publishing software
|
||||
|
||||
Copyright 2013 by the contributors
|
||||
Copyright 2017 by the contributors
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<body>
|
||||
<h1 id="logo">
|
||||
<a href="http://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" /></a>
|
||||
<br /> Version 3.7.5
|
||||
<br /> Version 3.7.22
|
||||
</h1>
|
||||
<p style="text-align: center">Semantic Personal Publishing Platform</p>
|
||||
|
||||
|
||||
@@ -36,14 +36,82 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
|
||||
</h2>
|
||||
|
||||
<div class="changelog point-releases">
|
||||
<h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 5 ); ?></h3>
|
||||
<h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 22 ); ?></h3>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 7 ), '3.7.22' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.22' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 5 ), '3.7.21' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.21' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed %2$s bug.',
|
||||
'<strong>Version %1$s</strong> addressed %2$s bugs.', 1 ), '3.7.20', number_format_i18n( 1 ) ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.20' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 5 ), '3.7.19' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.19' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 3 ), '3.7.18' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.18' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 8 ), '3.7.17' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.17' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 2 ), '3.7.16' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.16' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 9 ), '3.7.15' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.15' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 6 ), '3.7.14' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.14' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 2 ), '3.7.13' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.13' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 1 ), '3.7.12' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.12' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.', 2 ), '3.7.11', number_format_i18n( 2 ) ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.11' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.', 2 ), '3.7.10', number_format_i18n( 2 ) ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.10' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 2 ), '3.7.9' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.9' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.', 3 ), '3.7.8', number_format_i18n( 3 ) ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.8' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed %2$s bug.',
|
||||
'<strong>Version %1$s</strong> addressed %2$s bugs.', 1 ), '3.7.7', number_format_i18n( 1 ) ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.7' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 8 ), '3.7.6' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.6' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 8 ), '3.7.5', number_format_i18n( 8 ) ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://codex.wordpress.org/Version_3.7.5' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.5' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 5 ), '3.7.4', number_format_i18n( 5 ) ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://codex.wordpress.org/Version_3.7.4' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.4' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed %2$s bug.',
|
||||
'<strong>Version %1$s</strong> addressed %2$s bugs.', 2 ), '3.7.3', number_format_i18n( 2 ) ); ?>
|
||||
@@ -51,11 +119,11 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.', 9 ), '3.7.2', number_format_i18n( 9 ) ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://codex.wordpress.org/Version_3.7.2' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.2' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed %2$s bug.',
|
||||
'<strong>Version %1$s</strong> addressed %2$s bugs.', 11 ), '3.7.1', number_format_i18n( 11 ) ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://codex.wordpress.org/Version_3.7.1' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_3.7.1' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -15,9 +15,10 @@ if ( ! current_user_can( 'edit_theme_options' ) )
|
||||
|
||||
wp_reset_vars( array( 'url', 'return' ) );
|
||||
$url = urldecode( $url );
|
||||
$url = esc_url_raw( $url );
|
||||
$url = wp_validate_redirect( $url, home_url( '/' ) );
|
||||
if ( $return )
|
||||
$return = wp_validate_redirect( urldecode( $return ) );
|
||||
$return = wp_validate_redirect( esc_url_raw( urldecode( $return ) ) );
|
||||
if ( ! $return )
|
||||
$return = $url;
|
||||
|
||||
|
||||
@@ -1377,11 +1377,13 @@ function wp_ajax_inline_save() {
|
||||
if ( isset($data['post_parent']) )
|
||||
$data['parent_id'] = $data['post_parent'];
|
||||
|
||||
// status
|
||||
if ( isset($data['keep_private']) && 'private' == $data['keep_private'] )
|
||||
// Status.
|
||||
if ( isset( $data['keep_private'] ) && 'private' == $data['keep_private'] ) {
|
||||
$data['visibility'] = 'private';
|
||||
$data['post_status'] = 'private';
|
||||
else
|
||||
} else {
|
||||
$data['post_status'] = $data['_status'];
|
||||
}
|
||||
|
||||
if ( empty($data['comment_status']) )
|
||||
$data['comment_status'] = 'closed';
|
||||
@@ -2224,7 +2226,7 @@ function wp_ajax_get_revision_diffs() {
|
||||
if ( ! $post = get_post( (int) $_REQUEST['post_id'] ) )
|
||||
wp_send_json_error();
|
||||
|
||||
if ( ! current_user_can( 'read_post', $post->ID ) )
|
||||
if ( ! current_user_can( 'edit_post', $post->ID ) )
|
||||
wp_send_json_error();
|
||||
|
||||
// Really just pre-loading the cache here.
|
||||
|
||||
@@ -493,9 +493,9 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
|
||||
if ( current_user_can( 'edit_post', $post->ID ) ) {
|
||||
$post_link = "<a href='" . get_edit_post_link( $post->ID ) . "'>";
|
||||
$post_link .= get_the_title( $post->ID ) . '</a>';
|
||||
$post_link .= esc_html( get_the_title( $post->ID ) ) . '</a>';
|
||||
} else {
|
||||
$post_link = get_the_title( $post->ID );
|
||||
$post_link = esc_html( get_the_title( $post->ID ) );
|
||||
}
|
||||
|
||||
echo '<div class="response-links"><span class="post-com-count-wrapper">';
|
||||
|
||||
@@ -201,7 +201,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
||||
break;
|
||||
|
||||
case 'email':
|
||||
echo "<td $attributes><a href='mailto:$user->user_email'>$user->user_email</a></td>";
|
||||
echo "<td $attributes><a href='" . esc_url( "mailto:$user->user_email" ) . "'>$user->user_email</a></td>";
|
||||
break;
|
||||
|
||||
case 'registered':
|
||||
|
||||
@@ -339,26 +339,26 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||
if ( $screen->in_admin( 'network' ) ) {
|
||||
if ( $is_active ) {
|
||||
if ( current_user_can( 'manage_network_plugins' ) )
|
||||
$actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Network Deactivate') . '</a>';
|
||||
$actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Network Deactivate') . '</a>';
|
||||
} else {
|
||||
if ( current_user_can( 'manage_network_plugins' ) )
|
||||
$actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>';
|
||||
$actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>';
|
||||
if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) )
|
||||
$actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
|
||||
$actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&checked[]=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
|
||||
}
|
||||
} else {
|
||||
if ( $is_active ) {
|
||||
$actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
|
||||
$actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
|
||||
} else {
|
||||
$actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
|
||||
$actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
|
||||
|
||||
if ( ! is_multisite() && current_user_can('delete_plugins') )
|
||||
$actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
|
||||
$actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&checked[]=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
|
||||
} // end if $is_active
|
||||
} // end if $screen->in_admin( 'network' )
|
||||
|
||||
if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
|
||||
$actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . esc_attr__('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
|
||||
$actions['edit'] = '<a href="plugin-editor.php?file=' . urlencode( $plugin_file ) . '" title="' . esc_attr__('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
|
||||
} // end if $context
|
||||
|
||||
$prefix = $screen->in_admin( 'network' ) ? 'network_admin_' : '';
|
||||
|
||||
@@ -580,8 +580,9 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
|
||||
}
|
||||
|
||||
if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) )
|
||||
the_excerpt();
|
||||
if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) ) {
|
||||
echo esc_html( get_the_excerpt() );
|
||||
}
|
||||
|
||||
$actions = array();
|
||||
if ( $can_edit_post && 'trash' != $post->post_status ) {
|
||||
|
||||
@@ -1602,8 +1602,12 @@ class File_Upload_Upgrader {
|
||||
if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
|
||||
wp_die( $uploads['error'] );
|
||||
|
||||
$this->filename = $_GET[$urlholder];
|
||||
$this->filename = sanitize_file_name( $_GET[ $urlholder ] );
|
||||
$this->package = $uploads['basedir'] . '/' . $this->filename;
|
||||
|
||||
if ( 0 !== strpos( realpath( $this->package ), realpath( $uploads['basedir'] ) ) ) {
|
||||
wp_die( __( 'Please select a file' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ class WP_Users_List_Table extends WP_List_Table {
|
||||
$r .= "<td $attributes>$user_object->first_name $user_object->last_name</td>";
|
||||
break;
|
||||
case 'email':
|
||||
$r .= "<td $attributes><a href='mailto:$email' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a></td>";
|
||||
$r .= "<td $attributes><a href='" . esc_url( "mailto:$email" ) . "' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a></td>";
|
||||
break;
|
||||
case 'role':
|
||||
$r .= "<td $attributes>$role_name</td>";
|
||||
|
||||
@@ -488,6 +488,10 @@ function wp_dashboard_quick_press() {
|
||||
$_REQUEST = array(); // hack for get_default_post_to_edit()
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'edit_posts' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check if a new auto-draft (= no new post_ID) is needed or if the old can be used */
|
||||
$last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID
|
||||
if ( $last_post_id ) {
|
||||
@@ -658,7 +662,7 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
|
||||
$GLOBALS['comment'] =& $comment;
|
||||
|
||||
$comment_post_url = get_edit_post_link( $comment->comment_post_ID );
|
||||
$comment_post_title = strip_tags(get_the_title( $comment->comment_post_ID ));
|
||||
$comment_post_title = _draft_or_post_title( $comment->comment_post_ID );
|
||||
$comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
|
||||
$comment_link = '<a class="comment-link" href="' . esc_url(get_comment_link()) . '">#</a>';
|
||||
|
||||
|
||||
@@ -609,6 +609,10 @@ function _unzip_file_ziparchive($file, $to, $needed_dirs = array() ) {
|
||||
if ( '__MACOSX/' === substr($info['name'], 0, 9) ) // Skip the OS X-created __MACOSX directory
|
||||
continue;
|
||||
|
||||
if ( 0 !== validate_file( $info['name'] ) ) {
|
||||
return new WP_Error( 'invalid_file_ziparchive', __( 'Could not extract file from archive.' ), $info['name'] );
|
||||
}
|
||||
|
||||
$uncompressed_size += $info['size'];
|
||||
|
||||
if ( '/' == substr($info['name'], -1) ) // directory
|
||||
@@ -762,6 +766,10 @@ function _unzip_file_pclzip($file, $to, $needed_dirs = array()) {
|
||||
if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) // Don't extract the OS X-created __MACOSX directory files
|
||||
continue;
|
||||
|
||||
if ( 0 !== validate_file( $file['filename'] ) ) {
|
||||
return new WP_Error( 'invalid_file_pclzip', __( 'Could not extract file from archive.' ), $file['filename'] );
|
||||
}
|
||||
|
||||
if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE) )
|
||||
return new WP_Error( 'copy_failed_pclzip', __( 'Could not copy file.' ), $file['filename'] );
|
||||
}
|
||||
@@ -950,14 +958,28 @@ function request_filesystem_credentials($form_post, $type = '', $error = false,
|
||||
|
||||
$credentials = get_option('ftp_credentials', array( 'hostname' => '', 'username' => ''));
|
||||
|
||||
$submitted_form = wp_unslash( $_POST );
|
||||
|
||||
// Verify nonce, or unset submitted form field values on failure
|
||||
if ( ! isset( $_POST['_fs_nonce'] ) || ! wp_verify_nonce( $_POST['_fs_nonce'], 'filesystem-credentials' ) ) {
|
||||
unset(
|
||||
$submitted_form['hostname'],
|
||||
$submitted_form['username'],
|
||||
$submitted_form['password'],
|
||||
$submitted_form['public_key'],
|
||||
$submitted_form['private_key'],
|
||||
$submitted_form['connection_type']
|
||||
);
|
||||
}
|
||||
|
||||
// If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option)
|
||||
$credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? wp_unslash( $_POST['hostname'] ) : $credentials['hostname']);
|
||||
$credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? wp_unslash( $_POST['username'] ) : $credentials['username']);
|
||||
$credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? wp_unslash( $_POST['password'] ) : '');
|
||||
$credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($submitted_form['hostname']) ? $submitted_form['hostname'] : $credentials['hostname']);
|
||||
$credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($submitted_form['username']) ? $submitted_form['username'] : $credentials['username']);
|
||||
$credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($submitted_form['password']) ? $submitted_form['password'] : '');
|
||||
|
||||
// Check to see if we are setting the public/private keys for ssh
|
||||
$credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? wp_unslash( $_POST['public_key'] ) : '');
|
||||
$credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? wp_unslash( $_POST['private_key'] ) : '');
|
||||
$credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($submitted_form['public_key']) ? $submitted_form['public_key'] : '');
|
||||
$credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($submitted_form['private_key']) ? $submitted_form['private_key'] : '');
|
||||
|
||||
//sanitize the hostname, Some people might pass in odd-data:
|
||||
$credentials['hostname'] = preg_replace('|\w+://|', '', $credentials['hostname']); //Strip any schemes off
|
||||
@@ -974,8 +996,8 @@ function request_filesystem_credentials($form_post, $type = '', $error = false,
|
||||
$credentials['connection_type'] = 'ssh';
|
||||
else if ( (defined('FTP_SSL') && FTP_SSL) && 'ftpext' == $type ) //Only the FTP Extension understands SSL
|
||||
$credentials['connection_type'] = 'ftps';
|
||||
else if ( !empty($_POST['connection_type']) )
|
||||
$credentials['connection_type'] = wp_unslash( $_POST['connection_type'] );
|
||||
else if ( !empty($submitted_form['connection_type']) )
|
||||
$credentials['connection_type'] = $submitted_form['connection_type'];
|
||||
else if ( !isset($credentials['connection_type']) ) //All else fails (And it's not defaulted to something else saved), Default to FTP
|
||||
$credentials['connection_type'] = 'ftp';
|
||||
|
||||
@@ -1099,11 +1121,14 @@ jQuery(function($){
|
||||
|
||||
<?php
|
||||
foreach ( (array) $extra_fields as $field ) {
|
||||
if ( isset( $_POST[ $field ] ) )
|
||||
echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( wp_unslash( $_POST[ $field ] ) ) . '" />';
|
||||
if ( isset( $submitted_form[ $field ] ) )
|
||||
echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( $submitted_form[ $field ] ) . '" />';
|
||||
}
|
||||
submit_button( __( 'Proceed' ), 'button', 'upgrade' );
|
||||
?>
|
||||
<p class="request-filesystem-credentials-action-buttons">
|
||||
<?php wp_nonce_field( 'filesystem-credentials', '_fs_nonce', false, true ); ?>
|
||||
<?php submit_button( __( 'Proceed' ), 'button', 'upgrade', false ); ?>
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
@@ -221,7 +221,7 @@ function media_handle_upload($file_id, $post_id, $post_data = array(), $override
|
||||
$url = $file['url'];
|
||||
$type = $file['type'];
|
||||
$file = $file['file'];
|
||||
$title = $name;
|
||||
$title = sanitize_text_field( $name );
|
||||
$content = '';
|
||||
|
||||
if ( preg_match( '#^audio#', $type ) ) {
|
||||
@@ -1558,7 +1558,7 @@ $post_params = array(
|
||||
$post_params = apply_filters( 'upload_post_params', $post_params ); // hook change! old name: 'swfupload_post_params'
|
||||
|
||||
$plupload_init = array(
|
||||
'runtimes' => 'html5,silverlight,flash,html4',
|
||||
'runtimes' => 'html5,silverlight,html4',
|
||||
'browse_button' => 'plupload-browse-button',
|
||||
'container' => 'plupload-upload-ui',
|
||||
'drop_element' => 'drag-drop-area',
|
||||
@@ -2581,7 +2581,7 @@ function wp_add_id3_tag_data( &$metadata, $data ) {
|
||||
if ( ! empty( $data[$version]['comments'] ) ) {
|
||||
foreach ( $data[$version]['comments'] as $key => $list ) {
|
||||
if ( ! empty( $list ) ) {
|
||||
$metadata[$key] = reset( $list );
|
||||
$metadata[$key] = wp_kses_post( reset( $list ) );
|
||||
// fix bug in byte stream analysis
|
||||
if ( 'terms_of_use' === $key && 0 === strpos( $metadata[$key], 'yright notice.' ) )
|
||||
$metadata[$key] = 'Cop' . $metadata[$key];
|
||||
|
||||
@@ -154,6 +154,13 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
|
||||
$post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date'] );
|
||||
}
|
||||
|
||||
if ( isset( $post_data['post_category'] ) ) {
|
||||
$category_object = get_taxonomy( 'category' );
|
||||
if ( ! current_user_can( $category_object->cap->assign_terms ) ) {
|
||||
unset( $post_data['post_category'] );
|
||||
}
|
||||
}
|
||||
|
||||
return $post_data;
|
||||
}
|
||||
|
||||
@@ -166,6 +173,7 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
|
||||
* @return int Post ID.
|
||||
*/
|
||||
function edit_post( $post_data = null ) {
|
||||
global $wpdb;
|
||||
|
||||
if ( empty($post_data) )
|
||||
$post_data = &$_POST;
|
||||
@@ -295,7 +303,19 @@ function edit_post( $post_data = null ) {
|
||||
|
||||
update_post_meta( $post_ID, '_edit_last', get_current_user_id() );
|
||||
|
||||
wp_update_post( $post_data );
|
||||
$success = wp_update_post( $post_data );
|
||||
// If the save failed, see if we can sanity check the main fields and try again
|
||||
if ( ! $success && is_callable( array( $wpdb, 'strip_invalid_text_for_column' ) ) ) {
|
||||
$fields = array( 'post_title', 'post_content', 'post_excerpt' );
|
||||
|
||||
foreach( $fields as $field ) {
|
||||
if ( isset( $post_data[ $field ] ) ) {
|
||||
$post_data[ $field ] = $wpdb->strip_invalid_text_for_column( $wpdb->posts, $field, $post_data[ $field ] );
|
||||
}
|
||||
}
|
||||
|
||||
wp_update_post( $post_data );
|
||||
}
|
||||
|
||||
// Now that we have an ID we can fix any attachment anchor hrefs
|
||||
_fix_attachment_links( $post_ID );
|
||||
@@ -1134,11 +1154,11 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
|
||||
}
|
||||
|
||||
if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) {
|
||||
$return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
|
||||
$return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html( $permalink ) . "</span>\n";
|
||||
if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) )
|
||||
$return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
|
||||
if ( isset( $view_post ) )
|
||||
$return .= "<span id='view-post-btn'><a href='$permalink' class='button button-small'>$view_post</a></span>\n";
|
||||
$return .= "<span id='view-post-btn'><a href='" . esc_url( $permalink ) . "' class='button button-small'>$view_post</a></span>\n";
|
||||
|
||||
$return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
|
||||
|
||||
@@ -1159,16 +1179,16 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
|
||||
}
|
||||
}
|
||||
|
||||
$post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
|
||||
$display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
|
||||
$post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html( $post_name_abridged ) . '</span>';
|
||||
$display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, esc_html( $permalink ) );
|
||||
$view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink);
|
||||
$return = '<strong>' . __('Permalink:') . "</strong>\n";
|
||||
$return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
|
||||
$return .= '‎'; // Fix bi-directional text display defect in RTL languages.
|
||||
$return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
|
||||
$return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
|
||||
$return .= '<span id="editable-post-name-full">' . esc_html( $post_name ) . "</span>\n";
|
||||
if ( isset($view_post) )
|
||||
$return .= "<span id='view-post-btn'><a href='$view_link' class='button button-small'>$view_post</a></span>\n";
|
||||
$return .= "<span id='view-post-btn'><a href='" . esc_url( $view_link ) . "' class='button button-small'>$view_post</a></span>\n";
|
||||
|
||||
$return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
|
||||
|
||||
@@ -1341,7 +1361,7 @@ function _admin_notice_post_locked() {
|
||||
// Allow plugins to prevent some users overriding the post lock
|
||||
if ( $override ) {
|
||||
?>
|
||||
<a class="button button-primary wp-tab-last" href="<?php echo esc_url( add_query_arg( 'get-post-lock', '1', get_edit_post_link( $post->ID, 'url' ) ) ); ?>"><?php _e('Take over'); ?></a>
|
||||
<a class="button button-primary wp-tab-last" href="<?php echo esc_url( add_query_arg( 'get-post-lock', '1', wp_nonce_url( get_edit_post_link( $post->ID, 'url' ), 'lock-post_' . $post->ID ) ) ); ?>"><?php _e('Take over'); ?></a>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
@@ -901,7 +901,8 @@ final class WP_Screen {
|
||||
|
||||
switch ( $this->id ) {
|
||||
case 'widgets':
|
||||
$this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";
|
||||
$nonce = wp_create_nonce( 'widgets-access' );
|
||||
$this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on&_wpnonce=' . urlencode( $nonce ) . '">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off&_wpnonce=' . urlencode( $nonce ) . '">' . __('Disable accessibility mode') . "</a></p>\n";
|
||||
break;
|
||||
default:
|
||||
$this->_screen_settings = '';
|
||||
|
||||
@@ -706,7 +706,7 @@ function page_template_dropdown( $default = '' ) {
|
||||
$selected = " selected='selected'";
|
||||
else
|
||||
$selected = '';
|
||||
echo "\n\t<option value='".$templates[$template]."' $selected>$template</option>";
|
||||
echo "\n\t<option value='" . esc_attr( $templates[$template] ) ."' $selected>" . esc_html( $template ) . "</option>";
|
||||
endforeach;
|
||||
}
|
||||
|
||||
@@ -1373,7 +1373,7 @@ function _draft_or_post_title( $post = 0 ) {
|
||||
$title = get_the_title( $post );
|
||||
if ( empty( $title ) )
|
||||
$title = __( '(no title)' );
|
||||
return $title;
|
||||
return esc_html( $title );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -881,6 +881,9 @@ function update_core($from, $to) {
|
||||
$wp_filesystem->delete($old_file, true);
|
||||
}
|
||||
|
||||
// Remove any Genericons example.html's from the filesystem
|
||||
_upgrade_422_remove_genericons();
|
||||
|
||||
// Upgrade DB with separate request
|
||||
apply_filters('update_feedback', __('Upgrading database…'));
|
||||
$db_upgrade_url = admin_url('upgrade.php?step=upgrade_db');
|
||||
@@ -1009,3 +1012,67 @@ window.location = 'about.php?updated';
|
||||
exit();
|
||||
}
|
||||
add_action( '_core_updated_successfully', '_redirect_to_about_wordpress' );
|
||||
|
||||
/**
|
||||
* Cleans up Genericons example files.
|
||||
*
|
||||
* @since 4.2.2
|
||||
*/
|
||||
function _upgrade_422_remove_genericons() {
|
||||
global $wp_theme_directories, $wp_filesystem;
|
||||
|
||||
// A list of the affected files using the filesystem absolute paths.
|
||||
$affected_files = array();
|
||||
|
||||
// Themes
|
||||
foreach ( $wp_theme_directories as $directory ) {
|
||||
$affected_theme_files = _upgrade_422_find_genericons_files_in_folder( $directory );
|
||||
$affected_files = array_merge( $affected_files, $affected_theme_files );
|
||||
}
|
||||
|
||||
// Plugins
|
||||
$affected_plugin_files = _upgrade_422_find_genericons_files_in_folder( WP_PLUGIN_DIR );
|
||||
$affected_files = array_merge( $affected_files, $affected_plugin_files );
|
||||
|
||||
foreach ( $affected_files as $file ) {
|
||||
$gen_dir = $wp_filesystem->find_folder( trailingslashit( dirname( $file ) ) );
|
||||
if ( empty( $gen_dir ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// The path when the file is accessed via WP_Filesystem may differ in the case of FTP
|
||||
$remote_file = $gen_dir . basename( $file );
|
||||
|
||||
if ( ! $wp_filesystem->exists( $remote_file ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! $wp_filesystem->delete( $remote_file, false, 'f' ) ) {
|
||||
$wp_filesystem->put_contents( $remote_file, '' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively find Genericons example files in a given folder.
|
||||
*
|
||||
* @ignore
|
||||
* @since 4.2.2
|
||||
*
|
||||
* @param string $directory Directory path. Expects trailingslashed.
|
||||
* @return array
|
||||
*/
|
||||
function _upgrade_422_find_genericons_files_in_folder( $directory ) {
|
||||
$directory = trailingslashit( $directory );
|
||||
$files = array();
|
||||
|
||||
if ( file_exists( "{$directory}example.html" ) && false !== strpos( file_get_contents( "{$directory}example.html" ), '<title>Genericons</title>' ) ) {
|
||||
$files[] = "{$directory}example.html";
|
||||
}
|
||||
|
||||
foreach ( glob( $directory . '*', GLOB_ONLYDIR ) as $dir ) {
|
||||
$files = array_merge( $files, _upgrade_422_find_genericons_files_in_folder( $dir ) );
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
@@ -411,6 +411,9 @@ function upgrade_all() {
|
||||
if ( $wp_current_db_version < 26149 )
|
||||
upgrade_373();
|
||||
|
||||
if ( $wp_current_db_version < 26151 )
|
||||
upgrade_379();
|
||||
|
||||
maybe_disable_link_manager();
|
||||
|
||||
maybe_disable_automattic_widgets();
|
||||
@@ -1269,6 +1272,62 @@ function upgrade_373() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute changes made in WordPress 3.7.8.
|
||||
*
|
||||
* @since 3.7.8
|
||||
*/
|
||||
function upgrade_378() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute changes made in WordPress 3.7.9.
|
||||
*
|
||||
* @since 3.7.9
|
||||
*/
|
||||
function upgrade_379() {
|
||||
global $wp_current_db_version, $wpdb;
|
||||
|
||||
if ( $wp_current_db_version < 26151 ) {
|
||||
$content_length = $wpdb->get_col_length( $wpdb->comments, 'comment_content' );
|
||||
|
||||
if ( is_wp_error( $content_length ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( false === $content_length ) {
|
||||
$content_length = array(
|
||||
'type' => 'byte',
|
||||
'length' => 65535,
|
||||
);
|
||||
} elseif ( ! is_array( $content_length ) ) {
|
||||
$length = (int) $content_length > 0 ? (int) $content_length : 65535;
|
||||
$content_length = array(
|
||||
'type' => 'byte',
|
||||
'length' => $length
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'byte' !== $content_length['type'] || 0 === $content_length['length'] ) {
|
||||
// Sites with malformed DB schemas are on their own.
|
||||
return;
|
||||
}
|
||||
|
||||
$allowed_length = intval( $content_length['length'] ) - 10;
|
||||
|
||||
$comments = $wpdb->get_results(
|
||||
"SELECT `comment_ID` FROM `{$wpdb->comments}`
|
||||
WHERE `comment_date_gmt` > '2015-04-26'
|
||||
AND LENGTH( `comment_content` ) >= {$allowed_length}
|
||||
AND ( `comment_content` LIKE '%<%' OR `comment_content` LIKE '%>%' )"
|
||||
);
|
||||
|
||||
foreach ( $comments as $comment ) {
|
||||
wp_delete_comment( $comment->comment_ID, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute network level changes
|
||||
*
|
||||
|
||||
@@ -777,6 +777,16 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Ensure preview nonce is included with every customized request, to allow post data to be read.
|
||||
$.ajaxPrefilter( function injectPreviewNonce( options ) {
|
||||
if ( ! /wp_customize=on/.test( options.data ) ) {
|
||||
return;
|
||||
}
|
||||
options.data += '&' + $.param({
|
||||
customize_preview_nonce: api.settings.nonce.preview
|
||||
});
|
||||
});
|
||||
|
||||
// Refresh the nonces if the preview sends updated nonces over.
|
||||
previewer.bind( 'nonce', function( nonce ) {
|
||||
$.extend( this.nonce, nonce );
|
||||
|
||||
2
wp-admin/js/customize-controls.min.js
vendored
2
wp-admin/js/customize-controls.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -444,14 +444,14 @@ var wpNavMenu;
|
||||
if ( ! isPrimaryMenuItem ) {
|
||||
var thisLink = menuItem.find( '.menus-move-left' ),
|
||||
thisLinkText = menus.outFrom.replace( '%s', prevItemNameLeft );
|
||||
thisLink.prop( 'title', menus.moveOutFrom.replace( '%s', prevItemNameLeft ) ).html( thisLinkText ).css( 'display', 'inline' );
|
||||
thisLink.prop( 'title', menus.moveOutFrom.replace( '%s', prevItemNameLeft ) ).text( thisLinkText ).css( 'display', 'inline' );
|
||||
}
|
||||
|
||||
if ( 0 !== position ) {
|
||||
if ( menuItem.find( '.menu-item-data-parent-id' ).val() !== menuItem.prev().find( '.menu-item-data-db-id' ).val() ) {
|
||||
var thisLink = menuItem.find( '.menus-move-right' ),
|
||||
thisLinkText = menus.under.replace( '%s', prevItemNameRight );
|
||||
thisLink.prop( 'title', menus.moveUnder.replace( '%s', prevItemNameRight ) ).html( thisLinkText ).css( 'display', 'inline' );
|
||||
thisLink.prop( 'title', menus.moveUnder.replace( '%s', prevItemNameRight ) ).text( thisLinkText ).css( 'display', 'inline' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -473,7 +473,7 @@ var wpNavMenu;
|
||||
title = menus.subMenuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$s', parentItemName );
|
||||
}
|
||||
|
||||
$this.prop('title', title).html( title );
|
||||
$this.prop('title', title).text( title );
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
2
wp-admin/js/nav-menu.min.js
vendored
2
wp-admin/js/nav-menu.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -224,7 +224,7 @@ if ( isset( $_GET['updated'] ) ) {
|
||||
<tr valign="top">
|
||||
<th scope="row"><label for="first_comment_author"><?php _e( 'First Comment Author' ) ?></label></th>
|
||||
<td>
|
||||
<input type="text" size="40" name="first_comment_author" id="first_comment_author" value="<?php echo get_site_option('first_comment_author') ?>" />
|
||||
<input type="text" size="40" name="first_comment_author" id="first_comment_author" value="<?php echo esc_attr( get_site_option('first_comment_author') ); ?>" />
|
||||
<br />
|
||||
<?php _e( 'The author of the first comment on a new site.' ) ?>
|
||||
</td>
|
||||
|
||||
@@ -86,9 +86,9 @@ default:
|
||||
wp_die( $error );
|
||||
|
||||
if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network($file) ) || ! is_plugin_active($file) )
|
||||
activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error
|
||||
activate_plugin($file, "plugin-editor.php?file=" . urlencode( $file ) . "&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error
|
||||
|
||||
wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") );
|
||||
wp_redirect( self_admin_url("plugin-editor.php?file=" . urlencode( $file ) . "&a=te&scrollto=$scrollto") );
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -175,14 +175,14 @@ default:
|
||||
<big><?php
|
||||
if ( is_plugin_active($plugin) ) {
|
||||
if ( is_writeable($real_file) )
|
||||
echo sprintf(__('Editing <strong>%s</strong> (active)'), $file);
|
||||
echo sprintf(__('Editing <strong>%s</strong> (active)'), esc_html( $file ) );
|
||||
else
|
||||
echo sprintf(__('Browsing <strong>%s</strong> (active)'), $file);
|
||||
echo sprintf(__('Browsing <strong>%s</strong> (active)'), esc_html( $file ) );
|
||||
} else {
|
||||
if ( is_writeable($real_file) )
|
||||
echo sprintf(__('Editing <strong>%s</strong> (inactive)'), $file);
|
||||
echo sprintf(__('Editing <strong>%s</strong> (inactive)'), esc_html( $file ) );
|
||||
else
|
||||
echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file);
|
||||
echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), esc_html( $file ) );
|
||||
}
|
||||
?></big>
|
||||
</div>
|
||||
@@ -226,7 +226,7 @@ foreach ( $plugin_files as $plugin_file ) :
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo urlencode( $plugin_file ) ?>&plugin=<?php echo urlencode( $plugin ) ?>"><?php echo $plugin_file ?></a></li>
|
||||
<li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo urlencode( $plugin_file ) ?>&plugin=<?php echo urlencode( $plugin ) ?>"><?php echo esc_html( $plugin_file ); ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -17,7 +17,7 @@ $pagenum = $wp_list_table->get_pagenum();
|
||||
|
||||
$action = $wp_list_table->current_action();
|
||||
|
||||
$plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
|
||||
$plugin = isset($_REQUEST['plugin']) ? wp_unslash( $_REQUEST['plugin'] ) : '';
|
||||
$s = isset($_REQUEST['s']) ? urlencode($_REQUEST['s']) : '';
|
||||
|
||||
// Clean up request URI from temporary args for screen options/paging uri's to work as expected.
|
||||
@@ -37,10 +37,10 @@ if ( $action ) {
|
||||
|
||||
check_admin_referer('activate-plugin_' . $plugin);
|
||||
|
||||
$result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . $plugin), is_network_admin() );
|
||||
$result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . urlencode( $plugin ) ), is_network_admin() );
|
||||
if ( is_wp_error( $result ) ) {
|
||||
if ( 'unexpected_output' == $result->get_error_code() ) {
|
||||
$redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin . "&plugin_status=$status&paged=$page&s=$s");
|
||||
$redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . urlencode( $plugin ) . "&plugin_status=$status&paged=$page&s=$s");
|
||||
wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));
|
||||
exit;
|
||||
} else {
|
||||
@@ -67,7 +67,7 @@ if ( $action ) {
|
||||
|
||||
check_admin_referer('bulk-plugins');
|
||||
|
||||
$plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
|
||||
$plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array();
|
||||
|
||||
// Only activate plugins which are not already active.
|
||||
if ( is_network_admin() ) {
|
||||
@@ -104,9 +104,9 @@ if ( $action ) {
|
||||
check_admin_referer( 'bulk-plugins' );
|
||||
|
||||
if ( isset( $_GET['plugins'] ) )
|
||||
$plugins = explode( ',', $_GET['plugins'] );
|
||||
$plugins = explode( ',', wp_unslash( $_GET['plugins'] ) );
|
||||
elseif ( isset( $_POST['checked'] ) )
|
||||
$plugins = (array) $_POST['checked'];
|
||||
$plugins = (array) wp_unslash( $_POST['checked'] );
|
||||
else
|
||||
$plugins = array();
|
||||
|
||||
@@ -176,7 +176,7 @@ if ( $action ) {
|
||||
|
||||
check_admin_referer('bulk-plugins');
|
||||
|
||||
$plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
|
||||
$plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array();
|
||||
// Do not deactivate plugins which are already deactivated.
|
||||
if ( is_network_admin() ) {
|
||||
$plugins = array_filter( $plugins, 'is_plugin_active_for_network' );
|
||||
@@ -208,7 +208,7 @@ if ( $action ) {
|
||||
check_admin_referer('bulk-plugins');
|
||||
|
||||
//$_POST = from the plugin form; $_GET = from the FTP details screen.
|
||||
$plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array();
|
||||
$plugins = isset( $_REQUEST['checked'] ) ? (array) wp_unslash( $_REQUEST['checked'] ) : array();
|
||||
if ( empty( $plugins ) ) {
|
||||
wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
|
||||
exit;
|
||||
@@ -220,6 +220,14 @@ if ( $action ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Bail on all if any paths are invalid.
|
||||
// validate_file() returns truthy for invalid files
|
||||
$invalid_plugin_files = array_filter( $plugins, 'validate_file' );
|
||||
if ( $invalid_plugin_files ) {
|
||||
wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
|
||||
exit;
|
||||
}
|
||||
|
||||
include(ABSPATH . 'wp-admin/update.php');
|
||||
|
||||
$parent_file = 'plugins.php';
|
||||
|
||||
@@ -146,6 +146,7 @@ case 'edit':
|
||||
wp_die( __( 'You can’t edit this item because it is in the Trash. Please restore it and try again.' ) );
|
||||
|
||||
if ( ! empty( $_GET['get-post-lock'] ) ) {
|
||||
check_admin_referer( 'lock-post_' . $post_id );
|
||||
wp_set_post_lock( $post_id );
|
||||
wp_redirect( get_edit_post_link( $post_id, 'url' ) );
|
||||
exit();
|
||||
|
||||
@@ -34,8 +34,25 @@ function press_it() {
|
||||
if ( !current_user_can('edit_post', $post_ID) )
|
||||
wp_die(__('You are not allowed to edit this post.'));
|
||||
|
||||
$post['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : '';
|
||||
$post['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : '';
|
||||
// Only accept categories if the user actually can assign
|
||||
$category_tax = get_taxonomy( 'category' );
|
||||
if ( current_user_can( $category_tax->cap->assign_terms ) ) {
|
||||
$post['post_category'] = ( ! empty( $_POST['post_category'] ) ) ? $_POST['post_category'] : array();
|
||||
}
|
||||
|
||||
// Only accept taxonomies if the user can actually assign
|
||||
if ( ! empty( $_POST['tax_input'] ) ) {
|
||||
$tax_input = $_POST['tax_input'];
|
||||
foreach ( $tax_input as $tax => $_ti ) {
|
||||
$tax_object = get_taxonomy( $tax );
|
||||
if ( ! $tax_object || ! current_user_can( $tax_object->cap->assign_terms ) ) {
|
||||
unset( $tax_input[ $tax ] );
|
||||
}
|
||||
}
|
||||
|
||||
$post['tax_input'] = $tax_input;
|
||||
}
|
||||
|
||||
$post['post_title'] = isset($_POST['title']) ? $_POST['title'] : '';
|
||||
$content = isset($_POST['content']) ? $_POST['content'] : '';
|
||||
|
||||
@@ -490,75 +507,81 @@ $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace(
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $tax = get_taxonomy( 'category' ); ?>
|
||||
<div id="categorydiv" class="postbox">
|
||||
<div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div>
|
||||
<h3 class="hndle"><?php _e('Categories') ?></h3>
|
||||
<div class="inside">
|
||||
<div id="taxonomy-category" class="categorydiv">
|
||||
<?php
|
||||
|
||||
<ul id="category-tabs" class="category-tabs">
|
||||
<li class="tabs"><a href="#category-all"><?php echo $tax->labels->all_items; ?></a></li>
|
||||
<li class="hide-if-no-js"><a href="#category-pop"><?php _e( 'Most Used' ); ?></a></li>
|
||||
</ul>
|
||||
$tax = get_taxonomy( 'category' );
|
||||
if ( current_user_can( $tax->cap->assign_terms ) ) :
|
||||
?>
|
||||
<div id="categorydiv" class="postbox">
|
||||
<div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div>
|
||||
<h3 class="hndle"><?php _e('Categories') ?></h3>
|
||||
<div class="inside">
|
||||
<div id="taxonomy-category" class="categorydiv">
|
||||
|
||||
<div id="category-pop" class="tabs-panel" style="display: none;">
|
||||
<ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
|
||||
<?php $popular_ids = wp_popular_terms_checklist( 'category' ); ?>
|
||||
<ul id="category-tabs" class="category-tabs">
|
||||
<li class="tabs"><a href="#category-all"><?php echo $tax->labels->all_items; ?></a></li>
|
||||
<li class="hide-if-no-js"><a href="#category-pop"><?php _e( 'Most Used' ); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="category-all" class="tabs-panel">
|
||||
<ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear">
|
||||
<?php wp_terms_checklist($post_ID, array( 'taxonomy' => 'category', 'popular_cats' => $popular_ids ) ) ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php if ( !current_user_can($tax->cap->assign_terms) ) : ?>
|
||||
<p><em><?php _e('You cannot modify this Taxonomy.'); ?></em></p>
|
||||
<?php endif; ?>
|
||||
<?php if ( current_user_can($tax->cap->edit_terms) ) : ?>
|
||||
<div id="category-adder" class="wp-hidden-children">
|
||||
<h4>
|
||||
<a id="category-add-toggle" href="#category-add" class="hide-if-no-js">
|
||||
<?php printf( __( '+ %s' ), $tax->labels->add_new_item ); ?>
|
||||
</a>
|
||||
</h4>
|
||||
<p id="category-add" class="category-add wp-hidden-child">
|
||||
<label class="screen-reader-text" for="newcategory"><?php echo $tax->labels->add_new_item; ?></label>
|
||||
<input type="text" name="newcategory" id="newcategory" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" aria-required="true"/>
|
||||
<label class="screen-reader-text" for="newcategory_parent">
|
||||
<?php echo $tax->labels->parent_item_colon; ?>
|
||||
</label>
|
||||
<?php wp_dropdown_categories( array( 'taxonomy' => 'category', 'hide_empty' => 0, 'name' => 'newcategory_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —' ) ); ?>
|
||||
<input type="button" id="category-add-submit" data-wp-lists="add:categorychecklist:category-add" class="button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" />
|
||||
<?php wp_nonce_field( 'add-category', '_ajax_nonce-add-category', false ); ?>
|
||||
<span id="category-ajax-response"></span>
|
||||
</p>
|
||||
<div id="category-pop" class="tabs-panel" style="display: none;">
|
||||
<ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
|
||||
<?php $popular_ids = wp_popular_terms_checklist( 'category' ); ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="tagsdiv-post_tag" class="postbox">
|
||||
<div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div>
|
||||
<h3><span><?php _e('Tags'); ?></span></h3>
|
||||
<div class="inside">
|
||||
<div class="tagsdiv" id="post_tag">
|
||||
<div class="jaxtag">
|
||||
<label class="screen-reader-text" for="newtag"><?php _e('Tags'); ?></label>
|
||||
<input type="hidden" name="tax_input[post_tag]" class="the-tags" id="tax-input[post_tag]" value="" />
|
||||
<div class="ajaxtag">
|
||||
<input type="text" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
|
||||
<input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" />
|
||||
<div id="category-all" class="tabs-panel">
|
||||
<ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear">
|
||||
<?php wp_terms_checklist($post_ID, array( 'taxonomy' => 'category', 'popular_cats' => $popular_ids ) ) ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php if ( current_user_can($tax->cap->edit_terms) ) : ?>
|
||||
<div id="category-adder" class="wp-hidden-children">
|
||||
<h4>
|
||||
<a id="category-add-toggle" href="#category-add" class="hide-if-no-js">
|
||||
<?php printf( __( '+ %s' ), $tax->labels->add_new_item ); ?>
|
||||
</a>
|
||||
</h4>
|
||||
<p id="category-add" class="category-add wp-hidden-child">
|
||||
<label class="screen-reader-text" for="newcategory"><?php echo $tax->labels->add_new_item; ?></label>
|
||||
<input type="text" name="newcategory" id="newcategory" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" aria-required="true"/>
|
||||
<label class="screen-reader-text" for="newcategory_parent">
|
||||
<?php echo $tax->labels->parent_item_colon; ?>
|
||||
</label>
|
||||
<?php wp_dropdown_categories( array( 'taxonomy' => 'category', 'hide_empty' => 0, 'name' => 'newcategory_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —' ) ); ?>
|
||||
<input type="button" id="category-add-submit" data-wp-lists="add:categorychecklist:category-add" class="button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" />
|
||||
<?php wp_nonce_field( 'add-category', '_ajax_nonce-add-category', false ); ?>
|
||||
<span id="category-ajax-response"></span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tagchecklist"></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<p class="tagcloud-link"><a href="#titlediv" class="tagcloud-link" id="link-post_tag"><?php _e('Choose from the most used tags'); ?></a></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;
|
||||
|
||||
$tax = get_taxonomy( 'post_tag' );
|
||||
if ( current_user_can( $tax->cap->assign_terms ) ) :
|
||||
?>
|
||||
<div id="tagsdiv-post_tag" class="postbox">
|
||||
<div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div>
|
||||
<h3><span><?php _e('Tags'); ?></span></h3>
|
||||
<div class="inside">
|
||||
<div class="tagsdiv" id="post_tag">
|
||||
<div class="jaxtag">
|
||||
<label class="screen-reader-text" for="newtag"><?php _e('Tags'); ?></label>
|
||||
<input type="hidden" name="tax_input[post_tag]" class="the-tags" id="tax-input[post_tag]" value="" />
|
||||
<div class="ajaxtag">
|
||||
<input type="text" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
|
||||
<input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="tagchecklist"></div>
|
||||
</div>
|
||||
<p class="tagcloud-link"><a href="#titlediv" class="tagcloud-link" id="link-post_tag"><?php _e('Choose from the most used tags'); ?></a></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="posting">
|
||||
|
||||
@@ -63,7 +63,7 @@ default :
|
||||
if ( ! $post = get_post( $revision->post_parent ) )
|
||||
break;
|
||||
|
||||
if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'read_post', $post->ID ) )
|
||||
if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'edit_post', $revision->post_parent ) )
|
||||
break;
|
||||
|
||||
// Revisions disabled and we're not looking at an autosave
|
||||
|
||||
@@ -68,7 +68,7 @@ if ( empty( $file ) ) {
|
||||
$relative_file = 'style.css';
|
||||
$file = $allowed_files['style.css'];
|
||||
} else {
|
||||
$relative_file = $file;
|
||||
$relative_file = wp_unslash( $file );
|
||||
$file = $theme->get_stylesheet_directory() . '/' . $relative_file;
|
||||
}
|
||||
|
||||
@@ -127,10 +127,12 @@ default:
|
||||
<div id="message" class="updated"><p><?php _e( 'File edited successfully.' ) ?></p></div>
|
||||
<?php endif;
|
||||
|
||||
$description = get_file_description( $file );
|
||||
$file_description = get_file_description( $relative_file );
|
||||
$file_show = array_search( $file, array_filter( $allowed_files ) );
|
||||
if ( $description != $file_show )
|
||||
$description .= ' <span>(' . $file_show . ')</span>';
|
||||
$description = esc_html( $file_description );
|
||||
if ( $file_description != $file_show ) {
|
||||
$description .= ' <span>(' . esc_html( $file_show ) . ')</span>';
|
||||
}
|
||||
?>
|
||||
<div class="wrap">
|
||||
<?php screen_icon(); ?>
|
||||
@@ -180,9 +182,9 @@ if ( $allowed_files ) :
|
||||
if ( 'style.css' == $filename )
|
||||
echo "\t</ul>\n\t<h3>" . _x( 'Styles', 'Theme stylesheets in theme editor' ) . "</h3>\n\t<ul>\n";
|
||||
|
||||
$file_description = get_file_description( $absolute_filename );
|
||||
$file_description = esc_html( get_file_description( $filename ) );
|
||||
if ( $file_description != basename( $filename ) )
|
||||
$file_description .= '<br /><span class="nonessential">(' . $filename . ')</span>';
|
||||
$file_description .= '<br /><span class="nonessential">(' . esc_html( $filename ) . ')</span>';
|
||||
|
||||
if ( $absolute_filename == $file )
|
||||
$file_description = '<span class="highlight">' . $file_description . '</span>';
|
||||
|
||||
@@ -237,6 +237,8 @@ function list_plugin_updates() {
|
||||
<tbody class="plugins">
|
||||
<?php
|
||||
foreach ( (array) $plugins as $plugin_file => $plugin_data) {
|
||||
$plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true );
|
||||
|
||||
$info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug ));
|
||||
// Get plugin compat for running version of WordPress.
|
||||
if ( isset($info->tested) && version_compare($info->tested, $cur_wp_version, '>=') ) {
|
||||
|
||||
@@ -81,7 +81,7 @@ if ( is_multisite() && ! current_user_can( 'manage_network_users' ) && $user_id
|
||||
// Execute confirmed email change. See send_confirmation_on_profile_email().
|
||||
if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) {
|
||||
$new_email = get_option( $current_user->ID . '_new_email' );
|
||||
if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) {
|
||||
if ( $new_email && hash_equals( $new_email[ 'hash' ], $_GET[ 'newuseremail' ] ) ) {
|
||||
$user = new stdClass;
|
||||
$user->ID = $current_user->ID;
|
||||
$user->user_email = esc_html( trim( $new_email[ 'newemail' ] ) );
|
||||
@@ -92,7 +92,8 @@ if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $c
|
||||
wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) );
|
||||
die();
|
||||
}
|
||||
} elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' == $_GET['dismiss'] ) {
|
||||
} elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' === $_GET['dismiss'] ) {
|
||||
check_admin_referer( 'dismiss-' . $current_user->ID . '_new_email' );
|
||||
delete_option( $current_user->ID . '_new_email' );
|
||||
wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) );
|
||||
die();
|
||||
@@ -167,7 +168,7 @@ include (ABSPATH . 'wp-admin/admin-header.php');
|
||||
<p><strong><?php _e('User updated.') ?></strong></p>
|
||||
<?php endif; ?>
|
||||
<?php if ( $wp_http_referer && !IS_PROFILE_PAGE ) : ?>
|
||||
<p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php _e('← Back to Users'); ?></a></p>
|
||||
<p><a href="<?php echo esc_url( wp_validate_redirect( esc_url_raw( $wp_http_referer ), self_admin_url( 'users.php' ) ) ); ?>"><?php _e('← Back to Users'); ?></a></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -338,7 +339,7 @@ if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_c
|
||||
$new_email = get_option( $current_user->ID . '_new_email' );
|
||||
if ( $new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID ) : ?>
|
||||
<div class="updated inline">
|
||||
<p><?php printf( __('There is a pending change of your e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), $new_email['newemail'], esc_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ) ) ); ?></p>
|
||||
<p><?php printf( __('There is a pending change of your e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), esc_html( $new_email['newemail'] ), esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ), 'dismiss-' . $current_user->ID . '_new_email' ) ) ); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
||||
@@ -17,6 +17,8 @@ if ( ! current_user_can('edit_theme_options') )
|
||||
|
||||
$widgets_access = get_user_setting( 'widgets_access' );
|
||||
if ( isset($_GET['widgets-access']) ) {
|
||||
check_admin_referer( 'widgets-access' );
|
||||
|
||||
$widgets_access = 'on' == $_GET['widgets-access'] ? 'on' : 'off';
|
||||
set_user_setting( 'widgets_access', $widgets_access );
|
||||
}
|
||||
|
||||
@@ -1073,8 +1073,10 @@ function map_meta_cap( $cap, $user_id ) {
|
||||
case 'edit_post':
|
||||
case 'edit_page':
|
||||
$post = get_post( $args[0] );
|
||||
if ( empty( $post ) )
|
||||
if ( empty( $post ) ) {
|
||||
$caps[] = 'do_not_allow';
|
||||
break;
|
||||
}
|
||||
|
||||
if ( 'revision' == $post->post_type ) {
|
||||
$post = get_post( $post->post_parent );
|
||||
@@ -1182,7 +1184,16 @@ function map_meta_cap( $cap, $user_id ) {
|
||||
if ( empty( $comment ) )
|
||||
break;
|
||||
$post = get_post( $comment->comment_post_ID );
|
||||
$caps = map_meta_cap( 'edit_post', $user_id, $post->ID );
|
||||
|
||||
/*
|
||||
* If the post doesn't exist, we have an orphaned comment.
|
||||
* Fall back to the edit_posts capability, instead.
|
||||
*/
|
||||
if ( $post ) {
|
||||
$caps = map_meta_cap( 'edit_post', $user_id, $post->ID );
|
||||
} else {
|
||||
$caps = map_meta_cap( 'edit_posts', $user_id );
|
||||
}
|
||||
break;
|
||||
case 'unfiltered_upload':
|
||||
if ( defined('ALLOW_UNFILTERED_UPLOADS') && ALLOW_UNFILTERED_UPLOADS && ( !is_multisite() || is_super_admin( $user_id ) ) )
|
||||
@@ -1304,21 +1315,25 @@ function current_user_can( $capability ) {
|
||||
* @return bool
|
||||
*/
|
||||
function current_user_can_for_blog( $blog_id, $capability ) {
|
||||
if ( is_multisite() )
|
||||
switch_to_blog( $blog_id );
|
||||
$switched = is_multisite() ? switch_to_blog( $blog_id ) : false;
|
||||
|
||||
$current_user = wp_get_current_user();
|
||||
|
||||
if ( empty( $current_user ) )
|
||||
if ( empty( $current_user ) ) {
|
||||
if ( $switched ) {
|
||||
restore_current_blog();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$args = array_slice( func_get_args(), 2 );
|
||||
$args = array_merge( array( $capability ), $args );
|
||||
|
||||
$can = call_user_func_array( array( $current_user, 'has_cap' ), $args );
|
||||
|
||||
if ( is_multisite() )
|
||||
if ( $switched ) {
|
||||
restore_current_blog();
|
||||
}
|
||||
|
||||
return $can;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -999,20 +999,23 @@ class Snoopy
|
||||
if(!empty($this->user) || !empty($this->pass))
|
||||
$headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass);
|
||||
|
||||
for($curr_header = 0; $curr_header < count($headers); $curr_header++) {
|
||||
$safer_header = strtr( $headers[$curr_header], "\"", " " );
|
||||
$cmdline_params .= " -H \"".$safer_header."\"";
|
||||
$headerfile = tempnam( $this->temp_dir, "sno" );
|
||||
$cmdline_params = '-k -D ' . escapeshellarg( $headerfile );
|
||||
|
||||
foreach ( $headers as $header ) {
|
||||
$cmdline_params .= ' -H ' . escapeshellarg( $header );
|
||||
}
|
||||
|
||||
if(!empty($body))
|
||||
$cmdline_params .= " -d \"$body\"";
|
||||
if ( ! empty( $body ) ) {
|
||||
$cmdline_params .= ' -d ' . escapeshellarg( $body );
|
||||
}
|
||||
|
||||
if($this->read_timeout > 0)
|
||||
$cmdline_params .= " -m ".$this->read_timeout;
|
||||
if ( $this->read_timeout > 0 ) {
|
||||
$cmdline_params .= ' -m ' . escapeshellarg( $this->read_timeout );
|
||||
}
|
||||
|
||||
$headerfile = tempnam($this->temp_dir, "sno");
|
||||
|
||||
exec($this->curl_path." -k -D \"$headerfile\"".$cmdline_params." \"".escapeshellcmd($URI)."\"",$results,$return);
|
||||
exec( $this->curl_path . ' ' . $cmdline_params . ' ' . escapeshellarg( $URI ), $results, $return );
|
||||
|
||||
if($return)
|
||||
{
|
||||
|
||||
@@ -123,6 +123,24 @@ final class WP_Customize_Manager {
|
||||
|
||||
$this->theme = wp_get_theme( isset( $_REQUEST['theme'] ) ? $_REQUEST['theme'] : null );
|
||||
|
||||
/*
|
||||
* Clear incoming post data if the user lacks a CSRF token (nonce). Note that the customizer
|
||||
* application will inject the customize_preview_nonce query parameter into all Ajax requests.
|
||||
* For similar behavior elsewhere in WordPress, see rest_cookie_check_errors() which logs out
|
||||
* a user when a valid nonce isn't present.
|
||||
*/
|
||||
$has_post_data_nonce = (
|
||||
check_ajax_referer( 'preview-customize_' . $this->get_stylesheet(), 'nonce', false )
|
||||
||
|
||||
check_ajax_referer( 'save-customize_' . $this->get_stylesheet(), 'nonce', false )
|
||||
||
|
||||
check_ajax_referer( 'preview-customize_' . $this->get_stylesheet(), 'customize_preview_nonce', false )
|
||||
);
|
||||
if ( ! $has_post_data_nonce ) {
|
||||
unset( $_POST['customized'] );
|
||||
unset( $_REQUEST['customized'] );
|
||||
}
|
||||
|
||||
if ( $this->is_theme_active() ) {
|
||||
// Once the theme is loaded, we'll validate it.
|
||||
add_action( 'after_setup_theme', array( $this, 'after_setup_theme' ) );
|
||||
|
||||
@@ -59,12 +59,6 @@ final class _WP_Editors {
|
||||
// A cookie (set when a user resizes the editor) overrides the height.
|
||||
$cookie = (int) get_user_setting( 'ed_size' );
|
||||
|
||||
// Upgrade an old TinyMCE cookie if it is still around, and the new one isn't.
|
||||
if ( ! $cookie && isset( $_COOKIE['TinyMCE_content_size'] ) ) {
|
||||
parse_str( $_COOKIE['TinyMCE_content_size'], $cookie );
|
||||
$cookie = $cookie['ch'];
|
||||
}
|
||||
|
||||
if ( $cookie )
|
||||
$set['editor_height'] = $cookie;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class WP_Embed {
|
||||
add_shortcode( 'embed', array( $this, 'shortcode' ) );
|
||||
|
||||
// Do the shortcode (only the [embed] one is registered)
|
||||
$content = do_shortcode( $content );
|
||||
$content = do_shortcode( $content, true );
|
||||
|
||||
// Put the original shortcodes back
|
||||
$shortcode_tags = $orig_shortcode_tags;
|
||||
@@ -280,7 +280,14 @@ class WP_Embed {
|
||||
* @return string Potentially modified $content.
|
||||
*/
|
||||
function autoembed( $content ) {
|
||||
return preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array( $this, 'autoembed_callback' ), $content );
|
||||
// Replace line breaks from all HTML elements with placeholders.
|
||||
$content = wp_replace_in_html_tags( $content, array( "\n" => '<!-- wp-line-break -->' ) );
|
||||
|
||||
// Find URLs that are on their own line.
|
||||
$content = preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array( $this, 'autoembed_callback' ), $content );
|
||||
|
||||
// Put the line breaks back.
|
||||
return str_replace( '<!-- wp-line-break -->', "\n", $content );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -206,7 +206,7 @@ final class WP_Theme implements ArrayAccess {
|
||||
} elseif ( ! file_exists( $this->theme_root . '/' . $theme_file ) ) {
|
||||
$this->headers['Name'] = $this->stylesheet;
|
||||
if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet ) )
|
||||
$this->errors = new WP_Error( 'theme_not_found', sprintf( __( 'The theme directory "%s" does not exist.' ), $this->stylesheet ) );
|
||||
$this->errors = new WP_Error( 'theme_not_found', sprintf( __( 'The theme directory "%s" does not exist.' ), esc_html( $this->stylesheet ) ) );
|
||||
else
|
||||
$this->errors = new WP_Error( 'theme_no_stylesheet', __( 'Stylesheet is missing.' ) );
|
||||
$this->template = $this->stylesheet;
|
||||
@@ -253,7 +253,7 @@ final class WP_Theme implements ArrayAccess {
|
||||
$theme_root_template = $directories[ $this->template ]['theme_root'];
|
||||
} else {
|
||||
// Parent theme is missing.
|
||||
$this->errors = new WP_Error( 'theme_no_parent', sprintf( __( 'The parent theme is missing. Please install the "%s" parent theme.' ), $this->template ) );
|
||||
$this->errors = new WP_Error( 'theme_no_parent', sprintf( __( 'The parent theme is missing. Please install the "%s" parent theme.' ), esc_html( $this->template ) ) );
|
||||
$this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
|
||||
$this->parent = new WP_Theme( $this->template, $this->theme_root, $this );
|
||||
return;
|
||||
@@ -265,11 +265,11 @@ final class WP_Theme implements ArrayAccess {
|
||||
// If we are a parent, then there is a problem. Only two generations allowed! Cancel things out.
|
||||
if ( is_a( $_child, 'WP_Theme' ) && $_child->template == $this->stylesheet ) {
|
||||
$_child->parent = null;
|
||||
$_child->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), $_child->template ) );
|
||||
$_child->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), esc_html( $_child->template ) ) );
|
||||
$_child->cache_add( 'theme', array( 'headers' => $_child->headers, 'errors' => $_child->errors, 'stylesheet' => $_child->stylesheet, 'template' => $_child->template ) );
|
||||
// The two themes actually reference each other with the Template header.
|
||||
if ( $_child->stylesheet == $this->template ) {
|
||||
$this->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), $this->template ) );
|
||||
$this->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), esc_html( $this->template ) ) );
|
||||
$this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
|
||||
}
|
||||
return;
|
||||
@@ -641,8 +641,9 @@ final class WP_Theme implements ArrayAccess {
|
||||
private function markup_header( $header, $value, $translate ) {
|
||||
switch ( $header ) {
|
||||
case 'Name' :
|
||||
if ( empty( $value ) )
|
||||
$value = $this->get_stylesheet();
|
||||
if ( empty( $value ) ) {
|
||||
$value = esc_html( $this->get_stylesheet() );
|
||||
}
|
||||
break;
|
||||
case 'Description' :
|
||||
$value = wptexturize( $value );
|
||||
|
||||
@@ -273,6 +273,11 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
if ( isset($meta['id']) ) {
|
||||
$meta['id'] = (int) $meta['id'];
|
||||
$pmeta = get_metadata_by_mid( 'post', $meta['id'] );
|
||||
|
||||
if ( ! $pmeta || $pmeta->post_id != $post_id ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( isset($meta['key']) ) {
|
||||
$meta['key'] = wp_unslash( $meta['key'] );
|
||||
if ( $meta['key'] !== $pmeta->meta_key )
|
||||
@@ -990,6 +995,56 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
return $count > 1;
|
||||
}
|
||||
|
||||
private function _validate_boolean( $var ) {
|
||||
if ( is_bool( $var ) ) {
|
||||
return $var;
|
||||
}
|
||||
|
||||
if ( is_string( $var ) && 'false' === strtolower( $var ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool) $var;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulate the logic for sticking a post
|
||||
* and determining if the user has permission to do so
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access private
|
||||
*
|
||||
* @param array $post_data
|
||||
* @param bool $update
|
||||
* @return void|IXR_Error
|
||||
*/
|
||||
private function _toggle_sticky( $post_data, $update = false ) {
|
||||
$post_type = get_post_type_object( $post_data['post_type'] );
|
||||
|
||||
// Private and password-protected posts cannot be stickied.
|
||||
if ( 'private' === $post_data['post_status'] || ! empty( $post_data['post_password'] ) ) {
|
||||
// Error if the client tried to stick the post, otherwise, silently unstick.
|
||||
if ( ! empty( $post_data['sticky'] ) ) {
|
||||
return new IXR_Error( 401, __( 'Sorry, you cannot stick a private post.' ) );
|
||||
}
|
||||
|
||||
if ( $update ) {
|
||||
unstick_post( $post_data['ID'] );
|
||||
}
|
||||
} elseif ( isset( $post_data['sticky'] ) ) {
|
||||
if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) {
|
||||
return new IXR_Error( 401, __( 'Sorry, you are not allowed to stick this post.' ) );
|
||||
}
|
||||
|
||||
$sticky = $this->_validate_boolean( $post_data['sticky'] );
|
||||
if ( $sticky ) {
|
||||
stick_post( $post_data['ID'] );
|
||||
} else {
|
||||
unstick_post( $post_data['ID'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for wp_newPost and wp_editPost, containing shared logic.
|
||||
*
|
||||
@@ -1000,10 +1055,31 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
* @param array $content_struct Post data to insert.
|
||||
*/
|
||||
protected function _insert_post( $user, $content_struct ) {
|
||||
$defaults = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_author' => 0,
|
||||
'post_password' => '', 'post_excerpt' => '', 'post_content' => '', 'post_title' => '' );
|
||||
$defaults = array(
|
||||
'post_status' => 'draft',
|
||||
'post_type' => 'post',
|
||||
'post_author' => null,
|
||||
'post_password' => null,
|
||||
'post_excerpt' => null,
|
||||
'post_content' => null,
|
||||
'post_title' => null,
|
||||
'post_date' => null,
|
||||
'post_date_gmt' => null,
|
||||
'post_format' => null,
|
||||
'post_name' => null,
|
||||
'post_thumbnail' => null,
|
||||
'post_parent' => null,
|
||||
'ping_status' => null,
|
||||
'comment_status' => null,
|
||||
'custom_fields' => null,
|
||||
'terms_names' => null,
|
||||
'terms' => null,
|
||||
'sticky' => null,
|
||||
'enclosure' => null,
|
||||
'ID' => null,
|
||||
);
|
||||
|
||||
$post_data = wp_parse_args( $content_struct, $defaults );
|
||||
$post_data = wp_parse_args( array_intersect_key( $content_struct, $defaults ), $defaults );
|
||||
|
||||
$post_type = get_post_type_object( $post_data['post_type'] );
|
||||
if ( ! $post_type )
|
||||
@@ -1082,20 +1158,9 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$post_ID = $post_data['ID'];
|
||||
|
||||
if ( $post_data['post_type'] == 'post' ) {
|
||||
// Private and password-protected posts cannot be stickied.
|
||||
if ( $post_data['post_status'] == 'private' || ! empty( $post_data['post_password'] ) ) {
|
||||
// Error if the client tried to stick the post, otherwise, silently unstick.
|
||||
if ( ! empty( $post_data['sticky'] ) )
|
||||
return new IXR_Error( 401, __( 'Sorry, you cannot stick a private post.' ) );
|
||||
if ( $update )
|
||||
unstick_post( $post_ID );
|
||||
} elseif ( isset( $post_data['sticky'] ) ) {
|
||||
if ( ! current_user_can( $post_type->cap->edit_others_posts ) )
|
||||
return new IXR_Error( 401, __( 'Sorry, you are not allowed to stick this post.' ) );
|
||||
if ( $post_data['sticky'] )
|
||||
stick_post( $post_ID );
|
||||
else
|
||||
unstick_post( $post_ID );
|
||||
$error = $this->_toggle_sticky( $post_data, $update );
|
||||
if ( $error ) {
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1194,9 +1259,6 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$post_data['tax_input'] = $terms;
|
||||
unset( $post_data['terms'], $post_data['terms_names'] );
|
||||
} else {
|
||||
// do not allow direct submission of 'tax_input', clients must use 'terms' and/or 'terms_names'
|
||||
unset( $post_data['tax_input'], $post_data['post_category'], $post_data['tags_input'] );
|
||||
}
|
||||
|
||||
if ( isset( $post_data['post_format'] ) ) {
|
||||
@@ -4272,10 +4334,12 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
// Only posts can be sticky
|
||||
if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) {
|
||||
if ( $content_struct['sticky'] == true )
|
||||
stick_post( $post_ID );
|
||||
elseif ( $content_struct['sticky'] == false )
|
||||
unstick_post( $post_ID );
|
||||
$data = $postdata;
|
||||
$data['sticky'] = $content_struct['sticky'];
|
||||
$error = $this->_toggle_sticky( $data );
|
||||
if ( $error ) {
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset($content_struct['custom_fields']) )
|
||||
@@ -4539,11 +4603,12 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : null;
|
||||
|
||||
if ( ('publish' == $post_status) ) {
|
||||
if ( ( 'page' == $post_type ) && !current_user_can('publish_pages') )
|
||||
return new IXR_Error(401, __('Sorry, you do not have the right to publish this page.'));
|
||||
else if ( !current_user_can('publish_posts') )
|
||||
return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.'));
|
||||
if ( 'publish' == $post_status || 'private' == $post_status ) {
|
||||
if ( 'page' == $post_type && ! current_user_can( 'publish_pages' ) ) {
|
||||
return new IXR_Error( 401, __( 'Sorry, you do not have the right to publish this page.' ) );
|
||||
} elseif ( ! current_user_can( 'publish_posts' ) ) {
|
||||
return new IXR_Error( 401, __( 'Sorry, you do not have the right to publish this post.' ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $post_more )
|
||||
@@ -4583,10 +4648,13 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
// Only posts can be sticky
|
||||
if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) {
|
||||
if ( $content_struct['sticky'] == true )
|
||||
stick_post( $post_ID );
|
||||
elseif ( $content_struct['sticky'] == false )
|
||||
unstick_post( $post_ID );
|
||||
$data = $newpost;
|
||||
$data['sticky'] = $content_struct['sticky'];
|
||||
$data['post_type'] = 'post';
|
||||
$error = $this->_toggle_sticky( $data, true );
|
||||
if ( $error ) {
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset($content_struct['custom_fields']) )
|
||||
|
||||
@@ -13,23 +13,141 @@ if ( !function_exists('_') ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( !function_exists('mb_substr') ):
|
||||
function mb_substr( $str, $start, $length=null, $encoding=null ) {
|
||||
return _mb_substr($str, $start, $length, $encoding);
|
||||
/**
|
||||
* Returns whether PCRE/u (PCRE_UTF8 modifier) is available for use.
|
||||
*
|
||||
* @ignore
|
||||
* @since 4.2.2
|
||||
* @access private
|
||||
*
|
||||
* @param bool $set - Used for testing only
|
||||
* null : default - get PCRE/u capability
|
||||
* false : Used for testing - return false for future calls to this function
|
||||
* 'reset': Used for testing - restore default behavior of this function
|
||||
*/
|
||||
function _wp_can_use_pcre_u( $set = null ) {
|
||||
static $utf8_pcre = 'reset';
|
||||
|
||||
if ( null !== $set ) {
|
||||
$utf8_pcre = $set;
|
||||
}
|
||||
|
||||
if ( 'reset' === $utf8_pcre ) {
|
||||
$utf8_pcre = @preg_match( '/^./u', 'a' );
|
||||
}
|
||||
|
||||
return $utf8_pcre;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'mb_substr' ) ) :
|
||||
function mb_substr( $str, $start, $length = null, $encoding = null ) {
|
||||
return _mb_substr( $str, $start, $length, $encoding );
|
||||
}
|
||||
endif;
|
||||
|
||||
function _mb_substr( $str, $start, $length=null, $encoding=null ) {
|
||||
// the solution below, works only for utf-8, so in case of a different
|
||||
// charset, just use built-in substr
|
||||
$charset = get_option( 'blog_charset' );
|
||||
if ( !in_array( $charset, array('utf8', 'utf-8', 'UTF8', 'UTF-8') ) ) {
|
||||
return is_null( $length )? substr( $str, $start ) : substr( $str, $start, $length);
|
||||
/*
|
||||
* Only understands UTF-8 and 8bit. All other character sets will be treated as 8bit.
|
||||
* For $encoding === UTF-8, the $str input is expected to be a valid UTF-8 byte sequence.
|
||||
* The behavior of this function for invalid inputs is undefined.
|
||||
*/
|
||||
function _mb_substr( $str, $start, $length = null, $encoding = null ) {
|
||||
if ( null === $encoding ) {
|
||||
$encoding = get_option( 'blog_charset' );
|
||||
}
|
||||
// use the regex unicode support to separate the UTF-8 characters into an array
|
||||
preg_match_all( '/./us', $str, $match );
|
||||
$chars = is_null( $length )? array_slice( $match[0], $start ) : array_slice( $match[0], $start, $length );
|
||||
return implode( '', $chars );
|
||||
|
||||
// The solution below works only for UTF-8,
|
||||
// so in case of a different charset just use built-in substr()
|
||||
if ( ! in_array( $encoding, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
|
||||
return is_null( $length ) ? substr( $str, $start ) : substr( $str, $start, $length );
|
||||
}
|
||||
|
||||
if ( _wp_can_use_pcre_u() ) {
|
||||
// Use the regex unicode support to separate the UTF-8 characters into an array
|
||||
preg_match_all( '/./us', $str, $match );
|
||||
$chars = is_null( $length ) ? array_slice( $match[0], $start ) : array_slice( $match[0], $start, $length );
|
||||
return implode( '', $chars );
|
||||
}
|
||||
|
||||
$regex = '/(
|
||||
[\x00-\x7F] # single-byte sequences 0xxxxxxx
|
||||
| [\xC2-\xDF][\x80-\xBF] # double-byte sequences 110xxxxx 10xxxxxx
|
||||
| \xE0[\xA0-\xBF][\x80-\xBF] # triple-byte sequences 1110xxxx 10xxxxxx * 2
|
||||
| [\xE1-\xEC][\x80-\xBF]{2}
|
||||
| \xED[\x80-\x9F][\x80-\xBF]
|
||||
| [\xEE-\xEF][\x80-\xBF]{2}
|
||||
| \xF0[\x90-\xBF][\x80-\xBF]{2} # four-byte sequences 11110xxx 10xxxxxx * 3
|
||||
| [\xF1-\xF3][\x80-\xBF]{3}
|
||||
| \xF4[\x80-\x8F][\x80-\xBF]{2}
|
||||
)/x';
|
||||
|
||||
$chars = array( '' ); // Start with 1 element instead of 0 since the first thing we do is pop
|
||||
do {
|
||||
// We had some string left over from the last round, but we counted it in that last round.
|
||||
array_pop( $chars );
|
||||
|
||||
// Split by UTF-8 character, limit to 1000 characters (last array element will contain the rest of the string)
|
||||
$pieces = preg_split( $regex, $str, 1000, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
|
||||
|
||||
$chars = array_merge( $chars, $pieces );
|
||||
} while ( count( $pieces ) > 1 && $str = array_pop( $pieces ) ); // If there's anything left over, repeat the loop.
|
||||
|
||||
return join( '', array_slice( $chars, $start, $length ) );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'mb_strlen' ) ) :
|
||||
function mb_strlen( $str, $encoding = null ) {
|
||||
return _mb_strlen( $str, $encoding );
|
||||
}
|
||||
endif;
|
||||
|
||||
/*
|
||||
* Only understands UTF-8 and 8bit. All other character sets will be treated as 8bit.
|
||||
* For $encoding === UTF-8, the $str input is expected to be a valid UTF-8 byte sequence.
|
||||
* The behavior of this function for invalid inputs is undefined.
|
||||
*/
|
||||
function _mb_strlen( $str, $encoding = null ) {
|
||||
if ( null === $encoding ) {
|
||||
$encoding = get_option( 'blog_charset' );
|
||||
}
|
||||
|
||||
// The solution below works only for UTF-8,
|
||||
// so in case of a different charset just use built-in strlen()
|
||||
if ( ! in_array( $encoding, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
|
||||
return strlen( $str );
|
||||
}
|
||||
|
||||
if ( _wp_can_use_pcre_u() ) {
|
||||
// Use the regex unicode support to separate the UTF-8 characters into an array
|
||||
preg_match_all( '/./us', $str, $match );
|
||||
return count( $match[0] );
|
||||
}
|
||||
|
||||
$regex = '/(?:
|
||||
[\x00-\x7F] # single-byte sequences 0xxxxxxx
|
||||
| [\xC2-\xDF][\x80-\xBF] # double-byte sequences 110xxxxx 10xxxxxx
|
||||
| \xE0[\xA0-\xBF][\x80-\xBF] # triple-byte sequences 1110xxxx 10xxxxxx * 2
|
||||
| [\xE1-\xEC][\x80-\xBF]{2}
|
||||
| \xED[\x80-\x9F][\x80-\xBF]
|
||||
| [\xEE-\xEF][\x80-\xBF]{2}
|
||||
| \xF0[\x90-\xBF][\x80-\xBF]{2} # four-byte sequences 11110xxx 10xxxxxx * 3
|
||||
| [\xF1-\xF3][\x80-\xBF]{3}
|
||||
| \xF4[\x80-\x8F][\x80-\xBF]{2}
|
||||
)/x';
|
||||
|
||||
$count = 1; // Start at 1 instead of 0 since the first thing we do is decrement
|
||||
do {
|
||||
// We had some string left over from the last round, but we counted it in that last round.
|
||||
$count--;
|
||||
|
||||
// Split by UTF-8 character, limit to 1000 characters (last array element will contain the rest of the string)
|
||||
$pieces = preg_split( $regex, $str, 1000 );
|
||||
|
||||
// Increment
|
||||
$count += count( $pieces );
|
||||
} while ( $str = array_pop( $pieces ) ); // If there's anything left over, repeat the loop.
|
||||
|
||||
// Fencepost: preg_split() always returns one extra item in the array
|
||||
return --$count;
|
||||
}
|
||||
|
||||
if ( !function_exists('hash_hmac') ):
|
||||
|
||||
@@ -1144,7 +1144,7 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
|
||||
?>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
|
||||
<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" />
|
||||
<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $title ); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('nav_menu'); ?>"><?php _e('Select Menu:'); ?></label>
|
||||
|
||||
@@ -233,6 +233,10 @@ function wpautop($pee, $br = true) {
|
||||
$pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee);
|
||||
$pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee);
|
||||
$pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
|
||||
|
||||
// Find newlines in all elements and add placeholders.
|
||||
$pee = wp_replace_in_html_tags( $pee, array( "\n" => " <!-- wpnl --> " ) );
|
||||
|
||||
if ( strpos($pee, '<object') !== false ) {
|
||||
$pee = preg_replace('|\s*<param([^>]*)>\s*|', "<param$1>", $pee); // no pee inside object/embed
|
||||
$pee = preg_replace('|\s*</embed>\s*|', '</embed>', $pee);
|
||||
@@ -263,9 +267,109 @@ function wpautop($pee, $br = true) {
|
||||
if ( !empty($pre_tags) )
|
||||
$pee = str_replace(array_keys($pre_tags), array_values($pre_tags), $pee);
|
||||
|
||||
// Restore newlines in all elements.
|
||||
$pee = str_replace( " <!-- wpnl --> ", "\n", $pee );
|
||||
|
||||
return $pee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Separate HTML elements and comments from the text.
|
||||
*
|
||||
* @since 4.2.4
|
||||
*
|
||||
* @param string $input The text which has to be formatted.
|
||||
* @return array The formatted text.
|
||||
*/
|
||||
function wp_html_split( $input ) {
|
||||
static $regex;
|
||||
|
||||
if ( ! isset( $regex ) ) {
|
||||
$comments =
|
||||
'!' // Start of comment, after the <.
|
||||
. '(?:' // Unroll the loop: Consume everything until --> is found.
|
||||
. '-(?!->)' // Dash not followed by end of comment.
|
||||
. '[^\-]*+' // Consume non-dashes.
|
||||
. ')*+' // Loop possessively.
|
||||
. '(?:-->)?'; // End of comment. If not found, match all input.
|
||||
|
||||
$cdata =
|
||||
'!\[CDATA\[' // Start of comment, after the <.
|
||||
. '[^\]]*+' // Consume non-].
|
||||
. '(?:' // Unroll the loop: Consume everything until ]]> is found.
|
||||
. '](?!]>)' // One ] not followed by end of comment.
|
||||
. '[^\]]*+' // Consume non-].
|
||||
. ')*+' // Loop possessively.
|
||||
. '(?:]]>)?'; // End of comment. If not found, match all input.
|
||||
|
||||
$regex =
|
||||
'/(' // Capture the entire match.
|
||||
. '<' // Find start of element.
|
||||
. '(?(?=!--)' // Is this a comment?
|
||||
. $comments // Find end of comment.
|
||||
. '|'
|
||||
. '(?(?=!\[CDATA\[)' // Is this a comment?
|
||||
. $cdata // Find end of comment.
|
||||
. '|'
|
||||
. '[^>]*>?' // Find end of element. If not found, match all input.
|
||||
. ')'
|
||||
. ')'
|
||||
. ')/s';
|
||||
}
|
||||
|
||||
return preg_split( $regex, $input, -1, PREG_SPLIT_DELIM_CAPTURE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace characters or phrases within HTML elements only.
|
||||
*
|
||||
* @since 4.2.3
|
||||
*
|
||||
* @param string $haystack The text which has to be formatted.
|
||||
* @param array $replace_pairs In the form array('from' => 'to', ...).
|
||||
* @return string The formatted text.
|
||||
*/
|
||||
function wp_replace_in_html_tags( $haystack, $replace_pairs ) {
|
||||
// Find all elements.
|
||||
$textarr = wp_html_split( $haystack );
|
||||
$changed = false;
|
||||
|
||||
// Optimize when searching for one item.
|
||||
if ( 1 === count( $replace_pairs ) ) {
|
||||
// Extract $needle and $replace.
|
||||
foreach ( $replace_pairs as $needle => $replace );
|
||||
|
||||
// Loop through delimeters (elements) only.
|
||||
for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {
|
||||
if ( false !== strpos( $textarr[$i], $needle ) ) {
|
||||
$textarr[$i] = str_replace( $needle, $replace, $textarr[$i] );
|
||||
$changed = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Extract all $needles.
|
||||
$needles = array_keys( $replace_pairs );
|
||||
|
||||
// Loop through delimeters (elements) only.
|
||||
for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {
|
||||
foreach ( $needles as $needle ) {
|
||||
if ( false !== strpos( $textarr[$i], $needle ) ) {
|
||||
$textarr[$i] = strtr( $textarr[$i], $replace_pairs );
|
||||
$changed = true;
|
||||
// After one strtr() break out of the foreach loop and look at next element.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $changed ) {
|
||||
$haystack = implode( $textarr );
|
||||
}
|
||||
|
||||
return $haystack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Newline preservation help function for wpautop
|
||||
*
|
||||
@@ -841,7 +945,8 @@ function remove_accents($string) {
|
||||
* operating systems and special characters requiring special escaping
|
||||
* to manipulate at the command line. Replaces spaces and consecutive
|
||||
* dashes with a single dash. Trims period, dash and underscore from beginning
|
||||
* and end of filename.
|
||||
* and end of filename. It is not guaranteed that this function will return a
|
||||
* filename that is allowed to be uploaded.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*
|
||||
@@ -856,6 +961,14 @@ function sanitize_file_name( $filename ) {
|
||||
$filename = preg_replace('/[\s-]+/', '-', $filename);
|
||||
$filename = trim($filename, '.-_');
|
||||
|
||||
if ( false === strpos( $filename, '.' ) ) {
|
||||
$mime_types = wp_get_mime_types();
|
||||
$filetype = wp_check_filetype( 'test.' . $filename, $mime_types );
|
||||
if ( $filetype['ext'] === $filename ) {
|
||||
$filename = 'unnamed-file.' . $filetype['ext'];
|
||||
}
|
||||
}
|
||||
|
||||
// Split the filename into a base and extension[s]
|
||||
$parts = explode('.', $filename);
|
||||
|
||||
@@ -1053,21 +1166,23 @@ function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'displa
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures a string is a valid SQL order by clause.
|
||||
* Ensures a string is a valid SQL 'order by' clause.
|
||||
*
|
||||
* Accepts one or more columns, with or without ASC/DESC, and also accepts
|
||||
* RAND().
|
||||
* Accepts one or more columns, with or without a sort order (ASC / DESC).
|
||||
* e.g. 'column_1', 'column_1, column_2', 'column_1 ASC, column_2 DESC' etc.
|
||||
*
|
||||
* Also accepts 'RAND()'.
|
||||
*
|
||||
* @since 2.5.1
|
||||
*
|
||||
* @param string $orderby Order by string to be checked.
|
||||
* @return string|bool Returns the order by clause if it is a match, false otherwise.
|
||||
* @param string $orderby Order by clause to be validated.
|
||||
* @return string|bool Returns $orderby if valid, false otherwise.
|
||||
*/
|
||||
function sanitize_sql_orderby( $orderby ){
|
||||
preg_match('/^\s*([a-z0-9_]+(\s+(ASC|DESC))?(\s*,\s*|\s*$))+|^\s*RAND\(\s*\)\s*$/i', $orderby, $obmatches);
|
||||
if ( !$obmatches )
|
||||
return false;
|
||||
return $orderby;
|
||||
function sanitize_sql_orderby( $orderby ) {
|
||||
if ( preg_match( '/^\s*(([a-z0-9_]+|`[a-z0-9_]+`)(\s+(ASC|DESC))?\s*(,\s*(?=[a-z0-9_`])|$))+$/i', $orderby ) || preg_match( '/^\s*RAND\(\s*\)\s*$/i', $orderby ) ) {
|
||||
return $orderby;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1878,7 +1878,7 @@ function wp_check_filetype( $filename, $mimes = null ) {
|
||||
* If it's determined that the extension does not match the file's real type,
|
||||
* then the "proper_filename" value will be set with a proper filename and extension.
|
||||
*
|
||||
* Currently this function only supports validating images known to getimagesize().
|
||||
* Currently this function only supports renaming images validated via wp_get_image_mime().
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
@@ -1899,14 +1899,15 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
|
||||
if ( ! file_exists( $file ) )
|
||||
return compact( 'ext', 'type', 'proper_filename' );
|
||||
|
||||
// We're able to validate images using GD
|
||||
if ( $type && 0 === strpos( $type, 'image/' ) && function_exists('getimagesize') ) {
|
||||
// Validate image types.
|
||||
if ( $type && 0 === strpos( $type, 'image/' ) ) {
|
||||
|
||||
// Attempt to figure out what type of image it actually is
|
||||
$imgstats = @getimagesize( $file );
|
||||
$real_mime = wp_get_image_mime( $file );
|
||||
|
||||
// If getimagesize() knows what kind of image it really is and if the real MIME doesn't match the claimed MIME
|
||||
if ( !empty($imgstats['mime']) && $imgstats['mime'] != $type ) {
|
||||
if ( ! $real_mime ) {
|
||||
$type = $ext = false;
|
||||
} elseif ( $real_mime != $type ) {
|
||||
// This is a simplified array of MIMEs that getimagesize() can detect and their extensions
|
||||
// You shouldn't need to use this filter, but it's here just in case
|
||||
$mime_to_ext = apply_filters( 'getimagesize_mimes_to_exts', array(
|
||||
@@ -1918,10 +1919,10 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
|
||||
) );
|
||||
|
||||
// Replace whatever is after the last period in the filename with the correct extension
|
||||
if ( ! empty( $mime_to_ext[ $imgstats['mime'] ] ) ) {
|
||||
if ( ! empty( $mime_to_ext[ $real_mime ] ) ) {
|
||||
$filename_parts = explode( '.', $filename );
|
||||
array_pop( $filename_parts );
|
||||
$filename_parts[] = $mime_to_ext[ $imgstats['mime'] ];
|
||||
$filename_parts[] = $mime_to_ext[ $real_mime ];
|
||||
$new_filename = implode( '.', $filename_parts );
|
||||
|
||||
if ( $new_filename != $filename )
|
||||
@@ -1930,8 +1931,20 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
|
||||
// Redefine the extension / MIME
|
||||
$wp_filetype = wp_check_filetype( $new_filename, $mimes );
|
||||
extract( $wp_filetype );
|
||||
} else {
|
||||
$type = $ext = false;
|
||||
}
|
||||
}
|
||||
} elseif ( function_exists( 'finfo_file' ) ) {
|
||||
// Use finfo_file if available to validate non-image files.
|
||||
$finfo = finfo_open( FILEINFO_MIME_TYPE );
|
||||
$real_mime = finfo_file( $finfo, $file );
|
||||
finfo_close( $finfo );
|
||||
|
||||
// If the extension does not match the file's real type, return false.
|
||||
if ( $real_mime !== $type ) {
|
||||
$type = $ext = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Let plugins try and validate other types of files
|
||||
@@ -1939,6 +1952,38 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
|
||||
return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the real mime type of an image file.
|
||||
*
|
||||
* This depends on exif_imagetype() or getimagesize() to determine real mime types.
|
||||
*
|
||||
* @since 4.7.1
|
||||
*
|
||||
* @param string $file Full path to the file.
|
||||
* @return string|false The actual mime type or false if the type cannot be determined.
|
||||
*/
|
||||
function wp_get_image_mime( $file ) {
|
||||
/*
|
||||
* Use exif_imagetype() to check the mimetype if available or fall back to
|
||||
* getimagesize() if exif isn't avaialbe. If either function throws an Exception
|
||||
* we assume the file could not be validated.
|
||||
*/
|
||||
try {
|
||||
if ( is_callable( 'exif_imagetype' ) ) {
|
||||
$mime = image_type_to_mime_type( exif_imagetype( $file ) );
|
||||
} elseif ( function_exists( 'getimagesize' ) ) {
|
||||
$imagesize = getimagesize( $file );
|
||||
$mime = ( isset( $imagesize['mime'] ) ) ? $imagesize['mime'] : false;
|
||||
} else {
|
||||
$mime = false;
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
$mime = false;
|
||||
}
|
||||
|
||||
return $mime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve list of mime types and file extensions.
|
||||
*
|
||||
|
||||
@@ -472,7 +472,7 @@ function wp_http_validate_url( $url ) {
|
||||
|
||||
if ( ! $same_host ) {
|
||||
$host = trim( $parsed_url['host'], '.' );
|
||||
if ( preg_match( '#^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $host ) ) {
|
||||
if ( preg_match( '#^(([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)\.){3}([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)$#', $host ) ) {
|
||||
$ip = $host;
|
||||
} else {
|
||||
$ip = gethostbyname( $host );
|
||||
@@ -481,7 +481,7 @@ function wp_http_validate_url( $url ) {
|
||||
}
|
||||
if ( $ip ) {
|
||||
$parts = array_map( 'intval', explode( '.', $ip ) );
|
||||
if ( 127 === $parts[0] || 10 === $parts[0]
|
||||
if ( 127 === $parts[0] || 10 === $parts[0] || 0 === $parts[0]
|
||||
|| ( 172 === $parts[0] && 16 <= $parts[1] && 31 >= $parts[1] )
|
||||
|| ( 192 === $parts[0] && 168 === $parts[1] )
|
||||
) {
|
||||
|
||||
@@ -334,15 +334,24 @@ function uploadError(fileObj, errorCode, message, uploader) {
|
||||
}
|
||||
}
|
||||
|
||||
function uploadSizeError( up, file, over100mb ) {
|
||||
var message;
|
||||
function uploadSizeError( up, file ) {
|
||||
var message, errorDiv;
|
||||
|
||||
if ( over100mb )
|
||||
message = pluploadL10n.big_upload_queued.replace('%s', file.name) + ' ' + pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>');
|
||||
else
|
||||
message = pluploadL10n.file_exceeds_size_limit.replace('%s', file.name);
|
||||
message = pluploadL10n.file_exceeds_size_limit.replace('%s', file.name);
|
||||
|
||||
jQuery('#media-items').append('<div id="media-item-' + file.id + '" class="media-item error"><p>' + message + '</p></div>');
|
||||
// Construct the error div.
|
||||
errorDiv = jQuery( '<div />' )
|
||||
.attr( {
|
||||
'id': 'media-item-' + file.id,
|
||||
'class': 'media-item error'
|
||||
} )
|
||||
.append(
|
||||
jQuery( '<p />' )
|
||||
.text( message )
|
||||
);
|
||||
|
||||
// Append the error.
|
||||
jQuery('#media-items').append( errorDiv );
|
||||
up.removeFile(file);
|
||||
}
|
||||
|
||||
|
||||
2
wp-includes/js/plupload/handlers.min.js
vendored
2
wp-includes/js/plupload/handlers.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -164,6 +164,13 @@ var wpLink;
|
||||
|
||||
attrs = wpLink.getAttrs();
|
||||
|
||||
var parser = document.createElement( 'a' );
|
||||
parser.href = attrs.href;
|
||||
|
||||
if ( 'javascript:' === parser.protocol || 'data:' === parser.protocol ) { // jshint ignore:line
|
||||
attrs.href = '';
|
||||
}
|
||||
|
||||
// If there's no href, return.
|
||||
if ( ! attrs.href || attrs.href == 'http://' )
|
||||
return;
|
||||
@@ -174,7 +181,7 @@ var wpLink;
|
||||
if ( attrs.title )
|
||||
html += ' title="' + attrs.title + '"';
|
||||
if ( attrs.target )
|
||||
html += ' target="' + attrs.target + '"';
|
||||
html += ' rel="noopener" target="' + attrs.target + '"';
|
||||
|
||||
html += '>';
|
||||
|
||||
@@ -221,6 +228,13 @@ var wpLink;
|
||||
tinyMCEPopup.restoreSelection();
|
||||
e = ed.dom.getParent(ed.selection.getNode(), 'A');
|
||||
|
||||
var parser = document.createElement( 'a' );
|
||||
parser.href = attrs.href;
|
||||
|
||||
if ( 'javascript:' === parser.protocol || 'data:' === parser.protocol ) { // jshint ignore:line
|
||||
attrs.href = '';
|
||||
}
|
||||
|
||||
// If the values are empty, unlink and return
|
||||
if ( ! attrs.href || attrs.href == 'http://' ) {
|
||||
if ( e ) {
|
||||
|
||||
2
wp-includes/js/wplink.min.js
vendored
2
wp-includes/js/wplink.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -484,6 +484,82 @@ function wp_kses( $string, $allowed_html, $allowed_protocols = array() ) {
|
||||
return wp_kses_split($string, $allowed_html, $allowed_protocols);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters one attribute only and ensures its value is allowed.
|
||||
*
|
||||
* This function has the advantage of being more secure than esc_attr() and can
|
||||
* escape data in some situations where wp_kses() must strip the whole attribute.
|
||||
*
|
||||
* @since 4.2.3
|
||||
*
|
||||
* @param string $string The 'whole' attribute, including name and value.
|
||||
* @param string $element The element name to which the attribute belongs.
|
||||
* @return string Filtered attribute.
|
||||
*/
|
||||
function wp_kses_one_attr( $string, $element ) {
|
||||
$uris = array('xmlns', 'profile', 'href', 'src', 'cite', 'classid', 'codebase', 'data', 'usemap', 'longdesc', 'action');
|
||||
$allowed_html = wp_kses_allowed_html( 'post' );
|
||||
$allowed_protocols = wp_allowed_protocols();
|
||||
$string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) );
|
||||
$string = wp_kses_js_entities( $string );
|
||||
$string = wp_kses_normalize_entities( $string );
|
||||
|
||||
// Preserve leading and trailing whitespace.
|
||||
$matches = array();
|
||||
preg_match('/^\s*/', $string, $matches);
|
||||
$lead = $matches[0];
|
||||
preg_match('/\s*$/', $string, $matches);
|
||||
$trail = $matches[0];
|
||||
if ( empty( $trail ) ) {
|
||||
$string = substr( $string, strlen( $lead ) );
|
||||
} else {
|
||||
$string = substr( $string, strlen( $lead ), -strlen( $trail ) );
|
||||
}
|
||||
|
||||
// Parse attribute name and value from input.
|
||||
$split = preg_split( '/\s*=\s*/', $string, 2 );
|
||||
$name = $split[0];
|
||||
if ( count( $split ) == 2 ) {
|
||||
$value = $split[1];
|
||||
|
||||
// Remove quotes surrounding $value.
|
||||
// Also guarantee correct quoting in $string for this one attribute.
|
||||
if ( '' == $value ) {
|
||||
$quote = '';
|
||||
} else {
|
||||
$quote = $value[0];
|
||||
}
|
||||
if ( '"' == $quote || "'" == $quote ) {
|
||||
if ( substr( $value, -1 ) != $quote ) {
|
||||
return '';
|
||||
}
|
||||
$value = substr( $value, 1, -1 );
|
||||
} else {
|
||||
$quote = '"';
|
||||
}
|
||||
|
||||
// Sanitize quotes and angle braces.
|
||||
$value = htmlspecialchars( $value, ENT_QUOTES, null, false );
|
||||
|
||||
// Sanitize URI values.
|
||||
if ( in_array( strtolower( $name ), $uris ) ) {
|
||||
$value = wp_kses_bad_protocol( $value, $allowed_protocols );
|
||||
}
|
||||
|
||||
$string = "$name=$quote$value$quote";
|
||||
$vless = 'n';
|
||||
} else {
|
||||
$value = '';
|
||||
$vless = 'y';
|
||||
}
|
||||
|
||||
// Sanitize attribute by name.
|
||||
wp_kses_attr_check( $name, $value, $string, $vless, $element, $allowed_html );
|
||||
|
||||
// Restore whitespace.
|
||||
return $lead . $string . $trail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of allowed tags and attributes for a given context.
|
||||
*
|
||||
@@ -681,45 +757,11 @@ function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) {
|
||||
# Go through $attrarr, and save the allowed attributes for this element
|
||||
# in $attr2
|
||||
$attr2 = '';
|
||||
|
||||
$allowed_attr = $allowed_html[strtolower($element)];
|
||||
foreach ($attrarr as $arreach) {
|
||||
if ( ! isset( $allowed_attr[strtolower($arreach['name'])] ) )
|
||||
continue; # the attribute is not allowed
|
||||
|
||||
$current = $allowed_attr[strtolower($arreach['name'])];
|
||||
if ( $current == '' )
|
||||
continue; # the attribute is not allowed
|
||||
|
||||
if ( strtolower( $arreach['name'] ) == 'style' ) {
|
||||
$orig_value = $arreach['value'];
|
||||
$value = safecss_filter_attr( $orig_value );
|
||||
|
||||
if ( empty( $value ) )
|
||||
continue;
|
||||
|
||||
$arreach['value'] = $value;
|
||||
$arreach['whole'] = str_replace( $orig_value, $value, $arreach['whole'] );
|
||||
}
|
||||
|
||||
if ( ! is_array($current) ) {
|
||||
foreach ( $attrarr as $arreach ) {
|
||||
if ( wp_kses_attr_check( $arreach['name'], $arreach['value'], $arreach['whole'], $arreach['vless'], $element, $allowed_html ) ) {
|
||||
$attr2 .= ' '.$arreach['whole'];
|
||||
# there are no checks
|
||||
|
||||
} else {
|
||||
# there are some checks
|
||||
$ok = true;
|
||||
foreach ($current as $currkey => $currval) {
|
||||
if ( ! wp_kses_check_attr_val($arreach['value'], $arreach['vless'], $currkey, $currval) ) {
|
||||
$ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $ok )
|
||||
$attr2 .= ' '.$arreach['whole']; # it passed them
|
||||
} # if !is_array($current)
|
||||
} # foreach
|
||||
}
|
||||
}
|
||||
|
||||
# Remove any "<" or ">" characters
|
||||
$attr2 = preg_replace('/[<>]/', '', $attr2);
|
||||
@@ -727,6 +769,53 @@ function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) {
|
||||
return "<$element$attr2$xhtml_slash>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether an attribute is allowed.
|
||||
*
|
||||
* @since 4.2.3
|
||||
*
|
||||
* @param string $name The attribute name. Returns empty string when not allowed.
|
||||
* @param string $value The attribute value. Returns a filtered value.
|
||||
* @param string $whole The name=value input. Returns filtered input.
|
||||
* @param string $vless 'y' when attribute like "enabled", otherwise 'n'.
|
||||
* @param string $element The name of the element to which this attribute belongs.
|
||||
* @param array $allowed_html The full list of allowed elements and attributes.
|
||||
* @return bool Is the attribute allowed?
|
||||
*/
|
||||
function wp_kses_attr_check( &$name, &$value, &$whole, $vless, $element, $allowed_html ) {
|
||||
$allowed_attr = $allowed_html[strtolower( $element )];
|
||||
|
||||
$name_low = strtolower( $name );
|
||||
if ( ! isset( $allowed_attr[$name_low] ) || '' == $allowed_attr[$name_low] ) {
|
||||
$name = $value = $whole = '';
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( 'style' == $name_low ) {
|
||||
$new_value = safecss_filter_attr( $value );
|
||||
|
||||
if ( empty( $new_value ) ) {
|
||||
$name = $value = $whole = '';
|
||||
return false;
|
||||
}
|
||||
|
||||
$whole = str_replace( $value, $new_value, $whole );
|
||||
$value = $new_value;
|
||||
}
|
||||
|
||||
if ( is_array( $allowed_attr[$name_low] ) ) {
|
||||
// there are some checks
|
||||
foreach ( $allowed_attr[$name_low] as $currkey => $currval ) {
|
||||
if ( ! wp_kses_check_attr_val( $value, $vless, $currkey, $currval ) ) {
|
||||
$name = $value = $whole = '';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an attribute list from string containing attributes.
|
||||
*
|
||||
@@ -856,6 +945,109 @@ function wp_kses_hair($attr, $allowed_protocols) {
|
||||
return $attrarr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all attributes of an HTML element.
|
||||
*
|
||||
* Does not modify input. May return "evil" output.
|
||||
*
|
||||
* Based on wp_kses_split2() and wp_kses_attr()
|
||||
*
|
||||
* @since 4.2.3
|
||||
*
|
||||
* @param string $element HTML element/tag
|
||||
* @return array|bool List of attributes found in $element. Returns false on failure.
|
||||
*/
|
||||
function wp_kses_attr_parse( $element ) {
|
||||
$valid = preg_match('%^(<\s*)(/\s*)?([a-zA-Z0-9]+\s*)([^>]*)(>?)$%', $element, $matches);
|
||||
if ( 1 !== $valid ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$begin = $matches[1];
|
||||
$slash = $matches[2];
|
||||
$elname = $matches[3];
|
||||
$attr = $matches[4];
|
||||
$end = $matches[5];
|
||||
|
||||
if ( '' !== $slash ) {
|
||||
// Closing elements do not get parsed.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Is there a closing XHTML slash at the end of the attributes?
|
||||
if ( 1 === preg_match( '%\s*/\s*$%', $attr, $matches ) ) {
|
||||
$xhtml_slash = $matches[0];
|
||||
$attr = substr( $attr, 0, -strlen( $xhtml_slash ) );
|
||||
} else {
|
||||
$xhtml_slash = '';
|
||||
}
|
||||
|
||||
// Split it
|
||||
$attrarr = wp_kses_hair_parse( $attr );
|
||||
if ( false === $attrarr ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure all input is returned by adding front and back matter.
|
||||
array_unshift( $attrarr, $begin . $slash . $elname );
|
||||
array_push( $attrarr, $xhtml_slash . $end );
|
||||
|
||||
return $attrarr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an attribute list from string containing attributes.
|
||||
*
|
||||
* Does not modify input. May return "evil" output.
|
||||
* In case of unexpected input, returns false instead of stripping things.
|
||||
*
|
||||
* Based on wp_kses_hair() but does not return a multi-dimensional array.
|
||||
*
|
||||
* @since 4.2.3
|
||||
*
|
||||
* @param string $attr Attribute list from HTML element to closing HTML element tag
|
||||
* @return array|bool List of attributes found in $attr. Returns false on failure.
|
||||
*/
|
||||
function wp_kses_hair_parse( $attr ) {
|
||||
if ( '' === $attr ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$regex =
|
||||
'(?:'
|
||||
. '[-a-zA-Z:]+' // Attribute name.
|
||||
. '|'
|
||||
. '\[\[?[^\[\]]+\]\]?' // Shortcode in the name position implies unfiltered_html.
|
||||
. ')'
|
||||
. '(?:' // Attribute value.
|
||||
. '\s*=\s*' // All values begin with '='
|
||||
. '(?:'
|
||||
. '"[^"]*"' // Double-quoted
|
||||
. '|'
|
||||
. "'[^']*'" // Single-quoted
|
||||
. '|'
|
||||
. '[^\s"\']+' // Non-quoted
|
||||
. '(?:\s|$)' // Must have a space
|
||||
. ')'
|
||||
. '|'
|
||||
. '(?:\s|$)' // If attribute has no value, space is required.
|
||||
. ')'
|
||||
. '\s*'; // Trailing space is optional except as mentioned above.
|
||||
|
||||
// Although it is possible to reduce this procedure to a single regexp,
|
||||
// we must run that regexp twice to get exactly the expected result.
|
||||
|
||||
$validation = "%^($regex)+$%";
|
||||
$extraction = "%$regex%";
|
||||
|
||||
if ( 1 === preg_match( $validation, $attr ) ) {
|
||||
preg_match_all( $extraction, $attr, $attrarr );
|
||||
return $attrarr[0];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs different checks for attribute values.
|
||||
*
|
||||
|
||||
@@ -634,6 +634,8 @@ function img_caption_shortcode($attr, $content = null) {
|
||||
$content = $matches[1];
|
||||
$attr['caption'] = trim( $matches[2] );
|
||||
}
|
||||
} elseif ( strpos( $attr['caption'], '<' ) !== false ) {
|
||||
$attr['caption'] = wp_kses( $attr['caption'], 'post' );
|
||||
}
|
||||
|
||||
// Allow plugins/themes to override the default caption template.
|
||||
@@ -1637,7 +1639,7 @@ function wp_plupload_default_settings() {
|
||||
$max_upload_size = wp_max_upload_size();
|
||||
|
||||
$defaults = array(
|
||||
'runtimes' => 'html5,silverlight,flash,html4',
|
||||
'runtimes' => 'html5,silverlight,html4',
|
||||
'file_data_name' => 'async-upload', // key passed to $_FILE.
|
||||
'multiple_queues' => true,
|
||||
'max_file_size' => $max_upload_size . 'b',
|
||||
|
||||
@@ -631,7 +631,7 @@ function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') {
|
||||
function wpmu_signup_blog( $domain, $path, $title, $user, $user_email, $meta = array() ) {
|
||||
global $wpdb;
|
||||
|
||||
$key = substr( md5( time() . rand() . $domain ), 0, 16 );
|
||||
$key = substr( md5( time() . wp_rand() . $domain ), 0, 16 );
|
||||
$meta = serialize($meta);
|
||||
|
||||
$wpdb->insert( $wpdb->signups, array(
|
||||
@@ -667,7 +667,7 @@ function wpmu_signup_user( $user, $user_email, $meta = array() ) {
|
||||
// Format data
|
||||
$user = preg_replace( '/\s+/', '', sanitize_user( $user, true ) );
|
||||
$user_email = sanitize_email( $user_email );
|
||||
$key = substr( md5( time() . rand() . $user_email ), 0, 16 );
|
||||
$key = substr( md5( time() . wp_rand() . $user_email ), 0, 16 );
|
||||
$meta = serialize($meta);
|
||||
|
||||
$wpdb->insert( $wpdb->signups, array(
|
||||
|
||||
@@ -758,10 +758,14 @@ function auth_redirect() {
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_user_admin() )
|
||||
$scheme = 'logged_in';
|
||||
else
|
||||
$scheme = apply_filters( 'auth_redirect_scheme', '' );
|
||||
/**
|
||||
* Filters the authentication redirect scheme.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @param string $scheme Authentication redirect scheme. Default empty.
|
||||
*/
|
||||
$scheme = apply_filters( 'auth_redirect_scheme', '' );
|
||||
|
||||
if ( $user_id = wp_validate_auth_cookie( '', $scheme) ) {
|
||||
do_action('auth_redirect', $user_id);
|
||||
@@ -968,7 +972,7 @@ if ( !function_exists('wp_validate_redirect') ) :
|
||||
* @return string redirect-sanitized URL
|
||||
**/
|
||||
function wp_validate_redirect($location, $default = '') {
|
||||
$location = trim( $location );
|
||||
$location = trim( $location, " \t\n\r\0\x08\x0B" );
|
||||
// browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//'
|
||||
if ( substr($location, 0, 2) == '//' )
|
||||
$location = 'http:' . $location;
|
||||
@@ -976,7 +980,8 @@ function wp_validate_redirect($location, $default = '') {
|
||||
// In php 5 parse_url may fail if the URL query part contains http://, bug #38143
|
||||
$test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location;
|
||||
|
||||
$lp = parse_url($test);
|
||||
// @-operator is used to prevent possible warnings in PHP < 5.3.3.
|
||||
$lp = @parse_url($test);
|
||||
|
||||
// Give up if malformed URL
|
||||
if ( false === $lp )
|
||||
@@ -986,9 +991,17 @@ function wp_validate_redirect($location, $default = '') {
|
||||
if ( isset($lp['scheme']) && !('http' == $lp['scheme'] || 'https' == $lp['scheme']) )
|
||||
return $default;
|
||||
|
||||
// Reject if scheme is set but host is not. This catches urls like https:host.com for which parse_url does not set the host field.
|
||||
if ( isset($lp['scheme']) && !isset($lp['host']) )
|
||||
// Reject if certain components are set but host is not. This catches urls like https:host.com for which parse_url does not set the host field.
|
||||
if ( ! isset( $lp['host'] ) && ( isset( $lp['scheme'] ) || isset( $lp['user'] ) || isset( $lp['pass'] ) || isset( $lp['port'] ) ) ) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
// Reject malformed components parse_url() can return on odd inputs.
|
||||
foreach ( array( 'user', 'pass', 'host' ) as $component ) {
|
||||
if ( isset( $lp[ $component ] ) && strpbrk( $lp[ $component ], ':/?#@' ) ) {
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
||||
$wpp = parse_url(home_url());
|
||||
|
||||
|
||||
@@ -1204,7 +1204,7 @@ function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = fals
|
||||
if ( trim( $link_text ) == '' )
|
||||
$link_text = $_post->post_title;
|
||||
|
||||
return apply_filters( 'wp_get_attachment_link', "<a href='$url'>$link_text</a>", $id, $size, $permalink, $icon, $text );
|
||||
return apply_filters( 'wp_get_attachment_link', "<a href='" . esc_url( $url ) . "'>$link_text</a>", $id, $size, $permalink, $icon, $text );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2527,10 +2527,11 @@ function wp_untrash_post_comments($post = null) {
|
||||
|
||||
foreach ( $group_by_status as $status => $comments ) {
|
||||
// Sanity check. This shouldn't happen.
|
||||
if ( 'post-trashed' == $status )
|
||||
if ( 'post-trashed' == $status ) {
|
||||
$status = '0';
|
||||
$comments_in = implode( "', '", $comments );
|
||||
$wpdb->query( "UPDATE $wpdb->comments SET comment_approved = '$status' WHERE comment_ID IN ('" . $comments_in . "')" );
|
||||
}
|
||||
$comments_in = implode( ', ', array_map( 'intval', $comments ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->comments SET comment_approved = %s WHERE comment_ID IN ($comments_in)", $status ) );
|
||||
}
|
||||
|
||||
clean_comment_cache( array_keys($statuses) );
|
||||
|
||||
@@ -2657,14 +2657,15 @@ class WP_Query {
|
||||
|
||||
if ( 'any' == $post_type ) {
|
||||
$in_search_post_types = get_post_types( array('exclude_from_search' => false) );
|
||||
if ( empty( $in_search_post_types ) )
|
||||
if ( empty( $in_search_post_types ) ) {
|
||||
$where .= ' AND 1=0 ';
|
||||
else
|
||||
$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')";
|
||||
} else {
|
||||
$where .= " AND {$wpdb->posts}.post_type IN ('" . join( "', '", array_map( 'esc_sql', $in_search_post_types ) ) . "')";
|
||||
}
|
||||
} elseif ( !empty( $post_type ) && is_array( $post_type ) ) {
|
||||
$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $post_type) . "')";
|
||||
$where .= " AND {$wpdb->posts}.post_type IN ('" . join("', '", esc_sql( $post_type ) ) . "')";
|
||||
} elseif ( ! empty( $post_type ) ) {
|
||||
$where .= " AND $wpdb->posts.post_type = '$post_type'";
|
||||
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_type = %s", $post_type );
|
||||
$post_type_object = get_post_type_object ( $post_type );
|
||||
} elseif ( $this->is_attachment ) {
|
||||
$where .= " AND $wpdb->posts.post_type = 'attachment'";
|
||||
|
||||
@@ -245,12 +245,15 @@ function wp_default_scripts( &$scripts ) {
|
||||
|
||||
$scripts->add( 'plupload', '/wp-includes/js/plupload/plupload.js', array(), '1.5.7' );
|
||||
$scripts->add( 'plupload-html5', '/wp-includes/js/plupload/plupload.html5.js', array('plupload'), '1.5.7' );
|
||||
$scripts->add( 'plupload-flash', '/wp-includes/js/plupload/plupload.flash.js', array('plupload'), '1.5.7' );
|
||||
|
||||
// Not used, kept for dependency back-compat.
|
||||
$scripts->add( 'plupload-flash', false, array(), '1.5.7' );
|
||||
|
||||
$scripts->add( 'plupload-silverlight', '/wp-includes/js/plupload/plupload.silverlight.js', array('plupload'), '1.5.7' );
|
||||
$scripts->add( 'plupload-html4', '/wp-includes/js/plupload/plupload.html4.js', array('plupload'), '1.5.7' );
|
||||
|
||||
// cannot use the plupload.full.js, as it loads browserplus init JS from Yahoo
|
||||
$scripts->add( 'plupload-all', false, array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4'), '1.5.7' );
|
||||
$scripts->add( 'plupload-all', false, array('plupload', 'plupload-html5', 'plupload-silverlight', 'plupload-html4'), '1.5.7' );
|
||||
|
||||
$scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array('plupload-all', 'jquery') );
|
||||
did_action( 'init' ) && $scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );
|
||||
|
||||
@@ -176,16 +176,37 @@ function has_shortcode( $content, $tag ) {
|
||||
* @uses get_shortcode_regex() Gets the search pattern for searching shortcodes.
|
||||
*
|
||||
* @param string $content Content to search for shortcodes
|
||||
* @param bool $ignore_html When true, shortcodes inside HTML elements will be skipped.
|
||||
* @return string Content with shortcodes filtered out.
|
||||
*/
|
||||
function do_shortcode($content) {
|
||||
function do_shortcode( $content, $ignore_html = false ) {
|
||||
global $shortcode_tags;
|
||||
|
||||
if ( false === strpos( $content, '[' ) ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
if (empty($shortcode_tags) || !is_array($shortcode_tags))
|
||||
return $content;
|
||||
|
||||
$tagnames = array_keys($shortcode_tags);
|
||||
$tagregexp = join( '|', array_map('preg_quote', $tagnames) );
|
||||
$pattern = "/\\[($tagregexp)/s";
|
||||
|
||||
if ( 1 !== preg_match( $pattern, $content ) ) {
|
||||
// Avoids parsing HTML when there are no shortcodes or embeds anyway.
|
||||
return $content;
|
||||
}
|
||||
|
||||
$content = do_shortcodes_in_html_tags( $content, $ignore_html );
|
||||
|
||||
$pattern = get_shortcode_regex();
|
||||
return preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $content );
|
||||
$content = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $content );
|
||||
|
||||
// Always restore square braces so we don't break things like <!--[if IE ]>
|
||||
$content = unescape_invalid_shortcodes( $content );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -277,6 +298,127 @@ function do_shortcode_tag( $m ) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search only inside HTML elements for shortcodes and process them.
|
||||
*
|
||||
* Any [ or ] characters remaining inside elements will be HTML encoded
|
||||
* to prevent interference with shortcodes that are outside the elements.
|
||||
* Assumes $content processed by KSES already. Users with unfiltered_html
|
||||
* capability may get unexpected output if angle braces are nested in tags.
|
||||
*
|
||||
* @since 4.2.3
|
||||
*
|
||||
* @param string $content Content to search for shortcodes
|
||||
* @param bool $ignore_html When true, all square braces inside elements will be encoded.
|
||||
* @return string Content with shortcodes filtered out.
|
||||
*/
|
||||
function do_shortcodes_in_html_tags( $content, $ignore_html ) {
|
||||
// Normalize entities in unfiltered HTML before adding placeholders.
|
||||
$trans = array( '[' => '[', ']' => ']' );
|
||||
$content = strtr( $content, $trans );
|
||||
$trans = array( '[' => '[', ']' => ']' );
|
||||
|
||||
$pattern = get_shortcode_regex();
|
||||
$textarr = wp_html_split( $content );
|
||||
|
||||
foreach ( $textarr as &$element ) {
|
||||
if ( '' == $element || '<' !== $element[0] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$noopen = false === strpos( $element, '[' );
|
||||
$noclose = false === strpos( $element, ']' );
|
||||
if ( $noopen || $noclose ) {
|
||||
// This element does not contain shortcodes.
|
||||
if ( $noopen xor $noclose ) {
|
||||
// Need to encode stray [ or ] chars.
|
||||
$element = strtr( $element, $trans );
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $ignore_html || '<!--' === substr( $element, 0, 4 ) || '<![CDATA[' === substr( $element, 0, 9 ) ) {
|
||||
// Encode all [ and ] chars.
|
||||
$element = strtr( $element, $trans );
|
||||
continue;
|
||||
}
|
||||
|
||||
$attributes = wp_kses_attr_parse( $element );
|
||||
if ( false === $attributes ) {
|
||||
// Some plugins are doing things like [name] <[email]>.
|
||||
if ( 1 === preg_match( '%^<\s*\[\[?[^\[\]]+\]%', $element ) ) {
|
||||
$element = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $element );
|
||||
}
|
||||
|
||||
// Looks like we found some crazy unfiltered HTML. Skipping it for sanity.
|
||||
$element = strtr( $element, $trans );
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get element name
|
||||
$front = array_shift( $attributes );
|
||||
$back = array_pop( $attributes );
|
||||
$matches = array();
|
||||
preg_match('%[a-zA-Z0-9]+%', $front, $matches);
|
||||
$elname = $matches[0];
|
||||
|
||||
// Look for shortcodes in each attribute separately.
|
||||
foreach ( $attributes as &$attr ) {
|
||||
$open = strpos( $attr, '[' );
|
||||
$close = strpos( $attr, ']' );
|
||||
if ( false === $open || false === $close ) {
|
||||
continue; // Go to next attribute. Square braces will be escaped at end of loop.
|
||||
}
|
||||
$double = strpos( $attr, '"' );
|
||||
$single = strpos( $attr, "'" );
|
||||
if ( ( false === $single || $open < $single ) && ( false === $double || $open < $double ) ) {
|
||||
// $attr like '[shortcode]' or 'name = [shortcode]' implies unfiltered_html.
|
||||
// In this specific situation we assume KSES did not run because the input
|
||||
// was written by an administrator, so we should avoid changing the output
|
||||
// and we do not need to run KSES here.
|
||||
$attr = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $attr );
|
||||
} else {
|
||||
// $attr like 'name = "[shortcode]"' or "name = '[shortcode]'"
|
||||
// We do not know if $content was unfiltered. Assume KSES ran before shortcodes.
|
||||
$count = 0;
|
||||
$new_attr = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $attr, -1, $count );
|
||||
if ( $count > 0 ) {
|
||||
// Sanitize the shortcode output using KSES.
|
||||
$new_attr = wp_kses_one_attr( $new_attr, $elname );
|
||||
if ( '' !== $new_attr ) {
|
||||
// The shortcode is safe to use now.
|
||||
$attr = $new_attr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$element = $front . implode( '', $attributes ) . $back;
|
||||
|
||||
// Now encode any remaining [ or ] chars.
|
||||
$element = strtr( $element, $trans );
|
||||
}
|
||||
|
||||
$content = implode( '', $textarr );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove placeholders added by do_shortcodes_in_html_tags().
|
||||
*
|
||||
* @since 4.2.3
|
||||
*
|
||||
* @param string $content Content to search for placeholders.
|
||||
* @return string Content with placeholders removed.
|
||||
*/
|
||||
function unescape_invalid_shortcodes( $content ) {
|
||||
// Clean up entire string, avoids re-parsing HTML.
|
||||
$trans = array( '[' => '[', ']' => ']' );
|
||||
$content = strtr( $content, $trans );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all attributes from the shortcodes tag.
|
||||
*
|
||||
@@ -306,6 +448,15 @@ function shortcode_parse_atts($text) {
|
||||
elseif (isset($m[8]))
|
||||
$atts[] = stripcslashes($m[8]);
|
||||
}
|
||||
|
||||
// Reject any unclosed HTML elements
|
||||
foreach( $atts as &$value ) {
|
||||
if ( false !== strpos( $value, '<' ) ) {
|
||||
if ( 1 !== preg_match( '/^[^<]*+(?:<[^>]*+>[^<]*+)*+$/', $value ) ) {
|
||||
$value = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$atts = ltrim($text);
|
||||
}
|
||||
@@ -371,9 +522,15 @@ function strip_shortcodes( $content ) {
|
||||
if (empty($shortcode_tags) || !is_array($shortcode_tags))
|
||||
return $content;
|
||||
|
||||
$pattern = get_shortcode_regex();
|
||||
$content = do_shortcodes_in_html_tags( $content, true );
|
||||
|
||||
return preg_replace_callback( "/$pattern/s", 'strip_shortcode_tag', $content );
|
||||
$pattern = get_shortcode_regex();
|
||||
$content = preg_replace_callback( "/$pattern/s", 'strip_shortcode_tag', $content );
|
||||
|
||||
// Always restore square braces so we don't break things like <!--[if IE ]>
|
||||
$content = unescape_invalid_shortcodes( $content );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
function strip_shortcode_tag( $m ) {
|
||||
|
||||
@@ -587,7 +587,7 @@ function get_objects_in_term( $term_ids, $taxonomies, $args = array() ) {
|
||||
|
||||
$term_ids = array_map('intval', $term_ids );
|
||||
|
||||
$taxonomies = "'" . implode( "', '", $taxonomies ) . "'";
|
||||
$taxonomies = "'" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "'";
|
||||
$term_ids = "'" . implode( "', '", $term_ids ) . "'";
|
||||
|
||||
$object_ids = $wpdb->get_col("SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tt.term_id IN ($term_ids) ORDER BY tr.object_id $order");
|
||||
@@ -1346,7 +1346,7 @@ function get_terms($taxonomies, $args = '') {
|
||||
if ( '' !== $order && !in_array( $order, array( 'ASC', 'DESC' ) ) )
|
||||
$order = 'ASC';
|
||||
|
||||
$where = "tt.taxonomy IN ('" . implode("', '", $taxonomies) . "')";
|
||||
$where = "tt.taxonomy IN ('" . implode("', '", array_map( 'esc_sql', $taxonomies ) ) . "')";
|
||||
$inclusions = '';
|
||||
if ( ! empty( $include ) ) {
|
||||
$exclude = '';
|
||||
@@ -2029,7 +2029,7 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
|
||||
if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) )
|
||||
$order = 'ASC';
|
||||
|
||||
$taxonomies = "'" . implode("', '", $taxonomies) . "'";
|
||||
$taxonomies = "'" . implode("', '", array_map( 'esc_sql', $taxonomies ) ) . "'";
|
||||
$object_ids = implode(', ', $object_ids);
|
||||
|
||||
$select_this = '';
|
||||
|
||||
@@ -582,8 +582,6 @@ function preview_theme() {
|
||||
|
||||
// Prevent theme mods to current theme being used on theme being previewed
|
||||
add_filter( 'pre_option_theme_mods_' . get_option( 'stylesheet' ), '__return_empty_array' );
|
||||
|
||||
ob_start( 'preview_theme_ob_filter' );
|
||||
}
|
||||
add_action('setup_theme', 'preview_theme');
|
||||
|
||||
@@ -621,7 +619,7 @@ function _preview_theme_stylesheet_filter() {
|
||||
* @return string
|
||||
*/
|
||||
function preview_theme_ob_filter( $content ) {
|
||||
return preg_replace_callback( "|(<a.*?href=([\"']))(.*?)([\"'].*?>)|", 'preview_theme_ob_filter_callback', $content );
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -636,26 +634,7 @@ function preview_theme_ob_filter( $content ) {
|
||||
* @return string
|
||||
*/
|
||||
function preview_theme_ob_filter_callback( $matches ) {
|
||||
if ( strpos($matches[4], 'onclick') !== false )
|
||||
$matches[4] = preg_replace('#onclick=([\'"]).*?(?<!\\\)\\1#i', '', $matches[4]); //Strip out any onclicks from rest of <a>. (?<!\\\) means to ignore the '" if it's escaped by \ to prevent breaking mid-attribute.
|
||||
if (
|
||||
( false !== strpos($matches[3], '/wp-admin/') )
|
||||
||
|
||||
( false !== strpos( $matches[3], '://' ) && 0 !== strpos( $matches[3], home_url() ) )
|
||||
||
|
||||
( false !== strpos($matches[3], '/feed/') )
|
||||
||
|
||||
( false !== strpos($matches[3], '/trackback/') )
|
||||
)
|
||||
return $matches[1] . "#$matches[2] onclick=$matches[2]return false;" . $matches[4];
|
||||
|
||||
$stylesheet = isset( $_GET['stylesheet'] ) ? $_GET['stylesheet'] : '';
|
||||
$template = isset( $_GET['template'] ) ? $_GET['template'] : '';
|
||||
|
||||
$link = add_query_arg( array( 'preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => 1 ), $matches[3] );
|
||||
if ( 0 === strpos($link, 'preview=1') )
|
||||
$link = "?$link";
|
||||
return $matches[1] . esc_attr( $link ) . $matches[4];
|
||||
return $matches[0];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -146,7 +146,20 @@ function wp_version_check( $extra_stats = array() ) {
|
||||
if ( isset( $body['translations'] ) )
|
||||
$updates->translations = $body['translations'];
|
||||
|
||||
set_site_transient( 'update_core', $updates);
|
||||
set_site_transient( 'update_core', $updates );
|
||||
|
||||
if ( ! empty( $body['ttl'] ) ) {
|
||||
$ttl = (int) $body['ttl'];
|
||||
if ( $ttl && ( time() + $ttl < wp_next_scheduled( 'wp_version_check' ) ) ) {
|
||||
// Queue an event to re-run the update check in $ttl seconds.
|
||||
wp_schedule_single_event( time() + $ttl, 'wp_version_check' );
|
||||
}
|
||||
}
|
||||
|
||||
// Trigger background updates if running non-interactively, and we weren't called from the update handler.
|
||||
if ( defined( 'DOING_CRON' ) && DOING_CRON && 'wp_maybe_auto_update' != current_filter() ) {
|
||||
do_action( 'wp_maybe_auto_update' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,7 +210,11 @@ function wp_update_plugins( $extra_stats = array() ) {
|
||||
$timeout = HOUR_IN_SECONDS;
|
||||
break;
|
||||
default :
|
||||
$timeout = 12 * HOUR_IN_SECONDS;
|
||||
if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
|
||||
$timeout = 0;
|
||||
} else {
|
||||
$timeout = 12 * HOUR_IN_SECONDS;
|
||||
}
|
||||
}
|
||||
|
||||
$time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
|
||||
@@ -344,7 +361,11 @@ function wp_update_themes( $extra_stats = array() ) {
|
||||
$timeout = HOUR_IN_SECONDS;
|
||||
break;
|
||||
default :
|
||||
$timeout = 12 * HOUR_IN_SECONDS;
|
||||
if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
|
||||
$timeout = 0;
|
||||
} else {
|
||||
$timeout = 12 * HOUR_IN_SECONDS;
|
||||
}
|
||||
}
|
||||
|
||||
$time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time() - $last_update->last_checked );
|
||||
@@ -585,19 +606,8 @@ function wp_schedule_update_checks() {
|
||||
if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') )
|
||||
wp_schedule_event(time(), 'twicedaily', 'wp_update_themes');
|
||||
|
||||
if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING' ) ) {
|
||||
// Schedule auto updates for 7 a.m. and 7 p.m. in the timezone of the site.
|
||||
$next = strtotime( 'today 7am' );
|
||||
$now = time();
|
||||
// Find the next instance of 7 a.m. or 7 p.m., but skip it if it is within 3 hours from now.
|
||||
while ( ( $now + 3 * HOUR_IN_SECONDS ) > $next ) {
|
||||
$next += 12 * HOUR_IN_SECONDS;
|
||||
}
|
||||
$next = $next - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
|
||||
// Add a random number of minutes, so we don't have all sites trying to update exactly on the hour
|
||||
$next = $next + rand( 0, 59 ) * MINUTE_IN_SECONDS;
|
||||
wp_schedule_event( $next, 'twicedaily', 'wp_maybe_auto_update' );
|
||||
}
|
||||
if ( ( wp_next_scheduled( 'wp_maybe_auto_update' ) > ( time() + HOUR_IN_SECONDS ) ) && ! defined('WP_INSTALLING') )
|
||||
wp_clear_scheduled_hook( 'wp_maybe_auto_update' );
|
||||
}
|
||||
|
||||
if ( ( ! is_main_site() && ! is_network_admin() ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '3.7.5';
|
||||
$wp_version = '3.7.22';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
*
|
||||
* @global int $wp_db_version
|
||||
*/
|
||||
$wp_db_version = 26149;
|
||||
$wp_db_version = 26151;
|
||||
|
||||
/**
|
||||
* Holds the TinyMCE version
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,12 @@ require(dirname(__FILE__) . '/wp-load.php');
|
||||
if ( ! apply_filters( 'enable_post_by_email_configuration', true ) )
|
||||
wp_die( __( 'This action has been disabled by the administrator.' ) );
|
||||
|
||||
$mailserver_url = get_option( 'mailserver_url' );
|
||||
|
||||
if ( 'mail.example.com' === $mailserver_url || empty( $mailserver_url ) ) {
|
||||
wp_die( __( 'This action has been disabled by the administrator.' ), 403 );
|
||||
}
|
||||
|
||||
/** Allow a plugin to do a complete takeover of Post by Email **/
|
||||
do_action('wp-mail.php');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user