本文整理汇总了PHP中wc_let_to_num函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_let_to_num函数的具体用法?PHP wc_let_to_num怎么用?PHP wc_let_to_num使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wc_let_to_num函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _e
</td>
</tr>
<?php
if (function_exists('ini_get')) {
?>
<tr>
<td data-export-label="PHP Post Max Size"><?php
_e('PHP Post Max Size', 'woocommerce');
?>
:</td>
<td class="help"><?php
echo wc_help_tip(__('The largest filesize that can be contained in one post.', 'woocommerce'));
?>
</td>
<td><?php
echo size_format(wc_let_to_num(ini_get('post_max_size')));
?>
</td>
</tr>
<tr>
<td data-export-label="PHP Time Limit"><?php
_e('PHP Time Limit', 'woocommerce');
?>
:</td>
<td class="help"><?php
echo wc_help_tip(__('The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups)', 'woocommerce'));
?>
</td>
<td><?php
echo ini_get('max_execution_time');
?>
示例2: vtprd_check_memory_limit
function vtprd_check_memory_limit()
{
//from woocommerce/includes/admin/views/html-admin-page-status-report.php
//******************************
//v1.1.0.5 added function exists check ==>> pre woo 2.1 can go boom!
//******************************
if (function_exists('wc_let_to_num')) {
$memory = wc_let_to_num(WP_MEMORY_LIMIT);
if ($memory < 67108864) {
echo '<strong>WP Memory Limit: ' . sprintf(__('%s - We recommend setting memory to at least 64MB. See: <a href="%s">Increasing memory allocated to PHP</a>', 'woocommerce'), size_format($memory), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP') . '</strong>';
//echo '<mark class="error">WP Memory Limit: ' . sprintf( __( '%s - We recommend setting memory to at least 64MB. See: <a href="%s">Increasing memory allocated to PHP</a>', 'woocommerce' ), size_format( $memory ), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP' ) . '</mark>';
}
}
return;
}
示例3: function_exists
<h3 id="system">System Configuration</h3>
<?php
require_once WooCommerce_PDF_Invoices::$plugin_path . "lib/dompdf/dompdf_config.inc.php";
$memory_limit = function_exists('wc_let_to_num') ? wc_let_to_num(WP_MEMORY_LIMIT) : woocommerce_let_to_num(WP_MEMORY_LIMIT);
$server_configs = array("PHP Version" => array("required" => "5.0", "value" => phpversion(), "result" => version_compare(phpversion(), "5.0")), "DOMDocument extension" => array("required" => true, "value" => phpversion("DOM"), "result" => class_exists("DOMDocument")), "PCRE" => array("required" => true, "value" => phpversion("pcre"), "result" => function_exists("preg_match") && @preg_match("/./u", "a"), "failure" => "PCRE is required with Unicode support (the \"u\" modifier)"), "Zlib" => array("required" => true, "value" => phpversion("zlib"), "result" => function_exists("gzcompress"), "fallback" => "Recommended to compress PDF documents"), "MBString extension" => array("required" => true, "value" => phpversion("mbstring"), "result" => function_exists("mb_send_mail"), "fallback" => "Recommended, will use fallback functions"), "GD" => array("required" => true, "value" => phpversion("gd"), "result" => function_exists("imagecreate"), "fallback" => "Required if you have images in your documents"), "opcache" => array("required" => "For better performances", "value" => null, "result" => false, "fallback" => "Recommended for better performances"), "GMagick or IMagick" => array("required" => "Better with transparent PNG images", "value" => null, "result" => extension_loaded("gmagick") || extension_loaded("imagick"), "fallback" => "Recommended for better performances"), "glob()" => array("required" => "Required to detect custom templates and to clear the temp folder periodically", "value" => null, "result" => function_exists("glob"), "fallback" => "Check php disable_functions"), "WP Memory Limit" => array("required" => 'Recommended: 64MB (128MB for optimal performance)<br/>See: <a href="http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP">Increasing memory allocated to PHP</a>', "value" => WP_MEMORY_LIMIT, "result" => $memory_limit > 67108864));
if (($xc = extension_loaded("xcache")) || ($apc = extension_loaded("apc")) || ($zop = extension_loaded("Zend OPcache")) || ($op = extension_loaded("opcache"))) {
$server_configs["opcache"]["result"] = true;
$server_configs["opcache"]["value"] = $xc ? "XCache " . phpversion("xcache") : ($apc ? "APC " . phpversion("apc") : ($zop ? "Zend OPCache " . phpversion("Zend OPcache") : "PHP OPCache " . phpversion("opcache")));
}
if (($gm = extension_loaded("gmagick")) || ($im = extension_loaded("imagick"))) {
$server_configs["GMagick or IMagick"]["value"] = $im ? "IMagick " . phpversion("imagick") : "GMagick " . phpversion("gmagick");
}
?>
<table cellspacing="1px" cellpadding="4px" style="background-color: white; padding: 5px; border: 1px solid #ccc;">
<tr>
<th align="left"> </th>
<th align="left">Required</th>
<th align="left">Present</th>
</tr>
<?php
foreach ($server_configs as $label => $server_config) {
if ($server_config["result"]) {
$background = "#9e4";
$color = "black";
} elseif (isset($server_config["fallback"])) {
$background = "#FCC612";
$color = "black";
} else {
示例4: woocommerce_let_to_num
/**
* @deprecated
*/
function woocommerce_let_to_num($size)
{
return wc_let_to_num($size);
}
示例5: get_environment_info
/**
* Get array of environment information. Includes thing like software
* versions, and various server settings.
*
* @return array
*/
public function get_environment_info()
{
global $wpdb;
// Figure out cURL version, if installed.
$curl_version = '';
if (function_exists('curl_version')) {
$curl_version = curl_version();
$curl_version = $curl_version['version'] . ', ' . $curl_version['ssl_version'];
}
// WP memory limit
$wp_memory_limit = wc_let_to_num(WP_MEMORY_LIMIT);
if (function_exists('memory_get_usage')) {
$wp_memory_limit = max($wp_memory_limit, wc_let_to_num(@ini_get('memory_limit')));
}
// Test POST requests
$post_response = wp_safe_remote_post('https://www.paypal.com/cgi-bin/webscr', array('timeout' => 60, 'user-agent' => 'WooCommerce/' . WC()->version, 'httpversion' => '1.1', 'body' => array('cmd' => '_notify-validate')));
$post_response_successful = false;
if (!is_wp_error($post_response) && $post_response['response']['code'] >= 200 && $post_response['response']['code'] < 300) {
$post_response_successful = true;
}
// Test GET requests
$get_response = wp_safe_remote_get('https://woocommerce.com/wc-api/product-key-api?request=ping&network=' . (is_multisite() ? '1' : '0'));
$get_response_successful = false;
if (!is_wp_error($post_response) && $post_response['response']['code'] >= 200 && $post_response['response']['code'] < 300) {
$get_response_successful = true;
}
// Return all environment info. Described by JSON Schema.
return array('home_url' => get_option('home'), 'site_url' => get_option('siteurl'), 'version' => WC()->version, 'log_directory' => WC_LOG_DIR, 'log_directory_writable' => @fopen(WC_LOG_DIR . 'test-log.log', 'a') ? true : false, 'wp_version' => get_bloginfo('version'), 'wp_multisite' => is_multisite(), 'wp_memory_limit' => $wp_memory_limit, 'wp_debug_mode' => defined('WP_DEBUG') && WP_DEBUG, 'wp_cron' => !(defined('DISABLE_WP_CRON') && DISABLE_WP_CRON), 'language' => get_locale(), 'server_info' => $_SERVER['SERVER_SOFTWARE'], 'php_version' => phpversion(), 'php_post_max_size' => wc_let_to_num(ini_get('post_max_size')), 'php_max_execution_time' => ini_get('max_execution_time'), 'php_max_input_vars' => ini_get('max_input_vars'), 'curl_version' => $curl_version, 'suhosin_installed' => extension_loaded('suhosin'), 'max_upload_size' => wp_max_upload_size(), 'mysql_version' => !empty($wpdb->is_mysql) ? $wpdb->db_version() : '', 'default_timezone' => date_default_timezone_get(), 'fsockopen_or_curl_enabled' => function_exists('fsockopen') || function_exists('curl_init'), 'soapclient_enabled' => class_exists('SoapClient'), 'domdocument_enabled' => class_exists('DOMDocument'), 'gzip_enabled' => is_callable('gzopen'), 'mbstring_enabled' => extension_loaded('mbstring'), 'remote_post_successful' => $post_response_successful, 'remote_post_response' => is_wp_error($post_response) ? $post_response->get_error_message() : $post_response['response']['code'], 'remote_get_successful' => $get_response_successful, 'remote_get_response' => is_wp_error($get_response) ? $get_response->get_error_message() : $get_response['response']['code']);
}
示例6: test_wc_let_to_num
/**
* Test wc_let_to_num().
*
* @since 2.2
*/
public function test_wc_let_to_num()
{
$sizes = array('10K' => 10240, '10M' => 10485760, '10G' => 10737418240.0, '10T' => 10995116277760.0, '10P' => 1.125899906842624E+16);
foreach ($sizes as $notation => $size) {
$this->assertEquals($size, wc_let_to_num($notation));
}
}
示例7: get_server_info
/**
* Get server related info
* @return array
*/
private static function get_server_info()
{
$server_data = array();
if (isset($_SERVER['SERVER_SOFTWARE']) && !empty($_SERVER['SERVER_SOFTWARE'])) {
$server_data['software'] = $_SERVER['SERVER_SOFTWARE'];
}
if (function_exists('phpversion')) {
$server_data['php_version'] = phpversion();
}
if (function_exists('ini_get')) {
$server_data['php_post_max_size'] = size_format(wc_let_to_num(ini_get('post_max_size')));
$server_data['php_time_limt'] = ini_get('max_execution_time');
$server_data['php_max_input_vars'] = ini_get('max_input_vars');
$server_data['php_suhosin'] = extension_loaded('suhosin') ? 'Yes' : 'No';
}
global $wpdb;
$server_data['mysql_version'] = $wpdb->db_version();
$server_data['php_max_upload_size'] = size_format(wp_max_upload_size());
$server_data['php_default_timezone'] = date_default_timezone_get();
$server_data['php_soap'] = class_exists('SoapClient') ? 'Yes' : 'No';
$server_data['php_fsockopen'] = function_exists('fsockopen') ? 'Yes' : 'No';
$server_data['php_curl'] = function_exists('curl_init') ? 'Yes' : 'No';
return $server_data;
}
示例8: vtprd_deal
//.........这里部分代码省略.........
?>
" class="<?php
echo $vtprd_rule_display_framework['wizard_on_off_sw_select']['option'][$i]['class'];
?>
" value="<?php
echo $vtprd_rule_display_framework['wizard_on_off_sw_select']['option'][$i]['value'];
?>
" <?php
if ($vtprd_rule_display_framework['wizard_on_off_sw_select']['option'][$i]['value'] == $vtprd_rule->wizard_on_off_sw_select) {
echo $selected;
}
?>
> <?php
echo $vtprd_rule_display_framework['wizard_on_off_sw_select']['option'][$i]['title'];
?>
</option>
<?php
}
?>
</select>
<?php
vtprd_show_object_hover_help('hover-help', 'small');
?>
</span>
</span>
</div> <?php
//end blue-line
?>
<?php
//v1.0.9.0 begin
$memory = wc_let_to_num(WP_MEMORY_LIMIT);
if ($memory < 67108864) {
//test for 64mb
?>
<div class="blue-line clear-left">
<span class="left-column">
</span>
<span class="right-column">
<?php
echo 'WP Memory Limit: ' . sprintf(__('%s - We recommend setting memory to at least 64MB. See: <a href="%s">Increasing memory allocated to PHP</a>', 'woocommerce'), size_format($memory), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP');
?>
</span>
</div> <?php
//end blue-line
?>
<?php
}
//v1.0.9.0 end
?>
</div> <?php
//end template-area
?>
</div> <?php
//end top-box
?>
示例9: vtprd_maybe_system_requirements
public function vtprd_maybe_system_requirements()
{
//OVERRIDE System Requirements testing
if (apply_filters('vtprd_turn_off_system_requirements', FALSE)) {
return;
}
//**********************
//* MEMORY 64MB REQUIRED
//**********************
//v1.1.6.3
// Check if WooCommerce is active
if (class_exists('WooCommerce')) {
$memory = wc_let_to_num(WP_MEMORY_LIMIT);
if (function_exists('memory_get_usage')) {
$system_memory = wc_let_to_num(@ini_get('memory_limit'));
$memory = max($memory, $system_memory);
}
//VTPRD_PRO_VERSION only exists if PRO version is installed and active
if ($memory < 67108864 && defined('VTPRD_PRO_VERSION')) {
//test for 64mb
$message = '<h4>' . __('- ', 'vtprd') . VTPRD_PLUGIN_NAME . __(' - You need a minimum of -- 64mb of system memory -- for your site to run Woocommerce + Pricing Deals successfully. ', 'vtprd') . '</h4>';
$message .= ' ' . 'Your system memory is currently ' . size_format($memory);
$message .= '<br><br> ' . '- In wp-admin, please go to Woocommerce/System Status and look for WP Memory Limit. ';
$message .= '<br><br> ' . '- *** Suggest that you increase memory to a 256mb *** (the new defacto standard...) ';
$message .= '<br><br> ' . '- First, --contact your Host-- and request the memory change (this should be FREE from your Host). ';
$message .= '<br><br> ' . '- Then you need to update your wordpress wp_config.php file. See: <a href="http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP">Increasing memory allocated to PHP</a> ';
$message .= '<br><br> ' . '- *** -- BOTH of these actions must be done, in order for the memory change to be accomplished. ';
$message .= '<br><br> ' . '<h3> The more plugins that are used, the more server memory is recommended. These days, 256mb is best!</h3>';
$admin_notices = '<div id="message" class="error fade notice is-dismissible" style="background-color: #FFEBE8 !important;"><p>' . $message . ' </p></div>';
echo $admin_notices;
}
}
//v1.1.6 begin
global $vtprd_license_options;
//v1.1.6 moved here
//**********************
//* php > 5.3.1 REQUIRED
//**********************
//VTPRD_PRO_VERSION only exists if PRO version is installed and active
if (defined('VTPRD_PRO_VERSION')) {
$php_version = phpversion();
if (version_compare($php_version, '5.3.1', '<')) {
$message = '<h4>' . __('- ', 'vtprd') . VTPRD_PRO_PLUGIN_NAME . __(' - PHP version must be ==> 5.3.1 <== or greater, to run this PRO plugin successfully. ', 'vtprd') . '</h4>';
$message .= ' ' . 'Your PHP version is currently ' . $php_version;
$message .= '<br><br> ' . '- Contact your host to upgrade!!!. ';
$admin_notices = '<div id="message" class="error fade notice is-dismissible" style="background-color: #FFEBE8 !important;"><p>' . $message . ' </p></div>';
echo $admin_notices;
}
/*
if (!$vtprd_license_options['older_wordpress_warning_done']) {
global $wp_version;
//if ( version_compare( $wp_version, '4.5', '<' ) ) {
// if ( version_compare( $wp_version, VTPRD_WP_MINIMUM_VERSION_FOR_COMPARISON, '<' ) ) {
if ( version_compare( $wp_version, VTPRD_WP_MINIMUM_VERSION_FOR_COMPARISON, '<' ) ) {
$message = '<h4> ' .VTPRD_PRO_PLUGIN_NAME . '</h4>';
$message .= '<h4> - WORDPRESS VERSION WARNING - </h4>' ;
$message .= ' ' . 'The recommended Wordpress Version to run this PRO plugin successfully = <strong>Version ' .VTPRD_WP_MINIMUM_VERSION_FOR_COMPARISON . '</strong>';
$message .= ' ' . 'Your WordPress Version is <strong> currently ' . $wp_version .'</strong>';
$message .= '<br><br> ' . '- If Possible, Please ' ;
$message .= ' <strong> <a href="'.$vtprd_license_options['home_url'].'/wp-admin/update-core.php">Upgrade Wordpress Version</a> </strong> ' ;
$admin_notices = '<div class="error fade notice is-dismissible"
style="
line-height: 19px;
padding: 0px 15px 11px 15px;
font-size: 14px;
text-align: left;
margin: 25px 20px 15px 2px;
background-color: #fff;
border-left: 4px solid #ffba00;
-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); " > <p>' . $message . ' </p></div>';
echo $admin_notices;
}
$vtprd_license_options['older_wordpress_warning_done'] = true;
update_option('vtprd_license_options', $vtprd_license_options);
}
*/
}
//v1.1.6 end
//v1.1.6.3
// Check if WooCommerce is active
if (class_exists('WooCommerce')) {
//********************************
//* WOOCOMMERCE 2.4+ now REQUIRED
//********************************
$current_version = WOOCOMMERCE_VERSION;
if (version_compare(strval('2.4.0'), strval($current_version), '>') == 1) {
//'==1' = 2nd value is lower
$message = '<h4>' . __('- Current version of - ', 'vtprd') . VTPRD_PLUGIN_NAME . __(' - needs -- WooCommerce Version 2.4+ -- to run successfully. ', 'vtprd') . '</h4>';
$message .= '<br><br> ' . 'Please upgrade to WooCommerce Version 2.4+ ';
$message .= '<br><br> ' . ' - OR - ';
$message .= '<br><br> ' . 'Please contact Varktech for an earlier version of Pricing Deals, if you are still on 2.3+';
$message .= '<br> <strong> <a href="https://www.varktech.com/support/">Varktech Support</a> </strong> ';
$admin_notices = '<div id="message" class="error fade notice is-dismissible" style="background-color: #FFEBE8 !important;"><p>' . $message . ' </p></div>';
echo $admin_notices;
}
}
/* v1.1.6.1 LOCALHOST TEST TEMPORARILY SUSPENDED
********************************************************
//localhost test
//.........这里部分代码省略.........