Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
018b3718dc |
@@ -1,6 +1,6 @@
|
||||
WordPress - Web publishing software
|
||||
|
||||
Copyright 2018 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
|
||||
|
||||
@@ -18,50 +18,6 @@ if ( !is_multisite() ) {
|
||||
die();
|
||||
}
|
||||
|
||||
$valid_error_codes = array( 'already_active', 'blog_taken' );
|
||||
|
||||
list( $activate_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) );
|
||||
$activate_cookie = 'wp-activate-' . COOKIEHASH;
|
||||
|
||||
$key = '';
|
||||
$result = null;
|
||||
|
||||
if ( isset( $_GET['key'] ) && isset( $_POST['key'] ) && $_GET['key'] !== $_POST['key'] ) {
|
||||
wp_die( __( 'A key value mismatch has been detected. Please follow the link provided in your activation email.' ), __( 'An error occurred during the activation' ), 400 );
|
||||
} elseif ( ! empty( $_GET['key'] ) ) {
|
||||
$key = $_GET['key'];
|
||||
} elseif ( ! empty( $_POST['key'] ) ) {
|
||||
$key = $_POST['key'];
|
||||
}
|
||||
|
||||
if ( $key ) {
|
||||
$redirect_url = remove_query_arg( 'key' );
|
||||
|
||||
if ( $redirect_url !== remove_query_arg( false ) ) {
|
||||
setcookie( $activate_cookie, $key, 0, $activate_path, COOKIE_DOMAIN, is_ssl(), true );
|
||||
wp_safe_redirect( $redirect_url );
|
||||
exit;
|
||||
} else {
|
||||
$result = wpmu_activate_signup( $key );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $result === null && isset( $_COOKIE[ $activate_cookie ] ) ) {
|
||||
$key = $_COOKIE[ $activate_cookie ];
|
||||
$result = wpmu_activate_signup( $key );
|
||||
setcookie( $activate_cookie, ' ', time() - YEAR_IN_SECONDS, $activate_path, COOKIE_DOMAIN, is_ssl(), true );
|
||||
}
|
||||
|
||||
if ( $result === null || ( is_wp_error( $result ) && 'invalid_key' === $result->get_error_code() ) ) {
|
||||
status_header( 404 );
|
||||
} elseif ( is_wp_error( $result ) ) {
|
||||
$error_code = $result->get_error_code();
|
||||
|
||||
if ( ! in_array( $error_code, $valid_error_codes ) ) {
|
||||
status_header( 400 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_object( $wp_object_cache ) )
|
||||
$wp_object_cache->cache_enabled = false;
|
||||
|
||||
@@ -107,13 +63,12 @@ function wpmu_activate_stylesheet() {
|
||||
<?php
|
||||
}
|
||||
add_action( 'wp_head', 'wpmu_activate_stylesheet' );
|
||||
add_action( 'wp_head', 'wp_sensitive_page_meta' );
|
||||
|
||||
get_header();
|
||||
?>
|
||||
|
||||
<div id="content" class="widecolumn">
|
||||
<?php if ( ! $key ) { ?>
|
||||
<?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?>
|
||||
|
||||
<h2><?php _e('Activation Key Required') ?></h2>
|
||||
<form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>">
|
||||
@@ -127,25 +82,28 @@ get_header();
|
||||
</form>
|
||||
|
||||
<?php } else {
|
||||
if ( is_wp_error( $result ) && in_array( $result->get_error_code(), $valid_error_codes ) ) {
|
||||
$signup = $result->get_error_data();
|
||||
?>
|
||||
<h2><?php _e('Your account is now active!'); ?></h2>
|
||||
<?php
|
||||
echo '<p class="lead-in">';
|
||||
if ( $signup->domain . $signup->path == '' ) {
|
||||
printf( __('Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of “%2$s”. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.'), network_site_url( 'wp-login.php', 'login' ), $signup->user_login, $signup->user_email, wp_lostpassword_url() );
|
||||
|
||||
$key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
|
||||
$result = wpmu_activate_signup( $key );
|
||||
if ( is_wp_error($result) ) {
|
||||
if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) {
|
||||
$signup = $result->get_error_data();
|
||||
?>
|
||||
<h2><?php _e('Your account is now active!'); ?></h2>
|
||||
<?php
|
||||
echo '<p class="lead-in">';
|
||||
if ( $signup->domain . $signup->path == '' ) {
|
||||
printf( __('Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of “%2$s”. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.'), network_site_url( 'wp-login.php', 'login' ), $signup->user_login, $signup->user_email, wp_lostpassword_url() );
|
||||
} else {
|
||||
printf( __('Your site at <a href="%1$s">%2$s</a> is active. You may now log in to your site using your chosen username of “%3$s”. Please check your email inbox at %4$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, wp_lostpassword_url() );
|
||||
}
|
||||
echo '</p>';
|
||||
} else {
|
||||
printf( __('Your site at <a href="%1$s">%2$s</a> is active. You may now log in to your site using your chosen username of “%3$s”. Please check your email inbox at %4$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, wp_lostpassword_url() );
|
||||
?>
|
||||
<h2><?php _e('An error occurred during the activation'); ?></h2>
|
||||
<?php
|
||||
echo '<p>'.$result->get_error_message().'</p>';
|
||||
}
|
||||
echo '</p>';
|
||||
} elseif ( $result === null || is_wp_error( $result ) ) {
|
||||
?>
|
||||
<h2><?php _e('An error occurred during the activation'); ?></h2>
|
||||
<?php if ( is_wp_error( $result ) ) {
|
||||
echo '<p>' . $result->get_error_message() . '</p>';
|
||||
} ?>
|
||||
<?php
|
||||
} else {
|
||||
$url = isset( $result['blog_id'] ) ? get_blogaddress_by_id( (int) $result['blog_id'] ) : '';
|
||||
$user = get_userdata( (int) $result['user_id'] );
|
||||
|
||||
@@ -41,105 +41,7 @@ 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', 25 ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: WordPress version number */
|
||||
__( '<strong>Version %s</strong> addressed one security issue.' ),
|
||||
'4.2.26'
|
||||
);
|
||||
?>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: HelpHub URL */
|
||||
__( 'For more information, see <a href="%s">the release notes</a>.' ),
|
||||
sprintf(
|
||||
/* translators: %s: WordPress version */
|
||||
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
|
||||
sanitize_title( '4.2.26' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: WordPress version number */
|
||||
__( '<strong>Version %s</strong> addressed some security issues.' ),
|
||||
'4.2.25'
|
||||
);
|
||||
?>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: HelpHub URL */
|
||||
__( 'For more information, see <a href="%s">the release notes</a>.' ),
|
||||
sprintf(
|
||||
/* translators: %s: WordPress version */
|
||||
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
|
||||
sanitize_title( '4.2.25' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: WordPress version number */
|
||||
__( '<strong>Version %s</strong> addressed some security issues.' ),
|
||||
'4.2.24'
|
||||
);
|
||||
?>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: HelpHub URL */
|
||||
__( 'For more information, see <a href="%s">the release notes</a>.' ),
|
||||
sprintf(
|
||||
/* translators: %s: WordPress version */
|
||||
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
|
||||
sanitize_title( '4.2.24' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: WordPress version number */
|
||||
__( '<strong>Version %s</strong> addressed a security issue.' ),
|
||||
'4.2.23'
|
||||
);
|
||||
?>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: HelpHub URL */
|
||||
__( 'For more information, see <a href="%s">the release notes</a>.' ),
|
||||
sprintf(
|
||||
/* translators: %s: WordPress version */
|
||||
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
|
||||
sanitize_title( '4.2.23' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
/* translators: %s: WordPress version number */
|
||||
printf( __( '<strong>Version %s</strong> addressed some security issues.' ), '4.2.22' );
|
||||
?>
|
||||
<?php
|
||||
/* translators: %s: Codex URL */
|
||||
printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.2.22' );
|
||||
?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 1 ), '4.2.21' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.2.21' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 2 ), '4.2.20' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.2.20' ); ?>
|
||||
</p>
|
||||
<h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 19 ); ?></h3>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 1 ), '4.2.19' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.2.19' ); ?>
|
||||
|
||||
@@ -32,7 +32,7 @@ if ( ! ( isset( $_REQUEST['action'] ) && 'upload-attachment' == $_REQUEST['actio
|
||||
|
||||
require_once( ABSPATH . 'wp-admin/admin.php' );
|
||||
|
||||
header( 'Content-Type: text/plain; charset=' . get_option( 'blog_charset' ) );
|
||||
header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
|
||||
|
||||
if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
|
||||
include( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
|
||||
|
||||
@@ -952,8 +952,6 @@ function wp_ajax_replyto_comment( $action ) {
|
||||
if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) {
|
||||
kses_remove_filters(); // start with a clean slate
|
||||
kses_init_filters(); // set up the filters
|
||||
remove_filter( 'pre_comment_content', 'wp_filter_post_kses' );
|
||||
add_filter( 'pre_comment_content', 'wp_filter_kses' );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1860,7 +1858,7 @@ function wp_ajax_upload_attachment() {
|
||||
'success' => false,
|
||||
'data' => array(
|
||||
'message' => __( "You don't have permission to upload files." ),
|
||||
'filename' => esc_html( $_FILES['async-upload']['name'] ),
|
||||
'filename' => $_FILES['async-upload']['name'],
|
||||
)
|
||||
) );
|
||||
|
||||
@@ -1874,7 +1872,7 @@ function wp_ajax_upload_attachment() {
|
||||
'success' => false,
|
||||
'data' => array(
|
||||
'message' => __( "You don't have permission to attach files to this post." ),
|
||||
'filename' => esc_html( $_FILES['async-upload']['name'] ),
|
||||
'filename' => $_FILES['async-upload']['name'],
|
||||
)
|
||||
) );
|
||||
|
||||
@@ -1884,11 +1882,7 @@ function wp_ajax_upload_attachment() {
|
||||
$post_id = null;
|
||||
}
|
||||
|
||||
$post_data = ! empty( $_REQUEST['post_data'] ) ? _wp_get_allowed_postdata( _wp_translate_postdata( false, (array) $_REQUEST['post_data'] ) ) : array();
|
||||
|
||||
if ( is_wp_error( $post_data ) ) {
|
||||
wp_die( $post_data->get_error_message() );
|
||||
}
|
||||
$post_data = isset( $_REQUEST['post_data'] ) ? $_REQUEST['post_data'] : array();
|
||||
|
||||
// If the context is custom header or background, make sure the uploaded file is an image.
|
||||
if ( isset( $post_data['context'] ) && in_array( $post_data['context'], array( 'custom-header', 'custom-background' ) ) ) {
|
||||
@@ -1898,7 +1892,7 @@ function wp_ajax_upload_attachment() {
|
||||
'success' => false,
|
||||
'data' => array(
|
||||
'message' => __( 'The uploaded file is not a valid image. Please try again.' ),
|
||||
'filename' => esc_html( $_FILES['async-upload']['name'] ),
|
||||
'filename' => $_FILES['async-upload']['name'],
|
||||
)
|
||||
) );
|
||||
|
||||
@@ -1913,7 +1907,7 @@ function wp_ajax_upload_attachment() {
|
||||
'success' => false,
|
||||
'data' => array(
|
||||
'message' => $attachment_id->get_error_message(),
|
||||
'filename' => esc_html( $_FILES['async-upload']['name'] ),
|
||||
'filename' => $_FILES['async-upload']['name'],
|
||||
)
|
||||
) );
|
||||
|
||||
|
||||
@@ -175,27 +175,6 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
|
||||
return $post_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns only allowed post data fields
|
||||
*
|
||||
* @since 4.9.9
|
||||
*
|
||||
* @param array $post_data Array of post data. Defaults to the contents of $_POST.
|
||||
* @return object|bool WP_Error on failure, true on success.
|
||||
*/
|
||||
function _wp_get_allowed_postdata( $post_data = null ) {
|
||||
if ( empty( $post_data ) ) {
|
||||
$post_data = $_POST;
|
||||
}
|
||||
|
||||
// Pass through errors
|
||||
if ( is_wp_error( $post_data ) ) {
|
||||
return $post_data;
|
||||
}
|
||||
|
||||
return array_diff_key( $post_data, array_flip( array( 'meta_input', 'file', 'guid' ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing post with values provided in $_POST.
|
||||
*
|
||||
@@ -262,7 +241,6 @@ function edit_post( $post_data = null ) {
|
||||
$post_data = _wp_translate_postdata( true, $post_data );
|
||||
if ( is_wp_error($post_data) )
|
||||
wp_die( $post_data->get_error_message() );
|
||||
$translated = _wp_get_allowed_postdata( $post_data );
|
||||
|
||||
// Post Formats
|
||||
if ( isset( $post_data['post_format'] ) )
|
||||
@@ -340,7 +318,7 @@ function edit_post( $post_data = null ) {
|
||||
$attachment_data = isset( $post_data['attachments'][ $post_ID ] ) ? $post_data['attachments'][ $post_ID ] : array();
|
||||
|
||||
/** This filter is documented in wp-admin/includes/media.php */
|
||||
$translated = apply_filters( 'attachment_fields_to_save', $translated, $attachment_data );
|
||||
$post_data = apply_filters( 'attachment_fields_to_save', $post_data, $attachment_data );
|
||||
}
|
||||
|
||||
// Convert taxonomy input to term IDs, to avoid ambiguity.
|
||||
@@ -385,7 +363,7 @@ function edit_post( $post_data = null ) {
|
||||
}
|
||||
}
|
||||
|
||||
$translated['tax_input'][ $taxonomy ] = $clean_terms;
|
||||
$post_data['tax_input'][ $taxonomy ] = $clean_terms;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,18 +371,18 @@ function edit_post( $post_data = null ) {
|
||||
|
||||
update_post_meta( $post_ID, '_edit_last', get_current_user_id() );
|
||||
|
||||
$success = wp_update_post( $translated );
|
||||
$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( $translated[ $field ] ) ) {
|
||||
$translated[ $field ] = $wpdb->strip_invalid_text_for_column( $wpdb->posts, $field, $translated[ $field ] );
|
||||
if ( isset( $post_data[ $field ] ) ) {
|
||||
$post_data[ $field ] = $wpdb->strip_invalid_text_for_column( $wpdb->posts, $field, $post_data[ $field ] );
|
||||
}
|
||||
}
|
||||
|
||||
wp_update_post( $translated );
|
||||
wp_update_post( $post_data );
|
||||
}
|
||||
|
||||
// Now that we have an ID we can fix any attachment anchor hrefs
|
||||
@@ -562,9 +540,9 @@ function bulk_edit_posts( $post_data = null ) {
|
||||
unset( $post_data['tax_input']['category'] );
|
||||
}
|
||||
|
||||
$post_data['post_ID'] = $post_ID;
|
||||
$post_data['post_type'] = $post->post_type;
|
||||
$post_data['post_mime_type'] = $post->post_mime_type;
|
||||
$post_data['guid'] = $post->guid;
|
||||
|
||||
foreach ( array( 'comment_status', 'ping_status', 'post_author' ) as $field ) {
|
||||
if ( ! isset( $post_data[ $field ] ) ) {
|
||||
@@ -572,12 +550,14 @@ function bulk_edit_posts( $post_data = null ) {
|
||||
}
|
||||
}
|
||||
|
||||
$post_data['ID'] = $post_ID;
|
||||
$post_data['post_ID'] = $post_ID;
|
||||
|
||||
$post_data = _wp_translate_postdata( true, $post_data );
|
||||
if ( is_wp_error( $post_data ) ) {
|
||||
$skipped[] = $post_ID;
|
||||
continue;
|
||||
}
|
||||
$post_data = _wp_get_allowed_postdata( $post_data );
|
||||
|
||||
$updated[] = wp_update_post( $post_data );
|
||||
|
||||
@@ -588,8 +568,8 @@ function bulk_edit_posts( $post_data = null ) {
|
||||
unstick_post( $post_ID );
|
||||
}
|
||||
|
||||
if ( isset( $shared_post_data['post_format'] ) )
|
||||
set_post_format( $post_ID, $shared_post_data['post_format'] );
|
||||
if ( isset( $post_data['post_format'] ) )
|
||||
set_post_format( $post_ID, $post_data['post_format'] );
|
||||
}
|
||||
|
||||
return array( 'updated' => $updated, 'skipped' => $skipped, 'locked' => $locked );
|
||||
@@ -765,10 +745,9 @@ function wp_write_post() {
|
||||
$translated = _wp_translate_postdata( false );
|
||||
if ( is_wp_error($translated) )
|
||||
return $translated;
|
||||
$translated = _wp_get_allowed_postdata( $translated );
|
||||
|
||||
// Create the post.
|
||||
$post_ID = wp_insert_post( $translated );
|
||||
$post_ID = wp_insert_post( $_POST );
|
||||
if ( is_wp_error( $post_ID ) )
|
||||
return $post_ID;
|
||||
|
||||
@@ -1629,7 +1608,6 @@ function wp_create_post_autosave( $post_data ) {
|
||||
$post_data = _wp_translate_postdata( true, $post_data );
|
||||
if ( is_wp_error( $post_data ) )
|
||||
return $post_data;
|
||||
$post_data = _wp_get_allowed_postdata( $post_data );
|
||||
|
||||
$post_author = get_current_user_id();
|
||||
|
||||
|
||||
@@ -449,9 +449,7 @@ final class WP_Screen {
|
||||
|
||||
switch ( $base ) {
|
||||
case 'post' :
|
||||
if ( isset( $_GET['post'] ) && isset( $_POST['post_ID'] ) && (int) $_GET['post'] !== (int) $_POST['post_ID'] )
|
||||
wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
|
||||
elseif ( isset( $_GET['post'] ) )
|
||||
if ( isset( $_GET['post'] ) )
|
||||
$post_id = (int) $_GET['post'];
|
||||
elseif ( isset( $_POST['post_ID'] ) )
|
||||
$post_id = (int) $_POST['post_ID'];
|
||||
|
||||
@@ -16,9 +16,7 @@ $submenu_file = 'edit.php';
|
||||
|
||||
wp_reset_vars( array( 'action' ) );
|
||||
|
||||
if ( isset( $_GET['post'] ) && isset( $_POST['post_ID'] ) && (int) $_GET['post'] !== (int) $_POST['post_ID'] )
|
||||
wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
|
||||
elseif ( isset( $_GET['post'] ) )
|
||||
if ( isset( $_GET['post'] ) )
|
||||
$post_id = $post_ID = (int) $_GET['post'];
|
||||
elseif ( isset( $_POST['post_ID'] ) )
|
||||
$post_id = $post_ID = (int) $_POST['post_ID'];
|
||||
@@ -84,10 +82,6 @@ function redirect_post($post_id = '') {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( isset( $_POST['post_type'] ) && $post && $post_type !== $_POST['post_type'] ) {
|
||||
wp_die( __( 'A post type mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
|
||||
}
|
||||
|
||||
if ( isset( $_POST['deletepost'] ) )
|
||||
$action = 'delete';
|
||||
elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] )
|
||||
@@ -229,7 +223,7 @@ case 'editattachment':
|
||||
|
||||
// Update the thumbnail filename
|
||||
$newmeta = wp_get_attachment_metadata( $post_id, true );
|
||||
$newmeta['thumb'] = wp_basename( $_POST['thumb'] );
|
||||
$newmeta['thumb'] = $_POST['thumb'];
|
||||
|
||||
wp_update_attachment_metadata( $post_id, $newmeta );
|
||||
|
||||
|
||||
@@ -108,8 +108,6 @@ if ( $user->exists() ) {
|
||||
) {
|
||||
kses_remove_filters(); // start with a clean slate
|
||||
kses_init_filters(); // set up the filters
|
||||
remove_filter( 'pre_comment_content', 'wp_filter_post_kses' );
|
||||
add_filter( 'pre_comment_content', 'wp_filter_kses' );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -15,7 +15,7 @@ class WP {
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $public_query_vars = array( 'm', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type', 'embed' );
|
||||
public $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type');
|
||||
|
||||
/**
|
||||
* Private query variables.
|
||||
@@ -265,8 +265,6 @@ class WP {
|
||||
foreach ( $this->public_query_vars as $wpvar ) {
|
||||
if ( isset( $this->extra_query_vars[$wpvar] ) )
|
||||
$this->query_vars[$wpvar] = $this->extra_query_vars[$wpvar];
|
||||
elseif ( isset( $_GET[ $wpvar ] ) && isset( $_POST[ $wpvar ] ) && $_GET[ $wpvar ] !== $_POST[ $wpvar ] )
|
||||
wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 );
|
||||
elseif ( isset( $_POST[$wpvar] ) )
|
||||
$this->query_vars[$wpvar] = $_POST[$wpvar];
|
||||
elseif ( isset( $_GET[$wpvar] ) )
|
||||
|
||||
@@ -1496,11 +1496,6 @@ function wp_mkdir_p( $target ) {
|
||||
if ( file_exists( $target ) )
|
||||
return @is_dir( $target );
|
||||
|
||||
// Do not allow path traversals.
|
||||
if ( false !== strpos( $target, '../' ) || false !== strpos( $target, '..' . DIRECTORY_SEPARATOR ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We need to find the permissions of the parent folder that exists and inherit that.
|
||||
$target_parent = dirname( $target );
|
||||
while ( '.' != $target_parent && ! is_dir( $target_parent ) ) {
|
||||
@@ -1584,38 +1579,18 @@ function path_join( $base, $path ) {
|
||||
/**
|
||||
* Normalize a filesystem path.
|
||||
*
|
||||
* On windows systems, replaces backslashes with forward slashes
|
||||
* and forces upper-case drive letters.
|
||||
* Allows for two leading slashes for Windows network shares, but
|
||||
* ensures that all other duplicate slashes are reduced to a single.
|
||||
* Replaces backslashes with forward slashes for Windows systems, and ensures
|
||||
* no duplicate slashes exist.
|
||||
*
|
||||
* @since 3.9.0
|
||||
* @since 4.4.0 Ensures upper-case drive letters on Windows systems.
|
||||
* @since 4.5.0 Allows for Windows network shares.
|
||||
* @since 4.9.7 Allows for PHP file wrappers.
|
||||
*
|
||||
* @param string $path Path to normalize.
|
||||
* @return string Normalized path.
|
||||
*/
|
||||
function wp_normalize_path( $path ) {
|
||||
$wrapper = '';
|
||||
if ( wp_is_stream( $path ) ) {
|
||||
list( $wrapper, $path ) = explode( '://', $path, 2 );
|
||||
$wrapper .= '://';
|
||||
}
|
||||
|
||||
// Standardise all paths to use /
|
||||
$path = str_replace( '\\', '/', $path );
|
||||
|
||||
// Replace multiple slashes down to a singular, allowing for network shares having two slashes.
|
||||
$path = preg_replace( '|(?<=.)/+|', '/', $path );
|
||||
|
||||
// Windows paths should uppercase the drive letter
|
||||
if ( ':' === substr( $path, 1, 1 ) ) {
|
||||
$path = ucfirst( $path );
|
||||
}
|
||||
|
||||
return $wrapper . $path;
|
||||
$path = preg_replace( '|/+|','/', $path );
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2164,59 +2139,14 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
|
||||
$type = $ext = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Validate files that didn't get validated during previous checks.
|
||||
if ( $type && ! $real_mime && extension_loaded( 'fileinfo' ) ) {
|
||||
} 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 );
|
||||
|
||||
// fileinfo often misidentifies obscure files as one of these types
|
||||
$nonspecific_types = array(
|
||||
'application/octet-stream',
|
||||
'application/encrypted',
|
||||
'application/CDFV2-encrypted',
|
||||
'application/zip',
|
||||
);
|
||||
|
||||
/*
|
||||
* If $real_mime doesn't match the content type we're expecting from the file's extension,
|
||||
* we need to do some additional vetting. Media types and those listed in $nonspecific_types are
|
||||
* allowed some leeway, but anything else must exactly match the real content type.
|
||||
*/
|
||||
if ( in_array( $real_mime, $nonspecific_types, true ) ) {
|
||||
// File is a non-specific binary type. That's ok if it's a type that generally tends to be binary.
|
||||
if ( !in_array( substr( $type, 0, strcspn( $type, '/' ) ), array( 'application', 'video', 'audio' ) ) ) {
|
||||
$type = $ext = false;
|
||||
}
|
||||
} elseif ( 0 === strpos( $real_mime, 'video/' ) || 0 === strpos( $real_mime, 'audio/' ) ) {
|
||||
/*
|
||||
* For these types, only the major type must match the real value.
|
||||
* This means that common mismatches are forgiven: application/vnd.apple.numbers is often misidentified as application/zip,
|
||||
* and some media files are commonly named with the wrong extension (.mov instead of .mp4)
|
||||
*/
|
||||
|
||||
if ( substr( $real_mime, 0, strcspn( $real_mime, '/' ) ) !== substr( $type, 0, strcspn( $type, '/' ) ) ) {
|
||||
$type = $ext = false;
|
||||
}
|
||||
} else {
|
||||
if ( $type !== $real_mime ) {
|
||||
/*
|
||||
* Everything else including image/* and application/*:
|
||||
* If the real content type doesn't match the file extension, assume it's dangerous.
|
||||
*/
|
||||
$type = $ext = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// The mime type must be allowed
|
||||
if ( $type ) {
|
||||
$allowed = get_allowed_mime_types();
|
||||
|
||||
if ( ! in_array( $type, $allowed ) ) {
|
||||
// If the extension does not match the file's real type, return false.
|
||||
if ( $real_mime !== $type ) {
|
||||
$type = $ext = false;
|
||||
}
|
||||
}
|
||||
@@ -4961,25 +4891,3 @@ function wp_delete_file( $file ) {
|
||||
@unlink( $delete );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a file if its path is within the given directory.
|
||||
*
|
||||
* @since 4.9.7
|
||||
*
|
||||
* @param string $file Absolute path to the file to delete.
|
||||
* @param string $directory Absolute path to a directory.
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
function wp_delete_file_from_directory( $file, $directory ) {
|
||||
$real_file = realpath( wp_normalize_path( $file ) );
|
||||
$real_directory = realpath( wp_normalize_path( $directory ) );
|
||||
|
||||
if ( false === $real_file || false === $real_directory || strpos( wp_normalize_path( $real_file ), trailingslashit( wp_normalize_path( $real_directory ) ) ) !== 0 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
wp_delete_file( $file );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2372,24 +2372,6 @@ function wp_no_robots() {
|
||||
echo "<meta name='robots' content='noindex,follow' />\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a noindex,noarchive meta tag and referrer origin-when-cross-origin meta tag.
|
||||
*
|
||||
* Outputs a noindex,noarchive meta tag that tells web robots not to index or cache the page content.
|
||||
* Outputs a referrer origin-when-cross-origin meta tag that tells the browser not to send the full
|
||||
* url as a referrer to other sites when cross-origin assets are loaded.
|
||||
*
|
||||
* Typical usage is as a wp_head callback. add_action( 'wp_head', 'wp_sensitive_page_meta' );
|
||||
*
|
||||
* @since 5.0.0
|
||||
*/
|
||||
function wp_sensitive_page_meta() {
|
||||
?>
|
||||
<meta name='robots' content='noindex,noarchive' />
|
||||
<meta name='referrer' content='strict-origin-when-cross-origin' />
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the user should have a WYSIWIG editor.
|
||||
*
|
||||
@@ -3048,25 +3030,25 @@ function get_the_generator( $type = '' ) {
|
||||
|
||||
switch ( $type ) {
|
||||
case 'html':
|
||||
$gen = '<meta name="generator" content="WordPress ' . esc_attr( get_bloginfo( 'version' ) ) . '">';
|
||||
$gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">';
|
||||
break;
|
||||
case 'xhtml':
|
||||
$gen = '<meta name="generator" content="WordPress ' . esc_attr( get_bloginfo( 'version' ) ) . '" />';
|
||||
$gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '" />';
|
||||
break;
|
||||
case 'atom':
|
||||
$gen = '<generator uri="https://wordpress.org/" version="' . esc_attr( get_bloginfo_rss( 'version' ) ) . '">WordPress</generator>';
|
||||
$gen = '<generator uri="http://wordpress.org/" version="' . get_bloginfo_rss( 'version' ) . '">WordPress</generator>';
|
||||
break;
|
||||
case 'rss2':
|
||||
$gen = '<generator>' . esc_url_raw( 'https://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) ) . '</generator>';
|
||||
$gen = '<generator>http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '</generator>';
|
||||
break;
|
||||
case 'rdf':
|
||||
$gen = '<admin:generatorAgent rdf:resource="' . esc_url_raw( 'https://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) ) . '" />';
|
||||
$gen = '<admin:generatorAgent rdf:resource="http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '" />';
|
||||
break;
|
||||
case 'comment':
|
||||
$gen = '<!-- generator="WordPress/' . esc_attr( get_bloginfo( 'version' ) ) . '" -->';
|
||||
$gen = '<!-- generator="WordPress/' . get_bloginfo( 'version' ) . '" -->';
|
||||
break;
|
||||
case 'export':
|
||||
$gen = '<!-- generator="WordPress/' . esc_attr( get_bloginfo_rss( 'version' ) ) . '" created="' . date( 'Y-m-d H:i' ) . '" -->';
|
||||
$gen = '<!-- generator="WordPress/' . get_bloginfo_rss('version') . '" created="'. date('Y-m-d H:i') . '" -->';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -470,9 +470,8 @@ function wp_http_validate_url( $url ) {
|
||||
$ip = $host;
|
||||
} else {
|
||||
$ip = gethostbyname( $host );
|
||||
if ( $ip === $host ) { // Error condition for gethostbyname()
|
||||
return false;
|
||||
}
|
||||
if ( $ip === $host ) // Error condition for gethostbyname()
|
||||
$ip = false;
|
||||
}
|
||||
if ( $ip ) {
|
||||
$parts = array_map( 'intval', explode( '.', $ip ) );
|
||||
|
||||
@@ -1,72 +1,4 @@
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, {
|
||||
/******/ configurable: false,
|
||||
/******/ enumerable: true,
|
||||
/******/ get: getter
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
/*globals wp, _ */
|
||||
|
||||
var media = wp.media,
|
||||
@@ -275,21 +207,87 @@ wp.media.video = {
|
||||
}
|
||||
};
|
||||
|
||||
media.model.PostMedia = __webpack_require__( 1 );
|
||||
media.controller.AudioDetails = __webpack_require__( 2 );
|
||||
media.controller.VideoDetails = __webpack_require__( 3 );
|
||||
media.view.MediaFrame.MediaDetails = __webpack_require__( 4 );
|
||||
media.view.MediaFrame.AudioDetails = __webpack_require__( 5 );
|
||||
media.view.MediaFrame.VideoDetails = __webpack_require__( 6 );
|
||||
media.view.MediaDetails = __webpack_require__( 7 );
|
||||
media.view.AudioDetails = __webpack_require__( 8 );
|
||||
media.view.VideoDetails = __webpack_require__( 9 );
|
||||
media.model.PostMedia = require( './models/post-media.js' );
|
||||
media.controller.AudioDetails = require( './controllers/audio-details.js' );
|
||||
media.controller.VideoDetails = require( './controllers/video-details.js' );
|
||||
media.view.MediaFrame.MediaDetails = require( './views/frame/media-details.js' );
|
||||
media.view.MediaFrame.AudioDetails = require( './views/frame/audio-details.js' );
|
||||
media.view.MediaFrame.VideoDetails = require( './views/frame/video-details.js' );
|
||||
media.view.MediaDetails = require( './views/media-details.js' );
|
||||
media.view.AudioDetails = require( './views/audio-details.js' );
|
||||
media.view.VideoDetails = require( './views/video-details.js' );
|
||||
|
||||
},{"./controllers/audio-details.js":2,"./controllers/video-details.js":3,"./models/post-media.js":4,"./views/audio-details.js":5,"./views/frame/audio-details.js":6,"./views/frame/media-details.js":7,"./views/frame/video-details.js":8,"./views/media-details.js":9,"./views/video-details.js":10}],2:[function(require,module,exports){
|
||||
/*globals wp */
|
||||
|
||||
/***/ }),
|
||||
/* 1 */
|
||||
/***/ (function(module, exports) {
|
||||
/**
|
||||
* wp.media.controller.AudioDetails
|
||||
*
|
||||
* The controller for the Audio Details state
|
||||
*
|
||||
* @class
|
||||
* @augments wp.media.controller.State
|
||||
* @augments Backbone.Model
|
||||
*/
|
||||
var State = wp.media.controller.State,
|
||||
l10n = wp.media.view.l10n,
|
||||
AudioDetails;
|
||||
|
||||
AudioDetails = State.extend({
|
||||
defaults: {
|
||||
id: 'audio-details',
|
||||
toolbar: 'audio-details',
|
||||
title: l10n.audioDetailsTitle,
|
||||
content: 'audio-details',
|
||||
menu: 'audio-details',
|
||||
router: false,
|
||||
priority: 60
|
||||
},
|
||||
|
||||
initialize: function( options ) {
|
||||
this.media = options.media;
|
||||
State.prototype.initialize.apply( this, arguments );
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = AudioDetails;
|
||||
|
||||
},{}],3:[function(require,module,exports){
|
||||
/*globals wp */
|
||||
|
||||
/**
|
||||
* wp.media.controller.VideoDetails
|
||||
*
|
||||
* The controller for the Video Details state
|
||||
*
|
||||
* @class
|
||||
* @augments wp.media.controller.State
|
||||
* @augments Backbone.Model
|
||||
*/
|
||||
var State = wp.media.controller.State,
|
||||
l10n = wp.media.view.l10n,
|
||||
VideoDetails;
|
||||
|
||||
VideoDetails = State.extend({
|
||||
defaults: {
|
||||
id: 'video-details',
|
||||
toolbar: 'video-details',
|
||||
title: l10n.videoDetailsTitle,
|
||||
content: 'video-details',
|
||||
menu: 'video-details',
|
||||
router: false,
|
||||
priority: 60
|
||||
},
|
||||
|
||||
initialize: function( options ) {
|
||||
this.media = options.media;
|
||||
State.prototype.initialize.apply( this, arguments );
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = VideoDetails;
|
||||
|
||||
},{}],4:[function(require,module,exports){
|
||||
/*globals wp, Backbone, _ */
|
||||
|
||||
/**
|
||||
@@ -333,89 +331,125 @@ var PostMedia = Backbone.Model.extend({
|
||||
|
||||
module.exports = PostMedia;
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 2 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
},{}],5:[function(require,module,exports){
|
||||
/*globals wp */
|
||||
|
||||
/**
|
||||
* wp.media.controller.AudioDetails
|
||||
*
|
||||
* The controller for the Audio Details state
|
||||
* wp.media.view.AudioDetails
|
||||
*
|
||||
* @class
|
||||
* @augments wp.media.controller.State
|
||||
* @augments Backbone.Model
|
||||
* @augments wp.media.view.MediaDetails
|
||||
* @augments wp.media.view.Settings.AttachmentDisplay
|
||||
* @augments wp.media.view.Settings
|
||||
* @augments wp.media.View
|
||||
* @augments wp.Backbone.View
|
||||
* @augments Backbone.View
|
||||
*/
|
||||
var State = wp.media.controller.State,
|
||||
l10n = wp.media.view.l10n,
|
||||
var MediaDetails = wp.media.view.MediaDetails,
|
||||
AudioDetails;
|
||||
|
||||
AudioDetails = State.extend({
|
||||
defaults: {
|
||||
id: 'audio-details',
|
||||
toolbar: 'audio-details',
|
||||
title: l10n.audioDetailsTitle,
|
||||
content: 'audio-details',
|
||||
menu: 'audio-details',
|
||||
router: false,
|
||||
priority: 60
|
||||
},
|
||||
AudioDetails = MediaDetails.extend({
|
||||
className: 'audio-details',
|
||||
template: wp.template('audio-details'),
|
||||
|
||||
initialize: function( options ) {
|
||||
this.media = options.media;
|
||||
State.prototype.initialize.apply( this, arguments );
|
||||
setMedia: function() {
|
||||
var audio = this.$('.wp-audio-shortcode');
|
||||
|
||||
if ( audio.find( 'source' ).length ) {
|
||||
if ( audio.is(':hidden') ) {
|
||||
audio.show();
|
||||
}
|
||||
this.media = MediaDetails.prepareSrc( audio.get(0) );
|
||||
} else {
|
||||
audio.hide();
|
||||
this.media = false;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = AudioDetails;
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 3 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
},{}],6:[function(require,module,exports){
|
||||
/*globals wp */
|
||||
|
||||
/**
|
||||
* wp.media.controller.VideoDetails
|
||||
*
|
||||
* The controller for the Video Details state
|
||||
* wp.media.view.MediaFrame.AudioDetails
|
||||
*
|
||||
* @class
|
||||
* @augments wp.media.controller.State
|
||||
* @augments Backbone.Model
|
||||
* @augments wp.media.view.MediaFrame.MediaDetails
|
||||
* @augments wp.media.view.MediaFrame.Select
|
||||
* @augments wp.media.view.MediaFrame
|
||||
* @augments wp.media.view.Frame
|
||||
* @augments wp.media.View
|
||||
* @augments wp.Backbone.View
|
||||
* @augments Backbone.View
|
||||
* @mixes wp.media.controller.StateMachine
|
||||
*/
|
||||
var State = wp.media.controller.State,
|
||||
l10n = wp.media.view.l10n,
|
||||
VideoDetails;
|
||||
var MediaDetails = wp.media.view.MediaFrame.MediaDetails,
|
||||
MediaLibrary = wp.media.controller.MediaLibrary,
|
||||
|
||||
VideoDetails = State.extend({
|
||||
l10n = wp.media.view.l10n,
|
||||
AudioDetails;
|
||||
|
||||
AudioDetails = MediaDetails.extend({
|
||||
defaults: {
|
||||
id: 'video-details',
|
||||
toolbar: 'video-details',
|
||||
title: l10n.videoDetailsTitle,
|
||||
content: 'video-details',
|
||||
menu: 'video-details',
|
||||
router: false,
|
||||
priority: 60
|
||||
id: 'audio',
|
||||
url: '',
|
||||
menu: 'audio-details',
|
||||
content: 'audio-details',
|
||||
toolbar: 'audio-details',
|
||||
type: 'link',
|
||||
title: l10n.audioDetailsTitle,
|
||||
priority: 120
|
||||
},
|
||||
|
||||
initialize: function( options ) {
|
||||
this.media = options.media;
|
||||
State.prototype.initialize.apply( this, arguments );
|
||||
options.DetailsView = wp.media.view.AudioDetails;
|
||||
options.cancelText = l10n.audioDetailsCancel;
|
||||
options.addText = l10n.audioAddSourceTitle;
|
||||
|
||||
MediaDetails.prototype.initialize.call( this, options );
|
||||
},
|
||||
|
||||
bindHandlers: function() {
|
||||
MediaDetails.prototype.bindHandlers.apply( this, arguments );
|
||||
|
||||
this.on( 'toolbar:render:replace-audio', this.renderReplaceToolbar, this );
|
||||
this.on( 'toolbar:render:add-audio-source', this.renderAddSourceToolbar, this );
|
||||
},
|
||||
|
||||
createStates: function() {
|
||||
this.states.add([
|
||||
new wp.media.controller.AudioDetails( {
|
||||
media: this.media
|
||||
} ),
|
||||
|
||||
new MediaLibrary( {
|
||||
type: 'audio',
|
||||
id: 'replace-audio',
|
||||
title: l10n.audioReplaceTitle,
|
||||
toolbar: 'replace-audio',
|
||||
media: this.media,
|
||||
menu: 'audio-details'
|
||||
} ),
|
||||
|
||||
new MediaLibrary( {
|
||||
type: 'audio',
|
||||
id: 'add-audio-source',
|
||||
title: l10n.audioAddSourceTitle,
|
||||
toolbar: 'add-audio-source',
|
||||
media: this.media,
|
||||
menu: false
|
||||
} )
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = VideoDetails;
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 4 */
|
||||
/***/ (function(module, exports) {
|
||||
module.exports = AudioDetails;
|
||||
|
||||
},{}],7:[function(require,module,exports){
|
||||
/*globals wp */
|
||||
|
||||
/**
|
||||
@@ -547,93 +581,7 @@ MediaDetails = Select.extend({
|
||||
|
||||
module.exports = MediaDetails;
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 5 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/*globals wp */
|
||||
|
||||
/**
|
||||
* wp.media.view.MediaFrame.AudioDetails
|
||||
*
|
||||
* @class
|
||||
* @augments wp.media.view.MediaFrame.MediaDetails
|
||||
* @augments wp.media.view.MediaFrame.Select
|
||||
* @augments wp.media.view.MediaFrame
|
||||
* @augments wp.media.view.Frame
|
||||
* @augments wp.media.View
|
||||
* @augments wp.Backbone.View
|
||||
* @augments Backbone.View
|
||||
* @mixes wp.media.controller.StateMachine
|
||||
*/
|
||||
var MediaDetails = wp.media.view.MediaFrame.MediaDetails,
|
||||
MediaLibrary = wp.media.controller.MediaLibrary,
|
||||
|
||||
l10n = wp.media.view.l10n,
|
||||
AudioDetails;
|
||||
|
||||
AudioDetails = MediaDetails.extend({
|
||||
defaults: {
|
||||
id: 'audio',
|
||||
url: '',
|
||||
menu: 'audio-details',
|
||||
content: 'audio-details',
|
||||
toolbar: 'audio-details',
|
||||
type: 'link',
|
||||
title: l10n.audioDetailsTitle,
|
||||
priority: 120
|
||||
},
|
||||
|
||||
initialize: function( options ) {
|
||||
options.DetailsView = wp.media.view.AudioDetails;
|
||||
options.cancelText = l10n.audioDetailsCancel;
|
||||
options.addText = l10n.audioAddSourceTitle;
|
||||
|
||||
MediaDetails.prototype.initialize.call( this, options );
|
||||
},
|
||||
|
||||
bindHandlers: function() {
|
||||
MediaDetails.prototype.bindHandlers.apply( this, arguments );
|
||||
|
||||
this.on( 'toolbar:render:replace-audio', this.renderReplaceToolbar, this );
|
||||
this.on( 'toolbar:render:add-audio-source', this.renderAddSourceToolbar, this );
|
||||
},
|
||||
|
||||
createStates: function() {
|
||||
this.states.add([
|
||||
new wp.media.controller.AudioDetails( {
|
||||
media: this.media
|
||||
} ),
|
||||
|
||||
new MediaLibrary( {
|
||||
type: 'audio',
|
||||
id: 'replace-audio',
|
||||
title: l10n.audioReplaceTitle,
|
||||
toolbar: 'replace-audio',
|
||||
media: this.media,
|
||||
menu: 'audio-details'
|
||||
} ),
|
||||
|
||||
new MediaLibrary( {
|
||||
type: 'audio',
|
||||
id: 'add-audio-source',
|
||||
title: l10n.audioAddSourceTitle,
|
||||
toolbar: 'add-audio-source',
|
||||
media: this.media,
|
||||
menu: false
|
||||
} )
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = AudioDetails;
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 6 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
},{}],8:[function(require,module,exports){
|
||||
/*globals wp, _ */
|
||||
|
||||
/**
|
||||
@@ -770,11 +718,7 @@ VideoDetails = MediaDetails.extend({
|
||||
|
||||
module.exports = VideoDetails;
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 7 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
},{}],9:[function(require,module,exports){
|
||||
/*global wp, jQuery, _, MediaElementPlayer */
|
||||
|
||||
/**
|
||||
@@ -942,55 +886,7 @@ MediaDetails = AttachmentDisplay.extend({
|
||||
|
||||
module.exports = MediaDetails;
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 8 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/*globals wp */
|
||||
|
||||
/**
|
||||
* wp.media.view.AudioDetails
|
||||
*
|
||||
* @class
|
||||
* @augments wp.media.view.MediaDetails
|
||||
* @augments wp.media.view.Settings.AttachmentDisplay
|
||||
* @augments wp.media.view.Settings
|
||||
* @augments wp.media.View
|
||||
* @augments wp.Backbone.View
|
||||
* @augments Backbone.View
|
||||
*/
|
||||
var MediaDetails = wp.media.view.MediaDetails,
|
||||
AudioDetails;
|
||||
|
||||
AudioDetails = MediaDetails.extend({
|
||||
className: 'audio-details',
|
||||
template: wp.template('audio-details'),
|
||||
|
||||
setMedia: function() {
|
||||
var audio = this.$('.wp-audio-shortcode');
|
||||
|
||||
if ( audio.find( 'source' ).length ) {
|
||||
if ( audio.is(':hidden') ) {
|
||||
audio.show();
|
||||
}
|
||||
this.media = MediaDetails.prepareSrc( audio.get(0) );
|
||||
} else {
|
||||
audio.hide();
|
||||
this.media = false;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = AudioDetails;
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 9 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
},{}],10:[function(require,module,exports){
|
||||
/*globals wp */
|
||||
|
||||
/**
|
||||
@@ -1035,6 +931,4 @@ VideoDetails = MediaDetails.extend({
|
||||
|
||||
module.exports = VideoDetails;
|
||||
|
||||
|
||||
/***/ })
|
||||
/******/ ]);
|
||||
},{}]},{},[1]);
|
||||
|
||||
2
wp-includes/js/media-audiovideo.min.js
vendored
2
wp-includes/js/media-audiovideo.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
2
wp-includes/js/media-grid.min.js
vendored
2
wp-includes/js/media-grid.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,73 +1,4 @@
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, {
|
||||
/******/ configurable: false,
|
||||
/******/ enumerable: true,
|
||||
/******/ get: getter
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 20);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 20:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
/*globals wp, _, jQuery */
|
||||
|
||||
var $ = jQuery,
|
||||
@@ -127,12 +58,12 @@ l10n = media.model.l10n = window._wpMediaModelsL10n || {};
|
||||
media.model.settings = l10n.settings || {};
|
||||
delete l10n.settings;
|
||||
|
||||
Attachment = media.model.Attachment = __webpack_require__( 21 );
|
||||
Attachments = media.model.Attachments = __webpack_require__( 22 );
|
||||
Attachment = media.model.Attachment = require( './models/attachment.js' );
|
||||
Attachments = media.model.Attachments = require( './models/attachments.js' );
|
||||
|
||||
media.model.Query = __webpack_require__( 23 );
|
||||
media.model.PostImage = __webpack_require__( 24 );
|
||||
media.model.Selection = __webpack_require__( 25 );
|
||||
media.model.Query = require( './models/query.js' );
|
||||
media.model.PostImage = require( './models/post-image.js' );
|
||||
media.model.Selection = require( './models/selection.js' );
|
||||
|
||||
/**
|
||||
* ========================================================================
|
||||
@@ -300,12 +231,7 @@ $(window).on('unload', function(){
|
||||
window.wp = null;
|
||||
});
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 21:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
},{"./models/attachment.js":2,"./models/attachments.js":3,"./models/post-image.js":4,"./models/query.js":5,"./models/selection.js":6}],2:[function(require,module,exports){
|
||||
/*globals wp, _, Backbone */
|
||||
|
||||
/**
|
||||
@@ -475,12 +401,7 @@ Attachment = Backbone.Model.extend({
|
||||
|
||||
module.exports = Attachment;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 22:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
},{}],3:[function(require,module,exports){
|
||||
/*globals wp, _, Backbone */
|
||||
|
||||
/**
|
||||
@@ -1014,12 +935,163 @@ var Attachments = Backbone.Collection.extend({
|
||||
|
||||
module.exports = Attachments;
|
||||
|
||||
},{}],4:[function(require,module,exports){
|
||||
/*globals Backbone */
|
||||
|
||||
/***/ }),
|
||||
/**
|
||||
* wp.media.model.PostImage
|
||||
*
|
||||
* An instance of an image that's been embedded into a post.
|
||||
*
|
||||
* Used in the embedded image attachment display settings modal - @see wp.media.view.MediaFrame.ImageDetails.
|
||||
*
|
||||
* @class
|
||||
* @augments Backbone.Model
|
||||
*
|
||||
* @param {int} [attributes] Initial model attributes.
|
||||
* @param {int} [attributes.attachment_id] ID of the attachment.
|
||||
**/
|
||||
var PostImage = Backbone.Model.extend({
|
||||
|
||||
/***/ 23:
|
||||
/***/ (function(module, exports) {
|
||||
initialize: function( attributes ) {
|
||||
var Attachment = wp.media.model.Attachment;
|
||||
this.attachment = false;
|
||||
|
||||
if ( attributes.attachment_id ) {
|
||||
this.attachment = Attachment.get( attributes.attachment_id );
|
||||
if ( this.attachment.get( 'url' ) ) {
|
||||
this.dfd = jQuery.Deferred();
|
||||
this.dfd.resolve();
|
||||
} else {
|
||||
this.dfd = this.attachment.fetch();
|
||||
}
|
||||
this.bindAttachmentListeners();
|
||||
}
|
||||
|
||||
// keep url in sync with changes to the type of link
|
||||
this.on( 'change:link', this.updateLinkUrl, this );
|
||||
this.on( 'change:size', this.updateSize, this );
|
||||
|
||||
this.setLinkTypeFromUrl();
|
||||
this.setAspectRatio();
|
||||
|
||||
this.set( 'originalUrl', attributes.url );
|
||||
},
|
||||
|
||||
bindAttachmentListeners: function() {
|
||||
this.listenTo( this.attachment, 'sync', this.setLinkTypeFromUrl );
|
||||
this.listenTo( this.attachment, 'sync', this.setAspectRatio );
|
||||
this.listenTo( this.attachment, 'change', this.updateSize );
|
||||
},
|
||||
|
||||
changeAttachment: function( attachment, props ) {
|
||||
this.stopListening( this.attachment );
|
||||
this.attachment = attachment;
|
||||
this.bindAttachmentListeners();
|
||||
|
||||
this.set( 'attachment_id', this.attachment.get( 'id' ) );
|
||||
this.set( 'caption', this.attachment.get( 'caption' ) );
|
||||
this.set( 'alt', this.attachment.get( 'alt' ) );
|
||||
this.set( 'size', props.get( 'size' ) );
|
||||
this.set( 'align', props.get( 'align' ) );
|
||||
this.set( 'link', props.get( 'link' ) );
|
||||
this.updateLinkUrl();
|
||||
this.updateSize();
|
||||
},
|
||||
|
||||
setLinkTypeFromUrl: function() {
|
||||
var linkUrl = this.get( 'linkUrl' ),
|
||||
type;
|
||||
|
||||
if ( ! linkUrl ) {
|
||||
this.set( 'link', 'none' );
|
||||
return;
|
||||
}
|
||||
|
||||
// default to custom if there is a linkUrl
|
||||
type = 'custom';
|
||||
|
||||
if ( this.attachment ) {
|
||||
if ( this.attachment.get( 'url' ) === linkUrl ) {
|
||||
type = 'file';
|
||||
} else if ( this.attachment.get( 'link' ) === linkUrl ) {
|
||||
type = 'post';
|
||||
}
|
||||
} else {
|
||||
if ( this.get( 'url' ) === linkUrl ) {
|
||||
type = 'file';
|
||||
}
|
||||
}
|
||||
|
||||
this.set( 'link', type );
|
||||
},
|
||||
|
||||
updateLinkUrl: function() {
|
||||
var link = this.get( 'link' ),
|
||||
url;
|
||||
|
||||
switch( link ) {
|
||||
case 'file':
|
||||
if ( this.attachment ) {
|
||||
url = this.attachment.get( 'url' );
|
||||
} else {
|
||||
url = this.get( 'url' );
|
||||
}
|
||||
this.set( 'linkUrl', url );
|
||||
break;
|
||||
case 'post':
|
||||
this.set( 'linkUrl', this.attachment.get( 'link' ) );
|
||||
break;
|
||||
case 'none':
|
||||
this.set( 'linkUrl', '' );
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
updateSize: function() {
|
||||
var size;
|
||||
|
||||
if ( ! this.attachment ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( this.get( 'size' ) === 'custom' ) {
|
||||
this.set( 'width', this.get( 'customWidth' ) );
|
||||
this.set( 'height', this.get( 'customHeight' ) );
|
||||
this.set( 'url', this.get( 'originalUrl' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
size = this.attachment.get( 'sizes' )[ this.get( 'size' ) ];
|
||||
|
||||
if ( ! size ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.set( 'url', size.url );
|
||||
this.set( 'width', size.width );
|
||||
this.set( 'height', size.height );
|
||||
},
|
||||
|
||||
setAspectRatio: function() {
|
||||
var full;
|
||||
|
||||
if ( this.attachment && this.attachment.get( 'sizes' ) ) {
|
||||
full = this.attachment.get( 'sizes' ).full;
|
||||
|
||||
if ( full ) {
|
||||
this.set( 'aspectRatio', full.width / full.height );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.set( 'aspectRatio', this.get( 'customWidth' ) / this.get( 'customHeight' ) );
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = PostImage;
|
||||
|
||||
},{}],5:[function(require,module,exports){
|
||||
/*globals wp, _ */
|
||||
|
||||
/**
|
||||
@@ -1329,173 +1401,7 @@ Query = Attachments.extend({
|
||||
|
||||
module.exports = Query;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 24:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/*globals Backbone */
|
||||
|
||||
/**
|
||||
* wp.media.model.PostImage
|
||||
*
|
||||
* An instance of an image that's been embedded into a post.
|
||||
*
|
||||
* Used in the embedded image attachment display settings modal - @see wp.media.view.MediaFrame.ImageDetails.
|
||||
*
|
||||
* @class
|
||||
* @augments Backbone.Model
|
||||
*
|
||||
* @param {int} [attributes] Initial model attributes.
|
||||
* @param {int} [attributes.attachment_id] ID of the attachment.
|
||||
**/
|
||||
var PostImage = Backbone.Model.extend({
|
||||
|
||||
initialize: function( attributes ) {
|
||||
var Attachment = wp.media.model.Attachment;
|
||||
this.attachment = false;
|
||||
|
||||
if ( attributes.attachment_id ) {
|
||||
this.attachment = Attachment.get( attributes.attachment_id );
|
||||
if ( this.attachment.get( 'url' ) ) {
|
||||
this.dfd = jQuery.Deferred();
|
||||
this.dfd.resolve();
|
||||
} else {
|
||||
this.dfd = this.attachment.fetch();
|
||||
}
|
||||
this.bindAttachmentListeners();
|
||||
}
|
||||
|
||||
// keep url in sync with changes to the type of link
|
||||
this.on( 'change:link', this.updateLinkUrl, this );
|
||||
this.on( 'change:size', this.updateSize, this );
|
||||
|
||||
this.setLinkTypeFromUrl();
|
||||
this.setAspectRatio();
|
||||
|
||||
this.set( 'originalUrl', attributes.url );
|
||||
},
|
||||
|
||||
bindAttachmentListeners: function() {
|
||||
this.listenTo( this.attachment, 'sync', this.setLinkTypeFromUrl );
|
||||
this.listenTo( this.attachment, 'sync', this.setAspectRatio );
|
||||
this.listenTo( this.attachment, 'change', this.updateSize );
|
||||
},
|
||||
|
||||
changeAttachment: function( attachment, props ) {
|
||||
this.stopListening( this.attachment );
|
||||
this.attachment = attachment;
|
||||
this.bindAttachmentListeners();
|
||||
|
||||
this.set( 'attachment_id', this.attachment.get( 'id' ) );
|
||||
this.set( 'caption', this.attachment.get( 'caption' ) );
|
||||
this.set( 'alt', this.attachment.get( 'alt' ) );
|
||||
this.set( 'size', props.get( 'size' ) );
|
||||
this.set( 'align', props.get( 'align' ) );
|
||||
this.set( 'link', props.get( 'link' ) );
|
||||
this.updateLinkUrl();
|
||||
this.updateSize();
|
||||
},
|
||||
|
||||
setLinkTypeFromUrl: function() {
|
||||
var linkUrl = this.get( 'linkUrl' ),
|
||||
type;
|
||||
|
||||
if ( ! linkUrl ) {
|
||||
this.set( 'link', 'none' );
|
||||
return;
|
||||
}
|
||||
|
||||
// default to custom if there is a linkUrl
|
||||
type = 'custom';
|
||||
|
||||
if ( this.attachment ) {
|
||||
if ( this.attachment.get( 'url' ) === linkUrl ) {
|
||||
type = 'file';
|
||||
} else if ( this.attachment.get( 'link' ) === linkUrl ) {
|
||||
type = 'post';
|
||||
}
|
||||
} else {
|
||||
if ( this.get( 'url' ) === linkUrl ) {
|
||||
type = 'file';
|
||||
}
|
||||
}
|
||||
|
||||
this.set( 'link', type );
|
||||
},
|
||||
|
||||
updateLinkUrl: function() {
|
||||
var link = this.get( 'link' ),
|
||||
url;
|
||||
|
||||
switch( link ) {
|
||||
case 'file':
|
||||
if ( this.attachment ) {
|
||||
url = this.attachment.get( 'url' );
|
||||
} else {
|
||||
url = this.get( 'url' );
|
||||
}
|
||||
this.set( 'linkUrl', url );
|
||||
break;
|
||||
case 'post':
|
||||
this.set( 'linkUrl', this.attachment.get( 'link' ) );
|
||||
break;
|
||||
case 'none':
|
||||
this.set( 'linkUrl', '' );
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
updateSize: function() {
|
||||
var size;
|
||||
|
||||
if ( ! this.attachment ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( this.get( 'size' ) === 'custom' ) {
|
||||
this.set( 'width', this.get( 'customWidth' ) );
|
||||
this.set( 'height', this.get( 'customHeight' ) );
|
||||
this.set( 'url', this.get( 'originalUrl' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
size = this.attachment.get( 'sizes' )[ this.get( 'size' ) ];
|
||||
|
||||
if ( ! size ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.set( 'url', size.url );
|
||||
this.set( 'width', size.width );
|
||||
this.set( 'height', size.height );
|
||||
},
|
||||
|
||||
setAspectRatio: function() {
|
||||
var full;
|
||||
|
||||
if ( this.attachment && this.attachment.get( 'sizes' ) ) {
|
||||
full = this.attachment.get( 'sizes' ).full;
|
||||
|
||||
if ( full ) {
|
||||
this.set( 'aspectRatio', full.width / full.height );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.set( 'aspectRatio', this.get( 'customWidth' ) / this.get( 'customHeight' ) );
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = PostImage;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 25:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
},{}],6:[function(require,module,exports){
|
||||
/*globals wp, _ */
|
||||
|
||||
/**
|
||||
@@ -1594,7 +1500,4 @@ Selection = Attachments.extend({
|
||||
|
||||
module.exports = Selection;
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
},{}]},{},[1]);
|
||||
|
||||
2
wp-includes/js/media-models.min.js
vendored
2
wp-includes/js/media-models.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
8
wp-includes/js/media-views.min.js
vendored
8
wp-includes/js/media-views.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -180,6 +180,15 @@ if ( ! CUSTOM_TAGS ) {
|
||||
'lang' => true,
|
||||
'xml:lang' => true,
|
||||
),
|
||||
'form' => array(
|
||||
'action' => true,
|
||||
'accept' => true,
|
||||
'accept-charset' => true,
|
||||
'enctype' => true,
|
||||
'method' => true,
|
||||
'name' => true,
|
||||
'target' => true,
|
||||
),
|
||||
'h1' => array(
|
||||
'align' => true,
|
||||
),
|
||||
@@ -532,7 +541,7 @@ function wp_kses( $string, $allowed_html, $allowed_protocols = array() ) {
|
||||
* @return string Filtered attribute.
|
||||
*/
|
||||
function wp_kses_one_attr( $string, $element ) {
|
||||
$uris = wp_kses_uri_attributes();
|
||||
$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' ) );
|
||||
@@ -599,7 +608,6 @@ function wp_kses_one_attr( $string, $element ) {
|
||||
* Return a list of allowed tags and attributes for a given context.
|
||||
*
|
||||
* @since 3.5.0
|
||||
* @since 5.0.1 `form` removed as allowable HTML tag.
|
||||
*
|
||||
* @param string $context The context for which to retrieve tags. Allowed values are
|
||||
* post | strip | data | entities or the name of a field filter such as pre_user_description.
|
||||
@@ -624,27 +632,7 @@ function wp_kses_allowed_html( $context = '' ) {
|
||||
switch ( $context ) {
|
||||
case 'post':
|
||||
/** This filter is documented in wp-includes/kses.php */
|
||||
$tags = apply_filters( 'wp_kses_allowed_html', $allowedposttags, $context );
|
||||
|
||||
// 5.0.1 removed the `<form>` tag, allow it if a filter is allowing it's sub-elements `<input>` or `<select>`.
|
||||
if ( ! CUSTOM_TAGS && ! isset( $tags['form'] ) && ( isset( $tags['input'] ) || isset( $tags['select'] ) ) ) {
|
||||
$tags = $allowedposttags;
|
||||
|
||||
$tags['form'] = array(
|
||||
'action' => true,
|
||||
'accept' => true,
|
||||
'accept-charset' => true,
|
||||
'enctype' => true,
|
||||
'method' => true,
|
||||
'name' => true,
|
||||
'target' => true,
|
||||
);
|
||||
|
||||
/** This filter is documented in wp-includes/kses.php */
|
||||
$tags = apply_filters( 'wp_kses_allowed_html', $tags, $context );
|
||||
}
|
||||
|
||||
return $tags;
|
||||
return apply_filters( 'wp_kses_allowed_html', $allowedposttags, $context );
|
||||
|
||||
case 'user_description':
|
||||
case 'pre_user_description':
|
||||
@@ -725,56 +713,6 @@ function wp_kses_split( $string, $allowed_html, $allowed_protocols ) {
|
||||
return preg_replace_callback( '%(<!--.*?(-->|$))|(<[^>]*(>|$)|>)%', '_wp_kses_split_callback', $string );
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function listing HTML attributes containing a URL.
|
||||
*
|
||||
* This function returns a list of all HTML attributes that must contain
|
||||
* a URL according to the HTML specification.
|
||||
*
|
||||
* This list includes URI attributes both allowed and disallowed by KSES.
|
||||
*
|
||||
* @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
||||
*
|
||||
* @since 5.0.1
|
||||
*
|
||||
* @return array HTML attributes that must include a URL.
|
||||
*/
|
||||
function wp_kses_uri_attributes() {
|
||||
$uri_attributes = array(
|
||||
'action',
|
||||
'archive',
|
||||
'background',
|
||||
'cite',
|
||||
'classid',
|
||||
'codebase',
|
||||
'data',
|
||||
'formaction',
|
||||
'href',
|
||||
'icon',
|
||||
'longdesc',
|
||||
'manifest',
|
||||
'poster',
|
||||
'profile',
|
||||
'src',
|
||||
'usemap',
|
||||
'xmlns',
|
||||
);
|
||||
|
||||
/**
|
||||
* Filters the list of attributes that are required to contain a URL.
|
||||
*
|
||||
* Use this filter to add any `data-` attributes that are required to be
|
||||
* validated as a URL.
|
||||
*
|
||||
* @since 5.0.1
|
||||
*
|
||||
* @param array $uri_attributes HTML attributes requiring validation as a URL.
|
||||
*/
|
||||
$uri_attributes = apply_filters( 'wp_kses_uri_attributes', $uri_attributes );
|
||||
|
||||
return $uri_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for wp_kses_split.
|
||||
*
|
||||
@@ -966,7 +904,7 @@ function wp_kses_hair($attr, $allowed_protocols) {
|
||||
$attrarr = array();
|
||||
$mode = 0;
|
||||
$attrname = '';
|
||||
$uris = wp_kses_uri_attributes();
|
||||
$uris = array('xmlns', 'profile', 'href', 'src', 'cite', 'classid', 'codebase', 'data', 'usemap', 'longdesc', 'action');
|
||||
|
||||
// Loop through the whole attribute list
|
||||
|
||||
@@ -1375,8 +1313,7 @@ function wp_kses_html_error($string) {
|
||||
* @return string Sanitized content
|
||||
*/
|
||||
function wp_kses_bad_protocol_once($string, $allowed_protocols, $count = 1 ) {
|
||||
$string = preg_replace( '/(�*58(?![;0-9])|�*3a(?![;a-f0-9]))/i', '$1;', $string );
|
||||
$string2 = preg_split( '/:|�*58;|�*3a;|:/i', $string, 2 );
|
||||
$string2 = preg_split( '/:|�*58;|�*3a;/i', $string, 2 );
|
||||
if ( isset($string2[1]) && ! preg_match('%/\?%', $string2[0]) ) {
|
||||
$string = trim( $string2[1] );
|
||||
$protocol = wp_kses_bad_protocol_once2( $string2[0], $allowed_protocols );
|
||||
|
||||
@@ -243,13 +243,10 @@ function wpmu_admin_do_redirect( $url = '' ) {
|
||||
_deprecated_function( __FUNCTION__, '3.3' );
|
||||
|
||||
$ref = '';
|
||||
if ( isset( $_GET['ref'] ) && isset( $_POST['ref'] ) && $_GET['ref'] !== $_POST['ref'] ) {
|
||||
wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 );
|
||||
} elseif ( isset( $_POST['ref'] ) ) {
|
||||
$ref = $_POST[ 'ref' ];
|
||||
} elseif ( isset( $_GET['ref'] ) ) {
|
||||
$ref = $_GET[ 'ref' ];
|
||||
}
|
||||
if ( isset( $_GET['ref'] ) )
|
||||
$ref = $_GET['ref'];
|
||||
if ( isset( $_POST['ref'] ) )
|
||||
$ref = $_POST['ref'];
|
||||
|
||||
if ( $ref ) {
|
||||
$ref = wpmu_admin_redirect_add_updated_param( $ref );
|
||||
@@ -262,9 +259,7 @@ function wpmu_admin_do_redirect( $url = '' ) {
|
||||
}
|
||||
|
||||
$url = wpmu_admin_redirect_add_updated_param( $url );
|
||||
if ( isset( $_GET['redirect'] ) && isset( $_POST['redirect'] ) && $_GET['redirect'] !== $_POST['redirect'] ) {
|
||||
wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 );
|
||||
} elseif ( isset( $_GET['redirect'] ) ) {
|
||||
if ( isset( $_GET['redirect'] ) ) {
|
||||
if ( substr( $_GET['redirect'], 0, 2 ) == 's_' )
|
||||
$url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) );
|
||||
} elseif ( isset( $_POST['redirect'] ) ) {
|
||||
|
||||
@@ -1074,8 +1074,8 @@ if ( !function_exists('check_admin_referer') ) :
|
||||
* 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
|
||||
*/
|
||||
function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {
|
||||
if ( -1 === $action )
|
||||
_doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2.0' );
|
||||
if ( -1 == $action )
|
||||
_doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2' );
|
||||
|
||||
$adminurl = strtolower(admin_url());
|
||||
$referer = strtolower(wp_get_referer());
|
||||
@@ -1095,12 +1095,6 @@ function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {
|
||||
* 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
|
||||
*/
|
||||
do_action( 'check_admin_referer', $action, $result );
|
||||
|
||||
if ( ! $result && ! ( -1 === $action && strpos( $referer, $adminurl ) === 0 ) ) {
|
||||
wp_nonce_ays( $action );
|
||||
die();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
endif;
|
||||
@@ -1121,9 +1115,6 @@ if ( !function_exists('check_ajax_referer') ) :
|
||||
* 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
|
||||
*/
|
||||
function check_ajax_referer( $action = -1, $query_arg = false, $die = true ) {
|
||||
if ( -1 === $action )
|
||||
_doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2.0' );
|
||||
|
||||
$nonce = '';
|
||||
|
||||
if ( $query_arg && isset( $_REQUEST[ $query_arg ] ) )
|
||||
@@ -1312,14 +1303,6 @@ function wp_validate_redirect($location, $default = '') {
|
||||
if ( isset($lp['scheme']) && !('http' == $lp['scheme'] || 'https' == $lp['scheme']) )
|
||||
return $default;
|
||||
|
||||
if ( ! isset( $lp['host'] ) && ! empty( $lp['path'] ) && '/' !== $lp['path'][0] ) {
|
||||
$path = '';
|
||||
if ( ! empty( $_SERVER['REQUEST_URI'] ) ) {
|
||||
$path = dirname( parse_url( 'http://placeholder' . $_SERVER['REQUEST_URI'], PHP_URL_PATH ) . '?' );
|
||||
}
|
||||
$location = '/' . ltrim( $path . '/', '/' ) . $location;
|
||||
}
|
||||
|
||||
// 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;
|
||||
@@ -2366,3 +2349,4 @@ function wp_text_diff( $left_string, $right_string, $args = null ) {
|
||||
return $r;
|
||||
}
|
||||
endif;
|
||||
|
||||
|
||||
@@ -299,9 +299,24 @@ function get_the_content( $more_link_text = null, $strip_teaser = false ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( $preview ) // Preview fix for JavaScript bug with foreign languages.
|
||||
$output = preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output );
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Preview fix for JavaScript bug with foreign languages.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @access private
|
||||
* @param array $match Match array from preg_replace_callback
|
||||
* @return string
|
||||
*/
|
||||
function _convert_urlencoded_to_entities( $match ) {
|
||||
return '&#' . base_convert( $match[1], 16, 10 ) . ';';
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the post excerpt.
|
||||
*
|
||||
|
||||
@@ -4854,79 +4854,42 @@ function wp_delete_attachment( $post_id, $force_delete = false ) {
|
||||
/** This action is documented in wp-includes/post.php */
|
||||
do_action( 'deleted_post', $post_id );
|
||||
|
||||
wp_delete_attachment_files( $post_id, $meta, $backup_sizes, $file );
|
||||
|
||||
clean_post_cache( $post );
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all files that belong to the given attachment.
|
||||
*
|
||||
* @since 4.9.7
|
||||
*
|
||||
* @param int $post_id Attachment ID.
|
||||
* @param array $meta The attachment's meta data.
|
||||
* @param array $backup_sizes The meta data for the attachment's backup images.
|
||||
* @param string $file Absolute path to the attachment's file.
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
function wp_delete_attachment_files( $post_id, $meta, $backup_sizes, $file ) {
|
||||
global $wpdb;
|
||||
|
||||
$uploadpath = wp_upload_dir();
|
||||
$deleted = true;
|
||||
|
||||
if ( ! empty($meta['thumb']) ) {
|
||||
// Don't delete the thumb if another attachment uses it.
|
||||
if (! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%' . $wpdb->esc_like( $meta['thumb'] ) . '%', $post_id)) ) {
|
||||
$thumbfile = str_replace( basename( $file ), $meta['thumb'], $file );
|
||||
if ( ! empty( $thumbfile ) ) {
|
||||
$thumbfile = path_join( $uploadpath['basedir'], $thumbfile );
|
||||
$thumbdir = path_join( $uploadpath['basedir'], dirname( $file ) );
|
||||
|
||||
if ( ! wp_delete_file_from_directory( $thumbfile, $thumbdir ) ) {
|
||||
$deleted = false;
|
||||
}
|
||||
}
|
||||
$thumbfile = str_replace(basename($file), $meta['thumb'], $file);
|
||||
/** This filter is documented in wp-includes/functions.php */
|
||||
$thumbfile = apply_filters( 'wp_delete_file', $thumbfile );
|
||||
@ unlink( path_join($uploadpath['basedir'], $thumbfile) );
|
||||
}
|
||||
}
|
||||
|
||||
// Remove intermediate and backup images if there are any.
|
||||
if ( isset( $meta['sizes'] ) && is_array( $meta['sizes'] ) ) {
|
||||
$intermediate_dir = path_join( $uploadpath['basedir'], dirname( $file ) );
|
||||
foreach ( $meta['sizes'] as $size => $sizeinfo ) {
|
||||
$intermediate_file = str_replace( basename( $file ), $sizeinfo['file'], $file );
|
||||
if ( ! empty( $intermediate_file ) ) {
|
||||
$intermediate_file = path_join( $uploadpath['basedir'], $intermediate_file );
|
||||
|
||||
if ( ! wp_delete_file_from_directory( $intermediate_file, $intermediate_dir ) ) {
|
||||
$deleted = false;
|
||||
}
|
||||
}
|
||||
/** This filter is documented in wp-includes/functions.php */
|
||||
$intermediate_file = apply_filters( 'wp_delete_file', $intermediate_file );
|
||||
@ unlink( path_join( $uploadpath['basedir'], $intermediate_file ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_array($backup_sizes) ) {
|
||||
$del_dir = path_join( $uploadpath['basedir'], dirname( $meta['file'] ) );
|
||||
foreach ( $backup_sizes as $size ) {
|
||||
$del_file = path_join( dirname( $meta['file'] ), $size['file'] );
|
||||
if ( ! empty( $del_file ) ) {
|
||||
$del_file = path_join( $uploadpath['basedir'], $del_file );
|
||||
|
||||
if ( ! wp_delete_file_from_directory( $del_file, $del_dir ) ) {
|
||||
$deleted = false;
|
||||
}
|
||||
}
|
||||
$del_file = path_join( dirname($meta['file']), $size['file'] );
|
||||
/** This filter is documented in wp-includes/functions.php */
|
||||
$del_file = apply_filters( 'wp_delete_file', $del_file );
|
||||
@ unlink( path_join($uploadpath['basedir'], $del_file) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! wp_delete_file_from_directory( $file, $uploadpath['basedir'] ) ) {
|
||||
$deleted = false;
|
||||
}
|
||||
wp_delete_file( $file );
|
||||
|
||||
return $deleted;
|
||||
clean_post_cache( $post );
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1401,6 +1401,7 @@ class WP_Query {
|
||||
, 'attachment'
|
||||
, 'attachment_id'
|
||||
, 'name'
|
||||
, 'static'
|
||||
, 'pagename'
|
||||
, 'page_id'
|
||||
, 'second'
|
||||
@@ -1604,7 +1605,7 @@ class WP_Query {
|
||||
// If year, month, day, hour, minute, and second are set, a single
|
||||
// post is being queried.
|
||||
$this->is_single = true;
|
||||
} elseif ( '' != $qv['pagename'] || !empty($qv['page_id']) ) {
|
||||
} elseif ( '' != $qv['static'] || '' != $qv['pagename'] || !empty($qv['page_id']) ) {
|
||||
$this->is_page = true;
|
||||
$this->is_single = false;
|
||||
} else {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.2.26';
|
||||
$wp_version = '4.2.19';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
@@ -14,10 +14,10 @@ require( dirname(__FILE__) . '/wp-load.php' );
|
||||
// Redirect to https login if forced to use SSL
|
||||
if ( force_ssl_admin() && ! is_ssl() ) {
|
||||
if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
|
||||
wp_safe_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
|
||||
wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
|
||||
exit();
|
||||
} else {
|
||||
wp_safe_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
|
||||
wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ function login_header( $title = 'Log In', $message = '', $wp_error = '' ) {
|
||||
global $error, $interim_login, $action;
|
||||
|
||||
// Don't index any of these forms
|
||||
add_action( 'login_head', 'wp_sensitive_page_meta' );
|
||||
add_action( 'login_head', 'wp_no_robots' );
|
||||
|
||||
if ( wp_is_mobile() )
|
||||
add_action( 'login_head', 'wp_login_viewport_meta' );
|
||||
|
||||
Reference in New Issue
Block a user