本文整理汇总了PHP中AIOWPSecurity_Utility_File::get_file_contents方法的典型用法代码示例。如果您正苦于以下问题:PHP AIOWPSecurity_Utility_File::get_file_contents方法的具体用法?PHP AIOWPSecurity_Utility_File::get_file_contents怎么用?PHP AIOWPSecurity_Utility_File::get_file_contents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AIOWPSecurity_Utility_File
的用法示例。
在下文中一共展示了AIOWPSecurity_Utility_File::get_file_contents方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: backup_file_contents_to_db
static function backup_file_contents_to_db($src_file_path, $key_description)
{
global $wpdb, $aio_wp_security;
$file_contents = AIOWPSecurity_Utility_File::get_file_contents($src_file_path);
$payload = serialize($file_contents);
$date_time = current_time('mysql');
$data = array('date_time' => $date_time, 'meta_key1' => $key_description, 'meta_value2' => $payload);
//First check if a backup entry already exists in the global_meta table
$aiowps_global_meta_tbl_name = AIOWPSEC_TBL_GLOBAL_META_DATA;
$resultset = $wpdb->get_row("SELECT * FROM {$aiowps_global_meta_tbl_name} WHERE meta_key1 = '{$key_description}'", OBJECT);
if ($resultset) {
$where = array('meta_key1' => $key_description);
$res = $wpdb->update($aiowps_global_meta_tbl_name, $data, $where);
} else {
$res = $wpdb->insert($aiowps_global_meta_tbl_name, $data);
}
if ($res === false) {
$aio_wp_security->debug_logger->log_debug("AIOWPSecurity_Utility_File::backup_file_contents_to_db() - Unable to write entry to DB", 4);
}
return;
}
示例2: render_tab3
//.........这里部分代码省略.........
}
} else {
$aio_wp_security->debug_logger->log_debug("wp-config.php restore failed - Contents of restore file appear invalid!", 4);
$this->show_msg_error(__('wp-config.php Restore operation failed! Please check the contents of the file you are trying to restore from.', 'aiowpsecurity'));
}
}
}
?>
<h2><?php
_e('wp-config.php File Operations', 'aiowpsecurity');
?>
</h2>
<div class="aio_blue_box">
<?php
echo '<p>' . __('Your "wp-config.php" file is one of the most important in your WordPress installation. It is a primary configuration file and contains crucial things such as details of your database and other critical components.', 'aiowpsecurity') . '
<br />' . __('This feature allows you to backup and save your currently active wp-config.php file should you need to re-use the the backed up file in the future.', 'aiowpsecurity') . '
<br />' . __('You can also restore your site\'s wp-config.php settings using a backed up wp-config.php file.', 'aiowpsecurity') . '
</p>';
?>
</div>
<?php
if (AIOWPSecurity_Utility::is_multisite_install() && get_current_blog_id() != 1) {
//Hide config settings if MS and not main site
AIOWPSecurity_Utility::display_multisite_message();
} else {
?>
<div class="postbox">
<h3><label for="title"><?php
_e('Save the current wp-config.php file', 'aiowpsecurity');
?>
</label></h3>
<div class="inside">
<form action="" method="POST">
<?php
wp_nonce_field('aiowpsec-save-wp-config-nonce');
?>
<p class="description"><?php
_e('Click the button below to backup and download the contents of the currently active wp-config.php file.', 'aiowpsecurity');
?>
</p>
<input type="submit" name="aiowps_save_wp_config" value="<?php
_e('Backup wp-config.php File', 'aiowpsecurity');
?>
" class="button-primary" />
</form>
</div></div>
<div class="postbox">
<h3><label for="title"><?php
_e('Restore from a backed up wp-config file', 'aiowpsecurity');
?>
</label></h3>
<div class="inside">
<form action="" method="POST">
<?php
wp_nonce_field('aiowpsec-restore-wp-config-nonce');
?>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php
_e('wp-config file to restore from', 'aiowpsecurity');
?>
:</th>
<td>
<input type="button" id="aiowps_wp_config_file_button" name="aiowps_wp_config_file_button" class="button rbutton" value="Select Your wp-config File" />
<input name="aiowps_wp_config_file" type="text" id="aiowps_wp_config_file" value="" size="80" />
<p class="description">
<?php
_e('After selecting your file click the button below to restore your site using the backed up wp-config file (wp-config.php.backup.txt).', 'aiowpsecurity');
?>
</p>
</td>
</tr>
</table>
<input type="submit" name="aiowps_restore_wp_config_button" value="<?php
_e('Restore wp-config File', 'aiowpsecurity');
?>
" class="button-primary" />
</form>
</div></div>
<div class="postbox">
<h3><label for="title"><?php
_e('View Contents of the currently active wp-config.php file', 'aiowpsecurity');
?>
</label></h3>
<div class="inside">
<?php
$wp_config_file = AIOWPSecurity_Utility_File::get_wp_config_file_path();
$wp_config_contents = AIOWPSecurity_Utility_File::get_file_contents($wp_config_file);
?>
<textarea class="aio_text_area_file_output aio_width_80 aio_spacer_10_tb" rows="20" readonly><?php
echo $wp_config_contents;
?>
</textarea>
</div></div>
<?php
}
//End if statement
}
示例3: render_tab4
function render_tab4()
{
global $wpdb;
$file_selected = isset($_POST["aiowps_log_file"]) ? $_POST["aiowps_log_file"] : '';
?>
<div class="postbox">
<h3 class="hndle"><label for="title"><?php
_e('View Logs for All In WP Security & Firewall Plugin', 'all-in-one-wp-security-and-firewall');
?>
</label></h3>
<div class="inside">
<form action="" method="POST">
<?php
wp_nonce_field('aiowpsec-dashboard-logs-nonce');
?>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php
_e('Log File', 'all-in-one-wp-security-and-firewall');
?>
:</th>
<td>
<select id="aiowps_log_file" name="aiowps_log_file">
<option value=""><?php
_e('--Select a file--', 'all-in-one-wp-security-and-firewall');
?>
</option>
<option value="wp-security-log.txt" <?php
selected($file_selected, 'wp-security-log.txt');
?>
>wp-security-log</option>
<option value="wp-security-log-cron-job.txt" <?php
selected($file_selected, 'wp-security-log-cron-job.txt');
?>
>wp-security-log-cron-job</option>
</select>
<span class="description"><?php
_e('Select one of the log files to view the contents', 'all-in-one-wp-security-and-firewall');
?>
</span>
</td>
</tr>
</table>
<input type="submit" name="aiowps_view_logs" value="<?php
_e('View Logs', 'all-in-one-wp-security-and-firewall');
?>
" class="button-primary" />
</form>
</div></div>
<?php
if (isset($_POST['aiowps_view_logs'])) {
$error = '';
$nonce = $_REQUEST['_wpnonce'];
if (!wp_verify_nonce($nonce, 'aiowpsec-dashboard-logs-nonce')) {
$aio_wp_security->debug_logger->log_debug("Nonce check failed on dashboard view logs!", 4);
die("Nonce check failed on dashboard view logs!");
}
if (!empty($file_selected)) {
?>
<div class="postbox">
<h3 class="hndle"><label for="title"><?php
echo __('Log File Contents For', 'all-in-one-wp-security-and-firewall') . ': ' . $file_selected;
?>
</label></h3>
<div class="inside">
<?php
$aiowps_log_dir = AIO_WP_SECURITY_PATH . '/logs';
$log_file = $aiowps_log_dir . '/' . $file_selected;
if (file_exists($log_file)) {
$log_contents = AIOWPSecurity_Utility_File::get_file_contents($log_file);
} else {
$log_contents = '';
}
if (empty($log_contents)) {
$log_contents = $file_selected . ': ' . __('Log file is empty!', 'all-in-one-wp-security-and-firewall');
}
?>
<textarea class="aio_text_area_file_output aio_half_width aio_spacer_10_tb" rows="15" readonly><?php
echo $log_contents;
?>
</textarea>
</div>
</div>
<?php
}
}
?>
<?php
}