本文整理汇总了PHP中wp_is_writable函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_is_writable函数的具体用法?PHP wp_is_writable怎么用?PHP wp_is_writable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_is_writable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: mc_write_styles
function mc_write_styles($stylefile, $my_calendar_style)
{
if (defined('DISALLOW_FILE_EDIT') && DISALLOW_FILE_EDIT == true) {
return false;
}
$standard = dirname(__FILE__) . '/styles/';
$files = my_csslist($standard);
foreach ($files as $file) {
$filepath = mc_get_style_path($file);
$path = pathinfo($filepath);
if ($path['extension'] == 'css') {
$styles_whitelist[] = $filepath;
}
}
if (in_array($stylefile, $styles_whitelist)) {
if (function_exists('wp_is_writable')) {
$is_writable = wp_is_writable($stylefile);
} else {
$is_writable = is_writeable($stylefile);
}
if ($is_writable) {
$f = fopen($stylefile, 'w+');
fwrite($f, $my_calendar_style);
// number of bytes to write, max.
fclose($f);
return true;
} else {
return false;
}
}
return false;
}
开发者ID:hoitomt,项目名称:shamrocks_wordpress_site,代码行数:32,代码来源:my-calendar-styles.php
示例2: edd_create_protection_files
/**
* Creates blank index.php and .htaccess files
*
* This function runs approximately once per month in order to ensure all folders
* have their necessary protection files
*
* @since 1.1.5
*
* @param bool $force
* @param bool $method
*/
function edd_create_protection_files($force = false, $method = false)
{
if (false === get_transient('edd_check_protection_files') || $force) {
$upload_path = edd_get_upload_dir();
// Make sure the /edd folder is created
wp_mkdir_p($upload_path);
// Top level .htaccess file
$rules = edd_get_htaccess_rules($method);
if (edd_htaccess_exists()) {
$contents = @file_get_contents($upload_path . '/.htaccess');
if ($contents !== $rules || !$contents) {
// Update the .htaccess rules if they don't match
@file_put_contents($upload_path . '/.htaccess', $rules);
}
} elseif (wp_is_writable($upload_path)) {
// Create the file if it doesn't exist
@file_put_contents($upload_path . '/.htaccess', $rules);
}
// Top level blank index.php
if (!file_exists($upload_path . '/index.php') && wp_is_writable($upload_path)) {
@file_put_contents($upload_path . '/index.php', '<?php' . PHP_EOL . '// Silence is golden.');
}
// Now place index.php files in all sub folders
$folders = edd_scan_folders($upload_path);
foreach ($folders as $folder) {
// Create index.php, if it doesn't exist
if (!file_exists($folder . 'index.php') && wp_is_writable($folder)) {
@file_put_contents($folder . 'index.php', '<?php' . PHP_EOL . '// Silence is golden.');
}
}
// Check for the files once per day
set_transient('edd_check_protection_files', true, 3600 * 24);
}
}
开发者ID:Balamir,项目名称:Easy-Digital-Downloads,代码行数:45,代码来源:upload-functions.php
示例3: update
public function update()
{
if (!$this->is_build_with_elementor()) {
return;
}
$this->parse_elements_css();
$meta = ['version' => ELEMENTOR_VERSION, 'time' => time(), 'fonts' => array_unique($this->fonts)];
if (empty($this->css)) {
$this->delete();
$meta['status'] = self::CSS_STATUS_EMPTY;
$meta['css'] = '';
} else {
$file_created = false;
if (wp_is_writable(dirname($this->path))) {
$file_created = file_put_contents($this->path, $this->css);
}
if ($file_created) {
$meta['status'] = self::CSS_STATUS_FILE;
} else {
$meta['status'] = self::CSS_STATUS_INLINE;
$meta['css'] = $this->css;
}
}
$this->update_meta($meta);
}
开发者ID:pojome,项目名称:elementor,代码行数:25,代码来源:post-css-file.php
示例4: wpum_admin_messages
/**
* Admin Messages
*
* @since 1.0
* @global $wpum_options Array of all the WPUM Options
* @return void
*/
function wpum_admin_messages()
{
global $wpum_options;
$screen = get_current_screen();
if (isset($_GET['settings-updated']) && $_GET['settings-updated'] == true && !wpum_get_option('custom_passwords') && wpum_get_option('password_strength')) {
add_settings_error('wpum-notices', 'custom-passwords-disabled', __('You have enabled the "Minimum Password Strength" option, the "Users custom passwords" is currently disabled and must be enabled for custom passwords to work.', 'wpum'), 'error');
}
if (isset($_GET['settings-updated']) && $_GET['settings-updated'] == true && !wpum_get_option('custom_passwords') && wpum_get_option('login_after_registration')) {
add_settings_error('wpum-notices', 'custom-passwords-disabled', __('Error: the option "Login after registration" can only work when the option "Users custom passwords" is enabled too.', 'wpum'), 'error');
}
if (isset($_GET['emails-updated']) && $_GET['emails-updated'] == true) {
add_settings_error('wpum-notices', 'emails-updated', __('Email successfully updated.', 'wpum'), 'updated');
}
// Display Errors in plugin settings page
if ($screen->base == 'users_page_wpum-settings') {
// Display error if no core page is setup
if (!wpum_get_option('login_page') || !wpum_get_option('password_recovery_page') || !wpum_get_option('registration_page') || !wpum_get_option('account_page') || !wpum_get_option('profile_page')) {
add_settings_error('wpum-notices', 'page-missing', __('One or more WPUM pages are not configured.', 'wpum') . ' ' . sprintf(__('<a href="%s" class="button-primary">Click here to setup your pages</a>', 'wpum'), admin_url('users.php?page=wpum-settings&tab=general&wpum_action=install_pages')), 'error');
}
// Display error if wrong permalinks
if (get_option('permalink_structure') == '') {
add_settings_error('wpum-notices', 'permalink-wrong', sprintf(__('You must <a href="%s">change your permalinks</a> to anything else other than "default" for profiles to work.', 'wpum'), admin_url('options-permalink.php')), 'error');
}
if (isset($_GET['setup_done']) && $_GET['setup_done'] == 'true') {
add_settings_error('wpum-notices', 'pages-updated', __('Pages setup completed.', 'wpum'), 'updated');
}
if (isset($_GET['message']) && $_GET['message'] == 'fields_fixed') {
add_settings_error('wpum-notices', 'fields_fixed', __('Fields successfully fixed.', 'wpum'), 'updated');
}
}
// Verify if upload folder is writable
if (isset($_GET['wpum_action']) && $_GET['wpum_action'] == 'check_folder_permission') {
$upload_dir = wp_upload_dir();
if (!wp_is_writable($upload_dir['path'])) {
add_settings_error('wpum-notices', 'permission-error', sprintf(__('Your uploads folder in "%s" is not writable. <br/>Avatar uploads will not work, please adjust folder permission.<br/><br/> <a href="%s" class="button" target="_blank">Read More</a>', 'wpum'), $upload_dir['basedir'], 'http://www.wpbeginner.com/wp-tutorials/how-to-fix-image-upload-issue-in-wordpress/'), 'error');
} else {
add_settings_error('wpum-notices', 'permission-success', sprintf(__('No issues detected.', 'wpum'), admin_url('users.php?page=wpum-settings&tab=profile')), 'updated notice is-dismissible');
}
}
// messages for the groups and fields pages
if ($screen->base == 'users_page_wpum-profile-fields') {
if (isset($_GET['message']) && $_GET['message'] == 'group_success') {
add_settings_error('wpum-notices', 'group-updated', __('Field group successfully updated.', 'wpum'), 'updated');
}
if (isset($_GET['message']) && $_GET['message'] == 'group_delete_success') {
add_settings_error('wpum-notices', 'group-deleted', __('Field group successfully deleted.', 'wpum'), 'updated');
}
if (isset($_GET['message']) && $_GET['message'] == 'field_saved') {
add_settings_error('wpum-notices', 'field-saved', __('Field successfully updated.', 'wpum'), 'updated');
}
}
// messages for tools page
if ($screen->base == 'users_page_wpum-tools') {
if (isset($_GET['message']) && $_GET['message'] == 'settings_imported') {
add_settings_error('wpum-notices', 'settings-imported', __('Settings successfully imported.', 'wpum'), 'updated');
}
}
settings_errors('wpum-notices');
}
开发者ID:pierreglardon,项目名称:gdv-ttc,代码行数:66,代码来源:admin-notices.php
示例5: testFallbackPath
/**
* If the default path is unwritable then it should fallback to the fallback path
*/
public function testFallbackPath()
{
$this->assertEquals($this->path->get_default_path(), $this->path->get_path());
if (wp_is_writable($this->path->get_default_path())) {
$this->markTestSkipped('The default path was still writable');
}
$this->path->calculate_path();
$this->assertEquals($this->path->get_path(), $this->path->get_fallback_path());
$this->assertFileExists($this->path->get_fallback_path());
}
开发者ID:rjagadishsingh,项目名称:backupwordpress,代码行数:13,代码来源:testBackupPath.php
示例6: delete_report
private function delete_report($filename)
{
if (!empty($filename) && !is_string($filename)) {
return new WP_Error('invalid-argument', 'The delete-report function takes a string representing an individual report.');
}
$upload_path = Ithemes_Sync_Functions::get_upload_reports_dir();
if (!empty($upload_path) && wp_is_writable($upload_path)) {
@unlink($upload_path . '/' . $filename);
return true;
}
return false;
}
开发者ID:AndyA,项目名称:River,代码行数:12,代码来源:manage-reports.php
示例7: can_fix
public function can_fix()
{
if (GRAV_TESTS::is_editable()) {
$path = $this->get_wp_config_path();
if ($path && wp_is_writable($path)) {
if ($contents = file_get_contents($path)) {
$contents = GRAV_TESTS::remove_comments($contents);
if (preg_match('/define[^;]*WP_DEBUG.*(true|TRUE)[^;]*/s', $contents, $matches)) {
return true;
}
}
}
}
return false;
}
开发者ID:geoff-gedde,项目名称:Gravitate-Tester,代码行数:15,代码来源:wp_debug.php
示例8: themeton_less_mkdir
function themeton_less_mkdir()
{
$upload_dir = wp_upload_dir();
if (wp_is_writable($upload_dir['basedir'])) {
$dir = 'themeton';
$path = trailingslashit($upload_dir['basedir']) . $dir;
if (!@is_dir($path)) {
if (wp_mkdir_p($path)) {
return $path;
}
} else {
return $path;
}
}
return false;
}
开发者ID:petersondrs,项目名称:tellura,代码行数:16,代码来源:index.php
示例9: mc_write_styles
function mc_write_styles($stylefile, $my_calendar_style)
{
if (function_exists('wp_is_writable')) {
$is_writable = wp_is_writable($stylefile);
} else {
$is_writable = is_writeable($stylefile);
}
if ($is_writable) {
$f = fopen($stylefile, 'w+');
fwrite($f, $my_calendar_style);
// number of bytes to write, max.
fclose($f);
return true;
} else {
return false;
}
}
开发者ID:HugoLS,项目名称:Variation,代码行数:17,代码来源:my-calendar-styles.php
示例10: wpcf7_cleanup_upload_files
function wpcf7_cleanup_upload_files()
{
$dir = trailingslashit(wpcf7_upload_tmp_dir());
if (!is_dir($dir)) {
return false;
}
if (!is_readable($dir)) {
return false;
}
if (!wp_is_writable($dir)) {
return false;
}
if ($handle = @opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file == "." || $file == ".." || $file == ".htaccess") {
continue;
}
$stat = stat($dir . $file);
if ($stat['mtime'] + 60 < time()) {
// 60 secs
@unlink($dir . $file);
}
}
closedir($handle);
}
}
开发者ID:KurtMakesWeb,项目名称:CandG,代码行数:26,代码来源:file.php
示例11: wpcf7_cleanup_captcha_files
function wpcf7_cleanup_captcha_files()
{
if (!($captcha = wpcf7_init_captcha())) {
return false;
}
if (is_callable(array($captcha, 'cleanup'))) {
return $captcha->cleanup();
}
$dir = trailingslashit(wpcf7_captcha_tmp_dir());
if (!is_dir($dir) || !is_readable($dir) || !wp_is_writable($dir)) {
return false;
}
if ($handle = @opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if (!preg_match('/^[0-9]+\\.(php|txt|png|gif|jpeg)$/', $file)) {
continue;
}
$stat = @stat($dir . $file);
if ($stat['mtime'] + 3600 < time()) {
// 3600 secs == 1 hour
@unlink($dir . $file);
}
}
closedir($handle);
}
}
开发者ID:dracudakid,项目名称:WP_TrungTamTinHoc,代码行数:26,代码来源:really-simple-captcha.php
示例12: wpcf7_cleanup_upload_files
function wpcf7_cleanup_upload_files()
{
if (is_admin() || 'GET' != $_SERVER['REQUEST_METHOD'] || is_robots() || is_feed() || is_trackback()) {
return;
}
$dir = trailingslashit(wpcf7_upload_tmp_dir());
if (!is_dir($dir) || !is_readable($dir) || !wp_is_writable($dir)) {
return;
}
if ($handle = @opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file == "." || $file == ".." || $file == ".htaccess") {
continue;
}
$mtime = @filemtime($dir . $file);
if ($mtime && time() < $mtime + 60) {
// less than 60 secs old
continue;
}
wpcf7_rmdir_p(path_join($dir, $file));
}
closedir($handle);
}
}
开发者ID:flasomm,项目名称:Montkailash,代码行数:24,代码来源:file.php
示例13: wpstg_create_clonedetails_files
/**
* Create json cloning_details.json after activation of the plugin
*
* @return bool
*/
function wpstg_create_clonedetails_files()
{
$path = wpstg_get_upload_dir();
if (wp_is_writable($path)) {
$file = 'clone_details.json';
file_put_contents($path . '/' . $file, null);
} else {
WPSTG()->logger->info($path . '/' . $file . ' is not writeable! ');
}
}
开发者ID:pedro-mendonca,项目名称:wp-staging,代码行数:15,代码来源:install.php
示例14: rs_wpss_log_reset
function rs_wpss_log_reset($admin_ips = NULL, $get_fws = FALSE, $clr_hta = FALSE, $mk_log = FALSE)
{
/***
* $ip - Optional
* $get_fws - File writeable status - returns bool
* $clr_hta - Reset .htaccess only, don't reset log
* $mk_log - Make log log file if none exists
***/
$admin_ips = !empty($admin_ips) && is_array($admin_ips) ? $admin_ips : get_option('spamshield_admins');
$admin_ips = rs_wpss_remove_expired_admins($admin_ips);
if (!empty($admin_ips) && is_array($admin_ips)) {
$admin_ips = array_map('intval', $admin_ips);
$admin_ips = rs_wpss_sort_unique(array_flip($admin_ips));
} elseif (rs_wpss_is_user_admin()) {
$current_ip = rs_wpss_get_ip_addr();
rs_wpss_update_user_ip(NULL, TRUE, $admin_ips);
if (rs_wpss_is_valid_ip($current_ip)) {
$admin_ips = (array) $current_ip;
}
}
if (empty($admin_ips) || !is_array($admin_ips)) {
$last_admin_ip = get_option('spamshield_last_admin');
if (!empty($last_admin_ip) && rs_wpss_is_valid_ip($last_admin_ip)) {
$admin_ips = (array) $last_admin_ip;
}
}
$wpss_log_key = rs_wpss_get_log_key();
$wpss_log_key_uc = rs_wpss_casetrans('upper', $wpss_log_key);
$wpss_log_filnm = strpos(WPSS_SERVER_NAME_REV, WPSS_MDBUG_SERVER_NAME_REV) === 0 ? 'temp-comments-log.txt' : 'temp-comments-log-' . $wpss_log_key . '.txt';
$wpss_log_filns = array('', $wpss_log_filnm, 'temp-comments-log.init.txt', '.htaccess', 'htaccess.txt', 'htaccess.init.txt');
/* Filenames - log, log_empty, htaccess, htaccess,_orig, htaccess_empty */
$wpss_log_perlr = array(0775, 0664, 0664, 0664, 0664, 0664);
/* Permission level recommended */
$wpss_log_perlm = array(0755, 0644, 0644, 0644, 0644, 0644);
/* Permission level minimum */
$wpss_log_files = array();
/* Log files with full paths */
foreach ($wpss_log_filns as $f => $filn) {
$wpss_log_files[] = WPSS_PLUGIN_DATA_PATH . '/' . $filn;
}
/* 1 - Create temp-comments-log-{random hash}.txt if it doesn't exist */
clearstatcache();
if (!file_exists($wpss_log_files[1])) {
@chmod($wpss_log_files[2], 0664);
@copy($wpss_log_files[2], $wpss_log_files[1]);
@chmod($wpss_log_files[1], 0664);
}
if (!empty($mk_log)) {
return FALSE;
}
/* 2 - Create .htaccess if it doesn't exist */
clearstatcache();
if (!file_exists($wpss_log_files[3])) {
@chmod($wpss_log_files[0], 0775);
@chmod($wpss_log_files[4], 0664);
@chmod($wpss_log_files[5], 0664);
@rename($wpss_log_files[4], $wpss_log_files[3]);
@copy($wpss_log_files[5], $wpss_log_files[4]);
foreach ($wpss_log_files as $f => $file) {
@chmod($file, $wpss_log_perlr[$f]);
}
}
/* 3 - Check file permissions and fix */
clearstatcache();
$wpss_log_perms = array();
/* File permissions */
foreach ($wpss_log_files as $f => $file) {
$wpss_log_perms[] = substr(sprintf('%o', fileperms($file)), -4);
}
foreach ($wpss_log_perlr as $p => $perlr) {
if ($wpss_log_perms[$p] < $perlr || !wp_is_writable($wpss_log_files[$p])) {
foreach ($wpss_log_files as $f => $file) {
@chmod($file, $wpss_log_perlr[$f]);
}
/* Correct the permissions... */
break;
}
}
/* 4 - Clear files by copying fresh versions to existing files */
if (empty($clr_hta)) {
if (file_exists($wpss_log_files[1]) && file_exists($wpss_log_files[2])) {
@copy($wpss_log_files[2], $wpss_log_files[1]);
}
/* Log file */
}
if (file_exists($wpss_log_files[3]) && file_exists($wpss_log_files[5])) {
@copy($wpss_log_files[5], $wpss_log_files[3]);
}
/* .htaccess file */
/* 5 - Write .htaccess */
$wpss_htaccess_data = $wpss_access_ap22 = '';
$wpss_access_ap24 = 'Require all denied' . WPSS_EOL;
if (!empty($admin_ips) && is_array($admin_ips)) {
$ip_rgx = '^(' . str_replace(array('.', ':'), array('\\.', '\\:'), implode('|', $admin_ips)) . ')$';
$wpss_htaccess_data .= '<IfModule mod_setenvif.c>' . WPSS_EOL . "\t" . 'SetEnvIf Remote_Addr ' . $ip_rgx . ' WPSS_ACCESS_' . $wpss_log_key_uc . WPSS_EOL . '</IfModule>' . WPSS_EOL . WPSS_EOL;
$wpss_access_ap22 = "\t\t" . 'Allow from env=WPSS_ACCESS_' . $wpss_log_key_uc . WPSS_EOL;
$wpss_access_ap24 = 'Require env WPSS_ACCESS_' . $wpss_log_key_uc . WPSS_EOL;
}
$wpss_htaccess_data .= '<Files ' . $wpss_log_filnm . '>' . WPSS_EOL;
$wpss_htaccess_data .= "\t" . '# Apache 2.2' . WPSS_EOL . "\t" . '<IfModule !mod_authz_core.c>' . WPSS_EOL . "\t\t" . 'Order deny,allow' . WPSS_EOL . "\t\t" . 'Deny from all' . WPSS_EOL . $wpss_access_ap22 . "\t" . '</IfModule>' . WPSS_EOL . WPSS_EOL;
//.........这里部分代码省略.........
开发者ID:rosslibby,项目名称:davinaplugins,代码行数:101,代码来源:wp-spamshield.php
示例15: hmbkp_set_server_config_notices
function hmbkp_set_server_config_notices()
{
$notices = HM\BackUpWordPress\Notices::get_instance();
$messages = array();
if (!HM\BackUpWordPress\Backup::is_shell_exec_available()) {
$php_user = '<PHP USER>';
$php_group = '<PHP GROUP>';
} else {
$php_user = shell_exec('whoami');
$groups = explode(' ', shell_exec('groups'));
$php_group = reset($groups);
}
if (!is_dir(hmbkp_path())) {
$messages[] = sprintf(__('The backups directory can\'t be created because your %1$s directory isn\'t writable, run %2$s or %3$s or create the folder yourself.', 'backupwordpress'), '<code>' . esc_html(dirname(hmbkp_path())) . '</code>', '<code>chown ' . esc_html($php_user) . ':' . esc_html($php_group) . ' ' . esc_html(dirname(hmbkp_path())) . '</code>', '<code>chmod 777 ' . esc_html(dirname(hmbkp_path())) . '</code>');
}
if (is_dir(hmbkp_path()) && !wp_is_writable(hmbkp_path())) {
$messages[] = sprintf(__('Your backups directory isn\'t writable, run %1$s or %2$s or set the permissions yourself.', 'backupwordpress'), '<code>chown -R ' . esc_html($php_user) . ':' . esc_html($php_group) . ' ' . esc_html(hmbkp_path()) . '</code>', '<code>chmod -R 777 ' . esc_html(hmbkp_path()) . '</code>');
}
if (HM\BackUpWordPress\Backup::is_safe_mode_active()) {
$messages[] = sprintf(__('%1$s is running in %2$s, please contact your host and ask them to disable it. BackUpWordPress may not work correctly whilst %3$s is on.', 'backupwordpress'), '<code>PHP</code>', sprintf('<a href="%1$s">%2$s</a>', __('http://php.net/manual/en/features.safe-mode.php', 'backupwordpress'), __('Safe Mode', 'backupwordpress')), '<code>' . __('Safe Mode', 'backupwordpress') . '</code>');
}
if (defined('HMBKP_PATH') && HMBKP_PATH) {
// Suppress open_basedir warning https://bugs.php.net/bug.php?id=53041
if (!@file_exists(HMBKP_PATH)) {
$messages[] = sprintf(__('Your custom path does not exist', 'backupwordpress'));
} elseif (hmbkp_is_restricted_custom_path()) {
$messages[] = sprintf(__('Your custom path is unreachable due to a restriction set in your PHP configuration (open_basedir)', 'backupwordpress'));
} else {
if (!@is_dir(HMBKP_PATH)) {
$messages[] = sprintf(__('Your custom backups directory %1$s doesn\'t exist and can\'t be created, your backups will be saved to %2$s instead.', 'backupwordpress'), '<code>' . esc_html(HMBKP_PATH) . '</code>', '<code>' . esc_html(hmbkp_path()) . '</code>');
}
if (@is_dir(HMBKP_PATH) && !wp_is_writable(HMBKP_PATH)) {
$messages[] = sprintf(__('Your custom backups directory %1$s isn\'t writable, new backups will be saved to %2$s instead.', 'backupwordpress'), '<code>' . esc_html(HMBKP_PATH) . '</code>', '<code>' . esc_html(hmbkp_path()) . '</code>');
}
}
}
$test_backup = new HM\BackUpWordPress\Backup();
if (!is_readable($test_backup->get_root())) {
$messages[] = sprintf(__('Your site root path %s isn\'t readable.', 'backupwordpress'), '<code>' . $test_backup->get_root() . '</code>');
}
if (count($messages) > 0) {
$notices->set_notices('server_config', $messages, false);
}
}
开发者ID:alexanderpetrob89,项目名称:fei.edu,代码行数:44,代码来源:interface.php
示例16: move_old_backups
/**
* Move backup files from an existing directory and the new
* location
*
* @param string $path The path to move the backups from
* @return void
*/
public function move_old_backups($from)
{
if (!is_readable($from)) {
return;
}
if (!wp_is_writable($this->get_path())) {
return;
}
// Move any existing backups
if ($handle = opendir($from)) {
// Loop through the backup directory
while (false !== ($file = readdir($handle))) {
// Find all zips
if ('zip' === pathinfo($file, PATHINFO_EXTENSION)) {
// Try to move them
if (!@rename(trailingslashit($from) . $file, trailingslashit($this->get_path()) . $file)) {
// If we can't move them then try to copy them
copy(trailingslashit($from) . $file, trailingslashit($this->get_path()) . $file);
}
}
}
closedir($handle);
}
// Delete the old directory if it's inside WP_CONTENT_DIR
if (false !== strpos($from, WP_CONTENT_DIR) && $from !== $this->get_path()) {
hmbkp_rmdirtree($from);
}
}
开发者ID:Natedaug,项目名称:WordPressSites,代码行数:35,代码来源:class-hmbkp-path.php
示例17: wpstg_save_options
/**
* Save global clone details options
* and create clone_details.json
*
* @return void
*/
function wpstg_save_options()
{
global $wpstg_clone_details;
$path = wpstg_get_upload_dir();
if (wp_is_writable($path)) {
$file = 'clone_details.json';
file_put_contents($path . '/' . $file, json_encode($wpstg_clone_details));
} else {
wpstg_log($path . '/' . $file . ' is not writeable! ');
}
}
开发者ID:pedro-mendonca,项目名称:wp-staging,代码行数:17,代码来源:template-functions.php
示例18: request
//.........这里部分代码省略.........
return $pre;
}
if (function_exists('wp_kses_bad_protocol')) {
if ($r['reject_unsafe_urls']) {
$url = wp_http_validate_url($url);
}
if ($url) {
$url = wp_kses_bad_protocol($url, array('http', 'https', 'ssl'));
}
}
$arrURL = @parse_url($url);
if (empty($url) || empty($arrURL['scheme'])) {
return new WP_Error('http_request_failed', __('A valid URL was not provided.'));
}
if ($this->block_request($url)) {
return new WP_Error('http_request_failed', __('User has blocked requests through HTTP.'));
}
/*
* Determine if this is a https call and pass that on to the transport functions
* so that we can blacklist the transports that do not support ssl verification
*/
$r['ssl'] = $arrURL['scheme'] == 'https' || $arrURL['scheme'] == 'ssl';
// Determine if this request is to OUR install of WordPress.
$homeURL = parse_url(get_bloginfo('url'));
$r['local'] = 'localhost' == $arrURL['host'] || isset($homeURL['host']) && $homeURL['host'] == $arrURL['host'];
unset($homeURL);
/*
* If we are streaming to a file but no filename was given drop it in the WP temp dir
* and pick its name using the basename of the $url.
*/
if ($r['stream'] && empty($r['filename'])) {
$r['filename'] = get_temp_dir() . wp_unique_filename(get_temp_dir(), basename($url));
}
/*
* Force some settings if we are streaming to a file and check for existence and perms
* of destination directory.
*/
if ($r['stream']) {
$r['blocking'] = true;
if (!wp_is_writable(dirname($r['filename']))) {
return new WP_Error('http_request_failed', __('Destination directory for file streaming does not exist or is not writable.'));
}
}
if (is_null($r['headers'])) {
$r['headers'] = array();
}
if (!is_array($r['headers'])) {
$processedHeaders = self::processHeaders($r['headers'], $url);
$r['headers'] = $processedHeaders['headers'];
}
if (isset($r['headers']['User-Agent'])) {
$r['user-agent'] = $r['headers']['User-Agent'];
unset($r['headers']['User-Agent']);
}
if (isset($r['headers']['user-agent'])) {
$r['user-agent'] = $r['headers']['user-agent'];
unset($r['headers']['user-agent']);
}
if ('1.1' == $r['httpversion'] && !isset($r['headers']['connection'])) {
$r['headers']['connection'] = 'close';
}
// Construct Cookie: header if any cookies are set.
self::buildCookieHeader($r);
// Avoid issues where mbstring.func_overload is enabled.
mbstring_binary_safe_encoding();
if (!isset($r['headers']['Accept-Encoding'])) {
if ($encoding = WP_Http_Encoding::accept_encoding($url, $r)) {
$r['headers']['Accept-Encoding'] = $encoding;
}
}
if (!is_null($r['body']) && '' != $r['body'] || 'POST' == $r['method'] || 'PUT' == $r['method']) {
if (is_array($r['body']) || is_object($r['body'])) {
$r['body'] = http_build_query($r['body'], null, '&');
if (!isset($r['headers']['Content-Type'])) {
$r['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset');
}
}
if ('' === $r['body']) {
$r['body'] = null;
}
if (!isset($r['headers']['Content-Length']) && !isset($r['headers']['content-length'])) {
$r['headers']['Content-Length'] = strlen($r['body']);
}
}
$response = $this->_dispatch_request($url, $r);
reset_mbstring_encoding();
if (is_wp_error($response)) {
return $response;
}
// Append cookies that were used in this request to the response
if (!empty($r['cookies'])) {
$cookies_set = wp_list_pluck($response['cookies'], 'name');
foreach ($r['cookies'] as $cookie) {
if (!in_array($cookie->name, $cookies_set) && $cookie->test($url)) {
$response['cookies'][] = $cookie;
}
}
}
return $response;
}
开发者ID:mondi-webdigital,项目名称:prueba-wordpress,代码行数:101,代码来源:class-http.php
示例19: ob_end_clean
ob_end_clean();
$dashboard_required_array['rs-version-information'] = array('order' => 20, 'content' => $dbc);
ob_start();
?>
<!-- Requirements & Recommendations -->
<div class="rs-dash-widget">
<?php
$dir = wp_upload_dir();
$mem_limit = ini_get('memory_limit');
$mem_limit_byte = wp_convert_hr_to_bytes($mem_limit);
$upload_max_filesize = ini_get('upload_max_filesize');
$upload_max_filesize_byte = wp_convert_hr_to_bytes($upload_max_filesize);
$post_max_size = ini_get('post_max_size');
$post_max_size_byte = wp_convert_hr_to_bytes($post_max_size);
$writeable_boolean = wp_is_writable($dir['basedir'] . '/');
$can_connect = get_option('revslider-connection', false);
$mem_limit_byte_boolean = $mem_limit_byte < 268435456;
$upload_max_filesize_byte_boolean = $upload_max_filesize_byte < 33554432;
$post_max_size_byte_boolean = $post_max_size_byte < 33554432;
$dash_rr_status = $writeable_boolean == true && $can_connect == true && $mem_limit_byte_boolean == false && $upload_max_filesize_byte_boolean == false && $post_max_size_byte_boolean == false ? "rs-status-green-wrap" : "rs-status-red-wrap";
?>
<div class="rs-dash-title-wrap <?php
echo $dash_rr_status;
?>
">
<div class="rs-dash-title"><?php
_e("System Requirements", 'revslider');
?>
</div>
开发者ID:robertmeans,项目名称:evergreentaphouse,代码行数:31,代码来源:slider-overview.php
示例20: set_upload_writeable_notice
public function set_upload_writeable_notice()
{
if (!wp_is_writable(WC_germanized_pro()->plugin_path() . '/uploads')) {
?>
<div class="error">
<p><?php
printf(_x('Seems to be that your PDF upload directory (%s) is not writeable. Please set <a href="%s" target="_blank">file permissions</a>.', 'invoices', 'woocommerce-germanized-pro'), WC_germanized_pro()->plugin_path() . '/uploads/', 'http://codex.wordpress.org/Changing_File_Permissions');
?>
</p>
</div>
<?php
}
}
开发者ID:radscheit,项目名称:unicorn,代码行数:13,代码来源:class-wc-gzdp-invoice-helper.php
注:本文中的wp_is_writable函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论