*/ protected function post_keys() { return array( 'title' => 'rank_math_title', 'description' => 'rank_math_description', 'canonical' => 'rank_math_canonical_url', 'noindex' => 'rank_math_robots', 'nofollow' => 'rank_math_robots', 'focus_keyword' => 'rank_math_focus_keyword', ); } /** * Rank Math variable names => Orbitstem variables. * * @return array */ protected function variables() { return array( 'title' => '%title%', 'excerpt' => '%excerpt%', 'excerpt_only' => '%excerpt%', 'sitename' => '%sitename%', 'sitedesc' => '%tagline%', 'sep' => '%sep%', 'page' => '%page%', 'term' => '%term%', 'term_description' => '%term_description%', 'name' => '%author%', 'search_query' => '%search%', 'pt_plural' => '%type%', ); } /** * Rank Math variables: %name% or %name(arguments)%, names may contain hyphens. * * @return string */ protected function token_pattern() { return '/%([a-z0-9_-]+)(?:\([^)]*\))?%/i'; } /** * Robots is stored as an array of directives. * * @param string $field Field. * @param mixed $raw Stored value. * @return bool */ protected function robots_flag( $field, $raw ) { return is_array( $raw ) && in_array( $field, $raw, true ); } /** * Term IDs with Rank Math term meta, after a cursor. * * @param int $after Last processed ID. * @param int $limit Batch size. * @return int[] */ protected function candidate_term_ids( $after, $limit ) { return $this->term_ids_from_meta( array_values( $this->post_keys() ), $after, $limit ); } /** * Raw values for one term. * * @param int $term_id Term ID. * @return array */ protected function read_term_raw( $term_id ) { $raw = array(); foreach ( $this->post_keys() as $field => $key ) { $raw[ $field ] = get_term_meta( $term_id, $key, true ); } return $raw; } }