Changeset 2997345
- Timestamp:
- 11/16/2023 11:27:11 PM (2 years ago)
- Location:
- protect-admin-account/trunk
- Files:
-
- 3 added
- 10 edited
-
freemius/.editorconfig (added)
-
freemius/includes/class-freemius.php (modified) (15 diffs)
-
freemius/includes/debug/class-fs-debug-bar-panel.php (modified) (1 diff)
-
freemius/includes/fs-core-functions.php (modified) (1 diff)
-
freemius/includes/sdk/FreemiusWordPress.php (modified) (1 diff)
-
freemius/phpcompat.xml (added)
-
freemius/phpstan.neon (added)
-
freemius/start.php (modified) (1 diff)
-
freemius/templates/forms/license-activation.php (modified) (5 diffs)
-
includes/paa-options.php (modified) (1 diff)
-
index.php (modified) (1 diff)
-
languages/protect-admin-account.pot (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
protect-admin-account/trunk/freemius/includes/class-freemius.php
r2941649 r2997345 1532 1532 $this->add_filter( 'after_code_type_change', array( &$this, '_after_code_type_change' ) ); 1533 1533 1534 add_action( 'admin_init', array( &$this, '_add_trial_notice' ) ); 1535 add_action( 'admin_init', array( &$this, '_add_affiliate_program_notice' ) ); 1534 add_action( 'admin_init', array( &$this, '_add_trial_notice' ) ); // @phpstan-ignore-line 1535 add_action( 'admin_init', array( &$this, '_add_affiliate_program_notice' ) ); // @phpstan-ignore-line 1536 1536 add_action( 'admin_enqueue_scripts', array( &$this, '_enqueue_common_css' ) ); 1537 1537 … … 1643 1643 * @since 2.2.3 1644 1644 * 1645 * @return string1645 * @return void 1646 1646 */ 1647 1647 static function _prepend_fs_allow_updater_and_dialog_flag_url_param() { … … 3493 3493 */ 3494 3494 static function get_unfiltered_site_url( $blog_id = null, $strip_protocol = false, $add_trailing_slash = false ) { 3495 $url = ( ! is_multisite() && defined( 'WP_SITEURL' ) ) ? WP_SITEURL : self::get_site_url_from_wp_option( $blog_id ); 3496 3497 if ( $strip_protocol ) { 3498 $url = fs_strip_url_protocol( $url ); 3499 } 3500 3501 if ( $add_trailing_slash ) { 3502 $url = trailingslashit( $url ); 3503 } 3504 3505 return $url; 3506 } 3507 3508 /** 3509 * @author Leo Fajardo (@leorw) 3510 * @since 2.6.0 3511 * 3512 * @param int|null $blog_id 3513 * 3514 * @return string 3515 */ 3516 private static function get_site_url_from_wp_option( $blog_id = null ) { 3495 3517 global $wp_filter; 3496 3518 … … 3517 3539 $wp_filter[ $hook_name ] = $site_url_filter; 3518 3540 } 3519 }3520 3521 if ( $strip_protocol ) {3522 $url = fs_strip_url_protocol( $url );3523 }3524 3525 if ( $add_trailing_slash ) {3526 $url = trailingslashit( $url );3527 3541 } 3528 3542 … … 4081 4095 4082 4096 if ( function_exists( 'random_int' ) ) { 4083 $random = random_int( $min, $max ); 4097 $random = random_int( $min, $max ); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.random_intFound 4084 4098 } else { 4085 4099 $random = rand( $min, $max ); … … 4400 4414 4401 4415 // Get the UTF encoded domain name. 4402 $domain = idn_to_ascii( $parts[1] ) . '.'; 4416 /** 4417 * @note - The check of `defined('...')` is there to account for PHP servers compiled with some older version of ICU where the constants are not defined. 4418 * @author - @swashata 4419 */ 4420 $is_new_idn_available = ( 4421 version_compare( PHP_VERSION, '5.6.40') > 0 && 4422 defined( 'IDNA_DEFAULT' ) && 4423 defined( 'INTL_IDNA_VARIANT_UTS46' ) 4424 ); 4425 if ( $is_new_idn_available ) { 4426 $domain = idn_to_ascii( $parts[1], IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46 ); 4427 } else { 4428 $domain = idn_to_ascii( $parts[1] ); // phpcs:ignore PHPCompatibility.ParameterValues.NewIDNVariantDefault.NotSet 4429 } 4430 4431 $domain = $domain . '.'; 4403 4432 4404 4433 return ( checkdnsrr( $domain, 'MX' ) || checkdnsrr( $domain, 'A' ) ); … … 5616 5645 } 5617 5646 5618 if ( $this->is_registered() ) { 5619 if ( ! $this->is_addon() ) { 5620 add_action( 5621 is_admin() ? 'admin_init' : 'init', 5622 array( &$this, '_plugin_code_type_changed' ) 5623 ); 5624 } 5625 5626 if ( $this->is_premium() ) { 5627 // Purge cached payments after switching to the premium version. 5628 // @todo This logic doesn't handle purging the cache for serviceware module upgrade. 5629 $this->get_api_user_scope()->purge_cache( "/plugins/{$this->_module_id}/payments.json?include_addons=true" ); 5630 } 5647 if ( ! $this->is_addon() ) { 5648 add_action( 5649 is_admin() ? 'admin_init' : 'init', 5650 array( &$this, '_plugin_code_type_changed' ) 5651 ); 5652 } 5653 5654 if ( $this->is_registered() && $this->is_premium() ) { 5655 // Purge cached payments after switching to the premium version. 5656 // @todo This logic doesn't handle purging the cache for serviceware module upgrade. 5657 $this->get_api_user_scope()->purge_cache( "/plugins/{$this->_module_id}/payments.json?include_addons=true" ); 5631 5658 } 5632 5659 } … … 5692 5719 } 5693 5720 5694 // Schedule code type changes event. 5695 $this->schedule_install_sync(); 5721 if ( $this->is_registered() ) { 5722 // Schedule code type changes event. 5723 $this->schedule_install_sync(); 5724 } 5696 5725 5697 5726 /** … … 9991 10020 * @param string $caller 9992 10021 * 9993 * @return string10022 * @return void 9994 10023 */ 9995 10024 function set_basename( $is_premium, $caller ) { … … 12417 12446 $install_2_blog_map = array(); 12418 12447 foreach ( $blog_2_install_map as $blog_id => $install ) { 12419 $params[] = array( 'id' => $install->id );12448 $params[] = array( 'id' => $install->id, 'url' => $install->url ); 12420 12449 12421 12450 $install_2_blog_map[ $install->id ] = $blog_id; … … 16698 16727 * @return FS_User|false 16699 16728 */ 16700 static function _get_user_by_email( $email ) {16729 public static function _get_user_by_email( $email ) { 16701 16730 self::$_static_logger->entrance(); 16702 16731 … … 17872 17901 * @param bool $redirect 17873 17902 * 17874 * @return string If redirect is `false`, returns the next page the user should be redirected to.17903 * @return void 17875 17904 */ 17876 17905 private function install_many_pending_with_user( … … 23266 23295 23267 23296 /** 23297 * Adds CSS classes for the body tag in the admin. 23298 * 23299 * @param string $classes Space-separated string of class names. 23300 * 23301 * @return string $classes FS Admin body tag class names. 23302 */ 23303 public function fs_addons_body_class( $classes ) { 23304 $classes .= ' plugins-php'; 23305 return $classes; 23306 } 23307 23308 /** 23268 23309 * Account page resources load. 23269 23310 * … … 23281 23322 wp_enqueue_script( 'plugin-install' ); 23282 23323 add_thickbox(); 23283 23284 function fs_addons_body_class( $classes ) { 23285 $classes .= ' plugins-php'; 23286 23287 return $classes; 23288 } 23289 23290 add_filter( 'admin_body_class', 'fs_addons_body_class' ); 23324 add_filter( 'admin_body_class', array( $this, 'fs_addons_body_class' ) ); 23291 23325 } 23292 23326 … … 23423 23457 wp_enqueue_script( 'plugin-install' ); 23424 23458 add_thickbox(); 23425 23426 function fs_addons_body_class( $classes ) { 23427 $classes .= ' plugins-php'; 23428 23429 return $classes; 23430 } 23431 23432 add_filter( 'admin_body_class', 'fs_addons_body_class' ); 23459 add_filter( 'admin_body_class', array( $this, 'fs_addons_body_class' ) ); 23433 23460 23434 23461 if ( ! $this->is_registered() && $this->is_org_repo_compliant() ) { -
protect-admin-account/trunk/freemius/includes/debug/class-fs-debug-bar-panel.php
r2968769 r2997345 11 11 } 12 12 13 /** 14 * Extends Debug Bar plugin by adding a panel to show all Freemius API requests. 15 * 16 * @author Vova Feldman (@svovaf) 17 * @since 1.1.7.3 18 * 19 * Class Freemius_Debug_Bar_Panel 20 */ 21 class Freemius_Debug_Bar_Panel extends Debug_Bar_Panel { 22 function init() { 23 $this->title( 'Freemius' ); 24 } 13 if ( class_exists( 'Debug_Bar_Panel' ) ) { 25 14 26 static function requests_count() { 27 if ( class_exists( 'Freemius_Api_WordPress' ) ) { 28 $logger = Freemius_Api_WordPress::GetLogger(); 29 } else { 30 $logger = array(); 15 /** 16 * Extends Debug Bar plugin by adding a panel to show all Freemius API requests. 17 * 18 * @author Vova Feldman (@svovaf) 19 * @since 1.1.7.3 20 * 21 * Class Freemius_Debug_Bar_Panel 22 */ 23 class Freemius_Debug_Bar_Panel extends Debug_Bar_Panel { 24 25 public function init() { 26 $this->title( 'Freemius' ); // @phpstan-ignore-line 31 27 } 32 28 33 return number_format( count( $logger ) ); 34 } 29 public static function requests_count() { 30 if ( class_exists( 'Freemius_Api_WordPress' ) ) { 31 $logger = Freemius_Api_WordPress::GetLogger(); 32 } else { 33 $logger = array(); 34 } 35 35 36 static function total_time() { 37 if ( class_exists( 'Freemius_Api_WordPress' ) ) { 38 $logger = Freemius_Api_WordPress::GetLogger(); 39 } else { 40 $logger = array(); 36 return number_format( count( $logger ) ); 41 37 } 42 38 43 $total_time = .0; 44 foreach ( $logger as $l ) { 45 $total_time += $l['total']; 39 public static function total_time() { 40 if ( class_exists( 'Freemius_Api_WordPress' ) ) { 41 $logger = Freemius_Api_WordPress::GetLogger(); 42 } else { 43 $logger = array(); 44 } 45 46 $total_time = .0; 47 foreach ( $logger as $l ) { 48 $total_time += $l['total']; 49 } 50 51 return number_format( 100 * $total_time, 2 ) . ' ' . fs_text_x_inline( 'ms', 'milliseconds' ); 46 52 } 47 53 48 return number_format( 100 * $total_time, 2 ) . ' ' . fs_text_x_inline( 'ms', 'milliseconds' ); 49 } 50 51 function render() { 52 ?> 53 <div id='debug-bar-php'> 54 <?php fs_require_template( '/debug/api-calls.php' ) ?> 55 <br> 56 <?php fs_require_template( '/debug/scheduled-crons.php' ) ?> 57 <br> 58 <?php fs_require_template( '/debug/plugins-themes-sync.php' ) ?> 59 <br> 60 <?php fs_require_template( '/debug/logger.php' ) ?> 61 </div> 62 <?php 54 public function render() { 55 ?> 56 <div id='debug-bar-php'> 57 <?php fs_require_template( '/debug/api-calls.php' ) ?> 58 <br> 59 <?php fs_require_template( '/debug/scheduled-crons.php' ) ?> 60 <br> 61 <?php fs_require_template( '/debug/plugins-themes-sync.php' ) ?> 62 <br> 63 <?php fs_require_template( '/debug/logger.php' ) ?> 64 </div> 65 <?php 66 } 63 67 } 64 68 } -
protect-admin-account/trunk/freemius/includes/fs-core-functions.php
r2941649 r2997345 1205 1205 * @param string $slug Module slug for overrides. 1206 1206 * 1207 * @return string1207 * @return void 1208 1208 */ 1209 1209 function fs_esc_js_echo_x_inline( $text, $context, $key = '', $slug = 'freemius' ) { -
protect-admin-account/trunk/freemius/includes/sdk/FreemiusWordPress.php
r2891808 r2997345 474 474 if ( filter_var( $matches[1], FILTER_VALIDATE_IP ) ) { 475 475 if ( strlen( inet_pton( $matches[1] ) ) === 16 ) { 476 // error_log('Invalid IPv6 configuration on server, Please disable or get native IPv6 on your server.'); 477 // Hook to an action triggered just before cURL is executed to resolve the IP version to v4. 476 /** 477 * error_log('Invalid IPv6 configuration on server, Please disable or get native IPv6 on your server.'); 478 * Hook to an action triggered just before cURL is executed to resolve the IP version to v4. 479 * 480 * @phpstan-ignore-next-line 481 */ 478 482 add_action( 'http_api_curl', 'Freemius_Api_WordPress::CurlResolveToIPv4', 10, 1 ); 479 483 -
protect-admin-account/trunk/freemius/start.php
r2941649 r2997345 16 16 * @var string 17 17 */ 18 $this_sdk_version = '2.5.1 0';18 $this_sdk_version = '2.5.12'; 19 19 20 20 #region SDK Selection Logic -------------------------------------------------------------------- -
protect-admin-account/trunk/freemius/templates/forms/license-activation.php
r2886597 r2997345 53 53 $all_sites = Freemius::get_sites(); 54 54 55 $subsite_data_by_install_id = array(); 56 $install_url_by_install_id = array(); 55 $all_site_details = array(); 56 $subsite_url_by_install_id = array(); 57 $install_url_by_install_id = array(); 57 58 58 59 foreach ( $all_sites as $site ) { … … 67 68 68 69 if ( is_object( $install ) ) { 69 if ( isset( $subsite_ data_by_install_id[ $install->id ] ) ) {70 $clone_subsite_ data = $subsite_data_by_install_id[ $install->id ];71 $clone_install_url = $install_url_by_install_id[ $install->id ];70 if ( isset( $subsite_url_by_install_id[ $install->id ] ) ) { 71 $clone_subsite_url = $subsite_url_by_install_id[ $install->id ]; 72 $clone_install_url = $install_url_by_install_id[ $install->id ]; 72 73 73 74 if ( … … 78 79 * @since 2.5.0 79 80 */ 80 fs_strip_url_protocol( untrailingslashit( $clone_install_url ) ) === fs_strip_url_protocol( untrailingslashit( $clone_subsite_ data['url']) ) ||81 fs_strip_url_protocol( untrailingslashit( $clone_install_url ) ) === fs_strip_url_protocol( untrailingslashit( $clone_subsite_url ) ) || 81 82 fs_strip_url_protocol( untrailingslashit( $install->url ) ) !== fs_strip_url_protocol( untrailingslashit( $site_details['url'] ) ) 82 83 ) { … … 89 90 } 90 91 91 $subsite_data_by_install_id[ $install->id ] = $site_details; 92 $install_url_by_install_id[ $install->id ] = $install->url; 93 } 92 $subsite_url_by_install_id[ $install->id ] = $site_details['url']; 93 $install_url_by_install_id[ $install->id ] = $install->url; 94 } 95 96 $all_site_details[] = $site_details; 94 97 } 95 98 … … 97 100 $vars = array( 98 101 'id' => $fs->get_id(), 99 'sites' => array_values( $subsite_data_by_install_id ),102 'sites' => $all_site_details, 100 103 'require_license_key' => true 101 104 ); -
protect-admin-account/trunk/includes/paa-options.php
r2968769 r2997345 367 367 $logdata = $actionlog_arr; 368 368 369 // bug fix : https://wordpress.org/support/topic/php-warnings-170/ 370 $logdata = array_filter($logdata); 371 369 372 if (is_array($logdata)) 370 373 usort($logdata, "thp_paa_compare_datetime"); -
protect-admin-account/trunk/index.php
r2968769 r2997345 4 4 * Plugin URI: https://protectadmin.com/plugin/protect-admin-account-pro-wordpress-plugin/ 5 5 * Description: Protect admin accounts from being deleted or modified by other users. 6 * Version: 2.0. 46 * Version: 2.0.5 7 7 * Author: Keystroke Click 8 8 * Author URI: https://keystrokeclick.com/ -
protect-admin-account/trunk/languages/protect-admin-account.pot
r2968769 r2997345 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Protect Admin 2.0. 4\n"5 "Project-Id-Version: Protect Admin 2.0.5\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/protect-admin-account\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2023- 09-16T01:25:10+00:00\n"12 "POT-Creation-Date: 2023-11-12T23:26:40+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 "X-Generator: WP-CLI 2. 7.1\n"14 "X-Generator: WP-CLI 2.9.0\n" 15 15 "X-Domain: protect-admin-account\n" 16 16 … … 155 155 156 156 #: includes/paa-options.php:331 157 #: includes/paa-options.php:3 78157 #: includes/paa-options.php:381 158 158 msgid "No attempted actions recorded." 159 159 msgstr "" 160 160 161 161 #. translators: %s: is href for pro-version 162 #: includes/paa-options.php:39 1162 #: includes/paa-options.php:394 163 163 msgid "To see FULL LOG of the attempted actions, please <a href=\"%s\">upgrade to PRO</a>." 164 164 msgstr "" 165 165 166 #: includes/paa-options.php:43 2166 #: includes/paa-options.php:435 167 167 msgid "Sorry, you are not allowed to edit the settings." 168 168 msgstr "" 169 169 170 #: includes/paa-options.php:44 6170 #: includes/paa-options.php:449 171 171 msgid "One or more user selected is not admin. All users selected must be admin. Settings are not saved." 172 172 msgstr "" 173 173 174 #: includes/paa-options.php:46 1174 #: includes/paa-options.php:464 175 175 msgid "Settings have been updated successfully!" 176 176 msgstr "" 177 177 178 #: includes/paa-options.php:46 6178 #: includes/paa-options.php:469 179 179 msgid "Oops, something went wrong. Try saving your settings again." 180 180 msgstr "" 181 181 182 #: includes/paa-options.php:47 2182 #: includes/paa-options.php:475 183 183 msgid "Settings have been updated!" 184 184 msgstr "" 185 185 186 #: includes/paa-options.php:4 78186 #: includes/paa-options.php:481 187 187 msgid "No changes." 188 188 msgstr "" 189 189 190 #: includes/paa-options.php:48 2190 #: includes/paa-options.php:485 191 191 msgid "Settings are not saved." 192 192 msgstr "" 193 193 194 #: includes/paa-options.php:4 89194 #: includes/paa-options.php:492 195 195 msgid "Sorry, nonce verification failed. Settings are not saved." 196 196 msgstr "" -
protect-admin-account/trunk/readme.txt
r2968769 r2997345 4 4 Tags: protect, admin, user account, admin account, prevent admin deletion, prevent user edit 5 5 Requires at least: 4.7 6 Tested up to: 6. 3.16 Tested up to: 6.4.1 7 7 Requires PHP: 5.3 8 Stable tag: 2.0. 48 Stable tag: 2.0.5 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 14 14 == Description == 15 15 16 This plugin protects selected WP Admin accounts, and standard posts created by those Admins, from being deleted or edited by other users. This plugin is hidden from all users other than the Admin who installs it. Only users with the “Administrator”role can be protected.16 This plugin protects selected WP Admin accounts, and standard posts created by those Admins, from being deleted or edited by other users. This plugin is hidden from all users other than the Admin who installs it. Only users with the "Administrator" role can be protected. 17 17 18 18 This plugin might be useful if you want to share admin access with other users (i.e. IT team, developers, etc) but don’t want to risk impacting the accounts of certain Admins. Or, perhaps you’re the developer or IT member who might need this plugin to prevent other non-technical Admins from accidentally deleting your account or key Admins on specific projects. … … 100 100 == Changelog == 101 101 102 103 = 2.0.5 = 104 * Fix: PHP Warning for strpos and str_replace functions 105 * Updated Freemius SDK 106 * Compatibility check 107 102 108 = 2.0.4 = 103 109 * Added new option to protect BuddyPress contents.
Note: See TracChangeset
for help on using the changeset viewer.