/**
  * Register our actions and filters
  *
  * @static
  * @return void
  */
 public static function init()
 {
     $options = YMBESEO_Options::get_all();
     foreach (self::$social_networks as $option => $network) {
         if (true === $options[$option]) {
             foreach (self::$social_fields as $box => $type) {
                 self::$meta_fields['social'][$network . '-' . $box] = array('type' => $type, 'title' => '', 'default_value' => '', 'description' => '');
             }
         }
     }
     unset($options, $option, $network, $box, $type);
     /**
      * Allow add-on plugins to register their meta fields for management by this class
      * add_filter() calls must be made before plugins_loaded prio 14
      */
     $extra_fields = apply_filters('add_extra_YMBESEO_meta_fields', array());
     if (is_array($extra_fields)) {
         self::$meta_fields = self::array_merge_recursive_distinct($extra_fields, self::$meta_fields);
     }
     unset($extra_fields);
     $register = function_exists('register_meta');
     foreach (self::$meta_fields as $subset => $field_group) {
         foreach ($field_group as $key => $field_def) {
             if ($field_def['type'] !== 'snippetpreview') {
                 /**
                  * Function register_meta() is undocumented and not used by WP internally, wrapped in
                  * function_exists as a precaution in case they remove it.
                  */
                 if ($register === true) {
                     register_meta('post', self::$meta_prefix . $key, array(__CLASS__, 'sanitize_post_meta'));
                 } else {
                     add_filter('sanitize_post_meta_' . self::$meta_prefix . $key, array(__CLASS__, 'sanitize_post_meta'), 10, 2);
                 }
                 // Set the $fields_index property for efficiency.
                 self::$fields_index[self::$meta_prefix . $key] = array('subset' => $subset, 'key' => $key);
                 // Set the $defaults property for efficiency.
                 if (isset($field_def['default_value'])) {
                     self::$defaults[self::$meta_prefix . $key] = $field_def['default_value'];
                 } else {
                     // Meta will always be a string, so let's make the meta meta default also a string.
                     self::$defaults[self::$meta_prefix . $key] = '';
                 }
             }
         }
     }
     unset($subset, $field_group, $key, $field_def, $register);
     add_filter('update_post_metadata', array(__CLASS__, 'remove_meta_if_default'), 10, 5);
     add_filter('add_post_metadata', array(__CLASS__, 'dont_save_meta_if_default'), 10, 4);
 }