", esc_html__( 'Clearing the logs failed.', 'relevanssi' ) );
}
}
return $result;
}
/**
* Prints out the Relevanssi options form.
*
* @global array $relevanssi_variables The global Relevanssi variables array.
*/
function relevanssi_options_form() {
global $relevanssi_variables;
echo "
";
echo "
__( 'Click OK to copy Relevanssi options to all subsites', 'relevanssi' ),
'confirm_stopwords' => __( 'Are you sure you want to remove all stopwords?', 'relevanssi' ),
'confirm_delete_query' => __( 'Are you sure you want to delete the query?', 'relevanssi' ),
'truncating_index' => __( 'Wiping out the index...', 'relevanssi' ),
'done' => __( 'Done.', 'relevanssi' ),
'indexing_users' => __( 'Indexing users...', 'relevanssi' ),
'indexing_taxonomies' => __( 'Indexing the following taxonomies:', 'relevanssi' ),
'indexing_attachments' => __( 'Indexing attachments...', 'relevanssi' ),
'counting_posts' => __( 'Counting posts...', 'relevanssi' ),
'counting_terms' => __( 'Counting taxonomy terms...', 'relevanssi' ),
'counting_users' => __( 'Counting users...', 'relevanssi' ),
'counting_attachments' => __( 'Counting attachments...', 'relevanssi' ),
'posts_found' => __( 'posts found.', 'relevanssi' ),
'terms_found' => __( 'taxonomy terms found.', 'relevanssi' ),
'users_found' => __( 'users found.', 'relevanssi' ),
'attachments_found' => __( 'attachments found.', 'relevanssi' ),
'taxonomy_disabled' => __( 'Taxonomy term indexing is disabled.', 'relevanssi' ),
'user_disabled' => __( 'User indexing is disabled.', 'relevanssi' ),
'indexing_complete' => __( 'Indexing complete.', 'relevanssi' ),
'excluded_posts' => __( 'posts excluded.', 'relevanssi' ),
'options_changed' => __( 'Settings have changed, please save the options before indexing.', 'relevanssi' ),
'reload_state' => __( 'Reload the page to refresh the state of the index.', 'relevanssi' ),
'pdf_reset_confirm' => __( 'Are you sure you want to delete all attachment content from the index?', 'relevanssi' ),
'pdf_reset_done' => __( 'Relevanssi attachment data wiped clean.', 'relevanssi' ),
'pdf_reset_problems' => __( 'There were problems wiping the Relevanssi attachment data clean.', 'relevanssi' ),
'error_reset_done' => __( 'Relevanssi attachment server errors wiped.', 'relevanssi' ),
'error_reset_problems' => __( 'There were problems wiping the Relevanssi attachment server errors.', 'relevanssi' ),
'hour' => __( 'hour', 'relevanssi' ),
'hours' => __( 'hours', 'relevanssi' ),
'about' => __( 'about', 'relevanssi' ),
'sixty_min' => __( 'about an hour', 'relevanssi' ),
'ninety_min' => __( 'about an hour and a half', 'relevanssi' ),
'minute' => __( 'minute', 'relevanssi' ),
'minutes' => __( 'minutes', 'relevanssi' ),
'underminute' => __( 'less than a minute', 'relevanssi' ),
'notimeremaining' => __( "we're done!", 'relevanssi' ),
);
wp_localize_script( 'relevanssi_admin_js', 'relevanssi', $localizations );
$nonce = array(
'indexing_nonce' => wp_create_nonce( 'relevanssi_indexing_nonce' ),
'searching_nonce' => wp_create_nonce( 'relevanssi_admin_search_nonce' ),
);
if ( ! RELEVANSSI_PREMIUM ) {
wp_localize_script( 'relevanssi_admin_js', 'nonce', $nonce );
}
/**
* Sets the indexing limit, ie. how many posts are indexed at once.
*
* Relevanssi starts by indexing this many posts at once. If the process
* goes fast enough, Relevanssi will then increase the limit and if the
* process is slow, the limit will be decreased. If necessary, you can
* use the relevanssi_indexing_adjust filter hook to disable that
* adjustment.
*
* @param int The indexing limit, default 10.
*/
$indexing_limit = apply_filters( 'relevanssi_indexing_limit', 10 );
/**
* Sets the indexing adjustment.
*
* Relevanssi will adjust the number of posts indexed at once to speed
* up the process if it goes fast and to slow down, if the posts are
* slow to index. You can use this filter to stop that behaviour, making
* Relevanssi index posts at constant pace. That's generally slower, but
* more reliable.
*
* @param boolean Should the limit be adjusted, default true.
*/
$indexing_adjust = apply_filters( 'relevanssi_indexing_adjust', true );
wp_localize_script(
'relevanssi_admin_js',
'relevanssi_params',
array(
'indexing_limit' => $indexing_limit,
'indexing_adjust' => $indexing_adjust,
)
);
}
/**
* Prints out the form fields for tag and category weights.
*/
function relevanssi_form_tag_weight() {
$taxonomy_weights = get_option( 'relevanssi_post_type_weights' );
$tag_value = 1;
if ( isset( $taxonomy_weights['post_tag'] ) ) {
$tag_value = $taxonomy_weights['post_tag'];
}
$category_value = 1;
if ( isset( $taxonomy_weights['category'] ) ) {
$category_value = $taxonomy_weights['category'];
}
?>
$values ) {
$values = implode( ', ', $values );
$bg_color = array_shift( $bg_colors );
$border_color = array_shift( $border_colors );
$datasets_array[] = <<< EOJSON
{
label: "$label",
data: [ $values ],
backgroundColor: [ $bg_color ],
borderColor: [ $border_color ],
borderWidth: 2,
fill: {
target: 'origin',
below: $border_color,
},
pointRadius: 1,
cubicInterpolationMode: 'monotone'
}
EOJSON;
}
?>
' . $script . ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
/**
* Checks if the active tab exists in the tab list.
*
* If it doesn't, sets the active tab to the first tab in the list.
*
* @param string $active_tab The active tab.
* @param array $tabs The tab list.
*
* @return string The active tab.
*/
function relevanssi_check_active_tab( $active_tab, $tabs ) {
$active_tab_exists = false;
$first_tab_slug = '';
foreach ( $tabs as $tab ) {
if ( ! $first_tab_slug ) {
$first_tab_slug = $tab['slug'];
}
if ( $tab['slug'] === $active_tab ) {
$active_tab_exists = true;
break;
}
}
if ( ! $active_tab_exists ) {
$active_tab = $first_tab_slug;
}
return $active_tab;
}