Score to use.
*/
protected function get_keyword_score( $keyword, $score ) {
if ( empty( $keyword ) ) {
return null;
}
return $score;
}
/**
* Retrieves the lookup table.
*
* @return array Lookup table for the indexable fields.
*/
protected function get_indexable_lookup() {
return [
'focuskw' => 'primary_focus_keyword',
'canonical' => 'canonical',
'title' => 'title',
'metadesc' => 'description',
'bctitle' => 'breadcrumb_title',
'opengraph-title' => 'open_graph_title',
'opengraph-image' => 'open_graph_image',
'opengraph-image-id' => 'open_graph_image_id',
'opengraph-description' => 'open_graph_description',
'twitter-title' => 'twitter_title',
'twitter-image' => 'twitter_image',
'twitter-image-id' => 'twitter_image_id',
'twitter-description' => 'twitter_description',
'estimated-reading-time-minutes' => 'estimated_reading_time_minutes',
];
}
/**
* Finds an alternative image for the social image.
*
* @param Indexable $indexable The indexable.
*
* @return array|bool False when not found, array with data when found.
*/
protected function find_alternative_image( Indexable $indexable ) {
if (
$indexable->object_sub_type === 'attachment'
&& $this->image->is_valid_attachment( $indexable->object_id )
) {
return [
'image_id' => $indexable->object_id,
'source' => 'attachment-image',
];
}
$featured_image_id = $this->image->get_featured_image_id( $indexable->object_id );
if ( $featured_image_id ) {
return [
'image_id' => $featured_image_id,
'source' => 'featured-image',
];
}
$gallery_image = $this->image->get_gallery_image( $indexable->object_id );
if ( $gallery_image ) {
return [
'image' => $gallery_image,
'source' => 'gallery-image',
];
}
$content_image = $this->image->get_post_content_image( $indexable->object_id );
if ( $content_image ) {
return [
'image' => $content_image,
'source' => 'first-content-image',
];
}
return false;
}
/**
* Gets the number of pages for a post.
*
* @param object $post The post object.
*
* @return int|null The number of pages or null if the post isn't paginated.
*/
protected function get_number_of_pages_for_post( $post ) {
$number_of_pages = ( \substr_count( $post->post_content, '' ) + 1 );
if ( $number_of_pages <= 1 ) {
return null;
}
return $number_of_pages;
}
/**
* Checks whether an indexable should be built for this post.
*
* @param WP_Post $post The post for which an indexable should be built.
*
* @return bool `true` if the post should be excluded from building, `false` if not.
*/
protected function should_exclude_post( $post ) {
return $this->post_type_helper->is_excluded( $post->post_type );
}
/**
* Transforms an empty string into null. Leaves non-empty strings intact.
*
* @param string $text The string.
*
* @return string|null The input string or null.
*/
protected function empty_string_to_null( $text ) {
if ( ! \is_string( $text ) || $text === '' ) {
return null;
}
return $text;
}
}
nction¸0 8 ffff$objÿ@ ˜D ) {
if ( 'jquery' === $handle ) {
$handle = 'jquery-core';
}
if ( is_array( $l10n ) && isset( $l10n['l10n_print_after'] ) ) { // back compat, preserve the code in 'l10n_print_after' if present.
$after = $l10n['l10n_print_after'];
unset( $l10n['l10n_print_after'] );
}
if ( ! is_array( $l10n ) ) {
_doing_it_wrong(
__METHOD__,
sprintf(
/* translators: 1: $l10n, 2: wp_add_inline_script() */
__( 'The %1$s parameter must be an array. To pass arbitrary data to scripts, use the %2$s function instead.' ),
'$l10n
',
'wp_add_inline_script()
'
),
'5.7.0'
);
if ( false === $l10n ) {
// This should really not be needed, but is necessary for backward compatibility.
$l10n = array( $l10n );
}
}
if ( is_string( $l10n ) ) {
$l10n = html_entity_decode( $l10n, ENT_QUOTES, 'UTF-8' );
} elseif ( is_array( $l10n ) ) {
foreach ( $l10n as $key => $value ) {
if ( ! is_scalar( $value ) ) {
continue;
}
$l10n[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
}
}
$script = "var $object_name = " . wp_json_encode( $l10n ) . ';';
if ( ! empty( $after ) ) {
$script .= "\n$after;";
}
$data = $this->get_data( $handle, 'data' );
if ( ! empty( $data ) ) {
$script = "$data\n$script";
}
return $this->add_data( $handle, 'data', $script );
}
/**
* Sets handle group.
*
* @since 2.8.0
*
* @see WP_Dependencies::set_group()
*
* @param string $handle Name of the item. Should be unique.
* @param bool $recursion Internal flag that calling function was called recursively.
* @param int|false $group Optional. Group level: level (int), no groups (false).
* Default false.
* @return bool Not already in the group or a lower group.
*/
public function set_group( $handle, $recursion, $group = false ) {
if ( isset( $this->registered[ $handle ]->args ) && 1 === $this->registered[ $handle ]->args ) {
$grp = 1;
} else {
$grp = (int) $this->get_data( $handle, 'group' );
}
if ( false !== $group && $grp > $group ) {
$grp = $group;
}
return parent::set_group( $handle, $recursion, $grp );
}
/**
* Sets a translation textdomain.
*
* @since 5.0.0
* @since 5.1.0 The `$domain` parameter was made optional.
*
* @param string $handle Name of the script to register a translation domain to.
* @param string $domain Optional. Text domain. Default 'default'.
* @param string $path Optional. The full file path to the directory containing translation files.
* @return bool True if the text domain was registered, false if not.
*/
public function set_translations( $handle, $domain = 'default', $path = '' ) {
if ( ! isset( $this->registered[ $handle ] ) ) {
return false;
}
/** @var \_WP_Dependency $obj */
$obj = $this->registered[ $handle ];
if ( ! in_array( 'wp-i18n', $obj->deps, true ) ) {
$obj->deps[] = 'wp-i18n';
}
return $obj->set_translations( $domain, $path );
}
/**
* Prints translations set for a specific handle.
*
* @since 5.0.0
*
* @param string $handle Name of the script to add the inline script to.
* Must be lowercase.
* @param bool $display Optional. Whether to print the script
* instead of just returning it. Default true.
* @return string|false Script on success, false otherwise.
*/
public function print_translations( $handle, $display = true ) {
if ( ! isset( $this->registered[ $handle ] ) || empty( $this->registered[ $handle ]->textdomain ) ) {
return false;
}
$domain = $this->registered[ $handle ]->textdomain;
$path = '';
if ( isset( $this->registered[ $handle ]->translations_path ) ) {
$path = $this->registered[ $handle ]->translations_path;
}
$json_translations = load_script_textdomain( $handle, $domain, $path );
if ( ! $json_translations ) {
return false;
}
$output = <<\n%s\n\n", $this->type_attr, esc_attr( $handle ), $output );
}
return $output;
}
/**
* Determines script dependencies.
*
* @since 2.1.0
*
* @see WP_Dependencies::all_deps()
*
* @param string|string[] $handles Item handle (string) or item handles (array of strings).
* @param bool $recursion Optional. Internal flag that function is calling itself.
* Default false.
* @param int|false $group Optional. Group level: level (int), no groups (false).
* Default false.
* @return bool True on success, false on failure.
*/
public function all_deps( $handles, $recursion = false, $group = false ) {
$r = parent::all_deps( $handles, $recursion, $group );
if ( ! $recursion ) {
/**
* Filters the list of script dependencies left to print.
*
* @since 2.3.0
*
* @param string[] $to_do An array of script dependency handles.
*/
$this->to_do = apply_filters( 'print_scripts_array', $this->to_do );
}
return $r;
}
/**
* Processes items and dependencies for the head group.
*
* @since 2.8.0
*
* @see WP_Dependencies::do_items()
*
* @return string[] Handles of items that have been processed.
*/
public function do_head_items() {
$this->do_items( false, 0 );
return $this->done;
}
/**
* Processes items and dependencies for the footer group.
*
* @since 2.8.0
*
* @see WP_Dependencies::do_items()
*
* @return string[] Handles of items that have been processed.
*/
public function do_footer_items() {
$this->do_items( false, 1 );
return $this->done;
}
/**
* Whether a handle's source is in a default directory.
*
* @since 2.8.0
*
* @param string $src The source of the enqueued script.
* @return bool True if found, false if not.
*/
public function in_default_dir( $src ) {
if ( ! $this->default_dirs ) {
return true;
}
if ( 0 === strpos( $src, '/' . WPINC . '/js/l10n' ) ) {
return false;
}
foreach ( (array) $this->default_dirs as $test ) {
if ( 0 === strpos( $src, $test ) ) {
return true;
}
}
return false;
}
/**
* Resets class properties.
*
* @since 2.8.0
*/
public function reset() {
$this->do_concat = false;
$this->print_code = '';
$this->concat = '';
$this->concat_version = '';
$this->print_html = '';
$this->ext_version = '';
$this->ext_handles = '';
}
}
pK € ffff 'naH%B øèC array(
'description' => __( 'The title for the taxonomy.' ),
'type' => 'string',
'context' => array( 8 'edit', 'embed' ),
'readonly' => true,
),
'slug' => array(
'description' => __( 'An alphanumeric identifier for the taxonomy.' ),
'type' => 'string',
'context' => array( 'view', 'edit', 'embed' ),
'readonly' => true,
),
'show_cloud' => array(
'description' => __( 'Whether or not the term cloud should be displayed.' ),
'type' => 'boolean',
'context' => array( 'edit' ),
'readonly' => true,
),
'types' => array(
'description' => __( 'Types associated with the taxonomy.' ),
'type' => 'array',
'items' => array(
'type' => 'string',
),
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'rest_base' => array(
'description' => __( 'REST base route for the taxonomy.' ),
'type' => 'string',
'context' => array( 'view', 'edit', 'embed' ),
'readonly' => true,
),
'rest_namespace' => array(
'description' => __( 'REST namespace route for the taxonomy.' ),
'type' => 'string',
'context' => array( 'view', 'edit', 'embed' ),
'readonly' => true,
),
'visibility' => array(
'description' => __( 'The visibility settings for the taxonomy.' ),
'type' => 'object',
'context' => array( 'edit' ),
'readonly' => true,
'properties' => array(
'public' => array(
'description' => __( 'Whether a taxonomy is intended for use publicly either via the admin interface or by front-end users.' ),
'type' => 'boolean',
),
'publicly_queryable' => array(
'description' => __( 'Whether the taxonomy is publicly queryable.' ),
'type' => 'boolean',
),
'show_ui' => array(
'description' => __( 'Whether to generate a default UI for managing this taxonomy.' ),
'type' => 'boolean',
),
'show_admin_column' => array(
'description' => __( 'Whether to allow automatic creation of taxonomy columns on associated post-types table.' ),
'type' => 'boolean',
),
'show_in_nav_menus' => array(
'description' => __( 'Whether to make the taxonomy available for selection in navigation menus.' ),
'type' => 'boolean',
),
'show_in_quick_edit' => array(
'description' => __( 'Whether to show the taxonomy in the quick/bulk edit panel.' ),
'type' => 'boolean',
),
),
),
),
);
$this->schema = $schema;
return $this->add_additional_fields_schema( $this->schema );
}
/**
* Retrieves the query params for collections.
*
* @since 4.7.0
*
* @return array Collection parameters.
*/
public function get_collection_params() {
$new_params = array();
$new_params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$new_params['type'] = array(
'description' => __( 'Limit results to taxonomies associated with a specific post type.' ),
'type' => 'string',
);
return $new_params;
}
}