Plugin Directory

Changeset 3448586


Ignore:
Timestamp:
01/28/2026 10:31:16 AM (6 weeks ago)
Author:
codepeople2
Message:

New version 1.7.7
Modifications in the changelogs.

Location:
music-player-for-woocommerce
Files:
114 added
4 edited

Legend:

Unmodified
Added
Removed
  • music-player-for-woocommerce/trunk/languages/music-player-for-woocommerce-en_US.po

    r3384254 r3448586  
    22msgstr ""
    33"Project-Id-Version: music-player-for-woocommerce\n"
    4 "POT-Creation-Date: 2025-10-24 23:58+0200\n"
    5 "PO-Revision-Date: 2025-10-24 23:58+0200\n"
     4"POT-Creation-Date: 2026-01-28 10:56+0100\n"
     5"PO-Revision-Date: 2026-01-28 10:56+0100\n"
    66"Last-Translator: CodePeople\n"
    77"Language-Team: CodePeople\n"
     
    264264msgstr ""
    265265
    266 #: addons/dokan/player_options.php:161 views/global_options.php:318
     266#: addons/dokan/player_options.php:161 inc/landing.inc.php:224
     267#: inc/landing.inc.php:225 views/global_options.php:318
    267268#: views/global_options.php:319 views/player_options.php:214
    268269#: views/player_options.php:215
     
    270271msgstr ""
    271272
    272 #: addons/dokan/player_options.php:166 views/global_options.php:323
     273#: addons/dokan/player_options.php:166 inc/landing.inc.php:229
     274#: inc/landing.inc.php:230 views/global_options.php:323
    273275#: views/global_options.php:324 views/player_options.php:219
    274276#: views/player_options.php:220
     
    276278msgstr ""
    277279
    278 #: addons/dokan/player_options.php:171 views/global_options.php:328
     280#: addons/dokan/player_options.php:171 inc/landing.inc.php:234
     281#: inc/landing.inc.php:235 views/global_options.php:328
    279282#: views/global_options.php:329 views/player_options.php:224
    280283#: views/player_options.php:225
     
    359362msgstr ""
    360363
    361 #: addons/dokan/player_options.php:206 views/global_options.php:550
    362 #: views/player_options.php:305
     364#: addons/dokan/player_options.php:206 inc/landing.inc.php:251
     365#: views/global_options.php:550 views/player_options.php:305
    363366msgid "Display the player's title"
    364367msgstr ""
     
    408411"If the \"WC Vendors\" plugin is installed on the website, check the checkbox "
    409412"to allow vendors to configure their music players."
     413msgstr ""
     414
     415#: inc/landing.inc.php:159
     416msgid "close the landing page"
     417msgstr ""
     418
     419#: inc/landing.inc.php:162
     420msgid "Welcome to the Music Player for WooCommerce"
     421msgstr ""
     422
     423#: inc/landing.inc.php:199
     424msgid ""
     425"You are currently using the free version of Music Player for WooCommerce, "
     426"which allows audio players only on downloadable products that include at "
     427"least one audio file."
     428msgstr ""
     429
     430#: inc/landing.inc.php:200 inc/landing.inc.php:201
     431msgid ""
     432"Upgrade to the commercial version to unlock full flexibility: enable audio "
     433"players on any WooCommerce product, whether downloadable or physical, and "
     434"present your audio content exactly where it drives the most value."
     435msgstr ""
     436
     437#: inc/landing.inc.php:205
     438msgid "Downloadable Products"
     439msgstr ""
     440
     441#: inc/landing.inc.php:207
     442msgid "Compatible with the Music Player for WooCommerce Free"
     443msgstr ""
     444
     445#: inc/landing.inc.php:210
     446msgid "Other Products"
     447msgstr ""
     448
     449#: inc/landing.inc.php:212
     450msgid "Compatible with the Music Player for WooCommerce Pro"
     451msgstr ""
     452
     453#: inc/landing.inc.php:215
     454msgid ""
     455"Using this dialog, you can automatically enable the audio player for all "
     456"downloadable products that contain one or more associated audio files."
     457msgstr ""
     458
     459#: inc/landing.inc.php:220
     460msgid "Select a player skin:"
     461msgstr ""
     462
     463#: inc/landing.inc.php:241
     464msgid "Other options:"
     465msgstr ""
     466
     467#: inc/landing.inc.php:243 views/global_options.php:542
     468#: views/player_options.php:297
     469msgid "Visualizer control"
     470msgstr ""
     471
     472#: inc/landing.inc.php:244
     473msgid "Display the visualizer component over the player."
     474msgstr ""
     475
     476#: inc/landing.inc.php:251 views/global_options.php:552
     477#: views/player_options.php:307
     478msgid "Display the player title"
     479msgstr ""
     480
     481#: inc/landing.inc.php:258
     482msgid "Enabling the audio player"
     483msgstr ""
     484
     485#: inc/landing.inc.php:261
     486msgid "Go to your products list"
     487msgstr ""
     488
     489#: inc/landing.inc.php:274
     490msgid "Thanks!!!"
     491msgstr ""
     492
     493#: inc/landing.inc.php:278
     494msgid "Visit your store"
     495msgstr ""
     496
     497#: inc/landing.inc.php:295
     498msgid "Why Upgrade?"
     499msgstr ""
     500
     501#: inc/landing.inc.php:299
     502msgid "(One-time purchase, lifetime access plugin updates)"
     503msgstr ""
     504
     505#: inc/landing.inc.php:305
     506msgid "Display players on non-downloadable products"
     507msgstr ""
     508
     509#: inc/landing.inc.php:305
     510msgid "Allow audio players to be enabled on non-downloadable products."
     511msgstr ""
     512
     513#: inc/landing.inc.php:306
     514msgid "Protect the audio files"
     515msgstr ""
     516
     517#: inc/landing.inc.php:306
     518msgid ""
     519"Generate new demo audio files to ensure that unauthorized access only "
     520"exposes demo versions, not the full sales audio."
     521msgstr ""
     522
     523#: inc/landing.inc.php:307
     524msgid "Audio watermark"
     525msgstr ""
     526
     527#: inc/landing.inc.php:307
     528msgid "Allows you to apply audio watermarks to demo files."
     529msgstr ""
     530
     531#: inc/landing.inc.php:310
     532msgid "Demo specific audio files"
     533msgstr ""
     534
     535#: inc/landing.inc.php:310
     536msgid ""
     537"Assign specific audio files as demo versions, keeping them separate from the "
     538"original audio files."
     539msgstr ""
     540
     541#: inc/landing.inc.php:311
     542msgid "Allow accessing purchased files"
     543msgstr ""
     544
     545#: inc/landing.inc.php:311
     546msgid ""
     547"Allows verified buyers to listen to the original audio files rather than "
     548"demo versions."
     549msgstr ""
     550
     551#: inc/landing.inc.php:316
     552msgid "LIFETIME"
     553msgstr ""
     554
     555#: inc/landing.inc.php:317
     556msgid "UPGRADE!"
    410557msgstr ""
    411558
     
    438585#: pagebuilders/beaverbuilder/wcmp/wcmp.pb.php:12 pagebuilders/builders.php:126
    439586#: pagebuilders/divi/divi.pb.php:9
    440 #: pagebuilders/siteorigin/siteorigin-wcmp/siteorigin-wcmp.php:16 wcmp.php:369
     587#: pagebuilders/siteorigin/siteorigin-wcmp/siteorigin-wcmp.php:16 wcmp.php:387
    441588msgid "Music Player for WooCommerce"
    442589msgstr ""
     
    8911038msgstr ""
    8921039
    893 #: views/global_options.php:542 views/player_options.php:297
    894 msgid "Visualizer control"
    895 msgstr ""
    896 
    8971040#: views/global_options.php:543 views/player_options.php:298
    8981041msgid ""
    8991042"For \"all controls\" mode, display the visualizer component over the player."
    900 msgstr ""
    901 
    902 #: views/global_options.php:552 views/player_options.php:307
    903 msgid "Display the player title"
    9041043msgstr ""
    9051044
     
    11441283msgstr ""
    11451284
    1146 #: wcmp.php:379
     1285#: wcmp.php:397
    11471286msgid "Playback Counter"
    11481287msgstr ""
    11491288
    1150 #: wcmp.php:400
     1289#: wcmp.php:418
    11511290msgid "Help"
    11521291msgstr ""
    11531292
    1154 #: wcmp.php:1170
     1293#: wcmp.php:1269
    11551294msgid "download"
    11561295msgstr ""
    11571296
    1158 #: wcmp.php:1659
     1297#: wcmp.php:1768
    11591298msgid "There are no products that satisfy the block's settings"
    11601299msgstr ""
  • music-player-for-woocommerce/trunk/readme.txt

    r3432879 r3448586  
    55Requires at least: 3.5.0
    66Tested up to: 6.9
    7 Stable tag: 1.7.6
     7Stable tag: 1.7.7
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    266266== Changelog ==
    267267
     268= 1.7.7 =
     269
     270* Enables players quickly with a simple, intuitive setup.
     271
    268272= 1.7.6 =
    269273
     
    339343
    340344* Implements two new attributes in the Playlist shortcode for filtering the products by the product categories and tags.
    341 
    342 = 1.3.11 =
    343 
    344 * Enhances the user experience when editing the global player settings.
    345 
    346 = 1.3.10 =
    347 
    348 * Resolves a compatibility issue with WordPress version previous to 5.5.
    349 
    350 = 1.3.9 =
    351 
    352 * Resolves a notice by ensuring the language files are properly loaded.
    353 
    354 = 1.3.8 =
    355 
    356 * Fixes a conflict with Elementor's cache which is currently in Beta.
    357 
    358 = 1.3.7 =
    359 
    360 * Accepts a new attribute in the playlist shortcode to display/hide the audio durations from the playlist.
    361 
    362 = 1.3.6 =
    363 
    364 * Modifies the playlists, including additional information like the original file duration  (do not confuse it with the duration of the demos files)
    365 
    366 = 1.3.5 =
    367 
    368 * Modifies the player settings to enhance its accessibility and user experience.
    369 
    370 = 1.3.4 =
    371 
    372 * Changes the method by which the plugin identifies the product currently being edited.
    373 
    374 = 1.3.3 =
    375 
    376 * Prevents the LiteSpeed Cache plugin to affect the players.
    377 
    378 = 1.3.2 =
    379 
    380 * Modifies the module to load the language files to ensure compatibility with WP 6.7.
    381 
    382 = 1.3.1 =
    383 
    384 * Improves the plugin settings page.
    385 * Modifies the FFmpeg integration (Professional version).
    386 
    387 = 1.3.0 =
    388 
    389 * Updates the plugin settings page to make it more user-friendly.
    390 * Enhance the troubleshooting area to make it easier to resolve conflicts with third-party plugins and themes.
  • music-player-for-woocommerce/trunk/wcmp.php

    r3432879 r3448586  
    33Plugin Name: Music Player for WooCommerce
    44Plugin URI: https://wcmp.dwbooster.com
    5 Version: 1.7.6
     5Version: 1.7.7
    66Text Domain: music-player-for-woocommerce
    77Author: CodePeople
     
    4242define( 'WCMP_DEFAULT_PlAYER_TITLE', 1 );
    4343define( 'WCMP_REMOTE_TIMEOUT', 120 );
    44 define( 'WCMP_VERSION', '1.7.6' );
     44define( 'WCMP_VERSION', '1.7.7' );
    4545
    4646// Load Tools
     
    185185            $this->_clearDir( $this->_files_directory_path );
    186186            $this->_createDir();
     187
     188            // Check if the ladning page was opened previously, and redirect to the settings page if not.
     189            if ( ! get_option( 'wcmp-landing-page' ) ) {
     190                // Check if there is any player configured previously (this means that the user has used the plugin before).
     191                global $wpdb;
     192                if ( 0 == $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->postmeta} WHERE meta_key LIKE '%_wcmp_%'" ) ) {
     193                    set_transient( 'wcmp-landing-page', true, 24 * 60 * 60 );
     194                    set_transient( 'wcmp-landing-page-redirect', true, 24 * 60 * 60 );
     195                    update_option( 'wcmp-landing-page', 1 );
     196                }
     197            }
    187198        }
    188199
     
    365376            }
    366377
     378            // Redirect to the landing page if activated.
     379            if ( get_transient( 'wcmp-landing-page-redirect' ) ) {
     380                delete_transient( 'wcmp-landing-page-redirect' );
     381                wp_safe_redirect(admin_url('options-general.php?page=music-player-for-woocommerce-settings'));
     382            }
     383
     384            // Clear transients
    367385            $this->clear_expired_transients();
    368386
     
    408426
    409427        public function settings_page() {
     428            $delete_landing_page_transient = false;
     429            if ( isset( $_GET['close-landing-page'] ) ) delete_transient('wcmp-landing-page');
    410430            if (
    411                 isset( $_POST['wcmp_nonce'] ) &&
    412                 wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['wcmp_nonce'] ) ), 'wcmp_updating_plugin_settings' )
     431                isset( $_POST['wcmp_nonce'] )
    413432            ) {
     433                $updated_settings = false;
     434                $wcmp_nonce = sanitize_text_field( wp_unslash( $_POST['wcmp_nonce'] ) );
    414435                $_REQUEST = stripslashes_deep( $_REQUEST );
    415                 // Save the player settings
    416                 $registered_only                = ( isset( $_REQUEST['_wcmp_registered_only'] ) ) ? 1 : 0;
    417                 $fade_out                       = ( isset( $_REQUEST['_wcmp_fade_out'] ) ) ? 1 : 0;
    418                 $purchased_times_text           = sanitize_text_field( isset( $_REQUEST['_wcmp_purchased_times_text'] ) ? wp_unslash( $_REQUEST['_wcmp_purchased_times_text'] ) : '' );
    419                 $troubleshoot_default_extension = ( isset( $_REQUEST['_wcmp_default_extension'] ) ) ? true : false;
    420                 $ios_controls                   = ( isset( $_REQUEST['_wcmp_ios_controls'] ) ) ? true : false;
    421                 $troubleshoot_onload            = ( isset( $_REQUEST['_wcmp_onload'] ) ) ? true : false;
    422                 $include_main_player_hook       = ( isset( $_REQUEST['_wcmp_main_player_hook'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_main_player_hook'] ) ) : '';
    423                 $main_player_hook_title         = ( isset( $_REQUEST['_wcmp_main_player_hook_title'] ) ) ? 1 : 0;
    424                 $disable_302                    = ( isset( $_REQUEST['_wcmp_disable_302'] ) ) ? 1 : 0;
    425                 $include_all_players_hook       = ( isset( $_REQUEST['_wcmp_all_players_hook'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_all_players_hook'] ) ) : '';
    426 
    427                 $enable_player    = ( isset( $_REQUEST['_wcmp_enable_player'] ) ) ? 1 : 0;
    428                 $show_in          = ( isset( $_REQUEST['_wcmp_show_in'] ) && in_array( $_REQUEST['_wcmp_show_in'], array( 'single', 'multiple' ) ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_show_in'] ) ) : 'all';
    429                 $players_in_cart  = ( isset( $_REQUEST['_wcmp_players_in_cart'] ) ) ? true : false;
    430                 $player_style     = (
    431                         isset( $_REQUEST['_wcmp_player_layout'] ) &&
    432                         in_array( $_REQUEST['_wcmp_player_layout'], $this->_player_layouts )
    433                     ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_player_layout'] ) ) : WCMP_DEFAULT_PLAYER_LAYOUT;
    434                 $custom_skin_desc = ( isset( $_REQUEST['_wcmp_skin_generator_description'] ) ? sanitize_textarea_field( wp_unslash( $_REQUEST['_wcmp_skin_generator_description'] ) ) : '' );
    435                 $custom_skin      = ( isset( $_REQUEST['_wcmp_custom_skin'] ) ? sanitize_textarea_field( wp_unslash( $_REQUEST['_wcmp_custom_skin'] ) ) : '' );
    436                  $single_player   = ( isset( $_REQUEST['_wcmp_single_player'] ) ) ? 1 : 0;
    437                  $player_controls = (
    438                         isset( $_REQUEST['_wcmp_player_controls'] ) &&
    439                         in_array( $_REQUEST['_wcmp_player_controls'], $this->_player_controls )
    440                     ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_player_controls'] ) ) : WCMP_DEFAULT_PLAYER_CONTROLS;
    441 
    442                  $on_cover = ( ( 'button' == $player_controls || 'default' == $player_controls ) && isset( $_REQUEST['_wcmp_player_on_cover'] ) ) ? 1 : 0;
    443                  $visualizer = isset( $_REQUEST['_wcmp_visualizer'] ) ? 1 : 0;
    444 
    445                  $player_title        = ( isset( $_REQUEST['_wcmp_player_title'] ) ) ? 1 : 0;
    446                  $merge_grouped       = ( isset( $_REQUEST['_wcmp_merge_in_grouped'] ) ) ? 1 : 0;
    447                  $play_all            = ( isset( $_REQUEST['_wcmp_play_all'] ) ) ? 1 : 0;
    448                  $loop                = ( isset( $_REQUEST['_wcmp_loop'] ) ) ? 1 : 0;
    449                  $play_simultaneously = ( isset( $_REQUEST['_wcmp_play_simultaneously'] ) ) ? 1 : 0;
    450                  $volume              = ( isset( $_REQUEST['_wcmp_player_volume'] ) && is_numeric( $_REQUEST['_wcmp_player_volume'] ) ) ? floatval( $_REQUEST['_wcmp_player_volume'] ) : 1;
    451                  $preload             = (
    452                         isset( $_REQUEST['_wcmp_preload'] ) &&
    453                         in_array( $_REQUEST['_wcmp_preload'], array( 'none', 'metadata', 'auto' ) )
    454                     ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_preload'] ) ) : 'none';
    455 
    456                  $apply_to_all_players = ( isset( $_REQUEST['_wcmp_apply_to_all_players'] ) ) ? 1 : 0;
    457 
    458                  $global_settings = array(
    459                      '_wcmp_registered_only'            => $registered_only,
    460                      '_wcmp_fade_out'                   => $fade_out,
    461                      '_wcmp_purchased_times_text'       => $purchased_times_text,
    462                      '_wcmp_enable_player'              => $enable_player,
    463                      '_wcmp_show_in'                    => $show_in,
    464                      '_wcmp_players_in_cart'            => $players_in_cart,
    465                      '_wcmp_player_layout'              => $player_style,
    466                      '_wcmp_skin_generator_description' => $custom_skin_desc,
    467                      '_wcmp_custom_skin'                => $custom_skin,
    468                      '_wcmp_player_volume'              => $volume,
    469                      '_wcmp_single_player'              => $single_player,
    470                      '_wcmp_player_controls'            => $player_controls,
    471                      '_wcmp_player_title'               => $player_title,
    472                      '_wcmp_merge_in_grouped'           => $merge_grouped,
    473                      '_wcmp_play_all'                   => $play_all,
    474                      '_wcmp_loop'                       => $loop,
    475                      '_wcmp_play_simultaneously'        => $play_simultaneously,
    476                      '_wcmp_preload'                    => $preload,
    477                      '_wcmp_on_cover'                   => $on_cover,
    478                      '_wcmp_visualizer'                 => $visualizer,
    479                      '_wcmp_default_extension'          => $troubleshoot_default_extension,
    480                      '_wcmp_ios_controls'               => $ios_controls,
    481                      '_wcmp_onload'                     => $troubleshoot_onload,
    482                      '_wcmp_main_player_hook'           => $include_main_player_hook,
    483                      '_wcmp_main_player_hook_title'     => $main_player_hook_title,
    484                      '_wcmp_disable_302'                => $disable_302,
    485                      '_wcmp_all_players_hook'           => $include_all_players_hook,
    486                      '_wcmp_playback_counter_column'      => ( isset( $_REQUEST['_wcmp_playback_counter_column'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_playback_counter_column'] ) ) : 0,
    487                      '_wcmp_analytics_integration'      => ( isset( $_REQUEST['_wcmp_analytics_integration'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_analytics_integration'] ) ) : 'ua',
    488                      '_wcmp_analytics_property'         => ( isset( $_REQUEST['_wcmp_analytics_property'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_analytics_property'] ) ) : '',
    489                      '_wcmp_analytics_api_secret'       => ( isset( $_REQUEST['_wcmp_analytics_api_secret'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_analytics_api_secret'] ) ) : '',
    490                      '_wcmp_apply_to_all_players'       => $apply_to_all_players,
    491                  );
    492 
    493                  if ( $apply_to_all_players ) {
    494                      $this->_clearDir( $this->_files_directory_path );
    495 
    496                      $products_ids = array(
    497                          'post_type'     => $this->_get_post_types(),
    498                          'numberposts'   => -1,
    499                          'post_status'   => array( 'publish', 'pending', 'draft', 'future' ),
    500                          'fields'        => 'ids',
    501                          'cache_results' => false,
    502                      );
    503 
    504                      $products = get_posts( $products_ids );
    505                      foreach ( $products as $product_id ) {
    506                          update_post_meta( $product_id, '_wcmp_enable_player', $enable_player );
    507                          update_post_meta( $product_id, '_wcmp_show_in', $show_in );
    508                          update_post_meta( $product_id, '_wcmp_player_layout', $player_style );
    509                          update_post_meta( $product_id, '_wcmp_single_player', $single_player );
    510                          update_post_meta( $product_id, '_wcmp_player_controls', $player_controls );
    511                          update_post_meta( $product_id, '_wcmp_player_volume', $volume );
    512                          update_post_meta( $product_id, '_wcmp_player_title', $player_title );
    513                          update_post_meta( $product_id, '_wcmp_merge_in_grouped', $merge_grouped );
    514                          update_post_meta( $product_id, '_wcmp_play_all', $play_all );
    515                          update_post_meta( $product_id, '_wcmp_loop', $loop );
    516                          update_post_meta( $product_id, '_wcmp_preload', $preload );
    517                          update_post_meta( $product_id, '_wcmp_on_cover', $on_cover );
    518                          update_post_meta( $product_id, '_wcmp_visualizer', $visualizer );
    519                      }
    520                  }
    521 
    522                  update_option( 'wcmp_global_settings', $global_settings );
    523                  $this->_global_attrs = $global_settings;
    524                  do_action( 'wcmp_save_setting' );
    525 
    526                  /** Purge Cache **/
    527                  include_once __DIR__ . '/inc/cache.inc.php';
     436
     437                if ( wp_verify_nonce( $wcmp_nonce, 'wcmp_updating_plugin_settings_landing_page' ) ) { // phpcs:ignore()
     438                    $delete_landing_page_transient = true;
     439                    $enable_player      = 1;
     440                    $main_player_hook_title = 1;
     441                    $fade_out           = 1;
     442                    $visualizer         = isset($_REQUEST['_wcmp_visualizer']) ? 1 : 0;
     443                    $player_title       = (isset($_REQUEST['_wcmp_player_title'])) ? 1 : 0;
     444                    $play_all           = 1;
     445                    $show_in            = 'all';
     446                    $player_style       = (
     447                        isset($_REQUEST['_wcmp_player_layout']) &&
     448                        in_array($_REQUEST['_wcmp_player_layout'], $this->_player_layouts)
     449                    ) ? sanitize_text_field(wp_unslash($_REQUEST['_wcmp_player_layout'])) : WCMP_DEFAULT_PLAYER_LAYOUT;
     450                    $player_controls    = (
     451                        isset($_REQUEST['_wcmp_player_controls']) &&
     452                        in_array($_REQUEST['_wcmp_player_controls'], $this->_player_controls)
     453                    ) ? sanitize_text_field(wp_unslash($_REQUEST['_wcmp_player_controls'])) : WCMP_DEFAULT_PLAYER_CONTROLS;
     454                    $volume                 = 1;
     455                    $preload                = 'none';
     456                    $apply_to_all_players   = 1;
     457
     458                    $global_settings = get_option('wcmp_global_settings', []);
     459                    $global_settings = array_merge(
     460                        $global_settings,
     461                        array(
     462                            '_wcmp_fade_out'                   => $fade_out,
     463                            '_wcmp_enable_player'              => $enable_player,
     464                            '_wcmp_show_in'                    => $show_in,
     465                            '_wcmp_player_layout'              => $player_style,
     466                            '_wcmp_player_volume'              => $volume,
     467                            '_wcmp_player_controls'            => $player_controls,
     468                            '_wcmp_player_title'               => $player_title,
     469                            '_wcmp_play_all'                   => $play_all,
     470                            '_wcmp_preload'                    => $preload,
     471                            '_wcmp_visualizer'                 => $visualizer,
     472                            '_wcmp_main_player_hook_title'     => $main_player_hook_title,
     473                            '_wcmp_apply_to_all_players'       => $apply_to_all_players,
     474                        )
     475                    );
     476
     477                    if ($apply_to_all_players) {
     478                        $this->_clearDir($this->_files_directory_path);
     479
     480                        $products_ids = array(
     481                            'post_type'     => $this->_get_post_types(),
     482                            'numberposts'   => -1,
     483                            'post_status'   => array('publish', 'pending', 'draft', 'future'),
     484                            'fields'        => 'ids',
     485                            'cache_results' => false,
     486                        );
     487
     488                        $products = get_posts($products_ids);
     489                        foreach ($products as $product_id) {
     490                            update_post_meta($product_id, '_wcmp_enable_player', $enable_player);
     491                            update_post_meta($product_id, '_wcmp_show_in', $show_in);
     492                            update_post_meta($product_id, '_wcmp_player_layout', $player_style);
     493                            update_post_meta($product_id, '_wcmp_player_controls', $player_controls);
     494                            update_post_meta($product_id, '_wcmp_player_volume', $volume);
     495                            update_post_meta($product_id, '_wcmp_player_title', $player_title);
     496                            update_post_meta($product_id, '_wcmp_play_all', $play_all);
     497                            update_post_meta($product_id, '_wcmp_preload', $preload);
     498                            update_post_meta($product_id, '_wcmp_visualizer', $visualizer);
     499                        }
     500                    }
     501
     502                    $updated_settings = true;
     503                } elseif ( wp_verify_nonce( $wcmp_nonce, 'wcmp_updating_plugin_settings' ) ) { // phpcs:ignore()
     504                    // Save the player settings
     505                    $registered_only                = ( isset( $_REQUEST['_wcmp_registered_only'] ) ) ? 1 : 0;
     506                    $fade_out                       = ( isset( $_REQUEST['_wcmp_fade_out'] ) ) ? 1 : 0;
     507                    $purchased_times_text           = sanitize_text_field( isset( $_REQUEST['_wcmp_purchased_times_text'] ) ? wp_unslash( $_REQUEST['_wcmp_purchased_times_text'] ) : '' );
     508                    $troubleshoot_default_extension = ( isset( $_REQUEST['_wcmp_default_extension'] ) ) ? true : false;
     509                    $ios_controls                   = ( isset( $_REQUEST['_wcmp_ios_controls'] ) ) ? true : false;
     510                    $troubleshoot_onload            = ( isset( $_REQUEST['_wcmp_onload'] ) ) ? true : false;
     511                    $include_main_player_hook       = ( isset( $_REQUEST['_wcmp_main_player_hook'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_main_player_hook'] ) ) : '';
     512                    $main_player_hook_title         = ( isset( $_REQUEST['_wcmp_main_player_hook_title'] ) ) ? 1 : 0;
     513                    $disable_302                    = ( isset( $_REQUEST['_wcmp_disable_302'] ) ) ? 1 : 0;
     514                    $include_all_players_hook       = ( isset( $_REQUEST['_wcmp_all_players_hook'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_all_players_hook'] ) ) : '';
     515
     516                    $enable_player    = ( isset( $_REQUEST['_wcmp_enable_player'] ) ) ? 1 : 0;
     517                    $show_in          = ( isset( $_REQUEST['_wcmp_show_in'] ) && in_array( $_REQUEST['_wcmp_show_in'], array( 'single', 'multiple' ) ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_show_in'] ) ) : 'all';
     518                    $players_in_cart  = ( isset( $_REQUEST['_wcmp_players_in_cart'] ) ) ? true : false;
     519                    $player_style     = (
     520                            isset( $_REQUEST['_wcmp_player_layout'] ) &&
     521                            in_array( $_REQUEST['_wcmp_player_layout'], $this->_player_layouts )
     522                        ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_player_layout'] ) ) : WCMP_DEFAULT_PLAYER_LAYOUT;
     523                    $custom_skin_desc = ( isset( $_REQUEST['_wcmp_skin_generator_description'] ) ? sanitize_textarea_field( wp_unslash( $_REQUEST['_wcmp_skin_generator_description'] ) ) : '' );
     524                    $custom_skin      = ( isset( $_REQUEST['_wcmp_custom_skin'] ) ? sanitize_textarea_field( wp_unslash( $_REQUEST['_wcmp_custom_skin'] ) ) : '' );
     525                    $single_player   = ( isset( $_REQUEST['_wcmp_single_player'] ) ) ? 1 : 0;
     526                    $player_controls = (
     527                            isset( $_REQUEST['_wcmp_player_controls'] ) &&
     528                            in_array( $_REQUEST['_wcmp_player_controls'], $this->_player_controls )
     529                        ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_player_controls'] ) ) : WCMP_DEFAULT_PLAYER_CONTROLS;
     530
     531                    $on_cover = ( ( 'button' == $player_controls || 'default' == $player_controls ) && isset( $_REQUEST['_wcmp_player_on_cover'] ) ) ? 1 : 0;
     532                    $visualizer = isset( $_REQUEST['_wcmp_visualizer'] ) ? 1 : 0;
     533
     534                    $player_title        = ( isset( $_REQUEST['_wcmp_player_title'] ) ) ? 1 : 0;
     535                    $merge_grouped       = ( isset( $_REQUEST['_wcmp_merge_in_grouped'] ) ) ? 1 : 0;
     536                    $play_all            = ( isset( $_REQUEST['_wcmp_play_all'] ) ) ? 1 : 0;
     537                    $loop                = ( isset( $_REQUEST['_wcmp_loop'] ) ) ? 1 : 0;
     538                    $play_simultaneously = ( isset( $_REQUEST['_wcmp_play_simultaneously'] ) ) ? 1 : 0;
     539                    $volume              = ( isset( $_REQUEST['_wcmp_player_volume'] ) && is_numeric( $_REQUEST['_wcmp_player_volume'] ) ) ? floatval( $_REQUEST['_wcmp_player_volume'] ) : 1;
     540                    $preload             = (
     541                            isset( $_REQUEST['_wcmp_preload'] ) &&
     542                            in_array( $_REQUEST['_wcmp_preload'], array( 'none', 'metadata', 'auto' ) )
     543                        ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_preload'] ) ) : 'none';
     544
     545                    $apply_to_all_players = ( isset( $_REQUEST['_wcmp_apply_to_all_players'] ) ) ? 1 : 0;
     546
     547                    $global_settings = array(
     548                        '_wcmp_registered_only'            => $registered_only,
     549                        '_wcmp_fade_out'                   => $fade_out,
     550                        '_wcmp_purchased_times_text'       => $purchased_times_text,
     551                        '_wcmp_enable_player'              => $enable_player,
     552                        '_wcmp_show_in'                    => $show_in,
     553                        '_wcmp_players_in_cart'            => $players_in_cart,
     554                        '_wcmp_player_layout'              => $player_style,
     555                        '_wcmp_skin_generator_description'  => $custom_skin_desc,
     556                        '_wcmp_custom_skin'             => $custom_skin,
     557                        '_wcmp_player_volume'              => $volume,
     558                        '_wcmp_single_player'              => $single_player,
     559                        '_wcmp_player_controls'            => $player_controls,
     560                        '_wcmp_player_title'               => $player_title,
     561                        '_wcmp_merge_in_grouped'           => $merge_grouped,
     562                        '_wcmp_play_all'                   => $play_all,
     563                        '_wcmp_loop'                       => $loop,
     564                        '_wcmp_play_simultaneously'        => $play_simultaneously,
     565                        '_wcmp_preload'                    => $preload,
     566                        '_wcmp_on_cover'                   => $on_cover,
     567                        '_wcmp_visualizer'                 => $visualizer,
     568                        '_wcmp_default_extension'          => $troubleshoot_default_extension,
     569                        '_wcmp_ios_controls'               => $ios_controls,
     570                        '_wcmp_onload'                     => $troubleshoot_onload,
     571                        '_wcmp_main_player_hook'           => $include_main_player_hook,
     572                        '_wcmp_main_player_hook_title'     => $main_player_hook_title,
     573                        '_wcmp_disable_302'                 => $disable_302,
     574                        '_wcmp_all_players_hook'           => $include_all_players_hook,
     575                        '_wcmp_playback_counter_column'      => ( isset( $_REQUEST['_wcmp_playback_counter_column'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_playback_counter_column'] ) ) : 0,
     576                        '_wcmp_analytics_integration'      => ( isset( $_REQUEST['_wcmp_analytics_integration'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_analytics_integration'] ) ) : 'ua',
     577                        '_wcmp_analytics_property'         => ( isset( $_REQUEST['_wcmp_analytics_property'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_analytics_property'] ) ) : '',
     578                        '_wcmp_analytics_api_secret'       => ( isset( $_REQUEST['_wcmp_analytics_api_secret'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wcmp_analytics_api_secret'] ) ) : '',
     579                        '_wcmp_apply_to_all_players'       => $apply_to_all_players,
     580                    );
     581
     582                    if ( $apply_to_all_players ) {
     583                        $this->_clearDir( $this->_files_directory_path );
     584
     585                        $products_ids = array(
     586                            'post_type'     => $this->_get_post_types(),
     587                            'numberposts'   => -1,
     588                            'post_status'   => array( 'publish', 'pending', 'draft', 'future' ),
     589                            'fields'        => 'ids',
     590                            'cache_results' => false,
     591                        );
     592
     593                        $products = get_posts( $products_ids );
     594                        foreach ( $products as $product_id ) {
     595                            update_post_meta( $product_id, '_wcmp_enable_player', $enable_player );
     596                            update_post_meta( $product_id, '_wcmp_show_in', $show_in );
     597                            update_post_meta( $product_id, '_wcmp_player_layout', $player_style );
     598                            update_post_meta( $product_id, '_wcmp_single_player', $single_player );
     599                            update_post_meta( $product_id, '_wcmp_player_controls', $player_controls );
     600                            update_post_meta( $product_id, '_wcmp_player_volume', $volume );
     601                            update_post_meta( $product_id, '_wcmp_player_title', $player_title );
     602                            update_post_meta( $product_id, '_wcmp_merge_in_grouped', $merge_grouped );
     603                            update_post_meta( $product_id, '_wcmp_play_all', $play_all );
     604                            update_post_meta( $product_id, '_wcmp_loop', $loop );
     605                            update_post_meta( $product_id, '_wcmp_preload', $preload );
     606                            update_post_meta( $product_id, '_wcmp_on_cover', $on_cover );
     607                            update_post_meta( $product_id, '_wcmp_visualizer', $visualizer );
     608                        }
     609                    }
     610                    $updated_settings = true;
     611                }
     612
     613                if ( $updated_settings ) {
     614                    update_option( 'wcmp_global_settings', $global_settings );
     615                    $this->_global_attrs = $global_settings;
     616                    do_action( 'wcmp_save_setting' );
     617                    /** Purge Cache **/
     618                    include_once __DIR__ . '/inc/cache.inc.php';
     619                }
    528620            } // Save settings
    529621
    530622            print '<div class="wrap">'; // Open Wrap
    531             include_once dirname( __FILE__ ) . '/views/global_options.php';
     623            if ( get_transient( 'wcmp-landing-page' ) ) {
     624                include_once dirname( __FILE__ ) . '/inc/landing.inc.php';
     625                if( $delete_landing_page_transient ) { delete_transient( 'wcmp-landing-page' ); }
     626            } else {
     627                include_once dirname( __FILE__ ) . '/views/global_options.php';
     628            }
    532629            print '</div>'; // Close Wrap
    533630        } // End settings_page
Note: See TracChangeset for help on using the changeset viewer.