Plugin Directory

Changeset 2451356


Ignore:
Timestamp:
01/06/2021 03:18:20 PM (5 years ago)
Author:
audienceplayer
Message:
  • released version 1.10.6
Location:
audienceplayer
Files:
28 edited
1 copied

Legend:

Unmodified
Added
Removed
  • audienceplayer/tags/1.10.6/audienceplayer.php

    r2450559 r2451356  
    99Description: AudiencePlayer integration
    1010Author: AudiencePlayer
    11 Version: 1.10.5
     11Version: 1.10.6
    1212Author URI: https://www.audienceplayer.com
    1313Text Domain: audienceplayer
  • audienceplayer/tags/1.10.6/readme.txt

    r2450559 r2451356  
    11=== AudiencePlayer ===
    22Contributors: audienceplayer
    3 Stable tag: 1.10.5
     3Stable tag: 1.10.6
    44Tested up to: 5.5
    55Requires at least: 5.5
  • audienceplayer/tags/1.10.6/src/AudiencePlayer/AudiencePlayerWordpressPlugin/AudiencePlayerWordpressPlugin.php

    r2449847 r2451356  
    157157    }
    158158
     159
     160    public static function fetchPluginCacheString()
     161    {
     162        return self::fetchPluginVersion() . '-' . self::fetchPluginDomain();
     163    }
     164
    159165    /**
    160166     * @TODO: force return type ": AudiencePlayerApiClient" as soon as PHP7.3 is minimum supported version
  • audienceplayer/tags/1.10.6/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Config/Constants.php

    r2450559 r2451356  
    3939
    4040        // Main plugin version number here and in main plugin file header are automatically overwritten in gulp-build script
    41         PLUGIN_VERSION = '1.10.5',
     41        PLUGIN_VERSION = '1.10.6',
    4242
    4343        // DB migration version number is maintained here
  • audienceplayer/tags/1.10.6/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/BootstrapTrait.php

    r2450559 r2451356  
    206206    protected function deferAdminDownloadActions($self)
    207207    {
     208        // dowload a file, accessible for admin users or AudiencePlayer backend (credential check executed in the method)
    208209        \add_action('wp_ajax_audienceplayer_admin_download_file', function () use ($self) {
     210            $self->audienceplayerDownloadFile();
     211        });
     212        \add_action('wp_ajax_nopriv_audienceplayer_admin_download_file', function () use ($self) {
    209213            $self->audienceplayerDownloadFile();
    210214        });
     
    477481            // After this event, given Wordpress user is automatically logged in and is synchronised with AudiencePlayer.
    478482            // HIGH PRIO, fires before system events
     483            //
     484            // Warning: the 'user_register' is also called when a Wordpress user is created via \wp_create_user and \wp_insert_user
     485            // which in turn is used by UserSyncTrait->createWordpressUser (which has protection against undesired auto-login)
    479486            \add_action('user_register', function ($wordpressUserId) use ($self) {
    480487
     
    494501                    }
    495502                }
    496 
    497                 // auto-login new user @TODO: consider activating this pending customer use cases
    498                 // \wp_set_current_user($wordpressUserId);
    499                 // \wp_set_auth_cookie($wordpressUserId);
    500503
    501504                return $self->syncAudiencePlayerUser($wordpressUserId, $userArgs, $self->isNewUserRegistrationRequest, false, Constants::USER_METADATA_SYNC_DIRECTION_WP2A);
     
    548551            }, 10, 1);
    549552
    550             // "email_change_email": Runs immediately after user link in e-mail to confirm change of e-mail address.
     553            // "email_change_email": Runs immediately after user link in e-mail is clicked to confirm change of e-mail address.
    551554            // After this event, the new e-mail address is again validated at AudiencePlayer before it is changed in Wordpress.
    552555            // HIGH PRIO, fires before system events
     
    567570                    // if sync was not successful, restore the original user data and revert the pending change + hard exit
    568571                    if (false === $result) {
    569                         \wp_insert_user($currentUserData);
     572                        // @TODO: consider creating the missing Wordpress user
     573                        //$this->createWordpressUser($currentUserData);
    570574                        \delete_user_meta($wordpressUserId, '_new_email');
    571                         \wp_die('E-mail address could not be changed, likely an account with this e-mail address already exists!');
     575                        \wp_die($this->fetchTranslations('dialogue_email_address_not_changed_conflict'));
    572576                    }
    573577                }
     
    734738            'button_purchase_subscription' => __('Purchase', 'audienceplayer'),
    735739            'button_validate' => __('Validate', 'audienceplayer'),
     740            'dialogue_browser_not_supported' => __('Unfortunately this browser is not supported, please upgrade and/or switch to a different browser (e.g. Chrome or Safari)', 'audienceplayer'),
    736741            'dialogue_change_payment_method' => __('You can modify or add your payment method', 'audienceplayer'),
    737742            'dialogue_claim_device_explanation' => __('Enter the code displayed on your TV-screen and pair your device', 'audienceplayer'),
    738743            'dialogue_content_not_available_in_region' => __('The content is not available in your current country or region', 'audienceplayer'),
     744            'dialogue_email_address_not_changed_conflict' => __('E-mail address could not be changed, likely an account with this e-mail address already exists! If this e-mail address is yours, try to reset your password.', 'audienceplayer'),
    739745            'dialogue_error_occurred' => __('An error has occurred', 'audienceplayer'),
    740746            'dialogue_paired_device_confirm_removal' => __('Please confirm removing this paired device', 'audienceplayer'),
  • audienceplayer/tags/1.10.6/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/ShortCodeTrait.php

    r2448193 r2451356  
    6464                $self->enqueueTemplateFileScript('slick.min.js');
    6565
    66                 \wp_register_script('amp.min.js', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.js', [], self::fetchPluginVersion());
    67                 \wp_enqueue_script('amp.min.js', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.js', [], self::fetchPluginVersion());
     66                \wp_register_script('amp.min.js', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.js', [], self::fetchPluginCacheString());
     67                \wp_enqueue_script('amp.min.js', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.js', [], self::fetchPluginCacheString());
    6868
    6969                // CSS
     
    7373                $self->enqueueTemplateFileScript('slick-theme.css');
    7474
    75                 \wp_register_script('amp.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.css', [], self::fetchPluginVersion());
    76                 \wp_enqueue_style('amp.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.css', [], self::fetchPluginVersion());
    77                 \wp_register_script('amp-flush.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp-flush.min.css', [], self::fetchPluginVersion());
    78                 \wp_enqueue_style('amp-flush.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp-flush.min.css', [], self::fetchPluginVersion());
     75                \wp_register_script('amp.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.css', [], self::fetchPluginCacheString());
     76                \wp_enqueue_style('amp.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.css', [], self::fetchPluginCacheString());
     77                \wp_register_script('amp-flush.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp-flush.min.css', [], self::fetchPluginCacheString());
     78                \wp_enqueue_style('amp-flush.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp-flush.min.css', [], self::fetchPluginCacheString());
    7979            }
    8080        });
  • audienceplayer/tags/1.10.6/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/UserSyncTrait.php

    r2450559 r2451356  
    232232    }
    233233
     234    /**
     235     * @param $arr
     236     */
    234237    protected function parseMetas($arr)
    235238    {
     
    288291    }
    289292
     293    /**
     294     * @param int $audiencePlayerUserId
     295     * @param string $wordpressUserEmail
     296     * @return bool
     297     */
    290298    protected function deleteAudiencePlayerUser(int $audiencePlayerUserId, string $wordpressUserEmail)
    291299    {
     
    319327
    320328        return $ret;
     329    }
     330
     331    /**
     332     * @param $userData
     333     * @param bool $isForceSilentCreation
     334     * @return int|\WP_Error
     335     */
     336    protected function createWordpressUser($userData, $isForceSilentCreation = true)
     337    {
     338        if ($isForceSilentCreation) {
     339            // prevent that this is treated as newly created user registration (by wp_insert_user => 'user_register')
     340            $this->isNewUserRegistrationRequest = false;
     341        }
     342
     343        // create the new Wordpress user
     344        $wordpressUserId = \wp_insert_user($userData);
     345
     346        // If successful, prevent auto-login of this user which is often set in the Wordpress theme on the 'user_register' event
     347        // to allow newly registered users to become auto-logged in
     348        if ($isForceSilentCreation && is_int($wordpressUserId) && \get_current_user_id() === $wordpressUserId) {
     349            \wp_logout();
     350        }
     351
     352        return $wordpressUserId;
    321353    }
    322354
     
    560592            false === $isDeleteUser &&
    561593            ($userArgs = $this->helper->parseWordpressUserArgs($userArgs, ['user_email' => $email])) &&
    562             ($userId = \wp_insert_user($userArgs))
     594            ($userId = $this->createWordpressUser($userArgs))
    563595        ) {
    564596
  • audienceplayer/tags/1.10.6/static/css/audienceplayer_admin.css

    r2448193 r2451356  
    4949    list-style-type: square;
    5050    list-style-position: outside;
     51    padding-top: 6px;
    5152    padding-left: 16px;
    5253}
  • audienceplayer/tags/1.10.6/static/html/admin_help_user_sync.html

    r2448193 r2451356  
    5151        </ul>
    5252    </li>
     53    <li>
     54        Developers note: There are many Wordpress hooks addressed by this plugin to achieve redundant User
     55        synchronisation. If you use code and/or other plugins that affect user management and/or authentication, the
     56        hooks listed below deserve special attention should you use them as well. For a thorough overview, see the
     57        plugin file "BootstrapTrait.php" for the exact implementation.<br/>
     58        <ul class="audienceplayer-admin-ul-level1">
     59            <li><em>user_register</em>: synchronise user, add user</li>
     60            <li><em>email_change_email</em>: synchronise user</li>
     61            <li><em>user_profile_update_errors</em>: synchronise user, create user</li>
     62            <li><em>registration_errors</em>: synchronise user, create user</li>
     63            <li><em>delete_user</em>: synchronise user, delete user</li>
     64            <li><em>deleted_user</em>: synchronise user user</li>
     65        </ul>
     66    </li>
    5367</ol>
  • audienceplayer/tags/1.10.6/templates/audienceplayer-core-html.php

    r2446851 r2451356  
    99<!-- html elements for the AudiencePlayer modal EmbedPlayer -->
    1010<div id="audienceplayer-modal-video-player" class="audienceplayer-modal audienceplayer-modal-video-player">
    11     <button id="audienceplayer-modal-video-player-button-close" class="close"><i class="audienceplayer-fa close"></i>
    12     </button>
    1311    <div class="audienceplayer-modal-video-player-wrapper"></div>
     12    <button id="audienceplayer-modal-video-player-button-close" class="close"><i class="audienceplayer-fa close"></i></button>
    1413</div>
    1514
  • audienceplayer/tags/1.10.6/templates/audienceplayer-core-javascript.php

    r2450303 r2451356  
    11<?php
    2 $scriptEmbedQsa = '?ver=' . $AudiencePlayerWordpressPlugin::fetchPluginVersion() . '&domain=' . $AudiencePlayerWordpressPlugin::fetchPluginDomain();
     2$scriptEmbedQsa = '?ver=' . $AudiencePlayerWordpressPlugin::fetchPluginCacheString();
    33$audiencePlayerBearerToken = $AudiencePlayerWordpressPlugin->fetchUserBearerToken();
    44$isWordpressUserLoggedIn = \is_user_logged_in();
     
    4040<script>
    4141    <?php
     42
     43    /*
     44     * Create global error message accessible to unsupported browsers
     45     */
     46    echo 'window.AudiencePlayerBrowserNotSupportedError = \'' .
     47        $AudiencePlayerWordpressPlugin->helper
     48            ->escapeQuotes($AudiencePlayerWordpressPlugin->fetchTranslations('dialogue_browser_not_supported')) .
     49        '\';';
     50
    4251    /*
    4352     * Handle redirect/afterPurchase action after user returns from external payment provider url
  • audienceplayer/tags/1.10.6/templates/audienceplayer-core-translations.php

    r2448193 r2451356  
    1818    'button_purchase_subscription' => 'Purchase',
    1919    'button_validate' => 'Validate',
     20    'dialogue_browser_not_supported' => 'Unfortunately this browser is not supported, please upgrade and/or switch to a different browser (e.g. Chrome or Safari)',
    2021    'dialogue_change_payment_method' => 'You can modify or add your payment method',
    2122    'dialogue_claim_device_explanation' => 'Enter the code displayed on your TV-screen and pair your device',
    2223    'dialogue_content_not_available_in_region' => 'The content is not available in your current country or region',
     24    'dialogue_email_address_not_changed_conflict' => 'E-mail address could not be changed, likely an account with this e-mail address already exists! If this e-mail address is yours, try to reset your password.',
    2325    'dialogue_error_occurred' => 'An error has occurred',
    2426    'dialogue_paired_device_confirm_removal' => 'Please confirm removing this paired device',
  • audienceplayer/tags/1.10.6/templates/css/audienceplayer-shortcodes.css

    r2446851 r2451356  
    375375
    376376/* modal video player overrides */
    377 #audienceplayer-modal-video-player button.close {
    378     color: #ffffff;
    379     top: 16px !important;
    380     right: 16px !important;
    381 }
    382 
    383 /* main selector for the EmbedPlayer */
    384 .audienceplayer-modal-video-player-wrapper {
    385     position: absolute;
    386     margin: calc(1vh - 20px) 1vw calc(1vh + 20px) 1vw;
    387     height: 98vh;
    388     width: 98vw;
     377@media (max-aspect-ratio: 16/9) {
     378
     379    #audienceplayer-modal-video-player button.close {
     380        color: #ffffff;
     381        top: calc(50vh - calc(40vw / 1.7)) !important;
     382        right: calc(10vw) !important;
     383    }
     384
     385    .audienceplayer-modal-video-player-wrapper {
     386        z-index: 10001;
     387        position: absolute;
     388        margin: calc(50vh - calc(40vw / 1.7)) 10vw;
     389        height: calc(80vw / 1.7);
     390        width: 80vw;
     391    }
     392}
     393
     394@media (min-aspect-ratio: 16/9) {
     395
     396    #audienceplayer-modal-video-player button.close {
     397        color: #ffffff;
     398        top: 10vh !important;
     399        right: calc(50vw - calc(40vh * 1.7)) !important;
     400    }
     401
     402    .audienceplayer-modal-video-player-wrapper {
     403        z-index: 10001;
     404        position: absolute;
     405        margin: 10vh calc(50vw - calc(40vh * 1.7));
     406        height: 80vh;
     407        width: calc(80vh * 1.7);
     408    }
    389409}
    390410
  • audienceplayer/tags/1.10.6/templates/js/audienceplayer-core.js

    r2450303 r2451356  
    116116            });
    117117
    118             // Set up keyup events to close modals
     118            // @TODO: Consider allowing users to close the video modal by clicking on the transparent overlay
     119            /*
     120            $('#audienceplayer-modal-video-player').click(function () {
     121                self.closeModal(true);
     122                return false;
     123            });
     124            */
     125
     126            // Set up keyup events to close modals: Currently only map the ESC key (27)
    119127            $(document).unbind('keyup.key27');
    120128            $(document).bind('keyup.key27', function (event) {
     
    241249
    242250            }
    243 
    244             if (this.CONFIG.isLoggedIn && !this.CONFIG.isSynchronised) {
    245 
    246             }
    247251        },
    248252
     
    255259
    256260            let self = this;
     261
     262            // Check browser support before opening modal
     263            if (!self.isSupportedBrowser()) {
     264                self.openModalBrowserNotSupported(event);
     265                return;
     266            }
    257267
    258268            // Hide the main EmbedPlayer wrapper
     
    276286                        autoplay: true
    277287                    })
    278                     .then(config => {
     288                    .then(function (config) {
    279289                        // Show the main EmbedPlayer wrapper
    280290                        $('.audienceplayer-modal-video-player-wrapper').fadeIn();
    281291                    })
    282                     .catch(error => {
     292                    .catch(function (error) {
    283293                        $('#audienceplayer-modal-video-player').hide();
    284294                        //alert(error.message + ' [' + error.code + ']');
     
    303313
    304314            let self = this;
     315
     316            // Check browser support before opening modal
     317            if (!self.isSupportedBrowser()) {
     318                self.openModalBrowserNotSupported(event);
     319                return;
     320            }
    305321
    306322            let callbackNonAuthenticated = arguments[6];
     
    548564            self.setModalProperty($currentModal, 'message', message);
    549565            self.setActiveModal($currentModal);
     566        },
     567
     568        openModalBrowserNotSupported: function (event) {
     569            let message = window.AudiencePlayerBrowserNotSupportedError;
     570
     571            try {
     572                if (self.CONFIG.translations.dialogue_browser_not_supported) {
     573                    message = self.CONFIG.translations.dialogue_browser_not_supported;
     574                } else if (window.AudiencePlayerLib.translations.dialogue_browser_not_supported) {
     575                    message = window.AudiencePlayerLib.translations.dialogue_browser_not_supported;
     576                } else if (window.AudiencePlayerBrowserNotSupportedError) {
     577                    message = window.AudiencePlayerBrowserNotSupportedError;
     578                }
     579            } catch (e) {
     580                //
     581            }
     582
     583            this.openModalAlert(event, message, 'OK');
    550584        },
    551585
     
    756790                self.redirectNonAuthenticatedUser(callbackNonAuthenticated);
    757791                return;
    758             }
    759             elseif()
    760 
    761             if ($elementToggle.isWorking) {
     792            } else if ($elementToggle.isWorking) {
    762793                return;
    763794            } else {
     
    13041335        },
    13051336
     1337        isSupportedBrowser: function () {
     1338
     1339            // Nasic check to ensure browser is in the Internet Explorer family (version <= 11)
     1340            let isIE = /MSIE|Trident/.test(window.navigator.userAgent);
     1341            return !isIE;
     1342        },
     1343
    13061344        setCache: function (key, value) {
    13071345            try {
  • audienceplayer/trunk/audienceplayer.php

    r2450559 r2451356  
    99Description: AudiencePlayer integration
    1010Author: AudiencePlayer
    11 Version: 1.10.5
     11Version: 1.10.6
    1212Author URI: https://www.audienceplayer.com
    1313Text Domain: audienceplayer
  • audienceplayer/trunk/readme.txt

    r2450559 r2451356  
    11=== AudiencePlayer ===
    22Contributors: audienceplayer
    3 Stable tag: 1.10.5
     3Stable tag: 1.10.6
    44Tested up to: 5.5
    55Requires at least: 5.5
  • audienceplayer/trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/AudiencePlayerWordpressPlugin.php

    r2449847 r2451356  
    157157    }
    158158
     159
     160    public static function fetchPluginCacheString()
     161    {
     162        return self::fetchPluginVersion() . '-' . self::fetchPluginDomain();
     163    }
     164
    159165    /**
    160166     * @TODO: force return type ": AudiencePlayerApiClient" as soon as PHP7.3 is minimum supported version
  • audienceplayer/trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Config/Constants.php

    r2450559 r2451356  
    3939
    4040        // Main plugin version number here and in main plugin file header are automatically overwritten in gulp-build script
    41         PLUGIN_VERSION = '1.10.5',
     41        PLUGIN_VERSION = '1.10.6',
    4242
    4343        // DB migration version number is maintained here
  • audienceplayer/trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/BootstrapTrait.php

    r2450559 r2451356  
    206206    protected function deferAdminDownloadActions($self)
    207207    {
     208        // dowload a file, accessible for admin users or AudiencePlayer backend (credential check executed in the method)
    208209        \add_action('wp_ajax_audienceplayer_admin_download_file', function () use ($self) {
     210            $self->audienceplayerDownloadFile();
     211        });
     212        \add_action('wp_ajax_nopriv_audienceplayer_admin_download_file', function () use ($self) {
    209213            $self->audienceplayerDownloadFile();
    210214        });
     
    477481            // After this event, given Wordpress user is automatically logged in and is synchronised with AudiencePlayer.
    478482            // HIGH PRIO, fires before system events
     483            //
     484            // Warning: the 'user_register' is also called when a Wordpress user is created via \wp_create_user and \wp_insert_user
     485            // which in turn is used by UserSyncTrait->createWordpressUser (which has protection against undesired auto-login)
    479486            \add_action('user_register', function ($wordpressUserId) use ($self) {
    480487
     
    494501                    }
    495502                }
    496 
    497                 // auto-login new user @TODO: consider activating this pending customer use cases
    498                 // \wp_set_current_user($wordpressUserId);
    499                 // \wp_set_auth_cookie($wordpressUserId);
    500503
    501504                return $self->syncAudiencePlayerUser($wordpressUserId, $userArgs, $self->isNewUserRegistrationRequest, false, Constants::USER_METADATA_SYNC_DIRECTION_WP2A);
     
    548551            }, 10, 1);
    549552
    550             // "email_change_email": Runs immediately after user link in e-mail to confirm change of e-mail address.
     553            // "email_change_email": Runs immediately after user link in e-mail is clicked to confirm change of e-mail address.
    551554            // After this event, the new e-mail address is again validated at AudiencePlayer before it is changed in Wordpress.
    552555            // HIGH PRIO, fires before system events
     
    567570                    // if sync was not successful, restore the original user data and revert the pending change + hard exit
    568571                    if (false === $result) {
    569                         \wp_insert_user($currentUserData);
     572                        // @TODO: consider creating the missing Wordpress user
     573                        //$this->createWordpressUser($currentUserData);
    570574                        \delete_user_meta($wordpressUserId, '_new_email');
    571                         \wp_die('E-mail address could not be changed, likely an account with this e-mail address already exists!');
     575                        \wp_die($this->fetchTranslations('dialogue_email_address_not_changed_conflict'));
    572576                    }
    573577                }
     
    734738            'button_purchase_subscription' => __('Purchase', 'audienceplayer'),
    735739            'button_validate' => __('Validate', 'audienceplayer'),
     740            'dialogue_browser_not_supported' => __('Unfortunately this browser is not supported, please upgrade and/or switch to a different browser (e.g. Chrome or Safari)', 'audienceplayer'),
    736741            'dialogue_change_payment_method' => __('You can modify or add your payment method', 'audienceplayer'),
    737742            'dialogue_claim_device_explanation' => __('Enter the code displayed on your TV-screen and pair your device', 'audienceplayer'),
    738743            'dialogue_content_not_available_in_region' => __('The content is not available in your current country or region', 'audienceplayer'),
     744            'dialogue_email_address_not_changed_conflict' => __('E-mail address could not be changed, likely an account with this e-mail address already exists! If this e-mail address is yours, try to reset your password.', 'audienceplayer'),
    739745            'dialogue_error_occurred' => __('An error has occurred', 'audienceplayer'),
    740746            'dialogue_paired_device_confirm_removal' => __('Please confirm removing this paired device', 'audienceplayer'),
  • audienceplayer/trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/ShortCodeTrait.php

    r2448193 r2451356  
    6464                $self->enqueueTemplateFileScript('slick.min.js');
    6565
    66                 \wp_register_script('amp.min.js', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.js', [], self::fetchPluginVersion());
    67                 \wp_enqueue_script('amp.min.js', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.js', [], self::fetchPluginVersion());
     66                \wp_register_script('amp.min.js', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.js', [], self::fetchPluginCacheString());
     67                \wp_enqueue_script('amp.min.js', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.js', [], self::fetchPluginCacheString());
    6868
    6969                // CSS
     
    7373                $self->enqueueTemplateFileScript('slick-theme.css');
    7474
    75                 \wp_register_script('amp.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.css', [], self::fetchPluginVersion());
    76                 \wp_enqueue_style('amp.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.css', [], self::fetchPluginVersion());
    77                 \wp_register_script('amp-flush.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp-flush.min.css', [], self::fetchPluginVersion());
    78                 \wp_enqueue_style('amp-flush.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp-flush.min.css', [], self::fetchPluginVersion());
     75                \wp_register_script('amp.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.css', [], self::fetchPluginCacheString());
     76                \wp_enqueue_style('amp.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.css', [], self::fetchPluginCacheString());
     77                \wp_register_script('amp-flush.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp-flush.min.css', [], self::fetchPluginCacheString());
     78                \wp_enqueue_style('amp-flush.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp-flush.min.css', [], self::fetchPluginCacheString());
    7979            }
    8080        });
  • audienceplayer/trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/UserSyncTrait.php

    r2450559 r2451356  
    232232    }
    233233
     234    /**
     235     * @param $arr
     236     */
    234237    protected function parseMetas($arr)
    235238    {
     
    288291    }
    289292
     293    /**
     294     * @param int $audiencePlayerUserId
     295     * @param string $wordpressUserEmail
     296     * @return bool
     297     */
    290298    protected function deleteAudiencePlayerUser(int $audiencePlayerUserId, string $wordpressUserEmail)
    291299    {
     
    319327
    320328        return $ret;
     329    }
     330
     331    /**
     332     * @param $userData
     333     * @param bool $isForceSilentCreation
     334     * @return int|\WP_Error
     335     */
     336    protected function createWordpressUser($userData, $isForceSilentCreation = true)
     337    {
     338        if ($isForceSilentCreation) {
     339            // prevent that this is treated as newly created user registration (by wp_insert_user => 'user_register')
     340            $this->isNewUserRegistrationRequest = false;
     341        }
     342
     343        // create the new Wordpress user
     344        $wordpressUserId = \wp_insert_user($userData);
     345
     346        // If successful, prevent auto-login of this user which is often set in the Wordpress theme on the 'user_register' event
     347        // to allow newly registered users to become auto-logged in
     348        if ($isForceSilentCreation && is_int($wordpressUserId) && \get_current_user_id() === $wordpressUserId) {
     349            \wp_logout();
     350        }
     351
     352        return $wordpressUserId;
    321353    }
    322354
     
    560592            false === $isDeleteUser &&
    561593            ($userArgs = $this->helper->parseWordpressUserArgs($userArgs, ['user_email' => $email])) &&
    562             ($userId = \wp_insert_user($userArgs))
     594            ($userId = $this->createWordpressUser($userArgs))
    563595        ) {
    564596
  • audienceplayer/trunk/static/css/audienceplayer_admin.css

    r2448193 r2451356  
    4949    list-style-type: square;
    5050    list-style-position: outside;
     51    padding-top: 6px;
    5152    padding-left: 16px;
    5253}
  • audienceplayer/trunk/static/html/admin_help_user_sync.html

    r2448193 r2451356  
    5151        </ul>
    5252    </li>
     53    <li>
     54        Developers note: There are many Wordpress hooks addressed by this plugin to achieve redundant User
     55        synchronisation. If you use code and/or other plugins that affect user management and/or authentication, the
     56        hooks listed below deserve special attention should you use them as well. For a thorough overview, see the
     57        plugin file "BootstrapTrait.php" for the exact implementation.<br/>
     58        <ul class="audienceplayer-admin-ul-level1">
     59            <li><em>user_register</em>: synchronise user, add user</li>
     60            <li><em>email_change_email</em>: synchronise user</li>
     61            <li><em>user_profile_update_errors</em>: synchronise user, create user</li>
     62            <li><em>registration_errors</em>: synchronise user, create user</li>
     63            <li><em>delete_user</em>: synchronise user, delete user</li>
     64            <li><em>deleted_user</em>: synchronise user user</li>
     65        </ul>
     66    </li>
    5367</ol>
  • audienceplayer/trunk/templates/audienceplayer-core-html.php

    r2446851 r2451356  
    99<!-- html elements for the AudiencePlayer modal EmbedPlayer -->
    1010<div id="audienceplayer-modal-video-player" class="audienceplayer-modal audienceplayer-modal-video-player">
    11     <button id="audienceplayer-modal-video-player-button-close" class="close"><i class="audienceplayer-fa close"></i>
    12     </button>
    1311    <div class="audienceplayer-modal-video-player-wrapper"></div>
     12    <button id="audienceplayer-modal-video-player-button-close" class="close"><i class="audienceplayer-fa close"></i></button>
    1413</div>
    1514
  • audienceplayer/trunk/templates/audienceplayer-core-javascript.php

    r2450303 r2451356  
    11<?php
    2 $scriptEmbedQsa = '?ver=' . $AudiencePlayerWordpressPlugin::fetchPluginVersion() . '&domain=' . $AudiencePlayerWordpressPlugin::fetchPluginDomain();
     2$scriptEmbedQsa = '?ver=' . $AudiencePlayerWordpressPlugin::fetchPluginCacheString();
    33$audiencePlayerBearerToken = $AudiencePlayerWordpressPlugin->fetchUserBearerToken();
    44$isWordpressUserLoggedIn = \is_user_logged_in();
     
    4040<script>
    4141    <?php
     42
     43    /*
     44     * Create global error message accessible to unsupported browsers
     45     */
     46    echo 'window.AudiencePlayerBrowserNotSupportedError = \'' .
     47        $AudiencePlayerWordpressPlugin->helper
     48            ->escapeQuotes($AudiencePlayerWordpressPlugin->fetchTranslations('dialogue_browser_not_supported')) .
     49        '\';';
     50
    4251    /*
    4352     * Handle redirect/afterPurchase action after user returns from external payment provider url
  • audienceplayer/trunk/templates/audienceplayer-core-translations.php

    r2448193 r2451356  
    1818    'button_purchase_subscription' => 'Purchase',
    1919    'button_validate' => 'Validate',
     20    'dialogue_browser_not_supported' => 'Unfortunately this browser is not supported, please upgrade and/or switch to a different browser (e.g. Chrome or Safari)',
    2021    'dialogue_change_payment_method' => 'You can modify or add your payment method',
    2122    'dialogue_claim_device_explanation' => 'Enter the code displayed on your TV-screen and pair your device',
    2223    'dialogue_content_not_available_in_region' => 'The content is not available in your current country or region',
     24    'dialogue_email_address_not_changed_conflict' => 'E-mail address could not be changed, likely an account with this e-mail address already exists! If this e-mail address is yours, try to reset your password.',
    2325    'dialogue_error_occurred' => 'An error has occurred',
    2426    'dialogue_paired_device_confirm_removal' => 'Please confirm removing this paired device',
  • audienceplayer/trunk/templates/css/audienceplayer-shortcodes.css

    r2446851 r2451356  
    375375
    376376/* modal video player overrides */
    377 #audienceplayer-modal-video-player button.close {
    378     color: #ffffff;
    379     top: 16px !important;
    380     right: 16px !important;
    381 }
    382 
    383 /* main selector for the EmbedPlayer */
    384 .audienceplayer-modal-video-player-wrapper {
    385     position: absolute;
    386     margin: calc(1vh - 20px) 1vw calc(1vh + 20px) 1vw;
    387     height: 98vh;
    388     width: 98vw;
     377@media (max-aspect-ratio: 16/9) {
     378
     379    #audienceplayer-modal-video-player button.close {
     380        color: #ffffff;
     381        top: calc(50vh - calc(40vw / 1.7)) !important;
     382        right: calc(10vw) !important;
     383    }
     384
     385    .audienceplayer-modal-video-player-wrapper {
     386        z-index: 10001;
     387        position: absolute;
     388        margin: calc(50vh - calc(40vw / 1.7)) 10vw;
     389        height: calc(80vw / 1.7);
     390        width: 80vw;
     391    }
     392}
     393
     394@media (min-aspect-ratio: 16/9) {
     395
     396    #audienceplayer-modal-video-player button.close {
     397        color: #ffffff;
     398        top: 10vh !important;
     399        right: calc(50vw - calc(40vh * 1.7)) !important;
     400    }
     401
     402    .audienceplayer-modal-video-player-wrapper {
     403        z-index: 10001;
     404        position: absolute;
     405        margin: 10vh calc(50vw - calc(40vh * 1.7));
     406        height: 80vh;
     407        width: calc(80vh * 1.7);
     408    }
    389409}
    390410
  • audienceplayer/trunk/templates/js/audienceplayer-core.js

    r2450303 r2451356  
    116116            });
    117117
    118             // Set up keyup events to close modals
     118            // @TODO: Consider allowing users to close the video modal by clicking on the transparent overlay
     119            /*
     120            $('#audienceplayer-modal-video-player').click(function () {
     121                self.closeModal(true);
     122                return false;
     123            });
     124            */
     125
     126            // Set up keyup events to close modals: Currently only map the ESC key (27)
    119127            $(document).unbind('keyup.key27');
    120128            $(document).bind('keyup.key27', function (event) {
     
    241249
    242250            }
    243 
    244             if (this.CONFIG.isLoggedIn && !this.CONFIG.isSynchronised) {
    245 
    246             }
    247251        },
    248252
     
    255259
    256260            let self = this;
     261
     262            // Check browser support before opening modal
     263            if (!self.isSupportedBrowser()) {
     264                self.openModalBrowserNotSupported(event);
     265                return;
     266            }
    257267
    258268            // Hide the main EmbedPlayer wrapper
     
    276286                        autoplay: true
    277287                    })
    278                     .then(config => {
     288                    .then(function (config) {
    279289                        // Show the main EmbedPlayer wrapper
    280290                        $('.audienceplayer-modal-video-player-wrapper').fadeIn();
    281291                    })
    282                     .catch(error => {
     292                    .catch(function (error) {
    283293                        $('#audienceplayer-modal-video-player').hide();
    284294                        //alert(error.message + ' [' + error.code + ']');
     
    303313
    304314            let self = this;
     315
     316            // Check browser support before opening modal
     317            if (!self.isSupportedBrowser()) {
     318                self.openModalBrowserNotSupported(event);
     319                return;
     320            }
    305321
    306322            let callbackNonAuthenticated = arguments[6];
     
    548564            self.setModalProperty($currentModal, 'message', message);
    549565            self.setActiveModal($currentModal);
     566        },
     567
     568        openModalBrowserNotSupported: function (event) {
     569            let message = window.AudiencePlayerBrowserNotSupportedError;
     570
     571            try {
     572                if (self.CONFIG.translations.dialogue_browser_not_supported) {
     573                    message = self.CONFIG.translations.dialogue_browser_not_supported;
     574                } else if (window.AudiencePlayerLib.translations.dialogue_browser_not_supported) {
     575                    message = window.AudiencePlayerLib.translations.dialogue_browser_not_supported;
     576                } else if (window.AudiencePlayerBrowserNotSupportedError) {
     577                    message = window.AudiencePlayerBrowserNotSupportedError;
     578                }
     579            } catch (e) {
     580                //
     581            }
     582
     583            this.openModalAlert(event, message, 'OK');
    550584        },
    551585
     
    756790                self.redirectNonAuthenticatedUser(callbackNonAuthenticated);
    757791                return;
    758             }
    759             elseif()
    760 
    761             if ($elementToggle.isWorking) {
     792            } else if ($elementToggle.isWorking) {
    762793                return;
    763794            } else {
     
    13041335        },
    13051336
     1337        isSupportedBrowser: function () {
     1338
     1339            // Nasic check to ensure browser is in the Internet Explorer family (version <= 11)
     1340            let isIE = /MSIE|Trident/.test(window.navigator.userAgent);
     1341            return !isIE;
     1342        },
     1343
    13061344        setCache: function (key, value) {
    13071345            try {
Note: See TracChangeset for help on using the changeset viewer.