class-configuration-structure.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin\ConfigurationUI
  6. */
  7. /**
  8. * Class WPSEO_Configuration_Structure
  9. */
  10. class WPSEO_Configuration_Structure {
  11. /** @var array Registered steps */
  12. protected $steps = array();
  13. /**
  14. * WPSEO_Configuration_Structure constructor.
  15. */
  16. public function initialize() {
  17. $this->add_step( 'intro', __( 'Welcome!', 'wordpress-seo' ), array(
  18. 'configurationChoices',
  19. ), false, true );
  20. $this->add_step( 'environment_type', __( 'Environment', 'wordpress-seo' ), array( 'environment_type' ) );
  21. $this->add_step( 'siteType', __( 'Site type', 'wordpress-seo' ), array( 'siteType' ) );
  22. $this->add_step( 'publishingEntity', __( 'Company or person', 'wordpress-seo' ), array(
  23. 'publishingEntity',
  24. 'publishingEntityType',
  25. 'publishingEntityCompanyName',
  26. 'publishingEntityCompanyLogo',
  27. 'publishingEntityPersonName',
  28. ) );
  29. $this->add_step( 'profileUrls', __( 'Social profiles', 'wordpress-seo' ), array(
  30. 'socialProfilesIntro',
  31. 'profileUrlFacebook',
  32. 'profileUrlTwitter',
  33. 'profileUrlInstagram',
  34. 'profileUrlLinkedIn',
  35. 'profileUrlMySpace',
  36. 'profileUrlPinterest',
  37. 'profileUrlYouTube',
  38. 'profileUrlGooglePlus',
  39. ) );
  40. $fields = array( 'postTypeVisibility' );
  41. $post_type_factory = new WPSEO_Config_Factory_Post_Type();
  42. foreach ( $post_type_factory->get_fields() as $post_type_field ) {
  43. $fields[] = $post_type_field->get_identifier();
  44. }
  45. $this->add_step( 'postTypeVisibility', __( 'Search engine visibility', 'wordpress-seo' ), $fields );
  46. $this->add_step( 'multipleAuthors', __( 'Multiple authors', 'wordpress-seo' ), array( 'multipleAuthors' ) );
  47. $this->add_step( 'connectGoogleSearchConsole', __( 'Google Search Console', 'wordpress-seo' ), array(
  48. 'googleSearchConsoleIntro',
  49. 'connectGoogleSearchConsole',
  50. ) );
  51. $this->add_step( 'titleTemplate', __( 'Title settings', 'wordpress-seo' ), array(
  52. 'titleIntro',
  53. 'siteName',
  54. 'separator',
  55. ) );
  56. $this->add_step( 'newsletter', __( 'Newsletter', 'wordpress-seo' ), array(
  57. 'mailchimpSignup',
  58. ), true, true );
  59. $this->add_step( 'suggestions', __( 'You might like', 'wordpress-seo' ), array(
  60. 'suggestions',
  61. ), true, true );
  62. $this->add_step( 'success', __( 'Success!', 'wordpress-seo' ), array(
  63. 'successMessage',
  64. ), true, true );
  65. }
  66. /**
  67. * Add a step to the structure
  68. *
  69. * @param string $identifier Identifier for this step.
  70. * @param string $title Title to display for this step.
  71. * @param array $fields Fields to use on the step.
  72. * @param bool $navigation Show navigation buttons.
  73. * @param bool $full_width Wheter the step content is full width or not.
  74. */
  75. protected function add_step( $identifier, $title, $fields, $navigation = true, $full_width = false ) {
  76. $this->steps[ $identifier ] = array(
  77. 'title' => $title,
  78. 'fields' => $fields,
  79. 'hideNavigation' => ! (bool) $navigation,
  80. 'fullWidth' => $full_width,
  81. );
  82. }
  83. /**
  84. * Retrieve the registered steps
  85. *
  86. * @return array
  87. */
  88. public function retrieve() {
  89. return $this->steps;
  90. }
  91. }