Current File : /dom550890/wp-content/plugins/wordpress-seo/src/integrations/admin/import-integration.php
<?php
namespace Yoast\WP\SEO\Integrations\Admin;
use WPSEO_Admin_Asset_Manager;
use Yoast\WP\SEO\Conditionals\Import_Tool_Selected_Conditional;
use Yoast\WP\SEO\Conditionals\Yoast_Tools_Page_Conditional;
use Yoast\WP\SEO\Integrations\Integration_Interface;
use Yoast\WP\SEO\Presenters\Admin\Alert_Presenter;
use Yoast\WP\SEO\Routes\Importing_Route;
use Yoast\WP\SEO\Services\Importing\Importable_Detector_Service;
/**
* Loads import script when on the Tool's page.
*/
class Import_Integration implements Integration_Interface {
/**
* Contains the asset manager.
*
* @var WPSEO_Admin_Asset_Manager
*/
protected $asset_manager;
/**
* The Importable Detector service.
*
* @var Importable_Detector_Service
*/
protected $importable_detector;
/**
* The Importing Route class.
*
* @var Importing_Route
*/
protected $importing_route;
/**
* Returns the conditionals based on which this loadable should be active.
*
* @return array
*/
public static function get_conditionals() {
return [
Import_Tool_Selected_Conditional::class,
Yoast_Tools_Page_Conditional::class,
];
}
/**
* Import Integration constructor.
*
* @param WPSEO_Admin_Asset_Manager $asset_manager The asset manager.
* @param Importable_Detector_Service $importable_detector The importable detector.
* @param Importing_Route $importing_route The importing route.
*/
public function __construct(
WPSEO_Admin_Asset_Manager $asset_manager,
Importable_Detector_Service $importable_detector,
Importing_Route $importing_route
) {
$this->asset_manager = $asset_manager;
$this->importable_detector = $importable_detector;
$this->importing_route = $importing_route;
}
/**
* Initializes the integration.
*
* This is the place to register hooks and filters.
*
* @return void
*/
public function register_hooks() {
\add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_import_script' ] );
}
/**
* Enqueues the Import script.
*
* @return void
*/
public function enqueue_import_script() {
\wp_enqueue_style( 'dashicons' );
$this->asset_manager->enqueue_script( 'import' );
$data = [
'restApi' => [
'root' => \esc_url_raw( \rest_url() ),
'cleanup_endpoints' => $this->get_cleanup_endpoints(),
'importing_endpoints' => $this->get_importing_endpoints(),
'nonce' => \wp_create_nonce( 'wp_rest' ),
],
'assets' => [
'loading_msg_import' => \esc_html__( 'The import can take a long time depending on your site\'s size.', 'wordpress-seo' ),
'loading_msg_cleanup' => \esc_html__( 'The cleanup can take a long time depending on your site\'s size.', 'wordpress-seo' ),
'note' => \esc_html__( 'Note: ', 'wordpress-seo' ),
'cleanup_after_import_msg' => \esc_html__( 'After you\'ve imported data from another SEO plugin, please make sure to clean up all the original data from that plugin. (step 5)', 'wordpress-seo' ),
'select_placeholder' => \esc_html__( 'Select SEO plugin', 'wordpress-seo' ),
'no_data_msg' => \esc_html__( 'No data found from other SEO plugins.', 'wordpress-seo' ),
'validation_failure' => $this->get_validation_failure_alert(),
'import_failure' => $this->get_import_failure_alert( true ),
'cleanup_failure' => $this->get_import_failure_alert( false ),
'spinner' => \admin_url( 'images/loading.gif' ),
'replacing_texts' => [
'cleanup_button' => \esc_html__( 'Clean up', 'wordpress-seo' ),
'import_explanation' => \esc_html__( 'Please select an SEO plugin below to see what data can be imported.', 'wordpress-seo' ),
'cleanup_explanation' => \esc_html__( 'Once you\'re certain that your site is working properly with the imported data from another SEO plugin, you can clean up all the original data from that plugin.', 'wordpress-seo' ),
/* translators: %s: expands to the name of the plugin that is selected to be imported */
'select_header' => \esc_html__( 'The import from %s includes:', 'wordpress-seo' ),
'plugins' => [
'aioseo' => [
[
'data_name' => \esc_html__( 'Post metadata (SEO titles, descriptions, etc.)', 'wordpress-seo' ),
'data_note' => \esc_html__( 'Note: This metadata will only be imported if there is no existing Yoast SEO metadata yet.', 'wordpress-seo' ),
],
[
'data_name' => \esc_html__( 'Default settings', 'wordpress-seo' ),
'data_note' => \esc_html__( 'Note: These settings will overwrite the default settings of Yoast SEO.', 'wordpress-seo' ),
],
],
'other' => [
[
'data_name' => \esc_html__( 'Post metadata (SEO titles, descriptions, etc.)', 'wordpress-seo' ),
'data_note' => \esc_html__( 'Note: This metadata will only be imported if there is no existing Yoast SEO metadata yet.', 'wordpress-seo' ),
],
],
],
],
],
];
/**
* Filter: 'wpseo_importing_data' Filter to adapt the data used in the import process.
*
* @param array $data The import data to adapt.
*/
$data = \apply_filters( 'wpseo_importing_data', $data );
$this->asset_manager->localize_script( 'import', 'yoastImportData', $data );
}
/**
* Retrieves a list of the importing endpoints to use.
*
* @return array The endpoints.
*/
protected function get_importing_endpoints() {
$available_actions = $this->importable_detector->detect_importers();
$importing_endpoints = [];
$available_sorted_actions = $this->sort_actions( $available_actions );
foreach ( $available_sorted_actions as $plugin => $types ) {
foreach ( $types as $type ) {
$importing_endpoints[ $plugin ][] = $this->importing_route->get_endpoint( $plugin, $type );
}
}
return $importing_endpoints;
}
/**
* Sorts the array of importing actions, by moving any validating actions to the start for every plugin.
*
* @param array $available_actions The array of actions that we want to sort.
*
* @return array The sorted array of actions.
*/
protected function sort_actions( $available_actions ) {
$first_action = 'validate_data';
$available_sorted_actions = [];
foreach ( $available_actions as $plugin => $plugin_available_actions ) {
$validate_action_position = \array_search( $first_action, $plugin_available_actions, true );
if ( ! empty( $validate_action_position ) ) {
unset( $plugin_available_actions[ $validate_action_position ] );
\array_unshift( $plugin_available_actions, $first_action );
}
$available_sorted_actions[ $plugin ] = $plugin_available_actions;
}
return $available_sorted_actions;
}
/**
* Retrieves a list of the importing endpoints to use.
*
* @return array The endpoints.
*/
protected function get_cleanup_endpoints() {
$available_actions = $this->importable_detector->detect_cleanups();
$importing_endpoints = [];
foreach ( $available_actions as $plugin => $types ) {
foreach ( $types as $type ) {
$importing_endpoints[ $plugin ][] = $this->importing_route->get_endpoint( $plugin, $type );
}
}
return $importing_endpoints;
}
/**
* Gets the validation failure alert using the Alert_Presenter.
*
* @return string The validation failure alert.
*/
protected function get_validation_failure_alert() {
$content = \esc_html__( 'The AIOSEO import was cancelled because some AIOSEO data is missing. Please try and take the following steps to fix this:', 'wordpress-seo' );
$content .= '<br/>';
$content .= '<ol><li>';
$content .= \esc_html__( 'If you have never saved any AIOSEO \'Search Appearance\' settings, please do that first and run the import again.', 'wordpress-seo' );
$content .= '</li>';
$content .= '<li>';
$content .= \esc_html__( 'If you already have saved AIOSEO \'Search Appearance\' settings and the issue persists, please contact our support team so we can take a closer look.', 'wordpress-seo' );
$content .= '</li></ol>';
$validation_failure_alert = new Alert_Presenter( $content, 'error' );
return $validation_failure_alert->present();
}
/**
* Gets the import failure alert using the Alert_Presenter.
*
* @param bool $is_import Wether it's an import or not.
*
* @return string The import failure alert.
*/
protected function get_import_failure_alert( $is_import ) {
$content = \esc_html__( 'Cleanup failed with the following error:', 'wordpress-seo' );
if ( $is_import ) {
$content = \esc_html__( 'Import failed with the following error:', 'wordpress-seo' );
}
$content .= '<br/><br/>';
$content .= \esc_html( '%s' );
$import_failure_alert = new Alert_Presenter( $content, 'error' );
return $import_failure_alert->present();
}
}
Zerion Mini Shell 1.0
Home - Professional Genealogists and Historians - LineagesSkip to content
Our talented staff of professional researchers can help you, whether you have hit a roadblock in your research or simply lack the time or training to tackle it yourself. Plus, our rates are 40% lower than many of our competitors! Check out our sample projects and then pick the research package that best fits your needs!
ENSLAVED PEOPLE & ENSLAVERS
Identifying the men and women who owned your ancestors during slavery requires finely honed skills and years of experience. Our expertise comes from having traced hundreds of African-American family trees. Choose the research package that best fits your needs, and we will start tracing your ancestors back to the slave period and look for their owners.
Genealogy Research that's Insightful, Thorough & Personal
Our staff of amazinggenealogistsand family historians cannot wait to start documenting your ancestry. They will work with you to plan and achieve your research goals.
We will need your help in bringing your ancestors back to life by supplying items not available in public records or online, such as photos, passages from diaries, family stories, unsolved mysteries, and other interesting details.
The end result will be a fun trip down several memory lanes, and you will want to share it with family and friends.
“When Alex Haley prodded me to have my ancestry traced, I reached out to Johni Cerny and she has been my genealogist for 34 years—tracing my African-American roots and the ancestry of many of my close friends. She eternally reminds all of us how we got to this planet. Johni also keeps my soul eternally smiling and nobody does it better!”
Quincy D. Jones
“Thank you, thank you, thank you…for the amazing work you did to identify my biological father. The DNA results were gibberish until you explained it in layman’s terms for me and then used it to find him. Now it is time for you to trace his ancestry. I can’t wait to see the results of that adventure!”
Janet Williamson
“Wow, the research package arrived a few days ago and I can hardly put it down. The report and all those wonderful documents tell an interesting story about my mother’s Graupman ancestors. We will treasure this forever! Let me know what else you can do to trace the Graupman line in German records.”
K. Meyer
“My sister always felt like the odd person out in our family. DNA testing confirmed we were half-siblings. In her late 60s, we didn’t hold out much hope for identifying her biological father. With over 1,000 matches, we turned to Lineages’ staff expert for help. A few months and a lot of hard work, they solved the mystery. Lineages gave my sister the gift of a lifetime. Thank you, Lineages!”
How Your Family Tree Could Make You a Citizen Somewhere in many American family trees is a name followed by a Canadian birthplace: a fishing village in Nova Scotia, a farm township in Ontario, a parish along the St. Lawrence River. Maybe it belongs to a great-grandmother who crossed into Michigan as a young woman…
Imagine sitting down with a photograph of a document that has stumped your family for three generations. It is a baptismal register from a village church, the ink faded to a whisper, the words looping across the page in a script that seems indecipherable. Previously, you could hire a specialist, spend months teaching yourself the…
What an immigrant’s disappearance taught me about the limits of records, the value of living relatives, and why some answers only exist in family memory. The ancestor in this story happened to be Swedish; the story itself is one that almost every immigrant family carries. Öckerö parish husförhörslängd AIIa:5 (1916–1938), Image 1490, Page 140 —…
For half a century, Price Genealogy has done more than just look at census records and birth certificates; we’ve listened to the echoes of the past to tell the stories that define your present As we celebrate our golden anniversary, we look back at five decades of unmatched expertise, and more importantly, look forward to…
Description: French soldier in service uniform Date: 1914 Library of Congress, public domain. If you have recent French ancestors, there’s a good chance they appear in one of the most useful record sets you may not be using: the Registres de Matricule, or Military Conscription Registers. Starting in the late 19th century, every young man…
Insights from 50 Years of Professional Genealogy Your ancestors are from a country outside of the United States – now what? If your ancestors are from European countries such as the United Kingdom, Scandinavia, Germany, France, Switzerland, Spain, Italy, or even Latin American countries such as Mexico and Brazil, you may be able to find…
What better way to honor the 250th birthday of the United States of America than by discovering and recognizing your family’s contributions to the foundation of the United States. Lineage societies offer an interesting opportunity to recognize those past contributions and to participate in activities today that will give our descendants reason to celebrate in…
For fifty years, Price Genealogy has had the privilege of walking alongside families as they uncover their roots. While our company name appears on every report, it’s our researchers who bring each story to life. Behind every carefully crafted report, every breakthrough discovery, and every long-awaited answer is a dedicated researcher who truly cares about…
The journey of a master genealogist often begins not in a grand archive, but in the quiet corners of a family home. For Richard Price, that journey began in 1962. Like many young teenagers, Richard was naturally curious, but the discovery of an old file drawer of family memorabilia in his grandfather’s garage, transformed a…
Understanding Pedigree Collapse A typical family tree looks like this, with you at the bottom and spreading out vertically as your ancestors multiply, from 2 parents, to 4 grandparents, 8 great grandparents, 16 great grandparents, and so on. But probably at some point for all of us a portion of our tree resembles more of…