Plugin Directory

Changeset 3773505


Ignore:
Timestamp:
10/29/2026 04:23:35 PM (73 minutes ago)
Author:
hasanazizul
Message:

Release 2.3.23

Location:
text-to-audio/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • text-to-audio/trunk/includes/TTA_Helper.php

    r3761034 r3773505  
    131131    }
    132132
     133    /**
     134     * Check whether a post has any of the excluded tags or categories.
     135     *
     136     * @param WP_Term[]|false $post_terms     Terms attached to the post.
     137     * @param string[]        $excluded_terms Excluded term slugs from the settings.
     138     * @param string          $term_type      'tag' or 'category', passed to the filter.
     139     * @return bool True when at least one term is excluded.
     140     */
    133141    public static function is_exluded_by_terms($post_terms, $excluded_terms, $term_type = 'tag')
    134142    {
    … …  
    153161    }
    154162
     163    /**
     164     * Decide whether the player should be shown for a post.
     165     *
     166     * Checks the single-view context, excluded posts, tags, categories, post types
     167     * and post statuses from the settings. Filter: `tta_should_load_button`.
     168     *
     169     * @param WP_Post|int|string $current_post Post object or ID; defaults to the global post.
     170     * @param string             $called_from  Caller name, passed to the filter.
     171     * @param string|null        $reason       Out-parameter: why the player was not shown.
     172     * @return bool True when the player should be shown.
     173     */
    155174    public static function should_load_button($current_post = '', $called_from = 'default', &$reason = null)
    156175    {
    … …  
    396415    }
    397416
     417    /**
     418     * Get the status of the global post.
     419     *
     420     * @return string Post status, or an empty string when there is no post.
     421     */
    398422    public static function tts_post_status()
    399423    {
    … …  
    533557    }
    534558
     559    /**
     560     * Collect settings for active translation plugins the player supports (GTranslate, WPML and others).
     561     *
     562     * @return array Data keyed by plugin file, only for active plugins.
     563     */
    535564    public static function get_compatible_plugins_data()
    536565    {
    … …  
    649678    }
    650679
     680    /**
     681     * Get the listening language saved in the settings.
     682     *
     683     * @param array $plugin_all_settings All plugin settings.
     684     * @return string Language code, filtered by `tts_site_language`.
     685     */
    651686    public static function tts_site_language($plugin_all_settings)
    652687    {
    … …  
    703738    }
    704739
     740    /**
     741     * Build the key an MP3 file URL is stored under for a language and voice.
     742     *
     743     * @param string $language Language code.
     744     * @param string $voice    Voice name; added to the key for players above 3.
     745     * @return string The file URL key.
     746     */
    705747    public static function tts_get_file_url_key($language, $voice = '')
    706748    {
    … …  
    722764    }
    723765
     766    /**
     767     * Get the listening voice saved in the settings (players 4 to 6 only).
     768     *
     769     * @param array $plugin_all_settings All plugin settings.
     770     * @return string Voice name with spaces and brackets replaced by underscores.
     771     */
    724772    public static function tts_get_voice($plugin_all_settings)
    725773    {
    … …  
    736784    }
    737785
     786    /**
     787     * Build the MP3 file name for a post, language and voice.
     788     *
     789     * @param string         $title        Title to use; falls back to the post title, then the post ID.
     790     * @param string         $selectedLang Language code.
     791     * @param string         $voice        Voice name (players 4 to 6).
     792     * @param int|string     $post_id      Post ID; defaults to the post's ID.
     793     * @param WP_Post|string $post         Post object; defaults to the global post.
     794     * @return string File name without extension, filtered by `tts_file_name`.
     795     */
    738796    public static function tts_file_name($title, $selectedLang, $voice = '', $post_id = '', $post = '')
    739797    {
    … …  
    11861244    }
    11871245
     1246    /**
     1247     * Check whether the uploads folder can be written to.
     1248     *
     1249     * @return bool True when the folder is writable.
     1250     */
    11881251    public static function is_audio_folder_writable()
    11891252    {
    … …  
    11981261    }
    11991262
     1263    /**
     1264     * Get the active player ID. Wrapper for the global get_player_id().
     1265     *
     1266     * @return int Player ID.
     1267     */
    12001268    public static function get_player_id()
    12011269    {
    … …  
    12281296    }
    12291297
     1298    /**
     1299     * Save the default settings when they have not been saved yet.
     1300     *
     1301     * @return void
     1302     */
    12301303    public static function set_default_settings()
    12311304    {
    … …  
    12361309    }
    12371310
     1311    /**
     1312     * Check whether an MP3 file is missing, so it must be made again.
     1313     *
     1314     * @param string $url       File URL.
     1315     * @param string $date      Post date folder (Y/m/d).
     1316     * @param string $file_name Expected file name.
     1317     * @return bool True when the file is missing or does not match.
     1318     */
    12381319    public static function is_file_url_not_exists_and_is_file_empty($url, $date, $file_name)
    12391320    {
    … …  
    15641645    }
    15651646
     1647    /**
     1648     * Clean text before it is read aloud.
     1649     *
     1650     * Removes symbols that cannot be spoken, repeated punctuation, spacer dots and
     1651     * extra white space.
     1652     *
     1653     * @param string $inputString Text to clean.
     1654     * @return string Cleaned text.
     1655     */
    15661656    public static function clean_string($inputString)
    15671657    {
    … …  
    16241714
    16251715
     1716    /**
     1717     * Get the language and voice the player uses for a post.
     1718     *
     1719     * @param string  $language            Language from the settings.
     1720     * @param string  $voice               Voice from the settings.
     1721     * @param array   $plugin_all_settings All plugin settings.
     1722     * @param WP_Post $post                Current post.
     1723     * @return array { language: string, voice: string }, filtered by `tts_player_language_and_player_voice`.
     1724     */
    16261725    public static function get_player_language_and_player_voice($language, $voice, $plugin_all_settings, $post)
    16271726    {
    … …  
    16401739    }
    16411740
     1741    /**
     1742     * Check whether the current admin screen is the post editor.
     1743     *
     1744     * @return bool True on post.php or post-new.php.
     1745     */
    16421746    public static function is_edit_page()
    16431747    {
    … …  
    16541758    }
    16551759
     1760    /**
     1761     * Check whether the current admin screen is the AtlasVoice dashboard.
     1762     *
     1763     * @return bool|null True on the dashboard, false on other admin screens, null outside the admin.
     1764     */
    16561765    public static function is_text_to_audio_page()
    16571766    {
    … …  
    17621871    }
    17631872
     1873    /**
     1874     * Check whether Advanced Custom Fields (free or Pro) is active.
     1875     *
     1876     * @return bool True when ACF is active.
     1877     */
    17641878    public static function is_acf_active()
    17651879    {
    … …  
    17841898    }
    17851899
     1900    /**
     1901     * Get the post statuses shown in the admin, cached.
     1902     *
     1903     * @return array Status labels keyed by status name.
     1904     */
    17861905    public static function all_post_status()
    17871906    {
    … …  
    18661985    }
    18671986
     1987    /**
     1988     * Get the public post types, cached.
     1989     *
     1990     * @return array Post type labels keyed by name, filtered by `tts_get_post_types`.
     1991     */
    18681992    public static function get_post_types()
    18691993    {
    … …  
    20162140
    20172141
     2142    /**
     2143     * Get a post's date as the Y/m/d folder used for its MP3 files.
     2144     *
     2145     * @param WP_Post $post Post object.
     2146     * @return string Date in Y/m/d format.
     2147     */
    20182148    public static function get_post_date($post)
    20192149    {
    … …  
    20242154    }
    20252155
     2156    /**
     2157     * Check whether the listening language or voice differs from the saved settings.
     2158     *
     2159     * @param array|object $current_data Listening settings about to be saved.
     2160     * @return bool True when a value changed or is missing.
     2161     */
    20262162    public static function is_listening_lang_or_voice_changed($current_data)
    20272163    {
    … …  
    20612197    }
    20622198
     2199    /**
     2200     * Check whether the chosen player differs from the saved one.
     2201     *
     2202     * @param array|object $current_data Customize settings about to be saved.
     2203     * @return bool True when the player changed.
     2204     */
    20632205    public static function is_player_number_changed($current_data)
    20642206    {
    … …  
    20772219    }
    20782220
     2221    /**
     2222     * Delete a meta key from every post.
     2223     *
     2224     * @param string $meta_key Meta key to delete.
     2225     * @return int|bool Number of rows deleted, or false on error.
     2226     */
    20792227    public static function delete_post_meta($meta_key = 'tts_is_mp3_file_url_exists')
    20802228    {
    … …  
    20962244    }
    20972245
     2246    /**
     2247     * Strip HTML, scripts and styles from content and clean it for reading aloud.
     2248     *
     2249     * @param string $content Raw content.
     2250     * @return string Plain text.
     2251     */
    20982252    public static function clean_content($content) {
    20992253
    … …  
    21112265    }
    21122266
     2267    /**
     2268     * Remove a post from the duplicate-post list and clear its saved MP3 URLs.
     2269     *
     2270     * @param int $post_id Post ID.
     2271     * @return void
     2272     */
    21132273    public static function  delete_duplicate_post_ids_if_have( $post_id ){
    21142274        $duplicate_post_ids = get_option('tts_duplicate_post_ids', array());
    … …  
    21272287    }
    21282288
     2289    /**
     2290     * Remove script, style and stylesheet tags from content.
     2291     *
     2292     * @param string $content HTML content.
     2293     * @return string Content without scripts and styles.
     2294     */
    21292295    public static function remove_js_and_css_from_content($content) {
    21302296        // Remove <script>...</script>
    … …  
    21432309    }
    21442310   
     2311    /**
     2312     * Check whether a post's content contains an AtlasVoice shortcode.
     2313     *
     2314     * @param WP_Post|object $post Post object.
     2315     * @return bool True when [tta_listen_btn] or [atlasvoice] is used.
     2316     */
    21452317    public static function tts_has_shortcode($post) {
    21462318        // TTS-261: has_shortcode() runs str_contains() on the content — a non-string
    … …  
    21502322    }
    21512323
     2324    /**
     2325     * Detect the visitor's browser from the user agent.
     2326     *
     2327     * @return string firefox, chrome, safari, edge, opera or unknown.
     2328     */
    21522329    public  static  function detect_browser() {
    21532330        $user_agent = isset( $_SERVER['HTTP_USER_AGENT'] )
    … …  
    21712348    }
    21722349
     2350    /**
     2351     * Get the visitor's IP address, checking proxy and Cloudflare headers first.
     2352     *
     2353     * @return string IP address, or UNKNOWN.
     2354     */
    21732355    public static  function get_user_ip_address() {
    21742356        $ip_keys = [
  • text-to-audio/trunk/includes/helpers.php

    r3761034 r3773505  
    219219}
    220220
     221/**
     222 * Build the player markup for a shortcode, block or the_content.
     223 *
     224 * @param array  $atts        Shortcode or block attributes.
     225 * @param bool   $is_block    True when called from the block.
     226 * @param string $tag_content Content wrapped by the shortcode.
     227 * @return string|null Player HTML, an HTML note for editors, or null in the admin.
     228 */
    221229function tta_get_button_content($atts, $is_block = false, $tag_content = '')
    222230{
    … …  
    560568}
    561569
     570/**
     571 * Print the player's data for one post as a JSON payload.
     572 *
     573 * @param array $params              Player values (post, title, content, date, player_number and others).
     574 * @param array $plugin_all_settings All plugin settings.
     575 * @return void
     576 */
    562577function get_enqueued_js_object($params, $plugin_all_settings)
    563578{
    … …  
    599614        'settings'             => isset( $plugin_all_settings['settings'] ) ? $plugin_all_settings['settings'] : new \stdClass(),
    600615        'extra'                => array(
     616            // TTS-359: TTS.settings is filled by the first player only, so a page
     617            // with players for several posts needs each player's own post ID here.
     618            'post_id'             => (int) $post->ID,
    601619            'title'               => (string) $title,
    602620            'file_name'           => (string) $file_name,
    … …  
    682700
    683701
     702/**
     703 * Check whether two texts share at least 80% of their words (Jaccard similarity).
     704 *
     705 * @param string $text1 First text.
     706 * @param string $text2 Second text.
     707 * @return bool True when the texts match by 80% or more.
     708 */
    684709function tts_text_match_80_percent($text1, $text2)
    685710{
    … …  
    931956
    932957
     958/**
     959 * Get the registered shortcodes used in content.
     960 *
     961 * @param string $content Content to search.
     962 * @return string[] Shortcode tag names.
     963 */
    933964function get_used_shortcodes($content)
    934965{
    … …  
    947978}
    948979
     980/**
     981 * Get the WordPress locale names, keyed by locale code.
     982 *
     983 * @return array Locale names keyed by locale code.
     984 */
    949985function tta_get_default_languages()
    950986{
    … …  
    10811117
    10821118// Define rtl
     1119/**
     1120 * Check whether the site locale is written right to left.
     1121 *
     1122 * @return bool True for Arabic, Hebrew and Urdu locales.
     1123 */
    10831124function tta_is_rtl()
    10841125{
    … …  
    11531194
    11541195
     1196/**
     1197 * Save the default button texts on first use and return them.
     1198 *
     1199 * @param string $content_read_time Reading time, passed to the filter.
     1200 * @return array Button texts, filtered by `tts_initial_button_texts`.
     1201 */
    11551202function set_initial_button_texts($content_read_time)
    11561203{
    … …  
    11881235
    11891236
     1237/**
     1238 * Get the active player ID from the settings.
     1239 *
     1240 * Falls back to player 1 when the saved player is not available, for example
     1241 * after Pro was deactivated. Filter: `tts_get_player_id`.
     1242 *
     1243 * @return int Player ID.
     1244 */
    11901245function get_player_id()
    11911246{
  • text-to-audio/trunk/readme.txt

    r3761034 r3773505  
    66Tested up to: 7.1
    77Requires PHP: 7.4
    8 Stable tag: 2.3.22
     8Stable tag: 2.3.23
    99License: GPLv3 or later
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.txt
    … …  
    396396
    397397
     398= 2.3.23 ( 29 Oct 2026 ) =
     399Fixed : On a page with audio players for more than one post, each player now tells AtlasVoice Pro which post it belongs to.
     400Changed : Behind-the-scenes tidy-up of the code documentation.
     401
    398402= 2.3.22 ( 23 Oct 2026 ) =
    399403Fixed : On iPhone the player keeps reading the whole post instead of stopping after the first paragraph.
    … …  
    569573== Upgrade Notice ==
    570574
     575= 2.3.23 =
     576Helps pages with audio players for more than one post when AtlasVoice Pro is active, plus a behind-the-scenes tidy-up. Safe to update.
     577
    571578= 2.3.22 =
    572579Fixes the player on iPhone and Android phones (stopping after the first paragraph, staying silent, or an empty button) and makes Staging and Go live easier to see. Recommended for all sites.
  • text-to-audio/trunk/text-to-audio.php

    r3761034 r3773505  
    1616 * Plugin URI:        https://atlasaidev.com/
    1717 * Description:       The most user-friendly Text-to-Speech Accessibility plugin. Just install and automatically add a Text to Audio player to your WordPress site!
    18  * Version:           2.3.22
     18 * Version:           2.3.23
    1919 * Author:            AtlasAiDev
    2020 * Author URI:        http://atlasaidev.com/
    … …  
    173173    {
    174174        if (!defined('TEXT_TO_AUDIO_VERSION')) {
    175             define('TEXT_TO_AUDIO_VERSION', apply_filters('tts_version', '2.3.22'));
     175            define('TEXT_TO_AUDIO_VERSION', apply_filters('tts_version', '2.3.23'));
    176176        }
    177177
Note: See TracChangeset for help on using the changeset viewer.