-
Notifications
You must be signed in to change notification settings - Fork 804
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'trunk' into social/unified-connections-management
- Loading branch information
Showing
24 changed files
with
202 additions
and
52 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
projects/packages/connection/changelog/update-move-wpcom-rest-api-proxy-request-trait
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: changed | ||
|
||
Moved WPCOM_REST_API_Proxy_Request trait to the connection package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
projects/packages/jetpack-mu-wpcom/changelog/feat-introduce-wpcom-external-media-import-page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: added | ||
|
||
Import Media: Introduce the Import Media page |
5 changes: 5 additions & 0 deletions
5
projects/packages/jetpack-mu-wpcom/changelog/update-remove-duplicate-views-icons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Significance: patch | ||
Type: changed | ||
Comment: Removed no longer used code | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
projects/packages/jetpack-mu-wpcom/src/features/wpcom-media/wpcom-external-media-import.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log( 'Hello, Import Media Page' ); // eslint-disable-line no-console |
98 changes: 98 additions & 0 deletions
98
projects/packages/jetpack-mu-wpcom/src/features/wpcom-media/wpcom-external-media-import.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<?php | ||
/** | ||
* WordPress.com media import page. | ||
* | ||
* Adds WordPress.com-specific external media page to WordPress Media > Import. | ||
* | ||
* @package automattic/jetpack-mu-wpcom | ||
*/ | ||
|
||
if ( empty( $_GET['wpcom_external_media_import_page'] ) ) { // phpcs:disable WordPress.Security.NonceVerification.Recommended | ||
return; | ||
} | ||
|
||
/** | ||
* Register the WordPress.com-specific external media page to Media > Import. | ||
*/ | ||
function add_wpcom_external_media_import_page() { | ||
$wpcom_external_media_import_page_hook = add_submenu_page( | ||
'upload.php', | ||
__( 'Import Media', 'jetpack-mu-wpcom' ), | ||
__( 'Import Media', 'jetpack-mu-wpcom' ), | ||
'upload_files', | ||
'wpcom_external_media_import_page', | ||
'render_wpcom_external_media_import_page' | ||
); | ||
|
||
add_action( "load-$wpcom_external_media_import_page_hook", 'enqueue_wpcom_external_media_import_page' ); | ||
} | ||
add_action( 'admin_menu', 'add_wpcom_external_media_import_page' ); | ||
|
||
/** | ||
* Enqueue the assets of the wpcom external media page. | ||
*/ | ||
function enqueue_wpcom_external_media_import_page() { | ||
jetpack_mu_wpcom_enqueue_assets( 'wpcom-external-media-import-page', array( 'js' ) ); | ||
} | ||
|
||
/** | ||
* Render the container of the wpcom external media page. | ||
*/ | ||
function render_wpcom_external_media_import_page() { | ||
$title = __( 'Import Media', 'jetpack-mu-wpcom' ); | ||
$description = __( 'WordPress.com allows you to import media from various platforms directly into the Media Library. To begin, select a platform from the options below:', 'jetpack-mu-wpcom' ); | ||
$external_media_sources = array( | ||
array( | ||
'id' => 'google_photos', | ||
'name' => __( 'Google Photos', 'jetpack-mu-wpcom' ), | ||
'description' => __( 'Import media from your Google Photos account.', 'jetpack-mu-wpcom' ), | ||
), | ||
array( | ||
'id' => 'pexels', | ||
'name' => __( 'Pexels free photos', 'jetpack-mu-wpcom' ), | ||
'description' => __( 'Free stock photos, royalty free images shared by creators.', 'jetpack-mu-wpcom' ), | ||
), | ||
array( | ||
'id' => 'openverse', | ||
'name' => __( 'Openverse', 'jetpack-mu-wpcom' ), | ||
'description' => __( 'Explore more than 800 million creative works.', 'jetpack-mu-wpcom' ), | ||
), | ||
); | ||
|
||
?> | ||
<div class="wrap"> | ||
<h1><?php echo esc_html( $title ); ?></h1> | ||
<p><?php echo esc_html( $description ); ?></p> | ||
<table class="widefat importers striped"> | ||
<?php | ||
foreach ( $external_media_sources as $external_media_source ) { | ||
$id = $external_media_source['id']; | ||
$name = $external_media_source['name']; | ||
$description = $external_media_source['description']; | ||
$action = sprintf( | ||
'<a id="%1$s" aria-label="%2$s">%3$s</a>', | ||
esc_attr( $id ), | ||
/* translators: %s: The name of the external media source. */ | ||
esc_attr( sprintf( __( 'Import %s', 'jetpack-mu-wpcom' ), $name ) ), | ||
__( 'Import now', 'jetpack-mu-wpcom' ) | ||
); | ||
|
||
?> | ||
<tr class='importer-item'> | ||
<td class='import-system'> | ||
<span class='importer-title'><?php echo esc_html( $name ); ?></span> | ||
<span class='importer-action'> | ||
<?php echo $action; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- we escape things above. ?> | ||
</span> | ||
</td> | ||
<td class='desc'> | ||
<span class='importer-desc'><?php echo esc_html( $description ); ?></span> | ||
</td> | ||
</tr> | ||
<?php | ||
} | ||
?> | ||
</table> | ||
</div> | ||
<?php | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.