Changeset 2931216
- Timestamp:
- 06/27/2023 04:35:54 AM (3 years ago)
- Location:
- termageddon-usercentrics
- Files:
-
- 6 edited
- 19 copied
-
tags/1.3.4 (copied) (copied from termageddon-usercentrics/trunk)
-
tags/1.3.4/README.txt (copied) (copied from termageddon-usercentrics/trunk/README.txt) (2 diffs)
-
tags/1.3.4/admin/class-termageddon-usercentrics-admin.php (copied) (copied from termageddon-usercentrics/trunk/admin/class-termageddon-usercentrics-admin.php) (11 diffs)
-
tags/1.3.4/admin/css/termageddon-usercentrics-admin.css (copied) (copied from termageddon-usercentrics/trunk/admin/css/termageddon-usercentrics-admin.css)
-
tags/1.3.4/admin/css/termageddon-usercentrics-admin.min.css (copied) (copied from termageddon-usercentrics/trunk/admin/css/termageddon-usercentrics-admin.min.css)
-
tags/1.3.4/admin/js (copied) (copied from termageddon-usercentrics/trunk/admin/js)
-
tags/1.3.4/admin/js/termageddon-usercentrics-admin.js (copied) (copied from termageddon-usercentrics/trunk/admin/js/termageddon-usercentrics-admin.js)
-
tags/1.3.4/admin/js/termageddon-usercentrics-admin.min.js (copied) (copied from termageddon-usercentrics/trunk/admin/js/termageddon-usercentrics-admin.min.js)
-
tags/1.3.4/includes/class-termageddon-usercentrics-activator.php (copied) (copied from termageddon-usercentrics/trunk/includes/class-termageddon-usercentrics-activator.php)
-
tags/1.3.4/includes/class-termageddon-usercentrics-deactivator.php (copied) (copied from termageddon-usercentrics/trunk/includes/class-termageddon-usercentrics-deactivator.php)
-
tags/1.3.4/includes/class-termageddon-usercentrics.php (copied) (copied from termageddon-usercentrics/trunk/includes/class-termageddon-usercentrics.php) (17 diffs)
-
tags/1.3.4/languages/termageddon-usercentrics-en_US.po (copied) (copied from termageddon-usercentrics/trunk/languages/termageddon-usercentrics-en_US.po)
-
tags/1.3.4/languages/termageddon-usercentrics.pot (copied) (copied from termageddon-usercentrics/trunk/languages/termageddon-usercentrics.pot) (16 diffs)
-
tags/1.3.4/public/class-termageddon-usercentrics-public.php (copied) (copied from termageddon-usercentrics/trunk/public/class-termageddon-usercentrics-public.php) (3 diffs)
-
tags/1.3.4/public/js (copied) (copied from termageddon-usercentrics/trunk/public/js)
-
tags/1.3.4/public/js/termageddon-usercentrics-ajax.js (copied) (copied from termageddon-usercentrics/trunk/public/js/termageddon-usercentrics-ajax.js)
-
tags/1.3.4/public/js/termageddon-usercentrics-ajax.min.js (copied) (copied from termageddon-usercentrics/trunk/public/js/termageddon-usercentrics-ajax.min.js)
-
tags/1.3.4/termageddon-usercentrics.code-workspace (copied) (copied from termageddon-usercentrics/trunk/termageddon-usercentrics.code-workspace)
-
tags/1.3.4/termageddon-usercentrics.php (copied) (copied from termageddon-usercentrics/trunk/termageddon-usercentrics.php) (2 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/admin/class-termageddon-usercentrics-admin.php (modified) (11 diffs)
-
trunk/includes/class-termageddon-usercentrics.php (modified) (17 diffs)
-
trunk/languages/termageddon-usercentrics.pot (modified) (16 diffs)
-
trunk/public/class-termageddon-usercentrics-public.php (modified) (3 diffs)
-
trunk/termageddon-usercentrics.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
termageddon-usercentrics/tags/1.3.4/README.txt
r2922465 r2931216 5 5 Requires at least: 3.0.1 6 6 Tested up to: 6.2.2 7 Stable tag: 1.3. 37 Stable tag: 1.3.4 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 26 26 27 27 == Changelog == 28 29 = 1.3.4 = 30 31 - [ADD] Added alternate privacy settings link embed as an alternative for shortcodes (Divi Support). 32 - [ADD] Added settings section to showcase privacy settings link settings. 33 - [CHANGE] Moved Hide Privacy Settings Link option to Settings page instead of geolocation page. 34 - [FIX] Improved handling for WP_CLI actions and error logging. 28 35 29 36 = 1.3.3 = -
termageddon-usercentrics/tags/1.3.4/admin/class-termageddon-usercentrics-admin.php
r2922465 r2931216 213 213 214 214 return array( 215 'before_section' => '<div class="tu-settings-tab tu-tab-' . $tab . ( $tab_active ? '' : ' tu-section-hidden' ) . '" >', // Start a new tab 215 'before_section' => '<div class="tu-settings-tab tu-tab-' . $tab . ( $tab_active ? '' : ' tu-section-hidden' ) . '" >', // Start a new tab. 216 216 'after_section' => '</div></div> 217 217 </div>', // Finish the additional sections setup in the html callbacks (2) and then finish the tab for a total of 3 divs. … … 220 220 221 221 222 /** Build the default arguments for the current section 223 * 224 * @param mixed $tab The tab you are setting up; For use with identifying current tab and hiding/showing the tab. 225 * @return string[] 226 */ 227 public function add_new_subsection( string $section, array $options=[]) { 228 229 $name = (isset($options['name']) ? $options['name'] : false); 230 $description = (isset($options['description']) ? $options['description'] : false); 231 $indent = (isset($options['indent']) ? $options['indent'] === true : false); 232 $slim = (isset($options['slim']) ? $options['slim'] === true : false); 233 234 add_settings_field( 235 'termageddon_usercentrics_end-section-'.Termageddon_Usercentrics::generate_random_string(5), 222 /** 223 * Generate and appends the HTML for a new subsection based on options provided. 224 * 225 * @param string $section The section slug to add the section to. 226 * @param array $options name, description, indent, slim; Various options. 227 * @return void 228 */ 229 public function add_new_subsection( string $section, array $options = array() ) { 230 231 $name = ( isset( $options['name'] ) ? $options['name'] : false ); 232 $description = ( isset( $options['description'] ) ? $options['description'] : false ); 233 $indent = ( isset( $options['indent'] ) ? true === $options['indent'] : false ); 234 $slim = ( isset( $options['slim'] ) ? true === $options['slim'] : false ); 235 236 add_settings_field( 237 'termageddon_usercentrics_end-section-' . Termageddon_Usercentrics::generate_random_string( 5 ), 236 238 ' </th></tr></tbody></table> 237 239 </div> 238 240 <div class="tu-toggle-section"> 239 <span class="tu-section-title">' . esc_html __( $name , 'termageddon-usercentrics') . ':</span>240 ' .(empty($description) ? '' : '<p>' . esc_html__( $description, 'termageddon-usercentrics' ) . '</p>').'241 <span class="tu-section-title">' . esc_html( $name ) . ':</span> 242 ' . ( empty( $description ) ? '' : '<p>' . wp_kses_post( $description ) . '</p>' ) . ' 241 243 </div> 242 <div class="' .($indent ? 'tu-toggle-section' : 'tu-settings-section').($slim ? ' slim-section' : '').'">244 <div class="' . ( $indent ? 'tu-toggle-section' : 'tu-settings-section' ) . ( $slim ? ' slim-section' : '' ) . '"> 243 245 <table class="form-table" role="presentation"> 244 246 <tbody> … … 253 255 254 256 257 /** Generates and appends the beta label for a field. 258 * 259 * @return string */ 255 260 public static function mark_as_beta() { 256 261 return ' <span class="tu-label-warning">BETA</span>'; … … 379 384 ); 380 385 381 // BREAK SECTION FOR GEOLOCATION SETTINGS 382 $this->add_new_subsection('termageddon_usercentrics_section_settings', [ 383 'name' => 'Integrations', 384 'description' => 'We love to partner with other plugin developers to improve support with their plugins. If you encounter an issue, please contact our support to let us know.', 385 ]); 386 387 // Disable Login. 386 // BREAK SECTION FOR GEOLOCATION SETTINGS. 387 $this->add_new_subsection( 388 'termageddon_usercentrics_section_settings', 389 array( 390 'name' => 'Privacy Settings Link', 391 'description' => 'Giving users the ability to change their privacy/consent settings is a requirement under several privacy laws. Within your Termageddon account, if you selected (on page 1 of the Cookie Policy and Consent Tool questionnaire) to use the Privacy Settings hyperlink (instead of the \'fingerprint icon\'), you will see an additional script in the \'view embed code\' page that will need to be added to your website.</p> 392 <p>As an alternative to that additional script, you can simply use the [uc-privacysettings] shortcode, which will embed the privacy settings link. This is an easy way to add the Privacy Settings link within your global footer, for example. You can also pass in a text parameter to change the text of the link (for example, <code>[uc-privacysettings text="Change Privacy Settings"]</code>).', 393 ) 394 ); 395 396 // Privacy Settings Link Disable. 397 add_settings_field( 398 'termageddon_usercentrics_location_psl_hide', 399 __( 'Hide Privacy Settings Link when cookie consent tool is disabled', 'termageddon-usercentrics' ), 400 array( &$this, 'location_psl_disable_html' ), // function which prints the field. 401 'termageddon-usercentrics', // page slug. 402 'termageddon_usercentrics_section_settings', // section ID. 403 array( 404 'label_for' => 'termageddon_usercentrics_location_psl_hide', 405 'description' => __( 'When enabled, the Privacy Settings link will be hidden from certain users, whether that be certain logged in users (via your selections above in the “Hide widget for:” area) or if you enabled geolocation and are hiding the consent tool from certain visitors. For example, if you enable the option to hide the consent tool for logged in administrator (and enable this toggle), the Privacy Settings link will <strong>not</strong> show to logged in administrators. If you enable the option to hide the consent tool based on geolocation for certain users, the Privacy Settings link will no longer be displayed to those respective users as well.', 'termageddon-usercentrics' ), 406 ) 407 ); 408 409 register_setting( 410 'termageddon_usercentrics_settings', // settings group name. 411 'termageddon_usercentrics_location_psl_hide', // option name. 412 '' // sanitization function. 413 ); 414 415 // Privacy Settings Link Alternative Implementation. 416 add_settings_field( 417 'termageddon_usercentrics_psl_alternate', 418 __( 'Privacy Settings Link - Alternative Implementation', 'termageddon-usercentrics' ), 419 array( &$this, 'psl_alternate_implementation' ), // function which prints the field. 420 'termageddon-usercentrics', // page slug. 421 'termageddon_usercentrics_section_settings', // section ID. 422 array( 423 'label_for' => 'termageddon_usercentrics_psl_alternate', 424 'description' => __( 'For some theme builders including Divi, the footer (bottom bar) does not support shortcodes. If you are experiencing issues, use the following HTML code where you want to the privacy settings link to be instead of the shortcode and enable this option:', 'termageddon-usercentrics' ) . '<br><code><a id="usercentrics-psl">Privacy Settings</a></code>', 425 ) 426 ); 427 428 register_setting( 429 'termageddon_usercentrics_settings', // settings group name. 430 'termageddon_usercentrics_psl_alternate', // option name. 431 '' // sanitization function. 432 ); 433 434 // BREAK SECTION FOR GEOLOCATION SETTINGS. 435 $this->add_new_subsection( 436 'termageddon_usercentrics_section_settings', 437 array( 438 'name' => 'Integrations', 439 'description' => 'We love to partner with other plugin developers to improve support with their plugins. If you encounter an issue, please contact our support to let us know.', 440 ) 441 ); 442 443 // Presto Player. 388 444 add_settings_field( 389 445 'termageddon_usercentrics_integration_presto_player', 390 __( 'Presto Player', 'termageddon-usercentrics' ) .$this->mark_as_beta(),446 __( 'Presto Player', 'termageddon-usercentrics' ) . $this->mark_as_beta(), 391 447 array( &$this, 'presto_player_support' ), // function which prints the field. 392 448 'termageddon-usercentrics', // page slug. … … 516 572 ); 517 573 518 // BREAK SECTION FOR GEOLOCATION SETTINGS 519 $this->add_new_subsection('termageddon_usercentrics_section_geolocation', [ 520 'name' => 'Geo-Location Settings', 521 'description' => 'If you are experiencing issues or unexpected behavior, toggle the "Enable Location Logging" option. Please contact our support if you have any questions.', 522 ]); 574 // BREAK SECTION FOR GEOLOCATION SETTINGS. 575 $this->add_new_subsection( 576 'termageddon_usercentrics_section_geolocation', 577 array( 578 'name' => 'Geo-Location Settings', 579 'description' => 'If you are experiencing issues or unexpected behavior, toggle the "Enable Location Logging" option. Please contact our support if you have any questions.', 580 ) 581 ); 523 582 524 583 // Enable Geolocation Debug Mode. … … 542 601 ); 543 602 544 // Privacy Settings Link Disable.545 add_settings_field(546 'termageddon_usercentrics_location_psl_hide',547 __( 'Hide Privacy Settings Link when disabled', 'termageddon-usercentrics' ),548 array( &$this, 'location_psl_disable_html' ), // function which prints the field.549 'termageddon-usercentrics', // page slug.550 'termageddon_usercentrics_section_geolocation', // section ID.551 array(552 'label_for' => 'termageddon_usercentrics_location_psl_hide',553 'description' => __( 'When enabled, the privacy settings link will be hidden alongside the plugin if the visitor is outside of the geo-location marked above.', 'termageddon-usercentrics' ),554 )555 );556 557 register_setting(558 'termageddon_usercentrics_settings', // settings group name.559 'termageddon_usercentrics_location_psl_hide', // option name.560 '' // sanitization function.561 );562 603 // Enable Geolocation AJAX Mode. 563 604 add_settings_field( … … 652 693 // Options. 653 694 $default = ( isset( $args['default'] ) ? $args['default'] : false ); 654 $label = ( isset( $args['label'] ) ? $args['label'] : false);695 $label = ( isset( $args['label'] ) ? $args['label'] : '' ); 655 696 $tip = ( isset( $args['tip'] ) ? $args['tip'] : null ); 656 697 $description = ( isset( $args['description'] ) ? $args['description'] : null ); … … 659 700 $is_checked = get_option( $option_name, $default ) ? true : false; 660 701 661 echo '<input type="checkbox" class="termageddon-checkbox wppd-ui-toggle' . ( $label? ' label-' . esc_attr( $label ) : '' ) . '" id="' . esc_attr( $option_name ) . '" name="' . esc_attr( $option_name ) . '" value="1" ' . checked( 1, $is_checked, false ) . ' />';702 echo '<input type="checkbox" class="termageddon-checkbox wppd-ui-toggle' . ( ! empty( $label ) ? ' label-' . esc_attr( $label ) : '' ) . '" id="' . esc_attr( $option_name ) . '" name="' . esc_attr( $option_name ) . '" value="1" ' . checked( 1, $is_checked, false ) . ' />'; 662 703 663 704 if ( $tip ) { … … 665 706 } 666 707 if ( $description ) { 667 echo '<p>' . esc_html( $description ) . '</p>';708 echo '<p>' . wp_kses_post( $description ) . '</p>'; 668 709 } 669 710 … … 702 743 self::generate_checkbox( 'admin', 'disable', $args ); 703 744 } 704 745 705 746 /** 706 747 * The HTML field for the admin disable checkbox. … … 730 771 */ 731 772 public function location_psl_disable_html( array $args ) { 732 $args['default'] = true;733 773 self::generate_checkbox( 'psl_hide', 'location', $args ); 774 } 775 /** 776 * The HTML field for the psl hidden checkbox. 777 * 778 * @param array $args The arguments provided by the add_settings_field() method. 779 * @return void 780 */ 781 public function psl_alternate_implementation( array $args ) { 782 self::generate_checkbox( 'alternate', 'psl', $args ); 734 783 } 735 784 /** -
termageddon-usercentrics/tags/1.3.4/includes/class-termageddon-usercentrics.php
r2922465 r2931216 312 312 return $execution_time; 313 313 } 314 315 314 315 316 316 /** 317 317 * Generate a random string with specified paramaters 318 318 * 319 * @param int $length The length of string to generate.319 * @param int $length The length of string to generate. 320 320 * @param array $options The various options to pass in. 'type' is a valid option. 321 321 * @return string $randomString - The randomized string 322 322 */ 323 public static function generate_random_string( int $length=10, array $options=[]) {324 $type = ( isset($options['type']) ? $options['type'] : null);325 switch ( strtolower($type)) {323 public static function generate_random_string( int $length = 10, array $options = array() ) { 324 $type = ( isset( $options['type'] ) ? $options['type'] : null ); 325 switch ( strtolower( $type ) ) { 326 326 case 'letters': 327 327 $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; … … 335 335 } 336 336 337 // Generate String338 $characters Length = strlen($characters);339 $random String = '';340 for ( $i = 0; $i < $length; $i++) {341 $random String .= $characters[rand(0, $charactersLength - 1)];342 } 343 344 return $random String;337 // Generate String. 338 $characters_length = strlen( $characters ); 339 $random_string = ''; 340 for ( $i = 0; $i < $length; $i++ ) { 341 $random_string .= $characters[ wp_rand( 0, $characters_length - 1 ) ]; 342 } 343 344 return $random_string; 345 345 346 346 } … … 420 420 } 421 421 422 /** @return int */ 422 /** 423 * Return the integer count of database download errors. 424 * 425 * @return int */ 423 426 public static function count_download_errors(): int { 424 427 return (int) get_option( 'termageddon_usercentrics_download_error_count', 0 ); … … 426 429 427 430 428 /** @return array */ 431 /** 432 * Return a list of error logs generated by the download. 433 * 434 * @return array */ 429 435 public static function get_download_error_logs(): array { 430 436 return (array) array_filter( get_option( 'termageddon_usercentrics_download_error_log', array() ) ); … … 725 731 */ 726 732 public static function should_hide_psl() { 727 return ( get_option( 'termageddon_usercentrics_location_psl_hide', true ) ? true : false ); 733 return ( get_option( 'termageddon_usercentrics_location_psl_hide', false ) ? true : false ); 734 735 } 736 737 738 /** 739 * Returns whether debug mode is enabled via the query paramater 740 * 741 * @return bool 742 */ 743 public static function should_use_alternate_psl() { 744 return ( get_option( 'termageddon_usercentrics_psl_alternate', false ) ? true : false ); 728 745 729 746 } … … 736 753 */ 737 754 public static function debug( ...$msg ) { 738 if ( self::is_debug_mode_enabled() && ! wp_doing_ajax() ) { 739 // Display message on frontend. 740 // echo '<div class="error"><pre>' . wp_json_encode( $msg, JSON_PRETTY_PRINT ) . '</pre></div>';. 741 742 // Display message in browser console. 743 echo '<script> 744 console.log(\'TERMAGEDDON USERCENTRICS\', `' . wp_json_encode( $msg, JSON_PRETTY_PRINT ) . '`); 745 </script>'; 746 } 755 if ( ! self::is_debug_mode_enabled() ) { 756 return; // Check to ensure debug mode is enabled. 757 } 758 759 if ( wp_doing_ajax() ) { 760 return; // Check for Ajax. 761 } 762 763 if ( defined( 'WP_CLI' ) && WP_CLI ) { 764 return; // Check for CLI. 765 } 766 767 // Display message on frontend. 768 // echo '<div class="error"><pre>' . wp_json_encode( $msg, JSON_PRETTY_PRINT ) . '</pre></div>';. 769 770 // Display message in browser console. 771 echo '<script> 772 console.log(\'TERMAGEDDON USERCENTRICS\', `' . wp_json_encode( $msg, JSON_PRETTY_PRINT ) . '`); 773 </script>'; 747 774 } 748 775 … … 840 867 * 841 868 * @return string */ 842 public static function get_location_displayname() {869 public static function get_location_displayname(): string { 843 870 list('city' => $city, 'state' => $state, 'country' => $country) = self::lookup_ip_address(); 844 871 … … 854 881 * @return bool 855 882 */ 856 public static function is_geoip_enabled() {883 public static function is_geoip_enabled(): bool { 857 884 $show_in_eu = get_option( 'termageddon_usercentrics_show_in_eu', false ) ? true : false; 858 885 $show_in_uk = get_option( 'termageddon_usercentrics_show_in_uk', false ) ? true : false; … … 862 889 return ( $show_in_eu || $show_in_uk || $show_in_canada || $show_in_california || $show_in_virginia ); 863 890 } 864 865 /** Identifies if any geoip location is enabled. 866 * 891 892 893 /** 894 * Check if the given integration is enabled. 895 * 896 * @param string $integration The slug of the integration to check. 867 897 * @return bool 868 898 */ 869 public static function is_integration_enabled( string $int ){870 return get_option( 'termageddon_usercentrics_integration_' .$int, false ) ? true : false;899 public static function is_integration_enabled( string $integration ): bool { 900 return get_option( 'termageddon_usercentrics_integration_' . $integration, false ) ? true : false; 871 901 } 872 902 … … 875 905 * 876 906 * @return bool */ 877 public static function is_located_in_colorado() {907 public static function is_located_in_colorado(): bool { 878 908 list( 'state' => $state ) = self::lookup_ip_address(); 879 909 return ( null === $state || 'Colorado' === $state ); … … 885 915 * 886 916 * @return bool */ 887 public static function is_located_in_california() {917 public static function is_located_in_california(): bool { 888 918 list( 'state' => $state ) = self::lookup_ip_address(); 889 919 return ( null === $state || 'California' === $state ); … … 895 925 * 896 926 * @return bool */ 897 public static function is_located_in_virginia() {927 public static function is_located_in_virginia(): bool { 898 928 list( 'state' => $state ) = self::lookup_ip_address(); 899 929 return ( null === $state || 'Virginia' === $state ); … … 905 935 * 906 936 * @return bool */ 907 public static function is_located_in_canada() {937 public static function is_located_in_canada(): bool { 908 938 list( 'country' => $country ) = self::lookup_ip_address(); 909 939 return ( null === $country || 'Canada' === $country ); … … 915 945 * 916 946 * @return bool */ 917 public static function is_located_in_eu() {947 public static function is_located_in_eu(): bool { 918 948 list( 'country' => $country ) = self::lookup_ip_address(); 919 949 … … 959 989 * 960 990 * @return bool */ 961 public static function is_located_in_uk() {991 public static function is_located_in_uk(): bool { 962 992 list( 'country' => $country ) = self::lookup_ip_address(); 963 993 return ( null === $country || 'United Kingdom' === $country ); … … 970 1000 * 971 1001 * @return bool */ 972 public static function should_hide_due_to_location() {1002 public static function should_hide_due_to_location(): bool { 973 1003 $show_in_eu = get_option( 'termageddon_usercentrics_show_in_eu', false ) ? true : false; 974 1004 $show_in_uk = get_option( 'termageddon_usercentrics_show_in_uk', false ) ? true : false; … … 1021 1051 * 1022 1052 * @return bool */ 1023 public static function is_ajax_mode_enabled() {1053 public static function is_ajax_mode_enabled(): bool { 1024 1054 if ( ! self::is_geoip_enabled() ) { 1025 1055 return false; -
termageddon-usercentrics/tags/1.3.4/languages/termageddon-usercentrics.pot
r2890756 r2931216 4 4 "Project-Id-Version: Termageddon + Usercentrics\n" 5 5 "Report-Msgid-Bugs-To: \n" 6 "POT-Creation-Date: 2023-0 3-30 22:08+0000\n"6 "POT-Creation-Date: 2023-06-27 04:32+0000\n" 7 7 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 8 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 17 17 "X-Domain: termageddon-usercentrics" 18 18 19 #: admin/class-termageddon-usercentrics-admin.php: 29219 #: admin/class-termageddon-usercentrics-admin.php:335 20 20 msgid "Administrators" 21 21 msgstr "" … … 25 25 msgstr "" 26 26 27 #: admin/class-termageddon-usercentrics-admin.php: 42327 #: admin/class-termageddon-usercentrics-admin.php:541 28 28 msgid "California (CPRA)" 29 29 msgstr "" 30 30 31 #: admin/class-termageddon-usercentrics-admin.php: 40531 #: admin/class-termageddon-usercentrics-admin.php:523 32 32 msgid "Canada (PIPEDA)" 33 33 msgstr "" 34 34 35 35 #. section ID. 36 #: admin/class-termageddon-usercentrics-admin.php: 54436 #: admin/class-termageddon-usercentrics-admin.php:633 37 37 msgid "Control Panel" 38 38 msgstr "" 39 39 40 #: admin/class-termageddon-usercentrics-admin.php: 79640 #: admin/class-termageddon-usercentrics-admin.php:904 41 41 msgid "Cookie Policy and Consent Solution" 42 42 msgstr "" … … 52 52 msgstr "" 53 53 54 #: admin/class-termageddon-usercentrics-admin.php:3 1054 #: admin/class-termageddon-usercentrics-admin.php:353 55 55 msgid "Editors" 56 56 msgstr "" 57 57 58 58 #: admin/class-termageddon-usercentrics-admin.php:162 59 #: admin/class-termageddon-usercentrics-admin.php:2 5559 #: admin/class-termageddon-usercentrics-admin.php:298 60 60 msgid "Embed Code" 61 61 msgstr "" 62 62 63 #: admin/class-termageddon-usercentrics-admin.php: 47963 #: admin/class-termageddon-usercentrics-admin.php:586 64 64 msgid "Enable location logging" 65 65 msgstr "" 66 66 67 #: admin/class-termageddon-usercentrics-admin.php: 51767 #: admin/class-termageddon-usercentrics-admin.php:606 68 68 msgid "Enable page caching support via AJAX" 69 69 msgstr "" 70 70 71 #: admin/class-termageddon-usercentrics-admin.php: 55871 #: admin/class-termageddon-usercentrics-admin.php:647 72 72 msgid "Error Count" 73 73 msgstr "" … … 77 77 msgstr "" 78 78 79 #: admin/class-termageddon-usercentrics-admin.php: 57679 #: admin/class-termageddon-usercentrics-admin.php:665 80 80 msgid "Error List" 81 81 msgstr "" 82 82 83 #: admin/class-termageddon-usercentrics-admin.php: 36983 #: admin/class-termageddon-usercentrics-admin.php:487 84 84 msgid "European Union & European Economic Area (GDPR)" 85 85 msgstr "" … … 89 89 msgstr "" 90 90 91 #: admin/class-termageddon-usercentrics-admin.php:424 92 msgid "" 93 "For some theme builders including Divi, the footer (bottom bar) does not " 94 "support shortcodes. If you are experiencing issues, use the following HTML " 95 "code where you want to the privacy settings link to be instead of the " 96 "shortcode and enable this option:" 97 msgstr "" 98 91 99 #. section ID. 92 100 #: admin/class-termageddon-usercentrics-admin.php:164 93 #: admin/class-termageddon-usercentrics-admin.php: 355101 #: admin/class-termageddon-usercentrics-admin.php:473 94 102 msgid "Geo-Location" 95 103 msgstr "" … … 119 127 msgstr "" 120 128 121 #: admin/class-termageddon-usercentrics-admin.php: 499122 msgid "Hide Privacy Settings Link when disabled"129 #: admin/class-termageddon-usercentrics-admin.php:399 130 msgid "Hide Privacy Settings Link when cookie consent tool is disabled" 123 131 msgstr "" 124 132 … … 127 135 msgstr "" 128 136 129 #: admin/class-termageddon-usercentrics-admin.php:463 130 msgid "" 131 "If you are experiencing issues or unexpected behavior, toggle the \"Enable " 132 "Location Logging\" option. Please contact our support if you have any " 133 "questions." 134 msgstr "" 135 136 #: admin/class-termageddon-usercentrics-admin.php:814 137 #: admin/class-termageddon-usercentrics-admin.php:922 137 138 msgid "If you are using the Divi theme" 138 139 msgstr "" 139 140 140 #: admin/class-termageddon-usercentrics-admin.php: 813141 #: admin/class-termageddon-usercentrics-admin.php:921 141 142 msgid "" 142 143 "If you would like to remove Usercentrics for logged in users such as admins, " … … 152 153 msgstr "" 153 154 154 #: admin/class-termageddon-usercentrics-admin.php:3 28155 #: admin/class-termageddon-usercentrics-admin.php:371 155 156 msgid "Logged-in Users" 156 157 msgstr "" 157 158 159 #: admin/class-termageddon-usercentrics-admin.php:446 160 msgid "Presto Player" 161 msgstr "" 162 163 #: admin/class-termageddon-usercentrics-admin.php:418 164 msgid "Privacy Settings Link - Alternative Implementation" 165 msgstr "" 166 158 167 #. section ID. 159 #: includes/class-termageddon-usercentrics.php:3 44168 #: includes/class-termageddon-usercentrics.php:378 160 169 #: admin/class-termageddon-usercentrics-admin.php:163 161 #: admin/class-termageddon-usercentrics-admin.php: 283170 #: admin/class-termageddon-usercentrics-admin.php:326 162 171 msgid "Settings" 163 172 msgstr "" … … 178 187 msgstr "" 179 188 180 #: admin/class-termageddon-usercentrics-admin.php: 850189 #: admin/class-termageddon-usercentrics-admin.php:958 181 190 msgid "" 182 191 "To reset any of the backend variables, update the values below and save your " … … 184 193 msgstr "" 185 194 186 #: admin/class-termageddon-usercentrics-admin.php: 387195 #: admin/class-termageddon-usercentrics-admin.php:505 187 196 msgid "United Kingdom (UK DPA)" 188 197 msgstr "" 189 198 190 #: admin/class-termageddon-usercentrics-admin.php: 795199 #: admin/class-termageddon-usercentrics-admin.php:903 191 200 msgid "Upon generating your " 192 201 msgstr "" 193 202 194 #: admin/class-termageddon-usercentrics-admin.php: 781203 #: admin/class-termageddon-usercentrics-admin.php:889 195 204 msgid "Upon saving, all previous errors in the log will be deleted." 196 205 msgstr "" 197 206 198 #: admin/class-termageddon-usercentrics-admin.php: 441207 #: admin/class-termageddon-usercentrics-admin.php:559 199 208 msgid "Virginia (VCDPA)" 200 209 msgstr "" … … 207 216 msgstr "" 208 217 209 #: admin/class-termageddon-usercentrics-admin.php:505 210 msgid "" 211 "When enabled, the privacy settings link will be hidden alongside the plugin " 212 "if the visitor is outside of the geo-location marked above." 213 msgstr "" 214 215 #: admin/class-termageddon-usercentrics-admin.php:485 218 #: admin/class-termageddon-usercentrics-admin.php:405 219 msgid "" 220 "When enabled, the Privacy Settings link will be hidden from certain users, " 221 "whether that be certain logged in users (via your selections above in the " 222 "“Hide widget for:” area) or if you enabled geolocation and are hiding the " 223 "consent tool from certain visitors. For example, if you enable the option to " 224 "hide the consent tool for logged in administrator (and enable this toggle), " 225 "the Privacy Settings link will <strong>not</strong> show to logged in " 226 "administrators. If you enable the option to hide the consent tool based on " 227 "geolocation for certain users, the Privacy Settings link will no longer be " 228 "displayed to those respective users as well." 229 msgstr "" 230 231 #: admin/class-termageddon-usercentrics-admin.php:592 216 232 msgid "" 217 233 "When enabled, the visitor's location can be viewed in the browser console, " … … 219 235 msgstr "" 220 236 221 #: admin/class-termageddon-usercentrics-admin.php: 523237 #: admin/class-termageddon-usercentrics-admin.php:612 222 238 msgid "" 223 239 "When enabled, the visitor's location is checked via javascript to allow " … … 225 241 msgstr "" 226 242 227 #: admin/class-termageddon-usercentrics-admin.php: 832243 #: admin/class-termageddon-usercentrics-admin.php:940 228 244 msgid "" 229 245 "When enabled, you will be collecting IP addresses for the purposes of " … … 241 257 msgstr "" 242 258 243 #: admin/class-termageddon-usercentrics-admin.php: 797259 #: admin/class-termageddon-usercentrics-admin.php:905 244 260 msgid "" 245 261 "within your Termageddon account, you will be brought to the \"View embed " … … 248 264 msgstr "" 249 265 250 #: admin/class-termageddon-usercentrics-admin.php: 815266 #: admin/class-termageddon-usercentrics-admin.php:923 251 267 msgid "" 252 268 "you will need to enable at least one of the settings below to ensure logged " -
termageddon-usercentrics/tags/1.3.4/public/class-termageddon-usercentrics-public.php
r2922465 r2931216 112 112 ); 113 113 } 114 115 // Load Alternate PSL Logic. 116 if ( Termageddon_Usercentrics::should_use_alternate_psl() ) { 117 add_action( 'wp_footer', array( $this, 'replace_usercentrics_psl_with_shortcode' ) ); 118 } 114 119 } 115 120 … … 134 139 echo wp_kses( $script, self::ALLOWED_HTML ); 135 140 echo '<!-- END TERMAGEDDON + USERCENTRICS -->'; 141 } 142 143 144 /** 145 * Action to allow replacing a broken psl with the fully functional psl. 146 * 147 * @return void */ 148 public function replace_usercentrics_psl_with_shortcode() { 149 ob_start(); 150 ?> 151 <script id="termageddon-psl-alternate-js"> 152 (function($) { 153 $(document).ready(function() { 154 jQuery('a#usercentrics-psl').each(function() { 155 let newElem = jQuery(`<?php echo do_shortcode( '[uc-privacysettings]' ); ?>`); 156 if (!["","Privacy Settings"].includes(jQuery(this).text())) newElem.text(jQuery(this).text()) 157 jQuery(this).replaceWith(newElem); 158 }) 159 }) 160 })(jQuery); 161 </script> 162 <?php 163 ob_end_flush(); 136 164 } 137 165 … … 195 223 </script>'; 196 224 } 197 225 198 226 // Presto Player Integration Javascript. 199 if ( Termageddon_Usercentrics::is_integration_enabled( 'presto_player') ) {227 if ( Termageddon_Usercentrics::is_integration_enabled( 'presto_player' ) ) { 200 228 $script .= '<script type="application/javascript" id="uc-integration-presto-player"> 201 229 function uc_integration_setup(iID,service) { -
termageddon-usercentrics/tags/1.3.4/termageddon-usercentrics.php
r2922465 r2931216 15 15 * Plugin Name: Termageddon + Usercentrics 16 16 * Description: Easily integrate the Usercentrics consent solution into your website while controlling visibility for logged in users and admins. 17 * Version: 1.3. 317 * Version: 1.3.4 18 18 * Author: Termageddon 19 19 * Author URI: https://termageddon.com … … 34 34 * Rename this for your plugin and update it as you release new versions. 35 35 */ 36 define( 'TERMAGEDDON_COOKIE_VERSION', '1.3. 3' );36 define( 'TERMAGEDDON_COOKIE_VERSION', '1.3.4' ); 37 37 38 38 define( 'TERMAGEDDON_COOKIE_PLUGIN_PATH', dirname( __FILE__ ) );// No trailing slash. -
termageddon-usercentrics/trunk/README.txt
r2922465 r2931216 5 5 Requires at least: 3.0.1 6 6 Tested up to: 6.2.2 7 Stable tag: 1.3. 37 Stable tag: 1.3.4 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 26 26 27 27 == Changelog == 28 29 = 1.3.4 = 30 31 - [ADD] Added alternate privacy settings link embed as an alternative for shortcodes (Divi Support). 32 - [ADD] Added settings section to showcase privacy settings link settings. 33 - [CHANGE] Moved Hide Privacy Settings Link option to Settings page instead of geolocation page. 34 - [FIX] Improved handling for WP_CLI actions and error logging. 28 35 29 36 = 1.3.3 = -
termageddon-usercentrics/trunk/admin/class-termageddon-usercentrics-admin.php
r2922465 r2931216 213 213 214 214 return array( 215 'before_section' => '<div class="tu-settings-tab tu-tab-' . $tab . ( $tab_active ? '' : ' tu-section-hidden' ) . '" >', // Start a new tab 215 'before_section' => '<div class="tu-settings-tab tu-tab-' . $tab . ( $tab_active ? '' : ' tu-section-hidden' ) . '" >', // Start a new tab. 216 216 'after_section' => '</div></div> 217 217 </div>', // Finish the additional sections setup in the html callbacks (2) and then finish the tab for a total of 3 divs. … … 220 220 221 221 222 /** Build the default arguments for the current section 223 * 224 * @param mixed $tab The tab you are setting up; For use with identifying current tab and hiding/showing the tab. 225 * @return string[] 226 */ 227 public function add_new_subsection( string $section, array $options=[]) { 228 229 $name = (isset($options['name']) ? $options['name'] : false); 230 $description = (isset($options['description']) ? $options['description'] : false); 231 $indent = (isset($options['indent']) ? $options['indent'] === true : false); 232 $slim = (isset($options['slim']) ? $options['slim'] === true : false); 233 234 add_settings_field( 235 'termageddon_usercentrics_end-section-'.Termageddon_Usercentrics::generate_random_string(5), 222 /** 223 * Generate and appends the HTML for a new subsection based on options provided. 224 * 225 * @param string $section The section slug to add the section to. 226 * @param array $options name, description, indent, slim; Various options. 227 * @return void 228 */ 229 public function add_new_subsection( string $section, array $options = array() ) { 230 231 $name = ( isset( $options['name'] ) ? $options['name'] : false ); 232 $description = ( isset( $options['description'] ) ? $options['description'] : false ); 233 $indent = ( isset( $options['indent'] ) ? true === $options['indent'] : false ); 234 $slim = ( isset( $options['slim'] ) ? true === $options['slim'] : false ); 235 236 add_settings_field( 237 'termageddon_usercentrics_end-section-' . Termageddon_Usercentrics::generate_random_string( 5 ), 236 238 ' </th></tr></tbody></table> 237 239 </div> 238 240 <div class="tu-toggle-section"> 239 <span class="tu-section-title">' . esc_html __( $name , 'termageddon-usercentrics') . ':</span>240 ' .(empty($description) ? '' : '<p>' . esc_html__( $description, 'termageddon-usercentrics' ) . '</p>').'241 <span class="tu-section-title">' . esc_html( $name ) . ':</span> 242 ' . ( empty( $description ) ? '' : '<p>' . wp_kses_post( $description ) . '</p>' ) . ' 241 243 </div> 242 <div class="' .($indent ? 'tu-toggle-section' : 'tu-settings-section').($slim ? ' slim-section' : '').'">244 <div class="' . ( $indent ? 'tu-toggle-section' : 'tu-settings-section' ) . ( $slim ? ' slim-section' : '' ) . '"> 243 245 <table class="form-table" role="presentation"> 244 246 <tbody> … … 253 255 254 256 257 /** Generates and appends the beta label for a field. 258 * 259 * @return string */ 255 260 public static function mark_as_beta() { 256 261 return ' <span class="tu-label-warning">BETA</span>'; … … 379 384 ); 380 385 381 // BREAK SECTION FOR GEOLOCATION SETTINGS 382 $this->add_new_subsection('termageddon_usercentrics_section_settings', [ 383 'name' => 'Integrations', 384 'description' => 'We love to partner with other plugin developers to improve support with their plugins. If you encounter an issue, please contact our support to let us know.', 385 ]); 386 387 // Disable Login. 386 // BREAK SECTION FOR GEOLOCATION SETTINGS. 387 $this->add_new_subsection( 388 'termageddon_usercentrics_section_settings', 389 array( 390 'name' => 'Privacy Settings Link', 391 'description' => 'Giving users the ability to change their privacy/consent settings is a requirement under several privacy laws. Within your Termageddon account, if you selected (on page 1 of the Cookie Policy and Consent Tool questionnaire) to use the Privacy Settings hyperlink (instead of the \'fingerprint icon\'), you will see an additional script in the \'view embed code\' page that will need to be added to your website.</p> 392 <p>As an alternative to that additional script, you can simply use the [uc-privacysettings] shortcode, which will embed the privacy settings link. This is an easy way to add the Privacy Settings link within your global footer, for example. You can also pass in a text parameter to change the text of the link (for example, <code>[uc-privacysettings text="Change Privacy Settings"]</code>).', 393 ) 394 ); 395 396 // Privacy Settings Link Disable. 397 add_settings_field( 398 'termageddon_usercentrics_location_psl_hide', 399 __( 'Hide Privacy Settings Link when cookie consent tool is disabled', 'termageddon-usercentrics' ), 400 array( &$this, 'location_psl_disable_html' ), // function which prints the field. 401 'termageddon-usercentrics', // page slug. 402 'termageddon_usercentrics_section_settings', // section ID. 403 array( 404 'label_for' => 'termageddon_usercentrics_location_psl_hide', 405 'description' => __( 'When enabled, the Privacy Settings link will be hidden from certain users, whether that be certain logged in users (via your selections above in the “Hide widget for:” area) or if you enabled geolocation and are hiding the consent tool from certain visitors. For example, if you enable the option to hide the consent tool for logged in administrator (and enable this toggle), the Privacy Settings link will <strong>not</strong> show to logged in administrators. If you enable the option to hide the consent tool based on geolocation for certain users, the Privacy Settings link will no longer be displayed to those respective users as well.', 'termageddon-usercentrics' ), 406 ) 407 ); 408 409 register_setting( 410 'termageddon_usercentrics_settings', // settings group name. 411 'termageddon_usercentrics_location_psl_hide', // option name. 412 '' // sanitization function. 413 ); 414 415 // Privacy Settings Link Alternative Implementation. 416 add_settings_field( 417 'termageddon_usercentrics_psl_alternate', 418 __( 'Privacy Settings Link - Alternative Implementation', 'termageddon-usercentrics' ), 419 array( &$this, 'psl_alternate_implementation' ), // function which prints the field. 420 'termageddon-usercentrics', // page slug. 421 'termageddon_usercentrics_section_settings', // section ID. 422 array( 423 'label_for' => 'termageddon_usercentrics_psl_alternate', 424 'description' => __( 'For some theme builders including Divi, the footer (bottom bar) does not support shortcodes. If you are experiencing issues, use the following HTML code where you want to the privacy settings link to be instead of the shortcode and enable this option:', 'termageddon-usercentrics' ) . '<br><code><a id="usercentrics-psl">Privacy Settings</a></code>', 425 ) 426 ); 427 428 register_setting( 429 'termageddon_usercentrics_settings', // settings group name. 430 'termageddon_usercentrics_psl_alternate', // option name. 431 '' // sanitization function. 432 ); 433 434 // BREAK SECTION FOR GEOLOCATION SETTINGS. 435 $this->add_new_subsection( 436 'termageddon_usercentrics_section_settings', 437 array( 438 'name' => 'Integrations', 439 'description' => 'We love to partner with other plugin developers to improve support with their plugins. If you encounter an issue, please contact our support to let us know.', 440 ) 441 ); 442 443 // Presto Player. 388 444 add_settings_field( 389 445 'termageddon_usercentrics_integration_presto_player', 390 __( 'Presto Player', 'termageddon-usercentrics' ) .$this->mark_as_beta(),446 __( 'Presto Player', 'termageddon-usercentrics' ) . $this->mark_as_beta(), 391 447 array( &$this, 'presto_player_support' ), // function which prints the field. 392 448 'termageddon-usercentrics', // page slug. … … 516 572 ); 517 573 518 // BREAK SECTION FOR GEOLOCATION SETTINGS 519 $this->add_new_subsection('termageddon_usercentrics_section_geolocation', [ 520 'name' => 'Geo-Location Settings', 521 'description' => 'If you are experiencing issues or unexpected behavior, toggle the "Enable Location Logging" option. Please contact our support if you have any questions.', 522 ]); 574 // BREAK SECTION FOR GEOLOCATION SETTINGS. 575 $this->add_new_subsection( 576 'termageddon_usercentrics_section_geolocation', 577 array( 578 'name' => 'Geo-Location Settings', 579 'description' => 'If you are experiencing issues or unexpected behavior, toggle the "Enable Location Logging" option. Please contact our support if you have any questions.', 580 ) 581 ); 523 582 524 583 // Enable Geolocation Debug Mode. … … 542 601 ); 543 602 544 // Privacy Settings Link Disable.545 add_settings_field(546 'termageddon_usercentrics_location_psl_hide',547 __( 'Hide Privacy Settings Link when disabled', 'termageddon-usercentrics' ),548 array( &$this, 'location_psl_disable_html' ), // function which prints the field.549 'termageddon-usercentrics', // page slug.550 'termageddon_usercentrics_section_geolocation', // section ID.551 array(552 'label_for' => 'termageddon_usercentrics_location_psl_hide',553 'description' => __( 'When enabled, the privacy settings link will be hidden alongside the plugin if the visitor is outside of the geo-location marked above.', 'termageddon-usercentrics' ),554 )555 );556 557 register_setting(558 'termageddon_usercentrics_settings', // settings group name.559 'termageddon_usercentrics_location_psl_hide', // option name.560 '' // sanitization function.561 );562 603 // Enable Geolocation AJAX Mode. 563 604 add_settings_field( … … 652 693 // Options. 653 694 $default = ( isset( $args['default'] ) ? $args['default'] : false ); 654 $label = ( isset( $args['label'] ) ? $args['label'] : false);695 $label = ( isset( $args['label'] ) ? $args['label'] : '' ); 655 696 $tip = ( isset( $args['tip'] ) ? $args['tip'] : null ); 656 697 $description = ( isset( $args['description'] ) ? $args['description'] : null ); … … 659 700 $is_checked = get_option( $option_name, $default ) ? true : false; 660 701 661 echo '<input type="checkbox" class="termageddon-checkbox wppd-ui-toggle' . ( $label? ' label-' . esc_attr( $label ) : '' ) . '" id="' . esc_attr( $option_name ) . '" name="' . esc_attr( $option_name ) . '" value="1" ' . checked( 1, $is_checked, false ) . ' />';702 echo '<input type="checkbox" class="termageddon-checkbox wppd-ui-toggle' . ( ! empty( $label ) ? ' label-' . esc_attr( $label ) : '' ) . '" id="' . esc_attr( $option_name ) . '" name="' . esc_attr( $option_name ) . '" value="1" ' . checked( 1, $is_checked, false ) . ' />'; 662 703 663 704 if ( $tip ) { … … 665 706 } 666 707 if ( $description ) { 667 echo '<p>' . esc_html( $description ) . '</p>';708 echo '<p>' . wp_kses_post( $description ) . '</p>'; 668 709 } 669 710 … … 702 743 self::generate_checkbox( 'admin', 'disable', $args ); 703 744 } 704 745 705 746 /** 706 747 * The HTML field for the admin disable checkbox. … … 730 771 */ 731 772 public function location_psl_disable_html( array $args ) { 732 $args['default'] = true;733 773 self::generate_checkbox( 'psl_hide', 'location', $args ); 774 } 775 /** 776 * The HTML field for the psl hidden checkbox. 777 * 778 * @param array $args The arguments provided by the add_settings_field() method. 779 * @return void 780 */ 781 public function psl_alternate_implementation( array $args ) { 782 self::generate_checkbox( 'alternate', 'psl', $args ); 734 783 } 735 784 /** -
termageddon-usercentrics/trunk/includes/class-termageddon-usercentrics.php
r2922465 r2931216 312 312 return $execution_time; 313 313 } 314 315 314 315 316 316 /** 317 317 * Generate a random string with specified paramaters 318 318 * 319 * @param int $length The length of string to generate.319 * @param int $length The length of string to generate. 320 320 * @param array $options The various options to pass in. 'type' is a valid option. 321 321 * @return string $randomString - The randomized string 322 322 */ 323 public static function generate_random_string( int $length=10, array $options=[]) {324 $type = ( isset($options['type']) ? $options['type'] : null);325 switch ( strtolower($type)) {323 public static function generate_random_string( int $length = 10, array $options = array() ) { 324 $type = ( isset( $options['type'] ) ? $options['type'] : null ); 325 switch ( strtolower( $type ) ) { 326 326 case 'letters': 327 327 $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; … … 335 335 } 336 336 337 // Generate String338 $characters Length = strlen($characters);339 $random String = '';340 for ( $i = 0; $i < $length; $i++) {341 $random String .= $characters[rand(0, $charactersLength - 1)];342 } 343 344 return $random String;337 // Generate String. 338 $characters_length = strlen( $characters ); 339 $random_string = ''; 340 for ( $i = 0; $i < $length; $i++ ) { 341 $random_string .= $characters[ wp_rand( 0, $characters_length - 1 ) ]; 342 } 343 344 return $random_string; 345 345 346 346 } … … 420 420 } 421 421 422 /** @return int */ 422 /** 423 * Return the integer count of database download errors. 424 * 425 * @return int */ 423 426 public static function count_download_errors(): int { 424 427 return (int) get_option( 'termageddon_usercentrics_download_error_count', 0 ); … … 426 429 427 430 428 /** @return array */ 431 /** 432 * Return a list of error logs generated by the download. 433 * 434 * @return array */ 429 435 public static function get_download_error_logs(): array { 430 436 return (array) array_filter( get_option( 'termageddon_usercentrics_download_error_log', array() ) ); … … 725 731 */ 726 732 public static function should_hide_psl() { 727 return ( get_option( 'termageddon_usercentrics_location_psl_hide', true ) ? true : false ); 733 return ( get_option( 'termageddon_usercentrics_location_psl_hide', false ) ? true : false ); 734 735 } 736 737 738 /** 739 * Returns whether debug mode is enabled via the query paramater 740 * 741 * @return bool 742 */ 743 public static function should_use_alternate_psl() { 744 return ( get_option( 'termageddon_usercentrics_psl_alternate', false ) ? true : false ); 728 745 729 746 } … … 736 753 */ 737 754 public static function debug( ...$msg ) { 738 if ( self::is_debug_mode_enabled() && ! wp_doing_ajax() ) { 739 // Display message on frontend. 740 // echo '<div class="error"><pre>' . wp_json_encode( $msg, JSON_PRETTY_PRINT ) . '</pre></div>';. 741 742 // Display message in browser console. 743 echo '<script> 744 console.log(\'TERMAGEDDON USERCENTRICS\', `' . wp_json_encode( $msg, JSON_PRETTY_PRINT ) . '`); 745 </script>'; 746 } 755 if ( ! self::is_debug_mode_enabled() ) { 756 return; // Check to ensure debug mode is enabled. 757 } 758 759 if ( wp_doing_ajax() ) { 760 return; // Check for Ajax. 761 } 762 763 if ( defined( 'WP_CLI' ) && WP_CLI ) { 764 return; // Check for CLI. 765 } 766 767 // Display message on frontend. 768 // echo '<div class="error"><pre>' . wp_json_encode( $msg, JSON_PRETTY_PRINT ) . '</pre></div>';. 769 770 // Display message in browser console. 771 echo '<script> 772 console.log(\'TERMAGEDDON USERCENTRICS\', `' . wp_json_encode( $msg, JSON_PRETTY_PRINT ) . '`); 773 </script>'; 747 774 } 748 775 … … 840 867 * 841 868 * @return string */ 842 public static function get_location_displayname() {869 public static function get_location_displayname(): string { 843 870 list('city' => $city, 'state' => $state, 'country' => $country) = self::lookup_ip_address(); 844 871 … … 854 881 * @return bool 855 882 */ 856 public static function is_geoip_enabled() {883 public static function is_geoip_enabled(): bool { 857 884 $show_in_eu = get_option( 'termageddon_usercentrics_show_in_eu', false ) ? true : false; 858 885 $show_in_uk = get_option( 'termageddon_usercentrics_show_in_uk', false ) ? true : false; … … 862 889 return ( $show_in_eu || $show_in_uk || $show_in_canada || $show_in_california || $show_in_virginia ); 863 890 } 864 865 /** Identifies if any geoip location is enabled. 866 * 891 892 893 /** 894 * Check if the given integration is enabled. 895 * 896 * @param string $integration The slug of the integration to check. 867 897 * @return bool 868 898 */ 869 public static function is_integration_enabled( string $int ){870 return get_option( 'termageddon_usercentrics_integration_' .$int, false ) ? true : false;899 public static function is_integration_enabled( string $integration ): bool { 900 return get_option( 'termageddon_usercentrics_integration_' . $integration, false ) ? true : false; 871 901 } 872 902 … … 875 905 * 876 906 * @return bool */ 877 public static function is_located_in_colorado() {907 public static function is_located_in_colorado(): bool { 878 908 list( 'state' => $state ) = self::lookup_ip_address(); 879 909 return ( null === $state || 'Colorado' === $state ); … … 885 915 * 886 916 * @return bool */ 887 public static function is_located_in_california() {917 public static function is_located_in_california(): bool { 888 918 list( 'state' => $state ) = self::lookup_ip_address(); 889 919 return ( null === $state || 'California' === $state ); … … 895 925 * 896 926 * @return bool */ 897 public static function is_located_in_virginia() {927 public static function is_located_in_virginia(): bool { 898 928 list( 'state' => $state ) = self::lookup_ip_address(); 899 929 return ( null === $state || 'Virginia' === $state ); … … 905 935 * 906 936 * @return bool */ 907 public static function is_located_in_canada() {937 public static function is_located_in_canada(): bool { 908 938 list( 'country' => $country ) = self::lookup_ip_address(); 909 939 return ( null === $country || 'Canada' === $country ); … … 915 945 * 916 946 * @return bool */ 917 public static function is_located_in_eu() {947 public static function is_located_in_eu(): bool { 918 948 list( 'country' => $country ) = self::lookup_ip_address(); 919 949 … … 959 989 * 960 990 * @return bool */ 961 public static function is_located_in_uk() {991 public static function is_located_in_uk(): bool { 962 992 list( 'country' => $country ) = self::lookup_ip_address(); 963 993 return ( null === $country || 'United Kingdom' === $country ); … … 970 1000 * 971 1001 * @return bool */ 972 public static function should_hide_due_to_location() {1002 public static function should_hide_due_to_location(): bool { 973 1003 $show_in_eu = get_option( 'termageddon_usercentrics_show_in_eu', false ) ? true : false; 974 1004 $show_in_uk = get_option( 'termageddon_usercentrics_show_in_uk', false ) ? true : false; … … 1021 1051 * 1022 1052 * @return bool */ 1023 public static function is_ajax_mode_enabled() {1053 public static function is_ajax_mode_enabled(): bool { 1024 1054 if ( ! self::is_geoip_enabled() ) { 1025 1055 return false; -
termageddon-usercentrics/trunk/languages/termageddon-usercentrics.pot
r2890756 r2931216 4 4 "Project-Id-Version: Termageddon + Usercentrics\n" 5 5 "Report-Msgid-Bugs-To: \n" 6 "POT-Creation-Date: 2023-0 3-30 22:08+0000\n"6 "POT-Creation-Date: 2023-06-27 04:32+0000\n" 7 7 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 8 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 17 17 "X-Domain: termageddon-usercentrics" 18 18 19 #: admin/class-termageddon-usercentrics-admin.php: 29219 #: admin/class-termageddon-usercentrics-admin.php:335 20 20 msgid "Administrators" 21 21 msgstr "" … … 25 25 msgstr "" 26 26 27 #: admin/class-termageddon-usercentrics-admin.php: 42327 #: admin/class-termageddon-usercentrics-admin.php:541 28 28 msgid "California (CPRA)" 29 29 msgstr "" 30 30 31 #: admin/class-termageddon-usercentrics-admin.php: 40531 #: admin/class-termageddon-usercentrics-admin.php:523 32 32 msgid "Canada (PIPEDA)" 33 33 msgstr "" 34 34 35 35 #. section ID. 36 #: admin/class-termageddon-usercentrics-admin.php: 54436 #: admin/class-termageddon-usercentrics-admin.php:633 37 37 msgid "Control Panel" 38 38 msgstr "" 39 39 40 #: admin/class-termageddon-usercentrics-admin.php: 79640 #: admin/class-termageddon-usercentrics-admin.php:904 41 41 msgid "Cookie Policy and Consent Solution" 42 42 msgstr "" … … 52 52 msgstr "" 53 53 54 #: admin/class-termageddon-usercentrics-admin.php:3 1054 #: admin/class-termageddon-usercentrics-admin.php:353 55 55 msgid "Editors" 56 56 msgstr "" 57 57 58 58 #: admin/class-termageddon-usercentrics-admin.php:162 59 #: admin/class-termageddon-usercentrics-admin.php:2 5559 #: admin/class-termageddon-usercentrics-admin.php:298 60 60 msgid "Embed Code" 61 61 msgstr "" 62 62 63 #: admin/class-termageddon-usercentrics-admin.php: 47963 #: admin/class-termageddon-usercentrics-admin.php:586 64 64 msgid "Enable location logging" 65 65 msgstr "" 66 66 67 #: admin/class-termageddon-usercentrics-admin.php: 51767 #: admin/class-termageddon-usercentrics-admin.php:606 68 68 msgid "Enable page caching support via AJAX" 69 69 msgstr "" 70 70 71 #: admin/class-termageddon-usercentrics-admin.php: 55871 #: admin/class-termageddon-usercentrics-admin.php:647 72 72 msgid "Error Count" 73 73 msgstr "" … … 77 77 msgstr "" 78 78 79 #: admin/class-termageddon-usercentrics-admin.php: 57679 #: admin/class-termageddon-usercentrics-admin.php:665 80 80 msgid "Error List" 81 81 msgstr "" 82 82 83 #: admin/class-termageddon-usercentrics-admin.php: 36983 #: admin/class-termageddon-usercentrics-admin.php:487 84 84 msgid "European Union & European Economic Area (GDPR)" 85 85 msgstr "" … … 89 89 msgstr "" 90 90 91 #: admin/class-termageddon-usercentrics-admin.php:424 92 msgid "" 93 "For some theme builders including Divi, the footer (bottom bar) does not " 94 "support shortcodes. If you are experiencing issues, use the following HTML " 95 "code where you want to the privacy settings link to be instead of the " 96 "shortcode and enable this option:" 97 msgstr "" 98 91 99 #. section ID. 92 100 #: admin/class-termageddon-usercentrics-admin.php:164 93 #: admin/class-termageddon-usercentrics-admin.php: 355101 #: admin/class-termageddon-usercentrics-admin.php:473 94 102 msgid "Geo-Location" 95 103 msgstr "" … … 119 127 msgstr "" 120 128 121 #: admin/class-termageddon-usercentrics-admin.php: 499122 msgid "Hide Privacy Settings Link when disabled"129 #: admin/class-termageddon-usercentrics-admin.php:399 130 msgid "Hide Privacy Settings Link when cookie consent tool is disabled" 123 131 msgstr "" 124 132 … … 127 135 msgstr "" 128 136 129 #: admin/class-termageddon-usercentrics-admin.php:463 130 msgid "" 131 "If you are experiencing issues or unexpected behavior, toggle the \"Enable " 132 "Location Logging\" option. Please contact our support if you have any " 133 "questions." 134 msgstr "" 135 136 #: admin/class-termageddon-usercentrics-admin.php:814 137 #: admin/class-termageddon-usercentrics-admin.php:922 137 138 msgid "If you are using the Divi theme" 138 139 msgstr "" 139 140 140 #: admin/class-termageddon-usercentrics-admin.php: 813141 #: admin/class-termageddon-usercentrics-admin.php:921 141 142 msgid "" 142 143 "If you would like to remove Usercentrics for logged in users such as admins, " … … 152 153 msgstr "" 153 154 154 #: admin/class-termageddon-usercentrics-admin.php:3 28155 #: admin/class-termageddon-usercentrics-admin.php:371 155 156 msgid "Logged-in Users" 156 157 msgstr "" 157 158 159 #: admin/class-termageddon-usercentrics-admin.php:446 160 msgid "Presto Player" 161 msgstr "" 162 163 #: admin/class-termageddon-usercentrics-admin.php:418 164 msgid "Privacy Settings Link - Alternative Implementation" 165 msgstr "" 166 158 167 #. section ID. 159 #: includes/class-termageddon-usercentrics.php:3 44168 #: includes/class-termageddon-usercentrics.php:378 160 169 #: admin/class-termageddon-usercentrics-admin.php:163 161 #: admin/class-termageddon-usercentrics-admin.php: 283170 #: admin/class-termageddon-usercentrics-admin.php:326 162 171 msgid "Settings" 163 172 msgstr "" … … 178 187 msgstr "" 179 188 180 #: admin/class-termageddon-usercentrics-admin.php: 850189 #: admin/class-termageddon-usercentrics-admin.php:958 181 190 msgid "" 182 191 "To reset any of the backend variables, update the values below and save your " … … 184 193 msgstr "" 185 194 186 #: admin/class-termageddon-usercentrics-admin.php: 387195 #: admin/class-termageddon-usercentrics-admin.php:505 187 196 msgid "United Kingdom (UK DPA)" 188 197 msgstr "" 189 198 190 #: admin/class-termageddon-usercentrics-admin.php: 795199 #: admin/class-termageddon-usercentrics-admin.php:903 191 200 msgid "Upon generating your " 192 201 msgstr "" 193 202 194 #: admin/class-termageddon-usercentrics-admin.php: 781203 #: admin/class-termageddon-usercentrics-admin.php:889 195 204 msgid "Upon saving, all previous errors in the log will be deleted." 196 205 msgstr "" 197 206 198 #: admin/class-termageddon-usercentrics-admin.php: 441207 #: admin/class-termageddon-usercentrics-admin.php:559 199 208 msgid "Virginia (VCDPA)" 200 209 msgstr "" … … 207 216 msgstr "" 208 217 209 #: admin/class-termageddon-usercentrics-admin.php:505 210 msgid "" 211 "When enabled, the privacy settings link will be hidden alongside the plugin " 212 "if the visitor is outside of the geo-location marked above." 213 msgstr "" 214 215 #: admin/class-termageddon-usercentrics-admin.php:485 218 #: admin/class-termageddon-usercentrics-admin.php:405 219 msgid "" 220 "When enabled, the Privacy Settings link will be hidden from certain users, " 221 "whether that be certain logged in users (via your selections above in the " 222 "“Hide widget for:” area) or if you enabled geolocation and are hiding the " 223 "consent tool from certain visitors. For example, if you enable the option to " 224 "hide the consent tool for logged in administrator (and enable this toggle), " 225 "the Privacy Settings link will <strong>not</strong> show to logged in " 226 "administrators. If you enable the option to hide the consent tool based on " 227 "geolocation for certain users, the Privacy Settings link will no longer be " 228 "displayed to those respective users as well." 229 msgstr "" 230 231 #: admin/class-termageddon-usercentrics-admin.php:592 216 232 msgid "" 217 233 "When enabled, the visitor's location can be viewed in the browser console, " … … 219 235 msgstr "" 220 236 221 #: admin/class-termageddon-usercentrics-admin.php: 523237 #: admin/class-termageddon-usercentrics-admin.php:612 222 238 msgid "" 223 239 "When enabled, the visitor's location is checked via javascript to allow " … … 225 241 msgstr "" 226 242 227 #: admin/class-termageddon-usercentrics-admin.php: 832243 #: admin/class-termageddon-usercentrics-admin.php:940 228 244 msgid "" 229 245 "When enabled, you will be collecting IP addresses for the purposes of " … … 241 257 msgstr "" 242 258 243 #: admin/class-termageddon-usercentrics-admin.php: 797259 #: admin/class-termageddon-usercentrics-admin.php:905 244 260 msgid "" 245 261 "within your Termageddon account, you will be brought to the \"View embed " … … 248 264 msgstr "" 249 265 250 #: admin/class-termageddon-usercentrics-admin.php: 815266 #: admin/class-termageddon-usercentrics-admin.php:923 251 267 msgid "" 252 268 "you will need to enable at least one of the settings below to ensure logged " -
termageddon-usercentrics/trunk/public/class-termageddon-usercentrics-public.php
r2922465 r2931216 112 112 ); 113 113 } 114 115 // Load Alternate PSL Logic. 116 if ( Termageddon_Usercentrics::should_use_alternate_psl() ) { 117 add_action( 'wp_footer', array( $this, 'replace_usercentrics_psl_with_shortcode' ) ); 118 } 114 119 } 115 120 … … 134 139 echo wp_kses( $script, self::ALLOWED_HTML ); 135 140 echo '<!-- END TERMAGEDDON + USERCENTRICS -->'; 141 } 142 143 144 /** 145 * Action to allow replacing a broken psl with the fully functional psl. 146 * 147 * @return void */ 148 public function replace_usercentrics_psl_with_shortcode() { 149 ob_start(); 150 ?> 151 <script id="termageddon-psl-alternate-js"> 152 (function($) { 153 $(document).ready(function() { 154 jQuery('a#usercentrics-psl').each(function() { 155 let newElem = jQuery(`<?php echo do_shortcode( '[uc-privacysettings]' ); ?>`); 156 if (!["","Privacy Settings"].includes(jQuery(this).text())) newElem.text(jQuery(this).text()) 157 jQuery(this).replaceWith(newElem); 158 }) 159 }) 160 })(jQuery); 161 </script> 162 <?php 163 ob_end_flush(); 136 164 } 137 165 … … 195 223 </script>'; 196 224 } 197 225 198 226 // Presto Player Integration Javascript. 199 if ( Termageddon_Usercentrics::is_integration_enabled( 'presto_player') ) {227 if ( Termageddon_Usercentrics::is_integration_enabled( 'presto_player' ) ) { 200 228 $script .= '<script type="application/javascript" id="uc-integration-presto-player"> 201 229 function uc_integration_setup(iID,service) { -
termageddon-usercentrics/trunk/termageddon-usercentrics.php
r2922465 r2931216 15 15 * Plugin Name: Termageddon + Usercentrics 16 16 * Description: Easily integrate the Usercentrics consent solution into your website while controlling visibility for logged in users and admins. 17 * Version: 1.3. 317 * Version: 1.3.4 18 18 * Author: Termageddon 19 19 * Author URI: https://termageddon.com … … 34 34 * Rename this for your plugin and update it as you release new versions. 35 35 */ 36 define( 'TERMAGEDDON_COOKIE_VERSION', '1.3. 3' );36 define( 'TERMAGEDDON_COOKIE_VERSION', '1.3.4' ); 37 37 38 38 define( 'TERMAGEDDON_COOKIE_PLUGIN_PATH', dirname( __FILE__ ) );// No trailing slash.
Note: See TracChangeset
for help on using the changeset viewer.