Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c7cabc5
Beging the Site Health integration
kienstra Nov 25, 2019
92a04d2
Add debugging information for the AMP plugin
kienstra Nov 27, 2019
8d7fd3f
Add the content types to the 'Templates enabled' information
kienstra Dec 2, 2019
b943f7e
Remove unnecessary add_theme_support() call
kienstra Dec 9, 2019
a7e4d73
Change the module filter to add intl, json, mbstring, and zip
kienstra Dec 11, 2019
990ef7e
Merge branch 'develop' into add/2199-site-health
kienstra Dec 11, 2019
bca3dc1
Address failed PHPUnit tests
kienstra Dec 12, 2019
2e459d6
Use a for loop instead of 3 calls of the same function
kienstra Dec 12, 2019
2a8c88b
Remove esc_url() wrappers from plain string URLs, update DocBlocks
kienstra Dec 12, 2019
54745fb
Merge branch 'develop' into add/2199-site-health
kienstra Dec 13, 2019
08e5ec1
Merge branch 'develop' into add/2199-site-health
kienstra Dec 13, 2019
067584c
Add a test for the ICU version, but this needs more thought
kienstra Dec 16, 2019
3e95814
Add a translators comment above an esc_html__() call
kienstra Dec 18, 2019
60970ce
Prefix the Site Health tests with 'amp_'
kienstra Dec 18, 2019
8d19165
Unset global value in tearDown() method
kienstra Dec 18, 2019
98db052
Merge branch 'develop' into add/2199-site-health
kienstra Dec 18, 2019
c06c68c
Merge branch 'develop' into add/2199-site-health
kienstra Dec 18, 2019
fb1d94f
Change minimum ICU version to 4.6
kienstra Dec 18, 2019
27f7372
Add debugging information for 'Serve all templates as AMP?'
kienstra Dec 18, 2019
54783a6
Always display the extra information about persistent object caching
kienstra Dec 18, 2019
097c57d
Change %s to %d for a float, and change %1$d to %d
kienstra Dec 18, 2019
4febeb6
In sprintf(), change %d back to %s, as %s does not allow multiple digits
kienstra Dec 18, 2019
8c160d5
Update the package from AMP to Amp\AmpWP
kienstra Dec 18, 2019
57ed521
Make the SiteHealth class final
kienstra Dec 18, 2019
cf97965
Correct the link for the curl documentation
kienstra Dec 18, 2019
8184e80
Correct failed unit test: test_curl_multi_functions()
kienstra Dec 19, 2019
5c8d4bb
Merge branch 'develop' into add/2199-site-health
kienstra Dec 19, 2019
74e0326
Change debug information key from 'amp' to 'amp_wp'
kienstra Dec 19, 2019
9fc127b
Represent versions as strings; improve escaping
westonruter Dec 19, 2019
d0e0a20
Remove periods from test labels
westonruter Dec 19, 2019
c3dde83
Improve cURL multi messages
westonruter Dec 19, 2019
af21727
Improve translated strings: de-duplicate and simplify
westonruter Dec 19, 2019
d1c4d05
Make tests more DRY by not copying translation strings
westonruter Dec 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions amp.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,7 @@ function amp_init() {
AMP_Service_Worker::init();
add_action( 'admin_init', 'AMP_Options_Manager::register_settings' );
add_action( 'wp_loaded', 'amp_add_options_menu' );
add_action( 'wp_loaded', 'amp_admin_pointer' );
add_action( 'wp_loaded', 'amp_post_meta_box' ); // Used in both Website and Stories experiences.
add_action( 'wp_loaded', 'amp_bootstrap_admin' );

if ( AMP_Options_Manager::is_website_experience_enabled() ) {
add_rewrite_endpoint( amp_get_slug(), EP_PERMALINK );
Expand Down
26 changes: 11 additions & 15 deletions includes/admin/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* @package AMP
*/

use Amp\AmpWP\Admin\SiteHealth;

/**
* Obsolete constant for flagging when Customizer is opened for AMP.
*
Expand Down Expand Up @@ -169,18 +171,6 @@ function amp_add_custom_analytics( $analytics = [] ) {
return $analytics;
}

/**
* Bootstrap AMP post meta box.
*
* This function must be invoked only once through the 'wp_loaded' action.
*
* @since 0.6
*/
function amp_post_meta_box() {
$post_meta_box = new AMP_Post_Meta_Box();
$post_meta_box->init();
}

/**
* Bootstrap AMP Editor core blocks.
*/
Expand All @@ -190,13 +180,19 @@ function amp_editor_core_blocks() {
}

/**
* Bootstrap the AMP admin pointer class.
* Bootstraps AMP admin classes.
*
* @since 1.0
* @since 1.5.0
*/
function amp_admin_pointer() {
function amp_bootstrap_admin() {
$admin_pointers = new AMP_Admin_Pointers();
$admin_pointers->init();

$post_meta_box = new AMP_Post_Meta_Box();
$post_meta_box->init();

$site_health = new SiteHealth();
$site_health->init();
}
Comment on lines +187 to 196

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General note: it seems somewhat strange that these instances are completely inaccessible since the variables are scoped in the function. This is probably a wider issue that should be addressed later, as it's worse to pollute the global namespace with more variables. /cc @schlessera

@kienstra kienstra Dec 18, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good point. It'd be good to have some access to them.


/**
Expand Down
22 changes: 22 additions & 0 deletions includes/deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,25 @@ function amp_post_template_add_schemaorg_metadata() {
_deprecated_function( __FUNCTION__, '0.7', 'amp_print_schemaorg_metadata' );
amp_print_schemaorg_metadata();
}

/**
* Bootstrap AMP post meta box.
*
* This function must be invoked only once through the 'wp_loaded' action.
*
* @since 0.6
* @deprecated Since 1.5.0, as admin class bootstrapping is moved to amp_bootstrap_admin().
*/
function amp_post_meta_box() {
_deprecated_function( __FUNCTION__, '1.5.0' );
}

/**
* Bootstrap the AMP admin pointer class.
*
* @since 1.0
* @deprecated Since 1.5.0, as admin class bootstrapping is moved to amp_bootstrap_admin().
*/
function amp_admin_pointer() {
_deprecated_function( __FUNCTION__, '1.5.0' );
}
32 changes: 14 additions & 18 deletions includes/options/class-amp-options-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -550,17 +550,15 @@ public static function render_welcome_notice() {
*/
public static function persistent_object_caching_notice() {
if ( ! wp_using_ext_object_cache() && 'toplevel_page_' . self::OPTION_NAME === get_current_screen()->id ) {
echo '<div class="notice notice-warning"><p>';
esc_html_e( 'The AMP plugin performs at its best when persistent object cache is enabled. Object caching is used to more effectively store image dimensions and parsed CSS. It also allows for post-processor caching to be used.', 'amp' );
echo ' ';
printf(
'<div class="notice notice-warning"><p>%s</p></div>',
wp_kses(
sprintf(
/* translators: %s: Persistent object cache support URL */
__( 'The AMP plugin performs at its best when persistent object cache is enabled. <a href="%s">More details</a>', 'amp' ),
esc_url( __( 'https://codex.wordpress.org/Class_Reference/WP_Object_Cache#Persistent_Caching', 'amp' ) )
),
[ 'a' => [ 'href' => true ] ]
)
'<a href="%s">%s</a>',
esc_url( __( 'https://codex.wordpress.org/Class_Reference/WP_Object_Cache#Persistent_Caching', 'amp' ) ),
esc_html__( 'More details', 'amp' )
);
echo '</p></div>';
}
}

Expand All @@ -578,17 +576,15 @@ public static function render_cache_miss_notice() {
return;
}

echo '<div class="notice notice-warning is-dismissible"><p>';
esc_html_e( 'The AMP plugin&lsquo;s post-processor cache was disabled due to the detection of highly-variable content.', 'amp' );
echo ' ';
printf(
'<div class="notice notice-warning is-dismissible"><p>%s</p></div>',
wp_kses(
sprintf(
/* translators: %s: post-processor cache support URL */
__( 'The AMP plugin&lsquo;s post-processor cache was disabled due to the detection of highly-variable content. <a href="%s">More details</a>', 'amp' ),
esc_url( __( 'https://github.com/ampproject/amp-wp/wiki/Post-Processor-Cache', 'amp' ) )
),
[ 'a' => [ 'href' => true ] ]
)
'<a href="%s">%s</a>',
esc_url( __( 'https://github.com/ampproject/amp-wp/wiki/Post-Processor-Cache', 'amp' ) ),
esc_html__( 'More details', 'amp' )
);
echo '</p></div>';
}

/**
Expand Down
Loading