Yoast\WP\SEO\Actions\Importing\Aioseo

Abstract_Aioseo_Settings_Importing_Action::index()publicYoast 1.0

Imports AIOSEO settings.

Метод класса: Abstract_Aioseo_Settings_Importing_Action{}

Хуков нет.

Возвращает

Массив|false. An array of the AIOSEO settings that were imported or false if aioseo data was not found.

Использование

$Abstract_Aioseo_Settings_Importing_Action = new Abstract_Aioseo_Settings_Importing_Action();
$Abstract_Aioseo_Settings_Importing_Action->index();

Код Abstract_Aioseo_Settings_Importing_Action::index() Yoast 24.6

public function index() {
	$limit            = $this->get_limit();
	$aioseo_settings  = $this->query( $limit );
	$created_settings = [];

	$completed = \count( $aioseo_settings ) === 0;
	$this->set_completed( $completed );

	// Prepare the setting keys mapping.
	$this->build_mapping();

	// Prepare the replacement var mapping.
	foreach ( $this->replace_vars_edited_map as $aioseo_var => $yoast_var ) {
		$this->replacevar_handler->compose_map( $aioseo_var, $yoast_var );
	}

	$last_imported_setting = '';
	try {
		foreach ( $aioseo_settings as $setting => $setting_value ) {
			// Map and import the values of the setting we're working with (eg. post, book-category, etc.) to the respective Yoast option.
			$this->map( $setting_value, $setting );

			// Save the type of the settings that were just imported, so that we can allow chunked imports.
			$last_imported_setting = $setting;

			$created_settings[] = $setting;
		}
	}
	finally {
		$cursor_id = $this->get_cursor_id();
		$this->import_cursor->set_cursor( $cursor_id, $last_imported_setting );
	}

	return $created_settings;
}