本文整理汇总了PHP中get_filesystem_method函数的典型用法代码示例。如果您正苦于以下问题:PHP get_filesystem_method函数的具体用法?PHP get_filesystem_method怎么用?PHP get_filesystem_method使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_filesystem_method函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin_init
public function admin_init()
{
if (!empty($_GET['developer_plugin_reset']) && current_user_can('manage_options')) {
delete_option(self::OPTION);
}
$this->recommended_plugins = array('debug-bar' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar', 'a8c-developer'), 'active' => class_exists('Debug_Bar')), 'debug-bar-console' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar Console', 'a8c-developer'), 'active' => function_exists('debug_bar_console_panel')), 'debug-bar-cron' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar Cron', 'a8c-developer'), 'active' => function_exists('zt_add_debug_bar_cron_panel')), 'debug-bar-extender' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar Extender', 'a8c-developer'), 'active' => class_exists('Debug_Bar_Extender')), 'rewrite-rules-inspector' => array('project_type' => 'all', 'name' => esc_html__('Rewrite Rules Inspector', 'a8c-developer'), 'active' => class_exists('Rewrite_Rules_Inspector')), 'log-deprecated-notices' => array('project_type' => 'all', 'name' => esc_html__('Log Deprecated Notices', 'a8c-developer'), 'active' => class_exists('Deprecated_Log')), 'log-viewer' => array('project_type' => 'all', 'name' => esc_html__('Log Viewer', 'a8c-developer'), 'active' => class_exists('ciLogViewer')), 'vip-scanner' => array('project_type' => 'wpcom-vip', 'name' => esc_html__('VIP Scanner', 'a8c-developer'), 'active' => class_exists('VIP_Scanner')), 'jetpack' => array('project_type' => 'wpcom-vip', 'name' => esc_html__('Jetpack', 'a8c-developer'), 'active' => class_exists('Jetpack')), 'polldaddy' => array('project_type' => 'wpcom-vip', 'name' => esc_html__('Polldaddy Polls & Ratings', 'a8c-developer'), 'active' => class_exists('WP_Polldaddy')), 'monster-widget' => array('project_type' => 'all', 'name' => esc_html__('Monster Widget', 'a8c-developer'), 'active' => class_exists('Monster_Widget')), 'user-switching' => array('project_type' => 'all', 'name' => esc_html__('User Switching', 'a8c-developer'), 'active' => class_exists('user_switching')), 'piglatin' => array('project_type' => array('wporg-theme', 'wporg'), 'name' => esc_html__('Pig Latin', 'a8c-developer'), 'active' => class_exists('PigLatin')), 'rtl-tester' => array('project_type' => 'wporg-theme', 'name' => esc_html__('RTL Tester', 'a8c-developer'), 'active' => class_exists('RTLTester')), 'regenerate-thumbnails' => array('project_type' => 'wporg-theme', 'name' => esc_html__('Regenerate Thumbnails', 'a8c-developer'), 'active' => class_exists('RegenerateThumbnails')), 'simply-show-ids' => array('project_type' => 'wporg-theme', 'name' => esc_html__('Simply Show IDs', 'a8c-developer'), 'active' => function_exists('ssid_add')), 'theme-test-drive' => array('project_type' => 'wporg-theme', 'name' => esc_html__('Theme Test Drive', 'a8c-developer'), 'active' => function_exists('TTD_filters'), 'filename' => 'themedrive.php'), 'theme-check' => array('project_type' => 'wporg-theme', 'name' => esc_html__('Theme Check', 'a8c-developer'), 'active' => function_exists('tc_add_headers')));
if (!self::is_dev_version()) {
$this->recommended_plugins['wordpress-beta-tester'] = array('project_type' => 'all', 'name' => esc_html__('Beta Tester', 'a8c-developer'), 'active' => class_exists('wp_beta_tester'), 'filename' => 'wp-beta-tester.php');
}
$this->recommended_constants = array('WP_DEBUG' => array('project_type' => 'all', 'description' => __('Enables <a href="http://codex.wordpress.org/Debugging_in_WordPress" target="_blank">debug mode</a> which helps identify and resolve issues', 'a8c-developer')), 'SAVEQUERIES' => array('project_type' => 'all', 'description' => esc_html__('Logs database queries to an array so you can review them. The Debug Bar plugin will list out database queries if you set this constant.', 'a8c-developer')), 'JETPACK_DEV_DEBUG' => array('project_type' => 'wpcom-vip', 'description' => __('Enables <a href="http://jetpack.me/2013/03/28/jetpack-dev-mode-release/">Development Mode</a> in Jetpack for testing features without a connection to WordPress.com.', 'a8c-developer')));
register_setting(self::OPTION, self::OPTION, array($this, 'settings_validate'));
wp_register_script('a8c-developer', plugins_url('developer.js', __FILE__), array('jquery'), self::VERSION);
$strings = array('settings_slug' => self::PAGE_SLUG, 'go_to_step_2' => current_user_can('install_plugins') && current_user_can('activate_plugins') && 'direct' == get_filesystem_method() ? 'yes' : 'no', 'lightbox_title' => __('Developer: Plugin Setup', 'a8c-developer'), 'saving' => __('Saving...', 'a8c-developer'), 'installing' => '<img src="images/loading.gif" alt="" /> ' . esc_html__('Installing...', 'a8c-developer'), 'installed' => __('Installed', 'a8c-developer'), 'activating' => '<img src="images/loading.gif" alt="" /> ' . esc_html__('Activating...', 'a8c-developer'), 'activated' => __('Activated', 'a8c-developer'), 'error' => __('Error!', 'a8c-developer'), 'ACTIVE' => __('ACTIVE', 'a8c-developer'), 'INSTALLED' => __('INSTALLED', 'a8c-developer'), 'ERROR' => __('ERROR!', 'a8c-developer'));
wp_localize_script('a8c-developer', 'a8c_developer_i18n', $strings);
wp_register_style('a8c-developer', plugins_url('developer.css', __FILE__), array(), self::VERSION);
// Handle the submission of the lightbox form if step 2 won't be shown
if (!empty($_POST['action']) && 'a8c_developer_lightbox_step_1' == $_POST['action'] && !empty($_POST['a8c_developer_project_type']) && check_admin_referer('a8c_developer_lightbox_step_1')) {
$this->save_project_type($_POST['a8c_developer_project_type']);
add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
}
if (!get_option(self::OPTION)) {
if (!empty($_GET['a8cdev_errorsaving'])) {
add_settings_error(self::PAGE_SLUG, self::PAGE_SLUG . '_error_saving', __('Error saving settings. Please try again.', 'a8c-developer'));
} elseif (!is_network_admin() && current_user_can('manage_options')) {
add_action('admin_enqueue_scripts', array($this, 'load_lightbox_scripts_and_styles'));
add_action('admin_footer', array($this, 'output_setup_box_html'));
}
}
}
示例2: admin_init
public function admin_init()
{
$this->recommended_plugins = array('debug-bar' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar', 'a8c-developer'), 'active' => class_exists('Debug_Bar')), 'debug-bar-cron' => array('project_type' => 'all', 'name' => esc_html__('Debug Bar Cron', 'a8c-developer'), 'active' => function_exists('zt_add_debug_bar_cron_panel')), 'rewrite-rules-inspector' => array('project_type' => 'all', 'name' => esc_html__('Rewrite Rules Inspector', 'a8c-developer'), 'active' => class_exists('Rewrite_Rules_Inspector')), 'log-deprecated-notices' => array('project_type' => 'all', 'name' => esc_html__('Log Deprecated Notices', 'a8c-developer'), 'active' => class_exists('Deprecated_Log')), 'vip-scanner' => array('project_type' => 'all', 'name' => esc_html__('VIP Scanner', 'a8c-developer'), 'active' => class_exists('VIP_Scanner')), 'grunion-contact-form' => array('project_type' => 'wpcom-vip', 'name' => esc_html__('Grunion Contact Form', 'a8c-developer'), 'active' => defined('GRUNION_PLUGIN_DIR')), 'polldaddy' => array('project_type' => 'wpcom-vip', 'name' => esc_html__('Polldaddy Polls & Ratings', 'a8c-developer'), 'active' => class_exists('WP_Polldaddy')), 'monster-widget' => array('project_type' => 'all', 'name' => esc_html__('Monster Widget', 'a8c-developer'), 'active' => class_exists('Monster_Widget')), 'wordpress-beta-tester' => array('project_type' => 'all', 'name' => esc_html__('Beta Tester', 'a8c-developer'), 'active' => class_exists('wp_beta_tester'), 'filename' => 'wp-beta-tester.php'));
$this->recommended_constants = array('WP_DEBUG' => __('Enables <a href="http://codex.wordpress.org/Debugging_in_WordPress" target="_blank">debug mode</a> which helps identify and resolve issues', 'a8c-developer'), 'SAVEQUERIES' => esc_html__('Logs database queries to an array so you can review them. The Debug Bar plugin will list out database queries if you set this constant.', 'a8c-developer'));
register_setting(self::OPTION, self::OPTION, array($this, 'settings_validate'));
wp_register_script('a8c-developer', plugins_url('developer.js', __FILE__), array('jquery'), self::VERSION);
$strings = array('settings_slug' => self::PAGE_SLUG, 'go_to_step_2' => current_user_can('install_plugins') && current_user_can('activate_plugins') && 'direct' == get_filesystem_method() ? 'yes' : 'no', 'lightbox_title' => __('Developer: Plugin Setup', 'a8c-developer'), 'saving' => __('Saving...', 'a8c-developer'), 'installing' => '<img src="images/loading.gif" alt="" /> ' . esc_html__('Installing...', 'a8c-developer'), 'installed' => __('Installed', 'a8c-developer'), 'activating' => '<img src="images/loading.gif" alt="" /> ' . esc_html__('Activating...', 'a8c-developer'), 'activated' => __('Activated', 'a8c-developer'), 'error' => __('Error!', 'a8c-developer'), 'ACTIVE' => __('ACTIVE', 'a8c-developer'), 'INSTALLED' => __('INSTALLED', 'a8c-developer'), 'ERROR' => __('ERROR!', 'a8c-developer'));
wp_localize_script('a8c-developer', 'a8c_developer_i18n', $strings);
wp_register_style('a8c-developer', plugins_url('developer.css', __FILE__), array(), self::VERSION);
// Handle the submission of the lightbox form if step 2 won't be shown
if (!empty($_POST['a8c_developer_action'])) {
if ('lightbox_step_1' == $_POST['a8c_developer_action'] && !empty($_POST['a8c_developer_project_type']) && check_admin_referer('a8c_developer_action_lightbox_step_1')) {
$this->save_project_type($_POST['a8c_developer_project_type']);
add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
}
}
if (!get_option(self::OPTION)) {
if (!empty($_GET['a8cdev_errorsaving'])) {
add_settings_error(self::PAGE_SLUG, self::PAGE_SLUG . '_error_saving', __('Error saving settings. Please try again.', 'a8c-developer'));
} elseif (current_user_can('manage_options')) {
add_action('admin_enqueue_scripts', array($this, 'load_lightbox_scripts_and_styles'));
add_action('admin_footer', array($this, 'output_setup_box_html'));
}
}
}
示例3: install_branch
public function install_branch()
{
include_once ABSPATH . '/wp-admin/includes/file.php';
if (get_filesystem_method() === 'direct' && !is_dir(WP_CONTENT_DIR . '/thesis') && is_dir(THESIS_SKINS)) {
// first, set up wp_filesystem
WP_Filesystem();
$f = $GLOBALS['wp_filesystem'];
// directories
$directories = array('thesis/', 'thesis/boxes/', 'thesis/packages/', 'thesis/skins/');
foreach ($directories as $dir) {
$f->mkdir($f->wp_content_dir() . $dir);
}
// master.php
$f->put_contents($f->wp_content_dir() . 'thesis/master.php', "<?php\n// This is the Thesis master.php file.\n// Use this file to affect every site on your network.\n// Note: this is the last file included in Thesis!\n");
// move skins
$from = trailingslashit($f->find_folder(THESIS_SKINS));
$to = $f->wp_content_dir() . 'thesis/skins/';
$skins = array_keys($f->dirlist($from));
foreach ($skins as $skin) {
$f->move($from . $skin, $to . $skin);
if (!$f->exists($to . $skin . '/images')) {
$f->mkdir($to . $skin . '/images');
}
if (!$f->exists($to . $skin . '/custom.php')) {
$f->put_contents($to . $skin . '/custom.php', "<?php\n/*\n\tThis file is for skin specific customizations. Be careful not to change your skin's skin.php file as that will be upgraded in the future and your work will be lost.\n\tIf you are more comfortable with PHP, we recommend using the super powerful Thesis Box system to create elements that you can interact with in the Thesis HTML Editor.\n*/");
}
}
// clean up
if (($lib = array_keys($f->dirlist(THESIS_SKINS))) && empty($lib)) {
$f->delete(THESIS_SKINS);
}
}
}
示例4: render
function render()
{
$css = $this->ctc()->css;
$themes = $this->ctc()->themes;
$child = $css->get_prop('child');
$hidechild = count($themes['child']) ? '' : 'style="display:none"';
$enqueueset = isset($css->enqueue) && $child;
$this->ctc()->debug('Enqueue set: ' . ($enqueueset ? 'TRUE' : 'FALSE'), __FUNCTION__);
if (empty($css->nowarn)) {
$this->parent_theme_check();
}
$imports = $css->get_prop('imports');
$id = 0;
$this->ctc()->fs_method = get_filesystem_method();
add_thickbox();
add_filter('chld_thm_cfg_files_tab_filter', array($this, 'render_files_tab_options'));
add_action('chld_thm_cfg_tabs', array($this, 'render_addl_tabs'), 10, 4);
add_action('chld_thm_cfg_panels', array($this, 'render_addl_panels'), 10, 4);
add_action('chld_thm_cfg_related_links', array($this, 'lilaea_plug'));
if ($this->ctc()->is_debug) {
$this->ctc()->debug('adding new debug action...', __FUNCTION__);
add_action('chld_thm_cfg_print_debug', array($this->ctc(), 'print_debug'));
}
include CHLD_THM_CFG_DIR . '/includes/forms/main.php';
}
示例5: is_server_writable
function is_server_writable()
{
if ((!defined('FTP_HOST') || !defined('FTP_USER') || !defined('FTP_PASS')) && get_filesystem_method(array(), ABSPATH) != 'direct') {
return false;
} else {
return true;
}
}
示例6: pre_check_custom_css_writable
/**
* Check custom css directory
*/
function pre_check_custom_css_writable()
{
// custom css directory
$the_dir = get_template_directory() . "/lib/css";
if (!get_filesystem_method(array(), $the_dir) == "direct") {
add_action("admin_notices", "pre_notice_custom_css_permission");
}
}
示例7: check_filesystem_api
public static function check_filesystem_api()
{
global $gfpdfe_data;
$access_type = get_filesystem_method();
$gfpdfe_data->automated = false;
if ($access_type === 'direct') {
$gfpdfe_data->automated = true;
}
}
示例8: get_creds
private function get_creds()
{
$access_type = get_filesystem_method();
if ($access_type === 'direct') {
$creds = request_filesystem_credentials(site_url() . '/wp-admin/', '', false, false, array());
} else {
$creds = $this->get_ftp_creds($access_type);
}
return $creds;
}
示例9: __construct
public function __construct()
{
require_once ABSPATH . 'wp-admin/includes/file.php';
$upload_dir = wp_upload_dir();
if (get_filesystem_method(array(), $upload_dir['basedir']) !== 'direct' || !WP_Filesystem(request_filesystem_credentials(admin_url()))) {
self::$useFS = false;
add_action('wp_ajax_wpservefile', array($this, 'serve_file'));
add_action('wp_ajax_nopriv_wpservefile', array($this, 'serve_file'));
} else {
self::$useFS = true;
}
}
示例10: can_write_files
function can_write_files()
{
$access_type = get_filesystem_method();
ob_start();
$creds = request_filesystem_credentials(site_url() . '/wp-admin/', '', false, false, null);
$_c = ob_get_clean();
if ($access_type === 'direct' || WP_Filesystem($creds)) {
return true;
}
$this->errors[] = "WordPress does not have access to it's own file system!";
$this->consequences[] = "Images, CSS Files, Cache Files will be included with an alternative inline method, which is slower.";
$this->solutions[] = "\r\n <ol>\r\n <li>\r\n You will have to fill in FTP credentials into the wp-config.php file.<br><br>\r\n <strong>define( 'FTP_USER', 'username' );<br>\r\n define( 'FTP_PASS', 'password' );<br>\r\n define( 'FTP_HOST', 'ftp.example.org' );</strong> <br><br>\r\n In some cases more constants might be required. <br>\r\n Please read: <a href='https://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants'>WordPress Upgrage Constants</a> \r\n </li>\r\n <li>\r\n ADVANCED USERS ONLY!<br><br>\r\n Change ownership of the WordPress directory and all of its contents via SSH for the <strong>www-data</strong> process.<br><br>\r\n \r\n <a href='http://stackoverflow.com/questions/18352682/correct-file-permissions-for-wordpress'>Changing Ownership if WordPress is in the ROOT directory</a>\r\n </li>\r\n </ol>";
return false;
}
示例11: update_theme
function update_theme()
{
if (isset($_REQUEST['page'])) {
// Sanitize page being requested.
$_page = esc_attr($_REQUEST['page']);
if ('spyropress-update' == $_page) {
//Setup Filesystem
$method = get_filesystem_method();
if (isset($_POST['spyropress_ftp_cred'])) {
$cred = spyropress_decode($_POST['spyropress_ftp_cred']);
$filesystem = WP_Filesystem($cred);
} else {
$filesystem = WP_Filesystem();
}
if (false == $filesystem && 'Proceed' != $_POST['upgrade']) {
add_error_message(sprintf(__('Failed: Filesystem preventing downloads. (%s)', 'spyropress'), $method));
return;
}
if (isset($_REQUEST['spyropress_updater'])) {
// Sanitize action being requested.
$_action = esc_attr($_REQUEST['spyropress_updater']);
if ('framework' == $_action) {
locate_template('framework/utilities/envato/class-envato-wordpress-theme-upgrader.php', true);
$envato_api_key = get_option('_spyropress_envato_api_key_' . get_internal_name());
$envato_username = get_option('_spyropress_envato_username_' . get_internal_name());
$upgrader = new Envato_WordPress_Theme_Upgrader($envato_username, $envato_api_key);
$result = $upgrader->upgrade_theme();
// Successfully Updated
if ($result->success) {
$message = __('New version successfully downloaded, extracted and updated.', 'spyropress');
$message .= '<script type="text/javascript">
//<![CDATA[
window.location.replace("' . admin_url('admin.php?page=spyropress-update') . '");
//]]>
</script>';
add_success_message($message);
} else {
add_error_message($result->errors[0]);
}
}
}
}
// END UPDATE HERE
}
}
示例12: file_system_write_access
/**
* Returns true if the site has file write access false otherwise.
* @return string ( '1' | '0' )
**/
public static function file_system_write_access()
{
if (!function_exists('get_filesystem_method')) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}
require_once ABSPATH . 'wp-admin/includes/template.php';
$filesystem_method = get_filesystem_method();
if ($filesystem_method === 'direct') {
return 1;
}
ob_start();
$filesystem_credentials_are_stored = request_filesystem_credentials(self_admin_url());
ob_end_clean();
if ($filesystem_credentials_are_stored) {
return 1;
}
return 0;
}
示例13: vstrsnln_insert_rows
function vstrsnln_insert_rows($number_file = false, $noscript = false)
{
global $wpdb, $wp_filesystem;
if (false == $noscript) {
check_ajax_referer('bws_plugin', 'vstrsnln_ajax_nonce_field');
}
$prefix_bws = $wpdb->base_prefix . 'bws_';
$vstrsnln_access_type = get_filesystem_method();
if ($vstrsnln_access_type == 'direct') {
$vstrsnln_creds = request_filesystem_credentials(site_url() . '/wp-admin/', '', false, false, array());
if (!WP_Filesystem($vstrsnln_creds)) {
if ($number_file == false) {
echo false;
} else {
return false;
}
}
if ($number_file == false) {
if (isset($_POST['count']) && file_exists(plugin_dir_path(__FILE__) . 'file_' . $_POST['count'] . '.csv')) {
$filename = plugin_dir_path(__FILE__) . 'file_' . $_POST['count'] . '.csv';
$data_array = $wp_filesystem->get_contents_array($filename);
if (false !== $data_array && is_array($data_array) && !empty($data_array)) {
$sql = "INSERT IGNORE INTO `" . $prefix_bws . "country`\n ( `ip_from`, `ip_to`, `ip_from_int`, `ip_to_int`, `short_country`, `name_country` )\n VALUES ( " . implode(" ) , ( ", $data_array) . " );";
$result = $wpdb->query($sql);
unlink($filename);
echo $result;
}
}
} else {
if ($number_file > 0 && file_exists(plugin_dir_path(__FILE__) . 'file_' . $number_file . '.csv')) {
$filename = plugin_dir_path(__FILE__) . 'file_' . $number_file . '.csv';
$data_array = $wp_filesystem->get_contents_array($filename);
if (false !== $data_array && is_array($data_array) && !empty($data_array)) {
$sql = "INSERT IGNORE INTO `" . $prefix_bws . "country`\n ( `ip_from`, `ip_to`, `ip_from_int`, `ip_to_int`, `short_country`, `name_country` )\n VALUES ( " . implode(" ) , ( ", $data_array) . " );";
$result = $wpdb->query($sql);
unlink($filename);
return $result;
}
}
}
}
/* This is required to terminate immediately and return a proper response */
wp_die();
}
示例14: _getFileSystem
/**
* @return WP_Filesystem_Direct
*/
private function _getFileSystem()
{
if (!function_exists('get_filesystem_method')) {
require_once ABSPATH . '/wp-admin/includes/file.php';
$fileSystem = WP_Filesystem();
} else {
global $wp_filesystem;
$fileSystem = $wp_filesystem;
}
$method = get_filesystem_method();
if ($method != 'direct') {
$notificationText = __('Fresh Framework requires File System Direct to install itself. If you cant achieve this, ', 'zero');
$notificationText .= _('please install Fresh Framework plugin, otherwise our theme will not work<br><br>', 'zero');
$notificationText .= __('Plugin could be found here: ', 'zero') . get_template_directory() . '/install/fresh-framework.zip';
$this->_addNotification($notificationText);
return false;
}
return $fileSystem;
}
示例15: render
function render()
{
// load web fonts for this theme
if ($imports = $this->css()->get_prop('imports')) {
$ext = 0;
foreach ($imports as $import) {
$this->ctc()->convert_import_to_enqueue($import, ++$ext, TRUE);
}
}
$themes = $this->ctc()->themes;
$child = $this->css()->get_prop('child');
$hidechild = apply_filters('chld_thm_cfg_hidechild', count($themes['child']) ? '' : 'style="display:none"');
$enqueueset = isset($this->css()->enqueue) && $child;
$this->ctc()->debug('Enqueue set: ' . ($enqueueset ? 'TRUE' : 'FALSE'), __FUNCTION__, __CLASS__);
$imports = $this->css()->get_prop('imports');
$id = 0;
$this->ctc()->fs_method = get_filesystem_method();
add_thickbox();
include CHLD_THM_CFG_DIR . '/includes/forms/main.php';
}