确保Yoast SEO分析所有高级自定义字段4和5的内容,包括灵活内容和中继器。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

51 lines
1.2 KiB

  1. <?php
  2. /**
  3. * ACF Content Analysis for Yoast SEO plugin file.
  4. *
  5. * @package YoastACFAnalysis
  6. */
  7. /**
  8. * Checks whether ACF is installed.
  9. */
  10. final class Yoast_ACF_Analysis_Dependency_ACF implements Yoast_ACF_Analysis_Dependency {
  11. /**
  12. * Checks if ACF is active.
  13. *
  14. * @return bool
  15. */
  16. public function is_met() {
  17. if ( ! class_exists( 'acf' ) ) {
  18. return false;
  19. }
  20. if ( defined( 'ACF_VERSION' ) && version_compare( ACF_VERSION, '5.7.0', '<' ) ) {
  21. return false;
  22. }
  23. return true;
  24. }
  25. /**
  26. * Registers the notification to show when the conditions are not met.
  27. */
  28. public function register_notifications() {
  29. add_action( 'admin_notices', [ $this, 'message_plugin_not_activated' ] );
  30. }
  31. /**
  32. * Notify that we need ACF to be installed and active.
  33. */
  34. public function message_plugin_not_activated() {
  35. $message = sprintf(
  36. /* translators: %1$s resolves to ACF Content Analysis for Yoast SEO, %2$s resolves to Advanced Custom Fields */
  37. __( '%1$s requires %2$s (free or pro) 5.7 or higher to be installed and activated.', 'acf-content-analysis-for-yoast-seo' ),
  38. 'ACF Content Analysis for Yoast SEO',
  39. 'Advanced Custom Fields'
  40. );
  41. printf( '<div class="error"><p>%s</p></div>', esc_html( $message ) );
  42. }
  43. }