diff --git a/includes/postratings-activation.php b/includes/postratings-activation.php index 0411b3b..5994ad1 100644 --- a/includes/postratings-activation.php +++ b/includes/postratings-activation.php @@ -58,8 +58,8 @@ function ratings_activate() { // Add In Options (4 Records) add_option('postratings_image', 'stars' ); add_option('postratings_max', '5' ); - add_option('postratings_template_vote', '%RATINGS_IMAGES_VOTE% (%RATINGS_USERS% '.__('votes', 'wp-postratings').__(',', 'wp-postratings').' '.__('average', 'wp-postratings').': %RATINGS_AVERAGE% '.__('out of', 'wp-postratings').' %RATINGS_MAX%)
%RATINGS_TEXT%' ); - add_option('postratings_template_text', '%RATINGS_IMAGES% (%RATINGS_USERS% '.__('votes', 'wp-postratings').__(',', 'wp-postratings').' '.__('average', 'wp-postratings').': %RATINGS_AVERAGE% '.__('out of', 'wp-postratings').' %RATINGS_MAX%'.__(',', 'wp-postratings').' '.__('rated', 'wp-postratings').')' ); + add_option('postratings_template_vote', '%RATINGS_IMAGES_VOTE% (%RATINGS_USERS% %RATINGS_VOTE_TEXT%'.__(',', 'wp-postratings').' '.__('average', 'wp-postratings').': %RATINGS_AVERAGE% '.__('out of', 'wp-postratings').' %RATINGS_MAX%)
%RATINGS_TEXT%' ); + add_option('postratings_template_text', '%RATINGS_IMAGES% (%RATINGS_USERS% %RATINGS_VOTE_TEXT%'.__(',', 'wp-postratings').' '.__('average', 'wp-postratings').': %RATINGS_AVERAGE% '.__('out of', 'wp-postratings').' %RATINGS_MAX%'.__(',', 'wp-postratings').' '.__('rated', 'wp-postratings').')' ); add_option('postratings_template_none', '%RATINGS_IMAGES_VOTE% ('.__('No Ratings Yet', 'wp-postratings').')
%RATINGS_TEXT%' ); // Database Upgrade For WP-PostRatings 1.02 add_option('postratings_logging_method', '3' ); @@ -74,13 +74,16 @@ function ratings_activate() { // Database Upgrade For WP-PostRatings 1.20 add_option('postratings_ratingsvalue', array(1,2,3,4,5) ); add_option('postratings_customrating', 0 ); - add_option('postratings_template_permission', '%RATINGS_IMAGES% (%RATINGS_USERS% '.__('votes', 'wp-postratings').__(',', 'wp-postratings').' '.__('average', 'wp-postratings').': %RATINGS_AVERAGE% '.__('out of', 'wp-postratings').' %RATINGS_MAX%)
'.__('You need to be a registered member to rate this.', 'wp-postratings').'' ); + add_option('postratings_template_permission', '%RATINGS_IMAGES% (%RATINGS_USERS% %RATINGS_VOTE_TEXT%'.__(',', 'wp-postratings').' '.__('average', 'wp-postratings').': %RATINGS_AVERAGE% '.__('out of', 'wp-postratings').' %RATINGS_MAX%)
'.__('You need to be a registered member to rate this.', 'wp-postratings').'' ); // Database Upgrade For WP-PostRatings 1.30 - add_option('postratings_template_mostrated', '
  • %POST_TITLE% - %RATINGS_USERS% '.__('votes', 'wp-postratings').'
  • ' ); + add_option('postratings_template_mostrated', '
  • %POST_TITLE% - %RATINGS_USERS% %RATINGS_VOTE_TEXT%'.'
  • ' ); // Database Upgrade For WP-PostRatings 1.50 delete_option('widget_ratings_highest_rated'); delete_option('widget_ratings_most_rated'); + add_option('postratings_vote_text_singular', 'vote' ); + add_option('postratings_vote_text_plural', 'votes' ); + // Index $index = $wpdb->get_results( "SHOW INDEX FROM $wpdb->ratings;" ); $key_name = array(); diff --git a/postratings-options.php b/postratings-options.php index 07db9c4..bc5b2cd 100644 --- a/postratings-options.php +++ b/postratings-options.php @@ -45,6 +45,8 @@ $postratings_richsnippet = intval($_POST['postratings_richsnippet']); $postratings_ratingstext_array = $_POST['postratings_ratingstext']; $postratings_ratingstext = array(); + $postratings_vote_text_singular = sanitize_text_field(trim($_POST['postratings_vote_text_singular'])); + $postratings_vote_text_plural = sanitize_text_field(trim($_POST['postratings_vote_text_plural'])); if( ! empty( $postratings_ratingstext_array ) && is_array( $postratings_ratingstext_array ) ) { foreach( $postratings_ratingstext_array as $ratingstext ) { $postratings_ratingstext[] = wp_kses_post(trim( $ratingstext )); @@ -79,6 +81,8 @@ $update_ratings_queries[] = update_option('postratings_logging_method', $postratings_logging_method); $update_ratings_queries[] = update_option('postratings_allowtorate', $postratings_allowtorate); $update_ratings_queries[] = update_option('postratings_options', $postratings_options); + $update_ratings_queries[] = update_option('postratings_vote_text_singular', $postratings_vote_text_singular); + $update_ratings_queries[] = update_option('postratings_vote_text_plural', $postratings_vote_text_plural); $update_ratings_text[] = __('Custom Rating', 'wp-postratings'); $update_ratings_text[] = __('Ratings Template Vote', 'wp-postratings'); $update_ratings_text[] = __('Ratings Template Voted', 'wp-postratings'); @@ -94,6 +98,8 @@ $update_ratings_text[] = __('Logging Method', 'wp-postratings'); $update_ratings_text[] = __('Allow To Vote Option', 'wp-postratings'); $update_ratings_text[] = __('Ratings Settings', 'wp-postratings'); + $update_ratings_text[] = __('Custom vote text (singular)', 'wp-postratings'); + $update_ratings_text[] = __('Custom vote text (plural)', 'wp-postratings'); $i = 0; $text = ''; foreach($update_ratings_queries as $update_ratings_query) { @@ -124,22 +130,22 @@ function ratings_updown_templates(template, print) { var default_template; switch(template) { case "vote": - default_template = "%RATINGS_IMAGES_VOTE% (%RATINGS_SCORE% %RATINGS_USERS% )
    %RATINGS_TEXT%"; + default_template = "%RATINGS_IMAGES_VOTE% (%RATINGS_SCORE% %RATINGS_USERS% %RATINGS_VOTE_TEXT%)
    %RATINGS_TEXT%"; break; case "text": - default_template = "%RATINGS_IMAGES% (%RATINGS_SCORE% %RATINGS_USERS% )"; + default_template = "%RATINGS_IMAGES% (%RATINGS_SCORE% %RATINGS_USERS% %RATINGS_VOTE_TEXT% )"; break; case "permission": - default_template = "%RATINGS_IMAGES% (%RATINGS_SCORE% %RATINGS_USERS% )
    "; + default_template = "%RATINGS_IMAGES% (%RATINGS_SCORE% %RATINGS_USERS% %RATINGS_VOTE_TEXT% )
    "; break; case "none": default_template = "%RATINGS_IMAGES_VOTE% ()
    %RATINGS_TEXT%"; break; case "highestrated": - default_template = "
  • %POST_TITLE% (%RATINGS_SCORE% %RATINGS_USERS% )
  • "; + default_template = "
  • %POST_TITLE% (%RATINGS_SCORE% %RATINGS_USERS% %RATINGS_VOTE_TEXT%)
  • "; break; case "mostrated": - default_template = "
  • %POST_TITLE% - %RATINGS_USERS%
  • "; + default_template = "
  • %POST_TITLE% - %RATINGS_USERS% %RATINGS_VOTE_TEXT%
  • "; break; } if(print) { @@ -152,13 +158,13 @@ function ratings_default_templates(template, print) { var default_template; switch(template) { case "vote": - default_template = "%RATINGS_IMAGES_VOTE% (%RATINGS_USERS% : %RATINGS_AVERAGE% %RATINGS_MAX%)
    %RATINGS_TEXT%"; + default_template = "%RATINGS_IMAGES_VOTE% (%RATINGS_USERS% %RATINGS_VOTE_TEXT% : %RATINGS_AVERAGE% %RATINGS_MAX%)
    %RATINGS_TEXT%"; break; case "text": - default_template = "%RATINGS_IMAGES% (%RATINGS_USERS% : %RATINGS_AVERAGE% %RATINGS_MAX% )"; + default_template = "%RATINGS_IMAGES% (%RATINGS_USERS% %RATINGS_VOTE_TEXT% : %RATINGS_AVERAGE% %RATINGS_MAX% )"; break; case "permission": - default_template = "%RATINGS_IMAGES% (%RATINGS_USERS% : %RATINGS_AVERAGE% %RATINGS_MAX%)
    "; + default_template = "%RATINGS_IMAGES% (%RATINGS_USERS% %RATINGS_VOTE_TEXT% : %RATINGS_AVERAGE% %RATINGS_MAX%)
    "; break; case "none": default_template = "%RATINGS_IMAGES_VOTE% ()
    %RATINGS_TEXT%"; @@ -167,7 +173,7 @@ function ratings_default_templates(template, print) { default_template = "
  • %POST_TITLE% %RATINGS_IMAGES% (%RATINGS_AVERAGE% %RATINGS_MAX%)
  • "; break; case "mostrated": - default_template = "
  • %POST_TITLE% - %RATINGS_USERS%
  • "; + default_template = "
  • %POST_TITLE% - %RATINGS_USERS% %RATINGS_VOTE_TEXT%
  • "; break; } if(print) { @@ -363,6 +369,21 @@ function set_custom(custom, max) { +

    + + + + + + + + + +
    + +
    + +

    diff --git a/postratings-templates.php b/postratings-templates.php index 53ba456..50c1f7a 100644 --- a/postratings-templates.php +++ b/postratings-templates.php @@ -72,22 +72,22 @@ function ratings_updown_templates(template, print) { var default_template; switch(template) { case "vote": - default_template = "%RATINGS_IMAGES_VOTE% (%RATINGS_SCORE%%RATINGS_USERS%)
    %RATINGS_TEXT%"; + default_template = "%RATINGS_IMAGES_VOTE% (%RATINGS_SCORE%%RATINGS_USERS% %RATINGS_VOTE_TEXT%)
    %RATINGS_TEXT%"; break; case "text": - default_template = "%RATINGS_IMAGES% (%RATINGS_SCORE% %RATINGS_USERS% )"; + default_template = "%RATINGS_IMAGES% (%RATINGS_SCORE% %RATINGS_USERS% %RATINGS_VOTE_TEXT% )"; break; case "permission": - default_template = "%RATINGS_IMAGES% (%RATINGS_SCORE% %RATINGS_USERS% )
    "; + default_template = "%RATINGS_IMAGES% (%RATINGS_SCORE% %RATINGS_USERS% %RATINGS_VOTE_TEXT% )
    "; break; case "none": default_template = "%RATINGS_IMAGES_VOTE% ()
    %RATINGS_TEXT%"; break; case "highestrated": - default_template = "
  • %POST_TITLE% (%RATINGS_SCORE% %RATINGS_USERS% )
  • "; + default_template = "
  • %POST_TITLE% (%RATINGS_SCORE% %RATINGS_USERS% %RATINGS_VOTE_TEXT%)
  • "; break; case "mostrated": - default_template = "
  • %POST_TITLE% - %RATINGS_USERS%
  • "; + default_template = "
  • %POST_TITLE% - %RATINGS_USERS% %RATINGS_VOTE_TEXT%
  • "; break; } if(print) { @@ -100,13 +100,13 @@ function ratings_default_templates(template, print) { var default_template; switch(template) { case "vote": - default_template = "%RATINGS_IMAGES_VOTE% (%RATINGS_USERS%: %RATINGS_AVERAGE% %RATINGS_MAX%)
    %RATINGS_TEXT%"; + default_template = "%RATINGS_IMAGES_VOTE% (%RATINGS_USERS% %RATINGS_VOTE_TEXT%: %RATINGS_AVERAGE% %RATINGS_MAX%)
    %RATINGS_TEXT%"; break; case "text": - default_template = "%RATINGS_IMAGES% (%RATINGS_USERS% : %RATINGS_AVERAGE% %RATINGS_MAX% )"; + default_template = "%RATINGS_IMAGES% (%RATINGS_USERS% %RATINGS_VOTE_TEXT% : %RATINGS_AVERAGE% %RATINGS_MAX% )"; break; case "permission": - default_template = "%RATINGS_IMAGES% (%RATINGS_USERS% : %RATINGS_AVERAGE% %RATINGS_MAX%)
    "; + default_template = "%RATINGS_IMAGES% (%RATINGS_USERS% %RATINGS_VOTE_TEXT% : %RATINGS_AVERAGE% %RATINGS_MAX%)
    "; break; case "none": default_template = "%RATINGS_IMAGES_VOTE% ()
    %RATINGS_TEXT%"; @@ -115,7 +115,7 @@ function ratings_default_templates(template, print) { default_template = "
  • %POST_TITLE% %RATINGS_IMAGES% (%RATINGS_AVERAGE% %RATINGS_MAX%)
  • "; break; case "mostrated": - default_template = "
  • %POST_TITLE% - %RATINGS_USERS%
  • "; + default_template = "
  • %POST_TITLE% - %RATINGS_USERS% %RATINGS_VOTE_TEXT%
  • "; break; } if(print) { @@ -149,6 +149,9 @@ function ratings_default_templates(template, print) { + + +
    %RATINGS_SCORE% - %RATINGS_TEXT% -
    %RATINGS_VOTE_TEXT% -

    @@ -163,6 +166,7 @@ function ratings_default_templates(template, print) {

    - %RATINGS_USERS%

    - %RATINGS_AVERAGE%

    - %RATINGS_PERCENTAGE%

    +

    - %RATINGS_VOTE_TEXT%


    @@ -179,6 +183,7 @@ function ratings_default_templates(template, print) {

    - %RATINGS_USERS%

    - %RATINGS_AVERAGE%

    - %RATINGS_PERCENTAGE%

    +

    - %RATINGS_VOTE_TEXT%


    @@ -194,6 +199,7 @@ function ratings_default_templates(template, print) {

    - %RATINGS_USERS%

    - %RATINGS_AVERAGE%

    - %RATINGS_PERCENTAGE%

    +

    - %RATINGS_VOTE_TEXT%


    @@ -248,6 +254,7 @@ function ratings_default_templates(template, print) {

    - %POST_CONTENT%

    - %POST_URL%

    - %POST_THUMBNAIL%

    +

    - %RATINGS_VOTE_TEXT%


    diff --git a/uninstall.php b/uninstall.php index 88d30fc..38d5bea 100644 --- a/uninstall.php +++ b/uninstall.php @@ -25,6 +25,8 @@ , 'postratings_options' , 'widget_ratings' , 'widget_ratings-widget' + , 'postratings_vote_text_singular' + , 'postratings_vote_text_plural' ); diff --git a/wp-postratings.php b/wp-postratings.php index 7618b0e..266352d 100644 --- a/wp-postratings.php +++ b/wp-postratings.php @@ -1073,6 +1073,8 @@ function expand_ratings_template($template, $post_data, $post_ratings_data = nul $ratings_max = (int) get_option( 'postratings_max' ); $ratings_custom = (int) get_option( 'postratings_customrating' ); $ratings_options = get_option( 'postratings_options' ); + $ratings_vote_text_singular = get_option('postratings_vote_text_singular', 'vote'); + $ratings_vote_text_plural = get_option('postratings_vote_text_plural', 'votes'); if ( is_object( $post_data ) ) { $post_id = (int) $post_data->ID; @@ -1149,6 +1151,11 @@ function expand_ratings_template($template, $post_data, $post_ratings_data = nul $value = str_replace("%RATINGS_AVERAGE%", number_format_i18n($post_ratings_average, 2), $value); $value = str_replace("%RATINGS_PERCENTAGE%", number_format_i18n($post_ratings_percentage, 2), $value); $value = str_replace("%RATINGS_USERS%", number_format_i18n($post_ratings_users), $value); + if ($post_ratings_users > 1) { + $value = str_replace("%RATINGS_VOTE_TEXT%", $ratings_vote_text_plural, $value); + } else { + $value = str_replace("%RATINGS_VOTE_TEXT%", $ratings_vote_text_singular, $value); + } // Post Template Variables $post_link = get_permalink($post_data);