: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
$options = get_option( 'wp_review_options' );
$default_options = array(
'default_features' => array(),
'default_link_texts' => array(),
'default_link_urls' => array(),
'default_schema_type' => 'Thing',
'default_user_review_type' => WP_REVIEW_REVIEW_DISABLED,
'image_sizes' => array(),
if ( empty( $options ) ) {
$options = $default_options;
update_option( 'wp_review_options', $options );
if ( empty( $options['image_sizes'] ) ) {
$options['image_sizes'] = array();
$opt_name = 'wp_review_options_' . wp_get_theme();
$options_updated = get_option( $opt_name );
$suggest_theme_defaults = true;
if ( ! empty( $_GET['wp-review-theme-defaults'] ) && empty( $_GET['settings-updated'] ) ) { // WPCS: csrf ok.
wp_review_theme_defaults( $options_updated, true );
$options = get_option( 'wp_review_options' );
$suggest_theme_defaults = false;
// Test to see if we need to sugges setting theme defaults.
if ( empty( $options_updated ) ) {
$options_updated = array();
$opts_tmp = array_merge( $options, $options_updated );
if ( $opts_tmp === $options ) {
$suggest_theme_defaults = false;
$current_blog_id = get_current_blog_id();
$migrated_rows = get_option( 'wp_review_migrated_rows', 0 );
$has_migrated = get_option( 'wp_review_has_migrated', false );
if ( ! $has_migrated && $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->base_prefix}mts_wp_reviews'" ) === "{$wpdb->base_prefix}mts_wp_reviews" ) {
// Table exists and not migrated (fully) yet.
$total_rows = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->base_prefix}mts_wp_reviews WHERE blog_id = {$current_blog_id}" ); // WPCS: unprepared SQL ok.
$rows_left = $total_rows - $migrated_rows;
$comment_form_integration = ( ! empty( $options['comment_form_integration'] ) ? $options['comment_form_integration'] : 'replace' );
if ( 'replace' !== $comment_form_integration ) {
$comment_form_integration = 'extend';
$comments_template = ( ! empty( $options['comments_template'] ) ? $options['comments_template'] : 'theme' );
if ( 'theme' !== $comments_template ) {
$comments_template = 'plugin';
$default_colors = wp_review_get_default_colors();
$default_location = wp_review_get_default_location();
$default_criteria = wp_review_get_default_criteria();
$default_items = array();
foreach ( $default_criteria as $item ) {
$default_items[] = array(
'wp_review_item_title' => $item,
'wp_review_item_star' => '',
$default_schema = wp_review_option( 'default_schema_type' ) ? wp_review_option( 'default_schema_type' ) : $default_options['default_schema_type'];
$default_user_review_type = empty( $options['default_user_review_type'] ) ? WP_REVIEW_REVIEW_DISABLED : $options['default_user_review_type'];
$options['colors'] = apply_filters( 'wp_review_colors', $options['colors'], 0 );
if ( ! isset( $options['default'] ) ) {
$options['default'] = array();
/* Retrieve an existing value from the database. */
$items = ! empty( $options['default_features'] ) ? $options['default_features'] : '';
$link_texts = ! empty( $options['default_link_text'] ) ? $options['default_link_text'] : array();
$link_urls = ! empty( $options['default_link_url'] ) ? $options['default_link_url'] : array();
$location = wp_review_option( 'review_location' );
$color = ! empty( $options['colors']['color'] ) ? $options['colors']['color'] : '';
$inactive_color = ! empty( $options['colors']['inactive_color'] ) ? $options['colors']['inactive_color'] : '';
$fontcolor = ! empty( $options['colors']['fontcolor'] ) ? $options['colors']['fontcolor'] : '';
$bgcolor1 = ! empty( $options['colors']['bgcolor1'] ) ? $options['colors']['bgcolor1'] : '';
$bgcolor2 = ! empty( $options['colors']['bgcolor2'] ) ? $options['colors']['bgcolor2'] : '';
$bordercolor = ! empty( $options['colors']['bordercolor'] ) ? $options['colors']['bordercolor'] : '';
$force_user_ratings = wp_review_option( 'force_user_ratings' );
$rating_icon = wp_review_option( 'rating_icon', apply_filters( 'wp_review_default_rating_icon', 'fa fa-star' ) );
$rating_image = wp_review_option( 'rating_image' );
$review_templates = wp_review_get_box_templates();
$box_template = wp_review_option( 'box_template', 'default' );
$box_template_img = ! empty( $review_templates[ $box_template ] ) ? $review_templates[ $box_template ]['image'] : WP_REVIEW_ASSETS . 'images/largethumb.png';
$review_types = wp_review_get_rating_types();
$review_type = wp_review_option( 'review_type', 'none' );
$color = $default_colors['color'];
if ( '' === $inactive_color ) {
$inactive_color = $default_colors['inactive_color'];
if ( '' === $location ) {
$location = $default_location;
if ( '' === $fontcolor ) {
$fontcolor = $default_colors['fontcolor'];
if ( '' === $bgcolor1 ) {
$bgcolor1 = $default_colors['bgcolor1'];
if ( '' === $bgcolor2 ) {
$bgcolor2 = $default_colors['bgcolor2'];
if ( '' === $bordercolor ) {
$bordercolor = $default_colors['bordercolor'];
'inactive_color' => true,
'custom_location' => true,
$displayed_fields = apply_filters( 'wp_review_metabox_item_fields', $fields );
$available_types = apply_filters(
'wp_review_metabox_types',
'star' => __( 'Star', 'wp-review' ),
'point' => __( 'Point', 'wp-review' ),
'percentage' => __( 'Percentage', 'wp-review' ),
'circle' => __( 'Circle', 'wp-review' ),
'thumbs' => __( 'Thumbs', 'wp-review' ),
$form_field = new WP_Review_Form_Field();
<div class="nav-tab-wrapper">
<a href="#review-general" class="nav-tab nav-tab-active"><?php esc_html_e( 'General', 'wp-review' ); ?></a>
<a href="#review-styling" class="nav-tab"><?php esc_html_e( 'Styling', 'wp-review' ); ?></a>
<a href="#review-defaults" class="nav-tab"><?php esc_html_e( 'Defaults', 'wp-review' ); ?></a>
<a href="#review-embed" class="nav-tab"><?php esc_html_e( 'Embed', 'wp-review' ); ?></a>
<?php if ( $rows_left ) : ?>
<a href="#review-migrate" class="nav-tab"><?php esc_html_e( 'Migrate Ratings', 'wp-review' ); ?></a>
<div id="review-general" class="settings-tab-general tab-content">
<h3><?php esc_html_e( 'General Settings', 'wp-review' ); ?></h3>
$location = apply_filters( 'wp_review_location', $location, 0 );
if ( has_filter( 'wp_review_location' ) ) {
echo '<p class="wp-review-filter-msg"><div class="dashicons dashicons-info"></div>' . esc_html__( 'There is a filter set for the review location that may modify the options below.', 'wp-review' ) . '</p>';
if ( $suggest_theme_defaults ) {
<div class="wp-review-theme-defaults-msg updated settings-error">
<p class="wp-review-field">
<?php esc_html_e( 'The current theme provides default settings for the plugin.', 'wp-review' ); ?><br />
<a href="<?php echo admin_url( 'options-general.php?page=wp-review/admin/options.php&wp-review-theme-defaults=1' ); // WPCS: xss ok. ?>" class="button button-primary"><?php esc_html_e( 'Set to theme defaults', 'wp-review' ); ?></a>
<a href="#" class="dashicons dashicons-no-alt close-notice"></a>
<div class="wp-review-field">
<div class="wp-review-field-label">
<label><?php esc_html_e( 'Restrict rating to registered users only', 'wp-review' ); ?></label>
<div class="wp-review-field-option">
$form_field->render_switch(
'id' => 'wp_review_registered_only',
'name' => 'wp_review_options[registered_only]',
'value' => ! empty( $options['registered_only'] ),
<div class="wp-review-field">
<div class="wp-review-disabled wp-review-field-label">
<label><?php esc_html_e( 'Add total rating to thumbnails', 'wp-review' ); ?></label>
<?php wp_review_print_pro_text(); ?>
<div class="wp-review-field-option">
$form_field->render_switch(
'id' => 'wp_review_show_on_thumbnails',
'name' => 'wp_review_options[show_on_thumbnails]',
<div class="wp-review-field">
<div class="wp-review-disabled wp-review-field-label">
<label><?php esc_html_e( 'Enable User rating in old posts', 'wp-review' ); ?></label>
<?php wp_review_print_pro_text(); ?>
<div class="wp-review-field-option">
$form_field->render_switch(
'id' => 'wp_review_global_user_rating',
'name' => 'wp_review_options[global_user_rating]',
<?php if ( class_exists( 'WooCommerce' ) ) : ?>
<div class="wp-review-field">
<div class="wp-review-disabled wp-review-field-label">
<label><?php esc_html_e( 'Replace WooCommerce rating', 'wp-review' ); ?></label>
<?php wp_review_print_pro_text(); ?>
<div class="wp-review-field-option">
$form_field->render_switch(
'id' => 'wp_review_replace_wc_rating',
'name' => 'wp_review_options[replace_wc_rating]',
<div class="wp-review-field">
<div class="wp-review-disabled wp-review-field-label">
<label><?php esc_html_e( 'Disable Map Script in the Backend', 'wp-review' ); ?></label>
<?php wp_review_print_pro_text(); ?>
<div class="wp-review-field-option">
$form_field->render_switch(
'id' => 'wp_review_dequeue_map_backend',
'name' => 'wp_review_options[dequeue_map_backend]',
<p class="description" style="margin-top: 10px;"><?php esc_html_e( 'If map script is conflicting with other plugin in the single post editor, please enable this option.', 'wp-review' ); ?></p>
<div class="wp-review-field">
<div class="wp-review-disabled wp-review-field-label">
<label><?php esc_html_e( 'Comments template', 'wp-review' ); ?></label>
<?php wp_review_print_pro_text(); ?>
<div class="wp-review-field-option">
<div class="pr-10 wpr-col-1-2">
<label for="wp_review_comments_template_theme">
<span class="wp-review-disabled inline-block has-bg">
<input name="wp_review_options[comments_template]" id="wp_review_comments_template_theme" type="radio" value="theme" <?php checked( $comments_template, 'theme' ); ?> disabled />
<strong><?php esc_html_e( 'Theme', 'wp-review' ); ?></strong>
<span class="description"><?php esc_html_e( 'Use theme comments template. Might need customization of comments.php', 'wp-review' ); ?></span>
<div class="pl-10 wpr-col-1-2">
<label for="wp_review_comments_template_plugin">
<span class="wp-review-disabled inline-block has-bg">
<input name="wp_review_options[comments_template]" id="wp_review_comments_template_plugin" type="radio" value="plugin" <?php checked( $comments_template, 'plugin' ); ?> disabled />
<strong><?php esc_html_e( 'WP Review', 'wp-review' ); ?></strong>
<span class="description"><?php esc_html_e( 'Use WP Review comments template. Better chances for out of the box integration.', 'wp-review' ); ?></span>
<div class="wp-review-field">
<div class="wp-review-disabled wp-review-field-label">
<label><?php esc_html_e( 'Comment form integration', 'wp-review' ); ?></label>
<?php wp_review_print_pro_text(); ?>
<div class="wp-review-field-option">
<div class="pr-10 wpr-col-1-2">
<label for="wp_review_comment_form_integration_replace">
<span class="wp-review-disabled inline-block has-bg">
<input name="wp_review_options[comment_form_integration]" id="wp_review_comment_form_integration_replace" type="radio" value="replace" <?php checked( $comment_form_integration, 'replace' ); ?> disabled />
<strong><?php esc_html_e( 'Replace', 'wp-review' ); ?></strong>
<span class="description"><?php esc_html_e( 'Replace form fields.', 'wp-review' ); ?></span>
<div class="pl-10 wpr-col-1-2">
<label for="wp_review_comment_form_integration_extend">
<span class="wp-review-disabled inline-block has-bg">
<input name="wp_review_options[comment_form_integration]" id="wp_review_comment_form_integration_extend" type="radio" value="extend" <?php checked( $comment_form_integration, 'extend' ); ?> disabled />
<strong><?php esc_html_e( 'Extend', 'wp-review' ); ?></strong>
<span class="description"><?php esc_html_e( 'Add new fields without modifying the default fields.', 'wp-review' ); ?></span>
<div class="wp-review-field">
<div class="wp-review-disabled wp-review-field-label">
<label><?php esc_html_e( 'Require a rating when commenting', 'wp-review' ); ?></label>
<?php wp_review_print_pro_text(); ?>
<div class="wp-review-field-option">
$form_field->render_switch(
'id' => 'wp_review_require_rating',
'name' => 'wp_review_options[require_rating]',
<div class="wp-review-field">
<div class="wp-review-disabled wp-review-field-label">
<label><?php esc_html_e( 'Allow comment feedback (helpful/unhelpful)', 'wp-review' ); ?></label>
<?php wp_review_print_pro_text(); ?>
<div class="wp-review-field-option">
$form_field->render_switch(
'id' => 'wp_review_allow_comment_feedback',
'name' => 'wp_review_options[allow_comment_feedback]',
<div class="wp-review-field">
<div class="wp-review-disabled wp-review-field-label">
<label for="wp_review_record_ratings_by"><?php esc_html_e( 'Record User Ratings', 'wp-review' ); ?></label>
<?php wp_review_print_pro_text(); ?>
<div class="wp-review-field-option">
<span class="wp-review-disabled inline-block has-bg">
<select name="wp_review_options[record_ratings_by]" id="wp_review_record_ratings_by" disabled>
<option value="ip"><?php esc_html_e( 'Based on IP address', 'wp-review' ); ?></option>
<option value="cookie"><?php esc_html_e( 'Based on browser cookie', 'wp-review' ); ?></option>
/*<div class="wp-review-field">
<div class="wp-review-field-label">
<label><?php esc_html_e( 'Show text count with Star ratings', 'wp-review' ); ?></label>
<div class="wp-review-field-option">
$form_field->render_switch( array(
'id' => 'wp_review_show_star_rating_count',
'name' => 'wp_review_options[show_star_rating_count]',
'value' => ! empty( $options['show_star_rating_count'] ),
<div class="wp-review-field">
<div class="wp-review-field-label">
<label><?php esc_html_e( 'Allow multiple reviews per account', 'wp-review' ); ?></label>
<div class="wp-review-field-option">
$form_field->render_switch(
'id' => 'wp_review_multi_reviews_per_account',
'name' => 'wp_review_options[multi_reviews_per_account]',
'value' => ! empty( $options['multi_reviews_per_account'] ),
<div class="wp-review-field">
<div class="wp-review-disabled wp-review-field-label">
<label><?php esc_html_e( 'Include Pros/Cons in comment reviews', 'wp-review' ); ?></label>
<?php wp_review_print_pro_text(); ?>
<div class="wp-review-field-option">
$form_field->render_switch(
'id' => 'wp_review_comment_pros_cons',
'name' => 'wp_review_options[comment_pros_cons]',
<div class="wp-review-field">
<div class="wp-review-disabled wp-review-field-label">
<label><?php esc_html_e( 'Approve Comment Reviews without Moderation', 'wp-review' ); ?></label>
<?php wp_review_print_pro_text(); ?>
<div class="wp-review-field-option">
$form_field->render_switch(
'id' => 'wp_review_approve_ratings',
'name' => 'wp_review_options[approve_ratings]',
if ( current_user_can( 'wp_review_purge_visitor_ratings' ) ) {