PluginProbe ʕ •ᴥ•ʔ
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin / 3.11.0
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin v3.11.0
4.9.0 0.9.6 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.2 1.7.0 1.7.1 1.8.0 1.8.1 1.9.0 2.0.0 2.0.1 2.1.1 2.2.1 2.3.1 2.4.0 2.5.0 2.5.1 2.6.0 2.7.0 2.8.0 2.9.0 3.0.1 3.0.2 3.0.3 3.1.0 3.10.0 3.11.0 3.11.1 3.2.0 3.2.1 3.3.0 3.4.0 3.5.0 3.5.1 3.5.2 3.6.1 3.7.0 3.8.0 3.8.2 3.9.0 4.0.1 4.1.0 4.1.1 4.2.0 4.3.0 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.8.0 trunk 0.10.0 0.10.1 0.11.1 0.11.2 0.3.1 0.3.2 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.5.2 0.6 0.7 0.8 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 0.9.0 0.9.1 0.9.2 0.9.3 0.9.4 0.9.5
wp-mail-smtp / vendor / woocommerce / action-scheduler / classes / ActionScheduler_Compatibility.php
wp-mail-smtp / vendor / woocommerce / action-scheduler / classes Last commit date
WP_CLI 2 years ago abstracts 2 years ago actions 2 years ago data-stores 2 years ago migration 2 years ago schedules 2 years ago schema 2 years ago ActionScheduler_ActionClaim.php 2 years ago ActionScheduler_ActionFactory.php 2 years ago ActionScheduler_AdminView.php 2 years ago ActionScheduler_AsyncRequest_QueueRunner.php 2 years ago ActionScheduler_Compatibility.php 2 years ago ActionScheduler_DataController.php 2 years ago ActionScheduler_DateTime.php 2 years ago ActionScheduler_Exception.php 2 years ago ActionScheduler_FatalErrorMonitor.php 2 years ago ActionScheduler_InvalidActionException.php 2 years ago ActionScheduler_ListTable.php 2 years ago ActionScheduler_LogEntry.php 2 years ago ActionScheduler_NullLogEntry.php 2 years ago ActionScheduler_OptionLock.php 2 years ago ActionScheduler_QueueCleaner.php 2 years ago ActionScheduler_QueueRunner.php 2 years ago ActionScheduler_Versions.php 2 years ago ActionScheduler_WPCommentCleaner.php 2 years ago ActionScheduler_wcSystemStatus.php 2 years ago
ActionScheduler_Compatibility.php
106 lines
1 <?php
2
3 /**
4 * Class ActionScheduler_Compatibility
5 */
6 class ActionScheduler_Compatibility {
7 /**
8 * Converts a shorthand byte value to an integer byte value.
9 *
10 * Wrapper for wp_convert_hr_to_bytes(), moved to load.php in WordPress 4.6 from media.php
11 *
12 * @link https://secure.php.net/manual/en/function.ini-get.php
13 * @link https://secure.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
14 *
15 * @param string $value A (PHP ini) byte value, either shorthand or ordinary.
16 * @return int An integer byte value.
17 */
18 public static function convert_hr_to_bytes( $value ) {
19 if ( function_exists( 'wp_convert_hr_to_bytes' ) ) {
20 return wp_convert_hr_to_bytes( $value );
21 }
22
23 $value = strtolower( trim( $value ) );
24 $bytes = (int) $value;
25
26 if ( false !== strpos( $value, 'g' ) ) {
27 $bytes *= GB_IN_BYTES;
28 } elseif ( false !== strpos( $value, 'm' ) ) {
29 $bytes *= MB_IN_BYTES;
30 } elseif ( false !== strpos( $value, 'k' ) ) {
31 $bytes *= KB_IN_BYTES;
32 }
33
34 // Deal with large (float) values which run into the maximum integer size.
35 return min( $bytes, PHP_INT_MAX );
36 }
37
38 /**
39 * Attempts to raise the PHP memory limit for memory intensive processes.
40 *
41 * Only allows raising the existing limit and prevents lowering it.
42 *
43 * Wrapper for wp_raise_memory_limit(), added in WordPress v4.6.0
44 *
45 * @return bool|int|string The limit that was set or false on failure.
46 */
47 public static function raise_memory_limit() {
48 if ( function_exists( 'wp_raise_memory_limit' ) ) {
49 return wp_raise_memory_limit( 'admin' );
50 }
51
52 $current_limit = @ini_get( 'memory_limit' );
53 $current_limit_int = self::convert_hr_to_bytes( $current_limit );
54
55 if ( -1 === $current_limit_int ) {
56 return false;
57 }
58
59 $wp_max_limit = WP_MAX_MEMORY_LIMIT;
60 $wp_max_limit_int = self::convert_hr_to_bytes( $wp_max_limit );
61 $filtered_limit = apply_filters( 'admin_memory_limit', $wp_max_limit );
62 $filtered_limit_int = self::convert_hr_to_bytes( $filtered_limit );
63
64 if ( -1 === $filtered_limit_int || ( $filtered_limit_int > $wp_max_limit_int && $filtered_limit_int > $current_limit_int ) ) {
65 if ( false !== @ini_set( 'memory_limit', $filtered_limit ) ) {
66 return $filtered_limit;
67 } else {
68 return false;
69 }
70 } elseif ( -1 === $wp_max_limit_int || $wp_max_limit_int > $current_limit_int ) {
71 if ( false !== @ini_set( 'memory_limit', $wp_max_limit ) ) {
72 return $wp_max_limit;
73 } else {
74 return false;
75 }
76 }
77 return false;
78 }
79
80 /**
81 * Attempts to raise the PHP timeout for time intensive processes.
82 *
83 * Only allows raising the existing limit and prevents lowering it. Wrapper for wc_set_time_limit(), when available.
84 *
85 * @param int $limit The time limit in seconds.
86 */
87 public static function raise_time_limit( $limit = 0 ) {
88 $limit = (int) $limit;
89 $max_execution_time = (int) ini_get( 'max_execution_time' );
90
91 // If the max execution time is already set to zero (unlimited), there is no reason to make a further change.
92 if ( 0 === $max_execution_time ) {
93 return;
94 }
95
96 // Whichever of $max_execution_time or $limit is higher is the amount by which we raise the time limit.
97 $raise_by = 0 === $limit || $limit > $max_execution_time ? $limit : $max_execution_time;
98
99 if ( function_exists( 'wc_set_time_limit' ) ) {
100 wc_set_time_limit( $raise_by );
101 } elseif ( function_exists( 'set_time_limit' ) && false === strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved
102 @set_time_limit( $raise_by ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
103 }
104 }
105 }
106