diff --git a/inc/class-spotim-options.php b/inc/class-spotim-options.php index 67ff021..2432388 100644 --- a/inc/class-spotim-options.php +++ b/inc/class-spotim-options.php @@ -106,6 +106,7 @@ protected function __construct() { 'embed_method' => 'content', 'rc_embed_method' => 'regular', 'display_rc_amp_ad_tag' => '0', + 'enable_rating_reviews' => '0', 'display_priority' => 9999, 'enable_seo' => 'false', 'enable_og' => 'false', @@ -179,7 +180,8 @@ private function get_meta_data() { $data['display_page'] = sanitize_text_field( $data['display_page'] ); $data['display_attachment'] = sanitize_text_field( $data['display_attachment'] ); $data['display_newsfeed'] = sanitize_text_field( $data['display_newsfeed'] ); - $data['display_rc_amp_ad_tag'] = sanitize_text_field( $data['display_rc_amp_ad_tag'] ); + $data['display_rc_amp_ad_tag'] = isset( $data['display_rc_amp_ad_tag'] ) ? sanitize_text_field( $data['display_rc_amp_ad_tag'] ) : $this->default_options['display_rc_amp_ad_tag']; + $data['enable_rating_reviews'] = isset( $data['enable_rating_reviews'] ) ? sanitize_text_field( $data['enable_rating_reviews'] ) : $this->default_options['enable_rating_reviews']; $data = array_merge( $this->default_options, $data ); } @@ -284,6 +286,7 @@ public function validate( $input ) { case 'display_attachment': case 'display_newsfeed': case 'display_rc_amp_ad_tag': + case 'enable_rating_reviews': $options[ $key ] = sanitize_text_field( $value ); break; case 'posts_per_request': diff --git a/inc/class-spotim-settings-fields.php b/inc/class-spotim-settings-fields.php index 91a4fd7..c209912 100644 --- a/inc/class-spotim-settings-fields.php +++ b/inc/class-spotim-settings-fields.php @@ -330,6 +330,25 @@ public function register_advanced_section() { ) ); + add_settings_field( + 'enable_rating_reviews', + esc_html__( 'Star rating reviews in conversation', 'spotim-comments' ), + array( 'SpotIM_Form_Helper', 'radio_fields' ), + $this->options->slug, + 'advanced_settings_section', + array( + 'id' => 'enable_rating_reviews', + 'page' => $this->options->slug, + 'fields' => array( + '1' => esc_html__( 'Enable', 'spotim-comments' ), + '0' => esc_html__( 'Disable', 'spotim-comments' ), + ), + 'value' => $this->options->get( 'enable_rating_reviews' ), + ) + ); + + + add_settings_field( 'display_priority', esc_html__( 'Display Priority', 'spotim-comments' ), diff --git a/language/spotim-comments.pot b/language/spotim-comments.pot index 861dda3..b0852ec 100644 --- a/language/spotim-comments.pot +++ b/language/spotim-comments.pot @@ -36,11 +36,11 @@ msgstr "" msgid "Spot.IM" msgstr "" -#: inc/class-spotim-admin.php:427, inc/class-spotim-settings-fields.php:508 +#: inc/class-spotim-admin.php:427, inc/class-spotim-settings-fields.php:527 msgid "Spot ID is missing." msgstr "" -#: inc/class-spotim-admin.php:441, inc/class-spotim-settings-fields.php:509 +#: inc/class-spotim-admin.php:441, inc/class-spotim-settings-fields.php:528 msgid "Import token is missing." msgstr "" @@ -76,11 +76,11 @@ msgstr "" msgid "Comments" msgstr "" -#: inc/class-spotim-metabox.php:291, inc/class-spotim-metabox.php:339, inc/class-spotim-settings-fields.php:195, inc/class-spotim-settings-fields.php:235, inc/class-spotim-settings-fields.php:325, inc/class-spotim-settings-fields.php:359, inc/class-spotim-settings-fields.php:376 +#: inc/class-spotim-metabox.php:291, inc/class-spotim-metabox.php:339, inc/class-spotim-settings-fields.php:195, inc/class-spotim-settings-fields.php:235, inc/class-spotim-settings-fields.php:325, inc/class-spotim-settings-fields.php:343, inc/class-spotim-settings-fields.php:378, inc/class-spotim-settings-fields.php:395 msgid "Enable" msgstr "" -#: inc/class-spotim-metabox.php:293, inc/class-spotim-metabox.php:341, inc/class-spotim-settings-fields.php:194, inc/class-spotim-settings-fields.php:217, inc/class-spotim-settings-fields.php:234, inc/class-spotim-settings-fields.php:326, inc/class-spotim-settings-fields.php:358, inc/class-spotim-settings-fields.php:375 +#: inc/class-spotim-metabox.php:293, inc/class-spotim-metabox.php:341, inc/class-spotim-settings-fields.php:194, inc/class-spotim-settings-fields.php:217, inc/class-spotim-settings-fields.php:234, inc/class-spotim-settings-fields.php:326, inc/class-spotim-settings-fields.php:344, inc/class-spotim-settings-fields.php:377, inc/class-spotim-settings-fields.php:394 msgid "Disable" msgstr "" @@ -104,11 +104,11 @@ msgstr "" msgid "Show Spot.IM recirculation." msgstr "" -#: inc/class-spotim-options.php:437 +#: inc/class-spotim-options.php:440 msgid "Next sync on next page refresh." msgstr "" -#: inc/class-spotim-options.php:440 +#: inc/class-spotim-options.php:443 msgid "Next sync in %s." msgstr "" @@ -233,94 +233,98 @@ msgid "Please contact your account manager to activate the Ad tag for AMP powere msgstr "" #: inc/class-spotim-settings-fields.php:335 +msgid "Star rating reviews in conversation" +msgstr "" + +#: inc/class-spotim-settings-fields.php:354 msgid "Display Priority" msgstr "" -#: inc/class-spotim-settings-fields.php:350 +#: inc/class-spotim-settings-fields.php:369 msgid "Enable SEO" msgstr "" -#: inc/class-spotim-settings-fields.php:367 +#: inc/class-spotim-settings-fields.php:386 msgid "OpenGraph Tags" msgstr "" -#: inc/class-spotim-settings-fields.php:384 +#: inc/class-spotim-settings-fields.php:403 msgid "Container Class" msgstr "" -#: inc/class-spotim-settings-fields.php:397 +#: inc/class-spotim-settings-fields.php:416 msgid "Disqus Shortname" msgstr "" -#: inc/class-spotim-settings-fields.php:410 +#: inc/class-spotim-settings-fields.php:429 msgid "Disqus Identifier Structure" msgstr "" -#: inc/class-spotim-settings-fields.php:418 +#: inc/class-spotim-settings-fields.php:437 msgid "ID" msgstr "" -#: inc/class-spotim-settings-fields.php:419 +#: inc/class-spotim-settings-fields.php:438 msgid "Short URL" msgstr "" -#: inc/class-spotim-settings-fields.php:420 +#: inc/class-spotim-settings-fields.php:439 msgid "ID + Short URL (Default)" msgstr "" -#: inc/class-spotim-settings-fields.php:428 +#: inc/class-spotim-settings-fields.php:447 msgid "Start Manual Sync" msgstr "" -#: inc/class-spotim-settings-fields.php:435 +#: inc/class-spotim-settings-fields.php:454 msgid "Sync Now" msgstr "" -#: inc/class-spotim-settings-fields.php:439 +#: inc/class-spotim-settings-fields.php:458 msgid "Reset + Sync Now" msgstr "" -#: inc/class-spotim-settings-fields.php:440 +#: inc/class-spotim-settings-fields.php:459 msgid "Use Sync Now to sync data starting from the last sync time." msgstr "" -#: inc/class-spotim-settings-fields.php:440 +#: inc/class-spotim-settings-fields.php:459 msgid "Use Reset + Sync Now to clear any old synced data and start a fresh sync." msgstr "" -#: inc/class-spotim-settings-fields.php:444 +#: inc/class-spotim-settings-fields.php:463 msgid "Cancel" msgstr "" -#: inc/class-spotim-settings-fields.php:467 +#: inc/class-spotim-settings-fields.php:486 msgid "Comments Sync Options" msgstr "" -#: inc/class-spotim-settings-fields.php:474 +#: inc/class-spotim-settings-fields.php:493 msgid "Sync Token" msgstr "" -#: inc/class-spotim-settings-fields.php:481 +#: inc/class-spotim-settings-fields.php:500 msgid "Contact your Spot.IM account manager to get your sync token." msgstr "" -#: inc/class-spotim-settings-fields.php:488 +#: inc/class-spotim-settings-fields.php:507 msgid "No" msgstr "" -#: inc/class-spotim-settings-fields.php:498 +#: inc/class-spotim-settings-fields.php:517 msgid "Enable Auto Sync" msgstr "" -#: inc/class-spotim-settings-fields.php:505 +#: inc/class-spotim-settings-fields.php:524 msgid "Enable auto-sync and set how often should it reoccur." msgstr "" -#: inc/class-spotim-settings-fields.php:523 +#: inc/class-spotim-settings-fields.php:542 msgid "Posts Per Request" msgstr "" -#: inc/class-spotim-settings-fields.php:530 +#: inc/class-spotim-settings-fields.php:549 msgid "On every sync, several requests will be made to your server. This is the amount of posts that will be retrieved in each request. Default: 10." msgstr "" diff --git a/readme.txt b/readme.txt index 4bd5575..e2a31db 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: Comment, comment form, commenting, comments, comment author, comment form, Requires at least: 4.0 Tested up to: 5.2.2 Requires PHP: 5.4 -Stable tag: 4.5.1 +Stable tag: 4.5.2 License: GPLv2 or later License URI: license.txt @@ -203,6 +203,9 @@ You are also always more than welcome to contact our team at support@spot.im. We == Changelog == += 4.5.2 = +* Add support for Star Rating Reviews. + = 4.5.1 = * Update AMP templates to comply with WordPress VIP standard. @@ -396,5 +399,5 @@ You are also always more than welcome to contact our team at support@spot.im. We == Upgrade notice == -= 4.5.1 = -* Update AMP templates to comply with WordPress VIP standard. \ No newline at end of file += 4.5.2 = +* Add support for Star Rating Reviews. diff --git a/spotim-comments.php b/spotim-comments.php index 46cfb4d..6fc7d4f 100644 --- a/spotim-comments.php +++ b/spotim-comments.php @@ -3,7 +3,7 @@ * Plugin Name: Spot.IM Comments * Plugin URI: https://wordpress.org/plugins/spotim-comments/ * Description: Real-time comments widget turns your site into its own content-circulating ecosystem. - * Version: 4.5.1 + * Version: 4.5.2 * Author: Spot.IM * Author URI: https://github.com/SpotIM * License: GPLv2 @@ -22,9 +22,9 @@ /** * The version of the plugin * - * @since 4.5.1 + * @since 4.5.2 */ - define( 'SPOTIM_VERSION', '4.5.1' ); + define( 'SPOTIM_VERSION', '4.5.2' ); } /** diff --git a/templates/comments-template.php b/templates/comments-template.php index bc7308a..433871c 100644 --- a/templates/comments-template.php +++ b/templates/comments-template.php @@ -1,8 +1,9 @@ get( 'spot_id' ); -$recirculation_method = $options->get( 'rc_embed_method' ); +$options = SpotIM_Options::get_instance(); +$front = new SpotIM_Frontend( $options ); +$spot_id = $options->get( 'spot_id' ); +$recirculation_method = $options->get( 'rc_embed_method' ); +$enable_rating_reviews = 0 === absint( $options->get( 'enable_rating_reviews' ) ) ? 'false' : 'true'; switch ( $options->get( 'disqus_identifier' ) ) { case 'id': @@ -33,6 +34,7 @@ data-spotim-module="spotim-launcher" data-article-tags=" 'names' ) ) ) ); ?>" src="" + data-social-reviews="" data-post-id="" data-post-url="" data-short-url=""