oreach ( $dynamicRoles as $role => $data ) {
if ( empty( $this->customRoles[ $role ] ) ) {
$missing[ $role ] = $data;
}
}
foreach ( $missing as $roleName => $roleSettings ) {
$this->backup['roles'][ $roleName ] = aioseo()->dynamicOptions->convertOptionsToValues( $roleSettings, 'value' );
$this->shouldBackup = true;
}
}
/**
* Maybe backup the Post Types.
*
* @since 4.1.3
*
* @param array $newOptions An array of options to check.
* @return void
*/
protected function maybeBackupPostType( $newOptions ) {
parent::maybeBackupPostType( $newOptions );
// Maybe backup the post types for Breadcrumbs.
foreach ( $newOptions['breadcrumbs']['postTypes'] as $dynamicPostTypeName => $dynamicPostTypeSettings ) {
$found = in_array( $dynamicPostTypeName, $this->postTypes, true );
if ( ! $found ) {
$this->backup['postTypes'][ $dynamicPostTypeName ]['breadcrumbs'] = $dynamicPostTypeSettings;
$this->shouldBackup = true;
}
}
}
/**
* Maybe backup the Taxonomies.
*
* @since 4.1.4
*
* @param array $newOptions An array of new options.
* @return void
*/
protected function maybeBackupTaxonomy( $newOptions ) {
parent::maybeBackupTaxonomy( $newOptions );
// Maybe backup the taxonomies for Social Networks.
foreach ( $newOptions['social']['facebook']['general']['taxonomies'] as $dynamicTaxonomyName => $dynamicTaxonomySettings ) {
$found = in_array( $dynamicTaxonomyName, $this->taxonomies, true );
if ( ! $found ) {
$this->backup['taxonomies'][ $dynamicTaxonomyName ]['social']['facebook'] = $dynamicTaxonomySettings;
$this->shouldBackup = true;
}
}
// Maybe backup the taxonomies for Breadcrumbs.
foreach ( $newOptions['breadcrumbs']['taxonomies'] as $dynamicTaxonomyName => $dynamicTaxonomySettings ) {
$found = in_array( $dynamicTaxonomyName, $this->taxonomies, true );
if ( ! $found ) {
$this->backup['taxonomies'][ $dynamicTaxonomyName ]['breadcrumbs'] = $dynamicTaxonomySettings;
$this->shouldBackup = true;
}
}
}
/**
* Maybe backup the Archives.
*
* @since 4.1.3
*
* @param array $newOptions An array of options to check.
* @return void
*/
protected function maybeBackupArchives( $newOptions ) {
parent::maybeBackupArchives( $newOptions );
// Maybe backup the archives for Breadcrumbs.
foreach ( $newOptions['breadcrumbs']['archives']['postTypes'] as $archiveName => $archiveSettings ) {
$found = in_array( $archiveName, $this->archives, true );
if ( ! $found ) {
$this->backup['archives'][ $archiveName ]['breadcrumbs'] = $archiveSettings;
$this->shouldBackup = true;
}
}
}
}