Yoast\WP\SEO\Actions\Importing\Aioseo
Aioseo_Posts_Importing_Action::query()
Creates a query for gathering AiOSEO data from the database.
Метод класса: Aioseo_Posts_Importing_Action{}
Хуки из метода
Возвращает
Строку
. The query to use for importing or counting the number of items to import.
Использование
$Aioseo_Posts_Importing_Action = new Aioseo_Posts_Importing_Action(); $Aioseo_Posts_Importing_Action->query( $limit, $just_detect );
- $limit(int)
- The maximum number of unimported objects to be returned.
По умолчанию: false - $just_detect(true|false)
- Whether we want to just detect if there are unimported objects. If false, we want to actually import them too.
По умолчанию: false
Код Aioseo_Posts_Importing_Action::query() Aioseo Posts Importing Action::query Yoast 24.0
public function query( $limit = false, $just_detect = false ) { $table = $this->aioseo_helper->get_table(); $select_statement = 'id'; if ( ! $just_detect ) { // If we want to import too, we need the actual needed data from AIOSEO indexables. $needed_data = $this->get_needed_data(); $select_statement = \implode( ', ', $needed_data ); } $cursor_id = $this->get_cursor_id(); $cursor = $this->import_cursor->get_cursor( $cursor_id ); /** * Filter 'wpseo_aioseo_post_cursor' - Allow filtering the value of the aioseo post import cursor. * * @param int $import_cursor The value of the aioseo post import cursor. */ $cursor = \apply_filters( 'wpseo_aioseo_post_import_cursor', $cursor ); $replacements = [ $cursor ]; $limit_statement = ''; if ( ! empty( $limit ) ) { $replacements[] = $limit; $limit_statement = ' LIMIT %d'; } // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Reason: There is no unescaped user input. return $this->wpdb->prepare( "SELECT {$select_statement} FROM {$table} WHERE id > %d ORDER BY id{$limit_statement}", $replacements ); // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared }