/**
  * Allow for field injections
  *
  * @param WPSEO_Config_Field $field Field to add to the stack.
  */
 public function add_field(WPSEO_Config_Field $field)
 {
     $this->fields[] = $field;
     if (isset($this->adapter)) {
         $field->set_adapter($this->adapter);
     }
 }
 /**
  * WPSEO_Config_Field_Post_Type_Visibility constructor.
  */
 public function __construct()
 {
     parent::__construct('postTypeVisibility', 'HTML');
     $copy = __('Please specify which of the following public post types you would like Google to see.', 'wordpress-seo');
     $html = '<p>' . $copy . '</p><br/>';
     $this->set_property('html', $html);
 }
 /**
  * WPSEO_Config_Field_Social_Profiles_Intro constructor.
  */
 public function __construct()
 {
     parent::__construct('socialProfilesIntro', 'HTML');
     $intro_text = __('Please add all your relevant social profiles. We use these to let search engines know about them, and to enhance your social metadata:', 'wordpress-seo');
     $html = '<p>' . $intro_text . '</p>';
     $this->set_property('html', $html);
 }
 /**
  * WPSEO_Config_Field_Upsell_Site_Review constructor.
  */
 public function __construct()
 {
     parent::__construct('upsellSiteReview', 'HTML');
     /* translators: Text between %1$s and %2$s will be a link to a review explanation page. Text between %3$s and %4$s will be a link to an SEO copywriting course page. */
     $upsell_text = sprintf(__('If you want more help creating awesome content, check out our %3$sSEO copywriting course%4$s. We can also %1$sreview your site%2$s if you’d like some more in-depth help!', 'wordpress-seo'), '<a href="https://yoa.st/1a" target="_blank">', '</a>', '<a href="https://yoa.st/configuration-wizard-copywrite-course-link" target="_blank">', '</a>');
     $html = '<p>' . $upsell_text . '</p>';
     $this->set_property('html', $html);
 }
 /**
  * WPSEO_Config_Field_Upsell_Configuration_Service constructor.
  */
 public function __construct()
 {
     parent::__construct('upsellConfigurationService', 'HTML');
     $intro_text = __('Welcome to the Yoast SEO installation wizard. In a few simple steps we\'ll help you configure your SEO settings to match your website\'s needs!', 'wordpress-seo');
     /* Translators: %1$s opens the link, %2$s closes the link. */
     $upsell_text = sprintf(__('While we strive to make setting up Yoast SEO as easy as possible, we understand it can be daunting. If you’d rather have us set up Yoast SEO for you (and get a copy of Yoast SEO Premium in the process), order our %1$sYoast SEO configuration service%2$s here!', 'wordpress-seo'), '<a target="_blank" href="https://yoa.st/configuration-package">', '</a>');
     $html = '<p>' . $intro_text . '</p>';
     $html .= '<p><em>' . $upsell_text . '</em></p>';
     $this->set_property('html', $html);
 }
 /**
  * WPSEO_Config_Field_Success_Message constructor.
  */
 public function __construct()
 {
     parent::__construct('successMessage', 'HTML');
     $success_message = __('You’ve done it! You&#039;ve set up Yoast SEO, and Yoast SEO will now take care of all the needed technical optimization of your site. To really improve your site&#039;s performance in the search results, it&#039;s important to start creating content that ranks well for keywords you care about.', 'wordpress-seo');
     $onpage_seo = __('Check out the video below in which we explain how to use the Yoast SEO metabox when you edit posts or pages', 'wordpress-seo');
     $content_analysis_video = sprintf('<iframe width="560" height="315" src="https://yoa.st/metabox-screencast" title="%s" frameborder="0" allowfullscreen></iframe>', __('Yoast SEO video tutorial', 'wordpress-seo'));
     $html = '<p>' . $success_message . '</p>';
     $html .= '<p>' . $onpage_seo . '</p>';
     $html .= '<div class="yoast-video-container-max-width"><div class="yoast-video-container">' . $content_analysis_video . '</div></div>';
     $this->set_property('html', $html);
 }
 /**
  * WPSEO_Config_Field_Mailchimp_Signup constructor.
  */
 public function __construct()
 {
     parent::__construct('mailchimpSignup', 'MailchimpSignup');
     $current_user = wp_get_current_user();
     $user_email = $current_user->ID > 0 ? $current_user->user_email : '';
     $this->set_property('title', __('Newsletter signup', 'wordpress-seo'));
     $this->set_property('label', __('If you would like us to keep you up-to-date regarding Yoast SEO, other plugins by Yoast and major news in the world of SEO, subscribe to our newsletter:', 'wordpress-seo'));
     $this->set_property('mailchimpActionUrl', 'https://yoast.us1.list-manage.com/subscribe/post-json?u=ffa93edfe21752c921f860358&id=972f1c9122');
     $this->set_property('currentUserEmail', $user_email);
     $this->set_property('userName', trim($current_user->user_firstname . ' ' . $current_user->user_lastname));
 }
 /**
  * WPSEO_Config_Field_Profile_URL_MySpace constructor.
  */
 public function __construct()
 {
     parent::__construct('profileUrlMySpace', 'Input');
     $this->set_property('label', __('MySpace URL', 'wordpress-seo'));
     $this->set_property('pattern', '^https:\\/\\/myspace\\.com\\/([^/]+)\\/$');
 }
 /**
  * WPSEO_Config_Field_Profile_URL_YouTube constructor.
  */
 public function __construct()
 {
     parent::__construct('profileUrlYouTube', 'Input');
     $this->set_property('label', __('YouTube URL', 'wordpress-seo'));
     $this->set_property('pattern', '^https:\\/\\/www\\.youtube\\.com\\/([^/]+)$');
 }
 /**
  * WPSEO_Config_Field_Profile_URL_LinkedIn constructor.
  */
 public function __construct()
 {
     parent::__construct('profileUrlLinkedIn', 'Input');
     $this->set_property('label', __('LinkedIn URL', 'wordpress-seo'));
     $this->set_property('pattern', '^https:\\/\\/www\\.linkedin\\.com\\/in\\/([^/]+)$');
 }
 /**
  * WPSEO_Config_Field_Profile_URL_Pinterest constructor.
  */
 public function __construct()
 {
     parent::__construct('profileUrlPinterest', 'Input');
     $this->set_property('label', __('Pinterest URL', 'wordpress-seo'));
     $this->set_property('pattern', '^https:\\/\\/www\\.pinterest\\.com\\/([^/]+)\\/$');
 }
 /**
  * Save data from a field
  *
  * @param WPSEO_Config_Field $field Field to use for lookup.
  * @param mixed              $value Value to save to the lookup of the field.
  *
  * @return bool
  */
 public function set(WPSEO_Config_Field $field, $value)
 {
     $identifier = $field->get_identifier();
     // Lookup option and retrieve value.
     $type = $this->get_option_type($identifier);
     $option = $this->get_option($identifier);
     switch ($type) {
         case self::OPTION_TYPE_WORDPRESS:
             return update_option($option, $value);
         case self::OPTION_TYPE_YOAST:
             $group = WPSEO_Options::get_option($option[0]);
             $group[$option[1]] = $value;
             update_option($option[0], $group);
             $saved = WPSEO_Options::get_option($option[0]);
             return $saved[$option[1]] === $value;
         case self::OPTION_TYPE_CUSTOM:
             return call_user_func($option[1], $value);
     }
     return false;
 }
 /**
  * WPSEO_Config_Field_Choice constructor.
  *
  * @param string $field Field name to use.
  */
 public function __construct($field)
 {
     parent::__construct($field, 'Choice');
     $this->properties['choices'] = array();
 }
 /**
  * WPSEO_Config_Field_Company_Logo constructor.
  */
 public function __construct()
 {
     parent::__construct('publishingEntityCompanyLogo', 'MediaUpload');
     $this->set_property('label', __('Provide an image of the company logo', 'wordpress-seo'));
     $this->set_requires('publishingEntityType', 'company');
 }
 /**
  * Add custom properties for specific post types
  *
  * @param string             $post_type Post type of field that is being added.
  * @param WPSEO_Config_Field $field     Field that corresponds to the post type.
  */
 private function add_custom_properties($post_type, $field)
 {
     if ('attachment' === $post_type) {
         $field->set_property('explanation', __('WordPress automatically generates an URL for each media item in the library. Enabling this will allow for google to index the generated URL.', 'wordpress-seo'));
     }
 }
 /**
  * WPSEO_Config_Field_Connect_Google_Search_Console constructor.
  */
 public function __construct()
 {
     parent::__construct('connectGoogleSearchConsole', 'ConnectGoogleSearchConsole');
 }
 /**
  * WPSEO_Config_Field_Profile_URL_GooglePlus constructor.
  */
 public function __construct()
 {
     parent::__construct('profileUrlGooglePlus', 'Input');
     $this->set_property('label', __('Google+ URL', 'wordpress-seo'));
     $this->set_property('pattern', '^https:\\/\\/plus\\.google\\.com\\/([^/]+)$');
 }
 /**
  * WPSEO_Config_Field_Company_Or_Person constructor.
  */
 public function __construct()
 {
     parent::__construct('publishingEntityPersonName', 'Input');
     $this->set_property('label', __('The name of the person', 'wordpress-seo'));
     $this->set_requires('publishingEntityType', 'person');
 }
 /**
  * WPSEO_Config_Field_Profile_URL_Twitter constructor.
  */
 public function __construct()
 {
     parent::__construct('profileUrlTwitter', 'Input');
     $this->set_property('label', __('Twitter Username', 'wordpress-seo'));
 }
 /**
  * WPSEO_Config_Field_Site_Name constructor.
  */
 public function __construct()
 {
     parent::__construct('siteName', 'Input');
     $this->set_property('label', __('Website name', 'wordpress-seo'));
     $this->set_property('explanation', __('Google shows your website\'s name in the search results, if you want to change it, you can do that here.', 'wordpress-seo'));
 }
 /**
  * WPSEO_Config_Field_Profile_URL_Facebook constructor.
  */
 public function __construct()
 {
     parent::__construct('profileUrlFacebook', 'Input');
     $this->set_property('label', __('Facebook Page URL', 'wordpress-seo'));
     $this->set_property('pattern', '^https:\\/\\/www\\.facebook\\.com\\/([^/]+)\\/$');
 }