Changeset 2451356
- Timestamp:
- 01/06/2021 03:18:20 PM (5 years ago)
- Location:
- audienceplayer
- Files:
-
- 28 edited
- 1 copied
-
tags/1.10.6 (copied) (copied from audienceplayer/trunk)
-
tags/1.10.6/audienceplayer.php (modified) (1 diff)
-
tags/1.10.6/readme.txt (modified) (1 diff)
-
tags/1.10.6/src/AudiencePlayer/AudiencePlayerWordpressPlugin/AudiencePlayerWordpressPlugin.php (modified) (1 diff)
-
tags/1.10.6/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Config/Constants.php (modified) (1 diff)
-
tags/1.10.6/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/BootstrapTrait.php (modified) (6 diffs)
-
tags/1.10.6/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/ShortCodeTrait.php (modified) (2 diffs)
-
tags/1.10.6/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/UserSyncTrait.php (modified) (4 diffs)
-
tags/1.10.6/static/css/audienceplayer_admin.css (modified) (1 diff)
-
tags/1.10.6/static/html/admin_help_user_sync.html (modified) (1 diff)
-
tags/1.10.6/templates/audienceplayer-core-html.php (modified) (1 diff)
-
tags/1.10.6/templates/audienceplayer-core-javascript.php (modified) (2 diffs)
-
tags/1.10.6/templates/audienceplayer-core-translations.php (modified) (1 diff)
-
tags/1.10.6/templates/css/audienceplayer-shortcodes.css (modified) (1 diff)
-
tags/1.10.6/templates/js/audienceplayer-core.js (modified) (8 diffs)
-
trunk/audienceplayer.php (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/AudiencePlayerWordpressPlugin.php (modified) (1 diff)
-
trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Config/Constants.php (modified) (1 diff)
-
trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/BootstrapTrait.php (modified) (6 diffs)
-
trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/ShortCodeTrait.php (modified) (2 diffs)
-
trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/UserSyncTrait.php (modified) (4 diffs)
-
trunk/static/css/audienceplayer_admin.css (modified) (1 diff)
-
trunk/static/html/admin_help_user_sync.html (modified) (1 diff)
-
trunk/templates/audienceplayer-core-html.php (modified) (1 diff)
-
trunk/templates/audienceplayer-core-javascript.php (modified) (2 diffs)
-
trunk/templates/audienceplayer-core-translations.php (modified) (1 diff)
-
trunk/templates/css/audienceplayer-shortcodes.css (modified) (1 diff)
-
trunk/templates/js/audienceplayer-core.js (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
audienceplayer/tags/1.10.6/audienceplayer.php
r2450559 r2451356 9 9 Description: AudiencePlayer integration 10 10 Author: AudiencePlayer 11 Version: 1.10. 511 Version: 1.10.6 12 12 Author URI: https://www.audienceplayer.com 13 13 Text Domain: audienceplayer -
audienceplayer/tags/1.10.6/readme.txt
r2450559 r2451356 1 1 === AudiencePlayer === 2 2 Contributors: audienceplayer 3 Stable tag: 1.10. 53 Stable tag: 1.10.6 4 4 Tested up to: 5.5 5 5 Requires at least: 5.5 -
audienceplayer/tags/1.10.6/src/AudiencePlayer/AudiencePlayerWordpressPlugin/AudiencePlayerWordpressPlugin.php
r2449847 r2451356 157 157 } 158 158 159 160 public static function fetchPluginCacheString() 161 { 162 return self::fetchPluginVersion() . '-' . self::fetchPluginDomain(); 163 } 164 159 165 /** 160 166 * @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 39 39 40 40 // 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', 42 42 43 43 // DB migration version number is maintained here -
audienceplayer/tags/1.10.6/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/BootstrapTrait.php
r2450559 r2451356 206 206 protected function deferAdminDownloadActions($self) 207 207 { 208 // dowload a file, accessible for admin users or AudiencePlayer backend (credential check executed in the method) 208 209 \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) { 209 213 $self->audienceplayerDownloadFile(); 210 214 }); … … 477 481 // After this event, given Wordpress user is automatically logged in and is synchronised with AudiencePlayer. 478 482 // 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) 479 486 \add_action('user_register', function ($wordpressUserId) use ($self) { 480 487 … … 494 501 } 495 502 } 496 497 // auto-login new user @TODO: consider activating this pending customer use cases498 // \wp_set_current_user($wordpressUserId);499 // \wp_set_auth_cookie($wordpressUserId);500 503 501 504 return $self->syncAudiencePlayerUser($wordpressUserId, $userArgs, $self->isNewUserRegistrationRequest, false, Constants::USER_METADATA_SYNC_DIRECTION_WP2A); … … 548 551 }, 10, 1); 549 552 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. 551 554 // After this event, the new e-mail address is again validated at AudiencePlayer before it is changed in Wordpress. 552 555 // HIGH PRIO, fires before system events … … 567 570 // if sync was not successful, restore the original user data and revert the pending change + hard exit 568 571 if (false === $result) { 569 \wp_insert_user($currentUserData); 572 // @TODO: consider creating the missing Wordpress user 573 //$this->createWordpressUser($currentUserData); 570 574 \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')); 572 576 } 573 577 } … … 734 738 'button_purchase_subscription' => __('Purchase', 'audienceplayer'), 735 739 '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'), 736 741 'dialogue_change_payment_method' => __('You can modify or add your payment method', 'audienceplayer'), 737 742 'dialogue_claim_device_explanation' => __('Enter the code displayed on your TV-screen and pair your device', 'audienceplayer'), 738 743 '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'), 739 745 'dialogue_error_occurred' => __('An error has occurred', 'audienceplayer'), 740 746 '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 64 64 $self->enqueueTemplateFileScript('slick.min.js'); 65 65 66 \wp_register_script('amp.min.js', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.js', [], self::fetchPlugin Version());67 \wp_enqueue_script('amp.min.js', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.js', [], self::fetchPlugin Version());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()); 68 68 69 69 // CSS … … 73 73 $self->enqueueTemplateFileScript('slick-theme.css'); 74 74 75 \wp_register_script('amp.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.css', [], self::fetchPlugin Version());76 \wp_enqueue_style('amp.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.css', [], self::fetchPlugin Version());77 \wp_register_script('amp-flush.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp-flush.min.css', [], self::fetchPlugin Version());78 \wp_enqueue_style('amp-flush.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp-flush.min.css', [], self::fetchPlugin Version());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()); 79 79 } 80 80 }); -
audienceplayer/tags/1.10.6/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/UserSyncTrait.php
r2450559 r2451356 232 232 } 233 233 234 /** 235 * @param $arr 236 */ 234 237 protected function parseMetas($arr) 235 238 { … … 288 291 } 289 292 293 /** 294 * @param int $audiencePlayerUserId 295 * @param string $wordpressUserEmail 296 * @return bool 297 */ 290 298 protected function deleteAudiencePlayerUser(int $audiencePlayerUserId, string $wordpressUserEmail) 291 299 { … … 319 327 320 328 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; 321 353 } 322 354 … … 560 592 false === $isDeleteUser && 561 593 ($userArgs = $this->helper->parseWordpressUserArgs($userArgs, ['user_email' => $email])) && 562 ($userId = \wp_insert_user($userArgs))594 ($userId = $this->createWordpressUser($userArgs)) 563 595 ) { 564 596 -
audienceplayer/tags/1.10.6/static/css/audienceplayer_admin.css
r2448193 r2451356 49 49 list-style-type: square; 50 50 list-style-position: outside; 51 padding-top: 6px; 51 52 padding-left: 16px; 52 53 } -
audienceplayer/tags/1.10.6/static/html/admin_help_user_sync.html
r2448193 r2451356 51 51 </ul> 52 52 </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> 53 67 </ol> -
audienceplayer/tags/1.10.6/templates/audienceplayer-core-html.php
r2446851 r2451356 9 9 <!-- html elements for the AudiencePlayer modal EmbedPlayer --> 10 10 <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>13 11 <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> 14 13 </div> 15 14 -
audienceplayer/tags/1.10.6/templates/audienceplayer-core-javascript.php
r2450303 r2451356 1 1 <?php 2 $scriptEmbedQsa = '?ver=' . $AudiencePlayerWordpressPlugin::fetchPlugin Version() . '&domain=' . $AudiencePlayerWordpressPlugin::fetchPluginDomain();2 $scriptEmbedQsa = '?ver=' . $AudiencePlayerWordpressPlugin::fetchPluginCacheString(); 3 3 $audiencePlayerBearerToken = $AudiencePlayerWordpressPlugin->fetchUserBearerToken(); 4 4 $isWordpressUserLoggedIn = \is_user_logged_in(); … … 40 40 <script> 41 41 <?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 42 51 /* 43 52 * Handle redirect/afterPurchase action after user returns from external payment provider url -
audienceplayer/tags/1.10.6/templates/audienceplayer-core-translations.php
r2448193 r2451356 18 18 'button_purchase_subscription' => 'Purchase', 19 19 '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)', 20 21 'dialogue_change_payment_method' => 'You can modify or add your payment method', 21 22 'dialogue_claim_device_explanation' => 'Enter the code displayed on your TV-screen and pair your device', 22 23 '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.', 23 25 'dialogue_error_occurred' => 'An error has occurred', 24 26 'dialogue_paired_device_confirm_removal' => 'Please confirm removing this paired device', -
audienceplayer/tags/1.10.6/templates/css/audienceplayer-shortcodes.css
r2446851 r2451356 375 375 376 376 /* 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 } 389 409 } 390 410 -
audienceplayer/tags/1.10.6/templates/js/audienceplayer-core.js
r2450303 r2451356 116 116 }); 117 117 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) 119 127 $(document).unbind('keyup.key27'); 120 128 $(document).bind('keyup.key27', function (event) { … … 241 249 242 250 } 243 244 if (this.CONFIG.isLoggedIn && !this.CONFIG.isSynchronised) {245 246 }247 251 }, 248 252 … … 255 259 256 260 let self = this; 261 262 // Check browser support before opening modal 263 if (!self.isSupportedBrowser()) { 264 self.openModalBrowserNotSupported(event); 265 return; 266 } 257 267 258 268 // Hide the main EmbedPlayer wrapper … … 276 286 autoplay: true 277 287 }) 278 .then( config =>{288 .then(function (config) { 279 289 // Show the main EmbedPlayer wrapper 280 290 $('.audienceplayer-modal-video-player-wrapper').fadeIn(); 281 291 }) 282 .catch( error =>{292 .catch(function (error) { 283 293 $('#audienceplayer-modal-video-player').hide(); 284 294 //alert(error.message + ' [' + error.code + ']'); … … 303 313 304 314 let self = this; 315 316 // Check browser support before opening modal 317 if (!self.isSupportedBrowser()) { 318 self.openModalBrowserNotSupported(event); 319 return; 320 } 305 321 306 322 let callbackNonAuthenticated = arguments[6]; … … 548 564 self.setModalProperty($currentModal, 'message', message); 549 565 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'); 550 584 }, 551 585 … … 756 790 self.redirectNonAuthenticatedUser(callbackNonAuthenticated); 757 791 return; 758 } 759 elseif() 760 761 if ($elementToggle.isWorking) { 792 } else if ($elementToggle.isWorking) { 762 793 return; 763 794 } else { … … 1304 1335 }, 1305 1336 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 1306 1344 setCache: function (key, value) { 1307 1345 try { -
audienceplayer/trunk/audienceplayer.php
r2450559 r2451356 9 9 Description: AudiencePlayer integration 10 10 Author: AudiencePlayer 11 Version: 1.10. 511 Version: 1.10.6 12 12 Author URI: https://www.audienceplayer.com 13 13 Text Domain: audienceplayer -
audienceplayer/trunk/readme.txt
r2450559 r2451356 1 1 === AudiencePlayer === 2 2 Contributors: audienceplayer 3 Stable tag: 1.10. 53 Stable tag: 1.10.6 4 4 Tested up to: 5.5 5 5 Requires at least: 5.5 -
audienceplayer/trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/AudiencePlayerWordpressPlugin.php
r2449847 r2451356 157 157 } 158 158 159 160 public static function fetchPluginCacheString() 161 { 162 return self::fetchPluginVersion() . '-' . self::fetchPluginDomain(); 163 } 164 159 165 /** 160 166 * @TODO: force return type ": AudiencePlayerApiClient" as soon as PHP7.3 is minimum supported version -
audienceplayer/trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Config/Constants.php
r2450559 r2451356 39 39 40 40 // 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', 42 42 43 43 // DB migration version number is maintained here -
audienceplayer/trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/BootstrapTrait.php
r2450559 r2451356 206 206 protected function deferAdminDownloadActions($self) 207 207 { 208 // dowload a file, accessible for admin users or AudiencePlayer backend (credential check executed in the method) 208 209 \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) { 209 213 $self->audienceplayerDownloadFile(); 210 214 }); … … 477 481 // After this event, given Wordpress user is automatically logged in and is synchronised with AudiencePlayer. 478 482 // 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) 479 486 \add_action('user_register', function ($wordpressUserId) use ($self) { 480 487 … … 494 501 } 495 502 } 496 497 // auto-login new user @TODO: consider activating this pending customer use cases498 // \wp_set_current_user($wordpressUserId);499 // \wp_set_auth_cookie($wordpressUserId);500 503 501 504 return $self->syncAudiencePlayerUser($wordpressUserId, $userArgs, $self->isNewUserRegistrationRequest, false, Constants::USER_METADATA_SYNC_DIRECTION_WP2A); … … 548 551 }, 10, 1); 549 552 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. 551 554 // After this event, the new e-mail address is again validated at AudiencePlayer before it is changed in Wordpress. 552 555 // HIGH PRIO, fires before system events … … 567 570 // if sync was not successful, restore the original user data and revert the pending change + hard exit 568 571 if (false === $result) { 569 \wp_insert_user($currentUserData); 572 // @TODO: consider creating the missing Wordpress user 573 //$this->createWordpressUser($currentUserData); 570 574 \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')); 572 576 } 573 577 } … … 734 738 'button_purchase_subscription' => __('Purchase', 'audienceplayer'), 735 739 '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'), 736 741 'dialogue_change_payment_method' => __('You can modify or add your payment method', 'audienceplayer'), 737 742 'dialogue_claim_device_explanation' => __('Enter the code displayed on your TV-screen and pair your device', 'audienceplayer'), 738 743 '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'), 739 745 'dialogue_error_occurred' => __('An error has occurred', 'audienceplayer'), 740 746 'dialogue_paired_device_confirm_removal' => __('Please confirm removing this paired device', 'audienceplayer'), -
audienceplayer/trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/ShortCodeTrait.php
r2448193 r2451356 64 64 $self->enqueueTemplateFileScript('slick.min.js'); 65 65 66 \wp_register_script('amp.min.js', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.js', [], self::fetchPlugin Version());67 \wp_enqueue_script('amp.min.js', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.js', [], self::fetchPlugin Version());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()); 68 68 69 69 // CSS … … 73 73 $self->enqueueTemplateFileScript('slick-theme.css'); 74 74 75 \wp_register_script('amp.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.css', [], self::fetchPlugin Version());76 \wp_enqueue_style('amp.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp.min.css', [], self::fetchPlugin Version());77 \wp_register_script('amp-flush.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp-flush.min.css', [], self::fetchPlugin Version());78 \wp_enqueue_style('amp-flush.min.css', $self->fetchEmbedPlayerBaseUrl() . '/azure-media-player/amp-flush.min.css', [], self::fetchPlugin Version());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()); 79 79 } 80 80 }); -
audienceplayer/trunk/src/AudiencePlayer/AudiencePlayerWordpressPlugin/Resources/UserSyncTrait.php
r2450559 r2451356 232 232 } 233 233 234 /** 235 * @param $arr 236 */ 234 237 protected function parseMetas($arr) 235 238 { … … 288 291 } 289 292 293 /** 294 * @param int $audiencePlayerUserId 295 * @param string $wordpressUserEmail 296 * @return bool 297 */ 290 298 protected function deleteAudiencePlayerUser(int $audiencePlayerUserId, string $wordpressUserEmail) 291 299 { … … 319 327 320 328 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; 321 353 } 322 354 … … 560 592 false === $isDeleteUser && 561 593 ($userArgs = $this->helper->parseWordpressUserArgs($userArgs, ['user_email' => $email])) && 562 ($userId = \wp_insert_user($userArgs))594 ($userId = $this->createWordpressUser($userArgs)) 563 595 ) { 564 596 -
audienceplayer/trunk/static/css/audienceplayer_admin.css
r2448193 r2451356 49 49 list-style-type: square; 50 50 list-style-position: outside; 51 padding-top: 6px; 51 52 padding-left: 16px; 52 53 } -
audienceplayer/trunk/static/html/admin_help_user_sync.html
r2448193 r2451356 51 51 </ul> 52 52 </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> 53 67 </ol> -
audienceplayer/trunk/templates/audienceplayer-core-html.php
r2446851 r2451356 9 9 <!-- html elements for the AudiencePlayer modal EmbedPlayer --> 10 10 <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>13 11 <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> 14 13 </div> 15 14 -
audienceplayer/trunk/templates/audienceplayer-core-javascript.php
r2450303 r2451356 1 1 <?php 2 $scriptEmbedQsa = '?ver=' . $AudiencePlayerWordpressPlugin::fetchPlugin Version() . '&domain=' . $AudiencePlayerWordpressPlugin::fetchPluginDomain();2 $scriptEmbedQsa = '?ver=' . $AudiencePlayerWordpressPlugin::fetchPluginCacheString(); 3 3 $audiencePlayerBearerToken = $AudiencePlayerWordpressPlugin->fetchUserBearerToken(); 4 4 $isWordpressUserLoggedIn = \is_user_logged_in(); … … 40 40 <script> 41 41 <?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 42 51 /* 43 52 * Handle redirect/afterPurchase action after user returns from external payment provider url -
audienceplayer/trunk/templates/audienceplayer-core-translations.php
r2448193 r2451356 18 18 'button_purchase_subscription' => 'Purchase', 19 19 '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)', 20 21 'dialogue_change_payment_method' => 'You can modify or add your payment method', 21 22 'dialogue_claim_device_explanation' => 'Enter the code displayed on your TV-screen and pair your device', 22 23 '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.', 23 25 'dialogue_error_occurred' => 'An error has occurred', 24 26 'dialogue_paired_device_confirm_removal' => 'Please confirm removing this paired device', -
audienceplayer/trunk/templates/css/audienceplayer-shortcodes.css
r2446851 r2451356 375 375 376 376 /* 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 } 389 409 } 390 410 -
audienceplayer/trunk/templates/js/audienceplayer-core.js
r2450303 r2451356 116 116 }); 117 117 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) 119 127 $(document).unbind('keyup.key27'); 120 128 $(document).bind('keyup.key27', function (event) { … … 241 249 242 250 } 243 244 if (this.CONFIG.isLoggedIn && !this.CONFIG.isSynchronised) {245 246 }247 251 }, 248 252 … … 255 259 256 260 let self = this; 261 262 // Check browser support before opening modal 263 if (!self.isSupportedBrowser()) { 264 self.openModalBrowserNotSupported(event); 265 return; 266 } 257 267 258 268 // Hide the main EmbedPlayer wrapper … … 276 286 autoplay: true 277 287 }) 278 .then( config =>{288 .then(function (config) { 279 289 // Show the main EmbedPlayer wrapper 280 290 $('.audienceplayer-modal-video-player-wrapper').fadeIn(); 281 291 }) 282 .catch( error =>{292 .catch(function (error) { 283 293 $('#audienceplayer-modal-video-player').hide(); 284 294 //alert(error.message + ' [' + error.code + ']'); … … 303 313 304 314 let self = this; 315 316 // Check browser support before opening modal 317 if (!self.isSupportedBrowser()) { 318 self.openModalBrowserNotSupported(event); 319 return; 320 } 305 321 306 322 let callbackNonAuthenticated = arguments[6]; … … 548 564 self.setModalProperty($currentModal, 'message', message); 549 565 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'); 550 584 }, 551 585 … … 756 790 self.redirectNonAuthenticatedUser(callbackNonAuthenticated); 757 791 return; 758 } 759 elseif() 760 761 if ($elementToggle.isWorking) { 792 } else if ($elementToggle.isWorking) { 762 793 return; 763 794 } else { … … 1304 1335 }, 1305 1336 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 1306 1344 setCache: function (key, value) { 1307 1345 try {
Note: See TracChangeset
for help on using the changeset viewer.