Plugin Directory

Changeset 1996469


Ignore:
Timestamp:
12/17/2018 02:08:44 PM (7 years ago)
Author:
awslabs
Message:

2.6.2 trunk

Location:
amazon-polly/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • amazon-polly/trunk/README.md

    r1991560 r1996469  
    77| Requires PHP | 5.6 |
    88| Tested up to | 4.9 |
    9 | Stable tag | 2.6.1 |
     9| Stable tag | 2.6.2 |
    1010| License | GPLv3 ONLY |
    1111| License URI | https://www.gnu.org/licenses/gpl-3.0.html |
     
    3838
    3939###### Other settings:
    40 - Post Types: Specifies on which type of WordPress page plugin will be used. The default value is ‘posts’
     40- Post types: Specifies on which type of WordPress page plugin will be used. The default value is ‘posts’
     41- Display "Powered by AWS": This option let you to choose if you want to display Display by AWS logo on your website or (otherwise) add it to the content (like audio) which will be generated by the plugin
     42- Enable logging: Specifies if detailed pluging logging should be enabled.
     43- Skip tags: Allows to specify tags (for example audio) for which audio won't be generated.
    4144
    4245
     
    243246Important: Text will be shown in transcript if translate functionality is enabled, even if it was marked as "Audio Only".
    244247
    245 #### Q: What is "Words Only" functionality?
    246 
    247 If you have a piece of content that you want on your page but not read by the plugin, you use the -AMAZONPOLLY-ONLYWORDS- tag. For example:
    248 
    249 -AMAZONPOLLY-ONLYWORDS-START-
    250 
    251 [Text that will be shown in the browser but not read by the plugin.]
    252 
    253 -AMAZONPOLLY-ONLYWORDS-END-
    254 
    255 Important: Text will be read in translated audio files if translate functionality is enabled, even if it was marked as "Words Only".
    256 
    257 
    258248
    259249#### Changelog
     250
     251= 2.6.2 =
     252* Added possibility to specify tags, which won't be read (for example 'audio'). This option is available under 'Text-To-Speech' tab as 'Skip tags' option.
     253* Cleaning WordPress options when plugin is uninstalled.
    260254
    261255= 2.6.1 =
  • amazon-polly/trunk/README.txt

    r1991560 r1996469  
    55Requires PHP: 5.6
    66Tested up to: 4.9
    7 Stable tag: 2.6.1
     7Stable tag: 2.6.2
    88License: GPLv3 ONLY
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    3636
    3737Other settings:
    38 - Post Types: Specifies on which type of WordPress page plugin will be used. The default value is ‘posts’
     38- Post types: Specifies on which type of WordPress page plugin will be used. The default value is ‘posts’
     39- Display "Powered by AWS": This option let you to choose if you want to display Display by AWS logo on your website or (otherwise) add it to the content (like audio) which will be generated by the plugin
     40- Enable logging: Specifies if detailed pluging logging should be enabled.
     41- Skip tags: Allows to specify tags (for example audio) for which audio won't be generated.
     42
    3943
    4044
     
    238242Important: Text will be shown in transcript if translate functionality is enabled, even if it was marked as "Audio Only".
    239243
    240 == What is "Words Only" functionality? ==
    241 
    242 If you have a piece of content that you want on your page but not read by the plugin, you use the -AMAZONPOLLY-ONLYWORDS- tag. For example:
    243 
    244 -AMAZONPOLLY-ONLYWORDS-START-
    245 
    246 [Text that will be shown in the browser but not read by the plugin.]
    247 
    248 -AMAZONPOLLY-ONLYWORDS-END-
    249 
    250 Important: Text will be read in translated audio files if translate functionality is enabled, even if it was marked as "Words Only".
    251 
    252244== Changelog ==
     245
     246= 2.6.2 =
     247* Added possibility to specify tags, which won't be read (for example 'audio'). This option is available under 'Text-To-Speech' tab as 'Skip tags' option.
     248* Cleaning WordPress options when plugin is uninstalled.
    253249
    254250= 2.6.1 =
  • amazon-polly/trunk/admin/AmazonAI-Common.php

    r1991560 r1996469  
    11361136        $clean_text = str_replace(' ', ' ', $clean_text);
    11371137        $clean_text = do_shortcode($clean_text);
     1138
     1139        $clean_text = $this->skip_tags($clean_text);
     1140
    11381141        $is_ssml_enabled = $this->is_ssml_enabled();
    11391142        if ($is_ssml_enabled) {
     
    12201223    }
    12211224
     1225    private function skip_tags($text) {
     1226
     1227        $skip_tags_array = $this->get_skiptags_array();
     1228
     1229        foreach ($skip_tags_array as $value) {
     1230            $text = preg_replace('/<' . $value . '>(\s*?)(.*?)(\s*?)<\/' . $value . '>/', '', $text);
     1231        }
     1232
     1233        return $text;
     1234    }
    12221235
    12231236    /**
     
    13211334
    13221335    /**
     1336     * Return skip tags array.
     1337     *
     1338     * @since  1.0.7
     1339     */
     1340    public function get_skiptags_array() {
     1341        $array = get_option( 'amazon_ai_skip_tags' );
     1342        $array = explode( ' ', $array );
     1343
     1344        return $array;
     1345
     1346    }
     1347
     1348    /**
    13231349     * Return post type value array.
    13241350     *
  • amazon-polly/trunk/admin/AmazonAI-PollyConfiguration.php

    r1942322 r1996469  
    7575                    add_settings_field( 'amazon_polly_add_post_excerpt', __( 'Add post excerpt to audio:', 'amazonpolly' ), array( $this, 'add_post_excerpt_gui' ), 'amazon_ai_polly', 'amazon_ai_pollyadditional', array( 'label_for' => 'amazon_polly_add_post_excerpt' ) );
    7676              add_settings_field( 'amazon_ai_medialibrary_enabled', __( 'Enable Media Library support:', 'amazonpolly' ), array( $this, 'medialibrary_enabled_gui' ), 'amazon_ai_polly', 'amazon_ai_pollyadditional', array( 'label_for' => 'amazon_ai_medialibrary_enabled' ) );
    77 
     77              add_settings_field( 'amazon_ai_skip_tags', __( 'Skip tags:', 'amazonpolly' ), array( $this, 'skiptags_gui' ), 'amazon_ai_polly', 'amazon_ai_pollyadditional', array( 'label_for' => 'amazon_ai_skip_tags' ) );
    7878
    7979                    //Registration
     
    9494                    register_setting('amazon_ai_polly', 'amazon_polly_add_post_excerpt');
    9595              register_setting('amazon_ai_polly', 'amazon_ai_medialibrary_enabled');
     96              register_setting('amazon_ai_polly', 'amazon_ai_skip_tags');
     97
    9698            }
    9799          }
     
    222224
    223225    }
     226
     227    /**
     228     * Render the Player Label input.
     229     *
     230     * @since  1.0.3
     231     */
     232  public function skiptags_gui() {
     233
     234        $tags = get_option( 'amazon_ai_skip_tags' );
     235        echo '<input type="text" class="regular-text" name="amazon_ai_skip_tags" id="amazon_ai_skip_tags" value="' . esc_attr( $tags ) . '"> ';
     236
     237  }
    224238
    225239    /**
  • amazon-polly/trunk/admin/AmazonAI-Translator.php

    r1991560 r1996469  
    254254                $langs = $all_langs;
    255255                update_post_meta( $post_id, 'amazon_ai_source_language', $source_language );
    256                
     256
    257257            } else {
    258258
     
    267267
    268268                $logger->log(sprintf('%s Translating from ( %s ) to ( %s )', __METHOD__, $source_language, $language_code));
    269 
    270269                $wp_filesystem = $common->prepare_wp_filesystem();
    271270
     
    282281                        // Create audio files for files only if this functionality is enabled.
    283282                        if ( $common->is_audio_for_translations_enabled() ) {
     283                            $logger->log(sprintf('%s Starting preparing audio version', __METHOD__));
    284284                            $polly->convert_to_audio( $post_id, '', '', $sentences, $wp_filesystem, $language_code );
    285285                        }
  • amazon-polly/trunk/amazonpolly.php

    r1991560 r1996469  
    1717 * Plugin URI:        https://wordpress.org/plugins/amazon-polly/
    1818 * Description:       Create audio version of your posts, translate them into other languages and create podcasts! Amazon Polly is a service that turns text into lifelike speech. With dozens of voices across a variety of languages, you can select the ideal voice and build engaging speech-enabled applications that work in many different countries. The Amazon Polly plugin for WordPress is a sample application that shows how WordPress creators can easily add Text-to-Speech capabilities to written content with Amazon Polly. You can generate an audio feed for text-based content and insert it into an embedded player to increase the accessibility of your WordPress site. The sample code also enables you to publish podcasts directly from your site and make them available for listeners in the form of podcasts. In addition, the plugin allows to translate your text from one language to another using Amazon Translate– which is a neural machine translation service that delivers fast, high-quality, and affordable language translation. Amazon Translate allows you to localize content - such as websites and applications - for international users, and to easily translate large volumes of text efficiently.
    19  * Version:           2.6.1
     19 * Version:           2.6.2
    2020 * Author:            AWS Labs, WP Engine
    2121 * Author URI:        https://aws.amazon.com/
  • amazon-polly/trunk/uninstall.php

    r1991560 r1996469  
    1313     exit;
    1414 }
     15
     16// General Options
     17delete_option('amazon_polly_access_key');
     18delete_option('amazon_polly_secret_key');
     19
     20delete_option('amazon_ai_source_language');
     21delete_option('amazon_polly_region');
     22delete_option('amazon_polly_s3');
     23delete_option('amazon_polly_cloudfront');
     24delete_option('amazon_polly_posttypes');
     25delete_option('amazon_polly_poweredby');
     26delete_option('amazon_ai_logging');
     27
     28// Text-To-Speech Options
     29delete_option('amazon_polly_sample_rate');
     30delete_option('amazon_polly_voice_id');
     31delete_option('amazon_polly_auto_breaths');
     32delete_option('amazon_polly_ssml');
     33delete_option('amazon_polly_lexicons');
     34delete_option('amazon_polly_speed');
     35delete_option('amazon_polly_position');
     36delete_option('amazon_polly_player_label');
     37delete_option('amazon_polly_defconf');
     38delete_option('amazon_polly_autoplay');
     39delete_option('amazon_polly_update_all');
     40delete_option('amazon_polly_add_post_title');
     41delete_option('amazon_polly_add_post_excerpt');
     42delete_option('amazon_ai_medialibrary_enabled');
     43delete_option('amazon_ai_skip_tags');
     44
     45// Translate Options
     46delete_option('amazon_polly_trans_enabled');
     47delete_option('amazon_polly_trans_src_lang');
     48delete_option('amazon_ai_audio_for_translation_enabled');
     49
     50$languages = array('da','nl','zh','cs','en','fi','fr','de','he','it','id','ja','ko','nb','pl','pt','ro','ru','es','sv','tr','cy');
     51foreach( $languages as $language_code ){
     52  delete_option('amazon_polly_trans_langs_' . $language_code, 'strval');
     53  delete_option('amazon_polly_trans_langs_' . $language_code . '_voice', 'strval');
     54  delete_option('amazon_polly_trans_langs_' . $language_code . '_label', 'strval');
     55  delete_option('amazon_polly_trans_langs_' . $language_code . '_display', 'strval');
     56}
     57
     58// Podcast Options
     59delete_option('amazon_polly_podcast_email');
     60delete_option('amazon_polly_podcast_category');
     61delete_option('amazon_polly_podcast_explicit');
     62delete_option('amazon_polly_podcast_icon');
     63delete_option('amazon_polly_podcast_feedsize');
     64delete_option('amazon_polly_podcast_post_cat');
     65delete_option('amazon_polly_podcast_author');
     66delete_option('amazon_polly_podcast_https');
Note: See TracChangeset for help on using the changeset viewer.